diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/models/concerns/has_tags.rb b/app/models/concerns/has_tags.rb index abc1234..def5678 100644 --- a/app/models/concerns/has_tags.rb +++ b/app/models/concerns/has_tags.rb @@ -2,7 +2,7 @@ extend ActiveSupport::Concern included do - scope :with_tag, -> (key) { where("tags ? '#{key}'") } - scope :with_tag_equals, -> (key, value) { where("tags -> '#{key}' = '#{value}'") } + scope :with_tag, -> (key) { where("#{self.table_name}.tags ? '#{key}'") } + scope :with_tag_equals, -> (key, value) { where("#{self.table_name}.tags -> '#{key}' = '#{value}'") } end end
Use table_name in tags where clause
diff --git a/spec/factories/conferences.rb b/spec/factories/conferences.rb index abc1234..def5678 100644 --- a/spec/factories/conferences.rb +++ b/spec/factories/conferences.rb @@ -2,5 +2,10 @@ factory :conference do name { [FFaker::CheesyLingo.title, 'Conf'].join ' ' } tickets 2 + + trait :current_season do + season { Season.current } + end + end end
Add factory trait for current season's conference
diff --git a/rails_master_gemfile.rb b/rails_master_gemfile.rb index abc1234..def5678 100644 --- a/rails_master_gemfile.rb +++ b/rails_master_gemfile.rb @@ -3,11 +3,11 @@ <<-GEMFILE source 'http://gemcutter.org' +git 'git://github.com/carlhuda/bundler.git' + +gem 'bundler' + git 'git://github.com/rails/rails.git' - -git 'git://github.com/snusnu/dm-core.git', 'branch' => 'active_support' -git "git://github.com/snusnu/dm-more.git", 'branch' => 'active_support' -git 'git://github.com/dkubb/rails3_datamapper.git' gem 'activesupport', :require => 'active_support' gem 'activemodel', :require => 'active_model' @@ -17,6 +17,10 @@ gem 'data_objects', '0.10.1' gem 'do_sqlite3', '0.10.1' + +git 'git://github.com/snusnu/dm-core.git', 'branch' => 'active_support' +git "git://github.com/snusnu/dm-more.git", 'branch' => 'active_support' +git 'git://github.com/dkubb/rails3_datamapper.git' gem 'dm-core' gem 'dm-types'
Add carlhuda/bundler/master to rails master gemfile
diff --git a/spec/lib/ezapi_client_spec.rb b/spec/lib/ezapi_client_spec.rb index abc1234..def5678 100644 --- a/spec/lib/ezapi_client_spec.rb +++ b/spec/lib/ezapi_client_spec.rb @@ -14,6 +14,7 @@ password: "password", eks_path: CONFIG[:eks_path], prv_path: CONFIG[:prv_path], + host: CONFIG[:host], ) expect(client).to be_a EZAPIClient::Client @@ -21,6 +22,7 @@ expect(client.password).to eq "password" expect(client.eks_path).to eq CONFIG[:eks_path] expect(client.prv_path).to eq CONFIG[:prv_path] + expect(client.host).to eq CONFIG[:host] end end
Fix spec - set host
diff --git a/spec/link_shrink/isgd_spec.rb b/spec/link_shrink/isgd_spec.rb index abc1234..def5678 100644 --- a/spec/link_shrink/isgd_spec.rb +++ b/spec/link_shrink/isgd_spec.rb @@ -0,0 +1,43 @@+require 'spec_helper' + +describe LinkShrink::Shrinkers::IsGd do + include_examples 'shared_examples' + + let(:link_shrink) { described_class.new } + let(:is_gd) { 'http://is.gd/create.php' } + + describe '#sub_klass' do + it 'returns the inherited subclass name' do + expect(link_shrink.sub_klass).to eq('IsGd') + end + end + + describe '#base_url' do + it 'returns the base_url for the API' do + expect(link_shrink.base_url) + .to eq(is_gd) + end + end + + describe '#api_url' do + it 'returns full api url' do + link_shrink.stub(:url).and_return('www.google.com') + + expect(link_shrink.api_url) + .to eq('http://is.gd/create.php?format=simple&url=www.google.com') + end + end + + describe '#api_query_parameter' do + it 'returns query parameter' do + link_shrink.stub(:url).and_return('www.google.com') + expect(link_shrink.api_query_parameter).to eq('?format=simple&url=www.google.com') + end + end + + describe '#content_type' do + it 'returns text/plain' do + expect(link_shrink.content_type).to eq('text/plain') + end + end +end
Add spec for is.gd shrinker api
diff --git a/recipes/hbase_master.rb b/recipes/hbase_master.rb index abc1234..def5678 100644 --- a/recipes/hbase_master.rb +++ b/recipes/hbase_master.rb @@ -24,6 +24,28 @@ action :install end +# HBase can use a local directory or an HDFS directory for its rootdir... +# if HDFS, create execute block with action :nothing +# else create the local directory when file:// +if (node['hbase']['hbase_site']['hbase.rootdir'] =~ /^\/|^hdfs:\/\//i && node['hbase']['hbase_site']['hbase.cluster.distributed'].to_b) + execute 'hbase-hdfs-rootdir' do + command "hdfs dfs -mkdir -p #{node['hbase']['hbase_site']['hbase.rootdir']} && hdfs dfs -chown hbase #{node['hbase']['hbase_site']['hbase.rootdir']}" + timeout 300 + user 'hdfs' + group 'hdfs' + not_if "hdfs dfs -test -d #{node['hbase']['hbase_site']['hbase.rootdir']}", :user => 'hdfs' + action :nothing + end +else # Assume hbase.rootdir starts with file:// + directory node['hbase']['hbase_site']['hbase.rootdir'].gsub('file://', '') do + owner 'hbase' + group 'hbase' + mode '0700' + action :create + recursive true + end +end + service "hbase-master" do supports [ :restart => true, :reload => false, :status => true ] action :nothing
Create HBase's rootdir, either in HDFS or the local filesystem, depending on configuration
diff --git a/spec/poodr_rspec/gear_spec.rb b/spec/poodr_rspec/gear_spec.rb index abc1234..def5678 100644 --- a/spec/poodr_rspec/gear_spec.rb +++ b/spec/poodr_rspec/gear_spec.rb @@ -13,7 +13,7 @@ ) end - describe 'wheel double passes interface' do + describe 'wheel_double' do it_should_behave_like 'a diameterizable interface' do let(:diameterizable) { wheel_double } end
Update spec description to be easier to read. Why: * The name in the spec was confusing. This change addresses the need by: * Update the spec describe string.
diff --git a/lib/ruuid/uuid.rb b/lib/ruuid/uuid.rb index abc1234..def5678 100644 --- a/lib/ruuid/uuid.rb +++ b/lib/ruuid/uuid.rb @@ -34,10 +34,12 @@ "<#{self.class}:0x#{object_id} data=#{to_s}>" end + # @private def marshal_dump data end + # @private def marshal_load(data) @data = data.dup.freeze end
doc: Mark RUUID::UUID marshal methods private
diff --git a/app/services/datapoints_sync.rb b/app/services/datapoints_sync.rb index abc1234..def5678 100644 --- a/app/services/datapoints_sync.rb +++ b/app/services/datapoints_sync.rb @@ -37,6 +37,6 @@ end def overlapping_timestamps(new_datapoints, stored) - new_datapoints.map(&:timestamp) & stored.map(&:timestamp) + (new_datapoints.map(&:timestamp) & stored.map(&:timestamp)).to_set end end
Reduce complexity of sync algorithm
diff --git a/spree_email_to_friend.gemspec b/spree_email_to_friend.gemspec index abc1234..def5678 100644 --- a/spree_email_to_friend.gemspec +++ b/spree_email_to_friend.gemspec @@ -15,8 +15,7 @@ s.require_paths = ["lib"] s.requirements << 'none' - s.add_dependency 'spree_core', '>= 1.0.0' - s.add_dependency 'spree_auth', '>= 1.0.0' + s.add_dependency 'spree_core', '~> 1.2.0' s.add_dependency 'recaptcha', '>= 0.3.1' s.add_development_dependency 'rspec-rails' end
Update gemspec to support spree 1-2-stable
diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index abc1234..def5678 100644 --- a/lib/tasks/db.rake +++ b/lib/tasks/db.rake @@ -22,7 +22,7 @@ end def self.db_config_file_data - if defined?(ActiveRecord::Base) + if defined?(ActiveRecord::Base) && ActiveRecord::Base.configurations.present? ActiveRecord::Base.configurations else YAML.load_file("config/database.yml")
Add guard against empty AR configs Sometimes when Rake is loaded for loading tasks AR is loaded, but its config is not. This now checks for empty config and bails to reading the YAML file if loaded config is empty.
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -1,15 +1,16 @@ require 'sinatra' -# [Redis To Go | Heroku Dev Center](https://devcenter.heroku.com/articles/redistogo) configure do + # [Redis To Go | Heroku Dev Center](https://devcenter.heroku.com/articles/redistogo) require 'redis' uri = URI.parse(ENV['REDISTOGO_URL']) - REDIS = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password) + REDIS = Redis.new(host: uri.host, port: uri.port, password: uri.password) end get '/*' do |label| status = REDIS.hget(label, 'status') color = REDIS.hget(label, 'color') + if status redirect "http://img.shields.io/#{label}/#{status}.png?color=#{color}" else @@ -21,5 +22,5 @@ REDIS.hset(label, 'status', params[:status]) REDIS.hset(label, 'color', params[:color]) - "It was saved value is '#{label}/#{status}?color=#{color}'" + "It was saved #{label} status is #{status} and color is #{color}." end
Fix syntax to Ruby 2.0.0
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -1,13 +1,12 @@ # encoding: utf-8 -require 'sinatra' +require 'sinatra/base' -class Grokily < Sinatra::Application +class Grokily < Sinatra::Base # Not using the API? Just redirect to Github. get '/' do redirect 'https://github.com/benjaminasmith/grokily' end - - + run! if app_file == $0 end
Switch to the simpler Sinatra Base style - let's keep it simple for now and remove unnecessary complexity.
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -28,7 +28,7 @@ currency = currencies[symbol] if currency - respond_message "#{currency['name']} is currently valued at #{currency['price']} and the market cap is at #{currency['marketcap']}." + respond_message "#{currency['name']} is currently valued at #{currency['price']}." else respond_message "Currency cannot be found." end
REmove the marketcap from message.
diff --git a/test/test.rb b/test/test.rb index abc1234..def5678 100644 --- a/test/test.rb +++ b/test/test.rb @@ -7,7 +7,7 @@ client = Riak::Client.new(:http_backend => :Excon) # Automatically balance between multiple nodes -client = Riak::Client.new(:host => '127.0.0.1', :http_port => 8100) +client = Riak::Client.new(:host => '192.168.10.10', :http_port => 8098) puts client.ping
Update IP to point to host-only IP used in bosh-solo
diff --git a/test/data_structures/association_column_test.rb b/test/data_structures/association_column_test.rb index abc1234..def5678 100644 --- a/test/data_structures/association_column_test.rb +++ b/test/data_structures/association_column_test.rb @@ -18,8 +18,9 @@ end def test_searching - # right now, there's no intelligent searching on association columns - assert !@association_column.searchable? + # by default searching on association columns uses primary key + assert @association_column.searchable? + assert_equal 'model_stubs.id', @association_column.search_sql end def test_association
Fix testing default search for association columns
diff --git a/test/models/notifiers_test.rb b/test/models/notifiers_test.rb index abc1234..def5678 100644 --- a/test/models/notifiers_test.rb +++ b/test/models/notifiers_test.rb @@ -0,0 +1,7 @@+require 'test_helper' + +class NotifiersTest < ActiveSupport::TestCase + test 'pushbullet' do + assert Notifiers.new(:pushbullet).instance_of?(Notifiers::Pushbullet) + end +end
Create test for `Notifiers` module
diff --git a/core/db/migrate/20091209202200_make_state_events_polymorphic.rb b/core/db/migrate/20091209202200_make_state_events_polymorphic.rb index abc1234..def5678 100644 --- a/core/db/migrate/20091209202200_make_state_events_polymorphic.rb +++ b/core/db/migrate/20091209202200_make_state_events_polymorphic.rb @@ -1,4 +1,9 @@ class MakeStateEventsPolymorphic < ActiveRecord::Migration + # Legacy model support + class StateEvent < ActiveRecord::Base + + end + def self.up rename_column :state_events, :order_id, :stateful_id add_column :state_events, :stateful_type, :string
Add a legacy model to make_states_events_polymorphic migration
diff --git a/config/initializers/jira.rb b/config/initializers/jira.rb index abc1234..def5678 100644 --- a/config/initializers/jira.rb +++ b/config/initializers/jira.rb @@ -0,0 +1,11 @@+# frozen_string_literal: true + +# Changes JIRA DVCS user agent requests in order to be successfully handled +# by our API. +# +# Gitlab::Jira::Middleware is only defined on EE +# +# Use safe_constantize because the class may exist but has not been loaded yet +if "Gitlab::Jira::Middleware".safe_constantize + Rails.application.config.middleware.use(Gitlab::Jira::Middleware) +end
Load 'Gitlab::Jira::Middleware' if it exists Loads 'Gitlab::Jira::Middleware' only if it exists so this initializer can be backported to CE.
diff --git a/app/models/snapshot_diff_cluster.rb b/app/models/snapshot_diff_cluster.rb index abc1234..def5678 100644 --- a/app/models/snapshot_diff_cluster.rb +++ b/app/models/snapshot_diff_cluster.rb @@ -1,8 +1,8 @@ # Contains information about a cluster of differences for a snapshot diff class SnapshotDiffCluster < ActiveRecord::Base - belongs_to :snapshot_diff - validates_numericality_of :start, - :finish + belongs_to :snapshot_diff + validates :start, numericality: true + validates :finish, numericality: true default_scope { order(:start) }
Use the new "sexy" validations for SnapshotDiffCluster As pointed out by Rubocop. This resolves all of the cops for this file. Change-Id: I51fa7444f9f717f3f2848ff1bb87bd409ebbbe7b
diff --git a/lib/cucumber/a11y/a11y_steps.rb b/lib/cucumber/a11y/a11y_steps.rb index abc1234..def5678 100644 --- a/lib/cucumber/a11y/a11y_steps.rb +++ b/lib/cucumber/a11y/a11y_steps.rb @@ -1,5 +1,9 @@ Then(/^the page should be accessible$/) do expect(page).to be_accessible +end + +Then(/^the page should not be accessible$/) do + expect(page).to_not be_accessible end Then(/^"(.*?)" should be accessible$/) do |scope|
Add Cucumber page not accessible
diff --git a/lib/active_interaction/filters/array_filter.rb b/lib/active_interaction/filters/array_filter.rb index abc1234..def5678 100644 --- a/lib/active_interaction/filters/array_filter.rb +++ b/lib/active_interaction/filters/array_filter.rb @@ -27,7 +27,7 @@ raise InvalidFilter.new('multiple nested filters') unless filters.empty? raise InvalidFilter.new('nested name') unless names.empty? - raise InvalidFilter.new('nested default') if filter.optional? + raise InvalidDefault.new('nested default') if filter.optional? @filters << filter end
Switch to better error type
diff --git a/lib/ids_please/grabbers/base.rb b/lib/ids_please/grabbers/base.rb index abc1234..def5678 100644 --- a/lib/ids_please/grabbers/base.rb +++ b/lib/ids_please/grabbers/base.rb @@ -29,6 +29,18 @@ "#{self.class}##{self.object_id} #{line[1..-1]}" end + def to_h + { + avatar: avatar, + display_name: display_name, + username: username, + link: link, + page_source: page_source, + network_id: network_id, + data: data + } + end + def inspect to_s end
Add to_h method for grabbers
diff --git a/lib/jiraSOAP/entities/entity.rb b/lib/jiraSOAP/entities/entity.rb index abc1234..def5678 100644 --- a/lib/jiraSOAP/entities/entity.rb +++ b/lib/jiraSOAP/entities/entity.rb @@ -11,7 +11,7 @@ # @return [Array<String,Symbol,Class>] returns what you gave it def add_attributes *attributes superclass = ancestors[1] - @parse = superclass.parse.dup + @parse = superclass.parse.dup unless @parse attributes.each { |attribute| attr_accessor attribute[1]
Allow classes to have attributes added more than once In case they change things and a third party wants to monkey patch.
diff --git a/foreigner.gemspec b/foreigner.gemspec index abc1234..def5678 100644 --- a/foreigner.gemspec +++ b/foreigner.gemspec @@ -16,6 +16,6 @@ s.extra_rdoc_files = %w(README.rdoc) s.files = %w(MIT-LICENSE Rakefile README.rdoc) + Dir['lib/**/*.rb'] + Dir['test/**/*.rb'] - s.add_dependency('activerecord', '>= 3.1.0') + s.add_dependency('activerecord', '>= 3.0.0') s.add_development_dependency('activerecord', '>= 3.1.0') end
Decrease active_record requirement from 3.1 to 3.0
diff --git a/lib/did_you_mean/finders/name_error_finders.rb b/lib/did_you_mean/finders/name_error_finders.rb index abc1234..def5678 100644 --- a/lib/did_you_mean/finders/name_error_finders.rb +++ b/lib/did_you_mean/finders/name_error_finders.rb @@ -5,17 +5,14 @@ end def self.new(exception) - klass = if /uninitialized constant/ =~ exception.original_message + case exception.original_message + when /uninitialized constant/ SimilarClassFinder - elsif /undefined local variable or method/ =~ exception.original_message - SimilarNameFinder - elsif /undefined method/ =~ exception.original_message # for Rubinius + when /undefined local variable or method/, /undefined method/ SimilarNameFinder else NullFinder - end - - klass.new(exception) + end.new(exception) end end
Replace an if statement with when/case
diff --git a/lib/generators/responders/install_generator.rb b/lib/generators/responders/install_generator.rb index abc1234..def5678 100644 --- a/lib/generators/responders/install_generator.rb +++ b/lib/generators/responders/install_generator.rb @@ -11,9 +11,13 @@ include Responders::FlashResponder include Responders::HttpCacheResponder - # Uncomment this responder if you want your resources to redirect to the collection - # path (index action) instead of the resource path for POST/PUT/DELETE requests. + # Redirects resources to the collection path (index action) instead + # of the resource path (show action) for POST/PUT/DELETE requests. # include Responders::CollectionResponder + + # Allows to use a callable object as the redirect location with respond_with, + # eg a route that requires persisted objects when the validation may fail. + # include Responders::LocationResponder end RUBY end
Update the install generator to add the new location responder commented out
diff --git a/lib/octodown/support/helpers.rb b/lib/octodown/support/helpers.rb index abc1234..def5678 100644 --- a/lib/octodown/support/helpers.rb +++ b/lib/octodown/support/helpers.rb @@ -6,7 +6,7 @@ # TODO: Find a better home for this logic def self.markdown_to_html(content, options, path) html = markdown_to_raw_html(content, options, path) - tmp = Octodown::Support::HTMLFile.new 'octodown' + tmp = Octodown::Support::HTMLFile.new ['octodown', '.html'] tmp.persistent_write html end
Add an html extension to the temp file An extension can be added to the temp file (created behind the scene by `Tempfile.new`). It helps Safari recognize that the file is an HTML document. It is a possible solution for https://github.com/ianks/octodown/issues/34
diff --git a/lib/stackmate/stack_executor.rb b/lib/stackmate/stack_executor.rb index abc1234..def5678 100644 --- a/lib/stackmate/stack_executor.rb +++ b/lib/stackmate/stack_executor.rb @@ -0,0 +1,52 @@+require 'ruote' +require 'json' +require 'stackmate/stack' +require 'stackmate/logging' +require 'stackmate/classmap' +require 'stackmate/participants/cloudstack' +require 'stackmate/participants/common' + +module StackMate + +class StackExecutor < StackMate::Stacker + include Logging + + def initialize(templatefile, stackname, params, engine, create_wait_conditions) + super(templatefile, stackname, params) + @engine = engine + @create_wait_conditions = create_wait_conditions + end + + def pdef + participants = self.strongly_connected_components.flatten + #if we want to skip creating wait conditions (useful for automated tests) + participants = participants.select { |p| + StackMate::CLASS_MAP[@templ['Resources'][p]['Type']] != 'StackMate::WaitCondition' + } if !@create_wait_conditions + + logger.info("Ordered list of participants: #{participants}") + + participants.each do |p| + t = @templ['Resources'][p]['Type'] + throw :unknown, t if !StackMate::CLASS_MAP[t] + @engine.register_participant p, StackMate::CLASS_MAP[t] + end + @engine.register_participant 'Output', 'StackMate::Output' + participants << 'Output' + @pdef = Ruote.define @stackname.to_s() do + cursor do + participants.collect{ |name| __send__(name) } + end + end + #p @pdef + end + + def launch + pdef + wfid = @engine.launch( @pdef, @templ) + @engine.wait_for(wfid) + logger.error { "engine error : #{@engine.errors.first.message}"} if @engine.errors.first + end +end + +end
Refactor stack parsing and engine interaction
diff --git a/firmata.gemspec b/firmata.gemspec index abc1234..def5678 100644 --- a/firmata.gemspec +++ b/firmata.gemspec @@ -15,5 +15,8 @@ gem.require_paths = ["lib"] gem.version = Firmata::VERSION + gem.add_development_dependency("pry") + gem.add_runtime_dependency("serialport", ["~> 1.1.0"]) + end
Add a dev gem dependency.
diff --git a/api.rb b/api.rb index abc1234..def5678 100644 --- a/api.rb +++ b/api.rb @@ -17,7 +17,7 @@ unless File.exists?(directory) p = Pathname.new(directory) - p.mkdir + p.mkpath end File.open(destination, 'w') do |f|
Create the entire path if needed.
diff --git a/lib/bummr/updater.rb b/lib/bummr/updater.rb index abc1234..def5678 100644 --- a/lib/bummr/updater.rb +++ b/lib/bummr/updater.rb @@ -14,7 +14,7 @@ def update_gem(gem, index) puts "Updating #{gem[:name]}: #{index+1} of #{@outdated_gems.count}" - system("bundle update --source #{gem[:name]}") + system("bundle update #{gem[:name]}") updated_version = updated_version_for(gem) message = "Update #{gem[:name]} from #{gem[:installed]} to #{updated_version}"
Drop --source flag from update
diff --git a/lib/druid/console.rb b/lib/druid/console.rb index abc1234..def5678 100644 --- a/lib/druid/console.rb +++ b/lib/druid/console.rb @@ -12,8 +12,10 @@ include_timestamp = query.properties[:granularity] != 'all' + keys = result.empty? ? [] : result.last.keys + Terminal::Table.new({ - headings: (include_timestamp ? ["timestamp"] : []) + result.last.keys, + headings: (include_timestamp ? ["timestamp"] : []) + keys, rows: result.map { |row| (include_timestamp ? [row.timestamp] : []) + row.values } }) end
Fix a nullpointer exception on empty result set
diff --git a/lib/ghn/collector.rb b/lib/ghn/collector.rb index abc1234..def5678 100644 --- a/lib/ghn/collector.rb +++ b/lib/ghn/collector.rb @@ -14,7 +14,7 @@ @count = notifications.count notifications.map { |notification| Notification.new(notification).to_url - } + }.compact end def has_next?
Remove `nil` from collected URLs
diff --git a/templates/collection_view_controller/app/stylesheets/name_controller_stylesheet.rb b/templates/collection_view_controller/app/stylesheets/name_controller_stylesheet.rb index abc1234..def5678 100644 --- a/templates/collection_view_controller/app/stylesheets/name_controller_stylesheet.rb +++ b/templates/collection_view_controller/app/stylesheets/name_controller_stylesheet.rb @@ -19,7 +19,7 @@ #cl.headerReferenceSize = [cell_size[:w], cell_size[:h]] cl.minimumInteritemSpacing = @margin cl.minimumLineSpacing = @margin - #cl.sectionInsert = [0,0,0,0] + #cl.sectionInset = [0,0,0,0] end end end
Fix a typo in the CollectionView template.
diff --git a/lib/model_patches.rb b/lib/model_patches.rb index abc1234..def5678 100644 --- a/lib/model_patches.rb +++ b/lib/model_patches.rb @@ -3,13 +3,14 @@ # Doing so in init/environment.rb wouldn't work in development, since # classes are reloaded, but initialization is not run each time. # See http://stackoverflow.com/questions/7072758/plugin-not-reloading-in-development-mode -# -# Rails.configuration.to_prepare do -# OutgoingMessage.class_eval do -# # Add intro paragraph to new request template -# def default_letter -# return nil if self.message_type == 'followup' -# #"If you uncomment this line, this text will appear as default text in every message" -# end -# end -# end + +Rails.configuration.to_prepare do + OutgoingMessage.class_eval do + # Add intro paragraph to new request template + def default_letter + return nil if self.message_type == 'followup' + _("I would like to ask for the following information under Law no " \ + "04/2013 of 08/02/2013 relating to access to information.\n\n") + end + end +end
Add intro paragraph to new request template
diff --git a/lib/rip/nodes/try.rb b/lib/rip/nodes/try.rb index abc1234..def5678 100644 --- a/lib/rip/nodes/try.rb +++ b/lib/rip/nodes/try.rb @@ -1,15 +1,21 @@ module Rip::Nodes class Try < Base - attr_reader :body + attr_reader :attempt_body + attr_reader :catch_blocks + attr_reader :finally_block - def initialize(location, body) + def initialize(location, attempt_body, catch_blocks, finally_block) super(location) - @body = body + @attempt_body = attempt_body + @catch_blocks = catch_blocks + @finally_block = finally_block end def ==(other) super && - (body == other.body) + (attempt_body == other.attempt_body) && + (catch_blocks == other.catch_blocks) && + (finally_block == other.finally_block) end end end
Refactor Rip::Nodes::Try to accept catches and finally
diff --git a/lib/tasks/slack.rake b/lib/tasks/slack.rake index abc1234..def5678 100644 --- a/lib/tasks/slack.rake +++ b/lib/tasks/slack.rake @@ -10,15 +10,15 @@ namespace :slack do desc "Send an update about the CFP status" task send_cfp_status_update: :environment do - MESSAGE = "We had %d new CFP submissions in the last week, for a total of %d.".freeze + MESSAGE = "We had %d new CFP submissions in the last week, for a total of %d." # Heroku Scheduler can only run on a daily interval, but we want a weekly # report, so do nothing for the other days. next unless TODAY.tuesday? - new_submission_period = (TODAY - 1.week).upto(TODAY) + new_submission_period = (TODAY - 1.week)..TODAY - new_submissions = Paper.submitted.where(updated_at: new_submission_period.to_a).count + new_submissions = Paper.submitted.where(updated_at: new_submission_period).count all_submissions = Paper.submitted.count message = format(MESSAGE, new_submissions, all_submissions)
Fix new submissions not being reported to Slack The scheduled job that reports new submissions to Slack on a weekly basis was reporting 0 new submissions, despite there being two. This was caused by the query checking the `created_at` (a `DateTime`) against an array of `Date`s. This change fixes that.
diff --git a/purchase.gemspec b/purchase.gemspec index abc1234..def5678 100644 --- a/purchase.gemspec +++ b/purchase.gemspec @@ -24,6 +24,6 @@ s.add_runtime_dependency 'earth', '~>0.12.0' s.add_dependency 'emitter', '~> 1.0.0' - s.add_development_dependency 'sniff', '~>0.11.3' + s.add_development_dependency 'sniff', '~> 1.0.0' s.add_development_dependency 'sqlite3' end
Update sniff dependency to 1.x
diff --git a/Forecastr.podspec b/Forecastr.podspec index abc1234..def5678 100644 --- a/Forecastr.podspec +++ b/Forecastr.podspec @@ -5,7 +5,7 @@ s.homepage = "https://github.com/iwasrobbed/Forecastr" s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = 'Rob Phillips' - s.source = { :git => "https://github.com/iwasrobbed/Forecastr.git", :commit => "c14e0bc9de" } + s.source = { :git => "https://github.com/iwasrobbed/Forecastr.git", :commit => "4638d7b2f6" } s.platform = :ios, '5.0' s.source_files = 'Forecastr' s.resources = "Forecastr/*.plist"
Update the commit hash in the podspec to work and pass validation.
diff --git a/spec/features/dashboard_spec.rb b/spec/features/dashboard_spec.rb index abc1234..def5678 100644 --- a/spec/features/dashboard_spec.rb +++ b/spec/features/dashboard_spec.rb @@ -9,7 +9,7 @@ it "should show dashboard" do expect(current_path.to_s).to match dashboards_path - expect(page).to have_text("\"Pending\" Results") - expect(page).to have_selector('td', count: 21) + expect(page).to have_text("Online Visits") + expect(page).to have_selector('td', count: 9) end end
Fix test fallout from dashboard cleanup
diff --git a/spec/lib/nala/publisher_spec.rb b/spec/lib/nala/publisher_spec.rb index abc1234..def5678 100644 --- a/spec/lib/nala/publisher_spec.rb +++ b/spec/lib/nala/publisher_spec.rb @@ -12,28 +12,47 @@ end end +class MultipleArgsClass + include Nala::Publisher + + def call(_, _, _) + end +end + RSpec.describe Nala::Publisher do describe ".call" do + let(:instance) { spy } + + before { allow(use_case_class).to receive(:new) { instance } } + context "with no arguments" do + let(:use_case_class) { NoArgsClass } + it "instantiates and invokes #call" do - instance = spy - allow(NoArgsClass).to receive(:new) { instance } - - NoArgsClass.call + use_case_class.call expect(instance).to have_received(:call) end end context "with an argument" do - it "instantiates and invokes #call with the same arguments" do - instance = spy - allow(OneArgClass).to receive(:new) { instance } + let(:use_case_class) { OneArgClass } - OneArgClass.call(:hello) + it "instantiates and invokes #call with the same argument" do + use_case_class.call(:hello) expect(instance).to have_received(:call).with(:hello) end end + + context "with multiple arguments" do + let(:use_case_class) { MultipleArgsClass } + + it "instantiates and invokes #call with the same arguments" do + use_case_class.call(:hello, :there, :world) + + expect(instance).to have_received(:call).with(:hello, :there, :world) + end + end end end
Refactor specs to remove duplication
diff --git a/spec/qml/signal_connect_spec.rb b/spec/qml/signal_connect_spec.rb index abc1234..def5678 100644 --- a/spec/qml/signal_connect_spec.rb +++ b/spec/qml/signal_connect_spec.rb @@ -0,0 +1,27 @@+require 'spec_helper' + +describe "QML signal connection" do + + let(:component) do + QML::Component.new(data: <<-QML) + import QtQuick 2.0 + QtObject { + signal someSignal(var arg) + } + QML + end + + let(:obj) { component.create } + + it "connects QML signals to ruby proc" do + received_arg = nil + + obj[:someSignal].connect do |arg| + received_arg = arg + end + + obj.someSignal(10) + + expect(received_arg).to eq(10) + end +end
Add test for QML signal connect
diff --git a/spec/unit/adapter/bacon_spec.rb b/spec/unit/adapter/bacon_spec.rb index abc1234..def5678 100644 --- a/spec/unit/adapter/bacon_spec.rb +++ b/spec/unit/adapter/bacon_spec.rb @@ -25,6 +25,20 @@ evaluate_expr("describe('test') { describe_cli('test') {}.is_a? Bacon::Context }").should.success? end + describe 'extends context with methods' do + it 'can access #subject' do + evaluate_expr("describe_cli('test') {}.respond_to? :subject").should.success? + end + + it 'can access #context' do + evaluate_expr("describe_cli('test') {}.respond_to? :context").should.success? + end + + it 'can access #behaves_like_a' do + evaluate_expr("describe_cli('test') {}.respond_to? :behaves_like_a").should.success? + end + end + end end
Check if methods are available
diff --git a/Casks/font-fontawesome.rb b/Casks/font-fontawesome.rb index abc1234..def5678 100644 --- a/Casks/font-fontawesome.rb +++ b/Casks/font-fontawesome.rb @@ -2,6 +2,6 @@ url 'http://fortawesome.github.io/Font-Awesome/assets/font-awesome-4.0.3.zip' homepage 'http://fortawesome.github.io/Font-Awesome/' version '4.0.3' - sha1 '685d7b96e340a0609419c6d05261254eb758beda' + sha256 'ead30a79363ad5a29e1fac72aec3dbde3e986778405c042ca6d1a7a89fbfe841' font 'font-awesome-4.0.3/fonts/FontAwesome.otf' end
Update Fontawesome to sha256 checksums
diff --git a/test/controllers/accounts_controller_test.rb b/test/controllers/accounts_controller_test.rb index abc1234..def5678 100644 --- a/test/controllers/accounts_controller_test.rb +++ b/test/controllers/accounts_controller_test.rb @@ -21,4 +21,10 @@ assert_not_nil assigns(:account) assert_redirected_to account_path(assigns(:account)) end + + test "show should render correct page" do + @account = Account.first + get(:show, {'id' => @account.id}) + assert_template :show + end end
Add a test case for show action in account controller.
diff --git a/savon-multipart.gemspec b/savon-multipart.gemspec index abc1234..def5678 100644 --- a/savon-multipart.gemspec +++ b/savon-multipart.gemspec @@ -20,6 +20,7 @@ s.add_development_dependency "rake" s.add_development_dependency "rspec" s.add_development_dependency "autotest" + s.add_development_dependency "transpec" s.files = `git ls-files`.split("\n") s.require_path = "lib"
Add transpec as a development dependency
diff --git a/app/services/dwp_monitor.rb b/app/services/dwp_monitor.rb index abc1234..def5678 100644 --- a/app/services/dwp_monitor.rb +++ b/app/services/dwp_monitor.rb @@ -17,7 +17,7 @@ private def dwp_results - @checks = BenefitCheck.pluck(:dwp_result, :error_message).last(20) + @checks = BenefitCheck.order(:id).pluck(:dwp_result, :error_message).last(20) end def percent
Order benefit checks by ID
diff --git a/perfecta.gemspec b/perfecta.gemspec index abc1234..def5678 100644 --- a/perfecta.gemspec +++ b/perfecta.gemspec @@ -16,4 +16,7 @@ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ["lib"] + + gem.add_dependency "rest-client" + gem.add_development_dependency "mocha" end
Add runtime and development dependencies
diff --git a/spec/integration/rspec_booster/empty_split_configuration_spec.rb b/spec/integration/rspec_booster/empty_split_configuration_spec.rb index abc1234..def5678 100644 --- a/spec/integration/rspec_booster/empty_split_configuration_spec.rb +++ b/spec/integration/rspec_booster/empty_split_configuration_spec.rb @@ -0,0 +1,73 @@+require "spec_helper" + +describe "RSpec Booster behvaviour when split configuration is empty" do + + let(:project_path) { "/tmp/project_path-#{SecureRandom.uuid}" } + let(:specs_path) { "#{project_path}/spec" } + let(:split_configuration_path) { "/tmp/rspec_split_configuration.json" } + let(:rspec_report_path) { "/tmp/rspec_report.json" } + + before do + # Set up environment variables + ENV["SPEC_PATH"] = specs_path + ENV["RSPEC_SPLIT_CONFIGURATION_PATH"] = split_configuration_path + ENV["REPORT_PATH"] = rspec_report_path + + # Set up test dir structure + FileUtils.rm_rf(specs_path) + FileUtils.mkdir_p(specs_path) + FileUtils.rm_f(rspec_report_path) + + # Create spec files + Support::RspecFilesFactory.create(:path => "#{specs_path}/a_spec.rb", :result => :failing) + Support::RspecFilesFactory.create(:path => "#{specs_path}/b_spec.rb", :result => :failing) + Support::RspecFilesFactory.create(:path => "#{specs_path}/lib/c_spec.rb", :result => :passing) + + # Construct spec helper file + File.write("#{specs_path}/spec_helper.rb", "") + + # Construct empty split configuration + File.write(split_configuration_path, [{ :files => [] }, { :files => [] }, { :files => [] }].to_json) + + # make sure that everything is set up as it should be + expect(File.exist?(rspec_report_path)).to eq(false) + + expect(File.exist?(split_configuration_path)).to eq(true) + + expect(Dir["#{specs_path}/**/*"].sort).to eq([ + "#{specs_path}/a_spec.rb", + "#{specs_path}/b_spec.rb", + "#{specs_path}/lib", + "#{specs_path}/lib/c_spec.rb", + "#{specs_path}/spec_helper.rb" + ]) + end + + specify "first thread's behaviour" do + output = `cd #{project_path} && rspec_booster --thread 1` + + expect(output).to include("1 example, 1 failure") + expect($?.exitstatus).to eq(1) + + expect(File.exist?(rspec_report_path)).to eq(true) + end + + specify "second thread's behaviour" do + output = `cd #{project_path} && rspec_booster --thread 2` + + expect(output).to include("1 example, 1 failure") + expect($?.exitstatus).to eq(1) + + expect(File.exist?(rspec_report_path)).to eq(true) + end + + specify "third thread's behaviour" do + output = `cd #{project_path} && rspec_booster --thread 3` + + expect(output).to include("1 example, 0 failure") + expect($?.exitstatus).to eq(0) + + expect(File.exist?(rspec_report_path)).to eq(true) + end + +end
Make sure that rspec booster works even if the split config is empty
diff --git a/features/support/aruba.rb b/features/support/aruba.rb index abc1234..def5678 100644 --- a/features/support/aruba.rb +++ b/features/support/aruba.rb @@ -1 +1,7 @@ require 'aruba/cucumber' + +Before do + # ensure Cucumber's Ruby process can require the plugin as though it were a gem + path = File.expand_path(File.dirname(__FILE__) + '/../../lib') + set_env 'RUBYLIB', path +end
Fix paths so that the tests can require the formatter
diff --git a/test/lib/hector/test_case.rb b/test/lib/hector/test_case.rb index abc1234..def5678 100644 --- a/test/lib/hector/test_case.rb +++ b/test/lib/hector/test_case.rb @@ -9,6 +9,7 @@ def run(*) Hector.logger.info "--- #@method_name ---" super + ensure Hector.logger.info " " end
Fix test runner output on 1.9
diff --git a/spec/spec_helper/pre_flight.rb b/spec/spec_helper/pre_flight.rb index abc1234..def5678 100644 --- a/spec/spec_helper/pre_flight.rb +++ b/spec/spec_helper/pre_flight.rb @@ -18,15 +18,13 @@ ::Pod::UI.output = '' # The following prevents a nasty behaviour where the increments are not - # balanced when testing informatives which might lead to sections not + # balanced when testing informative which might lead to sections not # being printed to the output as they are too nested. ::Pod::UI.indentation_level = 0 ::Pod::UI.title_level = 0 - if SpecHelper.temporary_directory.exist? - SpecHelper.temporary_directory.rmtree - SpecHelper.temporary_directory.mkpath - end + SpecHelper.temporary_directory.rmtree if SpecHelper.temporary_directory.exist? + SpecHelper.temporary_directory.mkpath old_run_requirement.bind(self).call(description, spec) end
[Specs] Fix issue with missing tmp dir
diff --git a/spec/support/metal_archives.rb b/spec/support/metal_archives.rb index abc1234..def5678 100644 --- a/spec/support/metal_archives.rb +++ b/spec/support/metal_archives.rb @@ -20,5 +20,5 @@ ## Custom logger (optional) c.logger = Logger.new $stdout - c.logger.level = Logger::INFO + c.logger.level = Logger::WARN end
Set test logger level to WARN
diff --git a/app/controllers/claims_controller.rb b/app/controllers/claims_controller.rb index abc1234..def5678 100644 --- a/app/controllers/claims_controller.rb +++ b/app/controllers/claims_controller.rb @@ -17,16 +17,10 @@ def update resource.assign_attributes params[current_step] - saved = resource.save - - if params[:return] - redirect_to user_session_path + if resource.save + redirect_to page_claim_path(page: transition_manager.forward) else - if saved - redirect_to page_claim_path(page: transition_manager.forward) - else - render action: :show - end + render action: :show end end
Remove return params check as is no longer required due to save and complete button being removed
diff --git a/app/controllers/manage_controller.rb b/app/controllers/manage_controller.rb index abc1234..def5678 100644 --- a/app/controllers/manage_controller.rb +++ b/app/controllers/manage_controller.rb @@ -24,16 +24,16 @@ register Sinatra::Twitter::Bootstrap::Assets get '/jobs' do - case params[:scope] + @jobs = case params[:scope] when 'all' - # no-op + PushJob.all when 'failed' - @jobs = PushJob.failed + PushJob.failed when 'succeeded' - @jobs = PushJob.succeeded + PushJob.succeeded else params[:scope] = 'current' - @jobs = PushJob.in_progress + PushJob.in_progress end @refresh_automatically = params[:scope] == 'current'
[ManageController] Refactor how PushJobs are loaded. (Not working yet as the class methods are not working)
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index abc1234..def5678 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -17,13 +17,17 @@ else return_to = sections_path end - anchor = if params[:search][:anchor].present? + + anchor = if params.dig(:search, :anchor).present? if params[:search][:anchor] == 'import' '#import' else '#export' end + else + '' end + redirect_to(return_to + anchor) end }
Fix error when anchor is undefined in params
diff --git a/app/models/service_retire_request.rb b/app/models/service_retire_request.rb index abc1234..def5678 100644 --- a/app/models/service_retire_request.rb +++ b/app/models/service_retire_request.rb @@ -1,6 +1,7 @@ class ServiceRetireRequest < MiqRetireRequest TASK_DESCRIPTION = 'Service Retire'.freeze SOURCE_CLASS_NAME = 'Service'.freeze + ACTIVE_STATES = %w(retired) + base_class::ACTIVE_STATES delegate :service_template, :to => :source, :allow_nil => true end
Add retired to service active states
diff --git a/app/models/statisfaction/activity.rb b/app/models/statisfaction/activity.rb index abc1234..def5678 100644 --- a/app/models/statisfaction/activity.rb +++ b/app/models/statisfaction/activity.rb @@ -11,6 +11,14 @@ self.watched_class == other.watched_class && self.watched_activity == other.watched_activity end + def self.load(serialized) + self.new *(serialized.split(',')) + end + + def self.dump(obj) + "#{obj.watched_class},#{obj.watched_activity}" + end + attr_reader :watched_class, :watched_activity protected attr_writer :watched_class, :watched_activity
Make Activity objects serializable for db-storage
diff --git a/RKTableController.podspec b/RKTableController.podspec index abc1234..def5678 100644 --- a/RKTableController.podspec +++ b/RKTableController.podspec @@ -15,5 +15,5 @@ s.source_files = 'Code/*.{h,m}' s.ios.framework = 'QuartzCore' - s.dependency 'RestKit', '>= 0.20.0' + s.dependency 'RestKit', '>= 0.20.0dev' end
Set dependency to match >= 0.20.0dev
diff --git a/spec/moneta/adapters/memory/standard_memory_with_prefix_spec.rb b/spec/moneta/adapters/memory/standard_memory_with_prefix_spec.rb index abc1234..def5678 100644 --- a/spec/moneta/adapters/memory/standard_memory_with_prefix_spec.rb +++ b/spec/moneta/adapters/memory/standard_memory_with_prefix_spec.rb @@ -1,8 +1,8 @@ describe 'standard_memory_with_prefix', adapter: :Memory do - moneta_store :Memory, {prefix: "moneta"} + moneta_store :Memory, { prefix: "moneta" } moneta_specs STANDARD_SPECS.without_persist.with_each_key - context 'with keys with no prefix' do + context 'with keys from no prefix' do before(:each) do store.adapter.adapter.backend['no_prefix'] = 'hidden' end @@ -13,4 +13,29 @@ include_examples :each_key end + + context 'with keys from other prefixes' do + before do + backend = store.adapter.adapter.backend + @alternative_store ||= Moneta.build do + use :Transformer, key: [:marshal, :prefix], value: :marshal, prefix: 'alternative_' + adapter :Memory, backend: backend + end + expect(@alternative_store).to be_a(Moneta::Transformer::MarshalPrefixKeyMarshalValue) + end + let(:alternative) { @alternative_store } + + before(:each) do + alternative.store('with_prefix_key', 'hidden') + end + + after(:each) do + expect(store.adapter.adapter.backend.keys).to include('alternative_with_prefix_key') + expect(alternative.each_key.to_a).to eq(['with_prefix_key']) + expect(alternative['with_prefix_key']).to eq('hidden') + end + + include_examples :each_key + end + end
Add spec for a shared backend with other prefixes
diff --git a/app/views/poems_number_badge_item.rb b/app/views/poems_number_badge_item.rb index abc1234..def5678 100644 --- a/app/views/poems_number_badge_item.rb +++ b/app/views/poems_number_badge_item.rb @@ -14,8 +14,12 @@ def create_base_button(title) set_title = title ? title : '' UIButton.alloc.init.tap do |b| - b.setTitle(set_title, forState: UIControlStateNormal) - b.setTitleColor('blue'.uicolor, forState: UIControlStateNormal) + b.setTitle(set_title, forState: :normal.uicontrolstate) + if title + b.setTitleColor([0, 122, 255].uicolor, forState: :normal.uicontrolstate) + b.setTitleColor(:light_gray.uicolor, forState: :highlighted.uicontrolstate) + b.setTitleColor(:light_gray.uicolor(0.5), forState: :disabled.uicontrolstate) + end end end end
Set color of 'Save' button on PoemPicker
diff --git a/lib/aasm/graph.rb b/lib/aasm/graph.rb index abc1234..def5678 100644 --- a/lib/aasm/graph.rb +++ b/lib/aasm/graph.rb @@ -5,7 +5,7 @@ def initialize(class_name, options = {}) options = {path: '.'}.merge(options) - @file_path = File.join(options[:path], "#{class_name.parameterize('_')}_aasm.png") + @file_path = File.join(options[:path], "#{class_name.parameterize(separator: '_')}_aasm.png") super(:G) end
Change call to parameterize to use Rails 5 syntax
diff --git a/lib/srt/parser.rb b/lib/srt/parser.rb index abc1234..def5678 100644 --- a/lib/srt/parser.rb +++ b/lib/srt/parser.rb @@ -1,29 +1,31 @@ module SRT class Parser - def self.framerate(framerate_string) - mres = framerate_string.match(/(?<fps>\d+((\.)?\d+))(fps)/) - mres ? mres["fps"].to_f : nil - end + class << self + def framerate(framerate_string) + mres = framerate_string.match(/(?<fps>\d+((\.)?\d+))(fps)/) + mres ? mres["fps"].to_f : nil + end - def self.id(id_string) - mres = id_string.match(/#(?<id>\d+)/) - mres ? mres["id"].to_i : nil - end + def id(id_string) + mres = id_string.match(/#(?<id>\d+)/) + mres ? mres["id"].to_i : nil + end - def self.timecode(timecode_string) - mres = timecode_string.match(/(?<h>\d+):(?<m>\d+):(?<s>\d+),(?<ms>\d+)/) - mres ? "#{mres["h"].to_i * 3600 + mres["m"].to_i * 60 + mres["s"].to_i}.#{mres["ms"]}".to_f : nil - end + def timecode(timecode_string) + mres = timecode_string.match(/(?<h>\d+):(?<m>\d+):(?<s>\d+),(?<ms>\d+)/) + mres ? "#{mres["h"].to_i * 3600 + mres["m"].to_i * 60 + mres["s"].to_i}.#{mres["ms"]}".to_f : nil + end - def self.timespan(timespan_string) - factors = { - "ms" => 0.001, - "s" => 1, - "m" => 60, - "h" => 3600 - } - mres = timespan_string.match(/(?<amount>(\+|-)?\d+((\.)?\d+)?)(?<unit>ms|s|m|h)/) - mres ? mres["amount"].to_f * factors[mres["unit"]] : nil + def timespan(timespan_string) + factors = { + "ms" => 0.001, + "s" => 1, + "m" => 60, + "h" => 3600 + } + mres = timespan_string.match(/(?<amount>(\+|-)?\d+((\.)?\d+)?)(?<unit>ms|s|m|h)/) + mres ? mres["amount"].to_f * factors[mres["unit"]] : nil + end end end end
Declare methods in a singleton class, removing redundant calls in self
diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index abc1234..def5678 100644 --- a/lib/tasks/db.rake +++ b/lib/tasks/db.rake @@ -4,7 +4,7 @@ namespace :db do task :seed_words, [:directory] => :environment do |args| - CSV.foreach(File.open(Rails.root + "test/testdata/words.csv", "r"), col_sep: ';', headers:true) do |row| + CSV.foreach(File.open(Rails.root + "test/testdata/words.csv", "r"), col_sep: "\t", headers:true) do |row| Word.create({ name: row[0], description: row[1],
Change csv separation to 'tab'
diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index abc1234..def5678 100644 --- a/lib/tasks/db.rake +++ b/lib/tasks/db.rake @@ -23,4 +23,14 @@ SetAssetSizeWorker.perform_async(asset_id) end end + + desc "Transform all redirect chains into one-step redirects" + task resolve_redirect_chains: :environment do + replaced = Asset.unscoped.where(:replacement_id.ne => nil) + replaced.each do |asset| + next unless asset.replacement.present? + next if asset.replacement.replacement.present? + asset.update_indirect_replacements + end + end end
Add a rake task to resolve all redirect chains
diff --git a/lib/tasks/go.rake b/lib/tasks/go.rake index abc1234..def5678 100644 --- a/lib/tasks/go.rake +++ b/lib/tasks/go.rake @@ -1,2 +1,5 @@ desc "Run the exercise specs" -task :go => "spec:exercises" +RSpec::Core::RakeTask.new(:go => "spec:prepare") do |t| + t.pattern = "./exercises/**/*_spec.rb" + t.rspec_opts = "--fail-fast --format documentation" +end
Make Rspec fail on first error (--fail-fast) so as to not overwhelm gym members
diff --git a/spec/cli/deploy_spec.rb b/spec/cli/deploy_spec.rb index abc1234..def5678 100644 --- a/spec/cli/deploy_spec.rb +++ b/spec/cli/deploy_spec.rb @@ -0,0 +1,60 @@+require 'spec_helper' + +describe Hanzo::CLI do + describe :deploy do + let(:env) { 'production' } + let(:branch) { '1.0.0' } + let(:deploy!) { Hanzo::CLI.new(['deploy', env]) } + let(:migrations_exist) { false } + let(:heroku_remotes) { { 'production' => 'heroku-app-production' } } + let(:migration_dir) { 'db/migrate' } + + let(:migration_question) { 'Run migrations?' } + let(:deploy_question) { "Branch to deploy in #{env}:" } + + let(:migration_cmd) { "heroku run rake db:migrate --remote #{env}" } + let(:restart_cmd) { "heroku ps:restart --remote #{env}" } + let(:deploy_cmd) { "git push -f #{env} #{branch}:master" } + + before do + Dir.should_receive(:exists?).with(migration_dir).and_return(migrations_exist) + Hanzo::Installers::Remotes.stub(:environments).and_return(heroku_remotes) + Hanzo.should_receive(:ask).with(deploy_question).and_return(branch) + Hanzo.should_receive(:run).with(deploy_cmd).once + end + + context 'without migration' do + it 'should git push to heroku upstream' do + deploy! + end + end + + context 'with migrations' do + let(:migrations_exist) { true } + + context 'that should be ran' do + before do + Hanzo.should_receive(:agree).with(migration_question).and_return(true) + Hanzo.should_receive(:run).with(migration_cmd) + Hanzo.should_receive(:run).with(restart_cmd) + end + + it 'should run migrations' do + deploy! + end + end + + context 'that should not be ran' do + before do + Hanzo.should_receive(:agree).with(migration_question).and_return(false) + Hanzo.should_not_receive(:run).with(migration_cmd) + Hanzo.should_not_receive(:run).with(restart_cmd) + end + + it 'should not run migrations' do + deploy! + end + end + end + end +end
Add test for Hanzo::Deploy module
diff --git a/app/models/authenticated_user.rb b/app/models/authenticated_user.rb index abc1234..def5678 100644 --- a/app/models/authenticated_user.rb +++ b/app/models/authenticated_user.rb @@ -1,11 +1,8 @@+# This enables us to return private fields, like mfa_level, to an authenticated user +# so that they may retrieve this information about their own profile without it +# being exposed to all users in their public profile class AuthenticatedUser < User def payload - attrs = { - "id" => id, - "handle" => handle, - "mfa" => mfa_level - } - attrs["email"] = email unless hide_email - attrs + super.merge({"mfa" => mfa_level}) end end
Call super and add a comment
diff --git a/AEXML.podspec b/AEXML.podspec index abc1234..def5678 100644 --- a/AEXML.podspec +++ b/AEXML.podspec @@ -7,6 +7,8 @@ s.source = { :git => 'https://github.com/tadija/AEXML.git', :tag => s.version } s.source_files = 'Sources/AEXML/*.swift' + +s.swift_version = '5.0' s.ios.deployment_target = '8.0' s.osx.deployment_target = '10.10'
Fix warnings from `pod lib lint`
diff --git a/app/services/publisher_update.rb b/app/services/publisher_update.rb index abc1234..def5678 100644 --- a/app/services/publisher_update.rb +++ b/app/services/publisher_update.rb @@ -1,15 +1,30 @@ module Georelevent module Services class PublisherUpdate < Struct.new(:features, :publisher) + include Enumerable + def self.call(*args) new(*args).call end + def each(&block) + features.each(&block) + end + def call - features.lazy. + lazy. + # wrap each feature in a helper class to + # provide method access to nested attributes + # and granular control over the values map(&method(:wrap_feature)). + # build event instances from the wrapped + # features and assign the publisher map(&method(:build_event)). + # attempt to save each event, relying on + # model validations for deduplication, + # select only the new events select(&method(:save_event?)). + # evaluate the lazy enumeration force end @@ -52,7 +67,7 @@ def properties data['properties'] || {} end - end # Feature - end # PublisherUpdate - end # Workers -end # Georelevent + end + end + end +end
Refactor PublisherUpdate to be enumerable Also, comment to steps performed on each feature.
diff --git a/lib/commands.rb b/lib/commands.rb index abc1234..def5678 100644 --- a/lib/commands.rb +++ b/lib/commands.rb @@ -0,0 +1,6 @@+require File.expand_path(File.join(File.dirname(__FILE__), 'commands', 'base')) +require File.expand_path(File.join(File.dirname(__FILE__), 'commands', 'pick')) +require File.expand_path(File.join(File.dirname(__FILE__), 'commands', 'feature')) +require File.expand_path(File.join(File.dirname(__FILE__), 'commands', 'bug')) +require File.expand_path(File.join(File.dirname(__FILE__), 'commands', 'chore')) +require File.expand_path(File.join(File.dirname(__FILE__), 'commands', 'finish'))
Add convenience loader for Commands
diff --git a/site-cookbooks/basic_config/recipes/default.rb b/site-cookbooks/basic_config/recipes/default.rb index abc1234..def5678 100644 --- a/site-cookbooks/basic_config/recipes/default.rb +++ b/site-cookbooks/basic_config/recipes/default.rb @@ -13,7 +13,7 @@ # Set up app-specific user, group and home directory user app_user do shell "/bin/bash" - password "$1$yN53x/Fr$HZhgHSrSrwQmu/AV1V/tG." # Hash of "AppUserPassword" + #password "$1$yN53x/Fr$HZhgHSrSrwQmu/AV1V/tG." # Hash of "AppUserPassword" end group app_user
Comment out password line. Not using text passwords for now.
diff --git a/paper_ticket.gemspec b/paper_ticket.gemspec index abc1234..def5678 100644 --- a/paper_ticket.gemspec +++ b/paper_ticket.gemspec @@ -19,7 +19,8 @@ s.add_dependency "rails", "~> 4.0.2" s.add_dependency "formtastic" s.add_dependency "formtastic-bootstrap" - s.add_dependency "mongoid", "~> 4.0.0alpha1" + # s.add_dependency "mongoid", "~> 4.0.0alpha1" + s.add_dependency "mongoid" # Wait until mongoid 4 is out of beta # s.add_dependency "mongoid_token", '~> 2.0.0'
Remove dependency on alpha cut
diff --git a/app/controllers/exceptionally_beautiful/application_controller.rb b/app/controllers/exceptionally_beautiful/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/exceptionally_beautiful/application_controller.rb +++ b/app/controllers/exceptionally_beautiful/application_controller.rb @@ -1,4 +1,6 @@ module ExceptionallyBeautiful - class ApplicationController < ActionController::Base + class ApplicationController < ::ApplicationController + helper Rails.application.routes.url_helpers + helper ExceptionallyBeautiful::RenderHelper end end
Allow application routes to work within custom layouts. * Changed `ExceptionallyBeautiful::ApplicationController` to inherit from `::ApplicationController`. * Include `Rails.application.routes.url_helpers` as a helper in our `ExceptionallyBeautiful::ApplicationController` so named route helpers are available in views and layouts rendered by our controller.
diff --git a/premiere-webm.rb b/premiere-webm.rb index abc1234..def5678 100644 --- a/premiere-webm.rb +++ b/premiere-webm.rb @@ -1,4 +1,4 @@-cask :v1 => 'photoshop-webm' do +cask :v1 => 'premiere-webm' do version '1.0.1' sha256 '68a2d856d545a4b7e3ccc39f5cbf635ed97d33322eac494b121c40bb32a69688'
Fix typo in package name.
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index abc1234..def5678 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,6 +1,6 @@ class HomeController < ApplicationController def index - @count = Rubygem.total_count + @count = Version.latest.count @latest = Rubygem.latest @downloaded = Rubygem.downloaded @updated = Version.updated
Use Version.latest.count instead of total_count since AR hates DISTINCT
diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb index abc1234..def5678 100644 --- a/app/controllers/root_controller.rb +++ b/app/controllers/root_controller.rb @@ -14,7 +14,11 @@ redirect_to administrations_path else - @latest_release = Github::Releases.latest + begin + @latest_release = Github::Releases.latest + rescue OpenSSL::SSL::SSLErrorWaitReadable + @latest_release = nil + end render 'landing' end end
Fix bug @latest_release for Github
diff --git a/app/policies/application_policy.rb b/app/policies/application_policy.rb index abc1234..def5678 100644 --- a/app/policies/application_policy.rb +++ b/app/policies/application_policy.rb @@ -1,4 +1,6 @@ class ApplicationPolicy + + include Pundit::Serializer attr_reader :user, :record
Include the pundit serializer in the ApplicationPolicy class.
diff --git a/lib/active_admin/dependency_checker.rb b/lib/active_admin/dependency_checker.rb index abc1234..def5678 100644 --- a/lib/active_admin/dependency_checker.rb +++ b/lib/active_admin/dependency_checker.rb @@ -10,7 +10,7 @@ end end - unless pry_rails_0_1_6? + if pry_rails_before_0_1_6? warn "ActiveAdmin is not compatible with pry-rails < 0.1.6. Please upgrade pry-rails." end end @@ -30,7 +30,7 @@ false end - def pry_rails_0_1_6? + def pry_rails_before_0_1_6? begin PryRails::VERSION < "0.1.6" rescue NameError
Fix the logic for pry-rails dependency checking The check was just backwards so I made the name of the method more explicit and changed the if to an unless.
diff --git a/lib/finite_machine/transition_event.rb b/lib/finite_machine/transition_event.rb index abc1234..def5678 100644 --- a/lib/finite_machine/transition_event.rb +++ b/lib/finite_machine/transition_event.rb @@ -17,11 +17,11 @@ # @return [self] # # @api private - def self.build(transition) + def self.build(transition, *data) instance = new instance.name = transition.name instance.from = transition.from_state - instance.to = transition.to_state + instance.to = transition.to_state(*data) instance end end # TransitionEvent
Change to pass data to transition event.
diff --git a/lib/panther/representer/timestamped.rb b/lib/panther/representer/timestamped.rb index abc1234..def5678 100644 --- a/lib/panther/representer/timestamped.rb +++ b/lib/panther/representer/timestamped.rb @@ -3,18 +3,18 @@ module Representer module Timestamped def self.included(klass) - klass.class_eval <<-RUBY + klass.class_eval do property :created_at, exec_context: :decorator, if: -> (_) { respond_to?(:created_at) } property :updated_at, exec_context: :decorator, if: -> (_) { respond_to?(:updated_at) } + end + end - def created_at - represented.created_at.to_i - end + def created_at + represented.created_at.to_i + end - def updated_at - represented.updated_at.to_i - end - RUBY + def updated_at + represented.updated_at.to_i end end end
Use class_eval with block in Representer::Timestamped
diff --git a/test/cli/command/test_todo.rb b/test/cli/command/test_todo.rb index abc1234..def5678 100644 --- a/test/cli/command/test_todo.rb +++ b/test/cli/command/test_todo.rb @@ -0,0 +1,85 @@+# frozen_string_literal: true + +require "helpers" + +# Tests for KBSecret::CLI::Command::Todo +class KBSecretCommandTodoTest < Minitest::Test + include Helpers + include Helpers::CLI + + def test_todo_help + todo_helps = [ + %w[todo --help], + %w[todo -h], + %w[help todo], + ] + + todo_helps.each do |todo_help| + stdout, = kbsecret(*todo_help) + assert_match "Usage:", stdout + end + end + + def test_todo_too_few_arguments + _, stderr = kbsecret "todo" + + assert_match "Too few arguments given", stderr + + _, stderr = kbsecret "todo", "start" + + assert_match "Too few arguments given", stderr + end + + def test_todo_no_such_record + _, stderr = kbsecret "todo", "start", "this-does-not-exist" + + assert_match "No such todo record", stderr + + kbsecret "new", "login", "test-todo-filters-type", input: "foo\nbar\n" + + _, stderr = kbsecret "todo", "start", "test-todo-filters-type" + + assert_match "No such todo record", stderr + ensure + kbsecret "rm", "test-todo-filters-type" + end + + def test_todo_unknown_subcommand + kbsecret "new", "todo", "test-todo-unknown-subcommand", input: "laundry\n" + + _, stderr = kbsecret "todo", "made-up-subcommand", "test-todo-unknown-subcommand" + + assert_match "Unknown subcommand:", stderr + ensure + kbsecret "rm", "test-todo-unknown-subcommand" + end + + def test_todo_subcommands + kbsecret "new", "todo", "test-todo-subcommands", input: "laundry\n" + + stdout, = kbsecret "todo", "start", "test-todo-subcommands" + + assert_match "marked as started", stdout + + stdout, = kbsecret "todo", "suspend", "test-todo-subcommands" + + assert_match "marked as suspended", stdout + + stdout, = kbsecret "todo", "complete", "test-todo-subcommands" + + assert_match "marked as completed", stdout + ensure + kbsecret "rm", "test-todo-subcommands" + end + + def test_todo_accepts_session + kbsecret "session", "new", "todo-test-session", "-r", "todo-test-session" + kbsecret "new", "-s", "todo-test-session", "todo", "test-todo-session" + + stdout, = kbsecret "todo", "-s", "todo-test-session", "start", "test-todo-session" + + assert_match "marked as started", stdout + ensure + kbsecret "session", "rm", "-d", "todo-test-session" + end +end
test/cli: Add tests for `kbsecret todo`
diff --git a/GAuth.podspec b/GAuth.podspec index abc1234..def5678 100644 --- a/GAuth.podspec +++ b/GAuth.podspec @@ -12,7 +12,7 @@ spec.watchos.deployment_target = '2.0' spec.requires_arc = true - spec.source = { git: "https://www.github.com/fabiomassimo/GAuth", tag: "v#{spec.version}", submodules: true } + spec.source = { git: "https://www.github.com/fabiomassimo/GAuth", tag: "#{spec.version}", submodules: true } spec.source_files = "Sources/**/*.{h,swift}" spec.dependency "Result", "~> 2.1"
Update Podspec by removing "v" prefix in pod tag.
diff --git a/rails/install.rb b/rails/install.rb index abc1234..def5678 100644 --- a/rails/install.rb +++ b/rails/install.rb @@ -1,8 +1,9 @@ # copy migrations +FileUtils.mkdir_p("#{Rails.root}/db/migrate") Dir["#{Rails.root}/vendor/plugins/simple_metrics_engine/db/migrate/*.rb"].each do |file| puts "Copying #{File.basename(file)} to db/migrate" - FileUtils.cp(file, "#{Rails.root}/db/migrate", :verbose => true) + FileUtils.cp(file, "#{Rails.root}/db/migrate") end sh 'rake db:migrate'
Make sure db/migrate exists before copying to it.
diff --git a/kramdown-rfc2629.gemspec b/kramdown-rfc2629.gemspec index abc1234..def5678 100644 --- a/kramdown-rfc2629.gemspec +++ b/kramdown-rfc2629.gemspec @@ -1,10 +1,10 @@ spec = Gem::Specification.new do |s| s.name = 'kramdown-rfc2629' - s.version = '1.0.12' + s.version = '1.0.13' s.summary = "Kramdown extension for generating RFC 2629 XML." s.description = %{An RFC2629 (XML2RFC) generating backend for Thomas Leitner's "kramdown" markdown parser. Mostly useful for RFC writers.} - s.add_dependency('kramdown', '~> 1.3.0') + s.add_dependency('kramdown', '~> 1.4.0') s.files = Dir['lib/**/*.rb'] + %w(README.md LICENSE kramdown-rfc2629.gemspec bin/kramdown-rfc2629 data/kramdown-rfc2629.erb) s.require_path = 'lib' s.executables = ['kramdown-rfc2629']
1.0.13: Update to kramdown-1.4; include LICENSE file in gem
diff --git a/test/cases/migration_test_sqlserver.rb b/test/cases/migration_test_sqlserver.rb index abc1234..def5678 100644 --- a/test/cases/migration_test_sqlserver.rb +++ b/test/cases/migration_test_sqlserver.rb @@ -21,7 +21,7 @@ begin ActiveRecord::Migrator.up(SQLSERVER_MIGRATIONS_ROOT+'/transaction_table') rescue Exception => e - assert_match %r|migrations canceled|, e.message + assert_match %r|this and all later migrations canceled|, e.message end assert_does_not_contain @trans_test_table1, @connection.tables assert_does_not_contain @trans_test_table2, @connection.tables
Fix test for DDL transactions. (better regex for DDL specific message)
diff --git a/lib/inline_svg/static_asset_finder.rb b/lib/inline_svg/static_asset_finder.rb index abc1234..def5678 100644 --- a/lib/inline_svg/static_asset_finder.rb +++ b/lib/inline_svg/static_asset_finder.rb @@ -1,7 +1,9 @@+require "pathname" + # Naive fallback asset finder for when sprockets >= 3.0 && # config.assets.precompile = false # Thanks to @ryanswood for the original code: -# https://github.com/AbleHealth/inline_svg/commit/661bbb3bef7d1b4bd6ccd63f5f018305797b9509 +# https://github.com/jamesmartin/inline_svg/commit/661bbb3bef7d1b4bd6ccd63f5f018305797b9509 module InlineSvg class StaticAssetFinder def self.find_asset(filename) @@ -14,7 +16,7 @@ def pathname if ::Rails.application.config.assets.compile - ::Rails.application.assets[@filename].pathname + Pathname.new(::Rails.application.assets[@filename].filename) else manifest = ::Rails.application.assets_manifest asset_path = manifest.assets[@filename]
Fix bad reference to Sprockets::Asset.pathname
diff --git a/lib/rails-footnotes/notes/log_note.rb b/lib/rails-footnotes/notes/log_note.rb index abc1234..def5678 100644 --- a/lib/rails-footnotes/notes/log_note.rb +++ b/lib/rails-footnotes/notes/log_note.rb @@ -19,18 +19,22 @@ end def title - "Log (#{log.count("\n")})" + "Log (#{log.count})" end def content - result = escape(log.gsub(/\e\[.+?m/, '')).gsub("\n", '<br />') + result = '<table>' + log.each do |l| + result << "<tr><td>#{l.gsub(/\e\[.+?m/, '')}</td></tr>" + end + result << '</table>' # Restore formatter Rails.logger = self.class.original_logger result end def log - self.class.logs.join("\n") + self.class.logs end end
Fix count in log note and use tables
diff --git a/lib/roleify/roleifyable_controller.rb b/lib/roleify/roleifyable_controller.rb index abc1234..def5678 100644 --- a/lib/roleify/roleifyable_controller.rb +++ b/lib/roleify/roleifyable_controller.rb @@ -9,7 +9,7 @@ def allowed? # action marked 'public', allow access even when not logged in - return if actions_for_role(Roleify::Role::RULES[:public]).include?(self.action_name) + return if actions_for_role(Roleify::Role::RULES[:public]).try(:include?, self.action_name) # no user, no role deny access deny_access && return unless current_user && current_user.role # admin user, ok
Use :try to catch missing :public role.
diff --git a/lib/roleify/roleifyable_controller.rb b/lib/roleify/roleifyable_controller.rb index abc1234..def5678 100644 --- a/lib/roleify/roleifyable_controller.rb +++ b/lib/roleify/roleifyable_controller.rb @@ -9,7 +9,7 @@ def allowed? # action marked 'public', allow access even when not logged in - return if actions_for_role(Roleify::Role::RULES[:public]).include?(self.action_name) + return if actions_for_role(Roleify::Role::RULES[:public]).try(:include?, self.action_name) # no user, no role deny access deny_access && return unless current_user && current_user.role # admin user, ok
Use :try to catch missing :public role.
diff --git a/POSRx.podspec b/POSRx.podspec index abc1234..def5678 100644 --- a/POSRx.podspec +++ b/POSRx.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |s| s.name = 'POSRx' - s.version = '0.6.4' + s.version = '0.6.5' s.license = 'MIT' s.summary = 'Utilities around ReactiveCocoa.' s.homepage = 'https://github.com/pavelosipov/POSRx' s.authors = { 'Pavel Osipov' => '[email protected]' } - s.source = { :git => 'https://github.com/pavelosipov/POSRx.git', :tag => '0.6.4' } + s.source = { :git => 'https://github.com/pavelosipov/POSRx.git', :tag => '0.6.5' } s.platform = :ios, '7.0' s.requires_arc = true s.source_files = 'POSRx/**/*.{h,m}'
Update podspec version: 0.6.4 -> 0.6.5
diff --git a/sensu-extensions-statsd.gemspec b/sensu-extensions-statsd.gemspec index abc1234..def5678 100644 --- a/sensu-extensions-statsd.gemspec +++ b/sensu-extensions-statsd.gemspec @@ -13,7 +13,7 @@ spec.add_dependency 'sensu-extension' - spec.add_development_dependency 'bundler', '~> 1.6' + spec.add_development_dependency 'bundler', '~> 2.1' spec.add_development_dependency 'github_changelog_generator' spec.add_development_dependency 'rake' spec.add_development_dependency 'rspec'
Update bundler requirement from ~> 1.6 to ~> 2.1 Updates the requirements on [bundler](https://github.com/bundler/bundler) to permit the latest version. - [Release notes](https://github.com/bundler/bundler/releases) - [Changelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md) - [Commits](https://github.com/bundler/bundler/compare/v1.6.0...v2.1.0) Signed-off-by: dependabot-preview[bot] <[email protected]>
diff --git a/lib/vagrant-vbguest/vagrant_compat.rb b/lib/vagrant-vbguest/vagrant_compat.rb index abc1234..def5678 100644 --- a/lib/vagrant-vbguest/vagrant_compat.rb +++ b/lib/vagrant-vbguest/vagrant_compat.rb @@ -7,9 +7,11 @@ } compat_version = supported_version.find { |requirement, version| Gem::Requirement.new(requirement).satisfied_by?(vagrant_version) -}[1] +} -if !compat_version +if compat_version + compat_version = compat_version[1] +else # @TODO: yield warning compat_version = supported_version.to_a.last[1] end
Fix `nil[]` error with unknown Vagrant version
diff --git a/test/integration/oauth_test.rb b/test/integration/oauth_test.rb index abc1234..def5678 100644 --- a/test/integration/oauth_test.rb +++ b/test/integration/oauth_test.rb @@ -14,13 +14,26 @@ end end + context "access with invalid API key" do + setup do + @token = create(:access_token, application: @application, resource_owner_id: @user.id) + @application.destroy + end + + should "return data for questionnaire" do + get questionnaires_path, headers: auth_headers(@token.token) + assert_response :redirect + assert_redirected_to new_user_session_url + end + end + context "access with API key" do setup do @token = create(:access_token, application: @application, resource_owner_id: @user.id) end should "return data for questionnaire" do - get questionnaires_path, headers: auth_headers + get questionnaires_path, headers: auth_headers(@token.token) assert_response :success end end @@ -33,10 +46,10 @@ } end - def auth_headers + def auth_headers(token) { content_type: 'application/json', - authorization: "Bearer #{@token.token}" + authorization: "Bearer #{token}" } end end
Test with invalid API key
diff --git a/lib/libvirt-ruby/util.rb b/lib/libvirt-ruby/util.rb index abc1234..def5678 100644 --- a/lib/libvirt-ruby/util.rb +++ b/lib/libvirt-ruby/util.rb @@ -27,7 +27,7 @@ private def self.not_direct_call? - caller[1][/`.*'/][1..-2] == 'method_missing' + caller[1][/`.*'/] and caller[1][/`.*'/][1..-2] == 'method_missing' end end end
Fix Bug for ruby 1.8.7
diff --git a/lib/mathmagic/integer.rb b/lib/mathmagic/integer.rb index abc1234..def5678 100644 --- a/lib/mathmagic/integer.rb +++ b/lib/mathmagic/integer.rb @@ -32,4 +32,16 @@ return true end + def divisible? n + (self % n).zero? + end + + def up + self + 1 + end + + def down + self - 1 + end + end
Add methods to Integer: divisible?, up, down
diff --git a/lib/modalsupport/file.rb b/lib/modalsupport/file.rb index abc1234..def5678 100644 --- a/lib/modalsupport/file.rb +++ b/lib/modalsupport/file.rb @@ -1,12 +1,7 @@ def File.relative_path(path, base=nil) base ||= '.' casefold = File::ALT_SEPARATOR=='\\' - # Note: currently Rubinius differs from MRI in that - # File.expand_path('//x') is '//x' in MRI and '/x' - # Since '//x' could be an absolute path, we should fix this here: - double_slash = base.starts_with?('\\\\') base = File.expand_path(base) - base = '\\'+base if double_slash && !base.starts_with('\\\\') base = base.gsub(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR base.downcase! if casefold base += File::SEPARATOR unless base[-1,1]==File::SEPARATOR
Remove ugly & incomplete fix for Rubinius File.relative_path
diff --git a/lib/pry/terminal_info.rb b/lib/pry/terminal_info.rb index abc1234..def5678 100644 --- a/lib/pry/terminal_info.rb +++ b/lib/pry/terminal_info.rb @@ -21,6 +21,6 @@ ENV['ANSICON'] =~ /\((.*)x(.*)\)/ && [$2, $1] ].detect do |(_, cols)| cols.to_i > 0 - end + end.map!(&:to_i) end end
Return numbers from screen_size, kthxbai...
diff --git a/lib/shipitron/s3_copy.rb b/lib/shipitron/s3_copy.rb index abc1234..def5678 100644 --- a/lib/shipitron/s3_copy.rb +++ b/lib/shipitron/s3_copy.rb @@ -27,8 +27,6 @@ if $? != 0 fail_with_error!(message: 'Failed to transfer to/from s3.') end - - Logger.info "S3 result: #{Pathname.new(destination).parent.children.inspect}" end end
Remove debug logging that broke stuff