diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/problem_2.rb b/problem_2.rb index abc1234..def5678 100644 --- a/problem_2.rb +++ b/problem_2.rb @@ -6,7 +6,7 @@ c = a + b a = b b = c - sum += a if a % 2 == 0 + sum += a if a.even? end p sum
Change in checking whether a number is even -> a % 2 == 0 to a.even?
diff --git a/attributes/default.rb b/attributes/default.rb index abc1234..def5678 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -0,0 +1,27 @@+default[:jenkins][:server][:plugins] = %w( + ant + nant + mailer + javadoc + token-macro + maven-plugin + run-condition + conditional-buildstep + matrix-project + rebuild + promoted-builds + mapdb-api + credentials + ssh-credentials + scm-api + subversion + parameterized-trigger + git-client + git + maven-plugin + maven-info + dashboard-view + jquery + build-pipeline-plugin +) +
Add git and all its dependencies and a few others like ant
diff --git a/roles/web.rb b/roles/web.rb index abc1234..def5678 100644 --- a/roles/web.rb +++ b/roles/web.rb @@ -19,7 +19,7 @@ :web => { :status => "online", :database_host => "db", - :readonly_database_host => "db-slave" + :readonly_database_host => "db" } )
Move readonly load to katla
diff --git a/Start.rb b/Start.rb index abc1234..def5678 100644 --- a/Start.rb +++ b/Start.rb @@ -5,18 +5,11 @@ Dir[File.dirname(__FILE__) + '/vue/*.rb'].each {|file| require file } require_relative './class/generator_class.rb' - window= Gtk::Window.new window.set_title "Sudoku" window.set_default_size 300, 300 window.set_resizable false window.set_window_position Gtk::WindowPosition::CENTER - -window.signal_connect 'destroy' do - SaveUser.serialized - Gtk.main_quit -end - GlobalOpts.load SaveUser.load @@ -24,7 +17,17 @@ gen=Generator.new gen.generate(:full) -window.add Game.new(window,gen.board) +game = Game.new(window,gen.board) + +window.add game + +window.signal_connect 'destroy' do + game.hideOverlay + game.cleanOverlay + SaveUser.serialized + Gtk.main_quit +end + window.show_all Gtk.main
Fix core dump (overlay close app)
diff --git a/RxAlamofire.podspec b/RxAlamofire.podspec index abc1234..def5678 100644 --- a/RxAlamofire.podspec +++ b/RxAlamofire.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'RxAlamofire' - s.version = '1.1.1' + s.version = '1.2' s.license = 'MIT' s.summary = 'RxSwift wrapper around the elegant HTTP networking in Swift Alamofire' s.homepage = 'https://github.com/RxSwiftCommunity/RxAlamofire' @@ -9,6 +9,7 @@ s.ios.deployment_target = '8.0' s.osx.deployment_target = '10.9' + s.tvos.deployment_target = '9.0' s.requires_arc = true @@ -16,15 +17,15 @@ s.subspec "Core" do |ss| ss.source_files = "RxAlamofire/Source/*.swift" - ss.dependency "RxSwift", "~> 2.0" - ss.dependency "Alamofire", "~> 3.0" + ss.dependency "RxSwift", "~> 2.1.0" + ss.dependency "Alamofire", "~> 3.1" ss.framework = "Foundation" end s.subspec "RxCocoa" do |ss| ss.source_files = "RxAlamofire/Source/Cocoa/*.swift" - ss.dependency "RxCocoa", "~> 2.0" + ss.dependency "RxCocoa", "~> 2.1.0" ss.dependency "RxAlamofire/Core" end - + end
Update podspec to add tvOS support
diff --git a/rom-mongo.gemspec b/rom-mongo.gemspec index abc1234..def5678 100644 --- a/rom-mongo.gemspec +++ b/rom-mongo.gemspec @@ -17,7 +17,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_runtime_dependency "rom-core", "~> 4.0.0.beta1" + spec.add_runtime_dependency "rom-core", "~> 4.0" spec.add_runtime_dependency "mongo", "~> 2.2" spec.add_runtime_dependency "origin"
Update gemspec to allow ROM 4.0.x
diff --git a/chain-cli.rb b/chain-cli.rb index abc1234..def5678 100644 --- a/chain-cli.rb +++ b/chain-cli.rb @@ -16,7 +16,7 @@ def install venv = virtualenv_create(libexec, "python3") venv.pip_install resources - venv.link_scripts(bin) { venv.pip_install buildpath } + venv.pip_install_and_link buildpath bash_completion.install "contrib/bash/chain-complete.bash" => "chain" end
Fix for out of date docs.
diff --git a/ruby_enum.gemspec b/ruby_enum.gemspec index abc1234..def5678 100644 --- a/ruby_enum.gemspec +++ b/ruby_enum.gemspec @@ -11,7 +11,7 @@ spec.summary = %q{Simple enumeration type for ruby} spec.description = %q{Implementation of a simple enumeration type for ruby} - spec.homepage = "http://www.laskaridis.cm" + spec.homepage = "https://github.com/laskaridis/ruby_enum" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
Fix incorrect homepage in gemspec
diff --git a/frontend/app/controllers/spree/store_controller.rb b/frontend/app/controllers/spree/store_controller.rb index abc1234..def5678 100644 --- a/frontend/app/controllers/spree/store_controller.rb +++ b/frontend/app/controllers/spree/store_controller.rb @@ -17,7 +17,7 @@ handler = PromotionHandler::Coupon.new(@order).apply if handler.error.present? - flash[:error] = handler.error + flash.now[:error] = handler.error respond_with(@order) { |format| format.html { render :edit } } and return elsif handler.success flash[:success] = handler.success
[frontend] Use flash.now for coupon application error in OrdersController Otherwise this will carry over to the next request, which is not fun. Fixes #4034
diff --git a/lib/smart_answer_flows/calculate-your-redundancy-pay.rb b/lib/smart_answer_flows/calculate-your-redundancy-pay.rb index abc1234..def5678 100644 --- a/lib/smart_answer_flows/calculate-your-redundancy-pay.rb +++ b/lib/smart_answer_flows/calculate-your-redundancy-pay.rb @@ -6,98 +6,7 @@ status :published satisfies_need "100135" - date_question :date_of_redundancy? do - from { Date.civil(2012, 1, 1) } - to { Date.today.end_of_year } - validate_in_range - - calculate :rates do |response| - Calculators::RedundancyCalculator.redundancy_rates(response) - end - - calculate :ni_rates do |response| - Calculators::RedundancyCalculator.northern_ireland_redundancy_rates(response) - end - - calculate :rate do - rates.rate - end - - calculate :ni_rate do - ni_rates.rate - end - - calculate :max_amount do - rates.max - end - - calculate :ni_max_amount do - ni_rates.max - end - - next_node :age_of_employee? - end - - value_question :age_of_employee?, parse: :to_i do - calculate :employee_age do |response| - age = response - raise InvalidResponse if age < 16 or age > 100 - age - end - calculate :years_available do - employee_age - 15 - end - next_node :years_employed? - end - - value_question :years_employed?, parse: Float do - save_input_as :years_employed - calculate :years_employed do |response| - ye = response.floor - raise InvalidResponse if ye.to_i > years_available - ye - end - next_node do |response| - if response.floor < 2 - :done_no_statutory - else - :weekly_pay_before_tax? - end - end - end - - money_question :weekly_pay_before_tax? do - calculate :calculator do |response| - Calculators::RedundancyCalculator.new(rate, employee_age, years_employed, response) - end - - calculate :ni_calculator do |response| - Calculators::RedundancyCalculator.new(ni_rate, employee_age, years_employed, response) - end - - calculate :statutory_redundancy_pay do - calculator.format_money(calculator.pay.to_f) - end - - calculate :statutory_redundancy_pay_ni do - calculator.format_money(ni_calculator.pay.to_f) - end - - calculate :number_of_weeks_entitlement do - calculator.number_of_weeks_entitlement - end - - next_node do |response| - if years_employed < 2 - :done_no_statutory - else - :done - end - end - end - - outcome :done_no_statutory - outcome :done + use_shared_logic "redundancy_pay" end end end
Revert "TEMP: Inline redundancy_pay shared logic" This is no longer required now that I've used the coverage data to generate a set of responses that allow me to add regression tests.
diff --git a/serialize.gemspec b/serialize.gemspec index abc1234..def5678 100644 --- a/serialize.gemspec +++ b/serialize.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'serialize' - s.version = '0.1.5' + s.version = '0.2.0' s.summary = 'Common interface for serialization and deserialization, and serializer discovery' s.description = ' '
Package version is increased from 0.1.5 to 0.2.0
diff --git a/peat.gemspec b/peat.gemspec index abc1234..def5678 100644 --- a/peat.gemspec +++ b/peat.gemspec @@ -8,8 +8,8 @@ spec.version = Peat::VERSION spec.authors = ["Hubert Huang"] spec.email = ["hhuang@practicefusion.com"] - spec.summary = %q{TODO: Write a short summary. Required.} - spec.description = %q{TODO: Write a longer description. Optional.} + spec.summary = %q{Wrapper for the Exact Target fuel api} + spec.description = %q{Wrapper for the Exact Target fuel api} spec.homepage = "" spec.license = "MIT"
Add basic summary and description to gemspec
diff --git a/spec/controllers/organizations_controller_spec.rb b/spec/controllers/organizations_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/organizations_controller_spec.rb +++ b/spec/controllers/organizations_controller_spec.rb @@ -15,4 +15,11 @@ Organization.last.stripe_publishable_key.should == 'X' end end + + describe 'GET new' do + it 'renders a new template for an Organization' do + get :new + expect(response).to render_template("new") + end + end end
Test rendering of new organization form
diff --git a/rails/benchmarks/bm_activerecord_create_string_columns.rb b/rails/benchmarks/bm_activerecord_create_string_columns.rb index abc1234..def5678 100644 --- a/rails/benchmarks/bm_activerecord_create_string_columns.rb +++ b/rails/benchmarks/bm_activerecord_create_string_columns.rb @@ -0,0 +1,31 @@+require 'bundler/setup' +require 'active_record' +require_relative 'support/benchmark_rails' + +ActiveRecord::Base.establish_connection(ENV['DATABASE_URL']) + +ActiveRecord::Migration.verbose = false + +COUNT = 25 + +ActiveRecord::Schema.define do + create_table :users, force: true do |t| + COUNT.times do |i| + t.string :"column#{i}" + end + + t.timestamps null: false + end +end + +class User < ActiveRecord::Base; end + +attributes = {} + +COUNT.times do |i| + attributes[:"column#{i}"] = "Some string #{i}" +end + +Benchmark.rails("activerecord/#{db_adapter}_create_string_columns", time: 5) do + User.create!(attributes) +end
FEATURE: Add new benchmark for Active Record. * Creating a record with many string columns.
diff --git a/test/cookbooks/lxctests/recipes/install_lxc.rb b/test/cookbooks/lxctests/recipes/install_lxc.rb index abc1234..def5678 100644 --- a/test/cookbooks/lxctests/recipes/install_lxc.rb +++ b/test/cookbooks/lxctests/recipes/install_lxc.rb @@ -1,6 +1,14 @@ # Ubuntu 12, not Ubuntu 14 if node['platform'] == 'ubuntu' && node['platform_version'].to_i == 12 + execute 'apt-get update' do + action :nothing + end.run_action(:run) + package 'python-software-properties' do + action :nothing + end.run_action(:install) + + package 'make' do action :nothing end.run_action(:install) end
Fix LXC install on Ubuntu 12
diff --git a/spec/fabricators/user_fabricator.rb b/spec/fabricators/user_fabricator.rb index abc1234..def5678 100644 --- a/spec/fabricators/user_fabricator.rb +++ b/spec/fabricators/user_fabricator.rb @@ -1,6 +1,6 @@ Fabricator(:user) do - first_name{ sequence(:first_name) { |i| "user_first_name{i}" } } - last_name { sequence(:last_name) { |i| "user_last_name{i}" } } + first_name{ sequence(:first_name) { |i| "user_first_name#{i}" } } + last_name { sequence(:last_name) { |i| "user_last_name#{i}" } } email { sequence(:email) { |i| "user#{i}@example.com" } } password { "password1" } end
Update User Fabricator to include new table columns: First name and Last name
diff --git a/lib/miq_tools_services/sidekiq_worker_mixin.rb b/lib/miq_tools_services/sidekiq_worker_mixin.rb index abc1234..def5678 100644 --- a/lib/miq_tools_services/sidekiq_worker_mixin.rb +++ b/lib/miq_tools_services/sidekiq_worker_mixin.rb @@ -6,7 +6,7 @@ extend ActiveSupport::Concern included do - delegate :sidekiq_queue, :workers, :running, :to => self + delegate :sidekiq_queue, :workers, :running?, :to => self end module ClassMethods @@ -34,7 +34,7 @@ def first_unique_worker?(workers = nil) _name, work, _started_at = (workers || self.workers).first - work.fetch_path("payload", "jid") == jid + work.nil? || work.fetch_path("payload", "jid") == jid end end end
Fix issue when Sidekiq is not running
diff --git a/SSPPullToRefresh.podspec b/SSPPullToRefresh.podspec index abc1234..def5678 100644 --- a/SSPPullToRefresh.podspec +++ b/SSPPullToRefresh.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'SSPPullToRefresh' - s.version = '0.1.12' + s.version = '0.1.13' s.summary = 'General classes for "Pull-To-Refresh" concept customisation' s.description = <<-DESC
Update pod spec to 0.1.13
diff --git a/lib/openc_bot/templates/lib/company_fetcher_bot.rb b/lib/openc_bot/templates/lib/company_fetcher_bot.rb index abc1234..def5678 100644 --- a/lib/openc_bot/templates/lib/company_fetcher_bot.rb +++ b/lib/openc_bot/templates/lib/company_fetcher_bot.rb @@ -1,14 +1,54 @@ # encoding: UTF-8 -require 'company_fetcher_bot' +require 'openc_bot' +require 'openc_bot/company_fetcher_bot' # you may need to require other libraries here # # require 'nokogiri' # require 'openc_bot/helpers/dates' -# require 'openc_bot/helpers/incremental_search' module MyModule - extend CompanyFetcherBot + extend OpencBot + # This adds the CompanyFetcherBot functionality + extend OpencBot::CompanyFetcherBot + extend self # make these methods as Module methods, rather than instance ones + # If the register has a GET'able URL based on the company_number define it here. This should mean that + # #fetch_datum 'just works'. + def computed_registry_url(company_number) + # e.g. + # "http://some,register.com/path/to/#{company_number}" + end + + # This is the primary method for getting companies from the register. By default it uses the #fetch_data + # method defined in IncrementalSearch helper module, which increments through :company_number identifiers. + # See helpers/incremental_search.rb for details + # Override this if a different method for iterating companies is going to done (e.g. an alpha search, or + # parsing a CSV file) + def fetch_data + super + end + + # This is called by #update_datum (defined in the IncrementalSearch helper module), which updates the + # information for a given company_number. This allows the individual records to be updated, for example, + # via the 'Update from Register' button on the company page on OpenCorporates. This method is also called + # by the #fetch_data method in the case of incremental_searches. + # By default it calls #fetch_registry_page with the company_number and returns the result in a hash, + # with :company_page as a key. This will then be processed or parsed by the #process_datum method, + # and the result will be saved by #update_datum, and also returned in a form that can be used by the + # main OpenCorporates system + # This hash can contain other data, such as a page of filings or shareholdings, and the hash will be + # converted to json, and stored in the database in the row for that company number, under the :data key, + # so that it can be reused or referred it in the future. + # {:company_page => company_page_html, :filings_page => filings_page_html} + def fetch_datum(company_number) + super + end + + # This method must be defined for all bots that can fetch and process individual records, including + # incremental, and alpha searchers. Where the bot cannot do this (e.g. where the underlying data is + # only available as a CSV file, it can be left as a stub method) + def process_datum(datum_hash) + end end
Add documentation, stub methods to CompanyFetcherBot template
diff --git a/db/migrate/20160830110050_change_cloud_subnets_network_ports_unique_index.rb b/db/migrate/20160830110050_change_cloud_subnets_network_ports_unique_index.rb index abc1234..def5678 100644 --- a/db/migrate/20160830110050_change_cloud_subnets_network_ports_unique_index.rb +++ b/db/migrate/20160830110050_change_cloud_subnets_network_ports_unique_index.rb @@ -0,0 +1,15 @@+class ChangeCloudSubnetsNetworkPortsUniqueIndex < ActiveRecord::Migration[5.0] + def change + remove_index :cloud_subnets_network_ports, + :column => [:cloud_subnet_id, :network_port_id], + :name => 'index_cloud_subnets_network_ports', + :unique => true + + add_index :cloud_subnets_network_ports, :address + + add_index :cloud_subnets_network_ports, + [:cloud_subnet_id, :network_port_id, :address], + :name => 'index_cloud_subnets_network_ports_address', + :unique => true + end +end
Allow network port to have multiple fixed ips Allow network port to have multiple fixed ips, by extending unique index to contain address.
diff --git a/config/initializers/devise_permitted_parameters.rb b/config/initializers/devise_permitted_parameters.rb index abc1234..def5678 100644 --- a/config/initializers/devise_permitted_parameters.rb +++ b/config/initializers/devise_permitted_parameters.rb @@ -0,0 +1,17 @@+module DevisePermittedParameters + extend ActiveSupport::Concern + + included do + before_filter :configure_permitted_parameters + end + + protected + + def configure_permitted_parameters + devise_parameter_sanitizer.for(:sign_up) << :first_name << :last_name + devise_parameter_sanitizer.for(:account_update) << :first_name << :last_name + end + +end + +DeviseController.send :include, DevisePermittedParameters
Create initializer file to permit first and last name
diff --git a/Cosmos.podspec b/Cosmos.podspec index abc1234..def5678 100644 --- a/Cosmos.podspec +++ b/Cosmos.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Cosmos" - s.version = "8.0.1" + s.version = "8.0.2" s.license = { :type => "MIT" } s.homepage = "https://github.com/marketplacer/Cosmos" s.summary = "5-star rating control written in Swift"
Remove UIApplication.shared since it does not compile for app extensions
diff --git a/config/environment.rb b/config/environment.rb index abc1234..def5678 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -3,3 +3,5 @@ # Initialize the rails application Acubens::Application.initialize! + +ENV['RAILS_ASSET_ID'] = `git log -1 --pretty=format:"%h"`
Set RAILS_ASSET_ID to expire the assets
diff --git a/rets.gemspec b/rets.gemspec index abc1234..def5678 100644 --- a/rets.gemspec +++ b/rets.gemspec @@ -0,0 +1,22 @@+$LOAD_PATH.unshift File.expand_path("../lib", __FILE__) +require "rets/version" + +Gem::Specification.new do |s| + s.name = "rets" + s.version = RETS::Version + s.platform = Gem::Platform::RUBY + s.authors = ["Zachary Anker"] + s.email = ["zach.anker@gmail.com"] + s.homepage = "http://github.com/Placester/rets" + s.summary = "RETS library for Ruby" + s.description = "Simplifies communication with RETS 1.7, support for 2.0 and possibly 1.5 are planned." + + s.files = Dir.glob("lib/**/*") + %w[GPL-LICENSE MIT-LICENSE README.markdown] + s.require_path = "lib" + +# s.required_rubygems_version = ">= 1.3.6" +# s.rubyforge_project = "rets" + + s.add_runtime_dependency "nokogiri", "~>1.4.0" + s.add_development_dependency "rspec", "~> 2.0.0" +end
Add the gemspec file, still need to publish it after further testing
diff --git a/lib/capistrano/mailer_recipes.rb b/lib/capistrano/mailer_recipes.rb index abc1234..def5678 100644 --- a/lib/capistrano/mailer_recipes.rb +++ b/lib/capistrano/mailer_recipes.rb @@ -12,7 +12,7 @@ # Set the release notes git_commits_range = "#{latest_revision.strip}..#{current_revision.strip}" git_log = `git log --pretty=oneline --abbrev-commit #{git_commits_range}` # executes in local shell - set :release_notes, git_log.blank? ? "No Changes since last deploy." : git_log + set :release_notes, git_log.blank? ? "No Changes since last deploy." : "\n" + git_log mailer.send_notification_email(self) end
Add initial break for any release notes based on git log
diff --git a/lib/robin/sidekiq/queue_stats.rb b/lib/robin/sidekiq/queue_stats.rb index abc1234..def5678 100644 --- a/lib/robin/sidekiq/queue_stats.rb +++ b/lib/robin/sidekiq/queue_stats.rb @@ -29,18 +29,23 @@ # queue specific sidekiq_queue = ::Sidekiq::Queue.new(queue) - Librato.measure "#{namespace}.#{queue}.size", sidekiq_queue.size - Librato.measure "#{namespace}.#{queue}.latency", sidekiq_queue.latency - Librato.increment "#{namespace}.#{queue}.processed" + queue_namespace = metrics.for(queue: queue) + Librato.measure "#{queue_namespace}.size", sidekiq_queue.size + Librato.measure "#{queue_namespace}.latency", sidekiq_queue.latency + Librato.increment "#{queue_namespace}.processed" yield if block_given? rescue e Librato.increment "#{namespace}.failed" - Librato.increment "#{namespace}.#{queue}failed" + Librato.increment "#{queue_namespace}failed" raise e end private + + def metrics + @_metrics ||= Metric.new(namespace) + end def retries @_retries ||= ::Sidekiq::RetrySet.new
Use new Metric class to generate metric names
diff --git a/lib/vue-form-for/form_builder.rb b/lib/vue-form-for/form_builder.rb index abc1234..def5678 100644 --- a/lib/vue-form-for/form_builder.rb +++ b/lib/vue-form-for/form_builder.rb @@ -4,7 +4,8 @@ class FormBuilder < ActionView::Helpers::FormBuilder include VueFormFor::VueOptionsResolver - (field_helpers - [:label, :fields_for]).each do |selector| + (field_helpers - [:label, :check_box, :radio_button, :fields_for]) + .each do |selector| class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 def #{selector}(method, options = {}) resolve_vue_options(options) @@ -19,6 +20,16 @@ super(method, text, options, &block) end + def check_box(method, options = {}, checked_value = "1", unchecked_value = "0") + resolve_vue_options(options) + super(method, options, checked_value, unchecked_value) + end + + def radio_button(method, tag_value, options = {}) + resolve_vue_options(options) + super(method, tag_value, options) + end + def submit(value = nil, options = {}) resolve_vue_options(options) super(value, options)
Fix check_box and radio_button helper methods These methods have difference signature.
diff --git a/config/deploy/production.rb b/config/deploy/production.rb index abc1234..def5678 100644 --- a/config/deploy/production.rb +++ b/config/deploy/production.rb @@ -14,8 +14,8 @@ set :ssh_options, {:forward_agent => true} -set :wpcli_remote_url, "https://lamosty.com" -set :wpcli_local_url, "http://dev.lamosty.com" +set :wpcli_remote_url, "https://lamosty.com/" +set :wpcli_local_url, "http://dev.lamosty.com/" # you can set custom ssh options # it's possible to pass any option but you need to keep in mind that net/ssh understand limited list of options
Fix wpcli local and remote urls
diff --git a/app/controllers/devise/registration_custom_controller.rb b/app/controllers/devise/registration_custom_controller.rb index abc1234..def5678 100644 --- a/app/controllers/devise/registration_custom_controller.rb +++ b/app/controllers/devise/registration_custom_controller.rb @@ -14,4 +14,12 @@ def sign_up_params params.permit(:email, :password, :password_validation, :name, :father_last_name, :mother_last_name, :dependence_id, :user_role_id) end + + private + def render_create_success + render json: { + status: 'success', + user: resource_data + } + end end
Update render for create success
diff --git a/app/controllers/refinery/products/products_controller.rb b/app/controllers/refinery/products/products_controller.rb index abc1234..def5678 100644 --- a/app/controllers/refinery/products/products_controller.rb +++ b/app/controllers/refinery/products/products_controller.rb @@ -1,7 +1,7 @@ module Refinery module Products class ProductsController < ShopController - include ControllerHelper + include Refinery::Products::ControllerHelper before_filter :find_page before_filter :find_all_products
Update controller helper path of Products
diff --git a/Nimble.podspec b/Nimble.podspec index abc1234..def5678 100644 --- a/Nimble.podspec +++ b/Nimble.podspec @@ -13,7 +13,8 @@ s.source = { :git => "https://github.com/Quick/Nimble.git", :tag => "v#{s.version}" } s.source_files = "Nimble", "Nimble/**/*.{swift,h,m}" - s.framework = "XCTest" + s.weak_framework = "XCTest" + s.pod_target_xcconfig = { 'OTHER_LDFLAGS' => '-weak-lswiftXCTest', 'FRAMEWORK_SEARCH_PATHS' => '$(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks"' } s.requires_arc = true s.pod_target_xcconfig = { 'ENABLE_BITCODE' => 'NO' } end
Update the podspec to weakly link XCTest When strongly linking XCTest, Cocoapods automatically adds a framework search path to allow the framework to be found. When weakly linking, it must be manually specified.
diff --git a/spec/models/print_spec.rb b/spec/models/print_spec.rb index abc1234..def5678 100644 --- a/spec/models/print_spec.rb +++ b/spec/models/print_spec.rb @@ -6,7 +6,7 @@ expect(print_str).to include(' -# 100 ') expect(print_str).to include(" -o duplex='two-sided-long-edge'") expect(print_str).to include(" -o collate='True'") - expect(print_str).to include(" -o ranges='3, 5-7'") + expect(print_str).to include(" -o page-ranges='3, 5-7'") expect(print_str).to include(" -o ppi='600'") expect(print_str).to include(" -o media='A3'")
Change ranges to page-ranges in spec
diff --git a/spec/models/route_spec.rb b/spec/models/route_spec.rb index abc1234..def5678 100644 --- a/spec/models/route_spec.rb +++ b/spec/models/route_spec.rb @@ -27,7 +27,7 @@ describe 'when finding existing routes' do - fixtures :stops, :routes, :route_stops + fixtures :stops, :routes, :route_stops, :transport_modes it 'should include in the results returned a route with the same number, mode of transport and stop codes' do attributes = { :number => '1F50',
Use transport_mode fixtures - wonder if we should be seeding the test db?
diff --git a/spec/models/video_spec.rb b/spec/models/video_spec.rb index abc1234..def5678 100644 --- a/spec/models/video_spec.rb +++ b/spec/models/video_spec.rb @@ -32,4 +32,13 @@ expect(bad_video.valid?).to be false end end + + describe "#search_by_title" do + it "returns a list of videos containing the query string" do + @video.get_video_info + @video.save + videos = Video.search_by_title("testing") + expect(videos.length).to eq 1 + end + end end
Correct some irregularities in testing suite
diff --git a/features/step_definitions/homepage_steps.rb b/features/step_definitions/homepage_steps.rb index abc1234..def5678 100644 --- a/features/step_definitions/homepage_steps.rb +++ b/features/step_definitions/homepage_steps.rb @@ -14,6 +14,10 @@ expect(page).to have_content text end +Then(/^I should not see the text "([^"]*)"$/) do |text| + expect(page).not_to have_content text +end + Then(/^I should see the top navigation bar$/) do expect(page).to have_css '#top-nav' end
Define step for page not having certain text
diff --git a/_scripts/mod_img.rb b/_scripts/mod_img.rb index abc1234..def5678 100644 --- a/_scripts/mod_img.rb +++ b/_scripts/mod_img.rb @@ -9,9 +9,9 @@ FileUtils.mkdir_p(new_dir) end - if File.file?(new_name) + if File.file?(new_name) puts "Skipping #{original}, #{new_name} already exists" - else + else cmd = "convert #{original} #{image_opts} #{new_name}" puts "converting with #{image_opts} #{original}-->#{new_name}" system cmd @@ -19,10 +19,10 @@ end def convert(file) - if (!File.directory?(file) && file[".jpg"]) + if File.file?(file) && file.end_with?(".jpg") convert_image(file, "img", "-resize 750 -strip -quality 86") convert_image(file, "img/thumbnail", "-resize 200 -strip -quality 86") end end -Find.find('../_raw_img') { |e| convert e}+Find.find('../_raw_img') { |e| convert e}
Remove unneeded parentheses (Ruby style :D)
diff --git a/app/models/channels/twitter_channel.rb b/app/models/channels/twitter_channel.rb index abc1234..def5678 100644 --- a/app/models/channels/twitter_channel.rb +++ b/app/models/channels/twitter_channel.rb @@ -27,12 +27,12 @@ #Check tweet identifiers against tweets.each do |tweet| unless items.where(guid: tweet.id.to_s).exists? - items.build( + i = items.build( guid: tweet.id, - tags: tweet.hashtags.map(&:text), description: tweet.text, published_at: tweet.created_at ) + i.tag_names = tweet.hashtags.map(&:text) end end true
Set tags in the new way
diff --git a/app/observers/contribution_observer.rb b/app/observers/contribution_observer.rb index abc1234..def5678 100644 --- a/app/observers/contribution_observer.rb +++ b/app/observers/contribution_observer.rb @@ -31,7 +31,7 @@ { }, { bcc: ::Configuration[:email_payments] }) - if Time.now > contribution.project.expires_at + 7.days + if contribution.project.expires_at < 7.days.ago notification_for_backoffice(contribution, :contribution_confirmed_after_project_was_closed) end end
Improve if statement readability on contribution observer
diff --git a/KWTextStyleLabel.podspec b/KWTextStyleLabel.podspec index abc1234..def5678 100644 --- a/KWTextStyleLabel.podspec +++ b/KWTextStyleLabel.podspec @@ -7,10 +7,10 @@ Helps in modifying character spacing and line spacing to your label. You can modify using storyboard (Text Style Label) or programmatically. DESC - s.homepage = 'https://github.com/keepworks/KWTextStyleLabel' + s.homepage = 'https://bitbucket.org/keepworks/kwtextstylelabel' s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { 'Vinoth Anandan S' => 'vinoth@keepworks.com' } - s.source = { :git => 'https://github.com/keepworks/KWTextStyleLabel.git', :tag => s.version.to_s } + s.source = { :git => 'https://bitbucket.org/keepworks/kwtextstylelabel.git', :tag => s.version.to_s } s.ios.deployment_target = '8.0' s.source_files = 'KWTextStyleLabel/Classes/**/*'
Update of source repository location
diff --git a/coin_market_cap.gemspec b/coin_market_cap.gemspec index abc1234..def5678 100644 --- a/coin_market_cap.gemspec +++ b/coin_market_cap.gemspec @@ -11,7 +11,7 @@ spec.email = ["vinaysolanki2005@gmail.com"] spec.summary = %q{Coin Market Cap gem} spec.description = %q{Ruby gem to fetch Crypto currency prices from Coin Market Cap} - spec.homepage = "" + spec.homepage = "http://github.com/vinaysolanki/coin_market_cap" spec.license = "MIT" spec.files = `git ls-files`.split($/) @@ -19,6 +19,9 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] + spec.add_dependency "nokogiri", "~> 1.6", ">=1.6.1" + spec.add_development_dependency "bundler", "~> 1.5" - spec.add_development_dependency "rake" + spec.add_development_dependency "rake", "~> 10.1", ">=10.1.1" + spec.add_development_dependency "rspec", "~> 2.14", ">=2.14.1" end
Add homepage and update dependecies to gemspec
diff --git a/app/workers/scraper_auto_run_worker.rb b/app/workers/scraper_auto_run_worker.rb index abc1234..def5678 100644 --- a/app/workers/scraper_auto_run_worker.rb +++ b/app/workers/scraper_auto_run_worker.rb @@ -3,11 +3,13 @@ sidekiq_options backtrace: true def perform(scraper_id) - scraper = Scraper.find(scraper_id) + # Scraper might have been deleted after this job was created. So, check + # for this + scraper = Scraper.find_by(id: scraper_id) # Guard against more than one of a particular scraper running at the same time # And also double check that the scraper should be run automatically (in case it # has changed since it was queued) - if scraper.runnable? && scraper.auto_run? + if scraper && scraper.runnable? && scraper.auto_run? if scraper.owner.ability.can? :create, Run run = scraper.runs.create(queued_at: Time.now, auto: true, owner_id: scraper.owner_id) # Throw the actual run onto the background so it can be safely restarted
Deal with scraper deleted after ScraperAutoRunWorker job created
diff --git a/vp_to_ki.rb b/vp_to_ki.rb index abc1234..def5678 100644 --- a/vp_to_ki.rb +++ b/vp_to_ki.rb @@ -11,9 +11,9 @@ require 'nokogiri' require 'erubis' -require 'lib/state' -require 'lib/transition' -require 'lib/printer' +require_relative 'lib/state' +require_relative 'lib/transition' +require_relative 'lib/printer' if ARGV.size < 1 puts "Usage: #{$0} XML-FILE"
Use require_relative for Ruby 1.9 (no more 1.8!)
diff --git a/templater.rb b/templater.rb index abc1234..def5678 100644 --- a/templater.rb +++ b/templater.rb @@ -2,7 +2,7 @@ initialize_templater -required_recipes = %w(default jquery mongoid haml rspec factory_girl remarkable) +required_recipes = %w(default mongoid jquery haml rspec factory_girl remarkable) required_recipes.each {|required_recipe| apply recipe(required_recipe)} load_options
Change up the order of recipes
diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index abc1234..def5678 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -20,7 +20,8 @@ protected def handle_jwt_error - Raven.capture_message "\nJWT Decoding failed: #{request.env['JWT_DATA'].body}\n" + Raven.capture_message 'OAuth login failed', + extra: { jwt_data: request.env['JWT_DATA'].body } return redirect_to errors_login_error_path end end
Fix format of Raven capture for JWT debugging
diff --git a/app/serializers/paper_event_stream_serializer.rb b/app/serializers/paper_event_stream_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/paper_event_stream_serializer.rb +++ b/app/serializers/paper_event_stream_serializer.rb @@ -1,5 +1,5 @@ class PaperEventStreamSerializer < ActiveModel::Serializer - attributes :id, :short_title, :title, :body, :submitted, :paper_type, :status, :updated_at, :event_name + attributes :id, :short_title, :title, :body, :submitted, :paper_type, :status, :updated_at root :paper %i(phases figures author_groups supporting_information_files).each do |relation| @@ -24,8 +24,4 @@ def status object.manuscript.try(:status) end - - def event_name - EventStream.name(object.id) - end end
Remove unneeded event stream name because of user channel addition
diff --git a/app/services/hyrax/iiif_authorization_service.rb b/app/services/hyrax/iiif_authorization_service.rb index abc1234..def5678 100644 --- a/app/services/hyrax/iiif_authorization_service.rb +++ b/app/services/hyrax/iiif_authorization_service.rb @@ -5,6 +5,7 @@ @controller = controller end + # @note we ignore the `action` param here in favor of the `:show` action for all permissions def can?(_action, object) controller.current_ability.can?(:show, file_set_id_for(object)) end
Clarify ignored parameter in Hyrax::IIIFAuthorizationService Thanks, @jeremyf!
diff --git a/rails/benchmarks/bm_activerecord_scope_all.rb b/rails/benchmarks/bm_activerecord_scope_all.rb index abc1234..def5678 100644 --- a/rails/benchmarks/bm_activerecord_scope_all.rb +++ b/rails/benchmarks/bm_activerecord_scope_all.rb @@ -12,7 +12,7 @@ Benchmark.rails("activerecord/#{db_adapter}_scope_all", time: 5) do str = "" - User.pluck(:name, :email, :approved, :age, :birthday).each do |user| + User.select(:name, :email, :approved, :age, :birthday).each do |user| str << "name: #{user.name} email: #{user.email} approved: #{user.approved} age: #{user.age} birthday: #{user.birthday}\n" end end
Replace pluck with select in activerecord/scope_all
diff --git a/app/models/to_do.rb b/app/models/to_do.rb index abc1234..def5678 100644 --- a/app/models/to_do.rb +++ b/app/models/to_do.rb @@ -7,12 +7,6 @@ short_description end - def self.build(params = nil) - result = self.dobuild(params) - result.due_time = DateTime.now - result - end - after_save { |record| DueItem.due_todos(User.current_user, record, DueItem::UPDATE_TYPE_UPDATE) } after_destroy { |record| DueItem.due_todos(User.current_user, record, DueItem::UPDATE_TYPE_DELETE) } end
Remove default due time from TODOs
diff --git a/lib/concur_connect/session.rb b/lib/concur_connect/session.rb index abc1234..def5678 100644 --- a/lib/concur_connect/session.rb +++ b/lib/concur_connect/session.rb @@ -37,8 +37,8 @@ @user ||= @user_finder.find id end - def expense_reports(date, status = 'APPROVED') - @expense_reports ||= @expense_report_finder.find nil, status, date + def expense_reports(user_id, date, status = 'APPROVED') + @expense_reports ||= @expense_report_finder.find user_id, status, date end end end
Allow user to be specified when fetching expenses
diff --git a/lib/geogit/commands/commit.rb b/lib/geogit/commands/commit.rb index abc1234..def5678 100644 --- a/lib/geogit/commands/commit.rb +++ b/lib/geogit/commands/commit.rb @@ -6,10 +6,12 @@ module GeoGit module Command class Commit < GenericCommand - def initialize(repo_path, message) - # transaction_id, author_name, author_email + def initialize(repo_path, message, author_name = nil, author_email = nil) + # transaction_id @repo_path = repo_path @message = message + @author_name = author_name + @author_email = author_email end def run @@ -18,10 +20,10 @@ diff_op = geogit.command(DiffOp.java_class) commit = commit_op.set_author( - nil, - nil + @author_name, + @author_email ).set_message( - message + @message ).set_allow_empty( true ).set_all( @@ -30,7 +32,7 @@ #.set_amend(false) #.set_path_filters(nil) - parent_id = commit.parent_n(0).or(ObjectId.NULL) + parent_id = commit.parent_n(0).or(ObjectId::NULL) diff = diff_op.set_old_version( parent_id
Fix variable names in Commit command
diff --git a/lib/github_api/api/actions.rb b/lib/github_api/api/actions.rb index abc1234..def5678 100644 --- a/lib/github_api/api/actions.rb +++ b/lib/github_api/api/actions.rb @@ -1,19 +1,18 @@ # encoding: utf-8 module Github + # Core class responsible for api interface operations class API - # Returns all API public methods for a given class. - def self.inherited(klass) - klass.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 + def self.extend_with_actions(child_class) + child_class.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 def self.actions - self.new.api_methods_in(#{klass}) + self.new.api_methods_in(#{child_class}) end def actions - api_methods_in(#{klass}) + api_methods_in(#{child_class}) end RUBY_EVAL - super end def api_methods_in(klass) @@ -45,6 +44,5 @@ end args end - end # API end # Github
Change to expose as method call.
diff --git a/lib/llt/diff/parser/postag.rb b/lib/llt/diff/parser/postag.rb index abc1234..def5678 100644 --- a/lib/llt/diff/parser/postag.rb +++ b/lib/llt/diff/parser/postag.rb @@ -44,8 +44,10 @@ parts_of_speech persons numbers tenses moods voices genders cases degrees } + + CONTAINER_TABLE = PLURALIZED_POSTAG_SCHEMA.zip(POSTAG_SCHEMA) def add_datapoints_container(data) - PLURALIZED_POSTAG_SCHEMA.zip(POSTAG_SCHEMA).each do |pl, sg| + CONTAINER_TABLE.each do |pl, sg| data.add(Report::Generic.new(pl, 0, sg)) end end
Use a constant to get the datapoint containers No need to recompute it all the time
diff --git a/lib/spatial_features/unzip.rb b/lib/spatial_features/unzip.rb index abc1234..def5678 100644 --- a/lib/spatial_features/unzip.rb +++ b/lib/spatial_features/unzip.rb @@ -1,14 +1,9 @@+require 'fileutils' + module SpatialFeatures module Unzip def self.paths(file_path, find: nil) - dir = Dir.mktmpdir - paths = [] - - entries(file_path).each do |entry| - path = "#{dir}/#{entry.name}" - entry.extract(path) - paths << path - end + paths = extract(file_path) if find = Array.wrap(find).presence paths = paths.detect {|path| find.any? {|pattern| path.include?(pattern) } } @@ -16,6 +11,20 @@ end return paths + end + + def self.extract(file_path, output_dir = Dir.mktmpdir) + [].tap do |paths| + entries(file_path).each do |entry| + path = "#{output_dir}/#{entry.name}" + FileUtils.mkdir_p(File.dirname(path)) + entry.extract(path) + paths << path + end + end + rescue => e + FileUtils.remove_entry(output_dir) + raise(e) end def self.names(file_path)
Fix bug that prevented import of KMZs with folders When unzipping, we are tasked with creating folders for all zipfile entries. If there is a subfoldered entry, we need to also create that folder too.
diff --git a/test/core/test_unicode.rb b/test/core/test_unicode.rb index abc1234..def5678 100644 --- a/test/core/test_unicode.rb +++ b/test/core/test_unicode.rb @@ -4,14 +4,14 @@ class TestSlimUnicode < TestSlim def test_unicode_tags - source = "Статья года" - result = "<Статья>года</Статья>" + source = "cтатья года" + result = "<cтатья>года</cтатья>" assert_html result, source end def test_unicode_attrs - source = "Статья года=123 content" - result = "<Статья года=\"123\">content</Статья>" + source = "cтатья года=123 content" + result = "<cтатья года=\"123\">content</cтатья>" assert_html result, source end end
Make the unicode text work regardless of smart_text option.
diff --git a/spec/features/merge_requests/closes_issues_spec.rb b/spec/features/merge_requests/closes_issues_spec.rb index abc1234..def5678 100644 --- a/spec/features/merge_requests/closes_issues_spec.rb +++ b/spec/features/merge_requests/closes_issues_spec.rb @@ -0,0 +1,57 @@+require 'spec_helper' + +feature 'Merge Commit Description', feature: true do + let(:user) { create(:user) } + let(:project) { create(:project, :public) } + let(:issue_1) { create(:issue, project: project)} + let(:issue_2) { create(:issue, project: project)} + let(:merge_request) do + create( + :merge_request, + :simple, + source_project: project, + description: merge_request_description + ) + end + let(:merge_request_description) { 'Merge Request Description' } + + before do + project.team << [user, :master] + + login_as user + + visit namespace_project_merge_request_path(project.namespace, project, merge_request) + + click_link 'Modify commit message' + end + + context 'not closing or mentioning any issue' do + it 'does not display closing issue message' do + expect(page).not_to have_css('.mr-widget-footer') + end + end + + context 'closing issues but not mentioning any other issue' do + let(:merge_request_description) { "Description\n\nclosing #{issue_1.to_reference}, #{issue_2.to_reference}" } + + it 'does not display closing issue message' do + expect(page).to have_content("Accepting this merge request will close issues #{issue_1.to_reference} and #{issue_2.to_reference}") + end + end + + context 'mentioning issues but not closing them' do + let(:merge_request_description) { "Description\n\nRefers to #{issue_1.to_reference} and #{issue_2.to_reference}" } + + it 'does not display closing issue message' do + expect(page).to have_content("Issues #{issue_1.to_reference} and #{issue_2.to_reference} are mentioned but will not closed.") + end + end + + context 'closing some issues and mentioning, but not closing, others' do + let(:merge_request_description) { "Description\n\ncloses #{issue_1.to_reference}\n\n refers to #{issue_2.to_reference}" } + + it 'does not display closing issue message' do + expect(page).to have_content("Accepting this merge request will close issue #{issue_1.to_reference}. Issue #{issue_2.to_reference} is mentioned but will not closed.") + end + end +end
Add feature spec to verify all 4 different states of closing issues message on Merge Request show page.
diff --git a/spec/controllers/admin/cfps_controller_spec.rb b/spec/controllers/admin/cfps_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/admin/cfps_controller_spec.rb +++ b/spec/controllers/admin/cfps_controller_spec.rb @@ -1,5 +1,3 @@-require 'pry' - # frozen_string_literal: true require 'spec_helper'
Remove pry requires from spec
diff --git a/casing.gemspec b/casing.gemspec index abc1234..def5678 100644 --- a/casing.gemspec +++ b/casing.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'casing' - s.version = '0.1.3' + s.version = '0.2.0' s.summary = 'Convert the case of strings, symbols, and hash keys, including camelCase, PascalCase, and underscore_case' s.description = ' '
Package version is increased from 0.1.3 to 0.2.0
diff --git a/lib/puppet/parser/functions/write_package_names.rb b/lib/puppet/parser/functions/write_package_names.rb index abc1234..def5678 100644 --- a/lib/puppet/parser/functions/write_package_names.rb +++ b/lib/puppet/parser/functions/write_package_names.rb @@ -0,0 +1,22 @@+require 'fileutils' + +module Puppet::Parser::Functions + newfunction(:write_package_names, :doc => "Write package names which are managed via this puppet run to a file.") do |arg| + if arg[0].class == String + begin + output_file = arg[0] + packages = catalog.resources.collect { |r| r.title if r.type == 'Package' }.compact + FileUtils.mkdir_p(File.dirname(output_file)) + File.open(output_file, 'w') do |f| + packages.each do |pkg_name| + f.write(pkg_name + "\n") + end + end + rescue JSON::ParserError + raise Puppet::ParseError, "Syntax error: #{arg[0]} is invalid" + end + else + raise Puppet::ParseError, "Syntax error: #{arg[0]} is not a String" + end + end +end
Add a function to write package names This function writes out package names that have been defined in a given puppet catalog. In order to work this should be place last (or very late) in a manifest to ensure it picks up packages. Change-Id: Ie21b5bf7df71337da02ea43915dc4e70d3052bb7
diff --git a/ruby/subscription-card-update.rb b/ruby/subscription-card-update.rb index abc1234..def5678 100644 --- a/ruby/subscription-card-update.rb +++ b/ruby/subscription-card-update.rb @@ -0,0 +1,17 @@+ +gem 'chargify_api_ares', '=1.3.5' +require 'chargify_api_ares' + +Chargify.configure do |c| + c.subdomain = ENV['CHARGIFY_SUBDOMAIN'] + c.api_key = ENV['CHARGIFY_API_KEY'] +end + +sub = Chargify::Subscription.find 9970657 + +sub.credit_card_attributes = {:full_number => "3", :expiration_year => "2020"} + +sub.save + +puts sub.inspect +
Add example of updating with invalid card
diff --git a/chef/cookbooks/ohai/recipes/default.rb b/chef/cookbooks/ohai/recipes/default.rb index abc1234..def5678 100644 --- a/chef/cookbooks/ohai/recipes/default.rb +++ b/chef/cookbooks/ohai/recipes/default.rb @@ -20,10 +20,12 @@ Ohai::Config[:plugin_path] << node.ohai.plugin_path Chef::Log.info("ohai plugins will be at: #{node.ohai.plugin_path}") -p = package "lshw" do - action :nothing +unless ::File.exists?("/usr/sbin/lshw") or ::File.exists?("/usr/bin/lshw") + p = package "lshw" do + action :nothing + end + p.run_action(:install) end -p.run_action(:install) d = directory node.ohai.plugin_path do owner 'root'
Make the installation of lshw and ipmitool based upon where the file it contains is already there. THis allows the system not call yum in the centos discovery image. This explodes.
diff --git a/lib/metamodel/model/property_constructor.rb b/lib/metamodel/model/property_constructor.rb index abc1234..def5678 100644 --- a/lib/metamodel/model/property_constructor.rb +++ b/lib/metamodel/model/property_constructor.rb @@ -4,12 +4,19 @@ attr_reader :model + define_method :string do |json_key, property_key = nil| + save_property CocoaProperty.new(json_key, :string, property_key) + end + def initialize(model) @model = model end - def string(json_key, property_key = nil) - save_property CocoaProperty.new(json_key, "String", property_key) + def method_missing(symbol, *arguments) + define_method symbol do |json_key, property_key = nil| + save_property CocoaProperty.new(json_key, symbol, property_key) + end + eval symbol, arguments end private
Use method missing to generate model
diff --git a/lib/optimus_prime/transformers/validator.rb b/lib/optimus_prime/transformers/validator.rb index abc1234..def5678 100644 --- a/lib/optimus_prime/transformers/validator.rb +++ b/lib/optimus_prime/transformers/validator.rb @@ -26,23 +26,23 @@ end def range_validator(value, specifieres) - value >= specifieres[0] && value <= specifieres[1] + value && value >= specifieres[0] && value <= specifieres[1] end def less_than_or_equal_validator(value, specifieres) - value <= specifieres[0] + value && value <= specifieres[0] end def less_than_validator(value, specifieres) - value < specifieres[0] + value && value < specifieres[0] end def greater_than_or_equal_validator(value, specifieres) - value >= specifieres[0] + value && value >= specifieres[0] end def greater_than_validator(value, specifieres) - value > specifieres[0] + value && value > specifieres[0] end def set_validator(value, specifieres)
Check for value before doing the actual check except for set which can be nil
diff --git a/lib/rails/controller/testing/integration.rb b/lib/rails/controller/testing/integration.rb index abc1234..def5678 100644 --- a/lib/rails/controller/testing/integration.rb +++ b/lib/rails/controller/testing/integration.rb @@ -3,7 +3,7 @@ module Testing module Integration http_verbs = %w(get post patch put head delete get_via_redirect post_via_redirect) - http_verbs.push('xhr', 'xml_http_request') if Rails::VERSION::STRING.to_f <= 5.0 + http_verbs.push('xhr', 'xml_http_request') if ActionPack.version < Gem::Version.new('5.1') http_verbs.each do |method| define_method(method) do |*args|
Use the right framework to check the version
diff --git a/lib/schema2plantuml/active_record/schema.rb b/lib/schema2plantuml/active_record/schema.rb index abc1234..def5678 100644 --- a/lib/schema2plantuml/active_record/schema.rb +++ b/lib/schema2plantuml/active_record/schema.rb @@ -9,11 +9,9 @@ end def create_table(table_name, _options, &block) - puts <<~TABLE - object #{table_name} { - #{block.call(Table2plantuml.new)} - } - TABLE + puts "object #{table_name} {" + block.call(Table2plantuml.new) + puts "}" end def add_foreign_key(child_table_name, parent_table_name, _options = {}) @@ -27,7 +25,7 @@ class Table2plantuml def method_missing(column_type, column_name, _options = {}) - "#{column_name} : #{column_type}" + puts "#{column_name} : #{column_type}" end end end
Fix bug display only latest column
diff --git a/lib/vagrant-phpstorm-tunnel/configurator.rb b/lib/vagrant-phpstorm-tunnel/configurator.rb index abc1234..def5678 100644 --- a/lib/vagrant-phpstorm-tunnel/configurator.rb +++ b/lib/vagrant-phpstorm-tunnel/configurator.rb @@ -13,13 +13,14 @@ File.exist? @root_path + '/.idea' end - def link_php_to_phpstorm + def link_php_to_intellij destination_path = @root_path + '/.idea/vagrant/php' source_path = File.expand_path('../../../data/php', __FILE__) if !File.exist? destination_path FileUtils.mkdir_p(File.dirname(destination_path)) File.link(source_path, destination_path) + File.chmod(0755, destination_path) end end @@ -31,7 +32,7 @@ raise "Cannot detect intellij environment at #{@root_path}" end - link_php_to_phpstorm + link_php_to_intellij end end end
Change permission of shipped file to 0755
diff --git a/DFImageManager.podspec b/DFImageManager.podspec index abc1234..def5678 100644 --- a/DFImageManager.podspec +++ b/DFImageManager.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "DFImageManager" - s.version = "0.0.7" + s.version = "0.0.8" s.summary = "Complete solution for fetching, caching and adjusting images" s.homepage = "https://github.com/kean/DFImageManager" s.license = { :type => "MIT", :file => "LICENSE" }
Update podspec to version 0.0.8
diff --git a/spec/application_spec.rb b/spec/application_spec.rb index abc1234..def5678 100644 --- a/spec/application_spec.rb +++ b/spec/application_spec.rb @@ -1,6 +1,6 @@ require "spec_helper" -module NessusDB +module Risu module CLI describe Application do before(:all) do
Rename from NessusDB to Risu
diff --git a/spec/git_tracker_spec.rb b/spec/git_tracker_spec.rb index abc1234..def5678 100644 --- a/spec/git_tracker_spec.rb +++ b/spec/git_tracker_spec.rb @@ -1,17 +1,22 @@ require 'git_tracker' describe GitTracker do + subject { described_class } let(:args) { ["a_file", "the_source", "sha1234"] } describe ".execute" do + before do + subject.stub(:prepare_commit_msg) { true } + end + it "runs the hook, passing the args" do - GitTracker.should_receive(:prepare_commit_msg).with(*args) { true } - GitTracker.execute('prepare-commit-msg', *args) + subject.should_receive(:prepare_commit_msg).with(*args) { true } + subject.execute('prepare-commit-msg', *args) end # TODO: stop the abort from writing to stderr during tests? it "doesn't run hooks we don't know about" do - lambda { GitTracker.execute('non-existent-hook', *args) }. + lambda { subject.execute('non-existent-hook', *args) }. should raise_error SystemExit, "[git_tracker] hook: 'non-existent-hook' does not exist." end end @@ -19,7 +24,7 @@ describe ".prepare_commit_msg" do it "runs the hook, passing the args" do GitTracker::PrepareCommitMessage.should_receive(:run).with(*args) { true } - GitTracker.prepare_commit_msg(*args) + subject.prepare_commit_msg(*args) end end
Refactor to more idiomatic Rspec [#26437795]
diff --git a/spec/hash_object_spec.rb b/spec/hash_object_spec.rb index abc1234..def5678 100644 --- a/spec/hash_object_spec.rb +++ b/spec/hash_object_spec.rb @@ -0,0 +1,25 @@+require 'spec_helper' + +# Test support object +describe HashObject do + + subject { HashObject.new(hash) } + let(:hash) do + { + :name => 'Steve', + :address => {:street => 'Mainstreet'}, + :posts => [ + {:title => 'It is christmas'}, + {:title => 'NOT'} + ] + } + end + + it 'maps an intergalactic hash' do + assert_equal hash[:name], subject.name + assert_equal hash[:address][:street], subject.address.street + assert_equal hash[:posts].size, subject.posts.size + assert_equal hash[:posts][0][:title], subject.posts[0].title + assert_equal hash[:posts][1][:title], subject.posts[1].title + end +end
Add spec for nesting capabilities of HashObject
diff --git a/site-cookbooks/backup_restore/spec/recipes/setup_spec.rb b/site-cookbooks/backup_restore/spec/recipes/setup_spec.rb index abc1234..def5678 100644 --- a/site-cookbooks/backup_restore/spec/recipes/setup_spec.rb +++ b/site-cookbooks/backup_restore/spec/recipes/setup_spec.rb @@ -0,0 +1,70 @@+require_relative '../spec_helper' + +describe 'backup_restore::setup' do + let(:chef_run) do + ChefSpec::Runner.new( + cookbook_path: %w(site-cookbooks cookbooks), + platform: 'centos', + version: '6.5' + ).converge(described_recipe) + end + + let(:chef_run_backup_options) do + runner = ChefSpec::Runner.new( + cookbook_path: %w(site-cookbooks cookbooks), + platform: 'centos', + version: '6.5' + ) do |node| + node.set['backup']['version'] = '4.1.0' #=> Default nil => 4.0.2 + node.set['backup']['upgrade?'] = true #=> Default false + end + runner.converge(described_recipe) + end + + it 'include cron' do + expect(chef_run).to include_recipe 'cron::default' + end + + it 'install backup gem' do + expect(chef_run).to install_gem_package('backup').with( + version: nil, + options: '--no-ri --no-rdoc' + ) + end + + it 'install backup gem and set atributes' do + expect(chef_run_backup_options).to upgrade_gem_package('backup').with( + version: '4.1.0', + options: '--no-ri --no-rdoc' + ) + end + + it 'include backup' do + expect(chef_run).to include_recipe 'backup::default' + end + + it 'include percona' do + expect(chef_run).to include_recipe 'percona::backup' + end + + it 'create a link to backup bin' do + IO::File.stub(:exist?).and_call_original + IO::File.stub(:exist?).with("/root/.chefdk/gem/ruby/2.1.0/bin/backup").and_return(true) + link = chef_run.link('/usr/local/bin/backup') + expect(link).to link_to('/root/.chefdk/gem/ruby/2.1.0/bin/backup') + end + + describe 'for s3' do + it 'include yum-epel' do + expect(chef_run).to include_recipe 'yum-epel::default' + end + + it 'include s3cmd-master' do + expect(chef_run).to include_recipe 's3cmd-master::default' + end + + it 'install python-dateutil' do + expect(chef_run).to install_package 'python-dateutil' + end + end +end
Add chef-spec for setup recipe
diff --git a/spec/kaspersky_runner/linux_executor_spec.rb b/spec/kaspersky_runner/linux_executor_spec.rb index abc1234..def5678 100644 --- a/spec/kaspersky_runner/linux_executor_spec.rb +++ b/spec/kaspersky_runner/linux_executor_spec.rb @@ -6,14 +6,14 @@ let(:desired_cmd) { 'sudo ' + '/opt/kaspersky/kes4lwks/bin/kes4lwks-control ' + - '--scan-file /tmp/scan_file >> /tmp/bar.log' + '--scan-file /tmp/scan_file' } describe '#scan' do it 'should exectute correct command' do - expect(subject) - .to receive(:system) - .with(*desired_cmd.split(' ')) + expect(Open3) + .to receive(:capture3) + .with(desired_cmd) subject.scan(Pathname.new('/tmp').join('scan_file'), Pathname.new('/tmp').join('bar.log')) end
Update spec -- linux command usage
diff --git a/spec/rails_locale_detection/controller_methods_spec.rb b/spec/rails_locale_detection/controller_methods_spec.rb index abc1234..def5678 100644 --- a/spec/rails_locale_detection/controller_methods_spec.rb +++ b/spec/rails_locale_detection/controller_methods_spec.rb @@ -2,17 +2,18 @@ describe RailsLocaleDetection::ControllerMethods do let(:request) { MockRequest.new } - let(:controller) { MockController.new(request) } + subject(:controller) { MockController.new(request) } - describe '#available_locales' do - it "shadows I18n.available_locales" do - controller.available_locales.should eq([:en, :fr]) - end + it 'provides a blank user locale method' do + controller.user_locale.should be_nil end - - describe '#default_locale' do - it "shadows I18n.default locale" do - controller.default_locale.should eq(:en) - end + + it 'should provide a detect locale method' do + controller.class.should respond_to(:detect_locale) + end + + it 'should add a before filter' do + controller.class.before_filters.should eq([[RailsLocaleDetection::LocaleDetector]]) end + end
Add proper controller methods spec
diff --git a/rails_components.gemspec b/rails_components.gemspec index abc1234..def5678 100644 --- a/rails_components.gemspec +++ b/rails_components.gemspec @@ -1,8 +1,8 @@ Gem::Specification.new do |s| s.name = 'rails_components' - s.version = '0.0.1' + s.version = '0.0.2' s.date = '2016-09-23' - s.summary = "Rails view components" + s.summary = "a thin wrapper around render that makes passing blocks and html attributes to partials simple as pie." s.authors = ["Peter Schilling"] s.email = ['rubygems@peterschilling.org'] s.files = Dir["{lib}/**/*.rb", "LICENSE", "*.md"]
Update gem version, add a description
diff --git a/anyway_config.gemspec b/anyway_config.gemspec index abc1234..def5678 100644 --- a/anyway_config.gemspec +++ b/anyway_config.gemspec @@ -23,6 +23,6 @@ s.required_ruby_version = '>= 2.3' s.add_development_dependency "rspec", "~> 3.5" - s.add_development_dependency "rubocop", "~> 0.57.2" + s.add_development_dependency "rubocop", "~> 0.58.0" s.add_development_dependency "simplecov", ">= 0.3.8" end
Update rubocop to version 0.58.0
diff --git a/test/song_test.rb b/test/song_test.rb index abc1234..def5678 100644 --- a/test/song_test.rb +++ b/test/song_test.rb @@ -0,0 +1,31 @@+require 'test_helper' + +describe Lyricfy::Song do + before do + @song = Lyricfy::Song.new 'Yellow', 'Coldplay', ['Look at the stars', 'Look how they shine for you'] + end + + [ + :title, + :author, + :lines + ].each do |param| + it "should respond to #{param}" do + @song.must_respond_to param + end + end + + describe "#body" do + describe "with param" do + it "should use injected separator" do + @song.body("<br>").must_equal "Look at the stars<br>Look how they shine for you" + end + end + + describe "with no params" do + it "should use default separator" do + @song.body.must_equal "Look at the stars\\nLook how they shine for you" + end + end + end +end
Add tests for the Lyricfy::Song class
diff --git a/app/controllers/georgia/concerns/revisioning.rb b/app/controllers/georgia/concerns/revisioning.rb index abc1234..def5678 100644 --- a/app/controllers/georgia/concerns/revisioning.rb +++ b/app/controllers/georgia/concerns/revisioning.rb @@ -12,27 +12,27 @@ def review @revision.review - notify("#{current_user.name} is asking you to review #{@page.title} #{instance_name}.") - redirect_to [:edit, @page, @revision], notice: "You successfully submited #{@review.title} for review." + notify("#{current_user.name} is asking you to review #{@revision.title}.") + redirect_to [:edit, @page, @revision], notice: "You successfully submited #{@revision.title} for review." end def approve @revision.approve - message = "#{current_user.name} has successfully approved and published #{@page.title} #{instance_name}." + message = "#{current_user.name} has successfully approved and published #{@revision.title} #{instance_name}." notify(message) redirect_to [:show, @page], notice: message end def decline @revision.decline - message = "#{current_user.name} has successfully published #{@page.title} #{instance_name}." + message = "#{current_user.name} has successfully published #{@revision.title} #{instance_name}." notify(message) redirect_to [:edit, @page, @revision], notice: message end def revert @revision.revert - message = "#{current_user.name} has successfully published #{@page.title} #{instance_name}." + message = "#{current_user.name} has successfully published #{@revision.title} #{instance_name}." notify(message) redirect_to [:show, @page], notice: message end
Use @revision.title instead of @page
diff --git a/app/models/account.rb b/app/models/account.rb index abc1234..def5678 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -33,8 +33,8 @@ def organizations { - divisions: self.divisions, - projects: self.projects + my_divisions: self.divisions, + my_projects: self.projects } end
Fix symbol at default data
diff --git a/app/models/country.rb b/app/models/country.rb index abc1234..def5678 100644 --- a/app/models/country.rb +++ b/app/models/country.rb @@ -11,10 +11,15 @@ end def find_all - url = base_path + sql = <<-SQL + SELECT DISTINCT iso, admin0_name AS name, true as enabled + FROM indicators_values + ORDER BY name + SQL + url = "#{ENV['CDB_API_HOST']}?q=#{sql}" timeouts do items_caching do - get(url)['countries'] + get(url)['rows'] end end end @@ -38,4 +43,4 @@ end -end+end
Use the indicators-values table on cartoDB to get the list of available countries
diff --git a/app/models/concerns/can_be_serialized_to_csv.rb b/app/models/concerns/can_be_serialized_to_csv.rb index abc1234..def5678 100644 --- a/app/models/concerns/can_be_serialized_to_csv.rb +++ b/app/models/concerns/can_be_serialized_to_csv.rb @@ -1,3 +1,5 @@+require 'csv' + module CanBeSerializedToCsv extend ActiveSupport::Concern
Add require csv to CanBeSerializedToCSV.
diff --git a/app/models/renalware/feeds/message_processor.rb b/app/models/renalware/feeds/message_processor.rb index abc1234..def5678 100644 --- a/app/models/renalware/feeds/message_processor.rb +++ b/app/models/renalware/feeds/message_processor.rb @@ -9,10 +9,11 @@ include Wisper::Publisher def call(raw_message) - message_payload = parse_message(raw_message) - persist_message(message_payload) - - broadcast(:message_processed, message_payload) + ActiveRecord::Base.transaction do + message_payload = parse_message(raw_message) + persist_message(message_payload) + broadcast(:message_processed, message_payload) + end rescue StandardError => exception notify_exception(exception) raise exception
Add a transation around HL7 processing This prevents a feed_message row being created if we could not parse the OBR/Xs and prevents duplicate content for is a message was only partially saved.
diff --git a/spec/afip_bill/generator_spec.rb b/spec/afip_bill/generator_spec.rb index abc1234..def5678 100644 --- a/spec/afip_bill/generator_spec.rb +++ b/spec/afip_bill/generator_spec.rb @@ -0,0 +1,51 @@+require "spec_helper" +require "afip_bill/generator" +require "afip_bill/line_item" +require "afip_bill/user" + +describe AfipBill::Generator do + subject { described_class } + + let(:user) do + AfipBill::User.new("OmbuShop", "John Snow", "Winterfell 123", + "Consumidor Final") + end + let(:bill_path) { File.expand_path("../../support/#{type}.json", __FILE__) } + let(:bill) { File.read(bill_path) } + let(:item_1) { AfipBill::LineItem.new("Item 1", 1, 100) } + let(:item_2) { AfipBill::LineItem.new("Item 2", 1, 100) } + + let(:pdf_file) { subject.new(bill, user, [item_1, item_2]).generate_pdf_file } + let(:pdf_string) { subject.new(bill, user, [item_1, item_2]).generate_pdf_string } + + before do + AfipBill.configuration[:business_name] = "OmbuShop SRL" + AfipBill.configuration[:business_address] = "Av Juan B. Justo 1500" + AfipBill.configuration[:business_start_date] = "01/01/1900" + AfipBill.configuration[:business_cuit] = "30112233445" + AfipBill.configuration[:city] = "Ciudad de Buenos Aires" + AfipBill.configuration[:ingresos_brutos] = "901-111111-4" + AfipBill.configuration[:iva] = "IVA Responsable Inscripto" + AfipBill.configuration[:sale_point] = "005" + end + + describe "generate_pdf" do + context "Bill type A" do + let(:type) { "type_a" } + + it "has the 'magic number' that identify a PDF file" do + expect(pdf_file.readpartial(4)).to eq "%PDF" + expect(pdf_string[0..3]).to eq "%PDF" + end + end + + context "Bill type B" do + let(:type) { "type_b" } + + it "has the 'magic number' that identify a PDF file" do + expect(pdf_file.readpartial(4)).to eq "%PDF" + expect(pdf_string[0..3]).to eq "%PDF" + end + end + end +end
Test coverage for Generator class
diff --git a/spec/features/user_index_spec.rb b/spec/features/user_index_spec.rb index abc1234..def5678 100644 --- a/spec/features/user_index_spec.rb +++ b/spec/features/user_index_spec.rb @@ -0,0 +1,14 @@+require 'spec_helper' + +require 'carrierwave/test/matchers' +feature 'As a user' do + before do + sign_in + end + + scenario 'I can add a new user' do + + visit admin_users_path + expect(page).to have_content User.first.email + end +end
Add spec for admin users index
diff --git a/workers/command_runner.rb b/workers/command_runner.rb index abc1234..def5678 100644 --- a/workers/command_runner.rb +++ b/workers/command_runner.rb @@ -10,8 +10,9 @@ include Sidekiq::Worker def perform(command_id, command) logger.info "Things are happening." + logger.info ENV["REDIS_URL"] - $redis = Redis.new( ENV["REDIS_URL"] ) + $redis = Redis.new( url: ENV["REDIS_URL"] ) begin socket = UNIXSocket.new(DEFAULT_SOCKET_PATH)
Fix Redis initialization bug on worker
diff --git a/lib/faraday_bang/bang.rb b/lib/faraday_bang/bang.rb index abc1234..def5678 100644 --- a/lib/faraday_bang/bang.rb +++ b/lib/faraday_bang/bang.rb @@ -1,22 +1,33 @@ module Faraday::Bang ERROR_CODES = [(400..417).to_a, (500..505).to_a].flatten + SUPPORTED_HTTP_METHODS = Faraday::Connection::METHODS - Set.new([ :options ]) - Faraday::Connection::METHODS.each do |verb| + SUPPORTED_HTTP_METHODS.each do |verb| define_method("#{verb}!") do |*args, &block| response = self.send(verb, *args, &block) - if response.status >= 400 - err_name = "Response#{response.status}Error" - if Faraday::Bang.const_defined?(err_name) - klass = Faraday::Bang.const_get(err_name) - raise klass.new(response) - else - raise Faraday::Bang::ResponseError.new(response) - end - end - return response + handle_error(response) end end + define_method("options!") do |*args, &block| + url, params, headers = args + response = run_request(:options, url, params, headers, &block) + handle_error(response) + end + + private + def handle_error(response) + if response.status >= 400 + err_name = "Response#{response.status}Error" + if Faraday::Bang.const_defined?(err_name) + klass = Faraday::Bang.const_get(err_name) + raise klass.new(response) + else + raise Faraday::Bang::ResponseError.new(response) + end + end + response + end end Faraday.extend(Faraday::Bang)
Add support for `options!` method. Since Faraday doesn't support the `options` request as a first class HTTP method (see lostisland/faraday#305) we need to use the `run_request` method instead of the `options` one.
diff --git a/apps/redirects/app.rb b/apps/redirects/app.rb index abc1234..def5678 100644 --- a/apps/redirects/app.rb +++ b/apps/redirects/app.rb @@ -11,7 +11,7 @@ # redirect initials to homepage for tracking business cards # we may want to create personal pages thanking people for chatting with us # at these urls - r303 %r{^/(ah|jb|mw|sr|st)$}, "/" + r303 %r{^/(ah|jb|mw|sr|st|tsr|rm)$}, "/" # redirect all other api traffic to the legacy site # TODO: figure out a better place to host it
Add a couple more business cards redirects.
diff --git a/lib/active_record/turntable/util.rb b/lib/active_record/turntable/util.rb index abc1234..def5678 100644 --- a/lib/active_record/turntable/util.rb +++ b/lib/active_record/turntable/util.rb @@ -35,6 +35,10 @@ ar_version_equals_or_later?("5.2") end + def ar60_or_later? + ar_version_equals_or_later?("6.0") + end + module_function :ar_version_equals_or_later?, :ar_version_earlier_than?, :ar_version, @@ -42,6 +46,7 @@ :ar51?, :earlier_than_ar51?, :ar51_or_later?, - :ar52_or_later? + :ar52_or_later?, + :ar60_or_later? end end
Add ar60_or_later? method to Util
diff --git a/test/integration/default/serverspec/spec_helper.rb b/test/integration/default/serverspec/spec_helper.rb index abc1234..def5678 100644 --- a/test/integration/default/serverspec/spec_helper.rb +++ b/test/integration/default/serverspec/spec_helper.rb @@ -1,8 +1,8 @@ # Encoding: utf-8 + require 'serverspec' -include Serverspec::Helper::Exec -include Serverspec::Helper::DetectOS +set :backend, :exec RSpec.configure do |c| c.before :all do
Remove Serverspec::Helper for latest major version of serverspec.
diff --git a/lib/llt/segmenter/api.rb b/lib/llt/segmenter/api.rb index abc1234..def5678 100644 --- a/lib/llt/segmenter/api.rb +++ b/lib/llt/segmenter/api.rb @@ -5,6 +5,7 @@ class Api < Sinatra::Base register Sinatra::RespondWith + register LLT::Core::Api::VersionRoutes helpers LLT::Core::Api::Helpers get '/segment' do @@ -17,4 +18,6 @@ f.xml { to_xml(sentences, params) } end end + + add_version_route_for('/segment', dependencies: %i{ Core Segmenter }) end
Add version route for segment
diff --git a/lib/podio/models/live.rb b/lib/podio/models/live.rb index abc1234..def5678 100644 --- a/lib/podio/models/live.rb +++ b/lib/podio/models/live.rb @@ -31,10 +31,10 @@ Podio.connection.delete("/live/#{id}").body end - def authorize(scope) + def authorize(attributes) response = Podio.connection.post do |req| req.url "/live/omega/authorize" - req.body = scope + req.body = attributes end response.body
Make the auth method better
diff --git a/lib/punchlist/options.rb b/lib/punchlist/options.rb index abc1234..def5678 100644 --- a/lib/punchlist/options.rb +++ b/lib/punchlist/options.rb @@ -0,0 +1,33 @@+require 'optparse' + +module Punchlist + class Options + attr_reader :default_punchlist_line_regexp + + def initialize(default_punchlist_line_regexp) + @default_punchlist_line_regexp = default_punchlist_line_regexp + end + + def setup_options(opts) + options = {} + opts.banner = 'Usage: punchlist [options]' + opts.on('-g', '--glob g', 'Filename glob to identify source files') do |v| + options[:glob] = v + end + opts.on('-r', '--regexp r', + 'Regexp to trigger on - ' \ + 'default is XXX|TODO') do |v| + options[:regexp] = v + end + options + end + + def parse_options + options = nil + OptionParser.new do |opts| + options = setup_options(opts) + end.parse! + options + end + end +end
Add Options class for option parsing
diff --git a/lib/ellen/handlers/japan_weather.rb b/lib/ellen/handlers/japan_weather.rb index abc1234..def5678 100644 --- a/lib/ellen/handlers/japan_weather.rb +++ b/lib/ellen/handlers/japan_weather.rb @@ -1,7 +1,7 @@ module Ellen module Handlers class JapanWeather < Base - on /の天気/, name: "japan_weather", description: "Reply weather forecast" + on /.*の天気/, name: "japan_weather", description: "Reply weather forecast" def japan_weather(message) Ellen::Actions::JapanWeather.new(message).call
Fix regexp to match better in ellen's convention
diff --git a/lib/faraday_api_cache/middleware.rb b/lib/faraday_api_cache/middleware.rb index abc1234..def5678 100644 --- a/lib/faraday_api_cache/middleware.rb +++ b/lib/faraday_api_cache/middleware.rb @@ -5,7 +5,7 @@ class Middleware < Faraday::Middleware def initialize(app, options = {}) super(app) - @options = options.to_hash + @options = { period: 0, timeout: 0 }.merge(options.to_hash) end def call(env)
Set the default behavior to have timeout 0 and period 0 For api cache to behave transparently in faraday we can't have it imposing it's own timeouts or blocking repeated requests
diff --git a/lib/flipper/rails.rb b/lib/flipper/rails.rb index abc1234..def5678 100644 --- a/lib/flipper/rails.rb +++ b/lib/flipper/rails.rb @@ -12,6 +12,14 @@ require 'flipper' +require 'flipper/adapters/active_record' +require 'flipper/adapters/instrumented' +require 'flipper/adapters/memoizable' +require 'flipper/adapters/memory' +require 'flipper/adapters/mongo' +require 'flipper/adapters/pstore' +require 'flipper/adapters/redis' + require 'flipper/rails/version' require 'flipper/rails/options' require 'flipper/rails/railtie'
Include adapters so we don't have to do so manually
diff --git a/lib/stat_board/engine.rb b/lib/stat_board/engine.rb index abc1234..def5678 100644 --- a/lib/stat_board/engine.rb +++ b/lib/stat_board/engine.rb @@ -1,5 +1,11 @@ module StatBoard class Engine < ::Rails::Engine isolate_namespace StatBoard + + if Rails.version > "3.1" + initializer "StatBoard precompile hook" do |app| + app.config.assets.precompile += %w(stat_board/bootstrap.css) + end + end end end
Add Bootstrap to asset pipeline
diff --git a/lib/tasks/ops_tasks.rake b/lib/tasks/ops_tasks.rake index abc1234..def5678 100644 --- a/lib/tasks/ops_tasks.rake +++ b/lib/tasks/ops_tasks.rake @@ -31,4 +31,18 @@ deploy_id = deployment.configure deployment.wait_for_completion(deploy_id, "configure") end + + desc "create new instance" + task :create_instance => :environment do + scale = OpsTasks::RakeHelper.create_scale + instance_id = scale.create_instance + scale.start_instance(instance_id) + scale.wait_for_completion(instance_id) + end + + desc "create new load-based instance" + task :create_load_based_instance => :environment do + scale = OpsTasks::RakeHelper.create_scale + instance_id = scale.create_instance(true) + end end
Add rake tasks for creating new instance
diff --git a/lib/rspec/toolbelt/matchers/http.rb b/lib/rspec/toolbelt/matchers/http.rb index abc1234..def5678 100644 --- a/lib/rspec/toolbelt/matchers/http.rb +++ b/lib/rspec/toolbelt/matchers/http.rb @@ -18,6 +18,12 @@ RSpec::Matchers.define :be_created do match do |response| response.status == 201 + end + end + + RSpec::Matchers.define :be_ok do + match do |response| + response.status == 200 end end
Add ok response status to matchers
diff --git a/lib/kindly/runner.rb b/lib/kindly/runner.rb index abc1234..def5678 100644 --- a/lib/kindly/runner.rb +++ b/lib/kindly/runner.rb @@ -9,18 +9,22 @@ end def run(migration) - begin - output = capture_output do - migration.running! + failed = false + output = capture_output do + migration.running! + begin @handler.run(migration.job) + rescue + failed = true + puts $!, $@ end - migration.completed!(output) - rescue Exception - puts $!, $@ - migration.failed!(output) end - # write_log_file(migration, output) + if failed + migration.failed!(output) + else + migration.completed!(output) + end end private
Fix logging error on failures
diff --git a/lib/licit/command.rb b/lib/licit/command.rb index abc1234..def5678 100644 --- a/lib/licit/command.rb +++ b/lib/licit/command.rb @@ -11,9 +11,12 @@ end def check(licenser) + has_errors = false (licenser.check_files | licenser.check_headers).each do |severity, file, message| puts message + has_errors = true if severity == :error end + exit (has_errors ? 1 : 0) end def fix(licenser)
Set exit status to 1 if there was at least one error during check
diff --git a/lib/pangram_cases.rb b/lib/pangram_cases.rb index abc1234..def5678 100644 --- a/lib/pangram_cases.rb +++ b/lib/pangram_cases.rb @@ -5,13 +5,14 @@ def workload [ - "phrase = '#{input}'\n", - " #{assertion} Pangram.pangram?(phrase), \"#{message}\"" - ].join + "phrase = '#{input}'", + " result = Pangram.pangram?(phrase)", + " #{assertion} result, \"#{message}\"" + ].join("\n") end def message - "\#{phrase.inspect} #{is_or_isnt} a pangram" + "Expected #{expected}, got: \#{result.inspect}. \#{phrase.inspect} #{is_or_isnt} a pangram" end def is_or_isnt
Add expected and actual values to failure message.
diff --git a/lib/pantry/config.rb b/lib/pantry/config.rb index abc1234..def5678 100644 --- a/lib/pantry/config.rb +++ b/lib/pantry/config.rb @@ -21,6 +21,11 @@ def initialize + # Default connectivity settings + @server_host = "127.0.0.1" + @pub_sub_port = 23001 + @receive_port = 23002 + # Default client heartbeat to every 5 minutes @client_heartbeat_interval = 300
Set default host and ports