diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/shared/rakefiles/xk.rake b/shared/rakefiles/xk.rake
index abc1234..def5678 100644
--- a/shared/rakefiles/xk.rake
+++ b/shared/rakefiles/xk.rake
@@ -19,6 +19,20 @@
Secrets.set_secrets(@secrets)
+ # This is temporary task to handle updates of existing clusters to Istio (GPII-3671)
+ sh_filter "sh -c '
+ # if there is no kubernetes_namespace resource in TF state
+ terragrunt state pull --terragrunt-working-dir \"live/#{@env}/k8s/gpii/istio\" | jq -er \".modules[].resources[\\\"kubernetes_namespace.gpii\\\"]\" >/dev/null
+ if [ \"$?\" -ne 0 ]; then
+
+ # and if gpii namespace exists
+ kubectl get ns gpii --request-timeout=\"5s\"
+ if [ \"$?\" -eq 0 ]; then
+
+ # import it to TF state
+ terragrunt import kubernetes_namespace.gpii gpii --terragrunt-working-dir \"live/#{@env}/k8s/gpii/istio\"
+ fi
+ fi'"
sh_filter "#{@exekube_cmd} #{args[:cmd]}", !args[:preserve_stderr].nil? if args[:cmd]
end
|
GPII-3671: Add Istio namespace migration code
|
diff --git a/lib/grafana/user.rb b/lib/grafana/user.rb
index abc1234..def5678 100644
--- a/lib/grafana/user.rb
+++ b/lib/grafana/user.rb
@@ -17,7 +17,7 @@
def switch_current_user_org(org_id)
endpoint = "/api/user/using/#{org_id}"
- @logger.info("Switching current user to Org ID #{id} (GET #{endpoint})") if @debug
+ @logger.info("Switching current user to Org ID #{org_id} (GET #{endpoint})") if @debug
return post_request(endpoint, {})
end
|
Fix setting current org with debugging on
|
diff --git a/lib/generators/translation_for_generator.rb b/lib/generators/translation_for_generator.rb
index abc1234..def5678 100644
--- a/lib/generators/translation_for_generator.rb
+++ b/lib/generators/translation_for_generator.rb
@@ -19,7 +19,7 @@ template 'model.rb.erb', File.join('app/models', class_path, "#{file_name}.rb")
end
- def create_migration
+ def create_translations_migration
migration_template 'migration.rb.erb', "db/migrate/create_#{table_name}"
end
|
Fix migration generator for >= 4.1
`create_migration` method is reserved
More details is here: https://github.com/muratguzel/letsrate/issues/76#issuecomment-76588483
|
diff --git a/lib/rubocop/cop/performance/reverse_each.rb b/lib/rubocop/cop/performance/reverse_each.rb
index abc1234..def5678 100644
--- a/lib/rubocop/cop/performance/reverse_each.rb
+++ b/lib/rubocop/cop/performance/reverse_each.rb
@@ -15,26 +15,27 @@ # [].reverse_each
class ReverseEach < Cop
MSG = 'Use `reverse_each` instead of `reverse.each`.'.freeze
+ UNDERSCORE = '_'.freeze
+
+ def_node_matcher :reverse_each?, <<-MATCHER
+ (send $(send array :reverse) :each)
+ MATCHER
def on_send(node)
- receiver, second_method = *node
- return unless second_method == :each
- return if receiver.nil?
- _, first_method = *receiver
- return unless first_method == :reverse
+ reverse_each?(node) do |receiver|
+ source_buffer = node.source_range.source_buffer
+ location_of_reverse = receiver.loc.selector.begin_pos
+ end_location = node.loc.selector.end_pos
- source_buffer = node.source_range.source_buffer
- location_of_reverse = receiver.loc.selector.begin_pos
- end_location = node.loc.selector.end_pos
-
- range = Parser::Source::Range.new(source_buffer,
- location_of_reverse,
- end_location)
- add_offense(node, range, MSG)
+ range = Parser::Source::Range.new(source_buffer,
+ location_of_reverse,
+ end_location)
+ add_offense(node, range, MSG)
+ end
end
def autocorrect(node)
- ->(corrector) { corrector.replace(node.loc.dot, '_') }
+ ->(corrector) { corrector.replace(node.loc.dot, UNDERSCORE) }
end
end
end
|
Modify ReverseEach to use NodePattern
|
diff --git a/spec/lib/everything/blog/output/media_spec.rb b/spec/lib/everything/blog/output/media_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/everything/blog/output/media_spec.rb
+++ b/spec/lib/everything/blog/output/media_spec.rb
@@ -0,0 +1,35 @@+require 'pp' # Helps prevent an error like: 'superclass mismatch for class File'
+require 'bundler/setup'
+Bundler.require(:default)
+require './lib/everything/blog/output/index'
+require 'fakefs/spec_helpers'
+require './spec/support/shared'
+require './spec/support/post_helpers'
+
+describe Everything::Blog::Output::Index do
+ include FakeFS::SpecHelpers
+ include PostHelpers
+
+ include_context 'with fakefs'
+ include_context 'create blog path'
+ include_context 'stub out blog output path'
+
+ include_context 'with fake png'
+
+ let(:source_media) do
+ # TODO: Need to create this with a source file... Which, remind me, is what
+ # again? Just a path? Yes, the Source::PostsFinder uses the media paths.
+ Everything::Blog::Source::Media.new(test_png_file_path)
+ end
+ let(:media) do
+ described_class.new(source_media)
+ end
+
+ #TODO: This is giving me some trouble when I try to add this new spec.
+ describe '#output_file_name' do
+ it 'is the source file name' do
+ expect(media.output_file_name).to eq('1x1_black_square.png')
+ end
+ end
+end
+
|
Add the start of a Output::Media spec
|
diff --git a/lib/roger_themes.rb b/lib/roger_themes.rb
index abc1234..def5678 100644
--- a/lib/roger_themes.rb
+++ b/lib/roger_themes.rb
@@ -3,3 +3,7 @@ module RogerThemes
# Your code goes here...
end
+
+require "roger_themes/middleware"
+require "roger_themes/processor"
+require "roger_themes/xc_finalizer"
|
Load middleware, processor and finalizers from lib root
|
diff --git a/lib/signore/repo.rb b/lib/signore/repo.rb
index abc1234..def5678 100644
--- a/lib/signore/repo.rb
+++ b/lib/signore/repo.rb
@@ -6,12 +6,14 @@
module Signore
class Repo
+ class << self
+ def default_path
+ dir = ENV.fetch('XDG_DATA_HOME') { File.expand_path('~/.local/share') }
+ Pathname.new(dir) / 'signore' / 'signatures.yml'
+ end
+ end
+
extend Forwardable
-
- def self.default_path
- dir = ENV.fetch('XDG_DATA_HOME') { File.expand_path('~/.local/share') }
- Pathname.new(dir) / 'signore' / 'signatures.yml'
- end
def initialize(path: self.class.default_path)
@path = path
|
Switch Repo to class << self
|
diff --git a/lib/stripe/order.rb b/lib/stripe/order.rb
index abc1234..def5678 100644
--- a/lib/stripe/order.rb
+++ b/lib/stripe/order.rb
@@ -13,12 +13,20 @@
def pay(params = {}, opts = {})
resp, opts = request(:post, resource_url + "/pay", params, opts)
- initialize_from(resp.data, opts)
+ Util.convert_to_stripe_object(resp.data, opts)
end
def return_order(params = {}, opts = {})
resp, opts = request(:post, resource_url + "/returns", params, opts)
- initialize_from(resp.data, opts)
+ Util.convert_to_stripe_object(resp.data, opts)
+ end
+
+ private def pay_url
+ resource_url + "/pay"
+ end
+
+ private def returns_url
+ resource_url + "/returns"
end
end
end
|
Add some private methods back to Order
|
diff --git a/test/lat_lng_test.rb b/test/lat_lng_test.rb
index abc1234..def5678 100644
--- a/test/lat_lng_test.rb
+++ b/test/lat_lng_test.rb
@@ -23,11 +23,11 @@ end
it 'returns x offset' do
- slippy_map_tile_number[:offset][:x].must_equal 0.3400497777777787
+ slippy_map_tile_number[:offset][:x].round(12).must_equal 0.340049777778
end
it 'returns y offset' do
- slippy_map_tile_number[:offset][:y].must_equal 0.36446621522523515
+ slippy_map_tile_number[:offset][:y].round(12).must_equal 0.364466215225
end
end
end
|
Make lat_lng test machine precision safe
|
diff --git a/spec/sinatra/activerecord/rake_spec.rb b/spec/sinatra/activerecord/rake_spec.rb
index abc1234..def5678 100644
--- a/spec/sinatra/activerecord/rake_spec.rb
+++ b/spec/sinatra/activerecord/rake_spec.rb
@@ -1,14 +1,15 @@ require 'spec_helper'
require 'fileutils'
-class ActiveRecord::Migration
- def migrate_with_quietness(*args)
+module MigrationWithQuiet
+ def migrate(*args)
suppress_messages do
- migrate_without_quietness(*args)
+ super(*args)
end
end
- alias_method_chain :migrate, :quietness
end
+
+ActiveRecord::Migration.send(:prepend, MigrationWithQuiet)
RSpec.describe "the rake tasks" do
before do
@@ -23,13 +24,14 @@ require 'rake'
require 'sinatra/activerecord/rake'
- class Rake::Task
- def invoke_with_reenable
- invoke_without_reenable
+ module TaskWithReenable
+ def invoke
+ super
reenable
end
- alias_method_chain :invoke, :reenable
end
+
+ Rake::Task.send(:prepend, TaskWithReenable)
end
after do
|
Replace removed method alias_method_chain with Module prepend
Replace removed method alias_method_chain (removed in Rails 6) with Module prepend
|
diff --git a/mini_magick.gemspec b/mini_magick.gemspec
index abc1234..def5678 100644
--- a/mini_magick.gemspec
+++ b/mini_magick.gemspec
@@ -9,6 +9,7 @@ s.platform = Gem::Platform::RUBY
s.summary = "Manipulate images with minimal use of memory via ImageMagick / GraphicsMagick"
s.description = ""
+ s.requirements << "You must have ImageMagick or GraphicsMagick installed"
s.authors = ["Corey Johnson", "Hampton Catlin", "Peter Kieltyka"]
s.email = ["probablycorey@gmail.com", "hcatlin@gmail.com", "peter@nulayer.com"]
|
Add external requirements to gemspec.
|
diff --git a/0_code_wars/grasshopper_debug_say_hello.rb b/0_code_wars/grasshopper_debug_say_hello.rb
index abc1234..def5678 100644
--- a/0_code_wars/grasshopper_debug_say_hello.rb
+++ b/0_code_wars/grasshopper_debug_say_hello.rb
@@ -0,0 +1,5 @@+# http://www.codewars.com/kata/grasshopper-debug-sayhello/
+# --- iteration 1 ---
+def say_hello(name)
+ "Hello, #{name}"
+end
|
Add code wars (8) - say hello
|
diff --git a/BHCDatabase/test/models/attendance_test.rb b/BHCDatabase/test/models/attendance_test.rb
index abc1234..def5678 100644
--- a/BHCDatabase/test/models/attendance_test.rb
+++ b/BHCDatabase/test/models/attendance_test.rb
@@ -20,4 +20,11 @@ assert_not @attendance.valid?
end
+ test 'index on user_id and meeting_id' do
+ @duplicate_attendance = @attendance.dup
+ assert_not @duplicate_attendance.valid?
+ assert_no_difference 'Attendance.count' do
+ @duplicate_attendance.save
+ end
+ end
end
|
Add test for index on user_id and meeting_id for an attendance.
|
diff --git a/config/initializers/secure_headers.rb b/config/initializers/secure_headers.rb
index abc1234..def5678 100644
--- a/config/initializers/secure_headers.rb
+++ b/config/initializers/secure_headers.rb
@@ -1,5 +1,5 @@ ::SecureHeaders::Configuration.configure do |config|
- config.hsts = {:max_age => 1.month.to_i}
+ config.hsts = {:max_age => 1.year.to_i}
config.x_frame_options = 'DENY'
config.x_content_type_options = "nosniff"
config.x_xss_protection = {:value => 1, :mode => 'block'}
|
Set HSTS to 1 year
|
diff --git a/config.ru b/config.ru
index abc1234..def5678 100644
--- a/config.ru
+++ b/config.ru
@@ -1,8 +1,4 @@ # This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
-
-# Let rack know if we're running relative to a subdirectory
-Rails.application.config.relative_url_root || "/" do
- run Rails.application
-end
+run Rails.application
|
Revert "Let rack know if we're running relative to a subdirectory"
This reverts commit 2c03f05bb3d48f02472cf096fbdf0d069bc21583.
|
diff --git a/app/controllers/admin/admin_controller.rb b/app/controllers/admin/admin_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/admin/admin_controller.rb
+++ b/app/controllers/admin/admin_controller.rb
@@ -9,7 +9,6 @@
before_action :set_appsignal_namespace
before_action :do_not_cache
- before_action :respond_with_forbidden_if_ip_blocked
layout 'admin'
@@ -25,11 +24,5 @@ def set_appsignal_namespace
Appsignal.set_namespace("admin")
end
-
- def respond_with_forbidden_if_ip_blocked
- if ip_blocked?
- raise AccessDenied, "You are not permitted to access this page"
- end
- end
end
end
|
Remove ip restriction on admin page
|
diff --git a/app/controllers/admin/cards_controller.rb b/app/controllers/admin/cards_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/admin/cards_controller.rb
+++ b/app/controllers/admin/cards_controller.rb
@@ -9,7 +9,11 @@ end
def update
-
+ if @card.update(card_params)
+ redirect_to admin_cards_path, notice: 'Update successful.'
+ else
+ render :edit
+ end
end
def move_higher
@@ -29,6 +33,6 @@ end
def card_params
- params.require(:card).permit(:description, :link)
+ params.require(:card).permit(:description, :link, :background)
end
end
|
Allow card to be updated
|
diff --git a/app/controllers/communities_controller.rb b/app/controllers/communities_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/communities_controller.rb
+++ b/app/controllers/communities_controller.rb
@@ -1,8 +1,6 @@ class CommunitiesController < ApplicationController
- TOPIC_ORDERS = %w[newest most_commented oldest].freeze
- before_action :set_order, :set_community, :load_topics, :load_participants
-
- has_orders TOPIC_ORDERS
+ has_orders %w[newest most_commented oldest]
+ before_action :set_community, :load_topics, :load_participants
skip_authorization_check
@@ -14,26 +12,18 @@
private
- def set_order
- @order = valid_order? ? params[:order] : "newest"
- end
-
def set_community
@community = Community.find(params[:id])
end
def load_topics
- @topics = @community.topics.send("sort_by_#{@order}").page(params[:page])
+ @topics = @community.topics.send("sort_by_#{@current_order}").page(params[:page])
end
def load_participants
@participants = @community.participants
end
- def valid_order?
- params[:order].present? && TOPIC_ORDERS.include?(params[:order])
- end
-
def communitable_exists?
@community.proposal.present? || @community.investment.present?
end
|
Remove redundant method to set order
It was being incorrectly detected as used in a dangerous send. We can
get rid of the warning by taking advantage of the `has_orders` method
and getting rid of this code.
|
diff --git a/lib/merb-settings/adapters/datamapper/model.rb b/lib/merb-settings/adapters/datamapper/model.rb
index abc1234..def5678 100644
--- a/lib/merb-settings/adapters/datamapper/model.rb
+++ b/lib/merb-settings/adapters/datamapper/model.rb
@@ -22,7 +22,7 @@ base.class_eval do
property :id, Integer, :serial => true
property :name, String
- property :value, String
+ property :value, String, :length => 255
property :scope_id, String
property :scope_type, String
property :created_at, DateTime
|
Allow for longer Setting values.
|
diff --git a/app/models/placement.rb b/app/models/placement.rb
index abc1234..def5678 100644
--- a/app/models/placement.rb
+++ b/app/models/placement.rb
@@ -1,10 +1,4 @@ class Placement < ActiveRecord::Base
belongs_to :couple
belongs_to :event
-
- # Returns a string representation of the rank suitable for display to the
- # user. Present to match the signature of {SubPlacement::rank_to_s}
- def rank_to_s
- rank.to_s
- end
end
|
Remove unused `rank_to_s` from `Placement`
This was from when I was still figuring out the appropriate interface
for converting the rank.
|
diff --git a/spec/capi/spec_helper.rb b/spec/capi/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/capi/spec_helper.rb
+++ b/spec/capi/spec_helper.rb
@@ -12,8 +12,23 @@ # TODO use Tap; write a common ext build task
if RUBY_NAME == 'rbx'
`./bin/rbx compile -I#{Rubinius::HDR_PATH} #{ext_source}`
+ elsif RUBY_NAME == 'ruby'
+ cc = Config::CONFIG["CC"]
+ hdrdir = Config::CONFIG["archdir"]
+ cflags = Config::CONFIG["CFLAGS"]
+ incflags = "-I#{path} -I#{hdrdir}"
+
+ `#{cc} #{incflags} #{cflags} -c #{ext_source}`
+
+ ldshared = Config::CONFIG["LDSHARED"]
+ libpath = "-L#{path}"
+ libs = Config::CONFIG["LIBS"]
+ dldflags = Config::CONFIG["DLDFLAGS"]
+ obj = File.basename(ext_source, ".c") + ".o"
+
+ `#{ldshared} -o #{ext} #{libpath} #{dldflags} #{libs} #{obj}`
else
- # TODO add compile commands for MRI
+ raise "Don't know how to build C extensions with #{RUBY_NAME}"
end
File.open(signature, "w") { |f| f.puts RUBY_NAME }
|
Fix building C-API spec extensions with MRI.
|
diff --git a/app/models/skill.rb b/app/models/skill.rb
index abc1234..def5678 100644
--- a/app/models/skill.rb
+++ b/app/models/skill.rb
@@ -4,6 +4,12 @@ before_save :set_refreshed_at
def set_refreshed_at
- self.new_record? ? self.refreshed_at = self.created_at.to_i : self
+ if self.new_record?
+ self.refreshed_at = Time.now.to_i
+ end
+ end
+
+ def update_refreshed_at
+ self.refreshed_at = Time.now.to_i
end
end
|
Set refreshed_at to current time upon record creation
|
diff --git a/plugins/provisioners/ansible/provisioner.rb b/plugins/provisioners/ansible/provisioner.rb
index abc1234..def5678 100644
--- a/plugins/provisioners/ansible/provisioner.rb
+++ b/plugins/provisioners/ansible/provisioner.rb
@@ -19,9 +19,15 @@ options << "--sudo-user=#{config.sudo_user}" if config.sudo_user
options << "--verbose" if config.verbose
+ # Assemble the full ansible-playbook command
command = (%w(ansible-playbook) << options << config.playbook).flatten
- Vagrant::Util::SafeExec.exec(*command)
+ # Write stdout and stderr data, since it's the regular Ansible output
+ command << { :notify => [:stdout, :stderr] }
+ Vagrant::Util::Subprocess.execute(*command) do |type, data|
+ puts "#{data}" if type == :stdout || type == :stderr
+ yield type, data if block_given?
+ end
end
end
end
|
Use Vagrant::Util::Subprocess.execute instead of SafeExec
|
diff --git a/features/support/matchers/expect_uploaded_csv_to_include.rb b/features/support/matchers/expect_uploaded_csv_to_include.rb
index abc1234..def5678 100644
--- a/features/support/matchers/expect_uploaded_csv_to_include.rb
+++ b/features/support/matchers/expect_uploaded_csv_to_include.rb
@@ -13,7 +13,7 @@ path = FakeSFTP.find_path('*.csv')
contents = path ? FakeSFTP.read(path) : ''
- CSV.parse(contents, headers: true, converters: [:numeric, :date_time, :boolean],
+ CSV.parse(contents, headers: true, converters: [:date_time, :boolean],
header_converters: :symbol, col_sep: '|')
end
|
Remove number parsing from FakeCSV reader
An appointment type of `50_54` was being coerced as a number
and resulting in `5054`. As we no longer have any numbers in the
CSV, we it is no longer required.
|
diff --git a/Casks/istat-menus4.rb b/Casks/istat-menus4.rb
index abc1234..def5678 100644
--- a/Casks/istat-menus4.rb
+++ b/Casks/istat-menus4.rb
@@ -2,7 +2,7 @@ version '4.22'
sha256 '4e6873b24d18578e359b9363f02b9c98bdeda999afab1aaa8802af254ecb35b6'
- url "http://s3.amazonaws.com/bjango/files/istatmenus4/istatmenus#{version}.zip"
+ url "https://s3.amazonaws.com/bjango/files/istatmenus4/istatmenus#{version}.zip"
homepage 'http://bjango.com/mac/istatmenus/'
license :unknown
|
Update istat menus 4 download link to https
|
diff --git a/app/controllers/export_controller.rb b/app/controllers/export_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/export_controller.rb
+++ b/app/controllers/export_controller.rb
@@ -0,0 +1,8 @@+class ExportController < ApplicationController
+ def start
+ render :update do |page|
+ page.replace_html :sidebar_content, :partial => 'start'
+ page.call "openSidebar"
+ end
+ end
+end
|
Use named constants for HTTP response codes.
|
diff --git a/app/controllers/uptime_controller.rb b/app/controllers/uptime_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/uptime_controller.rb
+++ b/app/controllers/uptime_controller.rb
@@ -31,7 +31,7 @@ render json: {status: "success"}, status: 200
else
easy.body_str.force_encoding('UTF-8')
- render json: {status: "failed", errorMessage: error_message, content: JSON.generate(easy.body_str, quirks_mode: true)}, status: 200
+ render json: {status: "failed", errorMessage: error_message, content: easy.body_str}, status: 200
end
rescue => e
|
Fix encoding problem where uptime check on keyword fails
|
diff --git a/app/helpers/admin/editions_helper.rb b/app/helpers/admin/editions_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/admin/editions_helper.rb
+++ b/app/helpers/admin/editions_helper.rb
@@ -1,2 +1,15 @@ module Admin::EditionsHelper
+ def setup_association(object, associated, opts)
+ associated = object.send(associated.to_s) if associated.is_a? Symbol
+ associated = associated.is_a?(Array) ? associated : [associated] # preserve association proxy if this is one
+
+ opts.symbolize_keys!
+
+ (opts[:new] - associated.select(&:new_record?).length).times { associated.build } if opts[:new] and object.new_record? == true
+ if opts[:edit] and object.new_record? == false
+ (opts[:edit] - associated.count).times { associated.build }
+ elsif opts[:new_in_edit] and object.new_record? == false
+ opts[:new_in_edit].times { associated.build }
+ end
+ end
end
|
Add a helper that will make sure that we have a given number of associated objects. We use this to build relationships for our nested model forms
|
diff --git a/app/controllers/reservations_controller.rb b/app/controllers/reservations_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/reservations_controller.rb
+++ b/app/controllers/reservations_controller.rb
@@ -13,7 +13,7 @@ data_for_dropdowns
if @reservation.save
- flash.notice = t('reservations.created_message')
+ flash[:success] = t('reservations.created_message')
redirect_to reservations_path
else
render :new
|
Change flash type for success message
|
diff --git a/app/lib/contacts/distributed_lock.rb b/app/lib/contacts/distributed_lock.rb
index abc1234..def5678 100644
--- a/app/lib/contacts/distributed_lock.rb
+++ b/app/lib/contacts/distributed_lock.rb
@@ -10,25 +10,12 @@ end
def lock
- redis.lock("contacts-admin:#{Rails.env}:#{@lock_name}", life: LIFETIME) do
+ Redis.current.lock("contacts-admin:#{Rails.env}:#{@lock_name}", life: LIFETIME) do
Rails.logger.debug("Successfully got a lock. Running...")
yield
end
rescue Redis::Lock::LockNotAcquired => e
Rails.logger.debug("Failed to get lock for #{@lock_name} (#{e.message}). Another process probably got there first.")
end
-
- private
-
- def redis
- @redis ||= begin
- redis_config = {
- host: ENV["REDIS_HOST"] || "127.0.0.1",
- port: ENV["REDIS_PORT"] || 6379,
- }
-
- Redis.new(redis_config)
- end
- end
end
end
|
Remove need for REDIS_HOST and REDIS_PORT env vars
This is one of the few GOV.UK projects that uses this old approach to
configuring Redis - whereas most of the other ones use the approach
supported natively by the Redis gem [1] of using REDIS_URL. Removing
this will allow us to remove the need for REDIS_HOST and REDIS_PORT env
vars in our architecture and also allows this code to be simplified.
[1]: https://github.com/redis/redis-rb
|
diff --git a/app/models/bookyt_salary/employee.rb b/app/models/bookyt_salary/employee.rb
index abc1234..def5678 100644
--- a/app/models/bookyt_salary/employee.rb
+++ b/app/models/bookyt_salary/employee.rb
@@ -3,6 +3,9 @@ extend ActiveSupport::Concern
included do
+ # Associations
+ has_many :salaries, :foreign_key => :company_id
+
has_many :salary_templates, :foreign_key => :person_id
end
end
|
Include Employee.salaries association definition in BookytSalary::Employee.
|
diff --git a/opal-jquery.gemspec b/opal-jquery.gemspec
index abc1234..def5678 100644
--- a/opal-jquery.gemspec
+++ b/opal-jquery.gemspec
@@ -15,6 +15,6 @@ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.require_paths = ['lib']
- s.add_runtime_dependency 'opal', '>= 0.3.43'
+ s.add_runtime_dependency 'opal', '>= 0.4.2'
s.add_development_dependency 'opal-spec', '>= 0.2.15'
end
|
Fix the required opal version
Previous version was lacking #to_n and still using
#to_native.
|
diff --git a/app/presenters/redirect_presenter.rb b/app/presenters/redirect_presenter.rb
index abc1234..def5678 100644
--- a/app/presenters/redirect_presenter.rb
+++ b/app/presenters/redirect_presenter.rb
@@ -8,6 +8,7 @@ def render_for_publishing_api
{
content_id: redirect.content_id,
+ base_path: base_path,
format: 'redirect',
publishing_app: 'collections-publisher',
update_type: 'major',
|
Add base path to redirects.
|
diff --git a/app/models/event.rb b/app/models/event.rb
index abc1234..def5678 100644
--- a/app/models/event.rb
+++ b/app/models/event.rb
@@ -1,18 +1,22 @@ class Event < ActiveRecord::Base
- def self.find_lat_lon
+ def self.find_lat_lon max
self.find_by_sql <<-SQL
select st_x(point) as longitude, st_y(point) as latitude, id, unique_id, road_id, distance from
(
select st_line_interpolate_point(
st_transform(LineMerge(roads.the_geom), 4326),
- events.distance / st_length(roads.the_geom)
+ (events.distance - roads.begm) / (roads.endm - roads.begm)
) as point, events.id, events.unique_id, events.road_id, events.distance
from events
join roads on
- events.road_id = roads.tis_code AND
- events.distance > roads.begm AND
- events.distance <= roads.endm
- ) as event limit 10;
+ events.road_id = roads.tis_code and
+ events.distance >= roads.begm and
+ events.distance < roads.endm
+ where
+ roads.traf_dir in ('B', 'I')
+ order by
+ events.id
+ ) as event limit #{max}
SQL
end
end
|
Fix for bad point math; probably picked the right side of begm/endm to exclude; don't use roads in decreasing direction
|
diff --git a/app/models/event.rb b/app/models/event.rb
index abc1234..def5678 100644
--- a/app/models/event.rb
+++ b/app/models/event.rb
@@ -1,7 +1,6 @@ class Event < ApplicationRecord
has_many :shifts, dependent: :destroy
- validates :volunteers_needed, :starts_at, :ends_at, presence: true
validates :shift_length, :address, presence: true
end
|
Remove validations from Event model
|
diff --git a/app/models/field.rb b/app/models/field.rb
index abc1234..def5678 100644
--- a/app/models/field.rb
+++ b/app/models/field.rb
@@ -4,4 +4,41 @@ belongs_to :field_unit
has_many :parameter_group_fields
has_many :parameter_groups, through: :parameter_group_fields
+
+ default_scope { order 'name, length' }
+
+ def sel_name
+ "#{name}, #{length}"
+ end
+
+ def min_value_typed
+ case field_type_id
+ when 1, 2, 5, 6
+ if scaling < 1 && min_value != 0
+ return min_value
+ else
+ return min_value.to_i
+ end
+ when 3, 4
+ return min_value
+ else
+ return nil
+ end
+ end
+
+ def max_value_typed
+ case field_type_id
+ when 1, 2, 5, 6
+ if scaling < 1
+ return max_value
+ else
+ return max_value.to_i
+ end
+ when 3, 4
+ return max_value
+ else
+ return nil
+ end
+ end
end
+
|
Add formatted values and default scope
|
diff --git a/attributes/pagespeed.rb b/attributes/pagespeed.rb
index abc1234..def5678 100644
--- a/attributes/pagespeed.rb
+++ b/attributes/pagespeed.rb
@@ -5,5 +5,5 @@ default['nginx']['pagespeed']['version'] = '1.11.33.2'
default['nginx']['pagespeed']['url'] = "https://github.com/pagespeed/ngx_pagespeed/archive/release-#{node['nginx']['pagespeed']['version']}-beta.tar.gz"
default['nginx']['psol']['url'] = "https://dl.google.com/dl/page-speed/psol/#{node['nginx']['pagespeed']['version']}.tar.gz"
-default['nginx']['pagespeed']['packages']['rhel'] = %w(gcc-c++ pcre-dev pcre-devel zlib-devel make)
-default['nginx']['pagespeed']['packages']['debian'] = %w(build-essential zlib1g-dev libpcre3 libpcre3-dev)
+default['nginx']['pagespeed']['packages']['rhel'] = %w(pcre-dev pcre-devel zlib-devel)
+default['nginx']['pagespeed']['packages']['debian'] = %w(zlib1g-dev libpcre3 libpcre3-dev)
|
Remove duplicate packages from the page speed module attributes
We're already installing these all in build-essential which comes in via the source recipe
Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
|
diff --git a/lib/deployable.rb b/lib/deployable.rb
index abc1234..def5678 100644
--- a/lib/deployable.rb
+++ b/lib/deployable.rb
@@ -1,5 +1,8 @@ require "deployable/version"
+unless Capistrano::Configuration.respond_to?(:instance)
+ abort "This extension requires Capistrano 2"
+end
+
module Deployable
- # Your code goes here...
end
|
Make sure we have capistrano 2.x
|
diff --git a/periodicity.gemspec b/periodicity.gemspec
index abc1234..def5678 100644
--- a/periodicity.gemspec
+++ b/periodicity.gemspec
@@ -1,14 +1,22 @@ # -*- encoding: utf-8 -*-
require File.expand_path('../lib/periodicity/version', __FILE__)
-Gem::Specification.new do |gem|
- gem.name = 'periodicity'
- gem.version = Periodicity::VERSION
+Gem::Specification.new do |s|
+ s.name = "periodicity"
+ s.version = Periodicity::VERSION
+ s.authors = ["Dzmitry Plashchynski"]
+ s.email = ["plashchynski@gmail.com"]
+ s.homepage = "https://github.com/plashchynski/periodicity"
gem.description = gem.summary = "Job scheduler for Rails"
- gem.authors = ["Dzmitry Plashchynski"]
- gem.email = "plashchynski@gmail.com"
- gem.files = `git ls-files`.split("\n")
- gem.require_paths = ["lib"]
- gem.homepage = "https://github.com/plashchynski/periodicity"
- gem.license = "Apache-2.0"
+
+ s.required_rubygems_version = ">= 1.3.6"
+ s.rubyforge_project = "periodicity"
+
+ s.add_runtime_dependency "activejob"
+ s.add_development_dependency "bundler", ">= 1.0.0"
+ s.add_development_dependency "rspec"
+
+ s.files = `git ls-files`.split("\n")
+ s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
+ s.require_path = 'lib'
end
|
Update gemspec according to Bundler scaffold
|
diff --git a/app/models/competitions/blind_date_at_the_dairy_overall.rb b/app/models/competitions/blind_date_at_the_dairy_overall.rb
index abc1234..def5678 100644
--- a/app/models/competitions/blind_date_at_the_dairy_overall.rb
+++ b/app/models/competitions/blind_date_at_the_dairy_overall.rb
@@ -0,0 +1,36 @@+class BlindDateAtTheDairyOverall < Overall
+ def self.parent_event_name
+ "Blind Date at the Dairy"
+ end
+
+ def category_names
+ [
+ "Beginner Men",
+ "Beginner Women",
+ "Fixed",
+ "Junior Men 10-13",
+ "Junior Men 14-18",
+ "Junior Women 10-13",
+ "Junior Women 14-18",
+ "Masters Men A 40+",
+ "Masters Men B 35+",
+ "Masters Men C 35+",
+ "Men A",
+ "Men B",
+ "Men C",
+ "Singlespeed",
+ "Stampede",
+ "Women A",
+ "Women B",
+ "Women C"
+ ]
+ end
+
+ def default_bar_points
+ 1
+ end
+
+ def point_schedule
+ [ 0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 ]
+ end
+end
|
Add Blind Date series calculations
|
diff --git a/growl_windows.gemspec b/growl_windows.gemspec
index abc1234..def5678 100644
--- a/growl_windows.gemspec
+++ b/growl_windows.gemspec
@@ -1,6 +1,6 @@ Gem::Specification.new do |s|
s.name = "growl_windows"
- s.version = "0.1.0"
+ s.version = "0.1.1"
s.authors = "debbbbie"
s.date = "2013-12-09"
@@ -10,6 +10,10 @@ s.homepage = "https://github.com/debbbbie/growl_windows"
s.require_paths = ["lib"]
s.summary = "Make gem `growl` support windows"
+
+
+ s.add_dependency "growl"
+ s.add_development_dependency "rspec"
end
|
Add gem dependencis to gemspec
|
diff --git a/helpers/photoswipe_helpers.rb b/helpers/photoswipe_helpers.rb
index abc1234..def5678 100644
--- a/helpers/photoswipe_helpers.rb
+++ b/helpers/photoswipe_helpers.rb
@@ -3,7 +3,7 @@ size = image_size(image.url)
w = size.w
h = size.h
- link = link_to thumbnail(image, w: 200), image.url, 'data-size': "#{w}x#{h}", itemprop: 'contentUrl'
+ link = link_to thumbnail(image, w: 800), image.url, 'data-size': "#{w}x#{h}", itemprop: 'contentUrl'
#content_tag(:figure, link, itemprop: 'associatedMedia',
#itemscope: '',
|
Make thumbnail a little bigger
|
diff --git a/app/models/asset.rb b/app/models/asset.rb
index abc1234..def5678 100644
--- a/app/models/asset.rb
+++ b/app/models/asset.rb
@@ -26,8 +26,11 @@
has_attached_file :file
validates_presence_of :asset_type
- validates_attachment_content_type :file, content_type: %w(application/vnd.ms-excel
+ validates_attachment_content_type :file, content_type: %w(
+ application/vnd.ms-excel
+ application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
application/vnd.ms-powerpoint
+ application/vnd.openxmlformats-officedocument.presentationml.presentation
application/msword
application/vnd.openxmlformats-officedocument.wordprocessingml.document
application/pdf
|
Support a arquivos pptx e xlsx
|
diff --git a/app/models/image.rb b/app/models/image.rb
index abc1234..def5678 100644
--- a/app/models/image.rb
+++ b/app/models/image.rb
@@ -7,8 +7,8 @@
paginates_per 100
- validates :md5, uniqueness: { scope: :album_id },
- on: :create, message: 'This image already exists in the album'
+ validates :md5, on: :create,
+ uniqueness: { scope: :album_id }
before_validation :set_md5
after_commit :async_set_thumbnails, on: :create
|
Fix issue with md5 validation.
|
diff --git a/axiom-types.gemspec b/axiom-types.gemspec
index abc1234..def5678 100644
--- a/axiom-types.gemspec
+++ b/axiom-types.gemspec
@@ -14,7 +14,7 @@
gem.require_paths = %w[lib]
gem.files = `git ls-files`.split($/)
- gem.test_files = `git ls-files spec/{unit,integration}`.split($/)
+ gem.test_files = `git ls-files -- spec/unit`.split($/)
gem.extra_rdoc_files = %w[LICENSE README.md TODO]
gem.add_runtime_dependency('backports', '~> 3.1', '>= 3.1.1')
|
Fix path to test files
|
diff --git a/lib/heroku/command/json.rb b/lib/heroku/command/json.rb
index abc1234..def5678 100644
--- a/lib/heroku/command/json.rb
+++ b/lib/heroku/command/json.rb
@@ -13,7 +13,7 @@ json = File.read('heroku.json')
json = JSON.parse(json)
bootstrapper = Bootstrapper.new(api, app, json)
- Heroku::Helpers.confirm("This will cost you money by installing #{Heroku::Helpers.quantify('addons', json['addons'].count)}")
+ Heroku::Helpers.confirm_billing
bootstrapper.bootstrap
end
|
Switch to the standard heroku billing message
|
diff --git a/test/unit/csv_parser_test.rb b/test/unit/csv_parser_test.rb
index abc1234..def5678 100644
--- a/test/unit/csv_parser_test.rb
+++ b/test/unit/csv_parser_test.rb
@@ -8,10 +8,10 @@ end
test "can convert a CSV into an Array of Hash objects" do
- csv_string = <<~EOS
+ csv_string = <<~CSV
slug,tag
/foo,/bar
-EOS
+CSV
parser = CSVParser.new(StringIO.new(csv_string))
|
Use CSV rather than EOS for the heredoc
As this is more informative.
|
diff --git a/lib/exception_notification/resque.rb b/lib/exception_notification/resque.rb
index abc1234..def5678 100644
--- a/lib/exception_notification/resque.rb
+++ b/lib/exception_notification/resque.rb
@@ -13,7 +13,7 @@ failed_at: Time.now.to_s,
payload: payload,
queue: queue,
- worker: worker.to_s,
+ worker: worker.to_s
}
ExceptionNotifier.notify_exception(exception, data: { resque: data })
|
Fix syntax error and Style/TrailingCommaInLiteral offense
|
diff --git a/lib/generators/delayed/web/install_generator.rb b/lib/generators/delayed/web/install_generator.rb
index abc1234..def5678 100644
--- a/lib/generators/delayed/web/install_generator.rb
+++ b/lib/generators/delayed/web/install_generator.rb
@@ -4,7 +4,7 @@ source_root File.expand_path('../templates', __FILE__)
desc 'Installs Delayed::Web'
- def installe
+ def install
template 'initializer.rb', 'config/initializers/delayed_web.rb'
route 'mount Delayed::Web::Engine, at: \'/jobs\''
end
|
Fix typo in method name.
|
diff --git a/lib/generators/paper_trail/install_generator.rb b/lib/generators/paper_trail/install_generator.rb
index abc1234..def5678 100644
--- a/lib/generators/paper_trail/install_generator.rb
+++ b/lib/generators/paper_trail/install_generator.rb
@@ -8,7 +8,7 @@ extend ActiveRecord::Generators::Migration
source_root File.expand_path('../templates', __FILE__)
- class_option :with_changes, :type => :boolean, :default => false, :description => "Storage changeset of objects"
+ class_option :with_changes, :type => :boolean, :default => false, :desc => "Store changeset (diff) with each version"
desc 'Generates (but does not run) a migration to add a versions table.'
|
Fix description option and update text.
|
diff --git a/lib/pry/commands/watch_expression/expression.rb b/lib/pry/commands/watch_expression/expression.rb
index abc1234..def5678 100644
--- a/lib/pry/commands/watch_expression/expression.rb
+++ b/lib/pry/commands/watch_expression/expression.rb
@@ -1,34 +1,28 @@ class Pry
class Command::WatchExpression
class Expression
- NODUP = [TrueClass, FalseClass, NilClass, Numeric, Symbol].freeze
attr_reader :target, :source, :value, :previous_value
def initialize(target, source)
@target = target
- @source = source
+ @source = Code.new(source).strip
end
def eval!
- @previous_value = value
- @value = target_eval(target, source)
- @value = @value.dup unless NODUP.any? { |klass| klass === @value }
+ @previous_value = @value
+ @value = Pry::ColorPrinter.pp(target_eval(target, source), "")
end
def to_s
- "#{print_source} => #{print_value}"
+ "#{source} => #{value}"
end
+ # Has the value of the expression changed?
+ #
+ # We use the pretty-printed string represenation to detect differences
+ # as this avoids problems with dup (causes too many differences) and == (causes too few)
def changed?
(value != previous_value)
- end
-
- def print_value
- Pry::ColorPrinter.pp(value, "")
- end
-
- def print_source
- Code.new(source).strip
end
private
|
Use string difference in watch
|
diff --git a/lib/anaconda/form_builder_helpers.rb b/lib/anaconda/form_builder_helpers.rb
index abc1234..def5678 100644
--- a/lib/anaconda/form_builder_helpers.rb
+++ b/lib/anaconda/form_builder_helpers.rb
@@ -1,7 +1,7 @@ module Anaconda
module FormBuilderHelpers
- def anaconda_form_fields( anaconda_field_name )
+ def anaconda( anaconda_field_name )
output = ""
output += self.hidden_field "#{anaconda_field_name}_filename".to_sym
|
Rename form builder helper to just 'anaconda'
|
diff --git a/cookbooks/ondemand_base/recipes/ubuntu.rb b/cookbooks/ondemand_base/recipes/ubuntu.rb
index abc1234..def5678 100644
--- a/cookbooks/ondemand_base/recipes/ubuntu.rb
+++ b/cookbooks/ondemand_base/recipes/ubuntu.rb
@@ -9,9 +9,10 @@ include_recipe "openssh"
include_recipe "ntp"
-#Use experience recipes
+#User experience and tools recipes
include_recipe "vim"
include_recipe "man"
+include_recipe "networking_basic"
# Install useful tools
|
Add networking_basic cookbook to Ubuntu
|
diff --git a/schema.gemspec b/schema.gemspec
index abc1234..def5678 100644
--- a/schema.gemspec
+++ b/schema.gemspec
@@ -2,7 +2,7 @@ Gem::Specification.new do |s|
s.name = 'evt-schema'
s.summary = "Primitives for schema and data structure"
- s.version = '2.3.1.1'
+ s.version = '2.3.1.3'
s.description = ' '
s.authors = ['The Eventide Project']
|
Package version increased from 2.3.1.2 to 2.3.1.3
|
diff --git a/lib/puppet/indirector/node/stacks.rb b/lib/puppet/indirector/node/stacks.rb
index abc1234..def5678 100644
--- a/lib/puppet/indirector/node/stacks.rb
+++ b/lib/puppet/indirector/node/stacks.rb
@@ -22,7 +22,7 @@ node = super
classes = find_stack_classes(node.parameters['fqdn'])
if classes
- node.classes = machine.to_enc
+ node.classes = classes
end
return node
end
|
Fix blowing up gary found. Why do we have no tests for this???
|
diff --git a/lib/submit_once/controller_helper.rb b/lib/submit_once/controller_helper.rb
index abc1234..def5678 100644
--- a/lib/submit_once/controller_helper.rb
+++ b/lib/submit_once/controller_helper.rb
@@ -42,11 +42,15 @@ [@__form_token_key, @__form_token]
end
+ def clean_expired_token_probably
+ clean_expired_token if rand < 0.5
+ end
+
def clean_expired_token
session.to_hash.each do |key, value|
if key.start_with? TOKEN_KEY
timestamp = Time.zone.at key.sub(TOKEN_KEY, '').to_i
- session.delete(key) if timestamp < 30.minutes.ago
+ session.delete(key) if timestamp < 10.minutes.ago
end
end
end
|
Add random clean expired token method; set expired time to 10 minutes
|
diff --git a/http-commands.gemspec b/http-commands.gemspec
index abc1234..def5678 100644
--- a/http-commands.gemspec
+++ b/http-commands.gemspec
@@ -1,6 +1,6 @@ Gem::Specification.new do |s|
s.name = 'http-commands'
- s.version = '0.0.2.2'
+ s.version = '0.0.2.3'
s.summary = 'Convenience abstractions for common HTTP operations, such as post and get'
s.description = ' '
|
Package version is increased from 0.0.2.2 to 0.0.2.3
|
diff --git a/Formula/kde-phonon.rb b/Formula/kde-phonon.rb
index abc1234..def5678 100644
--- a/Formula/kde-phonon.rb
+++ b/Formula/kde-phonon.rb
@@ -13,6 +13,8 @@ keg_only "This package is already supplied by Qt and is only needed by KDE packages."
def install
+ inreplace 'cmake/FindPhononInternal.cmake',
+ 'BAD_ALLOCATOR AND NOT WIN32', 'BAD_ALLOCATOR AND NOT APPLE'
system "cmake . #{std_cmake_parameters}"
system "make install"
end
|
Patch phonon-kde to avoid incorrect error.
Fixes Homebrew/homebrew#5480.
|
diff --git a/sample/spec/lib/load_sample_spec.rb b/sample/spec/lib/load_sample_spec.rb
index abc1234..def5678 100644
--- a/sample/spec/lib/load_sample_spec.rb
+++ b/sample/spec/lib/load_sample_spec.rb
@@ -1,6 +1,15 @@ require 'spec_helper'
describe "Load samples" do
+ before do
+ # Seeds are only run for rake test_app so to allow this spec to pass without
+ # rerunning rake test_app every time we must load them in if not already.
+ unless Spree::Zone.find_by_name("North America")
+ load Rails.root + 'Rakefile'
+ load Rails.root + 'db/seeds.rb'
+ end
+ end
+
it "doesn't raise any error" do
expect {
SpreeSample::Engine.load_samples
|
Fix rerunning sample specs without new dummy app.
|
diff --git a/rb/spec/unit/selenium/webdriver/remote/http/default_spec.rb b/rb/spec/unit/selenium/webdriver/remote/http/default_spec.rb
index abc1234..def5678 100644
--- a/rb/spec/unit/selenium/webdriver/remote/http/default_spec.rb
+++ b/rb/spec/unit/selenium/webdriver/remote/http/default_spec.rb
@@ -29,6 +29,8 @@ http.proxy_port.should == 8080
http.proxy_user.should == "foo"
http.proxy_pass.should == "bar"
+
+ http.address.should == "example.com"
end
it "raises an error if the proxy is not an HTTP proxy" do
|
JariBakken: Update spec to check host of proxied HTTP client.
r10680
|
diff --git a/bin/git_gem_diff.rb b/bin/git_gem_diff.rb
index abc1234..def5678 100644
--- a/bin/git_gem_diff.rb
+++ b/bin/git_gem_diff.rb
@@ -0,0 +1,48 @@+#!/usr/bin/ruby
+# Diff a Git Gem Against its Rubygems equivalent
+#
+# ./git_gem_diff.rb
+#
+# Licensed under the MIT license
+# Copyright (C) 2014 Red Hat, Inc.
+###########################################################
+
+require 'colored'
+require 'polisher/git/pkg'
+require 'polisher/git/repo'
+
+conf = { :git => nil}
+
+optparse = OptionParser.new do |opts|
+ opts.on('-h', '--help', 'Display this help screen') do
+ puts opts
+ exit
+ end
+
+ opts.on('-g', '--git [url]', 'url') do |url|
+ conf[:git] = url
+ end
+end
+
+optparse.parse!
+
+if conf[:git].nil?
+ puts "Must specify a git url".bold.red
+ exit 1
+end
+
+git = Polisher::Git::Repo.new :url => conf[:git]
+git.clone unless git.cloned?
+
+name, version = nil
+
+git.in_repo do
+ gemspec_path = Dir.glob('*.gemspec').first
+ gem = Polisher::Gem.from_gemspec gemspec_path
+ name = gem.name
+ version = gem.version
+end
+
+gem = Polisher::Gem.from_rubygems name, version
+diff = gem.diff(git)
+puts diff
|
Add cmd-line utility to diff a git repo against a rubygem
|
diff --git a/lib/sequent/test/database_helpers.rb b/lib/sequent/test/database_helpers.rb
index abc1234..def5678 100644
--- a/lib/sequent/test/database_helpers.rb
+++ b/lib/sequent/test/database_helpers.rb
@@ -3,11 +3,13 @@ module Sequent
module Test
module DatabaseHelpers
+ ALLOWED_ENS = %w[development test spec].freeze
+
class << self
# Utility method to let Sequent handle creation of sequent_schema and view_schema
# rather than using the available rake tasks.
def maintain_test_database_schema(env: 'test')
- fail ArgumentError, "env must be test or spec but was '#{env}'" unless %w[test spec].include?(env)
+ fail ArgumentError, "env must one of [#{ALLOWED_ENS.join(',')}] '#{env}'" unless ALLOWED_ENS.include?(env)
Migrations::SequentSchema.create_sequent_schema_if_not_exists(env: env, fail_if_exists: false)
Migrations::ViewSchema.create_view_tables(env: env)
|
Allow maintain_test_database_schema usage for development as well
Handy if you programmatically want to create the database schema in development.
|
diff --git a/lib/uri/query_params/query_params.rb b/lib/uri/query_params/query_params.rb
index abc1234..def5678 100644
--- a/lib/uri/query_params/query_params.rb
+++ b/lib/uri/query_params/query_params.rb
@@ -44,16 +44,15 @@ query = []
query_params.each do |name,value|
- param = if value == true
+ param = case value
+ when Array
+ "#{name}=#{CGI.escape(value.join(' '))}"
+ when true
"#{name}=active"
- elsif value
- if value.kind_of?(Array)
- "#{name}=#{CGI.escape(value.join(' '))}"
- else
- "#{name}=#{CGI.escape(value.to_s)}"
- end
+ when false, nil
+ "#{name}="
else
- "#{name}="
+ "#{name}=#{CGI.escape(value.to_s)}"
end
query << param
|
Use a case/when statement in QueryParams.dump.
|
diff --git a/test/application/config/environment.rb b/test/application/config/environment.rb
index abc1234..def5678 100644
--- a/test/application/config/environment.rb
+++ b/test/application/config/environment.rb
@@ -1,4 +1,4 @@-RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
+RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
require File.join(File.dirname(__FILE__), 'boot')
require 'plugin_under_test_locator'
|
Update baseline Rails version to 2.3.5
|
diff --git a/test/support/model_stubbing_helpers.rb b/test/support/model_stubbing_helpers.rb
index abc1234..def5678 100644
--- a/test/support/model_stubbing_helpers.rb
+++ b/test/support/model_stubbing_helpers.rb
@@ -1,11 +1,6 @@ module ModelStubbingHelpers
def stub_record(type, options = {})
- result = build(type, options)
- result.stubs(:id).returns(next_record_id)
- result.stubs(:new_record?).returns(false)
- result.stubs(:created_at).returns(Time.zone.now) if result.respond_to?(:created_at)
- result.stubs(:updated_at).returns(Time.zone.now) if result.respond_to?(:updated_at)
- result
+ build_stubbed(type, options)
end
def stub_edition(type, options = {})
|
Use FactoryGirl.build_stubbed instead of a hand-rolled solution.
`FactoryGirl.build_stubbed` takes care of all this (and more).
I had run into problems with the previous implementation where, because
the "stub record" was still an instance of the `ActiveRecord::Base`
subclass (albeit with lots of stubbed method), and because its
`#new_record?` method returned `true`, it was possible for a database
query to be initiated by something as simple as inspecting the record or
calling an association method.
This problem was compounded in the cases I saw, because Mocha tried to
report the unexpected invocation of `select` on the `ActiveRecord`
connection, but in doing so it also wanted to list the stubbed methods
on the record. The latter caused a recursive call to the record's
`#inspect` method and an eventual stack overflow error.
|
diff --git a/section02/lesson02/straight_eight_boogie.rb b/section02/lesson02/straight_eight_boogie.rb
index abc1234..def5678 100644
--- a/section02/lesson02/straight_eight_boogie.rb
+++ b/section02/lesson02/straight_eight_boogie.rb
@@ -3,7 +3,7 @@
def straight_eight_boogie_alternating_treble(note, quality = :major, regression: true, first: false)
sleep MINIM if first
- 8.times do
+ (regression ? 8 : 4).times do
play chord(note, quality), amp: 2, sustain: SEMIBREVE
sleep SEMIBREVE
end
|
Allow straight eight boogie alternating to support a regression
|
diff --git a/spec/factories/janus_instance.rb b/spec/factories/janus_instance.rb
index abc1234..def5678 100644
--- a/spec/factories/janus_instance.rb
+++ b/spec/factories/janus_instance.rb
@@ -1,7 +1,7 @@ # frozen_string_literal: true
FactoryBot.define do
- factory :janus_instance, class: RubyRabbitmqJanus::Models::JanusInstance do
+ factory :janus_instance, class: 'RubyRabbitmqJanus::Models::JanusInstance' do
enable { true }
end
end
|
Fix rule factory class name
|
diff --git a/spec/models/coronavirus/live_stream_spec.rb b/spec/models/coronavirus/live_stream_spec.rb
index abc1234..def5678 100644
--- a/spec/models/coronavirus/live_stream_spec.rb
+++ b/spec/models/coronavirus/live_stream_spec.rb
@@ -10,17 +10,12 @@ end
it "is invalid without a url" do
- expect(described_class.create).not_to be_valid
+ expect(build(:live_stream, url: nil)).not_to be_valid
end
it "it requires a valid url" do
- expect { described_class.create!(url: bad_url) }.to raise_error(ActiveRecord::RecordInvalid)
- expect(described_class.create(url: good_url)).to be_valid
- end
-
- it "has a formatted_stream_date column that is neither required nor validated" do
- expect(described_class.create(url: good_url, formatted_stream_date: "1 April 2020")).to be_valid
- expect(described_class.create(url: good_url, formatted_stream_date: "")).to be_valid
+ expect(build(:live_stream, url: bad_url)).not_to be_valid
+ expect(build(:live_stream, url: good_url)).to be_valid
end
end
end
|
Use FactoryBot for validating Coronavirus::LiveStream
This is a more conventional approach for setting the model up
validation. It also using build rather than create which saves having to
hit the DB for a test.
This removes the tests for formatted_stream_date as it seems rather
unconventional to have tests that it's not validated.
|
diff --git a/db/migrate/1_create_retailers_retailers.rb b/db/migrate/1_create_retailers_retailers.rb
index abc1234..def5678 100644
--- a/db/migrate/1_create_retailers_retailers.rb
+++ b/db/migrate/1_create_retailers_retailers.rb
@@ -10,7 +10,7 @@ t.string :fax
t.string :email
t.string :website
- t.boolean :draft
+ t.boolean :draft, default: true
t.integer :position
t.timestamps
|
Add default true to draft
|
diff --git a/lib/asciidoctor/latex/inject_html.rb b/lib/asciidoctor/latex/inject_html.rb
index abc1234..def5678 100644
--- a/lib/asciidoctor/latex/inject_html.rb
+++ b/lib/asciidoctor/latex/inject_html.rb
@@ -27,20 +27,32 @@
<script>
- $(document).ready(function(){
- $('.openblock.click').click( function() { $(this).find('.content').slideToggle('200');
- $.reloadMathJax() } )
- $('.openblock.click').find('.content').hide()
- });
-
- $(document).ready(function(){
- $('.listingblock.click').click( function() { $(this).find('.content').slideToggle('200') } )
- $('.listingblock.click').find('.content').hide()
- });
- $(document).ready(ready);
- $(document).on('page:load', ready);
+var ready2;
+
+ready2 = function() {
+
+ $(document).ready(function(){
+
+ $('.openblock.click').click( function() { $(this).find('.content').slideToggle('200'); } )
+ $('.openblock.click').find('.content').hide()
+
+
+ $('.listingblock.click').click( function() { $(this).find('.content').slideToggle('200') } )
+ $('.listingblock.click').find('.content').hide()
+
+ });
+
+}
+
+
+
+
+$(document).ready(ready2);
+$(document).on('page:load', ready2);
+
+
</script>
</head>
|
Fix error in js code so that click blocks now function properly (hide/unhide)
|
diff --git a/lib/cinch/plugins/pax-timer/paxes.rb b/lib/cinch/plugins/pax-timer/paxes.rb
index abc1234..def5678 100644
--- a/lib/cinch/plugins/pax-timer/paxes.rb
+++ b/lib/cinch/plugins/pax-timer/paxes.rb
@@ -22,8 +22,8 @@ estimated: true },
{ type: 'east',
name: 'PAX East',
- date: Time.parse('2016-04-22 08:00:00 -05:00'),
- estimated: false }
+ date: Time.parse('2017-03-10 08:00:00 -05:00'),
+ estimated: true }
]
end
end
|
Add expected East 2017 date
From https://web.archive.org/web/20150406071050/http://massconvention.com/events/2017/02
|
diff --git a/lib/solidus_cmd/templates/extension/extension.gemspec b/lib/solidus_cmd/templates/extension/extension.gemspec
index abc1234..def5678 100644
--- a/lib/solidus_cmd/templates/extension/extension.gemspec
+++ b/lib/solidus_cmd/templates/extension/extension.gemspec
@@ -11,7 +11,7 @@
# s.author = 'You'
# s.email = 'you@example.com'
- # s.homepage = 'TODO'
+ # s.homepage = 'http://www.example.com'
s.files = Dir["{app,config,db,lib}/**/*", "LICENSE", "Rakefile", "README.md"]
s.test_files = Dir["test/**/*"]
|
Use example.com in sample gemspec
|
diff --git a/spec/controllers/gestionnaires/passwords_controller_spec.rb b/spec/controllers/gestionnaires/passwords_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/gestionnaires/passwords_controller_spec.rb
+++ b/spec/controllers/gestionnaires/passwords_controller_spec.rb
@@ -17,11 +17,11 @@ end
it "also signs user in" do
- put :update, gestionnaire: {
+ put :update, params: {gestionnaire: {
reset_password_token: @token,
password: "supersecret",
password_confirmation: "supersecret",
- }
+ }}
expect(subject.current_gestionnaire).to eq(gestionnaire)
expect(subject.current_user).to eq(user)
end
|
Fix DEPRECATION WARNING for spec/controllers/gestionnaires/*.rb
|
diff --git a/acceptance/output/plugin_output.rb b/acceptance/output/plugin_output.rb
index abc1234..def5678 100644
--- a/acceptance/output/plugin_output.rb
+++ b/acceptance/output/plugin_output.rb
@@ -13,7 +13,7 @@
# Tests that plugin list shows a plugin
OutputTester[:plugin_list_plugin] = lambda do |text, name, version|
- text =~ /^#{name} \(#{version}\)$/
+ text =~ /^#{name} \(#{version}\, global)$/
end
# Tests that Vagrant plugin install fails to a plugin not found
|
Update plugin output pattern to include global context
|
diff --git a/bin/transmission.rb b/bin/transmission.rb
index abc1234..def5678 100644
--- a/bin/transmission.rb
+++ b/bin/transmission.rb
@@ -6,9 +6,19 @@ require 'lib/transmission-connect'
CONFIG = "config/transmission.yml"
-result = []
+@exit = false
-while true
+trap("INT") do
+ EventMachine::stop_event_loop
+ @exit = true
+end
+
+trap("TERM") do
+ EventMachine::stop_event_loop
+ @exit = true
+end
+
+while !@exit
begin
EventMachine.run do
transmission = Configuration.new(YAML.load_file(CONFIG))
|
Handle system signals and correct exit from app
|
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index abc1234..def5678 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -3,6 +3,7 @@ # Cloudsdale::Application.config.session_store :mongo_store, key: '_cloudsdale_session', collection: lambda { Mongoid.master.collection('sessions') }
Cloudsdale::Application.config.session_store :redis_store,
+ expire_in: 259200,
:servers => {
:host => Cloudsdale.config['redis']['host'],
:port => Cloudsdale.config['redis']['port'],
|
Expire the redis session in 72 hours.
|
diff --git a/lib/mios/services/dimmable_light1.rb b/lib/mios/services/dimmable_light1.rb
index abc1234..def5678 100644
--- a/lib/mios/services/dimmable_light1.rb
+++ b/lib/mios/services/dimmable_light1.rb
@@ -9,9 +9,9 @@ end
def set_level!(new_level, async=false, &block)
- new_level = new_load_level.to_i
- new_level = 100 if new_load_level > 100
- new_level = 0 if new_load_level < 0
+ new_level = new_level.to_i
+ new_level = 100 if new_level > 100
+ new_level = 0 if new_level < 0
set(URN, 'SetLoadLevelTarget', { "newLoadlevelTarget" => new_level }, async, &block)
end
end
|
Fix variable reference with dimmer control
|
diff --git a/knife-windows.gemspec b/knife-windows.gemspec
index abc1234..def5678 100644
--- a/knife-windows.gemspec
+++ b/knife-windows.gemspec
@@ -15,7 +15,7 @@ s.description = s.summary
s.required_ruby_version = ">= 1.9.1"
- s.add_dependency "em-winrm", "= 0.5.4.rc.1"
+ s.add_dependency "em-winrm", "= 0.5.4"
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
Remove RC dependency on em-winrm, bump to release
|
diff --git a/rblib/url_mapper.rb b/rblib/url_mapper.rb
index abc1234..def5678 100644
--- a/rblib/url_mapper.rb
+++ b/rblib/url_mapper.rb
@@ -34,8 +34,13 @@ end
# Prefixes a relative URL with the domain definted in DOMAIN in the config
- def main_url(relative_path)
- url_prefix = "http://" + MySociety::Config.get("DOMAIN", '127.0.0.1:3000')
+ def main_url(relative_path, options={})
+ if options[:skip_protocol]
+ url_prefix = ''
+ else
+ url_prefix = 'http://'
+ end
+ url_prefix += MySociety::Config.get("DOMAIN", '127.0.0.1:3000')
return url_prefix + relative_path
end
|
Allow for an option to skip the protocol part of the url - useful in rails caching.
|
diff --git a/recipes/textmate.rb b/recipes/textmate.rb
index abc1234..def5678 100644
--- a/recipes/textmate.rb
+++ b/recipes/textmate.rb
@@ -2,7 +2,7 @@
unless File.exists?("/Applications/TextMate.app")
execute "download text mate to temp dir" do
- command "curl -o /tmp/textmate.zip http://download.macromates.com/TextMate_1.5.10.zip"
+ command "curl -L -o /tmp/textmate.zip http://download.macromates.com/TextMate_1.5.10.zip"
user WS_USER
end
|
Make sure to follow any redirects for Textmate download
|
diff --git a/test/models/draw_test.rb b/test/models/draw_test.rb
index abc1234..def5678 100644
--- a/test/models/draw_test.rb
+++ b/test/models/draw_test.rb
@@ -7,8 +7,11 @@ santaswife = participants :santas_wife
draw = Draw.new(event: secretsanta, giver: santa, receiver: santaswife)
assert_nil draw.sent_at
- draw.send_email
- assert_not_nil draw.sent_at
+ time = Time.local(2008, 9, 1, 12, 0, 0)
+ travel_to time do
+ draw.send_email
+ end
+ assert_equal time, draw.sent_at
assert_equal 1, ActionMailer::Base.deliveries.size
end
end
|
Use travel_to to mock Time.now
|
diff --git a/app/controllers/logs_controller.rb b/app/controllers/logs_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/logs_controller.rb
+++ b/app/controllers/logs_controller.rb
@@ -1,7 +1,7 @@ class LogsController < ApplicationController
def new
@project = Project.find(params[:project_id])
- @log = Log.new(worked_at: Date.today)
+ @log = Log.new(worked_at: Time.zone.today)
end
def create
|
Use Time.zone.today instead of Date.today
|
diff --git a/app/models/spree/gateway/affirm.rb b/app/models/spree/gateway/affirm.rb
index abc1234..def5678 100644
--- a/app/models/spree/gateway/affirm.rb
+++ b/app/models/spree/gateway/affirm.rb
@@ -36,7 +36,7 @@ def cancel(charge_ari)
_payment = Spree::Payment.valid.where(
response_code: charge_ari,
- source_type: "#{payment_source_class}"
+ source_type: payment_source_class.to_s
).first
return if _payment.nil?
@@ -44,7 +44,7 @@ if _payment.pending?
_payment.void_transaction!
- elsif _payment.completed? and _payment.can_credit?
+ elsif _payment.completed? && _payment.can_credit?
# create adjustment
_payment.order.adjustments.create(
@@ -52,10 +52,9 @@ amount: -_payment.credit_allowed.to_f,
order: _payment.order
)
- _payment.order.update!
-
- _payment.credit!
-
+ Spree::OrderUpdater.new(_payment.order).update
+ provider.refund(_payment.credit_allowed.to_money.cents, charge_ari)
+
end
end
end
|
Update to new spree method of canceling
|
diff --git a/app/uploaders/document_uploader.rb b/app/uploaders/document_uploader.rb
index abc1234..def5678 100644
--- a/app/uploaders/document_uploader.rb
+++ b/app/uploaders/document_uploader.rb
@@ -6,7 +6,7 @@
# A white list of extensions which are allowed to be uploaded.
def extension_white_list
- %w( pdf doc docx xls xlsx )
+ %w( pdf doc docx xls xlsx ppt )
end
end
|
Enable upload of Powerpoint files
|
diff --git a/chargehound.gemspec b/chargehound.gemspec
index abc1234..def5678 100644
--- a/chargehound.gemspec
+++ b/chargehound.gemspec
@@ -20,7 +20,7 @@ spec.add_development_dependency 'minitest', '~> 5.8'
spec.add_development_dependency 'rake', '~> 11.1'
spec.add_development_dependency 'rubocop', '~> 0.39'
- spec.add_development_dependency 'webmock', '~> 2.0.0.beta1'
+ spec.add_development_dependency 'webmock', '~> 2.0'
spec.files = `git ls-files`.split($/)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
Upgrade Webmock to official 2.0 release
|
diff --git a/spec/models/bus_stops_route_spec.rb b/spec/models/bus_stops_route_spec.rb
index abc1234..def5678 100644
--- a/spec/models/bus_stops_route_spec.rb
+++ b/spec/models/bus_stops_route_spec.rb
@@ -8,20 +8,16 @@ let!(:route) { create :route }
let!(:direction) { 'West' }
let!(:stop_1) { create :bus_stop }
- before :each do
- create :bus_stops_route, route: route,
- bus_stop: stop_1,
- sequence: sequence,
- direction: direction
- end
+ let!(:valid_bsr) { create :bus_stops_route, route: route,
+ bus_stop: stop_1,
+ direction: direction }
context 'same sequence' do
it 'is not valid' do
stop_2 = create :bus_stop
- sequence = 1
invalid_bsr = build :bus_stops_route, route: route,
bus_stop: stop_2,
- sequence: sequence,
+ sequence: valid_bsr.sequence,
direction: direction
expect(invalid_bsr).not_to be_valid
@@ -30,7 +26,7 @@ context 'same bus_stop' do
it 'is not valid' do
invalid_bsr = build :bus_stops_route, route: route,
- bus_stop: stop_1,
+ bus_stop: valid_bsr.bus_stop,
direction: direction
expect(invalid_bsr).not_to be_valid
|
Make the scenario even clearer with accessing valid bsr
|
diff --git a/lib/exercism/curriculum/javascript.rb b/lib/exercism/curriculum/javascript.rb
index abc1234..def5678 100644
--- a/lib/exercism/curriculum/javascript.rb
+++ b/lib/exercism/curriculum/javascript.rb
@@ -8,7 +8,7 @@ gigasecond triangle scrabble-score roman-numerals
binary prime-factors raindrops allergies strain
atbash-cipher accumulate crypto-square trinary
- sieve simple-cipher octal luhn pig-latin
+ sieve simple-cipher octal luhn
meetup
)
# always put meetup last. It's crazy in javascript.
|
Remove missing assignment from JS curriculum
|
diff --git a/lib/serverkit/resources/go_package.rb b/lib/serverkit/resources/go_package.rb
index abc1234..def5678 100644
--- a/lib/serverkit/resources/go_package.rb
+++ b/lib/serverkit/resources/go_package.rb
@@ -3,18 +3,18 @@ module Serverkit
module Resources
class GoPackage < Base
- attribute :url, required: true, type: String
+ attribute :path, required: true, type: String
# @note Override
def apply
- run_command("go get -u #{url}")
+ run_command("go get -u #{path}")
end
# @note Override
def check
- go_package_dir_path = "#{ENV['GOPATH']}/src/#{url}"
+ go_package_path = "#{ENV['GOPATH']}/src/#{path}"
check_command(
- backend.command.get(:check_file_is_directory, go_package_dir_path)
+ backend.command.get(:check_file_is_directory, go_package_path)
)
end
end
|
Use `path` instead of `url`
|
diff --git a/lib/tasks/clear_expired_sessions.rake b/lib/tasks/clear_expired_sessions.rake
index abc1234..def5678 100644
--- a/lib/tasks/clear_expired_sessions.rake
+++ b/lib/tasks/clear_expired_sessions.rake
@@ -0,0 +1,5 @@+desc "Clear the sessions table of records that are over 25 hours old."
+task :clear_expired_sessions => :environment do
+ puts "Deleting sessions over 25 hours old..."
+ ActiveRecord::SessionStore::Session.delete_all(["updated_at < ?", 25.hours.ago])
+end
|
Add a rake task to clear out sessions records over 25 hours old
|
diff --git a/lib/tasks/export_alternate_title.rake b/lib/tasks/export_alternate_title.rake
index abc1234..def5678 100644
--- a/lib/tasks/export_alternate_title.rake
+++ b/lib/tasks/export_alternate_title.rake
@@ -0,0 +1,24 @@+desc "Export all Editions that have an alternate title as a CSV"
+
+task :export_alternate_title => :environment do
+ require "csv"
+
+ editions_with_alternative_titles = Edition.where(:alternative_title.nin => ["", nil]).map { |e|
+ {
+ bson_id: e.id.to_s,
+ title: e.title,
+ alternative_title: e.alternative_title,
+ slug: e.slug,
+ }
+ }
+
+ csv_string = CSV.generate do |csv|
+ csv << ["bson_id", "title", "alternative_title", "slug"]
+
+ editions_with_alternative_titles.each do |e|
+ csv << [e[:bson_id], e[:title], e[:alternative_title], e[:slug]]
+ end
+ end
+
+ puts csv_string
+end
|
Add task to export editions that have an alternative title
|
diff --git a/test/remote/gateways/remote_cashnet_test.rb b/test/remote/gateways/remote_cashnet_test.rb
index abc1234..def5678 100644
--- a/test/remote/gateways/remote_cashnet_test.rb
+++ b/test/remote/gateways/remote_cashnet_test.rb
@@ -27,4 +27,21 @@ assert refund.test?
assert_equal 'Success', refund.message
end
+
+ def test_failed_purchase
+ assert response = @gateway.purchase(-44, @credit_card, @options)
+ assert_failure response
+ assert_match /Negative amount is not allowed/, response.message
+ assert_equal "5", response.params["result"]
+ end
+
+ def test_failed_refund
+ assert purchase = @gateway.purchase(@amount, @credit_card, @options)
+ assert_success purchase
+
+ assert refund = @gateway.refund(@amount + 50, purchase.authorization)
+ assert_failure refund
+ assert_match /Amount to refund exceeds/, refund.message
+ assert_equal "302", refund.params["result"]
+ end
end
|
Cashnet: Add a few remote tests
We now test that failures are working as expected.
Closes #1203.
|
diff --git a/postkode.gemspec b/postkode.gemspec
index abc1234..def5678 100644
--- a/postkode.gemspec
+++ b/postkode.gemspec
@@ -1,8 +1,8 @@ # encoding: utf-8
Gem::Specification.new do |s|
s.name = 'postkode'
- s.version = '0.3.1'
- s.date = '2015-02-17'
+ s.version = '0.3.2'
+ s.date = '2015-03-18'
s.summary = 'postkode'
s.description = 'Postcode validation module'
s.authors = ['K M Lawrence', 'Alexei Emam', 'Peter Robertson']
|
Update Gemspec to version 0.3.2
|
diff --git a/spec/integration/axiom/relation/mutable_enumerator_spec.rb b/spec/integration/axiom/relation/mutable_enumerator_spec.rb
index abc1234..def5678 100644
--- a/spec/integration/axiom/relation/mutable_enumerator_spec.rb
+++ b/spec/integration/axiom/relation/mutable_enumerator_spec.rb
@@ -0,0 +1,45 @@+# encoding: utf-8
+
+require 'spec_helper'
+
+# tests that tuple enumerators do not get frozen
+
+class MutableEnumerator < Enumerator
+ attr_reader :mutable_array
+ def initialize(tuple_source)
+ @mutable_array = []
+ super() do |y|
+ @mutable_array << Date.new
+ tuple_source.each do |t|
+ y << t
+ end
+ end
+ end
+end
+
+describe Relation do
+ context 'Relations do not freeze tuple enumerators' do
+ let(:tuple_enumerator) do
+ MutableEnumerator.new([ [ 1, 'John Doe' ], [ 2, 'Jane Doe' ], [ 3, 'Jane Roe' ] ])
+ end
+ let(:relation) do
+ Relation.new(
+ [ [ :id, Integer ], [ :name, String, { :required => false } ] ],
+ tuple_enumerator
+ )
+ end
+
+ it 'Relation tuples can be marshalled to array' do
+ tuples = relation.to_a
+ tuples.length.should == 3
+ tuple_enumerator.mutable_array.length.should == 3
+ end
+
+ it 'Relation enumerator mutability survives restriction' do
+ tuples = relation.restrict { |r| r.name.match(/^Jane/) }.to_a
+ tuples.length.should == 2
+ tuple_enumerator.mutable_array.length.should == 3
+ end
+
+ end
+end
|
Add spec for mutable enumerator
|
diff --git a/tools/extract_top_starred_nodejs_modules.rb b/tools/extract_top_starred_nodejs_modules.rb
index abc1234..def5678 100644
--- a/tools/extract_top_starred_nodejs_modules.rb
+++ b/tools/extract_top_starred_nodejs_modules.rb
@@ -2,27 +2,73 @@ require 'rubygems'
require 'nokogiri'
require 'open-uri'
+require 'github_api'
# USAGE:
# ruby extract_top_starred_nodejs_modules.rb > output.txt
#
+# Extracts top <LIMIT> packages from most starred and most depended, merge them
+# and remove duplicates
+#
LIMIT = 50
+#
+# Classes
+#
+class Parser
+ def self.get_top_packages(page_to_visit, limit)
+ output = []
+
+ while (true)
+ page = Nokogiri::HTML(open(page_to_visit))
+ output += page.css('.package-details a.name').map{ |e| e.attribute("href").value }.flatten
+
+ if (output.size < limit)
+ next_page_uri = page.css('.pagination .next').attribute("href").value
+ page_to_visit = "https://www.npmjs.com#{next_page_uri}"
+ else
+ break
+ end
+ end
+
+ return output[0...limit]
+ end
+end
+
+
+class Package
+ attr_reader :url, :downloads_month, :stargazers
+
+ def initialize(url, downloads_month)
+ @url = url
+ @downloads_month = downloads_month
+ end
+
+ def to_s
+ "#{url},#{@downloads_month}"
+ end
+end
+
+
+#
+# Main
+#
+
package_links = []
-page = Nokogiri::HTML(open("https://www.npmjs.com/browse/star"))
+package_links += Parser.get_top_packages("https://www.npmjs.com/browse/star", LIMIT)
+package_links += Parser.get_top_packages("https://www.npmjs.com/browse/depended", LIMIT)
-while (package_links.size < LIMIT)
- package_links.concat page.css('.package-details a.name').map{ |e| e.attribute("href").value }.flatten
+for package_link in package_links.uniq
+ package_page = Nokogiri::HTML(open("https://www.npmjs.com#{package_link}"))
- next_page_uri = page.css('.pagination .next').attribute("href").value
- page = Nokogiri::HTML(open("https://www.npmjs.com#{next_page_uri}"))
-end
+ git_url = package_page.css('.sidebar .box a')[1].attribute("href").value + ".git"
+ downloads_month = package_page.css('.sidebar .box .monthly-downloads')[0].text
-for package_link in package_links[0...LIMIT]
- package_page = Nokogiri::HTML(open("https://www.npmjs.com#{package_link}"))
- git_repository = package_page.css('.sidebar .box a')[1].attribute("href").value + ".git"
+ package = Package.new(git_url, downloads_month)
+ puts package
- puts git_repository
+ # be nice to npmjs.com
+ sleep(1)
end
|
Improve ruby script to also get the number of downloads from npmjs.com
And now we also get top depended (and not only top starred). Kehelian
uses top depended
|
diff --git a/test/functional/sitemaps_controller_test.rb b/test/functional/sitemaps_controller_test.rb
index abc1234..def5678 100644
--- a/test/functional/sitemaps_controller_test.rb
+++ b/test/functional/sitemaps_controller_test.rb
@@ -0,0 +1,8 @@+require 'test_helper'
+
+class SitemapsControllerTest < ActionController::TestCase
+ test 'should return an XML sitemap' do
+ get :index, :format => 'xml'
+ assert_response :success
+ end
+end
|
Add tests for sitemaps controller
|
diff --git a/cookbooks/chef/attributes/default.rb b/cookbooks/chef/attributes/default.rb
index abc1234..def5678 100644
--- a/cookbooks/chef/attributes/default.rb
+++ b/cookbooks/chef/attributes/default.rb
@@ -5,4 +5,4 @@ default[:chef][:server][:version] = "12.17.33"
# Set the default client version
-default[:chef][:client][:version] = "17.7.29"
+default[:chef][:client][:version] = "17.10.3"
|
Update chef client to 17.10.3
|
diff --git a/lib/konacha/engine.rb b/lib/konacha/engine.rb
index abc1234..def5678 100644
--- a/lib/konacha/engine.rb
+++ b/lib/konacha/engine.rb
@@ -8,7 +8,9 @@ run app.assets
end
- run Konacha::Engine
+ map "/" do
+ run Konacha::Engine
+ end
end
end
|
Add support for older versions of Rack.
|
diff --git a/core/app/models/spree/zone_member.rb b/core/app/models/spree/zone_member.rb
index abc1234..def5678 100644
--- a/core/app/models/spree/zone_member.rb
+++ b/core/app/models/spree/zone_member.rb
@@ -2,10 +2,5 @@ class ZoneMember < Spree::Base
belongs_to :zone, class_name: 'Spree::Zone', counter_cache: true, inverse_of: :zone_members
belongs_to :zoneable, polymorphic: true
-
- def name
- return nil if zoneable.nil?
- zoneable.name
- end
end
end
|
Remove unused & unspec'd method.
|
diff --git a/lib/call_sheet/dsl.rb b/lib/call_sheet/dsl.rb
index abc1234..def5678 100644
--- a/lib/call_sheet/dsl.rb
+++ b/lib/call_sheet/dsl.rb
@@ -1,8 +1,8 @@ require "call_sheet/step"
require "call_sheet/step_adapters"
require "call_sheet/step_adapters/base"
+require "call_sheet/step_adapters/map"
require "call_sheet/step_adapters/raw"
-require "call_sheet/step_adapters/map"
require "call_sheet/step_adapters/tee"
require "call_sheet/step_adapters/try"
require "call_sheet/transaction"
|
Order step adapter requires alphabetically
|
diff --git a/lib/chefspec/rspec.rb b/lib/chefspec/rspec.rb
index abc1234..def5678 100644
--- a/lib/chefspec/rspec.rb
+++ b/lib/chefspec/rspec.rb
@@ -1,6 +1,8 @@ RSpec.configure do |config|
- config.include(ChefSpec::API)
- config.include(ChefSpec::Macros)
+ unless ENV['CHEFSPEC_NO_INCLUDE']
+ config.include(ChefSpec::API)
+ config.include(ChefSpec::Macros)
+ end
config.after(:each) do
ChefSpec::Stubs::CommandRegistry.reset!
|
Set up an environment variable to disable the automatic RSpec injection.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.