diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/helpers/timeline_helper.rb b/app/helpers/timeline_helper.rb index abc1234..def5678 100644 --- a/app/helpers/timeline_helper.rb +++ b/app/helpers/timeline_helper.rb @@ -25,7 +25,7 @@ def detail_link_timeline_content(model) if model.course.show_see_details_link_in_timeline? content_tag(:p) do - content_tag(:a, "See the details", href: "#{url_for(model)}/#{model.id}") + content_tag(:a, "See the details", href: "#{url_for(model)}") end end end
Fix broken link in timeline helper
diff --git a/app/models/concerns/wp_post.rb b/app/models/concerns/wp_post.rb index abc1234..def5678 100644 --- a/app/models/concerns/wp_post.rb +++ b/app/models/concerns/wp_post.rb @@ -15,6 +15,10 @@ # Use gmt date to ignore timezone settings in WordPress self.published_at = json['date_gmt'] self.order = json['menu_order'] + end + + def update_post!(json) + update_post(json) save! end
Allow wp posts to call 'update_post' without saving the model
diff --git a/spec/support/shared_examples/redirect_for_non_students.rb b/spec/support/shared_examples/redirect_for_non_students.rb index abc1234..def5678 100644 --- a/spec/support/shared_examples/redirect_for_non_students.rb +++ b/spec/support/shared_examples/redirect_for_non_students.rb @@ -1,39 +1,33 @@ RSpec.shared_examples 'redirects for non-users' do # OPTIMIZE test actions other than 'index' + + shared_examples_for 'disallows access to students namespace' do + skip + end context 'as an admin' do skip end context 'as a guest' do - it 'redirects to / with an error message' do - skip - end + it_behaves_like 'disallows access to students namespace' end context 'as a coach' do - it 'redirects to / with an error message' do - skip - end + it_behaves_like 'disallows access to students namespace' end context 'as a mentor' do - it 'redirects to / with an error message' do - skip - end + it_behaves_like 'disallows access to students namespace' end context 'as a student' do context 'who is not poart of an accepted team' do - it 'redirects to / with an error message' do - skip - end + it_behaves_like 'disallows access to students namespace' end context 'who is part of an accepted team from last season' do - it 'redirects to / with an error message' do - skip - end + it_behaves_like 'disallows access to students namespace' end end
Use a shared example within a shared example. OMG!
diff --git a/lib/new_card.rb b/lib/new_card.rb index abc1234..def5678 100644 --- a/lib/new_card.rb +++ b/lib/new_card.rb @@ -23,7 +23,6 @@ 'idList'=>"#{@list_id}", 'due'=>nil, 'desc'=>'https://buildkite.com/conversation/tc-i18n-hygiene', - 'labels'=>['name'=>'TC','color'=>'green'], 'idLabels'=>["#{@id_labels}"] } @trello_client.create(:card, data)
Remove unecessary label values in favour of idLabel
diff --git a/lib/rman/cli.rb b/lib/rman/cli.rb index abc1234..def5678 100644 --- a/lib/rman/cli.rb +++ b/lib/rman/cli.rb @@ -8,12 +8,16 @@ store = RDoc::RI::Store.new(RDoc::RI::Paths.system_dir) store.load_all options = RDoc::Options.new - options.op_dir = "doc" + options.op_dir = output_directory options.mandb_section = mandb_section RDoc::Generator::Mdoc.new(store, options).generate end private + + def output_directory + File.expand_path("~/.man") + end def mandb_section "3-ruby-#{ruby_version.gsub(".", "-")}"
Install man pages in ~/.man
diff --git a/lib/dressing/runner/base.rb b/lib/dressing/runner/base.rb index abc1234..def5678 100644 --- a/lib/dressing/runner/base.rb +++ b/lib/dressing/runner/base.rb @@ -17,6 +17,8 @@ Dressing.current_session = Capybara::Session.new driver run_test update_status + ensure + driver.quit end def run_test
Quit the driver after runs.
diff --git a/assignments/ruby/crypto-square/example.rb b/assignments/ruby/crypto-square/example.rb index abc1234..def5678 100644 --- a/assignments/ruby/crypto-square/example.rb +++ b/assignments/ruby/crypto-square/example.rb @@ -20,7 +20,7 @@ plaintext_segments.map do |segment| # There has to be a better way to make sure that # the last segment is as long as the others! - segment.split('').fill("", segment.length..size-1) + segment.split('').fill('', segment.length...size) end.transpose.flatten.join end
Use Range's `...` excluding the size.
diff --git a/lib/sunlight.rb b/lib/sunlight.rb index abc1234..def5678 100644 --- a/lib/sunlight.rb +++ b/lib/sunlight.rb @@ -1,4 +1,3 @@-require 'rubygems' require 'json' require 'cgi' require 'ym4r/google_maps/geocoding'
Remove require 'rubygems' to be a good Ruby citizen.
diff --git a/lib/lita/handlers/google.rb b/lib/lita/handlers/google.rb index abc1234..def5678 100644 --- a/lib/lita/handlers/google.rb +++ b/lib/lita/handlers/google.rb @@ -8,6 +8,10 @@ route(/^google\s+(.+)/i, :search, command: true, help: { "google QUERY" => "Return the first Google search result for QUERY." }) + + def self.default_config(handler_config) + handler_config.safe_search = :active + end def search(response) query = response.matches[0][0]
Add default value for config attribute.
diff --git a/spec/lib/rspec/matcher_file_spec.rb b/spec/lib/rspec/matcher_file_spec.rb index abc1234..def5678 100644 --- a/spec/lib/rspec/matcher_file_spec.rb +++ b/spec/lib/rspec/matcher_file_spec.rb @@ -21,7 +21,9 @@ end it "writes the contents to the file" do - # + contents = File.read("lib/rspec/templates/matcher_file_template.erb") + subject.generate + expect(File.read(matchers_path)).to eql contents end end end
Test contents of matcher file
diff --git a/lib/qml/data/query_model.rb b/lib/qml/data/query_model.rb index abc1234..def5678 100644 --- a/lib/qml/data/query_model.rb +++ b/lib/qml/data/query_model.rb @@ -2,11 +2,6 @@ module Data # {QueryModel} provides a list model implementation with database backends like ActiveRecord. class QueryModel < ListModel - - Cache = Struct.new(:block_index, :items) - CACHE_SIZE = 256 - CACHE_COUNT = 4 - attr_reader :count # @param [Array<Symbol|String>] columns @@ -50,6 +45,10 @@ private + Cache = Struct.new(:block_index, :items) + CACHE_SIZE = 256 + CACHE_COUNT = 4 + def add_cache(block_offset) @caches.shift if @caches.size >= CACHE_COUNT Cache.new(block_offset, query(block_offset * CACHE_SIZE, CACHE_SIZE)).tap do |cache|
Make cache constants private in QueryModel
diff --git a/lib/tasks/data_hygiene.rake b/lib/tasks/data_hygiene.rake index abc1234..def5678 100644 --- a/lib/tasks/data_hygiene.rake +++ b/lib/tasks/data_hygiene.rake @@ -0,0 +1,12 @@+namespace :data_hygiene do + desc "See which documents don't have content IDs" + task :inspect_content_ids => [:environment] do + publishing_apps = ContentItem.all.distinct("publishing_app") + publishing_apps.each do |publishing_app| + without_content_id = ContentItem.where(content_id: nil, publishing_app: publishing_app).count + with_content_id = ContentItem.where(publishing_app: publishing_app).count - without_content_id + + puts "#{publishing_app}: #{without_content_id} without, #{with_content_id} with" + end + end +end
Add rake task to inspect missing content_ids `rake data_hygiene:inspect_content_ids` will give you a list of publishing apps and the number of content items with / without content_id in the database. We'll use this to verify we're sending the content_id for all documents.
diff --git a/web/lib/assets/umakadata/lib/umakadata/sparql_helper.rb b/web/lib/assets/umakadata/lib/umakadata/sparql_helper.rb index abc1234..def5678 100644 --- a/web/lib/assets/umakadata/lib/umakadata/sparql_helper.rb +++ b/web/lib/assets/umakadata/lib/umakadata/sparql_helper.rb @@ -5,27 +5,18 @@ module SparqlHelper - MAGNIFICATION = lambda { |t| a, b, c = 0, 1, 0; t.times { d = a + b; a = b; b = c = d; }; c } - def self.query(uri, query, logger: nil, options: {}) sparql_log = Umakadata::Logging::SparqlLog.new(uri, query) logger.push sparql_log unless logger.nil? - retry_count = 0 begin client = Umakadata::SparqlClient.new(uri, {'read_timeout': 5 * 60}.merge(options)) response = client.query(query) rescue RDF::ReaderError content_type = client.http_response.content_type sparql_log.error = "content-type: #{content_type} is inconsistent with the body of the response" - rescue SocketError => e - if (retry_count += 1) > 5 - sparql_log.error = SocketError.new(e.message + "\nRetry count: #{retry_count}") - else - sparql_log.error = "Retry count: #{retry_count}" - sleep 10 * MAGNIFICATION.call(retry_count) - retry - end + rescue SPARQL::Client::ClientError, SPARQL::Client::ServerError => e + sparql_log.error = e rescue => e sparql_log.error = e end
Revert "retry query on SocketError" This reverts commit fab9bb3bfc18d8a2aa5b6a0186616cb2f6f8394e.
diff --git a/vintner.gemspec b/vintner.gemspec index abc1234..def5678 100644 --- a/vintner.gemspec +++ b/vintner.gemspec @@ -15,7 +15,7 @@ gem.require_paths = ["lib"] gem.version = Vintner::VERSION - gem.add_dependency 'active_support' + gem.add_dependency 'activesupport', '~> 3.2.6' gem.add_dependency 'i18n' gem.add_development_dependency 'rspec', '~> 2.6' end
Use the right activesupport gem
diff --git a/lib/browserify_pipeline/transformer/six_to_fiveify.rb b/lib/browserify_pipeline/transformer/six_to_fiveify.rb index abc1234..def5678 100644 --- a/lib/browserify_pipeline/transformer/six_to_fiveify.rb +++ b/lib/browserify_pipeline/transformer/six_to_fiveify.rb @@ -4,7 +4,7 @@ module Transformer class SixToFiveify < Base - def initialize(command_line_options = '--extensions .browserify') + def initialize(command_line_options = '--extensions .browserify --extensions .js') super('6to5ify', command_line_options) end
Apply to .js files as well
diff --git a/stapler.gemspec b/stapler.gemspec index abc1234..def5678 100644 --- a/stapler.gemspec +++ b/stapler.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = "stapler" - s.version = "0.4.0" + s.version = "0.4.1" s.date = Time.now.strftime('%Y-%m-%d') s.summary = "Dynamic asset compression for Rails" s.homepage = "http://github.com/rykov/stapler"
Fix caching for super-long bundle URLs
diff --git a/stretch.gemspec b/stretch.gemspec index abc1234..def5678 100644 --- a/stretch.gemspec +++ b/stretch.gemspec @@ -18,6 +18,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_development_dependency "bundler", "~> 1.3" + spec.add_development_dependency "bundler", "~> 1.3" + spec.add_development_dependency "minitest", "~> 4.0" spec.add_development_dependency "rake" end
Add minitest as a development dependency
diff --git a/lyricfy.gemspec b/lyricfy.gemspec index abc1234..def5678 100644 --- a/lyricfy.gemspec +++ b/lyricfy.gemspec @@ -17,7 +17,9 @@ gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ["lib"] + gem.add_runtime_dependency "rake" gem.add_runtime_dependency "nokogiri", [">= 1.3.3"] - gem.add_development_dependency "fakeweb", ["~> 1.3"] + gem.add_development_dependency "webmock", ["1.8.0"] + gem.add_development_dependency "vcr", ["~> 2.4.0"] end
Add Webmock and VCR dependencies
diff --git a/addresses.gemspec b/addresses.gemspec index abc1234..def5678 100644 --- a/addresses.gemspec +++ b/addresses.gemspec @@ -5,7 +5,7 @@ s.name = "addresses" s.authors = ["Wilbert Ribeiro", "Joice Taciana"] s.email = ["wkelyson@gmail.com", "joicetaciana@gmail.com"] - s.version = '1.0.9' + s.version = '2.0' s.homepage = "http://www.github.com/wilbert/addresses" s.summary = "This engine allows create default addresses models for any usage." s.description = "Create Country, State, City, Neighborhood and a polymorphic model called Address that can be related as addessable." @@ -14,9 +14,8 @@ s.licenses = ['MIT'] s.required_ruby_version = '~> 2.2' - s.add_dependency "rails", '~> 5.0' + s.add_dependency "rails", '~> 6.0.0' - s.add_development_dependency 'rspec-rails', '3.5.2' - s.add_development_dependency 'capybara', '2.8.1' - s.add_development_dependency 'factory_girl_rails', '4.7.0' + s.add_development_dependency 'rspec-rails', '3.8.2' + s.add_development_dependency 'factory_bot_rails' end
Upgrade to Rails 6 compatibility
diff --git a/lib/emcee/processors/script_processor.rb b/lib/emcee/processors/script_processor.rb index abc1234..def5678 100644 --- a/lib/emcee/processors/script_processor.rb +++ b/lib/emcee/processors/script_processor.rb @@ -18,7 +18,7 @@ private def inline_scripts(doc) - doc.css("script").each do |node| + doc.css("script[src]").each do |node| path = absolute_path(node.attribute("src")) content = @context.evaluate(path) script = create_script(doc, content)
Select only <script>'s with `src` attribute
diff --git a/time_service.rb b/time_service.rb index abc1234..def5678 100644 --- a/time_service.rb +++ b/time_service.rb @@ -11,18 +11,18 @@ end def start_service - @thread = Thread.new { + @thread = Thread.new do while @active current_time = Time.new time = if current_time.min.zero? - ":clock#{current_time.strftime('%-I')}:" - elsif current_time.min == 30 - ":clock#{current_time.strftime('%-I')}30:" - elsif current_time.hour == 13 && current_time.min == 37 - 'Look at the time! It\'s :one: :three: : :three: :seven: !' - else - nil - end + ":clock#{current_time.strftime('%l')}:" + elsif current_time.min == 30 + ":clock#{current_time.strftime('%l')}30:" + elsif current_time.hour == 13 && current_time.min == 37 + 'Look at the time! It\'s :one: :three: : :three: :seven: !' + else + nil + end puts current_time if @debug @gitter_bot.send_message(time) unless time.nil? @@ -30,6 +30,6 @@ end @thread.kill - } + end end end
Fix identation and use %l in strftime
diff --git a/gemdiff.gemspec b/gemdiff.gemspec index abc1234..def5678 100644 --- a/gemdiff.gemspec +++ b/gemdiff.gemspec @@ -21,7 +21,7 @@ spec.add_dependency "launchy", "~> 2.4" spec.add_dependency "octokit", "~> 4.0" - spec.add_dependency "thor", "~> 0.19" + spec.add_dependency "thor", "~> 1.0" spec.add_development_dependency "minitest", "~> 5.4" spec.add_development_dependency "mocha", "~> 1.1"
Bump thor gem in gemspec to "~> 1.0"
diff --git a/core/file/stat/zero_spec.rb b/core/file/stat/zero_spec.rb index abc1234..def5678 100644 --- a/core/file/stat/zero_spec.rb +++ b/core/file/stat/zero_spec.rb @@ -0,0 +1,13 @@+require File.expand_path('../../../../spec_helper', __FILE__) +require File.expand_path('../../../../shared/file/zero', __FILE__) +require File.expand_path('../fixtures/classes', __FILE__) + +describe "File::Stat#zero?" do + it_behaves_like :file_zero, :zero?, FileStat + + platform_is :solaris do + it "returns false for /dev/null" do + FileStat.zero?('/dev/null').should == false + end + end +end
Revert "/dev/null is symbolic link on i386-solaris" This reverts commit 89c50a2583698b361d42584f37db7877992e1b02.
diff --git a/files/private-chef-upgrades/001/016_add_org_tables_osc_hash_types.rb b/files/private-chef-upgrades/001/016_add_org_tables_osc_hash_types.rb index abc1234..def5678 100644 --- a/files/private-chef-upgrades/001/016_add_org_tables_osc_hash_types.rb +++ b/files/private-chef-upgrades/001/016_add_org_tables_osc_hash_types.rb @@ -0,0 +1,14 @@+define_upgrade do + + if Partybus.config.bootstrap_server + + must_be_data_master + + # run 2.4.0 migrations to update db - includes adding org association/user tables + # and adding the OSC password hash types to the password_hash_type_enum + run_command("make deploy", + :cwd => "/opt/opscode/embedded/service/enterprise-chef-server-schema", + :env => {"EC_TARGET" => "@2.4.0", "OSC_TARGET" => "@1.0.4", "DB_USER" => "opscode-pgsql"} + ) + end +end
Add partybus migration update db schema to 2.4.0 This adds org association and org user tables. It also adds the OSC hash password types to the password_hash_type enum. This is in support of upgrades from OSC.
diff --git a/app/controllers/interview_start_time_defence_requests_controller.rb b/app/controllers/interview_start_time_defence_requests_controller.rb index abc1234..def5678 100644 --- a/app/controllers/interview_start_time_defence_requests_controller.rb +++ b/app/controllers/interview_start_time_defence_requests_controller.rb @@ -1,14 +1,16 @@ class InterviewStartTimeDefenceRequestsController < BaseController - skip_after_action :verify_authorized - before_action :set_policy_with_context, :find_defence_request + + include DefenceRequestConcern + + before_action :find_defence_request + before_action :new_defence_request_form + + before_action ->(c) { authorize_defence_request_access(:interview_start_time_edit) } def new - @defence_request_form ||= DefenceRequestForm.new @defence_request end def create - @defence_request_form ||= DefenceRequestForm.new @defence_request - if @defence_request_form.submit(interview_start_time_defence_request_params) redirect_to(defence_request_path(@defence_request), notice: flash_message(:interview_start_time, DefenceRequest)) else @@ -18,19 +20,13 @@ private - def policy_context - @_policy_context ||= PolicyContext.new(DefenceRequest, current_user) - end - - def set_policy_with_context - @policy ||= policy(policy_context) - end - - def find_defence_request - @defence_request ||= DefenceRequest.find(params.fetch(:defence_request_id)) + def defence_request_id + :defence_request_id end def interview_start_time_defence_request_params - params.require(:defence_request).permit({interview_start_time: %i[day month year hour min sec]}) + params.require(:defence_request).permit( + { interview_start_time: %i[day month year hour min sec] } + ) end end
Refactor interview start time controller to use DefenceRequestConcern methods.
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,5 @@ Books::Application.routes.draw do - match "auth/:provider/callback" => "sessions#create" + match "auth/:provider/callback" => "sessions#create", via: [:get, :post] get "auth/sign_out" => "sessions#sign_out", :as => :sign_out resources :sessions, :only => :new do
Set explicit methods for match route
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -21,6 +21,7 @@ get "/about", to: "home#about", as: "about_page" get "/dashboard", to: "dashboard#index", as: "dashboard_page" + post "/main_account", to: "accounts#main_account", as: "main_account" get "/index", to: "home#index", as: "index_page" get "/resources", to: "home#resources", as: "resources_page"
Add route to update main account
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 @@ # Frontend routes namespace :products, :path => Refinery::Products.shop_path do root to: "products#index", via: :get - get '/categories/*path', to: 'categories#show', as: :category + get "#{Refinery::Products.products_categories_path}/*path", to: 'categories#show', as: :category scope :path => Refinery::Products.products_path do resources :products, :path => '', :as => :products, :controller => 'products'
Add ability to have custom path for categories
diff --git a/toggl-weekly/blockspring.rb b/toggl-weekly/blockspring.rb index abc1234..def5678 100644 --- a/toggl-weekly/blockspring.rb +++ b/toggl-weekly/blockspring.rb @@ -0,0 +1,67 @@+require 'blockspring' +require 'rest-client' +require 'json' + +def week_start( date, offset_from_sunday=0 ) + date - (date.wday - offset_from_sunday)%7 +end + +def humanize_hours(milliseconds) + hours, min = (milliseconds / 1000 / 60 ).divmod(60) + "#{hours} h, #{min} min" +end + +def webhook(team_domain, service_id, token, user_name, team_id, user_id, channel_id, timestamp, channel_name, text, trigger_word, raw_text,toggl_key,workspace_id) + + d = Date.today + start_of_the_week = week_start(d,1).iso8601 + url = "https://#{toggl_key}:api_token@toggl.com/reports/api/v2/weekly?workspace_id=#{workspace_id}&since=#{start_of_the_week}&user_agent=api_test" + r = RestClient.get(url) + results = JSON.parse(r) + hours = humanize_hours(results["total_grand"]) + response = "Weekly total: ~ #{hours}" + + return { + text: response, # send a text response (replies to channel if not blank) + attachments: [], # add attatchments: https://api.slack.com/docs/attachments + username: "Toggl Weekly Report", # overwrite configured username (ex: MyCoolBot) + icon_url: "", # overwrite configured icon (ex: https://mydomain.com/some/image.png + icon_emoji: "", # overwrite configured icon (ex: :smile:) + } +end + +block = lambda do |request, response| + team_domain = request.params['team_domain'] + service_id = request.params['service_id'] + token = request.params['token'] + user_name = request.params['user_name'] + team_id = request.params['team_id'] + user_id = request.params['user_id'] + channel_id = request.params['channel_id'] + timestamp = request.params['timestamp'] + channel_name = request.params['channel_name'] + raw_text = text = request.params['text'] + trigger_word = request.params['trigger_word'] + toggl_key = request.params['TOGGL_KEY'] + workspace_id = request.params['workspace_id'] + + # ignore all bot messages + return if user_id == 'USLACKBOT' + + # Strip out trigger word from text if given + if trigger_word + text = text[trigger_word.length..text.length].strip + end + + # Execute bot function + output = webhook(team_domain, service_id, token, user_name, team_id, user_id, channel_id, timestamp, channel_name, text, trigger_word, raw_text,toggl_key,workspace_id) + + # set any keys that aren't blank + output.keys.each do |k| + response.addOutput(k, output[k]) unless output[k].nil? or output[k].empty? + end + + response.end +end + +Blockspring.define(block)
Add first slack bot: Toggl-Weekly Toggl-Weekly os a slackbot running on blockspring. It let's me add a slackbot without a server and it's easily sharable so others can use it too which is awesome. What it does you get your current weekly hourly report. So how many hours have you worked. Might be extended shortly but for now just the hours is fine. You can get the hours if you type in: /blockspring toggl-weekly
diff --git a/db/migrate/20141120183514_populate_aleph_id_from_user_attributes.rb b/db/migrate/20141120183514_populate_aleph_id_from_user_attributes.rb index abc1234..def5678 100644 --- a/db/migrate/20141120183514_populate_aleph_id_from_user_attributes.rb +++ b/db/migrate/20141120183514_populate_aleph_id_from_user_attributes.rb @@ -1,10 +1,11 @@+require 'pry' class PopulateAlephIdFromUserAttributes < ActiveRecord::Migration def up say_with_time "Migrating Aleph ID." do + User.class_eval { serialize :user_attributes } User.all.each do |user| - User.class_eval { serialize :user_attributes } unless user.user_attributes.blank? - user.update_attribute :aleph_id, user.user_attributes[:nyuidn] unless user.user_attributes.nil? + user.update_attribute :aleph_id, user.user_attributes[:nyuidn] end end end
Move class eval outside of loop
diff --git a/db/migrate/20190630113109_add_confidential_to_applications.rb b/db/migrate/20190630113109_add_confidential_to_applications.rb index abc1234..def5678 100644 --- a/db/migrate/20190630113109_add_confidential_to_applications.rb +++ b/db/migrate/20190630113109_add_confidential_to_applications.rb @@ -0,0 +1,13 @@+# frozen_string_literal: true + +class AddConfidentialToApplications < ActiveRecord::Migration[5.2] + def change + add_column( + :oauth_applications, + :confidential, + :boolean, + null: false, + default: true + ) + end +end
Add a `confidential` attribute to oauth applications
diff --git a/wak.gemspec b/wak.gemspec index abc1234..def5678 100644 --- a/wak.gemspec +++ b/wak.gemspec @@ -8,8 +8,8 @@ spec.version = Wak::VERSION spec.authors = ["Bob Van Landuyt"] spec.email = ["bob@vanlanduyt.co"] - spec.summary = %q{TODO: Write a short summary. Required.} - spec.description = %q{TODO: Write a longer description. Optional.} + spec.summary = "Easy rack hosting in development" + spec.description = "Host rack apps in development using ngnix" spec.homepage = "" spec.license = "MIT"
Add small discriptions to gemspec
diff --git a/test/dummy/app/models/category.rb b/test/dummy/app/models/category.rb index abc1234..def5678 100644 --- a/test/dummy/app/models/category.rb +++ b/test/dummy/app/models/category.rb @@ -8,6 +8,13 @@ =end class Category < ActiveRecord::Base + + ## + # + # + + attr_protected :permalink, :position, :as => :admin + attr_protected :permalink, :position ## # Mixins
Mark permalink and position as protected attributes.
diff --git a/knife-bluebox.gemspec b/knife-bluebox.gemspec index abc1234..def5678 100644 --- a/knife-bluebox.gemspec +++ b/knife-bluebox.gemspec @@ -13,8 +13,8 @@ s.email = "support@bluebox.net" s.homepage = "http://wiki.opscode.com/display/chef" - s.add_dependency "chef", ">= 0.9.14" - s.add_dependency "fog", "~> 1.1.2" + s.add_dependency "chef", ">= 0.10.10" + s.add_dependency "fog", "~> 1.6" s.require_path = 'lib' s.files = %w(LICENSE README.rdoc) + Dir.glob("lib/**/*") end
Update chef and fog dependency versions, now excludes chef 0.9.x. This will keep the gem in line with other knife-* plugins using the fog gem. Upcoming changes will depend on API changes in the Chef gem starting at 0.10.10.
diff --git a/lib/deploytracking.rb b/lib/deploytracking.rb index abc1234..def5678 100644 --- a/lib/deploytracking.rb +++ b/lib/deploytracking.rb @@ -9,7 +9,7 @@ def self.notify(api_key, data) puts "[DeployTracking] Tracking Deployment to #{DEPLOY_TRACKING_HOST}" - params = {'api_key' => api_key} + params = {'api_key' => api_key, 'deploy["gem_version"]' => DeployTracking::VERSION} data.each {|k,v| params["deploy[#{k}]"] = v } http = Net::HTTP.new(DEPLOY_TRACKING_HOST, DEPLOY_TRACKING_PORT)
Send back the version of the gem
diff --git a/lib/gnawrnip/rspec.rb b/lib/gnawrnip/rspec.rb index abc1234..def5678 100644 --- a/lib/gnawrnip/rspec.rb +++ b/lib/gnawrnip/rspec.rb @@ -5,18 +5,14 @@ Gnawrnip.ready! end - # https://github.com/jnicklas/capybara/blob/master/lib/capybara/rspec.rb - fetch_current_example = RSpec.respond_to?(:current_example) ? - proc { RSpec.current_example } : proc { |context| context.example } - config.before(:each, turnip: true) do - example = fetch_current_example.call(self) + example = RSpec.current_example Gnawrnip.photographer.reset! example.metadata[:gnawrnip] = {} end config.after(:each, turnip: true) do - example = fetch_current_example.call(self) + example = RSpec.current_example if example.exception Gnawrnip.photographer.take_shot
Remove `get current_example` method for RSpec 2.x
diff --git a/lib/gooru/response.rb b/lib/gooru/response.rb index abc1234..def5678 100644 --- a/lib/gooru/response.rb +++ b/lib/gooru/response.rb @@ -1,16 +1,41 @@ module Gooru class Response attr_reader :data + attr_reader :status def initialize(weary_response) @data = parse(weary_response.body) + @status = weary_response.status + end + + def error? + has_error_key? || + internal_server_error? + end + + def error_message + if has_error_key? + data["error"] + elsif internal_server_error? + data["status"] + else + "" + end end def success? - data.has_key?("error") == false + !error? end private + + def has_error_key? + data.has_key?("error") + end + + def internal_server_error? + status == 500 + end def parse(body) if body.match(/^error:(.*)/)
Handle more Gooru error possibilities.
diff --git a/lib/generators/nifty/layout/templates/error_messages_helper.rb b/lib/generators/nifty/layout/templates/error_messages_helper.rb index abc1234..def5678 100644 --- a/lib/generators/nifty/layout/templates/error_messages_helper.rb +++ b/lib/generators/nifty/layout/templates/error_messages_helper.rb @@ -7,8 +7,8 @@ messages = objects.compact.map { |o| o.errors.full_messages }.flatten unless messages.empty? content_tag(:div, :class => "error_messages") do - list_items = messages.map { |msg| content_tag(:li, msg) } - content_tag(:h2, options[:header_message]) + content_tag(:p, options[:message]) + content_tag(:ul, list_items.join.html_safe) + list_items = messages.map { |msg| content_tag(:li, msg.html_safe) } + content_tag(:h2, options[:header_message].html_safe) + content_tag(:p, options[:message].html_safe) + content_tag(:ul, list_items.join.html_safe) end end end
Use html_safe translated messages. This will let you use this format: "<strong>%{attribute}</strong> %{message}" and renders it properly
diff --git a/test/system/sessions_test.rb b/test/system/sessions_test.rb index abc1234..def5678 100644 --- a/test/system/sessions_test.rb +++ b/test/system/sessions_test.rb @@ -0,0 +1,40 @@+require 'application_system_test_case' + +class SessionsTest < ApplicationSystemTestCase + setup do + create :user + end + + test 'redirects to login page if not authenticated' do + visit root_path + + assert page.has_current_path? new_user_session_path + assert page.has_text? 'You need to sign in or sign up before continuing.' + end + + test 'sign in with valid credentials' do + visit new_user_session_path + + assert page.has_field? 'Email' + + fill_in 'Email', with: 'superadmin@example.com' + fill_in 'Password', with: 'asdfasdf' + click_button 'Log in' + + assert page.has_current_path? root_path + assert page.has_text? 'Signed in successfully.' + assert page.has_link? 'Logout' + end + + test 'sign out current user' do + user = User.first + login_as user, scope: :user + visit root_path + + assert page.has_link? 'Logout' + click_link 'Logout' + + assert page.has_current_path? new_user_session_path + assert page.has_text? 'You need to sign in or sign up before continuing.' + end +end
Write system tests for authentication
diff --git a/test/test_jekyll_mentions.rb b/test/test_jekyll_mentions.rb index abc1234..def5678 100644 --- a/test/test_jekyll_mentions.rb +++ b/test/test_jekyll_mentions.rb @@ -44,6 +44,7 @@ end should "not touch non-HTML pages" do + @mentions.generate(@site) assert_equal "test @test test", page_with_name(@site, "test.json").content end
Make sure to generate the site in the test about the non-HTML files.
diff --git a/Kiwi.podspec b/Kiwi.podspec index abc1234..def5678 100644 --- a/Kiwi.podspec +++ b/Kiwi.podspec @@ -9,6 +9,8 @@ s.framework = 'SenTestingKit' s.ios.xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => '$(inherited) "$(SDKROOT)/Developer/Library/Frameworks" "$(DEVELOPER_LIBRARY_DIR)/Frameworks"' } s.osx.xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => '$(inherited) "$(DEVELOPER_LIBRARY_DIR)/Frameworks"' } + s.ios.deployment_target = '5.0' + s.osx.deployment_target = '10.7' s.subspec 'ARC' do |arc| arc.source_files = 'Classes'
Update deployment target in pod spec
diff --git a/test/unit/contact_test.rb b/test/unit/contact_test.rb index abc1234..def5678 100644 --- a/test/unit/contact_test.rb +++ b/test/unit/contact_test.rb @@ -11,11 +11,9 @@ end test "should import contact details from contactotron" do - %w[ http https ].each do |protocol| - FakeWeb.register_uri(:get, "#{protocol}://contactotron.test.gov.uk/contacts/189", - body: File.read(Rails.root.join("test", "fixtures", "contactotron_api_response.json")) - ) - end + FakeWeb.register_uri(:get, "#{Plek.current.find("contactotron")}/contacts/189", + body: File.read(Rails.root.join("test", "fixtures", "contactotron_api_response.json")) + ) contact = Contact.new(contactotron_id: 189) contact.update_from_contactotron contact.reload
Make test work regardless of environment. For reasons that aren't quite clear to me, the server returned by Plek.current.find("contactotron") is different on the CI server. This change makes the test work there, too.
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,11 +1,9 @@-if Rails.env.production? || Rails.env.staging? - redis_jobs_url = ENV.fetch("OFN_REDIS_JOBS_URL", "redis://localhost:6381/0") +redis_jobs_url = ENV.fetch("OFN_REDIS_JOBS_URL", "redis://localhost:6381/0") - Sidekiq.configure_server do |config| - config.redis = { url: redis_jobs_url, network_timeout: 5 } - end +Sidekiq.configure_server do |config| + config.redis = { url: redis_jobs_url, network_timeout: 5 } +end - Sidekiq.configure_client do |config| - config.redis = { url: redis_jobs_url, network_timeout: 5 } - end +Sidekiq.configure_client do |config| + config.redis = { url: redis_jobs_url, network_timeout: 5 } end
Configure Sidekiq in development also
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,6 +1,6 @@ require "sidekiq" -redis_config = { namespace: "signon_sidekiq" } +redis_config = { namespace: "signon" } redis_config[:url] = ENV['REDIS_URL'] if ENV['REDIS_URL'] Sidekiq.configure_server do |config|
Change Redis namespace to match app name.
diff --git a/c7decrypt.gemspec b/c7decrypt.gemspec index abc1234..def5678 100644 --- a/c7decrypt.gemspec +++ b/c7decrypt.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'c7decrypt' - s.version = '0.0.1' + s.version = '0.0.2' s.authors = ["Jonathan Claudius"] s.date = '2012-09-07' s.email = 'claudijd@yahoo.com'
Bump gem version to 0.0.2
diff --git a/rails_reseed.gemspec b/rails_reseed.gemspec index abc1234..def5678 100644 --- a/rails_reseed.gemspec +++ b/rails_reseed.gemspec @@ -20,4 +20,5 @@ spec.add_development_dependency "bundler", "~> 1.7" spec.add_development_dependency "rake", "~> 10.0" + spec.add_development_dependency "rspec", "~> 3.2.0" end
Add rspec gem to dev dependencies
diff --git a/week-4/good-guess/my_solution.rb b/week-4/good-guess/my_solution.rb index abc1234..def5678 100644 --- a/week-4/good-guess/my_solution.rb +++ b/week-4/good-guess/my_solution.rb @@ -8,6 +8,6 @@ if argument == 42 return true else - return false + return false end end
Fix spacing on good guess
diff --git a/roles/fullsave.rb b/roles/fullsave.rb index abc1234..def5678 100644 --- a/roles/fullsave.rb +++ b/roles/fullsave.rb @@ -5,6 +5,30 @@ :hosted_by => "FullSave", :location => "Toulouse, France", :networking => { + :firewall => { + :inet => [ + { + :action => "ACCEPT", + :source => "net:185.116.130.12", + :dest => "fw", + :proto => "udp", + :dest_ports => "snmp", + :source_ports => "1024:", + :rate_limit => "-", + :connection_limit => "-" + }, + { + :action => "ACCEPT", + :source => "net:100.80.8.0/24", + :dest => "fw", + :proto => "udp", + :dest_ports => "snmp", + :source_ports => "1024:", + :rate_limit => "-", + :connection_limit => "-" + } + ] + }, :nameservers => ["141.0.202.202", "141.0.202.203"], :roles => { :external => {
Enable SNMP access to naga
diff --git a/lib/atlas/molecule_node.rb b/lib/atlas/molecule_node.rb index abc1234..def5678 100644 --- a/lib/atlas/molecule_node.rb +++ b/lib/atlas/molecule_node.rb @@ -15,6 +15,9 @@ attribute :from_energy, NodeAttributes::EnergyToMolecules + # Molecule nodes define output capacity; the capacity of all non-loss output carriers. + attribute :output_capacity, Float + # Public: The queries to be executed and saved on the Refinery graph. # # Defaults demand to zero, as the molecule graph should have no flows.
Add `output_capacity` to molecule nodes
diff --git a/lib/color_decomposition.rb b/lib/color_decomposition.rb index abc1234..def5678 100644 --- a/lib/color_decomposition.rb +++ b/lib/color_decomposition.rb @@ -4,6 +4,9 @@ module ColorDecomposition def self.quadtree(path, similarity) + unless similarity.between?(0, 100) + raise ArgumentError, 'Similarity value must be between 0 and 100' + end image = ImageReader.new(path) quadtree = Quadtree.new(image.height, image.width) image.add_image_data(quadtree)
Raise error if similarity value is not between 0 and 100
diff --git a/lib/http/request_stream.rb b/lib/http/request_stream.rb index abc1234..def5678 100644 --- a/lib/http/request_stream.rb +++ b/lib/http/request_stream.rb @@ -13,19 +13,12 @@ end end - # Stream the request to a socket - def stream - self.add_headers - + def add_body_type_headers case @body when NilClass - @socket << @request_header << CRLF when String @request_header << "Content-Length: #{@body.length}#{CRLF}" unless @headers['Content-Length'] @request_header << CRLF - - @socket << @request_header - @socket << @body when Enumerable if encoding = @headers['Transfer-Encoding'] raise ArgumentError, "invalid transfer encoding" unless encoding == "chunked" @@ -33,7 +26,21 @@ else @request_header << "Transfer-Encoding: chunked#{CRLF * 2}" end + end + end + # Stream the request to a socket + def stream + self.add_headers + self.add_body_type_headers + + case @body + when NilClass + @socket << @request_header << CRLF + when String + @socket << @request_header + @socket << @body + when Enumerable @socket << @request_header @body.each do |chunk| @socket << chunk.bytesize.to_s(16) << CRLF
Break body type specific header appending into own function this is done because I'm going to make it join them all with CRLFs in a bit, but for now just breaking things into their own methods Signed-off-by: Sam Phippen <e5a09176608998a68778e11d5021c871e8fae93c@googlemail.com>
diff --git a/lib/maildir/unique_name.rb b/lib/maildir/unique_name.rb index abc1234..def5678 100644 --- a/lib/maildir/unique_name.rb +++ b/lib/maildir/unique_name.rb @@ -45,19 +45,6 @@ Socket.gethostname end - def secure_random(bytes=8) - # File.read("/dev/urandom", bytes).unpack("H*")[0] - raise "Not implemented" - end - - def inode - raise "Not implemented" - end - - def device_number - raise "Not implemented" - end - def microsecond @now.usec.to_s end
Remove unused methods in UniqueName
diff --git a/lib/pacer/transform/cap.rb b/lib/pacer/transform/cap.rb index abc1234..def5678 100644 --- a/lib/pacer/transform/cap.rb +++ b/lib/pacer/transform/cap.rb @@ -14,17 +14,29 @@ protected - def attach_pipe(end_pipe) + def pipe_source + s, e = super + if not s and not e + s = e = com.tinkerpop.pipes.IdentityPipe.new + end + [s, e] + end + + def side_effect_pipe(end_pipe) old_back = @side_effect.back begin empty = Pacer::Route.new :filter => :empty, :back => self @side_effect.back = empty _, side_effect_pipe = @side_effect.send :build_pipeline + side_effect_pipe.setStarts end_pipe + side_effect_pipe ensure @side_effect.back = old_back end - side_effect_pipe.setStarts end_pipe - pipe = com.tinkerpop.pipes.sideeffect.SideEffectCapPipe.new side_effect_pipe + end + + def attach_pipe(end_pipe) + pipe = com.tinkerpop.pipes.sideeffect.SideEffectCapPipe.new side_effect_pipe(end_pipe) pipe.setStarts end_pipe pipe end
Fix the creation of SideEffectCapPipe directly after the sources.
diff --git a/seed_tray.gemspec b/seed_tray.gemspec index abc1234..def5678 100644 --- a/seed_tray.gemspec +++ b/seed_tray.gemspec @@ -18,7 +18,7 @@ spec.test_files = Dir["test/**/*"] spec.files = Dir["{lib,app}/**/*"] - spec.add_dependency "rails", "~> 4.2.5" + spec.add_dependency "rails", ">= 4.0" spec.add_dependency 'jquery-rails' spec.add_development_dependency 'sass-rails', '~> 5.0'
Change rails dependency to all rails 5.o to be used
diff --git a/lib/tasks/mongo_rates.rake b/lib/tasks/mongo_rates.rake index abc1234..def5678 100644 --- a/lib/tasks/mongo_rates.rake +++ b/lib/tasks/mongo_rates.rake @@ -4,7 +4,7 @@ desc 'Update Recommendations.' task :recommendations, [:person, :id, :strategy] => :environment do |t, args| options = {} - options[:strategy] = args[:strategy].to_sym + options[:strategy] = args[:strategy].to_sym if args[:strategy] person_to_update = nil if args[:person] && args[:id]
Fix issue with the rake task An error would be raised whenever you didn't specify the strategy. This'll properly convert the strategy to a symbol only when it is specified.
diff --git a/lib/tasks/set_locales.rake b/lib/tasks/set_locales.rake index abc1234..def5678 100644 --- a/lib/tasks/set_locales.rake +++ b/lib/tasks/set_locales.rake @@ -0,0 +1,7 @@+task :set_locales => :environment do + Rails.logger.info("-------- Set locales --------") + Topic.all.each do |t| + t.update!(locale: 'ja') + end + User.where(locale: nil).update_all(locale: "ja") +end
Set locale of topic and user
diff --git a/core/time/shared/gmt_offset.rb b/core/time/shared/gmt_offset.rb index abc1234..def5678 100644 --- a/core/time/shared/gmt_offset.rb +++ b/core/time/shared/gmt_offset.rb @@ -4,4 +4,25 @@ Time.new.send(@method).should == 10800 end end + + it "returns the correct offset for US Eastern time zone around daylight savings time change" do + with_timezone("EST5EDT") do + Time.local(2010,3,14,1,59,59).send(@method).should == -5*60*60 + Time.local(2010,3,14,2,0,0).send(@method).should == -4*60*60 + end + end + + it "returns the correct offset for Hawaii around daylight savings time change" do + with_timezone("Pacific/Honolulu") do + Time.local(2010,3,14,1,59,59).send(@method).should == -10*60*60 + Time.local(2010,3,14,2,0,0).send(@method).should == -10*60*60 + end + end + + it "returns the correct offset for New Zealand around daylight savings time change" do + with_timezone("Pacific/Auckland") do + Time.local(2010,4,4,1,59,59).send(@method).should == 13*60*60 + Time.local(2010,4,4,3,0,0).send(@method).should == 12*60*60 + end + end end
Add rudimentary checks for daylight savings time zone changes.
diff --git a/lib/harfbuzz.rb b/lib/harfbuzz.rb index abc1234..def5678 100644 --- a/lib/harfbuzz.rb +++ b/lib/harfbuzz.rb @@ -1,7 +1,46 @@-require 'harfbuzz.bundle' +require 'ffi' -# require 'harfbuzz/blob' -# require 'harfbuzz/face' -# require 'harfbuzz/font' -# require 'harfbuzz/buffer' -# require 'harfbuzz/shaping'+require 'harfbuzz/ffi_additions' + +module Harfbuzz + + extend FFI::Library + + ffi_lib 'harfbuzz' + + typedef :pointer, :hb_destroy_func_t + typedef :uint32, :hb_codepoint_t + + attach_function :hb_version_string, [], :string + attach_function :hb_version, [:pointer, :pointer, :pointer], :void + + def self.version_string + hb_version_string + end + + def self.version + major_ptr = FFI::MemoryPointer.new(:uint, 1) + minor_ptr = FFI::MemoryPointer.new(:uint, 1) + micro_ptr = FFI::MemoryPointer.new(:uint, 1) + hb_version(major_ptr, minor_ptr, micro_ptr) + [ + major_ptr.read_uint, + minor_ptr.read_uint, + micro_ptr.read_uint, + ] + end + + MinimumHarfbuzzVersion = '1.0.4' + + unless Gem::Version.new(Harfbuzz.version_string) >= Gem::Version.new(MinimumHarfbuzzVersion) + raise "Harfbuzz C library is version #{Harfbuzz.version_string}, but this gem requires version #{MinimumHarfbuzzVersion} or later" + end + +end + +require 'harfbuzz/base' +require 'harfbuzz/blob' +require 'harfbuzz/face' +require 'harfbuzz/font' +require 'harfbuzz/buffer' +require 'harfbuzz/shaping'
Revert "Move version checking into extension." This reverts commit a1c17fd0d328ed6572f70853227eed0d5bf02043.
diff --git a/spec/units/stacker_bee/middleware/raise_on_http_errors_spec.rb b/spec/units/stacker_bee/middleware/raise_on_http_errors_spec.rb index abc1234..def5678 100644 --- a/spec/units/stacker_bee/middleware/raise_on_http_errors_spec.rb +++ b/spec/units/stacker_bee/middleware/raise_on_http_errors_spec.rb @@ -1,5 +1,5 @@ require 'spec_helper' describe StackerBee::Middleware::RaiseOnHTTPError do - pending + skip end
Use `skip` instead of `pending`
diff --git a/spec/brewery_db/resources/search_spec.rb b/spec/brewery_db/resources/search_spec.rb index abc1234..def5678 100644 --- a/spec/brewery_db/resources/search_spec.rb +++ b/spec/brewery_db/resources/search_spec.rb @@ -28,13 +28,13 @@ end end - context "#upc", :vcr do + context '#upc', :vcr do subject(:search) { described_class.new(config) } - context "for an existing upc code" do + context 'for an existing upc code' do let(:upc) { '030613000043' } - it "returns a collection with the matched beer" do + it 'returns a collection with the matched beer' do expect(search.upc(code: upc).map(&:id)).to eq(['LVjHK1']) end end
Make consistent use of single-quotes
diff --git a/spec/controllers/tags_controller_spec.rb b/spec/controllers/tags_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/tags_controller_spec.rb +++ b/spec/controllers/tags_controller_spec.rb @@ -23,11 +23,6 @@ @tag = create(:tag) @tag.questions << create(:question) end - - it "renders show template" do - get :show, {id: 2} - expect(response).to render_template("show") - end it "assigns tags correctly" do get :show, {id: 5}
Add passing tests; final fix
diff --git a/spec/routing/attachments_routing_spec.rb b/spec/routing/attachments_routing_spec.rb index abc1234..def5678 100644 --- a/spec/routing/attachments_routing_spec.rb +++ b/spec/routing/attachments_routing_spec.rb @@ -8,13 +8,9 @@ it "recognizes and generates #download" do { - :get => "/uploads/#{@attachment.object.class.to_s.underscore}/#{@attachment.id}/letter.pdf" + :get => "/attachments/#{@attachment.id}/download" }.should route_to(:controller => "attachments", :action => "download", - :model => 'employee', - :basename => 'letter', - :extension => 'pdf', - :conditions => {'method' => :get}, :id => @attachment.id.to_s) end end
Update the spec for the attachment download.
diff --git a/spec/serializers/item_serializer_spec.rb b/spec/serializers/item_serializer_spec.rb index abc1234..def5678 100644 --- a/spec/serializers/item_serializer_spec.rb +++ b/spec/serializers/item_serializer_spec.rb @@ -2,9 +2,10 @@ require 'rails_helper' -RSpec.describe Bragi::UserSerializer do - let(:item) { build :bragi_item, audio_identifier: '2014/01/01/blah' } - let(:serialization) { ActiveModelSerializers::SerializableResource.new(item).serializable_hash } +RSpec.describe Bragi::ItemSerializer do + let(:item) { build :bragi_item, audio_identifier: '2014/01/01/blah', id: 'test' } + let(:serializer) { Bragi::ItemSerializer.new(item) } + let(:serialization) { ActiveModelSerializers::Adapter.create(serializer).as_json } it 'has three top level keys' do expect(serialization[:data].keys).to eq %i[id type attributes]
Handle change in AMS 0.10.6
diff --git a/mongoid.gemspec b/mongoid.gemspec index abc1234..def5678 100644 --- a/mongoid.gemspec +++ b/mongoid.gemspec @@ -20,7 +20,7 @@ s.add_dependency("activemodel", ["~> 3.1"]) s.add_dependency("tzinfo", ["~> 0.3.22"]) s.add_dependency("moped", ["~> 1.0.0.rc"]) - s.add_dependency("origin", ["~> 1.0.0.rc"]) + s.add_dependency("origin", ["~> 1.0.0"]) s.add_development_dependency("mocha", ["~> 0.11"]) s.add_development_dependency("rspec", ["~> 2.10"])
Update origin dependency to 1.0.0
diff --git a/mongoid.gemspec b/mongoid.gemspec index abc1234..def5678 100644 --- a/mongoid.gemspec +++ b/mongoid.gemspec @@ -21,7 +21,7 @@ s.add_dependency("activemodel", ["~> 4.0.0.rc1"]) s.add_dependency("tzinfo", ["~> 0.3.22"]) - s.add_dependency("moped", ["~> 1.4.2"]) + s.add_dependency("moped", ["~> 1.4"]) s.add_dependency("origin", ["~> 1.0"]) s.files = Dir.glob("lib/**/*") + %w(CHANGELOG.md LICENSE README.md Rakefile)
Allow gemspec to use 1.x mopeds higher than 1.4
diff --git a/db/migrate/1424991704_add_htcat_source.rb b/db/migrate/1424991704_add_htcat_source.rb index abc1234..def5678 100644 --- a/db/migrate/1424991704_add_htcat_source.rb +++ b/db/migrate/1424991704_add_htcat_source.rb @@ -0,0 +1,11 @@+Sequel.migration do + no_transaction + + up do + execute "ALTER TYPE target_type ADD VALUE 'htcat'" + end + + down do + raise Sequel::Error, 'irreversible migration' + end +end
Make htcat valid transfer source
diff --git a/mongoid.gemspec b/mongoid.gemspec index abc1234..def5678 100644 --- a/mongoid.gemspec +++ b/mongoid.gemspec @@ -14,6 +14,7 @@ s.summary = "Elegant Persistance in Ruby for MongoDB." s.description = "Mongoid is an ODM (Object Document Mapper) Framework for MongoDB, written in Ruby." + s.required_ruby_version = ">= 1.9" s.required_rubygems_version = ">= 1.3.6" s.rubyforge_project = "mongoid"
Add minimum ruby version requirement This only specifies "1.9" rather than "1.9.3" since it appears that JRuby in 1.9 mode reports its version as "1.9", without the third version number segment.
diff --git a/lib/core_ext.rb b/lib/core_ext.rb index abc1234..def5678 100644 --- a/lib/core_ext.rb +++ b/lib/core_ext.rb @@ -1,5 +1,6 @@-require 'core_ext/kernel' -require 'core_ext/pathname' -require 'core_ext/string' -require 'core_ext/array' -require 'core_ext/argv' +require_relative 'core_ext/kernel' +require_relative 'core_ext/pathname' +require_relative 'core_ext/string' +require_relative 'core_ext/array' +require_relative 'core_ext/argv' +require_relative 'core_ext/env'
Use relative_requires for lib integrity
diff --git a/resources/chef-repo/site-cookbooks/mysql_cookbook/recipes/default.rb b/resources/chef-repo/site-cookbooks/mysql_cookbook/recipes/default.rb index abc1234..def5678 100644 --- a/resources/chef-repo/site-cookbooks/mysql_cookbook/recipes/default.rb +++ b/resources/chef-repo/site-cookbooks/mysql_cookbook/recipes/default.rb @@ -15,9 +15,9 @@ include_recipe "database::mysql" -mysql_database "change_pass" do +mysql_database "delete_unknown_user" do connection mysql_connection_info - sql "UPDATE mysql.user SET Password = #{node['mysql']['new_root_password']} where User = #{node['mysql']['server_root_password']}" + sql "DELETE from mysql.user where User = ''" action :query end
Create site-cookbook for delete unknown user.
diff --git a/test/integration/ohaiplugins/serverspec/localhost/sshd_spec.rb b/test/integration/ohaiplugins/serverspec/localhost/sshd_spec.rb index abc1234..def5678 100644 --- a/test/integration/ohaiplugins/serverspec/localhost/sshd_spec.rb +++ b/test/integration/ohaiplugins/serverspec/localhost/sshd_spec.rb @@ -4,7 +4,7 @@ sshd = OHAI['sshd'] platform_family = OHAI['platform_family'] platform_version = OHAI['platform_version'].to_f -if OHAI['passwd'].key?('vagrant') +if OHAI['etc']['passwd'].key?('vagrant') vagrant = true else vagrant = false
Fix the fix for the sshd test
diff --git a/lib/pushable.rb b/lib/pushable.rb index abc1234..def5678 100644 --- a/lib/pushable.rb +++ b/lib/pushable.rb @@ -44,21 +44,23 @@ end module ClassMethods + attr_accessor :pushes + + def pushable + @pushes = { create: :collections, + update: [ :collections, :instances ], + destroy: [ :collections, :instances ] } #default events and channels + end + def push(options={}) @pushes = options - end - - def pushes - @pushes ||= { create: :collections, - update: [ :collections, :instances ], - destroy: :collections } #default events and channels end end module Rails module Faye mattr_accessor :address - self.address = 'https://localhost:9292' + self.address = 'http://localhost:9292' end end end
Change Default Push Events and Channels
diff --git a/app/helpers/actions_helper.rb b/app/helpers/actions_helper.rb index abc1234..def5678 100644 --- a/app/helpers/actions_helper.rb +++ b/app/helpers/actions_helper.rb @@ -29,7 +29,9 @@ def action_names(action) actions = [] action.actions.each do |action_name| - actions << action_label(action_name) + if action_name.present? + actions << action_label(action_name) + end end if actions.any? actions.join(', ')
Check if action_label has a value because array contains empty strings.
diff --git a/app/models/service_version.rb b/app/models/service_version.rb index abc1234..def5678 100644 --- a/app/models/service_version.rb +++ b/app/models/service_version.rb @@ -3,13 +3,19 @@ belongs_to :user validates :spec, swagger_spec: true before_create :set_version_number - before_validation :read_spec # proposed: 0, current: 1, rejected: 2, retracted:3 , outdated:4 , retired:5 # Always add new states at the end. enum status: [:proposed, :current, :rejected, :retracted, :outdated, :retired] - attr_accessor :spec_file + def spec_file + @spec_file + end + + def spec_file=(spec_file) + @spec_file = spec_file + self.spec = JSON.parse(self.spec_file.read) + end def to_param version_number.to_s @@ -19,7 +25,4 @@ self.version_number = service.last_version_number + 1 end - def read_spec - self.spec = JSON.parse(self.spec_file.read) - end end
Refactor JSON parsing of spec file to attr setter This way we avoid trying to parse a file on other flows (such as service version updates when its state change)
diff --git a/Currier.podspec b/Currier.podspec index abc1234..def5678 100644 --- a/Currier.podspec +++ b/Currier.podspec @@ -9,7 +9,7 @@ s.version = ‘0.2.0’ s.summary = 'Fantastically easy function currying in Swift.’ s.description = <<-DESC -Produces a curried version of almost any other function. Just wrap your function in a single call ‘curry(myFunction)’ and the result will be a curried version of your original. A useful tool for working with parser combinators and other functional programming work. Currently supports up to 12 parameters. Pull requests for improvements are welcome. +Produces a curried version of almost any other function. Just wrap your function in a single call ‘curry(myFunction)’ and the result will be a curried version of your original. A useful tool for working with parser combinators and other functional programming work. Currently supports up to 14 parameters. Pull requests for improvements are welcome. DESC s.homepage = 'https://github.com/tigerpixel/Currier'
Update podspec file with new parameter count.
diff --git a/builder/test-integration/spec/hypriotos-image/cmdline_serial_spec.rb b/builder/test-integration/spec/hypriotos-image/cmdline_serial_spec.rb index abc1234..def5678 100644 --- a/builder/test-integration/spec/hypriotos-image/cmdline_serial_spec.rb +++ b/builder/test-integration/spec/hypriotos-image/cmdline_serial_spec.rb @@ -4,5 +4,4 @@ it { should be_owned_by 'root' } its(:content) { should match /console=tty1/ } its(:content) { should match /console=ttyAMA0,115200/ } - its(:content) { should match /kgdboc=ttyAMA0,115200/ } end
Fix test for kgdboc= entry in cmdline.txt Signed-off-by: Dieter Reuter <554783fc552b5b2a46dd3d7d7b9b2cce9a82c122@me.com>
diff --git a/app/controllers/document_search_engine/documents_controller.rb b/app/controllers/document_search_engine/documents_controller.rb index abc1234..def5678 100644 --- a/app/controllers/document_search_engine/documents_controller.rb +++ b/app/controllers/document_search_engine/documents_controller.rb @@ -7,6 +7,10 @@ # GET /documents def index @documents = Document.all + query = params[:query] + if query.present? + @documents = @documents.full_text_search(query) + end end # GET /documents/1
Use full-text search in controller
diff --git a/script/generate-permitted-next-nodes-for-all-flows.rb b/script/generate-permitted-next-nodes-for-all-flows.rb index abc1234..def5678 100644 --- a/script/generate-permitted-next-nodes-for-all-flows.rb +++ b/script/generate-permitted-next-nodes-for-all-flows.rb @@ -0,0 +1,11 @@+flows = SmartAnswer::FlowRegistry.instance.flows +data = flows.sort_by(&:name).inject({}) do |hash, flow| + hash[flow.name] = flow.questions.sort_by(&:name).inject({}) do |q_vs_pnn, question| + q_vs_pnn[question.name] = question.permitted_next_nodes.sort + q_vs_pnn + end + hash +end + +path = Rails.root.join('test', 'data', 'permitted-next-nodes.yml') +File.write(path, data.to_yaml)
Add script to generate permitted next nodes for all flows I'm about to change all the flows to use the mechanism for automatically detecting permitted next nodes. Although the existing tests, particularly the regression tests should give a lot of confidence that nothing gets broken, I'm hoping to compare the results of this script before and after the changes as a double-check.
diff --git a/LolayKat.podspec b/LolayKat.podspec index abc1234..def5678 100644 --- a/LolayKat.podspec +++ b/LolayKat.podspec @@ -16,7 +16,6 @@ } s.source_files = '*.{h,m}' s.requires_arc = true - s.frameworks = 'XCTest','Foundation', 'QuartzCore', 'EventKit', 'UIKit' + s.frameworks = 'QuartzCore', 'EventKit' s.ios.deployment_target = '7.0' - s.xcconfig = { 'OTHER_LDFLAGS' => '-ObjC'} end
Update podspec to remove XCTest
diff --git a/examples/address_book/app/schemas/contacts_controller_schema.rb b/examples/address_book/app/schemas/contacts_controller_schema.rb index abc1234..def5678 100644 --- a/examples/address_book/app/schemas/contacts_controller_schema.rb +++ b/examples/address_book/app/schemas/contacts_controller_schema.rb @@ -1,7 +1,7 @@ class ContactsControllerSchema < ApplicationControllerSchema def create - request do - body_parameters do |s| + request do |r| + r.body_parameters do |s| s.hash "contact" do |s| s.contact_attributes end @@ -9,8 +9,8 @@ end response_for do |status| status.ok # contacts/create.schema - status.unprocessable_entity do - body do |s| + status.unprocessable_entity do |s| + s.body do |s| s.string "error" end end
Adjust to new DSL syntax.
diff --git a/test/controllers/maps_controller_test.rb b/test/controllers/maps_controller_test.rb index abc1234..def5678 100644 --- a/test/controllers/maps_controller_test.rb +++ b/test/controllers/maps_controller_test.rb @@ -2,7 +2,7 @@ class MapsControllerTest < ActionDispatch::IntegrationTest test "loads index JSON" do - get maps_path, params: { format: :json } + get "/api/maps" assert_response :success end end
Make test more explicit with exact path
diff --git a/bosh_cli_plugin_aws/migrations/20130412183544_create_rds_dbs.rb b/bosh_cli_plugin_aws/migrations/20130412183544_create_rds_dbs.rb index abc1234..def5678 100644 --- a/bosh_cli_plugin_aws/migrations/20130412183544_create_rds_dbs.rb +++ b/bosh_cli_plugin_aws/migrations/20130412183544_create_rds_dbs.rb @@ -8,7 +8,7 @@ end vpc_receipt = load_receipt("aws_vpc_receipt") - db_names = %w(ccdb uaadb mysql-service-public) + db_names = %w(ccdb uaadb) db_configs = config['rds'].select {|c| db_names.include?(c['instance']) } RdsDb.aws_rds = rds dbs = []
Revert "Revert "Boostrap no longer creates an RDS database for a public mysql offering."" This reverts commit 952bb0c6d3118e1231689f90e2b87048ee83bf22.
diff --git a/test/integration/mobile_messages_test.rb b/test/integration/mobile_messages_test.rb index abc1234..def5678 100644 --- a/test/integration/mobile_messages_test.rb +++ b/test/integration/mobile_messages_test.rb @@ -6,4 +6,14 @@ class MobileMessagesTest < MobileIntegrationTest include MessagingTests + + # + # In mobile screens, sometimes the cookie-bar gets in the middle so we need + # to dismiss it first. + # + before do + visit root_path + + within('#cookie-bar') { click_link 'OK' } + end end
Fix the cookie bar failure in messaging tests ``` Capybara::Poltergeist::MouseEventFailed: Firing a click at co-ordinates [30.5, 433.5] failed. Poltergeist detected another element with CSS selector 'html body div#cookie-bar p' at this position. It may be overlapping the element you are trying to interact with. If you don't care about overlapping elements, try using node.trigger('click'). ```
diff --git a/each_in_batches.gemspec b/each_in_batches.gemspec index abc1234..def5678 100644 --- a/each_in_batches.gemspec +++ b/each_in_batches.gemspec @@ -20,6 +20,6 @@ spec.add_dependency "activerecord", ">= 3.2", "<= 5.2.3" spec.add_development_dependency "bundler" - spec.add_development_dependency "rake", "~> 12.0" + spec.add_development_dependency "rake", "~> 13.0" spec.add_development_dependency "rspec", "~> 3.2" end
Update rake to version 13.0.4
diff --git a/db/migrate/20160902112213_add_locale_to_announcements.rb b/db/migrate/20160902112213_add_locale_to_announcements.rb index abc1234..def5678 100644 --- a/db/migrate/20160902112213_add_locale_to_announcements.rb +++ b/db/migrate/20160902112213_add_locale_to_announcements.rb @@ -2,6 +2,6 @@ class AddLocaleToAnnouncements < ActiveRecord::Migration[4.2] def change - add_column :announcements, :locale, :string + add_column :announcements, :locale, :string, limit: 255 end end
Fix migration for better reversibility
diff --git a/panties.gemspec b/panties.gemspec index abc1234..def5678 100644 --- a/panties.gemspec +++ b/panties.gemspec @@ -19,6 +19,7 @@ spec.require_paths = ["lib"] spec.add_dependency 'httparty', '~> 0.13.0' + spec.add_dependency 'nokogiri', '~> 1.4' spec.add_development_dependency "bundler", "~> 1.6" spec.add_development_dependency "rake"
Add nokogiri to gem dependencies.
diff --git a/packstack/puppet/modules/packstack/lib/facter/is_virtual_packstack.rb b/packstack/puppet/modules/packstack/lib/facter/is_virtual_packstack.rb index abc1234..def5678 100644 --- a/packstack/puppet/modules/packstack/lib/facter/is_virtual_packstack.rb +++ b/packstack/puppet/modules/packstack/lib/facter/is_virtual_packstack.rb @@ -4,6 +4,6 @@ Facter.add("is_virtual_packstack") do setcode do - Facter::Util::Resolution.exec('grep -P \'(vmx|svm|hypervisor)\' /proc/cpuinfo > /dev/null && echo true || echo false') + Facter::Util::Resolution.exec('grep hypervisor /proc/cpuinfo > /dev/null && echo true || echo false') end end
Revert "Better Hardware Virt Support checking" is_virtual_packstack custom fact checks if packstack is running on a virtualized system. So checking for 'vmx' or 'svm' flags is useless ! This reverts commit 5c357a8dd3c04a4eac7f9a106ae64ea5bc38eecc. Change-Id: I81f9444a787712cb1c5e676256d6a7c6ebdf84bf
diff --git a/UITextView+UIControl.podspec b/UITextView+UIControl.podspec index abc1234..def5678 100644 --- a/UITextView+UIControl.podspec +++ b/UITextView+UIControl.podspec @@ -1,5 +1,11 @@ Pod::Spec.new do |s| s.name = 'UITextView+UIControl' + s.summary = 'A UIControl-like API addition to UITextView.' + s.homepage = 'https://github.com/andrewsardone/UITextView-UIControl' + s.source = { :git => 'https://github.com/andrewsardone/UITextView-UIControl.git', :tag => '0.1' } s.version = '0.1' + s.authors = { 'Andrew Sardone' => 'andrew@andrewsardone.com' } + s.license = 'MIT' s.source_files = "Classes" + s.platform = :ios end
Update podspec to pass linter
diff --git a/app/controllers/renalware/clinical_summaries_controller.rb b/app/controllers/renalware/clinical_summaries_controller.rb index abc1234..def5678 100644 --- a/app/controllers/renalware/clinical_summaries_controller.rb +++ b/app/controllers/renalware/clinical_summaries_controller.rb @@ -8,7 +8,7 @@ def show @events = Events::Event.for_patient(@patient) @problems = @patient.problems.ordered - @medications = @patient.medications.ordered + @medications = @patient.medications.current.ordered end end end
Use the medications scope for clinical summary Resolves #519
diff --git a/exercises/rna-transcription/.meta/generator/rna_transcription_case.rb b/exercises/rna-transcription/.meta/generator/rna_transcription_case.rb index abc1234..def5678 100644 --- a/exercises/rna-transcription/.meta/generator/rna_transcription_case.rb +++ b/exercises/rna-transcription/.meta/generator/rna_transcription_case.rb @@ -2,20 +2,6 @@ class RnaTranscriptionCase < Generator::ExerciseCase def workload - if expects_error? - assert_raises(ArgumentError) { test_case } - else - assert_equal { test_case } - end - end - - private - - def test_case "assert_equal '#{expected}', Complement.of_dna('#{dna}')" end - - def expects_error? - expected.is_a? Hash - end end
Remove exception test generator for rna transcription exercise
diff --git a/db/migrate/20130329200919_create_consultations_variants.rb b/db/migrate/20130329200919_create_consultations_variants.rb index abc1234..def5678 100644 --- a/db/migrate/20130329200919_create_consultations_variants.rb +++ b/db/migrate/20130329200919_create_consultations_variants.rb @@ -1,6 +1,8 @@ class CreateConsultationsVariants < ActiveRecord::Migration def up - create_table :spree_consultations_variants, :id => false do |t| + # We used create_table with :id => false but put it back + # because it was easier to manage (delete) relations with IDs + create_table :spree_consultations_variants do |t| t.references :consultation t.references :variant end
Fix the migration - we need id column
diff --git a/db/migrate/20210211115125_migrate_shipment_fees_to_shipments.rb b/db/migrate/20210211115125_migrate_shipment_fees_to_shipments.rb index abc1234..def5678 100644 --- a/db/migrate/20210211115125_migrate_shipment_fees_to_shipments.rb +++ b/db/migrate/20210211115125_migrate_shipment_fees_to_shipments.rb @@ -1,4 +1,8 @@ class MigrateShipmentFeesToShipments < ActiveRecord::Migration + class Spree::Adjustment < ActiveRecord::Base + belongs_to :originator, polymorphic: true + end + def up # Shipping fee adjustments currently have the order as the `adjustable` and the shipment as # the `source`. Both `source` and `adjustable` will now be the shipment. The `originator` is
Add model definition to migration
diff --git a/development-vm/replication/close_and_delete_old_indices.rb b/development-vm/replication/close_and_delete_old_indices.rb index abc1234..def5678 100644 --- a/development-vm/replication/close_and_delete_old_indices.rb +++ b/development-vm/replication/close_and_delete_old_indices.rb @@ -12,7 +12,7 @@ resp = http.get(list_uri.path) data = JSON.parse(resp.body) - used_aliases = valid_indices.flat_map { |index_name| data[index_name]['aliases'].keys } + used_aliases = valid_indices.flat_map { |index_name| data[index_name] ? data[index_name]['aliases'].keys : [] } data.each do |index_name, aliases| next if valid_indices.include?(index_name) if (aliases['aliases'].keys & used_aliases).any?
Deal with edge case when index doesn't exist
diff --git a/app/controllers/line_controller.rb b/app/controllers/line_controller.rb index abc1234..def5678 100644 --- a/app/controllers/line_controller.rb +++ b/app/controllers/line_controller.rb @@ -1,4 +1,10 @@ class LineController < ApplicationController def callback + unless Line::Callback.validate_signature? request + render status: 400, text: 'Bad Request' and return + else + Line::Callback.parse request + render text: "OK" and return + end end end
Add - Add Line callback
diff --git a/examples/address_book/app/controllers/application_controller.rb b/examples/address_book/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/examples/address_book/app/controllers/application_controller.rb +++ b/examples/address_book/app/controllers/application_controller.rb @@ -2,4 +2,6 @@ protect_from_forgery around_filter :validate_schemas + + rescue_from_request_validation_error if Rails.env.development? end
Use request validation error handler.
diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -14,7 +14,11 @@ def set_content_type if ['json', 'xml', 'msgpack'].include? params[:format].to_s - response.content_type = "application/#{params[:format]}" + response.content_type = { + json: 'application/json', + xml: 'application/xml', + msgpack: 'application/x-msgpack' + }[params[:format].to_s.to_sym] else render_error status: :not_acceptable, message: 'Unsupported format.' false
Fix api controller content types
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index abc1234..def5678 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,17 +1,15 @@ class HomeController < ApplicationController - + #@contact_form.request = request def index - + end def show - - pages = %w(acerca contacto privacidad) + pages = %w(acerca privacidad) page = params[:id] || '' - @contact_form = ContactForm.new(params[:contact_form]) return render page.downcase if pages.include?(page.downcase) render text: 'Not found', status: 404
Remove contacto from show action
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index abc1234..def5678 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -7,7 +7,7 @@ skip_before_filter :ensure_org_url_if_org_user def app_status - return head(500) if Cartodb.config[:disable_file] && File.exists?(File.expand_path(Cartodb.config[:disable_file])) + return head(503) if Cartodb.config[:disable_file] && File.exists?(File.expand_path(Cartodb.config[:disable_file])) db_ok = Rails::Sequel.connection.select('OK').first.values.include?('OK') redis_ok = $tables_metadata.dbsize api_ok = true
Return 503 code if disable file is used (instead of 500)
diff --git a/app/controllers/pacs_controller.rb b/app/controllers/pacs_controller.rb index abc1234..def5678 100644 --- a/app/controllers/pacs_controller.rb +++ b/app/controllers/pacs_controller.rb @@ -1,4 +1,8 @@ class PacsController < EmbeddedToolsController + def canonical + "https://www.moneyhelper.org.uk/#{locale}/everyday-money/banking/compare-bank-account-fees-and-charges" + end + def exclude_syndicated_iframe_resizer? true end
Set canonical url for PACS
diff --git a/activerecord-stream.gemspec b/activerecord-stream.gemspec index abc1234..def5678 100644 --- a/activerecord-stream.gemspec +++ b/activerecord-stream.gemspec @@ -8,9 +8,9 @@ spec.version = ActiveRecord::Stream::VERSION spec.authors = ["Scott Fleckenstein"] spec.email = ["nullstyle@gmail.com"] - spec.description = %q{TODO: Write a gem description} - spec.summary = %q{TODO: Write a gem summary} - spec.homepage = "" + spec.description = %q{lazy-ish, Enumerator based traversal of data within ActiveRecord} + spec.summary = %q{lazy-ish, Enumerator based traversal of data within ActiveRecord} + spec.homepage = "https://github.com/nullstyle/activerecord-stream" spec.license = "MIT" spec.files = `git ls-files`.split($/) @@ -22,6 +22,6 @@ spec.add_development_dependency "rake" - spec.add_dependency "activerecord", "~> 3.2.0" - spec.add_dependency "activesupport", "~> 3.2.0" + spec.add_dependency "activerecord", ">= 3.2.0" + spec.add_dependency "activesupport", ">= 3.2.0" end
Update gemspec descriptions and dependencies
diff --git a/integration-tests/apps/alacarte/job-timeout/long_running_job.rb b/integration-tests/apps/alacarte/job-timeout/long_running_job.rb index abc1234..def5678 100644 --- a/integration-tests/apps/alacarte/job-timeout/long_running_job.rb +++ b/integration-tests/apps/alacarte/job-timeout/long_running_job.rb @@ -3,20 +3,19 @@ def initialize(opts) @queue_name = opts['queue'] @response_queue = TorqueBox::Messaging::Queue.new( @queue_name ) - @interrupted = false - + @latch = java.util.concurrent.CountDownLatch.new(1) end def run() $stderr.puts "Job executing! " + @queue_name @response_queue.publish( 'started' ) - sleep( 5 ) - @response_queue.publish( @interrupted ? 'interrupted' : 'done', :properties => { 'completion' => 'true' } ) + interrupted = @latch.await(30, java.util.concurrent.TimeUnit::SECONDS) + @response_queue.publish( interrupted ? 'interrupted' : 'done', :properties => { 'completion' => 'true' } ) end def on_timeout() $stderr.puts "Job was interrupted " + @queue_name - @interrupted = true + @latch.count_down end end
Use a CountDownLatch instead of sleep for jobs_timeout_spec