diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/signal_api/signal_http_api.rb b/lib/signal_api/signal_http_api.rb index abc1234..def5678 100644 --- a/lib/signal_api/signal_http_api.rb +++ b/lib/signal_api/signal_http_api.rb @@ -12,7 +12,7 @@ if response.code == 401 raise AuthFailedException.new("Authentication to the Signal platform failed. Make sure your API key is correct.") else - message = "Unable to create short url. Respone body: #{response.body}" + message = "API request failed with a response code of #{response.code}. Respone body: #{response.body}" SignalApi.logger.error message raise ApiException.new(message) end
Make the error message more generic
diff --git a/lib/spree_store_credits/engine.rb b/lib/spree_store_credits/engine.rb index abc1234..def5678 100644 --- a/lib/spree_store_credits/engine.rb +++ b/lib/spree_store_credits/engine.rb @@ -16,5 +16,9 @@ end config.to_prepare &method(:activate).to_proc + + initializer "spree.gateway.payment_methods", :after => "spree.register.payment_methods" do |app| + app.config.spree.payment_methods << Spree::PaymentMethod::StoreCredit + end end end
Add store credit to list of payment_methods. This will currently cause issues if you attempt to save the store credit payment method in the Spree admin interface because the gateway is not in the list of available payment methods. It will default the store credit payment method to the first payment method in the list, save with that, and now allow you to change it back, thereby breaking everything!
diff --git a/lib/tasks/spree_multi_tenant.rake b/lib/tasks/spree_multi_tenant.rake index abc1234..def5678 100644 --- a/lib/tasks/spree_multi_tenant.rake +++ b/lib/tasks/spree_multi_tenant.rake @@ -1,21 +1,34 @@+ +def do_create_tenant domain, code + if domain.blank? or code.blank? + puts "Error: domain and code must be specified" + puts "(e.g. rake spree_multi_tenant:create_tenant domain=mydomain.com code=mydomain)" + exit + end + + tenant = Spree::Tenant.create!({:domain => domain.dup, :code => code.dup}) + tenant.create_template_and_assets_paths + tenant +end + + namespace :spree_multi_tenant do + + desc "Create a new tenant and assign all exisiting items to the tenant." + task :create_tenant_and_assign => :environment do + tenant = do_create_tenant ENV["domain"], ENV["code"] + + # Assign all existing items to the new tenant + SpreeMultiTenant.tenanted_models.each do |model| + model.all.each do |item| + item.update_attribute(:tenant_id, tenant.id) + end + end + end desc "Create a new tenant" task :create_tenant => :environment do - domain = ENV["domain"] - code = ENV["code"] - - if domain.blank? or code.blank? - puts "Error: domain and code must be specified" - puts "(e.g. rake spree_multi_tenant:create_tenant domain=mydomain.com code=mydomain)" - exit - end - - tenant = Spree::Tenant.create! do |t| - t.domain = domain.dup - t.code = code.dup - end - tenant.create_template_and_assets_paths + tenant = do_create_tenant ENV["domain"], ENV["code"] end end
Add Rake task to create and assign first tenant, instead of the migration.
diff --git a/chef-sandwich.gemspec b/chef-sandwich.gemspec index abc1234..def5678 100644 --- a/chef-sandwich.gemspec +++ b/chef-sandwich.gemspec @@ -14,7 +14,7 @@ worry about cookbooks or configuration. EOS - gem.add_dependency('chef', '>= 0.9') + gem.add_dependency('chef', '~> 11.12.8') gem.add_dependency('uuidtools', '~> 2.1.5') gem.add_development_dependency('minitest', '~> 5.5.1')
Update Chef version to Chef 11 in gemspec
diff --git a/lib/travis/build/job/configure.rb b/lib/travis/build/job/configure.rb index abc1234..def5678 100644 --- a/lib/travis/build/job/configure.rb +++ b/lib/travis/build/job/configure.rb @@ -30,12 +30,7 @@ parse(response.body) else # TODO log error - { - ".fetching_failed" => true, - # do not send out any emails if .travis.yml does not exist - # on a branch. See travis-ci/travis-ci#414 to learn more. - "notifications" => { "email" => false } - } + { ".fetching_failed" => true } end end
Revert "Do not send out any emails if .travis.yml does not exist on the branch we are building." This reverts commit a3e5fc5324f2b005bb0179d4557c73d3f12131fa. This causes too much argument.
diff --git a/core/db/migrate/20120523061241_convert_sales_tax_to_default_tax.rb b/core/db/migrate/20120523061241_convert_sales_tax_to_default_tax.rb index abc1234..def5678 100644 --- a/core/db/migrate/20120523061241_convert_sales_tax_to_default_tax.rb +++ b/core/db/migrate/20120523061241_convert_sales_tax_to_default_tax.rb @@ -0,0 +1,9 @@+class ConvertSalesTaxToDefaultTax < ActiveRecord::Migration + def up + execute "UPDATE spree_calculators SET type='Spree::Calculator::DefaultTax' WHERE type='Spree::Calculator::SalesTax'" + end + + def down + execute "UPDATE spree_calculators SET type='Spree::Calculator::SalesTax' WHERE type='Spree::Calculator::DefaultTax'" + end +end
Add SalesTax to DefaultTax migration for spree_calculators Fixes #1581 Closes #1585
diff --git a/recipes/sevenscale_deploy/logs.rb b/recipes/sevenscale_deploy/logs.rb index abc1234..def5678 100644 --- a/recipes/sevenscale_deploy/logs.rb +++ b/recipes/sevenscale_deploy/logs.rb @@ -4,9 +4,10 @@ desc "tail log files" task :tail do log_filename = fetch(:log_filename, "#{rails_env}.log") + logs = Array(log_filename).collect { |l| "#{shared_path}/log/#{l}" } begin - run "tail -f #{shared_path}/log/#{log_filename}" do |ch, stream, out| + run "tail -f #{logs.join(' ')}" do |ch, stream, out| if ENV['WITH_HOSTNAME'] print " [#{ch[:host]}] " + out.chomp.gsub(/\n/, "\n [#{ch[:host]}] ") + "\n" else @@ -21,6 +22,7 @@ desc "grep log files" task :grep do log_filename = fetch(:log_filename, "#{rails_env}.log") + logs = Array(log_filename).collect { |l| "#{shared_path}/log/#{l}" } abort "Must provide PATTERN=" unless ENV['PATTERN'] @@ -30,6 +32,6 @@ command << %{-C "#{ENV['CONTEXT']}"} end - run %{#{command} -e "#{ENV['PATTERN']}" #{shared_path}/log/#{log_filename}} + run %{#{command} -e "#{ENV['PATTERN']}" #{logs.join(' ')}} end end
Allow for more than one log file.
diff --git a/spec/factories_spec.rb b/spec/factories_spec.rb index abc1234..def5678 100644 --- a/spec/factories_spec.rb +++ b/spec/factories_spec.rb @@ -0,0 +1,13 @@+require 'rails_helper' + +## +# Verify that factories are valid +# +FactoryGirl.factories.map(&:name).each do |factory_name| + describe "The #{factory_name} factory" do + it 'is valid' do + subject = build(factory_name) + expect(subject).to be_valid + end + end +end
Add basic test for factory validity This doesn't do anything fancy–it doesn't test traits, it doesn't test that things are properly sequenced/uniqueness requirements are obeyed, etc.–but it ensures that the basic factories are valid. After finding a sequence issue in `:shift`, I thought this would be a prudent test to have.
diff --git a/attributes/default.rb b/attributes/default.rb index abc1234..def5678 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -18,4 +18,4 @@ # default['build-essential']['compile_time'] = false -default['build-essential']['msys']['path'] = 'C:/msys' +default['build-essential']['msys']['path'] = File.join(ENV['SYSTEMDRIVE'], 'msys')
Use SYSTEMDRIVE for msys path attribue
diff --git a/attributes/default.rb b/attributes/default.rb index abc1234..def5678 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -10,3 +10,5 @@ default['owncloud']['timeout'] = '1800' # For big files upload default['owncloud']['enable_ssl'] = true default['owncloud']['disable_trusted_domains'] = true +default['owncloud']['ssl_certificate'] = nil +default['owncloud']['ssl_certificate_key'] = nil
Add attributes for setting SSL
diff --git a/spec/unit/head_spec.rb b/spec/unit/head_spec.rb index abc1234..def5678 100644 --- a/spec/unit/head_spec.rb +++ b/spec/unit/head_spec.rb @@ -15,4 +15,17 @@ "\e[1G[====>]\n" ].join) end + + it "customises all output characters" do + progress = TTY::ProgressBar.new("[:bar]", output: output, head: '>', complete: '+', incomplete: '.', total: 5) + 5.times { progress.advance } + output.rewind + expect(output.read).to eq([ + "\e[1G[>....]", + "\e[1G[+>...]", + "\e[1G[++>..]", + "\e[1G[+++>.]", + "\e[1G[++++>]\n" + ].join) + end end
Change to ensure all characters can be customised
diff --git a/cookbooks/home/recipes/default.rb b/cookbooks/home/recipes/default.rb index abc1234..def5678 100644 --- a/cookbooks/home/recipes/default.rb +++ b/cookbooks/home/recipes/default.rb @@ -16,7 +16,7 @@ Dir["/home/mzp/home/dotfiles/*"].each do|file| bash "install #{File.basename(file)}" do code <<-END - rm -rf ~mzp/#{File.basename(file)} + rm -rf ~mzp/.#{File.basename(file)} ln -s #{file} ~mzp/.#{File.basename(file)} END end
Fix home recipe: overwrites dotfiles
diff --git a/acts_as_uuid.gemspec b/acts_as_uuid.gemspec index abc1234..def5678 100644 --- a/acts_as_uuid.gemspec +++ b/acts_as_uuid.gemspec @@ -20,5 +20,5 @@ # specify any dependencies here; for example: s.add_development_dependency "rspec" - s.add_runtime_dependency "uuid" + # runtime dependency of something that conforms to UUID.generate - be that uuid or cuuid gem end
Remove dependency on uuid alone
diff --git a/lib/simple_view/builders/ui_text_field_builder.rb b/lib/simple_view/builders/ui_text_field_builder.rb index abc1234..def5678 100644 --- a/lib/simple_view/builders/ui_text_field_builder.rb +++ b/lib/simple_view/builders/ui_text_field_builder.rb @@ -1,6 +1,6 @@ module SimpleView module Builders - class UITextFieldBuilder < UIViewBuilder + class UITextFieldBuilder < UIControlBuilder include SimpleView::Builders::HasFont include SimpleView::Builders::HasTextColor end
Fix UITextFieldBuilder inherits from UIViewBuilder instead of UIControlBuilder
diff --git a/app/helpers/welcome_message_helper.rb b/app/helpers/welcome_message_helper.rb index abc1234..def5678 100644 --- a/app/helpers/welcome_message_helper.rb +++ b/app/helpers/welcome_message_helper.rb @@ -13,8 +13,8 @@ "Keep up the good work, you're doing great!", "We're all rooting for you!", 'We appreciate all that you do!', - "From San Francisco with love!" - "You're a real gem - the client_finder gem team" + "From San Francisco with love!", + "You're a real gem - the client_finder gem team", "You're rad and your work is much appreciated!" ] end
Add missing commas to WelcomeMessageHelper
diff --git a/interrogate.gemspec b/interrogate.gemspec index abc1234..def5678 100644 --- a/interrogate.gemspec +++ b/interrogate.gemspec @@ -9,7 +9,7 @@ s.email = ["brown.mhg@gmail.com"] s.homepage = "https://github.com/mhgbrown/interrogate" s.summary = "Scheme-like class predication for Ruby" - s.description = "String?(\"Hello\") Interrogate attempts to bring Scheme-like class predication to Ruby." + s.description = "String?(\"Hello\") Interrogate attempts to bring Scheme-like class predication to Ruby. It provides an alternate syntax using Module#===" s.rubyforge_project = "interrogate"
Update the description to include more specifics
diff --git a/app/models/side_type.rb b/app/models/side_type.rb index abc1234..def5678 100644 --- a/app/models/side_type.rb +++ b/app/models/side_type.rb @@ -5,7 +5,7 @@ scope :active, -> { where(active: true) } def to_s - name + code end end
Use correct coding for default name
diff --git a/lib/command_objects/send_message.rb b/lib/command_objects/send_message.rb index abc1234..def5678 100644 --- a/lib/command_objects/send_message.rb +++ b/lib/command_objects/send_message.rb @@ -6,7 +6,7 @@ # Sends a message to MeshBlu with optional Liquid Templating. Usually this is # required to report an event, completion of a schedule or system failures. class SendMessage < Mutations::Command - Liquid::Template.error_mode = :strict + Liquid::Template.error_mode = :lax required do string :message
Change templating mode from strict to lax
diff --git a/lib/custodian/samplers/linux/ram.rb b/lib/custodian/samplers/linux/ram.rb index abc1234..def5678 100644 --- a/lib/custodian/samplers/linux/ram.rb +++ b/lib/custodian/samplers/linux/ram.rb @@ -5,7 +5,7 @@ describe "RAM usage" def sample - free = `free`.match /Mem: +([0-9]+) +([0-9]+) +([0-9]+) +([0-9]+) +([0-9]+) +([0-9]+)/ + free = `free -m`.match /Mem: +([0-9]+) +([0-9]+) +([0-9]+) +([0-9]+) +([0-9]+) +([0-9]+)/ { "Total" => "#{free[1]} MB",
Fix a bug that caused the RAM sampler for Linux to display 1024 times too much
diff --git a/lib/html-proofer/check/opengraph.rb b/lib/html-proofer/check/opengraph.rb index abc1234..def5678 100644 --- a/lib/html-proofer/check/opengraph.rb +++ b/lib/html-proofer/check/opengraph.rb @@ -1,8 +1,12 @@ # encoding: utf-8 class OpenGraphElement < ::HTMLProofer::Element - def @src + def src @content + end + + def url + src end end
Revert back some of the changes
diff --git a/archive-ar.gemspec b/archive-ar.gemspec index abc1234..def5678 100644 --- a/archive-ar.gemspec +++ b/archive-ar.gemspec @@ -9,7 +9,7 @@ spec.authors = ["Joshua B. Bussdieker"] spec.email = ["jbussdieker@gmail.com"] spec.summary = %q{Simple AR file functions} - spec.homepage = "" + spec.homepage = "https://github.com/jbussdieker/ruby-archive-ar" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0")
Add homepage setting to gemspec
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -28,7 +28,7 @@ erb :'index.html' end -get '/:host' do |host| +get '/host/:host' do |host| @host = host record = IP.find_by_host(host) if record @@ -39,7 +39,7 @@ end end -post '/:host' do |host| +post '/host/:host' do |host| record = IP.find_by_host(host) unless record record = IP.new
Change get/set IP URLs to /host/:host
diff --git a/lib/roqua/support/command_runner.rb b/lib/roqua/support/command_runner.rb index abc1234..def5678 100644 --- a/lib/roqua/support/command_runner.rb +++ b/lib/roqua/support/command_runner.rb @@ -0,0 +1,24 @@+require 'pty' + +module CommandRunner + def self.run_command_and_print(cmd, output) + output.puts "Executing #{cmd}\n\n" + + PTY.spawn(cmd) do |read_stream, write_stream, pid| + begin + while chars = read_stream.read(1) + output.print chars + end + rescue Errno::EIO + end + Process.wait(pid) + end + output.puts "\n\n\n" + + if $? + exit 1 if $?.exitstatus > 0 + else + raise "Huh?! We didn't get an exit status from that last one: #{cmd}" + end + end +end
Add CommandRunner for running a shell command which raises when exitstatus > 0
diff --git a/lib/tasks/query_reviewer_tasks.rake b/lib/tasks/query_reviewer_tasks.rake index abc1234..def5678 100644 --- a/lib/tasks/query_reviewer_tasks.rake +++ b/lib/tasks/query_reviewer_tasks.rake @@ -2,6 +2,6 @@ namespace :query_reviewer do desc "Create a default config/query_reviewer.yml" task :setup do - FileUtils.copy(File.join(File.dirname(__FILE__), "..", "query_reviewer_defaults.yml"), File.join(RAILS_ROOT, "config", "query_reviewer.yml")) + FileUtils.copy(File.join(File.dirname(__FILE__), "../..", "query_reviewer_defaults.yml"), File.join(RAILS_ROOT, "config", "query_reviewer.yml")) end end
Fix bug in rake task
diff --git a/lib/texas/build/task/publish_pdf.rb b/lib/texas/build/task/publish_pdf.rb index abc1234..def5678 100644 --- a/lib/texas/build/task/publish_pdf.rb +++ b/lib/texas/build/task/publish_pdf.rb @@ -27,7 +27,7 @@ verbose { file = File.join(build_path, "master.log") output = `grep "Output written on" #{file}` - numbers = output.scan(/\((\d+?) pages\, (\d+?) bytes\)\./).flatten + numbers = output.scan(/\((\d+?) pages?\, (\d+?) bytes\)\./).flatten @page_count = numbers.first.to_i "Written PDF in #{dest_file.gsub(build.root, '')} (#{@page_count} pages)".green }
Fix Task::PublishPDF interpreted "1 page" from logfile as "0 pages".
diff --git a/spec/controllers/assets_controller_spec.rb b/spec/controllers/assets_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/assets_controller_spec.rb +++ b/spec/controllers/assets_controller_spec.rb @@ -9,7 +9,7 @@ @atts = { :file => load_fixture_file("asset.png") } end - it "is uploaded" do + it "is persisted" do post :create, asset: @atts assigns(:asset).should be_persisted @@ -32,8 +32,22 @@ end context "an invalid asset" do - it "is not uploaded" - it "returns an unprocessable status" + before do + @atts = { :file => nil } + end + + it "is not persisted" do + post :create, asset: @atts + + assigns(:asset).should_not be_persisted + assigns(:asset).file.current_path.should be_nil + end + + it "returns an unprocessable status" do + post :create, asset: @atts + + response.status.should == 422 + end end end
Add specs for creating an invalid asset
diff --git a/lib/github/html/autolink_filter.rb b/lib/github/html/autolink_filter.rb index abc1234..def5678 100644 --- a/lib/github/html/autolink_filter.rb +++ b/lib/github/html/autolink_filter.rb @@ -5,7 +5,13 @@ class AutolinkFilter < Filter def call return html if context[:autolink] == false - Rinku.auto_link(html, :urls, nil, %w[a script kbd pre code]) + flags = 0 + + if GitHub.enterprise? + flags |= Rinku::AUTOLINK_SHORT_DOMAINS + end + + Rinku.auto_link(html, :urls, nil, %w[a script kbd pre code], flags) end end end
Allow short-URL (intranet) autolinks in Enterprise Fixes #4045
diff --git a/lib/google_drive/oauth2_fetcher.rb b/lib/google_drive/oauth2_fetcher.rb index abc1234..def5678 100644 --- a/lib/google_drive/oauth2_fetcher.rb +++ b/lib/google_drive/oauth2_fetcher.rb @@ -35,9 +35,9 @@ def request_raw(method, url, data, extra_header, auth) if method == :delete || method == :get - raw_res = @oauth2_token.request(method, url, {:header => extra_header}) + raw_res = @oauth2_token.request(method, url, {:headers => extra_header}) else - raw_res = @oauth2_token.request(method, url, {:header => extra_header, :body => data}) + raw_res = @oauth2_token.request(method, url, {:headers => extra_header, :body => data}) end return Response.new(raw_res) end
Correct the headers hash key for OAuth2 The OAuth2::Client#request method in the OAuth2 library looks for header values using the hash key :headers, not :header.
diff --git a/lib/govuk_seed_crawler/get_urls.rb b/lib/govuk_seed_crawler/get_urls.rb index abc1234..def5678 100644 --- a/lib/govuk_seed_crawler/get_urls.rb +++ b/lib/govuk_seed_crawler/get_urls.rb @@ -5,7 +5,7 @@ attr_reader :urls def initialize(site_root) - raise "No :site_root defined" unless site_root + raise "No site_root defined" unless site_root indexer = GovukMirrorer::Indexer.new(site_root) @urls = indexer.all_start_urls
Fix typo in error message
diff --git a/lib/ProMotion/helpers/console.rb b/lib/ProMotion/helpers/console.rb index abc1234..def5678 100644 --- a/lib/ProMotion/helpers/console.rb +++ b/lib/ProMotion/helpers/console.rb @@ -8,19 +8,19 @@ class << self def log(log, with_color:color) - return if RUBYMOTION_ENV == "test" + return if defined?(RUBYMOTION_ENV) && RUBYMOTION_ENV == "test" PM.logger.deprecated "ProMotion::Console.log is deprecated. Use PM.logger (see README)" puts color[0] + NAME + log + color[1] end def log(log, withColor:color) - return if RUBYMOTION_ENV == "test" + return if defined?(RUBYMOTION_ENV) && RUBYMOTION_ENV == "test" PM.logger.deprecated "ProMotion::Console.log is deprecated. Use PM.logger (see README)" self.log(log, with_color:color) end def log(log) - return if RUBYMOTION_ENV == "test" + return if defined?(RUBYMOTION_ENV) && RUBYMOTION_ENV == "test" PM.logger.deprecated "ProMotion::Console.log is deprecated. Use PM.logger (see README)" log(log, with_color: DEFAULT_COLOR) end
Fix if RUBYMOTION_ENV not defined
diff --git a/lib/asteroids/states/play_state.rb b/lib/asteroids/states/play_state.rb index abc1234..def5678 100644 --- a/lib/asteroids/states/play_state.rb +++ b/lib/asteroids/states/play_state.rb @@ -14,6 +14,9 @@ end def button_down(id) + if id == Gosu::KbEscape + Asteroids::GameState.switch(Asteroids::MenuState.instance) + end end end
Add code to swich from play state to menu state.
diff --git a/lib/aws/call_types/action_param.rb b/lib/aws/call_types/action_param.rb index abc1234..def5678 100644 --- a/lib/aws/call_types/action_param.rb +++ b/lib/aws/call_types/action_param.rb @@ -7,7 +7,14 @@ ## # Implement call handling to work with the ?Action param, signing the message - # according to whatever Signing module is included along side this module + # according to whatever Signing module is included along side this module. + # + # This module hooks up the `method_missing` functionality as described in the + # {README}. To call methods on APIs including this module, simply call a method + # with either the Ruby-fied name, or the full CamelCase name, and pass in + # options required as the parameters. + # + # All responses will be wrapped up in an {AWS::Response AWS::Response} object. ## module ActionParam ##
Add details to ActionParam call type
diff --git a/lib/crashbreak/request_parser.rb b/lib/crashbreak/request_parser.rb index abc1234..def5678 100644 --- a/lib/crashbreak/request_parser.rb +++ b/lib/crashbreak/request_parser.rb @@ -27,7 +27,11 @@ end def request_headers - @request.select{|key| key.start_with?('HTTP_')}.map{|key, value| [key.gsub('HTTP_', ''), value]}.to_h + {}.tap do |request_headers| + @request.select{|key| key.start_with?('HTTP_')}.each do |key, value| + request_headers[key.gsub('HTTP_', '')] = value + end + end end end end
Use pure ruby instead of to_h on array
diff --git a/lib/dreamhost_personal_backup.rb b/lib/dreamhost_personal_backup.rb index abc1234..def5678 100644 --- a/lib/dreamhost_personal_backup.rb +++ b/lib/dreamhost_personal_backup.rb @@ -25,6 +25,7 @@ DreamhostPersonalBackup::StatusManager.remove_pid_file + DreamhostPersonalBackup.logger.info("") DreamhostPersonalBackup.logger.info("Backup run completed at #{DateTime.now}") end
Add newline before final logging message for log readability
diff --git a/lib/flex_commerce_api/version.rb b/lib/flex_commerce_api/version.rb index abc1234..def5678 100644 --- a/lib/flex_commerce_api/version.rb +++ b/lib/flex_commerce_api/version.rb @@ -1,4 +1,4 @@ module FlexCommerceApi - VERSION = "0.1.10" + VERSION = "0.1.9" API_VERSION = "v1" end
Revert "validate_stock now uses pull_updates! then validates" This reverts commit 43005247c946ddcab2b92e1dd84c4cecf23674f1.
diff --git a/lib/dm-core/property/binary.rb b/lib/dm-core/property/binary.rb index abc1234..def5678 100644 --- a/lib/dm-core/property/binary.rb +++ b/lib/dm-core/property/binary.rb @@ -6,11 +6,11 @@ if RUBY_VERSION >= "1.9" def load(value) - super.dup.force_encoding("BINARY") if value + super.dup.force_encoding("BINARY") unless value.nil? end def dump(value) - super.dup.force_encoding("BINARY") if value + super.dup.force_encoding("BINARY") unless value.nil? end end
Adjust to use unless value.nil? instead of if value
diff --git a/lib/less/rails/import_processor.rb b/lib/less/rails/import_processor.rb index abc1234..def5678 100644 --- a/lib/less/rails/import_processor.rb +++ b/lib/less/rails/import_processor.rb @@ -35,6 +35,10 @@ scope.metadata.merge(data: result) end + def self.default_mime_type + 'text/css' + end + def self.depend_on(scope, source, base=File.dirname(scope.logical_path)) import_paths = source.scan(IMPORT_SCANNER).flatten.compact.uniq import_paths.each do |path|
Add a default mime type for import processor
diff --git a/lib/spex/checks/created_check.rb b/lib/spex/checks/created_check.rb index abc1234..def5678 100644 --- a/lib/spex/checks/created_check.rb +++ b/lib/spex/checks/created_check.rb @@ -8,11 +8,17 @@ example "Directory was created", "check '/tmp/foo', :created => {:type => 'directory'}" def before - assert !File.exist?(target), "File already exists at #{target}" + if active? + assert !File.exist?(target), "File already exists at #{target}" + end end def after - assert File.exist?(target), "File was not created at #{target}" + if active? + assert File.exist?(target), "File was not created at #{target}" + else + assert !File.exist?(target), "File was created at #{target}" + end check_type end
Support :created => false (regression)
diff --git a/lib/piv/helpers/application.rb b/lib/piv/helpers/application.rb index abc1234..def5678 100644 --- a/lib/piv/helpers/application.rb +++ b/lib/piv/helpers/application.rb @@ -1,13 +1,12 @@ module Piv + class ConfigurationError < StandardError; end + module Helpers module Application extend ActiveSupport::Concern - # TODO: Move to config file - API_URL = "https://www.pivotaltracker.com/services/v5/" - module ClassMethods - attr_accessor :global_dir + attr_accessor :global_dir, :connection end def session_in_progress? @@ -19,7 +18,9 @@ end def client - @client ||= Client.new(API_URL) + @client ||= Client.new(self.class.connection) do |c| + c.options.timeout = 4 + end end def global_installer @@ -27,6 +28,8 @@ end def assure_globally_installed + raise ConfigurationError, "make sure connection and global directory are established" unless self.class.global_dir && self.class.connection + global_installer.run :up unless global_installer.done? end end
Allow Piv::Helpers::Application module to include accessor methods to receive connection during configuration time. also raise an error as part of assuring global installation in the case the connection or global directory configs are missing
diff --git a/lib/rom/session/environment.rb b/lib/rom/session/environment.rb index abc1234..def5678 100644 --- a/lib/rom/session/environment.rb +++ b/lib/rom/session/environment.rb @@ -1,25 +1,31 @@ module ROM class Session + # Session-specific environment wrapping ROM's environment + # + # It works exactly the same as ROM::Environment except it returns + # session relations + # # @api public class Environment < ROM::Environment include Proxy - attr_reader :environment - private :environment + attr_reader :environment, :tracker, :memory + private :environment, :tracker, :memory - attr_reader :tracker - private :tracker - - attr_reader :memory - private :memory - + # @api private def initialize(environment, tracker) @environment = environment @tracker = tracker initialize_memory end + # Return a relation identified by name + # + # @param [Symbol] name of a relation + # + # @return [Session::Relation] rom's relation wrapped by session + # # @api public def [](name) memory[name] @@ -42,7 +48,7 @@ Session::Relation.build(environment[name], tracker, tracker.identity_map(name)) end - end # Registry + end # Environment end # Session end # ROM
Simplify Session::Environment a little and add docs
diff --git a/lib/rubocop/cop/unless_else.rb b/lib/rubocop/cop/unless_else.rb index abc1234..def5678 100644 --- a/lib/rubocop/cop/unless_else.rb +++ b/lib/rubocop/cop/unless_else.rb @@ -12,6 +12,8 @@ def inspect(file, source, tokens, sexp) on_node(:if, sexp) do |s| + next unless s.src.respond_to?(:keyword) + if s.src.keyword.to_source == 'unless' && s.src.else add_offence(:convention, s.src.line, ERROR_MESSAGE)
Handle the possibility of encountering a ternary op
diff --git a/library/openstruct/table_spec.rb b/library/openstruct/table_spec.rb index abc1234..def5678 100644 --- a/library/openstruct/table_spec.rb +++ b/library/openstruct/table_spec.rb @@ -7,7 +7,7 @@ end it "is protected" do - @os.protected_methods.map {|m| m.to_s }.should include("table") + OpenStruct.should have_protected_instance_method(:table) end it "returns self's method/value table" do
Use have_protected_instance_method matcher for 1.9 compat.
diff --git a/puma.rb b/puma.rb index abc1234..def5678 100644 --- a/puma.rb +++ b/puma.rb @@ -1,4 +1,4 @@-workers Integer(ENV['WEB_CONCURRENCY'] || 5) +workers Integer(ENV['WEB_CONCURRENCY'] || 1) threads_count = Integer(ENV['MAX_THREADS'] || 32) threads threads_count, threads_count
Update web_concurrency to avoid ThreadError
diff --git a/lib/omniauth/strategies/ravelry.rb b/lib/omniauth/strategies/ravelry.rb index abc1234..def5678 100644 --- a/lib/omniauth/strategies/ravelry.rb +++ b/lib/omniauth/strategies/ravelry.rb @@ -14,8 +14,12 @@ info do { - :name => raw_info['name'], - :location => raw_info['city'] + 'name' => raw_info['first_name'], + 'location' => raw_info['location'], + 'nickname' => raw_info['username'], + 'first_name' => raw_info['first_name'], + 'description' => raw_info['about_me'], + 'image' => raw_info['small_photo_url'] } end @@ -26,7 +30,7 @@ end def raw_info - @raw_info ||= MultiJson.decode(access_token.get("/people/#{uid}.json").body) + @raw_info ||= MultiJson.decode(access_token.get("https://api.ravelry.com/people/#{uid}.json").body)['user'] end end
Update raw_info and info calls
diff --git a/lib/sinatra/asset_pipeline/task.rb b/lib/sinatra/asset_pipeline/task.rb index abc1234..def5678 100644 --- a/lib/sinatra/asset_pipeline/task.rb +++ b/lib/sinatra/asset_pipeline/task.rb @@ -5,24 +5,24 @@ module Sinatra module AssetPipeline class Task < Rake::TaskLib - def initialize(app) + def initialize(app_klass) namespace :assets do desc "Precompile assets" task :precompile do - environment = app.sprockets - manifest = Sprockets::Manifest.new(environment.index, app.assets_path) - manifest.compile(app.assets_precompile) + environment = app_klass.sprockets + manifest = Sprockets::Manifest.new(environment.index, app_klass.assets_path) + manifest.compile(app_klass.assets_precompile) end desc "Clean assets" task :clean do - FileUtils.rm_rf(app.assets_path) + FileUtils.rm_rf(app_klass.assets_path) end end end - def self.define!(app) - self.new app + def self.define!(app_klass) + self.new app_klass end end end
Refactor app to use a more descriptive name
diff --git a/app/controllers/jarvis/syncs_controller.rb b/app/controllers/jarvis/syncs_controller.rb index abc1234..def5678 100644 --- a/app/controllers/jarvis/syncs_controller.rb +++ b/app/controllers/jarvis/syncs_controller.rb @@ -1,18 +1,19 @@ module Jarvis class SyncsController < ApplicationController + @@brain = Brain.new(Rails.application.config.api_token) def create - # This is where we'll create users from the Brain - Brain.create_user(params[:user]) + # This is where we'll create users from the @brain + @@brain.create_user(params[:user]) end def update - # This is where we'll update users from the Brain - Brain.update_user(params[:user_id], params[:update]) + # This is where we'll update users from the @brain + @@brain.update_user(params[:user_id], params[:update]) end def destroy - # This is where we'll destroy users from the Brain - Brain.destroy_user(params[:user_id]) + # This is where we'll destroy users from the @brain + @@brain.destroy_user(params[:user_id]) end end end
Initialize the class in sync
diff --git a/lib/spritz_for_jekyll/generator.rb b/lib/spritz_for_jekyll/generator.rb index abc1234..def5678 100644 --- a/lib/spritz_for_jekyll/generator.rb +++ b/lib/spritz_for_jekyll/generator.rb @@ -4,7 +4,7 @@ def initialize(*args) super - login_success_path = args[0]["spritz_login_success_name"] || "login_success.html" + login_success_path = args[0]["spritz"]["login_success_name"] || "login_success.html" dirname = File.dirname(login_success_path) FileUtils.mkdir_p(dirname)
Fix bug - read login_success_name from the spritz namespace when copying file.
diff --git a/lib/strong_routes/rails/railtie.rb b/lib/strong_routes/rails/railtie.rb index abc1234..def5678 100644 --- a/lib/strong_routes/rails/railtie.rb +++ b/lib/strong_routes/rails/railtie.rb @@ -6,13 +6,6 @@ config.strong_routes = StrongRoutes.config initializer 'strong_routes.initialize' do |app| - # Need to force Rails to load the routes since there's no way to hook - # in after routes are loaded - app.reload_routes! - - config.strong_routes.allowed_routes ||= [] - config.strong_routes.allowed_routes += RouteMapper.map(app.routes) - case when config.strong_routes.insert_before? then app.config.middleware.insert_before(config.strong_routes.insert_before, Allow) @@ -22,6 +15,17 @@ app.config.middleware.insert_before(::Rails::Rack::Logger, Allow) end end + + # Load this late so initializers that depend on routes have a chance to + # initialize (i.e. Devise) + config.after_initialize do |app| + # Need to force Rails to load the routes since there's no way to hook + # in after routes are loaded + app.reload_routes! + + config.strong_routes.allowed_routes ||= [] + config.strong_routes.allowed_routes += RouteMapper.map(app.routes) + end end end end
Configure allowed routes in an after initializer Configure allowed routes in an after initializer so initializers that depend on routes have a chance to initialize (i.e. Devise).
diff --git a/app/overrides/add_button_to_admin_panel.rb b/app/overrides/add_button_to_admin_panel.rb index abc1234..def5678 100644 --- a/app/overrides/add_button_to_admin_panel.rb +++ b/app/overrides/add_button_to_admin_panel.rb @@ -0,0 +1,9 @@+Deface::Override.new(:virtual_path => %q{spree/admin/orders/index}, + :insert_after => "[data-hook='admin_orders_index_header_actions']", + :name => "print_button_header", + :text => "<th>print</th>") + +Deface::Override.new(:virtual_path => %q{spree/admin/orders/index}, + :insert_after => "[data-hook='admin_orders_index_row_actions']", + :name => "print_button_link", + :text => %q{<td><%= link_to "Print", "##{order.id}" %></td>})
Add buttons for printing invoices in admin panel
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -31,10 +31,11 @@ # Don't generate system test files. config.generators do |g| - g.test_framework(:rspec) - g.stylesheets(false) - g.javascripts(false) - g.helper(false) + g.test_framework :rspec + g.stylesheets false + g.javascripts false + g.helper false + g.template_engine :erb end config.middleware.insert(0, Rack::UTF8Sanitizer)
Set template engine to erb
diff --git a/lib/tasks/assessment_redesign.rake b/lib/tasks/assessment_redesign.rake index abc1234..def5678 100644 --- a/lib/tasks/assessment_redesign.rake +++ b/lib/tasks/assessment_redesign.rake @@ -0,0 +1,9 @@+namespace :db do + desc 'Migrates assessments to the new schema in 20140527151234_assessment_redesign.rb' + + task migrate_assessments: :environment do + Mission.all.each do |m| + puts m.to_yaml + end + end +end
Add new rake task to for architecture redesign
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -12,6 +12,7 @@ module RecordOfGuidance class Application < Rails::Application + config.active_job.queue_adapter = :sidekiq config.active_record.raise_in_transactional_callbacks = true end end
Configure ActiveJob to use Sidekiq
diff --git a/lib/tasks/email/notifications.rake b/lib/tasks/email/notifications.rake index abc1234..def5678 100644 --- a/lib/tasks/email/notifications.rake +++ b/lib/tasks/email/notifications.rake @@ -0,0 +1,19 @@+namespace :email do + desc 'Send an email notifying the deadline of an expense' + task notifications: :environment do + User.find_each do |user| + user_accounts = user.accounts.where(reminder_active: true, owner: user.id) + + user_accounts.each do |account| + days_before = account.reminder_days_before + date_to_compare = Date.today - days_before + + user_entries = account.entries.where(paid: false, date: date_to_compare, entries_type: :expense) + + user_entries.each do |entry| + Mailers::NotificationMessage.perform(user, account, entry) + end + end + end + end +end
Create a rake task to search for entries that will expire
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -12,5 +12,6 @@ # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. config.autoload_paths += %W["#{config.root}/app/validators/"] + config.assets.paths << Rails.root.join("app", "assets", "fonts") end end
Add 'fonts' folder to config.assets.paths
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -11,9 +11,7 @@ module Gov class Application < Rails::Application - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. - # config.time_zone = 'Central Time (US & Canada)' + config.time_zone = 'Sofia' config.i18n.default_locale = :bg end end
Set the time zone to Sofia
diff --git a/config/dotenv_load.rb b/config/dotenv_load.rb index abc1234..def5678 100644 --- a/config/dotenv_load.rb +++ b/config/dotenv_load.rb @@ -1,6 +1,6 @@-require 'dotenv' +if %w[development test].include?(ENV['RACK_ENV']) + require 'dotenv' -if %w[development test].include?(ENV['RACK_ENV']) Dotenv.load( ".env.#{ENV['RACK_ENV']}.local", '.env.local',
Load Dotenv in dev & test envs only
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -11,8 +11,8 @@ require "sprockets/railtie" require "rails/test_unit/railtie" require 'mongoid' -require 'mongo' -Mongoid.load!(File.expand_path('mongoid.yml', './config')) +Mongoid.load!('mongoid.yml', :production) +# Mongoid.load!(File.expand_path('mongoid.yml', './config')) # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups)
Test add for variables in config
diff --git a/spec/freebsd/loader.conf_spec.rb b/spec/freebsd/loader.conf_spec.rb index abc1234..def5678 100644 --- a/spec/freebsd/loader.conf_spec.rb +++ b/spec/freebsd/loader.conf_spec.rb @@ -1,9 +1,12 @@ require 'spec_helper' -# Tests to ensure ntp is locked down describe file('/boot/loader.conf') do it { should be_file } it { should contain "autoboot_delay=\"5\"" } + it { should contain "verbose_loading=\"YES\"" } + it { should contain "hw.usb.disable_enumeration=1" } + it { should contain "hw.usb.no_boot_wait=1" } + it { should contain "hw.usb.no_shutdown_wait=1" } end
Add new boot loader settings
diff --git a/spec/models/neighborhood_spec.rb b/spec/models/neighborhood_spec.rb index abc1234..def5678 100644 --- a/spec/models/neighborhood_spec.rb +++ b/spec/models/neighborhood_spec.rb @@ -1,5 +1,5 @@ require 'spec_helper' describe Neighborhood do - pending "add some examples to (or delete) #{__FILE__}" + pending "flagged for deletion #{__FILE__}" end
Add deletion flag to neighborhood spec
diff --git a/spec/ruby_syntax_checker_spec.rb b/spec/ruby_syntax_checker_spec.rb index abc1234..def5678 100644 --- a/spec/ruby_syntax_checker_spec.rb +++ b/spec/ruby_syntax_checker_spec.rb @@ -17,11 +17,7 @@ describe '#invalid_message' do it 'returns whatever Ruby gave it on the command line, followed by the original file' do - described_class.new("{").invalid_message.should == - "-:1: syntax error, unexpected $end, expecting '}'\n"\ - "\n" \ - "original file:\n" \ - "{" + described_class.new("{").invalid_message.should include 'syntax error' end end end
Update specs since Ruby 2.0 changed error messages
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -9,7 +9,7 @@ module EcotoneWeb class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 5.1 + config.load_defaults 5.2 # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers
Change default to match dummy app
diff --git a/config/environment.rb b/config/environment.rb index abc1234..def5678 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -14,8 +14,8 @@ config.gem 'json', :version => '1.5.1' if ['development', 'test'].include? RAILS_ENV - config.gem 'factory_girl', :version => '1.3.3', :lib => false - config.gem 'rspec-rails', :version => '1.3.3', :lib => false unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails')) + config.gem 'factory_girl', :version => '1.3.3', :lib => false + config.gem 'rspec-rails', :version => '1.3.3', :lib => false end # Libraries
Remove obsoleted code from when rspec-rails was vendored.
diff --git a/lib/fcrepo_wrapper.rb b/lib/fcrepo_wrapper.rb index abc1234..def5678 100644 --- a/lib/fcrepo_wrapper.rb +++ b/lib/fcrepo_wrapper.rb @@ -7,7 +7,7 @@ module FcrepoWrapper def self.default_fcrepo_version - '4.5.1' + '4.6.0' end def self.default_fcrepo_port
Use fcrepo 4.6.0 by default
diff --git a/lib/fit-commit/cli.rb b/lib/fit-commit/cli.rb index abc1234..def5678 100644 --- a/lib/fit-commit/cli.rb +++ b/lib/fit-commit/cli.rb @@ -1,4 +1,5 @@ require "fit-commit/installer" +require "fit-commit/version" module FitCommit class Cli @@ -12,6 +13,7 @@ if action_name == "install" FitCommit::Installer.new.install else + warn "fit-commit v#{FitCommit::VERSION}" warn "Usage: fit-commit install" false end
Add version to CLI help output
diff --git a/spec/shoes/radio_spec.rb b/spec/shoes/radio_spec.rb index abc1234..def5678 100644 --- a/spec/shoes/radio_spec.rb +++ b/spec/shoes/radio_spec.rb @@ -13,16 +13,16 @@ describe "#initialize" do it "sets accessors" do - subject.parent.should == parent - subject.group.should == group - subject.blk.should == input_block + expect(radio.parent).to eq(parent) + expect(radio.group).to eq(group) + expect(radio.blk).to eq(input_block) end end describe "#group=" do it "changes the group" do - subject.group = "New Group" - subject.group.should == "New Group" + radio.group = "New Group" + expect(radio.group).to eq("New Group") end end end
Update Radio specs to expect syntax
diff --git a/spec/unit/type_factory/factory/test_tuple_type.rb b/spec/unit/type_factory/factory/test_tuple_type.rb index abc1234..def5678 100644 --- a/spec/unit/type_factory/factory/test_tuple_type.rb +++ b/spec/unit/type_factory/factory/test_tuple_type.rb @@ -22,5 +22,22 @@ end end + context 'when use with {r: 0..255} and a name' do + subject{ factory.type({r: 0..255}, "MyTuple") } + + it{ should be_a(TupleType) } + + it 'should have the correct constraint on r' do + subject.up(r: 36) + ->{ + subject.up(r: 543) + }.should raise_error(UpError) + end + + it 'should have the correct name' do + subject.name.should eq("MyTuple") + end + end + end end
Make sure Range can be used for tuple attribute types.
diff --git a/spec/validators/array_inclusion_validator_spec.rb b/spec/validators/array_inclusion_validator_spec.rb index abc1234..def5678 100644 --- a/spec/validators/array_inclusion_validator_spec.rb +++ b/spec/validators/array_inclusion_validator_spec.rb @@ -14,18 +14,13 @@ subject { klass.new } - it 'passes validation if the attribute is in the acceptable list' do - subject.wotsit = 'OK' + it 'passes validation if all attributes are in the acceptable list' do + subject.wotsit = %w[ OK ] expect(subject).to be_valid end - it 'fails validation if the attribute is missing' do - subject.wotsit = nil - expect(subject).to be_valid - end - - it 'fails validation if the attribute is not in the acceptable list' do - subject.wotsit = 'something else' + it 'fails validation if an attribute is not in the acceptable list' do + subject.wotsit = %w[ OK bad ] expect(subject).not_to be_valid end end
Correct specs for array inclusion validator
diff --git a/config/initializers/basic_auth.rb b/config/initializers/basic_auth.rb index abc1234..def5678 100644 --- a/config/initializers/basic_auth.rb +++ b/config/initializers/basic_auth.rb @@ -1,5 +1,6 @@ if ENV.key?("APP_USERNAME") && ENV.key?("APP_PASSWORD") Vowessly::Application.config.middleware.insert_after 'Rack::Lock', 'Rack::Auth::Basic' do |username, password| - username == ENV["APP_USERNAME"] && password == ENV["APP_PASSWORD"] + (username == ENV["APP_USERNAME"] && password == ENV["APP_PASSWORD"]) || + (username == ENV["APP_SUPERVISOR_USERNAME"] && password == ENV["APP_SUPERVISOR_PASSWORD"]) end end
Add a supervisor username and password
diff --git a/spec/support/primo_id.rb b/spec/support/primo_id.rb index abc1234..def5678 100644 --- a/spec/support/primo_id.rb +++ b/spec/support/primo_id.rb @@ -4,6 +4,7 @@ 'journal' => 'nyu_aleph002736245', 'Vogue' => 'nyu_aleph002893728', 'The New Yorker' => 'nyu_aleph002904404', + 'Not by Reason Alone' => 'nyu_aleph002104209', 'book' => 'nyu_aleph001102376', 'checked out' => 'nyu_aleph003562911', 'requested' => 'nyu_aleph000864162',
Add Primo ID for the title "Not by Reason Alone"
diff --git a/lib/librarian/spec.rb b/lib/librarian/spec.rb index abc1234..def5678 100644 --- a/lib/librarian/spec.rb +++ b/lib/librarian/spec.rb @@ -1,10 +1,12 @@ module Librarian class Spec - attr_reader :source, :dependencies + attr_accessor :source, :dependencies + private :source=, :dependencies= def initialize(source, dependencies) - @source, @dependencies = source, dependencies + self.source = source + self.dependencies = dependencies end end
Use attr_accessor rather than attr_reader and instance variables.
diff --git a/jenkins-configuration/metadata.rb b/jenkins-configuration/metadata.rb index abc1234..def5678 100644 --- a/jenkins-configuration/metadata.rb +++ b/jenkins-configuration/metadata.rb @@ -21,3 +21,4 @@ #THE SOFTWARE. depends 'magic_shell' +depends 'jenkins', '> 2.0'
Store dependency for ideal library ordering
diff --git a/app/models/reason.rb b/app/models/reason.rb index abc1234..def5678 100644 --- a/app/models/reason.rb +++ b/app/models/reason.rb @@ -7,18 +7,23 @@ count = self.posts.where(:is_tp => true, :is_fp => false).count - return (count.to_f / self.posts.count.to_f).to_f + return (count.to_f / fast_post_count.to_f).to_f end def fp_percentage count = self.posts.where(:is_fp => true, :is_tp => false).count - return (count.to_f / self.posts.count.to_f).to_f + return (count.to_f / fast_post_count.to_f).to_f end def both_percentage count = self.posts.where(:is_fp => true, :is_tp => true).count + self.posts.includes(:feedbacks).where(:is_tp => false, :is_fp => false).where.not( :feedbacks => { :post_id => nil }).count - return (count.to_f / self.posts.count.to_f).to_f + return (count.to_f / fast_post_count.to_f).to_f + end + + # Attempt to use cached post_count if it's available (included in the dashboard/index query) + def fast_post_count + self.post_count || self.posts.count end end
Save a query (or a few hundred) on the dashboard
diff --git a/lib/censor_rules.rb b/lib/censor_rules.rb index abc1234..def5678 100644 --- a/lib/censor_rules.rb +++ b/lib/censor_rules.rb @@ -1,5 +1,5 @@ #!/bin/env ruby -#encoding: utf8 +#encoding: utf-8 # if not already created, make a CensorRule that hides personal information regexp = '={67}\s*\n(?:.*?#.*?: ?.*\n){3}.*={67}'
Set encoding in files with czech chars
diff --git a/lib/api/apps/apps.rb b/lib/api/apps/apps.rb index abc1234..def5678 100644 --- a/lib/api/apps/apps.rb +++ b/lib/api/apps/apps.rb @@ -11,7 +11,7 @@ def delete(appid) method = "DELETE" - if not appid.is_a? Integer + unless appid.is_a? Integer raise "Non integer appid" end endpoint = self.ENDPOINT + "/" + appid @@ -20,7 +20,7 @@ def delete_branding(appid) method = "DELETE" - if not appid.is_a? Integer + unless appid.is_a? Integer raise "Non integer appid" end endpoint = self.ENDPOINT + "/" + appid + "/branding" @@ -29,7 +29,7 @@ def create(name) method = "POST" - if not appid.is_a? String + unless appid.is_a? String raise "Non string app name" end return self.client.request(method, self.ENDPOINT, {"name" => name})
Use the fancy ruby unless instead of if negations
diff --git a/tinymce-rails-imageupload.gemspec b/tinymce-rails-imageupload.gemspec index abc1234..def5678 100644 --- a/tinymce-rails-imageupload.gemspec +++ b/tinymce-rails-imageupload.gemspec @@ -8,12 +8,14 @@ s.authors = ["Per Christian B. Viken"] s.email = ["perchr@northblue.org"] s.homepage = "http://eastblue.org/oss" - s.summary = %q{TinyMCE plugin for taking image uploads in Rails >= 3.1} - s.description = %q{TinyMCE plugin for taking image uploads in Rails >= 3.1} + s.summary = %q{TinyMCE plugin for taking image uploads in Rails >= 3.2} + s.description = %q{TinyMCE plugin for taking image uploads in Rails >= 3.2. Image storage is handled manually, so works with everything.} s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.require_paths = ["lib"] + + s.license = "MIT" s.add_runtime_dependency "railties", ">= 3.1" s.add_runtime_dependency "tinymce-rails", "~> 4.0"
Add license information and expand the description slightly
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,7 @@ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. # config.time_zone = 'Central Time (US & Canada)' + config.time_zone = 'Berlin' # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
Switch time zone to Berlin.
diff --git a/lib/work_guide/cli.rb b/lib/work_guide/cli.rb index abc1234..def5678 100644 --- a/lib/work_guide/cli.rb +++ b/lib/work_guide/cli.rb @@ -3,8 +3,12 @@ module WorkGuide class CLI < Thor desc "add [guide description]", "Add a new guide" + option :cycle, default: 'daily', banner: '[hourly|daily|weekly|monthly]', aliases: :c def add(description) - Guide.create(description: description) + Guide.create( + description: description, + cycle: options[:cycle] + ) end desc "list", "List guides"
Add cycle option for guide
diff --git a/lib/yuba/rendering.rb b/lib/yuba/rendering.rb index abc1234..def5678 100644 --- a/lib/yuba/rendering.rb +++ b/lib/yuba/rendering.rb @@ -2,7 +2,7 @@ module Rendering def render(*args) view_model_hash = args.find { |arg| arg.is_a?(Hash) && arg[:view_model] } - @_view_model = view_model_hash[:view_model] if view_model_hash[:view_model] + @_view_model = view_model_hash[:view_model] if view_model_hash && view_model_hash[:view_model] super end
Fix error on render without view_model options
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -14,7 +14,7 @@ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. - # config.time_zone = 'Central Time (US & Canada)' + config.time_zone = 'Atlantic Time (Canada)' # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
Set Timezone to Atlantic time
diff --git a/lib/ebay_products.rb b/lib/ebay_products.rb index abc1234..def5678 100644 --- a/lib/ebay_products.rb +++ b/lib/ebay_products.rb @@ -19,7 +19,13 @@ end def search - @search ||= self.class.get("/shopping", :query => options, :format => :xml)["FindProductsResponse"]["Product"] + if @search.blank? + @search = self.class.get("/shopping", :query => options, :format => :xml)["FindProductsResponse"]["Product"] + if @search.is_a? Hash + @search = [@search] + end + end + @search end def products
Handle when only 1 product in result
diff --git a/lib/grit/ext/blob.rb b/lib/grit/ext/blob.rb index abc1234..def5678 100644 --- a/lib/grit/ext/blob.rb +++ b/lib/grit/ext/blob.rb @@ -3,5 +3,12 @@ def id @repo.git.rev_parse({}, @id) end + + def create_tempfile + file = Tempfile.new(id) + file.write(data) + file.close + file + end end end
Add create_tempfile method for Grit::Blob
diff --git a/lib/userstamp/migration_helper.rb b/lib/userstamp/migration_helper.rb index abc1234..def5678 100644 --- a/lib/userstamp/migration_helper.rb +++ b/lib/userstamp/migration_helper.rb @@ -6,15 +6,10 @@ end module InstanceMethods - def userstamps(options = {}) - # add backwards compatibility support - options = {include_deleted_by: options} if (options === true || options === false) - - append_id_suffix = options[:include_id] ? '_id' : '' - - column(Ddb::Userstamp.compatibility_mode ? "created_by#{append_id_suffix}".to_sym : :creator_id, :integer) - column(Ddb::Userstamp.compatibility_mode ? "updated_by#{append_id_suffix}".to_sym : :updater_id, :integer) - column(Ddb::Userstamp.compatibility_mode ? "deleted_by#{append_id_suffix}".to_sym : :deleter_id, :integer) if options[:include_deleted_by] + def userstamps(include_deleted_by = false) + column(Ddb::Userstamp.compatibility_mode ? :created_by : :creator_id, :integer) + column(Ddb::Userstamp.compatibility_mode ? :updated_by : :updater_id, :integer) + column(Ddb::Userstamp.compatibility_mode ? :deleted_by : :deleter_id, :integer) if include_deleted_by end end end
Revert "Convert arguements to hash and add Suffix" This reverts commit 7aa98aa747887703a8a144e1819a7282ea69e02b.
diff --git a/lib/layer/message.rb b/lib/layer/message.rb index abc1234..def5678 100644 --- a/lib/layer/message.rb +++ b/lib/layer/message.rb @@ -11,12 +11,15 @@ end def read! - client.post("#{url}/receipts", { type: 'read' }) + client.post(receipts_url, { type: 'read' }) end def delivered! - client.post("#{url}/receipts", { type: 'delivery' }) + client.post(receipts_url, { type: 'delivery' }) end + def receipts_url + attributes['receipts_url'] || "#{url}/receipts" + end end end
Use the receipts url attribute if available
diff --git a/lib/poke/controls.rb b/lib/poke/controls.rb index abc1234..def5678 100644 --- a/lib/poke/controls.rb +++ b/lib/poke/controls.rb @@ -16,7 +16,7 @@ def press_button(button) BUTTONS.each do |key, value| if button == value - @buttons_pressed = key + @buttons_pressed.push(key) end end end
Fix erroneous assignment of @buttons_pressed
diff --git a/lib/rails_open311.rb b/lib/rails_open311.rb index abc1234..def5678 100644 --- a/lib/rails_open311.rb +++ b/lib/rails_open311.rb @@ -5,7 +5,7 @@ CACHE_KEY = 'open311_services' def self.load_config - YAML.load_file(CONFIG_PATH) + YAML.load(ERB.new(IO.read(CONFIG_PATH)).result) end def self.load_all_services!
Allow to embed erb in open311.yml
diff --git a/lib/sendgrid-ruby.rb b/lib/sendgrid-ruby.rb index abc1234..def5678 100644 --- a/lib/sendgrid-ruby.rb +++ b/lib/sendgrid-ruby.rb @@ -6,15 +6,17 @@ module SendGrid class Client - attr_reader :api_user, :api_key, :host, :endpoint + attr_accessor :api_user, :api_key, :host, :endpoint - def initialize(params) - @api_user = params.fetch(:api_user) - @api_key = params.fetch(:api_key) + def initialize(params = {}) + @api_user = params.fetch(:api_user, nil) + @api_key = params.fetch(:api_key, nil) @host = params.fetch(:host, 'https://api.sendgrid.com') @endpoint = params.fetch(:endpoint, '/api/mail.send.json') @conn = params.fetch(:conn, create_conn) @user_agent = params.fetch(:user_agent, 'sendgrid/' + SendGrid::VERSION + ';ruby') + yield self if block_given? + raise SendGrid::Exception.new('api_user and api_key are required') unless @api_user && @api_key end def send(mail)
Add block option to client
diff --git a/lib/poise_boiler.rb b/lib/poise_boiler.rb index abc1234..def5678 100644 --- a/lib/poise_boiler.rb +++ b/lib/poise_boiler.rb @@ -17,17 +17,28 @@ require 'poise_boiler/kitchen' module PoiseBoiler - def self.include_halite_spec_helper - @include_halite_spec_helper.nil? ? true : @include_halite_spec_helper - end + class << self + # @!attribute include_halite_spec_helper + # Enable/disable Halite::SpecHelper when configuring RSpec. + # + # @since 1.0.0 + # @return [Boolean] Include/don't include Halite::SpecHelper. + # @example + # require 'poise_boiler' + # PoiseBoiler.include_halite_spec_helper = false + # require 'poise_boiler/spec_helper' + def include_halite_spec_helper + defined?(@include_halite_spec_helper) ? @include_halite_spec_helper : true + end - def self.include_halite_spec_helper=(val) - @include_halite_spec_helper = val - end + def include_halite_spec_helper=(val) + @include_halite_spec_helper = val + end - # (see PoiseBoiler::Kitchen.kitchen) - def self.kitchen(platforms: 'ubuntu-14.04') - # Alias in a top-level namespace to reduce typing. - Kitchen.kitchen(platforms: platforms) + # (see PoiseBoiler::Kitchen.kitchen) + def kitchen(platforms: 'ubuntu-14.04') + # Alias in a top-level namespace to reduce typing. + Kitchen.kitchen(platforms: platforms) + end end end
Move class methods to a class << self because it makes Yard happier and ¯\_(ツ)_/¯.
diff --git a/lib/yuba/service.rb b/lib/yuba/service.rb index abc1234..def5678 100644 --- a/lib/yuba/service.rb +++ b/lib/yuba/service.rb @@ -8,6 +8,12 @@ return new.call if args.empty? new(**args).call + end + + def setup(**args) + return new.setup if args.empty? + + new(**args).setup end def property(name, options = {})
Add setup method like call
diff --git a/app/services/service_listeners/attachment_replacement_id_updater.rb b/app/services/service_listeners/attachment_replacement_id_updater.rb index abc1234..def5678 100644 --- a/app/services/service_listeners/attachment_replacement_id_updater.rb +++ b/app/services/service_listeners/attachment_replacement_id_updater.rb @@ -1,8 +1,5 @@ module ServiceListeners class AttachmentReplacementIdUpdater - include Rails.application.routes.url_helpers - include PublicDocumentRoutesHelper - attr_reader :attachment_data, :queue def initialize(attachment_data, queue: nil)
Remove unused includes in AttachmentReplacementIdUpdater Methods from these helpers are not used in this class.
diff --git a/lib/click/clicker.rb b/lib/click/clicker.rb index abc1234..def5678 100644 --- a/lib/click/clicker.rb +++ b/lib/click/clicker.rb @@ -7,7 +7,14 @@ @state = Hash.new(0) ObjectSpace.each_object do |object| - @state[object.class] += 1 + begin + klass = object.class + next unless klass.is_a?(Class) + rescue NoMethodError + next + end + + @state[klass] += 1 end @state[Symbol] = Symbol.all_symbols.count
Make click! more resilient against unclassy things
diff --git a/lib/guard/jasmine.rb b/lib/guard/jasmine.rb index abc1234..def5678 100644 --- a/lib/guard/jasmine.rb +++ b/lib/guard/jasmine.rb @@ -3,12 +3,26 @@ require 'guard/watcher' module Guard + + # The Jasmine guard that gets notifications about the following + # Guard events: `start`, `stop`, `reload`, `run_all` and `run_on_change`. + # class Jasmine < Guard autoload :Formatter, 'guard/jasmine/formatter' autoload :Inspector, 'guard/jasmine/inspector' autoload :Runner, 'guard/jasmine/runner' + # Initialize Guard::Jasmine. + # + # @param [Array<Guard::Watcher>] watchers the watchers in the Guard block + # @param [Hash] options the options for the Guard + # @option options [String] :jasmine_url the url of the Jasmine test runner + # @option options [String] :phantomjs_bin the location of the PhantomJS binary + # @option options [Boolean] :notification show notifications + # @option options [Boolean] :hide_success hide success message notification + # @option options [Boolean] :all_on_start run all suites on start + # def initialize(watchers = [], options = { }) defaults = { :jasmine_url => 'http://localhost:3000/jasmine', @@ -17,17 +31,26 @@ :hide_success => false, :all_on_start => true } + super(watchers, defaults.merge(options)) end + # Gets called once when Guard starts. + # def start run_all if options[:all_on_start] end + # Gets called when all specs should be run. + # def run_all run_on_change(['spec/javascripts']) end + # Gets called when watched paths and files have changes. + # + # @param [Array<String>] paths the changed paths and files + # def run_on_change(paths) Runner.run(Inspector.clean(paths), options) end
Add yardoc to the Jasmine Guard.
diff --git a/lib/hamlit/engine.rb b/lib/hamlit/engine.rb index abc1234..def5678 100644 --- a/lib/hamlit/engine.rb +++ b/lib/hamlit/engine.rb @@ -31,10 +31,10 @@ use Escapable use ForceEscapable filter :ControlFlow + use Ambles filter :MultiFlattener filter :StaticMerger use DynamicMerger - use Ambles use :Generator, -> { options[:generator] } end end
Put Ambles before MultiFlattener for optimization somehow it wasn't committed when I came up with it.
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -27,6 +27,6 @@ config.active_support.escape_html_entities_in_json = true # This ensures bootstrap-sass is compatible with the asset pipeline in rails 4 - config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif) + config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif *.woff *.eot *.svg *.ttf) end end
Update configuration to serve static assets true for production
diff --git a/lib/logstash/filters/uaparser.rb b/lib/logstash/filters/uaparser.rb index abc1234..def5678 100644 --- a/lib/logstash/filters/uaparser.rb +++ b/lib/logstash/filters/uaparser.rb @@ -12,11 +12,22 @@ # The name of the field to assign the UA data hash to config :container, :validate => :string, :default => "ua" + # name with full path of BrowserScope YAML file. + # One is shipped with this filter, but you can reference + # updated versions here. See https://github.com/tobie/ua-parser + # for updates + config :regexes_path, :validate => :string + public def register require 'user_agent_parser' - @parser = UserAgentParser::Parser.new + if @regexes_path.nil? + @parser = UserAgentParser::Parser.new + else + @logger.info? and @logger.info "Using regexes from", :regexes_path => @regexes_path) + @parser = UserAgentParser::Parser.new(regexes_path) + end end #def register public
Allow updating the regexes.yaml out of band. Add configuration to allow using a regexes.yaml other than the one shipped in user_agent_parser. Updated files can be found at https://github.com/tobie/ua-parser
diff --git a/lib/pickme/policy.rb b/lib/pickme/policy.rb index abc1234..def5678 100644 --- a/lib/pickme/policy.rb +++ b/lib/pickme/policy.rb @@ -33,7 +33,7 @@ def json_policy hash = { expiry: Pickme.config.expiry.call } - [:expiry, :call, :handle, :maxsize, :minsize, :path].each do |input| + [:call, :handle, :maxsize, :minsize, :path].each do |input| hash[input] = send(input) unless send(input).nil? end
Remove Expiry from Recalculation Every Time
diff --git a/lib/pronto/runner.rb b/lib/pronto/runner.rb index abc1234..def5678 100644 --- a/lib/pronto/runner.rb +++ b/lib/pronto/runner.rb @@ -13,8 +13,17 @@ file = Tempfile.new(blob.oid) file.write(blob.text) - file.close - file + + begin + if block_given? + file.flush + yield(file) + else + file + end + ensure + file.close unless file.closed? + end end end end
Add ability for create_tempfile do deal with a block
diff --git a/has_phone_numbers.gemspec b/has_phone_numbers.gemspec index abc1234..def5678 100644 --- a/has_phone_numbers.gemspec +++ b/has_phone_numbers.gemspec @@ -14,4 +14,7 @@ s.test_files = `git ls-files -- test/*`.split("\n") s.rdoc_options = %w(--line-numbers --inline-source --title has_phone_numbers --main README.rdoc) s.extra_rdoc_files = %w(README.rdoc CHANGELOG.rdoc LICENSE) + + s.add_development_dependency("rake") + s.add_development_dependency("plugin_test_helper", ">= 0.3.2") end
Add missing dependencies to gemspec
diff --git a/lib/superintendent/request/id.rb b/lib/superintendent/request/id.rb index abc1234..def5678 100644 --- a/lib/superintendent/request/id.rb +++ b/lib/superintendent/request/id.rb @@ -18,7 +18,7 @@ private def generate_request_id - "OHM#{SecureRandom.uuid.gsub!('-', '')}" + SecureRandom.uuid end end end
Use UUID for request ID
diff --git a/lib/refile/memory.rb b/lib/refile/memory.rb index abc1234..def5678 100644 --- a/lib/refile/memory.rb +++ b/lib/refile/memory.rb @@ -1,3 +1,4 @@+require "refile" require "refile/memory/version" module Refile
Make sure we require refile
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -5,3 +5,5 @@ # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Daley', city: cities.first) + +User.create!(login: "admin", email: "admin@example.com", password: "password")
Add seed for initial user