diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/chaindrive/database.rb b/lib/chaindrive/database.rb index abc1234..def5678 100644 --- a/lib/chaindrive/database.rb +++ b/lib/chaindrive/database.rb @@ -13,7 +13,7 @@ column :name, String, :index => true, :null => false column :version, String, :index => true, :null => false column :repository, String, :null => false - column :status, Boolean, :null => false, :default => true + column :status, TrueClass, :null => false, :default => true column :created_at, Datetime, :null => false, :index => true foreign_key :user_id, :users, :key => :id end
Modify the name of migration type to TrueClass for Boolean.
diff --git a/lib/dest/evaluator.rb b/lib/dest/evaluator.rb index abc1234..def5678 100644 --- a/lib/dest/evaluator.rb +++ b/lib/dest/evaluator.rb @@ -7,12 +7,12 @@ end def evaluate - expr_result = eval(parsed_attributes[1]) + expr_result = eval(@parsed_attributes[1]) - if expr_result == eval(parsed_attributes[2]) + if expr_result == eval(@parsed_attributes[2]) [true] else - [false, parsed_attributes[0], parsed_attributes[1], parsed_attributes[2], expr_result] + [false, @parsed_attributes[0], @parsed_attributes[1], @parsed_attributes[2], expr_result] # false, line number, expression, expected_result, actual_result end end
Fix a typo in Evaluator. ( used regular variable names rather then instance variables )
diff --git a/lib/dnsimple/error.rb b/lib/dnsimple/error.rb index abc1234..def5678 100644 --- a/lib/dnsimple/error.rb +++ b/lib/dnsimple/error.rb @@ -15,7 +15,7 @@ private def message_from(http_response) - if http_response.headers["Content-Type"] == "application/json" + if http_response.headers["Content-Type"] =~ %r{^application/json} http_response.parsed_response["message"] else net_http_response = http_response.response
Use regexp to detect the Content-Type
diff --git a/db/migrate/20111227235256_create_join_tables.rb b/db/migrate/20111227235256_create_join_tables.rb index abc1234..def5678 100644 --- a/db/migrate/20111227235256_create_join_tables.rb +++ b/db/migrate/20111227235256_create_join_tables.rb @@ -13,21 +13,21 @@ end create_table :lists_owners, :id => false do |t| - t.integer :list_id + t.integer :owned_list_id t.integer :owner_id end create_table :lists_posters, :id => false do |t| - t.integer :list_id + t.integer :poster_list_id t.integer :poster_id end add_index :lists_talks, :list_id add_index :lists_talks, :talk_id add_index :talks, :start_time - add_index :lists_owners, :list_id + add_index :lists_owners, :owned_list_id add_index :lists_owners, :owner_id - add_index :lists_posters, :list_id + add_index :lists_posters, :poster_list_id add_index :lists_posters, :poster_id end end
Fix up join tables again, add HABTM relationships
diff --git a/lib/active_mocker/mock/collection.rb b/lib/active_mocker/mock/collection.rb index abc1234..def5678 100644 --- a/lib/active_mocker/mock/collection.rb +++ b/lib/active_mocker/mock/collection.rb @@ -16,8 +16,8 @@ end extend ::Forwardable - def_delegators :@collection, :take, :push, :clear, :first, :last, :concat, :replace, :distinct, :uniq, :count, :size, :length, :empty?, :any?, :many?, :include?, :delete - alias distinct uniq + def_delegators :@collection, :take, :push, :clear, :first, :last, :concat, :replace, :uniq, :count, :size, :length, :empty?, :any?, :many?, :include?, :delete + alias_method :distinct, :uniq def select(&block) collection.select(&block)
Fix Ruby warning where distinct was being redefined.
diff --git a/lib/acts_as_paranoid/associations.rb b/lib/acts_as_paranoid/associations.rb index abc1234..def5678 100644 --- a/lib/acts_as_paranoid/associations.rb +++ b/lib/acts_as_paranoid/associations.rb @@ -9,7 +9,7 @@ module ClassMethods def belongs_to_with_deleted(target, options = {}) - with_deleted = options[:with_deleted] + with_deleted = options.delete(:with_deleted) result = belongs_to_without_deleted(target, options) if with_deleted
Revert "Do not delete :with_deleted from options" This reverts commit 5b2d844e352df9d62ca6b4f117749463dc73d060.
diff --git a/lib/dotenv-heroku/tasks.rb b/lib/dotenv-heroku/tasks.rb index abc1234..def5678 100644 --- a/lib/dotenv-heroku/tasks.rb +++ b/lib/dotenv-heroku/tasks.rb @@ -10,19 +10,20 @@ end desc "push the .env file to heroku config" - task :push, [:env_file] => :executable do |t, args| + task :push, [:env_file, :appname] => :executable do |t, args| args.with_defaults(env_file: ".env") - File.readlines(args[:env_file]).map(&:strip).each do |value| - sh "heroku config:set #{value}" - end + # Heroku allows setting env vars in 1 go + value = File.readlines(args[:env_file]).map(&:strip).join(' ') + sh "heroku config:set #{value} #{appname ? "--app #{appname}" : nil}" end desc "pull the config from heroku and write to .env file" - task :pull, [:env_file] => :executable do |t, args| + task :pull, [:env_file, :appname] => :executable do |t, args| args.with_defaults(env_file: ".env") + args.with_defaults(appname: nil) - remote_config = `heroku config` + remote_config = `heroku config #{appname ? "--app #{appname}" : nil}` remote_config or fail "could not fetch remote config" remote_config = remote_config.split("\n") remote_config.shift # remove the header
Allow the use of a app name this is for managing multiple apps in one folder. You can now pass the application name to the task. This in turn will be picked up by the heroku commands.
diff --git a/nokogiri_truncate_html.gemspec b/nokogiri_truncate_html.gemspec index abc1234..def5678 100644 --- a/nokogiri_truncate_html.gemspec +++ b/nokogiri_truncate_html.gemspec @@ -16,7 +16,7 @@ gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ["lib"] - gem.add_dependency "nokogiri", "~> 1.5.9" + gem.add_dependency "nokogiri", "~> 1.5.8" gem.add_dependency "activesupport", "~> 3.2.13" gem.add_dependency "htmlentities", "~> 4.3.1"
Downgrade version of nokogiri that we need.
diff --git a/features/step_definitions/file_steps.rb b/features/step_definitions/file_steps.rb index abc1234..def5678 100644 --- a/features/step_definitions/file_steps.rb +++ b/features/step_definitions/file_steps.rb @@ -2,8 +2,12 @@ create_file expand(virtual_path), expand(content) end -Given /^an executable called '(.*)'$/ do |virtual_path, content| - path = expand(virtual_path) - create_file path, expand(content) - File.chmod(0755, path) +Given /^an executable file named "(.*)" with:$/ do |file_path, content| + steps %Q{ + Given a file named "#{file_path}" with: + """ + #{content} + """ + } + File.chmod(0755, File.join([current_dir, file_path])) end
Rewrite a step to create an executable file
diff --git a/test/integration/default/minitest/test_default.rb b/test/integration/default/minitest/test_default.rb index abc1234..def5678 100644 --- a/test/integration/default/minitest/test_default.rb +++ b/test/integration/default/minitest/test_default.rb @@ -7,6 +7,6 @@ it "check R version" do system('echo "q()" > /tmp/showversion.R') system('/usr/local/R-devel/bin/R CMD BATCH /tmp/showversion.R') - assert system('grep "R version 3.2.3 RC" showversion.Rout'), 'R version is not expected version. patched version is updated' + assert system('grep "R version 3.2.3 Patched" showversion.Rout'), 'R version is not expected version. patched version is updated' end end
Update test case R version
diff --git a/lib/intouch/patches/project_patch.rb b/lib/intouch/patches/project_patch.rb index abc1234..def5678 100644 --- a/lib/intouch/patches/project_patch.rb +++ b/lib/intouch/patches/project_patch.rb @@ -41,11 +41,7 @@ if self.root? self.name else - titles = [] - ancestors = self.ancestors.visible.to_a - titles << ancestors - titles << name - titles.join(" » ") + "#{ self.parent.name } » #{ self.name }" end end
Fix project title for messages
diff --git a/app/commands/v2/put_link_set.rb b/app/commands/v2/put_link_set.rb index abc1234..def5678 100644 --- a/app/commands/v2/put_link_set.rb +++ b/app/commands/v2/put_link_set.rb @@ -7,6 +7,8 @@ content_id = link_params.fetch(:content_id) link_set = LinkSet.find_or_initialize_by(content_id: content_id) + + link_set.version += 1 link_set.links = link_set.links .merge(link_params.fetch(:links))
Increment the LinkSet version on update. New LinkSets start at version 0 and are incremented to version 1 as they're saved. This matches the behaviour of live and draft content items.
diff --git a/lib/arel/visitors/nuodb.rb b/lib/arel/visitors/nuodb.rb index abc1234..def5678 100644 --- a/lib/arel/visitors/nuodb.rb +++ b/lib/arel/visitors/nuodb.rb @@ -1,7 +1,7 @@ module Arel module Visitors class NuoDB < Arel::Visitors::ToSql - def visit_Arel_Nodes_SelectStatement o + def visit_Arel_Nodes_SelectStatement(o) [ (visit(o.with) if o.with), o.cores.map { |x| visit_Arel_Nodes_SelectCore x }.join, @@ -12,7 +12,7 @@ ].compact.join ' ' end - def visit_Arel_Nodes_Limit o + def visit_Arel_Nodes_Limit(o) "FETCH FIRST #{visit o.expr} ROWS ONLY" end end
Clean up a couple code-green issues.
diff --git a/lib/mortgage_calculator.rb b/lib/mortgage_calculator.rb index abc1234..def5678 100644 --- a/lib/mortgage_calculator.rb +++ b/lib/mortgage_calculator.rb @@ -9,10 +9,6 @@ mattr_accessor :stamp_duty_welsh_fix mattr_accessor :affordability_enabled - def self.stamp_duty_welsh_fix - @@stamp_duty_welsh_fix ||= lambda { |tool, locale| } - end - def self.configure yield self end
Revert "Default stamp duty welsh fix to a blank lambda" This reverts commit bb87792bd001d41e814081d0172cae2c4ca5e153.
diff --git a/spec/stack_overflow_spec.rb b/spec/stack_overflow_spec.rb index abc1234..def5678 100644 --- a/spec/stack_overflow_spec.rb +++ b/spec/stack_overflow_spec.rb @@ -1,4 +1,4 @@-require_relative 'spec_helper' +require 'spec_helper' require 'service/stack_overflow' include Service
Replace unnecessary require_relative with require
diff --git a/lib/sprockets/uglifier_compressor.rb b/lib/sprockets/uglifier_compressor.rb index abc1234..def5678 100644 --- a/lib/sprockets/uglifier_compressor.rb +++ b/lib/sprockets/uglifier_compressor.rb @@ -48,12 +48,15 @@ @uglifier.compile_with_map(data) end - minified = SourceMap::Map.from_json(map) - original = input[:metadata][:map] - combined = original | minified - - { data: js, - map: combined } + if input[:metadata][:map] + minified = SourceMap::Map.from_json(map) + original = input[:metadata][:map] + combined = original | minified + { data: js, + map: combined } + else + js + end end end end
Return bare js if no source map is created.
diff --git a/lib/bitmap.rb b/lib/bitmap.rb index abc1234..def5678 100644 --- a/lib/bitmap.rb +++ b/lib/bitmap.rb @@ -5,36 +5,38 @@ class Bitmap attr_reader :data - def initialize(width, height, color=nil) + def initialize(width, height) @data = Array.new(width) do Array.new(height) do - color || RandomColor.new + RandomColor.new end end end # Enlarge the data by a given factor. def enlarge(factor) - widened_data = stretch_width @data[0].length, factor - @data = stretch_height @data.length, factor, widened_data + stretch_width factor + stretch_height factor end - def stretch_width(width, factor) + def stretch_width(factor) + width = @data[0].length stretched = Array.new(width) { [] } @data.each_with_index do |row, row_index| row.each do |entry| factor.times { stretched[row_index] << entry } end end - stretched + @data = stretched end - def stretch_height(height, factor, data) + def stretch_height(factor) + height = @data.length stretched = Array.new(height) { [] } (factor*height).times do |index| - stretched[index] = data[index/factor] + stretched[index] = @data[index/factor] end - stretched + @data = stretched end end
Remove color from constructor and refactor stretch methods to use width from data.
diff --git a/lib/ruby_wedding/engine.rb b/lib/ruby_wedding/engine.rb index abc1234..def5678 100644 --- a/lib/ruby_wedding/engine.rb +++ b/lib/ruby_wedding/engine.rb @@ -9,5 +9,10 @@ g.helper false end + config.to_prepare do + Dir.glob(Rails.root + "app/decorators/**/**/*_decorator*.rb").each do |c| + require_dependency(c) + end + end end end
Allow decorators in the parent app.
diff --git a/lib/dox/formatters/json.rb b/lib/dox/formatters/json.rb index abc1234..def5678 100644 --- a/lib/dox/formatters/json.rb +++ b/lib/dox/formatters/json.rb @@ -2,9 +2,12 @@ module Formatters class Json < Dox::Formatters::Base def format - JSON.pretty_generate(JSON.parse(body || '')) - rescue JSON::ParserError - '' + # in cases where the body isn't valid JSON + # and the headers specify the Content-Type is application/json + # an error should be raised + return '' if body.nil? || body.length < 2 + + JSON.pretty_generate(JSON.parse(body)) end end end
Remove rescuing JSON parsing error in JSON formatter
diff --git a/lib/garufa/api/channels.rb b/lib/garufa/api/channels.rb index abc1234..def5678 100644 --- a/lib/garufa/api/channels.rb +++ b/lib/garufa/api/channels.rb @@ -15,8 +15,7 @@ plugin ChannelFilter plugin SettingsSetter - set :render, template_engine: 'yajl' - set :render, views: File.expand_path("views", File.dirname(__FILE__)) + set :render, template_engine: 'yajl', views: File.expand_path("views", File.dirname(__FILE__)) end Channels.define do
Set render settings with the same command.
diff --git a/lib/lager.rb b/lib/lager.rb index abc1234..def5678 100644 --- a/lib/lager.rb +++ b/lib/lager.rb @@ -4,6 +4,12 @@ end get '/servers' do + @servers = Server.all; + content_type :json + @servers.to_json + end + + get '/logs/server/all' do @servers = Server.all; content_type :json @servers.to_json
Add back get all servers into routes
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,4 +1,4 @@-require 'simplecov' +require 'simplecov' unless RUBY_ENGINE == 'jruby' require 'corefines' RSpec.configure do |config|
Disable SimpleCov when run on JRuby (it doesn't work there)
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,9 +2,14 @@ ENV["EDITOR"] = nil -require 'coveralls' -Coveralls.wear! do - add_filter 'spec/' +# Ruby 2.4.0 and 2.4.1 has a bug with its Coverage module that causes segfaults. +# https://bugs.ruby-lang.org/issues/13305 +# 2.4.2 should include this patch. +unless RUBY_VERSION == '2.4.0' || RUBY_VERSION == '2.4.1' + require 'coveralls' + Coveralls.wear! do + add_filter 'spec/' + end end require 'bundler/setup'
Disable coverage reporting with ruby 2.4.0/2.4.1
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,7 +9,9 @@ # for each example. This significantly DRYs up our linter specs to contain # only tests, since all the setup code is now centralized here. if described_class < SCSSLint::Linter - subject.run(SCSSLint::Engine.new(css)) + initial_indent = css[/\A(\s*)/, 1] + normalized_css = css.gsub(/^#{initial_indent}/, '') + subject.run(SCSSLint::Engine.new(normalized_css)) end end end
Normalize CSS indentation in specs Due to the use of Heredocs in specs, all CSS has leading indentation. In order to correctly write tests for an upcoming lint that detects invalid indentation, automatically normalize all CSS before it is passed to the engine to be parsed. Change-Id: I49891e2b4111ee7af066ddd2bf1db891aea5dacf Reviewed-on: https://gerrit.causes.com/29758 Tested-by: jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@causes.com> Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com>
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,7 +2,7 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'support')) -# $stdout = StringIO.new +$stdout = StringIO.new require 'grape'
Undo commented out stdout override.
diff --git a/lib/puppet/provider/rabbitmq_erlang_cookie/ruby.rb b/lib/puppet/provider/rabbitmq_erlang_cookie/ruby.rb index abc1234..def5678 100644 --- a/lib/puppet/provider/rabbitmq_erlang_cookie/ruby.rb +++ b/lib/puppet/provider/rabbitmq_erlang_cookie/ruby.rb @@ -3,9 +3,14 @@ Puppet::Type.type(:rabbitmq_erlang_cookie).provide(:ruby) do defaultfor :feature => :posix - has_command(:puppet, 'puppet') do - environment :PATH => '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin' + + env_path = '/opt/puppetlabs/bin:/usr/local/bin:/usr/bin:/bin' + puppet_path = Puppet::Util.withenv(:PATH => env_path) do + Puppet::Util.which('puppet') end + + confine :false => puppet_path.nil? + has_command(:puppet, puppet_path) unless puppet_path.nil? def exists? # Hack to prevent the create method from being called.
Fix incompatability with latest puppet
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,16 +1,26 @@ require 'octoshark' +require 'fileutils' +ROOT = File.expand_path('../', File.dirname(__FILE__)) +TMP = 'tmp' # Load support files -ROOT = File.expand_path('../', File.dirname(__FILE__)) Dir["#{ROOT}/spec/support/**/*.rb"].each { |f| require f } RSpec.configure do |config| config.include Helpers + config.before :suite do + FileUtils.mkdir_p(TMP) + end + config.before :each do ActiveRecord::Base.establish_connection({adapter: 'sqlite3', database: 'tmp/default.sqlite'}) Octoshark.reset! end + + config.after :suite do + FileUtils.rm_rf(TMP) + end end
Create 'tmp' folder before suite
diff --git a/spec/support/hax.rb b/spec/support/hax.rb index abc1234..def5678 100644 --- a/spec/support/hax.rb +++ b/spec/support/hax.rb @@ -21,10 +21,21 @@ class Object if ENV["BUNDLER_SPEC_RUBY_ENGINE"] + if defined?(RUBY_ENGINE) && RUBY_ENGINE != "jruby" && ENV["BUNDLER_SPEC_RUBY_ENGINE"] == "jruby" + begin + # this has to be done up front because psych will try to load a .jar + # if it thinks its on jruby + require "psych" + rescue LoadError + nil + end + end + remove_const :RUBY_ENGINE if defined?(RUBY_ENGINE) RUBY_ENGINE = ENV["BUNDLER_SPEC_RUBY_ENGINE"] if RUBY_ENGINE == "jruby" + remove_const :JRUBY_VERSION if defined?(JRUBY_VERSION) JRUBY_VERSION = ENV["BUNDLER_SPEC_RUBY_ENGINE_VERSION"] end end
[Hax] Support simulating jruby on MRI 2.3
diff --git a/lib/lita/external/robot.rb b/lib/lita/external/robot.rb index abc1234..def5678 100644 --- a/lib/lita/external/robot.rb +++ b/lib/lita/external/robot.rb @@ -27,7 +27,9 @@ end rescue => error Lita.logger.error("Outbound message failed: #{error.class}: #{error.message}") - Lita.config.robot.error_handler(error) + if Lita.config.robot.error_handler + Lita.config.robot.error_handler.call(error) + end end end end
Fix error reporting in outbound queue processing
diff --git a/lib/solve.rb b/lib/solve.rb index abc1234..def5678 100644 --- a/lib/solve.rb +++ b/lib/solve.rb @@ -25,7 +25,10 @@ # @param [Array<Solve::Demand>, Array<String, String>] demands # # @option options [#say] :ui (nil) - # a ui object for output + # a ui object for output, this will be used to output from a Solve::Tracers::HumanReadable if + # no other tracer is provided in options[:tracer] + # @option options [AbstractTracer] :tracer (nil) + # a Tracer object that is used to format and output tracing information # @option options [Boolean] :sorted (false) # should the output be a sorted list rather than a Hash # @@ -33,7 +36,7 @@ # # @return [Hash] def it!(graph, demands, options = {}) - @tracer = Solve::Tracers.human_readable(options[:ui]) + @tracer = options[:tracer] || Solve::Tracers.human_readable(options[:ui]) Solver.new(graph, demands, options[:ui]).resolve(options) end
Allow a user to pass in their own Tracer object so they are not forced into using the HumanReadable one.
diff --git a/app/helpers/dashboard_helper.rb b/app/helpers/dashboard_helper.rb index abc1234..def5678 100644 --- a/app/helpers/dashboard_helper.rb +++ b/app/helpers/dashboard_helper.rb @@ -11,6 +11,7 @@ if defined?(Graphite) require 'graphite/enrollment/status_info' include Graphite::Enrollment::StatusInfo + include Graphite::ElectiveBlocksCommonHelper end CONTEXT_FILTERS = [:newest, :recently_accepted, :recently_updated, :recently_created, :unaccepted, :newest_enrollments].freeze
Add graphite dependency in usi dashboard Change-Id: I65b2e8a1422544a191784d9b46ba074a062e1d62
diff --git a/lib/curtis.rb b/lib/curtis.rb index abc1234..def5678 100644 --- a/lib/curtis.rb +++ b/lib/curtis.rb @@ -1,4 +1,3 @@- require 'curtis/version' require 'ncurses' require 'curtis/base_view' @@ -15,8 +14,8 @@ def show(**options) screen = Ncurses.initscr - Ncurses.cbreak - Ncurses.noecho + Ncurses.cbreak if config.cbreak + Ncurses.noecho if config.noecho Ncurses.curs_set(0) if config.hide_cursor screen.refresh yield BaseView.new(screen) @@ -26,9 +25,13 @@ end class Configuration + attr_accessor :cbreak + attr_accessor :noecho attr_accessor :hide_cursor - def initializes + def initialize + @cbreak = true + @noecho = true @hide_cursor = false end end
Fix a typo. Add minor config options.
diff --git a/lib/redmine_revision_branches/git_adapter_patch.rb b/lib/redmine_revision_branches/git_adapter_patch.rb index abc1234..def5678 100644 --- a/lib/redmine_revision_branches/git_adapter_patch.rb +++ b/lib/redmine_revision_branches/git_adapter_patch.rb @@ -14,7 +14,7 @@ rescue ScmCommandAborted branches = Array.new end - branches.map { |branch| branch.split('/').last }.uniq + branches end end end
Fix for including branches with '/' in the name
diff --git a/spec/hello_sign/api/oauth_spec.rb b/spec/hello_sign/api/oauth_spec.rb index abc1234..def5678 100644 --- a/spec/hello_sign/api/oauth_spec.rb +++ b/spec/hello_sign/api/oauth_spec.rb @@ -17,7 +17,7 @@ describe '#refresh_oauth_token' do before do stub_post_oauth('/oauth/token', 'token') - @oauth_info = HelloSign.refresh_oauth_token 'oauth_token' + @oauth_info = HelloSign.refresh_oauth_token refresh_token: 'oauth_token' end it 'should get the correct resource' do
Fix broken test after changing method parameters
diff --git a/lib/duffel.rb b/lib/duffel.rb index abc1234..def5678 100644 --- a/lib/duffel.rb +++ b/lib/duffel.rb @@ -1,18 +1,33 @@ class Duffel VERSION = "0.0.1" - def self.method_missing(method, *args, &block) - fetch_default = lambda do |key| - raise KeyError.new("key not found: #{key}") + class << self + + def method_missing(method, *args, &block) + define_singleton_method(method) do |options=(args.first || {})| + return_value = options.fetch(:fallback, fetch_default) + fallback = format_return_value(return_value) + + env_name = method.to_s.upcase + ENV.fetch(env_name, &fallback) + end + self.send(method) end - define_singleton_method(method) do |options=(args.first || {})| - return_value = options.fetch(:fallback, fetch_default) - fallback = return_value.is_a?(Proc) ? return_value : lambda { |key| return_value } + protected - env_name = method.to_s.upcase - ENV.fetch(env_name, &fallback) + def format_return_value(value) + if value.is_a?(Proc) + value + else + lambda { |_key| value } + end end - self.send(method) + + def fetch_default + lambda do |key| + raise KeyError.new("key not found: #{key}") + end + end end end
Refactor some code. - format_return_value becomes it's own method instead of a one line ternary operator. - fetch_default is a method instead of a variable defined inside the method_missing block.
diff --git a/app/models/assets/background.rb b/app/models/assets/background.rb index abc1234..def5678 100644 --- a/app/models/assets/background.rb +++ b/app/models/assets/background.rb @@ -19,22 +19,18 @@ # class Background < ActiveRecord::Base include Imageable + include Attachable + belongs_to :attachable, polymorphic: true retina! - has_attached_file :image, - storage: :dropbox, - dropbox_credentials: Rails.root.join('config/dropbox.yml'), - path: '/backgrounds/:id/:style-:filename', - url: '/backgrounds/:id/:style-:filename', - styles: { - background: '4000x2000>', - large: '2000x1200>', - medium: '1000x600>', - small: '300x300>' - }, - retina: { quality: 70 }, - default_url: '/default/small-missing.png' + has_attachment :image, + styles: { + background: '4000x2000>', + large: '2000x1200>', + medium: '1000x600>', + small: '300x300>' + } validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/
Include Attachable concern to Background
diff --git a/spec/requests/healthcheck_spec.rb b/spec/requests/healthcheck_spec.rb index abc1234..def5678 100644 --- a/spec/requests/healthcheck_spec.rb +++ b/spec/requests/healthcheck_spec.rb @@ -18,6 +18,7 @@ expect(data.fetch(:checks)).to include( database_connectivity: { status: "ok" }, redis_connectivity: { status: "ok" }, + sidekiq_queue_latency: hash_including(status: "ok"), ) end end
Include queue_latency in the list of healthchecks to test
diff --git a/spec/requests/v1/api_csrf_spec.rb b/spec/requests/v1/api_csrf_spec.rb index abc1234..def5678 100644 --- a/spec/requests/v1/api_csrf_spec.rb +++ b/spec/requests/v1/api_csrf_spec.rb @@ -0,0 +1,27 @@+require 'spec_helper' + +describe 'api should not require csrf protection', type: :request do + before(:each) do + ActionController::Base.allow_forgery_protection = true + end + + it 'should return 200 when making a request without csrf' do + user = create(:user) + + token = create(:access_token, resource_owner_id: user.id) + allow(token).to receive(:accessible?).and_return(true) + allow(token).to receive(:scopes) + .and_return(Doorkeeper::OAuth::Scopes.from_array(%w(project public))) + + allow_any_instance_of(Api::V1::ProjectsController).to receive(:doorkeeper_token) + .and_return(token) + + post "/api/projects", { projects: { name: "new_hotness", + display_name: "New Hotness!", + description: "Your shits busted", + primary_language: 'en' } }.to_json, + { "HTTP_ACCEPT" => "application/vnd.api+json; version=1", + "CONTENT_TYPE" => "application/json; charset=utf-8" } + expect(response.status).to eq(201) + end +end
Add CSRF protection request spec
diff --git a/lib/progressive/subject.rb b/lib/progressive/subject.rb index abc1234..def5678 100644 --- a/lib/progressive/subject.rb +++ b/lib/progressive/subject.rb @@ -29,7 +29,7 @@ def method_missing(method_sym, *args, &block) if method_sym.to_s[-1] == '?' && specification.state?(method_sym.to_s[0..-2]) - state.send(method_sym) + specification.send(method_sym) else super end
Send delegated event to specification
diff --git a/lib/travis/logs/sidekiq.rb b/lib/travis/logs/sidekiq.rb index abc1234..def5678 100644 --- a/lib/travis/logs/sidekiq.rb +++ b/lib/travis/logs/sidekiq.rb @@ -6,12 +6,12 @@ module Sidekiq class << self def setup - Travis.logger.info('Setting up Sidekiq and the Redis connection') - Travis.logger.info("using redis:#{Logs.config.redis.inspect}") - Travis.logger.info("using sidekiq:#{Logs.config.sidekiq.inspect}") url = Logs.config.redis.url + redis_host = URI.parse(url).host + pool_size = Logs.config.sidekiq.pool_size namespace = Logs.config.sidekiq.namespace - pool_size = Logs.config.sidekiq.pool_size + + Travis.logger.info("Setting up Sidekiq (pool size: #{pool_size}) and Redis (connecting to host #{redis_host})") ::Sidekiq.redis = ::Sidekiq::RedisConnection.create({ :url => url, :namespace => namespace, :size => pool_size }) if Travis.config.log_level == :debug ::Sidekiq.logger = Travis.logger
Trim down the initial Sidekiq setup log output.
diff --git a/corsair.gemspec b/corsair.gemspec index abc1234..def5678 100644 --- a/corsair.gemspec +++ b/corsair.gemspec @@ -10,8 +10,8 @@ gem.authors = ["Varvet"] gem.email = ["info@varvet.se"] gem.homepage = "https://github.com/varvet/corsair" - gem.summary = "" - gem.description = "" + gem.summary = "Rack middleware for CORS responses in simple requests" + gem.description = "Corsair adds Access-Control-Allow-Origin to the response headers, even if your app raises an error." gem.license = "MIT" gem.files = `git ls-files -z`.split("\x0")
Add description and summary to gemspec
diff --git a/lib/radar/integration/rails3/templates/radar.rb b/lib/radar/integration/rails3/templates/radar.rb index abc1234..def5678 100644 --- a/lib/radar/integration/rails3/templates/radar.rb +++ b/lib/radar/integration/rails3/templates/radar.rb @@ -5,7 +5,10 @@ # ==> Reporter Configuration # Configure any reporters here. Reporters tell Radar how to report exceptions. # This may be to a file, to a server, to a stream, etc. At least one reporter - # is required for Radar to do somethign with your exceptions. + # is required for Radar to do something with your exceptions. By default, + # Radar reports to the Rails logger. Change this if you want to report to + # a file, a server, etc. + app.config.reporters.use :logger, :log_object => Rails.logger, :log_level => :error # Tell Radar to integrate this application with Rails 3. app.integrate :rails3
Change template for Rails3 to use LoggerReporter by default
diff --git a/lib/yajl/ffi.rb b/lib/yajl/ffi.rb index abc1234..def5678 100644 --- a/lib/yajl/ffi.rb +++ b/lib/yajl/ffi.rb @@ -0,0 +1,50 @@+require 'ffi' + +module Yajl + module FFI + extend ::FFI::Library + + ffi_lib 'yajl' + + enum :status, [ + :ok, + :client_canceled, + :error + ] + + enum :options, [ + :allow_comments, 0x01, + :allow_invalid_utf8, 0x02, + :allow_trailing_garbage, 0x04, + :allow_multiple_values, 0x08, + :allow_partial_values, 0x10 + ] + + class Callbacks < ::FFI::Struct + layout \ + :on_null, :pointer, + :on_boolean, :pointer, + :on_integer, :pointer, + :on_double, :pointer, + :on_number, :pointer, + :on_string, :pointer, + :on_start_object, :pointer, + :on_key, :pointer, + :on_end_object, :pointer, + :on_start_array, :pointer, + :on_end_array, :pointer + end + + typedef :pointer, :handle + + attach_function :alloc, :yajl_alloc, [:pointer, :pointer, :pointer], :handle + attach_function :free, :yajl_free, [:handle], :void + attach_function :config, :yajl_config, [:handle, :options, :varargs], :int + attach_function :parse, :yajl_parse, [:handle, :pointer, :size_t], :status + attach_function :complete_parse, :yajl_complete_parse, [:handle], :status + attach_function :get_error, :yajl_get_error, [:handle, :int, :pointer, :size_t], :pointer + attach_function :free_error, :yajl_free_error, [:handle, :pointer], :void + attach_function :get_bytes_consumed, :yajl_get_bytes_consumed, [:handle], :size_t + attach_function :status_to_string, :yajl_status_to_string, [:status], :string + end +end
Add FFI yajl function bindings.
diff --git a/spec/controllers/user/sessions_controller_spec.rb b/spec/controllers/user/sessions_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/user/sessions_controller_spec.rb +++ b/spec/controllers/user/sessions_controller_spec.rb @@ -5,8 +5,26 @@ @request.env["devise.mapping"] = Devise.mappings[:user] end + describe "#create" do + let(:user) { FactoryBot.create(:user, password: '/bin/animals64') } + + subject { post :create, params: { user: { login: user.email, password: user.password } } } + + it "logs in users without 2FA enabled without any further input" do + expect(subject).to redirect_to :root + end + + it "prompts users with 2FA enabled to enter a code" do + user.otp_module = :enabled + user.save + + expect(subject).to redirect_to :user_two_factor_entry + end + end + describe "#two_factor_entry" do subject { get :two_factor_entry } + it "redirects back to the home page if no sign in target is set" do expect(subject).to redirect_to :root end
Add basic login form tests
diff --git a/spec/features/admin/language_tree_feature_spec.rb b/spec/features/admin/language_tree_feature_spec.rb index abc1234..def5678 100644 --- a/spec/features/admin/language_tree_feature_spec.rb +++ b/spec/features/admin/language_tree_feature_spec.rb @@ -15,7 +15,7 @@ it "one should be able to switch the language tree" do visit('/admin/pages') - page.select 'Klingon', from: 'language_id' + select2 'Klingon', from: 'Language tree' expect(page).to have_selector('#sitemap', text: 'Klingon') end end @@ -25,7 +25,7 @@ it "displays a form for creating language root with preselected page layout and front page name" do visit('/admin/pages') - page.select 'Klingon', from: 'language_id' + select2 'Klingon', from: 'Language tree' expect(page).to have_content('This language tree does not exist') within('form#create_language_tree') do
Use select2 capybara helper to test language tree Former we were using the hidden select.
diff --git a/ostatus/lib/social_stream/ostatus/models/object.rb b/ostatus/lib/social_stream/ostatus/models/object.rb index abc1234..def5678 100644 --- a/ostatus/lib/social_stream/ostatus/models/object.rb +++ b/ostatus/lib/social_stream/ostatus/models/object.rb @@ -10,7 +10,7 @@ obj.author = obj.user_author = obj.owner = - SocialStream::ActivityStreams.actor_from_entry! entry + SocialStream::ActivityStreams.actor_from_entry!(entry) obj.title = entry.title obj.description = entry.content
Fix assignation in ruby 1.9.2
diff --git a/app/controllers/admin/proxy_orders_controller.rb b/app/controllers/admin/proxy_orders_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/proxy_orders_controller.rb +++ b/app/controllers/admin/proxy_orders_controller.rb @@ -9,9 +9,7 @@ def cancel if @proxy_order.cancel - respond_with(@proxy_order) do |format| - format.json { render_as_json @proxy_order } - end + render_as_json @proxy_order else respond_with(@proxy_order) do |format| format.json { render json: { errors: [t('admin.proxy_orders.cancel.could_not_cancel_the_order')] }, status: :unprocessable_entity } @@ -21,13 +19,9 @@ def resume if @proxy_order.resume - respond_with(@proxy_order) do |format| - format.json { render_as_json @proxy_order } - end + render_as_json @proxy_order else - respond_with(@proxy_order) do |format| - format.json { render json: { errors: [t('admin.proxy_orders.resume.could_not_resume_the_order')] }, status: :unprocessable_entity } - end + render json: { errors: [t('admin.proxy_orders.resume.could_not_resume_the_order')] }, status: :unprocessable_entity end end end
Remove usage of the responder as this is a json only controller
diff --git a/app/controllers/storytime/subscriptions_controller.rb b/app/controllers/storytime/subscriptions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/storytime/subscriptions_controller.rb +++ b/app/controllers/storytime/subscriptions_controller.rb @@ -7,7 +7,7 @@ def create @subscription = Storytime::Subscription.find_by(permitted_attributes) || Storytime::Subscription.new(permitted_attributes) @subscription.site = Storytime::Site.first if @subscription.site.nil? # if we ever go multi-site, this would likely become current_site - @subscription.subscribed = true if @subscription.subscribed == false + @subscription.subscribed = true unless @subscription.subscribed if @subscription.save flash[:notice] = I18n.t('flash.subscriptions.create.success')
Use unless instead of equality test
diff --git a/lib/sfn/command.rb b/lib/sfn/command.rb index abc1234..def5678 100644 --- a/lib/sfn/command.rb +++ b/lib/sfn/command.rb @@ -1,19 +1,20 @@ require 'sfn' +require 'bogo-cli' -class Sfn +module Sfn class Command < Bogo::Cli::Command - autoload :CloudformationCreate, 'sfn/command/cloudformation_create' - autoload :CloudformationDescribe, 'sfn/command/cloudformation_describe' - autoload :CloudformationDestroy, 'sfn/command/cloudformation_destroy' - autoload :CloudformationEvents, 'sfn/command/cloudformation_events' - autoload :CloudformationExport, 'sfn/command/cloudformation_export' - autoload :CloudformationImport, 'sfn/command/cloudformation_import' - autoload :CloudformationInspect, 'sfn/command/cloudformation_inspect' - autoload :CloudformationList, 'sfn/command/cloudformation_list' - autoload :CloudformationPromote, 'sfn/command/cloudformation_promote' - autoload :CloudformationUpdate, 'sfn/command/cloudformation_update' - autoload :CloudformationValidate, 'sfn/command/cloudformation_validate' + autoload :Create, 'sfn/command/create' + autoload :Describe, 'sfn/command/describe' + autoload :Destroy, 'sfn/command/destroy' + autoload :Events, 'sfn/command/events' + autoload :Export, 'sfn/command/export' + autoload :Import, 'sfn/command/import' + autoload :Inspect, 'sfn/command/inspect' + autoload :List, 'sfn/command/list' + autoload :Promote, 'sfn/command/promote' + autoload :Update, 'sfn/command/update' + autoload :Validate, 'sfn/command/validate' end end
Fix toplevel namespace type. Remove cloudformation prefixing.
diff --git a/application/utility/clear_catalog_credentials.rb b/application/utility/clear_catalog_credentials.rb index abc1234..def5678 100644 --- a/application/utility/clear_catalog_credentials.rb +++ b/application/utility/clear_catalog_credentials.rb @@ -0,0 +1,41 @@+#!/usr/bin/env ruby +# +# Copyright (C) 2010-2016 dtk contributors +# +# This file is part of the dtk project. +# +# 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. +# +root = File.expand_path('../', File.dirname(__FILE__)) + + +puts 'Clearing catalog credentials ...' + +require root + '/app' + +default_project = ::DTK::Project.get_all(::DTK::ModelHandle.new(c = 2, :project)).first +::DTK::Model.get_objs(default_project.model_handle(:user), { cols: ::DTK::User.common_columns }) + +session = ::DTK::CurrentSession.new +session.set_user_object(default_project.get_field?(:user)) +session.set_auth_filters(:c, :group_ids) + +users = ::DTK::Model.get_objs(default_project.model_handle(:user), { cols: [:id, :catalog_username, :catalog_password] }) + +users.each do |user| + user.update(catalog_password: nil, catalog_username: nil) +end + +::DTK::Model.update_from_rows(default_project.model_handle(:user), users) + +puts 'Catalog credentials have been purged successfully!'
Add script to clear catalog credentials
diff --git a/lib/capones_recipes/tasks/rails/logs.rb b/lib/capones_recipes/tasks/rails/logs.rb index abc1234..def5678 100644 --- a/lib/capones_recipes/tasks/rails/logs.rb +++ b/lib/capones_recipes/tasks/rails/logs.rb @@ -1,6 +1,6 @@ Capistrano::Configuration.instance.load do desc "Watch the log on the application server." - task :watch_logs, :role => :app do + task :watch_logs, :roles => :app do log_file = "#{shared_path}/log/#{rails_env}.log" run "tail -f #{log_file}" do |channel, stream, data|
Fix :role to :roles in task condition.
diff --git a/lib/myspec.rb b/lib/myspec.rb index abc1234..def5678 100644 --- a/lib/myspec.rb +++ b/lib/myspec.rb @@ -1,12 +1,15 @@ module DSL def describe(&block) - ContextDSL.new.instance_eval &block + context = ContextDSL.new + context.instance_eval &block + context.run end end class ContextDSL def initialize @givens = [] + @thens = [] end def Given(&block) @@ -14,7 +17,13 @@ end def Then(&block) - puts Then.new(block).run(@givens) ? 'pass' : 'fail' + @thens << Then.new(block) + end + + def run + @thens.each do |t| + puts t.run(@givens) ? 'pass' : 'fail' + end end end
Make all Givens run before Thens
diff --git a/mssql/recipes/configure.rb b/mssql/recipes/configure.rb index abc1234..def5678 100644 --- a/mssql/recipes/configure.rb +++ b/mssql/recipes/configure.rb @@ -9,7 +9,7 @@ end end -registry_key "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\#{node[:mssql][:service_name]}\\MSSQLServer" do +registry_key "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Microsoft SQL Server\\#{node[:mssql][:instance_id]}\\MSSQLServer" do values [{:name => "DefaultData", :type => :string, :data => "#{data_path}"}, {:name => "DefaultLog", :type => :string, :data => "#{log_path}"}, {:name => "BackupDirectory", :type => :string, :data => "#{backup_path}"}
Change mssql registry keys path
diff --git a/lib/crispy/crispy_internal/class_spy.rb b/lib/crispy/crispy_internal/class_spy.rb index abc1234..def5678 100644 --- a/lib/crispy/crispy_internal/class_spy.rb +++ b/lib/crispy/crispy_internal/class_spy.rb @@ -17,12 +17,8 @@ end def define_wrapper method_name - #return method_name if method_name == :initialize - return method_name if method_name == :method_missing - p method_name define_method method_name do|*arguments, &attached_block| - #::Kernel.print "e" # <= with this statement, prepend-ing :method_missing doesn't cause the segfault. - ::Crispy::CrispyInternal::ClassSpy.of_class(::Kernel.p self.class).received_messages << + ::Crispy::CrispyInternal::ClassSpy.of_class(self.class).received_messages << ::Crispy::CrispyReceivedMessageWithReceiver.new(self, method_name, *arguments, &attached_block) super(*arguments, &attached_block) end
Revert "add more codes to reproduce segfault more." This reverts commit a56586e48bf3a88dd9d19068d53fdb67f3e2faac.
diff --git a/app/grids/grid_state_grid.rb b/app/grids/grid_state_grid.rb index abc1234..def5678 100644 --- a/app/grids/grid_state_grid.rb +++ b/app/grids/grid_state_grid.rb @@ -9,9 +9,9 @@ column :email, label: 'User' column :grid_name - column :name column :state_value, editable: true, only: [:GridStatesScreen] - column :current, editable: false, formable: false, sortable: false, filterable: false + column :name, label: 'View Name' + column :current, label: 'Is Current View?', sortable: false, filterable: false action :make_default_grid, title: "Make default", icon: :publish, toolbar_item: true action :filter_default_grid_states, toolbar_item: false
Rename columns in grid state
diff --git a/lib/rabatt.rb b/lib/rabatt.rb index abc1234..def5678 100644 --- a/lib/rabatt.rb +++ b/lib/rabatt.rb @@ -6,4 +6,7 @@ module Rabatt # Your code goes here... +def Rabatt(provider_name, options = {}) + class_name = provider_name.to_s.capitalize + Object.const_get("Rabatt::Providers::#{class_name}").new end
Add shortcut method to get new instance of provider class
diff --git a/lib/jquery-colorpicker-rails/version.rb b/lib/jquery-colorpicker-rails/version.rb index abc1234..def5678 100644 --- a/lib/jquery-colorpicker-rails/version.rb +++ b/lib/jquery-colorpicker-rails/version.rb @@ -1,7 +1,7 @@ module Jquery module Colorpicker module Rails - VERSION = "1.0.4.1" + VERSION = "1.0.4.1.1" end end end
Update to rails-4: - Fix css assets urls
diff --git a/lib/generators/rspec/swagger/templates/spec.rb b/lib/generators/rspec/swagger/templates/spec.rb index abc1234..def5678 100644 --- a/lib/generators/rspec/swagger/templates/spec.rb +++ b/lib/generators/rspec/swagger/templates/spec.rb @@ -1,6 +1,6 @@ require 'swagger_helper' -RSpec.describe '<%= file_name %>', type: :request do +RSpec.describe '<%= controller_path %>', type: :request do <% @routes.each do | template, path_item | %> path '<%= template %>' do <% unless path_item[:params].empty? -%>
Use the namespaced controller name for the top describe
diff --git a/lib/puppet/provider/vagrant_box/vagrant_box.rb b/lib/puppet/provider/vagrant_box/vagrant_box.rb index abc1234..def5678 100644 --- a/lib/puppet/provider/vagrant_box/vagrant_box.rb +++ b/lib/puppet/provider/vagrant_box/vagrant_box.rb @@ -33,7 +33,7 @@ name, vprovider = @resource[:name].split('/') boxes = vagrant "box", "list" - boxes =~ /^#{name}\s+\(#{vprovider}\)/ + boxes =~ /^#{name}\s+\(#{vprovider}(, .+)?\)/ end end
Fix the box list regex for vagrant 1.6+ In vagrant 1.5, `vagrant box list` looked like: ``` lenny64 (vmware_fusion) precise64 (vmware_fusion) ``` Vagrant 1.6 added the version to the list: ``` lenny64 (vmware_fusion, 0) precise64 (vmware_fusion, 0) ``` This new regex supports either version
diff --git a/lib/rails_presenter/presenter_helper.rb b/lib/rails_presenter/presenter_helper.rb index abc1234..def5678 100644 --- a/lib/rails_presenter/presenter_helper.rb +++ b/lib/rails_presenter/presenter_helper.rb @@ -2,7 +2,7 @@ module PresenterHelper def present(template = self, object, with: nil, &block) if object.is_a?(Array) || object.is_a?(ActiveRecord::Relation) - return object.map {|e| present(e)} + return object.map {|e| present(e, with: with)} end begin
Fix with option for collections
diff --git a/lib/social_login/acts_as_social_user.rb b/lib/social_login/acts_as_social_user.rb index abc1234..def5678 100644 --- a/lib/social_login/acts_as_social_user.rb +++ b/lib/social_login/acts_as_social_user.rb @@ -5,8 +5,11 @@ included do def friends_that_use_the_app + self.class.joins(:services).where('social_login_services.remote_id IN (?)', remote_ids) + end + + def remote_ids remote_ids = services.map(&:friend_ids).flatten.map(&:to_s) - self.class.joins(:services).where('social_login_services.remote_id IN (?)', remote_ids) end end
Move remote_ids into its own method so apps can create their own queries if they like
diff --git a/lib/tasks/delete-old-embedded-runs.rake b/lib/tasks/delete-old-embedded-runs.rake index abc1234..def5678 100644 --- a/lib/tasks/delete-old-embedded-runs.rake +++ b/lib/tasks/delete-old-embedded-runs.rake @@ -0,0 +1,14 @@+namespace :taverna_player do + desc "Delete all completed embedded workflow runs." + task :delete_completed_embedded_runs => :environment do + + gone = 0 + TavernaPlayer::Run.find_all_by_embedded(true).each do |run| + if run.complete? + gone += 1 if run.destroy + end + end + + puts "#{gone} complete embedded runs were deleted." + end +end
[TAV-346] Add a rake task to delete embedded runs. Cleans up all completed embedded runs.
diff --git a/lib/travis/build/addons/apt_packages.rb b/lib/travis/build/addons/apt_packages.rb index abc1234..def5678 100644 --- a/lib/travis/build/addons/apt_packages.rb +++ b/lib/travis/build/addons/apt_packages.rb @@ -11,12 +11,23 @@ sh.echo "Installing APT Packages (BETA)", ansi: :yellow whitelisted = [] + disallowed = [] + config.each do |package| if whitelist.include?(package) whitelisted << package else - sh.echo "Ignoring unknown/disallowed package #{package.inspect}" + disallowed << package end + end + + unless disallowed.empty? + sh.echo "Disallowing packages: #{disallowed.join(', ')}", ansi: :red + sh.echo 'If you require these packages, please submit them for ' \ + 'review in a new issue:' + sh.echo ' https://github.com/travis-ci/travis-ci/issues/new' \ + '?labels[]=apt-whitelist&labels[]=travis-build' \ + "&title=APT+whitelist+request+for+#{disallowed.join(',+')}" end unless whitelisted.empty?
Add message about how to submit request for apt whitelist
diff --git a/vagrant_cloud.gemspec b/vagrant_cloud.gemspec index abc1234..def5678 100644 --- a/vagrant_cloud.gemspec +++ b/vagrant_cloud.gemspec @@ -1,14 +1,14 @@ Gem::Specification.new do |s| s.name = 'vagrant_cloud' s.version = '1.1.0' - s.summary = 'HashiCorp Atlas API client' - s.description = 'Minimalistic ruby client for the HashiCorp Atlas API (previously Vagrant Cloud API)' - s.authors = ['Cargo Media'] - s.email = 'tech@cargomedia.ch' + s.summary = 'Vagrant Cloud API client' + s.description = 'Ruby client for the HashiCorp Vagrant Cloud API' + s.authors = ['HashiCorp', 'Cargo Media'] + s.email = 'vagrant@hashicorp.com' s.files = Dir['LICENSE*', 'README*', '{bin,lib}/**/*'].reject { |f| f.end_with?('~') } - s.homepage = 'https://github.com/cargomedia/vagrant_cloud' + s.homepage = 'https://github.com/hashicorp/vagrant_cloud' s.license = 'MIT' s.executables << 'vagrant_cloud'
Update Rubygems specification after transfer
diff --git a/lib/ember_devise_simple_auth.rb b/lib/ember_devise_simple_auth.rb index abc1234..def5678 100644 --- a/lib/ember_devise_simple_auth.rb +++ b/lib/ember_devise_simple_auth.rb @@ -1,7 +1,6 @@ $: << File.expand_path(File.join(__FILE__, '../../support/rails/lib')) - -require "ember_devise_simple_auth/engine" module EmberDeviseSimpleAuth end +require "ember_devise_simple_auth/engine"
Fix placement of gem require
diff --git a/telemetry-logger.gemspec b/telemetry-logger.gemspec index abc1234..def5678 100644 --- a/telemetry-logger.gemspec +++ b/telemetry-logger.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'telemetry-logger' - s.version = '0.1.4' + s.version = '0.1.5' s.summary = 'Logging to STDERR with coloring and levels of severity' s.description = ' '
Package version is incremented from patch number 0.1.4 to 0.1.5
diff --git a/upstream-tracker.gemspec b/upstream-tracker.gemspec index abc1234..def5678 100644 --- a/upstream-tracker.gemspec +++ b/upstream-tracker.gemspec @@ -18,6 +18,8 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] + spec.add_runtime_dependency "thor", "~> 0.19" + spec.add_development_dependency "bundler", "~> 1.7" spec.add_development_dependency "rake", "~> 10.0" end
Add runtime dependency to thor
diff --git a/spec/controllers/activity_sessions_controller_spec.rb b/spec/controllers/activity_sessions_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/activity_sessions_controller_spec.rb +++ b/spec/controllers/activity_sessions_controller_spec.rb @@ -55,6 +55,12 @@ it 'responds with 302 redirect' do expect(response).to be_redirect end + + it 'calls the update_last_activity_date function' do + + expect(controller).to receive(:update_student_last_active) + get :play, {id: activity_session.id} + end end end
Add test to check that the callback is called correctly.
diff --git a/lib/after_commit_queue.rb b/lib/after_commit_queue.rb index abc1234..def5678 100644 --- a/lib/after_commit_queue.rb +++ b/lib/after_commit_queue.rb @@ -4,6 +4,13 @@ included do after_commit :_run_after_commit_queue after_rollback :_clear_after_commit_queue + end + + # Public: Add method to after commit queue + def run_after_commit(method = nil, &block) + _after_commit_queue << Proc.new { self.send(method) } if method + _after_commit_queue << block if block + true end protected @@ -17,13 +24,6 @@ @after_commit_queue.clear end - # Protected: Add method to after commit queue - def run_after_commit(method = nil, &block) - _after_commit_queue << Proc.new { self.send(method) } if method - _after_commit_queue << block if block - true - end - # Protected: Return after commit queue # Returns: Array with methods to run def _after_commit_queue
Make method public so it can be used in an observer
diff --git a/lib/akabei/chroot_tree.rb b/lib/akabei/chroot_tree.rb index abc1234..def5678 100644 --- a/lib/akabei/chroot_tree.rb +++ b/lib/akabei/chroot_tree.rb @@ -10,6 +10,7 @@ BASE_PACKAGES = %w[base base-devel sudo] def create + @root.mkpath mkarchroot(*BASE_PACKAGES) end
Prepare directory before creating chroot tree
diff --git a/test/test_integration.rb b/test/test_integration.rb index abc1234..def5678 100644 --- a/test/test_integration.rb +++ b/test/test_integration.rb @@ -27,14 +27,17 @@ def test_encoding_issues params = { 'SearchIndex' => 'All', 'Keywords' => 'google' } - - %w(BR CA CN DE ES FR GB IN IT JP US).each do |locale| + titles = %w(BR CA CN DE ES FR GB IN IT JP US).flat_map do |locale| req = Vacuum.new(locale) req.associate_tag = 'foo' res = req.item_search(query: params) - item = res.to_h['ItemSearchResponse']['Items']['Item'].sample + items = res.to_h['ItemSearchResponse']['Items']['Item'] + items.map { |item| item['ItemAttributes']['Title'] } + end + encodings = titles.map { |t| t.encoding.name }.uniq - assert_equal 'UTF-8', item['ASIN'].encoding.name - end + # Newer JRuby now appears to return both US-ASCII and UTF-8, depending on + # whether the string has non-ASCII characters. MRI will only return latter. + assert encodings.any? { |encoding| encoding == 'UTF-8' } end end
Handle divergent JRuby logic in test
diff --git a/spec/unit/generator/acknowledgements/plist_spec.rb b/spec/unit/generator/acknowledgements/plist_spec.rb index abc1234..def5678 100644 --- a/spec/unit/generator/acknowledgements/plist_spec.rb +++ b/spec/unit/generator/acknowledgements/plist_spec.rb @@ -35,8 +35,9 @@ } end - it "writes a plist to disk" do + it "writes a plist to disk at the given path" do path = @sandbox.root + "#{@target_definition.label}-Acknowledgements.plist" - @plist.save_as(path).should.be.true + Xcodeproj.expects(:write_plist).with(equals(@plist.plist), equals(path)) + @plist.save_as(path) end end
Improve Plist Acknowledgements unit testing a little
diff --git a/lib/ember/es6_template.rb b/lib/ember/es6_template.rb index abc1234..def5678 100644 --- a/lib/ember/es6_template.rb +++ b/lib/ember/es6_template.rb @@ -19,13 +19,8 @@ autoload :ES6Module, 'ember/es6_template/es6module' def self.setup(env) - env.register_mime_type 'text/ecmascript-6', extensions: ['.es6'], charset: :unicode - env.register_transformer 'text/ecmascript-6', 'application/javascript', ES6 - env.register_preprocessor 'text/ecmascript-6', Sprockets::DirectiveProcessor - - env.register_mime_type 'text/ecmascript-6+module', extensions: ['.module.es6'], charset: :unicode - env.register_transformer 'text/ecmascript-6+module', 'application/javascript', ES6Module - env.register_preprocessor 'text/ecmascript-6+module', Sprockets::DirectiveProcessor + env.register_engine '.es6', ES6, mime_type: 'application/javascript' + env.register_engine '.module.es6', ES6Module, mime_type: 'application/javascript' end else raise "Unsupported sprockets version: #{Sprockets::VERSION}"
Fix for `.module.es6` with sprockets 3 It is too strict to content type.
diff --git a/spec/controllers/spree/products_controller_spec.rb b/spec/controllers/spree/products_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/spree/products_controller_spec.rb +++ b/spec/controllers/spree/products_controller_spec.rb @@ -11,13 +11,13 @@ end describe '#show' do - it 'returns only variants with option values' do + it 'returns all variants even if they dont have option values' do product = create(:product_with_option_types) create(:base_variant, product: product) # this has option values create(:base_variant, product: product, option_values: []) get :show, params: { id: product.to_param } - expect(assigns['variants'].count).to eq(1) + expect(assigns['variants'].count).to eq(3) end end end
Fix spec to expect all variants instead of only ones with option_values
diff --git a/Casks/serf.rb b/Casks/serf.rb index abc1234..def5678 100644 --- a/Casks/serf.rb +++ b/Casks/serf.rb @@ -5,7 +5,7 @@ # bintray.com is the official download host per the vendor homepage url "https://dl.bintray.com/mitchellh/serf/#{version}_darwin_amd64.zip" name 'Serf' - homepage 'http://www.serfdom.io/' + homepage 'https://www.serfdom.io/' license :mpl binary 'serf'
Fix homepage to use SSL in Serf Cask The HTTP URL is already getting redirected to HTTPS. Using the HTTPS URL directly makes it more secure and saves a HTTP round-trip.
diff --git a/cookbooks/wt_monitoring/recipes/email_heartbeat.rb b/cookbooks/wt_monitoring/recipes/email_heartbeat.rb index abc1234..def5678 100644 --- a/cookbooks/wt_monitoring/recipes/email_heartbeat.rb +++ b/cookbooks/wt_monitoring/recipes/email_heartbeat.rb @@ -11,5 +11,5 @@ cron "email_heartbeat" do hour "*/6" - command "echo \"At the tone the time will be $(date \\+\\%k:\\%M` on $(date \\+\\%Y-\\%m-\\%d)\" | /bin/mail -s \"Nagios 4hr Heartbeat - $(date \\+\\%k:\\%M)\" #{node['wt_common']['admin_email']}" + command "echo \"At the tone the time will be $(date \\+\\%k:\\%M) on $(date \\+\\%Y-\\%m-\\%d)\" | /bin/mail -s \"Nagios 4hr Heartbeat - $(date \\+\\%k:\\%M)\" #{node['wt_common']['admin_email']}" end
Tweak the cron job for the nagios heartbeat Former-commit-id: f1df6c478f62b9bf6f2526c176ef225d07b2c863 [formerly 2f27ef241098d754005e40498259303876d2497c] [formerly 972bf819f651da59f633e2e82084dc136fd48692 [formerly a1d0fa0644b4cd0ffb88e7361a1adbbbb8b24612 [formerly 96715a01d89bf33118d1bb395a5329cf24d13c45]]] Former-commit-id: 3e05ca9892187769f98a2efa39908e3f00ce5e59 [formerly 3f799a1eb91bf92deee6ac0dd4ebe61e72d83431] Former-commit-id: cae7557f48258236b44022c1f46d20383afe0b09 Former-commit-id: bed18f8b4319e0492202653baaeae0fbce898850
diff --git a/app/models/givey_rails/user.rb b/app/models/givey_rails/user.rb index abc1234..def5678 100644 --- a/app/models/givey_rails/user.rb +++ b/app/models/givey_rails/user.rb @@ -1,9 +1,6 @@ module GiveyRails class User include GiveyModel - - attr_accessor :email, :password, :givey_tag, :password_confirmation, :remember_me - #validates_presence_of :email, :password # RELATIONSHIPS def like_this_charity?(charity)
Remove accessors in favour of nil object for forms
diff --git a/app/models/web_content_item.rb b/app/models/web_content_item.rb index abc1234..def5678 100644 --- a/app/models/web_content_item.rb +++ b/app/models/web_content_item.rb @@ -1,12 +1,14 @@ fields = %i{ id analytics_identifier + base_path content_id description details document_type first_published_at last_edited_at + locale need_ids phase public_updated_at @@ -14,14 +16,12 @@ redirects rendering_app routes + state schema_name title + unpublishing_type update_type - base_path - locale - state user_facing_version - unpublishing_type } WebContentItem = Struct.new(*fields) do
Correct alphabetical ordering of fields on WebContentItem
diff --git a/ruby/spec/bson/min_key_spec.rb b/ruby/spec/bson/min_key_spec.rb index abc1234..def5678 100644 --- a/ruby/spec/bson/min_key_spec.rb +++ b/ruby/spec/bson/min_key_spec.rb @@ -16,16 +16,10 @@ it_behaves_like "a JSON serializable object" end - let(:type) { 255.chr } - let(:obj) { described_class.new } - let(:bson) { BSON::NO_VALUE } + describe "#==" do - it_behaves_like "a bson element" - it_behaves_like "a serializable bson element" - it_behaves_like "a deserializable bson element" + context "when the objects are equal" do - describe "#==" do - context "when the objects are equal" do let(:other) { described_class.new } it "returns true" do @@ -34,6 +28,7 @@ end context "when the other object is not a max_key" do + it "returns false" do expect(subject).to_not eq("test") end @@ -41,14 +36,27 @@ end describe "#>" do + it "always returns false" do expect(subject > Integer::MAX_64BIT).to be_false end end describe "#<" do + it "always returns true" do expect(subject < Integer::MAX_64BIT).to be_true end end + + describe "#to_bson/#from_bson" do + + let(:type) { 255.chr } + let(:obj) { described_class.new } + let(:bson) { BSON::NO_VALUE } + + it_behaves_like "a bson element" + it_behaves_like "a serializable bson element" + it_behaves_like "a deserializable bson element" + end end
Reformat min key spec for consistency
diff --git a/files/private-chef-cookbooks/private-chef/metadata.rb b/files/private-chef-cookbooks/private-chef/metadata.rb index abc1234..def5678 100644 --- a/files/private-chef-cookbooks/private-chef/metadata.rb +++ b/files/private-chef-cookbooks/private-chef/metadata.rb @@ -11,4 +11,4 @@ supports os end -depends "runit", "1.2.0" +depends "runit", "= 1.2.0"
Add = to runit version constraint
diff --git a/lib/patches/active_record/xml_attribute_serializer.rb b/lib/patches/active_record/xml_attribute_serializer.rb index abc1234..def5678 100644 --- a/lib/patches/active_record/xml_attribute_serializer.rb +++ b/lib/patches/active_record/xml_attribute_serializer.rb @@ -3,8 +3,7 @@ ActiveRecord::XmlSerializer::Attribute.class_eval do def compute_type_with_translations klass = @serializable.class - if klass.respond_to?(:translated_attribute_names) && - klass.translated_attribute_names.include?(name.to_sym) + if klass.translates? && klass.translated_attribute_names.include?(name.to_sym) :string else compute_type_without_translations
Use klass.translates? per clemens suggestion.
diff --git a/spec/features/projects/tree/upload_file_spec.rb b/spec/features/projects/tree/upload_file_spec.rb index abc1234..def5678 100644 --- a/spec/features/projects/tree/upload_file_spec.rb +++ b/spec/features/projects/tree/upload_file_spec.rb @@ -35,17 +35,4 @@ expect(page).to have_selector('.multi-file-tab', text: 'doc_sample.txt') expect(find('.blob-editor-container .lines-content')['innerText']).to have_content(File.open(txt_file, &:readline)) end - - it 'uploads image file' do - find('.add-to-tree').click - - # make the field visible so capybara can use it - execute_script('document.querySelector("#file-upload").classList.remove("hidden")') - attach_file('file-upload', img_file) - - find('.add-to-tree').click - - expect(page).to have_selector('.multi-file-tab', text: 'dk.png') - expect(page).not_to have_selector('.monaco-editor') - end end
Remove IDE image upload spec Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/45045
diff --git a/spec/overcommit/hook_context/commit_msg_spec.rb b/spec/overcommit/hook_context/commit_msg_spec.rb index abc1234..def5678 100644 --- a/spec/overcommit/hook_context/commit_msg_spec.rb +++ b/spec/overcommit/hook_context/commit_msg_spec.rb @@ -8,13 +8,13 @@ let(:context) { described_class.new(config, args, input) } let(:commit_msg) do [ - '# Please enter the commit message for your changes.', - 'Some commit message', - '# On branch master', - 'diff --git a/file b/file', - 'index 4ae1030..342a117 100644', - '--- a/file', - '+++ b/file', + '# Please enter the commit message for your changes.', + 'Some commit message', + '# On branch master', + 'diff --git a/file b/file', + 'index 4ae1030..342a117 100644', + '--- a/file', + '+++ b/file', ] end
Fix array element indentation in spec Change-Id: I1fa1332fa682e0ce0521ffdf10cfbe03bf53dbb8 Reviewed-on: http://gerrit.causes.com/37394 Tested-by: jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@causes.com> Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com>
diff --git a/test/spec/store/get_entity_using_immediate_refresh.rb b/test/spec/store/get_entity_using_immediate_refresh.rb index abc1234..def5678 100644 --- a/test/spec/store/get_entity_using_immediate_refresh.rb +++ b/test/spec/store/get_entity_using_immediate_refresh.rb @@ -3,18 +3,18 @@ describe "Get Entity Using the Immediate Refresh Policy" do stream_name = EventStore::EntityStore::Controls::Writer.write_batch 'someEntity' + store = EventStore::EntityStore::Controls::Store::SomeStore.build refresh: :immediate + category_name = stream_name.split('-')[0] + store.category_name = category_name + id = EventStore::EntityStore::Controls::StreamName.id(stream_name) - cache = EventStore::EntityStore::Cache::Factory.build_cache :some_subject + cache = store.cache entity = EventStore::EntityStore::Controls::Entity.new entity.some_attribute = EventStore::EntityStore::Controls::Message.attribute initial_cache_record = cache.put id, entity, 0 - - store = EventStore::EntityStore::Controls::Store::SomeStore.build - category_name = stream_name.split('-')[0] - store.category_name = category_name entity, version, time = store.get id, include: [:version, :time]
Test uses the store's cache, rather than creating an independant cache object
diff --git a/ImageFormatInspector.podspec b/ImageFormatInspector.podspec index abc1234..def5678 100644 --- a/ImageFormatInspector.podspec +++ b/ImageFormatInspector.podspec @@ -7,8 +7,8 @@ s.author = { "David Sweetman" => "david@davidsweetman.com" } s.source = { :git => "https://github.com/sweetmandm/ImageFormatInspector.git", :tag => s.version.to_s } - s.platform = :ios, '7.0' - s.requires_arc = true - s.source_files = './ImageFormatInspector.{h,m}' - s.public_header_files = './ImageFormatInspector.h' + s.platform = :ios, '6.0' + s.requires_arc = false + s.source_files = 'ImageFormatInspector.{h,m}' + s.public_header_files = 'ImageFormatInspector.h' end
Modify podspec to allow non-arc and ios 6
diff --git a/lib/osc-ruby/em_server.rb b/lib/osc-ruby/em_server.rb index abc1234..def5678 100644 --- a/lib/osc-ruby/em_server.rb +++ b/lib/osc-ruby/em_server.rb @@ -20,8 +20,7 @@ def run EM.error_handler{ |e| - puts "Error raised in EMServer: #{e.message}" - puts e.backtrace + Thread.main.raise e } EM.run do
Use actual exceptions for handler errors
diff --git a/lib/gitlab.rb b/lib/gitlab.rb index abc1234..def5678 100644 --- a/lib/gitlab.rb +++ b/lib/gitlab.rb @@ -36,7 +36,7 @@ # # @return [Array<Symbol>] def self.actions - hidden = /endpoint|private_token|user_agent|sudo|get|post|put|\Adelete\z|validate|set_request_defaults/ + hidden = /endpoint|private_token|user_agent|sudo|get|post|put|\Adelete\z|validate|set_request_defaults|httparty/ (Gitlab::Client.instance_methods - Object.methods).reject {|e| e[hidden]} end end
Hide httparty & httparty= methods from Gitlab.actions - just like endpoint, private_token, etc.
diff --git a/lib/global.rb b/lib/global.rb index abc1234..def5678 100644 --- a/lib/global.rb +++ b/lib/global.rb @@ -6,7 +6,6 @@ class Country < ISO3166::Country def to_s - warn "[DEPRECATION] `Country` is deprecated. Please use `ISO3166::Country` instead." name end end
Remove deprecation from Country call
diff --git a/lib/rspec/core/sandbox.rb b/lib/rspec/core/sandbox.rb index abc1234..def5678 100644 --- a/lib/rspec/core/sandbox.rb +++ b/lib/rspec/core/sandbox.rb @@ -3,6 +3,9 @@ # A sandbox isolates the enclosed code into an environment that looks 'new' # meaning globally accessed objects are reset for the duration of the # sandbox. + # + # @note This module is not normally available. You must require + # `rspec/core/sandbox` to load it. module Sandbox # Execute a provided block with RSpec global objects (configuration, # world) reset. This is used to test RSpec with RSpec.
Clarify that this file must be required.
diff --git a/lib/klarna.rb b/lib/klarna.rb index abc1234..def5678 100644 --- a/lib/klarna.rb +++ b/lib/klarna.rb @@ -4,6 +4,10 @@ require 'klarna/connection' module Klarna + COUNTRIES = { + '209' => 'Sweden' + } + def self.configure yield configuration if block_given? end
Define COUNTRIES constant with Sweden mapping.
diff --git a/stdlib/nodejs/kernel.rb b/stdlib/nodejs/kernel.rb index abc1234..def5678 100644 --- a/stdlib/nodejs/kernel.rb +++ b/stdlib/nodejs/kernel.rb @@ -18,6 +18,7 @@ # @deprecated Please use `require('module')` instead def node_require(path) + warn '[DEPRECATION] `node_require` is deprecated. Please use `require(\'module\')` instead.' `#{NODE_REQUIRE}(#{path.to_str})` end end
Add a message to warn users about the deprecation
diff --git a/lib/tasks/whitespace.rake b/lib/tasks/whitespace.rake index abc1234..def5678 100644 --- a/lib/tasks/whitespace.rake +++ b/lib/tasks/whitespace.rake @@ -13,6 +13,8 @@ end desc 'Remove consecutive blank lines' task :scrub_gratuitous_newlines do - sh %{find . -name '*.rb' -exec sed -i '' '/./,/^$/!d' {} \\;} + sh %{for f in `find . -type f | grep -v -e '.git/' -e 'public/' -e '.png'`; + do cat $f | sed '/./,/^$/!d' > tmp; cp tmp $f; rm tmp; echo -n .; + done} end end
Improve task which remove consecutive blank lines
diff --git a/lib/twitter_pagination.rb b/lib/twitter_pagination.rb index abc1234..def5678 100644 --- a/lib/twitter_pagination.rb +++ b/lib/twitter_pagination.rb @@ -1,42 +1,23 @@-# Modified from flow_pagination gem module TwitterPagination + class LinkRenderer < WillPaginate::ViewHelpers::LinkRenderer + protected - # TwitterPagination renderer for (Mislav) WillPaginate Plugin - class LinkRenderer < WillPaginate::LinkRenderer - - def to_html - pagination = '' - - if self.current_page < self.last_page - pagination = @template.link_to_remote( - 'More', - :url => { :controller => @template.controller_name, - :action => @template.action_name, - :params => @template.params.merge!(:page => self.next_page)}, - :method => @template.request.request_method, - :html => { :class => 'twitter_pagination' }) - end - - @template.content_tag(:div, pagination, :class => 'pagination', :id => self.html_attributes[:id]) + def next_page + previous_or_next_page(@collection.next_page, "More", 'twitter_pagination') end - protected + def pagination + [ :next_page ] + end - # Get current page number - def current_page - @collection.current_page + # Override will_paginate's <tt>link</tt> method since it generates its own <tt>a</tt> + # attribute and won't support <tt>:remote => true</tt> + def link(text, target, attributes = {}) + if target.is_a? Fixnum + attributes[:rel] = rel_value(target) + target = url(target) end - - # Get last page number - def last_page - @last_page ||= WillPaginate::ViewHelpers.total_pages_for_collection(@collection) - end - - # Get next page number - def next_page - @collection.next_page - end - + @template.link_to(text, target, attributes.merge(:remote => true)) + end end - end
Update TwitterPagination class for new will_paginate And just as a side note, "Wow" at the new will_paginate. Made this stupid-easy.
diff --git a/0_code_wars/split_the_bill.rb b/0_code_wars/split_the_bill.rb index abc1234..def5678 100644 --- a/0_code_wars/split_the_bill.rb +++ b/0_code_wars/split_the_bill.rb @@ -0,0 +1,6 @@+# http://www.codewars.com/kata/split-the-bill/ +# --- iteration 1 --- +def split_the_bill(x) + avg = (x.values.reduce(:+)).fdiv(x.keys.size) + x.each { |k, v| x[k] = (v - avg).round(2) } +end
Add code wars (7) - split the bill
diff --git a/lib/generators/enumerate_it/enum/enum_generator.rb b/lib/generators/enumerate_it/enum/enum_generator.rb index abc1234..def5678 100644 --- a/lib/generators/enumerate_it/enum/enum_generator.rb +++ b/lib/generators/enumerate_it/enum/enum_generator.rb @@ -7,7 +7,7 @@ class_option :singular, type: 'string', desc: 'Singular name for i18n' - class_option :lang, type: 'string', desc: 'Lang to use in i18n', default: 'en' + class_option :lang, type: 'string', desc: 'Language to use in i18n', default: 'en' desc 'Creates a locale file on config/locales' def create_locale
Update description used in generator
diff --git a/Casks/font-kacstone.rb b/Casks/font-kacstone.rb index abc1234..def5678 100644 --- a/Casks/font-kacstone.rb +++ b/Casks/font-kacstone.rb @@ -0,0 +1,8 @@+class FontKacstone < Cask + url 'http://downloads.sourceforge.net/project/arabeyes/kacst_fonts/kacst_one_5.0.tar.bz2' + homepage 'http://projects.arabeyes.org/project.php?proj=Khotot' + version '5.0' + sha256 '1b016f49f99de16a65dcd990f229e729e6c4c6df02b23409771f6e27b69186a7' + font 'KacstOne.ttf' + font 'KacstOne-Bold.ttf' +end
Add Arabic font Kacst One from Arabeyes project
diff --git a/Casks/intellij-idea.rb b/Casks/intellij-idea.rb index abc1234..def5678 100644 --- a/Casks/intellij-idea.rb +++ b/Casks/intellij-idea.rb @@ -1,6 +1,6 @@ cask :v1 => 'intellij-idea' do - version '14.1.3' - sha256 'a7045dd58a6d632724a0444b46b71de55ee237a8f8fa31aa9a82b685d8d8bef2' + version '14.1.4' + sha256 '211b8a146870bbf1ac20a0498a49863dbbc1f06989a4780c602ba115a9c0a943' url "http://download.jetbrains.com/idea/ideaIU-#{version}.dmg" name 'IntelliJ IDEA'
Upgrade Intellij IDEA to 14.1.4 Signed-off-by: Koichi Shiraishi <41a18128582fec5418c0a92661f7d4b13d21d912@gmail.com>
diff --git a/app/services/alerts/collate_benchmark_data.rb b/app/services/alerts/collate_benchmark_data.rb index abc1234..def5678 100644 --- a/app/services/alerts/collate_benchmark_data.rb +++ b/app/services/alerts/collate_benchmark_data.rb @@ -14,16 +14,16 @@ def get_benchmarks_for_latest_run(latest_school_runs, benchmarks) latest_school_runs.each do |benchmark_result_school_generation_run| - school = benchmark_result_school_generation_run.school + school_id = benchmark_result_school_generation_run.school_id benchmark_result_school_generation_run.benchmark_results.each do |benchmark_result| unless benchmarks.key?(benchmark_result.asof) - benchmarks[benchmark_result.asof] = { school.id => {} } + benchmarks[benchmark_result.asof] = { school_id => {} } end - unless benchmarks[benchmark_result.asof].key?(school.id) - benchmarks[benchmark_result.asof][school.id] = {} + unless benchmarks[benchmark_result.asof].key?(school_id) + benchmarks[benchmark_result.asof][school_id] = {} end - benchmarks[benchmark_result.asof][school.id] = benchmarks[benchmark_result.asof][school.id].merge(benchmark_result.data) + benchmarks[benchmark_result.asof][school_id] = benchmarks[benchmark_result.asof][school_id].merge(benchmark_result.data) end end end
Use school id rather than school object
diff --git a/spec/ladder/resource/dynamic_spec.rb b/spec/ladder/resource/dynamic_spec.rb index abc1234..def5678 100644 --- a/spec/ladder/resource/dynamic_spec.rb +++ b/spec/ladder/resource/dynamic_spec.rb @@ -16,13 +16,7 @@ context 'with data' do let(:subject) { Thing.new } - before do - # non-localized literal - subject.alt = 'Mumintrollet pa kometjakt' - - # localized literal - subject.title = 'Comet in Moominland' - end + include_context 'with data' it_behaves_like 'a Resource' it_behaves_like 'a Dynamic Resource'
Use new context in dynamic spec
diff --git a/recipes/sevenscale_deploy/capistrano.rb b/recipes/sevenscale_deploy/capistrano.rb index abc1234..def5678 100644 --- a/recipes/sevenscale_deploy/capistrano.rb +++ b/recipes/sevenscale_deploy/capistrano.rb @@ -24,7 +24,8 @@ config_hash['roles'][role_name] = servers.collect { |s| s.host } servers.each do |server| - config_hash['options'][server.host] = server.options + config_hash['options'][server.host] ||= {} + config_hash['options'][server.host].merge!(server.options) end end
Make sure each host has all options.