diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/bash/session.rb b/lib/bash/session.rb index abc1234..def5678 100644 --- a/lib/bash/session.rb +++ b/lib/bash/session.rb @@ -15,15 +15,15 @@ cmd = command.dup cmd << ";" if cmd !~ /[;&]$/ - cmd << " DONTEVERUSETHIS=$?; echo #{@separator} $DONTEVERUSETHIS; echo \"exit $DONTEVERUSETHIS\"|sh" + cmd << %Q{ DONTEVERUSETHIS=$?; echo "\n#{@separator} $DONTEVERUSETHIS"; echo "exit $DONTEVERUSETHIS"|sh} @write.puts(cmd) until exit_status do begin data = @master.read_nonblock(160000) - if data.strip =~ /#{@separator} (\d+)$/ + if data.strip =~ /^#{@separator} (\d+)$/ exit_status = $1 - data = data.gsub!(/#{@separator} (\d+)$/, '') + data = data.gsub!(/^#{@separator} (\d+)$/, '') end callback.call(data) if callback out.puts data if out
Make sure that the separator command starts on a new line * This was causing the output of some commands which didn't have new line at the end to be chopped
diff --git a/chefspec.gemspec b/chefspec.gemspec index abc1234..def5678 100644 --- a/chefspec.gemspec +++ b/chefspec.gemspec @@ -25,6 +25,6 @@ s.add_dependency 'chef', '>= 14' s.add_dependency 'chef-cli' - s.add_dependency 'fauxhai-ng', '>= 6.11' + s.add_dependency 'fauxhai-ng', '>= 7.5' s.add_dependency 'rspec', '~> 3.0' end
Update the fauxhai-ng dep to >= 7.5 This is the first version of the fauxhai-ng gem Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/lib/secret_santa.rb b/lib/secret_santa.rb index abc1234..def5678 100644 --- a/lib/secret_santa.rb +++ b/lib/secret_santa.rb @@ -5,14 +5,14 @@ elsif names.length != names.uniq.length "ERROR: Please enter unique names" else - # shuffle names and create array (currently untested) + # shuffle names and build lists list = [] digraph_list = [] - shuffled_names = names.dup.shuffle! - shuffled_names.each_with_index do |name, i| - list << "#{name} -> #{shuffled_names[i - 1]}" + names.shuffle! + names.each_with_index do |name, i| + list << "#{name} -> #{names[i - 1]}" end - # write the list to a dot file for graphviz + # write the list to a graphviz dot file digraph_list = list.join("; ") digraph = "digraph {#{digraph_list}}\n" File.open('ss_list.dot', 'w') { |f| f.write("#{digraph}") }
Make code and comments more readable
diff --git a/lib/specter/spec.rb b/lib/specter/spec.rb index abc1234..def5678 100644 --- a/lib/specter/spec.rb +++ b/lib/specter/spec.rb @@ -13,12 +13,12 @@ @_block = block end - def run + def prepare scope = Specter.current[:scopes].last - prepares = [] prepares += Specter.current[:prepares] prepares += Specter.current[:scopes].map(&:prepares).flatten + prepares.each do |block| if scope scope.instance_eval(&block) @@ -26,6 +26,10 @@ block.call end end + end + + def run + prepare Specter.preserve block.binding do begin
Move prepare logic to a separate method.
diff --git a/config/initializers/gds-sso.rb b/config/initializers/gds-sso.rb index abc1234..def5678 100644 --- a/config/initializers/gds-sso.rb +++ b/config/initializers/gds-sso.rb @@ -1,8 +1,8 @@ GDS::SSO.config do |config| config.user_model = "User" - config.oauth_id = ENV['PANOPTICON_OAUTH_ID'] - config.oauth_secret = ENV['PANOPTICON_OAUTH_SECRET'] + config.oauth_id = ENV['PANOPTICON_OAUTH_ID'] || "abcdefgh12345678pan" + config.oauth_secret = ENV['PANOPTICON_OAUTH_SECRET'] || "secret" config.oauth_root_url = Plek.current.find("signon") - config.basic_auth_user = ENV['PANOPTICON_USER'] - config.basic_auth_password = ENV['PANOPTICON_PASSWORD'] + config.basic_auth_user = ENV['PANOPTICON_USER'] || "api" + config.basic_auth_password = ENV['PANOPTICON_PASSWORD'] || "defined_on_rollout_not" end
Add a sensible default in ENV not present
diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index abc1234..def5678 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -1,7 +1,15 @@+redis_namespace = + if ENV['CW_FILES_PREFIX'].present? + ENV['CW_FILES_PREFIX'].gsub('/', ':').chomp(':') + else + "climate_watch" + end +redis_namespace += "_#{Rails.env}" + Sidekiq.configure_server do |config| - config.redis = { url: ENV['REDIS_SERVER'], namespace: "climate_watch_#{Rails.env}" } + config.redis = { url: ENV['REDIS_SERVER'], namespace: redis_namespace } end Sidekiq.configure_client do |config| - config.redis = { url: ENV['REDIS_SERVER'], namespace: "climate_watch_#{Rails.env}" } + config.redis = { url: ENV['REDIS_SERVER'], namespace: redis_namespace } end
Use S3 file prefix as base for redis namespace name, to avoid name collisions between staging (env = production) and production (env = production)
diff --git a/Casks/ccleaner.rb b/Casks/ccleaner.rb index abc1234..def5678 100644 --- a/Casks/ccleaner.rb +++ b/Casks/ccleaner.rb @@ -3,8 +3,17 @@ sha256 '464a75b9d038dec0334f70846d5ea68679ff907e57b9ec373331c5da18cb4865' url "http://download.piriform.com/mac/CCMacSetup#{version.sub(%r{^(\d+)\.(\d+).*},'\1\2')}.dmg" + name 'CCleaner' homepage 'http://www.piriform.com/ccleaner' - license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder + license :freemium + tags :vendor => 'Piriform' + + zap :delete => [ + '~/Library/Application Support/CCleaner', + '~/Library/Caches/com.piriform.ccleaner', + '~/Library/Preferences/com.piriform.ccleaner.plist', + '~/Library/Saved Application State/com.piriform.ccleaner.savedState' + ] app 'CCleaner.app' end
Add name, license, vendor and zap for CCleaner.app
diff --git a/Casks/qlgradle.rb b/Casks/qlgradle.rb index abc1234..def5678 100644 --- a/Casks/qlgradle.rb +++ b/Casks/qlgradle.rb @@ -0,0 +1,11 @@+cask :v1 => 'qlgradle' do + version '0.0.1' + sha256 'ea76846953ecfbd180d65167ec31cb7c316030f500a6669cd79857c03b951b63' + + url "https://github.com/Urucas/QLGradle/releases/download/#{version}/QLGradle.qlgenerator.zip" + name 'qlgradle' + homepage 'https://github.com/Urucas/QLGradle' + license :mit + + qlplugin 'QLGradle.qlgenerator' +end
Add QLGradle v0.0.1 (Quicklook plugin to preview. gradle files) Add qlgradle(v0.0.1) Quicklook plugin to preview .gradle files set qlgradle name to lowercase change licence to MIT remove empty lines add newline after sha256 & license change url version, replace 0.0.1 with #{version} remove # from #{version} on url add # in url url with #{version} must be between double quotes to work remove QLGradle.rb add qlgradle.rb (lowercase name)
diff --git a/Casks/texnicle.rb b/Casks/texnicle.rb index abc1234..def5678 100644 --- a/Casks/texnicle.rb +++ b/Casks/texnicle.rb @@ -1,7 +1,7 @@ class Texnicle < Cask - url 'http://www.bobsoft-mac.de/resources/TeXnicle/2.2/TeXnicle.app.2.2.8.zip' + url 'http://www.bobsoft-mac.de/resources/TeXnicle/2.2/TeXnicle.app.2.2.9.zip' homepage 'http://www.bobsoft-mac.de/texnicle/texnicle.html' - version '2.2.8' - sha1 'd39a7142e97e7d0787047b02d821b67343099571' + version '2.2.9' + sha1 '54d8c1f303a20956a70b7fb83c0693a5abbf10a8' link 'TeXnicle.app' end
Update TeXnicle to version 2.2.9
diff --git a/spec/controllers/feedback_controller_spec.rb b/spec/controllers/feedback_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/feedback_controller_spec.rb +++ b/spec/controllers/feedback_controller_spec.rb @@ -7,6 +7,7 @@ before { Site.should_receive(:current).at_least(:once).and_return(current_site) current_site.should_receive(:locale) + current_site.stub(:timezone).and_return("UTC") } context "redirects to the current site's feedback_url if set" do
Fix errors in specs introduced by 2bc7d13f78e
diff --git a/Casks/mikogo.rb b/Casks/mikogo.rb index abc1234..def5678 100644 --- a/Casks/mikogo.rb +++ b/Casks/mikogo.rb @@ -5,7 +5,7 @@ # mikogo4.com is the official download host per the vendor homepage url 'http://download.mikogo4.com/mikogo.dmg' name 'Mikogo' - homepage 'http://www.mikogo.com/' + homepage 'https://www.mikogo.com/' license :gratis # Renamed for clarity: app name is inconsistent with its branding
Fix homepage to use SSL in Mikogo 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/shellissimo.gemspec b/shellissimo.gemspec index abc1234..def5678 100644 --- a/shellissimo.gemspec +++ b/shellissimo.gemspec @@ -18,7 +18,9 @@ gem.has_rdoc = "yard" - gem.add_dependency("yard") - gem.add_dependency("redcarpet") + gem.add_dependency("json") + + gem.add_development_dependency("yard") + gem.add_development_dependency("redcarpet") gem.add_development_dependency("minitest") end
Add json dependency for compatibility with REE-1.8.7
diff --git a/log.gemspec b/log.gemspec index abc1234..def5678 100644 --- a/log.gemspec +++ b/log.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'evt-log' - s.version = '0.5.2.0' + s.version = '0.5.2.1' s.summary = 'Logging to STD IO with levels, tagging, and coloring' s.description = ' '
Package version is increased from 0.5.2.0 to 0.5.2.1
diff --git a/GeoFire.podspec b/GeoFire.podspec index abc1234..def5678 100644 --- a/GeoFire.podspec +++ b/GeoFire.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "GeoFire" - s.version = "2.0.1" + s.version = "3.0.0" s.summary = "Realtime location queries with Firebase." s.homepage = "https://github.com/firebase/geofire-objc" s.license = { :type => 'MIT', :file => 'LICENSE' } @@ -9,7 +9,8 @@ s.source_files = "GeoFire/**/*.{h,m}" s.documentation_url = "https://geofire-ios.firebaseapp.com/docs/" s.ios.deployment_target = '8.0' - s.ios.dependency 'Firebase/Database', '~> 4.0' + s.ios.dependency 'Firebase/Database', '~> 5.0' s.framework = 'CoreLocation' s.requires_arc = true + s.static_framework = true end
Update geofire podspec for Firebase 5
diff --git a/LRMocky.podspec b/LRMocky.podspec index abc1234..def5678 100644 --- a/LRMocky.podspec +++ b/LRMocky.podspec @@ -0,0 +1,30 @@+Pod::Spec.new do |s| + s.name = 'LRMocky' + s.version = '1.0' + s.license = 'MIT' + s.summary = 'A mock object library for Objective C, inspired by JMock 2.0' + s.homepage = 'http://github.com/lukeredpath/LRMocky' + s.authors = { 'Luke Redpath' => 'luke@lukeredpath.co.uk' } + s.source = { :git => 'https://github.com/lukeredpath/LRMocky.git' } + s.requires_arc = true + + # exclude files that are not ARC compatible + source_files = FileList['Classes/**/*.{h,m}'].exclude(/LRMockyAutomation/) + source_files.exclude(/NSInvocation\+(BlockArguments|OCMAdditions).m/) + s.source_files = source_files + + s.public_header_files = FileList['Classes/**/*.h'].exclude(/LRMockyAutomation/) + + # create a sub-spec just for the non-ARC files + s.subspec 'no-arc' do |sp| + sp.source_files = FileList['Classes/LRMocky/Categories/NSInvocation+{BlockArguments,OCMAdditions}.m'] + sp.requires_arc = false + end + + # platform targets + s.ios.deployment_target = '5.0' + s.osx.deployment_target = '10.7' + + # dependencies + s.dependency 'OCHamcrest', '1.9' +end
Update the podspec for the new version.
diff --git a/0_code_wars/6_pile_of_cubes.rb b/0_code_wars/6_pile_of_cubes.rb index abc1234..def5678 100644 --- a/0_code_wars/6_pile_of_cubes.rb +++ b/0_code_wars/6_pile_of_cubes.rb @@ -1,6 +1,5 @@ # http://www.codewars.com/kata/5592e3bd57b64d00f3000047/ # --- iteration 1 --- - def find_nb(m) count = cube_sum = 1 until cube_sum >= m @@ -9,3 +8,17 @@ end cube_sum == m ? count : -1 end + +# --- iteration 2 --- +def find_nb(total_vol) + cube_count = 1 + until total_vol <= 0 + total_vol -= cube_count ** 3 + cube_count += 1 + end + total_vol == 0 ? cube_count-1 : -1 +end + +# sometimes it's good to use a passed in value and subtract from it when you're +# concerned about whether it ends up being 0 etc, instead of instantiating a new +# val like in iteration 1
Add codewars 6 pile of cubes
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,9 +5,12 @@ namespace :admin do resource :dashboard, :only => [:show], :controller => :dashboard - resource :session, :only => [:new, :create, :destroy], :controller => :session - resources :account, :only => [:new, :create, :show, :forgot_password] do - collection { get :forgot_password } + + if Typus.authentication == :session + resource :session, :only => [:new, :create, :destroy], :controller => :session + resources :account, :only => [:new, :create, :show, :forgot_password] do + collection { get :forgot_password } + end end end
Disable session and account resource if needed
diff --git a/Casks/doubletwist.rb b/Casks/doubletwist.rb index abc1234..def5678 100644 --- a/Casks/doubletwist.rb +++ b/Casks/doubletwist.rb @@ -6,7 +6,7 @@ appcast 'http://download.doubletwist.com/mac/appcast.xml', :sha256 => '63ad1487f6e129aa79b9724f9191a52aa1a31ec0c26de63a9d778c1dd709a815' name 'doubleTwist' - homepage 'http://www.doubletwist.com/' + homepage 'https://www.doubletwist.com/' license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder app 'doubleTwist.app'
Fix homepage to use SSL in doubleTwist 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/android-studio-bundle.rb b/Casks/android-studio-bundle.rb index abc1234..def5678 100644 --- a/Casks/android-studio-bundle.rb +++ b/Casks/android-studio-bundle.rb @@ -1,8 +1,8 @@ cask :v1 => 'android-studio-bundle' do - version '0.8.6 build-135.1339820' - sha256 '3a9f65434a2381019f4487481331f539a69b09b8ea81a8b4dfff9c6a126423f0' + version '0.8.14 build-135.1538390' + sha256 '05eb79f0c4025f510ff02d7205157eb94d42074a2d89c8a5ba4cbead1187948f' - url 'https://dl.google.com/android/studio/install/0.8.6/android-studio-bundle-135.1339820-mac.dmg' + url 'https://dl.google.com/dl/android/studio/ide-zips/0.8.14/android-studio-ide-135.1538390-mac.zip' homepage 'http://developer.android.com/sdk/installing/studio.html' license :unknown
Update Android Studio Bundle 0.8.14 build-135.1538390
diff --git a/event_store-client-http.gemspec b/event_store-client-http.gemspec index abc1234..def5678 100644 --- a/event_store-client-http.gemspec +++ b/event_store-client-http.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'event_store-client-http' - s.version = '0.1.7' + s.version = '0.1.8' s.summary = 'HTTP Client for EventStore' s.description = ' '
Package version patch number is increased from 0.1.7 to 0.1.8
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -11,5 +11,5 @@ depends 'chef-vault' -source_url 'https://github.com/opscode-cookbooks/awscreds' if respond_to?(:source_url) -issues_url 'https://github.com/opscode-cookbooks/awscreds/issues' if respond_to?(:issues_url) +source_url 'https://github.com/chef-cookbooks/awscreds' if respond_to?(:source_url) +issues_url 'https://github.com/chef-cookbooks/awscreds/issues' if respond_to?(:issues_url)
Update URLs and add license
diff --git a/ComponentKit.podspec b/ComponentKit.podspec index abc1234..def5678 100644 --- a/ComponentKit.podspec +++ b/ComponentKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "ComponentKit" - s.version = "0.10" + s.version = "0.11" s.summary = "A React-inspired view framework for iOS" s.homepage = "https://componentkit.com" s.authors = 'adamjernst@fb.com'
Increment podspec version to 0.11
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,13 +1,13 @@-# encoding: utf-8 +# frozen_string_literal: true -if RUBY_VERSION > '1.9' and (ENV['COVERAGE'] || ENV['TRAVIS']) +if ENV['COVERAGE'] || ENV['TRAVIS'] require 'simplecov' require 'coveralls' - SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ + SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([ SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter - ] + ]) SimpleCov.start do command_name 'spec'
Change syntax and stop limiting ruby version
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,6 +4,7 @@ Bundler.setup :default, :test Bundler.require :default, :test +$:.push(File.expand_path(File.dirname(__FILE__))) require './lib/mongoid-pagination' Mongoid.database = Mongo::Connection.new.db('mongoid-pagination_test')
Add spec to load path in test env
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,9 +4,9 @@ require 'timecop' def fixture(file) - File.new("#{File.expand_path('../fixtures', __FILE__)}/#{file}") + File.new("#{File.expand_path('../fixtures', __FILE__)}/#{file}").read end def stub_post(url) - stub_request(:post, TradeQueen::Client::BASE_URL + url) + stub_request(:post, TradeQueen::Rest::Client::BASE_URL + url) end
Fix up the spec helpers. - for #fixtuere, don’t just return a file, return the string in the file - for #stub_post, use the right namespace.
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -28,5 +28,8 @@ config.use_transactional_fixtures = false config.before(:suite) { DatabaseCleaner.strategy = :truncation } config.before(:each) { DatabaseCleaner.start } - config.after(:each) { DatabaseCleaner.clean } + config.after(:each) do + DatabaseCleaner.clean + page.driver.reset! + end end
Add page.driver.reset! per after spec
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -3,11 +3,11 @@ require 'rubygems' require 'postmark' -require 'lib/postmark-rails' +require 'postmark-rails' require 'spec' require 'spec/autorun' ActionMailer::Base.delivery_method = :postmark ActionMailer::Base.prepend_view_path(File.join(File.dirname(__FILE__), "fixtures", "views")) -Dir["#{File.dirname(__FILE__)}/fixtures/models/*.rb"].each { |f| require f }+Dir["#{File.dirname(__FILE__)}/fixtures/models/*.rb"].each { |f| require f }
Make specs pass in ruby 1.9 . is no longer in ruby's since 1.9
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,25 @@ $LOAD_PATH << File.join('../lib') require 'proteus' + +def quietly + streams = STDOUT, STDERR + on_hold = streams.collect { |stream| stream.dup } + streams.each do |stream| + stream.reopen(null_stream) + stream.sync = true + end + yield + ensure + streams.each_with_index do |stream, i| + stream.reopen(on_hold[i]) + end +end + +def null_stream + if RUBY_PLATFORM =~ /mswin/ + 'NUL:' + else + '/dev/null' + end +end
Add helper method to silence streams
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -17,11 +17,8 @@ include Quotes before do + clean_database run_migrations - end - - after do - end def call_use_case(domain, use_case, input_hash = nil) @@ -34,6 +31,14 @@ actual = actual.class.name.split('::').last assert_equal expected.to_s, actual + end + + def clean_database + existing_tables = database.tables + tables_to_preserve = [:schema_info, :schema_migrations] + tables_to_be_emptied = existing_tables - tables_to_preserve + + tables_to_be_emptied.each { |table| database << "TRUNCATE #{table}" } end def run_migrations @@ -51,4 +56,4 @@ end -end +end
Truncate database before tests run
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,13 @@ require "rspec" require "mahjong_scoring" +RSpec.configure do |config| + # Use color in STDOUT + config.color_enabled = true + + # Use color not only in STDOUT but also in pagers and files + config.tty = true + + # Use the specified formatter + config.formatter = :progress # :documentation, :progress, :html, :textmate +end
Use RSpec colors by default in this project Some say it should be a ~/.rspec setting. I say it should be the default. Seriously.
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -28,6 +28,7 @@ # Render views in controller tests config.render_views + config.include Devise::TestHelpers, type: :controller config.include EmailSpec::Helpers config.include EmailSpec::Matchers
Include Devise's helpers in controller tests.
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,16 +1,13 @@ require 'pathname' require 'rubygems' - -gem 'rspec', '>1.1.12' -require 'spec' gem 'dm-core', '0.10.0' require 'dm-core' -ROOT = Pathname(__FILE__).dirname.parent.expand_path +ROOT = Pathname(__FILE__).dirname.parent # use local dm-types if running from dm-more directly -lib = ROOT.parent.join('dm-validations', 'lib').expand_path +lib = ROOT.parent / 'dm-validations' / 'lib' $LOAD_PATH.unshift(lib) if lib.directory? begin @@ -19,7 +16,7 @@ # do nothing end -require ROOT + 'lib/dm-timestamps' +require ROOT / 'lib' / 'dm-timestamps' def load_driver(name, default_uri) return false if ENV['ADAPTER'] != name.to_s
[dm-more] Remove rubygems usage from libraries * No longer require dm-core inside the plugins. Expected usage is to require dm-core prior to requiring the plugin. * Updated pathname creation to using Pathname#/ where possible
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,8 @@+require 'simplecov' +SimpleCov.start do + enable_coverage :branch +end + require 'puppet-lint' PuppetLint::Plugins.load_spec_helper
Enable simplecov and turn on branch coverage New from ruby 2.5 - shows coverage of if / else for example
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,7 +8,7 @@ [SimpleCov::Formatter::LcovFormatter, SimpleCov::Formatter::HTMLFormatter] ) SimpleCov.start do - add_filter(/^\/spec\//) + add_filter(%r{/spec/}) end RSpec.configure do |config|
Use %r around regular expression
diff --git a/lib/cms/resource.rb b/lib/cms/resource.rb index abc1234..def5678 100644 --- a/lib/cms/resource.rb +++ b/lib/cms/resource.rb @@ -5,15 +5,13 @@ attr_accessor :attributes_for_index, :attributes_for_form def attributes_for_index - @attributes_for_index ||= self.collect_attributes.reject do |a| - %w(created_at updated_at).include?(a) - end + @attributes_for_index ||= self.collect_attributes + .except(:created_at, :updated_at) end def attributes_for_form - @attributes_for_form ||= self.collect_attributes.reject do |a| - %w(id created_at updated_at).include?(a) - end + @attributes_for_form ||= self.collect_attributes + .except(:id, :created_at, :updated_at) end def collect_attributes
Fix attributes_for_index and attributes_for_form rejected attributes
diff --git a/support/base_mock.rb b/support/base_mock.rb index abc1234..def5678 100644 --- a/support/base_mock.rb +++ b/support/base_mock.rb @@ -1,19 +1,19 @@ module RescueGroups class BaseMock class << self - def single_success + def find mocked_class.new(test_hash) end - def multiple_success + def where [single_success] end - def single_error + def find_not_found fail "Unable to find #{ self.class.name }" end - def multiple_error + def where_not_found [] end end
Rename mocked methods to match actual methods
diff --git a/newrelic-faraday.gemspec b/newrelic-faraday.gemspec index abc1234..def5678 100644 --- a/newrelic-faraday.gemspec +++ b/newrelic-faraday.gemspec @@ -18,7 +18,7 @@ spec.test_files = spec.files.grep(/^(test|spec|features)\//) spec.require_paths = ['lib'] - spec.add_dependency 'faraday', '>= 0.6', '< 0.10' + spec.add_dependency 'faraday', '>= 0.6', '< 1.0.0' spec.add_dependency 'newrelic_rpm', '~> 3.0' spec.add_development_dependency 'rake'
Add support for `faraday` 0.10.x This relaxes the version constraint to allow support for `faraday` version 0.10.x which was recently released.
diff --git a/lib/irb/rubinius.rb b/lib/irb/rubinius.rb index abc1234..def5678 100644 --- a/lib/irb/rubinius.rb +++ b/lib/irb/rubinius.rb @@ -18,17 +18,19 @@ continue = true bt.frames.each do |frame| next unless continue - if %r!kernel/core/eval.rb!.match(frame.last) + recv = frame.describe + loc = frame.location + if %r!kernel/core/eval.rb!.match(loc) continue = false next end - if %r!main.irb_binding!.match(frame.first) - puts " from #{frame[1]}" + if %r!main.irb_binding!.match(recv) + puts " from #{recv}" break end - puts " from #{frame[0]} at #{frame[1]}" + puts " from #{recv} at #{loc}" end end end
Fix IRB to work with new backtrace frame content
diff --git a/lib/stacked/user.rb b/lib/stacked/user.rb index abc1234..def5678 100644 --- a/lib/stacked/user.rb +++ b/lib/stacked/user.rb @@ -37,12 +37,12 @@ end end - def questions - parse_questions(request(singular(id) + "questions")) + def questions(options={}) + parse_questions(request(singular(id) + "questions", options)) end - def favorites - parse_questions(request(singular(id) + "favorites")) + def favorites(options={}) + parse_questions(request(singular(id) + "favorites", options)) end private
Add options to questions and favorites.
diff --git a/lib/tasks/alma.rake b/lib/tasks/alma.rake index abc1234..def5678 100644 --- a/lib/tasks/alma.rake +++ b/lib/tasks/alma.rake @@ -14,15 +14,11 @@ end def read_key - keys = `lpass show Shared-ITIMS-Passwords/alma/AlmaKeys --notes` - keys = build_hash(keys) - keys["production_read_only"].split(" ").first + `lpass show Shared-ITIMS-Passwords/alma/api-key-production-read-only --notes` end def region_key - keys = `lpass show Shared-ITIMS-Passwords/alma/AlmaKeys --notes` - keys = build_hash(keys) - keys["alma_region"].split(" ").first + `lpass show Shared-ITIMS-Passwords/alma/alma_region --notes` end def build_sftp_credentials_hash
Use individual lastpass entries for each key Since the larger one was edited in a way that broke our rake task
diff --git a/lib/thyme/server.rb b/lib/thyme/server.rb index abc1234..def5678 100644 --- a/lib/thyme/server.rb +++ b/lib/thyme/server.rb @@ -3,7 +3,7 @@ module Thyme class Server < Sinatra::Base - set :views, File.expand_path('views') + set :root, File.expand_path('.') get '/set/?' do @sets = Set.all(order: [:taken_at.desc])
Set root path instead of views
diff --git a/brewery_db.gemspec b/brewery_db.gemspec index abc1234..def5678 100644 --- a/brewery_db.gemspec +++ b/brewery_db.gemspec @@ -5,7 +5,7 @@ gem.version = BreweryDB::VERSION gem.summary = 'A Ruby library for using the BreweryDB API.' gem.homepage = 'http://github.com/tylerhunt/brewery_db' - gem.author = 'Tyler Hunt' + gem.authors = ['Tyler Hunt', 'Steven Harman'] gem.required_ruby_version = '>= 1.9'
Add myself to the authors list. :)
diff --git a/Formula/git-ps-rs.rb b/Formula/git-ps-rs.rb index abc1234..def5678 100644 --- a/Formula/git-ps-rs.rb +++ b/Formula/git-ps-rs.rb @@ -10,10 +10,12 @@ def install system "cargo", "install", *std_cargo_args - # Completion scripts and manpage are generated in the crate's build + # Completion scripts are generated in the crate's build # directory, which includes a fingerprint hash. Try to locate it first out_dir = Dir["target/release/build/gps-*/out"].first - # man1.install "#{out_dir}/gps.1" + # man1.install "doc/gps-add.1" + # exmaple of installing multiple man pages + # man1.install "doc/gps-add.1", "doc/gps.1" bash_completion.install "#{out_dir}/gps.bash" zsh_completion.install "#{out_dir}/_gps" end
Add notes around man page installation Add notes around man page installation so that when I cut the next release and include the man pages I remember how to add them to the install process. ps-id: 343a9c68-ac28-4f8a-813f-0850c67698d0
diff --git a/frontend/spree_frontend.gemspec b/frontend/spree_frontend.gemspec index abc1234..def5678 100644 --- a/frontend/spree_frontend.gemspec +++ b/frontend/spree_frontend.gemspec @@ -23,7 +23,6 @@ s.add_dependency 'canonical-rails', '~> 0.0.4' s.add_dependency 'jquery-rails', '~> 3.1.2' - s.add_dependency 'stringex', '~> 1.5.1' s.add_development_dependency 'capybara-accessible' end
Remove stringex from frontend gemspec its in core already.
diff --git a/core/models/post.rb b/core/models/post.rb index abc1234..def5678 100644 --- a/core/models/post.rb +++ b/core/models/post.rb @@ -1,4 +1,4 @@ class Post < Sequel::Model - one_to_one :author + many_to_one :author many_to_many :categories end
Fix issue where Post has wrong association type. Was many_to_many. Is now many_to_one.
diff --git a/cpp_samples.gemspec b/cpp_samples.gemspec index abc1234..def5678 100644 --- a/cpp_samples.gemspec +++ b/cpp_samples.gemspec @@ -20,4 +20,6 @@ spec.add_development_dependency "bundler", "~> 1.7" spec.add_development_dependency "rake", "~> 10.0" + + spec.add_dependency "liquid", "~> 3.0.0" end
Add dependency on liquid template library
diff --git a/ncsa-parser.gemspec b/ncsa-parser.gemspec index abc1234..def5678 100644 --- a/ncsa-parser.gemspec +++ b/ncsa-parser.gemspec @@ -20,8 +20,8 @@ s.homepage = "http://github.com/dark-panda/ncsa-parser" s.require_paths = ["lib"] - s.add_dependency("rdoc") - s.add_dependency("rake", ["~> 0.9"]) - s.add_dependency("minitest") - s.add_dependency("turn") + s.add_development_dependency("rdoc") + s.add_development_dependency("rake", ["~> 0.9"]) + s.add_development_dependency("minitest") + s.add_development_dependency("turn") end
Make these gems into development dependencies.
diff --git a/lib/generators/seo_landing_pages_generator.rb b/lib/generators/seo_landing_pages_generator.rb index abc1234..def5678 100644 --- a/lib/generators/seo_landing_pages_generator.rb +++ b/lib/generators/seo_landing_pages_generator.rb @@ -4,6 +4,8 @@ source_root File.expand_path('../templates', __FILE__) #TODO all the methods run now, turn them into options, as Thor intended :-) + + # Public: copies the migration. def migration migration_template 'migration.rb', 'db/migrate/create_seo_landing_pages.rb' end
Comment added to the generator
diff --git a/test/mp4_file_test.rb b/test/mp4_file_test.rb index abc1234..def5678 100644 --- a/test/mp4_file_test.rb +++ b/test/mp4_file_test.rb @@ -4,12 +4,18 @@ context "TagLib::MP4::File" do setup do @file = TagLib::MP4::File.new("test/data/mp4.m4a") + @tag = @file.tag end - should "have a tag" do - tag = @file.tag - assert_not_nil tag - assert_equal TagLib::Tag, tag.class + should "contain basic tag information" do + assert_equal "Title", @tag.title + assert_equal "Artist", @tag.artist + assert_equal "Album", @tag.album + assert_equal "Comment", @tag.comment + assert_equal "Pop", @tag.genre + assert_equal 2011, @tag.year + assert_equal 7, @tag.track + assert_equal false, @tag.empty? end teardown do
Test for basic tag information
diff --git a/spec/unit/control/retry_spec.rb b/spec/unit/control/retry_spec.rb index abc1234..def5678 100644 --- a/spec/unit/control/retry_spec.rb +++ b/spec/unit/control/retry_spec.rb @@ -0,0 +1,35 @@+require "rdg/control/retry" + +module RDG + module Control + describe Retry do + let(:graph) { spy("graph") } + let(:rescue_ast) { FakeAst.new(:rescue, children: [:first, :second]) } + let(:ast) { FakeAst.new(:retry, ancestors: [rescue_ast]) } + subject { Retry.new(ast, graph) } + + before(:each) do + allow(graph).to receive(:each_successor).and_yield(:successor) + end + + it "should remove any edges to existing successors" do + subject.analyse + + expect(graph).to have_received(:remove_edge).with(ast, :successor) + end + + it "should add an edge to the first child of the rescue" do + subject.analyse + + expect(graph).to have_received(:add_edge).with(ast, :first) + end + + it "should do nothing when not contained within a rescuable block" do + ast.ancestors = [] + subject.analyse + + expect(graph).not_to have_received(:add_edge) + end + end + end +end
Add unit tests for retry analyser.
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,5 +1,10 @@ module ApplicationHelper include GravatarHelper + + # 'shy;' is the HTML entity for a soft hyphen + def hypenate(string) + string.gsub('-', '&shy;').html_safe + end def shorter_url(url, length) s = url.gsub(%r(http[s]?://(www\.)?), '') @@ -28,7 +33,7 @@ '?' end end - + def url_only(url, length) url.present? ? link_to(shorter_url(url, length), url) : '?' end
Add helper for soft hyphenation
diff --git a/app/models/rglossa/corpus_text.rb b/app/models/rglossa/corpus_text.rb index abc1234..def5678 100644 --- a/app/models/rglossa/corpus_text.rb +++ b/app/models/rglossa/corpus_text.rb @@ -3,16 +3,18 @@ has_and_belongs_to_many :metadata_values class << self - # Returns all corpus texts that are associated with the metadata values - # that have the given database ids - def matching_metadata(metadata_value_ids) - CorpusText - .select('corpus_texts.startpos, corpus_texts.endpos').uniq - .joins('INNER JOIN corpus_texts_metadata_values ON ' + - 'corpus_texts_metadata_values.corpus_text_id = corpus_texts.id') - .where( - corpus_texts_metadata_values: { metadata_value_id: metadata_value_ids } - ) + + # Returns all corpus texts that are associated with the metadata values + # that have the given database ids + def matching_metadata(metadata_value_ids) + CorpusText + .select('startpos, endpos').uniq + .joins('INNER JOIN rglossa_corpus_texts_metadata_values j ON ' + + 'j.rglossa_corpus_text_id = rglossa_corpus_texts.id') + .where(j: { rglossa_metadata_value_id: metadata_value_ids }) + end + end + end end
Fix database table names in SQL query
diff --git a/app/models/service_status_type.rb b/app/models/service_status_type.rb index abc1234..def5678 100644 --- a/app/models/service_status_type.rb +++ b/app/models/service_status_type.rb @@ -20,13 +20,4 @@ as_json(options) end - # for bulk updates - def self.schema_structure - { - "enum": ServiceStatusType.all.pluck(:name), - "tuple": ServiceStatusType.all.map{ |x| {"id": x.id, "val": x.name} }, - "type": "string" - } - end - end
Revert "[Bulk Updates] Support Asset Lifecycle Events - Mileage, Condition, Service Status" This reverts commit 3abbec60
diff --git a/plugins/guests/redhat/cap/change_host_name.rb b/plugins/guests/redhat/cap/change_host_name.rb index abc1234..def5678 100644 --- a/plugins/guests/redhat/cap/change_host_name.rb +++ b/plugins/guests/redhat/cap/change_host_name.rb @@ -29,10 +29,10 @@ } # Restart network - if test -f /etc/init.d/network; then + if (test -f /usr/bin/systemctl && systemctl -q is-active NetworkManager.service); then + systemctl restart NetworkManager.service + elif test -f /etc/init.d/network; then service network restart - elif systemctl -q is-enabled NetworkManager.service; then - systemctl restart NetworkManager.service else printf "Could not restart the network to set the new hostname!\n" fi
Switch if statements, check for systemctl, and switch to is-active.
diff --git a/dckerize.gemspec b/dckerize.gemspec index abc1234..def5678 100644 --- a/dckerize.gemspec +++ b/dckerize.gemspec @@ -18,7 +18,7 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib", "templates"] - spec.add_development_dependency "bundler", "~> 1.8" + spec.add_development_dependency "bundler", "~> 1.7" spec.add_development_dependency "rake", "~> 10.0" spec.add_development_dependency "rspec" end
Allow lower bundler version for travis
diff --git a/lib/night_watch/ref_resolver.rb b/lib/night_watch/ref_resolver.rb index abc1234..def5678 100644 --- a/lib/night_watch/ref_resolver.rb +++ b/lib/night_watch/ref_resolver.rb @@ -21,7 +21,7 @@ attr_reader :repos, :repo_name def all_parent_commits_for(ref) - in_workspace { sh("git show #{ref}^@ --quiet --pretty=format:%H", true).lines.map(&:chomp) } + in_workspace { sh("git show #{ref}^@ -s --format=format:%H", true).lines.map(&:chomp) } end def merge_base_of(refs)
Use -s instead --quiet to supress diffs from git show in the RefResolver
diff --git a/Casks/scansnap-manager-ix500.rb b/Casks/scansnap-manager-ix500.rb index abc1234..def5678 100644 --- a/Casks/scansnap-manager-ix500.rb +++ b/Casks/scansnap-manager-ix500.rb @@ -0,0 +1,17 @@+cask :v1 => 'scansnap-manager-ix500' do + version :latest + sha256 :no_check + + # pfultd.com is the official download host per the vendor homepage + url 'http://origin.pfultd.com/downloads/IMAGE/driver/ss/mgr/m-ix500/ScanSnap.dmg' + name 'ScanSnap Manager for Fujitsu ScanSnap iX500' + homepage 'https://www.fujitsu.com/global/support/products/computing/peripheral/scanners/scansnap/software/ix500.html' + license :gratis + tags :vendor => 'YourKit' + + pkg 'ScanSnap Manager.pkg' + + uninstall :pkgutil => 'jp.co.pfu.ScanSnap.*' + + depends_on :macos => '>= :lion' +end
Add ScanSnap Manager for Fujitsu ScanSnap iX500.
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -6,6 +6,10 @@ class People < ActiveRecord::Base end +get '/' do + send_file 'index.html' +end + get '/people' do People.all.to_json end
Load the HTML file through Sinatra. This allows ajax to work. :)
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -24,8 +24,8 @@ 'geometry' => { 'type' => 'Point', 'coordinates' => [ - match['Y'], - match['X'] + match['X'].to_f, + match['Y'].to_f ] }, 'properties' => {
Change returned values to valid geojson
diff --git a/recipes/textmate.rb b/recipes/textmate.rb index abc1234..def5678 100644 --- a/recipes/textmate.rb +++ b/recipes/textmate.rb @@ -1,9 +1,18 @@ include_recipe "pivotal_workstation::user_owns_usr_local" +node.default["textmate"]["url"] = "http://dl.macromates.com/TextMate_1.5.10_r1631.zip" +node.default["textmate"]["shasum"] = "325f061fb19f87ea61df672df619065ea34e2c88fba30c84635368ea0a40c406" + unless File.exists?("/Applications/TextMate.app") - execute "download text mate to temp dir" do - command "curl -L -o #{Chef::Config[:file_cache_path]}/textmate.zip http://download.macromates.com/TextMate_1.5.10.zip" - user WS_USER + directory Chef::Config[:file_cache_path] do + action :create + recursive true + end + + remote_file "#{Chef::Config[:file_cache_path]}/textmate.zip" do + source node["textmate"]["url"] + checksum node["textmate"]["shasum"] + owner WS_USER end execute "extract text mate to /Applications" do
Use remote_file instead of curl and use a checksum to make sure we get what we expect. Update URL to match redirect and put into node defaults.
diff --git a/resources/config.rb b/resources/config.rb index abc1234..def5678 100644 --- a/resources/config.rb +++ b/resources/config.rb @@ -20,7 +20,7 @@ include Opscode::IIS::Helper include Opscode::IIS::Processors -property :cfg_cmd, String, name_attribute: true +property :cfg_cmd, String, name_property: true property :returns, [Integer, Array], default: 0 default_action :set
Resolve the new FC118 foodcritic warning Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/rmb_chinese_yuan.gemspec b/rmb_chinese_yuan.gemspec index abc1234..def5678 100644 --- a/rmb_chinese_yuan.gemspec +++ b/rmb_chinese_yuan.gemspec @@ -19,6 +19,7 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] + spec.required_ruby_version = '>= 2.0.0' spec.add_development_dependency "bundler", "~> 1.10" spec.add_development_dependency "rake", "~> 10.0" spec.add_development_dependency "minitest"
Add ruby required version in gemspec
diff --git a/robot_name/robot_name.rb b/robot_name/robot_name.rb index abc1234..def5678 100644 --- a/robot_name/robot_name.rb +++ b/robot_name/robot_name.rb @@ -16,6 +16,8 @@ @name = generate_name end + # TODO Move error handling out of initilize. It really belongs + # in the generate_name method. check_name_format check_name_collision @@registry << @name
Add TODO next step for error handling
diff --git a/config/environments/production.rb b/config/environments/production.rb index abc1234..def5678 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -24,6 +24,6 @@ # config.action_mailer.raise_delivery_errors = false ActionMailer::Base.smtp_settings = { - :address => 'outbox.allstream.net', - :domain => 'campusplus.com' + :address => 'theorem.ca', + :domain => 'theorem.ca' }
Change SMTP server for theorem.
diff --git a/app/api/v1/register_controller.rb b/app/api/v1/register_controller.rb index abc1234..def5678 100644 --- a/app/api/v1/register_controller.rb +++ b/app/api/v1/register_controller.rb @@ -1,14 +1,12 @@ class API::V1::RegisterController < Grape::API resource :register do - before do - redirect '/' if authenticated? - end - desc 'GET /api/v1/register/new' params do end get '/new' do - + { + account_schema: GlobalSetting.get(:account_schema) + } end desc 'POST /api/v1/register/validate' @@ -29,14 +27,16 @@ end post '/' do account = Account.create( - name: params[:name], - email: params[:email], - password: params[:password], - password_confirmation: params[:password_confirmation], - payload: params[:payload] - ) - authenticate(account) - account + name: params[:name], + email: params[:email], + password: params[:password], + password_confirmation: params[:password_confirmation], + payload: params[:payload] + ) + authenticate!(account) + { + account: account + } end end
Create registlation spec and initial data
diff --git a/config/initializers/repository.rb b/config/initializers/repository.rb index abc1234..def5678 100644 --- a/config/initializers/repository.rb +++ b/config/initializers/repository.rb @@ -0,0 +1,12 @@+# encoding: utf-8 +require_relative '../../app/models/visualization/collection' +require_relative '../../app/models/overlay/collection' +require_relative '../../services/data-repository/backend/sequel' + +CartoDB::Visualization.repository ||= + DataRepository::Backend::Sequel + .new(Rails::Sequel.connection, :visualizations) +CartoDB::Overlay.repository ||= + DataRepository::Backend::Sequel + .new(Rails::Sequel.connection, :overlays) +
Add initializer for Visualization and Overlay repositories
diff --git a/script/cruise_build.rb b/script/cruise_build.rb index abc1234..def5678 100644 --- a/script/cruise_build.rb +++ b/script/cruise_build.rb @@ -1,7 +1,6 @@ #!/usr/bin/env ruby -# Yes, this could be more abstracted, etc. Choosing explicitness for now. -# svn co and rake co need to be in same exec, or cruise just ends build after svn returns +# The svn:externals is a bit of a hack, but seems like the easiest solution to pulling in different projects # # Intentionally doing svn co and rake cruise in separate processes to ensure that all of the # local overrides are loaded by Rake. @@ -11,14 +10,8 @@ case project_name when "racing_on_rails" exec("rake cruise") -when "aba" - exec("svn co svn+ssh://cruise@butlerpress.com/var/repos/aba/trunk local && rake cruise") -when "atra" - exec('svn propset "svn:externals" "local svn+ssh://butlerpress.com/var/repos/atra/trunk" . && rake cruise') -when "obra" - exec("svn co svn+ssh://cruise@butlerpress.com/var/repos/obra/trunk local && rake cruise") -when "wsba" - exec("svn co svn+ssh://cruise@butlerpress.com/var/repos/wsba/trunk local && rake cruise") +when "aba", "atra", "obra", "wsba" + exec(%Q{svn propset "svn:externals" "local svn+ssh://butlerpress.com/var/repos/#{project}/trunk" . && rake cruise}) else raise "Don't know how to build project named: '#{project_name}'" end
Enable cc.rb semi-hack for all projects
diff --git a/db/default/zones.rb b/db/default/zones.rb index abc1234..def5678 100644 --- a/db/default/zones.rb +++ b/db/default/zones.rb @@ -1,15 +1,19 @@-eu_vat = Spree::Zone.create!(name: "EU_VAT", description: "Countries that make up the EU VAT zone.") -north_america = Spree::Zone.create!(name: "North America", description: "USA + Canada") +unless Spree::Zone.find_by(name: "EU_VAT") + eu_vat = Spree::Zone.create!(name: "EU_VAT", description: "Countries that make up the EU VAT zone.") -["Poland", "Finland", "Portugal", "Romania", "Germany", "France", - "Slovakia", "Hungary", "Slovenia", "Ireland", "Austria", "Spain", - "Italy", "Belgium", "Sweden", "Latvia", "Bulgaria", "United Kingdom", - "Lithuania", "Cyprus", "Luxembourg", "Malta", "Denmark", "Netherlands", - "Estonia"]. -each do |name| - eu_vat.zone_members.create!(zoneable: Spree::Country.find_by!(name: name)) + ["Poland", "Finland", "Portugal", "Romania", "Germany", "France", + "Slovakia", "Hungary", "Slovenia", "Ireland", "Austria", "Spain", + "Italy", "Belgium", "Sweden", "Latvia", "Bulgaria", "United Kingdom", + "Lithuania", "Cyprus", "Luxembourg", "Malta", "Denmark", "Netherlands", + "Estonia"].each do |name| + eu_vat.zone_members.create!(zoneable: Spree::Country.find_by!(name: name)) + end end -["United States", "Canada"].each do |name| - north_america.zone_members.create!(zoneable: Spree::Country.find_by!(name: name)) +unless Spree::Zone.find_by(name: "North America") + north_america = Spree::Zone.create!(name: "North America", description: "USA + Canada") + + ["United States", "Canada"].each do |name| + north_america.zone_members.create!(zoneable: Spree::Country.find_by!(name: name)) + end end
Make loading of Zones in db:seed idempotent (and avoid fatal errors if run twice)
diff --git a/config/initializers/mysql_ignore_postgresql_options.rb b/config/initializers/mysql_ignore_postgresql_options.rb index abc1234..def5678 100644 --- a/config/initializers/mysql_ignore_postgresql_options.rb +++ b/config/initializers/mysql_ignore_postgresql_options.rb @@ -0,0 +1,49 @@+# This patches ActiveRecord so indexes created using the MySQL adapter ignore +# any PostgreSQL specific options (e.g. `using: :gin`). +# +# These patches do the following for MySQL: +# +# 1. Indexes created using the :opclasses option are ignored (as they serve no +# purpose on MySQL). +# 2. When creating an index with `using: :gin` the `using` option is discarded +# as :gin is not a valid value for MySQL. +# 3. The `:opclasses` option is stripped from add_index_options in case it's +# used anywhere other than in the add_index methods. + +if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter) + module ActiveRecord + module ConnectionAdapters + class Mysql2Adapter < AbstractMysqlAdapter + alias_method :__gitlab_add_index, :add_index + alias_method :__gitlab_add_index_sql, :add_index_sql + alias_method :__gitlab_add_index_options, :add_index_options + + def add_index(table_name, column_name, options = {}) + unless options[:opclasses] + __gitlab_add_index(table_name, column_name, options) + end + end + + def add_index_sql(table_name, column_name, options = {}) + unless options[:opclasses] + __gitlab_add_index_sql(table_name, column_name, options) + end + end + + def add_index_options(table_name, column_name, options = {}) + if options[:using] and options[:using] == :gin + options = options.dup + options.delete(:using) + end + + if options[:opclasses] + options = options.dup + options.delete(:opclasses) + end + + __gitlab_add_index_options(table_name, column_name, options) + end + end + end + end +end
Patch MySQL to ignore PostgreSQL schema options This ensures that options such as `using: :gin` and PostgreSQL operator classes are ignored when loading a schema into a MySQL database.
diff --git a/test/test_adapters/rails_3.rb b/test/test_adapters/rails_3.rb index abc1234..def5678 100644 --- a/test/test_adapters/rails_3.rb +++ b/test/test_adapters/rails_3.rb @@ -1,28 +1,32 @@ require 'test_helper' -require "rails" +require 'rails/all' require 'rack/test' + +Bundler.require module TestRailsAdapter include ::Rack::Test::Methods - APP = Class.new(Rails::Application).tap do |app| - app.config.secret_token = "3b7cd727ee24e8444053437c36cc66c4" - app.config.session_store :cookie_store, :key => "_myapp_session" - app.config.active_support.deprecation = :log - app.routes.draw do + class Application < Rails::Application + config.secret_token = "3b7cd727ee24e8444053437c36cc66c4" + config.session_store :cookie_store, :key => "_myapp_session" + config.active_support.deprecation = :log + config.i18n.default_locale = :en + routes.draw do match "/" => "rails_test/tests#index" match "/foo/:id" => "rails_test/tests#show", :as => 'foo' filter :uuid, :pagination ,:locale, :extension end - app.initialize! end def app - APP + ::Rails.application end def response last_response end end + +TestRailsAdapter::Application.initialize!
Test application that gets initialized with rails 3.1/3.2
diff --git a/administrate-field-json.gemspec b/administrate-field-json.gemspec index abc1234..def5678 100644 --- a/administrate-field-json.gemspec +++ b/administrate-field-json.gemspec @@ -15,5 +15,5 @@ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") gem.add_dependency "administrate", "~> 0.3" - gem.add_dependency "rails", ">= 4.2", "< 5.1" + gem.add_dependency "rails", ">= 4.2", "< 5.3" end
Add support for Rails 5.2
diff --git a/bnr-webhooks.gemspec b/bnr-webhooks.gemspec index abc1234..def5678 100644 --- a/bnr-webhooks.gemspec +++ b/bnr-webhooks.gemspec @@ -18,8 +18,8 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_dependency "activesupport", "~> 3.0" - spec.add_dependency "actionpack", "~> 3.0" + spec.add_dependency "activesupport", "~> 4.0" + spec.add_dependency "actionpack", "~> 4.0" spec.add_development_dependency "bundler", "~> 1.7" spec.add_development_dependency "rake", "~> 10.0"
Use Rails 4 compatible gems
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index abc1234..def5678 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -18,10 +18,8 @@ end it "should update the avatar" do - subject.update_attributes( - avatar: File.open("spec/fixtures/avatar.gif") - ) - + avatar_path = Rails.root.join("spec/fixtures/avatar.gif") + subject.update_attributes(avatar: File.open(avatar_path)) subject.avatar.should be_present end end
Make the path to fixture files absolute
diff --git a/spec/permissions_spec.rb b/spec/permissions_spec.rb index abc1234..def5678 100644 --- a/spec/permissions_spec.rb +++ b/spec/permissions_spec.rb @@ -36,8 +36,10 @@ insist p.can?(:show, SomeClass) end + it "should verify permissions against model instances" + describe "#scoped_model" do - it "should return a properly scoped model" do + it "should allow scopes to be defined through lambdas" do model = mock model.should_receive(:some_scope).and_return(scoped_model = mock) @@ -47,6 +49,8 @@ p.scoped_model(:view, model).should == scoped_model end + + it "should allow scopes to be defined through where conditions" end end end
Add some more pending specs
diff --git a/spec/support/coverage.rb b/spec/support/coverage.rb index abc1234..def5678 100644 --- a/spec/support/coverage.rb +++ b/spec/support/coverage.rb @@ -9,4 +9,5 @@ if ENV['CI'] require 'codecov' SimpleCov.formatter = SimpleCov::Formatter::Codecov + Codecov.pass_ci_if_error = true end
Build should succeed even when Simplecov fails
diff --git a/app/controllers/bookmarks_controller.rb b/app/controllers/bookmarks_controller.rb index abc1234..def5678 100644 --- a/app/controllers/bookmarks_controller.rb +++ b/app/controllers/bookmarks_controller.rb @@ -1,13 +1,21 @@ class BookmarksController < ApplicationController get '/bookmarks' do - @bookmarks = Bookmark.all - erb :'/bookmarks/index' + if logged_in? + @bookmarks = Bookmark.all + erb :'/bookmarks/index' + else + redirect '/login' + end end get '/bookmarks/new' do - @bookmark = Bookmark.new - erb :'/bookmarks/new' + if logged_in? + @bookmark = Bookmark.new + erb :'/bookmarks/new' + else + redirect '/login' + end end post '/bookmarks/new' do @@ -21,8 +29,12 @@ end get '/bookmarks/:id' do - @bookmark = Bookmark.find_by_id(params[:id]) - erb :'/bookmarks/show' + if logged_in? + @bookmark = Bookmark.find_by_id(params[:id]) + erb :'/bookmarks/show' + else + redirect '/login' + end end get '/bookmarks/:id/edit' do
Verify user is logged in to view and create new bookmark
diff --git a/app/controllers/operators_controller.rb b/app/controllers/operators_controller.rb index abc1234..def5678 100644 --- a/app/controllers/operators_controller.rb +++ b/app/controllers/operators_controller.rb @@ -1,4 +1,7 @@ class OperatorsController < ApplicationController + + skip_before_filter :make_cachable + before_filter :long_cache def show @operator = Operator.find(params[:id])
Put longer cache time on operator pages.
diff --git a/app/helpers/valuators_helper.rb b/app/helpers/valuators_helper.rb index abc1234..def5678 100644 --- a/app/helpers/valuators_helper.rb +++ b/app/helpers/valuators_helper.rb @@ -4,8 +4,9 @@ end def valuator_abilities(valuator) - [valuator.can_comment ? I18n.t("admin.valuators.index.can_comment") : nil, - valuator.can_edit_dossier ? I18n.t("admin.valuators.index.can_edit_dossier") : nil - ].compact.join(", ") + %w[can_comment can_edit_dossier] + .select { |permission| valuator.send("#{permission}?") } + .map { |permission| I18n.t("admin.valuators.index.#{permission}") } + .join(", ") end end
Refactor method to display valuator abilities Using `select` is easier to follow than adding `nil` to an array and then using `compact`.
diff --git a/app/admin/entry.rb b/app/admin/entry.rb index abc1234..def5678 100644 --- a/app/admin/entry.rb +++ b/app/admin/entry.rb @@ -20,6 +20,7 @@ column :word_type column :translation column :description + column :published? actions end
@thenathanjones: Add the published flag to the index page
diff --git a/app/mailers/error_log_mailer.rb b/app/mailers/error_log_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/error_log_mailer.rb +++ b/app/mailers/error_log_mailer.rb @@ -18,7 +18,7 @@ @subject += @bad_object[:type].pluralize end - @log_file = tail "./log/#{Rails.env}.log", 200 + @log_file = tail "./log/#{Rails.env}.log", 500 mail_to = ENV['ADMIN_EMAIL'] mail_to ||= 'test@example.com' unless Rails.env.production?
Increase number of lines logged for error mailer
diff --git a/app/models/concerns/storable.rb b/app/models/concerns/storable.rb index abc1234..def5678 100644 --- a/app/models/concerns/storable.rb +++ b/app/models/concerns/storable.rb @@ -4,9 +4,7 @@ included do has_many :stores, as: :storable, dependent: :destroy - - # TODO fix me - # after_save { store.save } + after_save { store.save } end def storable?
Save the store automatically when the parent object gets saved.
diff --git a/app/models/wb_indc/indicator.rb b/app/models/wb_indc/indicator.rb index abc1234..def5678 100644 --- a/app/models/wb_indc/indicator.rb +++ b/app/models/wb_indc/indicator.rb @@ -1,6 +1,7 @@ module WbIndc class Indicator < ApplicationRecord belongs_to :indicator_type, class_name: 'WbIndc::IndicatorType' + has_many :values, class_name: 'WbIndc::Value' has_and_belongs_to_many :categories, join_table: :wb_indc_indicators_categories validates :name, presence: true
Add missing relation to model
diff --git a/app/policies/category_policy.rb b/app/policies/category_policy.rb index abc1234..def5678 100644 --- a/app/policies/category_policy.rb +++ b/app/policies/category_policy.rb @@ -7,6 +7,6 @@ end def show? - record.can_be_accessed_by?(user) || super + record.can_be_accessed_by?(@user) || super end end
fix(Category): Add missing @ to variable in policy
diff --git a/app/policies/question_policy.rb b/app/policies/question_policy.rb index abc1234..def5678 100644 --- a/app/policies/question_policy.rb +++ b/app/policies/question_policy.rb @@ -6,7 +6,7 @@ end def moderate? - user.role == 'superadmin' + user.superadmin? end end
Use user.superadmin? instead of ==
diff --git a/lib/asteroids/ship/ship-physics.rb b/lib/asteroids/ship/ship-physics.rb index abc1234..def5678 100644 --- a/lib/asteroids/ship/ship-physics.rb +++ b/lib/asteroids/ship/ship-physics.rb @@ -0,0 +1,12 @@+module Asteroids + class ShipPhysics < Component + + def initialize(game_object, object_pool) + super(game_object) + @object_pool = object_pool + game_object.x, game_object.y = $window.width / 2, $window.height / 2 + end + + + end +end
Add the ship physics class. The class will take care of the movement of the ship.
diff --git a/app/lib/repo_files_detective.rb b/app/lib/repo_files_detective.rb index abc1234..def5678 100644 --- a/app/lib/repo_files_detective.rb +++ b/app/lib/repo_files_detective.rb @@ -7,7 +7,7 @@ INPUTS = [:repo_url] OUTPUTS = [:repo_files] # Ask :repo_files.get("FILENAME") for files. - GITHUB_REPO = %r{https?://github.com/([^/]*)/([^/]*)(.git)?} + GITHUB_REPO = %r{https?://github.com/([\w\.-]*)/([\w\.-]*)(.git|/)?} def analyze(_evidence, current) repo_url = current[:repo_url] return {} if repo_url.blank?
Make Github match more stringent
diff --git a/app/jobs/admin_send_text_message_job.rb b/app/jobs/admin_send_text_message_job.rb index abc1234..def5678 100644 --- a/app/jobs/admin_send_text_message_job.rb +++ b/app/jobs/admin_send_text_message_job.rb @@ -22,6 +22,7 @@ if identity_phone.accepts_sms? if send_only_to.nil? || send_only_to[identity_phone.number] if exclude_numbers.nil? || !exclude_numbers[identity_phone.number] + Rails.logger.info{"AdminSendTextMessageJob processing user #{user.id} @ #{identity_phone.number}"} admin_text_message.text_message.process_single_target(identity_phone.number) end end
Add debug to sending admin text message
diff --git a/app/presenters/calendar_content_item.rb b/app/presenters/calendar_content_item.rb index abc1234..def5678 100644 --- a/app/presenters/calendar_content_item.rb +++ b/app/presenters/calendar_content_item.rb @@ -34,6 +34,7 @@ public_updated_at: Time.current.to_datetime.rfc3339, routes: [ { type: "prefix", path: base_path }, + { type: "exact", path: "#{base_path}.json" }, ], update_type: update_type, }
Add missing json calendar route
diff --git a/app/models/dojo.rb b/app/models/dojo.rb index abc1234..def5678 100644 --- a/app/models/dojo.rb +++ b/app/models/dojo.rb @@ -1,6 +1,6 @@ class Dojo < ApplicationRecord - NUM_OF_COUNTRIES = "69" - NUM_OF_WHOLE_DOJOS = "1,250" + NUM_OF_COUNTRIES = "75" + NUM_OF_WHOLE_DOJOS = "1,400" NUM_OF_JAPAN_DOJOS = Dojo.count.to_s has_one :dojo_event_service
Update CoderDojo stats based on Raspberry Pi site: cf. CoderDojo - Raspberry Pi https://www.raspberrypi.org/education/coderdojo/
diff --git a/spec/parser_spec.rb b/spec/parser_spec.rb index abc1234..def5678 100644 --- a/spec/parser_spec.rb +++ b/spec/parser_spec.rb @@ -26,4 +26,19 @@ expect(Moho::Parser.parse(tokens)).to eq ast end + + it 'parses nested lists' do + tokens = Moho::Lexer.tokenize('(+ 1 (* 2 3))') + ast = Moho::Lang::List.new([ + Moho::Lang::Symbol.new('+'), + Moho::Lang::Int.new(1), + Moho::Lang::List.new([ + Moho::Lang::Symbol.new('*'), + Moho::Lang::Int.new(2), + Moho::Lang::Int.new(3) + ]) + ]) + + expect(Moho::Parser.parse(tokens)).to eq ast + end end
Test for support for nested lists.
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,6 +4,16 @@ require 'simplecov' require 'simplecov-lcov' + +# Fix incompatibility of simplecov-lcov with older versions of simplecov that are not expresses in its gemspec. +# https://github.com/fortissimo1997/simplecov-lcov/pull/25 +if !SimpleCov.respond_to?(:branch_coverage) + module SimpleCov + def self.branch_coverage? + false + end + end +end SimpleCov::Formatter::LcovFormatter.config do |c| c.report_with_single_file = true
Fix simplecov-lcov incompatible with older simplecov (which is required to support Ruby < 2.4)
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,4 +1,5 @@ require 'rubygems' require 'rspec/autorun' +require 'rails/version' require 'ammeter/init'
Fix ammeter unitialized constant Rails::VERSION
diff --git a/app/workers/update_component.rb b/app/workers/update_component.rb index abc1234..def5678 100644 --- a/app/workers/update_component.rb +++ b/app/workers/update_component.rb @@ -6,6 +6,9 @@ def perform(bower_name) versions = Build::Utils.bower('/tmp', 'info', bower_name)['versions'] || [] + + # Exclude prereleases + versions = versions.reject { |v| v.match(/[a-z]/i) } if component = Component.find_by(bower_name: bower_name) versions = versions - component.versions.processed.map(&:bower_version)
Exclude prereleases from auto-converted versions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,8 +6,8 @@ require 'rspec/collection_matchers' if ENV["COVERAGE"] == "true" + require 'simplecov' require 'codecov' - require 'simplecov' SimpleCov.formatter = SimpleCov::Formatter::Codecov SimpleCov.start do
Order of requires matters apparently.
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,10 @@-require 'coveralls' -Coveralls.wear! +if ENV['TRAVIS'] + require 'coveralls' + Coveralls.wear! do + # exclude gems bundled by Travis + add_filter 'ci/bundle' + end +end if ENV['COVERAGE'] require 'simplecov'
Exclude gems bundled by Travis when computing coverage with Coveralls
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -23,6 +23,7 @@ config.treat_symbols_as_metadata_keys_with_true_values = true config.run_all_when_everything_filtered = true config.filter_run :focus + config.filter_run_excluding :live config.order = 'random' config.include Helpers end
Exclude :live specs by default
diff --git a/lib/j-cap-recipes/tasks/handy.rake b/lib/j-cap-recipes/tasks/handy.rake index abc1234..def5678 100644 --- a/lib/j-cap-recipes/tasks/handy.rake +++ b/lib/j-cap-recipes/tasks/handy.rake @@ -20,7 +20,7 @@ desc 'Show current settings' task :show do on roles(:all) do |host| - within shared_path do + within current_path do execute :cat, 'config/settings.yml', "config/settings/#{fetch(:stage)}.yml" end end
:panda_face: Use current folder to serach settings.
diff --git a/readingtime.gemspec b/readingtime.gemspec index abc1234..def5678 100644 --- a/readingtime.gemspec +++ b/readingtime.gemspec @@ -18,7 +18,8 @@ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ["lib"] - s.add_development_dependency 'rake' + s.add_development_dependency 'rake', '~> 10.5.0' if RUBY_VERSION < '1.9.3' # see: https://github.com/travis-ci/travis.rb/issues/380 + s.add_development_dependency 'rake' unless RUBY_VERSION < '1.9.3' s.add_development_dependency "rspec", "~>2.6" end
Fix rake version incompatibility by pinning to rake 10.5 on ruby < 1.9.3
diff --git a/recipes/database.rb b/recipes/database.rb index abc1234..def5678 100644 --- a/recipes/database.rb +++ b/recipes/database.rb @@ -29,7 +29,7 @@ execute 'create-mongodb-uptime-user' do # TODO: second param is the db_name - command "/usr/bin/mongo uptime --eval 'db.addUser(\"#{mongo_user}\",\"#{mongo_password}\")'" + command "/usr/bin/mongo uptime --eval 'db.createUser({user: \"#{mongo_user}\", pwd: \"#{mongo_password}\", roles: [{ role: \"readWrite\", db: \"uptime\" }]})'" action :run not_if "/usr/bin/mongo uptime --eval 'db.auth(\"#{mongo_user}\",\"#{mongo_password}\")' | grep -q ^1$" end
Switch to updated mongo syntax Previous syntax is now deprecated, causing a cookbook failure due to a warning message on stderr
diff --git a/lib/chef/dsl/audit.rb b/lib/chef/dsl/audit.rb index abc1234..def5678 100644 --- a/lib/chef/dsl/audit.rb +++ b/lib/chef/dsl/audit.rb @@ -16,6 +16,8 @@ # limitations under the License. # +require 'chef/exceptions' + class Chef module DSL module Audit @@ -23,9 +25,14 @@ # Can encompass tests in a `control` block or `describe` block # Adds the controls group and block (containing controls to execute) to the runner's list of pending examples def controls(*args, &block) - raise ::Chef::Exceptions::NoAuditsProvided unless block + raise Chef::Exceptions::NoAuditsProvided unless block + name = args[0] - raise AuditNameMissing if name.nil? || name.empty? + if name.nil? || name.empty? + raise Chef::Exceptions::AuditNameMissing + elsif run_context.controls.has_key?(name) + raise Chef::Exceptions::AuditControlGroupDuplicate.new(name) + end run_context.controls[name] = { :args => args, :block => block } end
Raise error if duplicate controls block given.