Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Fix variable name: option -> options
require 'rubygems/command_manager' require 'rubygems/install_update_options' require 'rubygems/commands/yardoc_command' Gem::CommandManager.instance.register_command :yardoc module Gem::InstallUpdateOptions alias install_update_options_without_yardoc add_install_update_options def add_install_update_options install_update_options_without_yardoc add_option :'Install/Update', '--yardoc', 'Generate YARD documentation for installed gems' do |value, option| unless options[:document].include? 'yardoc' options[:document] << 'yardoc' Gem.post_install do |installer| YARD::Registry.clear Gem::Commands::YardocCommand.run_yardoc(installer.spec) end end end end end Gem.pre_uninstall do |uninstaller| FileUtils.rm_rf File.join(uninstaller.spec.doc_dir, 'yardoc') end
require 'rubygems/command_manager' require 'rubygems/install_update_options' require 'rubygems/commands/yardoc_command' Gem::CommandManager.instance.register_command :yardoc module Gem::InstallUpdateOptions alias install_update_options_without_yardoc add_install_update_options def add_install_update_options install_update_options_without_yardoc add_option :'Install/Update', '--yardoc', 'Generate YARD documentation for installed gems' do |value, options| unless options[:document].include? 'yardoc' options[:document] << 'yardoc' Gem.post_install do |installer| YARD::Registry.clear Gem::Commands::YardocCommand.run_yardoc(installer.spec) end end end end end Gem.pre_uninstall do |uninstaller| FileUtils.rm_rf File.join(uninstaller.spec.doc_dir, 'yardoc') end
Add migration to create notifications table
class CreateNotifications < ActiveRecord::Migration def change create_table :notifications do |t| t.string :title t.text :message t.timestamp :sent_at t.timestamps null: false end end end
Fix NullLogger to handle message argument
# encoding: utf-8 require 'java' module Autobahn def self.transport_system(*args) TransportSystem.new(*args) end class NullLogger [:debug, :info, :warn, :error, :fatal].each do |level| define_method(level) { } end end end require 'hot_bunnies' require 'autobahn/version' require 'autobahn/concurrency' require 'autobahn/cluster' require 'autobahn/encoder' require 'autobahn/publisher_strategy' require 'autobahn/publisher' require 'autobahn/consumer_strategy' require 'autobahn/consumer' require 'autobahn/transport_system'
# encoding: utf-8 require 'java' module Autobahn def self.transport_system(*args) TransportSystem.new(*args) end class NullLogger [:debug, :info, :warn, :error, :fatal].each do |level| define_method(level) { |_| } end end end require 'hot_bunnies' require 'autobahn/version' require 'autobahn/concurrency' require 'autobahn/cluster' require 'autobahn/encoder' require 'autobahn/publisher_strategy' require 'autobahn/publisher' require 'autobahn/consumer_strategy' require 'autobahn/consumer' require 'autobahn/transport_system'
Remove erroneous require statement from gemspec
require 'rake' Gem::Specification.new do |s| s.name = "clockworksms" s.version = "1.0.0" s.author = "Mediaburst" s.email = "hello@mediaburst.co.uk" s.homepage = "http://www.clockworksms.com/" s.platform = Gem::Platform::RUBY s.summary = "Ruby Gem for the Clockwork API." s.description = "Ruby Gem for the Clockwork API. Send text messages with the easy to use SMS API from Mediaburst." s.files = FileList["lib/**/*.rb", "[A-Z]*"].to_a s.add_development_dependency "rake-compiler" s.add_development_dependency "rspec" s.has_rdoc = true end
Gem::Specification.new do |s| s.name = "clockworksms" s.version = "1.0.0" s.author = "Mediaburst" s.email = "hello@mediaburst.co.uk" s.homepage = "http://www.clockworksms.com/" s.platform = Gem::Platform::RUBY s.summary = "Ruby Gem for the Clockwork API." s.description = "Ruby Gem for the Clockwork API. Send text messages with the easy to use SMS API from Mediaburst." s.files = FileList["lib/**/*.rb", "[A-Z]*"].to_a s.add_development_dependency "rake-compiler" s.add_development_dependency "rspec" s.has_rdoc = true end
Add restful redirect rule for notifications arriving from V2V
class RestfulRedirectController < ApplicationController before_action :check_privileges def index case params[:model] when 'MiqRequest' redirect_to :controller => 'miq_request', :action => 'show', :id => params[:id] when 'VmOrTemplate' klass = VmOrTemplate.select(:id, :type).find(params[:id]).try(:class) controller = if klass && (VmCloud > klass || TemplateCloud > klass) 'vm_cloud' else 'vm_infra' end redirect_to :controller => controller, :action => 'show', :id => params[:id] else flash_to_session(_("Could not find the given \"%{model}\" record.") % {:model => ui_lookup(:model => params[:model])}, :error) redirect_to(:controller => 'dashboard', :action => 'show') end end end
class RestfulRedirectController < ApplicationController before_action :check_privileges def index case params[:model] when 'ServiceTemplateTransformationPlanRequest' req = ServiceTemplateTransformationPlanRequest.select(:source_id).find(params[:id]) redirect_to :controller => 'migration', :action => 'index', :anchor => "plan/#{req.source_id}" when 'MiqRequest' redirect_to :controller => 'miq_request', :action => 'show', :id => params[:id] when 'VmOrTemplate' klass = VmOrTemplate.select(:id, :type).find(params[:id]).try(:class) controller = if klass && (VmCloud > klass || TemplateCloud > klass) 'vm_cloud' else 'vm_infra' end redirect_to :controller => controller, :action => 'show', :id => params[:id] else flash_to_session(_("Could not find the given \"%{model}\" record.") % {:model => ui_lookup(:model => params[:model])}, :error) redirect_to(:controller => 'dashboard', :action => 'show') end end end
Fix issue with jruby in 1.9 mode where HostOS is not converted to a string.
require 'rbconfig' module Launchy::Detect class HostOs attr_reader :host_os alias to_s host_os def initialize( host_os = nil ) @host_os = host_os if not @host_os then if @host_os = override_host_os then Launchy.log "Using LAUNCHY_HOST_OS override value of '#{Launchy.host_os}'" else @host_os = default_host_os end end end def default_host_os ::RbConfig::CONFIG['host_os'] end def override_host_os Launchy.host_os end end end
require 'rbconfig' module Launchy::Detect class HostOs attr_reader :host_os alias to_s host_os alias to_str host_os def initialize( host_os = nil ) @host_os = host_os if not @host_os then if @host_os = override_host_os then Launchy.log "Using LAUNCHY_HOST_OS override value of '#{Launchy.host_os}'" else @host_os = default_host_os end end end def default_host_os ::RbConfig::CONFIG['host_os'] end def override_host_os Launchy.host_os end end end
Add basic jeprof extraction script.
#! /usr/bin/ruby def get_profile_total(profile_type, binary, profile) return `jeprof --text --#{profile_type} #{binary} #{profile} 2>/dev/null`[/^Total: ([0-9.]*)/, 1] end GROUP_ROOT = ARGV.shift unless GROUP_ROOT p "usage: #{$0} path/to/experiment/root" exit end Dir.glob("#{GROUP_ROOT}/*/") do |f| next if f == "roles" binary = File.basename(f)[/_([^_]*)$/, 1] scale_factor = File.basename(f)[/^(.*?)_/, 1] profile_type = if f =~ /accum/ then "alloc_space" else "inuse_space" end p "query,sf,prof_type,peer_id,seq_num,value" Dir.glob("#{f}*/") do |m| host = File.basename(m)[/\.([0-9]*)_(.*)$/, 1] Dir.glob("#{m}*.t[0-9]*.heap") do |h| sequence_number = h[/\.t([0-9]*)\./, 1] total = get_profile_total(profile_type, "#{GROUP_ROOT}/#{binary}", h) p "#{binary},#{scale_factor},#{profile_type},#{host},#{sequence_number},#{total}" end end end
Add tests for onboarding and proposal notifications
require 'spec_helper' describe Mailbot do let(:conference) { create(:conference) } let!(:email_settings) { create(:email_settings, conference: conference) } let(:user) { create(:user, email: 'user@example.com') } before { conference.contact.update_attributes(email: 'conf@domain.com') } context 'onboarding and proposal' do let(:event_user) { create(:submitter, user: user) } let(:event) { create(:event, program: conference.program, event_users: [event_user]) } shared_examples 'mailer actions' do it 'assigns the email subject' do expect(mail.subject).to eq 'Lorem Ipsum Dolsum' end it 'assigns the email receiver, sender, reply_to' do expect(mail.to).to eq ['user@example.com'] expect(mail.from).to eq ['conf@domain.com'] expect(mail.reply_to).to eq ['conf@domain.com'] end it 'assigns the email body' do expect(mail.body).to eq 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit' end end describe '.registration_mail' do include_examples 'mailer actions' do let(:mail) { Mailbot.registration_mail conference, user } end end describe '.acceptance_mail' do before do conference.email_settings.update_attributes(send_on_accepted: true, accepted_subject: 'Lorem Ipsum Dolsum', accepted_body: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit') end include_examples 'mailer actions' do let(:mail) { Mailbot.acceptance_mail event } end end describe '.rejection_mail' do before do conference.email_settings.update_attributes(send_on_rejected: true, rejected_subject: 'Lorem Ipsum Dolsum', rejected_body: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit') end include_examples 'mailer actions' do let(:mail) { Mailbot.rejection_mail event } end end describe '.confirm_reminder_mail' do before do conference.email_settings.update_attributes(send_on_confirmed_without_registration: true, confirmed_without_registration_subject: 'Lorem Ipsum Dolsum', confirmed_without_registration_body: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit') end include_examples 'mailer actions' do let(:mail) { Mailbot.confirm_reminder_mail event } end end describe '.build_email' do include_examples 'mailer actions' do let(:mail) { Mailbot.build_email conference, 'user@example.com', 'Lorem Ipsum Dolsum', 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit' } end end end context 'update notifications' do it 'is a pending test' end end
Disable digest email sending until the email becomes more useful and does not send when there are no updates.
# Use this file to easily define all of your cron jobs. # # It's helpful, but not entirely necessary to understand cron before proceeding. # http://en.wikipedia.org/wiki/Cron # Example: # # set :output, "/path/to/my/cron_log.log" # # every 2.hours do # command "/usr/bin/some_great_command" # runner "MyModel.some_method" # rake "some:great:rake:task" # end # # every 4.days do # runner "AnotherModel.prune_old_records" # end # Learn more: http://github.com/javan/whenever set :output, File.expand_path('../log/cron.log', __FILE__) every :day, at: '4am' do runner 'DigestBuilder.send_daily_email' end
# Use this file to easily define all of your cron jobs. # # It's helpful, but not entirely necessary to understand cron before proceeding. # http://en.wikipedia.org/wiki/Cron # Example: # # set :output, "/path/to/my/cron_log.log" # # every 2.hours do # command "/usr/bin/some_great_command" # runner "MyModel.some_method" # rake "some:great:rake:task" # end # # every 4.days do # runner "AnotherModel.prune_old_records" # end # Learn more: http://github.com/javan/whenever set :output, File.expand_path('../log/cron.log', __FILE__) every :day, at: '4am' do # FIXME: disable digest emails until the email becomes more useful and doesn't send when there are no updates. # runner 'DigestBuilder.send_daily_email' end
Update govuk module specs for mocked extdata
require_relative '../../../../spec_helper' describe 'govuk::app', :type => :define do let(:title) { 'giraffe' } context 'with no params' do it do expect { should contain_file('/var/apps/giraffe') }.to raise_error(Puppet::Error, /Must pass app_type/) end end context 'with good params' do let(:params) do { :port => 8000, :app_type => 'rack', :platform => 'production' } end it do should contain_govuk__app__package('giraffe').with( 'vhost_full' => 'giraffe.production.alphagov.co.uk', 'platform' => 'production', ) should contain_govuk__app__config('giraffe').with( 'domain' => 'production.alphagov.co.uk', ) should contain_service('giraffe').with_provider('upstart') end end context 'on the development platform' do let(:params) do { :port => 8000, :app_type => 'rack', :platform => 'development' } end it { should contain_govuk__app__config('giraffe').with_vhost_full('giraffe.dev.gov.uk') } end end
require_relative '../../../../spec_helper' describe 'govuk::app', :type => :define do let(:title) { 'giraffe' } context 'with no params' do it do expect { should contain_file('/var/apps/giraffe') }.to raise_error(Puppet::Error, /Must pass app_type/) end end context 'with good params' do let(:params) do { :port => 8000, :app_type => 'rack', :platform => 'production' } end it do should contain_govuk__app__package('giraffe').with( 'vhost_full' => 'giraffe.test.gov.uk', 'platform' => 'production', ) should contain_govuk__app__config('giraffe').with( 'domain' => 'test.gov.uk', ) should contain_service('giraffe').with_provider('upstart') end end end
Make the Book persistable via Daybreak
require 'pathname' require "gutenberg/book/version" require "gutenberg/book/paragraph" module Gutenberg class Book include Enumerable def initialize path file = Pathname.new(path).expand_path @parts = IO.read(file) .split(/\r\n\r\n/) .delete_if(&:empty?) .map { |part| part.strip.gsub "\r\n", ' ' } @book_start = @parts.find_index { |s| s.start_with? '*** START' } @book_end = @parts.find_index { |s| s.start_with? '*** END' } end def metainfo get_metainfo = -> do metainfo = {} @parts[0..@book_start].each do |string| key, value = string.split ': ', 2 metainfo[key] = value unless key.nil? || value.nil? end metainfo end @metainfo ||= get_metainfo[] end def paragraphs get_paragraphs = -> { @parts[@book_start+1...@book_end] } @paragraphs ||= get_paragraphs[] end def each &b paragraphs.each &b end end end
require 'pathname' require "gutenberg/book/version" require "gutenberg/book/paragraph" module Gutenberg class Book include Enumerable def each &b paragraphs.each &b end def initialize parts @book_start = parts.find_index { |s| s.start_with? '*** START' } @book_end = parts.find_index { |s| s.start_with? '*** END' } @parts = parts end class << self def new_from_txt path file = Pathname.new(path).expand_path parts = IO.read(file) .split(/\r\n\r\n/) .delete_if(&:empty?) .map { |part| part.strip.gsub "\r\n", ' ' } new parts end def new_from_daybreak path new (Daybreak::DB.new path) end end def metainfo get_metainfo = -> do metainfo = {} @parts[0..@book_start].each do |string| key, value = string.split ': ', 2 metainfo[key] = value unless key.nil? || value.nil? end metainfo end @metainfo ||= get_metainfo[] end def paragraphs get_paragraphs = -> { @parts[@book_start+1...@book_end] } @paragraphs ||= get_paragraphs[] end def save_to file db = Daybreak::DB.new file @parts.each { |k, v| db[k] = v } db.flush; db.close end end end
Add perf tests to establish baseline before refactoring
# frozen_string_literal: true require "io/console" require "rspec-benchmark" RSpec.describe TTY::Screen, ".size" do include RSpec::Benchmark::Matchers it "detectes size 180x slower than io-console" do expect { TTY::Screen.size }.to perform_slower_than { IO.console.winsize }.at_most(180).times end it "performs at least 2K i/s" do expect { TTY::Screen.size }.to perform_at_least(2000).ips end it "allocates at most 366 objects" do expect { TTY::Screen.size }.to perform_allocation(366).objects end end
Add summury and description at gemspec
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) Gem::Specification.new do |spec| spec.name = "unicorn_status" spec.version = "0.0.1" spec.authors = ["SpringMT"] spec.email = ["today.is.sky.blue.sky@gmail.com"] spec.description = %q{Write a gem description} spec.summary = %q{Write a gem summary} spec.homepage = "" spec.license = "MIT" spec.files = `git ls-files`.split($/) spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "raindrops" spec.add_dependency "thor" spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" end
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) Gem::Specification.new do |spec| spec.name = "unicorn_status" spec.version = "0.0.1" spec.authors = ["SpringMT"] spec.email = ["today.is.sky.blue.sky@gmail.com"] spec.description = %q{Monitoring for unicorn status} spec.summary = %q{Monitoring for unicorn status} spec.homepage = "" spec.license = "MIT" spec.files = `git ls-files`.split($/) spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "raindrops" spec.add_dependency "thor" spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" end
Include bnodes when fetching graph resources
# Fetches subresources from the graphs of envelopes with the given CTIDs class FetchGraphResources def self.call(ctids, envelope_community:) relation = Envelope .not_deleted .joins("CROSS JOIN LATERAL jsonb_array_elements(processed_resource->'@graph') AS graph(resource)") .where(envelope_ceterms_ctid: ctids) .where("graph.resource->>'ceterms:ctid' NOT IN (?)", ctids) if envelope_community relation = relation.where(envelope_community_id: envelope_community.id) end relation.pluck('graph.resource').map { |r| JSON(r) } end end
# Fetches subresources from the graphs of envelopes with the given CTIDs class FetchGraphResources def self.call(ctids, envelope_community:) relation = Envelope .not_deleted .joins("CROSS JOIN LATERAL jsonb_array_elements(processed_resource->'@graph') AS graph(resource)") .where(envelope_ceterms_ctid: ctids) relation = relation .where("graph.resource->'ceterms:ctid' IS NULL") .or(relation.where("graph.resource->>'ceterms:ctid' NOT IN (?)", ctids)) if envelope_community relation = relation.where(envelope_community_id: envelope_community.id) end relation.pluck('graph.resource').map { |r| JSON(r) } end end
Remove commented out code in search method
class SchoolsController < ApplicationController def index end def search # @results = PgSearch.multisearch(params["search"]) @results = School.search_schools(params["search"]) end def random40 @json = Array.new 20.times do offset = rand(School.count) rand_record = School.offset(offset).first @json << { dbn: rand_record.dbn, school: rand_record.school, total_enrollment: rand_record.total_enrollment, amount_owed: rand_record.amount_owed } end respond_to do |format| format.html format.json { render json: @json } end end end
class SchoolsController < ApplicationController def index end def search @results = School.search_schools(params["search"]) end def random40 @json = Array.new 20.times do offset = rand(School.count) rand_record = School.offset(offset).first @json << { dbn: rand_record.dbn, school: rand_record.school, total_enrollment: rand_record.total_enrollment, amount_owed: rand_record.amount_owed } end respond_to do |format| format.html format.json { render json: @json } end end end
Use Spree's cache of its in-stock state for in-stock variants.
Spree::Variant.class_eval do # Sorts by option value position and other criteria after variant position. scope :order_by_option_value, ->{ includes(:option_values).references(:option_values).unscope(:order).order( position: :asc ).order( 'spree_option_values.position ASC' ).order( is_master: :desc, id: :asc ).uniq } def first_option_value self.option_values.where(option_type_id: self.product.first_option_type.id).order(position: :asc).first end def stock_message return "#{Spree.t(:temporarily_out_of_stock)}. #{Spree.t(:deliver_when_available)}." if self.total_on_hand == 0 && self.is_backorderable? return "#{Spree.t(:out_of_stock)}." if !self.can_supply? return nil end end
Spree::Variant.class_eval do # Sorts by option value position and other criteria after variant position. scope :order_by_option_value, ->{ includes(:option_values).references(:option_values).unscope(:order).order( position: :asc ).order( 'spree_option_values.position ASC' ).order( is_master: :desc, id: :asc ).uniq } def first_option_value self.option_values.where(option_type_id: self.product.first_option_type.id).order(position: :asc).first end def stock_message if !self.in_stock? if self.is_backorderable? "#{Spree.t(:temporarily_out_of_stock)}. #{Spree.t(:deliver_when_available)}." else "#{Spree.t(:out_of_stock)}." end else nil end end end
Use earlier version of rake to fix 1.9.2 test
Gem::Specification.new do |s| s.name = %q{fastimage} s.version = "2.0.0" s.required_ruby_version = '>= 1.9.2' s.authors = ["Stephen Sykes"] s.date = %q{2016-03-24} s.description = %q{FastImage finds the size or type of an image given its uri by fetching as little as needed.} s.email = %q{sdsykes@gmail.com} s.extra_rdoc_files = [ "README.textile" ] s.files = [ "MIT-LICENSE", "README.textile", "lib/fastimage.rb", ] s.homepage = %q{http://github.com/sdsykes/fastimage} s.rdoc_options = ["--charset=UTF-8"] s.require_paths = ["lib"] s.rubygems_version = %q{1.3.6} s.summary = %q{FastImage - Image info fast} s.add_runtime_dependency 'addressable', '~> 2.3.5' s.add_development_dependency 'fakeweb', '~> 1.3' s.add_development_dependency('rake') s.add_development_dependency('rdoc') s.add_development_dependency('test-unit') s.licenses = ['MIT'] end
Gem::Specification.new do |s| s.name = %q{fastimage} s.version = "2.0.0" s.required_ruby_version = '>= 1.9.2' s.authors = ["Stephen Sykes"] s.date = %q{2016-03-24} s.description = %q{FastImage finds the size or type of an image given its uri by fetching as little as needed.} s.email = %q{sdsykes@gmail.com} s.extra_rdoc_files = [ "README.textile" ] s.files = [ "MIT-LICENSE", "README.textile", "lib/fastimage.rb", ] s.homepage = %q{http://github.com/sdsykes/fastimage} s.rdoc_options = ["--charset=UTF-8"] s.require_paths = ["lib"] s.rubygems_version = %q{1.3.6} s.summary = %q{FastImage - Image info fast} s.add_runtime_dependency 'addressable', '~> 2.3.5' s.add_development_dependency 'fakeweb', '~> 1.3' # Note rake 11 drops support for ruby 1.9.2 s.add_development_dependency('rake', '~> 10.5') s.add_development_dependency('rdoc') s.add_development_dependency('test-unit') s.licenses = ['MIT'] end
Refactor MemberList to use Support::Sublist
module NetSuite module Records class MemberList include Support::Fields include Support::Records include Namespaces::ListAcct fields :replace_all, :item_member def initialize(attrs = {}) initialize_from_attributes_hash(attrs) end def item_member=(items) case items when Hash self.item_member << ItemMember.new(items) when Array items.each { |ref| self.item_member << ItemMember.new(ref) } end end def item_member @item_member ||= [] end def to_record { "#{record_namespace}:itemMember" => item_member.map(&:to_record) } end end end end
module NetSuite module Records class MemberList < Support::Sublist include Support::Records include Namespaces::ListAcct fields :replace_all sublist :item_member, ItemMember end end end
Change gem description to nprogress version 0.1.6
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) Gem::Specification.new do |spec| spec.name = 'nprogress-rails' spec.version = '0.1.3.1' spec.authors = ['Carlos Alexandro Becker'] spec.email = ['caarlos0@gmail.com'] spec.description = %q{This is a gem for the rstacruz' nprogress implementation. It's based on version nprogress 0.1.2.} spec.summary = %q{Slim progress bars for Ajax'y applications. Inspired by Google, YouTube, and Medium.} spec.homepage = 'https://github.com/caarlos0/nprogress-rails' spec.license = 'MIT' spec.files = `git ls-files`.split($/) spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ['lib'] spec.add_development_dependency 'bundler', '~> 1.3' spec.add_development_dependency 'rake' spec.add_development_dependency 'sass-rails' spec.add_development_dependency 'sass' end
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) Gem::Specification.new do |spec| spec.name = 'nprogress-rails' spec.version = '0.1.3.1' spec.authors = ['Carlos Alexandro Becker'] spec.email = ['caarlos0@gmail.com'] spec.description = %q{This is a gem for the rstacruz' nprogress implementation. It's based on version nprogress 0.1.6.} spec.summary = %q{Slim progress bars for Ajax'y applications. Inspired by Google, YouTube, and Medium.} spec.homepage = 'https://github.com/caarlos0/nprogress-rails' spec.license = 'MIT' spec.files = `git ls-files`.split($/) spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ['lib'] spec.add_development_dependency 'bundler', '~> 1.3' spec.add_development_dependency 'rake' spec.add_development_dependency 'sass-rails' spec.add_development_dependency 'sass' end
Package version is increased from 0.21.1.0 to 0.22.0.0
# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'evt-messaging' s.version = '0.21.1.0' s.summary = 'Common primitives for platform-specific messaging implementations for Eventide' s.description = ' ' s.authors = ['The Eventide Project'] s.email = 'opensource@eventide-project.org' s.homepage = 'https://github.com/eventide-project/messaging' s.licenses = ['MIT'] s.require_paths = ['lib'] s.files = Dir.glob('{lib}/**/*') s.platform = Gem::Platform::RUBY s.required_ruby_version = '>= 2.4.0' s.add_runtime_dependency 'evt-message_store' s.add_development_dependency 'test_bench' end
# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'evt-messaging' s.version = '0.22.0.0' s.summary = 'Common primitives for platform-specific messaging implementations for Eventide' s.description = ' ' s.authors = ['The Eventide Project'] s.email = 'opensource@eventide-project.org' s.homepage = 'https://github.com/eventide-project/messaging' s.licenses = ['MIT'] s.require_paths = ['lib'] s.files = Dir.glob('{lib}/**/*') s.platform = Gem::Platform::RUBY s.required_ruby_version = '>= 2.4.0' s.add_runtime_dependency 'evt-message_store' s.add_development_dependency 'test_bench' end
Add .pre for next release
module EY module Serverside class Adapter VERSION = "2.3.1" end end end
module EY module Serverside class Adapter VERSION = "2.3.2.pre" end end end
Use generated image ids instead of hard coded ones
require "spec_helper" module Refinery describe "dialog", :type => :feature do refinery_login context 'When there are many images' do include_context 'many images' it "does not have selected an image" do visit refinery.insert_admin_images_path expect(page).to_not have_selector("li[class='selected']") end it "only selects the provided image" do visit refinery.insert_admin_images_path(selected_image: 1) expect(page).to have_selector("li[class='selected'] img[data-id='1']") expect(page).to_not have_selector("li[class='selected'] img[data-id='2']") expect(page).to_not have_selector("li[class='selected'] img[data-id='3']") end end end end
require "spec_helper" module Refinery describe "dialog", :type => :feature do refinery_login context 'When there are many images' do include_context 'many images' it "does not have selected an image" do visit refinery.insert_admin_images_path expect(page).to_not have_selector("li[class='selected']") end it "only selects the provided image" do visit refinery.insert_admin_images_path(selected_image: image.id) expect(page).to have_selector("li[class='selected'] img[data-id='#{image.id}']") expect(page).to_not have_selector("li[class='selected'] img[data-id='#{alt_image.id}']") expect(page).to_not have_selector("li[class='selected'] img[data-id='#{another_image.id}']") end end end end
Use the correct format for expect, add a string check aswell
shared_examples_for "ping" do |machine| it "responds to ping on its management network" do interval = 0.25 # seconds; can't go <0.2 unless root deadline = 10 # seconds; with this set, count is the count of successful responses required, not requests to send required_count = 3 # seconds output = `/bin/ping -i #{interval} -w #{deadline} -c #{required_count} -n #{machine.mgmt_fqdn} 2>&1` expect { $CHILD_STATUS.exitstatus }.to eql(0), "exitstatus = #{$CHILD_STATUS.exitstatus}\n#{output}" end end
shared_examples_for "ping" do |machine| it "responds to ping on its management network" do interval = 0.25 # seconds; can't go <0.2 unless root deadline = 10 # seconds; with this set, count is the count of successful responses required, not requests to send required_count = 3 # seconds output = `/bin/ping -i #{interval} -w #{deadline} -c #{required_count} -n #{machine.mgmt_fqdn} 2>&1` expect($CHILD_STATUS.exitstatus).to eql(0) expect(output).to include('3 packets transmitted, 3 received') end end
Move assets /after/ they've been created
namespace :travis do task :rspec do puts "Starting to run rspec..." system("bundle exec rspec") raise "rspec failed!" unless $?.exitstatus == 0 end task :cucumber do puts "Starting to run cucumber..." system("bundle exec cucumber") raise "cucumber failed!" unless $?.exitstatus == 0 end task :protractor => :environment do puts "Creating test assets for v#{Loomio::Version.current}..." system("cp -r #{Rails.root}/public/client/development #{Rails.root}/public/client/#{Loomio::Version.current}") raise "Asset creation failed!" unless $?.exitstatus == 0 puts "Starting to run protractor..." system("cd angular && gulp protractor && cd ../") raise "protractor failed!" unless $?.exitStatus == 0 end end
namespace :travis do task :rspec do puts "Starting to run rspec..." system("bundle exec rspec") raise "rspec failed!" unless $?.exitstatus == 0 end task :cucumber do puts "Starting to run cucumber..." system("bundle exec cucumber") raise "cucumber failed!" unless $?.exitstatus == 0 end task :protractor => :environment do puts "Creating test assets for v#{Loomio::Version.current}..." system("cd angular && gulp compile") system("cp -r #{Rails.root}/public/client/development #{Rails.root}/public/client/#{Loomio::Version.current}") raise "Asset creation failed!" unless $?.exitstatus == 0 puts "Starting to run protractor..." system("gulp protractor:now && cd ../") raise "protractor failed!" unless $?.exitStatus == 0 end end
Remove gemspec dependency on Fishbowl
# encoding: UTF-8 Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'spree_fishbowl' s.version = '1.3.2' s.summary = 'Integrate Spree Commerce with Fishbowl Inventory' s.description = '' s.required_ruby_version = '>= 1.9.2' s.author = 'Michael Porter' s.email = 'michael@skookum.com' # s.homepage = 'http://www.spreecommerce.com' s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.require_path = 'lib' s.requirements << 'none' s.add_dependency 'spree_core', '~> 1.3.2' s.add_dependency 'fishbowl', '>= 0.1.0' s.add_development_dependency 'capybara', '~> 1.1.2' s.add_development_dependency 'coffee-rails' s.add_development_dependency 'factory_girl', '~> 2.6.4' s.add_development_dependency 'ffaker' s.add_development_dependency 'rspec-rails', '~> 2.9' s.add_development_dependency 'sass-rails' s.add_development_dependency 'sqlite3' end
# encoding: UTF-8 Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'spree_fishbowl' s.version = '1.3.2' s.summary = 'Integrate Spree Commerce with Fishbowl Inventory' s.description = '' s.required_ruby_version = '>= 1.9.2' s.author = 'Michael Porter' s.email = 'michael@skookum.com' # s.homepage = 'http://www.spreecommerce.com' s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.require_path = 'lib' s.requirements << 'none' s.add_dependency 'spree_core', '~> 1.3.2' s.add_development_dependency 'capybara', '~> 1.1.2' s.add_development_dependency 'coffee-rails' s.add_development_dependency 'factory_girl', '~> 2.6.4' s.add_development_dependency 'ffaker' s.add_development_dependency 'rspec-rails', '~> 2.9' s.add_development_dependency 'sass-rails' s.add_development_dependency 'sqlite3' end
Clean up weird comments; Fixed ObjectId caller
require 'sunspot' require 'mongoid' require 'sunspot/rails' # == Examples: # # class Post # include Mongoid::Document # field :title # # include Sunspot::Mongoid # searchable do # text :title # end # end # module Sunspot module Mongoid def self.included(base) base.class_eval do extend Sunspot::Rails::Searchable::ActsAsMethods extend Sunspot::Mongoid::ActsAsMethods Sunspot::Adapters::DataAccessor.register(DataAccessor, base) Sunspot::Adapters::InstanceAdapter.register(InstanceAdapter, base) end end module ActsAsMethods # ClassMethods isn't loaded until searchable is called so we need # call it, then extend our own ClassMethods. def searchable (opt = {}, &block) super extend ClassMethods end end module ClassMethods # The sunspot solr_index method is very dependent on ActiveRecord, so # we'll change it to work more efficiently with Mongoid. def solr_index(opt={}) Sunspot.index!(all) end end class InstanceAdapter < Sunspot::Adapters::InstanceAdapter def id @instance.id end end class DataAccessor < Sunspot::Adapters::DataAccessor def load(id) @clazz.find(::Moped::BSON::ObjectID.from_string(id)) rescue nil end def load_all(ids) @clazz.where(:_id.in => ids.map { |id| ::Moped::BSON::ObjectID.from_string(id) }) end end end end
require 'sunspot' require 'mongoid' require 'sunspot/rails' module Sunspot module Mongoid def self.included(base) base.class_eval do extend Sunspot::Rails::Searchable::ActsAsMethods extend Sunspot::Mongoid::ActsAsMethods Sunspot::Adapters::DataAccessor.register(DataAccessor, base) Sunspot::Adapters::InstanceAdapter.register(InstanceAdapter, base) end end module ActsAsMethods # ClassMethods isn't loaded until searchable is called so we need # call it, then extend our own ClassMethods. def searchable (opt = {}, &block) super extend ClassMethods end end module ClassMethods # The sunspot solr_index method is very dependent on ActiveRecord, so # we'll change it to work more efficiently with Mongoid. def solr_index(opt={}) Sunspot.index!(all) end end class InstanceAdapter < Sunspot::Adapters::InstanceAdapter def id @instance.id end end class DataAccessor < Sunspot::Adapters::DataAccessor def load(id) @clazz.find(::Moped::BSON::ObjectId.from_string(id)) rescue nil end def load_all(ids) @clazz.where(:_id.in => ids.map { |id| ::Moped::BSON::ObjectId.from_string(id) }) end end end end
Add micro version to html-pipeline dependency
# -*- encoding: utf-8 -*- require File.expand_path '../lib/html/pipeline/asciidoc_filter/version', __FILE__ Gem::Specification.new do |gem| # named according to http://guides.rubygems.org/name-your-gem gem.name = 'html-pipeline-asciidoc_filter' gem.version = HTML_Pipeline::AsciiDocFilter::VERSION gem.authors = ['Dan Allen'] gem.email = ['dan.j.allen@gmail.com'] gem.summary = 'An AsciiDoc processing filter for html-pipeline powered by Asciidoctor' gem.description = 'An AsciiDoc processing filter for html-pipeline powered by Asciidoctor' gem.homepage = 'https://github.com/asciidoctor/html-pipeline-asciidoc_filter' gem.license = 'MIT' gem.files = `git ls-files -z -- */* {README,LICENSE}* *.gemspec`.split("\0") gem.executables = gem.files.grep(/^bin\//) { |f| File.basename(f) } gem.test_files = gem.files.grep(/^test\//) gem.require_paths = ['lib'] gem.add_dependency 'html-pipeline', '~> 2.2' gem.add_dependency 'asciidoctor', '~> 1.5.2' end
# -*- encoding: utf-8 -*- require File.expand_path '../lib/html/pipeline/asciidoc_filter/version', __FILE__ Gem::Specification.new do |gem| # named according to http://guides.rubygems.org/name-your-gem gem.name = 'html-pipeline-asciidoc_filter' gem.version = HTML_Pipeline::AsciiDocFilter::VERSION gem.authors = ['Dan Allen'] gem.email = ['dan.j.allen@gmail.com'] gem.summary = 'An AsciiDoc processing filter for html-pipeline powered by Asciidoctor' gem.description = 'An AsciiDoc processing filter for html-pipeline powered by Asciidoctor' gem.homepage = 'https://github.com/asciidoctor/html-pipeline-asciidoc_filter' gem.license = 'MIT' gem.files = `git ls-files -z -- */* {README,LICENSE}* *.gemspec`.split("\0") gem.executables = gem.files.grep(/^bin\//) { |f| File.basename(f) } gem.test_files = gem.files.grep(/^test\//) gem.require_paths = ['lib'] gem.add_dependency 'html-pipeline', '~> 2.2.2' gem.add_dependency 'asciidoctor', '~> 1.5.2' end
Remove spec test files; deprecated field
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'faker/version' Gem::Specification.new do |spec| spec.name = "fieldlocate_faker" spec.version = FieldlocateFaker::VERSION spec.authors = ["Jeff Hatfield"] spec.email = ["jeff.hatfield@fieldlocate.com"] spec.summary = "A repurposed FAKER gem for my purposes" spec.description = "FAKER was an amazing gem that I use on a daily basis, however would break my app. I have made fixes for myself" spec.homepage = "" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0") spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 1.6" spec.add_development_dependency "rake" end
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'faker/version' Gem::Specification.new do |spec| spec.name = "fieldlocate_faker" spec.version = FieldlocateFaker::VERSION spec.authors = ["Jeff Hatfield"] spec.email = ["jeff.hatfield@fieldlocate.com"] spec.summary = "A repurposed FAKER gem for my purposes" spec.description = "FAKER was an amazing gem that I use on a daily basis, however would break my app. I have made fixes for myself" spec.homepage = "" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0") spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 1.6" spec.add_development_dependency "rake" end
Add test for "-lah, -kah, -tah, -pun" suffixes
require 'spec_helper' describe Sastrawi do it 'has a version number' do expect(Sastrawi::VERSION).not_to be nil end it 'should not stem short words' do short_words = %w[mei bui] base_form = %w[mei bui] stemming_result = [] short_words.each do |word| stemming_result.push(Sastrawi.stem(word)) end expect((base_form - stemming_result).empty?).to eq(true) end it 'should not stem "nilai" to "nila"' do expect(Sastrawi.stem('nilai')).to eq('nilai') end end
require 'spec_helper' describe Sastrawi do it 'has a version number' do expect(Sastrawi::VERSION).not_to be nil end it 'should not stem short words' do short_words = %w[mei bui] base_form = %w[mei bui] stemming_result = [] short_words.each do |word| stemming_result.push(Sastrawi.stem(word)) end expect((base_form - stemming_result).empty?).to eq(true) end it 'should not stem "nilai" to "nila"' do expect(Sastrawi.stem('nilai')).to eq('nilai') end it 'should stem "-lah, -kah, -tah, -pun" suffixes' do suffixed_words = %w[hancurlah benarkah apatah siapapun] base_form = %w[hancur benar apa siapa] stemming_result = [] suffixed_words.each do |word| stemming_result.push(Sastrawi.stem(word)) end expect((base_form - stemming_result).empty?).to eq(true) end end
Change Provenance to use codelist instead of string
require_relative 'operator' require_relative '../behaviors/provenanceable' module ConceptQL module Operators # Filters the incoming stream of events to only those that have a # provenance-related concept_id. # # Provenance related concepts are the ones found in the xxx_type_concept_id # field. # # If the event has NULL for the provenance-related field, they are filtered # out. # # Multiple provenances can be specified at once class Provenance < Operator register __FILE__ include ConceptQL::Provenanceable desc <<-EOF Filters incoming events to those matching the indicated provenance. Enter the numeric concept id(s) for the provenance, or the corresponding text label(s) (e.g., "inpatient", "outpatient", "carrier", etc.). Separate entries with commas." EOF argument :provenance_types, label: 'Provenance Types', type: :string category "Filter Single Stream" basic_type :temporal allows_one_upstream validate_one_upstream require_column :provenance_type default_query_columns def query(db) db.from(stream.evaluate(db)) .where(provenance_type: provenance_concept_ids) end private def provenance_concept_ids arguments.map(&:to_s).flat_map { |w| w.split(/\s*,\s*/) }.uniq.flat_map do |arg| to_concept_id(arg.to_s) end end end end end
require_relative 'operator' require_relative '../behaviors/provenanceable' module ConceptQL module Operators # Filters the incoming stream of events to only those that have a # provenance-related concept_id. # # Provenance related concepts are the ones found in the xxx_type_concept_id # field. # # If the event has NULL for the provenance-related field, they are filtered # out. # # Multiple provenances can be specified at once class Provenance < Operator register __FILE__ include ConceptQL::Provenanceable desc <<-EOF Filters incoming events to those matching the indicated provenance. Enter the numeric concept id(s) for the provenance, or the corresponding text label(s) (e.g., "inpatient", "outpatient", "carrier", etc.). Separate entries with commas." EOF argument :provenance_types, label: 'Provenance Types', type: :codelist category "Filter Single Stream" basic_type :temporal allows_one_upstream validate_one_upstream require_column :provenance_type default_query_columns def query(db) db.from(stream.evaluate(db)) .where(provenance_type: provenance_concept_ids) end private def provenance_concept_ids arguments.map(&:to_s).flat_map { |w| w.split(/\s*,\s*/) }.uniq.flat_map do |arg| to_concept_id(arg.to_s) end end end end end
Add license to gem files
Gem::Specification.new do |s| s.authors = ['Eli Foster'] s.name = 'string-utility' s.summary = 'Provides some basic utilities for interacting with Strings' s.version = '3.0.0' s.license = 'MIT' # @todo Expand on this description eventually. s.description = <<-EOF Some simple but handy methods to interact with string objects. EOF s.email = 'elifosterwy@gmail.com' s.homepage = 'https://github.com/elifoster/string-utility-ruby' s.metadata = { 'issue_tracker' => 'https://github.com/elifoster/string-utility-ruby/issues' } s.required_ruby_version = '>= 2.1' s.files = [ 'lib/string_utility.rb', 'lib/string-utility.rb', 'CHANGELOG.md', ] end
Gem::Specification.new do |s| s.authors = ['Eli Foster'] s.name = 'string-utility' s.summary = 'Provides some basic utilities for interacting with Strings' s.version = '3.0.0' s.license = 'MIT' # @todo Expand on this description eventually. s.description = <<-EOF Some simple but handy methods to interact with string objects. EOF s.email = 'elifosterwy@gmail.com' s.homepage = 'https://github.com/elifoster/string-utility-ruby' s.metadata = { 'issue_tracker' => 'https://github.com/elifoster/string-utility-ruby/issues' } s.required_ruby_version = '>= 2.1' s.files = [ 'lib/string_utility.rb', 'lib/string-utility.rb', 'CHANGELOG.md', 'LICENSE.md', ] end
Allow sending an instance of Rusen::Settings to the middleware
require 'rusen/settings' require 'rusen/notifier' require 'rusen/notification' module Rusen module Middleware class RusenRack def initialize(app, settings = {}) @app = app @rusen_settings = Settings.new @rusen_settings.outputs = settings[:outputs] @rusen_settings.sections = settings[:sections] @rusen_settings.email_prefix = settings[:email_prefix] @rusen_settings.sender_address = settings[:sender_address] @rusen_settings.exception_recipients = settings[:exception_recipients] @rusen_settings.smtp_settings = settings[:smtp_settings] @rusen_settings.exclude_if = settings[:exclude_if] @notifier = Notifier.new(@rusen_settings) end def call(env) begin @app.call(env) rescue Exception => error unless @rusen_settings.exclude_if.call(error) request = Rack::Request.new(env) @notifier.notify(error, request.GET.merge(request.POST), env, request.session) end raise end end end end end
require 'rusen/settings' require 'rusen/notifier' require 'rusen/notification' module Rusen module Middleware class RusenRack def initialize(app, settings = {}) @app = app if settings.is_a?(::Rusen::Settings) @rusen_settings = settings else @rusen_settings = Settings.new @rusen_settings.outputs = settings[:outputs] @rusen_settings.sections = settings[:sections] @rusen_settings.email_prefix = settings[:email_prefix] @rusen_settings.sender_address = settings[:sender_address] @rusen_settings.exception_recipients = settings[:exception_recipients] @rusen_settings.smtp_settings = settings[:smtp_settings] @rusen_settings.exclude_if = settings[:exclude_if] end @notifier = Notifier.new(@rusen_settings) end def call(env) begin @app.call(env) rescue Exception => error unless @rusen_settings.exclude_if.call(error) request = Rack::Request.new(env) @notifier.notify(error, request.GET.merge(request.POST), env, request.session) end raise end end end end end
Add 'is_bare' option to ChangeLogger constructor.
require 'grit' require 'changelogger/commit_formatter' require 'changelogger/commit_filter' class ChangeLogger def initialize(repo_dir) @repo = Grit::Repo.new(repo_dir) end def changelog(formatter = CommitFormatter.new, filter = CommitFilter.new) tags = @repo.tags changelog = "" @repo.commits(@repo.head.name, false).each do |commit| tag = tags.find { |t| t.commit.id == commit.id } changelog += ("\n" + tag.name + "\n") unless tag.nil? changelog += (formatter.format(commit) + "\n") unless !filter.filter(commit) end changelog end end
require 'grit' require 'changelogger/commit_formatter' require 'changelogger/commit_filter' class ChangeLogger def initialize(repo_dir, is_bare = false) @repo = Grit::Repo.new(repo_dir, :is_bare => is_bare) end def changelog(formatter = CommitFormatter.new, filter = CommitFilter.new) tags = @repo.tags changelog = "" @repo.commits(@repo.head.name, false).each do |commit| tag = tags.find { |t| t.commit.id == commit.id } changelog += ("\n" + tag.name + "\n") unless tag.nil? changelog += (formatter.format(commit) + "\n") unless !filter.filter(commit) end changelog end end
Add rake task that prints the publisher inventory to console
namespace :publisher_inventory do task :print_winback_publishers => :environment do total_verified_publishers = Publisher.where(verified: true).count total_unverified_publishers = Publisher.where(verified: false).count total_winback_publishers = Publisher.get_winback_publishers.count puts "---Publisher Inventory----" puts "Verified Publishers: #{total_verified_publishers}" puts "Unverified Publishers: #{total_unverified_publishers}" puts "Winback Publishers: #{total_winback_publishers}" puts "--------------------------" end end
Use built-in JSON parser when Ruby 1.9 in order to avoid Rails bandled broken JSON parser
require 'open-uri' module I18nTranslationGeneratorModule class Translator def initialize(lang) @lang, @cache = lang, {} end def translate(word) return @cache[word] if @cache[word] begin w = CGI.escape ActiveSupport::Inflector.humanize(word) json = OpenURI.open_uri("http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=#{w}&langpair=en%7C#{@lang}").read result = ActiveSupport::JSON.decode(json) result['responseStatus'] == 200 ? (@cache[word] = result['responseData']['translatedText']) : word rescue => e puts %Q[failed to translate "#{word}" into "#{@lang}" language.] word end end end end
require 'open-uri' require 'json' if RUBY_VERSION >= '1.9' module I18nTranslationGeneratorModule class Translator def initialize(lang) @lang, @cache = lang, {} end def translate(word) return @cache[word] if @cache[word] begin w = CGI.escape ActiveSupport::Inflector.humanize(word) json = OpenURI.open_uri("http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=#{w}&langpair=en%7C#{@lang}").read result = if RUBY_VERSION >= '1.9' ::JSON.parse json else ActiveSupport::JSON.decode(json) end result['responseStatus'] == 200 ? (@cache[word] = result['responseData']['translatedText']) : word rescue => e puts %Q[failed to translate "#{word}" into "#{@lang}" language.] word end end end end
Fix thor dependency Rails 3.2 depends on thor ~> 0.14.6
# -*- encoding: utf-8 -*- $:.unshift File.expand_path("../lib", __FILE__) require "guard/version" Gem::Specification.new do |s| s.name = 'guard' s.version = Guard::VERSION s.platform = Gem::Platform::RUBY s.authors = ['Thibaud Guillaume-Gentil'] s.email = ['thibaud@thibaud.me'] s.homepage = 'https://github.com/guard/guard' s.summary = 'Guard keeps an eye on your file modifications' s.description = 'Guard is a command line tool to easily handle events on file system modifications.' s.required_rubygems_version = '>= 1.3.6' s.rubyforge_project = 'guard' s.add_dependency 'thor', '~> 0.15.2' s.add_dependency 'listen', '>= 0.4.2' s.add_development_dependency 'bundler' s.add_development_dependency 'rspec', '~> 2.10.0' s.add_development_dependency 'guard-rspec', '~> 0.7.0' s.add_development_dependency 'yard' s.add_development_dependency 'redcarpet' s.add_development_dependency 'pry' s.files = Dir.glob('{bin,images,lib}/**/*') + %w[CHANGELOG.md LICENSE man/guard.1 man/guard.1.html README.md] s.executable = 'guard' s.require_path = 'lib' end
# -*- encoding: utf-8 -*- $:.unshift File.expand_path("../lib", __FILE__) require "guard/version" Gem::Specification.new do |s| s.name = 'guard' s.version = Guard::VERSION s.platform = Gem::Platform::RUBY s.authors = ['Thibaud Guillaume-Gentil'] s.email = ['thibaud@thibaud.me'] s.homepage = 'https://github.com/guard/guard' s.summary = 'Guard keeps an eye on your file modifications' s.description = 'Guard is a command line tool to easily handle events on file system modifications.' s.required_rubygems_version = '>= 1.3.6' s.rubyforge_project = 'guard' s.add_dependency 'thor', '>= 0.14.6' s.add_dependency 'listen', '>= 0.4.2' s.add_development_dependency 'bundler' s.add_development_dependency 'rspec', '~> 2.10.0' s.add_development_dependency 'guard-rspec', '~> 0.7.0' s.add_development_dependency 'yard' s.add_development_dependency 'redcarpet' s.add_development_dependency 'pry' s.files = Dir.glob('{bin,images,lib}/**/*') + %w[CHANGELOG.md LICENSE man/guard.1 man/guard.1.html README.md] s.executable = 'guard' s.require_path = 'lib' end
Add some tests for the Keygen class
# encoding: utf-8 require 'spec_helper' require 'mdwnin/keygen' describe Mdwnin::Keygen do subject { Mdwnin::Keygen } describe ".generate" do it "returns a non empty string" do subject.generate.wont_be_empty end it "is comprised of lowercase letters, numbers, and one dot" do key = subject.generate key.must_match /^[a-z0-9.]+$/ key.count('.').must_equal 1 end end end
# encoding: utf-8 require 'spec_helper' require 'mdwnin/keygen' describe Mdwnin::Keygen do subject { Mdwnin::Keygen } let(:time) { Time.at(42) } describe ".generate" do it "returns a non empty string" do subject.generate.wont_be_empty end it "is comprised of lowercase letters, numbers, and one dot" do key = subject.generate key.must_match /^[a-z0-9.]+$/ key.count('.').must_equal 1 end it "takes an optional base time" do key = subject.generate(time) key.must_match time.usec.to_s(36) end it "does not return the same key for two runs atthe same time" do key1 = subject.generate(time) key2 = subject.generate(time) key1.wont_equal key2 end end end
Fix the execute resource in streamingcollection
# # Cookbook Name:: wt_streamingcollection # Recipe:: default # # Copyright 2012, Webtrends # # All rights reserved - Do Not Redistribute # user = node[:user] group = node[:group] tarball = node[:tarball] log_dir = "#{node['wt_common']['log_dir_linux']}/streamingcollection" install_dir = "#{node['wt_common']['install_dir_linux']}/streamingcollection" download_url = node[:download_url] directory "#{log_dir}" do owner "root" group "root" mode "0755" recursive true action :create end directory "#{install_dir}/bin" do owner "root" group "root" mode "0755" recursive true action :create end remote_file "/tmp/#{tarball}" do source download_url mode "0644" end execute "tar" do user "root" group "root" cwd install_dir command "tar zxf /tmp/#{tarball}" end template "#{install_dir}/bin/streamingcollection" do source "streamingcollectionservice.erb" owner "root" group "root" mode "0755" end runit_service "streamingcollection" do action :start end execute "delete_install_source" do user "root" group "root" run "rm -f /tmp/#{tarball}" end
# # Cookbook Name:: wt_streamingcollection # Recipe:: default # # Copyright 2012, Webtrends # # All rights reserved - Do Not Redistribute # user = node[:user] group = node[:group] tarball = node[:tarball] log_dir = "#{node['wt_common']['log_dir_linux']}/streamingcollection" install_dir = "#{node['wt_common']['install_dir_linux']}/streamingcollection" download_url = node[:download_url] directory "#{log_dir}" do owner "root" group "root" mode "0755" recursive true action :create end directory "#{install_dir}/bin" do owner "root" group "root" mode "0755" recursive true action :create end remote_file "/tmp/#{tarball}" do source download_url mode "0644" end execute "tar" do user "root" group "root" cwd install_dir command "tar zxf /tmp/#{tarball}" end template "#{install_dir}/bin/streamingcollection" do source "streamingcollectionservice.erb" owner "root" group "root" mode "0755" end runit_service "streamingcollection" do action :start end execute "delete_install_source" do user "root" group "root" execute "rm -f /tmp/#{tarball}" action :run end
Add feature specs that show working config
require "spec_helper" RSpec.feature "Example Feature Spec" do scenario "When using Rack Test, it works" do visit "/users" expect(page).to have_text("Log in with your Rails Portal (development) account.") end scenario "When using Chrome, it works", js: true do visit "/users" expect(page).to have_text("foobar") end end
Add better generic message for API version differences
module BugherdClient module Errors class InvalidOption < StandardError def initialize(msg="invalid option") super(msg) end end class UnsupportedMethod < StandardError def initialize(api_version="") super("Method supported in API version #{api_version}") end end class UnsupportedAttribute < StandardError def initialize(api_version="", attrs=[]) super("Attributes (#{attrs.join(',')}) supported in #{api_version}") end end end end
module BugherdClient module Errors class InvalidOption < StandardError def initialize(msg="invalid option") super(msg) end end class NotAvailable < StandardError def initialize(api_version, msg="") super("#{msg} not available in API v#{api_version}") end end class UnsupportedMethod < StandardError def initialize(api_version="") super("Method supported in API version #{api_version}") end end class UnsupportedAttribute < StandardError def initialize(api_version="", attrs=[]) super("Attributes (#{attrs.join(',')}) supported in #{api_version}") end end end end
Use the correct variable for things
require "howdoi/version" require 'nokogiri' require 'open-uri' module Howdoi class Searcher attr_accessor :result SITES = { "computers" => "http://stackoverflow.com", "program" => "http://programmers.stackexchange.com", "sysadmin" => "http://serverfault.com" } def initialize(site) search_val = get_search_val doc = Nokogiri::HTML(open("#{SITES[site]}/search?q=#{search}")) @result = "#{SITES[site]}#{doc.css(".result-link a").first.attribute("href").value}" end def get_search_val errors = File.open("/tmp/howdoi_errors") end end end
require "howdoi/version" require 'nokogiri' require 'open-uri' module Howdoi class Searcher attr_accessor :result SITES = { "computers" => "http://stackoverflow.com", "program" => "http://programmers.stackexchange.com", "sysadmin" => "http://serverfault.com" } def initialize(site) search_val = get_search_val doc = Nokogiri::HTML(open("#{SITES[site]}/search?q=#{search_val}")) @result = "#{SITES[site]}#{doc.css(".result-link a").first.attribute("href").value}" end def get_search_val errors = File.open("/tmp/howdoi_errors") end end end
Remove windows hack for finding dlls.
# If running on Windows, then add the current directory to the PATH # for the current process so it can find the pre-built libxml2 and # iconv2 shared libraries (dlls). if RUBY_PLATFORM.match(/mswin/i) ENV['PATH'] += ";#{File.dirname(__FILE__)}" end # Load the C-based binding. require 'libxml_ruby' # Load Ruby supporting code. require 'libxml/error' require 'libxml/parser' require 'libxml/document' require 'libxml/namespaces' require 'libxml/namespace' require 'libxml/node' require 'libxml/ns' require 'libxml/attributes' require 'libxml/attr' require 'libxml/attr_decl' require 'libxml/tree' require 'libxml/reader' require 'libxml/html_parser' require 'libxml/sax_parser' require 'libxml/sax_callbacks' require 'libxml/xpath_object' # Deprecated require 'libxml/properties'
# Load the C-based binding. require 'libxml_ruby' # Load Ruby supporting code. require 'libxml/error' require 'libxml/parser' require 'libxml/document' require 'libxml/namespaces' require 'libxml/namespace' require 'libxml/node' require 'libxml/ns' require 'libxml/attributes' require 'libxml/attr' require 'libxml/attr_decl' require 'libxml/tree' require 'libxml/reader' require 'libxml/html_parser' require 'libxml/sax_parser' require 'libxml/sax_callbacks' require 'libxml/xpath_object' # Deprecated require 'libxml/properties'
Add time to activity parameters.
require 'typhoeus' require 'config' require 'JSON' module TpCommandLine class ActivityTrack attr_reader :request def initialize(args) description = determine_description(args) config_data = TpCommandLine::Config.new.load_config @server_url = config_data["timepulse_url"] @request_options = { method: :post, body: JSON.dump({ activity: { description: description, project_id: config_data['project_id'], source: "API" } }), headers: { login: config_data['login'], Authorization: config_data['authorization'], 'Accept-Encoding' => 'application/json', 'Content-Type' => 'application/json' } } end #determine user activity and user feedback or what to POST def determine_description(args) if args[0] == "note" && args[1].is_a?(String) args[1] elsif args[0] == "cwd" "Changed working directory" else raise ArgumentError end end def send_to_timepulse @request = Typhoeus::Request.new(@server_url, @request_options) begin @request.run rescue StandardError => err puts "\n Please check your internet connection and that the project site is not currently offline." end handle_response(@request.response) end def handle_response(response) if response.success? puts "The activity was sent to TimePulse." else puts "There was an error sending to TimePulse." end end end end
require 'typhoeus' require 'config' require 'JSON' module TpCommandLine class ActivityTrack attr_reader :request def initialize(args) description = determine_description(args) config_data = TpCommandLine::Config.new.load_config @server_url = config_data["timepulse_url"] @request_options = { method: :post, body: JSON.dump({ activity: { description: description, project_id: config_data['project_id'], source: "API", time: Time.now.utc } }), headers: { login: config_data['login'], Authorization: config_data['authorization'], 'Accept-Encoding' => 'application/json', 'Content-Type' => 'application/json' } } end #determine user activity and user feedback or what to POST def determine_description(args) if args[0] == "note" && args[1].is_a?(String) args[1] elsif args[0] == "cwd" "Changed working directory" else raise ArgumentError end end def send_to_timepulse @request = Typhoeus::Request.new(@server_url, @request_options) begin @request.run rescue StandardError => err puts "\n Please check your internet connection and that the project site is not currently offline." end handle_response(@request.response) end def handle_response(response) if response.success? puts "The activity was sent to TimePulse." else puts "There was an error sending to TimePulse." end end end end
Add specs for utility methods.
require 'spec_helper' describe GithubCLI::Util do describe '#flatten_has' do let(:hash) { { :a => { :b => { :c => 1 }}} } it 'preserves original hash' do hash = { :a => 1, :b => 2 } output = {} subject.flatten_hash hash, output output.should == hash end it "reduces multidimensional keys to one dimension" do output = {} subject.flatten_hash hash, output output.should == { :a_b_c => 1 } end end describe '#convert_values' do let(:values) { [true, {:a => false }, 'string']} it "converts ruby boolean to string" do subject.convert_values(values).should include "true" subject.convert_values(values).should_not include true end it "converts recursively" do subject.convert_values(values).should include ['false'] end it 'preserves strings' do subject.convert_values(values).should include 'string' end end end # GithubCLI::Util
Add Pry to development dependencies
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'well_read_faker/version' Gem::Specification.new do |spec| spec.name = "well_read_faker" spec.version = WellReadFaker::VERSION spec.authors = ["Sebastian Skałacki"] spec.email = ["skalee@gmail.com"] spec.summary = %q{Returns random fragments of Iliad or other book.} spec.description = %q{A replacement for various lorem ipsum generators.} spec.homepage = "https://github.com/skalee/well_read_faker" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0").reject do |f| f.match(%r{^(test|spec|features)/}) end spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 1.14" spec.add_development_dependency "rake", "~> 10.0" spec.add_development_dependency "rspec", "~> 3.5" end
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'well_read_faker/version' Gem::Specification.new do |spec| spec.name = "well_read_faker" spec.version = WellReadFaker::VERSION spec.authors = ["Sebastian Skałacki"] spec.email = ["skalee@gmail.com"] spec.summary = %q{Returns random fragments of Iliad or other book.} spec.description = %q{A replacement for various lorem ipsum generators.} spec.homepage = "https://github.com/skalee/well_read_faker" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0").reject do |f| f.match(%r{^(test|spec|features)/}) end spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 1.14" spec.add_development_dependency "pry" spec.add_development_dependency "rake", "~> 10.0" spec.add_development_dependency "rspec", "~> 3.5" end
Add concept of parent to pieces
module Everything module AddPiecesToPieceRefinement refine Everything::Piece do def public_pieces pieces.select do |piece| piece.public? end end def pieces file_paths_under_piece = Dir.glob(File.join(full_path, '*')) sub_pieces_paths = file_paths_under_piece .select do |file_path_under_piece| File.directory?(file_path_under_piece) end sub_pieces_paths.map do |sub_piece_path| Piece.new(sub_piece_path) end end end end end
module Everything module AddPiecesToPieceRefinement refine Everything::Piece do attr_reader :parent def parent=(parent_piece) @parent = parent_piece end def public_pieces pieces.select do |piece| piece.public? end end def pieces file_paths_under_piece = Dir.glob(File.join(full_path, '*')) sub_pieces_paths = file_paths_under_piece .select do |file_path_under_piece| File.directory?(file_path_under_piece) end sub_pieces_paths.map do |sub_piece_path| Piece.new(sub_piece_path) .tap {|p| p.parent = self } end end end end end
Update LibVersion for new RequireJS release
module Requirejs module Rails Version = "0.7.3" LibVersion = "1.0.7" end end
module Requirejs module Rails Version = "0.7.3" LibVersion = "1.0.8" end end
Remove cached_default reference in favor of plain old default.
module Spree Store.class_eval do has_and_belongs_to_many :products, :join_table => 'spree_products_stores' has_many :taxonomies has_many :orders has_many :store_payment_methods has_many :payment_methods, :through => :store_payment_methods has_many :store_shipping_methods has_many :shipping_methods, :through => :store_shipping_methods has_and_belongs_to_many :promotion_rules, :class_name => 'Spree::Promotion::Rules::Store', :join_table => 'spree_promotion_rules_stores', :association_foreign_key => 'promotion_rule_id' has_attached_file :logo, :styles => { :mini => '48x48>', :small => '100x100>', :medium => '250x250>' }, :default_style => :medium, :url => 'stores/:id/:style/:basename.:extension', :path => 'stores/:id/:style/:basename.:extension', :convert_options => { :all => '-strip -auto-orient' } def self.current(domain = nil) current_store = domain ? Store.by_url(domain).first : nil current_store || cached_default end end end
module Spree Store.class_eval do has_and_belongs_to_many :products, :join_table => 'spree_products_stores' has_many :taxonomies has_many :orders has_many :store_payment_methods has_many :payment_methods, :through => :store_payment_methods has_many :store_shipping_methods has_many :shipping_methods, :through => :store_shipping_methods has_and_belongs_to_many :promotion_rules, :class_name => 'Spree::Promotion::Rules::Store', :join_table => 'spree_promotion_rules_stores', :association_foreign_key => 'promotion_rule_id' has_attached_file :logo, :styles => { :mini => '48x48>', :small => '100x100>', :medium => '250x250>' }, :default_style => :medium, :url => 'stores/:id/:style/:basename.:extension', :path => 'stores/:id/:style/:basename.:extension', :convert_options => { :all => '-strip -auto-orient' } def self.current(domain = nil) current_store = domain ? Store.by_url(domain).first : nil current_store || Store.default end end end
Use git ls-files command but scope it to lib dir
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'rails_legit/version' Gem::Specification.new do |spec| spec.name = "rails_legit" spec.version = RailsLegit::VERSION spec.authors = ["Kashyap"] spec.email = ["kashyap.kmbc@gmail.com"] spec.description = %q{Provides a DSL for common validation formats like Date, Array, DateTime etc.} spec.summary = %q{Provides a DSL for common validation formats like Date, Array, DateTime etc.} spec.homepage = "" spec.license = "MIT" spec.files = Dir.glob('lib/**/*') + ['Rakefile', 'README.md', 'LICENSE.txt'] spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" spec.add_development_dependency "rspec" spec.add_dependency "activemodel", "> 3.0" end
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'rails_legit/version' Gem::Specification.new do |spec| spec.name = "rails_legit" spec.version = RailsLegit::VERSION spec.authors = ["Kashyap"] spec.email = ["kashyap.kmbc@gmail.com"] spec.description = %q{Provides a DSL for common validation formats like Date, Array, DateTime etc.} spec.summary = %q{Provides a DSL for common validation formats like Date, Array, DateTime etc.} spec.homepage = "" spec.license = "MIT" spec.files = `git ls-files lib`.split($/) + ['Rakefile', 'README.md', 'LICENSE.txt'] spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" spec.add_development_dependency "rspec" spec.add_dependency "activemodel", "> 3.0" end
Update gemspec (on rubygems now)
Gem::Specification.new do |s| s.name = "Dit" s.version = "0.1" s.date = "2015-10-14" s.summary = "Dit is a dotfiles manager that thinks it's git." s.description = "Dit is a dotfiles manager that wraps around git and makes " + "dotfiles easy to manage across devices." s.authors = [ "Kyle Fahringer" ] s.files = [ "lib/dit.rb" ] s.executables << 'dit' s.license = "MIT" s.homepage = "http://github.com/vulpino/dit" s.add_runtime_dependency 'thor' s.add_runtime_dependency 'git' s.add_runtime_dependency 'os' end
Gem::Specification.new do |s| s.name = "dit" s.version = "0.1.1" s.date = "2015-10-14" s.summary = "Dit is a dotfiles manager that thinks it's git." s.description = "Dit is a dotfiles manager that wraps around git and makes " + "dotfiles easy to manage across devices." s.authors = [ "Kyle Fahringer" ] s.files = [ "lib/dit.rb" ] s.executables << 'dit' s.license = "MIT" s.homepage = "http://github.com/vulpino/dit" s.email = "hispanic@hush.ai" s.add_runtime_dependency 'thor', '~> 0.19.1' s.add_runtime_dependency 'git', '~> 1.2', '>= 1.2.9' s.add_runtime_dependency 'os', '~> 0.9.6' end
Reduce repetition in last day of the month generator
require 'spec_helper' describe Upcoming::LastDayOfMonthGenerator do Given(:subject) { Upcoming::LastDayOfMonthGenerator.new } When(:valid) { subject.valid?(date) } context 'start of the month is invalid' do Given(:date) { Date.parse('2014-06-01') } Then { !valid } end context 'middle of the month is invalid' do Given(:date) { Date.parse('2014-06-15') } Then { !valid } end context 'last day of the month is valid' do Given(:date) { Date.parse('2014-05-31') } Then { valid } end context 'last day of February in a leap year is valid' do Given(:date) { Date.parse('2012-02-29') } Then { valid } end end
require 'spec_helper' describe Upcoming::LastDayOfMonthGenerator do Given(:subject) { Upcoming::LastDayOfMonthGenerator.new } When(:valid) { subject.valid?(Date.parse(date)) } context 'start of the month is invalid' do Given(:date) { '2014-06-01' } Then { !valid } end context 'middle of the month is invalid' do Given(:date) { '2014-06-15' } Then { !valid } end context 'last day of the month is valid' do Given(:date) { '2014-05-31' } Then { valid } end context 'last day of February in a leap year is valid' do Given(:date) { '2012-02-29' } Then { valid } end end
Use expect not_to be_empty instead of raise
require_relative 'helper/spec_helper' describe HockeyGerrit do let(:hockey) { HockeyGerrit.new } it '#git_log' do log = hockey.git_log raise 'git_log fail' if log.empty? end it '#git_commit_sha' do log = hockey.git_commit_sha raise 'git_commit_sha fail' if log.empty? end end
require_relative 'helper/spec_helper' describe HockeyGerrit do let(:hockey) { HockeyGerrit.new } it '#git_log' do expect(hockey.git_log).not_to be_empty end it '#git_commit_sha' do expect(hockey.git_commit_sha).not_to be_empty end end
Use the correct type for values in PropertiesChanged
#!/usr/bin/env rspec # frozen_string_literal: true require_relative "spec_helper" require "dbus" class ObjectTest < DBus::Object T = DBus::Type unless const_defined? "T" dbus_interface "org.ruby.ServerTest" do dbus_attr_writer :write_me, T::Struct[String, String] end end describe DBus::Object do describe ".dbus_attr_writer" do describe "the declared assignment method" do # Slightly advanced RSpec: # https://rspec.info/documentation/3.9/rspec-expectations/RSpec/Matchers.html#satisfy-instance_method let(:a_struct_in_a_variant) do satisfying { |x| x.is_a?(DBus::Data::Variant) && x.member_type.to_s == "(ss)" } # ^ This formatting keeps the matcher on a single line # which enables RSpect to cite it if it fails, instead of saying "block". end it "emits PropertyChanged with correctly typed argument" do obj = ObjectTest.new("/test") expect(obj).to receive(:PropertiesChanged).with( "org.ruby.ServerTest", { "WriteMe" => a_struct_in_a_variant }, [] ) # bug: call PC with simply the assigned value, # which will need type guessing obj.write_me = ["two", "strings"] end end end end
Disable WebMock for the CodeClimate connection
require "codeclimate-test-reporter" CodeClimate::TestReporter.start require 'minitest/autorun' require 'webmock/minitest' require 'vcr' require "minitest/reporters" Minitest::Reporters.use! #we need the actual library file require_relative '../lib/bus-o-matic.rb'
# Let's get coverage reporting from Codeclimate WebMock.disable_net_connect!(:allow => "codeclimate.com") require "codeclimate-test-reporter" CodeClimate::TestReporter.start require 'minitest/autorun' require 'webmock/minitest' require 'vcr' require "minitest/reporters" Minitest::Reporters.use! #we need the actual library file require_relative '../lib/bus-o-matic.rb'
Increase version from 0.0.1.3 to 0.0.1.4
# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'identifier-uuid' s.version = '0.0.1.3' s.summary = 'UUID identifier generator with support for dependency configuration for real and null object implementations' s.description = ' ' s.authors = ['Obsidian Software, Inc'] s.email = 'opensource@obsidianexchange.com' s.homepage = 'https://github.com/obsidian-btc/identifier-uuid' s.licenses = ['MIT'] s.require_paths = ['lib'] s.files = Dir.glob('{lib}/**/*') s.platform = Gem::Platform::RUBY s.required_ruby_version = '>= 2.2.3' s.add_runtime_dependency 'naught' s.add_development_dependency 'test_bench' end
# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'identifier-uuid' s.version = '0.0.1.4' s.summary = 'UUID identifier generator with support for dependency configuration for real and null object implementations' s.description = ' ' s.authors = ['Obsidian Software, Inc'] s.email = 'opensource@obsidianexchange.com' s.homepage = 'https://github.com/obsidian-btc/identifier-uuid' s.licenses = ['MIT'] s.require_paths = ['lib'] s.files = Dir.glob('{lib}/**/*') s.platform = Gem::Platform::RUBY s.required_ruby_version = '>= 2.2.3' s.add_runtime_dependency 'naught' s.add_development_dependency 'test_bench' end
Add test for attribute accessors
require 'test_helper' class MailFormTest < ActiveSupport::TestCase test "truth" do assert_kind_of Module, MailForm end end
require 'test_helper' require 'fixtures/sample_mail' class MailFormTest < ActiveSupport::TestCase test "sample mail has name and email as attributes" do sample = SampleMail.new sample.name = "User" assert_equal "User", sample.name sample.email = "user@example.com" assert_equal "user@example.com", sample.email end end
Add pseudocode for acct groups
# PSEUDOCODE # Input: an array containing everyone's names # Output: an array of arrays, with each array representing an accountability group # Requirements/principles: every group has at least three and at most five people. Group selection is totally random and doesn't repeat # Steps: # Option 1: cheater's way. I believe there is some kind of built-in shuffle method for an array. So shuffle the names, then segment them into groups of 3-5 (more on how to do that in a second) # Option 2: # Let n = number of people. # Let n / 4 (integer division) = number of groups. We'll call it g. This will ensure no group has < 3 people or >5. # Initialize output array containing g empty arrays # While list of names isn't empty # => Randomly choose a name. We'll do this by picking number from 0 to input array length - 1. That's the index of the name we'll pick. # => Remove them from the input array # => Put them in the next available slot in the output array. To do this, we'll count up from 0 to g-1 with each name chosen so that each time it picks a different pod # Return output array
Add pipeline for portfolio's css
# Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = '1.0' # Add additional assets to the asset load path # Rails.application.config.assets.paths << Emoji.images_path # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. # Rails.application.config.assets.precompile += %w( search.js ) %w( home post reply ).each do |controller| Rails.application.config.assets.precompile += ["#{controller}.css"] end
# Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = '1.0' # Add additional assets to the asset load path # Rails.application.config.assets.paths << Emoji.images_path # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. # Rails.application.config.assets.precompile += %w( search.js ) %w( home post reply portfolio ).each do |controller| Rails.application.config.assets.precompile += ["#{controller}.css"] end
Change how we run jekyll in tests
require 'nokogiri' require 'jekyll-contentblocks' require 'pry-byebug' module SpecHelpers def jekyll_version @jekyll_version ||= `jekyll --version`.strip.gsub('jekyll ', '') end def generate_test_site system 'rm -rf test/_site' system 'jekyll build -s test/ -d test/_site &> /dev/null' end def load_html(file) path = "test/_site/#{file}" if File.exists?(path) index_html = File.read(path) Nokogiri::Slop(index_html).html end end def load_item_html(item) if Jekyll.version_less_than?('2.1.0') load_html("items/#{item}.html") else load_html("items/#{item}/index.html") end end end RSpec.configure do |config| config.extend(SpecHelpers) config.include(SpecHelpers) end
require 'nokogiri' require 'jekyll-contentblocks' require 'pry-byebug' require 'open3' module SpecHelpers def jekyll_version @jekyll_version ||= `jekyll --version`.strip.gsub('jekyll ', '') end def generate_test_site FileUtils.rm_rf('test/_site') exit_status = -1 Open3.popen3('jekyll build -s test/ -d test/_site') do |i, o, e, t| o.read exit_status = t.value.exitstatus end exit_status == 0 end def load_html(file) path = "test/_site/#{file}" if File.exists?(path) index_html = File.read(path) Nokogiri::Slop(index_html).html end end def load_item_html(item) if Jekyll.version_less_than?('2.1.0') load_html("items/#{item}.html") else load_html("items/#{item}/index.html") end end end RSpec.configure do |config| config.extend(SpecHelpers) config.include(SpecHelpers) end
Rollback bundle dependency to >= 1.6
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'action_conductor/version' Gem::Specification.new do |spec| spec.name = "action_conductor" spec.version = ActionConductor::VERSION spec.authors = ["Adam Cuppy"] spec.email = ["adam@codingzeal.com"] spec.summary = %q{DRY-up Rails controllers by leveraging interchangeable conductors to export data} spec.homepage = "https://github.com/acuppy/action_conductor" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0") spec.test_files = spec.files.grep(%r{^(spec|features)/}) spec.require_paths = ["lib"] spec.add_runtime_dependency 'rails', '~> 4.0', '>= 4.0.0' spec.add_development_dependency 'bundler', '~> 1.7' spec.add_development_dependency "rake", "~> 10.0" spec.add_development_dependency 'rspec', '~> 3.0', '>= 3.0.0' end
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'action_conductor/version' Gem::Specification.new do |spec| spec.name = "action_conductor" spec.version = ActionConductor::VERSION spec.authors = ["Adam Cuppy"] spec.email = ["adam@codingzeal.com"] spec.summary = %q{DRY-up Rails controllers by leveraging interchangeable conductors to export data} spec.homepage = "https://github.com/acuppy/action_conductor" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0") spec.test_files = spec.files.grep(%r{^(spec|features)/}) spec.require_paths = ["lib"] spec.add_runtime_dependency 'rails', '~> 4.0', '>= 4.0.0' spec.add_development_dependency 'bundler', '>= 1.6' spec.add_development_dependency "rake", "~> 10.0" spec.add_development_dependency 'rspec', '~> 3.0', '>= 3.0.0' end
Change generation method for Cauchy Distribution.
module Croupier module Distributions ##################################################################### # Cauchy Distribution # Continuous probability distribution describing resonance behavior. # class Cauchy < ::Croupier::Distribution def initialize(options={}) @name = "Cauchy distribution" @description = "Continuous probability distribution describing resonance behavior" configure(options) raise Croupier::InputParamsError, "Invalid scale value, it must be positive" unless params[:scale] > 0 end def generate_number n = rand n == 0 ? generate_number : params[:location] + (params[:scale] * Math.tan(Math::PI * (n - 0.5))) end def default_parameters {:location => 0.0, :scale => 1.0} end def self.cli_name "cauchy" end def self.cli_options {:options => [ [:location, 'location param', {:type=>:float, :default => 0.0}], [:scale, 'scale param', {:type=>:float, :default => 1.0}], ], :banner => "Cauchy continuous distribution. Generate numbers following a Cauchy distribution with location and scale parameters" } end end end end
module Croupier module Distributions ##################################################################### # Cauchy Distribution # Continuous probability distribution describing resonance behavior. # class Cauchy < ::Croupier::Distribution def initialize(options={}) @name = "Cauchy distribution" @description = "Continuous probability distribution describing resonance behavior" configure(options) raise Croupier::InputParamsError, "Invalid scale value, it must be positive" unless params[:scale] > 0 end def inv_cdf n params[:location] + (params[:scale] * Math.tan(Math::PI * (0.5 - n))) end def default_parameters {:location => 0.0, :scale => 1.0} end def self.cli_name "cauchy" end def self.cli_options {:options => [ [:location, 'location param', {:type=>:float, :default => 0.0}], [:scale, 'scale param', {:type=>:float, :default => 1.0}], ], :banner => "Cauchy continuous distribution. Generate numbers following a Cauchy distribution with location and scale parameters" } end end end end
Add limits to event_code and psp_reference fields for notifications to make the unique index work
# @private class CreateAdyenNotifications < ActiveRecord::Migration def self.up create_table :adyen_notifications do |t| t.boolean :live, :null => false, :default => false t.string :event_code, :null => false t.string :psp_reference, :null => false t.string :original_reference, :null => true t.string :merchant_reference, :null => false t.string :merchant_account_code, :null => false t.datetime :event_date, :null => false t.boolean :success, :null => false, :default => false t.string :payment_method, :null => true t.string :operations, :null => true t.text :reason, :null => true t.string :currency, :null => true, :limit => 3 t.integer :value, :null => true t.boolean :processed, :null => false, :default => false t.timestamps end add_index :adyen_notifications, [:psp_reference, :event_code, :success], :unique => true, :name => 'adyen_notification_uniqueness' end def self.down drop_table :adyen_notifications end end
# @private class CreateAdyenNotifications < ActiveRecord::Migration def self.up create_table :adyen_notifications do |t| t.boolean :live, :null => false, :default => false t.string :event_code, :null => false, :limit => 20 t.string :psp_reference, :null => false, :limit => 30 t.string :original_reference, :null => true t.string :merchant_reference, :null => false t.string :merchant_account_code, :null => false t.datetime :event_date, :null => false t.boolean :success, :null => false, :default => false t.string :payment_method, :null => true t.string :operations, :null => true t.text :reason, :null => true t.string :currency, :null => true, :limit => 3 t.integer :value, :null => true t.boolean :processed, :null => false, :default => false t.timestamps end add_index :adyen_notifications, [:psp_reference, :event_code, :success], :unique => true, :name => 'adyen_notification_uniqueness' end def self.down drop_table :adyen_notifications end end
Add "has_fetchable_fields" matcher for JSON API
module SmartRspec module Matchers module JsonApiMatchers extend RSpec::Matchers::DSL include SmartRspec::Support::Controller::Response matcher :has_valid_id_and_type_members do |expected| match do |response| json(response).collection.all? do |record| record['id'].present? && record['type'] == expected end end end end end end
module SmartRspec module Matchers module JsonApiMatchers extend RSpec::Matchers::DSL include SmartRspec::Support::Controller::Response matcher :has_valid_id_and_type_members do |expected| match do |response| json(response).collection.all? do |record| record['id'].present? && record['type'] == expected end end end matcher :has_fetchable_fields do |fields| match do |response| json(response).collection.all? do |record| (record['attributes'].keys - fields).empty? end end end end end end
Make the output of this object prettier
module Punchblock class Event class Offer < Event register :offer, :core include HasHeaders def to read_attr :to end def to=(offer_to) write_attr :to, offer_to end def from read_attr :from end def from=(offer_from) write_attr :from, offer_from end def inspect_attributes # :nodoc: [:to, :from] + super end end # Offer end end # Punchblock
module Punchblock class Event class Offer < Event register :offer, :core include HasHeaders def to read_attr :to end def to=(offer_to) write_attr :to, offer_to end def from read_attr :from end def from=(offer_from) write_attr :from, offer_from end def inspect_attributes # :nodoc: [:to, :from] + super end def inspect "#<Punchblock::Event::Offer to=\"#{to}\", from=\"#{from}\", call_id=\"#{call_id}\"" end end # Offer end end # Punchblock
Add support for Data Center "local" attribute
module OVIRT class DataCenter < BaseObject attr_reader :description, :status, :storage_type, :storage_format, :supported_versions, :version def initialize(client, xml) super(client, xml[:id], xml[:href], (xml/'name').first.text) parse_xml_attributes!(xml) self end private def parse_xml_attributes!(xml) @description = (xml/'description').first.text rescue nil @status = (xml/'status').first.text.strip @storage_type = (xml/'storage_type').first.text rescue nil @storage_format = (xml/'storage_format').first.text rescue nil @supported_versions = (xml/'supported_versions').collect { |v| parse_version v } @version = parse_version xml rescue nil end end end
module OVIRT class DataCenter < BaseObject attr_reader :description, :status, :local, :storage_type, :storage_format, :supported_versions, :version def initialize(client, xml) super(client, xml[:id], xml[:href], (xml/'name').first.text) parse_xml_attributes!(xml) self end private def parse_xml_attributes!(xml) @description = (xml/'description').first.text rescue nil @status = (xml/'status').first.text.strip @local = parse_bool((xml/'local').first.text) rescue nil @storage_type = (xml/'storage_type').first.text rescue nil @storage_format = (xml/'storage_format').first.text rescue nil @supported_versions = (xml/'supported_versions').collect { |v| parse_version v } @version = parse_version xml rescue nil end end end
Fix stub in tesing for store method on worker
module Sidekiq module Status class << self def status(jid) :complete end end end module Storage def store_status(id, status, expiration = nil, redis_pool=nil) 'ok' end end end
module Sidekiq module Status class << self def status(jid) :complete end end end module Storage def store_status(id, status, expiration = nil, redis_pool=nil) 'ok' end def store_for_id(id, status_updates, expiration = nil, redis_pool=nil) 'ok' end end end
Add missing test-unit gem development dependency
# -*- encoding: utf-8 -*- Gem::Specification.new do |gem| gem.authors = ["Hidemasa Togashi"] gem.email = ["togachiro@gmail.com"] gem.description = %q{Fluentd plugin for Apache Kafka > 0.8} gem.summary = %q{Fluentd plugin for Apache Kafka > 0.8} gem.homepage = "https://github.com/htgc/fluent-plugin-kafka" gem.files = `git ls-files`.split($\) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.name = "fluent-plugin-kafka" gem.require_paths = ["lib"] gem.version = '0.1.4' gem.add_dependency 'fluentd' gem.add_dependency 'poseidon_cluster' gem.add_dependency 'ltsv' gem.add_dependency 'yajl-ruby' gem.add_dependency 'msgpack' gem.add_dependency 'zookeeper' end
# -*- encoding: utf-8 -*- Gem::Specification.new do |gem| gem.authors = ["Hidemasa Togashi"] gem.email = ["togachiro@gmail.com"] gem.description = %q{Fluentd plugin for Apache Kafka > 0.8} gem.summary = %q{Fluentd plugin for Apache Kafka > 0.8} gem.homepage = "https://github.com/htgc/fluent-plugin-kafka" gem.files = `git ls-files`.split($\) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.name = "fluent-plugin-kafka" gem.require_paths = ["lib"] gem.version = '0.1.4' gem.add_development_dependency 'test-unit' gem.add_dependency 'fluentd' gem.add_dependency 'poseidon_cluster' gem.add_dependency 'ltsv' gem.add_dependency 'yajl-ruby' gem.add_dependency 'msgpack' gem.add_dependency 'zookeeper' end
Update gemspec to be compatible with Jekyll 3.8.7
# frozen_string_literal: true Gem::Specification.new do |spec| spec.name = "no-style-please" spec.version = "0.1.0" spec.authors = ["Riccardo Graziosi"] spec.email = ["riccardo.graziosi97@gmail.com"] spec.summary = "A (nearly) no-css minimalist Jekyll theme." spec.homepage = "https://github.com/riggraz/no-style-please" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r!^(assets|_layouts|_includes|_sass|LICENSE|README|_config\.yml)!i) } spec.add_runtime_dependency "jekyll", "~> 4.1" spec.add_runtime_dependency "jekyll-feed", "~> 0.14" spec.add_runtime_dependency "jekyll-seo-tag", "~> 2.6" end
# frozen_string_literal: true Gem::Specification.new do |spec| spec.name = "no-style-please" spec.version = "0.1.1" spec.authors = ["Riccardo Graziosi"] spec.email = ["riccardo.graziosi97@gmail.com"] spec.summary = "A (nearly) no-css minimalist Jekyll theme." spec.homepage = "https://github.com/riggraz/no-style-please" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r!^(assets|_layouts|_includes|_sass|LICENSE|README|_config\.yml)!i) } spec.add_runtime_dependency "jekyll", "~> 3.8.7" spec.add_runtime_dependency "jekyll-feed", "~> 0.13.0" spec.add_runtime_dependency "jekyll-seo-tag", "~> 2.6.1" end
Remove the ntpstat used for spof
require 'spec_helper' # # cloud::init # describe port(22) do it { should be_listening.with('tcp') } end # test if DNS is working describe command("timeout 1 dig #{property[:vip_public]}") do it { should return_exit_status 0 } end # NTP is needed to synchronize the cluster # using 'ntpstat' command # Note: ntpstat is not yet present in Debian official repositories. # https://ftp-master.debian.org/new/ntpstat_0.0.0.1-1.html # exit status 0 - Clock is synchronised. # exit status 1 - Clock is not synchronised. # exit status 2 - If clock state is indeterminant, for example if ntpd is not contactable describe command("ntpstat") do it { should return_exit_status 0 } end
require 'spec_helper' # # cloud::init # describe port(22) do it { should be_listening.with('tcp') } end # test if DNS is working describe command("timeout 1 dig #{property[:vip_public]}") do it { should return_exit_status 0 } end
Replace id presence by a placeholder into the path
require 'rack/stats/version' require 'rack/stats/runtime' module Rack class Stats DEFAULT_STATS = [ { name: -> (*_args) { 'request_duration_global' }, value: -> (_req, d, _resp) { d.ms }, type: :timing }, { name: lambda do |req, _d, _resp| [ req.path.eql?('/') ? 'index' : req.path.gsub(/\//, '-'), req.request_method.downcase, 'request_duration' ] end, value: -> (_req, d, _resp) { d.ms }, type: :timing }, { name: -> (*_args) { 'request_number' }, type: :increment }, { name: lambda do |_req, _d, resp| ['request_number_status', "#{resp.status / 100}XX"] end, type: :increment } ] def initialize(app, args = {}) @app = app @namespace = args.fetch(:namespace, ENV['RACK_STATS_NAMESPACE']) @statsd = Statsd.new(*args.fetch(:statsd, '127.0.0.1:8125').split(':')) @stats = args.fetch(:stats, DEFAULT_STATS) end def call(env) Runtime.new(@statsd, @app, env, @stats, @namespace).execute end end end
require 'rack/stats/version' require 'rack/stats/runtime' module Rack class Stats DEFAULT_STATS = [ { name: -> (*_args) { 'request_duration_global' }, value: -> (_req, d, _resp) { d.ms }, type: :timing }, { name: lambda do |req, _d, _resp| [ req.path.eql?('/') ? 'index' : \ req.path[1..-1].gsub(/\/\d+\//, '/id/') .gsub(/\/\d+$/, '/id') .gsub(/\//, '_'), req.request_method.downcase, 'request_duration' ] end, value: -> (_req, d, _resp) { d.ms }, type: :timing }, { name: -> (*_args) { 'request_number' }, type: :increment }, { name: lambda do |_req, _d, resp| ['request_number_status', "#{resp.status / 100}XX"] end, type: :increment } ] def initialize(app, args = {}) @app = app @namespace = args.fetch(:namespace, ENV['RACK_STATS_NAMESPACE']) @statsd = Statsd.new(*args.fetch(:statsd, '127.0.0.1:8125').split(':')) @stats = args.fetch(:stats, DEFAULT_STATS) end def call(env) Runtime.new(@statsd, @app, env, @stats, @namespace).execute end end end
Fix CORS for authenticated API endpoints
Rails.application.config.middleware.insert_before 0, Rack::Cors do allow do origins '*' resource '/api/*', methods: :any, headers: 'Origin, X-Requested-With, Content-Type, Accept, Authorization', expose: 'X-Filename', if: Proc.new { |env| req = Rack::Request.new(env) if /\A\/api\/v3\/runs\/\w+\z/.match?(req.path) && req.delete? false elsif /\A\/api\/v3\/runs\/\w+\/disown\z/.match?(req.path) && req.post? false elsif /\A\/api\/v4\/runs\/\w+\z/.match?(req.path) && req.put? false else true end } end end
Rails.application.config.middleware.insert_before 0, Rack::Cors do allow do origins '*' resource '/api/*', methods: :any, headers: :any, expose: 'X-Filename', if: Proc.new { |env| req = Rack::Request.new(env) if /\A\/api\/v3\/runs\/\w+\z/.match?(req.path) && req.delete? false elsif /\A\/api\/v3\/runs\/\w+\/disown\z/.match?(req.path) && req.post? false elsif /\A\/api\/v4\/runs\/\w+\z/.match?(req.path) && req.put? false else true end } end end
Change to load files directly
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'tty/spinner/version' Gem::Specification.new do |spec| spec.name = 'tty-spinner' spec.version = TTY::Spinner::VERSION spec.authors = ['Piotr Murach'] spec.email = ['pmurach@gmail.com'] spec.summary = %q{A terminal spinner for tasks that have non-deterministic time frame.} spec.description = %q{A terminal spinner for tasks that have non-deterministic time frame.} spec.homepage = 'https://github.com/piotrmurach/tty-spinner' spec.license = 'MIT' spec.files = Dir['lib/**/*.rb', 'LICENSE.txt', 'README.md'] spec.require_paths = ['lib'] spec.add_runtime_dependency 'tty-cursor', '~> 0.6.0' spec.add_development_dependency 'bundler', '>= 1.5.0', '< 2.0' spec.add_development_dependency 'rspec', '~> 3.1' spec.add_development_dependency 'rake' end
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'tty/spinner/version' Gem::Specification.new do |spec| spec.name = 'tty-spinner' spec.version = TTY::Spinner::VERSION spec.authors = ['Piotr Murach'] spec.email = ['pmurach@gmail.com'] spec.summary = %q{A terminal spinner for tasks that have non-deterministic time frame.} spec.description = %q{A terminal spinner for tasks that have non-deterministic time frame.} spec.homepage = 'https://github.com/piotrmurach/tty-spinner' spec.license = 'MIT' spec.files = Dir['{lib,spec,examples}/**/*.rb'] spec.files += Dir['{bin,tasks}/*', 'tty-spinner.gemspec'] spec.files += Dir['README.md', 'CHANGELOG.md', 'LICENSE.txt', 'Rakefile'] spec.require_paths = ['lib'] spec.add_runtime_dependency 'tty-cursor', '~> 0.6.0' spec.add_development_dependency 'bundler', '>= 1.5.0', '< 2.0' spec.add_development_dependency 'rspec', '~> 3.1' spec.add_development_dependency 'rake' end
Support iOS and OS X
# # Be sure to run `pod lib lint NAME.podspec' to ensure this is a # valid spec and remove all comments before submitting the spec. # # Any lines starting with a # are optional, but encouraged # # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html # Pod::Spec.new do |s| s.name = "QBRateLimit" s.version = "1.0.0" s.summary = "Rate limit controller." s.description = "A rate limit controller for avoiding excess HTTP requests or preventing UI from being tapped repeatedly." s.homepage = "https://github.com/questbeat/QBRateLimit" s.license = 'MIT' s.author = { "questbeat" => "questbeat@gmail.com" } s.source = { :git => "https://github.com/questbeat/QBRateLimit.git", :tag => s.version.to_s } s.social_media_url = 'https://twitter.com/questbeat' s.platform = :ios, '6.0' s.requires_arc = true s.source_files = 'Classes' end
# # Be sure to run `pod lib lint NAME.podspec' to ensure this is a # valid spec and remove all comments before submitting the spec. # # Any lines starting with a # are optional, but encouraged # # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html # Pod::Spec.new do |s| s.name = "QBRateLimit" s.version = "1.0.0" s.summary = "Rate limit controller." s.description = "A rate limit controller for avoiding excess HTTP requests or preventing UI from being tapped repeatedly." s.homepage = "https://github.com/questbeat/QBRateLimit" s.license = 'MIT' s.author = { "questbeat" => "questbeat@gmail.com" } s.source = { :git => "https://github.com/questbeat/QBRateLimit.git", :tag => s.version.to_s } s.social_media_url = 'https://twitter.com/questbeat' s.requires_arc = true s.source_files = 'Classes' s.ios.deployment_target = '6.0' s.osx.deployment_target = '10.7' end
Delete manifest along with filename
module RubyProfRails class ProfileController < RubyProfRails::ApplicationController def show profile = RubyProf::Rails::Profiles.find(params[:id]) if profile time = profile.time.strftime('%Y-%m-%d_%I-%M-%S-%Z') send_file profile.filename, filename: "#{profile.hash[:prefix]}_#{time}.#{profile.hash[:format]}" else render text: 'Profiler file was not found and may have been deleted.' # write some content to the body end end def destroy profile = RubyProf::Rails::Profiles.find(params[:id]) if profile File.unlink profile.filename flash[:notice] = 'Profile deleted' else flash[:alert] = 'Profile not found' end redirect_to @routes.ruby_prof_rails_path end end end
module RubyProfRails class ProfileController < RubyProfRails::ApplicationController def show profile = RubyProf::Rails::Profiles.find(params[:id]) if profile time = profile.time.strftime('%Y-%m-%d_%I-%M-%S-%Z') send_file profile.filename, filename: "#{profile.hash[:prefix]}_#{time}.#{profile.hash[:format]}" else render text: 'Profiler file was not found and may have been deleted.' # write some content to the body end end def destroy profile = RubyProf::Rails::Profiles.find(params[:id]) if profile File.unlink profile.manifest File.unlink profile.filename flash[:notice] = 'Profile deleted' else flash[:alert] = 'Profile not found' end redirect_to @routes.ruby_prof_rails_path end end end
Add Universal Media Server.app v4.0.2 for Java8
class UniversalMediaServer < Cask version '4.0.2' sha256 '9fabc3561151aa256237cded007a25f776383bbcaf18d6bb58bb5a16c11e4e8c' url 'http://downloads.sourceforge.net/sourceforge/unimediaserver/Official%20Releases/OS%20X/UMS-4.0.2-Java8.dmg' homepage 'www.universalmediaserver.com' link 'Universal Media Server.app' end
Update OpenOffice to version 4.1
class Openoffice < Cask url 'http://downloads.sourceforge.net/project/openofficeorg.mirror/4.0.1/binaries/en-US/Apache_OpenOffice_4.0.1_MacOS_x86_install_en-US.dmg' homepage 'http://www.openoffice.org/' version '4.0.1' sha256 'a6350066eb4a7cb35db8fda6d27c2f22534233465a95a9d4065e61fc717b7c5f' link 'OpenOffice.app' end
class Openoffice < Cask url 'http://downloads.sourceforge.net/project/openofficeorg.mirror/4.1.0/binaries/en-US/Apache_OpenOffice_4.1.0_MacOS_x86-64_install_en-US.dmg' homepage 'http://www.openoffice.org/' version '4.1.0' sha256 'ac77ff69cbbd87523e019d3c68d839cba2f952b0b63c13fb948863c8f25eaa9a' link 'OpenOffice.app' end
Test returned path for Show More on mobile
# Copyright (c) 2010-2011, Diaspora Inc. This file is # licensed under the Affero General Public License version 3 or later. See # the COPYRIGHT file. require 'spec_helper' describe StreamHelper do describe "next_page_path" do def build_controller controller_class controller_class.new.tap {|c| c.request = controller.request } end before do @stream = Stream::Base.new(alice, :max_time => Time.now) end it 'works for public page' do helper.stub(:controller).and_return(build_controller(PostsController)) helper.next_page_path.should include '/public' end it 'works for stream page when current page is stream' do helper.stub(:current_page?).and_return(true) helper.stub(:controller).and_return(build_controller(StreamsController)) helper.next_page_path.should include stream_path end it 'works for activity page when current page is not stream' do helper.stub("current_page?").and_return(false) helper.stub(:controller).and_return(build_controller(StreamsController)) # binding.pry helper.next_page_path.should include activity_stream_path end end end
# Copyright (c) 2010-2011, Diaspora Inc. This file is # licensed under the Affero General Public License version 3 or later. See # the COPYRIGHT file. require 'spec_helper' describe StreamHelper do describe "next_page_path" do def build_controller controller_class controller_class.new.tap {|c| c.request = controller.request } end before do @stream = Stream::Base.new(alice, :max_time => Time.now) end it 'works for public page' do helper.stub(:controller).and_return(build_controller(PostsController)) helper.next_page_path.should include '/public' end it 'works for stream page when current page is stream' do helper.stub(:current_page?).and_return(false) helper.should_receive(:current_page?).with(:stream).and_return(true) helper.stub(:controller).and_return(build_controller(StreamsController)) helper.next_page_path.should include stream_path end it 'works for aspects page when current page is aspects' do helper.stub(:current_page?).and_return(false) helper.should_receive(:current_page?).with(:aspects_stream).and_return(true) helper.stub(:controller).and_return(build_controller(StreamsController)) helper.next_page_path.should include aspects_stream_path end it 'works for activity page when current page is not stream or aspects' do helper.stub(:current_page?).and_return(false) helper.stub(:controller).and_return(build_controller(StreamsController)) # binding.pry helper.next_page_path.should include activity_stream_path end end end
Add activerecord and activesupport gems
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'attr_deprecated/version' Gem::Specification.new do |spec| spec.name = "attr_deprecated" spec.version = AttrDeprecated::VERSION spec.authors = ["Anthony Erlinger"] spec.email = ["aerlinger@gmail.com"] spec.summary = %q{Mark unused model attributes as deprecated.} spec.description = %q{A simple and non-intrusive way to mark deprecated columns/attributes in your models. Any usage of these attributes will logged with a warning message and a trace of where the deprecated attribute was called. An exception can be optionally raised as well.} spec.homepage = "" spec.license = "MIT" spec.files = `git ls-files`.split($/) spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 1.5" spec.add_development_dependency "rake" spec.add_development_dependency "rspec", "2.14.1" end
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'attr_deprecated/version' Gem::Specification.new do |spec| spec.name = "attr_deprecated" spec.version = AttrDeprecated::VERSION spec.authors = ["Anthony Erlinger"] spec.email = ["anthony@handybook.com"] spec.summary = %q{Mark unused model attributes as deprecated.} spec.description = %q{A simple and non-intrusive way to mark deprecated columns/attributes in your models. Any usage of these attributes will logged with a warning message and a trace of where the deprecated attribute was called. An exception can be optionally raised as well.} spec.homepage = "" spec.license = "MIT" spec.files = `git ls-files`.split($/) spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency 'activerecord', ['>= 3.0', '< 5.0'] spec.add_dependency 'activesupport', ['>= 3.0', '< 5.0'] spec.add_development_dependency "bundler", "~> 1.5" spec.add_development_dependency "rake" spec.add_development_dependency "rspec", "2.14.1" end
Add a script for handling Info.plist.
# encoding: utf-8 require 'base64' def help puts "Usage: ruby carte.rb {pre|post}" exit 1 end class Generator # @return [Hash{Sting => String}] license text by library name # attr_accessor :cartes def initialize self.cartes = {} end def generate self.cocoapods end def cocoapods files = [] filenames = `find .. -name "LICENSE*"`.split("\n") filenames.each do |filename| name = filename.split("/Pods/")[1].split("/")[0] self.cartes[name] = Base64.encode64(File.read(filename)) end end # TODO: cocoaseeds, carthage, manually added libraries... end def delete `/usr/libexec/PlistBuddy -c "Delete :Carte" $SRCROOT/$INFOPLIST_FILE || true` end case ARGV[0] when "pre" delete `/usr/libexec/PlistBuddy\ -c "Add :Carte array"\ $SRCROOT/$INFOPLIST_FILE || true` generator = Generator.new generator.generate generator.cartes.sort.each_with_index do |(name, text), index| `/usr/libexec/PlistBuddy\ -c "Add :Carte:#{index}:name string #{name}"\ $SRCROOT/$INFOPLIST_FILE || true` `/usr/libexec/PlistBuddy\ -c "Add :Carte:#{index}:text string #{text}"\ $SRCROOT/$INFOPLIST_FILE || true` end when "post" delete else help end
Fix rubocop warning in ServiceTemplateFieldsVisibilityService
class ServiceTemplateFieldsVisibilityService def determine_visibility(service_template_request) field_names_to_hide = [] if service_template_request field_names_to_hide += [:vm_description, :schedule_type, :schedule_time] end {:hide => field_names_to_hide} end end
class ServiceTemplateFieldsVisibilityService def determine_visibility(service_template_request) field_names_to_hide = [] if service_template_request field_names_to_hide += %i(vm_description schedule_type schedule_time) end {:hide => field_names_to_hide} end end
Comment loep token example initializer
# LOEP token here Vish::Application.config.loep_token = 'loepTokenValue'
# LOEP token here # Vish::Application.config.loep_token = 'loepTokenValue'
Add MacOSx entry to spec file
Pod::Spec.new do |s| s.name = "SSignalKit" s.version = "0.0.1" s.summary = "An experimental Rx- and RAC-3.0-inspired FRP framework" s.homepage = "https://github.com/PauloMigAlmeida/Signals" s.license = "MIT" s.authors = { "Peter Iakovlev" => '', "Paulo Miguel Almeida" => "paulo.ubuntu@gmail.com" } s.social_media_url = 'http://twitter.com/PauloMigAlmeida' s.platform = :ios, "6.0" s.source = { :git => "https://github.com/PauloMigAlmeida/Signals.git", :tag => "0.0.1" } s.source_files = "SSignalKit/**/*.{h,m}" s.requires_arc = true end
Pod::Spec.new do |s| s.name = "SSignalKit" s.version = "0.0.2" s.summary = "An experimental Rx- and RAC-3.0-inspired FRP framework" s.homepage = "https://github.com/PauloMigAlmeida/Signals" s.license = "MIT" s.authors = { "Peter Iakovlev" => '', "Paulo Miguel Almeida" => "paulo.ubuntu@gmail.com" } s.social_media_url = 'http://twitter.com/PauloMigAlmeida' s.ios.deployment_target = "6.0" s.osx.deployment_target = "10.7" s.source = { :git => "https://github.com/PauloMigAlmeida/Signals.git", :tag => "0.0.1" } s.source_files = "SSignalKit/**/*.{h,m}" s.requires_arc = true end
Fix redirect error when uploading document
class UploadsController < ApplicationController before_action :authenticate_user! def new @upload = Upload.new(user_id: current_user.id, user_type: "User").tap(&:save) end def create @upload = Upload.new(upload_params) if @upload.save redirect_to @upload, notice: 'Document was successfully uploaded.' else render action: 'new' end end def download @upload = Upload.find(params[:id]) redirect_to @upload.file.expiring_url(url_expire_in_seconds) end def destroy @upload = Upload.find(params[:id]) @upload.destroy flash[:notice] = "File has been deleted." redirect_to(:back) end private def url_expire_in_seconds 10 end def upload_params params.require(:upload).permit(:file, :file_file_name, :user_id, :user_type) end end
class UploadsController < ApplicationController before_action :authenticate_user! def new @upload = Upload.new(user_id: current_user.id, user_type: "User").tap(&:save) end def create @upload = Upload.new(upload_params) if @upload.save redirect_to :back, notice: 'File was successfully uploaded.' else redirect_to :back, alert: 'Failed to upload file.' end end def download @upload = Upload.find(params[:id]) redirect_to @upload.file.expiring_url(url_expire_in_seconds) end def destroy @upload = Upload.find(params[:id]) @upload.destroy flash[:notice] = "File has been deleted." redirect_to(:back) end private def url_expire_in_seconds 10 end def upload_params params.require(:upload).permit(:file, :file_file_name, :user_id, :user_type) end end
Fix plural name for extended OS
class AppnexusApi::OperatingSystemExtendedService < AppnexusApi::Service def initialize(connection) @read_only = true super(connection) end end
class AppnexusApi::OperatingSystemExtendedService < AppnexusApi::Service def initialize(connection) @read_only = true super(connection) end def plural_name 'operating-systems-extended' end end
Remove international development fund categories
categories = MainstreamCategory.where(parent_tag: "citizenship/international-development") categories.each do |category| old_path = Whitehall.url_maker.mainstream_category_path(category) puts "removing category: #{category.title}" guides = category.detailed_guides puts "\t removing association to category from #{guides.count} guides" guides.each do |guide| guide.update_attribute :primary_mainstream_category_id, nil end puts "\t destroying category: \t #{old_path} 💥🔫" category.destroy end puts "\nDon't forget to add the above redirects to router-data!"
Replace `scope` macro with `def self.scope`
class Entry < ActiveRecord::Base belongs_to :import belongs_to :user scope :by_date, -> { order("date DESC") } def self.newest by_date.first end def self.random order("RANDOM()").first end def for_today? date == Time.zone.now.in_time_zone(user.time_zone).to_date end end
class Entry < ActiveRecord::Base belongs_to :import belongs_to :user def self.by_date order("date DESC") end def self.newest by_date.first end def self.random order("RANDOM()").first end def for_today? date == Time.zone.now.in_time_zone(user.time_zone).to_date end end
Add a put method to update leads
require "batchbook/client/version" require "httparty" module Batchbook class Client attr_reader :token, :user API_URL = "/api/v1/" def initialize(user, token) @token = "#{token}" @user = "#{user}" end def ping response = users !response.has_key?("error") end def users(page = 1) get_request("users", "&page=#{page}") end def custom_field_sets(page = 1) get_request("custom_field_sets", "&page=#{page}") end def people(page = 1) get_request("people", "&page=#{page}") end def create_person(data, endpoint = "people") post_request(data, endpoint) end private def uri_generator(endpoint, options = "") "#{@user}#{API_URL}#{endpoint}.json?auth_token=#{@token}#{options}" end def get_request(endpoint, options = "") response = HTTParty.get(uri_generator(endpoint, options)) response.parsed_response end def post_request(data, endpoint, options = "") uri = uri_generator(endpoint, options) res = HTTParty.post(uri, :query => data, :header => { "Content-type" => "text/json"}) res.response end end end
require "batchbook/client/version" require "httparty" module Batchbook class Client attr_reader :token, :user API_URL = "/api/v1/" def initialize(user, token) @token = "#{token}" @user = "#{user}" end def ping response = users !response.has_key?("error") end def users(page = 1) get_request("users", "&page=#{page}") end def custom_field_sets(page = 1) get_request("custom_field_sets", "&page=#{page}") end def people(page = 1) get_request("people", "&page=#{page}") end def create_person(data, endpoint = "people") post_request(data, endpoint) end def update_person(data, id, options = "") put_request(data, "/people/#{id}", options) end private def uri_generator(endpoint, options = "") "#{@user}#{API_URL}#{endpoint}.json?auth_token=#{@token}#{options}" end def get_request(endpoint, options = "") response = HTTParty.get(uri_generator(endpoint, options)) response.parsed_response end def post_request(data, endpoint, options = "") uri = uri_generator(endpoint, options) res = HTTParty.post(uri, :query => data, :header => { "Content-type" => "text/json"}) res.response end def put_request(data, endpoint, options = "") uri = uri_generator(endpoint, options) res = HTTParty.put(uri, :query => data, :headers => { "Content-type" => "text/json" }) res.response end end end
Improve Token to_s to handle \n
module Sodascript ## # Token is used by Lexer to keep track of all the tokens it finds in the file. class Token # Token associated rule (Rule) attr_reader :rule # Token's lexeme (String) attr_reader :lexeme ## # Creates a token given a _rule_ (Rule) and a _lexeme_ (String). def initialize(rule, lexeme) raise ArgumentError, 'rule must be a Rule' unless rule.is_a?(Rule) raise ArgumentError, 'lexeme must be a String' unless lexeme.is_a?(String) raise ArgumentError, 'rule must match lexeme' unless rule.matches?(lexeme) @rule = rule @lexeme = lexeme end ## # String representation of a token def to_s "#{ @rule.name }: #{ @lexeme }" end end end
module Sodascript ## # Token is used by Lexer to keep track of all the tokens it finds in the file. class Token # Token associated rule (Rule) attr_reader :rule # Token's lexeme (String) attr_reader :lexeme ## # Creates a token given a _rule_ (Rule) and a _lexeme_ (String). def initialize(rule, lexeme) raise ArgumentError, 'rule must be a Rule' unless rule.is_a?(Rule) raise ArgumentError, 'lexeme must be a String' unless lexeme.is_a?(String) raise ArgumentError, 'rule must match lexeme' unless rule.matches?(lexeme) @rule = rule @lexeme = lexeme end ## # String representation of a token def to_s "#{ @rule.name }: #{ @lexeme.inspect[1..-2] }" end end end
Use description of the example group as the define name
module RSpec::Puppet module DefineExampleGroup include RSpec::Puppet::Matchers def subject @catalogue ||= catalogue end def catalogue Puppet[:modulepath] = module_path # TODO pull type name from describe string Puppet[:code] = 'sysctl' + " { " + name + ": " + params.keys.map { |r| "#{r.to_s} => '#{params[r].to_s}'" }.join(', ') + " }" unless facts = Puppet::Node::Facts.find(Puppet[:certname]) raise "Could not find facts for #{Puppet[:certname]}" end unless node = Puppet::Node.find(Puppet[:certname]) raise "Could not find node #{Puppet[:certname]}" end node.merge(facts.values) Puppet::Resource::Catalog.find(node.name, :use_node => node) end end end
module RSpec::Puppet module DefineExampleGroup include RSpec::Puppet::Matchers def subject @catalogue ||= catalogue end def catalogue Puppet[:modulepath] = module_path Puppet[:code] = self.class.metadata[:example_group][:full_description].downcase + " { " + name + ": " + params.keys.map { |r| "#{r.to_s} => '#{params[r].to_s}'" }.join(', ') + " }" unless facts = Puppet::Node::Facts.find(Puppet[:certname]) raise "Could not find facts for #{Puppet[:certname]}" end unless node = Puppet::Node.find(Puppet[:certname]) raise "Could not find node #{Puppet[:certname]}" end node.merge(facts.values) Puppet::Resource::Catalog.find(node.name, :use_node => node) end end end
Add specs for empty payload
describe BulkProcessor::PayloadSerializer do describe '.serialize' do it 'converts { "a" => "b" } to "a=b"' do expect(BulkProcessor::PayloadSerializer.serialize('a' => 'b')) .to eq('a=b') end it 'converts { "a" => "b", "c" => "d" } to "a=b&c=d"' do expect(BulkProcessor::PayloadSerializer.serialize('a' => 'b', 'c' => 'd')) .to eq('a=b&c=d') end end describe '.deserialize' do it 'returns { "a" => "b" } from "a=b"' do expect(BulkProcessor::PayloadSerializer.deserialize('a=b')) .to eq('a' => 'b') end it 'returns { "a" => "b", "c" => "d" } from "a=b&c=d"' do expect(BulkProcessor::PayloadSerializer.deserialize('a=b&c=d')) .to eq('a' => 'b', 'c' => 'd') end end end
describe BulkProcessor::PayloadSerializer do describe '.serialize' do it 'converts {} to ""' do expect(BulkProcessor::PayloadSerializer.serialize({})) .to eq('') end it 'converts { "a" => "b" } to "a=b"' do expect(BulkProcessor::PayloadSerializer.serialize('a' => 'b')) .to eq('a=b') end it 'converts { "a" => "b", "c" => "d" } to "a=b&c=d"' do expect(BulkProcessor::PayloadSerializer.serialize('a' => 'b', 'c' => 'd')) .to eq('a=b&c=d') end end describe '.deserialize' do it 'returns {} from ""' do expect(BulkProcessor::PayloadSerializer.deserialize('')) .to eq({}) end it 'returns { "a" => "b" } from "a=b"' do expect(BulkProcessor::PayloadSerializer.deserialize('a=b')) .to eq('a' => 'b') end it 'returns { "a" => "b", "c" => "d" } from "a=b&c=d"' do expect(BulkProcessor::PayloadSerializer.deserialize('a=b&c=d')) .to eq('a' => 'b', 'c' => 'd') end end end
Include sample code URL to the podspec description
Pod::Spec.new do |s| s.name = "FWTNotifiable" s.version = "0.0.13" s.platform = :ios, '8.0' s.summary = "Utility classes to integrate with Notifiable-Rails gem" s.dependency 'AFNetworking', '~> 3.0.4' s.ios.frameworks = 'MobileCoreServices' s.frameworks = 'SystemConfiguration' s.description = <<-DESC Utility classes to integrate with Notifiable-Rails gem (https://github.com/FutureWorkshops/notifiable-rails). DESC s.homepage = "https://github.com/FutureWorkshops/Notifiable-iOS" s.license = { :type => 'Apache License Version 2.0', :file => 'LICENSE' } s.author = { "Daniel Phillips" => "daniel@futureworkshops.com" } s.source = { :git => "https://github.com/FutureWorkshops/Notifiable-iOS.git", :tag => s.version } s.source_files = 'Notifiable-iOS/**/*.{h,m}' s.public_header_files = 'Notifiable-iOS/FWTNotifiableManager.h', 'Notifiable-iOS/Logger/FWTNotifiableLogger.h', 'Notifiable-iOS/Model/FWTNotifiableDevice.h', 'Notifiable-iOS/Category/*.h' s.module_name = 'FWTNotifiable' s.requires_arc = true end
Pod::Spec.new do |s| s.name = "FWTNotifiable" s.version = "0.0.13" s.platform = :ios, '8.0' s.summary = "Utility classes to integrate with Notifiable-Rails gem" s.dependency 'AFNetworking', '~> 3.0.4' s.ios.frameworks = 'MobileCoreServices' s.frameworks = 'SystemConfiguration' s.description = <<-DESC Utility classes to integrate with Notifiable-Rails gem (https://github.com/FutureWorkshops/notifiable-rails). You can see a sample of how to use the FWTNotifiable SDK on github: (https://github.com/FutureWorkshops/Notifiable-iOS/tree/master/Sample) DESC s.homepage = "https://github.com/FutureWorkshops/Notifiable-iOS" s.license = { :type => 'Apache License Version 2.0', :file => 'LICENSE' } s.author = { "Daniel Phillips" => "daniel@futureworkshops.com" } s.source = { :git => "https://github.com/FutureWorkshops/Notifiable-iOS.git", :tag => s.version } s.source_files = 'Notifiable-iOS/**/*.{h,m}' s.public_header_files = 'Notifiable-iOS/FWTNotifiableManager.h', 'Notifiable-iOS/Logger/FWTNotifiableLogger.h', 'Notifiable-iOS/Model/FWTNotifiableDevice.h', 'Notifiable-iOS/Category/*.h' s.module_name = 'FWTNotifiable' s.requires_arc = true end
Rename "Gambia" to "The Gambia"
gambia = WorldLocation.find_by(slug: "gambia") gambia.update(slug: "the-gambia") gambia.translation.update(name: "The Gambia")
Add score fields to round
class AddScoresToRounds < ActiveRecord::Migration def change add_column :rounds, :odd_team_score, :integer add_column :rounds, :even_team_score, :integer end end
Allow typhoeus versions before 1.0
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib')) require 'chargehound/version' Gem::Specification.new do |spec| spec.name = 'chargehound' spec.version = Chargehound::VERSION spec.platform = Gem::Platform::RUBY spec.required_ruby_version = '>= 1.9.3' spec.authors = ['Chargehound'] spec.email = ['support@chargehound.com'] spec.homepage = 'https://www.chargehound.com' spec.summary = 'Ruby bindings for the Chargehound API' spec.description = 'Automatically fight disputes in Stripe' spec.license = 'MIT' spec.add_dependency 'typhoeus', '~> 1.0' spec.add_development_dependency 'bundler', '~> 1.5' spec.add_development_dependency 'minitest', '~> 5.8' spec.add_development_dependency 'rake', '~> 11.1' spec.add_development_dependency 'rubocop', '~> 0.39' spec.add_development_dependency 'webmock', '~> 2.0' spec.files = `git ls-files`.split($/) spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^test/}) spec.require_paths = ['lib'] spec.extra_rdoc_files = ['README.md'] end
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib')) require 'chargehound/version' Gem::Specification.new do |spec| spec.name = 'chargehound' spec.version = Chargehound::VERSION spec.platform = Gem::Platform::RUBY spec.required_ruby_version = '>= 1.9.3' spec.authors = ['Chargehound'] spec.email = ['support@chargehound.com'] spec.homepage = 'https://www.chargehound.com' spec.summary = 'Ruby bindings for the Chargehound API' spec.description = 'Automatically fight disputes in Stripe' spec.license = 'MIT' spec.add_dependency 'typhoeus', '<2.0' spec.add_development_dependency 'bundler', '~> 1.5' spec.add_development_dependency 'minitest', '~> 5.8' spec.add_development_dependency 'rake', '~> 11.1' spec.add_development_dependency 'rubocop', '~> 0.39' spec.add_development_dependency 'webmock', '~> 2.0' spec.files = `git ls-files`.split($/) spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^test/}) spec.require_paths = ['lib'] spec.extra_rdoc_files = ['README.md'] end
Increase page size for links
class LinksController < ApplicationController add_breadcrumb I18n.t('links.index.title'), :links_path def index page_number = params[:page] ||= 1 all_links = Note.publishable.link @links = all_links.page(page_number).load @total_count = all_links.size @domains_count = all_links.pluck(:url_domain).uniq.size respond_to do |format| format.html format.atom { render atom: all_links } format.json { render json: all_links } end end end
class LinksController < ApplicationController add_breadcrumb I18n.t('links.index.title'), :links_path def index page_number = params[:page] ||= 1 all_links = Note.publishable.link page_size = Setting['advanced.notes_index_per_page'].to_i * 10 @links = all_links.page(page_number).per(page_size).load @total_count = all_links.size @domains_count = all_links.pluck(:url_domain).uniq.size respond_to do |format| format.html format.atom { render atom: all_links } format.json { render json: all_links } end end end
Add upvote and remove upvote button on a given issue (working)
class UsersController < ApplicationController def show @user = User.find_by(id: params[:id]) @same_user = false if @user.id == current_user.id @same_user = true end @issues = @user.issues.map { |issue| issue.package_info} @fixes = @user.fixes.map { |fix| fix.package_info} @watches = @user.issues_watches.map { |watches| watches.package_info} end def my_profile redirect_to "/users/#{current_user.id}" end def create_watch new_watch = IssuesWatch.create(user_id: params[:user_id], issue_id: params[:issue_id]) redirect_to issue_path(id: params[:issue_id]) end def delete_watch watch_to_delete = IssuesWatch.find_by(user_id: params[:user_id], issue_id: params[:issue_id]) watch_to_delete.destroy redirect_to issue_path(id: params[:issue_id]) end def create_vote end def delete_vote end end
class UsersController < ApplicationController def show @user = User.find_by(id: params[:id]) @same_user = false if @user.id == current_user.id @same_user = true end @issues = @user.issues.map { |issue| issue.package_info} @fixes = @user.fixes.map { |fix| fix.package_info} @watches = @user.issues_watches.map { |watches| watches.package_info} end def my_profile redirect_to "/users/#{current_user.id}" end def create_watch new_watch = IssuesWatch.create(user_id: params[:user_id], issue_id: params[:issue_id]) redirect_to issue_path(id: params[:issue_id]) end def delete_watch watch_to_delete = IssuesWatch.find_by(user_id: params[:user_id], issue_id: params[:issue_id]) watch_to_delete.destroy redirect_to issue_path(id: params[:issue_id]) end def create_vote up_vote = UsersVote.create(user_id: params[:user_id], issue_id: params[:issue_id]) redirect_to issue_path(id: params[:issue_id]) end def delete_vote vote_to_delete = UsersVote.find_by(user_id: params[:user_id], issue_id: params[:issue_id]) vote_to_delete.destroy redirect_to issue_path(id: params[:issue_id]) end end
Remove private from FeedParser as well
require 'faraday' module Octokit module Response # Parses RSS and Atom feed responses. class FeedParser < Faraday::Response::Middleware private def on_complete(env) if env[:response_headers]["content-type"] =~ /(\batom|\brss)/ require 'rss' env[:body] = RSS::Parser.parse env[:body] end end end end end
require 'faraday' module Octokit module Response # Parses RSS and Atom feed responses. class FeedParser < Faraday::Response::Middleware def on_complete(env) if env[:response_headers]["content-type"] =~ /(\batom|\brss)/ require 'rss' env[:body] = RSS::Parser.parse env[:body] end end end end end
Edit error message, when default user didn't set up
module UserControl def self.logged_in? Config.key?(:default_id) end def self.log_in loop do permalink = HighLine.new.ask('Please enter your permalink (last word in your profile url): ') url = "https://soundcloud.com/#{permalink}" if user_exist?(permalink) user = Client.get('/resolve', url: url) Config[:default_id] = user.id Config[:permalink] = permalink puts Paint['Successfully logged in!', :green] break else puts Paint['Invalid permalink. Please enter correct permalink', :red] end end end def self.temp_user=(permalink) if user_exist?(permalink) user = Client.get('/resolve', url: "https://soundcloud.com/#{permalink}") @temp_user = User.new(user.id) else puts Paint['Invalid permalink. Please enter correct permalink', :red] exit end end def self.user @temp_user || default_user end module_function def default_user if UserControl.logged_in? User.new(Config[:default_id]) else puts Paint["You didn't logged in", :red] puts "Enter #{Paint['nehm configure', :yellow]} to login" exit end end def user_exist?(permalink) Client.get('/resolve', url: "https://soundcloud.com/#{permalink}") rescue SoundCloud::ResponseError => e if e.message =~ /404/ false else raise e end else true end end
module UserControl def self.logged_in? Config.key?(:default_id) end def self.log_in loop do permalink = HighLine.new.ask('Please enter your permalink (last word in your profile url): ') url = "https://soundcloud.com/#{permalink}" if user_exist?(permalink) user = Client.get('/resolve', url: url) Config[:default_id] = user.id Config[:permalink] = permalink puts Paint['Successfully logged in!', :green] break else puts Paint['Invalid permalink. Please enter correct permalink', :red] end end end def self.temp_user=(permalink) if user_exist?(permalink) user = Client.get('/resolve', url: "https://soundcloud.com/#{permalink}") @temp_user = User.new(user.id) else puts Paint['Invalid permalink. Please enter correct permalink', :red] exit end end def self.user @temp_user || default_user end module_function def default_user if UserControl.logged_in? User.new(Config[:default_id]) else puts Paint["You didn't logged in", :red] puts "Login from #{Paint['nehm configure', :yellow]} or use #{Paint['[from PERMALINK]', :yellow]} option" exit end end def user_exist?(permalink) Client.get('/resolve', url: "https://soundcloud.com/#{permalink}") rescue SoundCloud::ResponseError => e if e.message =~ /404/ false else raise e end else true end end
Fix issues with pagination link
require 'will_paginate/view_helpers/base' require 'will_paginate/view_helpers/link_renderer' WillPaginate::ViewHelpers::LinkRenderer.class_eval do protected def page_number(page) unless page == current_page tag(:li, link(page, page, :rel => rel_value(page))) else tag(:li, tag(:p, page), :class => 'current') end end def gap '<li class="gap">&hellip;</li>' end def previous_or_next_page(page, text, classname) if page tag(:li, link(text, page), :class => classname) else tag(:li, tag(:p, text), :class => classname + ' disabled') end end def html_container(html) tag(:ul, html, container_attributes) end def url(page) url = @template.request.url if page == 1 url.gsub(/page\/[0-9]+/, '') else if url =~ /page\/[0-9]+/ url.gsub(/page\/[0-9]+/, "page/#{page}") else url + "page/#{page}" end end end end
require 'will_paginate/view_helpers/base' require 'will_paginate/view_helpers/link_renderer' WillPaginate::ViewHelpers::LinkRenderer.class_eval do protected def page_number(page) unless page == current_page tag(:li, link(page, page, :rel => rel_value(page))) else tag(:li, tag(:p, page), :class => 'current') end end def gap '<li class="gap">&hellip;</li>' end def previous_or_next_page(page, text, classname) if page tag(:li, link(text, page), :class => classname) else tag(:li, tag(:p, text), :class => classname + ' disabled') end end def html_container(html) tag(:ul, html, container_attributes) end def url(page) url = @template.request.path if page == 1 url.gsub(/page\/[0-9]+/, '') else if url =~ /page\/[0-9]+/ url.gsub(/page\/[0-9]+/, "page/#{page}") else url + "page/#{page}" end end end end
Make sure the debugger method doesn't stomp on the existing debugger method. Allows RSpec to work better in contexts where rspec runner isn't driving things (like for cucumber).
module Kernel def debugger(*args) RSpec.configuration.error_stream.puts "debugger statement ignored, use -d or --debug option to enable debugging\n#{caller(0)[1]}" end end
module Kernel def debugger(*args) RSpec.configuration.error_stream.puts "debugger statement ignored, use -d or --debug option to enable debugging\n#{caller(0)[1]}" end unless respond_to?(:debugger) end