diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/spec/controllers/api/raw_entity_descriptors_controller_spec.rb b/spec/controllers/api/raw_entity_descriptors_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/api/raw_entity_descriptors_controller_spec.rb +++ b/spec/controllers/api/raw_entity_descriptors_controller_spec.rb @@ -5,10 +5,17 @@ let(:entity_source) { create(:entity_source) } let(:source_tag) { entity_source.source_tag } + let(:raw_idp) { create(:raw_entity_descriptor_idp) } + let(:keys) { [:xml, :created_at, :updated_at, :enabled] } + let(:idp_values) { raw_idp.values.slice(*keys) } + let(:idp_tags) { { tags: [Faker::Lorem.word, Faker::Lorem.word] } } + + let(:raw_entity_descriptor) { idp_values.merge(idp_tags) } + def run request.env['HTTP_X509_DN'] = "CN=#{api_subject.x509_cn}" if api_subject - post :create, tag: source_tag - puts request.path + post :create, tag: source_tag, + raw_entity_descriptor: raw_entity_descriptor end context 'not permitted' do
Rework to include required payload
diff --git a/app/helpers/spree/api/api_helpers_decorator.rb b/app/helpers/spree/api/api_helpers_decorator.rb index abc1234..def5678 100644 --- a/app/helpers/spree/api/api_helpers_decorator.rb +++ b/app/helpers/spree/api/api_helpers_decorator.rb @@ -2,9 +2,9 @@ alias_method :orig_order_attributes, :order_attributes - @@order_attributes = [] + @order_attributes = [] def self.extended_order_attributes - @@order_attributes + @order_attributes end def order_attributes orig_order_attributes + Spree::Api::ApiHelpers.extended_order_attributes
Fix issue with class variables
diff --git a/app/helpers/spree/api/api_helpers_decorator.rb b/app/helpers/spree/api/api_helpers_decorator.rb index abc1234..def5678 100644 --- a/app/helpers/spree/api/api_helpers_decorator.rb +++ b/app/helpers/spree/api/api_helpers_decorator.rb @@ -0,0 +1,16 @@+module Spree + module Api + ApiHelpers.module_eval do + + def product_attributes + [:id, :name, :visual_code, :description, :price, + :available_on, :permalink, :count_on_hand, :meta_description, :meta_keywords] + end + + def variant_attributes + [:id, :name, :count_on_hand, :visual_code, :sku, :price, :weight, :height, :width, :depth, :is_master, :cost_price, :permalink] + end + + end + end +end
[api] Add visual code to product and variant attributes
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,7 +3,7 @@ scope "admin", :module => :admin, :as => "admin" do match "/" => "dashboard#show", :as => "dashboard" - match "/app/:application" => "dashboard#show", :as => "dashboard_app" + match "/dashboard/:application" => "dashboard#show", :as => "dashboard_app" match "user_guide" => "base#user_guide" if Typus.authentication == :session
Make more sense to be in the dashboard of an app.
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,7 +6,7 @@ map.resource :session map.namespace :admin do |admin| - admin.resources :users, :member => { :activate => :put, :suspend => :put, :reset_password => :put }, + admin.resources :users, :member => { :activate => :put, :suspend => :put, :reset_password => :put, :administrator => :put }, :collection => { :inactive => :get } end
Add routing for the new action
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,5 +5,7 @@ get '/items/:id', to: 'items#show', as: 'item' get '/items/:id/edit', to: 'items#edit', as: 'edit_item' patch '/items/:id', to: 'items#update' + delete '/items/:id', to: 'items#destroy' + # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html end
Create route for delete /items/:id
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -22,7 +22,7 @@ resources :members, :only => [:index, :show, :update] - root :to => "home#index" + root :to => redirect("/members") match '/401', :to => 'errors#unauthorized' match '/404', :to => 'errors#not_found'
Make the root page redirect to /members Done as an actual redirect, because web. Resolves #109
diff --git a/lib/generators/spree_mail_chimp/install/install_generator.rb b/lib/generators/spree_mail_chimp/install/install_generator.rb index abc1234..def5678 100644 --- a/lib/generators/spree_mail_chimp/install/install_generator.rb +++ b/lib/generators/spree_mail_chimp/install/install_generator.rb @@ -11,7 +11,7 @@ end def add_migrations - run 'rake railties:install:migrations FROM=spree_spree_mail_chimp' + run 'rake railties:install:migrations FROM=spree_mail_chimp' end def run_migrations
Fix bad naming of when adding migrations
diff --git a/test/rectangle_test.rb b/test/rectangle_test.rb index abc1234..def5678 100644 --- a/test/rectangle_test.rb +++ b/test/rectangle_test.rb @@ -0,0 +1,42 @@+require 'minitest/autorun' +require 'r2d' + +describe Rectangle do + before do + R2D::Window.create width: 640, height: 480 + @rectangle = Rectangle.new(10, 20, 300, 500) + end + + it 'can have x and y coordinates' do + @rectangle.x.must_equal 10 + @rectangle.y.must_equal 20 + end + + it 'can have a width' do + @rectangle.width.must_equal 300 + end + + it 'can have a height' do + @rectangle.height.must_equal 500 + end + + it 'can edit the x coordinate' do + @rectangle.x = 30 + @rectangle.x.must_equal 30 + end + + it 'can edit the y coordinate' do + @rectangle.y = 25 + @rectangle.y.must_equal 25 + end + + it 'can edit the width' do + @rectangle.width = 250 + @rectangle.width.must_equal 250 + end + + it 'can edit the height' do + @rectangle.height = 450 + @rectangle.height.must_equal 450 + end +end
Add tests for the Rectangle class
diff --git a/erable.rb b/erable.rb index abc1234..def5678 100644 --- a/erable.rb +++ b/erable.rb @@ -14,6 +14,7 @@ homepage "https://www.atgc-montpellier.fr/erable/" url "http://www.atgc-montpellier.fr/download/sources/erable/erable1.0_Unix_Linux.tar.gz" sha256 "b03ff6f4d854a7cc064f392e428447932cdf1dba08c39712b88354d6ab1bef9a" + version '1.0' def install cd "erable1.0_Unix_Linux" do
Set the version number because linuxbrew thinks it is "Unix"
diff --git a/0_code_wars/binary_score.rb b/0_code_wars/binary_score.rb index abc1234..def5678 100644 --- a/0_code_wars/binary_score.rb +++ b/0_code_wars/binary_score.rb @@ -0,0 +1,10 @@+# http://www.codewars.com/kata/56cafdabc8cfcc3ad4000a2b +# --- iteration 1 --- +def score(n) + n < 2 ? n : 2**Math.log(n, 2).ceil - 1 +end + +# --- iteration 2 --- +def score(n) + n < 2 ? n : 2**(n.to_s(2).size) - 1 +end
Add code wars (7) - binary score
diff --git a/config/initializers/seeds_proxy.rb b/config/initializers/seeds_proxy.rb index abc1234..def5678 100644 --- a/config/initializers/seeds_proxy.rb +++ b/config/initializers/seeds_proxy.rb @@ -1,10 +1,16 @@ class SeedsProxy < Rack::Proxy - USE = :remote + USE = ENV['SEEDS'] || 'remote' LOCAL_URL = 'localhost:3001' REMOTE_URL = 'cocoa-tree.github.io:80' + if USE == 'local' + puts "=> Using seeds from #{LOCAL_URL}" + else + puts "=> Using seeds from #{REMOTE_URL}" + end + def rewrite_env(env) - if USE == :remote + if USE == 'remote' env["HTTP_HOST"] = REMOTE_URL else env["HTTP_HOST"] = LOCAL_URL
Configure seeds proxy via ENV['SEEDS'].
diff --git a/lib/suspenders/generators/production/manifest_generator.rb b/lib/suspenders/generators/production/manifest_generator.rb index abc1234..def5678 100644 --- a/lib/suspenders/generators/production/manifest_generator.rb +++ b/lib/suspenders/generators/production/manifest_generator.rb @@ -17,7 +17,7 @@ RACK_ENV: { required: true }, SECRET_KEY_BASE: { generator: "secret" }, }, - addons: ["heroku-postgresql"], + addons: ["heroku-postgresql", "heroku-redis"], ) end end
Install redis on heroku for sidekiq
diff --git a/cookbooks/maintenance/recipes/default.rb b/cookbooks/maintenance/recipes/default.rb index abc1234..def5678 100644 --- a/cookbooks/maintenance/recipes/default.rb +++ b/cookbooks/maintenance/recipes/default.rb @@ -1,3 +1,3 @@-include_recipe 'useful_tools' +include_recipe 'maintanance::useful_tools' include_recipe 'maintenance::users' include_recipe 'maintenance::admin_users'
Fix link to useful tools.
diff --git a/Casks/rubymine-eap-bundled-jdk.rb b/Casks/rubymine-eap-bundled-jdk.rb index abc1234..def5678 100644 --- a/Casks/rubymine-eap-bundled-jdk.rb +++ b/Casks/rubymine-eap-bundled-jdk.rb @@ -0,0 +1,20 @@+cask :v1 => 'rubymine-eap-bundled-jdk' do + version '141.373' + sha256 '2605d3b61d9ae4a0590337d04bc24bf2f1c430cb5c226b1bffafcde6b61e478d' + + url "https://download.jetbrains.com/ruby/RubyMine-#{version}-custom-jdk-bundled.dmg" + name 'RubyMine EAP' + homepage 'https://confluence.jetbrains.com/display/RUBYDEV/RubyMine+EAP' + license :commercial + + app 'RubyMine EAP.app' + + zap :delete => [ + '~/Library/Preferences/com.jetbrains.rubymine-EAP.plist', + '~/Library/Preferences/RubyMine70', + '~/Library/Application Support/RubyMine70', + '~/Library/Caches/RubyMine70', + '~/Library/Logs/RubyMine70', + '/usr/local/bin/mine', + ] +end
Add formula for RubyMine EAP with bundled JDK
diff --git a/lib/active_admin/engine.rb b/lib/active_admin/engine.rb index abc1234..def5678 100644 --- a/lib/active_admin/engine.rb +++ b/lib/active_admin/engine.rb @@ -1,7 +1,7 @@ module ActiveAdmin class Engine < Rails::Engine if Rails.version > "3.1" - initializer "ActiveAdmin precompile hook" do |app| + initializer "ActiveAdmin precompile hook", :group => :all do |app| app.config.assets.precompile += %w(active_admin.js active_admin.css active_admin/print.css) end end
Make sure assets are precompiled on Heroku Heroku recommends that `config.assets.initialize_on_precompile = false`, which means that this initializer will not be invoked by `rake assets:precompile`, which forces developers deploying to Heroku to duplicate this initializer in their apps' configs.
diff --git a/test/kleisli/try_test.rb b/test/kleisli/try_test.rb index abc1234..def5678 100644 --- a/test/kleisli/try_test.rb +++ b/test/kleisli/try_test.rb @@ -24,4 +24,14 @@ def test_fmap_failure assert_kind_of ZeroDivisionError, Try { 10 / 0 }.fmap { |x| x * 2 }.exception end + + def test_bind + try = Try { 20 / 10 } >-> number { Try { 10 / number } } + assert_equal 5, try.value + end + + def test_pointfree + try = Try { 20 / 10 } >> F . Try { 10 / 2 } + assert_equal 5, try.value + end end
Add point free style test
diff --git a/lib/frizz/configuration.rb b/lib/frizz/configuration.rb index abc1234..def5678 100644 --- a/lib/frizz/configuration.rb +++ b/lib/frizz/configuration.rb @@ -46,13 +46,10 @@ def start_yaml_listener require "listen" - listener = Listen.to Dir.pwd - listener.change do |modified, added, removed| + Listen.to(Dir.pwd) do |modified, added, removed| load_yaml! if modified.include? "frizz.yml" end - - listener.start end end -end+end
Use block for listen... more concise
diff --git a/test/ventilation_test.rb b/test/ventilation_test.rb index abc1234..def5678 100644 --- a/test/ventilation_test.rb +++ b/test/ventilation_test.rb @@ -12,9 +12,14 @@ should "render external resource" do expected = "response_from_example.com" FakeWeb.register_uri(:get, "http://example.com/", :body => expected) + actual = @consumer.esi 'http://example.com/' + assert_equal expected, actual, "Expected response was not rendered by esi method" + end - actual = @consumer.esi 'http://example.com/' - + should "render external resource with port number" do + expected = "response_from_example.com_port_4000" + FakeWeb.register_uri(:get, "http://example.com:4000/", :body => expected) + actual = @consumer.esi 'http://example.com:4000/' assert_equal expected, actual, "Expected response was not rendered by esi method" end @@ -25,9 +30,7 @@ deep_stack = mock() deep_stack.expects(:get).with(:index).returns(response) Ventilation::DeepStack.expects(:new).with(WelcomeController).returns(deep_stack) - actual = @consumer.esi :index, :controller => :welcome - assert_equal expected, actual end
Add test to ensure port numbers are supported in external resources.
diff --git a/lib/lita/adapters/shell.rb b/lib/lita/adapters/shell.rb index abc1234..def5678 100644 --- a/lib/lita/adapters/shell.rb +++ b/lib/lita/adapters/shell.rb @@ -2,12 +2,14 @@ module Adapters class Shell < Adapter def run + user = User.new(1, "Shell User") + source = Source.new(user) puts 'Type "exit" or "quit" to end the session.' + loop do print "#{robot.name} > " input = gets.chomp.strip break if input == "exit" || input == "quit" - source = Source.new("Shell User") message = Message.new(robot, input, source) robot.receive(message) end
Update Shell adapter to use a User as its source.
diff --git a/lib/redirect_follow_get.rb b/lib/redirect_follow_get.rb index abc1234..def5678 100644 --- a/lib/redirect_follow_get.rb +++ b/lib/redirect_follow_get.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true require 'redirect_follow_get/version' +require 'addressable' require 'net/http' module RedirectFollowGet @@ -9,7 +10,8 @@ def redirect_follow_get(url, limit: 10) raise RedirectFollowGet::TooManyRedirects, 'too many HTTP redirects' if limit.zero? - uri = URI(URI.escape(url)) + uri = url.ascii_only? ? URI.parse(url) : Addressable::URI.parse(url) + case response = Net::HTTP.get_response(uri) when Net::HTTPSuccess response
Change URI parse depending on `ascii_only?`
diff --git a/lib/renoir/cluster_info.rb b/lib/renoir/cluster_info.rb index abc1234..def5678 100644 --- a/lib/renoir/cluster_info.rb +++ b/lib/renoir/cluster_info.rb @@ -15,9 +15,9 @@ def load_slots(slots) slots.each do |s, e, master, *slaves| ip, port, = master - name = add_node(ip, port) + node = add_node(ip, port) (s..e).each do |slot| - @slots[slot] = name + @slots[slot] = node[:name] end end end
Fix a bug: slots cache is not used
diff --git a/server.rb b/server.rb index abc1234..def5678 100644 --- a/server.rb +++ b/server.rb @@ -35,10 +35,7 @@ while true line = @client.gets break if line=="\r\n" - array << line - end - array.each do |sentence| - sentence.gsub!("\r\n","") + array << line.gsub("\r\n","") end array end
Refactor get_headers to avoid needless array looping
diff --git a/spec/str_sanitizer/html_entities_spec.rb b/spec/str_sanitizer/html_entities_spec.rb index abc1234..def5678 100644 --- a/spec/str_sanitizer/html_entities_spec.rb +++ b/spec/str_sanitizer/html_entities_spec.rb @@ -0,0 +1,39 @@+require "spec_helper" +require "str_sanitizer/html_entities" + +RSpec.describe StrSanitizer::HtmlEntities do + before(:each) do + @methods = ExampleClass + + @encode_string = "<div>Hello world</div>" + @decode_string = "&lt;div&gt;Hello world&lt;/div&gt;" + end + + it "has some method for encoding and decoding" do + expect(@methods.respond_to? :encode).to eq(true) + expect(@methods.respond_to? :decode).to eq(true) + end + + it "returns a encoded string" do + encoded = @methods.encode(@encode_string) + # The encoded string was done by `htmlentities` gem manually and pasted in here + expect(encoded).to eq("&lt;div&gt;Hello world&lt;/div&gt;") + end + + it "returns a decoded string" do + decoded = @methods.decode(@decode_string) + # The decoded string was done by `htmlentities` gem manually and pasted in here + expect(decoded).to eq("<div>Hello world</div>") + end + + it "doesn't throw any exception if nothing was there to encode and decode" do + simple_string = "Hello world" + + expect(@methods.encode simple_string).to eq(simple_string) + expect(@methods.decode simple_string).to eq(simple_string) + end +end + +class ExampleClass + extend StrSanitizer::HtmlEntities +end
Add specs for HtmlEntities module
diff --git a/spec/unit/job_spec.rb b/spec/unit/job_spec.rb index abc1234..def5678 100644 --- a/spec/unit/job_spec.rb +++ b/spec/unit/job_spec.rb @@ -4,7 +4,7 @@ it "adds and executes job" do spinner = TTY::Spinner.new("[:spinner] :title") called = [] - work = proc { |spinner| called << spinner } + work = proc { |sp| called << sp } spinner.job(&work) spinner.execute_job
Change to fix spec var shadowing
diff --git a/add_user_to_sqlite.rb b/add_user_to_sqlite.rb index abc1234..def5678 100644 --- a/add_user_to_sqlite.rb +++ b/add_user_to_sqlite.rb @@ -0,0 +1,29 @@+# -*- coding: utf-8 -*- + +require 'sqlite3' + +@database_yml = ARGV[0] + +@nomnichi_db = SQLite3::Database.new("nomnichi.sqlite3") +print "User : "; user = gets.chomp +print "Pass : "; pass = gets.chomp +salt = 'sio'#Time.now.to_s +puts salt +pass_sha = `echo -n '#{salt}#{pass}' | shasum`.chomp.split(' ').first + +puts pass_sha +max_id_sql = <<SQL +select max(id) from user; +SQL +id = @nomnichi_db.execute(max_id_sql).flatten.first.to_i + 1 + +add_user_sql = <<SQL +insert into user values (#{id}, '#{user}', '#{pass_sha}', '#{salt}'); +SQL +@nomnichi_db.execute(add_user_sql) + + +# yaml_data = YAML.load_file("./#{@database_yml}") +# into_article_table(yaml_data) +@nomnichi_db.close +
Create script to add user to sqlite3
diff --git a/activerecord/test/cases/adapters/postgresql/case_insensitive_test.rb b/activerecord/test/cases/adapters/postgresql/case_insensitive_test.rb index abc1234..def5678 100644 --- a/activerecord/test/cases/adapters/postgresql/case_insensitive_test.rb +++ b/activerecord/test/cases/adapters/postgresql/case_insensitive_test.rb @@ -7,22 +7,21 @@ def test_case_insensitiveness connection = ActiveRecord::Base.connection - table = Default.arel_table - column = Default.columns_hash["char1"] - comparison = connection.case_insensitive_comparison table, :char1, column, nil + attr = Default.arel_attribute(:char1) + comparison = connection.case_insensitive_comparison(attr, nil) assert_match(/lower/i, comparison.to_sql) - column = Default.columns_hash["char2"] - comparison = connection.case_insensitive_comparison table, :char2, column, nil + attr = Default.arel_attribute(:char2) + comparison = connection.case_insensitive_comparison(attr, nil) assert_match(/lower/i, comparison.to_sql) - column = Default.columns_hash["char3"] - comparison = connection.case_insensitive_comparison table, :char3, column, nil + attr = Default.arel_attribute(:char3) + comparison = connection.case_insensitive_comparison(attr, nil) assert_match(/lower/i, comparison.to_sql) - column = Default.columns_hash["multiline_default"] - comparison = connection.case_insensitive_comparison table, :multiline_default, column, nil + attr = Default.arel_attribute(:multiline_default) + comparison = connection.case_insensitive_comparison(attr, nil) assert_match(/lower/i, comparison.to_sql) end end
Fix `test_case_insensitiveness` to follow up eb5fef5
diff --git a/app/services/reports/performance_platform/transactions_by_channel.rb b/app/services/reports/performance_platform/transactions_by_channel.rb index abc1234..def5678 100644 --- a/app/services/reports/performance_platform/transactions_by_channel.rb +++ b/app/services/reports/performance_platform/transactions_by_channel.rb @@ -5,9 +5,7 @@ def initialize(start_date) @start_date = start_date - raise 'Report must start on a Monday' unless @start_date.monday? - raise 'Report cannot be in the current week' if @start_date.cweek.eql?(Date.today.cweek) - raise 'Report cannot be in the future' if @start_date >= Date.today + validate @pps = ::PerformancePlatform.report('transactions_by_channel') @ready_to_send = false end @@ -32,6 +30,14 @@ def count_digital_claims @count_digital_claims ||= Claims::Count.week(@start_date) end + + def validate + raise 'Report must start on a Monday' unless @start_date.monday? + if @start_date.cweek.eql?(Date.current.cweek) && @start_date.year.eql?(Date.current.year) + raise 'Report cannot be in the current week' + end + raise 'Report cannot be in the future' if @start_date >= Date.current + end end end end
Fix performance platform date validations validation was stopping report being generated by the week of the year, regardless of the year itself. This meant users could not run a report for week 51 of 2018 during week 51 of 2019.
diff --git a/test/support/models.rb b/test/support/models.rb index abc1234..def5678 100644 --- a/test/support/models.rb +++ b/test/support/models.rb @@ -4,7 +4,8 @@ attr_accessor :name, :address, :number validates :name, :address, :number, presence: {message: "cannot be blank!"} - validates :name, :address, length: { maximum: 100 } + validates :name, length: {in: 6..20} + validates :address, length: {minimum: 10, maximum: 100, too_long: "100 characters is the maximum allowed", too_short: "10 characters is the minimum allowed"} validates :number, numericality: true def column_for_attribute(attribute_name)
Add more validation to test
diff --git a/spec/lib/ec2ssh/cli_spec.rb b/spec/lib/ec2ssh/cli_spec.rb index abc1234..def5678 100644 --- a/spec/lib/ec2ssh/cli_spec.rb +++ b/spec/lib/ec2ssh/cli_spec.rb @@ -26,4 +26,10 @@ expect { cli.update }.not_to raise_error end end + + describe '#remove' do + it do + expect { cli.remove }.not_to raise_error + end + end end
Add an example for cli.remove
diff --git a/test/orm_ext/mongo_mapper_test.rb b/test/orm_ext/mongo_mapper_test.rb index abc1234..def5678 100644 --- a/test/orm_ext/mongo_mapper_test.rb +++ b/test/orm_ext/mongo_mapper_test.rb @@ -5,11 +5,11 @@ context "The MongoMapper extension" do setup do setup_fixtures - @person = MongoMapperPerson.create end should "be able to find the object in the database" do - assert_equal @person, MongoMapperPerson._t_find(@person.id) + person = MongoMapperPerson.create + assert_equal person, MongoMapperPerson._t_find(person.id) end should "be able to find the associates of an object" do @@ -20,9 +20,21 @@ end should "be able to associate many objects with the given object" do + transaction_1 = ActiveRecordTransaction.create + transaction_2 = ActiveRecordTransaction.create + transaction_3 = ActiveRecordTransaction.create + person = MongoMapperPerson.create + person._t_associate_many(:active_record_transactions, [transaction_1.id, transaction_2.id, transaction_3.id]) + assert_set_equal [transaction_1.id, transaction_2.id, transaction_3.id], person._t_active_record_transaction_ids end should "be able to get the ids of the objects associated with the given object" do + transaction_1 = ActiveRecordTransaction.create + transaction_2 = ActiveRecordTransaction.create + transaction_3 = ActiveRecordTransaction.create + person = MongoMapperPerson.create + person._t_associate_many(:active_record_transactions, [transaction_1.id, transaction_2.id, transaction_3.id]) + assert_set_equal [transaction_1.id, transaction_2.id, transaction_3.id], person._t_get_associate_ids(:active_record_transactions) end end
Add a few more mongo mapper extension tests
diff --git a/daemons.gemspec b/daemons.gemspec index abc1234..def5678 100644 --- a/daemons.gemspec +++ b/daemons.gemspec @@ -21,14 +21,5 @@ monitoring and automatic restarting of your processes if they crash. EOF - s.files = [ - "Rakefile", - "Releases", - "README.md", - "LICENSE", - "setup.rb", - "lib/*.rb", - "lib/**/*.rb", - "examples/**/*.rb", - ] + s.files = `git ls-files README.md LICENSE Releases lib`.split end
Use git ls-files to generate the file list
diff --git a/openssl-extensions.gemspec b/openssl-extensions.gemspec index abc1234..def5678 100644 --- a/openssl-extensions.gemspec +++ b/openssl-extensions.gemspec @@ -20,7 +20,8 @@ s.add_development_dependency 'rspec', '~> 2.4.0' s.add_development_dependency 'fuubar', '~> 0.0.1' - s.files = Dir.glob('lib/**/*') + extra_rdoc_files - s.test_files = Dir.glob('spec/**/*') - s.require_path = 'lib' + s.files = `git ls-files`.split("\n") + s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") + s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } + s.require_paths = ["lib"] end
Update files, test_files, executables to use git list.
diff --git a/src/db/migrate/20120227150102_add_pool_family_to_instance.rb b/src/db/migrate/20120227150102_add_pool_family_to_instance.rb index abc1234..def5678 100644 --- a/src/db/migrate/20120227150102_add_pool_family_to_instance.rb +++ b/src/db/migrate/20120227150102_add_pool_family_to_instance.rb @@ -5,11 +5,11 @@ add_column :catalogs, :pool_family_id, :integer add_column :deployables, :pool_family_id, :integer - Deployment.all.each do |deployment| + Deployment.unscoped.each do |deployment| deployment.pool_family_id = deployment.pool.pool_family_id deployment.save! end - Instance.all.each do |instance| + Instance.unscoped.each do |instance| instance.pool_family_id = instance.pool.pool_family_id instance.save! end
Fix migration after paranoid gem changed the default scope
diff --git a/lib/retina_rails/extensions/carrierwave.rb b/lib/retina_rails/extensions/carrierwave.rb index abc1234..def5678 100644 --- a/lib/retina_rails/extensions/carrierwave.rb +++ b/lib/retina_rails/extensions/carrierwave.rb @@ -14,7 +14,7 @@ def mount_uploader(*args) original_mount_uploader(*args) - serialize :retina_dimensions if columns_hash.has_key?('retina_dimensions') + serialize :retina_dimensions if table_exists? && columns_hash.has_key?('retina_dimensions') end end end
Check if table exists before calling columns_hash
diff --git a/lib/tasks/migrations/weapon_overrides.rake b/lib/tasks/migrations/weapon_overrides.rake index abc1234..def5678 100644 --- a/lib/tasks/migrations/weapon_overrides.rake +++ b/lib/tasks/migrations/weapon_overrides.rake @@ -2,6 +2,7 @@ namespace :lca do namespace :migrate do + # Obsoleted columns: Weapon.attr, Weapon.damage_attr desc 'Move weapon pool data (attack attribute, etc) to new Overrides hash' task weapon_overrides: :environment do puts 'Migrating weapons...' @@ -9,7 +10,6 @@ weapon.overrides[:damage_attribute] = { use: weapon.damage_attr } unless weapon.damage_attr == 'strength' unless weapon.attr == 'dexterity' weapon.overrides[:attack_attribute] = { use: weapon.attr } - weapon.overrides[:attack_attribute][:base_only] = true if weapon.attr == 'strength' weapon.overrides[:defense_attribute] = { use: weapon.attr } end weapon.save
Add migrator for new weapon override structure
diff --git a/app/controllers/question.rb b/app/controllers/question.rb index abc1234..def5678 100644 --- a/app/controllers/question.rb +++ b/app/controllers/question.rb @@ -12,6 +12,10 @@ json question: @user.questions.last end -delete '/questions/:id' do +delete '/questions' do + Question.find(params['question']['id']).destroy(); +end +put '/questions' do + Question.find(params['question']['id']).update(params['question']) end
Add Edit and Delete Feature to Question Controller
diff --git a/app/helpers/index_helper.rb b/app/helpers/index_helper.rb index abc1234..def5678 100644 --- a/app/helpers/index_helper.rb +++ b/app/helpers/index_helper.rb @@ -1,6 +1,6 @@ module IndexHelper def title_and_url(flow_name, title) - tag.p(title) + link_to("/#{flow_name}", smart_answer_path(flow_name)) + sanitize(title) + tag.br + link_to("/#{flow_name}", smart_answer_path(flow_name)) end def live_link(flow_name, status) @@ -12,7 +12,8 @@ end def code_links(flow_name) - tag.p(link_to("Definition", "https://www.github.com/alphagov/smart-answers/blob/master/lib/smart_answer_flows/#{flow_name}.rb")) + - tag.p(link_to("Content files", "https://www.github.com/alphagov/smart-answers/blob/master/lib/smart_answer_flows/#{flow_name}")) + link_to("Definition", "https://www.github.com/alphagov/smart-answers/blob/master/lib/smart_answer_flows/#{flow_name}.rb") + + tag.br + + link_to("Content files", "https://www.github.com/alphagov/smart-answers/blob/master/lib/smart_answer_flows/#{flow_name}") end end
Reduce tag nesting on index page Not using these extra paragraph tags also means the index page will look exactly the same after we switched to `header_footer_only` template.
diff --git a/test/test_mechanize_http_auth_realm.rb b/test/test_mechanize_http_auth_realm.rb index abc1234..def5678 100644 --- a/test/test_mechanize_http_auth_realm.rb +++ b/test/test_mechanize_http_auth_realm.rb @@ -14,7 +14,10 @@ assert_equal 'r', @realm.realm realm = @AR.new 'Digest', @uri, 'R' - assert_equal 'r', realm.realm + refute_equal 'r', realm.realm + + realm = @AR.new 'Digest', @uri, 'R' + assert_equal 'R', realm.realm realm = @AR.new 'Digest', @uri, nil assert_nil realm.realm @@ -28,6 +31,9 @@ refute_equal @realm, other other = @AR.new 'Digest', URI('http://other.example/'), 'r' + refute_equal @realm, other + + other = @AR.new 'Digest', @uri, 'R' refute_equal @realm, other other = @AR.new 'Digest', @uri, 's'
Add tests for realm case sensitivity in AuthRealm As per RFC 1945 (section 11) and RFC 2617, the realm value is case sensitive. This commit adds tests for realm case sensitivity in Mechanize::HTTP::AuthRealm.
diff --git a/app/models/search_record.rb b/app/models/search_record.rb index abc1234..def5678 100644 --- a/app/models/search_record.rb +++ b/app/models/search_record.rb @@ -11,7 +11,7 @@ # class SearchRecord < ActiveRecord::Base - STORAGE_LIFETIME = 90.days + STORAGE_LIFETIME = 30.days has_many :search_records_words, dependent: :destroy has_many :words, -> { order('search_records_words.position') }, through: :search_records_words
Reduce SearchRecord::STORAGE_LIFETIME to 30 days
diff --git a/db/data_migration/20130404141154_remove_unpublishing_comment.rb b/db/data_migration/20130404141154_remove_unpublishing_comment.rb index abc1234..def5678 100644 --- a/db/data_migration/20130404141154_remove_unpublishing_comment.rb +++ b/db/data_migration/20130404141154_remove_unpublishing_comment.rb @@ -0,0 +1,12 @@+u = Unpublishing.find_by_slug('civil-contingencies-act-a-short-guide-revised') +if u + print "Removing explanation from 'civil-contingencies-act-a-short-guide-revised' unpublishing" + u.explanation = '' + if u.save + puts ". Done!" + else + puts ". ERROR - unpublishing no longer valid: #{u.errors.full_messages}" + end +else + pute "Unpublishing for 'civil-contingencies-act-a-short-guide-revised' not present - skipping!" +end
Remove erroneous explanation from an unpublishing
diff --git a/lib/active_record/connection_adapters/oracle_enhanced/column.rb b/lib/active_record/connection_adapters/oracle_enhanced/column.rb index abc1234..def5678 100644 --- a/lib/active_record/connection_adapters/oracle_enhanced/column.rb +++ b/lib/active_record/connection_adapters/oracle_enhanced/column.rb @@ -4,7 +4,7 @@ module ConnectionAdapters #:nodoc: module OracleEnhanced class Column < ActiveRecord::ConnectionAdapters::Column - attr_reader :table_name, :virtual_column_data_default #:nodoc: + attr_reader :virtual_column_data_default #:nodoc: def initialize(name, default, sql_type_metadata = nil, null = true, table_name = nil, virtual = false, returning_id = nil, comment = nil) #:nodoc: @virtual = virtual
Remove `attr_reader :table_name` from `ActiveRecord::ConnectionAdapters::OracleEnhanced::Column` Already set at `ActiveRecord::ConnectionAdapters::Column`
diff --git a/features/step_definitions/login_steps.rb b/features/step_definitions/login_steps.rb index abc1234..def5678 100644 --- a/features/step_definitions/login_steps.rb +++ b/features/step_definitions/login_steps.rb @@ -27,5 +27,5 @@ end Then(/^I should see the login page in the current window$/) do - expect(current_host).to eq 'https://logindev.library.nyu.edu' + expect(current_host).to match /^https:\/\/login(dev)?\.library\.nyu\.edu$/ end
Change the login URL expectation to a RegExp that takes logindev into account for Travis
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 @@ -8,6 +8,6 @@ end def map_locale_names - locale_codes.index_by { |l| [t("language_names.#{l}", locale: "en")] } + locale_codes.map { |l| [t("language_names.#{l}", locale: "en"), l] }.to_h end end
Fix locale select form options
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 @@ -10,7 +10,7 @@ def units_name_from_amee_unit(carbon_producing_type) unit_obj = Unit.from_amee_unit(carbon_producing_type.units) - unit_obj ? unit_obj.name : convert_units_to_readable_format(carbon_producing_type.units) + unit_obj ? unit_obj.name : carbon_producing_type.units end def two_decimal_place_float(amount)
Fix units helper for alternative units
diff --git a/app/views/news/index.atom.builder b/app/views/news/index.atom.builder index abc1234..def5678 100644 --- a/app/views/news/index.atom.builder +++ b/app/views/news/index.atom.builder @@ -9,7 +9,7 @@ @nodes.map(&:content).each do |news| feed.entry(news) do |entry| - entry.title(news.title) + entry.title(news.title, :published => news.node.created_at) first = content_tag(:div, news.body) links = content_tag(:ul, news.links.map.with_index do |l,i| content_tag(:li, "lien n°#{i+1} : ".html_safe + link_to(l.title, l.url))
Use the publication date for news in the ATOM feed
diff --git a/week-6/nested_data_solution.rb b/week-6/nested_data_solution.rb index abc1234..def5678 100644 --- a/week-6/nested_data_solution.rb +++ b/week-6/nested_data_solution.rb @@ -0,0 +1,54 @@+# RELEASE 2: NESTED STRUCTURE GOLF +# Hole 1 +# Target element: "FORE" + +array = [[1,2], ["inner", ["eagle", "par", ["FORE", "hook"]]]] + +# attempts: +# ============================================================ +# p array[1][1][2][0] + + +# ============================================================ + +# Hole 2 +# Target element: "congrats!" + +hash = {outer: {inner: {"almost" => {3 => "congrats!"}}}} + +# attempts: +# ============================================================ + +# p hash[:outer][:inner]["almost"][3] + +# ============================================================ + + +# Hole 3 +# Target element: "finished" + +nested_data = {array: ["array", {hash: "finished"}]} + +# attempts: +# ============================================================ + +# p nested_data[:array][1][:hash] + +# ============================================================ + +# RELEASE 3: ITERATE OVER NESTED STRUCTURES + +# number_array = [5, [10, 15], [20,25,30], 35] + +# number_array.collect! do |element| + +# if element.kind_of?(Array) +# element.collect! {|inner| inner+=5} +# else element+=5 +# end +# end +# p number_array + +# Bonus: + +startup_names = ["bit", ["find", "fast", ["optimize", "scope"]]]
Add solution file for challenge 6.5
diff --git a/Extra.podspec b/Extra.podspec index abc1234..def5678 100644 --- a/Extra.podspec +++ b/Extra.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Extra' - s.version = '0.6.0' + s.version = '0.6.2' s.summary = 'Swift 3 library with usefull and lightfull extensions for your Cocoa Touch projects.' s.homepage = 'https://github.com/smartnsoft/Extra' @@ -12,7 +12,7 @@ s.tvos.deployment_target = '9.0' s.ios.frameworks = 'UIKit', 'QuartzCore', 'Foundation' - + s.default_subspec = 'UIKit', 'Foundation' s.subspec 'UIKit' do |sp|
Prepare quick fix 0.6.2 release
diff --git a/app/models/ability.rb b/app/models/ability.rb index abc1234..def5678 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -5,6 +5,10 @@ # # @param user [User] The current user. def initialize(user) + # TODO: Replace with just the symbols when Rails 5 is released. + can :read, Course, status: [Course.statuses[:published], Course.statuses[:opened], + 'published', 'opened'] + return unless user can :manage, :all if user.administrator?
Allow courses to be read by anyone when it is open.
diff --git a/core/random/default_spec.rb b/core/random/default_spec.rb index abc1234..def5678 100644 --- a/core/random/default_spec.rb +++ b/core/random/default_spec.rb @@ -13,8 +13,8 @@ end ruby_version_is '3.0' do - it "returns a Random instance" do - Random::DEFAULT.should be_an_instance_of(Class) + it "refers to the Random class" do + Random::DEFAULT.should.equal?(Random) end end
Clarify spec and change of behavior for Random::DEFAULT
diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index abc1234..def5678 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -1,7 +1,7 @@ require 'puppetlabs_spec_helper/module_spec_helper' require 'spec_helper' -describe 'php' do +describe 'php::install' do context 'with defaults for all parameters' do it { should contain_class('php::install') }
Fix class name in tests
diff --git a/attributes/default.rb b/attributes/default.rb index abc1234..def5678 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -6,6 +6,7 @@ domain_prefix = '' domain_prefix = "#{node.chef_environment}-" if node.chef_environment != 'prod' +domain_prefix = 'stage-' if node.chef_environment == 'stage-newvpc' set['et_verify_app']['server_name'] = "#{domain_prefix}verify.evertrue.com"
Fix subdomain for stage w/ stage-newvpc
diff --git a/lib/active_model/railtie.rb b/lib/active_model/railtie.rb index abc1234..def5678 100644 --- a/lib/active_model/railtie.rb +++ b/lib/active_model/railtie.rb @@ -4,7 +4,7 @@ class Railtie < Rails::Railtie initializer "active_model.globalid" do config.after_initialize do |app| - ActiveModel::SignedGlobalID.verifier = Rails.application.message_verifier(:signed_global_ids) + ActiveModel::SignedGlobalID.verifier = app.message_verifier(:signed_global_ids) end ActiveSupport.on_load(:active_record) do
Use the right instance of the application
diff --git a/BIObjCHelpers.podspec b/BIObjCHelpers.podspec index abc1234..def5678 100644 --- a/BIObjCHelpers.podspec +++ b/BIObjCHelpers.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "BIObjCHelpers" - s.version = "0.4.1" + s.version = "0.4.2" s.summary = "My collection of Objective-C helpers" s.description = <<-DESC Simple collection of classes commonly used in Objective-C projects.
Bump up pod version number
diff --git a/spec/toy/equality_spec.rb b/spec/toy/equality_spec.rb index abc1234..def5678 100644 --- a/spec/toy/equality_spec.rb +++ b/spec/toy/equality_spec.rb @@ -1,7 +1,7 @@ require 'helper' describe Toy::Equality do - uses_constants('User', 'Game', 'Person') + uses_objects('User', 'Person') describe "#eql?" do it "returns true if same class and id" do
Use objects for equality spec.
diff --git a/Casks/phpstorm-eap.rb b/Casks/phpstorm-eap.rb index abc1234..def5678 100644 --- a/Casks/phpstorm-eap.rb +++ b/Casks/phpstorm-eap.rb @@ -1,6 +1,6 @@ cask :v1 => 'phpstorm-eap' do - version '139.1226' - sha256 '7f9e55d3f5070fb5869eb7053566f21067600d11f93435074fad9cf399ea1626' + version '141.176' + sha256 'a5c70789db4aa13c938de761029b15b2348b0a39f7ac549eaa7c82434373caed' url "http://download.jetbrains.com/webide/PhpStorm-EAP-#{version}.dmg" homepage 'http://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Early+Access+Program' @@ -15,6 +15,6 @@ zap :delete => [ '~/Library/Application Support/WebIde80', '~/Library/Preferences/WebIde80', - '~/Library/Preferences/com.jetbrains.PhpStorm.plist', + '~/Library/Preferences/com.jetbrains.PhpStorm-EAP.plist', ] end
Update PhpStorm-EAP.app to version 141.176.
diff --git a/lib/image_optim/worker/gifsicle.rb b/lib/image_optim/worker/gifsicle.rb index abc1234..def5678 100644 --- a/lib/image_optim/worker/gifsicle.rb +++ b/lib/image_optim/worker/gifsicle.rb @@ -9,7 +9,7 @@ LEVEL_OPTION = option(:level, 3, 'Compression level: '\ - '`0` - Does nothing, '\ + '`0` - Set unoptimazation flag, '\ '`1` - stores only the changed portion of each image, '\ '`2` - slso uses transparency to shrink the file further., '\ '`3` - try several optimization methods (usually slower, sometimes better results)') do |v| @@ -30,6 +30,7 @@ ] args.unshift('-i') if interlace args.unshift("-O#{level}") unless level == 0 + args.unshift("--unoptimize") if level == 0 execute(:gifsicle, *args) && optimized?(src, dst) end end
Send --unoptimize if Gifsicle level is 0
diff --git a/lib/linkedin/api/authentication.rb b/lib/linkedin/api/authentication.rb index abc1234..def5678 100644 --- a/lib/linkedin/api/authentication.rb +++ b/lib/linkedin/api/authentication.rb @@ -13,7 +13,7 @@ params.reverse_merge! redirect_uri: configuration.redirect_uri opts = { mode: :query, param_name: 'oauth2_access_token' } - self.access_token = auth_code.get_token authorization_code, params, opts + credentials.auth_code.get_token authorization_code, params, opts end private
Use auth_code provided by credentials
diff --git a/Casks/paraview-lion-python27.rb b/Casks/paraview-lion-python27.rb index abc1234..def5678 100644 --- a/Casks/paraview-lion-python27.rb +++ b/Casks/paraview-lion-python27.rb @@ -4,12 +4,10 @@ version '4.1.0' sha1 '6da244c25bd500e44f1f020a0e44f5a239708a40' link 'paraview.app' - - def caveats; <<-EOS.undent + caveats <<-EOS.undent This version of ParaView is for OS X Lion (10.7) or Mountain Lion (10.8) and should be installed if the system Python version is 2.6. If your OS version is Lion (10.7) or later, and your system Python version is 2.7 or later, you may install this cask or the standard paraview cask. EOS - end end
Use caveats DSL in Paraview Lion Python 2.7.
diff --git a/lib/sparrow/response_middleware.rb b/lib/sparrow/response_middleware.rb index abc1234..def5678 100644 --- a/lib/sparrow/response_middleware.rb +++ b/lib/sparrow/response_middleware.rb @@ -10,6 +10,7 @@ def converted_response_body # return the original body if we are not going to process it return body if unprocessable_status? + return body unless strategy.has_processable_request? response_body = Sparrow::Strategies::JsonFormatStrategy.convert(body)
Return body unprocessed when not processable When strategy says our response is unprocessable, then we should not process the response.
diff --git a/Initializable.podspec b/Initializable.podspec index abc1234..def5678 100644 --- a/Initializable.podspec +++ b/Initializable.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Initializable" - s.version = "1.0.1" + s.version = "1.1.0" s.summary = "Application Initializer protocols" s.description = <<-DESC
Update project version to 1.1.0
diff --git a/laravel/recipes/environment_variables.rb b/laravel/recipes/environment_variables.rb index abc1234..def5678 100644 --- a/laravel/recipes/environment_variables.rb +++ b/laravel/recipes/environment_variables.rb @@ -7,7 +7,7 @@ variables( database: deploy[:database], - variables: (deploy[application.to_s][:environment] rescue {}), + variables: (deploy[:environment_variables] rescue {}) ) only_if { ::File.directory?("#{deploy[:deploy_to]}/current") }
Adjust the location of the environment variables
diff --git a/lib/allowing/validations_group.rb b/lib/allowing/validations_group.rb index abc1234..def5678 100644 --- a/lib/allowing/validations_group.rb +++ b/lib/allowing/validations_group.rb @@ -1,9 +1,6 @@-require 'allowing/helpers/scope_helpers' -require 'allowing/wrapped_validation_builder' - module Allowing class ValidationsGroup - attr_reader :attribute, :validations + attr_reader :validations def initialize(validations = []) @validations = validations
Remove unnecessary reader and requires
diff --git a/AlamofireActivityLogger.podspec b/AlamofireActivityLogger.podspec index abc1234..def5678 100644 --- a/AlamofireActivityLogger.podspec +++ b/AlamofireActivityLogger.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |spec| spec.name = "AlamofireActivityLogger" - spec.version = "1.0.1" + spec.version = "2.0.0" spec.summary = "A response serializer for Alamofire which logs both request and response" spec.description = <<-DESC A response serializer for Alamofire which prints both request and responses. It provides 4 log levels and a few options to configure your logs. @@ -18,7 +18,9 @@ spec.requires_arc = true spec.framework = "Foundation" - spec.dependency "Alamofire", "~> 3.4" + spec.dependency "Alamofire", "~> 4.0" spec.source_files = "alamofire_activity_logger/Request+ActivityLogger.swift" + spec.pod_target_xcconfig = { 'SWIFT_VERSION' => '3.0' } + end
Change Alamofire version in podspec
diff --git a/BHCDatabase/app/grids/medical_conditions_grid.rb b/BHCDatabase/app/grids/medical_conditions_grid.rb index abc1234..def5678 100644 --- a/BHCDatabase/app/grids/medical_conditions_grid.rb +++ b/BHCDatabase/app/grids/medical_conditions_grid.rb @@ -6,7 +6,7 @@ end filter(:id, :string, :multiple => ',') - filter(:name, :string) { |value| where('name like ? ', "%#{value}%") } + filter(:name, :string) { |value| where.has { name =~ "%#{value}%" } } column(:id, :mandatory => true) do |model| format(model.id) { |value| link_to value, model }
Change medical conditions grid to use new search method
diff --git a/lib/deep_cover/node/exceptions.rb b/lib/deep_cover/node/exceptions.rb index abc1234..def5678 100644 --- a/lib/deep_cover/node/exceptions.rb +++ b/lib/deep_cover/node/exceptions.rb @@ -40,6 +40,12 @@ class Kwbegin < Node include NodeBehavior::CoverWithNextInstruction + include NodeBehavior::CoverEntry + + def next_instruction + n = children.first + n if n && n.type != :rescue + end end class Rescue < Node
Handle case of empty body being rescued
diff --git a/app/controllers/butterfli/instagram/rails/api_controller.rb b/app/controllers/butterfli/instagram/rails/api_controller.rb index abc1234..def5678 100644 --- a/app/controllers/butterfli/instagram/rails/api_controller.rb +++ b/app/controllers/butterfli/instagram/rails/api_controller.rb @@ -1,4 +1,4 @@-class Butterfli::Instagram::Rails::ApiController < Butterfli::Controller +class Butterfli::Instagram::Rails::ApiController < Butterfli::Rails::Controller layout nil protect_from_forgery with: :null_session, :if => Proc.new { |c| c.request.format == 'application/json' }
Fixed: Use of namespace changes in Butterfli Rails
diff --git a/lib/dpl/provider/azure_webapps.rb b/lib/dpl/provider/azure_webapps.rb index abc1234..def5678 100644 --- a/lib/dpl/provider/azure_webapps.rb +++ b/lib/dpl/provider/azure_webapps.rb @@ -28,7 +28,7 @@ end def push_app - log "Deploying to Azure Web App '#{config[slot] || config['site']}'" + log "Deploying to Azure Web App '#{config['slot'] || config['site']}'" if !!options[:verbose] context.shell "git push --force --quiet #{git_target} master"
Fix log when deploying via azure web apps using slot
diff --git a/lib/omniauth/strategies/github.rb b/lib/omniauth/strategies/github.rb index abc1234..def5678 100644 --- a/lib/omniauth/strategies/github.rb +++ b/lib/omniauth/strategies/github.rb @@ -28,7 +28,7 @@ end extra do - {:user_hash => raw_info} + {:raw_info => raw_info} end def raw_info
Use new :raw_info semantic instead of :user_hash.
diff --git a/server/app/controllers/files_controller.rb b/server/app/controllers/files_controller.rb index abc1234..def5678 100644 --- a/server/app/controllers/files_controller.rb +++ b/server/app/controllers/files_controller.rb @@ -19,7 +19,7 @@ rescue Exception => e logger.error e.message logger.info e.backtrace.join("\n") if params[:debug] - response = e.message + response = e.message + "\n" response << e.backtrace.join("\n") if params[:debug] render :text => response, :status => :internal_server_error end
Add a newline when assembling error response message so that the error and the backtrace don't blend together on the same line.
diff --git a/spec/haml_lint/parser_spec.rb b/spec/haml_lint/parser_spec.rb index abc1234..def5678 100644 --- a/spec/haml_lint/parser_spec.rb +++ b/spec/haml_lint/parser_spec.rb @@ -4,54 +4,54 @@ context 'when skip_frontmatter is true' do let(:parser) { HamlLint::Parser.new(haml, 'skip_frontmatter' => true) } - let(:haml) { <<-HAML } ---- -:key: value ---- -%tag - Some non-inline text -- 'some code' + let(:haml) { normalize_indent(<<-HAML) } + --- + :key: value + --- + %tag + Some non-inline text + - 'some code' HAML it 'excludes the frontmatter' do - expect(parser.contents).to eq(<<-CONTENT) -%tag - Some non-inline text -- 'some code' + expect(parser.contents).to eq(normalize_indent(<<-CONTENT)) + %tag + Some non-inline text + - 'some code' CONTENT end context 'when haml has --- as content' do - let(:haml) { <<-HAML } ---- -:key: value ---- -%tag - Some non-inline text -- 'some code' - --- - HAML + let(:haml) { normalize_indent(<<-HAML) } + --- + :key: value + --- + %tag + Some non-inline text + - 'some code' + --- + HAML it 'is not greedy' do - expect(parser.contents).to eq(<<-CONTENT) -%tag - Some non-inline text -- 'some code' - --- - CONTENT + expect(parser.contents).to eq(normalize_indent(<<-CONTENT)) + %tag + Some non-inline text + - 'some code' + --- + CONTENT end end end context 'when skip_frontmatter is false' do let(:parser) { HamlLint::Parser.new(haml, 'skip_frontmatter' => false) } - let(:haml) { <<-HAML } ---- -:key: value ---- -%tag - Some non-inline text -- 'some code' + let(:haml) { normalize_indent(<<-HAML) } + --- + :key: value + --- + %tag + Some non-inline text + - 'some code' HAML it 'raises HAML error' do
Indent heredocs in Parser spec Heredocs that aren't indented are more difficult to read. Fix that by indenting them and using the `normalize_indent` helper to avoid a parse error. Change-Id: Ia8cde89109290a548f421ad1db642e9c7926c7a4 Reviewed-on: http://gerrit.causes.com/42552 Tested-by: jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@causes.com> Reviewed-by: Shane da Silva <67fb7bfe39f841b16a1f86d3928acc568d12c716@brigade.com>
diff --git a/spec/requests/profile_spec.rb b/spec/requests/profile_spec.rb index abc1234..def5678 100644 --- a/spec/requests/profile_spec.rb +++ b/spec/requests/profile_spec.rb @@ -0,0 +1,48 @@+require 'spec_helper' + +describe "Profile account page" do + let(:user) { create(:user) } + + before do + login_as :user + end + + describe "when signup is enabled" do + before do + Gitlab.config.gitlab.stub(:signup_enabled).and_return(true) + visit account_profile_path + end + it { page.should have_content("Remove account") } + + it "should delete the account", js: true do + expect { click_link "Delete account" }.to change {User.count}.by(-1) + current_path.should == new_user_session_path + end + end + + describe "when signup is enabled and user has a project" do + before do + Gitlab.config.gitlab.stub(:signup_enabled).and_return(true) + @project = create(:project, namespace: @user.namespace) + @project.team << [@user, :master] + visit account_profile_path + end + it { page.should have_content("Remove account") } + + it "should not allow user to delete the account" do + expect { click_link "Delete account" }.not_to change {User.count}.by(-1) + end + end + + describe "when signup is disabled" do + before do + Gitlab.config.gitlab.stub(:signup_enabled).and_return(false) + visit account_profile_path + end + + it "should not have option to remove account" do + page.should_not have_content("Remove account") + current_path.should == account_profile_path + end + end +end
Test the delete acount option.
diff --git a/lib/rubocopfmt/rubocop_version.rb b/lib/rubocopfmt/rubocop_version.rb index abc1234..def5678 100644 --- a/lib/rubocopfmt/rubocop_version.rb +++ b/lib/rubocopfmt/rubocop_version.rb @@ -10,6 +10,6 @@ '!= 0.44.0', # Restrict to latest version tested. - '<= 0.48' + '< 0.48' ].freeze end
Fix incorrect Rubocop dependency version string
diff --git a/lib/saasable/scoped_controller.rb b/lib/saasable/scoped_controller.rb index abc1234..def5678 100644 --- a/lib/saasable/scoped_controller.rb +++ b/lib/saasable/scoped_controller.rb @@ -16,7 +16,7 @@ private def fetch_current_saas - @current_saas = Saasable::SaasDocument.find_by_host!(request.host) + @current_saas = Saasable::SaasDocument.saas_document.find_by_host!(request.host) end def scope_models_by_saas
Fix another bug on ScopedController.
diff --git a/recipes/config_kairosdb.rb b/recipes/config_kairosdb.rb index abc1234..def5678 100644 --- a/recipes/config_kairosdb.rb +++ b/recipes/config_kairosdb.rb @@ -15,10 +15,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -include_recipe "kairosdb::install_kairosdb" - # Check if autodiscover cassandra cluster is enabled node.default['kairosdb']['config']['kairosdb.datastore.cassandra.host_list']=discover_cassandra_seed_nodes if node['kairosdb']['cassandra_seed_discovery'] + +service "kairosdb" do + action :nothing +end template '/opt/kairosdb/conf/kairosdb.properties' do source 'kairosdb.properties.erb'
Add service to remove recursive dep
diff --git a/lib/weary/middleware/hmac_auth.rb b/lib/weary/middleware/hmac_auth.rb index abc1234..def5678 100644 --- a/lib/weary/middleware/hmac_auth.rb +++ b/lib/weary/middleware/hmac_auth.rb @@ -11,35 +11,37 @@ end def call(env) - request = Rack::Request.new(env) - @app.call signed_env_for_weary(env) + set_content_type! env + sign! env + @app.call env end private attr_reader :access_id, :secret_key - def env_for_signing(env) - env.dup.tap do |new_env| + def set_content_type!(env) + env.tap do |e| # Weary::Middleware::ContentType is dynamically injected after # this middleware is called and since Content-Type is used to - # sign HMAC signatures, we have to set it before signing it. - if ['POST', 'PUT'].include? env['REQUEST_METHOD'] - new_env.update 'CONTENT_TYPE' => 'application/x-www-form-urlencoded' + # sign HMAC signatures, we have to mimic that behavior so that + # there's no difference in the headers when it's authenticated. + if ['POST', 'PUT'].include? e['REQUEST_METHOD'] + e.update 'CONTENT_TYPE' => 'application/x-www-form-urlencoded' end end end def signed_request(env) - Rack::Request.new(env_for_signing(env)).tap do |r| + Rack::Request.new(env).tap do |r| ApiAuth.sign! r, access_id, secret_key end end - def signed_env_for_weary(env) + def sign!(env) req = signed_request(env) - env.dup.tap do |e| + env.tap do |e| # Weary wants all headers to be in HTTP_[UPCASE] format for Rack env compatibility e.update( 'HTTP_AUTHORIZATION' => req.env['Authorization'],
Fix signing of PUT requests without params
diff --git a/lib/websocket/client_handshake.rb b/lib/websocket/client_handshake.rb index abc1234..def5678 100644 --- a/lib/websocket/client_handshake.rb +++ b/lib/websocket/client_handshake.rb @@ -7,25 +7,37 @@ Digest::SHA1.base64digest(websocket_key.strip + GUID) end - def initialize(method, uri, headers = {}, proxy = {}, body = nil, version = "1.1") - @method = method.to_s.downcase.to_sym - @uri = uri.is_a?(URI) ? uri : URI(uri.to_s) - - @headers = headers - @proxy, @body, @version = proxy, body, version + def errors + @errors ||= [] end def valid? - headers['Connection'] == 'Upgrade' && - headers['Upgrade'] == 'websocket' && - headers['Sec-WebSocket-Version'].to_i == PROTOCOL_VERSION + if headers['Connection'].downcase != 'upgrade' + errors << 'Not connection upgrade' + return false + end + + if headers['Upgrade'].downcase != 'websocket' + errors << 'Connection upgrade is not for websocket' + return false + end + + # Careful: Http gem changes header capitalization, + # so Sec-WebSocket-Version becomes Sec-Websocket-Version + if headers['Sec-Websocket-Version'].to_i != PROTOCOL_VERSION + errors << "Protocol version not supported '#{headers['Sec-Websocket-Version']}'" + return false + end + + return true end def accept_response + websocket_key = headers['Sec-Websocket-Key'] response_headers = { 'Upgrade' => 'websocket', 'Connection' => 'Upgrade', - 'Sec-WebSocket-Accept' => ClientHandshake.accept_token_for(headers['Sec-WebSocket-Key']) + 'Sec-WebSocket-Accept' => ClientHandshake.accept_token_for(websocket_key) } ServerHandshake.new(101, '1.1', response_headers)
Add validation errors to client handshake
diff --git a/spooky.gemspec b/spooky.gemspec index abc1234..def5678 100644 --- a/spooky.gemspec +++ b/spooky.gemspec @@ -14,15 +14,8 @@ spec.homepage = "TODO: Put your gem's website or public repo URL here." spec.license = "MIT" - # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host' - # to allow pushing to a single host or delete this section to allow pushing to any host. - if spec.respond_to?(:metadata) - spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'" - else - raise "RubyGems 2.0 or newer is required to protect against public gem pushes." - end - - spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } + file_match = %r{^(test|spec|features)/} + spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(file_match) } spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"]
:bulb: Allow gem to be pushed to any host
diff --git a/TTRangeSlider.podspec b/TTRangeSlider.podspec index abc1234..def5678 100644 --- a/TTRangeSlider.podspec +++ b/TTRangeSlider.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "TTRangeSlider" - s.version = "1.0.2" + s.version = "1.0.3" s.summary = "A slider that allows you to pick a range" s.description = <<-DESC A slider, similar in style to UISlider, but has two handles instead of one, allowing you to pick a minimum and maximum range.
Update podspec to v 1.0.3
diff --git a/swagger_rails.gemspec b/swagger_rails.gemspec index abc1234..def5678 100644 --- a/swagger_rails.gemspec +++ b/swagger_rails.gemspec @@ -17,7 +17,7 @@ s.files = Dir["{app,bower_components/swagger-ui/dist,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"] s.add_dependency 'rack' - s.add_dependency "rails", ">= 3.1", "<= 5" + s.add_dependency "rails", ">= 3.1", "< 5.1" s.add_development_dependency "rspec-rails", "~> 3.0" end
Allow all minor updates of Rails 5.0.
diff --git a/lib/approvals/reporters/reporter.rb b/lib/approvals/reporters/reporter.rb index abc1234..def5678 100644 --- a/lib/approvals/reporters/reporter.rb +++ b/lib/approvals/reporters/reporter.rb @@ -23,7 +23,7 @@ protected def launch(received, approved) - exec launcher.call(received, approved) + `#{launcher.call(received, approved)}` end end end
Use backticks to avoid hijacking execution
diff --git a/lib/batch/framework/configurable.rb b/lib/batch/framework/configurable.rb index abc1234..def5678 100644 --- a/lib/batch/framework/configurable.rb +++ b/lib/batch/framework/configurable.rb @@ -6,14 +6,15 @@ module ClassMethods - def configure(cfg_file = nil, options = {}) - if cfg_file.is_a?(Hash) - options = cfg_file - cfg_file = nil + def configure(*cfg_files) + options = cfg_files.last.is_a?(Hash) ? cfg_files.pop : {} + config.decryption_key = options.delete(:decryption_key) if options[:decryption_key] + config.merge!(options) + cfg_files.each do |cfg_file| + config.load(cfg_file, !options.fetch(:ignore_unknown_placeholders, true)) end - config.decryption_key = options[:decryption_key] if options[:decryption_key] - if cfg_file - config.load(cfg_file, !options.fetch(:ignore_unknown_placeholders, true)) + if defined?(Batch::Events) + Batch::Events.publish(self, 'post-configure', config) end config end
Handle multiple config files, fire post-config event
diff --git a/lib/challenger/recipes/passenger.rb b/lib/challenger/recipes/passenger.rb index abc1234..def5678 100644 --- a/lib/challenger/recipes/passenger.rb +++ b/lib/challenger/recipes/passenger.rb @@ -7,3 +7,13 @@ run "sudo -u root `rbenv which passenger-install-nginx-module` --auto --auto-download --prefix=/etc/nginx" end end + +namespace :deploy do + task :start do; end + task :stop do; end + + desc "Restart Application" + task :restart, roles: :app, except: {no_release: true} do + run "touch #{deploy_to}/current/tmp/restart.txt" + end +end
Add deploy:start, :stop, :restart tasks. Doesn't work right now.
diff --git a/db/migrate/20160331192758_add_migration_for_add_early_disposition_request_event_type_rake_task.rb b/db/migrate/20160331192758_add_migration_for_add_early_disposition_request_event_type_rake_task.rb index abc1234..def5678 100644 --- a/db/migrate/20160331192758_add_migration_for_add_early_disposition_request_event_type_rake_task.rb +++ b/db/migrate/20160331192758_add_migration_for_add_early_disposition_request_event_type_rake_task.rb @@ -0,0 +1,9 @@+class AddMigrationForAddEarlyDispositionRequestEventTypeRakeTask < ActiveRecord::Migration + def change + reversible do |change| + change.up do + Rake::Task['transam_core_data:add_early_disposition_request_event_type'].invoke + end + end + end +end
Add data migration to add early_disposition_request event type
diff --git a/api/app/controllers/v1/slack_invitation/strategies_controller.rb b/api/app/controllers/v1/slack_invitation/strategies_controller.rb index abc1234..def5678 100644 --- a/api/app/controllers/v1/slack_invitation/strategies_controller.rb +++ b/api/app/controllers/v1/slack_invitation/strategies_controller.rb @@ -2,15 +2,15 @@ module SlackInvitation class StrategiesController < ApplicationController def show - render json: { - id: 0, - name: 'mason', - club_name: 'Mason Hack Club', - primary_color: '#d31b6b', - greeting: "Hello welcome to Hack Club's Slack :)", - channels: [], - user_groups: [] - } + @strat = SlackInviteStrategy.find_by(name: params[:id]) + + unless @strat + render json: {}, status: 404 + + return + end + + render json: @strat end end end
Add proper lookup for strategies
diff --git a/spec/controllers/places_controller_spec.rb b/spec/controllers/places_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/places_controller_spec.rb +++ b/spec/controllers/places_controller_spec.rb @@ -3,32 +3,24 @@ describe PlacesController do describe "GET #index" do it "properly assigns all of the places to @places" do - # places = FactoryGirl.create_list(:place, 3) - # p "**************************" - # p places - # p places.length - # p "******************************" + places = FactoryGirl.create_list(:place, 3) get :index expect(assigns(:places).length).to eq(3) end end - # describe "GET #show" do - # context "when a place exists" do - # it "assigns @place as an instance of Place" do - # place = FactoryGirl.create(:place) - # p "++++++++++++++++++++++++++" - # p place - # p places.length - # p "++++++++++++++++++++++++++" - # get :show, id: place.id - # expect(assigns(:place)).to be_a(Place) - # end + describe "GET #show" do + context "when a place exists" do + let!(:place) { FactoryGirl.create :place } + it "assigns @place as an instance of Place" do + get :show, id: place.id + expect(assigns(:place)).to be_a(Place) + end - # it "ensures @place has the correct id" do - # get :show, id: place.id - # expect(assigns(:place).id).to eq(place.id) - # end - # end - # end + it "ensures @place has the correct id" do + get :show, id: place.id + expect(assigns(:place).id).to eq(place.id) + end + end + end end
Add tests to places controller
diff --git a/spec/tasks/get-commit-shasums/task_spec.rb b/spec/tasks/get-commit-shasums/task_spec.rb index abc1234..def5678 100644 --- a/spec/tasks/get-commit-shasums/task_spec.rb +++ b/spec/tasks/get-commit-shasums/task_spec.rb @@ -4,11 +4,14 @@ describe 'get-commit-shasums', :fly do before :context do @sha_artifacts = Dir.mktmpdir - `git init ./spec/tasks/get-commit-shasums` - execute("-c tasks/get-commit-shasums/task.yml -i buildpacks-ci=. --include-ignored -i buildpack-checksums=./spec/tasks/get-commit-shasums -i buildpack-artifacts=./spec/tasks/get-commit-shasums/pivotal-buildpacks-cached -o sha-artifacts=#{@sha_artifacts}") + @buildpack_checksums = Dir.mktmpdir + `rsync -a ./spec/tasks/get-commit-shasums/ #{@buildpack_checksums}/` + `git init #{@buildpack_checksums}` + execute("-c tasks/get-commit-shasums/task.yml --include-ignored -i buildpacks-ci=. -i buildpack-checksums=#{@buildpack_checksums} -i buildpack-artifacts=#{@buildpack_checksums}/pivotal-buildpacks-cached -o sha-artifacts=#{@sha_artifacts}") end after(:context) do FileUtils.rm_rf @sha_artifacts + FileUtils.rm_rf @buildpack_checksums end it 'has a helpful commit message' do
Copy fixture to tempdir before altering
diff --git a/lib/kosmos/packages/precise_node.rb b/lib/kosmos/packages/precise_node.rb index abc1234..def5678 100644 --- a/lib/kosmos/packages/precise_node.rb +++ b/lib/kosmos/packages/precise_node.rb @@ -0,0 +1,9 @@+class PreciseNode < Kosmos::Package + title 'Precise Node' + aliases 'precisenode' + url 'http://blizzy.de/precise-node/PreciseNode-0.12.zip' + + def install + merge_directory 'PreciseNode-0.12/GameData' + end +end
Add a package for PreciseNode.
diff --git a/db/migrate/20130822161803_add_prominence_fields_to_outgoing_message.rb b/db/migrate/20130822161803_add_prominence_fields_to_outgoing_message.rb index abc1234..def5678 100644 --- a/db/migrate/20130822161803_add_prominence_fields_to_outgoing_message.rb +++ b/db/migrate/20130822161803_add_prominence_fields_to_outgoing_message.rb @@ -0,0 +1,6 @@+class AddProminenceFieldsToOutgoingMessage < ActiveRecord::Migration + def change + add_column :outgoing_messages, :prominence, :string, :null => false, :default => 'normal' + add_column :outgoing_messages, :prominence_reason, :text + end +end
Add prominence fields to outgoing message.
diff --git a/lib/modules/search/filter_params.rb b/lib/modules/search/filter_params.rb index abc1234..def5678 100644 --- a/lib/modules/search/filter_params.rb +++ b/lib/modules/search/filter_params.rb @@ -0,0 +1,81 @@+class Search::FilterParams + + def self.standardise(filters) + self.new(filters).standardise + end + + def initialize(filters) + @filters = filters + end + + def standardise + sanitise_location_filter + sanitise_db_type_filter + sanitise_type_filter + sanitise_ancestor_filter + sanitise_categories_filter + sanitise_special_status_filter + filters + end + + #{'location' => {'type' => 'country', 'options' => ['Italy']}} + def sanitise_location_filter + if filters['location'].present? && filters['location']['options'].present? + filters[filters['location']['type'].to_sym] = filters['location']['options'] + end + + # ensure to delete 'location' as it conflicts with the coordinates location filter in the Search modules + filters.delete('location') + end + + def sanitise_db_type_filter + db_type = filters.delete('db_type') + db_type = db_type && db_type.reject { |i| i == 'all' } + return if db_type.blank? || db_type.length != 1 + + filters[:is_oecm] = true if db_type.first == 'oecm' + end + + def sanitise_type_filter + # ['marine', 'terrestrial', 'all'] + is_type = filters.delete('is_type') + return if !is_type || is_type.include?('all') || is_type.length != 1 + + filters[:marine] = is_type.first == 'marine' + end + + FAKE_CATEGORIES = %w(all areas).freeze + def sanitise_ancestor_filter + ancestor = filters.delete('ancestor') + + return if ancestor.blank? || FAKE_CATEGORIES.include?(ancestor) + + filters['ancestor'] = ancestor.to_i + end + + def sanitise_special_status_filter + # ['has_parcc_info', 'is_green_list'] + special_status = filters.delete('special_status') + return unless special_status + + special_status.map do |status| + filters[status.to_sym] = true + end + end + + def sanitise_categories_filter + topics = filters.delete('topics') + types = filters.delete('types') + + return if topics.blank? && types.blank? + + filters[:topic] = topics if topics.present? + filters[:page_type] = types if types.present? + end + + private + + def filters + @filters + end +end
Add forgotten filter params class
diff --git a/lib/pdf_ravager/strategies/smart.rb b/lib/pdf_ravager/strategies/smart.rb index abc1234..def5678 100644 --- a/lib/pdf_ravager/strategies/smart.rb +++ b/lib/pdf_ravager/strategies/smart.rb @@ -4,6 +4,16 @@ def initialize(stamper) @acro_form = Strategies::AcroForm.new(stamper) @xfa = Strategies::XFA.new(stamper) + afields = stamper.getAcroFields + @type = if afields.getXfa.isXfaPresent + if afields.getFields.empty? + :dynamic_xfa + else + :static_xfa + end + else + :acro_form + end end def set_field_values(template) @@ -15,7 +25,12 @@ end def set_read_only - [@acro_form, @xfa].each(&:set_read_only) + case @type + when :acro_form, :static_xfa + @acro_form.set_read_only + when :dynamic_xfa + @xfa.set_read_only + end end end end
Fix Smart strategy not setting XFA read-only properly
diff --git a/core/lib/spree/core/testing_support/factories/product_factory.rb b/core/lib/spree/core/testing_support/factories/product_factory.rb index abc1234..def5678 100644 --- a/core/lib/spree/core/testing_support/factories/product_factory.rb +++ b/core/lib/spree/core/testing_support/factories/product_factory.rb @@ -1,6 +1,6 @@ FactoryGirl.define do factory :simple_product, :class => Spree::Product do - sequence(:name) { |n| "Product ##{n} - #{rand(9999)}" } + sequence(:name) { |n| "Product ##{n} - #{Kernel.rand(9999)}" } description { Faker::Lorem.paragraphs(1 + Kernel.rand(5)).join("\n") } price 19.99 cost_price 17.00
Fix product factory name sequence with Kernel.rand so it is not interpreted as a Spree::Product method Fixes #1964
diff --git a/rails/app/views/feeds/mpdream_info.xml.builder b/rails/app/views/feeds/mpdream_info.xml.builder index abc1234..def5678 100644 --- a/rails/app/views/feeds/mpdream_info.xml.builder +++ b/rails/app/views/feeds/mpdream_info.xml.builder @@ -2,8 +2,8 @@ xml.publicwhip do @policy_member_distances.each do |pmd| xml.memberinfo("id" => "uk.org.publicwhip/member/#{pmd.member.id}", - "public_whip_dreammp#{pmd.policy.id}_absent" => pmd.nvotesabsent + pmd.nvotesabsentstrong, + "public_whip_dreammp#{pmd.policy.id}_distance" => number_with_precision(pmd.distance_a, strip_insignificant_zeros: true), "public_whip_dreammp#{pmd.policy.id}_both_voted" => pmd.nvotessame + pmd.nvotessamestrong + pmd.nvotesdiffer + pmd.nvotesdifferstrong, - "public_whip_dreammp#{pmd.policy.id}_distance" => number_with_precision(pmd.distance_a, strip_insignificant_zeros: true)) + "public_whip_dreammp#{pmd.policy.id}_absent" => pmd.nvotesabsent + pmd.nvotesabsentstrong) end end
Change order so it matches PHP and is easier to visually compare
diff --git a/axiom.gemspec b/axiom.gemspec index abc1234..def5678 100644 --- a/axiom.gemspec +++ b/axiom.gemspec @@ -13,8 +13,8 @@ gem.license = 'MIT' gem.require_paths = %w[lib] - gem.files = `git ls-files`.split("\n") - gem.test_files = `git ls-files -- spec/{unit,integration}`.split("\n") + gem.files = `git ls-files`.split($/) + gem.test_files = `git ls-files -- spec/{unit,integration}`.split($/) gem.extra_rdoc_files = %w[LICENSE README.md CONTRIBUTING.md TODO] gem.add_runtime_dependency('abstract_type', '~> 0.0.7')
Change gemspec to use the OS specific line break
diff --git a/db/data_migration/20160623092908_correct_document_content_ids.rb b/db/data_migration/20160623092908_correct_document_content_ids.rb index abc1234..def5678 100644 --- a/db/data_migration/20160623092908_correct_document_content_ids.rb +++ b/db/data_migration/20160623092908_correct_document_content_ids.rb @@ -0,0 +1,44 @@+# Documents with the following slugs exist in Whitehall. +slugs_to_fix = %w{ + how-to-appeal-your-rateable-value + cma-opens-consultation-on-reed-elsevier-undertakings + uk-visa-operations-in-south-india-are-impacted-by-the-floods-in-chennai + common-land-guidance-for-commons-registration-authorities-and-applicants + rpa-remains-on-track-to-pay-bps-2015-claims-from-december +} + +# Each of these documents have published editions and render correctly on the +# Whitehall frontend. +# None of them have corresponding content items in the content store. +# They do however, have corresponding items in the publishing API database +# (matching on the base_path determined by Whitehall's url_maker). + +# The content IDs recorded in Whitehall for these items do not match anything +# in the publishing API. The content IDs in the publishing API, however, match +# 5 'similar' documents in Whitehall: +obsolete_slugs = %w{ + deleted-how-to-appeal-your-rateable-value + lorem-ipsum-dolor-sit-amet-elit-311681 + deleted-uk-visa-operations-in-south-india-are-impacted-by-the-floods-in-chennai + deleted-common-land-guidance-for-commons-registration-authorities-and-applicants + deleted-rpa-remains-on-track-to-pay-bps-2015-claims-from-december +} + +# These appear to be junk documents with no corresponding editions, and can be +# safely deleted. +obsolete_slugs.each do |slug| + Document.where(slug: slug).first!.destroy! +end + +# As for the 'good' documents with incorrect content IDs, we can fetch the +# correct IDs from the content store and set them accordingly: +slugs_to_fix.each do |slug| + document = Document.find_by(slug: slug) + base_path = Whitehall.url_maker.public_document_path(document.published_edition) + correct_content_id = Whitehall.publishing_api_v2_client.lookup_content_id(base_path: base_path) + if correct_content_id.blank? + raise ArgumentError, "no content id found for #{base_path}" + end + document.content_id = correct_content_id + document.save! +end
Fix content IDs and remove obsolete documents The Finding Things migration checker has detected an inconsistency in the state of 5 documents across Whitehall > Publishing API > Content Store. These items do not exist in the content store, and have mismatched content IDs in Whitehall/Publishing API. Further detail is provided in the data migration.
diff --git a/packer_templates/windows/cookbooks/packer/recipes/vm_tools.rb b/packer_templates/windows/cookbooks/packer/recipes/vm_tools.rb index abc1234..def5678 100644 --- a/packer_templates/windows/cookbooks/packer/recipes/vm_tools.rb +++ b/packer_templates/windows/cookbooks/packer/recipes/vm_tools.rb @@ -19,3 +19,18 @@ action :delete end end + +# install vmware tools on vmware guests +# This is from https://github.com/luciusbono/Packer-Windows10/blob/master/install-guest-tools.ps1 +if vmware? + powershell_script 'install vbox guest additions' do + code <<-EOH + $isopath = "C:\\Windows\\Temp\\vmware.iso" + Mount-DiskImage -ImagePath $isopath + $exe = ((Get-DiskImage -ImagePath $isopath | Get-Volume).Driveletter + ':\setup.exe') + $parameters = '/S /v "/qr REBOOT=R"' + Dismount-DiskImage -ImagePath $isopath + Remove-Item $isopath + EOH + end +end
Install vmware tools on windows vmware-iso boxes Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/lib/generators/open_conference_ware/install/install_generator.rb b/lib/generators/open_conference_ware/install/install_generator.rb index abc1234..def5678 100644 --- a/lib/generators/open_conference_ware/install/install_generator.rb +++ b/lib/generators/open_conference_ware/install/install_generator.rb @@ -5,6 +5,16 @@ copy_file "config_initializer.rb", "config/initializers/open_conference_ware.rb" end + def include_engine_seeds + append_to_file "db/seeds.rb" do + <<-SEED + +# Include OpenConferenceWare's seed data +OpenConferenceWare::Engine.load_seed + SEED + end + end + def run_setup_rake_task rake "open_conference_ware:setup" end
Set up the host app to load OCW's seeds, via install generator
diff --git a/ssl_checker.rb b/ssl_checker.rb index abc1234..def5678 100644 --- a/ssl_checker.rb +++ b/ssl_checker.rb @@ -22,8 +22,11 @@ ssl_client.sysclose tcp_client.close - puts "Certificate Expires #{cert.not_after}" - Time.now > cert.not_after ? exit(1) : exit(0) + if Time.now > cert.not_after + puts "FAIL: Certificate Expired #{cert.not_after}" + else + puts "PASS: Certificate Expires #{cert.not_after}" + end end end
Improve output to make failures easier to spot
diff --git a/app/controllers/spree/admin/images_controller.rb b/app/controllers/spree/admin/images_controller.rb index abc1234..def5678 100644 --- a/app/controllers/spree/admin/images_controller.rb +++ b/app/controllers/spree/admin/images_controller.rb @@ -0,0 +1,35 @@+module Spree + module Admin + class ImagesController < ResourceController + before_filter :load_data + + create.before :set_viewable + update.before :set_viewable + destroy.before :destroy_before + + private + + def location_after_save + admin_product_images_url(@product) + end + + def load_data + @product = Product.find_by_permalink(params[:product_id]) + @variants = @product.variants.collect do |variant| + [variant.options_text, variant.id] + end + @variants.insert(0, [Spree.t(:all), @product.master.id]) + end + + def set_viewable + @image.viewable_type = 'Spree::Variant' + @image.viewable_id = params[:image][:viewable_id] + end + + def destroy_before + @viewable = @image.viewable + end + + end + end +end
Bring images controller from spree_backend so we can merge it with ofn's decorator
diff --git a/app/helpers/locomotive/content_entries_helper.rb b/app/helpers/locomotive/content_entries_helper.rb index abc1234..def5678 100644 --- a/app/helpers/locomotive/content_entries_helper.rb +++ b/app/helpers/locomotive/content_entries_helper.rb @@ -5,7 +5,7 @@ content_type = Locomotive::ContentType.class_name_to_content_type(class_name, current_site) if content_type - content_type.ordered_entries.map { |entry| [entry._label, entry._id] } + content_type.ordered_entries.map { |entry| [entry_label(content_type, entry), entry._id] } else [] # unknown content type end
Allow the custom label for a foreign model to be appear in the SELECT menu that lists the belongs_to options for a given model.