diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/jquery-rails.rb b/lib/jquery-rails.rb index abc1234..def5678 100644 --- a/lib/jquery-rails.rb +++ b/lib/jquery-rails.rb @@ -1,8 +1,8 @@ module Jquery module Rails class Railtie < ::Rails::Railtie - if ::Rails.root.join("javascripts/jquery-ui.min.js").exist? config.before_initialize do + if ::Rails.root.join("public/javascripts/jquery-ui.min.js").exist? config.action_view.javascript_expansions[:defaults] = %w(jquery.min jquery-ui.min rails) else config.action_view.javascript_expansions[:defaults] = %w(jquery.min rails)
Fix jQuery-UI checking to actually work
diff --git a/lib/maia/message.rb b/lib/maia/message.rb index abc1234..def5678 100644 --- a/lib/maia/message.rb +++ b/lib/maia/message.rb @@ -51,7 +51,6 @@ def to_h hash = { data: other, - priority: priority.to_s, notification: { title: alert, body: alert,
Remove priority from to_h, merge it later if it's set
diff --git a/lib/client_for_poslynx/data/requests/debit_card_sale.rb b/lib/client_for_poslynx/data/requests/debit_card_sale.rb index abc1234..def5678 100644 --- a/lib/client_for_poslynx/data/requests/debit_card_sale.rb +++ b/lib/client_for_poslynx/data/requests/debit_card_sale.rb @@ -12,7 +12,6 @@ attr_element_mapping attribute: :merchant_supplied_id, element: 'Id' attr_element_mapping attribute: :client_id, element: 'ClientId' - attr_element_mapping attribute: :tax_amount, element: 'TaxAmount' attr_element_mapping attribute: :amount, element: 'Amount' attr_element_mapping attribute: :input_source, element: 'Input' attr_element_mapping attribute: :track_2, element: 'Track2'
Remove invalid TaxAmount element from DCSALE
diff --git a/lib/middleware/base.rb b/lib/middleware/base.rb index abc1234..def5678 100644 --- a/lib/middleware/base.rb +++ b/lib/middleware/base.rb @@ -3,13 +3,21 @@ class Base extend Aliasable + # By default, Testify middleware is initialized with only the next app on + # the stack. If you override this, you may also need to override + # Runner::Base.construct_app_stack (if you are using that class). + # def initialize(app) @app = app end + # By default, the middleware base class just calls the next app on the + # stack - you will almost certainly want to override this method. + # def call(env) @app.call(env) end + end end end
Add some rdoc (more needed)
diff --git a/lib/pgquilter/topic.rb b/lib/pgquilter/topic.rb index abc1234..def5678 100644 --- a/lib/pgquilter/topic.rb +++ b/lib/pgquilter/topic.rb @@ -12,13 +12,10 @@ end def self.normalize(subject) - # 1. Look for '(was $subject) and normalize subject instead - # 2. Strip '[HACKERS]' - # 3. Replace \W with '-' if subject =~ SUBJECT_WAS_RE normalize subject.sub(SUBJECT_WAS_RE, '\1') end - subject.gsub('[HACKERS]\s*', '').gsub(/\W/, '-') + subject.gsub(/(?:Re:|\[HACKERS\])\s*/, '').gsub(/\W/, '-') end end
Remove unneeded comments and improve subject normalization
diff --git a/lib/tasks/ingress.rake b/lib/tasks/ingress.rake index abc1234..def5678 100644 --- a/lib/tasks/ingress.rake +++ b/lib/tasks/ingress.rake @@ -17,7 +17,8 @@ begin response = HTTP.basic_auth(user: "actionmailbox", pass: password) .timeout(connect: 1, write: 10, read: 10) - .post(url, headers: { "Content-Type" => "message/rfc822", "User-Agent" => ENV.fetch("USER_AGENT", "Postfix") }, body: STDIN) + .post(url, body: STDIN.read, + headers: { "Content-Type" => "message/rfc822", "User-Agent" => ENV.fetch("USER_AGENT", "Postfix") }) case when response.status.success?
Read STDIN to upload it http.rb can't stream from pipes.
diff --git a/lib/tiddle/strategy.rb b/lib/tiddle/strategy.rb index abc1234..def5678 100644 --- a/lib/tiddle/strategy.rb +++ b/lib/tiddle/strategy.rb @@ -9,7 +9,7 @@ def authenticate! env["devise.skip_trackable"] = true - resource = mapping.to.find_for_authentication(email: email_from_headers) + resource = mapping.to.find_for_authentication(authentication_keys_from_headers) return fail(:invalid_token) unless resource token = Tiddle::TokenIssuer.build.find_token(resource, token_from_headers) @@ -22,7 +22,7 @@ end def valid? - email_from_headers.present? && token_from_headers.present? + authentication_keys_from_headers.present? && token_from_headers.present? end def store? @@ -31,8 +31,10 @@ private - def email_from_headers - env["HTTP_X_#{model_name}_EMAIL"] + def authentication_keys_from_headers + authentication_keys.map do |key| + { key => env["HTTP_X_#{model_name}_#{key.upcase}"] } + end.reduce(:merge) end def token_from_headers @@ -43,6 +45,10 @@ Tiddle::ModelName.new.with_underscores(mapping.to) end + def authentication_keys + mapping.to.authentication_keys + end + def touch_token(token) token.update_attribute(:last_used_at, DateTime.current) if token.last_used_at < 1.hour.ago end
Allow authentication using authentication_keys different than email. This introduces the possibility to use for instance "login" field instead of "email" to authenticate.
diff --git a/lib/tori/backend/s3.rb b/lib/tori/backend/s3.rb index abc1234..def5678 100644 --- a/lib/tori/backend/s3.rb +++ b/lib/tori/backend/s3.rb @@ -35,8 +35,12 @@ object(filename).read end - def url(filename) - object(filename).url_for(:read) + def public_url(filename) + object(filename).public_url + end + + def url_for(filename, method) + object(filename).url_for(method) end def object(filename)
Remove `url` and define `public_url` and `url_for` since proxy to S3Object
diff --git a/turbolinks.gemspec b/turbolinks.gemspec index abc1234..def5678 100644 --- a/turbolinks.gemspec +++ b/turbolinks.gemspec @@ -6,7 +6,7 @@ s.author = 'David Heinemeier Hansson' s.email = '[email protected]' s.license = 'MIT' - s.homepage = 'https://github.com/turbolinks/turbolinks-rails' + s.homepage = 'https://github.com/turbolinks/turbolinks' s.summary = 'Turbolinks makes navigating your web application faster' s.description = 'Rails engine for Turbolinks 5 support' s.files = Dir["lib/turbolinks.rb", "lib/turbolinks/*.rb", "README.md", "LICENSE"]
Update homepage to point to the main Turbolinks repo
diff --git a/spec/classes/mysql_backup_spec.rb b/spec/classes/mysql_backup_spec.rb index abc1234..def5678 100644 --- a/spec/classes/mysql_backup_spec.rb +++ b/spec/classes/mysql_backup_spec.rb @@ -12,7 +12,7 @@ it { should contain_database_user('testuser@localhost')} it { should contain_database_grant('testuser@localhost').with( - :privileges => [ 'select_priv', 'reload_priv', 'lock_tables_priv' ] + :privileges => [ 'Select_priv', 'Reload_priv', 'Lock_tables_priv' ] )} it { should contain_cron('mysql-backup').with(
Update privilege names to comply with 3fbb54de6c. Forgot to update the rspec test.
diff --git a/spec/factories/address_factory.rb b/spec/factories/address_factory.rb index abc1234..def5678 100644 --- a/spec/factories/address_factory.rb +++ b/spec/factories/address_factory.rb @@ -5,5 +5,6 @@ # Modify the address factory to generate unique addresses. factory :address do address2 { SecureRandom.uuid } + state { Spree::State.first || create(:state) } end end
Make sure all factory addresses have the same state.
diff --git a/lib/bookyt_pos/railtie.rb b/lib/bookyt_pos/railtie.rb index abc1234..def5678 100644 --- a/lib/bookyt_pos/railtie.rb +++ b/lib/bookyt_pos/railtie.rb @@ -3,8 +3,8 @@ module BookytPos class Railtie < Rails::Engine - initializer :after_initialize do - Bookyt::Engine.register_engine 'bookyt_pos' + initializer :after_initialize do |app| + app.config.bookyt.engines << 'bookyt_pos' end end end
Use app.config.bookyt.engines to register engines with bookyt.
diff --git a/lib/phusion_passenger/railz/framework_extensions/analytics_logging/ar_abstract_adapter_extension.rb b/lib/phusion_passenger/railz/framework_extensions/analytics_logging/ar_abstract_adapter_extension.rb index abc1234..def5678 100644 --- a/lib/phusion_passenger/railz/framework_extensions/analytics_logging/ar_abstract_adapter_extension.rb +++ b/lib/phusion_passenger/railz/framework_extensions/analytics_logging/ar_abstract_adapter_extension.rb @@ -11,7 +11,12 @@ if log sql_base64 = [sql].pack("m") sql_base64.strip! - log.measure("DB BENCHMARK: #{sql_base64} #{name.strip}") do + if name + name = name.strip + else + name = "SQL" + end + log.measure("DB BENCHMARK: #{sql_base64} #{name}") do log_without_passenger(sql, name, &block) end else
Fix ActiveRecord SQL logging: name could be nil.
diff --git a/examples/test_ffi_struct.rb b/examples/test_ffi_struct.rb index abc1234..def5678 100644 --- a/examples/test_ffi_struct.rb +++ b/examples/test_ffi_struct.rb @@ -33,7 +33,7 @@ layout :a, :int, :b, :int end def initialize(ptr=nil) - @struct = Struct.new(ptr) + @struct = self.class.const_get(:Struct).new(ptr) end end @@ -41,9 +41,6 @@ class Struct < MyFFIStruct layout :p, Foo2, :c, :int end - def initialize(ptr=nil) - @struct = Struct.new(ptr) - end end bar = Bar2.new
Make initialize work for subclasses too. By using const_get to retrieve the Struct class, we don't need to redefine initialize for each subclass of Foo2.
diff --git a/lib/conceptql/database.rb b/lib/conceptql/database.rb index abc1234..def5678 100644 --- a/lib/conceptql/database.rb +++ b/lib/conceptql/database.rb @@ -1,6 +1,3 @@-require 'facets/hash/revalue' -require 'facets/hash/symbolize_keys' - module ConceptQL class Database attr :db, :opts @@ -15,10 +12,11 @@ db_type = db.database_type.to_sym end - @opts = opts.revalue { |v| v ? v.to_sym : v }.symbolize_keys + # Symbolize all keys and values + @opts = Hash[opts.map { |k,v| [k.to_sym, v ? v.to_sym : v]}] + @opts[:data_model] ||= (ENV["CONCEPTQL_DATA_MODEL"] || :omopv4).to_sym @opts[:database_type] ||= db_type - db.set(db_opts) if db.respond_to?(:set) end def query(statement, opts={}) @@ -26,25 +24,6 @@ Query.new(db, statement, @opts.merge(opts)) end - def db_opts - opt_regexp = /^#{opts[:database_type]}_db_opt_/i - - env_hash = ENV.to_hash.rekey { |k| k.to_s.downcase } - opts_hash = opts.rekey { |k| k.to_s.downcase } - all_opts = env_hash.merge(opts_hash) - - matching_opts = all_opts.select { |k, _| k.match(opt_regexp) } - - matching_opts.each_with_object({}) do |(k,v), h| - new_key = k.sub(opt_regexp, '') - h[new_key] = prep_value(k, v) - end - end - - def prep_value(k, v) - v =~ /\W/ ? %Q|"#{v}"| : v - end - def extensions [:date_arithmetic, :error_sql] end
Database: Move DB_OPT processing to Sequelizer Addresses #120
diff --git a/core/lib/spree/deprecation.rb b/core/lib/spree/deprecation.rb index abc1234..def5678 100644 --- a/core/lib/spree/deprecation.rb +++ b/core/lib/spree/deprecation.rb @@ -4,4 +4,54 @@ module Spree Deprecation = ActiveSupport::Deprecation.new('3.0', 'Solidus') + + # This DeprecatedInstanceVariableProxy transforms instance variable to + # deprecated instance variable. + # + # It differs from ActiveSupport::DeprecatedInstanceVariableProxy since + # it allows to define a custom message. + # + # class Example + # def initialize(deprecator) + # @request = Spree::DeprecatedInstanceVariableProxy.new(self, :request, :@request, deprecator, "Please, do not use this thing.") + # @_request = :a_request + # end + # + # def request + # @_request + # end + # + # def old_request + # @request + # end + # end + # + # When someone execute any method on @request variable this will trigger + # +warn+ method on +deprecator_instance+ and will fetch <tt>@_request</tt> + # variable via +request+ method and execute the same method on non-proxy + # instance variable. + # + # Default deprecator is <tt>Spree::Deprecation</tt>. + class DeprecatedInstanceVariableProxy < ActiveSupport::Deprecation::DeprecationProxy + def initialize(instance, method, var = "@#{method}", deprecator = Spree::Deprecation, message = nil) + @instance = instance + @method = method + @var = var + @deprecator = deprecator + @message = message + end + + private + + def target + @instance.__send__(@method) + end + + def warn(callstack, called, args) + message = @message || "#{@var} is deprecated! Call #{@method}.#{called} instead of #{@var}.#{called}." + message = [message, "Args: #{args.inspect}"].join(" ") + + @deprecator.warn(message, callstack) + end + end end
Add a Spree::DeprecatedInstanceVariableProxy to allow custom messages The default Rails class does not allow to pass a custom message to the deprecation. This custom class extends its behavior to make it possible. Note that I also opened a PR in Rails for fixing this: rails/rails#35442
diff --git a/week-6/nested_data_solution.rb b/week-6/nested_data_solution.rb index abc1234..def5678 100644 --- a/week-6/nested_data_solution.rb +++ b/week-6/nested_data_solution.rb @@ -0,0 +1,47 @@+# RELEASE 2: NESTED STRUCTURE GOLF +# Hole 1 +# Target element: "FORE" + +array = [[1,2], ["inner", ["eagle", "par", ["FORE", "hook"]]]] + +# attempts: +# ============================================================ + + + +# ============================================================ + +# Hole 2 +# Target element: "congrats!" + +hash = {outer: {inner: {"almost" => {3 => "congrats!"}}}} + +# attempts: +# ============================================================ + + + +# ============================================================ + + +# Hole 3 +# Target element: "finished" + +nested_data = {array: ["array", {hash: "finished"}]} + +# attempts: +# ============================================================ + + + +# ============================================================ + +# RELEASE 3: ITERATE OVER NESTED STRUCTURES + +number_array = [5, [10, 15], [20,25,30], 35] + + + +# Bonus: + +startup_names = ["bit", ["find", "fast", ["optimize", "scope"]]]
Add initial load challenge 6.5
diff --git a/spec/dummy/config/initializers/alchemy.rb b/spec/dummy/config/initializers/alchemy.rb index abc1234..def5678 100644 --- a/spec/dummy/config/initializers/alchemy.rb +++ b/spec/dummy/config/initializers/alchemy.rb @@ -1,31 +1,33 @@ # frozen_string_literal: true -Alchemy.register_ability Ability -Alchemy.user_class_name = 'DummyUser' -Alchemy.signup_path = '/admin/pages' unless Rails.env.test? -Alchemy::Modules.register_module( - name: 'events', - navigation: { - name: 'Events', - controller: '/admin/events', - action: 'index', - icon: 'calendar-alt', - sub_navigation: [{ - name: 'Events', - controller: '/admin/events', - action: 'index' - }, { - name: 'Locations', - controller: '/admin/locations', - action: 'index' - }, { - name: 'Series', - controller: '/admin/series', - action: 'index' - }, { - name: 'Bookings', - controller: '/admin/bookings', - action: 'index' - }] - } -) +Rails.application.config.to_prepare do + Alchemy.register_ability Ability + Alchemy.user_class_name = "DummyUser" + Alchemy.signup_path = "/admin/pages" unless Rails.env.test? + Alchemy::Modules.register_module( + name: "events", + navigation: { + name: "Events", + controller: "/admin/events", + action: "index", + icon: "calendar-alt", + sub_navigation: [{ + name: "Events", + controller: "/admin/events", + action: "index", + }, { + name: "Locations", + controller: "/admin/locations", + action: "index", + }, { + name: "Series", + controller: "/admin/series", + action: "index", + }, { + name: "Bookings", + controller: "/admin/bookings", + action: "index", + }], + }, + ) +end
Move initializer code into to_prepare block Rails 7 does not autoload constants during boot anymore.
diff --git a/rails/spec/helpers/theme_helper_spec.rb b/rails/spec/helpers/theme_helper_spec.rb index abc1234..def5678 100644 --- a/rails/spec/helpers/theme_helper_spec.rb +++ b/rails/spec/helpers/theme_helper_spec.rb @@ -0,0 +1,75 @@+require 'spec_helper' + +class ConsumerClass + include ThemeHelper +end + +def set_theme_env(name) + allow(ENV).to receive(:[]).with(ThemeHelper::ENV_THEME_KEY).and_return(name) +end + +def stub_env(key, value) +end + +describe ThemeHelper do + let(:theme_name) { nil } + let(:instance) { ConsumerClass.new } + + it "ConsumerClass has ThemeHelper includes" do + expect(ConsumerClass).to include(ThemeHelper) + end + + describe "helper defined methods should exist" do + it "should respond to :render_themed_partial" do + expect(instance).to respond_to :render_themed_partial + end + it "should respond to :themed_style_sheet_tag" do + expect(instance).to respond_to :themed_style_sheet_tag + end + it "should respond to :theme_name" do + expect(instance).to respond_to :theme_name + end + end + + describe ":theme_name" do + describe "with no theme name in the environment" do + it "should return the default theme name" do + set_theme_env(nil) + expect(instance.theme_name).to eql 'learn' + set_theme_env("") + expect(instance.theme_name).to eql 'learn' + end + end + describe "with theme name set in the environment" do + it "should return the theme name" do + set_theme_env('foo') + expect(instance.theme_name).to eql 'foo' + end + end + end + + describe ":render_themed_partial" do + before(:each) { set_theme_env('learn') } + + describe "When the requested themed template exists" do + it "should render the template" do + allow(instance) + .to receive_message_chain(:lookup_context, :template_exists?) + .and_return(true) + + expect(instance).to receive(:render).with({ partial: 'themes/learn/foo' }) + instance.render_themed_partial('foo') + end + end + + describe "When the theme is missing the requested template)" do + it "should render the default template" do + allow(instance) + .to receive_message_chain(:lookup_context, :template_exists?) + .and_return(false) + expect(instance).to receive(:render).with({ partial: 'foo' }) + instance.render_themed_partial('foo') + end + end + end +end
Add test for the theme_helper #178193020 - find alternative to themes on rails https://www.pivotaltracker.com/story/show/178193020
diff --git a/lib/docushin/route_set.rb b/lib/docushin/route_set.rb index abc1234..def5678 100644 --- a/lib/docushin/route_set.rb +++ b/lib/docushin/route_set.rb @@ -12,7 +12,7 @@ if (rack_app = discover_rack_app(route.app)) && rack_app.respond_to?(:routes) rack_app.routes.routes.each do |rack_route| add_route Route.new(rack_route) - end + end if rack_app.routes.respond_to?(:routes) end add_route Route.new(route)
Fix error when multiple Rack apps are mounted.
diff --git a/app/helpers/translation_helper.rb b/app/helpers/translation_helper.rb index abc1234..def5678 100644 --- a/app/helpers/translation_helper.rb +++ b/app/helpers/translation_helper.rb @@ -0,0 +1,17 @@+module TranslationHelper + # Forest translation + def ft(record, attribute_name, options = {}) + fallback = options.fetch(:fallback, false) + + attr_name = attribute_name.to_s + attr_name << "_#{I18n.locale}" if I18n.locale != I18n.default_locale + + value = record.send(attr_name) + + if value.blank? && fallback + value = record.send(attribute_name) + end + + value + end +end
Add forest translation `ft` helper method
diff --git a/app/controllers/pods_controller.rb b/app/controllers/pods_controller.rb index abc1234..def5678 100644 --- a/app/controllers/pods_controller.rb +++ b/app/controllers/pods_controller.rb @@ -1,7 +1,7 @@ class PodsController < ApplicationController caches_page :index, :show - CHUNK_SIZE = 100 + CHUNK_SIZE = 500 def index @pods = CocoaPod.all
Increase chunk size to 500 pods.
diff --git a/app/helpers/bsat/content_helper.rb b/app/helpers/bsat/content_helper.rb index abc1234..def5678 100644 --- a/app/helpers/bsat/content_helper.rb +++ b/app/helpers/bsat/content_helper.rb @@ -1,7 +1,7 @@ module Bsat module ContentHelper - def bsat_brand(title, path: nil, &block) + def bsat_brand(path: nil, &block) content_for(:bsat_brand, block_given? ? capture(&block) : title) content_for(:bsat_brand_path, path) if path.present? end
Allow only block syntax for bsat_brand with optional path.
diff --git a/app/helpers/vote_display_helper.rb b/app/helpers/vote_display_helper.rb index abc1234..def5678 100644 --- a/app/helpers/vote_display_helper.rb +++ b/app/helpers/vote_display_helper.rb @@ -9,6 +9,6 @@ end def get_type(voteable) - + voteable.class.name end end
Define get_type method for voteable
diff --git a/minitest-sugar.gemspec b/minitest-sugar.gemspec index abc1234..def5678 100644 --- a/minitest-sugar.gemspec +++ b/minitest-sugar.gemspec @@ -14,4 +14,5 @@ s.test_files = Dir["test/**/*.rb"] s.add_dependency "minitest", "~> 5.0" + spec.add_development_dependency "rake", "~> 10.0" end
Add rake as a development dependency.
diff --git a/spec/kat.rb b/spec/kat.rb index abc1234..def5678 100644 --- a/spec/kat.rb +++ b/spec/kat.rb @@ -5,17 +5,21 @@ load 'daniel' describe Daniel::PasswordGenerator do - it "gives the expected password for foo, bar" do - gen = Daniel::PasswordGenerator.new "foo" - gen.generate("baz", Daniel::Parameters.new).should == "Dp4iWIX26UwV55N(" - end - it "gives the expected reminder for foo, bar" do - gen = Daniel::PasswordGenerator.new "foo" - gen.reminder("baz", Daniel::Parameters.new).should == "8244c50a1000baz" - end - it "gives the expected password for foo, bar reminder" do - gen = Daniel::PasswordGenerator.new "foo" - gen.generate_from_reminder("8244c50a1000baz").should == - "Dp4iWIX26UwV55N(" - end + [ + ["foo", "baz", "Dp4iWIX26UwV55N(", "8244c50a1000baz"], + ].each do |items| + master, code, result, reminder = items + it "gives the expected password for #{master}, #{code}" do + gen = Daniel::PasswordGenerator.new master + gen.generate(code, Daniel::Parameters.new).should == result + end + it "gives the expected reminder for #{master}, #{code}" do + gen = Daniel::PasswordGenerator.new master + gen.reminder(code, Daniel::Parameters.new).should == reminder + end + it "gives the expected password for #{master}, #{code} reminder" do + gen = Daniel::PasswordGenerator.new master + gen.generate_from_reminder(reminder).should == result + end + end end
Refactor tests to make multiple tests easier. Signed-off-by: brian m. carlson <[email protected]>
diff --git a/app/workers/reservation_worker.rb b/app/workers/reservation_worker.rb index abc1234..def5678 100644 --- a/app/workers/reservation_worker.rb +++ b/app/workers/reservation_worker.rb @@ -1,7 +1,7 @@ class ReservationWorker include Sidekiq::Worker - sidekiq_options :retry => 1 + sidekiq_options :retry => false attr_accessor :reservation, :reservation_id
Revert "allow reservation worker to retry jobs" This reverts commit 9d36398251f2ee136d47394953e1ea856dd94c0d.
diff --git a/core/env/clear_spec.rb b/core/env/clear_spec.rb index abc1234..def5678 100644 --- a/core/env/clear_spec.rb +++ b/core/env/clear_spec.rb @@ -5,7 +5,7 @@ orig = ENV.to_hash begin ENV.clear - ENV.should == {} + env.should == {} ensure ENV.replace orig end
Revert "change env to ENV" This reverts commit 789b8248a6f13710177488284505e45ee452923d.
diff --git a/lib/shanty/initializer.rb b/lib/shanty/initializer.rb index abc1234..def5678 100644 --- a/lib/shanty/initializer.rb +++ b/lib/shanty/initializer.rb @@ -1,42 +1,40 @@ require "thor" module Shanty - class Initializer < Thor + class Initializer + include Thor::Base include Thor::Actions - source_root(File.dirname(__FILE__)) - no_commands do - def init(language, provider) - create_provider_config(provider) - set_default_provider(provider) - create_project_config(language) - end + def init(language, provider) + create_provider_config(provider) + set_default_provider(provider) + create_project_config(language) + end - def create_provider_config(provider) - template "templates/providers/#{provider}.yml.tt", "~/.shanty/providers/#{provider}.yml" - end + def create_provider_config(provider) + template "templates/providers/#{provider}.yml.tt", "~/.shanty/providers/#{provider}.yml" + end - # TODO: Change this name to create_global_config - def set_default_provider(provider) - @provider = provider - template "templates/shanty/global_config.yml.tt", "~/.shanty/global_config.yml" - end + # TODO: Change this name to create_global_config + def set_default_provider(provider) + @provider = provider + template "templates/shanty/global_config.yml.tt", "~/.shanty/global_config.yml" + end - def create_project_config(language) - shanty_file = File.join(Shanty.project_path, ".shanty.yml") - @language = language - @current_ruby_version = dot_ruby_version - template "templates/dot_shanty.yml.tt", shanty_file - end + def create_project_config(language) + shanty_file = File.join(Shanty.project_path, ".shanty.yml") + @language = language + @current_ruby_version = dot_ruby_version + template "templates/dot_shanty.yml.tt", shanty_file + end - def dot_ruby_version - dot_ruby_version_file_path = File.join(Shanty.project_path, ".ruby-version") - return nil unless File.exist?(dot_ruby_version_file_path) - dot_ruby_version_content = File.read(dot_ruby_version_file_path).strip - if dot_ruby_version_content =~ /(?:ruby-)?(\d+\.\d+\.\d+(?:-p\d+)?)(?:@[\w\-]+)?/ - return $1 - end + def dot_ruby_version + dot_ruby_version_file_path = File.join(Shanty.project_path, ".ruby-version") + return nil unless File.exist?(dot_ruby_version_file_path) + dot_ruby_version_content = File.read(dot_ruby_version_file_path).strip + if dot_ruby_version_content =~ /(?:ruby-)?(\d+\.\d+\.\d+(?:-p\d+)?)(?:@[\w\-]+)?/ + return $1 end end end
Make Initializer not a inherit from Thor. I made this change to have it no longer inherit from Thor because it isn't really a sub command. Instead it is simply a class that I wanted to use the thor action methods in.
diff --git a/web/database/db.rb b/web/database/db.rb index abc1234..def5678 100644 --- a/web/database/db.rb +++ b/web/database/db.rb @@ -15,4 +15,4 @@ end options[:dbname] = uri.path[1..-1] -DB = Flounder.connect options +DB = Flounder.connect options.merge(search_path: 'public, information_schema')
Include the information schema in the search path.
diff --git a/web_purify.gemspec b/web_purify.gemspec index abc1234..def5678 100644 --- a/web_purify.gemspec +++ b/web_purify.gemspec @@ -15,7 +15,7 @@ s.add_dependency "json" - s.add_development_dependency "rspec", "~> 3.2.0" + s.add_development_dependency "rspec", "~> 3.8.0" s.add_development_dependency "vcr" s.add_development_dependency "webmock"
Update rspec requirement from ~> 3.2.0 to ~> 3.8.0 Updates the requirements on [rspec](https://github.com/rspec/rspec) to permit the latest version. - [Release notes](https://github.com/rspec/rspec/releases) - [Commits](https://github.com/rspec/rspec/commits/v3.8.0) Signed-off-by: dependabot[bot] <[email protected]>
diff --git a/test/unit/git/commit/test_rememberance.rb b/test/unit/git/commit/test_rememberance.rb index abc1234..def5678 100644 --- a/test/unit/git/commit/test_rememberance.rb +++ b/test/unit/git/commit/test_rememberance.rb @@ -8,6 +8,7 @@ @reposdir = Pathname.new("tmp/repos.git") @commit = Piston::Git::Commit.new(@repos, "ab"*20) + @commit.stubs(:git).with("ls-remote", @repos.url, @commit.commit).returns("b"*40) @values = @commit.remember_values end
Fix test rememberance of git repositories due to use of git-ls-remote to get last commit
diff --git a/jekyll-theme-kagami.gemspec b/jekyll-theme-kagami.gemspec index abc1234..def5678 100644 --- a/jekyll-theme-kagami.gemspec +++ b/jekyll-theme-kagami.gemspec @@ -15,5 +15,5 @@ spec.add_runtime_dependency "jekyll", "~> 3.3" spec.add_development_dependency "bundler", "~> 1.12" - spec.add_development_dependency "rake", "~> 10.0" + spec.add_development_dependency "rake", ">= 12.3.3" end
Upgrade rake to version 12.3.3 Upgrade rake to version 12.3.3
diff --git a/test/deprecated_sanitizer_test.rb b/test/deprecated_sanitizer_test.rb index abc1234..def5678 100644 --- a/test/deprecated_sanitizer_test.rb +++ b/test/deprecated_sanitizer_test.rb @@ -19,4 +19,9 @@ sanitize_helper.sanitized_allowed_tags = %w(horse) assert_equal %w(horse), HTML::WhiteListSanitizer.allowed_tags end + + test 'setting allowed attributes modifies HTML::WhiteListSanitizers allowed attributes' do + sanitize_helper.sanitized_allowed_attributes = 'for', 'your', 'health' + assert_equal %w(for your health), HTML::WhiteListSanitizer.allowed_attributes + end end
Add a test for setting allowed attributes.
diff --git a/config/environments/production.rb b/config/environments/production.rb index abc1234..def5678 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -13,4 +13,5 @@ config.logger = Logger::Syslog.new("racing_on_rails", Syslog::LOG_LOCAL4) config.logger.level = ::Logger::INFO config.serve_static_assets = false + config.assets.precompile += %w( wsba.css tabs.js ) end
Add assets for WSBA precompilation
diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index abc1234..def5678 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -6,3 +6,5 @@ Mime::Type.register_alias "text/plain", :diff Mime::Type.register_alias "text/plain", :patch +Mime::Type.register_alias 'text/html', :markdown +Mime::Type.register_alias 'text/html', :md
Add Markdown to Mime types
diff --git a/db/migrate/093_add_reviewer_id_to_review_of_review_mappings.rb b/db/migrate/093_add_reviewer_id_to_review_of_review_mappings.rb index abc1234..def5678 100644 --- a/db/migrate/093_add_reviewer_id_to_review_of_review_mappings.rb +++ b/db/migrate/093_add_reviewer_id_to_review_of_review_mappings.rb @@ -0,0 +1,12 @@+class AddReviewerIdToReviewOfReviewMappings < ActiveRecord::Migration + def self.up + begin + add_column :review_of_review_mappings, :reviewer_id, :integer, :null => true + rescue + end + + end + + def self.down + end +end
Add reviewer_id to review_of_review_mappings (metareview mappings) git-svn-id: f67d969b640da65cb7bc1d229e09fd6d2db44ae1@575 392d7b7b-3f31-0410-9dc3-c95a9635ea79
diff --git a/lib/bulk_insert.rb b/lib/bulk_insert.rb index abc1234..def5678 100644 --- a/lib/bulk_insert.rb +++ b/lib/bulk_insert.rb @@ -33,4 +33,6 @@ end end -ActiveRecord::Base.send :include, BulkInsert +ActiveSupport.on_load(:active_record) do + send(:include, BulkInsert) +end
Fix Rails 5 belongs_to behaviour override
diff --git a/lib/mr_keychain.rb b/lib/mr_keychain.rb index abc1234..def5678 100644 --- a/lib/mr_keychain.rb +++ b/lib/mr_keychain.rb @@ -10,7 +10,7 @@ # This is a special constant that allows {Keychain::Item} to treat a # password as if it were like the other keychain item attributes. # @return [Symbol] - KSecAttrPassword = :password + KSecAttrPassword = 'pass' end require 'mr_keychain/core_ext'
Make KSecAttPassword a 4 letter string like the real constants
diff --git a/lib/parse_fasta.rb b/lib/parse_fasta.rb index abc1234..def5678 100644 --- a/lib/parse_fasta.rb +++ b/lib/parse_fasta.rb @@ -20,6 +20,7 @@ require "parse_fasta/record" require "parse_fasta/seq_file" require "parse_fasta/error/data_format_error" +require "parse_fasta/error/sequence_format_error" module ParseFasta end
Raise error with bad fastA seq
diff --git a/lib/pausescreen.rb b/lib/pausescreen.rb index abc1234..def5678 100644 --- a/lib/pausescreen.rb +++ b/lib/pausescreen.rb @@ -6,4 +6,16 @@ @window = window end + def draw + draw_rect(@window_width, @window_height, Pokeconstants::Trans_black, + ZOrder::Pause_background) + end + + def draw_rect(width, height, color, z_order) + # Draws a rectangle by coordinates clockwise from top-left + @window.draw_quad(0, 0, color, width, 0, color, + width, height, color, 0, height, color, + z_order, :default) + end + end
Add draw_rect method and use it in PauseScreen.draw
diff --git a/lib/date-parser/datetime.rb b/lib/date-parser/datetime.rb index abc1234..def5678 100644 --- a/lib/date-parser/datetime.rb +++ b/lib/date-parser/datetime.rb @@ -6,6 +6,7 @@ value = args.first return if value.nil? return value if value.is_a?(DateTime) || value.is_a?(Time) + return value.to_datetime if value.is_a?(Date) return super unless value.is_a?(String) value.strip!
Return to DateTime converted value if called with Date
diff --git a/deployment_scripts/puppet/modules/plugin_midonet/lib/puppet/parser/functions/generate_zookeeper_hash.rb b/deployment_scripts/puppet/modules/plugin_midonet/lib/puppet/parser/functions/generate_zookeeper_hash.rb index abc1234..def5678 100644 --- a/deployment_scripts/puppet/modules/plugin_midonet/lib/puppet/parser/functions/generate_zookeeper_hash.rb +++ b/deployment_scripts/puppet/modules/plugin_midonet/lib/puppet/parser/functions/generate_zookeeper_hash.rb @@ -11,7 +11,7 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - +# module Puppet::Parser::Functions newfunction(:generate_zookeeper_hash, :type => :rvalue, :doc => <<-EOS This function returns Zookeper configuration hash @@ -19,10 +19,11 @@ ) do |argv| nodes_hash = argv[0] result = {} - nodes_hash.each do |ctrl| - result[ctrl[1]['fqdn']] = { 'host' => ctrl[1]['network_roles']['management'], - 'id' => (nodes_hash.keys().index(ctrl).to_i + 1).to_s - } + nodes_hash.each_with_index do |ctrl, index| + result[ctrl[1]['fqdn']] = { + 'host' => ctrl[1]['network_roles']['management'], + 'id' => (index + 1).to_s, + } end return result end
Fix function to generate zookeper hashes Change to each_to_index method Change-Id: Ibed3824a6d9ee4912365291a2323eda9d98ab48d
diff --git a/lib/filter_factory/field.rb b/lib/filter_factory/field.rb index abc1234..def5678 100644 --- a/lib/filter_factory/field.rb +++ b/lib/filter_factory/field.rb @@ -3,17 +3,29 @@ attr_reader :name, :condition, :alias, :options attr_accessor :value + # Initializes new instance of Field. + # + # @param [Symbol, String] name + # @param [Symbol] condition + # @param [Hash] options + # @option options [Symbol, String] :alias field alias def initialize(name, condition, options = {}) fail ArgumentError unless FilterFactory::Filter::CONDITIONS.include?(condition) valid_options = [:alias] - @name, @condition, @options = name, condition, options.reject{|k,| !valid_options.include?(k)} + @name, @condition, @options = name, condition, options.reject { |k,| !valid_options.include?(k) } @alias = @options[:alias] || @name end + # Checks whether two objects are equal. + # Returns true if obj is of the same class and has name, + # condition and alias attributes equal to current object. + # + # @param [Object] obj object to compare with + # @return [Boolean] def ==(obj) return false unless obj.is_a?(self.class) - [:name, :condition, :alias].inject(true) do |acc,attr| + [:name, :condition, :alias].inject(true) do |acc, attr| acc && public_send(attr) == obj.public_send(attr) end end
Add RDoc/Yard comments and minor style fixed for Field class.
diff --git a/spec/features/with_dependencies_spec.rb b/spec/features/with_dependencies_spec.rb index abc1234..def5678 100644 --- a/spec/features/with_dependencies_spec.rb +++ b/spec/features/with_dependencies_spec.rb @@ -7,5 +7,12 @@ it 'outputs multiple project banners' do lines.select{|l| l == "="*80}.size.should == 2 end + + it 'outputs most recent change of dependency' do + lines[8].should include('4225aa8') + lines[8].should include('2013-10-22') + lines[8].should include("Remove commander dependency, as it's not used") + lines[8].should include('Gareth Visagie') + end end end
Add tests for dependency output
diff --git a/dill.gemspec b/dill.gemspec index abc1234..def5678 100644 --- a/dill.gemspec +++ b/dill.gemspec @@ -18,7 +18,6 @@ s.require_paths = ['lib'] s.rubyforge_project = '[none]' - s.add_dependency 'cucumber' s.add_dependency 'chronic' s.add_dependency 'capybara', '>= 2.0'
Remove cucumber as a runtime dependency.
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index abc1234..def5678 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -26,7 +26,7 @@ @issue = create :issue, :github_labels => [[[], ['name', 'foo'], ['color', 'bar']]], :tags => ['foo'] end - it 'return blue' do + it 'return css rules' do expect(helper.issue_tag_color(@issue, 'foo')).to eq 'background-color: #bar;color:black;' end end
Fix spec description for issue_tag_color
diff --git a/dm-restful-adapter.gemspec b/dm-restful-adapter.gemspec index abc1234..def5678 100644 --- a/dm-restful-adapter.gemspec +++ b/dm-restful-adapter.gemspec @@ -15,7 +15,7 @@ gem.require_paths = ["lib"] gem.version = DataMapper::Adapters::RestfulAdapter::VERSION - gem.add_dependency 'dm-core', '1.2.1' + gem.add_dependency 'dm-core', '1.2.0' gem.add_dependency 'multi_json' gem.add_development_dependency 'rspec', '~> 2.9.0' gem.add_development_dependency 'mimic', '~> 0.4.3'
Change dm-core dependency to 1.2.0 (hopefully, just until pull request is included into core and they fix mainline)
diff --git a/spec/presenters/asset_presenter_spec.rb b/spec/presenters/asset_presenter_spec.rb index abc1234..def5678 100644 --- a/spec/presenters/asset_presenter_spec.rb +++ b/spec/presenters/asset_presenter_spec.rb @@ -0,0 +1,56 @@+require 'rails_helper' + +RSpec.describe AssetPresenter do + subject(:presenter) { described_class.new(asset, view_context) } + + let(:asset) { FactoryGirl.build(:asset) } + let(:view_context) { instance_double(ActionView::Base) } + + context '#as_json' do + let(:options) { {} } + let(:json) { presenter.as_json(options) } + let(:asset_url) { 'asset-url' } + + before do + allow(view_context).to receive(:asset_url).with(asset.id).and_return(asset_url) + end + + context 'when no status is supplied' do + let(:options) { { status: nil } } + + it 'returns hash including default response status' do + expect(json).to include(_response_info: { status: 'ok' }) + end + end + + context 'when status is supplied' do + let(:options) { { status: 'not_found' } } + + it 'returns hash including response status' do + expect(json).to include(_response_info: { status: 'not_found' }) + end + end + + it 'returns hash including asset URL as API identifier' do + expect(json).to include(id: 'asset-url') + end + + it 'returns hash including asset filename as name' do + expect(json).to include(name: 'asset.png') + end + + it 'returns hash including asset content type' do + expect(json).to include(content_type: 'image/png') + end + + it 'returns hash including public asset URL as file_url' do + uri = URI.parse(json[:file_url]) + expect("#{uri.scheme}://#{uri.host}").to eq(Plek.new.asset_root) + expect(uri.path).to eq("/media/#{asset.id}/#{asset.filename}") + end + + it 'returns hash including asset state' do + expect(json).to include(state: 'unscanned') + end + end +end
Add unit test coverage for AssetPresenter
diff --git a/lib/rspec-redo/rake_task.rb b/lib/rspec-redo/rake_task.rb index abc1234..def5678 100644 --- a/lib/rspec-redo/rake_task.rb +++ b/lib/rspec-redo/rake_task.rb @@ -9,12 +9,12 @@ def initialize(name = 'spec:redo', *args, &block) @retry_count = ENV['RETRY_COUNT'] - unless ::Rake.application.last_comment + unless ::Rake.application.last_description desc 'Run RSpec code examples with RSpecRedo' end - super(name, :retry_count, *args) do |t, args| - @retry_count = args.retry_count + super(name, :retry_count, *args) do |t, opts| + @retry_count = opts.retry_count yield self if block_given? end end
Fix deprecated Rake last_comment is now last_description
diff --git a/lib/hpcloud/commands/addresses.rb b/lib/hpcloud/commands/addresses.rb index abc1234..def5678 100644 --- a/lib/hpcloud/commands/addresses.rb +++ b/lib/hpcloud/commands/addresses.rb @@ -29,7 +29,6 @@ display_error_message(error) rescue Fog::AWS::Compute::Error => error # Hack to fix the lack of correct exception being raised, to enable better user experience - error_message = error.respond_to?(:response) ? parse_error(error.response) : error.message if error_message_includes?(error, "FloatingIpNotFoundForProject") display "You currently have no addresses, use `#{selfname} addresses:add` to create one." else
Remove line as it is not needed anymore.
diff --git a/lib/sippy_cup/media/rtp_packet.rb b/lib/sippy_cup/media/rtp_packet.rb index abc1234..def5678 100644 --- a/lib/sippy_cup/media/rtp_packet.rb +++ b/lib/sippy_cup/media/rtp_packet.rb @@ -5,6 +5,7 @@ module SippyCup class Media class RTPPacket < PacketFu::UDPPacket + attr_reader :header def initialize(payload_id = 0, marker = false) super({}) @@ -20,13 +21,6 @@ raise NoMethodError end end - - def header - @header - end - def peek_format - "hello" - end end end end
Use attr_reader instead of a method
diff --git a/lib/spree_store_credits/engine.rb b/lib/spree_store_credits/engine.rb index abc1234..def5678 100644 --- a/lib/spree_store_credits/engine.rb +++ b/lib/spree_store_credits/engine.rb @@ -16,5 +16,9 @@ end config.to_prepare &method(:activate).to_proc + + initializer "spree.gateway.payment_methods", :after => "spree.register.payment_methods" do |app| + app.config.spree.payment_methods << Spree::PaymentMethod::StoreCredit + end end end
Add store credit to list of payment_methods. This will currently cause issues if you attempt to save the store credit payment method in the Spree admin interface because the gateway is not in the list of available payment methods. It will default the store credit payment method to the first payment method in the list, save with that, and now allow you to change it back, thereby breaking everything!
diff --git a/dragons/scripts/run.rb b/dragons/scripts/run.rb index abc1234..def5678 100644 --- a/dragons/scripts/run.rb +++ b/dragons/scripts/run.rb @@ -0,0 +1,13 @@+#!/usr/bin/env ruby + +require_relative "../src/html-visualizer.rb" + +usage = <<eos +./run.rb <input_file> <rooms|teachers|groups> + parses a given JSON input file and visualizes the solution to the course + scheduling problem by giving time tables in terms of rooms, teachers or + groups as HTML output +eos + +puts usage unless ARGV.size == 2 +Visualizer::HTMLVisualizer.visualize(*ARGV)
Add ignored dir and rename it because bin is Satan for M$
diff --git a/providers/common.rb b/providers/common.rb index abc1234..def5678 100644 --- a/providers/common.rb +++ b/providers/common.rb @@ -15,7 +15,7 @@ action :create source new_resource.config_template path new_resource.config_destination - variables new_resource.variables + variables new_resource.config_vars owner new_resource.owner group new_resource.group mode new_resource.mode
Correct name of resource variables new_resource.variables -> new_resource.config_vars
diff --git a/spec/bin/t012_git_contest_list_spec.rb b/spec/bin/t012_git_contest_list_spec.rb index abc1234..def5678 100644 --- a/spec/bin/t012_git_contest_list_spec.rb +++ b/spec/bin/t012_git_contest_list_spec.rb @@ -0,0 +1,51 @@+require 'spec_helper' + +describe "T012: git-contest-list" do + before do + ENV['GIT_CONTEST_CONFIG'] = "#{@temp_dir}/config.yml" + end + + context "git-contest-list sites" do + before do + # create config + File.open "#{@temp_dir}/config.yml", 'w' do |file| + file.write <<EOF +sites: + test_site1: + driver: test_driver1 + user: test_user1 + password: test_password1 + test_site2: + driver: test_driver2 + user: test_user2 + password: test_password2 + test_site3: + driver: test_driver3 + user: test_user3 + password: test_password3 +EOF + end + end + + it "should include site name" do + ret = bin_exec "list sites" + (1..3).each {|x| expect(ret).to include "test_site#{x}" } + end + + it "should include user name" do + ret = bin_exec "list sites" + (1..3).each {|x| expect(ret).to include "test_user#{x}" } + end + + it "should include driver name" do + ret = bin_exec "list sites" + (1..3).each {|x| expect(ret).to include "test_driver#{x}" } + end + + it "should NOT include password" do + ret = bin_exec "list sites" + (1..3).each {|x| expect(ret).not_to include "test_password#{x}" } + end + end + +end
Add spec for git-contest-list sites
diff --git a/spec/stack_master/commands/nag_spec.rb b/spec/stack_master/commands/nag_spec.rb index abc1234..def5678 100644 --- a/spec/stack_master/commands/nag_spec.rb +++ b/spec/stack_master/commands/nag_spec.rb @@ -25,7 +25,7 @@ let(:template_body) { '{}' } let(:template_format) { :json } - it 'outputs the template' do + it 'calls the nag gem' do expect_any_instance_of(described_class).to receive(:system).once.with('cfn_nag', /.*\.json/) run end @@ -35,8 +35,9 @@ let(:template_body) { '---' } let(:template_format) { :yaml } - it 'outputs an error' do - expect { run }.to output(/cfn_nag doesn't support yaml formatted templates/).to_stderr + it 'calls the nag gem' do + expect_any_instance_of(described_class).to receive(:system).once.with('cfn_nag', /.*\.yaml/) + run end end end
Fix spec to allow yaml templates
diff --git a/spec/support/potential_user_helpers.rb b/spec/support/potential_user_helpers.rb index abc1234..def5678 100644 --- a/spec/support/potential_user_helpers.rb +++ b/spec/support/potential_user_helpers.rb @@ -0,0 +1,31 @@+module PotentialUserHelpers + + def create_potential_user args={} + defaults = { + :first_name => "John", + :last_name => "Smith", + :role => "Hiring Manager", + :company => "Acme", + :message => "Please add me to the partner dashboard.", + :email => "[email protected]" + } + args.reverse_merge(defaults) + end + + def request_invite(user) + visit '/' + click_link "Request Invitation" + fill_in "Email", with: user[:email] + fill_in "First Name", with: user[:first_name] + fill_in "Last Name", with: user[:last_name] + fill_in "Company", with: user[:company] + fill_in "Role", with: user[:role] + fill_in "Message to Admin", with: user[:message] + click_button "Submit" + end +end + + +RSpec.configure do |c| + c.include PotentialUserHelpers, :type => :feature +end
Add potential users helpers for request invite tests
diff --git a/extras/image_reaper.rb b/extras/image_reaper.rb index abc1234..def5678 100644 --- a/extras/image_reaper.rb +++ b/extras/image_reaper.rb @@ -0,0 +1,15 @@+#!/usr/bin/env ruby + +require 'rubygems' +require 'active_support' + +class File + def self.obsolete?(filename) + File.mtime(filename) < 1.day.ago + end +end + +Dir['*'].each do |filename| + next if filename =~ /^airbrush/ # leave queue files alone + File.delete filename if File.obsolete? filename +end
Add supplimentary script for cleaning out older spool paths via cron git-svn-id: 6d9b9a8f21f96071dc3ac7ff320f08f2a342ec80@89 daa9635f-4444-0410-9b3d-b8c75a019348
diff --git a/app/parameters/raw_time_parameters.rb b/app/parameters/raw_time_parameters.rb index abc1234..def5678 100644 --- a/app/parameters/raw_time_parameters.rb +++ b/app/parameters/raw_time_parameters.rb @@ -3,12 +3,34 @@ class RawTimeParameters < BaseParameters def self.permitted - %i[id event_group_id event_id lap split_name parameterized_split_name sub_split_kind bitkey bib_number sortable_bib_number - absolute_time entered_time stopped_here with_pacer remarks source split_time_id created_by created_at pulled_by pulled_at - effort_last_name split_time_exists data_status disassociated_from_effort] + [:absolute_time, + :bib_number, + :bitkey, + :created_at, + :created_by, + :data_status, + :disassociated_from_effort, + :effort_last_name, + :entered_lap, + :entered_time, + :event_group_id, + :event_id, + :id, + :parameterized_split_name, + :pulled_at, + :pulled_by, + :remarks, + :sortable_bib_number, + :source, + :split_name, + :split_time_exists, + :split_time_id, + :stopped_here, + :sub_split_kind, + :with_pacer] end def self.enriched_query - permitted + %i[split_id effort_id] + permitted + [:split_id, :effort_id] end end
Allow entered_lap (but not lap) as a permitted param
diff --git a/spec/commands/version_spec.rb b/spec/commands/version_spec.rb index abc1234..def5678 100644 --- a/spec/commands/version_spec.rb +++ b/spec/commands/version_spec.rb @@ -17,10 +17,8 @@ context "with version" do it "outputs the version with build metadata" do - date = Bundler::BuildMetadata.built_at - git_commit_sha = Bundler::BuildMetadata.git_commit_sha bundle! "version" - expect(out).to eq("Bundler version #{Bundler::VERSION} (#{date} commit #{git_commit_sha})") + expect(out).to match(/\ABundler version #{Regexp.escape(Bundler::VERSION)} \(\d{4}-\d{2}-\d{2} commit [a-fA-F0-9]{7,}\)\z/) end end end
Update the version spec to handle when the specs start in the day before that example is run
diff --git a/spec/lib/tasks/dummy_app.rake b/spec/lib/tasks/dummy_app.rake index abc1234..def5678 100644 --- a/spec/lib/tasks/dummy_app.rake +++ b/spec/lib/tasks/dummy_app.rake @@ -0,0 +1,26 @@+require "rspec/core/rake_task" + +namespace :engine_example do + desc "Generate a dummy app for testing and development" + task :dummy_app => [:setup_dummy_app, :migrate_dummy_app] + + task :setup_dummy_app do + require "rails" + require "engine_example" + require File.expand_path("../../generators/engine_example/dummy/dummy_generator", + __FILE__) + + EngineExample::DummyGenerator.start %w(--quiet) + end + + task :migrate_dummy_app do + # Set up migrations here once they are written + end + + desc "Destroy dummy app" + task :destroy_dummy_app do + FileUtils.rm_rf "spec/dummy" if File.exists?("spec/dummy") + end +end + +
Add dummy app Rake tasks
diff --git a/spec/the_google/event_spec.rb b/spec/the_google/event_spec.rb index abc1234..def5678 100644 --- a/spec/the_google/event_spec.rb +++ b/spec/the_google/event_spec.rb @@ -0,0 +1,18 @@+require_relative '../spec_helper' + +describe TheGoogle::Event do + + describe "apply recurrence" do + + let(:event) { TheGoogle::Event.new } + + let(:result) { TheGoogle::Event.apply_recurrence event } + + it "should return the event, alone in an array" do + result.count.must_equal 1 + result[0].must_be_same_as event + end + + end + +end
Write a test for the existing functionality.
diff --git a/spec/presenters/entry_presenter_spec.rb b/spec/presenters/entry_presenter_spec.rb index abc1234..def5678 100644 --- a/spec/presenters/entry_presenter_spec.rb +++ b/spec/presenters/entry_presenter_spec.rb @@ -0,0 +1,38 @@+require 'spec_helper' + +RSpec.describe EntryPresenter do + describe '#summary' do + let(:document) { + FactoryBot.build(:document, description: 'This is the summary. And this is extra.') + } + it 'displays the truncated description' do + expect(EntryPresenter.new(document, true).summary).to eq('This is the summary.') + end + it 'returns nil' do + expect(EntryPresenter.new(document, false).summary).to be nil + end + end + describe '#tag' do + it 'returns a tag' do + document = FactoryBot.build(:document, link: '/path/to/content') + atom_feed_builder = ActionView::Helpers::AtomFeedHelper::AtomFeedBuilder.new(nil, nil, schema_date: 2019) + expect(EntryPresenter.new(document, true).tag(atom_feed_builder)).to eq('tag:www.test.gov.uk,2019:/path/to/content') + end + end + describe '#updated_at' do + it 'returns the public timestamp' do + document = FactoryBot.build(:document, public_timestamp: "Thu Nov 29 14:33:20 2001", release_timestamp: "Thu Nov 29 14:33:20 2010") + expect(EntryPresenter.new(document, true).updated_at).to eq("Thu Nov 29 14:33:20 2001") + end + it 'returns the release timestamp' do + document = FactoryBot.build(:document, public_timestamp: nil, release_timestamp: "Thu Nov 29 14:33:20 2010") + expect(EntryPresenter.new(document, true).updated_at).to eq("Thu Nov 29 14:33:20 2010") + end + end + describe '#feed_ended_id' do + it 'returns a feed_ended_id' do + atom_feed_builder = ActionView::Helpers::AtomFeedHelper::AtomFeedBuilder.new(nil, nil, schema_date: 2019) + expect(EntryPresenter.feed_ended_id(atom_feed_builder, '/path/to/content')).to eq('tag:www.test.gov.uk,2019:/path/to/content/feed-ended') + end + end +end
Add unit tests for EntryPresenter
diff --git a/spec/reports_kit/report_builder_spec.rb b/spec/reports_kit/report_builder_spec.rb index abc1234..def5678 100644 --- a/spec/reports_kit/report_builder_spec.rb +++ b/spec/reports_kit/report_builder_spec.rb @@ -22,13 +22,7 @@ end it 'transforms the filter criteria' do - expect(subject.properties[:measures][0][:filters][0]).to eq({ - key: 'opened_at', - criteria: { - operator: 'between', - value: "#{format_criteria_time(1.week.ago)} - #{format_criteria_time(Time.zone.now)}" - } - }) + expect(subject.date_range('opened_at')).to include("#{format_criteria_time(1.week.ago)} - #{format_criteria_time(Time.zone.now)}") end end end
Improve scope of ReportBuilder example's expectation
diff --git a/spec/requests/default_namespace_spec.rb b/spec/requests/default_namespace_spec.rb index abc1234..def5678 100644 --- a/spec/requests/default_namespace_spec.rb +++ b/spec/requests/default_namespace_spec.rb @@ -3,6 +3,8 @@ RSpec.describe ActiveAdmin::Application, type: :request do include Rails.application.routes.url_helpers + + let(:resource) { ActiveAdmin.register Category } [false, nil].each do |value| @@ -10,6 +12,10 @@ around do |example| with_custom_default_namespace(value) { example.call } + end + + it "should generate resource paths" do + expect(resource.route_collection_path).to eq "/categories" end it "should generate a log out path" do @@ -28,6 +34,10 @@ around do |example| with_custom_default_namespace(:test) { example.call } + end + + it "should generate resource paths" do + expect(resource.route_collection_path).to eq "/test/categories" end it "should generate a log out path" do
Add some resource route specs to default namespace
diff --git a/spec/unit/imap/backup/cli/utils_spec.rb b/spec/unit/imap/backup/cli/utils_spec.rb index abc1234..def5678 100644 --- a/spec/unit/imap/backup/cli/utils_spec.rb +++ b/spec/unit/imap/backup/cli/utils_spec.rb @@ -0,0 +1,45 @@+describe Imap::Backup::CLI::Utils do + let(:list) do + instance_double(Imap::Backup::Configuration::List, accounts: accounts) + end + let(:accounts) { [{username: email}] } + let(:connection) do + instance_double( + Imap::Backup::Account::Connection, + local_folders: local_folders + ) + end + let(:local_folders) { [[serializer, folder]] } + let(:folder) do + instance_double( + Imap::Backup::Account::Folder, + exist?: true, + name: "name", + uid_validity: "uid_validity", + uids: ["123"] + ) + end + let(:serializer) do + instance_double( + Imap::Backup::Serializer::Mbox, + uids: ["123", "456"], + apply_uid_validity: nil + ) + end + let(:email) { "[email protected]" } + + before do + allow(Imap::Backup::Configuration::List).to receive(:new) { list } + allow(Imap::Backup::Account::Connection).to receive(:new) { connection } + end + + describe "ignore_history" do + it "ensures the local UID validity matches the server" + + it "fills the local folder with fake emails" do + subject.ignore_history(email) + + TODO + end + end +end
Add tests for local utils
diff --git a/tww.gemspec b/tww.gemspec index abc1234..def5678 100644 --- a/tww.gemspec +++ b/tww.gemspec @@ -17,7 +17,7 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ['lib'] - spec.required_ruby_version = '>= 2.1.0' + spec.required_ruby_version = '>= 2.6.0' spec.add_development_dependency 'bundler', '~> 2.1' spec.add_development_dependency 'rake', '~> 13.0'
Remove suporte a versões antigas do Ruby
diff --git a/app/models/project_decorator.rb b/app/models/project_decorator.rb index abc1234..def5678 100644 --- a/app/models/project_decorator.rb +++ b/app/models/project_decorator.rb @@ -34,7 +34,11 @@ end def status - @_status + @_ci.status + end + + def status_url + @_ci.url end private @@ -56,16 +60,16 @@ end def init_ci - @_status = + @_ci = case ci_type when "travis" - Status::Travis.new(repo_name, travis_token).status + Status::Travis.new(repo_name, travis_token) when "codeship" - Status::Codeship.new(repo_name, codeship_uuid).status + Status::Codeship.new(repo_name, codeship_uuid) when "circleci" - Status::Circleci.new(repo_name, circleci_token).status + Status::Circleci.new(repo_name, circleci_token) else - :unavailable + Status::Null.new end end end
Update project decorator to be able to retrieve the build url.
diff --git a/Casks/master-key.rb b/Casks/master-key.rb index abc1234..def5678 100644 --- a/Casks/master-key.rb +++ b/Casks/master-key.rb @@ -0,0 +1,7 @@+class MasterKey < Cask + url 'http://macinmind.com/MasterKey.dmg' + homepage 'http://macinmind.com/?area=app&app=masterkey&pg=info' + version '5.6.2' + sha256 '3b952d0e40a5bb937b4e85684e480d7fb364c17e319c1963f94e89bd382e2353' + link 'Master Key.app' +end
Add Master Key.app version 5.6.2 Created a new Cask for Master Key 5.6.2 following the naming conventions, converting it to master-key.rb. Included a sha256, and successfully passed both install and audit --download prior to committing.
diff --git a/Casks/qt-creator.rb b/Casks/qt-creator.rb index abc1234..def5678 100644 --- a/Casks/qt-creator.rb +++ b/Casks/qt-creator.rb @@ -1,6 +1,6 @@ cask :v1 => 'qt-creator' do - version '3.3.0' - sha256 '5e5491f6c82d3cb57b3ccc186b5b239ca52c2144034da92fc72ad7e8e6788045' + version '3.3.1' + sha256 '4e7f697e49330abc7883f0bbf58b5c6b7d57dc7d365f5430a9beda1cc3c5ec43' url "http://download.qt-project.org/official_releases/qtcreator/#{version.sub(%r{^(\d+\.\d+).*},'\1')}/#{version}/qt-creator-opensource-mac-x86_64-#{version}.dmg" homepage 'http://qt-project.org/'
Upgrade QT Creator to v3.3.1
diff --git a/examples/rails_log/file_output.rb b/examples/rails_log/file_output.rb index abc1234..def5678 100644 --- a/examples/rails_log/file_output.rb +++ b/examples/rails_log/file_output.rb @@ -6,7 +6,7 @@ @outgoing = CSV.open('/tmp/connection_logging.csv', 'w') end - def finalize + def after_run_log_path puts "\nData written to #{outgoing.path}\n\n" end
Use after_run hook in rails log example during output.
diff --git a/date-parser.gemspec b/date-parser.gemspec index abc1234..def5678 100644 --- a/date-parser.gemspec +++ b/date-parser.gemspec @@ -7,8 +7,8 @@ Gem::Specification.new do |s| s.name = "date-parser" s.version = DateParser::VERSION - s.authors = ["Rober Voß", "Niels Bennke"] - s.email = ["[email protected]", "[email protected]"] + s.authors = ["Robert Voß", "Niels Bennke"] + s.email = ["[email protected]", "[email protected]"] s.homepage = "http://www.bfpi.de" s.summary = "Simple parser for dates and times from strings" s.description = "Simple parser for dates and times from strings"
Fix typo in name and email
diff --git a/Casks/bit-slicer.rb b/Casks/bit-slicer.rb index abc1234..def5678 100644 --- a/Casks/bit-slicer.rb +++ b/Casks/bit-slicer.rb @@ -1,12 +1,12 @@ cask :v1 => 'bit-slicer' do - version '1.7.5' - sha256 '1180666794b41ddba4895c6f90ba9e428f49c115f0eb260d76061c6c6aa9f1a9' + version '1.7.6' + sha256 '03e9125481bd4c6459e379b3b0df69a2eecbde80f7cb11d9be8dfc9c0f8d3a58' # bitbucket.org is the official download host per the vendor homepage url "https://bitbucket.org/zorgiepoo/bit-slicer/downloads/Bit%20Slicer%20#{version}.zip" name 'Bit Slicer' appcast 'https://zgcoder.net/bitslicer/update/appcast.xml', - :sha256 => '1deab6db866da60ea0c088b1d086039c8363f5c48fcb2bbdea62f52176395c33' + :sha256 => '3012f7d3d8b49f6d595d62e07f87525c0a225a59d44576ba46f0c67518fdf019' homepage 'https://github.com/zorgiepoo/bit-slicer/' license :bsd
Update Bit Slicer to 1.7.6
diff --git a/Formula/modelgen.rb b/Formula/modelgen.rb index abc1234..def5678 100644 --- a/Formula/modelgen.rb +++ b/Formula/modelgen.rb @@ -2,20 +2,16 @@ desc "Swift CLI to generate Models based on a JSON Schema and a template." homepage "https://github.com/hebertialmeida/ModelGen" url "https://github.com/hebertialmeida/ModelGen.git", - :tag => "0.3.0", + :tag => "0.4.0", :revision => "22ca2343cd65a4df4a039eef004ba5a75a0609fc" head "https://github.com/hebertialmeida/ModelGen.git" depends_on :xcode => ["9.3", :build] def install - ENV["NO_CODE_LINT"]="1" # Disable swiftlint Build Phase to avoid build errors if versions mismatch - - ENV["GEM_HOME"] = buildpath/"gem_home" - system "gem", "install", "bundler" - ENV.prepend_path "PATH", buildpath/"gem_home/bin" - system "bundle", "install", "--without", "development" - system "bundle", "exec", "rake", "cli:install[#{bin},#{lib}]" + system "swift", "build", "--disable-sandbox", "-c", "release", "-Xswiftc", "-static-stdlib" + bin.install ".build/release/modelgen" + lib.install Dir[".build/release/*.dylib"] end test do
Update formula to build with SPM
diff --git a/byk.gemspec b/byk.gemspec index abc1234..def5678 100644 --- a/byk.gemspec +++ b/byk.gemspec @@ -17,6 +17,8 @@ s.homepage = "https://github.com/topalovic/byk" s.license = "MIT" + s.required_ruby_version = ">= 1.9.3" + s.extensions = ["ext/byk/extconf.rb"] s.require_paths = ["lib"]
Set the required Ruby version in gemspec
diff --git a/DKDBManager.podspec b/DKDBManager.podspec index abc1234..def5678 100644 --- a/DKDBManager.podspec +++ b/DKDBManager.podspec @@ -8,6 +8,8 @@ s.source = { :git => "https://github.com/kevindelord/DKDBManager.git", :tag => s.version.to_s } s.platform = :ios s.requires_arc = true + s.ios.deployment_target = '6.1' + s.osx.deployment_target = '10.8' s.framework = 'CoreData' s.source_files = 'DKDBManager/*' s.dependency 'MagicalRecord'
Add deployment target on podspec
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,7 +2,7 @@ mount RailsAdmin::Engine => '/admin', :as => 'rails_admin' - devise_for :users, controllers: { registrations: 'registrations', omniauth_callbacks: 'users/omniauth_callbacks' } + devise_for :users, :path => "members", controllers: { registrations: 'registrations', omniauth_callbacks: 'users/omniauth_callbacks' } devise_scope :user do get '/sign-in' => 'sessions#new', as: :sign_in
Change users routing to members
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,6 @@ Frontend::Application.routes.draw do match "/homepage" => redirect("/") + match "/search" => "search#index", as: :search # Crude way of handling the situation described at # http://stackoverflow.com/a/3443678 @@ -19,6 +20,5 @@ pub.match ":slug(/:part)" end - match "/search" => "search#index", as: :search root :to => 'root#index' end
Move /search route so it actually kicks in It was being trumped by the catch-all publication routes.
diff --git a/JBSSettings.podspec b/JBSSettings.podspec index abc1234..def5678 100644 --- a/JBSSettings.podspec +++ b/JBSSettings.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'JBSSettings' - s.version = '0.1.0' + s.version = '0.1.1' s.summary = 'A settings object that is less annoying than NSUserDefaults' s.description = '' s.homepage = 'https://github.com/jsumners/JBSSettings' @@ -14,7 +14,9 @@ #s.ios.deployment_target = '4.0' s.osx.deployment_target = '10.10' - s.requires_arc = true + # Yes, it requires ARC, but it also depends on a library that doesn't. + # `pod spec lint` can't handle that. Good times! + #s.requires_arc = true s.dependency 'FMDB', '~> 2.5' s.source_files = 'Classes', 'Classes/**/*.{h,m}'
Fix failing `pod spec lint`
diff --git a/MJExtension.podspec b/MJExtension.podspec index abc1234..def5678 100644 --- a/MJExtension.podspec +++ b/MJExtension.podspec @@ -1,12 +1,12 @@ Pod::Spec.new do |s| s.name = "MJExtension" - s.version = "0.1.0" + s.version = "0.1.1" s.summary = "The fastest and most convenient conversion between JSON and model" s.homepage = "https://github.com/CoderMJLee/MJExtension" s.license = "MIT" s.author = { "MJLee" => "[email protected]" } s.social_media_url = "http://weibo.com/exceptions" - s.source = { :git => "https://github.com/CoderMJLee/MJExtension.git", :tag => "0.1.0" } + s.source = { :git => "https://github.com/CoderMJLee/MJExtension.git", :tag => "0.1.1" } s.source_files = "MJExtensionExample/MJExtensionExample/MJExtension" s.requires_arc = true end
Fix setValue:forKeyPath: nil value problem Fix setValue:forKeyPath: nil value problem
diff --git a/railties/lib/rails/deprecation.rb b/railties/lib/rails/deprecation.rb index abc1234..def5678 100644 --- a/railties/lib/rails/deprecation.rb +++ b/railties/lib/rails/deprecation.rb @@ -3,7 +3,8 @@ module Rails class DeprecatedConstant < ActiveSupport::Deprecation::DeprecatedConstantProxy def self.deprecate(old, current) - constant = new(old, current) + # double assignment is used to avoid "assigned but unused variable" warning + constant = constant = new(old, current) eval "::#{old} = constant" end
Remove 'assigned but unused variable' warning
diff --git a/MenuItemKit.podspec b/MenuItemKit.podspec index abc1234..def5678 100644 --- a/MenuItemKit.podspec +++ b/MenuItemKit.podspec @@ -5,7 +5,7 @@ s.author = "CHEN Xian’an <[email protected]>" s.homepage = "https://github.com/cxa/MenuItemKit" s.license = 'MIT' - s.source = { :git => 'https://github.com/janeabernethy/MenuItemKit.git', :branch => "master", :tag => s.version.to_s } + s.source = { :git => 'https://github.com/cxa/MenuItemKit.git', :branch => "master", :tag => s.version.to_s } s.platform = :ios, '8.0' s.source_files = 'MenuItemKit/*.{h,m,swift}' s.requires_arc = true
Add correct branch and source for source value in podspec
diff --git a/instrumental_agent.gemspec b/instrumental_agent.gemspec index abc1234..def5678 100644 --- a/instrumental_agent.gemspec +++ b/instrumental_agent.gemspec @@ -16,6 +16,7 @@ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ["lib"] + s.add_development_dependency("pry", [">= 0"]) s.add_development_dependency("rake", [">= 0"]) s.add_development_dependency("rspec", ["~> 3.0"]) s.add_development_dependency("fuubar", [">= 0"])
Add pry for testing introspection.
diff --git a/app/controllers/servers_controller.rb b/app/controllers/servers_controller.rb index abc1234..def5678 100644 --- a/app/controllers/servers_controller.rb +++ b/app/controllers/servers_controller.rb @@ -1,6 +1,7 @@ class ServersController < ApplicationController skip_before_filter :authenticate_user! + caches_action :index, :unless => :current_user def index SteamCondenser::Servers::Sockets::BaseSocket.timeout = 500
Revert "disable caching on server page for now" This reverts commit a0809d53fc3ec833c74f4fa423a60db0baa4a202.
diff --git a/app/models/neighborhood/crime_data.rb b/app/models/neighborhood/crime_data.rb index abc1234..def5678 100644 --- a/app/models/neighborhood/crime_data.rb +++ b/app/models/neighborhood/crime_data.rb @@ -5,8 +5,8 @@ def yearly_counts # TODO: Append the within_polygon to the where clause for the data set. - service_url = URI::escape("https://data.kcmo.org/resource/dfzx-ty3t.json") - crimes = HTTParty.get(service_url) + service_url = URI::escape("https://data.kcmo.org/resource/nsn9-g8a4.json?#{query_polygon}") + crimes = HTTParty.get(service_url, verify: false) yearly_counts = {} @@ -20,13 +20,30 @@ Hash[yearly_counts] end + def map_coordinates + service_url = URI::escape("https://data.kcmo.org/resource/nsn9-g8a4.json?#{query_polygon}") + coordinates = HTTParty.get(service_url, verify: false) + + coordinates + .select{ |coordinate| coordinate["location_1"] && coordinates["location_1"]["coordinates"]} + .map { |coordinate| + { + "type" => "Feature", + "geometry" => { + "type" => "Point", + "coordinates" => coordinate["location_1"]["coordinates"] + } + } + } + end + private def query_polygon - coordinates = @neighborhood.coordinates.map{ |neighborhood| + coordinates = @neighborhood.coordinates.map{ |neighborhood| "#{neighborhood.latitude} #{neighborhood.longtitude}" }.join(',') - "$where=within_polygon(location, 'MULTIPOLYGON (((#{coordinates})))')" + "$where=within_polygon(location_1, 'MULTIPOLYGON (((#{coordinates})))')" end end
Use the new API for Crime Data
diff --git a/recipes/_fedora.rb b/recipes/_fedora.rb index abc1234..def5678 100644 --- a/recipes/_fedora.rb +++ b/recipes/_fedora.rb @@ -2,7 +2,7 @@ # Cookbook Name:: build-essential # Recipe:: fedora # -# Copyright 2008-2013, Chef Software, Inc. +# Copyright 2008-2015, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -28,4 +28,5 @@ package 'make' package 'm4' package 'ncurses-devel' + package 'patch' end
Include patch on Fedora systems We included this on RHEL. Without this the xml cookbook fails on Fedora
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -3,11 +3,11 @@ # Cookbook Name:: chef_testing_example # Recipe:: default # -# + package 'apache2' service 'apache2' do - action [:start,:enable] + action [:start, :enable] end execute 'a2enmod rewrite' do
Revert "Test CI pickup of failure" It worked! This reverts commit 0d8a0467fca6af2df7e76bcfb30f5ba13058f375.
diff --git a/spec/models/mcas_importer_spec.rb b/spec/models/mcas_importer_spec.rb index abc1234..def5678 100644 --- a/spec/models/mcas_importer_spec.rb +++ b/spec/models/mcas_importer_spec.rb @@ -6,19 +6,31 @@ fixture_path = "#{Rails.root}/spec/fixtures/fake_mcas.csv" let(:healey) { FactoryGirl.create(:healey) } let(:brown) { FactoryGirl.create(:brown) } - let(:importer) { McasImporter.new(fixture_path, healey, "05") } + let(:healey_importer) { McasImporter.new(fixture_path, healey, "05") } + let(:brown_importer) { McasImporter.new(fixture_path, brown, "05") } context 'with good data' do - it 'creates a student' do - expect { - importer.import - }.to change(Student, :count).by(1) + context 'for Healey school' do + + it 'creates a student' do + expect { + healey_importer.import + }.to change(Student, :count).by(1) + end + + it 'imports a Healey student' do + healey_importer.import + expect(Student.last.first_name).to eq('Ben') + end end - it 'sets the student name correctly' do - importer.import - expect(Student.last.first_name).to eq('Ben') + context 'for Brown school' do + + it 'imports a Brown student' do + brown_importer.import + expect(Student.last.first_name).to eq('Mari') + end end end end
Test MCAS import by school. * #18.
diff --git a/lib/daniel/credential/resource.rb b/lib/daniel/credential/resource.rb index abc1234..def5678 100644 --- a/lib/daniel/credential/resource.rb +++ b/lib/daniel/credential/resource.rb @@ -0,0 +1,83 @@+require 'daniel' +require 'open-uri' +require 'uri' + +module Daniel + # A set of classes providing automatic credential generation based on a set of + # parameters. + module CredentialHelper + # The default implementation of a credential helper. + # + # This class provides support for reading a file or URL (supported by + # open-uri) containing a list of valid reminder codes, one on each line, and + # finding the first one that matches the master password's checksum which + # has a code of the form user@*.domain or *.domain. + class Resource + attr_writer :reminders + attr_writer :master_password + + def initialize(resource = nil) + @resource = resource + url = 'https://github.com/bk2204/daniel-ruby' + ver = Daniel::Version.to_s + @user_agent = "daniel/#{ver} (+#{url}) Ruby/#{RUBY_VERSION}" + end + + def reminders + return @reminders if @reminders + + @reminders = [] + if @resource.respond_to? :each_line + @reminders = read_resource(@resource) + else + open(@resource, 'User-Agent' => @user_agent) do |f| + @reminders = read_resource(f) + end + end + @reminders + end + + def generate(params) + acquire unless @master_password + pgen = Daniel::PasswordGenerator.new(@master_password) + selected = select(pgen.checksum, params) + pgen.generate(selected[:code], selected[:params], selected[:mask]) + end + + protected + + def read_resource(io) + reminders = [] + io.each_line do |line| + next if line =~ /^\s*(?:#.*)?$/ + reminders << Daniel::PasswordGenerator.parse_reminder(line.strip) + end + reminders + end + + def acquire + fail 'No master password set!' unless @master_password + end + + def selected(csum, params) + fail 'No matching reminder!' unless reminders + user, domain = params[:user], params[:domain] + userpat = user ? /(?:(#{Regexp.escape(user)})@)?/ : /()/ + pat = /\A#{userpat}((?:.*\.)?#{Regexp.escape(domain)})\z/ + s = reminders.map do |r| + if r[:checksum] == csum && r[:code] =~ pat + [Regexp.last_match[1..2], r].flatten + else + nil + end + end + result = s.select { |r| r }.sort do |a, b| + cmp = b[0].to_s <=> a[0].to_s + cmp.zero? ? a[1].length <=> b[1].length : cmp + end.first + fail 'No matching reminder!' unless result + result[2] + end + end + end +end
Move credential helper implementation to separate file. The implementation of a credential helper is useful, but not a good base class. Move it to a separate file in preparation for providing a useful API in the original file. Signed-off-by: brian m. carlson <[email protected]>
diff --git a/TVMLKitchen.podspec b/TVMLKitchen.podspec index abc1234..def5678 100644 --- a/TVMLKitchen.podspec +++ b/TVMLKitchen.podspec @@ -14,5 +14,5 @@ s.platform = :tvos, '9.0' s.requires_arc = true - s.source_files = 'source/**/*' + s.source_files = 'source/**/*', 'library/**/*' end
Add library to the podspec
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,9 +1,10 @@ Rails.application.routes.draw do resources :requests - + get '/login', :to => 'sessions#new', :as => :login get '/logout', :to => 'sessions#destroy', :as => :logout get "/auth/auth0/callback" => "auth0#callback" get "/auth/failure" => "auth0#failure" + post "/groups/assign", to: "groups#assign" end
Add route to accept a user's address input.
diff --git a/lib/atlas/fever_details.rb b/lib/atlas/fever_details.rb index abc1234..def5678 100644 --- a/lib/atlas/fever_details.rb +++ b/lib/atlas/fever_details.rb @@ -7,8 +7,8 @@ values do attribute :type, Symbol attribute :group, Symbol - attribute :curve, Symbol, default: nil - attribute :defer_for, Integer, default: 0 + attribute :curve, Symbol + attribute :defer_for, Integer end end end
Remove redundant defaults from FeverDetails
diff --git a/lib/aweplug/helpers/cdn.rb b/lib/aweplug/helpers/cdn.rb index abc1234..def5678 100644 --- a/lib/aweplug/helpers/cdn.rb +++ b/lib/aweplug/helpers/cdn.rb @@ -9,18 +9,23 @@ # _tmp/cdn with new file name, and return that file name class CDN - CDN_TMP_DIR = Pathname.new("_tmp").join("cdn") - CDN_CONTROL = Pathname.new("_cdn").join("cdn.yml") + TMP_DIR = Pathname.new("_tmp").join("cdn") + DIR = Pathname.new("_cdn") + CONTROL = DIR.join("cdn.yml") + EXPIRES_FILE = DIR.join("cdn_expires.htaccess") def initialize(ctx_path) - @tmp_dir = CDN_TMP_DIR.join ctx_path - FileUtils.mkdir_p(File.dirname(CDN_CONTROL)) + @tmp_dir = TMP_DIR.join ctx_path + FileUtils.mkdir_p(File.dirname(CONTROL)) FileUtils.mkdir_p(@tmp_dir) + if File.exists? EXPIRES_FILE + FileUtils.cp(EXPIRES_FILE, @tmp_dir.join(".htaccess")) + end end def version(name, ext, content) id = name + ext - yml = YAML::Store.new CDN_CONTROL + yml = YAML::Store.new CONTROL yml.transaction do yml[id] ||= { "build_no" => 0 } md5sum = Digest::MD5.hexdigest(content)
Add support for copying in a .htaccess file to the CDN dirs
diff --git a/lib/batsir/stage_worker.rb b/lib/batsir/stage_worker.rb index abc1234..def5678 100644 --- a/lib/batsir/stage_worker.rb +++ b/lib/batsir/stage_worker.rb @@ -21,6 +21,7 @@ @operation_queue.each do |operation| puts "Performing #{operation.class.to_s}" message = operation.execute(message) + return false if message.nil? end puts "Done" true
Stop operation execution once an operation returns nil
diff --git a/capistrano-github-releases.gemspec b/capistrano-github-releases.gemspec index abc1234..def5678 100644 --- a/capistrano-github-releases.gemspec +++ b/capistrano-github-releases.gemspec @@ -23,6 +23,6 @@ spec.add_dependency "highline", ">= 1.6.20" spec.add_dependency "dotenv", ">= 0.11.0" - spec.add_development_dependency "bundler", "~> 1.5" + spec.add_development_dependency "bundler", "~> 2.0" spec.add_development_dependency "rake" end
Update bundler requirement from ~> 1.5 to ~> 2.0 Updates the requirements on [bundler](https://github.com/bundler/bundler) to permit the latest version. - [Release notes](https://github.com/bundler/bundler/releases) - [Changelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md) - [Commits](https://github.com/bundler/bundler/commits/v2.0.0) Signed-off-by: dependabot[bot] <[email protected]>
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -30,7 +30,7 @@ config.mock_with :rspec config.use_transactional_fixtures = true - config.include Spree::TestingSupport::ControllerRequests + config.include Spree::TestingSupport::ControllerRequests, type: :controller config.include FactoryGirl::Syntax::Methods config.include Spree::TestingSupport::UrlHelpers
Fix spec helper for Rspec 3.2
diff --git a/githubqa.rb b/githubqa.rb index abc1234..def5678 100644 --- a/githubqa.rb +++ b/githubqa.rb @@ -0,0 +1,59 @@+#!/usr/bin/env ruby + +class SrcRepo + def initialize(root_repo_path, repo_name) + @root_repo_path = root_repo_path + @repo_name = repo_name + @repo_path = "#{root_repo_path}/#{repo_name}" + @score = 0 + @score_max = 1 + end + + def test_one + d = Dir.new(@repo_path) + fns_all = d.map{|fn| fn} + d.close() + + readme_have = !fns_all.select{ |file| file if file == "README.md" }.empty? + + if !readme_have then print "README wasn't found in #{@repo_path}\n" else @score += 1 end + + #travis_fn = fns_all.select { |file| file if file == ".travis.yml" } + #if not travis_fn then print ".travis.yml wasn't found\n" else @score += 1 end + end + + def score + @score + end + + def self.repo_test_all(root_repos_path) + repos = [] + d = Dir.new(root_repos_path) + d.map{|i| i}.select{|fn| fn if not fn =~ /\.$/ }.each do |repo_name| + repo_path = "#{root_repos_path}/#{repo_name}" + next if not File.directory?(repo_path) + r = SrcRepo.new(root_repos_path, repo_name) + r.test_one() + if not r then return False else repos.push(r) end + end + d.close() + return repos + end + + def to_s + "-- #{@root_repo_path} #{@repo_name} score=#{@score} score_max=#{@score_max}\n" + end +end + +def main(repos_path) + repos = SrcRepo.repo_test_all(repos_path) + + pts_score_possible = repos.count + pts_score_actual = 0 + repos.each { |r| pts_score_actual += r.score() } + + print "Possible score : #{pts_score_possible}\n" + print "Your current score: #{pts_score_actual}\n" +end + +main("/w/repos")
Add QA script in Ruby.
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -15,10 +15,10 @@ mocks_config.verify_partial_doubles = true end - # Lita calls `exit(false)` in a few places. If an RSpec example hits one of these calls and it wasn't - # explicitly stubbed, the example will stop at exactly that point, but will be reported by RSpec - # as having passed, and will also change RSpec's exit code to 1. This situation indicates either - # a missing stub or a real bug, so we catch it here and fail loudly. + # Lita calls `exit(false)` in a few places. If an RSpec example hits one of these calls and it + # wasn't explicitly stubbed, the example will stop at exactly that point, but will be reported by + # RSpec as having passed, and will also change RSpec's exit code to 1. This situation indicates + # either a missing stub or a real bug, so we catch it here and fail loudly. # # https://github.com/rspec/rspec-core/issues/2246 config.around do |example|
Fix line length RuboCop violation.
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,6 +4,7 @@ require 'rspec/rails' require 'rspec/autorun' require 'factory_girl_rails' +require File.expand_path("../dummy/spec/factories.rb", __FILE__) Rails.backtrace_cleaner.remove_silencers! @@ -22,12 +23,6 @@ end end -FactoryGirl.define do - factory :user do - sequence(:first_name){ |n| "Bob #{n}" } - end -end - def response_json(json) JSON.parse(json) end
Load factories defined in dummy app