diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -2,7 +2,7 @@ maintainer 'Aetrion, LLC DBA DNSimple' maintainer_email 'ops@dnsimple.com' license 'Apache 2.0' -description 'Installs/Configures pdns' +description 'Installs/Configures PowerDNS Recursor and Authoritative server' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '2.4.1' source_url 'https://github.com/dnsimple/pdns' if respond_to?(:source_url)
Update description with something less terse
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -1,7 +1,7 @@ name 'omnibus' maintainer 'Chef Software, Inc.' maintainer_email 'releng@chef.io' -license 'Apache 2.0' +license 'Apache-2.0' description 'Prepares a machine to be an Omnibus builder.' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '5.1.7'
Use SPDX standard license string Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/databasedotcom.gemspec b/databasedotcom.gemspec index abc1234..def5678 100644 --- a/databasedotcom.gemspec +++ b/databasedotcom.gemspec @@ -24,4 +24,10 @@ s.add_development_dependency 'rspec', '~> 2.6' s.add_development_dependency 'webmock' s.add_development_dependency 'rake', '>= 0.8.6' + + if RUBY_VERSION >= "1.9" + s.add_development_dependency 'debugger' + else + s.add_development_dependency 'ruby-debug' + end end
Add debugger to development dependencies * debugger if ruby > 1.9 * else ruby-debug
diff --git a/test/processors/command_processor_test.rb b/test/processors/command_processor_test.rb index abc1234..def5678 100644 --- a/test/processors/command_processor_test.rb +++ b/test/processors/command_processor_test.rb @@ -15,6 +15,11 @@ EOC end + def test_empty_command_repeats_last_command + enter 'n', '' + debug_code(program) { assert_equal 6, state.line } + end + def test_multiple_commands_are_executed_sequentially enter 'n ; n' debug_code(program) { assert_equal 6, state.line }
Add a test to check empty commands behaviour which is supposed to execute the last non-empty command.
diff --git a/mlk.gemspec b/mlk.gemspec index abc1234..def5678 100644 --- a/mlk.gemspec +++ b/mlk.gemspec @@ -24,5 +24,5 @@ spec.add_development_dependency 'rake' spec.add_development_dependency 'mocha' spec.add_development_dependency 'pry' - spec.add_development_dependency 'pry-debugger' + spec.add_development_dependency 'pry-byebug' end
Fix dependencies for recent ruby versions
diff --git a/mdv.gemspec b/mdv.gemspec index abc1234..def5678 100644 --- a/mdv.gemspec +++ b/mdv.gemspec @@ -17,6 +17,8 @@ `git ls-files -z`.split("\0") s.test_files = Dir['test/**/*.rb'] + s.license = 'MIT' + s.add_dependency('gir_ffi-gtk', ['~> 0.8.0']) s.add_dependency('github-markup', ['~> 1.1']) s.add_dependency('github-markdown', ['~> 0.6.5'])
Include license info in the gemspec
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -9,7 +9,7 @@ depends "site-gittypo3org", "~> 0.1.0" depends "ssl_certificates", "~> 1.1.0" -depends "t3-gerrit", "~> 0.5.0" +depends "t3-gerrit", "~> 0.5.5" depends "t3-chef-vault", "~> 1.0.0" depends "t3-mysql", "~> 0.1.3"
[TASK] Add version hint for depsolver
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -8,4 +8,4 @@ depends 'build-essential', '~> 2.2' depends 'java', '~> 1.35' depends 'runit', '~> 1.7' -depends 'zookeeper', '~> 3.0' +depends 'zookeeper', '~> 4.0'
Update to zookeeper ~> 4.0
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -13,6 +13,11 @@ # it down until they're done depends "opscode-postgresql", "= 0.1.3" +# This is the version we currently have in prod / preprod +# +# It apparently does not play nicely with Ubuntu 12? +depends "apt", "= 1.2.2" + # This is one of the new cookbooks: # https://github.com/opscode-cookbooks/opscode-pedant depends "opscode-pedant", "~> 0.1.2"
Fix apt at the version in prod
diff --git a/AttributedLib.podspec b/AttributedLib.podspec index abc1234..def5678 100644 --- a/AttributedLib.podspec +++ b/AttributedLib.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'AttributedLib' - s.version = '0.2.0' + s.version = '0.2.1' s.summary = 'A Modern interface for attributed strings.' s.description = <<-DESC
Update Pod specification to point to 0.2.1
diff --git a/mms.gemspec b/mms.gemspec index abc1234..def5678 100644 --- a/mms.gemspec +++ b/mms.gemspec @@ -18,5 +18,6 @@ s.add_runtime_dependency 'clamp', '~> 0.6.0' s.add_development_dependency 'rake' + s.add_development_dependency 'pry' s.add_development_dependency 'rspec', '~> 2.0' end
Add pry for dev debugging
diff --git a/db/migrate/20150312155312_add_module_full_name_to_match.rb b/db/migrate/20150312155312_add_module_full_name_to_match.rb index abc1234..def5678 100644 --- a/db/migrate/20150312155312_add_module_full_name_to_match.rb +++ b/db/migrate/20150312155312_add_module_full_name_to_match.rb @@ -1,6 +1,6 @@ class AddModuleFullNameToMatch < ActiveRecord::Migration def change - add_column :automatic_exploitation_matches, :module_fullname, :string + add_column :automatic_exploitation_matches, :module_fullname, :text add_index :automatic_exploitation_matches, :module_fullname end end
Change string type to text
diff --git a/spec/integration/commands/addresses/remove_spec.rb b/spec/integration/commands/addresses/remove_spec.rb index abc1234..def5678 100644 --- a/spec/integration/commands/addresses/remove_spec.rb +++ b/spec/integration/commands/addresses/remove_spec.rb @@ -21,14 +21,16 @@ end it "should not list in addresses" do - addresses = @hp_svc.addresses.map {|a| a.public_ip} - addresses.should_not include(@public_ip) + lambda { + addresses = @hp_svc.addresses.map {|a| a.public_ip} + }.should raise_error(Fog::AWS::Compute::Error) end it "should not exist" do - address = get_address(@hp_svc, @public_ip) - address.should be_nil - end + lambda { + address = get_address(@hp_svc, @public_ip) + }.should raise_error(Fog::AWS::Compute::Error) + end end end
Fix spec to catch exception raised when there are no addresses. Behavior changed in Diablo4.
diff --git a/business.gemspec b/business.gemspec index abc1234..def5678 100644 --- a/business.gemspec +++ b/business.gemspec @@ -20,7 +20,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_development_dependency "gc_ruboconfig", "~> 2.20.0" + spec.add_development_dependency "gc_ruboconfig", "~> 2.23.0" spec.add_development_dependency "rspec", "~> 3.1" spec.add_development_dependency "rspec_junit_formatter", "~> 0.4.1" spec.add_development_dependency "rubocop", "~> 1.4.2"
Update gc_ruboconfig requirement from ~> 2.20.0 to ~> 2.23.0 Updates the requirements on [gc_ruboconfig](https://github.com/gocardless/ruboconfig) to permit the latest version. - [Release notes](https://github.com/gocardless/ruboconfig/releases) - [Changelog](https://github.com/gocardless/gc_ruboconfig/blob/master/CHANGELOG.md) - [Commits](https://github.com/gocardless/ruboconfig/commits) Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/api_classes/dsl_proxy.rb b/api_classes/dsl_proxy.rb index abc1234..def5678 100644 --- a/api_classes/dsl_proxy.rb +++ b/api_classes/dsl_proxy.rb @@ -32,3 +32,4 @@ Proxy.get Proxy.create Proxy.delete +Proxy.update
Add method "update" tp proxy
diff --git a/app/extensions/assets.rb b/app/extensions/assets.rb index abc1234..def5678 100644 --- a/app/extensions/assets.rb +++ b/app/extensions/assets.rb @@ -27,16 +27,16 @@ Stylus.setup(assets) app.set :asset_host, '' + assets.cache = Sprockets::Cache::FileStore.new('./tmp') + # app.configure :development do + # assets.cache = Sprockets::Cache::FileStore.new('./tmp') + # end - app.configure :development do - assets.cache = Sprockets::Cache::FileStore.new('./tmp') - end - - app.configure :production do - assets.cache = Sprockets::Cache::MemcacheStore.new - # assets.js_compressor = Closure::Compiler.new - # assets.css_compressor = YUI::CssCompressor.new - end + # app.configure :production do + # assets.cache = Sprockets::Cache::MemcacheStore.new + # # assets.js_compressor = Closure::Compiler.new + # # assets.css_compressor = YUI::CssCompressor.new + # end app.helpers Helpers end
Revert using memcache on prod
diff --git a/app/jobs/post_grouper.rb b/app/jobs/post_grouper.rb index abc1234..def5678 100644 --- a/app/jobs/post_grouper.rb +++ b/app/jobs/post_grouper.rb @@ -10,7 +10,7 @@ def delete_orphaned_gene_claims DataModel::GeneClaim.joins(:gene, :gene_claim_aliases, :source) .where("gene_claims.gene_id IS NULL and sources.source_db_name = 'Ensembl'") - .each {|c| c.detroy} + .destroy_all end def update_counts
Use destroy_all instead of calling destroy on individual entries
diff --git a/scss-lint.gemspec b/scss-lint.gemspec index abc1234..def5678 100644 --- a/scss-lint.gemspec +++ b/scss-lint.gemspec @@ -14,7 +14,7 @@ s.summary = 'SCSS lint tool' s.description = 'Opinionated tool to help write clean and consistent SCSS' - s.files = Dir['lib/**/*.rb'] + s.files = Dir['config/**/*.yml'] + Dir['lib/**/*.rb'] s.executables = ['scss-lint'] s.require_paths = ['lib']
Include config directory in gem file Commit 4b13f23 forgot to add the new `config` directory to the gemspec, resulting in default configurations not being found (and the gem ultimately crashing). Change-Id: Ieff25d0e002c9dae069c16e88685a9b802254d4d Reviewed-on: https://gerrit.causes.com/31531 Tested-by: jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@causes.com> Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com>
diff --git a/test/trash_test.rb b/test/trash_test.rb index abc1234..def5678 100644 --- a/test/trash_test.rb +++ b/test/trash_test.rb @@ -2,6 +2,7 @@ require 'rubygems' require 'active_record' require 'trash' +require 'factory_girl' ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:") @@ -22,16 +23,32 @@ end end +## +# Model definitions +# + class Entry < ActiveRecord::Base default_scope where(:deleted_at => nil) has_trash end +## +# Factories +# + +Factory.define :entry do |f| + f.sequence(:title) { |n| "Entry##{n}" } +end + +## +# And finally the test itself. +# + class TrashTest < Test::Unit::TestCase def setup setup_db - @entry = Entry.create :title => "Hello World" + @entry = Factory(:entry) end def teardown
Use factories to create data
diff --git a/omf_common/example/engine_xmpp.rb b/omf_common/example/engine_xmpp.rb index abc1234..def5678 100644 --- a/omf_common/example/engine_xmpp.rb +++ b/omf_common/example/engine_xmpp.rb @@ -0,0 +1,75 @@+# OMF_VERSIONS = 6.0 +require 'omf_common' + +OmfCommon::Eventloop.init(type: :em) + +def create_engine(garage) + garage.create(:engine, name: 'bob') do |msg| + if msg.success? + info ">>> Connected to newly created resource #{msg.inspect}" + on_engine_created(msg.resource_address) + else + error ">>> Resource creation failed - #{msg[:reason]}" + end + end +end + +# This method is called whenever a new engine has been created by the garage. +# +# @param [Topic] engine Topic representing the created engine +# +def on_engine_created(engine_resource_address) + OmfCommon.eventloop.after(3) do + OmfCommon.comm.subscribe(engine_resource_address) do |engine| + # Monitor all status information from teh engine + engine.on_status do |msg| + msg.each_property do |name, value| + logger.info "#{name} => #{value}" + end + end + + engine.on_error do |msg| + logger.error msg.read_content("reason") + end + + # Send a request for specific properties + info ">>> SENDING REQUEST" + + engine.request([:max_rpm, :max_power]) do |msg| + info ">>> REPLY #{msg.inspect}" + end + + # Now we will apply 50% throttle to the engine + engine.configure(throttle: 50) + + # Some time later, we want to reduce the throttle to 0, to avoid blowing up the engine + OmfCommon.eventloop.after(5) do + engine.configure(throttle: 0) + end + end + end +end + +def release_engine(engine, garage) + logger.info "Time to release engine #{engine}" + garage.release engine do |rmsg| + puts "===> ENGINE RELEASED: #{rmsg}" + end +end + +OmfCommon.eventloop.run do |el| + OmfCommon::Comm.init(type: :xmpp, username: 'alpha', password: 'pw', server: 'localhost') + + OmfCommon.comm.on_connected do |comm| + info "Connected as #{OmfCommon.comm.jid}" + + comm = OmfCommon.comm + comm.subscribe('garage') do |garage| + create_engine(garage) + end + + el.after(20) { el.stop } + end +end + +info "DONE"
Add xmpp engine test according to new API
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -23,7 +23,7 @@ config.middleware.insert_before "ActionDispatch::Static", "Rack::Cors" do allow do origins '*' - resource '*', :headers => :any, :methods => [:get, :post, :options] + resource '*', :headers => :any, :methods => [:get, :post, :put, :options] end end end
Update CORS config to allow PUT requests
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -24,10 +24,12 @@ config.generators.views = false config.generators.assets = false - config.middleware.insert_before 'Warden::Manager', 'Rack::Cors' do - allow do - origins(*ENV['CORS_ALLOW_ORIGIN'].split(',')) - resource '*', headers: :any, methods: [:get, :post, :put, :delete, :options, :head] + unless ENV['CORS_ALLOW_ORIGIN'].nil? + config.middleware.insert_before 'Warden::Manager', 'Rack::Cors' do + allow do + origins(*ENV['CORS_ALLOW_ORIGIN'].split(',')) + resource '*', headers: :any, methods: [:get, :post, :put, :delete, :options, :head] + end end end end
Fix split on nil issue.
diff --git a/EEEOperationCenter.podspec b/EEEOperationCenter.podspec index abc1234..def5678 100644 --- a/EEEOperationCenter.podspec +++ b/EEEOperationCenter.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "EEEOperationCenter" - s.version = "1.0.0" + s.version = "1.0.0.b1" s.summary = "Say 'no' to God-classes, chop them up with the operation center" s.homepage = "https://github.com/epologee/EEEOperationCenter" s.license = 'Unlicense'
Mark this podspec as beta, up until pushing to Cocoapods (`pod push`)
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -24,5 +24,10 @@ # Do not swallow errors in after_commit/after_rollback callbacks. config.active_record.raise_in_transactional_callbacks = true + + config.action_dispatch.default_headers = { + 'X-XSS-Protection' => '1; mode=block', + 'X-Content-Type-Options' => 'nosniff' + } end end
Allow site to appear inside iframe iframe is common in imageboard aggregation sites.
diff --git a/spec/deep_cover_spec.rb b/spec/deep_cover_spec.rb index abc1234..def5678 100644 --- a/spec/deep_cover_spec.rb +++ b/spec/deep_cover_spec.rb @@ -7,13 +7,16 @@ it 'temporarily overrides `require`, `require_relative` and `autoload`' do methods = %i[require require_relative] methods << :autoload unless RUBY_PLATFORM == 'java' + original = methods.map { |m| method(m).source_location } 2.times do sources = nil DeepCover.cover do sources = methods.map { |m| method(m).source_location } end - sources.compact.size.should == methods.size - methods.map { |m| method(m).source_location }.compact.size.should == 0 + sources.zip(original).each do |now, before| + now.should_not == before + end + methods.map { |m| method(m).source_location }.should == original end end
Improve spec, and make it JRuby compatible
diff --git a/lib/gglog/repository.rb b/lib/gglog/repository.rb index abc1234..def5678 100644 --- a/lib/gglog/repository.rb +++ b/lib/gglog/repository.rb @@ -37,7 +37,7 @@ def pull Dir.chdir(@path) do system "git", "reset", "--hard", "--quiet" - system "git", "pull", "--force", "--quiet", "origin", "master" + system "git", "pull", "--force", "--quiet", "origin", "HEAD" end end
Use HEAD for pulling branch
diff --git a/lib/launch_pass/user.rb b/lib/launch_pass/user.rb index abc1234..def5678 100644 --- a/lib/launch_pass/user.rb +++ b/lib/launch_pass/user.rb @@ -39,8 +39,6 @@ @teams ||= @info_hash["teams"].map do |team_hash| team_hash["name"] end - else - [] end end @@ -49,8 +47,6 @@ @products ||= @info_hash["products"].map do |product| product["name"] end - else - [] end end end
Revert "better handling for nil collections" This reverts commit 4d21c5d4c0309abd581fe2bd0e14a48caf5d8a4b.
diff --git a/SwiftyZeroMQ.podspec b/SwiftyZeroMQ.podspec index abc1234..def5678 100644 --- a/SwiftyZeroMQ.podspec +++ b/SwiftyZeroMQ.podspec @@ -24,6 +24,6 @@ s.watchos.deployment_target = "2.0" s.libraries = "stdc++" s.source_files = "Sources/*.{h,swift}" - s.vendored_libraries = "Sources/libzmq-{ios|macos|tvos|watchos}.a" + s.vendored_libraries = "Sources/libzmq-{ios,macos,tvos,watchos}.a" s.preserve_paths = "Sources/*.{a,h}" end
Fix cocoapods vendored libs pattern
diff --git a/spec/run_command_spec.rb b/spec/run_command_spec.rb index abc1234..def5678 100644 --- a/spec/run_command_spec.rb +++ b/spec/run_command_spec.rb @@ -15,9 +15,11 @@ out.string.should =~ /hokey_pokey/ end - # This is a regression test as 0.9.11 broke this behaviour - it 'can perform a show-source' do - Pry.run_command "show-source drum", :context => @context, :output => out = StringIO.new - out.string.should =~ /roken is dodelijk/ + if !PryTestHelpers.mri18_and_no_real_source_location? + # This is a regression test as 0.9.11 broke this behaviour + it 'can perform a show-source' do + Pry.run_command "show-source drum", :context => @context, :output => out = StringIO.new + out.string.should =~ /roken is dodelijk/ + end end end
Fix failing specs on ree/ruby18 We put a conditional around tests so that we skip those those using show-source (namely the one in run_command_spec.rb) on ree/ruby18
diff --git a/lib/baseball_stats/calculators/improved_batting_average.rb b/lib/baseball_stats/calculators/improved_batting_average.rb index abc1234..def5678 100644 --- a/lib/baseball_stats/calculators/improved_batting_average.rb +++ b/lib/baseball_stats/calculators/improved_batting_average.rb @@ -41,7 +41,11 @@ end end - class NoStatsToCalculateError < StandardError; end + class NoStatsToCalculateError < StandardError + def message + "There are no stats to calculate." + end + end class NoStatsFoundInDateRangeError < StandardError; end class StatsMustHaveAtLeast200AtBatsError < StandardError; end end
Add a friendly message to NoStatsToCalculateError for the report
diff --git a/config/initializers/haml.rb b/config/initializers/haml.rb index abc1234..def5678 100644 --- a/config/initializers/haml.rb +++ b/config/initializers/haml.rb @@ -1 +1,7 @@ Haml::Template.options[:ugly] = true + +# Remove the `:coffee` and `:coffeescript` filters +# +# See https://git.io/vztMu and http://stackoverflow.com/a/17571242/223897 +Haml::Filters.remove_filter('coffee') +Haml::Filters.remove_filter('coffeescript')
Remove the `:coffee` and `:coffeescript` Haml filters See https://git.io/vztMu and http://stackoverflow.com/a/17571242/223897
diff --git a/capistrano-karaf.gemspec b/capistrano-karaf.gemspec index abc1234..def5678 100644 --- a/capistrano-karaf.gemspec +++ b/capistrano-karaf.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'capistrano-karaf' - s.version = '1.2.1' + s.version = '1.2.2' s.date = '2013-12-03' s.summary = 'Capistrano functions for communicating with karaf' s.authors = ['Brecht Hoflack']
Change version number to 1.2.2
diff --git a/lib/npr/api/response.rb b/lib/npr/api/response.rb index abc1234..def5678 100644 --- a/lib/npr/api/response.rb +++ b/lib/npr/api/response.rb @@ -6,19 +6,21 @@ module NPR module API class Response + include NPR::Concern::Relation + + has_many "messages", :key => "message", :class_name => NPR::API::Message attr_reader :raw, :version, :messages, :list def initialize(response) + create_relations(response) + @raw = response @version = response.body["version"] @list = NPR::Entity::List.new(response.body["list"]) - messages = [] Array.wrap(response.body["message"]).each do |message| - messages.push NPR::API::Message.new(message) + @messages.push NPR::API::Message.new(message) end - - @messages = messages end end # Response end # API
Add messages relations to API::Response
diff --git a/ext/libvirt/extconf.rb b/ext/libvirt/extconf.rb index abc1234..def5678 100644 --- a/ext/libvirt/extconf.rb +++ b/ext/libvirt/extconf.rb @@ -20,7 +20,10 @@ 'virStoragePoolPtr', 'virStorageVolPtr' ] +libvirt_funcs = [ ] + have_libvirt_types(libvirt_types) +have_libvirt_funcs(libvirt_funcs) create_header create_makefile(extension_name)
Introduce have_libvirt_funcs, which will be needed later. Signed-off-by: Chris Lalancette <60b62644009db6b194cc0445b64e9b27bb26433a@redhat.com>
diff --git a/fancybox-rails.gemspec b/fancybox-rails.gemspec index abc1234..def5678 100644 --- a/fancybox-rails.gemspec +++ b/fancybox-rails.gemspec @@ -8,7 +8,7 @@ s.summary = "Use FancyBox with the Rails asset pipeline" s.description = "This gem provides jQuery FancyBox for your Rails application." - s.files = Dir["{app,lib,vendor}/**/*"] + ["MIT-LICENSE", "Rakefile", "Gemfile", "README.md"] + s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } s.version = "0.3.0" s.add_dependency "railties", ">= 3.1.0"
Use git to determine which files to include in gem When you create a gem with bundler this is the standard way that it gets the list of files. Using this method avoids accidentally missing out some of the files.
diff --git a/lib/s3browser/server.rb b/lib/s3browser/server.rb index abc1234..def5678 100644 --- a/lib/s3browser/server.rb +++ b/lib/s3browser/server.rb @@ -8,22 +8,25 @@ set :port, 9292 set :bind, '0.0.0.0' enable :logging - set :store, Store.new end get '/' do - buckets = settings.store.buckets + buckets = store.buckets haml :index, locals: { title: 'S3Browser', buckets: buckets } end get '/:bucket' do |bucket| params['q'] = nil if params['q'] == '' - objects = settings.store.get(bucket, term: params['q'], sort: params['s'], direction: params['d']) + objects = store.get(bucket, term: params['q'], sort: params['s'], direction: params['d']) haml :bucket, locals: { title: bucket, bucket: bucket, objects: objects, q: params['q'] } end helpers do + def store + @@store ||= Store.new + end + def bucket ENV['AWS_S3_BUCKET'] end
fix: Move store back to a helper
diff --git a/lib/yacht/javascript.rb b/lib/yacht/javascript.rb index abc1234..def5678 100644 --- a/lib/yacht/javascript.rb +++ b/lib/yacht/javascript.rb @@ -13,7 +13,7 @@ def to_js_file(opts={}) # by default, set :dir to 'public/javascripts' in Rails - opts[:dir] ||= Rails.root.join('public', 'javascripts').to_s if defined?(Rails) + opts[:dir] ||= Rails.root.join('public', 'javascripts').to_s if Object.const_defined?(:Rails) raise Yacht::LoadError.new("Must provide :dir option") if opts[:dir].nil?
Use Object.const_defined? to detect rails
diff --git a/glyphicons-rails.gemspec b/glyphicons-rails.gemspec index abc1234..def5678 100644 --- a/glyphicons-rails.gemspec +++ b/glyphicons-rails.gemspec @@ -23,4 +23,6 @@ spec.add_development_dependency "rake", "~> 10.0" spec.add_dependency "sass", "~> 3.3" spec.add_dependency "sass-rails" + + spec.post_install_message = "WARNING: This gem is deprecated!" end
Add deprecation warning to gemspec
diff --git a/static_deploy.gemspec b/static_deploy.gemspec index abc1234..def5678 100644 --- a/static_deploy.gemspec +++ b/static_deploy.gemspec @@ -1,4 +1,3 @@-# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'static_deploy/version' @@ -18,7 +17,11 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_dependency "tty", "0.2.1" + spec.required_ruby_version = '>= 2.0.0' - spec.add_development_dependency "bundler", "~> 1.3" + spec.add_runtime_dependency 'tty-prompt', '~> 0.18' + spec.add_runtime_dependency 'rake' + + spec.add_development_dependency 'bundler', '>= 1.5.0', '< 2.0' + spec.add_development_dependency 'rspec', '~> 3.1' end
Change to use only tty-prompt and add dev dependencies
diff --git a/spec/lib/analytics/histogram_plotter_spec.rb b/spec/lib/analytics/histogram_plotter_spec.rb index abc1234..def5678 100644 --- a/spec/lib/analytics/histogram_plotter_spec.rb +++ b/spec/lib/analytics/histogram_plotter_spec.rb @@ -22,7 +22,8 @@ describe HistogramPlotter do let(:course) { create(:course, id: 1, start: 1.year.ago, end: 1.day.from_now) } - let(:subject) { described_class.plot(course: course) } + let(:opts) { { existing_only: true, minimum_improvement: 1 } } + let(:subject) { described_class.plot(course: course, opts: opts) } let(:article) { create(:article) } let(:revision) do create(:revision, article: article, date: 1.day.ago, wp10: 70, wp10_previous: 1) @@ -44,8 +45,17 @@ course.articles << article end - it 'returns an image path string' do - expect(subject).to match(/.*png/) + context 'histogram type' do + let(:opts) { { type: 'histogram' } } + it 'returns an image path string' do + expect(subject).to match(/.*png/) + end + end + + context 'default density type' do + it 'returns an image path string' do + expect(subject).to match(/.*png/) + end end end end
Test both histogram and density plots, with different options
diff --git a/spec/requests/application_controller_spec.rb b/spec/requests/application_controller_spec.rb index abc1234..def5678 100644 --- a/spec/requests/application_controller_spec.rb +++ b/spec/requests/application_controller_spec.rb @@ -0,0 +1,21 @@+require 'rails_helper' + +RSpec.describe "get a 404 response (in JSON) from unmatched route", :type => :request do + it 'when the request id for HTML' do + get '/foo' + expect(response.body).to eq('{"error":"404 - Not Found"}') + expect(response).to have_http_status(:not_found) + end + + it 'when the request id for CSV' do + get '/foo', headers: {"Content-Type": "text/csv"} + expect(response.body).to eq('{"error":"404 - Not Found"}') + expect(response).to have_http_status(:not_found) + end + + it 'when the request id for JSON' do + get '/foo', headers: {"Content-Type": "application/vnd.uktt.v2"} + expect(response.body).to eq('{"error":"404 - Not Found"}') + expect(response).to have_http_status(:not_found) + end +end
Add spec for desired behavior
diff --git a/spec/unit/shared/attribute/accept_options.rb b/spec/unit/shared/attribute/accept_options.rb index abc1234..def5678 100644 --- a/spec/unit/shared/attribute/accept_options.rb +++ b/spec/unit/shared/attribute/accept_options.rb @@ -25,9 +25,9 @@ end context "when new attribute is created and overrides option's default value" do + subject { sub_attribute.new(attribute_name, option => new_value) } + let(:new_value) { 11 } - - subject { sub_attribute.new(attribute_name, option => new_value) } it 'sets the new value' do subject.options[option].should eql(new_value)
Move the subject to the top of the context block
diff --git a/app/services/sunlight_congress_legislator_service.rb b/app/services/sunlight_congress_legislator_service.rb index abc1234..def5678 100644 --- a/app/services/sunlight_congress_legislator_service.rb +++ b/app/services/sunlight_congress_legislator_service.rb @@ -10,7 +10,7 @@ def initialize @key = ENV['SUNLIGHT_API_KEY'] - @base_url = "http://congress.api.sunlightfoundation.com/" + @base_url = "https://congress.api.sunlightfoundation.com/" @legislators_url = "#{base_url}legislators/" @id_field = "bioguide_id" end
Use HTTPS for Sunlight Congress API interaction
diff --git a/katex.gemspec b/katex.gemspec index abc1234..def5678 100644 --- a/katex.gemspec +++ b/katex.gemspec @@ -15,7 +15,7 @@ s.homepage = 'https://github.com/glebm/katex-ruby' s.license = 'MIT' - s.required_ruby_version = '~> 2.3' + s.required_ruby_version = '>= 2.3' s.files = Dir['{exe,lib,vendor}/**/*'] + %w[LICENSE.txt README.md] s.bindir = 'exe' @@ -24,7 +24,7 @@ s.add_dependency 'execjs', '~> 2.7' - s.add_development_dependency 'bundler', '~> 2.0.1' + s.add_development_dependency 'bundler', '~> 2.0' s.add_development_dependency 'rake', '~> 10.0' s.add_development_dependency 'rspec', '~> 3.0' s.add_development_dependency 'rubocop', '>= 0.55.0'
Add support for Ruby 3
diff --git a/spec/unit/owner_spec.rb b/spec/unit/owner_spec.rb index abc1234..def5678 100644 --- a/spec/unit/owner_spec.rb +++ b/spec/unit/owner_spec.rb @@ -10,5 +10,31 @@ yaml = YAML.load(@owner.to_yaml) yaml.keys.sort.should == %w(created_at email id name) end + + it "finds itself with an email address" do + owner = Owner.find_or_create_by_email(@owner.email) + owner.should.not.be.new + owner.email.should == @owner.email + end + + it "creates itself with an email address" do + email = 'janny@example.com' + owner = Owner.find_or_create_by_email(email) + owner.should.not.be.new + owner.email.should == email + end + + it "normalizes the email address when finding by email address" do + owner = Owner.find_or_create_by_email(" #{@owner.email.upcase} ") + owner.should.not.be.new + owner.email.should == @owner.email + end + + it "normalizes the email address when creating by email address" do + email = 'janny@example.com' + owner = Owner.find_or_create_by_email(" #{email.upcase} ") + owner.should.not.be.new + owner.email.should == email + end end end
[App] Make sure find or create for owners works properly.
diff --git a/lib/alfabank/api/base.rb b/lib/alfabank/api/base.rb index abc1234..def5678 100644 --- a/lib/alfabank/api/base.rb +++ b/lib/alfabank/api/base.rb @@ -19,11 +19,7 @@ end def url - if Alfabank::Configuration.mode == :test - self.class::TEST_URL - elsif Alfabank::Configuration.mode == :production - self.class::URL - end + Alfabank::Configuration.mode == :production ? self.class::URL : self.class::TEST_URL end def credentials
Use test environment by default if none specified
diff --git a/split-analytics.gemspec b/split-analytics.gemspec index abc1234..def5678 100644 --- a/split-analytics.gemspec +++ b/split-analytics.gemspec @@ -7,7 +7,6 @@ gem.email = ['andrewnez@gmail.com'] gem.summary = 'Split extension to push test data to Google Analytics' gem.homepage = 'https://github.com/splitrb/split-analytics' - gem.bug_tracker_uri = 'https://github.com/splitrb/split-analytics/issues' gem.license = 'MIT' gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
Remove bug tracker from gemspec
diff --git a/lib/catscan/scannable.rb b/lib/catscan/scannable.rb index abc1234..def5678 100644 --- a/lib/catscan/scannable.rb +++ b/lib/catscan/scannable.rb @@ -15,15 +15,13 @@ module ScannerMethods def scan(context, comment = nil, &block) - result = nil - klass_name = context.class.name comment = Util.limit_bytesize(comment) if comment.present? ActiveSupport::Notifications.instrument("log.scan", :klass_name => klass_name, :comment => "#{klass_name}: #{comment}") do - result = context.instance_eval(&block) + context.instance_eval(&block) end rescue => ex puts "Error!"
Clean up scan instance/class method
diff --git a/test/test_calc.rb b/test/test_calc.rb index abc1234..def5678 100644 --- a/test/test_calc.rb +++ b/test/test_calc.rb @@ -14,6 +14,11 @@ assert_equal 10, calc("2 PLUS 5 MINUS 1 PLUS 4") end + def test_another_complex_expression + skip "not yet" + assert_equal 5, calc("2 TIMES 4 MINUS 3") + end + def test_more_complex_expression skip "not yet" assert_equal 10, calc("10 DIV 2 PLUS 6 MINUS 1")
Add multiplication test. Not implemented.
diff --git a/db/schema.rb b/db/schema.rb index abc1234..def5678 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -18,8 +18,8 @@ create_table "skills", force: :cascade do |t| t.string "title" - t.integer "current_streak" - t.integer "longest_streak" + t.integer "current_streak", default: 1 + t.integer "longest_streak", default: 1 t.integer "user_id" t.datetime "created_at" t.datetime "updated_at"
Add default values to current and longest streak fields
diff --git a/lib/jibby/application.rb b/lib/jibby/application.rb index abc1234..def5678 100644 --- a/lib/jibby/application.rb +++ b/lib/jibby/application.rb @@ -27,7 +27,7 @@ private def prompt_text - '>' + "#{@current_key}>" end end end
Add ticket key to prompt if found
diff --git a/lib/rhythmmml/command.rb b/lib/rhythmmml/command.rb index abc1234..def5678 100644 --- a/lib/rhythmmml/command.rb +++ b/lib/rhythmmml/command.rb @@ -37,10 +37,11 @@ "Reverse octave sign (><) effects") do |boolean| options[:octave_reverse] = boolean end - parser.on("--channel_delimiter=DELIMITER", - "Specify channel delimiter") do |delimiter| - options[:channel_delimiter] = delimiter - end + # TODO: support stereo + #parser.on("--channel_delimiter=DELIMITER", + # "Specify channel delimiter") do |delimiter| + # options[:channel_delimiter] = delimiter + #end parser.parse!(arguments) unless File.pipe?('/dev/stdin') || IO.select([ARGF], nil, nil, 0)
Disable a not supporting option
diff --git a/lib/servicenow/record.rb b/lib/servicenow/record.rb index abc1234..def5678 100644 --- a/lib/servicenow/record.rb +++ b/lib/servicenow/record.rb @@ -29,7 +29,7 @@ else self.wsdl = "https://%s:%s@%s.%s/%s.do?WSDL" % [user,password,instance,domain,table] end - client :wsdl => self.wsdl, + client :wsdl => opts[:wsdl] || self.wsdl, :log => log ? true : false, :log_level => log || :fatal, :ssl_verify_mode => :none,
Allow for custom WSDL location
diff --git a/lib/tasks/analytics.rake b/lib/tasks/analytics.rake index abc1234..def5678 100644 --- a/lib/tasks/analytics.rake +++ b/lib/tasks/analytics.rake @@ -26,4 +26,16 @@ end end end + + desc "Delete old export files (specify the number to keep with EXPORT_FILE_LIMIT)" + task :delete_old_files do + path = ENV['EXPORT_PATH'] || 'data' + export_file_limit = ENV.fetch('EXPORT_FILE_LIMIT').to_i + 1 + files = Dir["#{path}/analytics_data_import_*.csv"] + files = files.sort + files[0..-export_file_limit].each do |file| + puts "Removing file: #{file}" + File.delete(file) + end + end end
Add rake task to delete old export files
diff --git a/provisioner/worker/plugins/automators/chef_solo_automator/chef_solo_automator/cookbooks/loom_hosts/recipes/default.rb b/provisioner/worker/plugins/automators/chef_solo_automator/chef_solo_automator/cookbooks/loom_hosts/recipes/default.rb index abc1234..def5678 100644 --- a/provisioner/worker/plugins/automators/chef_solo_automator/chef_solo_automator/cookbooks/loom_hosts/recipes/default.rb +++ b/provisioner/worker/plugins/automators/chef_solo_automator/chef_solo_automator/cookbooks/loom_hosts/recipes/default.rb @@ -19,7 +19,8 @@ node['loom']['cluster']['nodes'].each do |n, v| short_host = v.hostname.split('.').first - hostsfile_entry v.ipaddress do + next unless v.key?('ipaddresses') && v['ipaddresses'].key?('bind_v4') + hostsfile_entry v['ipaddresses']['bind_v4'] do hostname v.hostname aliases [ short_host ] unique true
Change cookbook to use new bind_v4 address
diff --git a/app/controllers/api/v1/notes_controller.rb b/app/controllers/api/v1/notes_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/v1/notes_controller.rb +++ b/app/controllers/api/v1/notes_controller.rb @@ -28,6 +28,15 @@ end end + def destroy + @note = current_api_user.notes.find params[:id] + if @note.destroy + render json: { message: 'Deleted Successfully' } + else + render json: @note.errors, status: :unprocessable_entity + end + end + private def note_params
Add delete endpoint to API
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,7 +5,7 @@ end member do - put :update_notes + patch :update_notes end member do
Change PUT to PATCH for update_notes method Rails 4 changed the default HTTP verb from PUT to PATCH for updates, which broke the note updating functionality in this app.
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,6 +7,7 @@ get "/releases/2016/12/12/new-backend", to: redirect('/blogs/2016/12/12/new-backend') # Sessions + get '/logout', to: 'sessions#destroy' resource :session, only: [:create, :destroy] # Default Scrivito routes. Adapt them to change the routing of CMS objects.
Enable to log out by GET /login
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -12,6 +12,7 @@ get '/terms', to: 'page#term', as: 'show_term' get '/feedbacks', to: 'page#feedback', as: 'show_feedback' get '/docs', to: 'page#doc', as: 'show_doc' + get '/dashboard', to: 'checks#index', as: 'user_root' # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html end
Add user root path for devise to redirect
diff --git a/spec/models/cloud_model/workers/components/ruby_component_worker_spec.rb b/spec/models/cloud_model/workers/components/ruby_component_worker_spec.rb index abc1234..def5678 100644 --- a/spec/models/cloud_model/workers/components/ruby_component_worker_spec.rb +++ b/spec/models/cloud_model/workers/components/ruby_component_worker_spec.rb @@ -14,8 +14,9 @@ end it 'should apt-get ruby' do - expect(subject).to receive(:chroot!).with('/tmp/build', 'apt-get install ruby git zlib1g-dev libxml2-dev ruby-bcrypt nodejs imagemagick libxml2-utils libxslt-dev -y', 'Failed to install packages for deployment of rails app') - expect(subject).to receive(:chroot!).with('/tmp/build', 'gem install bundler', 'Failed to install bundler') + expect(subject).to receive(:chroot!).with('/tmp/build', 'apt-get install ruby ruby-dev git zlib1g-dev libxml2-dev ruby-bcrypt nodejs imagemagick libxml2-utils libxslt-dev -y', 'Failed to install packages for deployment of rails app') + expect(subject).to receive(:chroot!).with('/tmp/build', 'gem install bundler', 'Failed to install current bundler') + expect(subject).to receive(:chroot!).with('/tmp/build', "gem install bundler -v '~>1.0'", 'Failed to install legacy bundler v1') subject.build '/tmp/build' end
Fix ruby component worker test for latest changes
diff --git a/releases.rb b/releases.rb index abc1234..def5678 100644 --- a/releases.rb +++ b/releases.rb @@ -0,0 +1,71 @@+# Release - a HAProxy release +# Build - our docker image for a corresponding release +# + +HAPROXY_GIT_URL = "http://git.haproxy.org/git/haproxy-%s.git" + +# Supported versions per the table on the haproxy.org homepage +HAPROXY_MAJOR_VERSIONS = %w(1.8 2.0 2.1 2.2 2.3) + +# HAProxy versions we have built. +HAPROXY_BUILDS = %x(git tag).split + +EXHAUSTIVE = ARGV.first == "--all" + +def haproxy_git_url major + HAPROXY_GIT_URL % major +end + +def haproxy_builds_for major + re_ver = Regexp.quote(major + ".") + + versions = HAPROXY_BUILDS.grep /^#{re_ver}/ + + versions.sort_by { |v| Gem::Version.new(v) } +end + +# All releases from the HAProxy project for a given major version. +# The leading "v" in the version string vX.Y.Z is removed. +def haproxy_releases_for major + refs_and_tags = %x(git ls-remote --tags -q --refs #{haproxy_git_url(major)} v#{major}.*) + + versions = refs_and_tags.split(/\n/).map { |r| r.sub(%r{^.*refs/tags/v}, "") } + + versions.sort_by { |v| Gem::Version.new(v) } +end + +def pending_builds major + builds = haproxy_builds_for major + releases = haproxy_releases_for major + + releases - builds +end + +def build version + update + build_haproxy version + tag + push +end + +def update + update_lib :libslz + update_lib :openssl + update_lib :pcre +end + +HAPROXY_MAJOR_VERSIONS.each do |major| + + if EXHAUSTIVE + pending_builds(major).each do |version| + puts "A build is required for HAProxy version %s" % version + end + + else + puts "Latest %s release is %s, have %s (%s)" % [ + major, haproxy_releases_for(major).last, haproxy_builds_for(major).last, + haproxy_releases_for(major).last == haproxy_builds_for(major).last ? "OK" : "FAIL" + ] + end +end +
Add a script to check how current each major version is.
diff --git a/hpr.gemspec b/hpr.gemspec index abc1234..def5678 100644 --- a/hpr.gemspec +++ b/hpr.gemspec @@ -22,6 +22,6 @@ spec.add_development_dependency "bundler", "~> 1.5" spec.add_development_dependency "rake" - spec.add_development_dependency "rspec" + spec.add_development_dependency "rspec", "~> 3" spec.add_development_dependency "webmock" end
Make RSpec 3 a requirement
diff --git a/pullable.rb b/pullable.rb index abc1234..def5678 100644 --- a/pullable.rb +++ b/pullable.rb @@ -5,6 +5,7 @@ root = ARGF.argv[0] raise ArgumentError.new("Please pass a root directoy!") if root.nil? +raise ArgumentError.new("Please pass a valid root directoy!") unless File.directory?(root) Dir.foreach(root) do |directory| if File.directory?(directory)
Check for a valid root directory
diff --git a/test/controllers/products_controller_test.rb b/test/controllers/products_controller_test.rb index abc1234..def5678 100644 --- a/test/controllers/products_controller_test.rb +++ b/test/controllers/products_controller_test.rb @@ -26,6 +26,13 @@ assert_template :new end + test 'should redirect to show on successful create' do + product = Product.new(id: 823, title: 'Zendesk', status: 'Planned') + get :create, product: product.attributes + assert !response.error?, 'Should create product without errors' + assert_redirected_to(assigns[:product]) + end + test 'should generate index' do assert_generates '/products', controller: 'products', action: 'index' end
Test that successful product creation redirects to show
diff --git a/app/lib/ehjob_authentication/api_client.rb b/app/lib/ehjob_authentication/api_client.rb index abc1234..def5678 100644 --- a/app/lib/ehjob_authentication/api_client.rb +++ b/app/lib/ehjob_authentication/api_client.rb @@ -11,7 +11,7 @@ default_options.merge!(verify: false) headers 'Content-Type' => 'application/json' headers 'Accept' => 'application/json' - debug_output $stderr if Figaro.env.httparty_debug? + debug_output $stderr if ENV['HTTPARTY_DEBUG'].present? headers 'AUTHORIZATION' => "Token token=#{Figaro.env.single_authentication_key}"
Set debug flag as optional
diff --git a/app/services/gas_asset_lists/calculator.rb b/app/services/gas_asset_lists/calculator.rb index abc1234..def5678 100644 --- a/app/services/gas_asset_lists/calculator.rb +++ b/app/services/gas_asset_lists/calculator.rb @@ -7,7 +7,10 @@ private def time_range - min_year..max_year + min = min_year || 0 + max = max_year || min + + min..max end def min_year
Fix invalid nil..nil range with no gas assets Closes #981
diff --git a/app/views/spree/products/index.rss.builder b/app/views/spree/products/index.rss.builder index abc1234..def5678 100644 --- a/app/views/spree/products/index.rss.builder +++ b/app/views/spree/products/index.rss.builder @@ -1,27 +1,30 @@-xml.instruct! :xml, :version=>"1.0" -xml.rss(:version=>"2.0", "xmlns:g" => "http://base.google.com/ns/1.0"){ - xml.channel{ - xml.title(current_store.name) - xml.link("http://#{current_store.url}") - xml.description("Find out about new products on http://#{current_store.url} first!") - xml.language('en-us') +xml.instruct! :xml, version: "1.0" + +xml.rss version: "2.0", "xmlns:g" => "http://base.google.com/ns/1.0" do + xml.channel do + xml.title current_store.name + xml.link "http://#{current_store.url}" + xml.description "Find out about new products on http://#{current_store.url} first!" + xml.language 'en-us' + @products.each do |product| xml.item do - xml.title(product.name) - xml.description((product.images.count > 0 ? link_to(image_tag(product.images.first.attachment.url(:product)), product_url(product)) : '') + simple_format(product.description)) - xml.author(current_store.url) - xml.pubDate((product.available_on || product.created_at).strftime("%a, %d %b %Y %H:%M:%S %z")) - xml.link(product_url(product)) - xml.guid(product.id) + xml.title product.name + xml.description (product.images.count > 0 ? link_to(image_tag(product.images.first.attachment.url(:product)), product_url(product)) : '') + simple_format(product.description) + + xml.author current_store.url + xml.pubDate (product.available_on || product.created_at).strftime("%a, %d %b %Y %H:%M:%S %z") + xml.link product_url(product) + xml.guid product.id if product.images.count > 0 - xml.tag!('g:image_link', product.images.first.attachment.url(:large)) + xml.tag! 'g:image_link', product.images.first.attachment.url(:large) end - xml.tag!('g:price', product.price) - xml.tag!('g:condition', 'retail') - xml.tag!('g:id', product.id) + xml.tag! 'g:price', product.price + xml.tag! 'g:condition', 'retail' + xml.tag! 'g:id', product.id end end - } -} + end +end
Make RSS template more readable
diff --git a/app/controllers/admin/papers_controller.rb b/app/controllers/admin/papers_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/papers_controller.rb +++ b/app/controllers/admin/papers_controller.rb @@ -1,4 +1,4 @@-class Admin::PapersController < ApplicationController +class Admin::PapersController < Admin::ApplicationController before_action :set_activity before_action :set_paper, only: [:show] def index
Fix permission check on papers admin
diff --git a/app/controllers/backend/tags_controller.rb b/app/controllers/backend/tags_controller.rb index abc1234..def5678 100644 --- a/app/controllers/backend/tags_controller.rb +++ b/app/controllers/backend/tags_controller.rb @@ -9,7 +9,7 @@ def create create_tag unless tag_exists? - tag_model + find_model.tagged_items.create tag: find_tag render json: { tag: params[:tag] } end @@ -43,10 +43,4 @@ slug: params[:tag].parameterize } end - - def tag_model - if find_model.tagged_items.where(tag_id: find_tag.id).empty? - find_model.tagged_items.create! tag: find_tag - end - end end
Simplify tag creation a bit more.
diff --git a/PullToRefresh.podspec b/PullToRefresh.podspec index abc1234..def5678 100644 --- a/PullToRefresh.podspec +++ b/PullToRefresh.podspec @@ -0,0 +1,21 @@+Pod::Spec.new do |s| + + s.name = "PullToRefresh" + s.version = "0.0.1" + s.summary = "A simple CollectionViewController with UIRefreshControl" + s.description = <<-DESC + A simple CollectionViewController with UIRefreshControl for iOS. + DESC + + s.homepage = "https://github.com/hirohisa/PullToRefresh" + s.license = { :type => "MIT", :file => "LICENSE" } + + s.author = { "Hirohisa Kawasaki" => "hirohisa.kawasaki@gmail.com" } + + s.source = { :git => "https://github.com/hirohisa/PullToRefresh.git", :branch => 'master' } + + s.source_files = "PullToRefresh/*.swift" + s.requires_arc = true + s.ios.deployment_target = '8.0' + +end
Add podspec, not tag use branch
diff --git a/lib/sucker_punch/queue.rb b/lib/sucker_punch/queue.rb index abc1234..def5678 100644 --- a/lib/sucker_punch/queue.rb +++ b/lib/sucker_punch/queue.rb @@ -1,3 +1,5 @@+require 'thread' + module SuckerPunch class Queue attr_reader :job @@ -6,14 +8,17 @@ def initialize(job) @job = job @pool = nil + @mutex = Mutex.new end def register - unless registered? - initialize_celluloid_pool - register_celluloid_pool - register_queue_with_master_list - end + @mutex.synchronize { + unless registered? + initialize_celluloid_pool + register_celluloid_pool + register_queue_with_master_list + end + } end def registered?
Put a mutex around creating the pool
diff --git a/lib/brew-cask-upgrade.rb b/lib/brew-cask-upgrade.rb index abc1234..def5678 100644 --- a/lib/brew-cask-upgrade.rb +++ b/lib/brew-cask-upgrade.rb @@ -5,7 +5,7 @@ require 'vendor/homebrew-fork/global' require 'hbc' -CASKROOM = "/opt/homebrew-cask/Caskroom" +CASKROOM = "/usr/local/Caskroom" def each_installed Hbc.installed.each_with_index do |name, i|
Update caskroom path according to cask last update
diff --git a/spec/views/shared/_atom_header_spec.rb b/spec/views/shared/_atom_header_spec.rb index abc1234..def5678 100644 --- a/spec/views/shared/_atom_header_spec.rb +++ b/spec/views/shared/_atom_header_spec.rb @@ -0,0 +1,26 @@+require 'spec_helper' + +describe "shared/_atom_header.atom.builder" do + before do + stub_default_blog + end + + describe "with no items" do + before do + @xml = ::Builder::XmlMarkup.new + @xml.foo do + render :partial => "shared/atom_header.atom.builder", + :locals => { :feed => @xml, :items => [] } + end + end + + it "shows typo with the current version as the generator" do + xml = Nokogiri::XML.parse(@xml.to_s) + generator = xml.css("generator").first + generator.content.should == "Typo" + generator["version"].should == TYPO_VERSION + end + end +end + +
Create spec for atom header partial.
diff --git a/slapshot.rb b/slapshot.rb index abc1234..def5678 100644 --- a/slapshot.rb +++ b/slapshot.rb @@ -0,0 +1,45 @@+#!/usr/bin/env ruby + + +# Uploads current, last built apk of the Android project of your +# current path. + + +if !ARGV[0] + puts "Usage: slapshot <RELEASE MESSAGE>" + exit +end + +msg = ARGV[0] +apk_path = "todo" +app_api_write_token = "todo" +app_token = "todo" + +curl_request = "curl -SsF \"status=2\" -F \"notify=1\" -F \"notes=#{msg}\" -F \"notes_type=0\" -F \"ipa=@./androidapp/build/outputs/apk/androidapp-release.apk\" -H \"X-HockeyAppToken: HOCKEYWRITETOKEN\" https://rink.hockeyapp.net/api/2/apps/APPID/app_versions/upload" + +puts "Uploading new release to Hockey..." +response = `#{curl_request}` +# TODO check response, handle errors/anything not 200/ok +puts "New release uploaded to Hockey!" + + + +# ------------ +# Notes on useful hockeyapp api calls: + +# Get my tokens +# curl --user thomas.nilsson@shortcut.no:<PW> https://rink.hockeyapp.net/api/2/auth_tokens + +# List my apps using that token +# curl -H "X-HockeyAppToken: <mytoken>" https://rink.hockeyapp.net/api/2/apps + +# List versions of app +# curl -H "X-HockeyAppToken: <mytoken>" \ + #https://rink.hockeyapp.net/api/2/apps/<apptoken>/app_versions + +# Create new version (if not already existing. pull version strings from android project) +# curl \ +# -F "bundle_short_version=0.2.9" \ +# -F "bundle_version=21" \ +# -H "X-HockeyAppToken: <mytoken>" \ +# https://rink.hockeyapp.net/api/2/apps/<apptoken>/app_versions/new
Add old ruby impl as reference
diff --git a/lib/excon/addressable.rb b/lib/excon/addressable.rb index abc1234..def5678 100644 --- a/lib/excon/addressable.rb +++ b/lib/excon/addressable.rb @@ -8,7 +8,15 @@ Excon.defaults[:uri_parser] = Excon::Addressable::Parser +# Excon +# +# We inject the `expand` key to the allowed lists of keys to be used when +# creating a request, or connection object. Excon does not enforce this yet, but +# it does print a warning, so this makes things future-proof. module Excon + VALID_REQUEST_KEYS << :expand + VALID_CONNECTION_KEYS << :expand + module Addressable # Middleware #
Add `expand` to Excon's allowed keys
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -8,6 +8,6 @@ protected def configure_permitted_parameters - devise_parameter_sanitizer.for(:sign_up) << :name + devise_parameter_sanitizer.for(:sign_up) << [:name, :terms_of_use] end end
Add 'terms_of_use' to Devise's permitted params Tell devise to allow the 'terms_of_use' form value to be passed to the model for recrod creation. Devise's parameters are an array so the new allowed values are pushed in as an array as well.
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,6 +2,6 @@ # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception - include Squash::Ruby::ControllerMethods - enable_squash_client + # include Squash::Ruby::ControllerMethods + # enable_squash_client end
Remove squash from app/controller because squash is not set up for the app
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -27,6 +27,8 @@ end def set_expiry(duration) - expires_in duration, public: true unless Rails.env.development? + unless Rails.env.development? + expires_in duration, public: true + end end end
Convert single-line conditional into multi-line I'm about to make the `expires_in` line longer which will make the line very long and in any case I find this code easier to read.
diff --git a/app/controllers/guest_users_controller.rb b/app/controllers/guest_users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/guest_users_controller.rb +++ b/app/controllers/guest_users_controller.rb @@ -4,6 +4,7 @@ end def new + @guest_user = GuestUser.new end def create
Update guest users new action
diff --git a/app/decorators/search_result_decorator.rb b/app/decorators/search_result_decorator.rb index abc1234..def5678 100644 --- a/app/decorators/search_result_decorator.rb +++ b/app/decorators/search_result_decorator.rb @@ -10,22 +10,20 @@ end def title - object.title.sub(site_title_regex, '') + object.title.sub(Regexp.union(title_suffix_regexps), '') end private - def site_title_regex - Regexp.new(site_title_suffixes.join('$|')) - end - - def site_title_suffixes + def title_suffix_regexps title = h.t('layouts.base.title') length = title.length length.times.map do |i| - truncated = i < length -1 - " - #{title[0..i]}" + (truncated ? ' ...' : '') + is_truncated = i < (length - 1) + + Regexp.new(' - %<suffix>s%<ellipsis>s$' % { suffix: title[0..i], + ellipsis: is_truncated ? ' ...' : nil }) end end
Use Regexp.union to process search result titles
diff --git a/app/helpers/shortener/shortener_helper.rb b/app/helpers/shortener/shortener_helper.rb index abc1234..def5678 100644 --- a/app/helpers/shortener/shortener_helper.rb +++ b/app/helpers/shortener/shortener_helper.rb @@ -1,4 +1,5 @@ module Shortener::ShortenerHelper + DEFAULT_HTTP_PORT = 80.freeze # generate a url from a url string def short_url(url, owner: nil, custom_key: nil, expires_at: nil, @@ -11,8 +12,17 @@ meta: meta) if short_url - options = { controller: :"shortener/shortened_urls", action: :show, id: short_url.unique_key, only_path: false }.merge(url_options) - url_for(options) + options = { + controller: 'shortener/shortened_urls', + action: :show, + id: short_url.unique_key, + only_path: false, + host: request.host, + protocol: request.protocol + } + options.merge!({ port: request.port }) unless request.port == DEFAULT_HTTP_PORT + + Rails.application.routes.url_for(options.merge(url_options)) else url end
Fix shortener URL helper namespace
diff --git a/lib/xapian_db/railtie.rb b/lib/xapian_db/railtie.rb index abc1234..def5678 100644 --- a/lib/xapian_db/railtie.rb +++ b/lib/xapian_db/railtie.rb @@ -35,6 +35,7 @@ end config.adapter adapter.to_sym config.writer writer.to_sym + config.language(env_config["language"]) if env_config["language"] end end
Support for language configuration from the config file
diff --git a/vendor/plugins/refinery/lib/refinery/base_presenter.rb b/vendor/plugins/refinery/lib/refinery/base_presenter.rb index abc1234..def5678 100644 --- a/vendor/plugins/refinery/lib/refinery/base_presenter.rb +++ b/vendor/plugins/refinery/lib/refinery/base_presenter.rb @@ -1,7 +1,7 @@ class Refinery::BasePresenter DEFAULT_FIELDS = { - :title => Proc.new { |p| p.model.class.name.titleize }, + :title => Proc.new { |p| p.model.present? ? p.model.class.name.titleize : nil }, :path => Proc.new { |p| p.title }, :browser_title => nil, :meta_description => nil,
Check for presence before titleize because otherwise we get NilClass in the title.
diff --git a/pkg/brew/ripgrep-bin.rb b/pkg/brew/ripgrep-bin.rb index abc1234..def5678 100644 --- a/pkg/brew/ripgrep-bin.rb +++ b/pkg/brew/ripgrep-bin.rb @@ -3,7 +3,7 @@ desc "Search tool like grep and The Silver Searcher." homepage "https://github.com/BurntSushi/ripgrep" url "https://github.com/BurntSushi/ripgrep/releases/download/#{version}/ripgrep-#{version}-x86_64-apple-darwin.tar.gz" - sha256 "efdc64456fc64910c2998b25c402aac2ff17caf1507e8bcca4584b429ef7f7ae" + sha256 "5bfa8872c4f2a5d010ddec1c213d518056e62d4dd3b3f23a0ef099b85343dbdd" conflicts_with "ripgrep"
Fix brew tap sha256 sum. Fixes #407
diff --git a/steam-condenser.gemspec b/steam-condenser.gemspec index abc1234..def5678 100644 --- a/steam-condenser.gemspec +++ b/steam-condenser.gemspec @@ -14,7 +14,7 @@ s.add_dependency 'multi_json', '~> 1.8.0' s.add_dependency 'multi_xml', '~> 0.5.2' - s.add_development_dependency 'mocha', '~> 0.13.0' + s.add_development_dependency 'mocha', '~> 0.14.0' s.add_development_dependency 'rake', '~> 10.1.0' s.add_development_dependency 'shoulda-context', '~> 1.1.1' s.add_development_dependency 'yard', '~> 0.8.0'
Update mocha dependency to 0.14.0
diff --git a/elasticsearch-node.gemspec b/elasticsearch-node.gemspec index abc1234..def5678 100644 --- a/elasticsearch-node.gemspec +++ b/elasticsearch-node.gemspec @@ -3,7 +3,7 @@ require "elasticsearch-node/version" Gem::Specification.new do |s| - s.name = "elsearch-node" + s.name = "elasticsearch-node" s.version = Elsearch::Node::VERSION s.authors = ["Florian Gilcher"] s.email = ["florian.gilcher@asquera.de"]
Use proper name in gemspec [skip ci]
diff --git a/test/active_record/query/limit_test.rb b/test/active_record/query/limit_test.rb index abc1234..def5678 100644 --- a/test/active_record/query/limit_test.rb +++ b/test/active_record/query/limit_test.rb @@ -5,15 +5,41 @@ create_table "ships" do |t| t.string "name", limit: 255 end + + create_table "sailors" do |t| + t.string "name", limit: 255 + t.integer "ship_id", null: false + end + + create_table "arms" do |t| + t.string "name", limit: 255 + t.integer "sailor_id", null: false + end end class Ship < ActiveRecord::Base + has_many :crew, class_name: "Sailor" end - + + class Arm < ActiveRecord::Base + belongs_to :sailor + end + + class Sailor < ActiveRecord::Base + belongs_to :ship + has_many :arms + end + test '::limit' do webmock(:get, "/ships", {limit: 5000}).to_return(body: [{id: 42}].to_json) assert_equal Ship.limit(5000).map(&:id), [42] end + test '::limit with eager loading and joining' do + webmock(:get, "/sailors", { include: ['ship'], limit: 8 }).to_return(body: [{id: 42}].to_json) + assert_equal Sailor.eager_load(:ship).joins(:arms).limit(8).map(&:id), [42] + end + + test '::offset with eager loading' end
Add test for previous commit
diff --git a/steam-condenser.gemspec b/steam-condenser.gemspec index abc1234..def5678 100644 --- a/steam-condenser.gemspec +++ b/steam-condenser.gemspec @@ -12,7 +12,7 @@ s.description = 'A multi-language library for querying the Steam Community, Source, GoldSrc servers and Steam master servers' s.add_dependency 'bzip2-ruby', '~> 0.2.7' - s.add_dependency 'multi_json', '~> 1.6.0' + s.add_dependency 'multi_json', '~> 1.7.2' s.add_dependency 'multi_xml', '~> 0.5.2' s.add_development_dependency 'mocha', '~> 0.13.0'
Update multi_json dependency to 1.7.2
diff --git a/test/dummy/db/schema.rb b/test/dummy/db/schema.rb index abc1234..def5678 100644 --- a/test/dummy/db/schema.rb +++ b/test/dummy/db/schema.rb @@ -0,0 +1,16 @@+# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 0) do + +end
Test suite complains about missing migration in dummy project
diff --git a/Formula/getmail.rb b/Formula/getmail.rb index abc1234..def5678 100644 --- a/Formula/getmail.rb +++ b/Formula/getmail.rb @@ -9,7 +9,7 @@ scripts = %w[ getmail getmail_fetch getmail_maildir getmail_mbox ] libexec.install 'getmailcore' libexec_scripts = libexec.install scripts - bin.install_symlink *libexec_scripts + bin.install_symlink libexec_scripts man1.install Dir['docs/*.1'] end end
Update return values of install and install_symlink These now return an Array of all the target destinations. Previously, if a single argument was passed a single non- Array was returned. This behavior has been changed so that an Array is always returned even for a single argument. Updated the test. Hopefully this won't break any custom code out there.
diff --git a/u2f.gemspec b/u2f.gemspec index abc1234..def5678 100644 --- a/u2f.gemspec +++ b/u2f.gemspec @@ -9,7 +9,7 @@ s.description = 'Library for handling registration and authentication of U2F devices' s.authors = ['Johan Brissmyr', 'Sebastian Wallin'] s.email = ['brissmyr@gmail.com', 'sebastian.wallin@gmail.com'] - s.homepage = 'https://github.com/userbin/ruby-u2f' + s.homepage = 'https://github.com/castle/ruby-u2f' s.license = 'MIT' s.files = Dir['{lib}/**/*'] + ['README.md']
Update gemspec with correct github path
diff --git a/test/minitest_helper.rb b/test/minitest_helper.rb index abc1234..def5678 100644 --- a/test/minitest_helper.rb +++ b/test/minitest_helper.rb @@ -2,6 +2,6 @@ require "minitest/reporters" # for attaching tests to rubymine -MiniTest::Reporters.use! +MiniTest::Reporters.use! if ENV['RUBYMINE'] require 'mocha/setup'
Use MiniTest reporters only if ENV['RUBYMINE'] set
diff --git a/LightRoute.podspec b/LightRoute.podspec index abc1234..def5678 100644 --- a/LightRoute.podspec +++ b/LightRoute.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "LightRoute" - s.version = "2.1.6" + s.version = "2.1.7" s.summary = "LightRoute is easy transition between view controllers and support many popylar arhitectures" s.description = <<-DESC LightRoute is easy transition between view controllers and support many popylar arhitectures. This framework very flow for settings your transition and have userfriendly API.
Update spec to version 2.1.7
diff --git a/PAPasscode.podspec b/PAPasscode.podspec index abc1234..def5678 100644 --- a/PAPasscode.podspec +++ b/PAPasscode.podspec @@ -1,10 +1,10 @@ Pod::Spec.new do |s| s.name = 'PAPasscode' - s.version = '0.0.1' + s.version = '0.1' s.summary = 'A Passcode View Controller for iOS similar to the one in Settings.app' s.homepage = 'https://github.com/dhennessy/PAPasscode' s.authors = { 'Denis Hennessy' => 'denis@hennessynet.com' } - s.source = { :git => 'https://github.com/dhennessy/PAPasscode.git' } + s.source = { :git => 'https://github.com/dhennessy/PAPasscode.git', :tag => '0.1' } s.platform = :ios s.requires_arc = true
Revise podspec to refer to 1st tagged version
diff --git a/tool/cleanup-imports.rb b/tool/cleanup-imports.rb index abc1234..def5678 100644 --- a/tool/cleanup-imports.rb +++ b/tool/cleanup-imports.rb @@ -0,0 +1,23 @@+#!/usr/bin/env ruby + +# You can call this from .git/hooks/pre-commit with +# exec tool/cleanup-imports.rb + +STDERR.puts "Removing unused imports ..." + +output = `rake checkstyle 2>&1` +status = $? + +output.lines.reverse.grep(/: Unused import -/) do |line| + path, lineno, _ = line.split(':', 3) + lineno = Integer(lineno) + + lines = File.readlines path + lines.delete_at(lineno-1) + File.write path, lines.join +end + +unless status.success? + STDERR.puts output + exit status.exitstatus +end
Add tool to cleanup imports as a pre-commit hook
diff --git a/Transition.podspec b/Transition.podspec index abc1234..def5678 100644 --- a/Transition.podspec +++ b/Transition.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Transition' - s.version = '1.0.1' + s.version = '1.1.0' s.summary = 'Easy interactive interruptible custom ViewController transitions.' s.description = <<-DESC
Update podspec for version 1.1.0
diff --git a/kernel/common/errno.rb b/kernel/common/errno.rb index abc1234..def5678 100644 --- a/kernel/common/errno.rb +++ b/kernel/common/errno.rb @@ -15,13 +15,7 @@ exc = Errno::Mapping[err] if exc - msg = FFI::Platform::POSIX.strerror(err) - - if additional - msg << " - " << additional - end - - raise exc.new(msg, err) + raise exc.new(additional, err) else raise "Unknown error: #{FFI::Platform::POSIX.strerror(err)} (#{err})" end
Fix the double strerror() output in the message
diff --git a/app/views/api/v1/places/index.json.rabl b/app/views/api/v1/places/index.json.rabl index abc1234..def5678 100644 --- a/app/views/api/v1/places/index.json.rabl +++ b/app/views/api/v1/places/index.json.rabl @@ -9,5 +9,7 @@ # farm attributes actually, not place attributes. # but included here for map tooltip display attributes :vegetable_products, :animal_products, :beverages - -attributes :type, :user_id, :updated_at +attributes :type, :updated_at +child :ownerships do + attributes :user_id +end
Update user relation in API response.
diff --git a/lib/gitlab_git/blob.rb b/lib/gitlab_git/blob.rb index abc1234..def5678 100644 --- a/lib/gitlab_git/blob.rb +++ b/lib/gitlab_git/blob.rb @@ -13,7 +13,7 @@ end def data - if raw_blob + if raw_blob and raw_blob.respond_to?('data') raw_blob.data else nil
Fix missing "data" method when accesing a Git::Submodule
diff --git a/lib/mixins/nestable.rb b/lib/mixins/nestable.rb index abc1234..def5678 100644 --- a/lib/mixins/nestable.rb +++ b/lib/mixins/nestable.rb @@ -4,7 +4,7 @@ # Setup an accessor for all nested instances. attr_accessor *mapping.keys # Create a nested instance automatically on initialize. - self.define_method(:initialize) do |arguments = nil| + define_method(:initialize) do |arguments = nil| mapping.each do |attribute, klass| self.instance_variable_set "@#{attribute}".to_sym, klass.new end
Call private method define_method correctly.