diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/hide/server.rb b/lib/hide/server.rb index abc1234..def5678 100644 --- a/lib/hide/server.rb +++ b/lib/hide/server.rb @@ -22,6 +22,7 @@ post '/update' do begin + STDERR.puts "Starting the update process..." json = Yajl::Parser.parse(params[:payload]) before, after = json['before'], json['after'] # p [before, after]
Print debug info at the beginning of the /update process
diff --git a/lib/library_hlb.rb b/lib/library_hlb.rb index abc1234..def5678 100644 --- a/lib/library_hlb.rb +++ b/lib/library_hlb.rb @@ -8,7 +8,7 @@ module Library::HLB class IllegalLC < ArgumentError;end - SOURCE_URL = 'https://www.lib.umich.edu/browse/categories/xml.php' + SOURCE_URL = ENV['HLB_XML_ENDPOINT'] || 'https://www.lib.umich.edu/browse/categories/xml.php' # Fetch (and optionally store) a new version of the file def self.fetch
Allow ENV['HLB_XML_ENDPOINT'] to override URL
diff --git a/lib/polyamorous.rb b/lib/polyamorous.rb index abc1234..def5678 100644 --- a/lib/polyamorous.rb +++ b/lib/polyamorous.rb @@ -5,7 +5,6 @@ JoinDependency = ::ActiveRecord::Associations::JoinDependency JoinAssociation = ::ActiveRecord::Associations::JoinDependency::JoinAssociation - JoinBase = ::ActiveRecord::Associations::JoinDependency::JoinBase end require 'polyamorous/tree_node' @@ -22,10 +21,4 @@ Polyamorous::JoinDependency.send(:prepend, Polyamorous::JoinDependencyExtensions) Polyamorous::JoinDependency.singleton_class.send(:prepend, Polyamorous::JoinDependencyExtensions::ClassMethods) Polyamorous::JoinAssociation.send(:prepend, Polyamorous::JoinAssociationExtensions) - - Polyamorous::JoinBase.class_eval do - if method_defined?(:active_record) - alias_method :base_klass, :active_record - end - end end
Remove unused constant alias for `JoinBase` `JoinBase#active_record` no longer exist since Rails 4.0. See https://github.com/rails/rails/pull/10151
diff --git a/lib/rb-readline.rb b/lib/rb-readline.rb index abc1234..def5678 100644 --- a/lib/rb-readline.rb +++ b/lib/rb-readline.rb @@ -2,6 +2,6 @@ # It forces require of bundled readline instead of any already existing # in your Ruby installation. It will avoid any possible warning caused # by double require. -unless $LOADED_FEATURES.any? { |f| f =~ /readline\.rb$/ } +unless defined?(RbReadline) require File.join(File.dirname(__FILE__), 'readline') end
Check against RbReadline been defined Since other projects might have readline.rb files loaded before. That check was stupid. (I need to stop coding late at night)
diff --git a/messaging.gemspec b/messaging.gemspec index abc1234..def5678 100644 --- a/messaging.gemspec +++ b/messaging.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'evt-messaging' - s.version = '1.3.0.2' + s.version = '1.3.1.0' s.summary = 'Common primitives for platform-specific messaging implementations for Eventide' s.description = ' '
Package version is increased from 1.3.0.2 to 1.3.1.0
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,5 +5,5 @@ resources :builds, only: [:index, :show, :create, :update, :destroy] end - resources :events, only: :index + resources :events, only: :index if Rails.configuration.cache_classes end
Enable /events endpoints under cache_classes
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,9 @@-Rails.application.routes.prepend do - post "operator/:queue" => "operator/messages#create", :as => :process_message +if Operator::Engine.respond_to?(:routes) + Operator::Engine.routes.draw do + post ':queue' => 'operator/messages#create', :as => :process_message + end +else + Rails.application.routes.prepend do + post 'operator/:queue' => 'operator/messages#create', :as => :process_message + end end
Make the gem mountable in rails with `mount Operator::Engine => '/operator'`
diff --git a/zip-zip.gemspec b/zip-zip.gemspec index abc1234..def5678 100644 --- a/zip-zip.gemspec +++ b/zip-zip.gemspec @@ -19,7 +19,8 @@ spec.require_paths = ['lib'] spec.add_runtime_dependency 'rubyzip', '>= 1.0.0' - spec.add_development_dependency 'bundler', '~> 1.6' + spec.add_development_dependency 'bundler' spec.add_development_dependency 'rake' - spec.add_development_dependency 'minitest', '4.7.5' + spec.add_development_dependency 'minitest' + spec.add_development_dependency 'test-unit' end
Add test-unit as a development dependency And remove versions
diff --git a/rufus-scheduler.gemspec b/rufus-scheduler.gemspec index abc1234..def5678 100644 --- a/rufus-scheduler.gemspec +++ b/rufus-scheduler.gemspec @@ -21,9 +21,11 @@ #s.files = `git ls-files`.split("\n") s.files = Dir[ + 'README.{md,txt}', 'Makefile', 'lib/**/*.rb', #'spec/**/*.rb', 'test/**/*.rb', - '*.gemspec', '*.txt', '*.rdoc', '*.md' + '*.gemspec', + 'CHANGELOG.{md,txt}', 'CREDITS.{md,txt}', 'LICENSE.{md,txt}' ] s.required_ruby_version = '>= 1.9'
Make .gemspec {.md,.txt} inclusion more strict
diff --git a/activerecord/test/cases/query_logs_formatter_test.rb b/activerecord/test/cases/query_logs_formatter_test.rb index abc1234..def5678 100644 --- a/activerecord/test/cases/query_logs_formatter_test.rb +++ b/activerecord/test/cases/query_logs_formatter_test.rb @@ -7,7 +7,7 @@ assert_raises(ArgumentError) do ActiveRecord::QueryLogs::FormatterFactory.from_symbol(:non_existing_formatter) end - end + end def test_sqlcommenter_key_value_separator formatter = ActiveRecord::QueryLogs::FormatterFactory.from_symbol(:sqlcommenter)
Address `warning: mismatched indentations` at test_factory_invalid_formatter This commit addresses the `warning: mismatched indentations` below. ```ruby $ bundle exec ruby -w -Itest test/cases/query_logs_formatter_test.rb -n test_factory_invalid_formatter test/cases/query_logs_formatter_test.rb:10: warning: mismatched indentations at 'end' with 'def' at 6 Using sqlite3 Run options: -n test_factory_invalid_formatter --seed 48904 . Finished in 0.008743s, 114.3776 runs/s, 114.3776 assertions/s. 1 runs, 1 assertions, 0 failures, 0 errors, 0 skips $ ``` Follow-up #45081
diff --git a/app/helpers/application_helper/button/basic_image.rb b/app/helpers/application_helper/button/basic_image.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper/button/basic_image.rb +++ b/app/helpers/application_helper/button/basic_image.rb @@ -1,7 +1,6 @@ class ApplicationHelper::Button::BasicImage < ApplicationHelper::Button::Basic def visible? - @sb.fetch_path(:trees, :vandt_tree, :active_node).blank? || - (@sb[:trees][:vandt_tree][:active_node] != "xx-arch" && - @sb[:trees][:vandt_tree][:active_node] != "xx-orph") + active_node = @view_context.x_node + active_node.blank? || (active_node != "xx-arch" && active_node != "xx-orph") end end
Use x_node instead of inspecting sandbox
diff --git a/app/models/login_page.rb b/app/models/login_page.rb index abc1234..def5678 100644 --- a/app/models/login_page.rb +++ b/app/models/login_page.rb @@ -1,5 +1,5 @@ class LoginPage < Obj - attribute :title, :string - attribute :body, :widgetlist + attribute :title, :string + attribute :body, :widgetlist attribute :child_order, :referencelist end
Tweak indent in LoginPage model
diff --git a/bm/bm_template_parse.rb b/bm/bm_template_parse.rb index abc1234..def5678 100644 --- a/bm/bm_template_parse.rb +++ b/bm/bm_template_parse.rb @@ -0,0 +1,17 @@+require 'krypt' +require_relative 'resources' +require 'stringio' +require 'openssl' +require 'benchmark' + +Benchmark.bm do |bm| + + cert = Resources.certificate + [1000, 10_000, 100_000].each do |n| + bm.report("Krypt::X509.parse_der String(n=#{n})") { n.times { Krypt::X509::Certificate.parse_der(cert) } } + bm.report("OpenSSL::X509::Certificate String(n=#{n})") { n.times { OpenSSL::X509::Certificate.new(Resources.certificate) } } + puts + end + +end +
Add benchmark for Krypt::X509::Certificate parsing
diff --git a/brain/lib/crm_neuron.rb b/brain/lib/crm_neuron.rb index abc1234..def5678 100644 --- a/brain/lib/crm_neuron.rb +++ b/brain/lib/crm_neuron.rb @@ -11,6 +11,6 @@ futuresimple_token = message.user["profile"]["futuresimple_token"] session = Pipejump::Session.new token: futuresimple_token contact = session.contacts.all.find { |contact| contact.name == name } - "#{contact.name}, #{contact.title} at #{contact.organisation_name}\nPhone: +1 (515) 555-8765\nEmail: jsmith@acmeinc.com" + "#{contact.name}, #{contact.title} at #{contact.organisation_name}\nPhone: #{contact.phone}\nEmail: #{contact.email}" end end
[BRAIN] Use phone/email address from data rather than static in CRM neuron
diff --git a/Argo.podspec b/Argo.podspec index abc1234..def5678 100644 --- a/Argo.podspec +++ b/Argo.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = 'Argo' - spec.version = '0.2.2' + spec.version = '0.3.2' spec.summary = 'Functional JSON parsing library for Swift.' spec.homepage = 'https://github.com/thoughtbot/Argo' spec.license = { :type => 'MIT', :file => 'LICENSE' } @@ -15,5 +15,7 @@ spec.requires_arc = true spec.ios.deployment_target = '8.0' spec.osx.deployment_target = '10.9' + + spec.dependency = 'Runes' end
Update Podspec with Runes dependency Since Runes is now available in CocoaPods Trunk, we can depend on it here and bump the version to the most recent.
diff --git a/functional_ruby.gemspec b/functional_ruby.gemspec index abc1234..def5678 100644 --- a/functional_ruby.gemspec +++ b/functional_ruby.gemspec @@ -25,17 +25,6 @@ s.require_paths = ['lib'] s.required_ruby_version = '>= 1.9.2' - s.post_install_message = <<-MSG - hello() -> io:format("Hello, World!"). - - package main - import "fmt" - func main() { - fmt.Printf("hello, world") - } - - (def hello (fn [] "Hello world")) - MSG s.add_development_dependency 'bundler' end
Remove (unnecessary) gem post-install message.
diff --git a/cookbooks/lib/languages/python_spec.rb b/cookbooks/lib/languages/python_spec.rb index abc1234..def5678 100644 --- a/cookbooks/lib/languages/python_spec.rb +++ b/cookbooks/lib/languages/python_spec.rb @@ -1,6 +1,6 @@+include Support::Python + describe 'python environment' do - include Support::Python - describe pycommand('python --version') do its(:stdout) { should be_empty } its(:stderr) { should match(/^Python \d+\.\d+\.\d+/) }
Include python support bits in the right place
diff --git a/Casks/appcode.rb b/Casks/appcode.rb index abc1234..def5678 100644 --- a/Casks/appcode.rb +++ b/Casks/appcode.rb @@ -1,6 +1,6 @@ cask :v1 => 'appcode' do - version '3.1.3' - sha256 '36a7429ae57d7855a83b2d7d461c3ccf2d61b125249c532a254e6625746561c6' + version '3.1.4' + sha256 'ca623c106337dd355732200d25f2e0a4776629dd4185a01f972e9ad34b417eb4' url "http://download.jetbrains.com/objc/AppCode-#{version}.dmg" name 'AppCode'
Update AppCode to version 3.1.4 This commit also updates the SHA for the download.
diff --git a/Casks/aquaskk.rb b/Casks/aquaskk.rb index abc1234..def5678 100644 --- a/Casks/aquaskk.rb +++ b/Casks/aquaskk.rb @@ -3,6 +3,8 @@ sha256 'fd29284c76ddc361506ad887be3868bc8e020d6424d818e5365d7d9148d19fcc' url "https://github.com/codefirst/aquaskk/releases/download/#{version}/AquaSKK-#{version}.dmg" + appcast 'https://github.com/codefirst/aquaskk/releases.atom', + :sha256 => 'd5858e86a4cac5e0380083242d40be65ac5eb757048e88863dbf265bc236ee14' name 'AquaSKK' homepage 'https://github.com/codefirst/aquaskk' license :gpl
Add an appcast to AquaSKK's cask
diff --git a/post-processing.rb b/post-processing.rb index abc1234..def5678 100644 --- a/post-processing.rb +++ b/post-processing.rb @@ -9,6 +9,7 @@ # line filters line.gsub!(/\s*\n$/, "\n") line.gsub!("'", '"') + line.gsub!('u"', '"') buffer += line end
Remove all the pesky u"..." in comments generated by codegen.py
diff --git a/db/migrate/20200103121539_create_gdata_favorites.rb b/db/migrate/20200103121539_create_gdata_favorites.rb index abc1234..def5678 100644 --- a/db/migrate/20200103121539_create_gdata_favorites.rb +++ b/db/migrate/20200103121539_create_gdata_favorites.rb @@ -0,0 +1,12 @@+# frozen_string_literal: true + +class CreateGdataFavorites < ActiveRecord::Migration[5.2] + def change + create_table :gdata_favorites do |t| + t.references :user + t.references :favorited, polymorphic: true + + t.timestamps + end + end +end
Add migration to create gdata_favorites
diff --git a/DeskAPIClient.podspec b/DeskAPIClient.podspec index abc1234..def5678 100644 --- a/DeskAPIClient.podspec +++ b/DeskAPIClient.podspec @@ -5,7 +5,7 @@ s.license = { :type => 'BSD 3-Clause', :file => 'LICENSE.txt' } s.homepage = "https://github.com/forcedotcom/DeskApiClient-ObjC" s.author = { "Salesforce, Inc." => "mobile@desk.com" } - s.source = { :git => "https://github.com/forcedotcom/DeskApiClient-ObjC.git", :branch => 'develop' } + s.source = { :git => "https://github.com/forcedotcom/DeskApiClient-ObjC.git", :branch => 'tickets/APIC-115-create-ability-to-cancel' } s.platform = :ios, '8.0' s.source_files = 'DeskAPIClient/DeskAPIClient/*.{h,m}', 'DeskAPIClient/DeskAPIClient/**/*.{h,m}' s.requires_arc = true
Change pod spec to point to ticket branch.
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,5 +1,5 @@ #Create Admin For the Site -User.create(email:'nzeplowitz@gmail.com', name: 'admin', access: 'admin') +User.create(email:'nzeplowitz@gmail.com', name: 'Nathan Zeplowitz', access: 'admin') #Create 5 Students 5.times do
Fix Seed to Check New Features
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -8,6 +8,7 @@ user = User.find_by email:'foo@bar.com' user = User.create! email:'foo@bar.com', password:'12345678' unless user +user.update_attributes(admin: true) event = Event.find_or_create_by! name: "White Christmas" snow = event.outcomes.find_or_create_by! event: event, name: 'Snow at Christmas' no_snow = event.outcomes.find_or_create_by! event: event, name: 'No snow at Christmas'
Make seed user an admin
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -0,0 +1,35 @@+ +city_models = {} +county_models = {} +state_models = {} + +f = File.new(File.dirname(__FILE__) + '/../db/seeds.rb') +f.each do |line| + + fields = line.split(/\|\|/) + next if fields.size != 6 + + postal_code, latitude, longitude, state, city, count = fields + + state_model = state_models[state] + if state_model.nil? + state_model = State.create(:name => state) + states[state] = state_model + end + + county_models_key = [county, state_model.id] + county_model = county_models[county_models_key] + if county_model.nil? + county_model = County.create(:name => county, :state_id => state_model.id) + county_models[county_models_key] = county_model + end + + city_models_key = [city, county_model.id, state_model.id] + city_model = city_models[city_models_key] + if city_model.nil? + city_model = City.create(:name => city, :county_id => county_model.id, :state_id => state_model.id) + city_models[city_models_key] + end + + PostalCode.create(:code => postal_code, :city_id => city_model.id, :county_id => county_model.id, :state_id => state_model.id, :latitude => latitude, :longitude => longtiude) +end
Add seed data based on data in text file.
diff --git a/core/app/interactors/interactors/groups/create.rb b/core/app/interactors/interactors/groups/create.rb index abc1234..def5678 100644 --- a/core/app/interactors/interactors/groups/create.rb +++ b/core/app/interactors/interactors/groups/create.rb @@ -0,0 +1,31 @@+module Interactors + module Groups + class Create + include Pavlov::Interactor + include Util::CanCan + + attribute :groupname, String + attribute :creator, String + attribute :pavlov_options, Hash + + def authorized? + pavlov_options[:current_user].username == creator && + can?(:create, Group) + end + + private + + def execute + Backend::Group.create( + groupname: groupname, + members: [pavlov_options[:current_user]] + ) + end + + def validate + validate_nonempty_string :groupname, groupname + validate_nonempty_string :creator, creator + end + end + end +end
Create interactor for group creation
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -8,7 +8,7 @@ constant = Constants.create \ :site_title => "Everyday City People", - :goal => 1000 + :goal => 10 p = Petition.create :title => "Bro Code #2345207", :statement => "No fucking bitches before the hackathon" r = Resident.create :name => "DrunkMcAndres" @@ -18,6 +18,12 @@ r1 = Resident.create :name => "DrunkMcAndres" s1 = Signature.create +p2 = Petition.create :title => "Counting", :statement => "If you don't know how to count, just say it..." +r2 = Resident.create :name => "DrewBitchboyFilipski" +s2 = Signature.create +s3 = Signature.create + + s.petition = p s.resident = r s.save @@ -25,3 +31,11 @@ s1.petition = p1 s1.resident = r1 s1.save + +s2.petition = p2 +s2.resident = r2 +s2.save + +s3.petition = p2 +s3.resident = r1 +s3.save
Add new petition and resident for testing
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -14,6 +14,6 @@ end -session = Session.create(duration: 60, pause_time: 30, work_time: 30, user1_driver_time: 15, user2_driver_time: 15, user1: 2, user2: 1) +session = Session.create(duration: 60, pause_time: 30, work_time: 30, user1_drive_time: 15, user2_drive_time: 15, user1_id: user1, user2_id: user2);
Fix Session Created in Seed
diff --git a/ivy-serializers.gemspec b/ivy-serializers.gemspec index abc1234..def5678 100644 --- a/ivy-serializers.gemspec +++ b/ivy-serializers.gemspec @@ -20,5 +20,5 @@ spec.add_development_dependency 'json-schema-rspec', '~> 0.0.4' spec.add_development_dependency 'rake' spec.add_development_dependency 'rspec', '~> 3.5' - spec.add_development_dependency 'simplecov', '~> 0.18.5' + spec.add_development_dependency 'simplecov', '~> 0.19.0' end
Update simplecov requirement from ~> 0.18.5 to ~> 0.19.0 Updates the requirements on [simplecov](https://github.com/simplecov-ruby/simplecov) to permit the latest version. - [Release notes](https://github.com/simplecov-ruby/simplecov/releases) - [Changelog](https://github.com/simplecov-ruby/simplecov/blob/main/CHANGELOG.md) - [Commits](https://github.com/simplecov-ruby/simplecov/compare/v0.18.5...v0.19.0) Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/test/bank-account-statement_test.rb b/test/bank-account-statement_test.rb index abc1234..def5678 100644 --- a/test/bank-account-statement_test.rb +++ b/test/bank-account-statement_test.rb @@ -4,7 +4,7 @@ describe "BankAccountStatement::VERSION" do it "uses major.minor.patch" do - ::BankAccountStatement::VERSION.must_match /\A\d+\.\d+\.\d+\z/ + ::BankAccountStatement::VERSION.must_match(/\A\d+\.\d+\.\d+\z/) end end
Fix warning test ambiguous / .
diff --git a/lib/vendorificator/hooks/chef_cookbook.rb b/lib/vendorificator/hooks/chef_cookbook.rb index abc1234..def5678 100644 --- a/lib/vendorificator/hooks/chef_cookbook.rb +++ b/lib/vendorificator/hooks/chef_cookbook.rb @@ -16,7 +16,7 @@ next if ignored.include?(name) work_dirs = Vendorificator::Config[:modules].map(&:work_dir) - path = cookbook_path.map { |p| File.absolute_path(File.join(p, name)) } + path = cookbook_path.map { |p| File.expand_path(File.join(p, name)) } # Don't add cookbooks which already have modules next unless (path & work_dirs).empty?
Use File.expand_path for 1.8.7 compat.
diff --git a/config/initializers/messaging.rb b/config/initializers/messaging.rb index abc1234..def5678 100644 --- a/config/initializers/messaging.rb +++ b/config/initializers/messaging.rb @@ -1,11 +1,13 @@ # This configuration is suitable for development, it should be managed by puppet -# in production. +# in production. # TODO: Check if this is thread/forked process safe under passenger. Possible risk # that client connections get copied when passenger forks a process but the mutexes -# protecting those connections do not. +# protecting those connections do not. require 'messenger' unless Rails.env.test? Messenger.transport = Stomp::Client.new "stomp://support.cluster:61613" Publication.marples_transport = Stomp::Client.new 'stomp://support.cluster:61613' + Publication.marples_client_name = 'publisher' + Publication.marples_logger = Rails.logger end
Use the correct client name
diff --git a/lib/capybara/rails.rb b/lib/capybara/rails.rb index abc1234..def5678 100644 --- a/lib/capybara/rails.rb +++ b/lib/capybara/rails.rb @@ -2,6 +2,12 @@ require 'capybara/dsl' Capybara.app = Rack::Builder.new do + # Work around an issue where rails allows concurrency in test mode even though eager_load + # is false which can cause an issue with constant loading + if Gem::Version.new(Rails.version) >= Gem::Version.new("4.0") + use Rack::Lock unless Rails.application.config.eager_load || Rails.application.middleware.include?(Rack::Lock) + end + map "/" do if Gem::Version.new(Rails.version) >= Gem::Version.new("3.0") run Rails.application
Use Rack::Lock to prevent concurrency when eager_load is false
diff --git a/db/migrate/20160424000002_create_external_sync.rb b/db/migrate/20160424000002_create_external_sync.rb index abc1234..def5678 100644 --- a/db/migrate/20160424000002_create_external_sync.rb +++ b/db/migrate/20160424000002_create_external_sync.rb @@ -9,7 +9,7 @@ t.timestamps null: false end add_index :external_syncs, [:source, :source_id], unique: true - add_index :external_syncs, [:source, :source_id, :object, :o_id] + add_index :external_syncs, [:source, :source_id, :object, :o_id], name: 'index_external_syncs_on_source_and_source_id_and_object_o_id' add_index :external_syncs, [:object, :o_id] end end
Fixed: Index name 'index_external_syncs_on_source_and_source_id_and_object_and_o_id' on table 'external_syncs' is too long; the limit is 63 characters.
diff --git a/test/system/methods/with_no_args/returning_nil/output-truth/SUITE.rb b/test/system/methods/with_no_args/returning_nil/output-truth/SUITE.rb index abc1234..def5678 100644 --- a/test/system/methods/with_no_args/returning_nil/output-truth/SUITE.rb +++ b/test/system/methods/with_no_args/returning_nil/output-truth/SUITE.rb @@ -5,6 +5,6 @@ require File.expand_path(source_file) end -Dir.glob("#{File.dirname __FILE__}/**/*test.rb") do |test_file| +Dir.glob("#{File.dirname __FILE__}/**/*_test.rb") do |test_file| require File.expand_path(test_file) end
Fix pattern for finding test files
diff --git a/unpoly-rails.gemspec b/unpoly-rails.gemspec index abc1234..def5678 100644 --- a/unpoly-rails.gemspec +++ b/unpoly-rails.gemspec @@ -22,4 +22,7 @@ spec.add_dependency 'memoized' spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" + + # We use Module#prepend + spec.required_ruby_version = '>= 2.1.0' end
Add minimum Ruby version in gemspec
diff --git a/spec/lib/chamber/commands/secure_spec.rb b/spec/lib/chamber/commands/secure_spec.rb index abc1234..def5678 100644 --- a/spec/lib/chamber/commands/secure_spec.rb +++ b/spec/lib/chamber/commands/secure_spec.rb @@ -5,27 +5,31 @@ module Chamber module Commands describe Secure do - let(:rootpath) { Pathname.new(::File.expand_path('./spec/fixtures')) } - let(:settings_filename) { rootpath + 'settings' + 'unencrypted.yml' } - let(:options) { { basepath: rootpath, + let(:rootpath) { Pathname.new(::File.expand_path('./spec/fixtures')) } + let(:settings_directory) { rootpath + 'settings' } + let(:settings_filename) { settings_directory + 'unencrypted.yml' } + let(:options) { { basepath: rootpath, rootpath: rootpath, encryption_key: rootpath + '../spec_key', shell: double.as_null_object } } + before(:each) do + ::FileUtils.mkdir_p settings_directory unless ::File.exist? settings_directory + end + + after(:each) do + ::FileUtils.rm_rf(settings_directory) if ::File.exist? settings_directory + end + it 'can return values formatted as environment variables' do - ::FileUtils.mkdir_p rootpath + 'settings' unless ::File.exist? rootpath + 'settings' - ::File.open(settings_filename, 'w') do |file| - file.write <<-HEREDOC + settings_filename.write <<-HEREDOC test: _secure_my_unencrpyted_setting: hello HEREDOC - end Secure.call(options) - expect(::File.read(settings_filename)).to match %r{_secure_my_unencrpyted_setting: [A-Za-z0-9\+\/]{342}==} - - ::File.delete(settings_filename) + expect(settings_filename.read).to match %r{_secure_my_unencrpyted_setting: [A-Za-z0-9\+\/]{342}==} end end end
Tests: Fix spec that wasn't cleaning up after itself if it failed
diff --git a/spec/lib/chamber/commands/secure_spec.rb b/spec/lib/chamber/commands/secure_spec.rb index abc1234..def5678 100644 --- a/spec/lib/chamber/commands/secure_spec.rb +++ b/spec/lib/chamber/commands/secure_spec.rb @@ -5,27 +5,31 @@ module Chamber module Commands describe Secure do - let(:rootpath) { Pathname.new(::File.expand_path('./spec/fixtures')) } - let(:settings_filename) { rootpath + 'settings' + 'unencrypted.yml' } - let(:options) { { basepath: rootpath, + let(:rootpath) { Pathname.new(::File.expand_path('./spec/fixtures')) } + let(:settings_directory) { rootpath + 'settings' } + let(:settings_filename) { settings_directory + 'unencrypted.yml' } + let(:options) { { basepath: rootpath, rootpath: rootpath, encryption_key: rootpath + '../spec_key', shell: double.as_null_object } } + before(:each) do + ::FileUtils.mkdir_p settings_directory unless ::File.exist? settings_directory + end + + after(:each) do + ::FileUtils.rm_rf(settings_directory) if ::File.exist? settings_directory + end + it 'can return values formatted as environment variables' do - ::FileUtils.mkdir_p rootpath + 'settings' unless ::File.exist? rootpath + 'settings' - ::File.open(settings_filename, 'w') do |file| - file.write <<-HEREDOC + settings_filename.write <<-HEREDOC test: _secure_my_unencrpyted_setting: hello HEREDOC - end Secure.call(options) - expect(::File.read(settings_filename)).to match %r{_secure_my_unencrpyted_setting: [A-Za-z0-9\+\/]{342}==} - - ::File.delete(settings_filename) + expect(settings_filename.read).to match %r{_secure_my_unencrpyted_setting: [A-Za-z0-9\+\/]{342}==} end end end
Tests: Fix spec that wasn't cleaning up after itself if it failed
diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index abc1234..def5678 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -18,6 +18,7 @@ # Install module and dependencies hosts.each do |host| copy_module_to(host, source: proj_root, module_name: 'denyhosts') + on host, puppet('module install puppet-extlib'), acceptable_exit_codes: [0, 1] on host, puppet('module install puppetlabs-stdlib'), acceptable_exit_codes: [0, 1] end end
Add missing dependency for Beaker tests
diff --git a/core/exception/interrupt_spec.rb b/core/exception/interrupt_spec.rb index abc1234..def5678 100644 --- a/core/exception/interrupt_spec.rb +++ b/core/exception/interrupt_spec.rb @@ -33,3 +33,19 @@ end end end + +describe "Interrupt" do + # This spec is basically the same as above, + # but it does not rely on Signal.trap(:INT, :SIG_DFL) which can be tricky + it "is raised on the main Thread by the default SIGINT handler" do + out = ruby_exe(<<-'RUBY', args: "2>&1") + begin + Process.kill :INT, Process.pid + sleep + rescue Interrupt => e + puts "Interrupt: #{e.signo}" + end + RUBY + out.should == "Interrupt: #{Signal.list["INT"]}\n" + end +end
Add extra spec for the default SIGINT handler raising Interrupt
diff --git a/spec/factories.rb b/spec/factories.rb index abc1234..def5678 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -13,6 +13,16 @@ context 'Quote context' language 'english' user + + factory :quote_with_photos do + ignore do + photos_count 1 + end + + after(:create) do |quote, evaluator| + create_list(:photo, evaluator.photos_count, quote: quote) + end + end end factory :identity do
Add factory :quote_with_photos, nice DSL
diff --git a/lib/airbrake/rails/middleware/exceptions_catcher.rb b/lib/airbrake/rails/middleware/exceptions_catcher.rb index abc1234..def5678 100644 --- a/lib/airbrake/rails/middleware/exceptions_catcher.rb +++ b/lib/airbrake/rails/middleware/exceptions_catcher.rb @@ -17,7 +17,7 @@ controller = env['action_controller.instance'] env['airbrake.error_id'] = Airbrake. notify_or_ignore(exception, - controller.airbrake_request_data) unless skip_user_agent?(env) + controller.try(:airbrake_request_data) || {:rack_env => env}) unless skip_user_agent?(env) if defined?(controller.rescue_action_in_public_without_airbrake) controller.rescue_action_in_public_without_airbrake(exception) end
Fix Airbrake so it actually reports data.
diff --git a/lib/metasploit_data_models/db_manager/db_objects.rb b/lib/metasploit_data_models/db_manager/db_objects.rb index abc1234..def5678 100644 --- a/lib/metasploit_data_models/db_manager/db_objects.rb +++ b/lib/metasploit_data_models/db_manager/db_objects.rb @@ -1,45 +1,19 @@ module Msf - ## - # - # This module defines all of the DB database tables - # and creates ActiveRecord objects for each one of them - # - ## + # + # + # This module defines all of the DB database tables + # and creates ActiveRecord objects for each one of them + # + ## - class DBManager - - class Lock - @@mutex = Mutex.new - def self.mutex - @@mutex - end - end - - - # - # This inclusion makes sure the connection pool of ActiveRecord is purged frequently - # - module DBSave - - def self.included(mod) - class << mod - def find(*args) - ActiveRecord::Base.connection_pool.clear_stale_cached_connections! if ActiveRecord::Base.connection_pool - super(*args) - end - - def save(*args) - ActiveRecord::Base.connection_pool.clear_stale_cached_connections! if ActiveRecord::Base.connection_pool - super(*args) - end - - end - end - - end - - end + class DBManager + + # Stub for future hooks + module DBSave + + end + end end
Remove old connection flushing code (triggers warnings in AR 3.2)
diff --git a/lib/vagrant/smartos/zones/commands/multi_command.rb b/lib/vagrant/smartos/zones/commands/multi_command.rb index abc1234..def5678 100644 --- a/lib/vagrant/smartos/zones/commands/multi_command.rb +++ b/lib/vagrant/smartos/zones/commands/multi_command.rb @@ -29,7 +29,7 @@ command_method = subcommands.find { |c| c == command } unless command_method - ui.warn option_parser.to_s, prefix: false + @env.ui.warn option_parser.to_s, prefix: false exit 1 end @@ -38,7 +38,7 @@ end def fail_options! - ui.warn option_parser.to_s, prefix: false + @env.ui.warn option_parser.to_s, prefix: false exit 1 end
Fix issue with undefined local variable or method `ui'
diff --git a/test/gtk_overrides_test.rb b/test/gtk_overrides_test.rb index abc1234..def5678 100644 --- a/test/gtk_overrides_test.rb +++ b/test/gtk_overrides_test.rb @@ -1,4 +1,5 @@ require File.expand_path('test_helper.rb', File.dirname(__FILE__)) +require 'gir_ffi/overrides/gtk' class GtkOverridesTest < MiniTest::Spec setup do
Make sure overrides file for Gtk has been required in tests.
diff --git a/test/test_ebs_name_sync.rb b/test/test_ebs_name_sync.rb index abc1234..def5678 100644 --- a/test/test_ebs_name_sync.rb +++ b/test/test_ebs_name_sync.rb @@ -8,4 +8,8 @@ def test_that_it_is_a_class assert_equal EbsNameSync.class, Class end + + def test_that_it_has_fog_required + assert defined?(Fog), "It should require Fog" + end end
Test if fog is required
diff --git a/test/unit/donation_test.rb b/test/unit/donation_test.rb index abc1234..def5678 100644 --- a/test/unit/donation_test.rb +++ b/test/unit/donation_test.rb @@ -7,6 +7,7 @@ assert_not_nil d.amount assert d.amount > 0 assert d.amount < Rails.application.config.max_donation + assert_not_equal d.amount.to_i, d.amount, "donation amount should not be integer (most of the time)" d2 = Donation.new
Test Donation.amount set to randomly generated float instead of integer Not the best test, will have false failures every so often
diff --git a/lib/ember_cli/engine.rb b/lib/ember_cli/engine.rb index abc1234..def5678 100644 --- a/lib/ember_cli/engine.rb +++ b/lib/ember_cli/engine.rb @@ -1,10 +1,7 @@ module EmberCli class Engine < Rails::Engine initializer "ember-cli-rails.setup" do - require "ember_cli/ember_controller" require "ember_cli/route_helpers" - - ActionController::Base.helper EmberRailsHelper end end end
Fix autoload deprecation in Rails 6 After upgrading an application to Rails 6, I noticed the following deprecation warning: > DEPRECATION WARNING: Initialization autoloaded the constants ApplicationController This appears to be due to the initializer requiring `EmberController`, which shouldn't be necessary since that class is already in `app/controllers`, which is autoloaded. Similarly `EmberRailsHelper` is autoloaded and shouldn't need to be referenced here.
diff --git a/lib/env_bang/classes.rb b/lib/env_bang/classes.rb index abc1234..def5678 100644 --- a/lib/env_bang/classes.rb +++ b/lib/env_bang/classes.rb @@ -16,9 +16,9 @@ end def Array(value, options) - options.delete(:class) - options[:class] = options[:of] if options[:of] - value.split(',').map { |value| cast(value.strip, options) } + values = value.split(',').map { |value| value.strip } + values.map! { |value| cast(value, class: options[:of]) } if options[:of] + values end def Symbol(value, options)
Remove in-place modification of options when casting to Array. This was causing the :class option to be lost, which meant the first access to an Array value would work correctly, while subsequent accesses would return a String.
diff --git a/lib/espresso/concern.rb b/lib/espresso/concern.rb index abc1234..def5678 100644 --- a/lib/espresso/concern.rb +++ b/lib/espresso/concern.rb @@ -17,13 +17,18 @@ super base.extend const_get('ClassMethods') if const_defined?('ClassMethods') base.send :include, const_get('InstanceMethods') if const_defined?('InstanceMethods') - base.class_eval(&@_included_block) if instance_variable_defined?('@_included_block') + if instance_variable_defined?('@_included_blocks') + @_included_blocks.each do |included_block| + base.class_eval(&included_block) + end + end end end def included(base = nil, &block) if base.nil? - @_included_block = block + @_included_blocks ||= [] + @_included_blocks << block else super end
Make Espresso::Concern work with many included blocks
diff --git a/lib/mws-rb/api/feeds.rb b/lib/mws-rb/api/feeds.rb index abc1234..def5678 100644 --- a/lib/mws-rb/api/feeds.rb +++ b/lib/mws-rb/api/feeds.rb @@ -12,7 +12,7 @@ end def submit_feed(params={}) - xml_envelope = Envelope.new(params) + xml_envelope = Envelope.new(params.merge!(merchant_id: self.connection.seller_id)) params = params.except(:merchant_id, :message_type, :message, :skip_schema_validation) call(:submit_feed, params.merge!( request_params: {
Remove the need of passing merchant_id to submit_feed
diff --git a/examples.rb b/examples.rb index abc1234..def5678 100644 --- a/examples.rb +++ b/examples.rb @@ -1,7 +1,25 @@ require File.join(File.dirname(__FILE__), 'lib', 'tickle') -['May 30', '6:30 PM', 'tomorrow at 6:00', 'June 18, 2011',].each {|s| - print "s: ", s, " ", Tickle.parse(s) - puts +=begin + +Time is ignored if there's also a date, unless the date is 'tomorrow'(?) + +Tickle creates times in the servers local time zone. +To go from server time to user's local time... + user_time = server_time + (user_time_offset - server_time_offset) + eg (5:00PM Central) = (6:00PM Eastern + (-6 - -5)) + +=end + + +server_offset = Time.now.utc_offset / 60 / 60 + +['May 30th at midnight', '6:30 PM', + 'tomorrow at 6:00', 'June 18, 2011', 'Christmas'].each {|s| + time = Tickle.parse(s)[:next] + print s, " --> server date: ", time + puts + print s, " --> utc date: ", time - Time.now.utc_offset + puts }
Add timezone notes to example.rb
diff --git a/recipes/haproxy.rb b/recipes/haproxy.rb index abc1234..def5678 100644 --- a/recipes/haproxy.rb +++ b/recipes/haproxy.rb @@ -22,6 +22,7 @@ cn "Tester" bits 4096 days 365 + not_if do ::File.exists?(node['haproxy']['cert']) end end template "#{node['haproxy']['conf_dir']}/haproxy.cfg" do
Add constraint to cert resource
diff --git a/lib/ssh_key_hub/exporter/authorized_keys_users.rb b/lib/ssh_key_hub/exporter/authorized_keys_users.rb index abc1234..def5678 100644 --- a/lib/ssh_key_hub/exporter/authorized_keys_users.rb +++ b/lib/ssh_key_hub/exporter/authorized_keys_users.rb @@ -0,0 +1,28 @@+module SSHKeyHub::Exporter + # Simple key exporter with home directory like subfolders + class AuthorizedKeysUsers + def initialize + @credentials = {} + end + + def add(new_creds) + @credentials.merge!(new_creds) { |_, old_val, new_val| old_val + new_val } + end + + def export(dir_name="home") + Dir.mkdir dir_name + Dir.chdir dir_name do + @credentials.each do |user, keys| + Dir.mkdir user + ssh_dir = File.join(user, '.ssh') + Dir.mkdir ssh_dir + Dir.chdir ssh_dir do + File.open('authorized_keys', 'w') do |file| + keys.each { |key| file.puts key } + end + end + end + end + end + end +end
Add simple OpenSSH style home directory key export
diff --git a/lib/webmock/http_lib_adapters/http_rb/response.rb b/lib/webmock/http_lib_adapters/http_rb/response.rb index abc1234..def5678 100644 --- a/lib/webmock/http_lib_adapters/http_rb/response.rb +++ b/lib/webmock/http_lib_adapters/http_rb/response.rb @@ -14,8 +14,18 @@ def from_webmock(webmock_response, request_signature = nil) status = Status.new(webmock_response.status.first) headers = webmock_response.headers || {} - body = Body.new(Streamer.new(webmock_response.body), encoding: webmock_response.body.encoding) uri = normalize_uri(request_signature && request_signature.uri) + + # HTTP.rb 3.0+ uses a keyword argument to pass the encoding, but 1.x + # and 2.x use a positional argument, and 0.x don't support supplying + # the encoding. + body = if HTTP::VERSION < "1.0.0" + Body.new(Streamer.new(webmock_response.body)) + elsif HTTP::VERSION < "3.0.0" + Body.new(Streamer.new(webmock_response.body), webmock_response.body.encoding) + else + Body.new(Streamer.new(webmock_response.body), encoding: webmock_response.body.encoding) + end return new(status, "1.1", headers, body, uri) if HTTP::VERSION < "1.0.0"
Support correct encoding parameter for HTTP.rb 2.x and earlier
diff --git a/lib/vmdb/deprecation.rb b/lib/vmdb/deprecation.rb index abc1234..def5678 100644 --- a/lib/vmdb/deprecation.rb +++ b/lib/vmdb/deprecation.rb @@ -1,5 +1,19 @@-Vmdb::Deprecation ||= begin - deprecator = ActiveSupport::Deprecation.new("D-release", "ManageIQ") - deprecator.behavior = [:stderr, :log] - deprecator +module Vmdb + class Deprecation + def self.instance + @instance ||= begin + deprecator = ActiveSupport::Deprecation.new("D-release", "ManageIQ") + deprecator.behavior = [:stderr, :log] + deprecator + end + end + + def self.method_missing(method_name, *args, &block) + instance.respond_to?(method_name) ? instance.send(method_name, *args, &block) : super + end + + def self.respond_to_missing?(method, _include_private = false) + instance.respond_to?(method) + end + end end
Fix rubocop error "Syntax - dynamic constant assignment"
diff --git a/lib/yelp/deep_struct.rb b/lib/yelp/deep_struct.rb index abc1234..def5678 100644 --- a/lib/yelp/deep_struct.rb +++ b/lib/yelp/deep_struct.rb @@ -3,37 +3,30 @@ # This is some code to create nested Structs from nested hash tables. # Code written by Andrea Pavoni, more information here: # http://andreapavoni.com/blog/2013/4/create-recursive-openstruct-from-a-ruby-hash +# +# This has been slightly modified to work with hashes nested inside of arrays class DeepStruct < OpenStruct - def initialize(hash = nil) + def initialize(hash = {}) @table = {} - @hash_table = {} - if hash - hash.each do |k,v| - if v.is_a?(Hash) - @table[k.to_sym] = self.class.new(v) - elsif v.is_a?(Array) - array = [] - v.each do |v2| - if v2.is_a?(Hash) - array << self.class.new(v2) - else - array << v2 - end + hash.each do |k,v| + if v.is_a?(Hash) + @table[k.to_sym] = self.class.new(v) + elsif v.is_a?(Array) + array = [] + v.each do |v2| + if v2.is_a?(Hash) + array << self.class.new(v2) + else + array << v2 end - @table[k.to_sym] = array - else - @table[k.to_sym] = v end + @table[k.to_sym] = array + else + @table[k.to_sym] = v + end - @hash_table[k.to_sym] = v - - new_ostruct_member(k) - end + new_ostruct_member(k) end end - - def to_h - @hash_table - end end
Clean up DeepStruct a little bit
diff --git a/spec/acceptance/support/sphinx_controller.rb b/spec/acceptance/support/sphinx_controller.rb index abc1234..def5678 100644 --- a/spec/acceptance/support/sphinx_controller.rb +++ b/spec/acceptance/support/sphinx_controller.rb @@ -40,7 +40,7 @@ end def index(*indices) - config.controller.index *indices + ThinkingSphinx::Commander.call :index_sql, config, :indices => indices end private
Use the commander for indexing in acceptance specs
diff --git a/spec/controllers/contacts_controller_spec.rb b/spec/controllers/contacts_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/contacts_controller_spec.rb +++ b/spec/controllers/contacts_controller_spec.rb @@ -14,5 +14,13 @@ it { expect(response).to be_success } end + describe "GET 'autocomplete'" do + before(:each) { get 'autocomplete', term: 'bac' } + it { expect(Contact.count).to eq(0)} + it { expect(response).to be_success } + it { expect(response.body).to eq([{value:"bac",label:"Cr\u00e9er la structure : bac", new:"true",link:"/fr/structures/new?name=bac"},{value:"bac",label:"Cr\u00e9er la personne : bac",new:"true",link:"/fr/people/new?name=bac"}].to_json) } + end + + end end
Fix spec for previous commit
diff --git a/spec/integration/match_either_result_spec.rb b/spec/integration/match_either_result_spec.rb index abc1234..def5678 100644 --- a/spec/integration/match_either_result_spec.rb +++ b/spec/integration/match_either_result_spec.rb @@ -1,29 +1,93 @@ RSpec.describe "MatchEitherResult" do - subject(:match) { - MatchEitherResult(result) do |m| - m.success do |v| - "Matched success: #{v}" + describe "external matching" do + subject(:match) { + MatchEitherResult(result) do |m| + m.success do |v| + "Matched success: #{v}" + end + + m.failure do |v| + "Matched failure: #{v}" + end end + } - m.failure do |v| - "Matched failure: #{v}" + context "successful result" do + let(:result) { Right("a success") } + + it "matches on success" do + expect(match).to eq "Matched success: a success" end end - } - context "successful result" do - let(:result) { Right("a success") } + context "failed result" do + let(:result) { Left("a failure") } - it "matches on success" do - expect(match).to eq "Matched success: a success" + it "matches on failure" do + expect(match).to eq "Matched failure: a failure" + end end end - context "failed result" do - let(:result) { Left("a failure") } + describe "class enhancement" do + let(:operation) { + Class.new do + include EitherResultMatcher.for(:call) - it "matches on failure" do - expect(match).to eq "Matched failure: a failure" + def call(bool) + bool ? Right("a success") : Left("a failure") + end + end.new + } + + describe "match blocks" do + subject(:match) { + operation.call(input) do |m| + m.success do |v| + "Matched success: #{v}" + end + + m.failure do |v| + "Matched failure: #{v}" + end + end + } + + context "successful result" do + let(:input) { true } + + it "matches on success" do + expect(match).to eq "Matched success: a success" + end + end + + context "failed result" do + let(:input) { false } + + it "matches on failure" do + expect(match).to eq "Matched failure: a failure" + end + end + end + + describe "without match blocks" do + subject(:result) { operation.call(input) } + + context "successful result" do + let(:input) { true } + + it "returns the result" do + expect(result).to eq Right("a success") + end + end + + context "failed result" do + let(:input) { false } + + it "returns the result" do + expect(result).to eq Left("a failure") + end + end end end end
Add specs to cover class enhancement
diff --git a/spec/lib/danica/variable_spec.rb b/spec/lib/danica/variable_spec.rb index abc1234..def5678 100644 --- a/spec/lib/danica/variable_spec.rb +++ b/spec/lib/danica/variable_spec.rb @@ -10,7 +10,9 @@ let(:value) { 100 } let(:subject) { described_class.new(value: value) } - it { expect(subject.to_f).to eq(value) } + it 'returns the value' do + expect(subject.to_f).to eq(value) + end end end
Correct spec description to variable spec
diff --git a/spec/centos/interfaces_spec.rb b/spec/centos/interfaces_spec.rb index abc1234..def5678 100644 --- a/spec/centos/interfaces_spec.rb +++ b/spec/centos/interfaces_spec.rb @@ -0,0 +1,24 @@+require 'spec_helper' + +# This test requires a VM to be provision with two IPs, preferably one public +# and one private. + +# Test to ensure the VM has two interfaces, eth0 and eth1 + +# eth0 +describe interface('eth0') do + it { should exist } +end + +describe interface('eth0') do + it { should be_up } +end + +# eth1 +describe interface('eth1') do + it { should exist } +end + +describe interface('eth1') do + it { should be_up } +end
Test to ensure the VM has two interfaces, eth0 and eth1 This test requires a VM to be provision with two IPs, preferably one public and one private.
diff --git a/spec/api_mock_spec.rb b/spec/api_mock_spec.rb index abc1234..def5678 100644 --- a/spec/api_mock_spec.rb +++ b/spec/api_mock_spec.rb @@ -0,0 +1,11 @@+require 'discordrb' +require 'mock/api_mock' +using APIMock + +describe APIMock do + it 'stores the used method' do + Discordrb::API.raw_request(:get, []) + + Discordrb::API.last_method.should == :get + end +end
Write a short spec for APIMock
diff --git a/spec/models/restaurant_spec.rb b/spec/models/restaurant_spec.rb index abc1234..def5678 100644 --- a/spec/models/restaurant_spec.rb +++ b/spec/models/restaurant_spec.rb @@ -3,9 +3,8 @@ RSpec.describe Restaurant, type: :model do describe "attributes" do it { should have_db_column(:name) } - it { should have_db_column(:address) } + it { should have_db_column(:address1) } it { should have_db_column(:phone_number) } - it { should have_db_column(:website) } it { should have_db_column(:created_at) } it { should have_db_column(:updated_at) } end @@ -14,4 +13,4 @@ it { should have_many(:pictures) } it { should have_many(:likes).through(:pictures) } end -end+end
Fix rspec tests to pass new restaurants table
diff --git a/NoticeView.podspec b/NoticeView.podspec index abc1234..def5678 100644 --- a/NoticeView.podspec +++ b/NoticeView.podspec @@ -0,0 +1,14 @@+Pod::Spec.new do |s| + s.name = 'NoticeView' + s.version = '2.4' + s.license = 'MIT' + s.summary = 'A TweetBot-like notice component for iOS.' + s.homepage = 'https://github.com/tciuro/NoticeView/' + s.author = { 'Tito Ciuro' => 'tciuro@mac.com' } + s.source = { :git => 'https://github.com/tciuro/NoticeView.git', :tag => '2.4' } + s.platform = :ios + s.source_files = 'NoticeView/WBNoticeView/*.{m,h}' + s.frameworks = 'Foundation', 'UIKit', 'CoreGraphics', 'QuartzCore' + s.resources = 'NoticeView/WBNoticeView/NoticeView.bundle' + s.requires_arc = true +end
Add podspec to support :local installation
diff --git a/spec/double-create.rb b/spec/double-create.rb index abc1234..def5678 100644 --- a/spec/double-create.rb +++ b/spec/double-create.rb @@ -0,0 +1,11 @@+require_relative 'spec_helper' + +describe "Noodle" do + it "should fail to create a node with the same name as an existing node" do + post '/nodes/jojo.example.com', params = '{"ilk":"host","status":"surplus","params":{"site":"moon"}}' + post '/nodes/jojo.example.com', params = '{"ilk":"yabba","status":"foo","params":{"site":"moon"}}' + assert_equal last_response.status,422 + assert last_response.body.must_include 'jojo.example.com already exists' + end +end +
Add test for creating a node that already exists
diff --git a/spec/support/authentication.rb b/spec/support/authentication.rb index abc1234..def5678 100644 --- a/spec/support/authentication.rb +++ b/spec/support/authentication.rb @@ -24,6 +24,15 @@ let(:current_user) { membership.user } end +shared_context "signed in as a group member" do + include_context "signs in" + + let!(:membership) { FactoryGirl.create(:stewie_at_quahogcc) } + let!(:password) { FactoryGirl.attributes_for(:stewie)[:password] } + let(:current_group) { membership.group } + let(:current_user) { membership.user } +end + shared_context "signed in as a site user" do include_context "signs in"
Add group member sign in context.
diff --git a/Titanium.podspec b/Titanium.podspec index abc1234..def5678 100644 --- a/Titanium.podspec +++ b/Titanium.podspec @@ -18,7 +18,7 @@ s.platform = :ios, '7.0' - s.source = { :git => "git@github.com:quri/Titanium.git", :tag => "#{s.version}" } + s.source = { :git => "https://github.com/quri/Titanium.git", :tag => "#{s.version}" } s.source_files = 'Titanium/Titanium/*.{h,m}'
Change to https in podspec to pass linter
diff --git a/spec/time_helpers_spec.rb b/spec/time_helpers_spec.rb index abc1234..def5678 100644 --- a/spec/time_helpers_spec.rb +++ b/spec/time_helpers_spec.rb @@ -5,6 +5,11 @@ it do expect(Time.current.year).to eq 2004 + expect(Time.now.year).to eq 2004 + + # ensure knapsack_pro adds raw method + # to detect real time + expect(Time.raw_now.year).to be >= 2017 end end @@ -14,6 +19,7 @@ it do travel_to(1.day.ago) do expect(Time.current.day).to eq yesterday.day + expect(Time.raw_now.year).to be >= 2017 end end end
Add additional tests to ensure the knapsack_pro detects time correctly
diff --git a/lib/hensel/helpers.rb b/lib/hensel/helpers.rb index abc1234..def5678 100644 --- a/lib/hensel/helpers.rb +++ b/lib/hensel/helpers.rb @@ -3,7 +3,7 @@ module Hensel module Helpers def breadcrumbs - @breadcrumbs ||= Builder.new + @__breadcrumbs ||= Builder.new end end end
Fix an instance variable name
diff --git a/rails-data-explorer.gemspec b/rails-data-explorer.gemspec index abc1234..def5678 100644 --- a/rails-data-explorer.gemspec +++ b/rails-data-explorer.gemspec @@ -17,7 +17,7 @@ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") # really it's only ActiveSupport and ActionView - gem.add_dependency 'rails', '>= 3.0.0' + gem.add_dependency 'actionview', '>= 3.0.0' gem.add_dependency 'color' gem.add_dependency 'descriptive-statistics' gem.add_dependency 'distribution'
Adjust rails dependencies to what's needed only
diff --git a/spree_cdyne_pav.gemspec b/spree_cdyne_pav.gemspec index abc1234..def5678 100644 --- a/spree_cdyne_pav.gemspec +++ b/spree_cdyne_pav.gemspec @@ -16,7 +16,7 @@ s.require_path = 'lib' s.requirements << 'none' - s.add_dependency 'spree_core', '~> 1.2' + s.add_dependency 'spree_core', '>= 2.0.0.beta' s.add_dependency 'active_record_query_trace' s.add_development_dependency 'capybara', '1.0.1'
Update gemspec to support spree 2.0
diff --git a/rakuten_web_service.gemspec b/rakuten_web_service.gemspec index abc1234..def5678 100644 --- a/rakuten_web_service.gemspec +++ b/rakuten_web_service.gemspec @@ -17,7 +17,7 @@ spec.require_paths = ['lib'] spec.required_ruby_version = '>= 2.3.0' - spec.add_development_dependency 'bundler', '~> 1.3' + spec.add_development_dependency 'bundler' spec.add_development_dependency 'rake', '~> 12.3.0' spec.add_development_dependency 'rspec', '~> 3.7.0' spec.add_development_dependency 'tapp', '~> 1.5.1'
Use the latest version of bundler
diff --git a/lib/mactag/builder.rb b/lib/mactag/builder.rb index abc1234..def5678 100644 --- a/lib/mactag/builder.rb +++ b/lib/mactag/builder.rb @@ -43,7 +43,7 @@ if builder.has_gems? Mactag::Ctags.new(@builder.files, Mactag::Config.tags_file).create - puts "Successfully generated #{Mactag::Config.tags_file} file" + puts "[done] Successfully generated #{Mactag::Config.tags_file} file" else raise Mactag::MactagError.new('Nothing to tag') end
Update message when creation of tags file is done.
diff --git a/lib/install/template.rb b/lib/install/template.rb index abc1234..def5678 100644 --- a/lib/install/template.rb +++ b/lib/install/template.rb @@ -10,7 +10,7 @@ /node_modules EOS -run './bin/yarn add --dev webpack webpack-merge webpack-dev-server path-complete-extname babel-loader babel-core babel-preset-latest coffee-loader coffee-script rails-erb-loader glob' +run './bin/yarn add --dev webpack webpack-merge webpack-dev-server path-complete-extname babel-loader babel-core babel-preset-latest coffee-loader coffee-script compression-webpack-plugin rails-erb-loader glob' environment \ "# Make javascript_pack_tag lookup digest hash to enable long-term caching\n" +
Add compression-webpack-plugin as a dependency
diff --git a/clever_tap.gemspec b/clever_tap.gemspec index abc1234..def5678 100644 --- a/clever_tap.gemspec +++ b/clever_tap.gemspec @@ -14,8 +14,6 @@ spec.description = 'Gem providing easy access to the CleverTap API' spec.files = Dir['lib/**/*', 'LICENSE.txt', 'Rakefile', 'README.md', 'Gemfile'] spec.test_files = Dir['spec/**/*'] - spec.executables = Dir['bin/**/*'] - spec.bindir = 'bin' spec.require_paths = ['lib'] # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
Fix gem warning for wrong bin folder
diff --git a/lib/mas/firm_indexer.rb b/lib/mas/firm_indexer.rb index abc1234..def5678 100644 --- a/lib/mas/firm_indexer.rb +++ b/lib/mas/firm_indexer.rb @@ -16,6 +16,13 @@ index_firm(aggregate.firm) if firm_exists?(aggregate.firm) end + def firm_exists?(firm) + return false if (firm.nil? || firm.destroyed?) + Firm.exists?(firm.id) + end + + private + def store_firm(firm) FirmRepository.new.store(firm) end @@ -23,10 +30,5 @@ def delete_firm(firm) FirmRepository.new.delete(firm.id) end - - def firm_exists?(firm) - return false if (firm.nil? || firm.destroyed?) - Firm.exists?(firm.id) - end end end
Make store_firm and delete_firm private
diff --git a/lib/camaraderie/user.rb b/lib/camaraderie/user.rb index abc1234..def5678 100644 --- a/lib/camaraderie/user.rb +++ b/lib/camaraderie/user.rb @@ -10,7 +10,7 @@ Camaraderie.membership_types.each do |type| class_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{type}_of?(organization) - !!memberships.#{type.pluralize}.where(organization: organization).exists? + !!memberships.#{type.pluralize}.where(organization_id: organization.id).exists? end RUBY end
Fix bug with ActiveRecord 3
diff --git a/lib/podio/areas/news.rb b/lib/podio/areas/news.rb index abc1234..def5678 100644 --- a/lib/podio/areas/news.rb +++ b/lib/podio/areas/news.rb @@ -5,7 +5,7 @@ def create(attributes) response = Podio.connection.post do |req| - req.url = '/news' + req.url '/news/' req.body = attributes end
Fix syntax error in create method on News area
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,3 +1,12 @@ dian = User.create(name: "Dian", email: "dian@example.com", password: "abc123") julianna = User.create(name: "Julianna", email: "juls@example.com", password: "123456") jenny = User.create(name: "Jenny", email: "jellylee@example.com", password: "iamjenny") + + +ExpenseType.create(name: "Housing") +ExpenseType.create(name: "Transportation") +ExpenseType.create(name: "Food") +ExpenseType.create(name: "Phone") +ExpenseType.create(name: "Misc. 1") +ExpenseType.create(name: "Misc. 2") +ExpenseType.create(name: "Misc. 3")
Add expense type seed data
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1 +1,29 @@-# Nothing to see here, yet. +# I fear my lack of imagination for this. + +pseudonyms = %w(svankmajer ricatorta tinchox jp_kakaroto ak|ra codefolk frankie norman leech nonce) + +titles = [ + 'absolute peace', + 'reaching the threshold', + 'perhaps a light at the end of the tunnel', + 'please, don\'t do this to me', + 'uncanny perceptions', + 'the monkey\'s out of the bottle, man', + 'allow me to break the ice', + 'it\'s not a tumor', + 'finding a new way', + 'this is enlightmen? whatever' +] + +body = %{ +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer vitae orci nec leo gravida adipiscing. Duis aliquam ac massa non dictum. Pellentesque aliquam eu enim vitae volutpat. In justo eros, tempus in purus a, rutrum sagittis turpis. Suspendisse potenti. Phasellus quis commodo eros. Aenean ut odio faucibus, pulvinar tellus fringilla, ornare sem. + +Ut dolor ante, sagittis nec ornare eu, sollicitudin eu nisi. Sed in enim quis ante viverra rhoncus vitae non tellus. Pellentesque convallis massa et felis vestibulum, vestibulum hendrerit felis luctus. In vel gravida lacus. Sed turpis elit, tristique a vulputate vitae, scelerisque vitae nunc. Sed ac nibh sollicitudin, ornare tortor a, pellentesque risus. Curabitur porta ligula aliquam, vulputate tortor quis, porttitor nisi. Sed molestie ac tortor eu dapibus. + +Morbi quis ipsum sed dui placerat tristique. Integer consequat dolor enim, nec pretium lorem faucibus vitae. Mauris lacinia sem aliquet urna convallis, eu varius velit aliquam. Vestibulum sit amet turpis a sem varius sollicitudin. Praesent eu eleifend metus. Sed interdum varius lorem non egestas. Aenean metus massa, placerat in mauris vel, viverra pellentesque nunc. Sed neque dui, molestie eget molestie in, condimentum non enim. In ac nunc pretium, feugiat metus ac, placerat turpis. Curabitur malesuada ligula vel urna feugiat, a semper tortor dignissim. Fusce ut est a erat porttitor facilisis. +} + +titles.zip(pseudonyms).each do |title, pseudonym| + experience = Experience.create(title: title, pseudonym: pseudonym, body: body) + experience.approve +end
Add seed data for development.
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,3 +1,6 @@+User.create(username: 'admin', password: 'admin', + password_confirmation: 'admin', email: 'admin@admin.com') + 5.times do passphrase_generator = Faker::Internet.password
Add admin user for testing
diff --git a/spec/controllers/no_response_if_performed_spec.rb b/spec/controllers/no_response_if_performed_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/no_response_if_performed_spec.rb +++ b/spec/controllers/no_response_if_performed_spec.rb @@ -3,46 +3,34 @@ module NoResponseIfPerformedSpec # example setup class TheController < ActionController::Base - before_filter :redirect + before_filter :do_redirect response_for :an_action do |format| - format.html { in_response_for } + format.html { render :text => "in response for" } end protected - def redirect + def do_redirect redirect_to 'http://redirected.from.before_filter' end - - def in_response_for; end end describe TheController do - describe "when before_filter redirects, GET :an_action" do - it "should redirect to 'http://redirected.from.before_filter'" do + describe "(when before_filter redirects)" do + it "GET :an_action should redirect to 'http://redirected.from.before_filter'" do get :an_action response.should redirect_to('http://redirected.from.before_filter') end - - it "should not execute inside response_for" do - @controller.should_not_receive :in_response_for - get :an_action - end end - describe "when before_filter doesn't redirect, GET :an_action" do + describe "(when before_filter doesn't redirect)" do before do - @controller.stub!(:redirect) + @controller.stub!(:do_redirect) end - it "should execute inside response for" do - @controller.should_receive :in_response_for + it "GET :an_action should execute inside response for" do get :an_action - end - - it "should render :an_action" do - get :an_action - response.should render_template(:an_action) + response.body.should == 'in response for' end end end
Simplify spec, less method tracing, more response checking
diff --git a/lib/thank_you_mailer.rb b/lib/thank_you_mailer.rb index abc1234..def5678 100644 --- a/lib/thank_you_mailer.rb +++ b/lib/thank_you_mailer.rb @@ -3,14 +3,12 @@ require 'mail' class ThankYouMailer - class << self - def send_email(recipient, first_name) - Mail.deliver do - to recipient - from 'info@survivalinternational.org' - subject 'Thank you for your donation' - body "Hello #{first_name}" - end + def self.send_email(recipient, first_name) + Mail.deliver do + to recipient + from 'info@survivalinternational.org' + subject 'Thank you for your donation' + body "Thank you for your donation #{first_name}" end end end
Make the class method syntax more explicit and readable We only have one class method and there is a lot of indentation making the code difficult to scan. Using the class << self syntax is a premature optimization in this case.
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -0,0 +1,5 @@+unless Role.count > 0 + Role.create!(:name => "Administrator", :kind => Role::KIND_ADMIN) + Role.create!(:name => "Committer", :kind => Role::KIND_MEMBER) +end +
Fix db:setup task to allow team creation Seed data should go to db/seeds.rb instead of being on migrations.
diff --git a/BVLinearGradient.podspec b/BVLinearGradient.podspec index abc1234..def5678 100644 --- a/BVLinearGradient.podspec +++ b/BVLinearGradient.podspec @@ -3,6 +3,8 @@ s.name = "BVLinearGradient" s.version = "1.5.2" s.homepage = "https://github.com/brentvatne/react-native-linear-gradient" + s.summary = "A <LinearGradient /> component for react-native" + s.author = "Brent Vatne" s.platform = :ios, "7.0" s.source = { :git => "https://github.com/brentvatne/react-native-linear-gradient.git", :tag => "#{s.version}" } s.source_files = 'BVLinearGradient/*.{h,m}'
Add required fields to podspec Cocoapods >= 1 requires `summary` and `author`
diff --git a/app/controllers/chapters_controller.rb b/app/controllers/chapters_controller.rb index abc1234..def5678 100644 --- a/app/controllers/chapters_controller.rb +++ b/app/controllers/chapters_controller.rb @@ -4,7 +4,7 @@ caches_action :show def show - @chapter = @book.chapters.detect { |chapter| chapter.position == params[:id].to_i } + @chapter = @book.chapters.first(conditions: { position: params[:id] }) end private
Use for finding a chapter for a given position rather than the array version
diff --git a/spec/lib/tasks/dev_seed_spec.rb b/spec/lib/tasks/dev_seed_spec.rb index abc1234..def5678 100644 --- a/spec/lib/tasks/dev_seed_spec.rb +++ b/spec/lib/tasks/dev_seed_spec.rb @@ -1,5 +1,7 @@+require 'rake' require 'rails_helper' -require 'rake' +Rake::Task.define_task(:environment) +Rake.application.rake_require('tasks/db') describe 'rake db:dev_seed' do let :run_rake_task do
Add missing require for dev_seeds rake task spec
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index abc1234..def5678 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -5,16 +5,16 @@ @project = Project.new end - def create - @user = User.find(params[:user_id]) - @project = Project.new(project_params) - @user.save! - redirect_to root_path - end + # def create + # @user = User.find(params[:user_id]) + # @project = Project.new(project_params) + # @user.save! + # redirect_to root_path + # end - private - def project_params - params.require(:project).permit(:title, :wordcount_goal, :goal_time_limit, :goal_deadline_date) - end + # private + # def project_params + # params.require(:project).permit(:title, :wordcount_goal, :goal_time_limit, :goal_deadline_date) + # end end
Add create mvp action in ProjectsController.
diff --git a/app/controllers/requests_controller.rb b/app/controllers/requests_controller.rb index abc1234..def5678 100644 --- a/app/controllers/requests_controller.rb +++ b/app/controllers/requests_controller.rb @@ -25,7 +25,9 @@ end def update - + request = Request.find_by(params[:id]) + request.responder = current_user if request.requester != current_user + redirect_to request(@request) end def destroy
Add update logic to add responder
diff --git a/lib/ruboty/jira/actions/associate_user.rb b/lib/ruboty/jira/actions/associate_user.rb index abc1234..def5678 100644 --- a/lib/ruboty/jira/actions/associate_user.rb +++ b/lib/ruboty/jira/actions/associate_user.rb @@ -20,8 +20,8 @@ end def reply_message - if associate_name.nil? - message.reply('The jira account name is not found') + if associate_user.nil? + message.reply("The jira account #{message[:jira_id]} is not found") else message.reply('Registered.') end
Change assciate user error message
diff --git a/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb b/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb index abc1234..def5678 100644 --- a/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb +++ b/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb @@ -13,11 +13,11 @@ end def self.renderer - @renderer ||= - ReactRenderer - .new(files: ['pageflow-scrolled-server.js'], - # Define required external globals. - code: 'function videojs() {};') + if Rails.env.development? + ReactServerSideRenderingHelper.new_renderer + else + @renderer ||= ReactServerSideRenderingHelper.new_renderer + end end # Normally react-rails either tries to auto detect which asset @@ -29,5 +29,12 @@ ::React::ServerRendering::WebpackerManifestContainer end end + + def self.new_renderer + ReactRenderer + .new(files: ['pageflow-scrolled-server.js'], + # Define required external globals. + code: 'function videojs() {};') + end end end
Remove renderer memoization in development Having to restart the Rails server to synchronize server- and client-side JS introduces an additional error source in many development scenarios that otherwise don't have anything to do with the SSR/CSR distinction. To avoid this, we only memoize the renderer in environments that aren't development. REDMINE-18013
diff --git a/lib/tasks/ffcrm/missing_translations.rake b/lib/tasks/ffcrm/missing_translations.rake index abc1234..def5678 100644 --- a/lib/tasks/ffcrm/missing_translations.rake +++ b/lib/tasks/ffcrm/missing_translations.rake @@ -4,25 +4,25 @@ # See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php #------------------------------------------------------------------------------ -require './lib/missing_translation_detector.rb' +require 'missing_translation_detector' namespace :ffcrm do namespace :missing_translations do desc 'Detects missing translations for a locale - Takes a locale and compares with "en-US".' task :detect, [:locale] => [:environment] do |t, args| base_locale = 'en-US' - + [[base_locale, args[:locale]], ["#{base_locale}_fat_free_crm", "#{args[:locale]}_fat_free_crm"]].each do |locale_file_names| detector = MissingTranslationDetector.new locale_file_names.first, - locale_file_names.last + locale_file_names.last detector.detect if detector.missing_translations? puts puts "Detected missing translations within \"config/locales/#{locale_file_names.last}.yml\":" puts - + detector.missing_translations.each do |missing| puts "#{missing.key_path.join(' => ')}: #{missing.value}" end
Fix relative path issue when running ffcrm as an engine.
diff --git a/lib/tasks/ffcrm/missing_translations.rake b/lib/tasks/ffcrm/missing_translations.rake index abc1234..def5678 100644 --- a/lib/tasks/ffcrm/missing_translations.rake +++ b/lib/tasks/ffcrm/missing_translations.rake @@ -4,25 +4,25 @@ # See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php #------------------------------------------------------------------------------ -require './lib/missing_translation_detector.rb' +require 'missing_translation_detector' namespace :ffcrm do namespace :missing_translations do desc 'Detects missing translations for a locale - Takes a locale and compares with "en-US".' task :detect, [:locale] => [:environment] do |t, args| base_locale = 'en-US' - + [[base_locale, args[:locale]], ["#{base_locale}_fat_free_crm", "#{args[:locale]}_fat_free_crm"]].each do |locale_file_names| detector = MissingTranslationDetector.new locale_file_names.first, - locale_file_names.last + locale_file_names.last detector.detect if detector.missing_translations? puts puts "Detected missing translations within \"config/locales/#{locale_file_names.last}.yml\":" puts - + detector.missing_translations.each do |missing| puts "#{missing.key_path.join(' => ')}: #{missing.value}" end
Fix relative path issue when running ffcrm as an engine.
diff --git a/lib/dotenv/rails-now.rb b/lib/dotenv/rails-now.rb index abc1234..def5678 100644 --- a/lib/dotenv/rails-now.rb +++ b/lib/dotenv/rails-now.rb @@ -6,5 +6,15 @@ # gem "gem-that-requires-env-variables" # +# Needed for dotenv to work in Rails 3.0 +# https://github.com/bkeepers/dotenv/issues/151 +module Rails + class Railtie + def self.instance + @instance ||= new + end + end +end require "dotenv/rails" + Dotenv::Railtie.load
Add Rails 3 monkey patch to deal with missing ivar prior to load. * Can't put this in application.rb since dotenv needs to set env before loading other gems. * Rails environment must be set prior to load for rspec tests or else the development db is configured * https://github.com/bkeepers/dotenv/issues/45
diff --git a/spree_i18n.gemspec b/spree_i18n.gemspec index abc1234..def5678 100644 --- a/spree_i18n.gemspec +++ b/spree_i18n.gemspec @@ -16,7 +16,7 @@ s.add_dependency 'i18n', '~> 0.6.1' s.add_dependency 'rails-i18n', '~> 0.7.3' - s.add_dependency 'spree_core', '~> 2.1.0.beta' + s.add_dependency 'spree_core', '~> 2.0' s.add_dependency 'globalize3', '~> 0.3.0' s.add_development_dependency 'rspec-rails', '~> 2.13'
Make master branch less restrict on spree versions No need to force to 2.1.0.beta as master branch should work as well spree 2.0.x releases
diff --git a/lib/gir_ffi-gst/base.rb b/lib/gir_ffi-gst/base.rb index abc1234..def5678 100644 --- a/lib/gir_ffi-gst/base.rb +++ b/lib/gir_ffi-gst/base.rb @@ -24,7 +24,7 @@ # Overrides for Gst module functions module Gst - setup_method 'init' + setup_method! 'init' include GirFFIGst::AutoArgv end
Use exception-raising method setup functions
diff --git a/lib/mutant/delegator.rb b/lib/mutant/delegator.rb index abc1234..def5678 100644 --- a/lib/mutant/delegator.rb +++ b/lib/mutant/delegator.rb @@ -11,9 +11,7 @@ # @api private # def delegate(*names) - names.each do |name| - define_delegator(name) - end + names.each(&method(:define_delegator)) end # Create delegator to object
Use simpler enumerated method call
diff --git a/ohm-validations.gemspec b/ohm-validations.gemspec index abc1234..def5678 100644 --- a/ohm-validations.gemspec +++ b/ohm-validations.gemspec @@ -11,7 +11,7 @@ s.files = Dir["LICENSE", "README.md", "lib/**/*.rb"] s.test_files = Dir["test/**/*.rb"] - s.add_dependency "ohm", "~> 2.0" + s.add_dependency "ohm", ">= 2.0", "~> 3.0" s.add_dependency "scrivener", "~> 1.0" s.add_development_dependency "minitest", "~> 5.8" s.add_development_dependency "minitest-sugar", "~> 2.1"
Enable use with Ohm 3.x
diff --git a/lib/tairu/coordinate.rb b/lib/tairu/coordinate.rb index abc1234..def5678 100644 --- a/lib/tairu/coordinate.rb +++ b/lib/tairu/coordinate.rb @@ -7,5 +7,51 @@ @column = Integer(column) @zoom = Integer(zoom) end + + def x + @column + end + + def y + @row + end + + def z + @zoom + end + + def nw + to_lat_lng(@column, @row, @zoom) + end + + def ne + to_lat_lng(@column + 1, @row, @zoom) + end + + def se + to_lat_lng(@column + 1, @row + 1, @zoom) + end + + def sw + to_lat_lng(@column, @row + 1, @zoom) + end + + def bounds + ul = nw + lr = se + {x_min: ul[:lng], x_max: lr[:lng], y_min: lr[:lat], y_max: ul[:lat]} + end + + def center + to_lat_lng(@column + 0.5, @row + 0.5, @zoom) + end + + def to_lat_lng(x, y, z) + n = 2.0 ** z + lng = x / n * 360.0 - 180.0 + lat_rad = Math::atan(Math::sinh(Math::PI * (1 - 2 * y / n))) + lat = 180.0 * (lat_rad / Math::PI) + {lat: lat, lng: lng} + end end -end+end
Add bounds to Tile Coordinate