source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
spec/unit/postmark/mail_message_converter_spec.rb
Ruby
mit
228
main
12,673
# encoding: utf-8 require 'spec_helper' describe Postmark::MailMessageConverter do subject {Postmark::MailMessageConverter} let(:mail_message) do Mail.new do from "sheldon@bigbangtheory.com" to "lenard@bigbangtheory.com" subject "Hello!" body "Hello Sheldon!" end end let(:mail...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
spec/unit/postmark/error_spec.rb
Ruby
mit
228
main
7,724
require 'spec_helper' describe(Postmark::Error) do it {is_expected.to be_a(StandardError)} end describe(Postmark::HttpClientError) do it {is_expected.to be_a(Postmark::Error)} it {expect(subject.retry?).to be true} end describe(Postmark::HttpServerError) do it {is_expected.to be_a(Postmark::Error)} descri...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
spec/unit/postmark/client_spec.rb
Ruby
mit
228
main
1,507
require 'spec_helper' describe Postmark::Client do subject { Postmark::Client.new('abcd-efgh') } describe 'instance' do describe '#find_each' do let(:path) { 'resources' } let(:name) { 'Resources' } let(:response) { { 'TotalCount' => 10, name => [{'Foo' => 'bar'},...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
spec/unit/postmark/api_client_spec.rb
Ruby
mit
228
main
45,166
require 'spec_helper' describe Postmark::ApiClient do let(:api_client) {Postmark::ApiClient.new(api_token)} let(:api_token) {"provided-api-token"} let(:message_hash) {{:from => "support@postmarkapp.com"}} let(:message) do Mail.new do from "support@postmarkapp.com" delivery_method Mail::Postmark...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
spec/unit/postmark/inbound_spec.rb
Ruby
mit
228
main
4,815
require 'spec_helper' describe Postmark::Inbound do # http://developer.postmarkapp.com/developer-inbound-parse.html#example-hook let(:example_inbound) { '{"From":"myUser@theirDomain.com","FromFull":{"Email":"myUser@theirDomain.com","Name":"John Doe"},"To":"451d9b70cf9364d23ff6f9d51d870251569e+ahoy@inbound.postmark...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
spec/unit/postmark/inflector_spec.rb
Ruby
mit
228
main
1,195
require 'spec_helper' describe Postmark::Inflector do describe ".to_postmark" do it 'converts rubyish underscored format to camel cased symbols accepted by the Postmark API' do expect(subject.to_postmark(:foo_bar)).to eq 'FooBar' expect(subject.to_postmark(:_bar)).to eq 'Bar' expect(subject.to_...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
spec/unit/postmark/account_api_client_spec.rb
Ruby
mit
228
main
26,487
require 'spec_helper' describe Postmark::AccountApiClient do let(:api_token) { 'abcd-efgh' } subject { Postmark::AccountApiClient} it 'can be created with an API token' do expect { subject.new(api_token) }.not_to raise_error end it 'can be created with an API token and options hash' do expect { sub...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
spec/unit/postmark/helpers/hash_helper_spec.rb
Ruby
mit
228
main
2,688
require 'spec_helper' describe Postmark::HashHelper do describe ".to_postmark" do let(:source) do { :level_one => { :level_two => { :level_three => [{ :array_item => 1 }] } } } end describe 'default behaviour' do let(:target) do {...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
spec/unit/postmark/helpers/message_helper_spec.rb
Ruby
mit
228
main
6,029
require 'spec_helper' describe Postmark::MessageHelper do let(:attachments) { [ File.open(empty_gif_path), {:name => "img2.gif", :content => Postmark::MessageHelper.encode_in_base64(File.read(empty_gif_path)), :content_type => "application/octet-stream"} ] } let(:postmark_attac...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
spec/unit/postmark/handlers/mail_spec.rb
Ruby
mit
228
main
2,633
require 'spec_helper' describe Mail::Postmark do let(:message) do Mail.new do from "sheldon@bigbangtheory.com" to "lenard@bigbangtheory.com" subject "Hello!" body "Hello Sheldon!" end end before do message.delivery_method Mail::Postmark end subject(:handler) {...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
spec/unit/postmark/message_extensions/mail_spec.rb
Ruby
mit
228
main
11,321
require 'spec_helper' describe Mail::Message do before do allow(Kernel).to receive(:warn) end let(:mail_message) do Mail.new do from "sheldon@bigbangtheory.com" to "lenard@bigbangtheory.com" subject "Hello!" body "Hello Sheldon!" end end let(:mail_html_message...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
spec/support/shared_examples.rb
Ruby
mit
228
main
2,077
shared_examples :mail do it "set text body for plain message" do expect(Postmark.send(:convert_message_to_options_hash, subject)['TextBody']).not_to be_nil end it "encode from properly when name is used" do subject.from = "Sheldon Lee Cooper <sheldon@bigbangtheory.com>" expect(subject).to be_serializ...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
spec/support/helpers.rb
Ruby
mit
228
main
259
module Postmark module RSpecHelpers def empty_gif_path File.join(File.dirname(__FILE__), '..', 'data', 'empty.gif') end def encoded_empty_gif_data Postmark::MessageHelper.encode_in_base64(File.read(empty_gif_path)) end end end
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
spec/support/custom_matchers.rb
Ruby
mit
228
main
1,029
RSpec::Matchers.define :a_postmark_json do |string| def postmark_key?(key) key == ::Postmark::Inflector.to_postmark(key) end def postmark_object?(obj) case obj when Hash return false unless obj.keys.all? { |k| postmark_key?(k) } return false unless obj.values.all? { |v| postmark_object?(v...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
spec/integration/api_client_resources_spec.rb
Ruby
mit
228
main
1,952
require 'spec_helper' describe 'Accessing server resources using the API' do let(:api_client) {Postmark::ApiClient.new(ENV['POSTMARK_API_KEY'], :http_open_timeout => 15)} let(:recipient) {ENV['POSTMARK_CI_RECIPIENT']} let(:message) { { :from => ENV['POSTMARK_CI_SENDER'], :to => recipient, ...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
spec/integration/mail_delivery_method_spec.rb
Ruby
mit
228
main
2,869
require 'spec_helper' describe "Sending Mail::Messages with delivery_method Mail::Postmark" do let(:postmark_message_id_format) { /\w{8}\-\w{4}-\w{4}-\w{4}-\w{12}/ } let(:message) { Mail.new do from "sender@postmarkapp.com" to "recipient@postmarkapp.com" subject "Mail::Message object" ...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
spec/integration/account_api_client_spec.rb
Ruby
mit
228
main
4,211
require 'spec_helper' describe 'Account API client usage' do subject { Postmark::AccountApiClient.new(ENV['POSTMARK_ACCOUNT_API_KEY'], :http_open_timeout => 15, :http_read_timeout => 15) } let(:unique_token) { rand(36**32).to_s(...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
spec/integration/api_client_messages_spec.rb
Ruby
mit
228
main
4,168
require 'spec_helper' describe "Sending Mail::Messages with Postmark::ApiClient" do let(:postmark_message_id_format) { /\w{8}\-\w{4}-\w{4}-\w{4}-\w{12}/ } let(:api_client) { Postmark::ApiClient.new('POSTMARK_API_TEST', :http_open_timeout => 15, :http_read_timeout => 15) } let(:message) { Mail.new do f...
github
ActiveCampaign/postmark-gem
https://github.com/ActiveCampaign/postmark-gem
spec/integration/api_client_hashes_spec.rb
Ruby
mit
228
main
2,976
require 'spec_helper' describe "Sending messages as Ruby hashes with Postmark::ApiClient" do let(:message_id_format) {/<.+@.+>/} let(:postmark_message_id_format) {/\w{8}\-\w{4}-\w{4}-\w{4}-\w{12}/} let(:api_client) {Postmark::ApiClient.new('POSTMARK_API_TEST', :http_open_timeout => 15, :http_read_timeout => 15)}...
github
godfat/rib
https://github.com/godfat/rib
Rakefile
Ruby
apache-2.0
228
master
340
begin require "#{__dir__}/task/gemgem" rescue LoadError sh 'git submodule update --init --recursive' exec Gem.ruby, '-S', $PROGRAM_NAME, *ARGV end Gemgem.init(__dir__) do |s| require 'rib/version' s.name = 'rib' s.version = Rib::VERSION %w[screenshot.png asciicast.json].each do |file| s.files.dele...
github
godfat/rib
https://github.com/godfat/rib
Gemfile
Ruby
apache-2.0
228
master
244
source 'https://rubygems.org' gemspec gem 'rake' gem 'pork' gem 'muack' gem 'bond' gem 'hirb' gem 'simplecov', :require => false if ENV['COV'] gem 'coveralls', :require => false if ENV['CI'] platforms :ruby do gem 'readline_buffer' end
github
godfat/rib
https://github.com/godfat/rib
rib.gemspec
Ruby
apache-2.0
228
master
4,312
# -*- encoding: utf-8 -*- # stub: rib 1.6.3 ruby lib Gem::Specification.new do |s| s.name = "rib".freeze s.version = "1.6.3".freeze s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= s.require_paths = ["lib".freeze] s.authors = ["Lin Jen-Shin (godf...
github
godfat/rib
https://github.com/godfat/rib
test/test_shell.rb
Ruby
apache-2.0
228
master
4,265
require 'rib/test' require 'rib/shell' describe Rib::Shell do paste :rib describe '#loop' do def input str=Rib::Skip mock(shell).get_input{if block_given? then yield else str end} shell.loop ok end would 'exit' do input('exit' ) end would 'also ...
github
godfat/rib
https://github.com/godfat/rib
test/test_runner.rb
Ruby
apache-2.0
228
master
961
require 'rib/test' require 'rib/runner' describe Rib::Runner do paste :rib before do mock(Rib).shell{ shell }.times(2) end def input *args args.each{ |item| mock(shell).get_input{ item } } mock(shell).get_input{} end def output *args args.each{ |item| mock(shell).puts("=> #{item}"){} } ...
github
godfat/rib
https://github.com/godfat/rib
test/test_plugin.rb
Ruby
apache-2.0
228
master
1,256
require 'rib/test' require 'rib/all' describe Rib::Plugin do paste :rib before do @names = Dir[File.expand_path( "#{File.dirname(__FILE__)}/../lib/rib/{core,more,zore}/*.rb")]. map {|path| File.basename(path)[0..-4] } @mods = Rib.plugins end would ...
github
godfat/rib
https://github.com/godfat/rib
test/test_api.rb
Ruby
apache-2.0
228
master
1,153
require 'rib/test' require 'rib/shell' describe Rib::API do paste :rib Rib::API.instance_methods.delete_if{ |e| e[/=$/] }.each do |meth| would "##{meth} be accessible to plugins" do mod = Module.new do define_method meth do "pong_#{meth}" end end klass = Rib::Shell....
github
godfat/rib
https://github.com/godfat/rib
test/extra/test_autoindent.rb
Ruby
apache-2.0
228
master
4,561
require 'rib/test' require 'rib/extra/autoindent' describe Rib::Autoindent do paste :rib autoindent = Class.new do include Rib::Autoindent, Rib::Multiline, Rib::API def config {:line => 0, :binding => TOPLEVEL_BINDING, :prompt => '>> '} end def stack_size autoindent_stack.size end ...
github
godfat/rib
https://github.com/godfat/rib
test/core/test_squeeze_history.rb
Ruby
apache-2.0
228
master
1,060
require 'rib/test' require 'rib/test/history' require 'rib/core/squeeze_history' describe Rib::SqueezeHistory do paste :rib paste :setup_history test_for Rib::History, Rib::SqueezeHistory do before do @input = %w[foo bar bar foo bar] end would 'after_loop saves squeezed history' do shel...
github
godfat/rib
https://github.com/godfat/rib
test/core/test_readline.rb
Ruby
apache-2.0
228
master
381
require 'rib/test' require 'rib/core/readline' describe Rib::Readline do paste :rib test_for Rib::Readline do would '#before_loop set @history' do expect(shell.history).eq Readline::HISTORY end would '#get_input calling Readline.readline' do mock(Readline).readline(shell.prompt, true){'ok...
github
godfat/rib
https://github.com/godfat/rib
test/core/test_history.rb
Ruby
apache-2.0
228
master
1,390
require 'rib/test' require 'rib/test/history' require 'rib/core/history' describe Rib::History do paste :rib paste :setup_history test_for Rib::History do would '#after_loop save history' do inputs = %w[blih blah] shell.history.push(*inputs) shell.after_loop expect(File.read(histor...
github
godfat/rib
https://github.com/godfat/rib
test/core/test_last_value.rb
Ruby
apache-2.0
228
master
680
require 'rib/test' require 'rib/core/last_value' describe Rib::LastValue do paste :rib before do stub_output stub(Rib).shell{shell} end test_for Rib::LastValue do would 'set last_value' do mock(shell).get_input{'Rib.last_value'} mock(shell).get_input{'10**2'} mock(shell).get_inp...
github
godfat/rib
https://github.com/godfat/rib
test/core/test_multiline.rb
Ruby
apache-2.0
228
master
205
require 'rib/test' require 'rib/test/multiline' require 'rib/core/multiline' describe Rib::Multiline do paste :rib paste :setup_multiline test_for Rib::Multiline do paste :multiline end end
github
godfat/rib
https://github.com/godfat/rib
test/core/test_strip_backtrace.rb
Ruby
apache-2.0
228
master
519
require 'rib/test' require 'rib/core/strip_backtrace' describe Rib::StripBacktrace do would 'strip home' do backtrace = ["#{ENV['HOME']}/test", "/prefix/#{ENV['HOME']}/test"] expect(Rib::StripBacktrace.strip_home_backtrace(backtrace)). eq ['~/test', "/prefix/#{ENV['HOME']}/test"] end would 'strip...
github
godfat/rib
https://github.com/godfat/rib
test/core/test_completion.rb
Ruby
apache-2.0
228
master
469
require 'rib/test' require 'rib/core/completion' describe Rib::Completion do paste :rib before do Rib::Completion.enable end would 'start bond' do new_shell do |sh| eval_binding = sh.method(:eval_binding).source_location mock(Bond).start(having(eval_binding: is_a(Proc))).peek_args do |*a...
github
godfat/rib
https://github.com/godfat/rib
test/more/test_multiline_history.rb
Ruby
apache-2.0
228
master
1,004
require 'rib/test' require 'rib/test/multiline' require 'rib/more/multiline_history' describe Rib::MultilineHistory do paste :rib paste :setup_multiline def check str, err=nil shell.history.clear yield if block_given? with_history(str, err) @shell = nil stub_output shell.history.clear ...
github
godfat/rib
https://github.com/godfat/rib
test/more/test_anchor.rb
Ruby
apache-2.0
228
master
1,553
require 'rib/test' require 'rib/more/anchor' require 'rib/core/multiline' require 'rib/test/multiline' describe Rib::Anchor do paste :rib paste :setup_multiline before do Rib::Anchor.enable end describe '#anchor?' do would 'give true when anchoring' do stub(Rib).shell{shell} mock(shell...
github
godfat/rib
https://github.com/godfat/rib
test/more/test_beep.rb
Ruby
apache-2.0
228
master
907
require 'rib/test' require 'rib/more/beep' describe Rib::Beep do paste :rib before do Rib::Beep.enable end def verify delay, threshold=nil, &block shell(:started_at => Time.now - delay, :beep_threshold => threshold, &block) stub_output mock(shell).get_input{} shell.loop o...
github
godfat/rib
https://github.com/godfat/rib
test/more/test_caller.rb
Ruby
apache-2.0
228
master
229
require 'rib/test' require 'rib/more/caller' describe Rib::Caller do paste :rib test_for Rib::Caller do would 'puts some backtrace' do mock(Rib.shell).puts(is_a(String)){ ok } Rib.caller end end end
github
godfat/rib
https://github.com/godfat/rib
test/more/test_color.rb
Ruby
apache-2.0
228
master
1,886
require 'rib/test' require 'rib/more/color' describe Rib::Color do paste :rib before do Rib::Color.enable end color = Class.new do include Rib::Color def colors @colors ||= Rib::Shell.new.before_loop.config[:color] end def inspect_result result result.inspect end end.ne...
github
godfat/rib
https://github.com/godfat/rib
lib/rib.rb
Ruby
apache-2.0
228
master
3,927
# frozen_string_literal: true require 'rib/shell' require 'rib/version' module Rib Skip = Object.new module_function # All default Rib configs, would be passed to Shell.new in Rib.shell, # but calling Shell.new directly won't bring this in. # # @api public def config @config ||= {:name => 'rib', :p...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/runner.rb
Ruby
apache-2.0
228
master
5,806
# frozen_string_literal: true require 'rib' module Rib; module Runner module_function def options @options ||= [['ruby options:' , '' ], ['-e, --eval LINE' , 'Evaluate a LINE of code' ...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/plugin.rb
Ruby
apache-2.0
228
master
1,356
# frozen_string_literal: true module Rib; module Plugin attr_accessor :disabled def enable self.disabled = false if block_given? then yield else enabled? end ensure self.disabled = true if block_given? end def disable self.disabled = true if block_given? then yield else enabled? end e...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/api.rb
Ruby
apache-2.0
228
master
3,527
# frozen_string_literal: true module Rib; module API # Called before shell starts looping def before_loop self end # Called after shell finishes looping def after_loop self end # Handle interrupt (control-c) def handle_interrupt; puts ; end # The prompt string of this shell ...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/test.rb
Ruby
apache-2.0
228
master
2,573
# frozen_string_literal: true require 'pork/auto' require 'muack' Pork::Suite.include(Muack::API) require 'rib' copy :rib do before do Rib.disable_plugins end after do Muack.verify end def shell opts={} @shell ||= new_shell(opts) end def new_shell opts={} binding_object = Object.new...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/more.rb
Ruby
apache-2.0
228
master
376
# frozen_string_literal: true # upon session ends require 'rib/more/multiline_history_file' # upon formatting output require 'rib/more/bottomup_backtrace' require 'rib/more/color' # upon input require 'rib/more/multiline_history' # special tools require 'rib/more/anchor' require 'rib/more/caller' require 'rib/more/...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/shell.rb
Ruby
apache-2.0
228
master
2,725
# frozen_string_literal: true require 'rib/plugin' require 'rib/api' module Rib; class Shell include API def self.use mod include mod end attr_reader :config # Create a new shell. # # @api public # @param config [Hash] The config of the shell. # @option config [String] :config ('~/.rib/config...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/core.rb
Ruby
apache-2.0
228
master
347
# frozen_string_literal: true # before session starts require 'rib/core/completion' # upon session ends require 'rib/core/history' # upon formatting output require 'rib/core/strip_backtrace' # upon input require 'rib/core/readline' require 'rib/core/multiline' require 'rib/core/squeeze_history' # special tools req...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/more/multiline_history_file.rb
Ruby
apache-2.0
228
master
1,204
# frozen_string_literal: true require 'rib/more/multiline_history' module Rib; module MultilineHistoryFile extend Plugin Shell.use(self) # --------------- Rib API --------------- def before_loop return super if MultilineHistoryFile.disabled? multiline_history_file_token super end # --------...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/more/bottomup_backtrace.rb
Ruby
apache-2.0
228
master
404
# frozen_string_literal: true require 'rib' module Rib; module BottomupBacktrace extend Plugin Shell.use(self) # --------------- Rib API --------------- def format_error err return super if BottomupBacktrace.disabled? message, backtrace = get_error(err) " #{backtrace.join("\n ")}\n#{message}" ...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/more/anchor.rb
Ruby
apache-2.0
228
master
2,024
# frozen_string_literal: true require 'rib' module Rib; module Anchor extend Plugin Shell.use(self) # --------------- Rib API --------------- def prompt return super if Rib::Anchor.disabled? return super unless anchor? level = "(#{Rib.shells.size - 1})" if Rib.const_defined?(:Color) && ...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/more/multiline_history.rb
Ruby
apache-2.0
228
master
1,026
# frozen_string_literal: true require 'rib/core/history' # dependency require 'rib/core/multiline' # dependency module Rib; module MultilineHistory extend Plugin Shell.use(self) # --------------- Rib API --------------- def before_loop @multiline_trash = 0 super end def loop_eval input re...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/more/beep.rb
Ruby
apache-2.0
228
master
433
# frozen_string_literal: true require 'rib' module Rib; module Beep extend Plugin Shell.use(self) # --------------- Rib API --------------- def loop_once return super if Beep.disabled? beep if started_at && (Time.now - started_at) > beep_threshold config[:started_at] = Time.now super end ...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/more/color.rb
Ruby
apache-2.0
228
master
4,055
# frozen_string_literal: true require 'rib' module Rib; module Color extend Plugin Shell.use(self) # --------------- Rib API --------------- def before_loop colors super end def format_result result return super if Color.disabled? "#{result_prompt}#{format_color(result)}" end def g...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/more/edit.rb
Ruby
apache-2.0
228
master
666
# frozen_string_literal: true require 'rib' require 'tempfile' module Rib; module Edit extend Plugin Shell.use(self) module Imp def edit return if Rib::Edit.disabled? file = Tempfile.new(['rib.edit', '.rb']) file.puts(Rib.vars[:edit]) file.close shell = Rib.shell system...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/more/caller.rb
Ruby
apache-2.0
228
master
906
# frozen_string_literal: true require 'rib' module Rib; module Caller extend Plugin Shell.use(self) module Imp def caller *filters return if Rib::Caller.disabled? display_backtrace(super().drop(1), *filters) end def display_backtrace raw_backtrace, *filters backtrace = Rib.shell...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/extra/autoindent.rb
Ruby
apache-2.0
228
master
4,895
# frozen_string_literal: true require 'rib/core/history' # otherwise the order might be wrong require 'rib/core/readline' # dependency require 'rib/core/multiline' # dependency module Rib; module Autoindent extend Plugin Shell.use(self) # begin block could be simpler, because it should also trigger # Synt...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/extra/hirb.rb
Ruby
apache-2.0
228
master
614
# frozen_string_literal: true require 'rib' module Rib; module Hirb extend Plugin Shell.use(self) # --------------- Rib API --------------- def format_result result return super if Hirb.disabled? ::Hirb::View.view_or_page_output(result) || super end end begin Rib.silence{ require 'hirb' ...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/extra/byebug.rb
Ruby
apache-2.0
228
master
1,954
# frozen_string_literal: true require 'rib/more/anchor' require 'byebug/core' # This is based on lib/byebug/processors/pry_processor.rb module Rib; module Byebug extend Plugin Shell.use(self) def before_loop return super if Rib::Byebug.disabled? super # ::Byebug::RibProcessor.start end modul...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/extra/paging.rb
Ruby
apache-2.0
228
master
1,323
# frozen_string_literal: true require 'rib' module Rib; module Paging extend Plugin Shell.use(self) # --------------- Rib API --------------- # Print if the it fits one screen, paging it through a pager otherwise. def puts str='' return super if Paging.disabled? if one_screen?(str) super ...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/test/multiline.rb
Ruby
apache-2.0
228
master
3,062
# frozen_string_literal: true copy :setup_multiline do def setup_input str if readline? stub_readline(:mock) else mock($stdin).gets{ str.chomp } end end def input str setup_input(str) mock(shell).throw(:rib_multiline) end def input_done str, err=nil setup_input(str) ...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/test/history.rb
Ruby
apache-2.0
228
master
370
# frozen_string_literal: true require 'tempfile' copy :setup_history do before do if readline? ::Readline::HISTORY.clear stub_readline end shell(:history_file => history_file) end after do tempfile.unlink if @tempfile end def tempfile @tempfile ||= Tempfile.new('rib') en...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/app/rack.rb
Ruby
apache-2.0
228
master
643
# frozen_string_literal: true module Rib; module Rack singleton_class.module_eval{ attr_accessor :app } module_function def load load_rack rescue LoadError => e Rib.abort("Error: #{e}", "Is this a Rack app?") end def load_rack require 'rack' Rib.abort("Error: Cannot find config.ru") unles...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/app/auto.rb
Ruby
apache-2.0
228
master
497
# frozen_string_literal: true module Rib; module Auto module_function def load app, name = %w[rails rack].find{ |n| require "rib/app/#{n}" a = Rib.const_get(n.capitalize) break a, n if a.public_send("#{n}?") } if app Rib.say("Found #{name.capitalize}, loading it...") begi...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/app/rails.rb
Ruby
apache-2.0
228
master
3,023
# frozen_string_literal: true module Rib; module Rails module_function def load load_rails rescue LoadError => e Rib.abort("Error: #{e}", "Is this a Rails app?") end def load_rails require path_for('boot') if File.exist?(path_for('application.rb')) Rib::Rails.load_rails3 else ...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/core/strip_backtrace.rb
Ruby
apache-2.0
228
master
1,155
# frozen_string_literal: true require 'rib' module Rib; module StripBacktrace extend Plugin Shell.use(self) # --------------- Rib API --------------- def format_error err return super if StripBacktrace.disabled? message, backtrace = get_error(err) "#{message}\n #{backtrace.join("\n ")}" end ...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/core/history.rb
Ruby
apache-2.0
228
master
1,578
# frozen_string_literal: true require 'rib' require 'fileutils' module Rib; module History extend Plugin Shell.use(self) # --------------- Rib API --------------- def before_loop return super if History.disabled? history_file history_size FileUtils.mkdir_p(File.dirname(history_file_path)) ...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/core/multiline.rb
Ruby
apache-2.0
228
master
4,234
# frozen_string_literal: true require 'rib' # from https://github.com/janlelis/ripl-multi_line module Rib; module Multiline extend Plugin Shell.use(self) engine = if Object.const_defined?(:RUBY_ENGINE) RUBY_ENGINE else 'ruby' end # test those: # ruby -e '"' ...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/core/readline.rb
Ruby
apache-2.0
228
master
501
# frozen_string_literal: true require 'rib' require 'readline' module Rib; module Readline extend Plugin Shell.use(self) # --------------- Rib API --------------- def before_loop return super if Readline.disabled? config[:history] = ::Readline::HISTORY super end def get_input return sup...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/core/last_value.rb
Ruby
apache-2.0
228
master
538
# frozen_string_literal: true require 'rib' module Rib; module LastValue extend Plugin Shell.use(self) attr_reader :last_value, :last_exception def print_result result return super if LastValue.disabled? @last_value = result super end def print_eval_error err return super if LastValue.d...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/core/squeeze_history.rb
Ruby
apache-2.0
228
master
1,024
# frozen_string_literal: true require 'rib/core/history' # dependency module Rib; module SqueezeHistory extend Plugin Shell.use(self) # --------------- Rib API --------------- # squeeze history in memory too def loop_once return super if SqueezeHistory.disabled? begin input, last_input = his...
github
godfat/rib
https://github.com/godfat/rib
lib/rib/core/completion.rb
Ruby
apache-2.0
228
master
812
# frozen_string_literal: true require 'rib' module Rib; module Completion extend Plugin Shell.use(self) # --------------- Rib API --------------- def before_loop return super if Completion.disabled? config[:completion] ||= {} config[:completion][:gems] ||= [] config[:c...
github
hendrikschneider/jekyll-analytics
https://github.com/hendrikschneider/jekyll-analytics
spec_helper.rb
Ruby
mit
228
master
219
#Run unit test and coverage require 'simplecov' require 'simplecov-rcov' SimpleCov.start require_relative 'test/test_all' SimpleCov.coverage_dir 'spec/coverage' SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
github
hendrikschneider/jekyll-analytics
https://github.com/hendrikschneider/jekyll-analytics
jekyll-analytics.gemspec
Ruby
mit
228
master
649
Gem::Specification.new do |s| s.name = 'jekyll-analytics' s.version = '0.1.12' s.date = '2018-05-04' s.summary = "Jekyll plugin " s.description = "Plugin to easily add web analytics to your jekyll site without modifying your templates. Supported are: Google Analytics, Piwik, Matomo, MPul...
github
hendrikschneider/jekyll-analytics
https://github.com/hendrikschneider/jekyll-analytics
Gemfile
Ruby
mit
228
master
269
# frozen_string_literal: true source "https://rubygems.org" git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } group :test do gem "simplecov", "~> 0.17.1" gem "simplecov-rcov", "~> 0.2.3" gem "rake", "~> 13.0" gem "test-unit", "~> 3.4" end
github
hendrikschneider/jekyll-analytics
https://github.com/hendrikschneider/jekyll-analytics
lib/jekyll-analytics.rb
Ruby
mit
228
master
727
Dir[File.dirname(__FILE__) + '/analytics/*.rb'].each {|file| require file[0..-4] } CONFIG_KEY = "jekyll_analytics" def inject(site) if ENV['JEKYLL_ENV'] and site.site.config.has_key? CONFIG_KEY site.site.config[CONFIG_KEY].keys().each{ |a| analyzerClass = Module.const_get(a) config = site.site.confi...
github
hendrikschneider/jekyll-analytics
https://github.com/hendrikschneider/jekyll-analytics
lib/analytics/post_hog.rb
Ruby
mit
228
master
1,595
class PostHog SETUP_CODE = <<~SCRIPT <!-- PostHog START --> <script> !function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createEl...
github
hendrikschneider/jekyll-analytics
https://github.com/hendrikschneider/jekyll-analytics
lib/analytics/CounterDotDev.rb
Ruby
mit
228
master
681
class CounterDotDev def initialize(config) if config['user'].nil? raise ArgumentError, 'Please use your counter.dev "user"' end @user = config['user'] end def render() str = """ <!-- Counter.dev Analytics --> <script>if(!sessionStorage.getItem(\"_swa\")...
github
hendrikschneider/jekyll-analytics
https://github.com/hendrikschneider/jekyll-analytics
lib/analytics/Piwik.rb
Ruby
mit
228
master
1,354
class Piwik SETUP_CODE = """ <!-- Piwik --> <script type=\"text/javascript\"> var _paq = _paq || []; _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u='//'+\"%{url}\"; _paq.push(['setTrackerUrl', u+'/piwik.php']); _paq.push(['setSiteId', '%{site...
github
hendrikschneider/jekyll-analytics
https://github.com/hendrikschneider/jekyll-analytics
lib/analytics/plausible.rb
Ruby
mit
228
master
2,054
class Plausible def initialize(config) @domain = config['domain'] @source = config['source'] @host = config['host'] @not_found = !!config['404_tracking'] @embed = !!config['embed_tracker'] end def render() if @embed return "<script defer async>#{<...
github
hendrikschneider/jekyll-analytics
https://github.com/hendrikschneider/jekyll-analytics
lib/analytics/GoogleAnalytics.rb
Ruby
mit
228
master
1,377
class GoogleAnalytics #source: https://developers.google.com/analytics/devguides/collection/analyticsjs/ SETUP_CODE = """ <!-- Google Analytics --> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s....
github
hendrikschneider/jekyll-analytics
https://github.com/hendrikschneider/jekyll-analytics
lib/analytics/Matomo.rb
Ruby
mit
228
master
1,551
class Matomo SETUP_CODE = """ <!-- Matomo --> <!-- Matomo Image Tracker --> <noscript> <img src=\"//%{url}?idsite=%{siteId}&amp;rec=1\" style=\"border:0\" alt=\"\" /> </noscript> <!-- End Matomo --> <script type=\"text/javascript\"> var _paq = _paq || []; _paq.push(['tra...
github
hendrikschneider/jekyll-analytics
https://github.com/hendrikschneider/jekyll-analytics
lib/analytics/MPulse.rb
Ruby
mit
228
master
1,994
class MPulse #source: https://docs.soasta.com/boomerang/#mpulse-loader-snippet MPULSE_LOADER = """ <!-- mPulse --> <script> (function(API_KEY){ if (window.BOOMR && window.BOOMR.version) { return; } var dom, doc, where, iframe = document.createElement(\"iframe\"), win = window; function boomerangSa...
github
hendrikschneider/jekyll-analytics
https://github.com/hendrikschneider/jekyll-analytics
test/CounterDotDev.rb
Ruby
mit
228
master
1,432
require_relative "../lib/analytics/CounterDotDev.rb" require "test/unit" class TestCounterDotDev < Test::Unit::TestCase def test_init assert_raise( ArgumentError ) { CounterDotDev.new() } assert_instance_of(CounterDotDev, CounterDotDev.new( {"user" => "SomeUser"} )) end def test_default_tr...
github
hendrikschneider/jekyll-analytics
https://github.com/hendrikschneider/jekyll-analytics
test/mPulseTest.rb
Ruby
mit
228
master
2,142
require_relative "../lib/analytics/MPulse.rb" require "test/unit" class TestMPulse < Test::Unit::TestCase def test_init assert_raise( ArgumentError ) { MPulse.new( {"apikey" => "XXXXX-YYYYY-ZZZZZ-13456"} ) } assert_instance_of(MPulse, MPulse.new( {"apikey" => "XXXXX-YYYYY-ZZZZZ-AAAAA-23456"} )) ...
github
hendrikschneider/jekyll-analytics
https://github.com/hendrikschneider/jekyll-analytics
test/GoogleAnalyticsTest.rb
Ruby
mit
228
master
1,324
require_relative "../lib/analytics/GoogleAnalytics.rb" require "test/unit" class TestGoogleAnalytics < Test::Unit::TestCase def test_init assert_raise( ArgumentError ) { GoogleAnalytics.new( {"id" => "123-456"} ) } assert_instance_of(GoogleAnalytics, GoogleAnalytics.new( {"id" => "UA-123-456"} )) ...
github
hendrikschneider/jekyll-analytics
https://github.com/hendrikschneider/jekyll-analytics
test/MatomoTest.rb
Ruby
mit
228
master
1,527
require_relative "../lib/analytics/Matomo.rb" require "test/unit" class MatomoTest < Test::Unit::TestCase def test_init assert_raise( ArgumentError ) { Matomo.new( {"url" => "my.matomo.server/path/"}) } assert_raise( ArgumentError ) { Matomo.new( {"url" => "my.matomo.server/path", "siteId" => "a"})...
github
hendrikschneider/jekyll-analytics
https://github.com/hendrikschneider/jekyll-analytics
test/PiwikTest.rb
Ruby
mit
228
master
1,184
require_relative "../lib/analytics/Piwik.rb" require "test/unit" class PiwikTest < Test::Unit::TestCase def test_init assert_raise( ArgumentError ) { Piwik.new( {"url" => "my.piwik.server/path/"}) } assert_raise( ArgumentError ) { Piwik.new( {"url" => "my.piwik.server/path", "siteId" => "a"}) } ...
github
hendrikschneider/jekyll-analytics
https://github.com/hendrikschneider/jekyll-analytics
test/PostHogTest.rb
Ruby
mit
228
master
1,889
require_relative "../lib/analytics/post_hog.rb" require "test/unit" class PostHogTest < Test::Unit::TestCase def test_init assert_raise(ArgumentError) { PostHog.new({ "apikey" => "phc_xx" }) } assert_raise(ArgumentError) { PostHog.new({ "url" => "https://us.i.posthog.com" }) } assert_instance_of(PostHog,...
github
thechangelog/nightly
https://github.com/thechangelog/nightly
Gemfile
Ruby
mit
229
master
316
source "https://rubygems.org" ruby "2.3.3" gem "rake" gem "bigquery" gem "pry" gem "hashie" gem "dotenv" gem "sass" gem "createsend" gem "gemoji", git: "https://github.com/github/gemoji" gem "sequel" gem "sqlite3" gem "rest-client" gem "obscenity" gem "whatlanguage" gem "foreman" group :test do gem "rspec" end
github
thechangelog/nightly
https://github.com/thechangelog/nightly
Rakefile
Ruby
mit
229
master
5,481
require "rubygems" require "bundler/setup" require "date" require "json" require "dotenv/tasks" require "createsend" require "pry" require "uri" require_relative "lib/core_ext/date" require_relative "lib/core_ext/integer" require_relative "lib/bq_client" require_relative "lib/db" require_relative "lib/issue" require_r...
github
thechangelog/nightly
https://github.com/thechangelog/nightly
lib/db.rb
Ruby
mit
229
master
875
require "sequel" require "sqlite3" module DB @gh = Sequel.sqlite(File.join(ENV.fetch("DB_DIR", "."), "github.db")) def self.create unless @gh.table_exists? :listings @gh.create_table :listings do primary_key :id Bignum :github_id, null: false, index: true Date :date, null: false,...
github
thechangelog/nightly
https://github.com/thechangelog/nightly
lib/repo.rb
Ruby
mit
229
master
1,939
require "pry" require "hashie/mash" require "yaml" require "obscenity" require "whatlanguage" require "open-uri" require_relative "./core_ext/string" class Repo < Hashie::Mash def self.from_github url, stars_count repo = new JSON.load open(url, "Authorization" => %{token #{ENV["GITHUB_TOKEN"]}}) repo.new_sta...
github
thechangelog/nightly
https://github.com/thechangelog/nightly
lib/issue.rb
Ruby
mit
229
master
984
require_relative "./db" require_relative "./repo" class Issue attr_reader :date, :promotions, :top_new, :top_all def initialize date, json @date = date @promotions = ["beats", ["plusplus", "submit", "podcast"].sample].flatten process_top_new json process_top_all json end def promotion_one ...
github
thechangelog/nightly
https://github.com/thechangelog/nightly
lib/template.rb
Ruby
mit
229
master
550
require "erb" class Template def self.view_path= path @view_path = path end def self.view_path @view_path || "views" end def self.partial path, locals={} new(path).render locals end attr_reader :erb def initialize path @erb = ERB.new File.read "#{Template.view_path}/#{path}.erb" en...
github
thechangelog/nightly
https://github.com/thechangelog/nightly
lib/bq_client.rb
Ruby
mit
229
master
2,572
require "json" require "big_query" class BqClient attr_reader :bq, :day def initialize day @day = day @bq = BigQuery::Client.new({ "client_id" => ENV.fetch("BQ_CLIENT_ID"), "service_email" => ENV.fetch("BQ_SERVICE_EMAIL"), "key" => ENV.fetch("BQ_KEY", "bq-key.p12"), "p...
github
thechangelog/nightly
https://github.com/thechangelog/nightly
lib/buffer.rb
Ruby
mit
229
master
920
require "rest_client" require_relative "./core_ext/string" class Buffer def self.endpoint action "https://api.bufferapp.com/1/#{action}.json?access_token=#{ENV["BUFFER_TOKEN"]}" end attr_reader :profile, :languages, :tags, :repos def initialize profile, languages, tags="" @profile = profile @langu...
github
thechangelog/nightly
https://github.com/thechangelog/nightly
lib/core_ext/string.rb
Ruby
mit
229
master
2,016
require "cgi" require "emoji" # Derive all custom emoji from images on disk Dir["images/emoji/*.png"].each do |image| name = image.split("/").last.gsub ".png", "" Emoji.create name end class String def emojify self.gsub(/:([\w+-]+):/) do |match| if emoji = Emoji.find_by_alias($1) if emoji.cust...
github
thechangelog/nightly
https://github.com/thechangelog/nightly
lib/core_ext/date.rb
Ruby
mit
229
master
316
class Date def classy_year strftime "%Y" end def classy_month strftime "%m" end def classy_day strftime "%d" end def day_month_abbrev strftime "%b %d" end def day_month_year strftime "%B %d, %Y" end def path "#{classy_year}/#{classy_month}/#{classy_day}" end end
github
thechangelog/nightly
https://github.com/thechangelog/nightly
spec/template_spec.rb
Ruby
mit
229
master
634
require_relative "../lib/template" describe Template do let(:template) { Template.new "html/index" } let(:locals) { {test: 1, another: "test"} } describe "#assign_locals" do it "takes a hash and assigns the keys as local methods which return the values" do template.assign_locals locals expect(te...
github
thechangelog/nightly
https://github.com/thechangelog/nightly
spec/issue_spec.rb
Ruby
mit
229
master
1,270
require_relative "../lib/issue" RSpec.describe Issue do let(:issue) { Issue.new "2017-01-01", {"top_all" => [], "top_new" => []} } describe "#top_all_firsts" do it "returns repos which have one or less occurrences" do nope = double occurrences: 2 yep = double occurrences: 1 expect(issue).to ...