diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/ruby/ql/test/library-tests/dataflow/barrier-guards/barrier-guards.rb b/ruby/ql/test/library-tests/dataflow/barrier-guards/barrier-guards.rb index abc1234..def5678 100644 --- a/ruby/ql/test/library-tests/dataflow/barrier-guards/barrier-guards.rb +++ b/ruby/ql/test/library-tests/dataflow/barrier-guards/barrier-guards.rb @@ -31,3 +31,11 @@ end foo + +FOO = ["foo"] + +if FOO.include?(foo) + foo +else + foo +end
Ruby: Add test case: array constant barrier guard This guard isn't yet recognised as a `StringConstArrayInclusionCall`.
diff --git a/HysteriaPlayer.podspec b/HysteriaPlayer.podspec index abc1234..def5678 100644 --- a/HysteriaPlayer.podspec +++ b/HysteriaPlayer.podspec @@ -1,12 +1,13 @@ Pod::Spec.new do |s| s.name = "HysteriaPlayer" s.version = "2.1.2" - s.summary = "Objective-C remote audio player (AVPlayer extends)" + s.summary = "Objective-C remote audio player (AVPlayer extends), iOS, OS X compatible" s.homepage = "https://github.com/StreetVoice/HysteriaPlayer" s.license = 'MIT' s.author = { "Stan Tsai" => "feocms@gmail.com" } s.source = { :git => "https://github.com/StreetVoice/HysteriaPlayer.git", :tag => "2.1.2" } - s.platform = :ios, '6.0' + s.ios.platform = :ios, '6.0' + s.osx.platform = :osx, '10.9' s.source_files = 'HysteriaPlayer/**/*.{h,m}' s.resources = 'HysteriaPlayer/point1sec.{mp3}' s.frameworks = 'CoreMedia', 'AudioToolbox', 'AVFoundation'
Update .podspec, OS X compatible
diff --git a/app/models/inputs/effective_static_control/input.rb b/app/models/inputs/effective_static_control/input.rb index abc1234..def5678 100644 --- a/app/models/inputs/effective_static_control/input.rb +++ b/app/models/inputs/effective_static_control/input.rb @@ -8,7 +8,12 @@ end def to_html - content_tag(:p, value, tag_options) + if value.kind_of?(String) && value.start_with?('<p>') && value.end_with?('</p>') + content_tag(:p, value[3...-4].html_safe, tag_options) + else + content_tag(:p, (value.html_safe? ? value : value.to_s.html_safe), tag_options) + end + end def html_options
Tweak effective_static_control to avoid double <p>
diff --git a/db/migrate/20090606004452_add_status_to_racers.rb b/db/migrate/20090606004452_add_status_to_racers.rb index abc1234..def5678 100644 --- a/db/migrate/20090606004452_add_status_to_racers.rb +++ b/db/migrate/20090606004452_add_status_to_racers.rb @@ -1,11 +1,17 @@ class AddStatusToRacers < ActiveRecord::Migration def self.up - return if ASSOCIATION.short_name == "MBRA" - - add_column :racers, :status, :string + case ASSOCIATION.short_name + when "MBRA" + return + when "WSBA" + add_column :people, :status, :string + else + add_column :racers, :status, :string + end end def self.down - remove_column :racers, :status + remove_column(:people, :status) rescue nil + remove_column(:racers, :status) rescue nil end end
Fix migration for WSBA (already deployed and ran People migrations)
diff --git a/lib/dc/zip_utils.rb b/lib/dc/zip_utils.rb index abc1234..def5678 100644 --- a/lib/dc/zip_utils.rb +++ b/lib/dc/zip_utils.rb @@ -7,15 +7,12 @@ module ZipUtils def package(zip_name) - temp_dir = Dir.mktmpdir# do |temp_dir| - zipfile = "#{temp_dir}/#{zip_name}" - Zip::File.open(zipfile, Zip::File::CREATE) do |zip| - yield zip - end - # TODO: We can stream, or even better, use X-Accel-Redirect, if we can - # be sure to clean up the Zip after the fact -- with a cron or equivalent. - send_file zipfile, :stream => false -# end + zipfile = Tempfile.new(["dc",".zip"]) + Zip::File.open(zipfile.path, Zip::File::CREATE) do |zip| + yield zip + end + send_file zipfile.path, :type => 'application/zip', :disposition => 'attachment', :filename => zip_name + zipfile.close end end
Use Tempfile for zipfile creation When Dir.mktmpdir is unlinked, the inner files are inaccessible to send_file. This meant that we had to keep it around until after the download was complete, which littered the /tmp directory with directories filled with zip files. Since we only need a single file, Tempfile is more appropriate. We can close the filehandle and any process that is currently reading from it (like send_file) can continue to read even after the file is unlinked when the tempfile is garbage collected. A future enhancement might be to switch to the Zipline gem. That would allow streaming the zip file while files are being added to it, allowing downloading to begin sooner.
diff --git a/pronto-rails_schema.gemspec b/pronto-rails_schema.gemspec index abc1234..def5678 100644 --- a/pronto-rails_schema.gemspec +++ b/pronto-rails_schema.gemspec @@ -20,7 +20,7 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_dependency 'pronto', '~> 0.5.0 ' + spec.add_dependency 'pronto', '~> 0.6.0 ' spec.add_development_dependency "bundler", "~> 1.10" spec.add_development_dependency "rake", "~> 10.0" spec.add_development_dependency "rspec", "~> 3.3"
Upgrade pronto dependency to 0.6.0.
diff --git a/db/migrate/20120814113226_create_wafflemix_pages.rb b/db/migrate/20120814113226_create_wafflemix_pages.rb index abc1234..def5678 100644 --- a/db/migrate/20120814113226_create_wafflemix_pages.rb +++ b/db/migrate/20120814113226_create_wafflemix_pages.rb @@ -1,5 +1,5 @@ class CreateWafflemixPages < ActiveRecord::Migration - def change + def up create_table :wafflemix_pages do |t| t.integer :parent_id t.integer :position @@ -11,5 +11,12 @@ t.timestamps end + + Wafflemix::Page.create_translation_table! :title => :string, :body => :text + end + + def down + drop_table :wafflemix_pages + Wafflemix::Page.drop_translation_table! end end
Add pages migration w translations.
diff --git a/db/migrate/20161014123500_add_episode_attributes.rb b/db/migrate/20161014123500_add_episode_attributes.rb index abc1234..def5678 100644 --- a/db/migrate/20161014123500_add_episode_attributes.rb +++ b/db/migrate/20161014123500_add_episode_attributes.rb @@ -20,5 +20,7 @@ add_column :episodes, :feedburner_orig_link, :string add_column :episodes, :feedburner_orig_enclosure_link, :string add_column :episodes, :is_perma_link, :boolean + + Episode.where(prx_uri: nil, title: nil).each { |e| EpisodeEntryHandler.new(e).update_from_overrides } end end
Copy data from overrides to the episode columns
diff --git a/lib/finch/cursor.rb b/lib/finch/cursor.rb index abc1234..def5678 100644 --- a/lib/finch/cursor.rb +++ b/lib/finch/cursor.rb @@ -15,8 +15,12 @@ klass.extend ClassMethods end + def more? + !@_next.nil + end + def next - raise "No next parameter set" if @_next.nil? + raise "No next parameter set" unless more? next_params = Finch::Utils::keys_to_sym( Rack::Utils.parse_nested_query(@_next.gsub('?',''))) l = @_last_request
Add `more?` method to test for pagination.
diff --git a/db/migrate/20151125123352_create_notifications_endpoint.rb b/db/migrate/20151125123352_create_notifications_endpoint.rb index abc1234..def5678 100644 --- a/db/migrate/20151125123352_create_notifications_endpoint.rb +++ b/db/migrate/20151125123352_create_notifications_endpoint.rb @@ -0,0 +1,25 @@+class CreateNotificationsEndpoint < ActiveRecord::Migration + def change + execute <<-SQL + CREATE OR REPLACE VIEW "1".notifications AS + SELECT * FROM + ( + SELECT user_id, template_name, created_at, sent_at, deliver_at FROM category_notifications + UNION ALL + SELECT user_id, template_name, created_at, sent_at, deliver_at FROM donation_notifications + UNION ALL + SELECT user_id, template_name, created_at, sent_at, deliver_at FROM user_notifications + UNION ALL + SELECT user_id, template_name, created_at, sent_at, deliver_at FROM project_notifications + UNION ALL + SELECT user_id, template_name, created_at, sent_at, deliver_at FROM user_transfer_notifications + UNION ALL + SELECT user_id, template_name, created_at, sent_at, deliver_at FROM project_post_notifications + UNION ALL + SELECT user_id, template_name, created_at, sent_at, deliver_at FROM contribution_notifications + ) n; + + grant select on "1".notifications to admin; + SQL + end +end
Add View to notification endpoint
diff --git a/attributes/remi-gpgkey.rb b/attributes/remi-gpgkey.rb index abc1234..def5678 100644 --- a/attributes/remi-gpgkey.rb +++ b/attributes/remi-gpgkey.rb @@ -1,11 +1,8 @@ # From https://rpms.remirepo.net/ in the "Other Resources" section about # gpg keys for platform versions. -default['yum-remi-chef']['gpgkey'] = if node['platform'].eql?('fedora') && +default['yum-remi-chef']['gpgkey'] = if platform?('fedora') && node['platform_version'].to_i >= 28 'https://rpms.remirepo.net/RPM-GPG-KEY-remi2018' - elsif node['platform'].eql?('fedora') && - node['platform_version'].to_i.between?(26, 27) - 'https://rpms.remirepo.net/RPM-GPG-KEY-remi2017' else 'https://rpms.remirepo.net/RPM-GPG-KEY-remi' end
Remove logic to support EOL Fedora platforms Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/lib/api2cart/daemon/proxy_server.rb b/lib/api2cart/daemon/proxy_server.rb index abc1234..def5678 100644 --- a/lib/api2cart/daemon/proxy_server.rb +++ b/lib/api2cart/daemon/proxy_server.rb @@ -28,7 +28,7 @@ begin connection_handler.handle_proxy_connection(client_socket) rescue Exception => e - LOGGER.error "! Exception: #{e.inspect}" + LOGGER.error "! Exception: #{e.inspect}\n#{e.backtrace}" ensure client_socket.close end
Add backtrace to error logs
diff --git a/test_site/se_demo.rb b/test_site/se_demo.rb index abc1234..def5678 100644 --- a/test_site/se_demo.rb +++ b/test_site/se_demo.rb @@ -4,7 +4,7 @@ require 'sequel_setup' require 'se_setup' ScaffoldingExtensions.javascript_library = 'JQuery' -set :port=>7980 +set :port=>7980, :run=>true get '/' do erb :index
Add :run=>true option so sinatra works with ruby-style on test site
diff --git a/app/mailers/song_mailer.rb b/app/mailers/song_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/song_mailer.rb +++ b/app/mailers/song_mailer.rb @@ -1,5 +1,5 @@ class SongMailer < ApplicationMailer - default to: 'miyoshi@ku-unplugged.net' # TODO: Replace "miyoshi" with "pa" + default to: 'pa@ku-unplugged.net' def entry(song, applicant, notes) @song = song
Change the destination to PA
diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -1,9 +1,9 @@ class UserMailer < ActionMailer::Base - default from: "from@example.com" + default from: Rails.configuration.noreply_email def password_reset_notification(user) @user = user - @url = passwords_path(user.password_reset_token) + @url = passwords_url(token: user.password_reset_token) mail(to: user.email, subject: "Your password reset request")
Use rails configuration for from email
diff --git a/db/migrate/20190124103508_remove_micro_chp_input.rb b/db/migrate/20190124103508_remove_micro_chp_input.rb index abc1234..def5678 100644 --- a/db/migrate/20190124103508_remove_micro_chp_input.rb +++ b/db/migrate/20190124103508_remove_micro_chp_input.rb @@ -11,7 +11,7 @@ Scenario.migratable.find_each.with_index do |scenario, index| say "#{index} done" if index.positive? && (index % 250).zero? - if collection_name(scenario, SOURCE_KEY) + if collection_name(scenario, SOURCE_KEY) && collection_name(scenario, TARGET_KEY) updated += 1 source_collection = scenario.public_send(collection_name(scenario, SOURCE_KEY))
Fix micro CHP migration when no network gas is set
diff --git a/app/models/rapidfire/question.rb b/app/models/rapidfire/question.rb index abc1234..def5678 100644 --- a/app/models/rapidfire/question.rb +++ b/app/models/rapidfire/question.rb @@ -9,7 +9,7 @@ serialize :validation_rules if Rails::VERSION::MAJOR == 3 - attr_accessible :survey, :question_text, :validation_rules, :answer_options + attr_accessible :survey, :question_text, :position, :validation_rules, :answer_options end def self.inherited(child)
Make position attribute accessible in Rails 3
diff --git a/shuffle.rb b/shuffle.rb index abc1234..def5678 100644 --- a/shuffle.rb +++ b/shuffle.rb @@ -1,11 +1,10 @@ require 'sinatra' require 'httparty' require 'yaml' +require 'pry' data = YAML.load_file(File.expand_path("./data.yml")) post('/') do - team = data['team_members'].shuffle - - HTTParty.post(data['url'], body: { text: team, channel: "\##{params['channel_name']}" }.to_json ) + HTTParty.post(data['url'], body: { text: data['team_members'].shuffle.join(', '), channel: "\##{params['channel_name']}" }.to_json ) end
Remove unnecessary variable and return list joined
diff --git a/lib/ranked-model.rb b/lib/ranked-model.rb index abc1234..def5678 100644 --- a/lib/ranked-model.rb +++ b/lib/ranked-model.rb @@ -53,8 +53,13 @@ instance_variable_set "@#{ranker.name}_position", position end end + define_method "position" do + position_value = send(ranker.name) + return nil unless position_value + self.class.send(ranker.scope).where("#{ranker.name} < ?", position_value).count + end - public "#{ranker.name}_position", "#{ranker.name}_position=" + public "#{ranker.name}_position", "#{ranker.name}_position=", :position end end
Add position method to ranked objects. An instance of a ranked class can now call #position to get their position in the list. It uses count so wouldn't be great for querying every object (if you're doing that you're probably in a loop and can use with_index) but will be fine for infrequent calls.
diff --git a/lib/reel/version.rb b/lib/reel/version.rb index abc1234..def5678 100644 --- a/lib/reel/version.rb +++ b/lib/reel/version.rb @@ -1,4 +1,4 @@ module Reel - VERSION = "0.6.0" - CODENAME = "Garland" + VERSION = "0.7.0.pre" + CODENAME = "Marilyn" end
Make master 0.7.0.pre (codename "Marilyn")
diff --git a/lib/ruby_rexster.rb b/lib/ruby_rexster.rb index abc1234..def5678 100644 --- a/lib/ruby_rexster.rb +++ b/lib/ruby_rexster.rb @@ -1,8 +1,8 @@ libdir = File.dirname(__FILE__) $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir) -require 'ruby_rexster/vertex' -require 'ruby_rexster/edge' module RubyRexster + autoload :Vertex, 'ruby_rexster/vertex' + autoload :Edge, 'ruby_rexster/edge' end
Move to autoloading the modules
diff --git a/lib/clojurescript_rails/template.rb b/lib/clojurescript_rails/template.rb index abc1234..def5678 100644 --- a/lib/clojurescript_rails/template.rb +++ b/lib/clojurescript_rails/template.rb @@ -4,13 +4,8 @@ module ClojurescriptRails class ClojurescriptTemplate < ::Tilt::Template - def self.engine_initialized? - not @compiler.nil? - end - def initialize_engine - debugger - @compiler = ClojurescriptCompiler.new + @compiler ||= ClojurescriptCompiler.new end def prepare
Remove debugging statement and unecessary method
diff --git a/lib/earth/air/airline/data_miner.rb b/lib/earth/air/airline/data_miner.rb index abc1234..def5678 100644 --- a/lib/earth/air/airline/data_miner.rb +++ b/lib/earth/air/airline/data_miner.rb @@ -3,6 +3,7 @@ schema Earth.database_options do string 'name' string 'bts_code' + string 'iata_code' string 'icao_code' end @@ -11,6 +12,7 @@ :encoding => 'UTF-8' do key 'name' store 'bts_code', :nullify => true + store 'iata_code', :nullify => true store 'icao_code', :nullify => true end end
Include iata_code in our Airline table since we have it
diff --git a/lib/easy_dci/extensions/dci_base.rb b/lib/easy_dci/extensions/dci_base.rb index abc1234..def5678 100644 --- a/lib/easy_dci/extensions/dci_base.rb +++ b/lib/easy_dci/extensions/dci_base.rb @@ -11,18 +11,22 @@ def create set_dci_data(_crud_model.params(:on_create)) - _crud_model.scoped? ? call_dci_context(:create, _crud_scoped_object) : call_dci_context(:create) + if _crud_model.scoped? || _crud_model.polymorphic? + call_dci_context(:create, _crud_scoped_object, *_dci_additional_params_on_create) + else + call_dci_context(:create, *_dci_additional_params_on_create) + end end def update set_dci_data(_crud_model.params(:on_update)) - call_dci_context(:update, _crud_object) + call_dci_context(:update, _crud_object, *_dci_additional_params_on_update) end def destroy - call_dci_context(:delete, _crud_object) + call_dci_context(:delete, _crud_object, *_dci_additional_params_on_destroy) end @@ -34,6 +38,21 @@ self.render_flash_messages.call(request) end + + def _dci_additional_params_on_create + [] + end + + + def _dci_additional_params_on_update + [] + end + + + def _dci_additional_params_on_destroy + [] + end + end end end
Handle additional params for DCI actions
diff --git a/Casks/omni-disk-sweeper.rb b/Casks/omni-disk-sweeper.rb index abc1234..def5678 100644 --- a/Casks/omni-disk-sweeper.rb +++ b/Casks/omni-disk-sweeper.rb @@ -1,7 +1,7 @@ class OmniDiskSweeper < Cask url 'http://www.omnigroup.com/download/latest/omnidisksweeper' homepage 'http://www.omnigroup.com/products/omnidisksweeper/' - version '1.8' - sha1 '8061c4d7ee18549f976119146f28e67180141069' + version 'latest' + no_checksum link 'OmniDiskSweeper.app' end
Update OmniDiskSweeper to use latest scheme
diff --git a/db/migrate/20141007022617_create_collaboration_runs.rb b/db/migrate/20141007022617_create_collaboration_runs.rb index abc1234..def5678 100644 --- a/db/migrate/20141007022617_create_collaboration_runs.rb +++ b/db/migrate/20141007022617_create_collaboration_runs.rb @@ -2,12 +2,12 @@ def up create_table :collaboration_runs do |t| t.integer :user_id - t.string :collaborators_data_url + t.string :collaboration_endpoint_url t.timestamps end add_column :runs, :collaboration_run_id, :integer - add_index :collaboration_runs, [:collaborators_data_url], :name => 'collaboration_runs_endpoint_idx' + add_index :collaboration_runs, [:collaboration_endpoint_url], :name => 'collaboration_runs_endpoint_idx' add_index :runs, [:collaboration_run_id], :name => 'runs_collaboration_idx' # Rename index, as its previous name is too long and causes errors during this migration rollback. remove_index :runs, [:user_id, :remote_id, :remote_endpoint]
Fix one of the migrations where column name was accidentally changed [#79958812]
diff --git a/benchmarks/format_args.rb b/benchmarks/format_args.rb index abc1234..def5678 100644 --- a/benchmarks/format_args.rb +++ b/benchmarks/format_args.rb @@ -0,0 +1,34 @@+require "benchmark" +require 'lib/yard' + +def format_args_regex(object) + if object.signature + object.signature[/#{Regexp.quote object.name.to_s}\s*(.*)/, 1] + else + "" + end +end + +def format_args_parameters(object) + if !object.parameters.empty? + args = object.parameters.map {|n, v| v ? "#{n} = #{v}" : n.to_s }.join(", ") + "(#{args})" + else + "" + end +end + +YARD::Registry.load +$object = YARD::Registry.at('YARD::Generators::Base#G') + +puts "regex: " + format_args_regex($object) +puts "params: " + format_args_parameters($object) +puts + +TIMES = 100_000 +Benchmark.bmbm do |x| + x.report("regex") { TIMES.times { format_args_regex($object) } } + x.report("parameters") { TIMES.times { format_args_parameters($object) } } +end + +
Add benchmark for argument formatting
diff --git a/lib/ruby-lint/analysis/pedantics.rb b/lib/ruby-lint/analysis/pedantics.rb index abc1234..def5678 100644 --- a/lib/ruby-lint/analysis/pedantics.rb +++ b/lib/ruby-lint/analysis/pedantics.rb @@ -1,9 +1,20 @@ module RubyLint module Analysis ## - # The {RubyLint::Analysis::UselessRuby} class checks for various useless - # Ruby features, the use of redundant tokens such as `then` for `if` - # statements and various other pedantics. + # This class adds (pedantic) warnings for various features that aren't + # really that useful or needed. This serves mostly as a simple example on + # how to write an analysis class. + # + # Currently warnings are added for the following: + # + # * BEGIN/END blocks + # * Statements that use `then` or `do` when it's not needed + # + # For example: + # + # BEGIN { puts 'foo' } + # + # This would result in the warning "BEGIN/END is useless" being added. # class Pedantics < Base register 'pedantics'
Correct docs of the Pedantics analysis class.
diff --git a/lib/tasks/load_legacy_mappings.rake b/lib/tasks/load_legacy_mappings.rake index abc1234..def5678 100644 --- a/lib/tasks/load_legacy_mappings.rake +++ b/lib/tasks/load_legacy_mappings.rake @@ -13,7 +13,7 @@ begin topic_taxon_id = api.lookup_content_id(base_path: topic_taxon) raise "Lookup failed for #{topic_taxon}" unless topic_taxon_id - topic_taxon_links = api.get_links(topic_taxon_id)["links"] + topic_taxon_links = api.get_links(topic_taxon_id) legacy_taxon_ids = api.lookup_content_ids(base_paths: legacy_taxons) missing_legacy_taxons = legacy_taxons - legacy_taxon_ids.keys @@ -21,7 +21,10 @@ topic_taxon_links["legacy_taxons"] = legacy_taxon_ids.values puts "Adding #{legacy_taxons.count} legacy taxons for #{topic_taxon}" - api.patch_links(topic_taxon_id, links: topic_taxon_links, bulk_publishing: true) + api.patch_links(topic_taxon_id, + links: topic_taxon_links["links"], + bulk_publishing: true, + previous_version: topic_taxon_links["version"]) rescue StandardError => e puts "Failed to patch #{topic_taxon}: #{e.message}" end
Modify legacy mapping rake task to support optimistic locking. This will prevent the rake task accidentally overwriting concurrent changes to a topic taxon when populating its legacy_taxons links.
diff --git a/db/data_migration/20190117142343_remove_policy_publisher_content.rb b/db/data_migration/20190117142343_remove_policy_publisher_content.rb index abc1234..def5678 100644 --- a/db/data_migration/20190117142343_remove_policy_publisher_content.rb +++ b/db/data_migration/20190117142343_remove_policy_publisher_content.rb @@ -0,0 +1,13 @@+puts 'Unpublishing /government/policies/school-and-college-funding-and-accountability/email-signup and redirecting to /email-signup/?topic=/education/school-and-academy-funding' +Services.publishing_api.unpublish( + '377e1772-a6d5-454c-836f-f9c282457b0e', + type: 'redirect', + alternative_path: '/email-signup/?topic=/education/school-and-academy-funding' +) + +puts 'Unpublishing /government/policies/all and redirecting to /' +Services.publishing_api.unpublish( + 'ccb6c301-2c64-4a59-88c9-0528d0ffd088', + type: 'redirect', + alternative_path: '/' +)
Add a data migration to unpublish old Policy Publisher content This doesn't specifically relate to Whitehall, it's just an easy place to put this code. A single email signup page was left behind when Policy Publisher was retired, so unpublish that and replace it with a redirect to the email signup page for the replacement Topic in the Topic Taxonomy. Policy Publisher also published a finder for policies, so unpublish that, and replace it with a redirect to the homepage, as there isn't a great alternative for that specific page.
diff --git a/db/migrate/20160310114854_add_document_fingerprint_to_print_jobs.rb b/db/migrate/20160310114854_add_document_fingerprint_to_print_jobs.rb index abc1234..def5678 100644 --- a/db/migrate/20160310114854_add_document_fingerprint_to_print_jobs.rb +++ b/db/migrate/20160310114854_add_document_fingerprint_to_print_jobs.rb @@ -0,0 +1,16 @@+class AddDocumentFingerprintToPrintJobs < ActiveRecord::Migration + def up + add_column :print_jobs, :document_fingerprint, :string + PrintJob.find_each do |print_job| + path = print_job.document.path + if path && File.exists?(path) + fingerprint = Digest::MD5.file(path).hexdigest + print_job.update_column(:document_fingerprint, fingerprint) + end + end + end + + def down + remove_column :print_jobs, :document_fingerprint + end +end
Fix missing migration for previous commit.
diff --git a/rb/spec/unit/selenium/webdriver/remote/http/common_spec.rb b/rb/spec/unit/selenium/webdriver/remote/http/common_spec.rb index abc1234..def5678 100644 --- a/rb/spec/unit/selenium/webdriver/remote/http/common_spec.rb +++ b/rb/spec/unit/selenium/webdriver/remote/http/common_spec.rb @@ -6,13 +6,13 @@ module Http describe Common do - it "sends Content-Length=0 header for POST requests without a command in the body" do + it "sends non-empty body header for POST requests without command data" do common = Common.new common.server_url = URI.parse("http://server") common.should_receive(:request). with(:post, URI.parse("http://server/clear"), - hash_including("Content-Length" => "0"), nil) + hash_including("Content-Length" => "2"), "{}") common.call(:post, "clear", nil) end
JariBakken: Fix spec for last change. git-svn-id: 4179480af2c2519a5eb5e1e9b541cbdf5cf27696@13679 07704840-8298-11de-bf8c-fd130f914ac9
diff --git a/spec/controllers/physical_server_controller_spec.rb b/spec/controllers/physical_server_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/physical_server_controller_spec.rb +++ b/spec/controllers/physical_server_controller_spec.rb @@ -9,8 +9,9 @@ before(:each) do EvmSpecHelper.create_guid_miq_server_zone login_as FactoryGirl.create(:user) + ems = FactoryGirl.create(:ems_physical_infra) computer_system = FactoryGirl.create(:computer_system, :hardware => FactoryGirl.create(:hardware)) - physical_server = FactoryGirl.create(:physical_server, :computer_system => computer_system) + physical_server = FactoryGirl.create(:physical_server, :computer_system => computer_system, :ems_id => ems.id) get :show, :params => {:id => physical_server.id} end it { expect(response.status).to eq(200) }
Update specs for physical server - Add parent relationship for physical server with ems_physical_infra
diff --git a/app/controllers/admin/link_check_reports_controller.rb b/app/controllers/admin/link_check_reports_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/link_check_reports_controller.rb +++ b/app/controllers/admin/link_check_reports_controller.rb @@ -1,5 +1,5 @@ class Admin::LinkCheckReportsController < Admin::BaseController - before_filter :find_reportable + before_action :find_reportable def create @report = LinkCheckerApiService.check_links(
Use before_action instead of before_filter in link check controller
diff --git a/lib/spectrum/config/online_resource_aggregator.rb b/lib/spectrum/config/online_resource_aggregator.rb index abc1234..def5678 100644 --- a/lib/spectrum/config/online_resource_aggregator.rb +++ b/lib/spectrum/config/online_resource_aggregator.rb @@ -34,8 +34,8 @@ text: link['link_text'], href: link['href'] }, - link['description'] || 'N/A', - link['relationship'] || 'N/A' + {text: link['description'] || 'N/A'}, + {text: link['relationship'] || 'N/A'} ] end resource
Put the cell data in a structure.
diff --git a/lib/mutant/mutator/node/send/binary.rb b/lib/mutant/mutator/node/send/binary.rb index abc1234..def5678 100644 --- a/lib/mutant/mutator/node/send/binary.rb +++ b/lib/mutant/mutator/node/send/binary.rb @@ -20,7 +20,7 @@ emit(left) emit_left_mutations emit_selector_replacement - emit(right) unless splat?(right) + emit(right) unless n_splat?(right) emit_right_mutations end
Correct use of node type predicates
diff --git a/lib/generators/geocoder/maxmind/templates/migration/geolite_city.rb b/lib/generators/geocoder/maxmind/templates/migration/geolite_city.rb index abc1234..def5678 100644 --- a/lib/generators/geocoder/maxmind/templates/migration/geolite_city.rb +++ b/lib/generators/geocoder/maxmind/templates/migration/geolite_city.rb @@ -5,7 +5,9 @@ t.column :end_ip_num, :bigint, null: false t.column :loc_id, :bigint, null: false end + add_index :maxmind_geolite_city_blocks, :loc_id add_index :maxmind_geolite_city_blocks, :start_ip_num, unique: true + add_index :maxmind_geolite_city_blocks, [:end_ip_num, :start_ip_num], unique: true, name: 'index_maxmind_geolite_city_blocks_on_end_ip_num_range' create_table :maxmind_geolite_city_location, id: false do |t| t.column :loc_id, :bigint, null: false
Add indices for faster queries. See: https://github.com/alexreisner/geocoder/issues/703
diff --git a/lib/rocket_cms/controllers/contacts.rb b/lib/rocket_cms/controllers/contacts.rb index abc1234..def5678 100644 --- a/lib/rocket_cms/controllers/contacts.rb +++ b/lib/rocket_cms/controllers/contacts.rb @@ -17,10 +17,13 @@ end if @contact_message.send(meth) after_create - redirect_after_done + if request.xhr? && process_ajax + ajax_success + else + redirect_after_done + end else - flash.now[:alert] = @contact_message.errors.full_messages.join("\n") - render action: "new" + render_error end end @@ -28,7 +31,20 @@ end private - + def render_error + if request.xhr? && process_ajax + render json: @contact_message.errors + else + flash.now[:alert] = @contact_message.errors.full_messages.join("\n") + render action: "new", status: 422 + end + end + def process_ajax + true + end + def ajax_success + render json: {ok: true} + end def redirect_after_done redirect_to :contacts_sent end
Add ajax contact message handling
diff --git a/lib/simple_form/inputs/string_input.rb b/lib/simple_form/inputs/string_input.rb index abc1234..def5678 100644 --- a/lib/simple_form/inputs/string_input.rb +++ b/lib/simple_form/inputs/string_input.rb @@ -4,13 +4,13 @@ def input input_html_options[:size] ||= [limit, SimpleForm.default_input_size].compact.min input_html_options[:maxlength] ||= limit if limit - input_html_options[:type] ||= input_type unless input_type == :string + input_html_options[:type] ||= input_type unless string? @builder.text_field(attribute_name, input_html_options) end def input_html_classes - input_type == :string ? super : super.unshift("string") + string? ? super : super.unshift("string") end protected @@ -22,6 +22,10 @@ def has_placeholder? placeholder_present? end + + def string? + input_type == :string + end end end end
Refactor string input a bit
diff --git a/lib/spree/chimpy/controller_filters.rb b/lib/spree/chimpy/controller_filters.rb index abc1234..def5678 100644 --- a/lib/spree/chimpy/controller_filters.rb +++ b/lib/spree/chimpy/controller_filters.rb @@ -14,7 +14,7 @@ if (mc_eid || mc_cid) && session[:order_id] attributes = {campaign_id: mc_cid, email_id: mc_eid} - if current_order(true).source + if current_order(create_order_if_necessary: true).source current_order.source.update_attributes(attributes) else current_order.create_source(attributes)
Use Spree 2.x method signature
diff --git a/bin/circle_client_tests.rb b/bin/circle_client_tests.rb index abc1234..def5678 100644 --- a/bin/circle_client_tests.rb +++ b/bin/circle_client_tests.rb @@ -9,6 +9,9 @@ # export CIRCLE_BANK_ACCOUNT_ID=186074 # export CIRCLE_CUSTOMER_SESSION_TOKEN= # export CIRCLE_COOKIE="" +# export COINBASE_KEY= +# export COINBASE_SECRET= + # Instantiate Circle Client circle_client = RbtcArbitrage::Clients::CircleClient.new
Add placeholders for COINBASE_KEY and COINBASE_SECRET
diff --git a/lib/active_support_decorators/active_support_decorators.rb b/lib/active_support_decorators/active_support_decorators.rb index abc1234..def5678 100644 --- a/lib/active_support_decorators/active_support_decorators.rb +++ b/lib/active_support_decorators/active_support_decorators.rb @@ -38,7 +38,7 @@ if const_path file = const_path.underscore else - first_autoload_match = ActiveSupport::Dependencies.autoload_paths.find { |p| file.include?(p) } + first_autoload_match = ActiveSupport::Dependencies.autoload_paths.find { |p| file.include?(p.to_s) } file.sub!(first_autoload_match, '') if first_autoload_match end
Fix `no implicit conversion of Pathname into String (TypeError)`
diff --git a/libraries/provider_shipyard_agent_application_container.rb b/libraries/provider_shipyard_agent_application_container.rb index abc1234..def5678 100644 --- a/libraries/provider_shipyard_agent_application_container.rb +++ b/libraries/provider_shipyard_agent_application_container.rb @@ -0,0 +1,68 @@+# Encoding: UTF-8 +# +# Cookbook Name:: shipyard +# Provider:: shipyard_agent_application_container +# +# Copyright 2014, Jonathan Hartman +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require 'chef/provider' +require_relative 'resource_shipyard_agent_application' +require_relative 'provider_shipyard_agent_application' + +class Chef + class Provider + class ShipyardAgentApplication < Provider + # A Chef provider for a container-based Shipyard agent install + # + # @author Jonathan Hartman <j@p4nt5.com> + class Container < ShipyardAgentApplication + def action_create + image.run_action(:pull) + end + + def action_delete + image.run_action(:remove) + end + + def installed? + !current_image.tag.nil? + end + + def version + return nil unless installed? + current_image.tag + end + + private + + def current_image + @current_image ||= Chef::Provider::DockerImage.new( + Chef::Resource::DockerImage.new( + new_resource.docker_image, run_context + ), run_context + ).load_current_resource + end + + def image + @image ||= Chef::Resource::DockerImage.new(new_resource.docker_image, + run_context) + @image.tag(new_resource.version) + @image + end + end + end + end +end
Add a provider for container-based agent applications
diff --git a/actionsystemtest/lib/action_system_test/driver_adapters/web_server.rb b/actionsystemtest/lib/action_system_test/driver_adapters/web_server.rb index abc1234..def5678 100644 --- a/actionsystemtest/lib/action_system_test/driver_adapters/web_server.rb +++ b/actionsystemtest/lib/action_system_test/driver_adapters/web_server.rb @@ -30,7 +30,7 @@ end def register_webrick(app, port) - Rack::Handler::WEBrick.run(app, Port: port) + Rack::Handler::WEBrick.run(app, Port: port, AccessLog: [], Logger: WEBrick::Log::new(nil, 0)) end def set_server
Set Webrick logger for system testing If this is not set Webrick will log **everything** to STDOUT and distract from the running tests. This will instead log to the log file. This example was extracted from the Capybara source code.
diff --git a/spec/dummy/config/application.rb b/spec/dummy/config/application.rb index abc1234..def5678 100644 --- a/spec/dummy/config/application.rb +++ b/spec/dummy/config/application.rb @@ -1,15 +1,15 @@ require File.expand_path('../boot', __FILE__) # Pick the frameworks you want: -require "active_record/railtie" -require "action_controller/railtie" -require "action_mailer/railtie" -require "action_view/railtie" -require "sprockets/railtie" +require 'active_record/railtie' +require 'action_controller/railtie' +require 'action_mailer/railtie' +require 'action_view/railtie' +require 'sprockets/railtie' # require "rails/test_unit/railtie" Bundler.require(*Rails.groups) -require "udongo" +require 'udongo' module Dummy class Application < Rails::Application
Use single quotes for requiring files.
diff --git a/spec/helpers/methods_examples.rb b/spec/helpers/methods_examples.rb index abc1234..def5678 100644 --- a/spec/helpers/methods_examples.rb +++ b/spec/helpers/methods_examples.rb @@ -38,7 +38,7 @@ it 'should raise an undefined method error (without the _async)' do ex = (begin; subject.send("some_method_async"); rescue => e; e end) - ex.message.should match(/undefined method \`some_method_async\' for/) + ex.message.should match(/undefined method \`some_method_async\'/) end end end
Change exception expectation message for rbx compatibility.
diff --git a/spec/requests/user_pages_spec.rb b/spec/requests/user_pages_spec.rb index abc1234..def5678 100644 --- a/spec/requests/user_pages_spec.rb +++ b/spec/requests/user_pages_spec.rb @@ -17,6 +17,7 @@ it { should have_title(user_title(user.name)) } it { should have_content(user.name) } + it { should have_content(user.email) } end end
Add lc_email to initial entry (John Glenn)
diff --git a/app/lib/mock_aws_s3.rb b/app/lib/mock_aws_s3.rb index abc1234..def5678 100644 --- a/app/lib/mock_aws_s3.rb +++ b/app/lib/mock_aws_s3.rb @@ -4,28 +4,27 @@ @key = key end - VALID_KEYS = [ - 'demo-student-photo-small-172x207.jpg', - 'demo-student-photo-large-308x364.jpg', - ] - def body - # Validate strictly here because in general we don't want to send paths - # that include variables down to the filesystem. Even though this is a Mock - # object that will only be used in development/demo environments. - raise 'Invalid mock S3 object!' unless VALID_KEYS.include?(@key) - - MockObjectBody.new("#{Rails.root}/public/#{@key}") + MockObjectBody.new(@key) end end class MockObjectBody - def initialize(path) - @path = path + def initialize(key) + @key = key end + SMALL_PHOTO = 'demo-student-photo-small-172x207.jpg' + LARGE_PHOTO = 'demo-student-photo-large-308x364.jpg' + def read - File.read(@path) + if @key == SMALL_PHOTO + File.read("#{Rails.root}/public/#{SMALL_PHOTO}") + elsif @key == LARGE_PHOTO + File.read("#{Rails.root}/public/#{LARGE_PHOTO}") + else + raise 'Invalid mock S3 object!' + end end end
Refactor MockAwsS3 to be more protective of the filesystem, even in dev/test envs
diff --git a/lib/watch_tower/server/extensions/improved_partials.rb b/lib/watch_tower/server/extensions/improved_partials.rb index abc1234..def5678 100644 --- a/lib/watch_tower/server/extensions/improved_partials.rb +++ b/lib/watch_tower/server/extensions/improved_partials.rb @@ -4,30 +4,34 @@ module ImprovedPartials def self.included(base) - base.extend ClassMethods + base.send :include, InstanceMethods end - module ClassMethods - # Render a partial with support for collections - # - # stolen from http://github.com/cschneid/irclogger/blob/master/lib/partials.rb - # and made a lot more robust by Sam Elliott <sam@lenary.co.uk> - # https://gist.github.com/119874 - # - # @param [Symbol] The template to render - # @param [Hash] Options - def partial(template, *args) - template_array = template.to_s.split('/') - template = template_array[0..-2].join('/') + "/_#{template_array[-1]}" - options = args.last.is_a?(Hash) ? args.pop : {} - options.merge!(:layout => false) - if collection = options.delete(:collection) then - collection.inject([]) do |buffer, member| - buffer << haml(:"#{template}", options.merge(:layout => - false, :locals => {template_array[-1].to_sym => member})) - end.join("\n") - else - haml(:"#{template}", options) + module InstanceMethods + + # Define partial as a helper + helpers do + # Render a partial with support for collections + # + # stolen from http://github.com/cschneid/irclogger/blob/master/lib/partials.rb + # and made a lot more robust by Sam Elliott <sam@lenary.co.uk> + # https://gist.github.com/119874 + # + # @param [Symbol] The template to render + # @param [Hash] Options + def partial(template, *args) + template_array = template.to_s.split('/') + template = template_array[0..-2].join('/') + "/_#{template_array[-1]}" + options = args.last.is_a?(Hash) ? args.pop : {} + options.merge!(:layout => false) + if collection = options.delete(:collection) then + collection.inject([]) do |buffer, member| + buffer << haml(:"#{template}", options.merge(:layout => + false, :locals => {template_array[-1].to_sym => member})) + end.join("\n") + else + haml(:"#{template}", options) + end end end end
App/Extensions: Fix the definition of partial.
diff --git a/config/initializers/opbeat.rb b/config/initializers/opbeat.rb index abc1234..def5678 100644 --- a/config/initializers/opbeat.rb +++ b/config/initializers/opbeat.rb @@ -0,0 +1,9 @@+if Rails.env.production? + require "opbeat" + # set up an Opbeat configuration + Opbeat.configure do |config| + config.organization_id = ENV["OPBEAT_ORG_ID"] + config.app_id = ENV["OPBEAT_APP_ID"] + config.secret_token = ENV["OPBEAT_SECRET"] + end +end
Revert old configuration way, load only on production
diff --git a/config/initializers/stripe.rb b/config/initializers/stripe.rb index abc1234..def5678 100644 --- a/config/initializers/stripe.rb +++ b/config/initializers/stripe.rb @@ -1,6 +1,6 @@ Rails.configuration.stripe = { - :publishable_key => ENV['STRIPE_PUBLISHABLE_KEY'], - :secret_key => ENV['STRIPE_SECRET_KEY'] + :publishable_key => ENV['STRIPE_TEST_PUBLISHABLE_KEY'], + :secret_key => ENV['STRIPE_TEST_SECRET_KEY'] } Stripe.api_key = Rails.configuration.stripe[:secret_key]
Switch API keys to actually use the test keys
diff --git a/core/spec/models/spree/return_item/eligibility_validator/time_since_purchase_spec.rb b/core/spec/models/spree/return_item/eligibility_validator/time_since_purchase_spec.rb index abc1234..def5678 100644 --- a/core/spec/models/spree/return_item/eligibility_validator/time_since_purchase_spec.rb +++ b/core/spec/models/spree/return_item/eligibility_validator/time_since_purchase_spec.rb @@ -1,30 +1,35 @@ require 'rails_helper' RSpec.describe Spree::ReturnItem::EligibilityValidator::TimeSincePurchase, type: :model do - let(:inventory_unit) { create(:inventory_unit, shipment: create(:shipped_order).shipments.first) } - let(:return_item) { create(:return_item, inventory_unit: inventory_unit) } - let(:validator) { Spree::ReturnItem::EligibilityValidator::TimeSincePurchase.new(return_item) } + include ActiveSupport::Testing::TimeHelpers + + let(:return_item) { instance_double(Spree::ReturnItem) } + let(:validator) { described_class.new(return_item) } describe "#eligible_for_return?" do subject { validator.eligible_for_return? } + let(:interval) { Spree::Config[:return_eligibility_number_of_days] } + + before do + allow(return_item). + to receive_message_chain('inventory_unit.order.completed_at'). + and_return(completed_at) + end + + around(:each) do |e| + travel_to(Time.current) { e.run } + end + context "it is within the return timeframe" do - it "returns true" do - completed_at = return_item.inventory_unit.order.completed_at - (Spree::Config[:return_eligibility_number_of_days].days / 2) - return_item.inventory_unit.order.update_attributes(completed_at: completed_at) - expect(subject).to be true - end + let(:completed_at) { 1.day.ago } + it { is_expected.to be_truthy } end context "it is past the return timeframe" do - before do - completed_at = return_item.inventory_unit.order.completed_at - Spree::Config[:return_eligibility_number_of_days].days - 1.day - return_item.inventory_unit.order.update_attributes(completed_at: completed_at) - end + let(:completed_at) { interval.day.ago } - it "returns false" do - expect(subject).to be false - end + it { is_expected.to be_falsy } it "sets an error" do subject
Test TimeSincePurchaseSpec without the database This spec previously took 1 full second to run because of the objects being unnecessarily persisted. This implements the same specs in memory to speed up the test
diff --git a/templates/app_generators/test_engineering/test_block/lib_dev/dut.rb b/templates/app_generators/test_engineering/test_block/lib_dev/dut.rb index abc1234..def5678 100644 --- a/templates/app_generators/test_engineering/test_block/lib_dev/dut.rb +++ b/templates/app_generators/test_engineering/test_block/lib_dev/dut.rb @@ -18,7 +18,7 @@ end def instantiate_sub_blocks(options) - sub_block :arm_debug, class_name: 'OrigenARMDebug::Driver', aps: { mem_ap: 0x0, mdmap: 0x0100_0000 } + sub_block :arm_debug, class_name: 'OrigenARMDebug::Driver', mem_aps: { mem_ap: 0x0, mdmap: 0x0100_0000 } sub_block :<%= options[:sub_block_name] %>, class_name: '<%= @namespace %>::<%= options[:class_name] %>', base_address: 0x1000_0000 end end
Update to latest arm_debug driver requirements
diff --git a/config/initializers/clearance.rb b/config/initializers/clearance.rb index abc1234..def5678 100644 --- a/config/initializers/clearance.rb +++ b/config/initializers/clearance.rb @@ -5,7 +5,6 @@ config.allow_sign_up = false config.mailer_sender = ENV["MAILGUN_FROM_EMAIL"] config.sign_in_guards = [SignInGuards::IsTeamMemberGuard, SignInGuards::NotDeletedGuard] + # Allow cookies to work across all subdomains '.openhq.io' + config.cookie_domain = "." + URI.parse(Rails.application.secrets.application_url).host end - -# Clearance::PasswordsController.layout 'auth' -# Clearance::SessionsController.layout 'auth'
Allow cookies to work across all domains
diff --git a/config/initializers/cloudfuji.rb b/config/initializers/cloudfuji.rb index abc1234..def5678 100644 --- a/config/initializers/cloudfuji.rb +++ b/config/initializers/cloudfuji.rb @@ -2,7 +2,7 @@ Errbit::Application.configure do # Register observers to fire Cloudfuji events - config.mongoid.observers = :cloudfuji_notice_observer + (config.mongoid.observers ||= []) << :cloudfuji_notice_observer # Set default host for ActionMailer default_host = ENV['ERRBIT_HOST'] || ENV['BUSHIDO_DOMAIN']
Extend original observers, instead of overwriting
diff --git a/pages/lib/generators/refinery/pages/pages_generator.rb b/pages/lib/generators/refinery/pages/pages_generator.rb index abc1234..def5678 100644 --- a/pages/lib/generators/refinery/pages/pages_generator.rb +++ b/pages/lib/generators/refinery/pages/pages_generator.rb @@ -5,6 +5,17 @@ def generate_pages_initializer template "config/initializers/refinery_pages.rb.erb", File.join(destination_root, "config", "initializers", "refinery_pages.rb") end + + def append_load_seed_data + create_file "db/seeds.rb" unless File.exists?(File.join(destination_root, 'db', 'seeds.rb')) + append_file 'db/seeds.rb', :verbose => true do + <<-EOH + +# Added by RefineryCMS Pages engine +Refinery::Pages::Engine.load_seed + EOH + end + end end end
Use rails way to load seed data from pages engine
diff --git a/Template/{PROJECT}.podspec b/Template/{PROJECT}.podspec index abc1234..def5678 100644 --- a/Template/{PROJECT}.podspec +++ b/Template/{PROJECT}.podspec @@ -3,6 +3,7 @@ s.version = "0.1" s.summary = "" s.description = <<-DESC +Your description here. DESC s.homepage = "{URL}" s.license = { :type => "MIT", :file => "LICENSE" } @@ -12,7 +13,7 @@ s.osx.deployment_target = "10.9" s.watchos.deployment_target = "2.0" s.tvos.deployment_target = "9.0" - s.source = { :git => "{URL}.git", :tag => "0.1" } + s.source = { :git => "{URL}.git", :tag => s.version.to_s } s.source_files = "Sources/**/*" s.frameworks = "Foundation" end
Add description placeholder and reuse version str
diff --git a/recipes/sevenscale_deploy/github.rb b/recipes/sevenscale_deploy/github.rb index abc1234..def5678 100644 --- a/recipes/sevenscale_deploy/github.rb +++ b/recipes/sevenscale_deploy/github.rb @@ -0,0 +1,21 @@+namespace :github do + namespace :pending do + desc 'Display pending changes ready to be deployed in a browser' + task :default do + if m = repository.match(/github.com:(.*)\.git$/) + system 'open', "http://github.com/#{m[1]}/compare/#{current_revision[0..8]}...#{branch}" + else + raise "The current repository '#{repository}' is not hosted on github" + end + end + + desc 'Display pending changes in master in a browser' + task :master do + if m = repository.match(/github.com:(.*)\.git$/) + system 'open', "http://github.com/#{m[1]}/compare/#{current_revision[0..8]}...master" + else + raise "The current repository '#{repository}' is not hosted on github" + end + end + end +end
Add task to show the changes ready to be deployed.
diff --git a/lib/puppet/provider/rabbitmq_plugin/rabbitmqplugins.rb b/lib/puppet/provider/rabbitmq_plugin/rabbitmqplugins.rb index abc1234..def5678 100644 --- a/lib/puppet/provider/rabbitmq_plugin/rabbitmqplugins.rb +++ b/lib/puppet/provider/rabbitmq_plugin/rabbitmqplugins.rb @@ -21,8 +21,8 @@ defaultfor :feature => :posix def self.instances - rabbitmqplugins('list', '-E').split(/\n/).map do |line| - if line.split(/\s+/)[1] =~ /^(\S+)$/ + rabbitmqplugins('list', '-E', '-m').split(/\n/).map do |line| + if line =~ /^(\S+)$/ new(:name => $1) else raise Puppet::Error, "Cannot parse invalid plugins line: #{line}" @@ -39,8 +39,8 @@ end def exists? - rabbitmqplugins('list', '-E').split(/\n/).detect do |line| - line.split(/\s+/)[1].match(/^#{resource[:name]}$/) + rabbitmqplugins('list', '-E', '-m').split(/\n/).detect do |line| + line.match(/^#{resource[:name]}$/) end end
Use -m flag on rabbitmq-plugins command for managing rabbitmq_plugin resources Use the -m flag for calls to the rabbitmq-plugins command, which enables minimal output mode. This is much easier and more reliable to parse. Fixes an issue under RMQ 3.4.0 where rabbitmq_plugin resources were being enabled on every Puppet run, even though they are already enabled.
diff --git a/SIGS/app/controllers/administrative_assistant_controller.rb b/SIGS/app/controllers/administrative_assistant_controller.rb index abc1234..def5678 100644 --- a/SIGS/app/controllers/administrative_assistant_controller.rb +++ b/SIGS/app/controllers/administrative_assistant_controller.rb @@ -16,13 +16,24 @@ def destroy @administrative_assistant = AdministrativeAssistant.find(params[:id]) @user = User.find(@administrative_assistant.user_id) - @user.destroy + + @administrative_assistant = AdministrativeAssistant.all + if @administrative_assistant.count > 1 + @administrative_assistant.destroy + @user.destroy + redirect_to destroy_path + else + redirect_to index_path(@administrative_assistant.id) + end end def enable + @user = User.find(:id) + @user.active = true end def approve_registration + @user = User.find_by(active: false) end def approve_allocation @@ -33,6 +44,7 @@ end def view_users + end def edit_users
Add methods destroy aprove_regisration enable
diff --git a/core/errno/eagain_spec.rb b/core/errno/eagain_spec.rb index abc1234..def5678 100644 --- a/core/errno/eagain_spec.rb +++ b/core/errno/eagain_spec.rb @@ -0,0 +1,12 @@+require File.expand_path('../../../spec_helper', __FILE__) + +describe "Errno::EAGAIN" do + # From http://jira.codehaus.org/browse/JRUBY-4747 + it "is the same class as Errno::EWOULDBLOCK if they represent the same errno value" do + if Errno::EAGAIN::Errno == Errno::EWOULDBLOCK::Errno + Errno::EAGAIN.should == Errno::EWOULDBLOCK + else + Errno::EAGAIN.should_not == Errno::EWOULDBLOCK + end + end +end
Add a spec to confirm that Errno::EAGAIN is used for EWOULDBLOCK when appropriate
diff --git a/tasks/git.rake b/tasks/git.rake index abc1234..def5678 100644 --- a/tasks/git.rake +++ b/tasks/git.rake @@ -18,7 +18,7 @@ msg = "Tag release v#{version}" msg << "\n\n" unless issues.empty? - msg << "References:#{issues.uniq.sort.join(', ')}" + msg << "References: #{issues.uniq.sort.join(', ')}" msg << "\n\n" end msg << `rake changelog:latest`
Format update for release message.
diff --git a/db/migrate/20211015074811_add_klarna_customer_token_to_spree_user.rb b/db/migrate/20211015074811_add_klarna_customer_token_to_spree_user.rb index abc1234..def5678 100644 --- a/db/migrate/20211015074811_add_klarna_customer_token_to_spree_user.rb +++ b/db/migrate/20211015074811_add_klarna_customer_token_to_spree_user.rb @@ -0,0 +1,7 @@+# frozen_string_literal: true + +class AddKlarnaCustomerTokenToSpreeUser < ActiveRecord::Migration[5.2] + def change + add_column :spree_users, :klarna_customer_token, :string + end +end
Add the customer_token col to the user table This column is needed to store the fetched customer token. The customer token will be used to place future orders.
diff --git a/ruby/command-t/lib/command-t/scanner/buffer_scanner.rb b/ruby/command-t/lib/command-t/scanner/buffer_scanner.rb index abc1234..def5678 100644 --- a/ruby/command-t/lib/command-t/scanner/buffer_scanner.rb +++ b/ruby/command-t/lib/command-t/scanner/buffer_scanner.rb @@ -8,14 +8,10 @@ include PathUtilities def paths - (0..(::VIM::Buffer.count - 1)).map do |n| - buffer = ::VIM::Buffer[n] - # Beware, name may be nil, and on Neovim unlisted buffers (like - # Command-T's match listing itself) will be returned and must be - # skipped. - if buffer.name && ::VIM::evaluate("buflisted(#{buffer.number})") != 0 - relative_path_under_working_directory buffer.name - end + VIM.capture('silent ls').scan(/\n\s*(\d+)[^\n]+/).map do |n| + number = n[0].to_i + name = ::VIM.evaluate("bufname(#{number})") + relative_path_under_working_directory(name) unless name == '' end.compact end end
Work around pathologically slow buffer scanning in Neovim In Neovim, unlisted buffers are returned to the Ruby layer. If you run Ferret's :Ack, for example, you might find yourself with a large number of those (as `:h unlisted-buffer` says, Vim uses these to track things like file names). As such, it is too easy to wind up with a *huge* number of unlisted buffers, and the scanner takes forever. This is exacerbated by the scanner being called on every keypress. Fix the slow processing by avoiding use of `VIM::Buffer` entirely, and instead call out to native Vim commands. This alone makes it usable again. In a follow-up commit I'll do the "right" thing and make it not call the scanner repeatedly during a single invocation.
diff --git a/spec/models/layout_spec.rb b/spec/models/layout_spec.rb index abc1234..def5678 100644 --- a/spec/models/layout_spec.rb +++ b/spec/models/layout_spec.rb @@ -1,29 +1,30 @@ require File.dirname(__FILE__) + '/../spec_helper' describe Layout do - #dataset :layouts - test_helper :validations - before :each do - @layout = @model = Layout.new(layout_params) - end + let(:layout){ FactoryGirl.build(:layout) } - it 'should validate presence of' do - assert_valid :name, 'Just a Test' - assert_invalid :name, 'this must not be blank', nil, '', ' ' - end + describe 'name' do + it 'is invalid when blank' do + expect(layout.errors_on(:name)).to be_blank + layout.name = '' + expect(layout.errors_on(:name)).to include("this must not be blank") + end - it 'should validate uniqueness of' do - assert_invalid :name, 'this name is already in use', 'Main' - assert_valid :name, 'Something Else' - end + it 'should validate uniqueness of' do + layout.save! + other = FactoryGirl.build(:layout) + expect{other.save!}.to raise_error(ActiveRecord::RecordInvalid) + other.name = 'Something Else' + expect(other.errors_on(:name)).to be_blank + end - it 'should validate length of' do - { - :name => 100 - }.each do |field, max| - assert_invalid field, ('this must not be longer than %d characters' % max), 'x' * (max + 1) - assert_valid field, 'x' * max + it 'should validate length of' do + layout.name = 'x' * 100 + expect(layout.errors_on(:name)).to be_blank + layout.name = 'x' * 101 + expect{layout.save!}.to raise_error(ActiveRecord::RecordInvalid) + expect(layout.errors_on(:name)).to include("this must not be longer than 100 characters") end end end
Rewrite model spec w/o validations_helper
diff --git a/YumiUnitySDK/2.0.0/YumiUnitySDK.podspec b/YumiUnitySDK/2.0.0/YumiUnitySDK.podspec index abc1234..def5678 100644 --- a/YumiUnitySDK/2.0.0/YumiUnitySDK.podspec +++ b/YumiUnitySDK/2.0.0/YumiUnitySDK.podspec @@ -20,7 +20,7 @@ s.ios.deployment_target = "7.0" - s.source = { :http => "http://ad-sdk.oss-cn-beijing.aliyuncs.com/iOS/Unity_SDK_v#{s.version}.zip" } + s.source = { :http => "http://adsdk.yumimobi.com/iOS/Unity_SDK_v#{s.version}.zip" } src_root = "Unity_SDK_v#{s.version}/lib" s.vendored_frameworks = "#{src_root}/UnityAds.framework"
Update unity sdk source to use cdn
diff --git a/app/models/course/video.rb b/app/models/course/video.rb index abc1234..def5678 100644 --- a/app/models/course/video.rb +++ b/app/models/course/video.rb @@ -6,7 +6,8 @@ after_initialize :set_defaults, if: :new_record? - has_many :submissions, inverse_of: :video, dependent: :destroy + has_many :submissions, class_name: Course::Video::Submission.name, + inverse_of: :video, dependent: :destroy def self.use_relative_model_naming? true
Define a more verbose association, also to circumvent circular dependency issue while loading in production
diff --git a/app/models/geo_activity.rb b/app/models/geo_activity.rb index abc1234..def5678 100644 --- a/app/models/geo_activity.rb +++ b/app/models/geo_activity.rb @@ -10,7 +10,7 @@ field :country_code, type: String field :city, type: String - validates_presence_of :id, :dates, :loc, :country_code, :city + validates_presence_of :id, :dates, :loc, :country_code def self.record(ip: nil, user: nil) date = DateTime.current.utc.to_date.to_s
Allow city to be missing.
diff --git a/app/models/registration.rb b/app/models/registration.rb index abc1234..def5678 100644 --- a/app/models/registration.rb +++ b/app/models/registration.rb @@ -2,5 +2,5 @@ belongs_to :user belongs_to :event - PAYMENT_TYPE = ['Cash','Check'] + PAYMENT_TYPE = [['Cash',1],['Check',2]] end
Add id value to PAYMENT_TYPE
diff --git a/app/models/user_profile.rb b/app/models/user_profile.rb index abc1234..def5678 100644 --- a/app/models/user_profile.rb +++ b/app/models/user_profile.rb @@ -9,6 +9,6 @@ def generate_picture_path hash = Digest::SHA1.file(picture.path).hexdigest - "attachments/user_profile/#{hash[0..6]}/#{hash}" + "profile_pictures/#{hash[0..2]}/#{hash[3..5]}/#{hash}" end end
Reduce profile picture path size and make safe. * 16^3 directory entries is well within FS limits. * DragonFly root path means "attachments" is not needed. * Give path a more relevant name.
diff --git a/spec/classes/apache_spec.rb b/spec/classes/apache_spec.rb index abc1234..def5678 100644 --- a/spec/classes/apache_spec.rb +++ b/spec/classes/apache_spec.rb @@ -8,7 +8,7 @@ it { should include_class("apache::params") } it { should contain_package("httpd") } it { should contain_service("httpd").with( - 'ensure' => 'running', + 'ensure' => 'true', 'enable' => 'true', 'subscribe' => 'Package[httpd]' ) @@ -29,7 +29,7 @@ it { should include_class("apache::params") } it { should contain_package("httpd") } it { should contain_service("httpd").with( - 'ensure' => 'running', + 'ensure' => 'true', 'enable' => 'true', 'subscribe' => 'Package[httpd]' )
Update spec tests to expect boolean
diff --git a/webhookr-mandrill.gemspec b/webhookr-mandrill.gemspec index abc1234..def5678 100644 --- a/webhookr-mandrill.gemspec +++ b/webhookr-mandrill.gemspec @@ -19,12 +19,5 @@ gem.add_dependency("webhookr") gem.add_dependency("activesupport", ["~> 3.1"]) - # Until the latest version gets to Rubygems - # gem.add_dependency("recursive-open-struct") - gem.add_development_dependency("rake") - gem.add_development_dependency("minitest") - gem.add_development_dependency("guard") - gem.add_development_dependency("guard-minitest") - gem.add_development_dependency("rb-fsevent") end
Remove comments and dev dependencies
diff --git a/db/migrate/20141111164439_create_storytime_subscriptions.rb b/db/migrate/20141111164439_create_storytime_subscriptions.rb index abc1234..def5678 100644 --- a/db/migrate/20141111164439_create_storytime_subscriptions.rb +++ b/db/migrate/20141111164439_create_storytime_subscriptions.rb @@ -3,7 +3,7 @@ create_table :storytime_subscriptions do |t| t.string :email t.boolean :subscribed, default: true - t.token :string, index: true + t.string :token, index: true t.timestamps end
Fix syntax in subscription migration
diff --git a/phare.gemspec b/phare.gemspec index abc1234..def5678 100644 --- a/phare.gemspec +++ b/phare.gemspec @@ -7,7 +7,7 @@ spec.name = 'phare' spec.version = Phare::VERSION spec.authors = ['Rémi Prévost'] - spec.email = ['remi@exomel.com'] + spec.email = ['rprevost@mirego.com'] spec.description = 'Phare looks into your files and check for (Ruby, JavaScript and SCSS) coding style errors.' spec.summary = spec.description spec.homepage = 'https://github.com/mirego/phare'
Fix my own email in gemspec
diff --git a/config/initializers/csp.rb b/config/initializers/csp.rb index abc1234..def5678 100644 --- a/config/initializers/csp.rb +++ b/config/initializers/csp.rb @@ -5,8 +5,8 @@ *.hatena.ne.jp *.st-hatena.com *.slidesharecdn.com *.slideshare.net) config.csp = { - report_only: Rails.env.production?, # default: false - preserve_schemes: true, # default: false. + report_only: false, + preserve_schemes: true, # default: false default_src: src, script_src: src,
Set report_only to 'false' in CSP
diff --git a/omnibus/config/projects/opscode-push-jobs-server.rb b/omnibus/config/projects/opscode-push-jobs-server.rb index abc1234..def5678 100644 --- a/omnibus/config/projects/opscode-push-jobs-server.rb +++ b/omnibus/config/projects/opscode-push-jobs-server.rb @@ -22,6 +22,7 @@ build_version Omnibus::BuildVersion.full build_iteration "1" +runtime_dependencies [ "private-chef" ] deps = [] # global
Add private-chef as runtime dependency
diff --git a/config/tire.rb b/config/tire.rb index abc1234..def5678 100644 --- a/config/tire.rb +++ b/config/tire.rb @@ -8,3 +8,8 @@ config = es_config[APP_ENV] Tire::Model::Search.index_prefix config["index_prefix"] + +Tire.configure do + logger File.expand_path(config["log"], APP_ROOT) if config["log"] + url config["url"] if config["url"] +end
deploy: Configure ES url and log
diff --git a/lib/cb/utils/validator.rb b/lib/cb/utils/validator.rb index abc1234..def5678 100644 --- a/lib/cb/utils/validator.rb +++ b/lib/cb/utils/validator.rb @@ -14,7 +14,7 @@ begin json = JSON.parse(response.response.body) - if json[json.keys[0]].empty? + if json.keys.any? && json[json.keys[0]].empty? return false end rescue JSON::ParserError
Check if keys exist before accessing
diff --git a/app/controllers/downloads_controller.rb b/app/controllers/downloads_controller.rb index abc1234..def5678 100644 --- a/app/controllers/downloads_controller.rb +++ b/app/controllers/downloads_controller.rb @@ -27,8 +27,8 @@ @platform = 'windows' if @platform == 'win' if @platform == 'windows' || @platform == 'mac' if @platform == 'windows' - @project_url = "https://msysgit.github.io/" - @source_url = "https://github.com/msysgit/git/" + @project_url = "https://git-for-windows.github.io/" + @source_url = "https://github.com/git-for-windows/git" else @project_url = "http://sourceforge.net/projects/git-osx-installer/" @source_url = "https://github.com/git/git/"
Update project & source URL from MSysGit to Git for Windows.
diff --git a/app/controllers/libraries_controller.rb b/app/controllers/libraries_controller.rb index abc1234..def5678 100644 --- a/app/controllers/libraries_controller.rb +++ b/app/controllers/libraries_controller.rb @@ -4,8 +4,8 @@ end def search - s = params[:search] - @query = s[:query] - @results = Library::Item.find_with_index(@query) + @items = Library::Item.find_with_index(params[:query]) + @items = Library::ItemDecorator.decorate(@items) + render :show end end
Update library search to render same page.
diff --git a/app/controllers/questions_controller.rb b/app/controllers/questions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/questions_controller.rb +++ b/app/controllers/questions_controller.rb @@ -22,7 +22,6 @@ end def show - @question = Question.find(params[:id]) end def edit
Remove unnecessary local variable from questions controller
diff --git a/MTLParseAdapter.podspec b/MTLParseAdapter.podspec index abc1234..def5678 100644 --- a/MTLParseAdapter.podspec +++ b/MTLParseAdapter.podspec @@ -1,28 +1,16 @@-# -# Be sure to run `pod lib lint MTLParseAdapter.podspec' to ensure this is a -# valid spec and remove all comments before submitting the spec. -# -# Any lines starting with a # are optional, but encouraged -# -# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html -# - Pod::Spec.new do |s| s.name = "MTLParseAdapter" s.version = "0.1.0" - s.summary = "A short description of MTLParseAdapter." + s.summary = "Easily convert your objects to and from Parse PFObjects" s.description = <<-DESC - An optional longer description of MTLParseAdapter - - * Markdown format. - * Don't worry about the indent, we strip it! + This library provides an interface to convert + objects that conform to MTLJSONSerializing to and + from PFObjects provided by the Parse SDK. DESC - s.homepage = "https://github.com/<GITHUB_USERNAME>/MTLParseAdapter" - # s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2" + s.homepage = "https://github.com/lazerwalker/MTLParseAdapter" s.license = 'MIT' s.author = { "Mike Walker" => "michael@lazerwalker.com" } - s.source = { :git => "https://github.com/<GITHUB_USERNAME>/MTLParseAdapter.git", :tag => s.version.to_s } - # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>' + s.source = { :git => "https://github.com/lazerwalker/MTLParseAdapter.git", :tag => s.version.to_s } s.platform = :ios, '7.0' s.requires_arc = true @@ -32,7 +20,7 @@ 'MTLParseAdapter' => ['Pod/Assets/*.png'] } - # s.public_header_files = 'Pod/Classes/**/*.h' - # s.frameworks = 'UIKit', 'MapKit' - # s.dependency 'AFNetworking', '~> 2.3' + s.public_header_files = 'Pod/Classes/**/*.h' + s.dependency 'Mantle', '~> 1.5' + s.dependency 'Parse', '~> 1.6' end
Update podspec to have more information
diff --git a/fuubar.gemspec b/fuubar.gemspec index abc1234..def5678 100644 --- a/fuubar.gemspec +++ b/fuubar.gemspec @@ -27,6 +27,6 @@ s.executables = Dir.glob("bin/*").map{ |f| File.basename(f) } s.require_paths = ['lib'] - s.add_dependency 'rspec', '~> 2.0' + s.add_dependency 'rspec', ['>= 2.14.0', '< 3.1.0'] s.add_dependency 'ruby-progressbar', '~> 1.3' end
Update RSpec dependency to work with RSpec 3.0
diff --git a/examples/galena/lib/galena/tissue/migration/frozen_shims.rb b/examples/galena/lib/galena/tissue/migration/frozen_shims.rb index abc1234..def5678 100644 --- a/examples/galena/lib/galena/tissue/migration/frozen_shims.rb +++ b/examples/galena/lib/galena/tissue/migration/frozen_shims.rb @@ -11,7 +11,7 @@ # @param (see CaRuby::Migratable#migrate) def migrate(row, migrated) super - find or StorageContainer.create_galena_box + find or create_galena_box end private @@ -20,14 +20,19 @@ # {Galena::Seed::Defaults#freezer_type}. # # @return [StorageContainer] the new box - def self.create_galena_box + def create_galena_box defs = Galena::Seed.defaults - self.storage_type = defs.box_type - site = defs.tissue_bank + # the box container type + self.container_type = defs.box_type + # the required box site + self.site = defs.tissue_bank # A freezer with a slot for the box. frz = defs.freezer_type.find_available(site, :create) - # Add this box to the first open slot in the first unfilled rack in the freezer. + # Add the box to the first open slot in the first unfilled rack in the freezer. frz << self + logger.debug { "Placed the tissue box #{self} in freezer #{frz}." } + logger.debug { "Creating the tissue box #{self}..." } + create end end end
Set the Galena box site and container type.
diff --git a/activerecord/test/cases/arel/collectors/bind_test.rb b/activerecord/test/cases/arel/collectors/bind_test.rb index abc1234..def5678 100644 --- a/activerecord/test/cases/arel/collectors/bind_test.rb +++ b/activerecord/test/cases/arel/collectors/bind_test.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require_relative "../helper" +require "arel/collectors/bind" module Arel module Collectors
Address `NameError: uninitialized constant Arel::Collectors::Bind` when tested with Ruby 2.5 or higher ```ruby $ ruby -v ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux] $ bundle exec ruby -w -Itest test/cases/arel/collectors/bind_test.rb -n test_compile_gathers_all_bind_params Run options: -n test_compile_gathers_all_bind_params --seed 24420 E Error: Arel::Collectors::TestBind#test_compile_gathers_all_bind_params: NameError: uninitialized constant Arel::Collectors::Bind Did you mean? Binding test/cases/arel/collectors/bind_test.rb:15:in `collect' test/cases/arel/collectors/bind_test.rb:19:in `compile' test/cases/arel/collectors/bind_test.rb:31:in `test_compile_gathers_all_bind_params' bin/rails test test/cases/arel/collectors/bind_test.rb:30 Finished in 0.002343s, 426.8559 runs/s, 0.0000 assertions/s. 1 runs, 0 assertions, 0 failures, 1 errors, 0 skips $ ``` It is likely due to Ruby 2.5 does not look up top level constant. https://www.ruby-lang.org/en/news/2017/12/25/ruby-2-5-0-released/ "Top-level constant look-up is no longer available."
diff --git a/app/workers/concerns/waitable_worker.rb b/app/workers/concerns/waitable_worker.rb index abc1234..def5678 100644 --- a/app/workers/concerns/waitable_worker.rb +++ b/app/workers/concerns/waitable_worker.rb @@ -3,7 +3,7 @@ module ClassMethods # Schedules multiple jobs and waits for them to be completed. - def bulk_perform_and_wait(args_list) + def bulk_perform_and_wait(args_list, timeout: 10) # Short-circuit: it's more efficient to do small numbers of jobs inline return bulk_perform_inline(args_list) if args_list.size <= 3 @@ -14,7 +14,7 @@ waiting_args_list = args_list.map { |args| [*args, waiter.key] } bulk_perform_async(waiting_args_list) - waiter.wait + waiter.wait(timeout) end # Performs multiple jobs directly. Failed jobs will be put into sidekiq so
Allow bulk_perform_and_wait wait timeout to be overridden
diff --git a/config/software/fluentd.rb b/config/software/fluentd.rb index abc1234..def5678 100644 --- a/config/software/fluentd.rb +++ b/config/software/fluentd.rb @@ -9,9 +9,11 @@ relative_path "fluentd" build do + env = with_standard_compiler_flags(with_embedded_path) + Dir.glob(File.expand_path(File.join(Omnibus::Config.project_root, 'core_gems', '*.gem'))).sort.each { |gem_path| - gem "install --no-ri --no-rdoc #{gem_path}" + gem "install --no-ri --no-rdoc #{gem_path}", env: env } - rake "build" - gem "install --no-ri --no-rdoc pkg/fluentd-*.gem" + rake "build", env: env + gem "install --no-ri --no-rdoc pkg/fluentd-*.gem", env: env end
Add env to each command
diff --git a/app/controllers/islay_blog/public/blog_controller.rb b/app/controllers/islay_blog/public/blog_controller.rb index abc1234..def5678 100644 --- a/app/controllers/islay_blog/public/blog_controller.rb +++ b/app/controllers/islay_blog/public/blog_controller.rb @@ -13,6 +13,7 @@ @blog_entry = BlogEntry.public_summary.active.find(params[:id]) @comment = BlogComment.new(:blog_entry_id => @blog_entry.id) if @comment.update_attributes(params[:blog_comment]) + flash[:comment_added] = "Your comment has been added" redirect_to path(@blog_entry) else render :entry
Add confirmation of a new comment to the flash.
diff --git a/lib/mountebank/network.rb b/lib/mountebank/network.rb index abc1234..def5678 100644 --- a/lib/mountebank/network.rb +++ b/lib/mountebank/network.rb @@ -32,11 +32,11 @@ end def self.mountebank_server - !!ENV['MOUNTEBANK_SERVER'] ? ENV['MOUNTEBANK_SERVER'] : 'localhost' + ENV['MOUNTEBANK_SERVER'] || 'localhost' end def self.mountebank_server_port - !!ENV['MOUNTEBANK_PORT'] ? ENV['MOUNTEBANK_PORT'] : '2525' + ENV['MOUNTEBANK_PORT'] || '2525' end def self.mountebank_server_uri
Use different syntax as recommended by Bjorn.
diff --git a/lib/seed/configuration.rb b/lib/seed/configuration.rb index abc1234..def5678 100644 --- a/lib/seed/configuration.rb +++ b/lib/seed/configuration.rb @@ -13,7 +13,7 @@ end def schema_version - @schema_version ||= Digest::SHA1.hexdigest(ActiveRecord::Migrator.get_all_versions.sort.join) + @schema_version ||= Digest::SHA1.hexdigest(get_all_versions.sort.join) end def database_options @@ -33,5 +33,16 @@ def make_tmp_dir FileUtils.mkdir_p(base_path) unless File.exist?(base_path) end + + private + + def get_all_versions + if ::Gem::Version.new(::ActiveRecord::VERSION::STRING) >= ::Gem::Version.new('5.2') + migration_paths = ::ActiveRecord::Migrator.migrations_paths + ::ActiveRecord::MigrationContext.new(migration_paths).get_all_versions + else + ::ActiveRecord::Migrator.get_all_versions + end + end end end
Fix NoMethodError on Rails 5.2
diff --git a/lib/vagrant-lxc/plugin.rb b/lib/vagrant-lxc/plugin.rb index abc1234..def5678 100644 --- a/lib/vagrant-lxc/plugin.rb +++ b/lib/vagrant-lxc/plugin.rb @@ -8,27 +8,22 @@ The LXC provider allows Vagrant to manage and control LXC-based virtual machines. EOF - locale_loaded = false provider(:lxc, parallel: true, priority: 7) do require File.expand_path("../provider", __FILE__) - - if not locale_loaded - I18n.load_path << File.expand_path(File.dirname(__FILE__) + '/../../locales/en.yml') - I18n.reload! - locale_loaded = true - end - + init! Provider end command "lxc" do require_relative 'command/root' + init! Command::Root end config(:lxc, :provider) do require File.expand_path("../config", __FILE__) + init! Config end @@ -41,6 +36,16 @@ require_relative "provider/cap/public_address" Provider::Cap::PublicAddress end + + protected + + def self.init! + return if defined?(@_init) + I18n.load_path << File.expand_path(File.dirname(__FILE__) + '/../../locales/en.yml') + I18n.reload! + @_init = true + end + end end end
Make code similar to other providers
diff --git a/lib/redmine_project_filtering/patches/custom_field_patch.rb b/lib/redmine_project_filtering/patches/custom_field_patch.rb index abc1234..def5678 100644 --- a/lib/redmine_project_filtering/patches/custom_field_patch.rb +++ b/lib/redmine_project_filtering/patches/custom_field_patch.rb @@ -9,8 +9,10 @@ base.class_eval do unloadable named_scope( :used_for_project_filtering, lambda do |*args| - used_field_setting = Setting['plugin_redmine_project_filtering']['used_fields'] || {} - used_fields = used_field_setting.keys.collect(&:to_i) + plugin_settings = Setting['plugin_redmine_project_filtering'] + used_field_setting = Setting['plugin_redmine_project_filtering'].present? ? plugin_settings['used_fields'] : {} + used_field_hash = used_field_setting.class == Hash ? used_field_setting : {} + used_fields = used_field_hash.keys.collect(&:to_i) { :conditions => [ "custom_fields.type = 'ProjectCustomField' AND custom_fields.field_format = 'list' AND custom_fields.id IN (?)", used_fields ] }
Fix custom_field_path for been usable on new instances of chiliproject
diff --git a/spec/controllers/items_controller_spec.rb b/spec/controllers/items_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/items_controller_spec.rb +++ b/spec/controllers/items_controller_spec.rb @@ -53,4 +53,14 @@ expect(response).to redirect_to action: :index end end + + describe "POST remove_done" do + def do_remove_done + end + + it "redirect to the index" do + do_remove_done + expect(response).to redirect_to action: :index + end + end end
Add failing spec for redirect to index after remove done
diff --git a/lib/lims-laboratory-app/laboratory/create_receptacle_action_trait.rb b/lib/lims-laboratory-app/laboratory/create_receptacle_action_trait.rb index abc1234..def5678 100644 --- a/lib/lims-laboratory-app/laboratory/create_receptacle_action_trait.rb +++ b/lib/lims-laboratory-app/laboratory/create_receptacle_action_trait.rb @@ -0,0 +1,55 @@+require 'modularity' +require 'lims-laboratory-app/laboratory/receptacle' +require 'lims-laboratory-app/laboratory/sample/create_sample_shared' +require 'lims-laboratory-app/laboratory/create_labellable_resource_action' + +module Lims::LaboratoryApp + module Laboratory::Receptacle + module CreateReceptacleActionTrait + + as_trait do |args| + include Laboratory::CreateLabellableResourceAction + include Laboratory::Sample::CreateSampleShared + + attribute :aliquots, Array, :default => [] + + receptacle_name = args[:receptacle_name].to_sym + receptacle_class = args[:receptacle_class] + extra_parameters = args[:extra_parameters] || [] + + define_method(:receptacle_parameters) do + {}.tap do |p| + extra_parameters.map(&:to_sym).each do |extra| + p[extra] = self.send(extra) + end + end + end + + define_method(:create) do |session| + new_receptacle = receptacle_class.new(receptacle_parameters) + session << new_receptacle + count = 0 + if aliquots + aliquots.each do |aliquot| + # The sample uuid comes from lims-management-app, + # as a result, the sample is not present in the + # lims-laboratory-app sample table. The following + # creates a new sample with the expected uuid. + aliquot_ready = aliquot.mash do |k,v| + case k.to_s + when "sample_uuid" then + count += 1 + ["sample", create_sample(session, "Sample #{count}", v)] + else + [k,v] + end + end + new_receptacle << Laboratory::Aliquot.new(aliquot_ready) + end + end + {receptacle_name => new_receptacle, :uuid => session.uuid_for!(new_receptacle)} + end + end + end + end +end
Add create receptacle action trait
diff --git a/spec/controllers/remote_translation_controller_spec.rb b/spec/controllers/remote_translation_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/remote_translation_controller_spec.rb +++ b/spec/controllers/remote_translation_controller_spec.rb @@ -9,7 +9,7 @@ @remote_translations_params = [{ remote_translatable_id: debate.id.to_s, remote_translatable_type: debate.class.to_s, locale: :es }].to_json - allow(controller.request).to receive(:referer).and_return("any_path") + request.env["HTTP_REFERER"] = "any_path" Delayed::Worker.delay_jobs = true end
Use Rails 5 syntax to set referer in specs The previous way was working fine with Rails 4, but now the referer was returning nil and therefore raising an error in this spec.
diff --git a/spec/dummy/spec/integration/user_model_mapping_spec.rb b/spec/dummy/spec/integration/user_model_mapping_spec.rb index abc1234..def5678 100644 --- a/spec/dummy/spec/integration/user_model_mapping_spec.rb +++ b/spec/dummy/spec/integration/user_model_mapping_spec.rb @@ -6,7 +6,7 @@ let(:users) { rom.read(:users) } before do - rom.command(:users).create.call(name: 'Piotr') + rom.command(:users).try { create(name: 'Piotr') } end it 'works' do
Update spec to use .try interface
diff --git a/ruby/puppy.rb b/ruby/puppy.rb index abc1234..def5678 100644 --- a/ruby/puppy.rb +++ b/ruby/puppy.rb @@ -1,16 +1,41 @@-SPECIES ------------------------ + +=begin SPECIES ------------------------ Canis lateus amplexus +create hash CHARACTERISTICS ---------------- -Ability to hug: varies +Ability to hug: scale of 1 to 10 Friendly: yes -Eye count: 2 -Tail count: 1 -Wag_tail: varies +Tail_wag: scale of 1 to 10 +Loud_bark: scale of 1 to 10 Name: varies Color: varies +create array BEHAVIOR ----------------------- -Jump +Quiet Hug -Frisbee allstar+Frisbee all star +=end + +#defines new puppy class +class Puppy + # names the species with design + print " SPECIES:\n Canis lateus amplexus" + # prints characteristics in hash + print "\n ----------------------- \n CHARACTERISTICS \n ----------------------- \n" + pup_details = {"Hugs" => 8, + "Friendly" => true, + "Tail_wag" => 7, + "Loud_bark" => 3, + "Name" => "Monty", + "Color" => "Purple" + } + pup_details.each do |characteristic, specialty| + puts "#{characteristic}: #{specialty}" + end + # prints behavior in array + print "\n ----------------------- \n BEHAVIOR \n ----------------------- \n" + pup_behavior = ["Quiet", "Hug", "Frisbee superstar", "Snuggler"] + puts pup_behavior +end
Create Puppy class, characteristics hash and behavior array
diff --git a/resources/target.rb b/resources/target.rb index abc1234..def5678 100644 --- a/resources/target.rb +++ b/resources/target.rb @@ -1,4 +1,3 @@-property :name, String, name_property: true property :data, Array, default: [] action :create do
Remove name property from the resource Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/Casks/aluxian-messenger.rb b/Casks/aluxian-messenger.rb index abc1234..def5678 100644 --- a/Casks/aluxian-messenger.rb +++ b/Casks/aluxian-messenger.rb @@ -1,6 +1,6 @@ cask :v1 => 'aluxian-messenger' do - version '1.4.0' - sha256 'cd29d15312435952d6dba2bf65421d910a4c4f866c036e2b1f3beb3af626ac23' + version '1.4.3' + sha256 'a187cd9e704b8a6333ec7fef736b9838a04a7d983d6e35c7fb782235d59bb492' url "https://github.com/Aluxian/Facebook-Messenger-Desktop/releases/download/v#{version}/Messenger.dmg" name 'Messenger'
Update Aluxian Messenger to 1.4.3
diff --git a/capistrano-cook.gemspec b/capistrano-cook.gemspec index abc1234..def5678 100644 --- a/capistrano-cook.gemspec +++ b/capistrano-cook.gemspec @@ -22,6 +22,6 @@ "LICENSE" ] - s.add_dependency "capistrano", "~> 2.5.9" + s.add_dependency "capistrano", [">= 2.5.9", "< 3.0"] s.add_dependency "capistrano-ext", ">= 1.2.1" end
Support all versions of 2.x.x of Capistrano.