diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/unicode_math.gemspec b/unicode_math.gemspec index abc1234..def5678 100644 --- a/unicode_math.gemspec +++ b/unicode_math.gemspec @@ -11,7 +11,7 @@ gem.homepage = 'https://github.com/collectiveidea/unicode_math' gem.add_development_dependency 'rake', '~> 0.9' - gem.add_development_dependency 'rspec', '~> 2.0' + gem.add_development_dependency 'rspec', '~> 2.11' gem.files = `git ls-files`.split($/) gem.test_files = gem.files.grep(/^spec/)
Bring the RSpec dependency up-to-date to include random ordering
diff --git a/test/prx_auth/rails/configuration_test.rb b/test/prx_auth/rails/configuration_test.rb index abc1234..def5678 100644 --- a/test/prx_auth/rails/configuration_test.rb +++ b/test/prx_auth/rails/configuration_test.rb @@ -9,17 +9,28 @@ end it 'can be reconfigured using the namespace attr' do - subject.namespace = :new_test + PrxAuth::Rails.stub(:configuration, subject) do + PrxAuth::Rails.configure do |config| + config.namespace = :new_test + end - assert subject.namespace == :new_test + assert PrxAuth::Rails.configuration.namespace == :new_test + end end it 'defaults to enabling the middleware' do - assert subject.install_middleware + PrxAuth::Rails.stub(:configuration, subject) do + assert PrxAuth::Rails.configuration.install_middleware + end end it 'allows overriding of the middleware automatic installation' do - subject.install_middleware = false - assert subject.install_middleware == false + PrxAuth::Rails.stub(:configuration, subject) do + PrxAuth::Rails.configure do |config| + config.install_middleware = false + end + + assert !PrxAuth::Rails.configuration.install_middleware + end end end
Use stubbing here to ensure we trace the config block codepath
diff --git a/cookbooks/zookeeper/attributes/default.rb b/cookbooks/zookeeper/attributes/default.rb index abc1234..def5678 100644 --- a/cookbooks/zookeeper/attributes/default.rb +++ b/cookbooks/zookeeper/attributes/default.rb @@ -1,9 +1,9 @@ default[:zookeeper][:version] = "3.3.4" -default[:zookeeper][:installDir] = "/usr/local/share/zookeeper" +default[:zookeeper][:installDir] = "/opt/zookeeper" default[:zookeeper][:logDir] = '/var/log/zookeeper' default[:zookeeper][:dataDir] = "/var/zookeeper" -default[:zookeeper][:snapshotDir] = "/var/lib/zookeeper/snapshots" +default[:zookeeper][:snapshotDir] = "#{default[:zookeeper][:dataDir]}/snapshots" default[:zookeeper][:tickTime] = 2000 default[:zookeeper][:initLimit] = 10
Move installdir to /opt/zookeeper and make snapshotdir inside of whatever datadir is Former-commit-id: c0e88f5abb0455236cf1bee2fdb37771ac51aa68 [formerly efb0f4b29750eeeca1e3f6b1d0f9da9fc1d5b929] [formerly b9a0f58862e0bbb50b4f743495580d2951f795d8 [formerly bc71f82139379f73042326dea9667cc0d5b0566f [formerly edf676cccda3fcebf7d02e8562cb12086ba28e4f]]] Former-commit-id: b9cd345c0027339d7f31e7cd471e86fb78eb9481 [formerly 6f4efd35b1b7f9cf0e5f031a58e4b6dfe90185d0] Former-commit-id: a4b16262a1150763f7bbfa2988870c3ef18e355d Former-commit-id: 3d8c1f0522d2563b034251a184eda821d66cbd6a
diff --git a/numbers.rb b/numbers.rb index abc1234..def5678 100644 --- a/numbers.rb +++ b/numbers.rb @@ -14,14 +14,14 @@ IfZero = -> if_this_is_zero { -> do_this { -> otherwise_do_this { - If[->_{do_this.(Noop)}][->_{otherwise_do_this.(Noop)}][IsZero[if_this_is_zero]] + IsZero[if_this_is_zero][->_{do_this.(Noop)}][->_{otherwise_do_this.(Noop)}].(Noop) }}} NumbersEqual = -> first { -> second { IfZero[first][ - ->_{If[LTrue][LFalse][IsZero[second]]} + ->_{IsZero[second]} ][ ->_{IfZero[second][LFalse][->_{NumbersEqual[Pred[first]][Pred[second]]}]} ]
Simplify a couple of Ifs
diff --git a/DRObservableArray.podspec b/DRObservableArray.podspec index abc1234..def5678 100644 --- a/DRObservableArray.podspec +++ b/DRObservableArray.podspec @@ -6,8 +6,11 @@ s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { 'Dariusz Rybicki' => 'darrarski@gmail.com' } s.source = { :git => 'https://github.com/darrarski/DRObservableArray.git', :tag => 'v1.0.0' } - s.platform = :ios + + s.requires_arc = true s.ios.deployment_target = "8.0" - s.source_files = 'DRObservableArray' - s.requires_arc = true + s.osx.deployment_target = '10.11' + s.source_files = 'DRObservableArray/Common/*.{h,m}' + s.ios.source_files = 'DRObservableArray/iOS/*.{h,m}' + s.osx.source_files = 'DRObservableArray/macOS/*.{h,m}' end
Update podspec so it contains setup for iOS and macOS platforms
diff --git a/capybara-firebug.gemspec b/capybara-firebug.gemspec index abc1234..def5678 100644 --- a/capybara-firebug.gemspec +++ b/capybara-firebug.gemspec @@ -18,7 +18,7 @@ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ["lib"] - s.add_dependency "capybara", "~> 1.0" + s.add_dependency "capybara", ">= 1.0", "< 3.0" s.add_development_dependency "rspec", "~> 2.0" s.add_development_dependency "cucumber", "~> 0.10.0"
Make gemspec compatible with Capybara 2.0 Things seem to be working fine.
diff --git a/test/controllers/api/auth/networks_controller_test.rb b/test/controllers/api/auth/networks_controller_test.rb index abc1234..def5678 100644 --- a/test/controllers/api/auth/networks_controller_test.rb +++ b/test/controllers/api/auth/networks_controller_test.rb @@ -0,0 +1,32 @@+require 'test_helper' +require 'json' + +describe Api::Auth::NetworksController do + let (:user) { create(:user) } + let (:token) { OpenStruct.new.tap { |t| t.user_id = user.id } } + let (:network) { create(:network, account: user.individual_account) } + + describe 'with a valid token' do + + around do |test| + @controller.stub(:prx_auth_token, token) { test.call } + end + + it 'should show' do + get(:show, api_version: 'v1', format: 'json', id: network.id) + assert_response :success + resource = JSON.parse(@response.body) + resource["id"].must_equal network.id + end + + it 'should list' do + network.id.wont_be_nil + get(:index, api_version: 'v1', format: 'json') + assert_response :success + list = JSON.parse(@response.body) + list["total"].must_equal 1 + end + + end + +end
Add auth networks controller test
diff --git a/sharepoint.gemspec b/sharepoint.gemspec index abc1234..def5678 100644 --- a/sharepoint.gemspec +++ b/sharepoint.gemspec @@ -10,6 +10,8 @@ gem.files = `git ls-files`.split("\n") gem.require_paths = ["lib"] + gem.required_ruby_version = '>= 2.3' + gem.add_dependency 'ethon' gem.add_dependency 'activesupport', '>= 4.0'
Add required ruby version to gemspec Sharepoint uses `.dig` method, introduced in Ruby 2.3, so it is not compatible with versions older than 2.3
diff --git a/lib/cloudstrap/hdp/bootstrap_properties.rb b/lib/cloudstrap/hdp/bootstrap_properties.rb index abc1234..def5678 100644 --- a/lib/cloudstrap/hdp/bootstrap_properties.rb +++ b/lib/cloudstrap/hdp/bootstrap_properties.rb @@ -55,7 +55,11 @@ Contract None => Hash def load - JavaProperties.load file + if exist? + JavaProperties.load file + else + JavaProperties.parse seed.contents + end end Contract None => Hash
Load seed contents if missing properties
diff --git a/lib/hell/lib/capistrano/task_definition.rb b/lib/hell/lib/capistrano/task_definition.rb index abc1234..def5678 100644 --- a/lib/hell/lib/capistrano/task_definition.rb +++ b/lib/hell/lib/capistrano/task_definition.rb @@ -14,6 +14,7 @@ :fully_qualified_name => fully_qualified_name, :description => description == brief_description ? false : description, :brief_description => brief_description, + :options => @options, } end end
Add options hash to task hash
diff --git a/lib/inch_ci/worker/build/badge_detector.rb b/lib/inch_ci/worker/build/badge_detector.rb index abc1234..def5678 100644 --- a/lib/inch_ci/worker/build/badge_detector.rb +++ b/lib/inch_ci/worker/build/badge_detector.rb @@ -13,7 +13,7 @@ # @return [String] filename def self.find_readme(repo) - Dir[File.join(repo.path, '*.*')].detect do |f| + Dir[File.join(repo.path, '*.*')].sort.detect do |f| File.basename(f) =~ /\Areadme\./i end end
Sort README files for BadgeDetector
diff --git a/lib/morpher/evaluator/transformer/guard.rb b/lib/morpher/evaluator/transformer/guard.rb index abc1234..def5678 100644 --- a/lib/morpher/evaluator/transformer/guard.rb +++ b/lib/morpher/evaluator/transformer/guard.rb @@ -4,9 +4,14 @@ # Transformer that allows to guard transformation process with a predicate on input class Guard < self - include Concord.new(:predicate), Transitive + include Concord::Public.new(:predicate), Transitive register :guard + + printer do + name + visit(:predicate) + end # Call evaluator #
Add printer configuration for Evaluator::Transformer::Guard
diff --git a/lib/tasks/data_feeds/meteostat_loader.rake b/lib/tasks/data_feeds/meteostat_loader.rake index abc1234..def5678 100644 --- a/lib/tasks/data_feeds/meteostat_loader.rake +++ b/lib/tasks/data_feeds/meteostat_loader.rake @@ -6,6 +6,6 @@ loader = DataFeeds::MeteostatLoader.new(start_date, end_date) loader.import - p "Imported #{loader.insert_count} records, Updated #{loader.update_count} records from #{loader.stations} stations" + p "Imported #{loader.insert_count} records, Updated #{loader.update_count} records from #{loader.stations_processed} stations" end end
Fix error in log message
diff --git a/Lyt.podspec b/Lyt.podspec index abc1234..def5678 100644 --- a/Lyt.podspec +++ b/Lyt.podspec @@ -1,13 +1,14 @@ Pod::Spec.new do |s| s.name = 'Lyt' - s.version = '0.2' + s.version = '0.3' s.license = 'Apache 2.0' - s.summary = 'A UIView category to make autolayout (more) readable and less verbose' + s.summary = 'A UIView and NSView category to make autolayout (more) readable and less verbose' s.homepage = 'https://github.com/robotmedia/Lyt' s.author = 'Hermes Pique' s.social_media_url = 'https://twitter.com/robotmedia' s.source = { :git => 'https://github.com/robotmedia/Lyt.git', :tag => "v#{s.version}" } - s.platform = :ios, '7.0' + s.ios.platform = :ios, '7.0' + s.osx.platform = :osx, '10.7' s.requires_arc = true s.source_files = 'Lyt/*.{h,m}' end
Increase version and add OS X platform
diff --git a/rake/test/filecreation.rb b/rake/test/filecreation.rb index abc1234..def5678 100644 --- a/rake/test/filecreation.rb +++ b/rake/test/filecreation.rb @@ -13,7 +13,9 @@ end def create_file(name) - open(name, "w") {|f| f.puts "HI" } if ! File.exist?(name) + dirname = File.dirname(name) + FileUtils.mkdir_p(dirname) unless File.exist?(dirname) + open(name, "w") {|f| f.puts "HI" } unless File.exist?(name) File.new(name).mtime end
Create directory in create_file if it does not exist. git-svn-id: 6a2c20c72ceedae27ecedb68e90cd4f115192a7a@237 5af023f1-ac1a-0410-98d6-829a145c37ef
diff --git a/spec/ellen/handlers/whoami_spec.rb b/spec/ellen/handlers/whoami_spec.rb index abc1234..def5678 100644 --- a/spec/ellen/handlers/whoami_spec.rb +++ b/spec/ellen/handlers/whoami_spec.rb @@ -0,0 +1,36 @@+require "spec_helper" + +describe Ellen::Handlers::Whoami do + let(:robot) do + Ellen::Robot.new + end + + describe "#ping" do + let(:from) do + "alice" + end + + let(:to) do + "#general" + end + + let(:said) do + "@ellen Who am I?" + end + + it "returns PONG to PING" do + robot.should_receive(:say).with( + body: from, + from: to, + to: from, + original: { + body: said, + from: from, + robot: robot, + to: to, + }, + ) + robot.receive(body: said, from: from, to: to) + end + end +end
Write test for whoami handler
diff --git a/spec/models/security_group_spec.rb b/spec/models/security_group_spec.rb index abc1234..def5678 100644 --- a/spec/models/security_group_spec.rb +++ b/spec/models/security_group_spec.rb @@ -13,7 +13,13 @@ describe "#total_vms" do it "counts vms" do sg = FactoryGirl.create(:security_group) - 2.times { sg.vms.create(FactoryGirl.attributes_for(:vm)) } + + 2.times do + vm = FactoryGirl.create(:vm_amazon) + FactoryGirl.create(:network_port_openstack, + :device => vm, + :security_groups => [sg]) + end expect(sg.reload.total_vms).to eq(2) end
Fix failing test due to old SC association Fix failing test due to old SC association, test was using an old association, with direct relation to VM.
diff --git a/spec/controllers/proposals_controller_spec.rb b/spec/controllers/proposals_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/proposals_controller_spec.rb +++ b/spec/controllers/proposals_controller_spec.rb @@ -0,0 +1,14 @@+require 'spec_helper' + +describe ProposalsController, :type => :controller do + describe '#generate' do + it 'doesn\'t die horribly when you try to use it' do + lambda do + post :generate, :format => :pdf, :proposal => + { :title => 'my proposal' } + end.should_not raise_error + response.should be_success + end + end +end +
Add small test for proposals (not 500).
diff --git a/spec/ruby/core/module/initialize_copy_spec.rb b/spec/ruby/core/module/initialize_copy_spec.rb index abc1234..def5678 100644 --- a/spec/ruby/core/module/initialize_copy_spec.rb +++ b/spec/ruby/core/module/initialize_copy_spec.rb @@ -1,2 +1,17 @@ require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../fixtures/classes', __FILE__) + +describe "Module#initialize_copy" do + + ruby_bug "#7557", "1.9.3.327" do + + it "raises a TypeError when called on already initialized classes" do + lambda{ + m = Module.new + String.send :initialize_copy, m + }.should raise_error(TypeError) + end + + end + +end
Add spec for trying to reinitialize Module
diff --git a/roles/eustace.rb b/roles/eustace.rb index abc1234..def5678 100644 --- a/roles/eustace.rb +++ b/roles/eustace.rb @@ -2,6 +2,11 @@ description "Master role applied to eustace" default_attributes( + :chef => { + :client => { + :version => "12.1.2-1" + } + }, :networking => { :interfaces => { :internal_ipv4 => {
Upgrade one node to use a chef 12 client as a test
diff --git a/Casks/art-directors-toolkit.rb b/Casks/art-directors-toolkit.rb index abc1234..def5678 100644 --- a/Casks/art-directors-toolkit.rb +++ b/Casks/art-directors-toolkit.rb @@ -0,0 +1,13 @@+cask :v1 => 'art-directors-toolkit' do + version '5.5.1' + sha256 '6b15214f4f928d8519836cd6e60b4f72ecf9365ebc2f29a931c32b81babaddff' + + url "http://www.code-line.com/download/ArtDirectorsToolkit#{version.to_i}i.zip" + name 'Art Directors Toolkit' + homepage 'http://code-line.com/artdirectorstoolkit' + license :commercial + + app "Art Directors Toolkit #{version.to_i}i.app" + + zap :delete => '~/Library/Preferences/com.code-line.artdirectorstoolkit*.plist' +end
Add Art Director's Toolkit 5.1.1 Art Director's Toolkit from Code Line. Signed-off-by: Daniel Bayley <a8999ec6105921a5e047cd21489d1a78436cfb40@me.com>
diff --git a/Casks/spotify-notifications.rb b/Casks/spotify-notifications.rb index abc1234..def5678 100644 --- a/Casks/spotify-notifications.rb +++ b/Casks/spotify-notifications.rb @@ -0,0 +1,7 @@+class SpotifyNotifications < Cask + url 'https://github.com/citruspi/Spotify-Notifications/releases/download/0.4.8/Spotify.Notifications.-.0.4.8.zip' + homepage 'http://spotify-notifications.citruspi.io/' + version '0.4.8' + sha256 '953028e9a1aad445005869598050cb8612980821a796563936f557e03b319f50' + link 'Spotify Notifications.app' +end
Create Spotify Notifications v0.4.8 cask
diff --git a/app/controllers/sms_configurations_controller.rb b/app/controllers/sms_configurations_controller.rb index abc1234..def5678 100644 --- a/app/controllers/sms_configurations_controller.rb +++ b/app/controllers/sms_configurations_controller.rb @@ -12,7 +12,7 @@ end def save_sms_configuration - sms_config = params.clone.delete_if {|k,v| v.blank? } + sms_config = params.clone.delete_if {|k,v| not (k =~/^(enable_sms|token|sender|body|account_id)/)} sms_config.each do |k,v| SMSConfiguration.update_or_insert(k,v) end
Fix param filter for sms config saving
diff --git a/config/initializers/ruby_parser_ruby23_bridge.rb b/config/initializers/ruby_parser_ruby23_bridge.rb index abc1234..def5678 100644 --- a/config/initializers/ruby_parser_ruby23_bridge.rb +++ b/config/initializers/ruby_parser_ruby23_bridge.rb @@ -0,0 +1,18 @@+require 'ruby_parser' + +module RubyParserRuby23Bridge + def for_current_ruby + result = super + rescue => e + if e.message.include?("unrecognized RUBY_VERSION 2.3") + Ruby22Parser.new + else + raise + end + else + warn "Remove me: #{__FILE__}:#{__LINE__}. RubyParser now supports ruby 2.3+" if RUBY_VERSION.match(/^2.3/) + result + end +end + +RubyParser.singleton_class.prepend RubyParserRuby23Bridge
Use ruby 2.2 parser until 2.3 is supported in ruby_parser. Fixes errors on ruby 2.3.0-preview2 of the variety: ``` 1) ManageIQ::Providers::Kubernetes::ContainerManager::Refresher will perform a full refresh on k8s Failure/Error: @ems = FactoryGirl.create(:ems_kubernetes, :hostname => "10.35.0.169", RuntimeError: unrecognized RUBY_VERSION 2.3.0 ./lib/extensions/descendant_loader.rb:74:in `classes_in' ./lib/extensions/descendant_loader.rb:193:in `classes_in' ./lib/extensions/descendant_loader.rb:205:in `block in class_inheritance_relationships' ./lib/extensions/descendant_loader.rb:204:in `glob' ./lib/extensions/descendant_loader.rb:204:in `class_inheritance_relationships' ./lib/extensions/descendant_loader.rb:228:in `load_subclasses' ./lib/extensions/descendant_loader.rb:250:in `descendants' ./spec/models/manageiq/providers/kubernetes/container_manager/refresher_spec.rb:7:in `block (2 levels) in <top (required)>' ``` See the request to support 2.3 features such as &. "safe navigation operator" https://github.com/seattlerb/ruby_parser, issue: 201
diff --git a/db/migrate/20131210181901_migrate_word_counts.rb b/db/migrate/20131210181901_migrate_word_counts.rb index abc1234..def5678 100644 --- a/db/migrate/20131210181901_migrate_word_counts.rb +++ b/db/migrate/20131210181901_migrate_word_counts.rb @@ -5,13 +5,13 @@ post_ids = execute("SELECT id FROM posts WHERE word_count IS NULL LIMIT 500").map {|r| r['id'].to_i } while post_ids.length > 0 - execute "UPDATE posts SET word_count = array_length(regexp_split_to_array(raw, ' '),1) WHERE id IN (#{post_ids.join(',')})" + execute "UPDATE posts SET word_count = COALESCE(array_length(regexp_split_to_array(raw, ' '),1), 0) WHERE id IN (#{post_ids.join(',')})" post_ids = execute("SELECT id FROM posts WHERE word_count IS NULL LIMIT 500").map {|r| r['id'].to_i } end topic_ids = execute("SELECT id FROM topics WHERE word_count IS NULL LIMIT 500").map {|r| r['id'].to_i } while topic_ids.length > 0 - execute "UPDATE topics SET word_count = (SELECT SUM(COALESCE(posts.word_count, 0)) FROM posts WHERE posts.topic_id = topics.id) WHERE topics.id IN (#{topic_ids.join(',')})" + execute "UPDATE topics SET word_count = COALESCE((SELECT SUM(COALESCE(posts.word_count, 0)) FROM posts WHERE posts.topic_id = topics.id), 0) WHERE topics.id IN (#{topic_ids.join(',')})" topic_ids = execute("SELECT id FROM topics WHERE word_count IS NULL LIMIT 500").map {|r| r['id'].to_i } end
Use COALESCE in case there are no posts in a topic
diff --git a/lib/baler/parser.rb b/lib/baler/parser.rb index abc1234..def5678 100644 --- a/lib/baler/parser.rb +++ b/lib/baler/parser.rb @@ -9,26 +9,28 @@ DOCUMENT_ADAPTERS = {:hpricot => Adapter::Hpricot::Document} DEFAULT_DOCUMENT_ADAPTER = DOCUMENT_ADAPTERS.keys.first - def self.document(type_or_adapter, url, context_path = nil) - if adapter_class = DOCUMENT_ADAPTERS[(type_or_adapter || DEFAULT_DOCUMENT_ADAPTER)] - adapter = adapter_class.new(url) - else - adapter = type_or_adapter + class << self + def document(type_or_adapter, url, context_path = nil) + if adapter_class = DOCUMENT_ADAPTERS[(type_or_adapter || DEFAULT_DOCUMENT_ADAPTER)] + adapter = adapter_class.new(url) + else + adapter = type_or_adapter + end + + Document.new(adapter, context_path) end - Document.new(adapter, context_path) - end + def filter(object) + if object.is_a? Parser::Collection + object = object.length <= 1 ? object.first : object.to_array.map{|e| e.inner_html} + end - def self.filter(object) - if object.is_a? Parser::Collection - object = object.length <= 1 ? object.first : object.to_array.map{|e| e.inner_html} + if object.is_a? Parser::Element + object = object.inner_html + end + + object end - - if object.is_a? Parser::Element - object = object.inner_html - end - - object end end end
Move Baler::Parser methods into a class << self block
diff --git a/lib/sprint/rails.rb b/lib/sprint/rails.rb index abc1234..def5678 100644 --- a/lib/sprint/rails.rb +++ b/lib/sprint/rails.rb @@ -2,6 +2,7 @@ module Sprint module Rails - # Your code goes here... + class Engine << ::Rails::Engine + end end end
Declare as subclass of Rails::Engine
diff --git a/rubyfox-sfsobject.gemspec b/rubyfox-sfsobject.gemspec index abc1234..def5678 100644 --- a/rubyfox-sfsobject.gemspec +++ b/rubyfox-sfsobject.gemspec @@ -13,7 +13,7 @@ gem.homepage = "https://github.com/neopoly/rubyfox-sfsobject" gem.platform = Gem::Platform::CURRENT - gem.files = `git ls-files`.split($/) + gem.files = `git ls-files`.split($/).reject { |file| file =~ %r{test/vendor} } 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"]
Exclude test/vendor when building a gem. [ci skip]
diff --git a/examples/rotating_hmans.rb b/examples/rotating_hmans.rb index abc1234..def5678 100644 --- a/examples/rotating_hmans.rb +++ b/examples/rotating_hmans.rb @@ -5,11 +5,18 @@ class Hmans < Schnitzel::Node def setup @sprite = Schnitzel::Sprite.new file: File.join(__FILE__, '../assets/images/hmans.jpg') + @font = Gosu::Font.new($window, Gosu::default_font_name, 20) self << @sprite end def update(dt) + super @sprite.rotation += 90.0 * dt + end + + def draw + super + @font.draw("Woohoo!", 10, 10, 666, 1.0, 1.0, 0xccffffff) end end
Add a bit of text to the rotating hmans example.
diff --git a/faraday_middleware.gemspec b/faraday_middleware.gemspec index abc1234..def5678 100644 --- a/faraday_middleware.gemspec +++ b/faraday_middleware.gemspec @@ -11,7 +11,7 @@ spec.licenses = ['MIT'] spec.name = 'faraday_middleware' spec.require_paths = ['lib'] - spec.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') + spec.required_rubygems_version = '>= 1.3.6' spec.summary = spec.description spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") spec.version = FaradayMiddleware::VERSION
Use of custom objects is not necessary here
diff --git a/examples/background_subtractor.rb b/examples/background_subtractor.rb index abc1234..def5678 100644 --- a/examples/background_subtractor.rb +++ b/examples/background_subtractor.rb @@ -32,4 +32,6 @@ result.copy!(frame, delta); window.show result + + break if GUI::wait_key(10) > 0 end
Add a break condition here too.
diff --git a/spec/factories/check_in_form.rb b/spec/factories/check_in_form.rb index abc1234..def5678 100644 --- a/spec/factories/check_in_form.rb +++ b/spec/factories/check_in_form.rb @@ -1,4 +1,5 @@ FactoryGirl.define do + # TODO: this factory is invalid sometimes, see issue #122 factory :check_in_form do transient do signature_required? { CheckInForm::SHIFT_ACTIONS.include? action }
Add note about factory being invalid sometimes
diff --git a/GoogleMediaFramework.podspec b/GoogleMediaFramework.podspec index abc1234..def5678 100644 --- a/GoogleMediaFramework.podspec +++ b/GoogleMediaFramework.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "GoogleMediaFramework" - s.version = "0.1.2" + s.version = "0.1.3" s.summary = "A simple video player framework and UI. Integrates easily with the Google IMA SDK for including advertising on your videos." s.homepage = "https://github.com/googleads/google-media-framework-ios" s.license = { :type => "Apache License, Version 2.0", :file => "LICENSE" }
Update Cocapods version to 0.1.3
diff --git a/spec/helpers/attributes_spec.rb b/spec/helpers/attributes_spec.rb index abc1234..def5678 100644 --- a/spec/helpers/attributes_spec.rb +++ b/spec/helpers/attributes_spec.rb @@ -1,5 +1,7 @@ require 'spec_helper' +require 'serverspec/helper/base' +include Serverspec::Helper::Base include Serverspec::Helper::Attributes describe 'Attributes Helper' do
Include base command helper to pass tests
diff --git a/app/controllers/api/internal/application_controller.rb b/app/controllers/api/internal/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/internal/application_controller.rb +++ b/app/controllers/api/internal/application_controller.rb @@ -5,6 +5,8 @@ class ApplicationController < ActionController::Base include ControllerCommon include Analyzable + + before_action :switch_languages private
Fix a bug which some text has not changed into correct language.
diff --git a/spec/usi/resource/score_spec.rb b/spec/usi/resource/score_spec.rb index abc1234..def5678 100644 --- a/spec/usi/resource/score_spec.rb +++ b/spec/usi/resource/score_spec.rb @@ -26,4 +26,24 @@ end end end + + describe '#mate' do + let(:score) { USI::Resource::Score.new(args) } + + context '`mate` is included' do + let(:args) { ["mate", "+"] } + + it "returns the mate value" do + expect(score.mate).to eq "+" + end + end + + context '`mate` is not included' do + let(:args) { ["cp", "-1521"] } + + it do + expect(score.mate).to be nil + end + end + end end
Set mate, getter returns String of mate.
diff --git a/spec/cli_spec.rb b/spec/cli_spec.rb index abc1234..def5678 100644 --- a/spec/cli_spec.rb +++ b/spec/cli_spec.rb @@ -3,8 +3,15 @@ require "tempfile" describe CLI do + # Super hacky way of setting a constant without setting off a warnings that the + # constant has already been initialized + def set_argv(*params) + Object.__send__ :remove_const, :ARGV + Object.const_set :ARGV, params + end + it "should fail on an invalid subcommand" do - ARGV = ["invalid"] + set_argv "invalid" lambda { CLI.start }.should raise_error InvalidCommandError end @@ -14,8 +21,8 @@ @dictionary = Tempfile.new(["dict", ".yml"]) @dictionary.write <<-eos - - en: dogs - ja: 犬 + en: dogs + ja: 犬 eos @dictionary.rewind @@ -23,14 +30,17 @@ @english = Tempfile.new(["english", "_en.txt"]) @english.write "I like dogs." @english.rewind + + # Set ARGV + set_argv "translate", @english.path, "into", "japanese", "using", + @dictionary.path end it "should correctly translate English text" do begin - ARGV = ["translate", @english.path, "into", "japanese", "using", @dictionary.path] CLI.start converted_path = Utils.build_converted_file_name(@english.path, "en", "ja") - puts File.read(@english.path).should == "I like dogs." + File.read(@english.path).should == "I like dogs." File.read(converted_path).should == "I like 犬.\n" ensure @dictionary.close! @@ -38,5 +48,9 @@ File.delete converted_path end end + + it "should return the name of the file to translate" do + CLI.start.should == [@english.path] + end end end
Handle warnings from changing ARGV
diff --git a/src/merge_dbs.rb b/src/merge_dbs.rb index abc1234..def5678 100644 --- a/src/merge_dbs.rb +++ b/src/merge_dbs.rb @@ -1,6 +1,15 @@ IO.write( "leak_summary.txt", - Dir.glob("#{ARGV[0]}/*").map do |f| + ARGV.map do |arg| + if File.file?(arg) + arg + elsif File.directory?(arg) + Dir.glob("#{arg}/*") + else + puts "#{arg} not file or directory" + [] + end + end.flatten.map do |f| IO.readlines(f).map do |e| s = e.strip.split puts "Null password in #{f}! Count: #{s[0]}" if s[1].nil?
Make script accept more than one directory or file
diff --git a/lib/oga/xml/node_set.rb b/lib/oga/xml/node_set.rb index abc1234..def5678 100644 --- a/lib/oga/xml/node_set.rb +++ b/lib/oga/xml/node_set.rb @@ -9,8 +9,6 @@ def initialize(nodes = []) @nodes = nodes - - associate_nodes end def each @@ -23,9 +21,12 @@ alias_method :size, :length + def index(node) + return @nodes.index(node) + end + def push(node) node.node_set = self - node.index = node.length @nodes << node end @@ -38,8 +39,8 @@ def remove @nodes.each do |node| - # Remove references to the node from the parent node, if any. - node.parent.children.delete!(node) if node.parent + node.node_set.delete!(node) + node.node_set = nil end end @@ -63,7 +64,6 @@ def associate_nodes @nodes.each_with_index do |node, index| node.node_set = self - node.index = index end end end # NodeSet
Remove explicit index tracking of NodeSet. Instead the various nodes can use NodeSet#index (aka Array#index) instead. This has a slight performance overhead on very large (millions) of nodes but should be fine in most other cases.
diff --git a/lib/scss_lint/engine.rb b/lib/scss_lint/engine.rb index abc1234..def5678 100644 --- a/lib/scss_lint/engine.rb +++ b/lib/scss_lint/engine.rb @@ -4,7 +4,7 @@ class Engine ENGINE_OPTIONS = { cache: false, syntax: :scss } - attr_reader :contents + attr_reader :contents, :tree def initialize(scss_or_filename) if File.exists?(scss_or_filename) @@ -14,10 +14,8 @@ @engine = Sass::Engine.new(scss_or_filename, ENGINE_OPTIONS) @contents = scss_or_filename end - end - def tree - @engine.to_tree + @tree = @engine.to_tree end end end
Build parse tree on Engine initialization `Sass::Engine.to_tree` apparently generates a new parse tree each time. In order to save some processing time, initialize the parse tree only once. Change-Id: Idadd6d6f3653684ced13fde824e1c7c9f45fa703 Reviewed-on: https://gerrit.causes.com/16558 Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com> Tested-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com> Reviewed-by: Greg Hurrell <79e2475f81a6317276bf7cbb3958b20d289b78df@causes.com>
diff --git a/test/controllers/bookmarks_controller_test.rb b/test/controllers/bookmarks_controller_test.rb index abc1234..def5678 100644 --- a/test/controllers/bookmarks_controller_test.rb +++ b/test/controllers/bookmarks_controller_test.rb @@ -1,7 +1,15 @@ require 'test_helper' class BookmarksControllerTest < ActionController::TestCase - # test "the truth" do - # assert true - # end + test "return ok status if bookmark is created" do + post :create, bookmark: { title: "Tuts+", url: "http://tutsplus.com" } + + assert_response 201 + end + + test "returns not ok status if bookmark is not created" do + post :create, bookmark: {} + + assert_response 422 + end end
Write test for bookmarks controller - create action.
diff --git a/core/app/models/evidence_deletable.rb b/core/app/models/evidence_deletable.rb index abc1234..def5678 100644 --- a/core/app/models/evidence_deletable.rb +++ b/core/app/models/evidence_deletable.rb @@ -14,7 +14,7 @@ private def people_believes_ids - @people_believes_ids ||= believable.people_believes.ids + @people_believes_ids ||= believable.opiniated(:believes).ids end def has_no_believers
Use opiniated(:believes) instead of people_believes
diff --git a/src/app/controllers/admin/realm_mappings_controller.rb b/src/app/controllers/admin/realm_mappings_controller.rb index abc1234..def5678 100644 --- a/src/app/controllers/admin/realm_mappings_controller.rb +++ b/src/app/controllers/admin/realm_mappings_controller.rb @@ -22,9 +22,14 @@ def multi_destroy require_privilege(Privilege::MODIFY, Realm) - # TODO: add permissions checks - destroyed = RealmBackendTarget.destroy(params[:id]) - redirect_to admin_realm_path(destroyed.first.frontend_realm_id, :details_tab => 'mapping') + if params[:id].blank? + flash[:error] = 'You must select at least one mapping to delete.' + redirect_to admin_realm_path(params[:frontend_realm_id], :details_tab => 'mapping') + else + # TODO: add permissions checks + destroyed = RealmBackendTarget.destroy(params[:id]) + redirect_to admin_realm_path(destroyed.first.frontend_realm_id, :details_tab => 'mapping') + end end protected
Check if realm mapping is selected
diff --git a/spec/levenshtein_spec.rb b/spec/levenshtein_spec.rb index abc1234..def5678 100644 --- a/spec/levenshtein_spec.rb +++ b/spec/levenshtein_spec.rb @@ -1,22 +1,20 @@ require 'spec_helper' describe Levenshtein do - before(:each) do - @fixtures = [ - ["hello", "hello", 0], - ["hello", "helo", 1], - ["hello", "jello", 1], - ["hello", "helol", 1], - ["hello", "hellol", 1], - ["hello", "heloll", 2], - ["hello", "cheese", 4], - ["hello", "saint", 5], - ["hello", "", 5], - ] - end + fixtures = [ + ["hello", "hello", 0], + ["hello", "helo", 1], + ["hello", "jello", 1], + ["hello", "helol", 1], + ["hello", "hellol", 1], + ["hello", "heloll", 2], + ["hello", "cheese", 4], + ["hello", "saint", 5], + ["hello", "", 5], + ] - it "should calculate correct distances" do - @fixtures.each do |w1, w2, d| + fixtures.each do |w1, w2, d| + it "should calculate a distance of #{d} between #{w1} and #{w2}" do Levenshtein.distance(w1, w2).should == d Levenshtein.distance(w2, w1).should == d end
Update each spec to be self-contained.
diff --git a/lib/ost.rb b/lib/ost.rb index abc1234..def5678 100644 --- a/lib/ost.rb +++ b/lib/ost.rb @@ -59,7 +59,7 @@ end def self.redis - @redis ||= Redis.new + @redis ||= Redis.connect end def self.redis=(redis)
Change default Redis.new to Redis.connect.
diff --git a/lib/faye-rails/routing_hooks.rb b/lib/faye-rails/routing_hooks.rb index abc1234..def5678 100644 --- a/lib/faye-rails/routing_hooks.rb +++ b/lib/faye-rails/routing_hooks.rb @@ -8,7 +8,8 @@ defaults = { :mount => mount_path||'/faye', :timeout => 25, - :engine => nil + :engine => nil, + :server => 'thin' } unknown_options = options.keys - defaults.keys @@ -19,6 +20,8 @@ end options = defaults.merge(options) + + Faye::WebSocket.load_adapter(options.delete(:server)) adapter = FayeRails::RackAdapter.new(options) adapter.instance_eval(&block) if block.respond_to? :call
Fix issue with new version of faye
diff --git a/lib/kenny_g/games/game_setup.rb b/lib/kenny_g/games/game_setup.rb index abc1234..def5678 100644 --- a/lib/kenny_g/games/game_setup.rb +++ b/lib/kenny_g/games/game_setup.rb @@ -17,6 +17,7 @@ def play_game game_factory.new(game_setup: self) end + alias_method :start_game, :play_game private attr_reader :game_factory,
Add same convenience methods on instance as kenny g class
diff --git a/lib/mios/services/ha_device1.rb b/lib/mios/services/ha_device1.rb index abc1234..def5678 100644 --- a/lib/mios/services/ha_device1.rb +++ b/lib/mios/services/ha_device1.rb @@ -5,13 +5,25 @@ base.instance_variable_set("@hadevice1_urn", "urn:micasaverde-com:serviceId:HaDevice1") end - def battery_level - integer_for(@hadevice1_urn, "BatteryLevel") + def auto_configure + boolean_for(@hadevice1_urn, "AutoConfigure") end def battery_date timestamp_for(@hadevice1_urn, "BatteryDate") end + + def battery_level + integer_for(@hadevice1_urn, "BatteryLevel") + end + + def first_configured + timestamp_for(@hadevice1_urn, "FirstConfigured") + end + + def last_update + timestamp_for(@hadevice1_urn, "LastUpdate") + end end end end
Add some additional methods to HaDevice
diff --git a/lib/mocha/adapters/test_unit.rb b/lib/mocha/adapters/test_unit.rb index abc1234..def5678 100644 --- a/lib/mocha/adapters/test_unit.rb +++ b/lib/mocha/adapters/test_unit.rb @@ -1,6 +1,5 @@ require 'mocha_standalone' require 'mocha/expectation_error' -require 'test/unit/assertionfailederror' test_unit_version = begin load 'test/unit/version.rb' @@ -29,10 +28,17 @@ include Mocha::API + def handle_mocha_expectation_error(e) + return false unless e.is_a?(Mocha::ExpectationError) + problem_occurred + add_failure(e.message, e.backtrace) + true + end + def self.included(mod) - Mocha::ExpectationErrorFactory.exception_class = Test::Unit::AssertionFailedError + mod.setup :mocha_setup - mod.setup :mocha_setup + mod.exception_handler(:handle_mocha_expectation_error) mod.cleanup do assertion_counter = AssertionCounter.new(self)
Use a custom exception handler in the new Test::Unit adapter. * It turns out that Test::Unit::AssertionFailedError is derived from StandardError; whereas MiniTest::Assertion is derived from Exception. * I had been telling Mocha::ExpectationErrorFactory to use Test::Unit::AssertionFailedError in the Test::Unit adapter, but since this inherits from StandardError, this would mean a regression on #15. * So instead I've introduced a custom exception handler in the new Test::Unit adapter to rescue Mocha::ExpectationError as if it were a Test::Unit::AssertionFailedError, even though the former is derived from Exception. * Unfortunately I have had to call some private methods in Test::Unit from within the exception handler method. I'm going to ask the Test::Unit developers whether there is an alternative to doing this.
diff --git a/lib/protobuf/message/encoder.rb b/lib/protobuf/message/encoder.rb index abc1234..def5678 100644 --- a/lib/protobuf/message/encoder.rb +++ b/lib/protobuf/message/encoder.rb @@ -0,0 +1,49 @@+module Protobuf + class Message + module Encoder + + def self.encode(stream, message) + message.each_field_for_serialization do |field, value| + encode_field(field, value, stream) + end + + stream + end + + private + + def self.encode_field(field, value, stream) + if field.repeated? + encode_repeated_field(field, value, stream) + else + write_pair(stream, field, value) + end + end + + def self.encode_packed_field(field, value, stream) + key = (field.tag << 3) | ::Protobuf::WireType::LENGTH_DELIMITED + packed_value = value.map { |val| field.encode(val) }.join + stream << ::Protobuf::Field::VarintField.encode(key) + stream << ::Protobuf::Field::VarintField.encode(packed_value.size) + stream << packed_value + end + + def self.encode_repeated_field(field, value, stream) + if field.packed? + encode_packed_field(field, value, stream) + else + value.each { |val| write_pair(stream, field, val) } + end + end + + # Encode key and value, and write to +stream+. + def self.write_pair(stream, field, value) + key = (field.tag << 3) | field.wire_type + stream << ::Protobuf::Field::VarintField.encode(key) + stream << field.encode(value) + end + + end + end +end +
Make an Encoder module patterned after the Decoder, extract encoding logic from Message instance
diff --git a/lib/rpub/compilation_helpers.rb b/lib/rpub/compilation_helpers.rb index abc1234..def5678 100644 --- a/lib/rpub/compilation_helpers.rb +++ b/lib/rpub/compilation_helpers.rb @@ -11,19 +11,11 @@ end def layout - @layout ||= if File.exist?('layout.html') - 'layout.html' - else - Rpub.support_file('layout.html') - end + @layout ||= own_or_support_file('layout.html') end def styles - @styles ||= if File.exists?('styles.css') - 'styles.css' - else - Rpub.support_file('styles.css') - end + @styles ||= own_or_support_file('styles.css') end def config @@ -32,5 +24,15 @@ YAML.load_file('config.yml') end end + + private + + def own_or_support_file(filename) + if File.exists?(filename) + filename + else + Rpub.support_file(filename) + end + end end end
Refactor defaulting to support files for style and layout
diff --git a/lib/spontaneous/cli/generate.rb b/lib/spontaneous/cli/generate.rb index abc1234..def5678 100644 --- a/lib/spontaneous/cli/generate.rb +++ b/lib/spontaneous/cli/generate.rb @@ -32,6 +32,8 @@ end end + protected + def generate_site(args) ::Spontaneous::Generators::Site.start(args.drop_while { |e| %w(generate site).include?(e) }) end
Remove warning about task creation without matching desc
diff --git a/app/serializers/api/admin/subscription_customer_serializer.rb b/app/serializers/api/admin/subscription_customer_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/api/admin/subscription_customer_serializer.rb +++ b/app/serializers/api/admin/subscription_customer_serializer.rb @@ -1,5 +1,3 @@-require 'spec_helper' - module Api module Admin # Used by admin subscription form
Revert accidental copy and paste
diff --git a/video_merger.rb b/video_merger.rb index abc1234..def5678 100644 --- a/video_merger.rb +++ b/video_merger.rb @@ -5,7 +5,7 @@ DRY_RUN = false class VideoMerger - def merge + def self.merge files = find_files_to_merge input_list = create_input_list(files) do_merge(input_list) unless DRY_RUN @@ -13,7 +13,7 @@ end private - def create_input_list(files) + def self.create_input_list(files) list_path = File.join(Dir.pwd, "input.list") File.open(list_path, "w") do |list| files.each do |file| @@ -23,19 +23,19 @@ list_path end - def find_files_to_merge + def self.find_files_to_merge glob_pattern = File.join(Dir.pwd, "*#{VIDEO_EXTENSION}") files = Dir.glob(glob_pattern) files.sort_by{|file| File.mtime(file)} end - def do_merge(input_list) + def self.do_merge(input_list) output_path = File.join(Dir.pwd, OUTPUT_NAME) command = "ffmpeg -safe 0 -f concat -i '#{input_list}' -c copy '#{output_path}'" Kernel.system(command) end - def do_cleanup(input_list) + def self.do_cleanup(input_list) File.delete(input_list) end end @@ -43,7 +43,7 @@ # Entrypoint if __FILE__ == $0 if ENV['STY'] # if running in a screen session - VideoMerger.new.merge + VideoMerger.merge else puts "It is recommended that you run this script within a screen session." end
Convert from instance to class methods
diff --git a/lib/capistrano/tasks/migrate.rake b/lib/capistrano/tasks/migrate.rake index abc1234..def5678 100644 --- a/lib/capistrano/tasks/migrate.rake +++ b/lib/capistrano/tasks/migrate.rake @@ -8,7 +8,7 @@ task :status do set :process, ask('What process do you want to restart ?', nil) - on roles(:web) do + run_locally do execute "#{fetch(:current_path)}vendor/bin/phpmig status -b #{fetch(:current_path)}phpmig-#{fetch(:app_environment)}.php" end end
Update path fot phpmig files
diff --git a/app/controllers/pages/assets_controller.rb b/app/controllers/pages/assets_controller.rb index abc1234..def5678 100644 --- a/app/controllers/pages/assets_controller.rb +++ b/app/controllers/pages/assets_controller.rb @@ -13,7 +13,8 @@ def show @page = Page.find(params[:page_id]) metric = AssetsMetrics.new page_id: @page.id, time_key: params[:id] - render json: metric.read_har + result = "onInputData (" + metric.read_har.to_s + ");" + render json: result end def get_assets(page, start_date, end_date) @@ -21,5 +22,5 @@ select_value += ", html_bytes, js_bytes, css_bytes, image_bytes, font_bytes, other_bytes" data = AssetsMetrics.select(select_value).by_page(page.id).where(time: start_date..end_date) data.to_a - end -end+ end +end
Fix : generate jsonp for har reader
diff --git a/spec/features/top_spec.rb b/spec/features/top_spec.rb index abc1234..def5678 100644 --- a/spec/features/top_spec.rb +++ b/spec/features/top_spec.rb @@ -5,7 +5,7 @@ scenario "Each section should exist" do visit "/" expect(page).to have_title 'CoderDojo Japan' - expect(page).to have_text '全国の道場' + expect(page).to have_text '日本各地の道場' expect(page).to have_css 'section.partners_logo a[href]' expect(page).to have_text '問い合わせ' expect(page).to have_text '一般社団法人'
Fix spec to test wording in Top
diff --git a/config.ru b/config.ru index abc1234..def5678 100644 --- a/config.ru +++ b/config.ru @@ -1,13 +1,12 @@ require "#{File.dirname(__FILE__)}/lib/dolphy" app = DolphyApplication.app do - puts "Inside run DolphyApplication whatever" get '/hello' do haml :index, :body => "hello" end get '/wat' do - haml :index, :body => "WAT" + erb :what, :body => "WAT" end end
Add one more route using ERB to the app.
diff --git a/spec/view_helpers_spec.rb b/spec/view_helpers_spec.rb index abc1234..def5678 100644 --- a/spec/view_helpers_spec.rb +++ b/spec/view_helpers_spec.rb @@ -6,9 +6,16 @@ describe RailsBootstrapAlerts::ViewHelpers do describe '#flash_class' do - it 'Returns a translated class name' do - class_name = ViewHelpersTester.flash_class('notice') - expect(class_name).to eq('alert alert-info') + context 'With recognized flash message names' do + before do + @alert_names = ['notice', 'success', 'error', 'alert'] + end + it 'Returns a class name' do + @alert_names.each do |alert_name| + class_name = ViewHelpersTester.flash_class(alert_name) + expect(class_name.length).to be > 1 + end + end end context 'With unrecognized flash message name' do it 'returns an empty string' do
Test for supported flash message names
diff --git a/core/lib/spree/testing_support/dummy_app/migrations.rb b/core/lib/spree/testing_support/dummy_app/migrations.rb index abc1234..def5678 100644 --- a/core/lib/spree/testing_support/dummy_app/migrations.rb +++ b/core/lib/spree/testing_support/dummy_app/migrations.rb @@ -15,12 +15,8 @@ def needs_migration? return true if !database_exists? - if ActiveRecord::Base.connection.respond_to?(:migration_context) - # Rails >= 5.2 - ActiveRecord::Base.connection.migration_context.needs_migration? - else - ActiveRecord::Migrator.needs_migration? - end + + ActiveRecord::Base.connection.migration_context.needs_migration? end def auto_migrate
Remove DummyApp migration code that targets Rails < 5.2
diff --git a/app/workers/telegram_live_sender_worker.rb b/app/workers/telegram_live_sender_worker.rb index abc1234..def5678 100644 --- a/app/workers/telegram_live_sender_worker.rb +++ b/app/workers/telegram_live_sender_worker.rb @@ -23,7 +23,7 @@ keyboard = Telegram::Bot::Types::InlineKeyboardMarkup.new( inline_keyboard: [ [ - Telegram::Bot::Types::InlineKeyboardButton.new(text: 'Описание', + Telegram::Bot::Types::InlineKeyboardButton.new(text: I18n.t('label_preview'), callback_data: { type: 'issue_preview', issue_id: issue_id }.to_json) ] ]
Add I18n for preview label
diff --git a/db/migrate/20091007170153_add_downloads_to_versions.rb b/db/migrate/20091007170153_add_downloads_to_versions.rb index abc1234..def5678 100644 --- a/db/migrate/20091007170153_add_downloads_to_versions.rb +++ b/db/migrate/20091007170153_add_downloads_to_versions.rb @@ -4,6 +4,6 @@ end def self.down - remove_column :versions, :downloads_count, :integer + remove_column :versions, :downloads_count end end
Fix remove_column where a column type was given
diff --git a/lib/param_validator/controller.rb b/lib/param_validator/controller.rb index abc1234..def5678 100644 --- a/lib/param_validator/controller.rb +++ b/lib/param_validator/controller.rb @@ -14,7 +14,7 @@ end def validate_parameters - klass_name = [self.class.name.gsub( /Controller/, '' ), "#{action_name.titlecase}ParamValidator"].join( '::' ) + klass_name = [self.class.name.gsub( /Controller/, '' ), "#{action_name.camelize}ParamValidator"].join( '::' ) klass = klass_name.constantize validator = klass.new( params ) unless validator.valid?
Fix action name translation issue
diff --git a/XTInfiniteScrollView.podspec b/XTInfiniteScrollView.podspec index abc1234..def5678 100644 --- a/XTInfiniteScrollView.podspec +++ b/XTInfiniteScrollView.podspec @@ -0,0 +1,28 @@+# +# Be sure to run `pod spec lint XTInfiniteScrollView.podspec' to ensure this is a +# valid spec and to remove all comments including this before submitting the spec. +# +# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html +# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ +# + +Pod::Spec.new do |s| + s.name = "XTInfiniteScrollView" + s.version = "1.0.1" + s.summary = "An elegant infinite scroll view for ad banner." + + s.description = <<-DESC + Data source is very similar to UITableViewDataSource. Implement protocols in XTInfiniteScrollViewDataSource. + DESC + s.homepage = "https://github.com/wuwen1030/XTInfiniteScrollView" + s.license = { :type => "MIT" } + s.author = { "XiaBin" => "xiabin@tuniu.com" } + s.platform = :ios + s.source = { :git => "https://github.com/wuwen1030/XTInfiniteScrollView.git", :tag => s.version.to_s } + s.source_files = "XTInfiniteScrollView/XTInfiniteScrollView/*.{h,m}" + s.requires_arc = true + + s.ios.deployment_target = "6.0" + + s.dependency "AFNetworking" +end
Add a pod spec file
diff --git a/project.rb b/project.rb index abc1234..def5678 100644 --- a/project.rb +++ b/project.rb @@ -0,0 +1,63 @@+def fibs(num) + curr = 0 + next_num = 1 + temp = 0 + while (num -= 1) > 0 do + temp = curr + next_num + curr = next_num + next_num = temp + end + return next_num +end + +def fibs_rec(num) + if num < 2 then + return num + else + return fibs_rec(num - 1) + fibs_rec(num - 2) + end +end + +def merge(left, right) + result = [] + while left.size > 0 and right.size > 0 + if left[0] <= right[0] + result << left[0] + left = left[1..-1] + else + result << right[0] + right = right[1..-1] + end + end + if left.size > 0 + result.concat left + end + if right.size > 0 + result.concat right + end + return result +end + +def merge_sort(arr) + left, right, result = [] + + if arr.size <= 1 + return arr + else + middle = arr.size / 2 + left = arr[0..middle - 1] + right = arr[middle..-1] + left = merge_sort(left) + right = merge_sort(right) + if left.last <= right[0] + left.concat right + return left + end + result = merge(left, right) + return result + end +end + +arr = [3, 1, 5, 2] +puts arr +puts merge_sort(arr)
Add solutions for fibonacci seq (iter and rec) and mergesort
diff --git a/soft_service.gemspec b/soft_service.gemspec index abc1234..def5678 100644 --- a/soft_service.gemspec +++ b/soft_service.gemspec @@ -5,8 +5,8 @@ Gem::Specification.new do |gem| gem.name = "soft_service" gem.version = SoftService::VERSION - gem.summary = %q{TODO: Summary} - gem.description = %q{TODO: Description} + gem.summary = %q{Mixins for service objects.} + gem.description = %q{A pattern for service object interfaces.} gem.license = "MIT" gem.authors = ["Don Morrison"] gem.email = "don@elskwid.net"
Update gemspec to avoid bundler whining about missing desc and summary
diff --git a/docs/examples/aws_vpc.rb b/docs/examples/aws_vpc.rb index abc1234..def5678 100644 --- a/docs/examples/aws_vpc.rb +++ b/docs/examples/aws_vpc.rb @@ -6,7 +6,7 @@ cidr_block "10.0.1.0/24" end - subnet "provisioning-vpc-subnet-a" do + aws_subnet "provisioning-vpc-subnet-a" do cidr_block "10.0.1.0/26" vpc "provisioning-vpc" availability_zone "eu-west-1a"
Fix VPC example to use aws_subnet
diff --git a/spec/fetcher_spec.rb b/spec/fetcher_spec.rb index abc1234..def5678 100644 --- a/spec/fetcher_spec.rb +++ b/spec/fetcher_spec.rb @@ -16,17 +16,19 @@ expect(f.etag).to be_a String end - it 'can honor a 304 Not Modified response' do + it 'can send If-Modified-Since and honor a 304 Not Modified response' do f = RSSCache::Fetcher.new url: last_modified_feed_url 2.times { f.fetch } expect(FakeWeb.last_request['If-Modified-Since']).to eq @mock_last_modified expect(f.status).to eq 304 + expect(f.content).to be_a String end - it 'can honor a 304 Not Modified response' do + it 'can send If-None-Match and honor a 304 Not Modified response' do f = RSSCache::Fetcher.new url: etag_feed_url 2.times { f.fetch } expect(FakeWeb.last_request['If-None-Match']).to eq @mock_etag expect(f.status).to eq 304 + expect(f.content).to be_a String end end
Clarify Fetcher spec and check Fetcher content
diff --git a/lib/carto/mapcapped_visualization_updater.rb b/lib/carto/mapcapped_visualization_updater.rb index abc1234..def5678 100644 --- a/lib/carto/mapcapped_visualization_updater.rb +++ b/lib/carto/mapcapped_visualization_updater.rb @@ -31,7 +31,7 @@ def export_in_memory_visualization(visualization, user) { version: CURRENT_VERSION, - visualization: export(visualization, user) + visualization: export(visualization, user, with_mapcaps: false) } end end
Fix MapcappedVisualizationUpdater, ignore mapcaps in export
diff --git a/lib/padrino-pipeline/tasks/pipeline_tasks.rb b/lib/padrino-pipeline/tasks/pipeline_tasks.rb index abc1234..def5678 100644 --- a/lib/padrino-pipeline/tasks/pipeline_tasks.rb +++ b/lib/padrino-pipeline/tasks/pipeline_tasks.rb @@ -9,6 +9,12 @@ app.pipeline.send(method, *args) if app.pipeline? end end + + desc "Compile all assets" + tast :compile => [:compile_js, :compile_css] + + desc "Clean all assets" + tast :clean => [:clean_js, :clean_css] desc "Compile javascript assets" task :compile_js do
Add generic compile and clean tasks
diff --git a/app/services/spree_shopify_importer/connections/base.rb b/app/services/spree_shopify_importer/connections/base.rb index abc1234..def5678 100644 --- a/app/services/spree_shopify_importer/connections/base.rb +++ b/app/services/spree_shopify_importer/connections/base.rb @@ -21,8 +21,8 @@ opts = { page: 1 }.merge(opts) loop do batch = api_class.find(:all, params: opts) + break if batch.blank? yield batch - break if batch.blank? opts[:page] += 1 end end
Break pagination loop if result is empty Haven't really tested this, just spotted it as I came here to grab the ShopifyAPI pagination code. :)
diff --git a/Casks/dropbox.rb b/Casks/dropbox.rb index abc1234..def5678 100644 --- a/Casks/dropbox.rb +++ b/Casks/dropbox.rb @@ -1,6 +1,7 @@ class Dropbox < Cask - url 'https://d1ilhw0800yew8.cloudfront.net/client/Dropbox%202.0.6.dmg' + url 'https://d1ilhw0800yew8.cloudfront.net/client/Dropbox%202.0.10.dmg' homepage 'http://www.dropbox.com/' - version '2.0.6' - sha1 '28bec064ddbd3321266cb734dc275eeb6bc12f52' + version '2.0.10' + sha1 '75c77b3361d78683fc4bd456922e20ae84d95b60' + link :app, 'Dropbox.app' end
Update Dropbox cask to 2.0.10
diff --git a/Casks/modmove.rb b/Casks/modmove.rb index abc1234..def5678 100644 --- a/Casks/modmove.rb +++ b/Casks/modmove.rb @@ -0,0 +1,14 @@+cask :v1 => 'modmove' do + version '1.0.0' + sha256 '1d0cc13c38a4f76ae4f3a5d24c31553d4607c2d180ec1cdc93b43ee8787fe679' + + url "https://github.com/keith/modmove/releases/download/#{version}/ModMove.app.zip" + appcast 'https://github.com/keith/modmove/releases.atom' + name 'ModMove' + homepage 'https://github.com/keith/modmove' + license :mit + + app 'ModMove.app' + + accessibility_access true +end
Add initial version of ModMove https://github.com/keith/ModMove/
diff --git a/Casks/tagoman.rb b/Casks/tagoman.rb index abc1234..def5678 100644 --- a/Casks/tagoman.rb +++ b/Casks/tagoman.rb @@ -7,7 +7,7 @@ name 'TagoMan' appcast 'https://onflapp.appspot.com/tagoman', :sha256 => 'b6e866d06fe73d9d2915e04cde5cb0270b452382b9cd9d0c7fc65d5735c15443' - homepage 'http://onflapp.wordpress.com/tagoman' + homepage 'https://onflapp.wordpress.com/tagoman/' license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder app 'TagoMan.app'
Fix homepage to use SSL in TagoMan 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/Casks/torpedo.rb b/Casks/torpedo.rb index abc1234..def5678 100644 --- a/Casks/torpedo.rb +++ b/Casks/torpedo.rb @@ -1,7 +1,7 @@ class Torpedo < Cask - url 'http://usetorpedo.com/downloads/mac/Torpedo-1.2.2.app.zip' + url 'http://usetorpedo.com/app/mac/download' homepage 'https://usetorpedo.com' - version '1.2.2' - sha256 '72f0a027ea525755e07e43d90464aa00f1c45167b30d333272017f64e0496dcf' + version 'latest' + no_checksum link 'Torpedo.app' end
Change to latest version of Torpedo. Update to HTTP instead of HTTPS.
diff --git a/app/models/blood_drive.rb b/app/models/blood_drive.rb index abc1234..def5678 100644 --- a/app/models/blood_drive.rb +++ b/app/models/blood_drive.rb @@ -6,4 +6,6 @@ field :location, type: String field :date, type: DateTime field :description, type: String + + validates_presence_of :location, :date, :description end
Add validation to blood drives
diff --git a/spec/controllers/events_controller_spec.rb b/spec/controllers/events_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/events_controller_spec.rb +++ b/spec/controllers/events_controller_spec.rb @@ -5,9 +5,9 @@ describe "#index" do context "events page" do it "lists the events, ordered by start asc in UTC" do - event1 = FactoryBot.create(:event) event2 = FactoryBot.create(:event, start: Time.now - 3.months, finish: Time.now - 3.months + 180, error: nil, success: true) event3 = FactoryBot.create(:event, start: Time.now - 2.months, finish: Time.now - 2.months + 180, error: nil, success: true) + event1 = FactoryBot.create(:event) event4 = FactoryBot.create(:event, start: Time.now - 1.month, finish: Time.now - 1.month + 180, error: nil, success: true) get :index expect(assigns(:events)).to eq([event2, event3, event4, event1])
Change the order of the event creation to satisfy the needs of the failing Event.all code
diff --git a/spec/controllers/groups_controller_spec.rb b/spec/controllers/groups_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/groups_controller_spec.rb +++ b/spec/controllers/groups_controller_spec.rb @@ -0,0 +1,21 @@+require 'spec_helper' + +describe GroupsController do + + let(:group) { Fabricate(:group) } + + describe 'when one exists' do + render_views + + before(:each) do + @request.host = "#{group.slug}.#{@request.host}" + end + + it 'should be available from subdomain' do + get('show') + response.should be_success + response.body.should match(group.title) + end + end + +end
Add basic group controller specs.
diff --git a/spec/integration/command/aggregate_spec.rb b/spec/integration/command/aggregate_spec.rb index abc1234..def5678 100644 --- a/spec/integration/command/aggregate_spec.rb +++ b/spec/integration/command/aggregate_spec.rb @@ -0,0 +1,52 @@+# encoding: utf-8 + +require 'spec_helper' + +ENV['ADAPTER'] = 'cassandra' + +describe 'aggregate support' do + before :all do + setup_keyspace + adapter.execute(""" + CREATE TABLE heffalumps ( + user varint, + type varint, + time timestamp, + PRIMARY KEY (user, type, time) + ) + """) + end + + let(:model) do + Class.new { + include DataMapper::Resource + property :user, Integer, key: true + property :type, Integer, key: true + property :time, DateTime, key: true + # This is needed for DataMapper.finalize + def self.name() 'Heffalump' end + }.tap { DataMapper.finalize } + end + + subject { described_class } + + describe '#count' do + before :all do + model.count.should eq 0 + model.create(user: 1, type: 1, time: Time.now) + model.create(user: 1, type: 2, time: Time.now) + model.create(user: 2, type: 1, time: Time.now) + end + + it 'returns the number of rows' do + model.count.should eq 3 + end + + describe 'with conditions' do + it 'returns the number of matching rows' do + model.all(user: 1).count.should eq 2 + model.all(user: 1, type: 2).count.should eq 1 + end + end + end +end
Add integration test for aggregate command
diff --git a/spec/unit/lib/itamae/resource/link_spec.rb b/spec/unit/lib/itamae/resource/link_spec.rb index abc1234..def5678 100644 --- a/spec/unit/lib/itamae/resource/link_spec.rb +++ b/spec/unit/lib/itamae/resource/link_spec.rb @@ -0,0 +1,24 @@+require 'itamae' + +module Itamae + describe Resource::Link do + let(:recipe) { double(:recipe) } + + subject(:resource) do + described_class.new(recipe, "name") do + to "/path/to/target" + end + end + + describe "#create_action" do + it "runs install command of specinfra" do + subject.link :link_name + expect(subject).to receive(:run_specinfra).with(:check_file_is_linked_to, :link_name, "/path/to/target").and_return(false) + expect(subject).to receive(:run_specinfra).with(:link_file_to, :link_name, "/path/to/target") + subject.create_action + end + end + end +end + +
Add unit test for link resource
diff --git a/relationize.gemspec b/relationize.gemspec index abc1234..def5678 100644 --- a/relationize.gemspec +++ b/relationize.gemspec @@ -21,5 +21,4 @@ spec.add_development_dependency "bundler", "~> 1.11" spec.add_development_dependency "rake", "~> 10.0" - spec.add_development_dependency "minitest", "~> 5.0" end
Remove useless gem from gemspec
diff --git a/spec/dummy/shared/persistence.rb b/spec/dummy/shared/persistence.rb index abc1234..def5678 100644 --- a/spec/dummy/shared/persistence.rb +++ b/spec/dummy/shared/persistence.rb @@ -1,5 +1,5 @@ module Persistence - class Container < Dry::Component::Container + class Container < Dry::System::Container configure do |config| config.root = Pathname(__dir__).join('persistence') config.name = :persistence
Fix Component=>System in dummy app
diff --git a/spec/features/press_page_spec.rb b/spec/features/press_page_spec.rb index abc1234..def5678 100644 --- a/spec/features/press_page_spec.rb +++ b/spec/features/press_page_spec.rb @@ -21,7 +21,7 @@ expect(title).to eq article.title expect(source).to include article.company - expect(source).to include article.published_date.strftime('%Y-%m-%e'); + expect(source).to include article.published_date.strftime('%Y-%m-%d'); expect(description).to include article.description end end
Correct strftime for press page spec
diff --git a/spec/helpers/tree_helper_spec.rb b/spec/helpers/tree_helper_spec.rb index abc1234..def5678 100644 --- a/spec/helpers/tree_helper_spec.rb +++ b/spec/helpers/tree_helper_spec.rb @@ -5,7 +5,8 @@ let(:project) { create(:project) } before do - @repository = project.repository @commit = project.commit("e56497bb") + @repository = project.repository + @commit = project.commit("e56497bb") end context "on a directory containing more than one file/directory" do
Fix bad multi-line split from previous commit
diff --git a/spec/matchers/dictionary_spec.rb b/spec/matchers/dictionary_spec.rb index abc1234..def5678 100644 --- a/spec/matchers/dictionary_spec.rb +++ b/spec/matchers/dictionary_spec.rb @@ -1,19 +1,30 @@-require 'spec_helper' +# frozen_string_literal: true + +require "spec_helper" describe Zxcvbn::Matchers::Dictionary do - let(:matcher) { described_class.new('english', dictionary) } - let(:dictionary) { Zxcvbn::Data.new.ranked_dictionaries['english'] } + subject(:matcher) { described_class.new("Test dictionary", dictionary) } - it 'finds all the matches' do - matches = matcher.matches('whatisinit') - expect(matches.count).to eq(14) - expected_matches = ['wha', 'what', 'ha', 'hat', 'a', 'at', 'tis', 'i', 'is', - 'sin', 'i', 'in', 'i', 'it'] - expect(matches.map(&:matched_word)).to eq(expected_matches) + describe "#matches" do + let(:matches) { matcher.matches(password) } + let(:matched_words) { matches.map(&:matched_word) } + + context "Given a dictionary of English words" do + let(:dictionary) { Zxcvbn::Data.new.ranked_dictionaries["english"] } + let(:password) { "whatisinit" } + + it "finds all the matches" do + expect(matched_words).to match_array %w[wha what ha hat a at tis i is sin i in i it] + end + end + + context "Given a custom dictionary" do + let(:dictionary) { Zxcvbn::DictionaryRanker.rank_dictionary(%w[test AB10CD]) } + let(:password) { "AB10CD" } + + it "matches uppercase passwords with normalised dictionary entries" do + expect(matched_words).to match_array(%w[ab10cd]) + end + end end - - it 'matches uppercase' do - matcher = described_class.new('user_inputs', Zxcvbn::DictionaryRanker.rank_dictionary(['test','AB10CD'])) - expect(matcher.matches('AB10CD')).not_to be_empty - end -end+end
Refactor dictionary spec to gain an understanding
diff --git a/csg.gemspec b/csg.gemspec index abc1234..def5678 100644 --- a/csg.gemspec +++ b/csg.gemspec @@ -5,7 +5,7 @@ s.description = s.summary s.authors = ["Yaroslav Shirokov", "Sean Bryant"] s.email = ['sshirokov@github.com', 'sbryant@github.com'] - s.files = ["lib/csg.rb"] + Dir['src/**/*.c'] + s.files = ["Makefile", "lib/csg.rb"] + Dir['src/**/*.{c,h}'] s.homepage = 'https://github.com/sshirokov/csgtool/' s.add_runtime_dependency 'ffi' end
Include the Makefile as part of the gem.
diff --git a/benchmarks/memory_usage.rb b/benchmarks/memory_usage.rb index abc1234..def5678 100644 --- a/benchmarks/memory_usage.rb +++ b/benchmarks/memory_usage.rb @@ -1,4 +1,6 @@-require 'finite_machine' +# frozen_string_literal: true + +require_relative '../lib/finite_machine' 3.times do puts @@ -6,7 +8,7 @@ GC.start gc_before = GC.stat - objects_before = ObjectSpace.count_objects[:T_OBJECT] + objects_before = ObjectSpace.count_objects p objects_before 1_000.times do @@ -18,5 +20,5 @@ p objects_after p "GC count: #{gc_after[:count] - gc_before[:count]}" - p "Objects count: #{}" + p "Objects count: #{objects_after[:T_OBJECT] - objects_before[:T_OBJECT]}" end
Change to show objects count
diff --git a/src/old.rb b/src/old.rb index abc1234..def5678 100644 --- a/src/old.rb +++ b/src/old.rb @@ -3,12 +3,16 @@ require 'optparse' require_relative 'scp-article-loader' require_relative 'roff-builder' +require_relative 'locale' option = { - :locale => "www" + :locale => SITE::EN, + :manpath => "~/.local/share/man" } OptionParser.new do |opt| - opt.on('-l', '--locale=locale') { |locale| option[:locale] = locale } + opt.on('-l', '--locale=locale') do |locale| + option[:locale] = SITE.create(locale) + end opt.parse! ARGV end
Use locale on option parsing
diff --git a/test/slide_hero/list_point_spec.rb b/test/slide_hero/list_point_spec.rb index abc1234..def5678 100644 --- a/test/slide_hero/list_point_spec.rb +++ b/test/slide_hero/list_point_spec.rb @@ -3,9 +3,32 @@ module SlideHero describe ListPoint do it "takes text and an animation on initialization" do - line_point = ListPoint.new("point!", animation: nil) - line_point.text.must_equal "point!" - line_point.animation.must_equal nil + list_point = ListPoint.new("point!", animation: nil) + list_point.text.must_equal "point!" + list_point.animation.must_equal nil + list_point.animation_class.must_equal nil + end + + describe "#animation_class" do + it "applies fragement if animation is true" do + list_point = ListPoint.new("foo", animation: true) + list_point.animation_class.must_equal " class=\"fragment \"" + end + + it "only applies simple animation if value not supported" do + list_point = ListPoint.new("foo", animation: "banana") + list_point.animation_class.must_equal " class=\"fragment \"" + end + + it "applies extra classes for supported animations" do + supported_animations = %w{grow shrink roll-in fade-out + highlight-red highlight-green highlight-blue} + + supported_animations.each do |animation| + list_point = ListPoint.new("foo", animation: animation) + list_point.animation_class.must_equal " class=\"fragment #{animation}\"" + end + end end end end
Add more tests for ListPoint
diff --git a/mike_rowe/db/migrate/20160125220811_create_teachers.rb b/mike_rowe/db/migrate/20160125220811_create_teachers.rb index abc1234..def5678 100644 --- a/mike_rowe/db/migrate/20160125220811_create_teachers.rb +++ b/mike_rowe/db/migrate/20160125220811_create_teachers.rb @@ -4,7 +4,7 @@ t.string :name t.string :email t.string :password_digest - t.boolean :admin + t.boolean :admin, default: false t.timestamps null: false end
Add admin status default false
diff --git a/plugin/hammer.vim/renderers/markdown_renderer.rb b/plugin/hammer.vim/renderers/markdown_renderer.rb index abc1234..def5678 100644 --- a/plugin/hammer.vim/renderers/markdown_renderer.rb +++ b/plugin/hammer.vim/renderers/markdown_renderer.rb @@ -15,7 +15,7 @@ end -markup :redcarpet, /md|mkd|markdown/ do |content| +markup :redcarpet, /md|mkd|markdown|mdwn/ do |content| renderer = Redcarpet::Markdown.new Hammer::MarkdownRenderer.new, :tables => true, :fenced_code_blocks => true,
Add support '.mdwn' as markdown file extension. Closes #33.
diff --git a/rest/rest_server.rb b/rest/rest_server.rb index abc1234..def5678 100644 --- a/rest/rest_server.rb +++ b/rest/rest_server.rb @@ -32,6 +32,12 @@ %({"token": "#{token}"}) end + + get '/api/gateway' do + session! + + 'wss://127.0.0.1:6602' + end end end
Implement the gateway endpoint (even though WS is currently unimplemented)
diff --git a/button_like_a_link.gemspec b/button_like_a_link.gemspec index abc1234..def5678 100644 --- a/button_like_a_link.gemspec +++ b/button_like_a_link.gemspec @@ -1,6 +1,6 @@ # coding: utf-8 lib = File.expand_path('../lib', __FILE__) -# $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'button_like_a_link/version' Gem::Specification.new do |spec|
Revert change to load path
diff --git a/app/controllers/gend_image_pages_controller.rb b/app/controllers/gend_image_pages_controller.rb index abc1234..def5678 100644 --- a/app/controllers/gend_image_pages_controller.rb +++ b/app/controllers/gend_image_pages_controller.rb @@ -12,11 +12,13 @@ @gend_image_url = gend_image_url_for(@gend_image) @meme_text = @gend_image.captions.position_order.map(&:text).join(' ') - # rubocop:disable Style/GuardClause - if @gend_image.work_in_progress? && - (Time.now - @gend_image.created_at < 10) - @refresh_in = 2 - end - # rubocop:enable Style/GuardClause + set_refresh + end + + private + + def set_refresh + return unless @gend_image.work_in_progress? + @refresh_in = 2 if Time.now - @gend_image.created_at < 10 end end
Refactor refresh in gend image pages controller.
diff --git a/thrifty-bunny.gemspec b/thrifty-bunny.gemspec index abc1234..def5678 100644 --- a/thrifty-bunny.gemspec +++ b/thrifty-bunny.gemspec @@ -25,6 +25,6 @@ spec.add_dependency 'thrift' spec.add_dependency 'thin' - spec.add_dependency 'bunny' + spec.add_dependency 'bunny', '~> 1.6.3' spec.add_dependency 'uuidtools' end
Set bunny version to be at least 1.6.3
diff --git a/tdd-fizzbuzz/fizzbuzz.rb b/tdd-fizzbuzz/fizzbuzz.rb index abc1234..def5678 100644 --- a/tdd-fizzbuzz/fizzbuzz.rb +++ b/tdd-fizzbuzz/fizzbuzz.rb @@ -5,14 +5,18 @@ divisible_by_three = (n % 3).zero? divisible_by_five = (n % 5).zero? - if divisible_by_three && divisible_by_five - "FizzBuzz" - elsif divisible_by_three - "Fizz" - elsif divisible_by_five - "Buzz" + s = '' + if divisible_by_three + s << "Fizz" + end + if divisible_by_five + s << "Buzz" + end + + if s.length.zero? + n else - n + s end end end
Build a return string in parts instead of explicitly switching
diff --git a/warmercooler.rb b/warmercooler.rb index abc1234..def5678 100644 --- a/warmercooler.rb +++ b/warmercooler.rb @@ -3,9 +3,9 @@ puts solution # This statement is temporary while I test the game. puts "Guess what number I'm thinking of. It's between 1 and 1000" guess = gets.to_i +puts "Wrong! Guess again!" if guess != solution while guess != solution guesses.push(guess) - puts "Wrong! Guess again!" puts "You've guessed #{guesses}" # Temporary, to be replaced by prompt comparing guesses. guess = gets.to_i end
Remove first guess from while loop
diff --git a/test/test_cfi.rb b/test/test_cfi.rb index abc1234..def5678 100644 --- a/test/test_cfi.rb +++ b/test/test_cfi.rb @@ -1,5 +1,6 @@ require_relative 'helper' require 'epub/cfi' +require 'epub/parser/cfi' class TestCFI < Test::Unit::TestCase def test_escape @@ -9,4 +10,17 @@ def test_unescape assert_equal '^', EPUB::CFI.unescape('^^') end + + def test_compare + assert_compare epubcfi('/6/4[id]'), '<', epubcfi('/6/5') + assert_equal epubcfi('/6/4'), epubcfi('/6/4') + assert_compare epubcfi('/6/4'), '>', epubcfi('/4/6') + assert_compare epubcfi('/6/4!/4@3:7'), '>', epubcfi('/6/4!/4') + end + + private + + def epubcfi(string) + EPUB::Parser::CFI.new.parse('epubcfi(' + string + ')') + end end
Add test cases for CFI sorting rules
diff --git a/padrino_bootstrap_forms.gemspec b/padrino_bootstrap_forms.gemspec index abc1234..def5678 100644 --- a/padrino_bootstrap_forms.gemspec +++ b/padrino_bootstrap_forms.gemspec @@ -14,8 +14,8 @@ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ["lib"] - s.add_dependency "padrino", "~> 0.10.6" - s.add_dependency "activesupport", "~> 3.0" + s.add_dependency "padrino", "~> 0.11" + s.add_dependency "activesupport", ">= 3.0" s.add_development_dependency "rake" s.add_development_dependency "slim" s.add_development_dependency "haml", "~> 3.0"
Fix the gemspec for padrino 0.11.
diff --git a/lib/foreman/logging/stdout_adapter.rb b/lib/foreman/logging/stdout_adapter.rb index abc1234..def5678 100644 --- a/lib/foreman/logging/stdout_adapter.rb +++ b/lib/foreman/logging/stdout_adapter.rb @@ -1,7 +1,7 @@ module Foreman module Logging class StdoutAdapter - attr_reader :multiplexer + attr_reader :logger, :multiplexer def initialize @logger = ::Logger.new(STDOUT)
Add attr_reader :logger on StdoutAdapter