diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/commands/v2/put_link_set.rb b/app/commands/v2/put_link_set.rb index abc1234..def5678 100644 --- a/app/commands/v2/put_link_set.rb +++ b/app/commands/v2/put_link_set.rb @@ -6,10 +6,7 @@ link_set = LinkSet.create_or_replace(link_params.except(:links)) do |link_set| link_set.version += 1 - - link_set.links = link_set.links - .merge(link_params.fetch(:links)) - .reject {|_, links| links.empty? } + link_set.links = merge_links(link_set.links, link_params.fetch(:links)) end Success.new(links: link_set.links) @@ -35,6 +32,12 @@ def link_params payload end + + def merge_links(base_links, new_links) + base_links + .merge(new_links) + .reject {|_, links| links.empty? } + end end end end
Refactor link merging into a private method.
diff --git a/examples/view_profile_item.rb b/examples/view_profile_item.rb index abc1234..def5678 100644 --- a/examples/view_profile_item.rb +++ b/examples/view_profile_item.rb @@ -0,0 +1,32 @@+dir = File.dirname(__FILE__) + '/../lib' +$LOAD_PATH << dir unless $LOAD_PATH.include?(dir) + +#require 'rubygems' +require 'amee' +require 'optparse' + +# Command-line options - get username, password, and server +options = {} +OptionParser.new do |opts| + opts.on("-u", "--username USERNAME", "AMEE username") do |u| + options[:username] = u + end + opts.on("-p", "--password PASSWORD", "AMEE password") do |p| + options[:password] = p + end + opts.on("-s", "--server SERVER", "AMEE server") do |s| + options[:server] = s + end +end.parse! + +# Connect +connection = AMEE::Connection.new(options[:server], options[:username], options[:password]) + +# Create a new profile item +item = AMEE::Profile::Item.get(connection, ARGV[0]) +puts "loaded item #{item.name}" +item.values.each do |x| + puts " - #{x[:name]}: #{x[:value]}" +end +puts " - total per month: #{item.total_amount_per_month}" +
Add example for viewing profile items
diff --git a/activerecord/lib/active_record/identity_map.rb b/activerecord/lib/active_record/identity_map.rb index abc1234..def5678 100644 --- a/activerecord/lib/active_record/identity_map.rb +++ b/activerecord/lib/active_record/identity_map.rb @@ -11,19 +11,19 @@ repositories[current_repository_name] ||= Weakling::WeakHash.new end - def with_repository(name = :default, &block) + def with_repository(name = :default) old_repository = self.current_repository_name self.current_repository_name = name - block.call(current) + yield if block_given? ensure self.current_repository_name = old_repository end - def without(&block) + def without old, self.enabled = self.enabled, false - block.call + yield if block_given? ensure self.enabled = old end
Use yield instead block argument.
diff --git a/gem-compiler.gemspec b/gem-compiler.gemspec index abc1234..def5678 100644 --- a/gem-compiler.gemspec +++ b/gem-compiler.gemspec @@ -35,5 +35,7 @@ # development dependencies spec.add_development_dependency "rake", "~> 12.0", ">= 12.0.0" - spec.add_development_dependency "minitest", "~> 4.7" + + # minitest 5.14.2 is required to support Ruby 3.0 + spec.add_development_dependency "minitest", "~> 5.14", ">= 5.14.2" end
Update Minitest to support Ruby 3
diff --git a/app/helpers/versions_helper.rb b/app/helpers/versions_helper.rb index abc1234..def5678 100644 --- a/app/helpers/versions_helper.rb +++ b/app/helpers/versions_helper.rb @@ -11,9 +11,9 @@ "Mapping created" elsif version.changeset['http_status'] if version.changeset['http_status'][0] == '410' - "Archive → Redirect" + "Switched mapping to a Redirect" else - "Redirect → Archive" + "Switched mapping to an Archive" end elsif version.changeset.length == 1 first = version.changeset.first[0].titleize
Make mapping type switches more friendly
diff --git a/Swinject.podspec b/Swinject.podspec index abc1234..def5678 100644 --- a/Swinject.podspec +++ b/Swinject.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Swinject" - s.version = "1.0.0-beta.1" + s.version = "1.0.0-beta.2" s.summary = "Dependency injection framework for Swift" s.description = <<-DESC Swinject is a dependency injection framework for Swift, to manage the dependencies of types in your system.
Set the version number to 1.0.0-beta.2.
diff --git a/app/lib/test_pals_mock_ldap.rb b/app/lib/test_pals_mock_ldap.rb index abc1234..def5678 100644 --- a/app/lib/test_pals_mock_ldap.rb +++ b/app/lib/test_pals_mock_ldap.rb @@ -1,3 +1,15 @@+# This code mocks the LDAP services that provide authentication to Student Insights +# by implementing the `bind` method. It uses a dummy password defined in ENV +# instead of real passwords. + +# We will consume this mock service in three places: (1) the test suite, (2) the +# local development environment, (3) our demo site. + +# The advantage to mocking an LDAP service in this way is that developers +# will exercise the code in our custom LDAP Devise strategy constantly, +# instead of relying on a different auth mechanism locally and only exercising +# LDAP-related code in production. + class TestPalsMockLDAP def initialize(options)
Add code comments to test pals mock ldap
diff --git a/app/controllers/session_reminder_controller.rb b/app/controllers/session_reminder_controller.rb index abc1234..def5678 100644 --- a/app/controllers/session_reminder_controller.rb +++ b/app/controllers/session_reminder_controller.rb @@ -3,7 +3,14 @@ before_action :get_users def get_users - @users = get_admin_users + # @users = get_admin_users + # TODO - make this a value pulled in from the user + @user_events = UserEvent.where(event_id: 3) + # pull the users out of this + @users = [] + @user_events.each do |user| + @users.push user.user + end end def get_admin_users
Use all users registered for event 3 (SkalCon)
diff --git a/app/models/esa/associations/flags_extension.rb b/app/models/esa/associations/flags_extension.rb index abc1234..def5678 100644 --- a/app/models/esa/associations/flags_extension.rb +++ b/app/models/esa/associations/flags_extension.rb @@ -3,13 +3,13 @@ module FlagsExtension def most_recent(nature, time=Time.zone.now, exclude=nil) query = where(nature: nature). - where('time <= ?', time) + where('esa_flags.time <= ?', time) if exclude.present? query = query.where('esa_flags.id not in (?)', exclude) end - query.order('time DESC, created_at DESC').first + query.order('esa_flags.time DESC, esa_flags.created_at DESC').first end def is_set?(nature, time=Time.zone.now, exclude=nil)
Remove ambiguity from column names
diff --git a/lib/barcelona/network/bastion_server.rb b/lib/barcelona/network/bastion_server.rb index abc1234..def5678 100644 --- a/lib/barcelona/network/bastion_server.rb +++ b/lib/barcelona/network/bastion_server.rb @@ -7,7 +7,7 @@ def define_resource(json) super do |j| - j.InstanceType "t2.micro" + j.InstanceType "t2.nano" j.SourceDestCheck false j.ImageId "ami-29160d47" j.UserData user_data
Change bastion instance type to t2.nano
diff --git a/RxAlamofire.podspec b/RxAlamofire.podspec index abc1234..def5678 100644 --- a/RxAlamofire.podspec +++ b/RxAlamofire.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'RxAlamofire' - s.version = '0.3' + s.version = '0.3.1' s.license = 'MIT' s.summary = 'RxSwift wrapper around the elegant HTTP networking in Swift Alamofire' s.homepage = 'https://github.com/bontoJR/RxAlamofire' @@ -10,16 +10,21 @@ s.ios.deployment_target = '8.0' s.osx.deployment_target = '10.9' - s.source_files = 'RxAlamofire/Source/*.swift' - s.requires_arc = true - s.dependency "RxSwift", "~> 2.0.0-beta" - s.dependency "Alamofire", "~> 3.0" + s.default_subspec = "Core" - # s.subspec "Cocoa" do |ss| - # ss.source_files = "RxAlamofire/Source/Cocoa/*.swift" - # ss.dependency "RxCocoa", "~> 2.0.0-beta" - # end + s.subspec "Core" do |ss| + ss.source_files = "RxAlamofire/Source/*.swift" + ss.dependency "RxSwift", "~> 2.0.0-beta" + ss.dependency "Alamofire", "~> 3.0" + ss.framework = "Foundation" + end + + s.subspec "RxCocoa" do |ss| + ss.source_files = "RxAlamofire/Source/Cocoa/*.swift" + ss.dependency "RxCocoa", "~> 2.0.0-beta" + ss.dependency "RxAlamofire/Core" + end end
Update spec for 0.3.1 with core and RxCocoa subpod
diff --git a/fund_id_reference.rb b/fund_id_reference.rb index abc1234..def5678 100644 --- a/fund_id_reference.rb +++ b/fund_id_reference.rb @@ -0,0 +1,24 @@+# Generates Fund ID Reference page for the wiki at +# http://code.google.com/p/sgmf-uwa/wiki/FundIdReference + +require 'rubygems' +require 'open-uri' +require 'nokogiri' + +doc = Nokogiri::HTML(open('http://www.fundsupermart.com/main/home/index.svdo')) +funds = doc.css('select.fundselect option') + +output = "= Fund ID Reference =\n" +output << "_As of #{Time.now.strftime('%d %b %Y')}_\n\n" +output << "|| *Fund Name* || *Fund ID* ||\n" + +funds.drop(1).each do |fund| + output << '|| ' + output << fund.content + output << ' || ' + output << fund.attribute('value').value.gsub(/^.*=/, '') + output << " ||\n" +end + +puts output +
Add script to generate fund ID reference wiki.
diff --git a/lib/spec/runner/example_group_runner.rb b/lib/spec/runner/example_group_runner.rb index abc1234..def5678 100644 --- a/lib/spec/runner/example_group_runner.rb +++ b/lib/spec/runner/example_group_runner.rb @@ -10,6 +10,7 @@ # responsibility of the ExampleGroupRunner. Some implementations (like) # the one using DRb may choose *not* to load files, but instead tell # someone else to do it over the wire. + $KCODE = 'u' if RUBY_VERSION < '1.9' files.each do |file| load file end @@ -56,4 +57,4 @@ # TODO: BT - Deprecate BehaviourRunner? BehaviourRunner = ExampleGroupRunner end -end+end
Use UTF-8 while loading files to be compatible with rails default. [#643 state:resolved]
diff --git a/lib/tariff_synchronizer/file_service.rb b/lib/tariff_synchronizer/file_service.rb index abc1234..def5678 100644 --- a/lib/tariff_synchronizer/file_service.rb +++ b/lib/tariff_synchronizer/file_service.rb @@ -11,7 +11,7 @@ def write_file(path, body) data_file = File.new(path, "w") - data_file.write(body) + data_file.write(body.encode('UTF-8', invalid: :replace, undef: :replace)) data_file.close end
Fix tariff synchronizer and encoding issue.
diff --git a/app/models/service_type.rb b/app/models/service_type.rb index abc1234..def5678 100644 --- a/app/models/service_type.rb +++ b/app/models/service_type.rb @@ -1,4 +1,6 @@ class ServiceType < ActiveRecord::Base + has_many :services + def self.seed_somerville_service_types ServiceType.destroy_all ServiceType.create([
Add has_many :services to ServiceType
diff --git a/spec/lib/rubolite/admin_spec.rb b/spec/lib/rubolite/admin_spec.rb index abc1234..def5678 100644 --- a/spec/lib/rubolite/admin_spec.rb +++ b/spec/lib/rubolite/admin_spec.rb @@ -17,5 +17,9 @@ it "raises an error when the path given isn't a git repository" do expect { subject.path = "./spec/support" }.to raise_error(Rubolite::Admin::InvalidGitRepo) end + + it "does not raise an error when the path given is a valid git repository" do + expect { subject.path = "./spec/support/gitolite-admin" }.not_to raise_error(Rubolite::Admin::InvalidGitRepo) + end end end
Check inverse of bad repo spec.
diff --git a/spec/models/performance_spec.rb b/spec/models/performance_spec.rb index abc1234..def5678 100644 --- a/spec/models/performance_spec.rb +++ b/spec/models/performance_spec.rb @@ -19,7 +19,7 @@ @space.users.size.should == 1 - pending "bug #419" + #pending "bug #419" assert_no_difference @space.users.count.to_s do @admin_performance.destroy.should be_false end
Test Hudson with failing test
diff --git a/spec/mongoid/report/out_spec.rb b/spec/mongoid/report/out_spec.rb index abc1234..def5678 100644 --- a/spec/mongoid/report/out_spec.rb +++ b/spec/mongoid/report/out_spec.rb @@ -0,0 +1,46 @@+require 'spec_helper' + +describe Mongoid::Report do + let(:klass) { Model } + + it 'should merge properly results on splitted requests' do + Report = Class.new do + include Mongoid::Report + + report 'example' do + attach_to Model do + group_by :field1 + batches pool_size: 2 + column :field1, :field2 + end + end + end + + klass.create!(day: 0.days.ago, field1: 1, field2: 1) + klass.create!(day: 1.days.ago, field1: 1, field2: 1) + klass.create!(day: 1.days.ago, field1: 2, field2: 2) + klass.create!(day: 2.days.ago, field1: 3, field2: 3) + klass.create!(day: 3.days.ago, field1: 1, field2: 1) + klass.create!(day: 4.days.ago, field1: 1, field2: 1) + + report = Report.new + + scoped = report.aggregate_for('example-models') + scoped = scoped + .in_batches(day: (5.days.ago.to_date..0.days.from_now.to_date)) + .out('stored-report') + .all + + values = scoped.rows.map {|row| row['field2']} + expect(values).to have(3).items + + StoredReport = Class.new do + include Mongoid::Document + + store_in collection: 'stored-report' + end + + out = StoredReport.all + + end +end
Add test spec for testing custom method
diff --git a/app/routes/unsubscribes.rb b/app/routes/unsubscribes.rb index abc1234..def5678 100644 --- a/app/routes/unsubscribes.rb +++ b/app/routes/unsubscribes.rb @@ -12,7 +12,7 @@ post '/unsubscribes' do if FILTER_WORD_REGEXP === params['Body'] phone_number = Phoner::Phone.parse(params['From']).to_s - Subscription.where(phone_number: phone_number, unsubscribed_at: nil).update(unsubscribed_at: DateTime.now) + Subscription.active.where(phone_number: phone_number).update(unsubscribed_at: DateTime.now) end 200
Use dataset method for clarity
diff --git a/toolsmith.gemspec b/toolsmith.gemspec index abc1234..def5678 100644 --- a/toolsmith.gemspec +++ b/toolsmith.gemspec @@ -7,15 +7,15 @@ Gem::Specification.new do |s| s.name = "toolsmith" s.version = Toolsmith::VERSION - s.authors = ["Robert Ross"] - s.email = ["bobby@gophilosophie.com"] + s.authors = ["Robert Ross", "Brendan Loudermilk"] + s.email = ["bobby@gophilosophie.com", "brendan@gophilosophie.com"] s.homepage = "http://gophilosophie.com" s.summary = "A gem to craft UI's easily." s.description = "Toolsmith provides common helpers for UI components and styles." s.files = Dir["{app,config,db,lib}/**/*"] + ["Rakefile", "README.md", "CHANGELOG.md"] - s.add_dependency "rails", "~> 3.2.11" + s.add_dependency "rails", ">= 3.2.11", "< 4.1" s.add_dependency "compass-rails", "~> 1.0.3" s.add_dependency "bootstrap-sass", "~> 2.2.2.0"
Add Brendan Loudermilk as an author. Allow usage with Rails 4.
diff --git a/ibge.gemspec b/ibge.gemspec index abc1234..def5678 100644 --- a/ibge.gemspec +++ b/ibge.gemspec @@ -21,5 +21,5 @@ spec.add_dependency "spreadsheet", "~> 1.0" spec.add_development_dependency "rake", "~> 13.0" - spec.add_development_dependency "rspec", "= 3.11.0" + spec.add_development_dependency "rspec", "= 3.12.0" end
Update rspec requirement from = 3.11.0 to = 3.12.0 Updates the requirements on [rspec](https://github.com/rspec/rspec-metagem) to permit the latest version. - [Release notes](https://github.com/rspec/rspec-metagem/releases) - [Commits](https://github.com/rspec/rspec-metagem/compare/v3.11.0...v3.12.0) --- updated-dependencies: - dependency-name: rspec dependency-type: direct:development ... Signed-off-by: dependabot[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@github.com>
diff --git a/services/relocator/environment.rb b/services/relocator/environment.rb index abc1234..def5678 100644 --- a/services/relocator/environment.rb +++ b/services/relocator/environment.rb @@ -9,11 +9,13 @@ end #initialize def database_username + return "cartodb_user_#{user_id}" if environment == 'production' return "cartodb_staging_user_#{user_id}" if environment == 'staging' "#{environment}_cartodb_user_#{user_id}" end #database_username def user_database + return "cartodb_user_#{user_id}_db" if environment == 'production' return "cartodb_dev_user_#{user_id}_db" if environment == 'development' "cartodb_#{environment}_user_#{user_id}_db" end #user_database @@ -24,4 +26,3 @@ end # Environment end # Relocator end # CartoDB -
Fix pg db/user names in relocator prod env
diff --git a/Casks/widelands.rb b/Casks/widelands.rb index abc1234..def5678 100644 --- a/Casks/widelands.rb +++ b/Casks/widelands.rb @@ -1,7 +1,7 @@ class Widelands < Cask - url 'https://launchpad.net/widelands/build17/build-17/+download/widelands-build17-mac.dmg' + url 'https://launchpad.net/widelands/build18/build-18/+download/widelands-build18-mac.dmg' homepage 'https://wl.widelands.org/' - version 'Build 17' - sha256 '3812ae9f95697269a94970fc83c2c16ab962f450b5a114057046fde3bcfc5a2c' + version 'Build 18' + sha256 '1d209dcf653942788120c6f1abbe6f421fdefe6776f4feed48c58eddeb4c3722' link 'Widelands.app' end
Update Widelands to Build 18
diff --git a/lib/acknowledgements/resources.rb b/lib/acknowledgements/resources.rb index abc1234..def5678 100644 --- a/lib/acknowledgements/resources.rb +++ b/lib/acknowledgements/resources.rb @@ -19,13 +19,18 @@ # Now the app is built, but not codesigned yet. destination = File.join(config.app_bundle(platform), 'Settings.bundle/Acknowledgements.plist') - pods_path = 'vendor/Pods/Pods-acknowledgements.plist' + pods_alt_path = 'vendor/Pods/Target Support Files/Pods/Pods-acknowledgements.plist' if File.exist? pods_path info 'Copy', destination FileUtils.cp_r(pods_path, destination, :remove_destination => true) else - warn 'Could not find CocoaPods Acnkowledgement file.' + if File.exist? pods_alt_path + info 'Copy', destination + FileUtils.cp_r(pods_alt_path, destination, :remove_destination => true) + else + warn 'Could not find CocoaPods Acknowledgement file.' + end end end end
Check old & new location for Acknowledgement file Recent versions of CocoaPods put the acknowledgements.plist into vendor/Pods/Target Support Files/Pods/. Support looking for the file in the old and new location.
diff --git a/lib/api-umbrella-gatekeeper.rb b/lib/api-umbrella-gatekeeper.rb index abc1234..def5678 100644 --- a/lib/api-umbrella-gatekeeper.rb +++ b/lib/api-umbrella-gatekeeper.rb @@ -5,7 +5,9 @@ mattr_accessor :redis mattr_accessor :logger - self.logger = Logger.new(STDOUT) + + $stdout.sync = true + self.logger = Logger.new($stdout) end end
Disable buffering on stdout logger.
diff --git a/Formotion.gemspec b/Formotion.gemspec index abc1234..def5678 100644 --- a/Formotion.gemspec +++ b/Formotion.gemspec @@ -15,7 +15,7 @@ s.require_paths = ["lib"] s.license = 'MIT' - s.add_dependency "bubble-wrap", "~> 1.4.0" - s.add_dependency "motion-require", "~> 0.0.3" + s.add_dependency "bubble-wrap", ">= 1.4.0" + s.add_dependency "motion-require", "~> 0.1.0" s.add_development_dependency 'rake' -end+end
Make bubblewrap dep >= 1.4.0 and motion-require ~> 0.1.0
diff --git a/lib/bugsnag/tasks/bugsnag.rake b/lib/bugsnag/tasks/bugsnag.rake index abc1234..def5678 100644 --- a/lib/bugsnag/tasks/bugsnag.rake +++ b/lib/bugsnag/tasks/bugsnag.rake @@ -2,7 +2,7 @@ namespace :bugsnag do desc "Notify Bugsnag of a new deploy." - task :deploy do + task :deploy => :load do api_key = ENV["BUGSNAG_API_KEY"] release_stage = ENV["BUGSNAG_RELEASE_STAGE"] app_version = ENV["BUGSNAG_APP_VERSION"]
Load environment for deploy task This provides an alternative mechanism to the currently supported environment variables to set options such as API key, and also allows setting other options through the standard `config/bugsnag.yml` file that were not previously available, i.e. endpoint and proxy.
diff --git a/lib/desktop/simple_desktops.rb b/lib/desktop/simple_desktops.rb index abc1234..def5678 100644 --- a/lib/desktop/simple_desktops.rb +++ b/lib/desktop/simple_desktops.rb @@ -4,7 +4,7 @@ module Desktop class SimpleDesktops def latest_image_url - thumbnail.match(/http.*?png/).to_s + thumbnail.match(full_image_regex).to_s end def latest_image @@ -32,5 +32,10 @@ def thumbnail parser.css('.desktop a img').first['src'] end + + # http://rubular.com/r/UHYgmPJoQM + def full_image_regex + /http.*?png/ + end end end
Move full_image_regex to own method with link
diff --git a/lib/dino/components/rgb_led.rb b/lib/dino/components/rgb_led.rb index abc1234..def5678 100644 --- a/lib/dino/components/rgb_led.rb +++ b/lib/dino/components/rgb_led.rb @@ -16,15 +16,21 @@ end def blue + analog_write(Board::LOW, pins[:red]) + analog_write(Board::LOW, pins[:green]) + analog_write(Board::HIGH, pins[:blue]) + end + + def red analog_write(Board::HIGH, pins[:red]) - analog_write(Board::HIGH, pins[:green]) + analog_write(Board::LOW, pins[:green]) analog_write(Board::LOW, pins[:blue]) end - def red + def green analog_write(Board::LOW, pins[:red]) analog_write(Board::HIGH, pins[:green]) - analog_write(Board::HIGH, pins[:blue]) + analog_write(Board::LOW, pins[:blue]) end def blinky
Fix RGB LED component to turn on the right colors
diff --git a/lib/event_bus/broker/rabbit.rb b/lib/event_bus/broker/rabbit.rb index abc1234..def5678 100644 --- a/lib/event_bus/broker/rabbit.rb +++ b/lib/event_bus/broker/rabbit.rb @@ -22,7 +22,7 @@ private def channel - @channel ||= connection.create_channel + @@channel ||= connection.create_channel end def session
Define class variable instead instance variable for channel
diff --git a/lib/podio/models/item_field.rb b/lib/podio/models/item_field.rb index abc1234..def5678 100644 --- a/lib/podio/models/item_field.rb +++ b/lib/podio/models/item_field.rb @@ -10,6 +10,12 @@ alias_method :id, :field_id class << self + + # @see https://developers.podio.com/doc/items/get-item-field-values-22368 + def find_values(item_id, field_id) + Podio.connection.get("/item/#{item_id}/value/#{field_id}").body + end + # @see https://developers.podio.com/doc/items/update-item-field-values-22367 def update(item_id, field_id, values, options = {}) response = Podio.connection.put do |req|
Add method for getting field values
diff --git a/lib/pronto/rugged/diff/line.rb b/lib/pronto/rugged/diff/line.rb index abc1234..def5678 100644 --- a/lib/pronto/rugged/diff/line.rb +++ b/lib/pronto/rugged/diff/line.rb @@ -52,7 +52,9 @@ def blame @blame ||= Blame.new(repo, patch.delta.new_file[:path], - min_line: new_lineno, max_line: new_lineno)[0] + min_line: new_lineno, max_line: new_lineno, + track_copies_same_file: true, + track_copies_any_commit_copies: true)[0] end end end
Use additional tracking options for more accurate blaming
diff --git a/lib/cerberus/publisher/gmailer.rb b/lib/cerberus/publisher/gmailer.rb index abc1234..def5678 100644 --- a/lib/cerberus/publisher/gmailer.rb +++ b/lib/cerberus/publisher/gmailer.rb @@ -7,9 +7,9 @@ subject, body = Cerberus::Publisher::Base.formatted_message(state, manager, options) gopts = options[:publisher, :gmailer] - recipients = options[:publisher, :gmailer, :recipients] + recipients = gopts[:recipients] GMailer.connect(gopts) do |g| - success = g.send(:to => recipients, :subject => subject, :body => body) + success = g.send(:to => recipients, :subject => subject, :body => body, :from => gopts[:recipients]) raise 'Unable to send mail using Gmailer' unless success end
Use from option from configuration git-svn-id: 6b26ca77393dff49db3326cae3426b51e4e94954@166 65aa75ef-ce15-0410-bc34-cdc86d5f77e6
diff --git a/lib/couchrest/model/migrations.rb b/lib/couchrest/model/migrations.rb index abc1234..def5678 100644 --- a/lib/couchrest/model/migrations.rb +++ b/lib/couchrest/model/migrations.rb @@ -50,9 +50,10 @@ puts " created (#{document['version']})" elsif should_upgrade current, document + old_version = current['version'] current.update(document) current.save - puts " upgraded (#{current['version']} -> #{document['version']})" + puts " upgraded (#{old_version} -> #{document['version']})" else puts " up to date (#{current['version']})"
Print the correct old version of the design document being upgraded
diff --git a/isbm_adaptor.gemspec b/isbm_adaptor.gemspec index abc1234..def5678 100644 --- a/isbm_adaptor.gemspec +++ b/isbm_adaptor.gemspec @@ -14,10 +14,11 @@ s.add_development_dependency 'rake', '~> 10.1.0' s.add_development_dependency 'rspec', '~> 2.14.0' - s.add_development_dependency 'vcr', '~> 2.5.0' - s.add_development_dependency 'webmock', '~> 1.13.0' + s.add_development_dependency 'vcr', '~> 2.8.0' + s.add_development_dependency 'webmock', '~> 1.16.0' - s.add_runtime_dependency 'activesupport', '>= 3.0.0' - s.add_runtime_dependency 'builder', '>= 3.0.0' + s.add_runtime_dependency 'activesupport', '>= 1.0.0' + s.add_runtime_dependency 'builder', '>= 2.1.2' + s.add_runtime_dependency 'nokogiri', '>= 1.4.0' s.add_runtime_dependency 'savon', '>= 2.0.0' end
Update gem dependencies and versions Nokogiri is added since it is called directly ActiveSupport version is relaxed since called methods were introduced in 1.0.0 Builder and Nokogiri versions are relaxed to the minimum of what Savon requires
diff --git a/lib/rspec/contracts/mock_proxy.rb b/lib/rspec/contracts/mock_proxy.rb index abc1234..def5678 100644 --- a/lib/rspec/contracts/mock_proxy.rb +++ b/lib/rspec/contracts/mock_proxy.rb @@ -22,8 +22,16 @@ super(object, method_name, proxy) end + def set_arguments(arguments) + @message.arguments = arguments + end + + def add_response(response) + @message.response = response + end + def add_simple_stub(method_name, return_value) - @message.response = ReturnedResponse.new(return_value) + add_response ReturnedResponse.new(return_value) super end @@ -33,17 +41,13 @@ end class ContractMessageExpectation < Mocks::MessageExpectation - def contract_message - @method_double.message - end - def with(*args) - contract_message.arguments = args + @method_double.set_arguments args super end def and_return(*args) - contract_message.response = ReturnedResponse.new(args.first) + @method_double.add_response ReturnedResponse.new(args.first) super end end
Move more responsibility for building messages into MockProxy
diff --git a/lib/rubocopfmt/rubocop_version.rb b/lib/rubocopfmt/rubocop_version.rb index abc1234..def5678 100644 --- a/lib/rubocopfmt/rubocop_version.rb +++ b/lib/rubocopfmt/rubocop_version.rb @@ -10,6 +10,6 @@ '!= 0.44.0', # Restrict to latest version tested. - '< 0.48' + '< 0.53' ].freeze end
Bump max supported rubocop version from 0.51 to 0.52
diff --git a/lib/elasticsearch_relation.rb b/lib/elasticsearch_relation.rb index abc1234..def5678 100644 --- a/lib/elasticsearch_relation.rb +++ b/lib/elasticsearch_relation.rb @@ -1,7 +1,7 @@ # This class tries to reproduce an ActiveRecord relation class ElasticsearchRelation def initialize(params = {}) - @params = params.merge({ size: 10000 }) + @params = { size: 10000 }.merge(params) end def offset(x)
Fix ES search results size to 10000, fix defaults
diff --git a/lib/faker/default/business.rb b/lib/faker/default/business.rb index abc1234..def5678 100644 --- a/lib/faker/default/business.rb +++ b/lib/faker/default/business.rb @@ -26,7 +26,7 @@ # @return [Date] # # @example - # Faker::Business.credit_card_number #=> <Date: 2015-11-11 ((2457338j,0s,0n),+0s,2299161j)> + # Faker::Business.credit_card_expiry_date #=> <Date: 2015-11-11 ((2457338j,0s,0n),+0s,2299161j)> # # @faker.version 1.2.0 def credit_card_expiry_date
Fix a typo for `Faker::Business.credit_card_expiry_date`
diff --git a/lib/lyricfy/lyric_provider.rb b/lib/lyricfy/lyric_provider.rb index abc1234..def5678 100644 --- a/lib/lyricfy/lyric_provider.rb +++ b/lib/lyricfy/lyric_provider.rb @@ -5,5 +5,13 @@ def initialize(parameters = {}) self.parameters = parameters end + + def search + begin + data = open(self.url) + rescue OpenURI::HTTPError + nil + end + end end end
Add base search method to handles HTTP exceptions
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -15,6 +15,8 @@ config.cache_max_age = ENV['CACHE_MAX_AGE'] || 10.seconds config.middleware.use Rack::BounceFavicon + require 'bounce_browserconfig' + config.middleware.use BounceBrowserconfig config.mount_javascript_test_routes = false end
Use middleware to 404 requests to `/browserconfig.xml`
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -10,6 +10,8 @@ # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(:default, Rails.env) +Bundler.require(*Rails.groups(assets: %w(development test))) + module SpecialistFrontend class Application < Rails::Application
Use asset group in development
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -23,5 +23,8 @@ # Autoload lib/ config.autoload_paths += Dir["#{config.root}/lib", "#{config.root}/lib/**/"] + + # Compile the correct assets + config.assets.precompile += ['master.css'] end end
Add master.css to compiled assets
diff --git a/WNGLogger.podspec b/WNGLogger.podspec index abc1234..def5678 100644 --- a/WNGLogger.podspec +++ b/WNGLogger.podspec @@ -0,0 +1,26 @@+Pod::Spec.new do |s| + + s.name = "WNGLogger" + s.version = "0.1.0" + s.summary = "WNGLogger is an iOS client library to record and log metric data to Weblog-NG." + + s.description = <<-DESC + WNGLogger is an iOS client library to record and log metric data via the + HTTP api of Weblog-NG. + DESC + + s.homepage = "https://bitbucket.org/beardedrobotllc/weblog-ng-client-ios" + + s.license = { :type => 'Apache 2.0', :file => 'LICENSE.txt' } + + s.authors = { "Stephen Kuenzli" => "skuenzli@qualimente.com" } + + s.platform = :ios, '7.0' + + s.source = { :git => "ssh://git@bitbucket.org/beardedrobotllc/weblog-ng-client-ios.git", :tag => "0.1.0" } + + s.source_files = 'logger/*.{h,m}' + + s.dependency "AFNetworking", "2.0.3" + +end
Create a CocoaPod spec for Weblog-NG. Specifies Weblog-NG version 0.1.0.
diff --git a/publify_textfilter_code.gemspec b/publify_textfilter_code.gemspec index abc1234..def5678 100644 --- a/publify_textfilter_code.gemspec +++ b/publify_textfilter_code.gemspec @@ -16,8 +16,8 @@ s.files = Dir['{app,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.rdoc'] - s.add_dependency 'rails', '~> 4.2.7' - s.add_dependency 'publify_core', '~> 9.0.0.pre1' + s.add_dependency 'rails', '~> 5.0.0' + s.add_dependency 'publify_core', '~> 9.0.0.pre3' s.add_dependency 'coderay', '~> 1.1.0' s.add_dependency 'htmlentities', '~> 4.3'
Update dependencies for Rails 5
diff --git a/db/schema.rb b/db/schema.rb index abc1234..def5678 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -17,9 +17,10 @@ enable_extension "plpgsql" create_table "skills", force: :cascade do |t| - t.string "title" + t.string "title", null: false t.integer "current_streak", default: 1 t.integer "longest_streak", default: 1 + t.integer "refreshed_at" t.integer "user_id" t.datetime "created_at" t.datetime "updated_at"
Add db constraints for title on skill table
diff --git a/spec/classes/mysql_backup_spec.rb b/spec/classes/mysql_backup_spec.rb index abc1234..def5678 100644 --- a/spec/classes/mysql_backup_spec.rb +++ b/spec/classes/mysql_backup_spec.rb @@ -2,32 +2,57 @@ describe 'mysql::backup' do - let(:params) { + let(:default_params) { { 'backupuser' => 'testuser', 'backuppassword' => 'testpass', 'backupdir' => '/tmp', } } + context "standard conditions" do + let(:params) { default_params } - it { should contain_database_user('testuser@localhost')} + it { should contain_database_user('testuser@localhost')} - it { should contain_database_grant('testuser@localhost').with( - :privileges => [ 'Select_priv', 'Reload_priv', 'Lock_tables_priv', 'Show_view_priv' ] - )} + it { should contain_database_grant('testuser@localhost').with( + :privileges => [ 'Select_priv', 'Reload_priv', 'Lock_tables_priv', 'Show_view_priv' ] + )} - it { should contain_cron('mysql-backup').with( - :command => '/usr/local/sbin/mysqlbackup.sh', - :ensure => 'present' - )} + it { should contain_cron('mysql-backup').with( + :command => '/usr/local/sbin/mysqlbackup.sh', + :ensure => 'present' + )} - it { should contain_file('mysqlbackup.sh').with( - :path => '/usr/local/sbin/mysqlbackup.sh', - :ensure => 'present' - )} + it { should contain_file('mysqlbackup.sh').with( + :path => '/usr/local/sbin/mysqlbackup.sh', + :ensure => 'present' + ) } - it { should contain_file('mysqlbackupdir').with( - :path => '/tmp', - :ensure => 'directory' - )} + it { should contain_file('mysqlbackupdir').with( + :path => '/tmp', + :ensure => 'directory' + )} + it 'should have compression by default' do + verify_contents(subject, 'mysqlbackup.sh', [ + ' --all-databases | bzcat -zc > ${DIR}/mysql_backup_`date +%Y%m%d-%H%M%S`.sql.bz2', + ]) + end + end + + context "with compression disabled" do + let(:params) do + { :backupcompress => false }.merge(default_params) + end + + it { should contain_file('mysqlbackup.sh').with( + :path => '/usr/local/sbin/mysqlbackup.sh', + :ensure => 'present' + ) } + + it 'should be able to disable compression' do + verify_contents(subject, 'mysqlbackup.sh', [ + ' --all-databases > ${DIR}/mysql_backup_`date +%Y%m%d-%H%M%S`.sql', + ]) + end + end end
Add spec tests for backup compression enabled/disabled
diff --git a/lib/guide.rb b/lib/guide.rb index abc1234..def5678 100644 --- a/lib/guide.rb +++ b/lib/guide.rb @@ -4,7 +4,7 @@ def initialize(path = nil) # locate the restaurant text file at path Restaurant.filepath = path - if Restaurant.file_exists? + if Restaurant.file_usable? puts "Found restaurant file." # or create a new file elsif Restaurant.create_file
Update to use new method from Restaurant class
diff --git a/config/initializers/settings.rb b/config/initializers/settings.rb index abc1234..def5678 100644 --- a/config/initializers/settings.rb +++ b/config/initializers/settings.rb @@ -1,3 +1,6 @@+# A Struct for conveniently storing individual shelves for the shelves setting. +Shelf = Struct.new(:begin, :end) + Alexandria::Application.configure do # This file contains configuration options for the Alexandria library itself. # Be sure to restart your server when you modify this file.
Set up a Struct for storing shelf information
diff --git a/config/initializers/zangetsu.rb b/config/initializers/zangetsu.rb index abc1234..def5678 100644 --- a/config/initializers/zangetsu.rb +++ b/config/initializers/zangetsu.rb @@ -17,17 +17,36 @@ g.scaffold_controller = 'scaffold_controller' end -require "devise_controller" +module Zangetsu + module Devise + module PermittedParameters + # extends ................................................................ -class DeviseController - before_filter :configure_permitted_parameters - hide_action :configure_permitted_parameters + extend ActiveSupport::Concern - protected + # includes ............................................................... + # constants .............................................................. + # additional config ...................................................... - def configure_permitted_parameters - devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:username, :email, :password, :password_confirmation, :remember_me) } - devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:login, :username, :email, :password, :remember_me) } - devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:username, :email, :password, :password_confirmation, :current_password) } + included do + before_filter :configure_permitted_parameters + end + + # class methods .......................................................... + # helper methods ......................................................... + # protected instance methods ............................................. + + protected + + def configure_permitted_parameters + devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:username, :email, :password, :password_confirmation, :remember_me) } + devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:login, :username, :email, :password, :remember_me) } + devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:username, :email, :password, :password_confirmation, :current_password) } + end + + # private instance methods ............................................... + end end end + +DeviseController.send :include, Zangetsu::Devise::PermittedParameters
Use a mixin/concern for configuring parameters for DeviseController
diff --git a/spec/xml/schema_generator_spec.rb b/spec/xml/schema_generator_spec.rb index abc1234..def5678 100644 --- a/spec/xml/schema_generator_spec.rb +++ b/spec/xml/schema_generator_spec.rb @@ -10,23 +10,31 @@ fields: - name: author_first_name xpath: "/book/author/firstName" + type: string - name: author_last_name xpath: "/book/author/lastName" + type: string - name: publisher_name xpath: "/book/publisher/name" + type: string - name: published_at xpath: "/book/publishedAt" + type: string - name: for_sale xpath: "/book/forSale" + type: string - name: rating xpath: "/book/rating" + type: string - name: pages xpath: "/book/pages" + type: string - node: chapters xpath: "/book/chapters/chapter" children: - name: chapters_title xpath: "./title" + type: string EXPECTED end end
Fix spec for recent change
diff --git a/lib/ffaker/utils/array_utils.rb b/lib/ffaker/utils/array_utils.rb index abc1234..def5678 100644 --- a/lib/ffaker/utils/array_utils.rb +++ b/lib/ffaker/utils/array_utils.rb @@ -9,6 +9,11 @@ def self.random_pick(array, n) indexes = (0...array.length).sort_by{Kernel.rand}[0...n] indexes.map { |n| array[n].dup } + end + + def self.rand(array) + warn '[ArrayUtils.rand] is deprecated. Please use the Array#sample method' + array.sample end def self.freeze_all(array) @@ -25,6 +30,11 @@ ArrayUtils.random_pick(self, n) end + def rand + warn '[ArrayUtils#rand] is deprecated. Please use the Array#sample method' + sample + end + def freeze_all ArrayUtils.freeze_all(self) end
Revert rand methods with deprecate warning
diff --git a/lib/refinery/redactor/engine.rb b/lib/refinery/redactor/engine.rb index abc1234..def5678 100644 --- a/lib/refinery/redactor/engine.rb +++ b/lib/refinery/redactor/engine.rb @@ -10,6 +10,7 @@ config.to_prepare do Rails.application.config.assets.precompile += %w( refinery-redactor/index.css + refinery-redactor/plugins.css refinery-redactor/plugins.js refinery-redactor/index.js ) @@ -29,11 +30,11 @@ end after_inclusion do - %w(refinery-redactor/index).each do |stylesheet| + %w(refinery-redactor/plugins refinery-redactor/index).each do |stylesheet| Refinery::Core.config.register_visual_editor_stylesheet stylesheet end - %W(refinery-redactor/index refinery-redactor/plugins).each do |javascript| + %W(refinery-redactor/plugins refinery-redactor/index).each do |javascript| Refinery::Core.config.register_visual_editor_javascript javascript end end
Load all plugins by default
diff --git a/lib/rspec/rake/example_group.rb b/lib/rspec/rake/example_group.rb index abc1234..def5678 100644 --- a/lib/rspec/rake/example_group.rb +++ b/lib/rspec/rake/example_group.rb @@ -8,7 +8,7 @@ base.instance_eval do metadata[:type] = :task - metadata[:tasks_path] ||= File.join('..', 'lib', 'tasks') + metadata[:tasks_path] ||= File.join('lib', 'tasks') metadata[:rakefile] ||= nil subject(:task) { Rake.application[self.class.top_level_description] } @@ -18,7 +18,7 @@ task_name = self.class.top_level_description rakefile = metadata[:rakefile] || task_name.split(':').first - task_path = File.join(metadata[:tasks_path], rakefile) + task_path = File.join('..', metadata[:tasks_path], rakefile) Rake.application = Rake::Application.new # We are sending an empty list of loaded files
Allow 'tasks_path' context parameter to specify subdirectories
diff --git a/test/test_action_add_node.rb b/test/test_action_add_node.rb index abc1234..def5678 100644 --- a/test/test_action_add_node.rb +++ b/test/test_action_add_node.rb @@ -8,7 +8,8 @@ should "properly create a new node entry when called" do require 'yaml' - %x(#{RUTTY_BIN} add_node -c #{TEST_CONF_DIR} example.com -k /home/user/.ssh/id_rsa -u root -p 22333 --tags example,testing) + output = %x(#{RUTTY_BIN} add_node -c #{TEST_CONF_DIR} example.com -k /home/user/.ssh/id_rsa -u root -p 22333 --tags example,testing) + assert_match /Added example\.com/, output nodes = YAML.load(File.open(TEST_NODES_CONF).read)
Add assert to 'rutty add_node' tests to check for command output
diff --git a/test/test_api_postcode_nl.rb b/test/test_api_postcode_nl.rb index abc1234..def5678 100644 --- a/test/test_api_postcode_nl.rb +++ b/test/test_api_postcode_nl.rb @@ -1,8 +1,16 @@ require 'helper' class TestApiPostcodeNl < Test::Unit::TestCase + class DummyFetcher + def fetch(*_) + OpenStruct.new(body: '{}') + end + end + context 'API.address' do setup do + ApiPostcodeNl::API.fetcher = DummyFetcher.new + ApiPostcodeNl::API.key = 'some-api-key' ApiPostcodeNl::API.secret = 'super-secret' end
Make tests not access the live API
diff --git a/config/environment.rb b/config/environment.rb index abc1234..def5678 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,5 +1,9 @@ # Load the Rails application. require File.expand_path('../application', __FILE__) +Paperclip.options[:content_type_mappings] = { + :cfg => "application/octet-stream" +} + # Initialize the Rails application. Smaran::Application.initialize!
Allow .cfg file types to be uplodated as application/octet-stream mime type
diff --git a/config/initializers/flipper.rb b/config/initializers/flipper.rb index abc1234..def5678 100644 --- a/config/initializers/flipper.rb +++ b/config/initializers/flipper.rb @@ -6,6 +6,14 @@ Flipper.new(Flipper::Adapters::ActiveRecord.new) end end + +if Rails.env.production? + Flipper::UI.configure do |config| + config.banner_text = '⚠️ Production environment: be aware that the changes have an impact on the application. Please, read the how-to before: https://github.com/openfoodfoundation/openfoodnetwork/wiki/Feature-toggle-with-Flipper' + config.banner_class = 'danger' + end +end + Rails.configuration.middleware.use Flipper::Middleware::Memoizer, preload_all: true Flipper.register(:admins) { |actor| actor.respond_to?(:admin?) && actor.admin? }
Add banner to Flipper UI to warn the admin users Add a link (escaped...) to the wiki page Co-authored-by: Pau Pérez Fabregat <c22b1f60e5873e20e0d9728f2418c5f1ac919f72@gmail.com>
diff --git a/human_digest.gemspec b/human_digest.gemspec index abc1234..def5678 100644 --- a/human_digest.gemspec +++ b/human_digest.gemspec @@ -5,7 +5,6 @@ Gem::Specification.new do |s| s.name = 'human_digest' s.version = HumanDigest::VERSION - s.date = '2012-05-11' s.summary = "HumanDigest" s.description = "Human-readable digests" s.authors = ["Matt Vanderpol"]
Remove date to prevent future stale date releases.
diff --git a/spec/geometry/comparison_spec.rb b/spec/geometry/comparison_spec.rb index abc1234..def5678 100644 --- a/spec/geometry/comparison_spec.rb +++ b/spec/geometry/comparison_spec.rb @@ -21,7 +21,13 @@ it 'should return true when both the abscissas and ordinates are same point(Reflexive property)'do point1 = Geometry::Comparison.new(1, 1) - expect(point1 == point1).to eq(true) + expect(point1 == point1).to eq(true) + end + + it 'it return true for symmetric property for given two points 'do + point1 = Geometry::Comparison.new(1, 1) + point2 = Geometry::Comparison.new(1, 1) + expect(point1 == point2 && point2 == point1).to eq(true) end end end
Add Test spec for symmetric property for give two points
diff --git a/spec/models/generic_work_spec.rb b/spec/models/generic_work_spec.rb index abc1234..def5678 100644 --- a/spec/models/generic_work_spec.rb +++ b/spec/models/generic_work_spec.rb @@ -14,4 +14,11 @@ expect(subject.generic_files.first).to be_kind_of Worthwhile::GenericFile end end + + describe "to_solr" do + subject { FactoryGirl.build(:work, date_uploaded: Date.today).to_solr } + it "indexes some fields" do + expect(subject.keys).to include 'desc_metadata__date_uploaded_dtsi' + end + end end
Test for to_solr on generic_work
diff --git a/spec/react/refs_callback_spec.rb b/spec/react/refs_callback_spec.rb index abc1234..def5678 100644 --- a/spec/react/refs_callback_spec.rb +++ b/spec/react/refs_callback_spec.rb @@ -20,7 +20,9 @@ end Foo.class_eval do - attr_accessor :my_bar + def my_bar=(bar) + $bar = bar + end def render React.create_element(Bar, ref: method(:my_bar=).to_proc) @@ -28,13 +30,16 @@ end element = React.create_element(Foo) - instance = React::Test::Utils.render_into_document(element) - expect(instance.my_bar).to be_a(Bar) + React::Test::Utils.render_into_document(element) + expect($bar).to be_a(Bar) + $bar = nil end it "is invoked with the actual DOM node" do Foo.class_eval do - attr_accessor :my_div + def my_div=(div) + $div = div + end def render React.create_element('div', ref: method(:my_div=).to_proc) @@ -42,8 +47,9 @@ end element = React.create_element(Foo) - instance = React::Test::Utils.render_into_document(element) - expect(`#{instance.my_div}.nodeType`).to eq(1) + React::Test::Utils.render_into_document(element) + expect(`#{$div}.nodeType`).to eq(1) + $div = nil end end
Fix test for opal 0.8
diff --git a/workflows.gemspec b/workflows.gemspec index abc1234..def5678 100644 --- a/workflows.gemspec +++ b/workflows.gemspec @@ -17,7 +17,5 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_development_dependency "bundler", "~> 1.7" - spec.add_development_dependency "rake", "~> 10.0" spec.add_development_dependency "rspec", "~> 3.2.0" end
Remove explicit dependencies on bundler/rake
diff --git a/PusherSwift.podspec b/PusherSwift.podspec index abc1234..def5678 100644 --- a/PusherSwift.podspec +++ b/PusherSwift.podspec @@ -12,6 +12,6 @@ s.source_files = 'Source/*.swift' s.ios.deployment_target = '8.0' - s.osx.deployment_target = '10.9' + s.osx.deployment_target = '10.10' s.tvos.deployment_target = '9.0' end
Update osx deployment target to 10.10 in podspec
diff --git a/arm-eabi-gdb78.rb b/arm-eabi-gdb78.rb index abc1234..def5678 100644 --- a/arm-eabi-gdb78.rb +++ b/arm-eabi-gdb78.rb @@ -0,0 +1,22 @@+require 'formula' + +class ArmEabiGdb78 <Formula + url 'http://ftp.gnu.org/gnu/gdb/gdb-7.8.tar.xz' + homepage 'http://www.gnu.org/software/gdb/' + sha1 'fc43f1f2e651df1c69e7707130fd6864c2d7a428' + + depends_on 'gmp' + depends_on 'mpfr' + depends_on 'libmpc' + + def install + system "./configure", "--prefix=#{prefix}", "--target=arm-eabi", + "--with-gmp=#{Formula.factory('gmp').prefix}", + "--with-mpfr=#{Formula.factory('mpfr').prefix}", + "--with-mpc=#{Formula.factory('libmpc').prefix}", + "--without-cloog", + "--enable-lto","--disable-werror" + system "make" + system "make install" + end +end
Add GDB 7.8 for ARM EABI
diff --git a/test/test_helper.rb b/test/test_helper.rb index abc1234..def5678 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -4,6 +4,8 @@ require 'tmpdir' class Test::Unit::TestCase + DTD_PATH = File.dirname(__FILE__) + '/examples/' + alias_method :old_setup, :setup def setup @ead = EADCodec::Document.new("1", "Teste") @@ -22,24 +24,30 @@ @ead = EADCodec::Document.from_file filepath end - def validate_well_formed - assert(system("rxp", "-xs", filepath)) + def xmllint_installed + assert(system("xmllint --version > /dev/null 2>&1"), + "xmllint utility not installed"+ + "(on ubuntu/debian install package libxml2-utils)") end + def validate_well_formed + xmllint_installed + assert(system("xmllint #{filepath} >/dev/null"), + "Validation failed for #{filepath}") + end + def validate_dtd - assert(system("rxp", "-VVs", filepath)) - #assert(system("xmlstarlet", "val", "-d", "ead.dtd", @test_file)) + xmllint_installed + assert(system("xmllint --nonet --loaddtd --path #{DTD_PATH}"+ + " #{filepath} > /dev/null"), + "Validation failed for #{filepath}") end def compare_xpath(value, path) - assert_equal(value, select(path)) - end + assert_equal(value.strip, XMLUtils::select_path(path, filepath).strip) + end def element_exists(xpath, *args) assert(XMLUtils::element_exists(xpath, filepath), *args) end - - def select(xpath) - XMLUtils::select_path(xpath, filepath) - end end
Move to xmllint and fix whitespace problems in comparisons
diff --git a/translate.rb b/translate.rb index abc1234..def5678 100644 --- a/translate.rb +++ b/translate.rb @@ -14,7 +14,7 @@ match /t(?:r(?:anslate)?)? ([a-zA-Z-]{2,5}) ([a-zA-Z-]{2,5}) (.*)/u def execute(m, from, to, message) - url = "https://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=" + url = "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=" url += "#{CGI.escape(message)}&langpair=#{CGI.escape(from)}%7c#{CGI.escape(to)}" begin
Switch from https to http
diff --git a/github-pages.gemspec b/github-pages.gemspec index abc1234..def5678 100644 --- a/github-pages.gemspec +++ b/github-pages.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.rubygems_version = "1.8.0" - s.required_ruby_version = "~> 2.0.0" + s.required_ruby_version = ">= 1.9.3" s.name = "github-pages" s.version = "3"
Drop the Ruby 2.0 requirement in the Gemspec. This brings back support for running this gem on Ruby 1.9. The gem works fine on both 1.9 and 2.0. Unfortunatly with the ~> constraint operator it is not possible to specify both ~> 1.9.3 and ~> 2.0, so the >= 1.9.3 constraint is used instead.
diff --git a/kit/rails/_deploy.rb b/kit/rails/_deploy.rb index abc1234..def5678 100644 --- a/kit/rails/_deploy.rb +++ b/kit/rails/_deploy.rb @@ -46,13 +46,12 @@ ts_restart cron_restart + app_release_info app_server_restart nginx_restart release_cleanup letsencript_info - sidekiq_restart - app_release_info end end
Change an order of commands
diff --git a/app/routes/posts.rb b/app/routes/posts.rb index abc1234..def5678 100644 --- a/app/routes/posts.rb +++ b/app/routes/posts.rb @@ -43,11 +43,19 @@ request.host_with_port end - @host_string = if request.secure? - 'https://' + @host_string - else - 'http://' + @host_string - end + if request.referer == "" + @host_string = if request.secure? + 'https://' + @host_string + else + 'http://' + @host_string + end + else + @host_string = if request.referrer =~ /^https.*/ + 'https://' + @host_string + else + 'http://' + @host_string + end + end @pagetype = :uploaded return erb :base
Change link generation logic in uploaded view
diff --git a/lib/utils.rb b/lib/utils.rb index abc1234..def5678 100644 --- a/lib/utils.rb +++ b/lib/utils.rb @@ -1,7 +1,7 @@ module FunkyWorldCup def self.finalized? match = last_match - !match.result.nil? && match.result.status == 'final' + match && !match.result.nil? && match.result.status == 'final' end def self.total_points
Add safety check for match
diff --git a/spec/unit/dialect/test_tags.rb b/spec/unit/dialect/test_tags.rb index abc1234..def5678 100644 --- a/spec/unit/dialect/test_tags.rb +++ b/spec/unit/dialect/test_tags.rb @@ -0,0 +1,32 @@+require 'spec_helper' +module WLang + describe Dialect::Tags do + + describe 'tag' do + include Dialect::Tags::ClassMethods + + def define_tag_method(*args) + args + end + + it "works with a symbol" do + tag("$", :dollar).should eq(["$", nil, :dollar]) + end + + it "works with a single proc" do + proc = lambda{|buf,fn| } + tag("$", &proc).should eq(["$", nil, proc]) + end + + it "allows specifying dialects with a symbol" do + tag("$", [Foo], :dollar).should eq(["$", [Foo], :dollar]) + end + + it "allows specifying dialects with a proc" do + proc = lambda{|buf,fn| } + tag("$", [Foo], &proc).should eq(["$", [Foo], proc]) + end + end + + end # describe Dialect +end # module WLang
Add missing test about previous feature
diff --git a/lib/danica/format.rb b/lib/danica/format.rb index abc1234..def5678 100644 --- a/lib/danica/format.rb +++ b/lib/danica/format.rb @@ -10,11 +10,10 @@ content.to(format) end - def +(other) - self.class.new(content + other, format) - end - - def *(other) - self.class.new(content * other, format) + def method_missing(method, *args) + self.class.new( + content.public_send(method, *args), + format + ) end end
Use method missing for operators
diff --git a/guard-jammit.gemspec b/guard-jammit.gemspec index abc1234..def5678 100644 --- a/guard-jammit.gemspec +++ b/guard-jammit.gemspec @@ -23,6 +23,7 @@ s.add_development_dependency 'yard' s.add_development_dependency 'redcarpet' s.add_development_dependency 'pry' + s.add_development_dependency 'rake' s.files = Dir.glob('{lib}/**/*') + %w[LICENSE README.md] s.require_path = 'lib'
Add rake to dev deps.
diff --git a/init.rb b/init.rb index abc1234..def5678 100644 --- a/init.rb +++ b/init.rb @@ -1,4 +1,4 @@-require 'ardes/inherit_views' +#require 'ardes/inherit_views' -ActionController::Base.send :extend, Ardes::InheritViews::ActionController -ActionView::Base.send :include, Ardes::InheritViews::ActionView+#ActionController::Base.send :extend, Ardes::InheritViews::ActionController +#ActionView::Base.send :include, Ardes::InheritViews::ActionView
Disable inherit_views in experimental rails 2.3 branch [temporarily]
diff --git a/lib/itunes_parser.rb b/lib/itunes_parser.rb index abc1234..def5678 100644 --- a/lib/itunes_parser.rb +++ b/lib/itunes_parser.rb @@ -5,24 +5,26 @@ @lib = ItunesParser::Library.new - # @result is a hash - @result = @lib.parse(File.read(File.dirname(__FILE__) + './test/test_library.xml')) - puts @result.inspect + # @parsed_lib is a hash + @parsed_lib = @lib.parse(File.read(File.dirname(__FILE__) + './test/test_library.xml')) + puts @parsed_lib.inspect - puts @result['first_song'].inspect + puts @parsed_lib['first_song'].inspect - puts "library version #{@result['version']}" + puts "library version #{@parsed_lib['version']}" - puts "first song's name #{@result['first_song']['name']}" - puts "first song's artist #{@result['first_song']['artist']}" - puts "first song's year #{@result['first_song']['year']}" - puts "first song's kind #{@result['first_song']['kind']}" - puts "first song's size #{@result['first_song']['size']} bytes" + puts "first song's name #{@parsed_lib['first_song']['name']}" + puts "first song's artist #{@parsed_lib['first_song']['artist']}" + puts "first song's year #{@parsed_lib['first_song']['year']}" + puts "first song's kind #{@parsed_lib['first_song']['kind']}" + puts "first song's size #{@parsed_lib['first_song']['size']} bytes" # note these tags don't have underscore inserted - puts "first song's sample rate #{@result['first_song']['sample rate']} Hz" - puts "first song's total time #{@result['first_song']['total time']} millisec" + puts "first song's sample rate #{@parsed_lib['first_song']['sample rate']} Hz" + puts "first song's total time #{@parsed_lib['first_song']['total time']} millisec" - puts "number of songs #{@result['songs'].count}" + puts "number of songs #{@parsed_lib['songs'].count}" + + end
Refactor rename @result to @parsed_lib.
diff --git a/lib/simpre/helper.rb b/lib/simpre/helper.rb index abc1234..def5678 100644 --- a/lib/simpre/helper.rb +++ b/lib/simpre/helper.rb @@ -15,6 +15,9 @@ private def current_view_context + # if calling `decorate` from another presenter return the existing + # view_context + return h if is_a?(Presenter) is_a?(ApplicationController) ? view_context : self end end
Support calling `decorate` from another presenter
diff --git a/vec3.rb b/vec3.rb index abc1234..def5678 100644 --- a/vec3.rb +++ b/vec3.rb @@ -54,7 +54,7 @@ return self.+(-rhs) end - def ==(rhs) + def <=>(rhs) dx = @x - rhs.x if dx != 0 then return dx end dy = @y - rhs.y
Use correct operator in definition Define the spaceship operator, not comparison/equality
diff --git a/transitions.gemspec b/transitions.gemspec index abc1234..def5678 100644 --- a/transitions.gemspec +++ b/transitions.gemspec @@ -5,7 +5,7 @@ s.name = "transitions" s.version = Transitions::VERSION s.platform = Gem::Platform::RUBY - s.authors = ["Jakub Kuźma", "Timo Rößner"] + s.authors = ["Jakub Kuzma", "Timo Roessner"] s.email = "timo.roessner@googlemail.com" s.homepage = "http://github.com/troessner/transitions" s.summary = "State machine extracted from ActiveModel"
Remove utf8 to see if that will fix bundle issue
diff --git a/lib/affirm/client.rb b/lib/affirm/client.rb index abc1234..def5678 100644 --- a/lib/affirm/client.rb +++ b/lib/affirm/client.rb @@ -6,7 +6,7 @@ private :url_prefix class << self - def request(method, path, **data) + def request(method, path, data={}) new.public_send(method, path, data) end end @@ -21,11 +21,11 @@ end end - def get(path, **data) + def get(path, data={}) connection.get(normalized_path(path), data) end - def post(path, **data) + def post(path, data={}) connection.post(normalized_path(path), data) end
Fix error on Ruby 3 In Ruby 3, the double splat operator behavior has changed This causes a "too many arguments" error. Specifying an optional array instead
diff --git a/lib/jekyll/assets.rb b/lib/jekyll/assets.rb index abc1234..def5678 100644 --- a/lib/jekyll/assets.rb +++ b/lib/jekyll/assets.rb @@ -19,6 +19,6 @@ require_relative "assets/env" Jekyll::Hooks.register(:site, :post_read) { |o| Jekyll::Assets::Env.new(o) } -Jekyll::Hooks.register :site, :post_write do |o| +Jekyll::Hooks.register :site, :post_render do |o| o&.sprockets&.write_all end
Move to `post_render` because Jekyll doesn't do logging very well.
diff --git a/twingly-url.gemspec b/twingly-url.gemspec index abc1234..def5678 100644 --- a/twingly-url.gemspec +++ b/twingly-url.gemspec @@ -15,7 +15,7 @@ s.required_ruby_version = ">= 2.5" s.add_dependency "addressable", "~> 2.6" - s.add_dependency "public_suffix", ">= 3.0.1", "< 5.0" + s.add_dependency "public_suffix", ">= 3.0.1", "< 6.0" s.add_development_dependency "rake", "~> 12" s.add_development_dependency "rspec", "~> 3"
Allow use of `public_suffix` 5 Changes in public_suffix looks fine to me, no breaking API changes what I can see: * https://github.com/weppos/publicsuffix-ruby/blob/v5.0.0/CHANGELOG.md#500 * https://github.com/weppos/publicsuffix-ruby/compare/v4.0.7...v5.0.0 Addressable 2.8.1 was just released to allow use of public_suffix 5.x: https://github.com/sporkmonger/addressable/blob/addressable-2.8.1/CHANGELOG.md#addressable-281
diff --git a/lib/clash/helpers.rb b/lib/clash/helpers.rb index abc1234..def5678 100644 --- a/lib/clash/helpers.rb +++ b/lib/clash/helpers.rb @@ -1,5 +1,26 @@ module Clash module Helpers + extend self + + def expand_list_of_numbers(only) + # Used in options[:only] to expand all possibilities. + if only.is_a?(Array) + only = only.join(',') + end + only.split(',').map do |n| + if n.include?("-") + expand_range(n) + else + n.to_i + end + end.flatten.sort.uniq + end + + def expand_range(string_range) + lower, upper = string_range.split("-").map(&:to_i).take(2).sort + Array.new(upper+1 - lower).fill { |i| i + lower } + end + def default_array(option) o = option || [] o = [o] unless o.is_a?(Array) @@ -30,7 +51,7 @@ def yellowit(str) colorize(str, 'yellow') end - + def redit(str) colorize(str, 'red') end
Create a function which expands the CLI args.
diff --git a/lib/config/nested.rb b/lib/config/nested.rb index abc1234..def5678 100644 --- a/lib/config/nested.rb +++ b/lib/config/nested.rb @@ -16,8 +16,15 @@ attr_accessor :shallow_delete # Add a nested ActionLink - def add_link(label, models) - @core.action_links.add('nested', :label => label, :type => :record, :security_method => :nested_authorized?, :position => :after, :parameters => {:associations => models.join(' ')}) + def add_link(label, models, options={}) + options = { + :security_method => ('nested_' + models.join('_')).to_sym, + :label => label, + :type => :record, + :position => :after, + :parameters => {:associations => models.join(' ')} + }.merge(options) + @core.action_links.add('nested', options) end # the label for this Nested action. used for the header.
Allow pass through options in add_link
diff --git a/lib/dry/view/path.rb b/lib/dry/view/path.rb index abc1234..def5678 100644 --- a/lib/dry/view/path.rb +++ b/lib/dry/view/path.rb @@ -22,7 +22,7 @@ def initialize(dir, root: dir) @dir = Pathname(dir) - @root = root + @root = Pathname(root) end def lookup(name, format, include_shared: true)
Stop infinitely looking for missing template and avoid SystemStackError
diff --git a/lib/extlib/module.rb b/lib/extlib/module.rb index abc1234..def5678 100644 --- a/lib/extlib/module.rb +++ b/lib/extlib/module.rb @@ -31,7 +31,7 @@ end # if we get this far then the nested constant was not found - raise NameError + raise NameError, "uninitialized constant #{const_name}" end end # class Module
Raise an exception with a useful message to prevent hair-loss
diff --git a/lib/findrepos/cli.rb b/lib/findrepos/cli.rb index abc1234..def5678 100644 --- a/lib/findrepos/cli.rb +++ b/lib/findrepos/cli.rb @@ -9,12 +9,18 @@ desc: 'finds Git repositories in subdirectories recursively', type: :boolean, aliases: :'-r' + option :clean, + desc: 'finds clean repositories only', + type: :boolean + option :dirty, + desc: 'finds dirty repositories only', + type: :boolean def list(directory = '.') # :nodoc: Findrepos.list(directory, recursive: options[:recursive]).each do |repo| if Findrepos.clean?(repo) - say_status 'clean', repo, :green + say_status 'clean', repo, :green if !options[:dirty] else - say_status 'dirty', repo, :red + say_status 'dirty', repo, :red if !options[:clean] end end end
Add --clean and --dirty options for filtering the list of repos
diff --git a/lib/model_patches.rb b/lib/model_patches.rb index abc1234..def5678 100644 --- a/lib/model_patches.rb +++ b/lib/model_patches.rb @@ -29,4 +29,13 @@ def ntcouncil? return self.has_tag?('NT_council') end + #QLD + # QLD State + def qldstate? + return self.has_tag?('QLD_state') + end + # QLD Council + def qldcouncil? + return self.has_tag?('QLD_council') + end end
Define QLD in the PublicBody Module
diff --git a/lib/monkey-mailer.rb b/lib/monkey-mailer.rb index abc1234..def5678 100644 --- a/lib/monkey-mailer.rb +++ b/lib/monkey-mailer.rb @@ -9,7 +9,10 @@ module MonkeyMailer extend Fallen - extend Fallen::CLI + + def self.extended(base) + base.extend(Fallen) + end @@normal_sleep = 0 @@low_sleep = 0 @@ -37,21 +40,10 @@ MonkeyMailer.send_emails(emails) end - def self.run + def run while running? MonkeyMailer.find_and_deliver sleep MonkeyMailer.configuration.sleep end end end - -case Clap.run(ARGV, MonkeyMailer.cli).first - -when "start" - MonkeyMailer.start! -when "stop" - MonkeyMailer.stop! -when "usage", "help" - puts MonkeyMailer.fallen_usage -end -
Remove CLI (it should be implemented by projects that uses the gem), Convert run into an instance method so it can be called from extending modules
diff --git a/lib/noir/executer.rb b/lib/noir/executer.rb index abc1234..def5678 100644 --- a/lib/noir/executer.rb +++ b/lib/noir/executer.rb @@ -9,27 +9,28 @@ # finish find by terminal command return nil if command.superclass == Noir::Base::TerminalCommand - commands = command.constants(true).map(&:to_s) + commands = command.constants(true).map(&:to_s) + matched_str = commands.find{|c| c.downcase == search_str.downcase} - commands.find{|c| c.downcase == search_str.downcase} + return nil if matched_str.nil? + matched_arr = command_arr + [matched_str] + unless eval(matched_arr.join('::')).ancestors.include?(Noir::Base::Command) + # matched. but matched class is not inherited commmand + return nil + end + + return matched_str end def self.command_from_argv args = ARGV.clone - command_arr = ['Noir', 'Command'] # command prefix + command_arr = ['Noir', 'Command'] # command prefix and default command while true break unless search_str = args.shift break unless matched_command = find_command(command_arr, search_str) command_arr << matched_command - - unless eval(command_arr.join('::')).ancestors.include?(Noir::Base::Command) - # delete last matched_command. - # because this matched class is not inherited Noir::Base::Command - command_arr.pop - break - end end return eval(command_arr.join('::'))
Move check command inherited into find_command
diff --git a/lib/pix_scale/pic.rb b/lib/pix_scale/pic.rb index abc1234..def5678 100644 --- a/lib/pix_scale/pic.rb +++ b/lib/pix_scale/pic.rb @@ -17,19 +17,19 @@ scaled_pic = @pic.scale(@pic.width * scale, @pic.height * scale) output_path = "#{dirname}/#{basename}-#{scale.to_s}#{extname}" - scaled_pic.save(output_path, type) + scaled_pic.save(output_path, @type) end def dirname - File.dirname(path) + File.dirname(@path) end def basename - File.basename(path, ".*") + File.basename(@path, ".*") end def extname - File.extname(path) + File.extname(@path) end end end
Use instance variable for use in local
diff --git a/lib/quizzy/engine.rb b/lib/quizzy/engine.rb index abc1234..def5678 100644 --- a/lib/quizzy/engine.rb +++ b/lib/quizzy/engine.rb @@ -1,6 +1,6 @@ module Quizzy class Engine < ::Rails::Engine isolate_namespace Quizzy - require "CarrierWave" + require "carrierwave" end end
Change le require de carrierwave
diff --git a/test/helpers/geo_helper_test.rb b/test/helpers/geo_helper_test.rb index abc1234..def5678 100644 --- a/test/helpers/geo_helper_test.rb +++ b/test/helpers/geo_helper_test.rb @@ -4,8 +4,9 @@ include GeoHelper test "should get ip address" do - ip = "87.223.138.147" - @request.headers["REMOTE_ADDR"] = ip + @request.headers["REMOTE_ADDR"] = "87.223.138.147" + ip = GeoHelper.get_ip_address(@request) + assert_equal(ip, "87.223.138.147") end
Make ip extractor test actually test something
diff --git a/core/dir/home_spec.rb b/core/dir/home_spec.rb index abc1234..def5678 100644 --- a/core/dir/home_spec.rb +++ b/core/dir/home_spec.rb @@ -14,9 +14,15 @@ Dir.home.should == home_directory end - platform_is_not :windows do + platform_is :solaris do it "returns the named user's home directory, from the user database, as a string if called with an argument" do - Dir.home(ENV['USER']).should == `/bin/echo ~#{ENV['USER']}`.chomp + Dir.home(ENV['USER']).should == `getent passwd ~#{ENV['USER']}|cut -d: -f6`.chomp + end + end + + platform_is_not :windows, :solaris do + it "returns the named user's home directory, from the user database, as a string if called with an argument" do + Dir.home(ENV['USER']).should == `echo ~#{ENV['USER']}`.chomp end end
Use getent and cut on Solaris to get home directory git-svn-id: ab86ecd26fe50a6a239cacb71380e346f71cee7d@66177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
diff --git a/cricos_scrape.gemspec b/cricos_scrape.gemspec index abc1234..def5678 100644 --- a/cricos_scrape.gemspec +++ b/cricos_scrape.gemspec @@ -22,9 +22,9 @@ spec.require_paths = ['lib'] - spec.add_development_dependency 'rspec' - spec.add_development_dependency 'rspec-its' + spec.add_development_dependency 'rspec', '~> 3.3.0', '>= 3.3.0' + spec.add_development_dependency 'rspec-its', '~> 1.2.0', '>= 1.2.0' - spec.add_runtime_dependency 'mechanize', '>= 2.7.2' - spec.add_runtime_dependency 'slop' + spec.add_runtime_dependency 'mechanize', '~> 2.7', '>= 2.7.2' + spec.add_runtime_dependency 'slop', '~> 4.2.0', '>= 4.2.0' end
Add semantic version to deps
diff --git a/lib/endeavour/core_ext.rb b/lib/endeavour/core_ext.rb index abc1234..def5678 100644 --- a/lib/endeavour/core_ext.rb +++ b/lib/endeavour/core_ext.rb @@ -4,8 +4,8 @@ class Endeavour def self.hook! return if defined?(@try_removed) - Object.include CoreExt::Object::Try - NilClass.include CoreExt::NilClass::Try + Object.prepend CoreExt::Object::Try + NilClass.prepend CoreExt::NilClass::Try end def self.remove_hook!
Use prepend instead of include
diff --git a/lib/free_cite/citation.rb b/lib/free_cite/citation.rb index abc1234..def5678 100644 --- a/lib/free_cite/citation.rb +++ b/lib/free_cite/citation.rb @@ -48,7 +48,8 @@ alias_method :replace!, :replace def has_field?(field) - self[field].present? && self[field] != self[:raw_string] && self[field].to_s.scan(/"”“/) != 1 # if the field has exactly one double quote, it's a good sign we didn't parse successfully + value = self[field] + value.present? && value != self[:raw_string] && value.to_s.scan(/["”“]/).length != 1 # if the field has exactly one double quote, it's a good sign we didn't parse successfully end def transformed_versions_to_try(str)
Fix invalidity based on stray double quote
diff --git a/lib/ghtorrent/settings.rb b/lib/ghtorrent/settings.rb index abc1234..def5678 100644 --- a/lib/ghtorrent/settings.rb +++ b/lib/ghtorrent/settings.rb @@ -21,7 +21,7 @@ :mirror_persister => "mirror.persister", :mirror_commit_pages_new_repo => "mirror.commit_pages_new_repo", - :uniq_id => "uniq_id" + :uniq_id => "mirror.uniq_id" } def config(key)
Fix retrieval of uniq_id field
diff --git a/lib/json_resume/reader.rb b/lib/json_resume/reader.rb index abc1234..def5678 100644 --- a/lib/json_resume/reader.rb +++ b/lib/json_resume/reader.rb @@ -1,6 +1,7 @@ require_relative 'formatter_html' require_relative 'formatter_latex' require_relative 'formatter_md' +require 'rest-client' require 'json' module JsonResume @@ -11,6 +12,7 @@ output_type = options[:output_type] || "html" #default html, others latex, md @json_string = case json_input when /\.json$/i then File.read(json_input) + when /^(http|https|www)/ then RestClient.get(json_input) else json_input end @output_type = output_type
Add option to enter json url
diff --git a/lib/stormtroopers/army.rb b/lib/stormtroopers/army.rb index abc1234..def5678 100644 --- a/lib/stormtroopers/army.rb +++ b/lib/stormtroopers/army.rb @@ -3,9 +3,16 @@ attr_reader :factory, :threads, :max_threads def initialize(config) - @factory = "stormtroopers/#{config[:factory].delete(:type)}_factory".camelize.constantize.new(config[:factory]) + @factory = factory_class(config).new(config[:factory]) @max_threads = config[:max_threads] || 1 @threads = [] + end + + def factory_class(config) + raise ArgumentError, "Factory class or type must be defined" if config[:factory][:class].blank? && config[:factory][:type].blank? + class_name ||= config[:factory].delete(:class) + class_name ||= "stormtroopers/#{config[:factory].delete(:type)}_factory".camelize + class_name.constantize end def manage @@ -27,4 +34,4 @@ threads.reject!{ |thread| !thread.alive? } end end -end+end
Allow us to specify the class directly too