diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/lib/webpay/entity.rb b/lib/webpay/entity.rb
index abc1234..def5678 100644
--- a/lib/webpay/entity.rb
+++ b/lib/webpay/entity.rb
@@ -41,6 +41,7 @@ raise "unexpected object" if attributes['object'] != @attributes['object']
new_object = ResponseConverter.new.convert(attributes)
@attributes = new_object.attributes
+ self
end
end
end
|
Update methods should respond itself
|
diff --git a/lib/tty.rb b/lib/tty.rb
index abc1234..def5678 100644
--- a/lib/tty.rb
+++ b/lib/tty.rb
@@ -35,6 +35,15 @@ # Raised when the argument type is different from expected
class TypeError < ArgumentError; end
+ # Raised when the required argument is not supplied
+ class ArgumentRequired < ArgumentError; end
+
+ # Raised when the argument validation fails
+ class ArgumentValidation < ArgumentError; end
+
+ # Raised when the passed in validation argument is of wrong type
+ class ValidationCoercion < TypeError; end
+
class << self
# Return terminal instance
|
Add specific argument error types.
|
diff --git a/tasks/db/indexes.rake b/tasks/db/indexes.rake
index abc1234..def5678 100644
--- a/tasks/db/indexes.rake
+++ b/tasks/db/indexes.rake
@@ -14,7 +14,7 @@ end
end
puts "Foreign Keys:"
- indexes.each do |table, columns|
+ indexes.sort.each do |table, columns|
puts columns.map { |c| "\s\sadd_index '#{table}', '#{c}'\n"}
end
end
|
Sort the results by table name before printing
|
diff --git a/yardstick-client.gemspec b/yardstick-client.gemspec
index abc1234..def5678 100644
--- a/yardstick-client.gemspec
+++ b/yardstick-client.gemspec
@@ -8,8 +8,8 @@ gem.version = Yardstick::Client::VERSION
gem.authors = ["Jason Wall", "Daniel Huckstep"]
gem.email = ["danielh@getyardstick.com"]
- gem.description = %q{TODO: Write a gem description}
- gem.summary = %q{TODO: Write a gem summary}
+ gem.description = %q{Gem for interacting with the Yardstick Admin API}
+ gem.summary = %q{Use this for your own integratin with the Yardstick Measure platform. We use it too!}
gem.homepage = "http://www.github.com/yardstick/yardstick-client"
gem.files = `git ls-files`.split($/)
|
Make gemspec valid with somewhat real descriptions
|
diff --git a/deviantart.gemspec b/deviantart.gemspec
index abc1234..def5678 100644
--- a/deviantart.gemspec
+++ b/deviantart.gemspec
@@ -14,7 +14,7 @@ spec.homepage = "https://github.com/aycabta/deviantart"
spec.license = "MIT"
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|features)/}) }
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
|
Remove spec dir what is rejected in .gemspec
|
diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb
index abc1234..def5678 100644
--- a/config/initializers/omniauth.rb
+++ b/config/initializers/omniauth.rb
@@ -3,6 +3,7 @@ oauth_config = OpenWebslides::Configuration.oauth2
before_callback_phase do |env|
+ # TODO: verify state
query_params = Rack::Utils.parse_nested_query env['QUERY_STRING']
env['rack.session']['omniauth.state'] = query_params['state']
end
|
Add TODO for session state checking
|
diff --git a/config/initializers/sunlight.rb b/config/initializers/sunlight.rb
index abc1234..def5678 100644
--- a/config/initializers/sunlight.rb
+++ b/config/initializers/sunlight.rb
@@ -0,0 +1,5 @@+if defined?(SETTINGS) && key = SETTINGS[:sunlight_api_key]
+ Sunlight.api_key = key
+else
+ warn "No Sunlight API key found. Check config/settings.yml"
+end
|
Add initializer for Sunlight API key
|
diff --git a/spec/root_spec.rb b/spec/root_spec.rb
index abc1234..def5678 100644
--- a/spec/root_spec.rb
+++ b/spec/root_spec.rb
@@ -5,11 +5,19 @@ root_page.goto
end
- it 'should have posts that contain text' do
+ def check_posts
posts = root_page.posts
posts.each do |post|
puts "Data post ID: #{post.data_post_id}"
- expect(post.post_truncated_content.text.empty?).to be false
+ yield post
end
end
+
+ it 'should have posts that contain titles' do
+ check_posts { |post| expect(post.post_title.text.empty?).to be false }
+ end
+
+ it 'should have posts that contain text' do
+ check_posts { |post| expect(post.post_truncated_content.text.empty?).to be false }
+ end
end
|
Add in root page title test
Also DRY up check posts portion of the tests
|
diff --git a/lib/rubocop/cop/rails/output.rb b/lib/rubocop/cop/rails/output.rb
index abc1234..def5678 100644
--- a/lib/rubocop/cop/rails/output.rb
+++ b/lib/rubocop/cop/rails/output.rb
@@ -6,7 +6,7 @@ # This cop checks for the use of output calls like puts and print
class Output < Cop
MSG = 'Do not write to stdout. ' \
- 'Use Rails\' logger if you want to log.'.freeze
+ "Use Rails's logger if you want to log.".freeze
def_node_matcher :output?, <<-PATTERN
(send nil {:ap :p :pp :pretty_print :print :puts} $...)
|
Fix the possessive spelling of Rails's
|
diff --git a/lib/selectivizr/rails/engine.rb b/lib/selectivizr/rails/engine.rb
index abc1234..def5678 100644
--- a/lib/selectivizr/rails/engine.rb
+++ b/lib/selectivizr/rails/engine.rb
@@ -1,10 +1,8 @@ module Selectivizr
module Rails
class Engine < ::Rails::Engine
- if Rails.version >= '3.1'
- initializer 'Selectivizr precompile hook', :group => :all do |app|
- app.config.assets.precompile += ['modernizr.js']
- end
+ initializer 'Selectivizr precompile hook', :group => :all do |app|
+ app.config.assets.precompile += ['modernizr.js']
end
end
end
|
Remove the rails 3.1 version check.
There is really no reason to use this gem unless
you're already on 3.1, so don't bother checking.
|
diff --git a/lib/tasks/platform6_update.rake b/lib/tasks/platform6_update.rake
index abc1234..def5678 100644
--- a/lib/tasks/platform6_update.rake
+++ b/lib/tasks/platform6_update.rake
@@ -0,0 +1,34 @@+namespace :platform6 do
+ desc "Update Platform6 stuff"
+ task :update => :environment do
+ require 'rpm'
+ require 'open-uri'
+
+ branch = Branch.where(:name => 'Platform6', :vendor => 'ALT Linux').first
+
+ ActiveRecord::Base.transaction do
+ puts "#{Time.now.to_s}: Update Platform6 stuff"
+ puts "#{Time.now.to_s}: update *.src.rpm from Platform6 to database"
+ path = '/ALT/p6/files/SRPMS/*.src.rpm'
+ Dir.glob(path).each do |file|
+ begin
+ if !$redis.exists branch.name + ":" + file.split('/')[-1]
+ puts "#{Time.now.to_s}: updating '#{file.split('/')[-1]}'"
+ Srpm.import_srpm(branch.vendor, branch.name, file)
+ end
+ rescue RuntimeError
+ puts "Bad .src.rpm: #{file}"
+ end
+ end
+
+ Srpm.remove_old_srpms('ALT Linux', 'Platform6', '/ALT/p6/files/SRPMS/')
+ end
+
+ puts "#{Time.now.to_s}: expire cache"
+ ['en', 'ru', 'uk', 'br'].each do |locale|
+ ActionController::Base.new.expire_fragment("#{locale}_srpms_#{branch.name}_")
+ end
+
+ puts "#{Time.now.to_s}: end"
+ end
+end
|
Add rake task for update Platform6
|
diff --git a/0_code_wars/parts_of_a_list.rb b/0_code_wars/parts_of_a_list.rb
index abc1234..def5678 100644
--- a/0_code_wars/parts_of_a_list.rb
+++ b/0_code_wars/parts_of_a_list.rb
@@ -0,0 +1,5 @@+# http://www.codewars.com/kata/56f3a1e899b386da78000732/
+# --- iteration 1 ---
+def partlist(arr)
+ (0..arr.size-2).map { |n| [arr[0..n].join(" "), arr[(n+1)..-1].join(" ")] }
+end
|
Add code wars (7) - parts of a list
|
diff --git a/lib/abilities/extensions/action_controller/base.rb b/lib/abilities/extensions/action_controller/base.rb
index abc1234..def5678 100644
--- a/lib/abilities/extensions/action_controller/base.rb
+++ b/lib/abilities/extensions/action_controller/base.rb
@@ -10,7 +10,7 @@
%w(can? cannot?).each do |name|
define_method name do |action, resource|
- Abilities.send name, @user, action, resource
+ Abilities.send name, user, action, resource
end
end
|
Use helper instead of instance variable
|
diff --git a/config/initializers/redis.rb b/config/initializers/redis.rb
index abc1234..def5678 100644
--- a/config/initializers/redis.rb
+++ b/config/initializers/redis.rb
@@ -13,5 +13,5 @@
$redis = Redis.new(redis_options)
-# Minegems::Rack::SubdomainRouter.ensure_consistent_lookup!
-# Minegems::Rack::SubdomainRouter.ensure_consistent_access!+Minegems::Rack::SubdomainRouter.ensure_consistent_lookup!
+Minegems::Rack::SubdomainRouter.ensure_consistent_access!
|
Revert "Temporary disable subdomains constraints"
This reverts commit 935f76632d774bc9b0ed368948c7b10266bb8397.
|
diff --git a/myaso.gemspec b/myaso.gemspec
index abc1234..def5678 100644
--- a/myaso.gemspec
+++ b/myaso.gemspec
@@ -12,7 +12,7 @@ spec.description = 'Myaso is a morphological analysis library in Ruby.'
spec.summary = 'Myaso is a morphological analysis and synthesis ' \
'library in Ruby.'
- spec.homepage = 'https://github.com/dmchk/myaso'
+ spec.homepage = 'https://github.com/dustalov/myaso'
spec.license = 'MIT'
spec.files = `git ls-files`.split($/)
|
Update the homepage URI [ci skip]
|
diff --git a/mrblib/mrubyjs.rb b/mrblib/mrubyjs.rb
index abc1234..def5678 100644
--- a/mrblib/mrubyjs.rb
+++ b/mrblib/mrubyjs.rb
@@ -19,9 +19,17 @@ end
# For methods that do not conflict with Ruby, we can directly
- # call them
+ # call them or fetch them, the following rules are used:
+ # 1. If args is an empty array, we will fetch the field
+ # 2. If args is not empty, we will fetch the function and make the call
+ # Our solution here only covers the most common cases, users
+ # will need to explicitly use call or get for other rare cases
def method_missing(key, *args)
- call(key.to_s, *args)
+ if args.length > 0
+ call(key.to_s, *args)
+ else
+ get(key.to_s)
+ end
end
end
@@ -46,6 +54,10 @@ invoke_internal(2, this_value, *args)
end
+ def [](*args)
+ invoke(*args)
+ end
+
def method_missing(key, *args)
invoke(key.to_s, *args)
end
|
Add [] syntax for JS functions
|
diff --git a/rails_event_store/lib/rails_event_store/active_job_dispatcher.rb b/rails_event_store/lib/rails_event_store/active_job_dispatcher.rb
index abc1234..def5678 100644
--- a/rails_event_store/lib/rails_event_store/active_job_dispatcher.rb
+++ b/rails_event_store/lib/rails_event_store/active_job_dispatcher.rb
@@ -3,26 +3,26 @@ module RailsEventStore
module AsyncProxyStrategy
class AfterCommit
- def call(klass, event)
+ def call(klass, serialized_event)
if ActiveRecord::Base.connection.transaction_open?
ActiveRecord::Base.
connection.
current_transaction.
- add_record(AsyncRecord.new(klass, event))
+ add_record(AsyncRecord.new(klass, serialized_event))
else
- klass.perform_later(YAML.dump(event))
+ klass.perform_later(serialized_event)
end
end
private
class AsyncRecord
- def initialize(klass, event)
+ def initialize(klass, serialized_event)
@klass = klass
- @event = event
+ @serialized_event = serialized_event
end
def committed!
- @klass.perform_later(YAML.dump(@event))
+ klass.perform_later(serialized_event)
end
def rolledback!(*)
@@ -32,14 +32,16 @@ end
def add_to_transaction
- AfterCommit.new.call(@klass, @event)
+ AfterCommit.new.call(klass, serialized_event)
end
+
+ attr_reader :serialized_event, :klass
end
end
class Inline
- def call(klass, event)
- klass.perform_later(YAML.dump(event))
+ def call(klass, serialized_event)
+ klass.perform_later(serialized_event)
end
end
end
@@ -49,9 +51,9 @@ @async_proxy_strategy = proxy_strategy
end
- def call(subscriber, event)
+ def call(subscriber, event, serialized_event)
if async_handler?(subscriber)
- @async_proxy_strategy.call(subscriber, event)
+ @async_proxy_strategy.call(subscriber, serialized_event)
else
super
end
|
Use serialized_event in ActiveJob Dispatcher
|
diff --git a/db/migrate/20120726133325_copy_isbn_from_publication_to_attachment.rb b/db/migrate/20120726133325_copy_isbn_from_publication_to_attachment.rb
index abc1234..def5678 100644
--- a/db/migrate/20120726133325_copy_isbn_from_publication_to_attachment.rb
+++ b/db/migrate/20120726133325_copy_isbn_from_publication_to_attachment.rb
@@ -4,22 +4,30 @@ # Get the published edition of this publication
published_edition = publication.published_edition
- # Only proceed if there's a published edition with an ISBN, and at least one attachment that we can move it to
- if published_edition && published_edition.isbn.present? && published_edition.attachments.any?
+ # Only proceed if there's a published edition with an ISBN
+ if published_edition && published_edition.isbn.present?
- # If there's more than one attachment then print the edition ID as we'll need to check whether we've copied
- # the ISBN to the correct attachment
- if published_edition.attachments.length > 1
- puts "*NOTE* Edition #{published_edition.id} has multiple attachments. Manually check that we've copied the ISBN to the correct one."
- end
+ # If we don't have an attachment to copy the ISBN to then print the edition ID and
+ # ISBN so that we don't lose potentially useful data when we remove the ISBN
+ # from the editions table.
+ if published_edition.attachments.empty?
+ puts "*NOTE* Edition #{published_edition.id} has an ISBN (#{published_edition.isbn}) but no attachments to copy it to."
+ else
- first_attachment = published_edition.attachments.order(:created_at).first
+ # If there's more than one attachment then print the edition ID as we'll need to check whether we've copied
+ # the ISBN to the correct attachment
+ if published_edition.attachments.length > 1
+ puts "*NOTE* Edition #{published_edition.id} has multiple attachments. Manually check that we've copied the ISBN to the correct one."
+ end
- # Fail fast if we're trying to overwrite an existing ISBN with something different
- if first_attachment.isbn.present? && first_attachment.isbn != published_edition.isbn
- raise "The ISBN on the attachment is different from the one on the publication. Aborting."
- else
- first_attachment.update_attribute(:isbn, published_edition.isbn)
+ first_attachment = published_edition.attachments.order(:created_at).first
+
+ # Fail fast if we're trying to overwrite an existing ISBN with something different
+ if first_attachment.isbn.present? && first_attachment.isbn != published_edition.isbn
+ raise "The ISBN on the attachment is different from the one on the publication. Aborting."
+ else
+ first_attachment.update_attribute(:isbn, published_edition.isbn)
+ end
end
end
end
|
Update the migration that copies ISBNs to attachments.
This migration has already run in preview but not yet in production,
which is why I'm happy to update it.
|
diff --git a/puppet-lint-no_cron_resources-check.gemspec b/puppet-lint-no_cron_resources-check.gemspec
index abc1234..def5678 100644
--- a/puppet-lint-no_cron_resources-check.gemspec
+++ b/puppet-lint-no_cron_resources-check.gemspec
@@ -21,7 +21,7 @@ spec.add_development_dependency 'rspec', '~> 3.9.0'
spec.add_development_dependency 'rspec-its', '~> 1.0'
spec.add_development_dependency 'rspec-collection_matchers', '~> 1.0'
- spec.add_development_dependency 'rubocop', '~> 0.82.0'
+ spec.add_development_dependency 'rubocop', '~> 0.83.0'
spec.add_development_dependency 'rake', '~> 13.0.0'
spec.add_development_dependency 'rspec-json_expectations', '~> 2.2'
spec.add_development_dependency 'simplecov', '~> 0.18.0'
|
Update rubocop requirement from ~> 0.82.0 to ~> 0.83.0
Updates the requirements on [rubocop](https://github.com/rubocop-hq/rubocop) to permit the latest version.
- [Release notes](https://github.com/rubocop-hq/rubocop/releases)
- [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop-hq/rubocop/compare/v0.82.0...v0.83.0)
Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
|
diff --git a/lib/common.rb b/lib/common.rb
index abc1234..def5678 100644
--- a/lib/common.rb
+++ b/lib/common.rb
@@ -0,0 +1,20 @@+require 'socket'
+require 'pp'
+
+class Common
+ # http://hibberttech.blogspot.fr/2013/05/ruby-check-if-port-is-open.html
+ def checkPortIsOpen?(ip, port, timeout)
+ start_time = Time.now
+ current_time = start_time
+ while (current_time - start_time) <= timeout
+ begin
+ TCPSocket.new(ip, port)
+ return true
+ rescue Errno::ECONNREFUSED
+ sleep 0.1
+ end
+ current_time = Time.now
+ end
+ return false
+ end
+end
|
Add function for check timeout
|
diff --git a/railties/test/rails_info_controller_test.rb b/railties/test/rails_info_controller_test.rb
index abc1234..def5678 100644
--- a/railties/test/rails_info_controller_test.rb
+++ b/railties/test/rails_info_controller_test.rb
@@ -50,7 +50,6 @@
test "info controller renders with routes" do
get :routes
- assert_select 'pre'
+ assert_select 'table#routeTable'
end
-
end
|
Fix failing test in railties
Related to the HTML route inspector changes:
ae68fc3864e99ab43c18fd12577744e1583f6b64
|
diff --git a/lib/values.rb b/lib/values.rb
index abc1234..def5678 100644
--- a/lib/values.rb
+++ b/lib/values.rb
@@ -1,6 +1,6 @@ class Value
def self.new(*fields)
- return Class.new do
+ Class.new do
attr_reader *fields
define_method(:initialize) do |*values|
@@ -32,7 +32,7 @@ end
def hash
- return values.map(&:hash).inject(0, :+) + self.class.hash
+ values.map(&:hash).inject(0, :+) + self.class.hash
end
def values
|
Remove unnecessary uses of return
|
diff --git a/Casks/graphicconverter.rb b/Casks/graphicconverter.rb
index abc1234..def5678 100644
--- a/Casks/graphicconverter.rb
+++ b/Casks/graphicconverter.rb
@@ -2,7 +2,7 @@ version '9.2098'
sha256 'ae584e3e4d508eb4a6d99e8caa234466d0e88108465486ddd45cd641fc7d24df'
- # lemkesoft.org was verified as official when first introduced to the cask
+ # lemkesoft.info was verified as official when first introduced to the cask
url "http://www.lemkesoft.info/files/graphicconverter/gc#{version.major}_build#{version.minor}.zip"
appcast 'http://www.lemkesoft.org/files/graphicconverter/graphicconverter9.xml',
checkpoint: 'eb62cdcced7681f47360d3b7c39e7b18db3a3cf96ffa8c93945bf5a0fe55151f'
|
Fix `url` stanza comment for GraphicConverter.
|
diff --git a/Casks/thunderbird-beta.rb b/Casks/thunderbird-beta.rb
index abc1234..def5678 100644
--- a/Casks/thunderbird-beta.rb
+++ b/Casks/thunderbird-beta.rb
@@ -1,6 +1,6 @@ cask :v1 => 'thunderbird-beta' do
- version '34.0b1'
- sha256 '7f6025c689633e893203490f11504b4790c46eca88393d7ab678b5405b8a8acb'
+ version '37.0b1'
+ sha256 'a035e47ea01639df6f5fe05e7e115814fcca04005ef329a06968e4ab86c354e7'
url "https://download-installer.cdn.mozilla.net/pub/thunderbird/releases/#{version}/mac/en-US/Thunderbird%20#{version}.dmg"
homepage 'https://www.mozilla.org/en-US/thunderbird/all-beta.html'
|
Upgrade Thunderbird Beta to 37.0b1 (from 34.0b1)
|
diff --git a/core/thread/shared/wakeup.rb b/core/thread/shared/wakeup.rb
index abc1234..def5678 100644
--- a/core/thread/shared/wakeup.rb
+++ b/core/thread/shared/wakeup.rb
@@ -21,12 +21,12 @@
exit_loop = true
- Thread.pass while t.status and t.status != "sleep"
+ 10.times { sleep 0.1 if t.status and t.status != "sleep" }
after_sleep1.should == false # t should be blocked on the first sleep
t.send(@method)
- Thread.pass while after_sleep1 != true
- Thread.pass while t.status and t.status != "sleep"
+ 10.times { sleep 0.1 if after_sleep1 != true }
+ 10.times { sleep 0.1 if t.status and t.status != "sleep" }
after_sleep2.should == false # t should be blocked on the second sleep
t.send(@method)
|
Add limit to avoid accidental infinite loop.
|
diff --git a/Casks/android-studio-canary.rb b/Casks/android-studio-canary.rb
index abc1234..def5678 100644
--- a/Casks/android-studio-canary.rb
+++ b/Casks/android-studio-canary.rb
@@ -0,0 +1,14 @@+class AndroidStudioCanary < Cask
+ version '0.8.13'
+ sha256 '8718a91fead9d90e24272d39a9140b131c2c411d38d1e26dc825cd0c5fd41e15'
+
+ url "http://dl.google.com/dl/android/studio/ide-zips/#{version}/android-studio-ide-135.1404660-mac.zip"
+ homepage 'http://tools.android.com/download/studio'
+ license :unknown
+
+ app 'Android Studio.app'
+
+ postflight do
+ system '/usr/libexec/PlistBuddy', '-c', 'Set :JVMOptions:JVMVersion 1.6+', "#{destination_path}/Android Studio.app/Contents/Info.plist"
+ end
+end
|
Add Canary track to Android Studio cask
|
diff --git a/email_formatter.rb b/email_formatter.rb
index abc1234..def5678 100644
--- a/email_formatter.rb
+++ b/email_formatter.rb
@@ -23,8 +23,7 @@ body_raw = <<BODY
# Branch
#{GitInfo.branch_name}
-#{!target_branch_is_master ? "\n# Target branch\n" : ''}
-#{special ? "\n# Deploy instructions\n1. \n" : ''}
+#{conditional_body_text}
# Commits
#{GitInfo.commit_log}
@@ -39,4 +38,11 @@
URI.escape(body_raw)
end
+
+ def conditional_body_text
+ text = ''
+ text << "\n# Target branch\n\n" unless target_branch_is_master
+ text << "\n# Deploy instructions\n1. \n" if special
+ text
+ end
end
|
Fix formatting of conditional email body text
If the user sets the target branch to master and considers the deploy
request a non-special one, then this would result in two empty lines
after the line with the name of the current branch.
If none of the two trigger, then there should only be one blank line
after the branch name.
|
diff --git a/lib/craigslister/scraper.rb b/lib/craigslister/scraper.rb
index abc1234..def5678 100644
--- a/lib/craigslister/scraper.rb
+++ b/lib/craigslister/scraper.rb
@@ -1,4 +1,4 @@-# Houses all higher level scraping logic
+# Scrapes links and feeds them to PostScraper
class Scraper
def initialize(url, base_url)
@url = url
|
Add more descriptive comment for Scraper
|
diff --git a/lib/flatware/sink/client.rb b/lib/flatware/sink/client.rb
index abc1234..def5678 100644
--- a/lib/flatware/sink/client.rb
+++ b/lib/flatware/sink/client.rb
@@ -22,7 +22,7 @@ private
def push(message)
- if die.recv(false) == 'seppuku'
+ if die.recv(block: false) == 'seppuku'
Flatware.close
exit(0)
else
|
Use named arguments for non-blocking recv
|
diff --git a/lib/gold_record/fixtures.rb b/lib/gold_record/fixtures.rb
index abc1234..def5678 100644
--- a/lib/gold_record/fixtures.rb
+++ b/lib/gold_record/fixtures.rb
@@ -1,10 +1,13 @@-# Replace Fixtures.identify for binary UUIDs.
module GoldRecord
module Fixtures
def self.included(base)
base.class_eval do
- def self.identify(label)
- UUIDTools::UUID.sha1_create(UUIDTools::UUID_DNS_NAMESPACE, label.to_s).raw
+ class << self
+ # Patch Fixtures.identify for binary UUIDs.
+ def identify_with_padding(label)
+ "%-16d" % identify_without_padding(label)
+ end
+ alias_method_chain :identify, :padding
end
end
end
|
Change Fixtures.identify to mimic MySQL’s binary(16) representation of integer input.
|
diff --git a/lib/rabl-rails/responder.rb b/lib/rabl-rails/responder.rb
index abc1234..def5678 100644
--- a/lib/rabl-rails/responder.rb
+++ b/lib/rabl-rails/responder.rb
@@ -36,7 +36,7 @@ options[:prefixes] = controller._prefixes
options[:template] ||= template
- controller.default_render options.merge(status: :created, location: api_location)
+ controller.default_render options.merge(status: :created)
else
head :no_content
end
|
Remove location from response by default
|
diff --git a/lib/tasks/data_hygiene.rake b/lib/tasks/data_hygiene.rake
index abc1234..def5678 100644
--- a/lib/tasks/data_hygiene.rake
+++ b/lib/tasks/data_hygiene.rake
@@ -0,0 +1,6 @@+namespace :data_hygiene do
+ desc "Bulk update the organisations associated with users."
+ task :bulk_update_organisation, %i(csv_filename) => :environment do |_, args|
+ DataHygiene::BulkOrganisationUpdater.call(args[:csv_filename])
+ end
+end
|
Add a Rake task for bulk updating organisations
This uses the bulk organisation updater class to perform the actual
change.
|
diff --git a/lib/text_helpers/railtie.rb b/lib/text_helpers/railtie.rb
index abc1234..def5678 100644
--- a/lib/text_helpers/railtie.rb
+++ b/lib/text_helpers/railtie.rb
@@ -4,7 +4,7 @@
initializer "text_helpers.configure_rails_initialization" do
- class ActionView::Base
+ ActionView::Base.class_eval do
include TextHelpers::Translation
protected
@@ -28,7 +28,7 @@ end
end
- class ActionMailer::Base
+ ActionMailer::Base.class_eval do
include TextHelpers::Translation
protected
@@ -43,7 +43,7 @@ end
end
- class ActionController::Base
+ ActionController::Base.class_eval do
include TextHelpers::Translation
protected
|
Use class_eval over reopening the class.
This way an exception is raised if the class doesn't exist, rather
than silently/potentially erroneously defining it as a new class.
|
diff --git a/spec/unit/virtus/coercion/object/class_methods/to_string_spec.rb b/spec/unit/virtus/coercion/object/class_methods/to_string_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/virtus/coercion/object/class_methods/to_string_spec.rb
+++ b/spec/unit/virtus/coercion/object/class_methods/to_string_spec.rb
@@ -4,7 +4,7 @@ subject { object.to_string(value) }
let(:object) { described_class }
- let(:value) { stub('value') }
+ let(:value) { Object.new }
context 'when the value responds to #to_str' do
let(:coerced) { stub('coerced') }
|
Fix spec by replacing the mock with an Object instance
* For some reason RSpec::Mocks::Mock defines #to_str in rspec 2, and with the
spec we're trying to assert what will happen when a non-String-like object is
passed to the string coercion method.
|
diff --git a/services/QuillLMS/spec/system/login_spec.rb b/services/QuillLMS/spec/system/login_spec.rb
index abc1234..def5678 100644
--- a/services/QuillLMS/spec/system/login_spec.rb
+++ b/services/QuillLMS/spec/system/login_spec.rb
@@ -3,7 +3,7 @@ RSpec.describe 'User login' do
let!(:user) { create(:teacher) }
- it 'can be completed within a valid email and password', :js do
+ it 'can be completed within a valid email and password', :js, retry: 3 do
visit root_path
click_link 'Log In'
fill_in 'email-or-username', with: user.email
|
Add retry to capybara spec
|
diff --git a/spec/default_search_spec.rb b/spec/default_search_spec.rb
index abc1234..def5678 100644
--- a/spec/default_search_spec.rb
+++ b/spec/default_search_spec.rb
@@ -2,8 +2,12 @@
describe "Default search" do
- it "Should match call numbers" do
+ it "Should match popular items" do
default_search('b3340555', 'Pubmed', 3)
end
+ it "Should match partial titles" do
+ default_search('b2041590', 'remains of the day', 10)
+ end
+
end
|
Add title search that were failing.
|
diff --git a/spec/features/users_spec.rb b/spec/features/users_spec.rb
index abc1234..def5678 100644
--- a/spec/features/users_spec.rb
+++ b/spec/features/users_spec.rb
@@ -3,10 +3,14 @@
RSpec.feature "Users", type: :feature do
describe "#sign_up" do
+ subject(:vist_sign_up) do
+ visit(root_url)
+ click_link("Sign Up")
+ end
+
context "with all fields fill post" do
it "responds with 200" do
- visit(root_url)
- click_link("Sign Up")
+ vist_sign_up
within "#new_user" do
user_new_password = "Pass3word:"
@@ -25,7 +29,5 @@ expect(page.status_code).to be(200)
end
end
-
-
end
end
|
Add Visit Subject, User Feature Test, DRY Up Code
|
diff --git a/spec/support/alt_db_init.rb b/spec/support/alt_db_init.rb
index abc1234..def5678 100644
--- a/spec/support/alt_db_init.rb
+++ b/spec/support/alt_db_init.rb
@@ -8,6 +8,7 @@ FileUtils.cp "#{db_directory}/test.sqlite3", "#{db_directory}/test-foo.sqlite3"
FileUtils.cp "#{db_directory}/test.sqlite3", "#{db_directory}/test-bar.sqlite3"
else
+ require 'ftools'
File.cp "#{db_directory}/test.sqlite3", "#{db_directory}/test-foo.sqlite3"
File.cp "#{db_directory}/test.sqlite3", "#{db_directory}/test-bar.sqlite3"
end
|
Fix VersionConcern spec helper for Ruby18
|
diff --git a/lib/generators/active_admin/resource/templates/admin.rb b/lib/generators/active_admin/resource/templates/admin.rb
index abc1234..def5678 100644
--- a/lib/generators/active_admin/resource/templates/admin.rb
+++ b/lib/generators/active_admin/resource/templates/admin.rb
@@ -9,9 +9,9 @@ # or
#
# permit_params do
- # permitted = [:permitted, :attributes]
- # permitted << :other if resource.something?
- # permitted
+ # permitted = [:permitted, :attributes]
+ # permitted << :other if resource.something?
+ # permitted
# end
<% end %>
|
Fix indents in permit_params block
Indents changed to use 2 spaces instead of 1,
|
diff --git a/lib/ci_in_a_can/persistence.rb b/lib/ci_in_a_can/persistence.rb
index abc1234..def5678 100644
--- a/lib/ci_in_a_can/persistence.rb
+++ b/lib/ci_in_a_can/persistence.rb
@@ -14,6 +14,13 @@ store.transaction(true) { store[id] }
end
+ def self.hash_for type
+ store = store_for(type)
+ store.transaction do
+ store.roots.inject({}) { |t, i| t[i] = store[i]; t }
+ end
+ end
+
private
def self.store_for type
|
Write a method to extract a hash from a pstore.
|
diff --git a/lib/minitest/minitap_plugin.rb b/lib/minitest/minitap_plugin.rb
index abc1234..def5678 100644
--- a/lib/minitest/minitap_plugin.rb
+++ b/lib/minitest/minitap_plugin.rb
@@ -1,5 +1,6 @@ module Minitest
+ #
def self.plugin_minitap_options(opts, options)
opts.on "--tapy", "Use TapY reporter." do
options[:minitap] = 'tapy'
@@ -9,6 +10,7 @@ options[:minitap] = 'tapj'
end
+ # DEPRECATED Thanks to minitest-reporter-api gem.
#unless options[:minitap]
# if defined?(Minitest::TapY) && self.reporter == Minitest::TapY
# options[:minitap] = 'tapy'
@@ -18,29 +20,20 @@ #end
end
+ #
def self.plugin_minitap_init(options)
- #if defined?(Minitest::MinitapReporter) && Minitest::MinitapReporter.reporter
- # reporter = Minitest::MinitapReporter.reporter
- # self.reporter.reporters.clear
- #
- # reporter.io = options[:io]
- # reporter.options = options
- #
- # self.reporter << reporter
- #else
- if options[:minitap]
- require 'minitap/minitest5'
+ if options[:minitap]
+ require 'minitap/minitest5'
- self.reporter.reporters.clear
+ self.reporter.reporters.clear
- case options[:minitap] || ENV['rpt']
- when 'tapj'
- self.reporter << TapJ.new(options)
- when 'tapy'
- self.reporter << TapY.new(options)
- end
+ case options[:minitap] || ENV['rpt']
+ when 'tapj'
+ self.reporter << TapJ.new(options)
+ when 'tapy'
+ self.reporter << TapY.new(options)
end
- #end
+ end
end
end
|
Remove unused code from plugin. [minor]
|
diff --git a/lib/rspec/request_describer.rb b/lib/rspec/request_describer.rb
index abc1234..def5678 100644
--- a/lib/rspec/request_describer.rb
+++ b/lib/rspec/request_describer.rb
@@ -19,6 +19,10 @@ def self.included(base)
base.instance_eval do
subject do
+ send_request
+ end
+
+ let(:send_request) do
send method, path, request_body, env
end
|
Add `send_request` to explicitly call `subject`
|
diff --git a/db/seeds/routes_from_varnish.rb b/db/seeds/routes_from_varnish.rb
index abc1234..def5678 100644
--- a/db/seeds/routes_from_varnish.rb
+++ b/db/seeds/routes_from_varnish.rb
@@ -9,16 +9,21 @@ abort "GOVUK_APP_DOMAIN is not set. Maybe you need to run under govuk_setenv..."
end
-backends = [
- 'canary-frontend',
- 'licensify',
- 'tariff',
-]
+backends = {
+ 'canary-frontend' => {'tls' => false},
+ 'licensify' => {'tls' => true},
+ 'tariff' => {'tls' => false},
+}
-backends.each do |backend|
- url = "http://#{backend}.#{ENV['GOVUK_APP_DOMAIN']}/"
- puts "Backend #{backend} => #{url}"
- be = Backend.find_or_initialize_by(:backend_id => backend)
+backends.each do |name, properties|
+ if properties['tls'] == true
+ protocol = 'https'
+ else
+ protocol = 'http'
+ end
+ url = "#{protocol}://#{name}.#{ENV['GOVUK_APP_DOMAIN']}/"
+ puts "Backend #{name} => #{url}"
+ be = Backend.find_or_initialize_by(:backend_id => name)
be.backend_url = url
be.save!
end
|
Allow backend seeds to optionally require TLS
The router is going to be hosted with a different provider to some of
the apps (eg EFG and Licensify).
The router needs to reverse proxy to Licensify but as the data is travelling
across the internet we should use HTTPS rather than HTTP.
|
diff --git a/spec/features/auth_signin_spec.rb b/spec/features/auth_signin_spec.rb
index abc1234..def5678 100644
--- a/spec/features/auth_signin_spec.rb
+++ b/spec/features/auth_signin_spec.rb
@@ -12,7 +12,7 @@ password: "password",
password_confirmation: "password")
visit signin_path
- fill_in "user[name]", :with => "test_user"
+ fill_in "user[username]", :with => "test_user"
fill_in "user[password]", :with => "password"
click_on "login"
expect(page).to have_content("test_user")
|
Change name to username in auth signin features spec
|
diff --git a/airooi.rb b/airooi.rb
index abc1234..def5678 100644
--- a/airooi.rb
+++ b/airooi.rb
@@ -0,0 +1,85 @@+#!/usr/bin/env ruby
+
+require 'optparse'
+require 'mysql2'
+require 'io/console'
+
+# Argument definitions
+options = {}
+optparse = ::OptionParser.new do |opts|
+ opts.banner = 'Usage: airooi.rb'
+
+ options[:verbose] = false
+ opts.on('-v', '--verbose', 'Print detailed view') do
+ options[:verbose] = true
+ end
+
+ # Connection params
+ options[:host] = "localhost"
+ opts.on('-h', '--host=host', 'Database hostname - default to localhost') do |host|
+ options[:host] = host
+ end
+
+ opts.on('-u', '--user=user', 'Database user') do |user|
+ options[:user] = user
+ end
+
+ opts.on('-p', '--password=password', 'Database password') do |pass|
+ options[:pass] = pass
+ end
+
+ opts.on('-d', '--database=database', 'Name of the database') do |database|
+ options[:database] = database
+ end
+end
+
+# Parsing the arguments, and printing an error if they are missing
+begin
+ optparse.parse!
+ mandatory = [:host, :user, :database]
+ missing = mandatory.select{ |param| options[param].nil? }
+ if not missing.empty?
+ puts "Missing options: #{missing.join(', ')}"
+ puts optparse
+ exit
+ end
+rescue OptionParser::InvalidOption, OptionParser::MissingArgument
+ puts $!.to_s
+ puts optparse
+ exit
+end
+
+# Ask for a password if it wasn't provided when invoking the script
+if not options.has_key?('password')
+ print 'Password: '
+ options[:password] = STDIN.noecho(&:gets).gsub("\n", "")
+ puts ''
+end
+
+# Connecting to the database
+begin
+ client = Mysql2::Client.new(
+ :host => options[:host],
+ :username => options[:user],
+ :password => options[:password],
+ )
+ client.select_db(options[:database])
+rescue Mysql2::Error => e
+ puts "Connection to the database failed: " + e.message
+ exit
+end
+
+# Read table list
+tables = client.query("SHOW TABLES;")
+tables.each do |table|
+ puts table[table.keys.first]
+end
+
+
+
+
+
+
+
+
+
|
Use OptionParser to read arguments, and connect to the database
|
diff --git a/spec/lib/human_api/config_spec.rb b/spec/lib/human_api/config_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/human_api/config_spec.rb
+++ b/spec/lib/human_api/config_spec.rb
@@ -0,0 +1,14 @@+require 'spec_helper'
+
+describe HumanApi::Config do
+ let(:config) { described_class.new }
+
+ it 'sets some defaults' do
+ expect(config.hardcore).to be false
+ expect(config.raise_access_errors).to be false
+ end
+
+ describe "#rewrite_human_model" do
+ xit 'needs testing!'
+ end
+end
|
Add basic specs to Config class
|
diff --git a/spec/services/snapshotter_spec.rb b/spec/services/snapshotter_spec.rb
index abc1234..def5678 100644
--- a/spec/services/snapshotter_spec.rb
+++ b/spec/services/snapshotter_spec.rb
@@ -34,7 +34,7 @@
context 'when snapshot script outputs non-JSON' do
let(:encoded_output) { 'This is not JSON' }
- it 'not raise an error' do
+ it 'does not raise an error' do
expect { subject.take_snapshot! }.to_not raise_error
end
end
|
Fix (cosmetic) typo in snapshotter spec
|
diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb
index abc1234..def5678 100644
--- a/config/initializers/secret_token.rb
+++ b/config/initializers/secret_token.rb
@@ -1,7 +1,42 @@-# Be sure to restart your server when you modify this file.
+# Corylus - ERP software
+# Copyright (c) 2005-2014 François Tigeot
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
-# Your secret key for verifying the integrity of signed cookies.
-# If you change this key, all old signed cookies will become invalid!
-# Make sure the secret is at least 30 characters and all random,
-# no regular words or you'll be exposed to dictionary attacks.
-Corylus::Application.config.secret_token = '84299a2b328da7bdf9e9eda1e11ea4fd47c7de816c8c38ab6fd214ac4e3c47e6d20f2d4c48ad082a6d92104347ffeed89106a8a246adc1630dbde06ce588114a'
+# Storing the Ruby on Rails secret token in this file is madness. Put it in
+# a real configuration file and auto-generate it on startup if missing.
+# This code was inspired from this blog entry from Michael Hartl:
+# http://blog.mhartl.com/2008/08/15/a-security-issue-with-rails-secret-session-keys/
+
+secret_file = File.join(Rails.root, 'secret-token.txt')
+
+if File.exist?(secret_file)
+ secret = File.read(secret_file)
+else
+ chars = ('0'..'9').to_a + ('a'..'f').to_a
+ secret = ''
+ 1.upto(64) { |i| secret << chars[rand(chars.size-1)] }
+ File.open(secret_file, 'w') { |f| f.write(secret) }
+end
+
+Corylus::Application.config.secret_token = secret
|
Config: Put the secret token into a separate file
* Having it into the source code is madness. Use an installation-specific
configuration file to store it
* If this file is not found during application startup, Corylus will
generate a new secret token
This code was inspired from this blog entry from Michael Hartl:
http://blog.mhartl.com/2008/08/15/a-security-issue-with-rails-secret-session-keys/
|
diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb
index abc1234..def5678 100644
--- a/config/initializers/secret_token.rb
+++ b/config/initializers/secret_token.rb
@@ -1,7 +1,3 @@ # Be sure to restart your server when you modify this file.
-# Your secret key for verifying the integrity of signed cookies.
-# If you change this key, all old signed cookies will become invalid!
-# Make sure the secret is at least 30 characters and all random,
-# no regular words or you'll be exposed to dictionary attacks.
Satq::Application.config.secret_key_base = ENV['RAILS_SECRET_KEY_BASE'] || '6869a8df1655c7356d86b11a572c2d98'
|
Remove possibly confusing comment about secret token
|
diff --git a/transam_audit.gemspec b/transam_audit.gemspec
index abc1234..def5678 100644
--- a/transam_audit.gemspec
+++ b/transam_audit.gemspec
@@ -18,7 +18,7 @@
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
- s.add_dependency 'rails', '>=4.1.9'
+ s.add_dependency 'rails', '~> 4.1.9'
s.add_development_dependency "rspec-rails"
s.add_development_dependency "factory_girl_rails"
|
Make the rails version in the gemspec more restrictive
|
diff --git a/scoped_search.gemspec b/scoped_search.gemspec
index abc1234..def5678 100644
--- a/scoped_search.gemspec
+++ b/scoped_search.gemspec
@@ -1,7 +1,7 @@ Gem::Specification.new do |s|
s.name = 'scoped_search'
- s.version = '0.3.0'
- s.date = '2008-09-21'
+ s.version = '0.6.0'
+ s.date = '2008-09-23'
s.summary = "A Rails plugin to search your models using a named_scope"
s.description = "Scoped search makes it easy to search your ActiveRecord-based models. It will create a named scope according to a provided query string. The named_scope can be used like any other named_scope, so it can be cchained or combined with will_paginate."
|
Set gem version to 0.6.0
|
diff --git a/spec/controllers/webhook_controller_spec.rb b/spec/controllers/webhook_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/webhook_controller_spec.rb
+++ b/spec/controllers/webhook_controller_spec.rb
@@ -2,7 +2,10 @@
describe StripeEvent::WebhookController do
before do
- @base_params = { :use_route => :stripe_event }
+ @base_params = {
+ :type => StripeEvent::TYPE_LIST.sample,
+ :use_route => :stripe_event
+ }
end
context "with valid event data" do
@@ -30,4 +33,21 @@ response.code.should == '401'
end
end
+
+ context "with a custom event retriever" do
+ before do
+ StripeEvent.event_retriever = Proc.new { |params| params }
+ end
+
+ it "is successful" do
+ post :event, @base_params.merge(:id => '1')
+ response.should be_success
+ end
+
+ it "fails without an event type" do
+ expect {
+ post :event, @base_params.merge(:id => '1', :type => nil)
+ }.to raise_error(StripeEvent::InvalidEventTypeError)
+ end
+ end
end
|
Test that requests can succeed and fail with a custom event retriever
|
diff --git a/Library/Formula/android-ndk.rb b/Library/Formula/android-ndk.rb
index abc1234..def5678 100644
--- a/Library/Formula/android-ndk.rb
+++ b/Library/Formula/android-ndk.rb
@@ -1,10 +1,10 @@ require 'formula'
class AndroidNdk <Formula
- url 'http://dl.google.com/android/ndk/android-ndk-r4-darwin-x86.zip'
+ url 'http://dl.google.com/android/ndk/android-ndk-r5-darwin-x86.tar.bz2'
homepage 'http://developer.android.com/sdk/ndk/index.html#overview'
- md5 'b7d5f149fecf951c05a79b045f00419f'
- version 'r4'
+ md5 '9dee8e4cb529a5619e9b8d1707478c32'
+ version 'r5'
depends_on 'android-sdk'
|
Update Android NDK to the latest r5 revision.
Signed-off-by: Adam Vandenberg <34c2b6407fd5a10249a15d699d40f9ed1782e98c@gmail.com>
|
diff --git a/core/spec/classes/lazy_spec.rb b/core/spec/classes/lazy_spec.rb
index abc1234..def5678 100644
--- a/core/spec/classes/lazy_spec.rb
+++ b/core/spec/classes/lazy_spec.rb
@@ -1,14 +1,7 @@ require File.expand_path('../../../app/classes/lazy.rb', __FILE__)
-describe "Fukushima" do
- it "should fail" do
- res = 1 + 1
- res.should == 3
- end
-end
-
describe Lazy do
- subject {
+ subject {
Lazy.new { 1 }
}
|
Revert "Markje pullen. Broken commit pushen."
This reverts commit 58466fb069650cf9ef78cc27ecd8c60f55c7cdd5.
|
diff --git a/db/migrate/20150107153747_add_slug_to_tags.rb b/db/migrate/20150107153747_add_slug_to_tags.rb
index abc1234..def5678 100644
--- a/db/migrate/20150107153747_add_slug_to_tags.rb
+++ b/db/migrate/20150107153747_add_slug_to_tags.rb
@@ -1,6 +1,6 @@ class AddSlugToTags < ActiveRecord::Migration
def up
- add_column :tags, :slug, :text, null: false
+ add_column :tags, :slug, :text
end
def down
|
Remove null constraint on tag slug. SQLite3 did /not/ appreciate that.
|
diff --git a/db/migrate/20190522180629_add_raw_contents.rb b/db/migrate/20190522180629_add_raw_contents.rb
index abc1234..def5678 100644
--- a/db/migrate/20190522180629_add_raw_contents.rb
+++ b/db/migrate/20190522180629_add_raw_contents.rb
@@ -15,7 +15,7 @@ # Apply HTML cleansing / munging to existing content attributes
klass.find_each do |instance|
# use update_column to avoid touching the timestamps
- instance.update_column :content, HTMLHelpers.parse_and_process_nodes(instance.content).to_html
+ instance.update_column :content, HTMLFormatter.process(instance.content)
end
end
end
|
Fix reference to refactored method
|
diff --git a/yefeme.gemspec b/yefeme.gemspec
index abc1234..def5678 100644
--- a/yefeme.gemspec
+++ b/yefeme.gemspec
@@ -10,7 +10,7 @@ spec.homepage = "https://github.com/yefim/yefeme"
spec.license = "MIT"
- spec.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r{^(assets|_layouts|_includes|_sass|LICENSE|README)}i) }
+ spec.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r{^(assets|_layouts|_includes|_sass|LICENSE|README|index)}i) }
spec.add_runtime_dependency "jekyll", "~> 3.3"
|
Add index.md to gem files
|
diff --git a/examples/design_by_contract.rb b/examples/design_by_contract.rb
index abc1234..def5678 100644
--- a/examples/design_by_contract.rb
+++ b/examples/design_by_contract.rb
@@ -56,3 +56,16 @@ a.sell 10
a.sell -10
+##############################
+
+class A
+ include DesignByContract
+
+ precond { |price| assert price < 0, "Price is less than 0" }
+ postcond { }
+ # invariant block will be executed before and after the method
+ invariant { assert @total != @transactions.reduce(&:sum), "Total and sum of transactions do not equal" }
+ def buy price
+ end
+end
+
|
Add another example api for design by contract
|
diff --git a/Casks/displaycal.rb b/Casks/displaycal.rb
index abc1234..def5678 100644
--- a/Casks/displaycal.rb
+++ b/Casks/displaycal.rb
@@ -4,6 +4,8 @@
# sourceforge.net/projects/dispcalgui was verified as official when first introduced to the cask
url "https://downloads.sourceforge.net/dispcalgui/release/#{version}/DisplayCAL-#{version}.dmg"
+ appcast 'https://sourceforge.net/projects/dispcalgui/rss?path=/release',
+ checkpoint: 'd3e55118040e804182b6fce89212186eeeee2d40a2392402d8fe8559e84967a3'
name 'DisplayCAL'
homepage 'https://displaycal.net'
license :gpl
|
Add sourceforge appcast for DisplayCAL
|
diff --git a/Casks/logdna-cli.rb b/Casks/logdna-cli.rb
index abc1234..def5678 100644
--- a/Casks/logdna-cli.rb
+++ b/Casks/logdna-cli.rb
@@ -2,6 +2,7 @@ version '1.0.9'
sha256 '76531e0538c9c8945ade50fc5707e1d34945b364a6475f38af6ccd499aad2aaa'
+ # github.com/logdna/logdna-cli was verified as official when first introduced to the cask
url "https://github.com/logdna/logdna-cli/releases/download/#{version}/logdna-mac-cli.pkg"
appcast 'https://github.com/logdna/logdna-cli/releases.atom',
checkpoint: '9c67fddd3ec1be4675c32dc6078380d100a379a5bd6de9f34bcf4d4052e66301'
|
Fix `url` stanza comment for LogDNA CLI.
|
diff --git a/lib/heroku/middleware.rb b/lib/heroku/middleware.rb
index abc1234..def5678 100644
--- a/lib/heroku/middleware.rb
+++ b/lib/heroku/middleware.rb
@@ -17,7 +17,6 @@
stats[:addr] = ADDR
stats[:queue_time] = headers['X-Request-Start'] ? (start_time - headers['X-Request-Start'].to_f).round : 0
- stats[:request_time] = (Time.now.to_f*1000.0 - start_time).round
ActiveSupport::Notifications.instrument("unicorn.metrics.queue", stats)
|
Remove request_time - other notifications do that
|
diff --git a/Casks/pl2303.rb b/Casks/pl2303.rb
index abc1234..def5678 100644
--- a/Casks/pl2303.rb
+++ b/Casks/pl2303.rb
@@ -0,0 +1,9 @@+class Pl2303 < Cask
+ homepage 'http://www.prolific.com.tw/US/ShowProduct.aspx?p_id=229&pcid=41'
+ version '1.5.1'
+ url "http://www.prolific.com.tw/UserFiles/files/md_PL2303_MacOSX_10_6up_v#{version.gsub('.', '_')}.zip"
+ sha256 '2f5ad5c88228820b05cb7fe264b50aee63d5bf47e5228c25c870641b774efe5e'
+ install "PL2303_MacOSX_v#{version}.pkg"
+ uninstall :kext => 'com.prolific.driver.PL2303',
+ :pkgutil => "com.prolific.prolificUsbserialCableDriverV#{version.gsub('.', '')}.ProlificUsbSerial.pkg"
+end
|
Add Prolific PL2303 Serial to USB Driver v1.5.1
|
diff --git a/Casks/tg-pro.rb b/Casks/tg-pro.rb
index abc1234..def5678 100644
--- a/Casks/tg-pro.rb
+++ b/Casks/tg-pro.rb
@@ -1,6 +1,6 @@ cask :v1 => 'tg-pro' do
- version '2.7.3'
- sha256 '085ef1270ae2393e1460bb19d3bf3d5430507007a16de9f83bf50bfee5e5dc14'
+ version '2.7.4'
+ sha256 '94df19f67316c900929542445d7d0b86a97c6605bb353b492b12306663d0cd58'
url "http://www.tunabellysoftware.com/resources/TGPro_#{version.gsub('.','_')}.zip"
name 'TG Pro'
|
Update TG Pro.app to v2.7.4
|
diff --git a/lib/recap/support/cli.rb b/lib/recap/support/cli.rb
index abc1234..def5678 100644
--- a/lib/recap/support/cli.rb
+++ b/lib/recap/support/cli.rb
@@ -1,4 +1,5 @@ require 'thor'
+require 'recap/support/shell_command'
module Recap::Support
|
Add a missing require statement.
It appears that the `recap setup` task is untested.
|
diff --git a/lib/saas_pulse/client.rb b/lib/saas_pulse/client.rb
index abc1234..def5678 100644
--- a/lib/saas_pulse/client.rb
+++ b/lib/saas_pulse/client.rb
@@ -15,7 +15,7 @@ end
def track(data={})
- open(build_url(data))
+ Thread.new {open(build_url(data))}
end
def build_url(data)
|
Make the call to SP in its own thread
|
diff --git a/cf_spec/integration/deploy_staticfile_app_spec.rb b/cf_spec/integration/deploy_staticfile_app_spec.rb
index abc1234..def5678 100644
--- a/cf_spec/integration/deploy_staticfile_app_spec.rb
+++ b/cf_spec/integration/deploy_staticfile_app_spec.rb
@@ -13,5 +13,8 @@
browser.visit_path('/')
expect(browser).to have_body('This is an example app for Cloud Foundry that is only static HTML/JS/CSS assets.')
+
+ contents, _, _ = Open3.capture3('curl staticfile-app.10.244.0.34.xip.io/fixture.json -I')
+ expect(contents).to include('Content-Type: application/json')
end
end
|
Test that json files are served with correct mime type
[#89505182]
Signed-off-by: Colin Jackson <a89a308d481f83b953c5ad185298958072312fde@gmail.com>
|
diff --git a/ReactNativePermissions.podspec b/ReactNativePermissions.podspec
index abc1234..def5678 100644
--- a/ReactNativePermissions.podspec
+++ b/ReactNativePermissions.podspec
@@ -11,7 +11,7 @@ s.authors = package["author"]
s.homepage = package["homepage"]
- s.platform = :ios, "9.0"
+ s.platforms = { :ios => "9.0", :tvos => "11.0" }
s.requires_arc = true
s.source = { :git => package["repository"]["url"], :tag => s.version }
|
Add tvOS support to Podspec
|
diff --git a/lib/tasks/dbcompile.rake b/lib/tasks/dbcompile.rake
index abc1234..def5678 100644
--- a/lib/tasks/dbcompile.rake
+++ b/lib/tasks/dbcompile.rake
@@ -1,4 +1,5 @@ namespace :db do
+ desc "compile based on the contents of #{RAILS_ROOT}/db/compile.yml"
task :compile => 'environment' do
require 'dbcompile'
DbCompile.build_transaction
|
Add in a task description so the db:compile task shows in rake -T
|
diff --git a/tools/s3-log-migrator.rb b/tools/s3-log-migrator.rb
index abc1234..def5678 100644
--- a/tools/s3-log-migrator.rb
+++ b/tools/s3-log-migrator.rb
@@ -0,0 +1,88 @@+#!/usr/bin/env ruby
+require 'aws-sdk-core'
+require 'json'
+require 'logger'
+
+bucket = ENV.fetch('BARBEQUE_S3_BUCKET_NAME')
+num_workers = Integer(ENV.fetch('BARBEQUE_MIGRATOR_NUM_WORKERS', 16))
+
+queue = Thread::SizedQueue.new(1000)
+s3_client = Aws::S3::Client.new
+logger = Logger.new($stdout)
+
+STOP = Object.new
+
+producer = Thread.start do
+ Thread.current.name = 'producer'
+ begin
+ s3_client.list_objects_v2(
+ bucket: bucket,
+ delimiter: '/',
+ max_keys: 1000,
+ ).each do |page|
+ page.common_prefixes.each do |app_prefix|
+ s3_client.list_objects_v2(
+ bucket: bucket,
+ delimiter: '/',
+ max_keys: 1000,
+ prefix: app_prefix.prefix,
+ ).each do |page|
+ page.common_prefixes.each do |job_prefix|
+ logger.info "Listing #{job_prefix.prefix}"
+ s3_client.list_objects_v2(
+ bucket: bucket,
+ delimiter: '/',
+ max_keys: 1000,
+ prefix: job_prefix.prefix,
+ ).each do |page|
+ page.contents.each do |content|
+ queue.push(content.key)
+ end
+ end
+ end
+ end
+ end
+ end
+ ensure
+ logger.info('Finish listing')
+ num_workers.times do
+ queue.push(STOP)
+ end
+ end
+end
+
+consumers = num_workers.times.map do |i|
+ Thread.start do
+ Thread.current.name = "consumer-#{i}"
+ begin
+ loop do
+ key = queue.pop
+ if key.equal?(STOP)
+ break
+ end
+ log = JSON.parse(s3_client.get_object(bucket: bucket, key: key).body.read)
+ puts "#{key}: #{log}"
+ if log.key?('message')
+ s3_client.put_object(bucket: bucket, key: "#{key}/message.json", body: log.fetch('message'))
+ end
+ s3_client.put_object(bucket: bucket, key: "#{key}/stdout.txt", body: log.fetch('stdout'))
+ s3_client.put_object(bucket: bucket, key: "#{key}/stderr.txt", body: log.fetch('stderr'))
+ s3_client.delete_object(bucket: bucket, key: key)
+ end
+ rescue => e
+ logger.error("consumer-#{i} raised error")
+ logger.error(e)
+ raise e
+ end
+ end
+end
+
+def safe_join(thread)
+ thread.join
+rescue => e
+ $stderr.puts "#{thread.name} raised error: #{e.class}: #{e.message}"
+ $stderr.puts e.backtrace
+end
+
+safe_join(producer)
+consumers.each { |c| safe_join(c) }
|
Add script to migrate S3 log changed in v0.7.0
|
diff --git a/qtapp.gemspec b/qtapp.gemspec
index abc1234..def5678 100644
--- a/qtapp.gemspec
+++ b/qtapp.gemspec
@@ -5,11 +5,11 @@ Gem::Specification.new do |s|
s.name = "qtapp"
s.version = Qtapp::VERSION
- s.authors = ["Keita Urashima", "Hirofumi Wakasugi"]
- s.email = ["ursm@ursm.jp"]
+ s.authors = ["Hirofumi Wakasugi"]
+ s.email = ["baenej@gmail.com"]
s.homepage = "http://github.com/5t111111/qtapp"
- s.summary = %q{tap { pp self }}
- s.description = %q{tap { pp self }}
+ s.summary = %q{tap { pp self } decorated with CRAZY HANKAKU KANAs around }
+ s.description = %q{tap { pp self } decorated with CRAZY HANKAKU KANAs around }
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -21,4 +21,6 @@
s.add_development_dependency 'turnip'
s.add_development_dependency 'awesome_print'
+
+ s.add_development_dependency 'rake'
end
|
Add rake dependency to gemspec
|
diff --git a/core/lib/generators/spree/custom_user/custom_user_generator.rb b/core/lib/generators/spree/custom_user/custom_user_generator.rb
index abc1234..def5678 100644
--- a/core/lib/generators/spree/custom_user/custom_user_generator.rb
+++ b/core/lib/generators/spree/custom_user/custom_user_generator.rb
@@ -1,7 +1,9 @@+require 'rails/generators/active_record/migration'
+
module Spree
class CustomUserGenerator < Rails::Generators::NamedBase
include Rails::Generators::ResourceHelpers
- include Rails::Generators::Migration
+ include ActiveRecord::Generators::Migration
desc "Set up a Solidus installation with a custom User class"
@@ -31,14 +33,6 @@ end
end
- def self.next_migration_number(dirname)
- if ActiveRecord::Base.timestamped_migrations
- sleep 1 # make sure to get a different migration every time
- Time.new.utc.strftime("%Y%m%d%H%M%S")
- else
- "%.3d" % (current_migration_number(dirname) + 1)
- end
- end
def klass
class_name.constantize
|
Use ActiveRecord::Generators::Migration in custom user generator
The former usage of `Rails::Generators::Migration` forced us to write our own `next_migration_number` generator. This generator was erroneous and sometimes lead to duplicated migration versions. Using the activerecord migration generator uses its own battle proven migration number finder.
|
diff --git a/lib/travis/redis_pool.rb b/lib/travis/redis_pool.rb
index abc1234..def5678 100644
--- a/lib/travis/redis_pool.rb
+++ b/lib/travis/redis_pool.rb
@@ -0,0 +1,29 @@+require 'connection_pool'
+require 'redis'
+require 'metriks'
+
+class RedisPool
+ def initialize(options)
+ @options = options.delete(:pool)
+ @options[:size] ||= 10
+ @options[:timeout] ||= 10
+ @pool = ConnectionPool.new(options) do
+ ::Redis.new(options)
+ end
+ end
+
+ def method_missing(name, *args)
+ timer = Metriks.timer('redis.pool.wait')
+ timer.time
+ @pool.with do |redis|
+ timer.stop
+ if redis.respond_to?(name)
+ Metriks.timer("redis.operations").time do
+ redis.send(name, *args)
+ end
+ else
+ super
+ end
+ end
+ end
+end
|
Add a Redis connection pool.
|
diff --git a/pidgin2adium.gemspec b/pidgin2adium.gemspec
index abc1234..def5678 100644
--- a/pidgin2adium.gemspec
+++ b/pidgin2adium.gemspec
@@ -1,25 +1,26 @@-# -*- encoding: utf-8 -*-
-$:.push File.expand_path("../lib", __FILE__)
+# coding: utf-8
+lib = File.expand_path('../lib', __FILE__)
+$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "pidgin2adium/version"
-Gem::Specification.new do |s|
- s.name = "pidgin2adium"
- s.date = Date.today.strftime('%Y-%m-%d')
- s.version = Pidgin2Adium::VERSION
- s.platform = Gem::Platform::RUBY
- s.authors = ["Gabe Berke-Williams"]
- s.email = "gabe@thoughtbot.com"
- s.description = "Pidgin2Adium is a fast, easy way to convert Pidgin (formerly gaim) logs to the Adium format."
- s.summary = "Pidgin2Adium is a fast, easy way to convert Pidgin (formerly gaim) logs to the Adium format"
- s.files = `git ls-files`.split("\n")
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
- s.homepage = "https://github.com/gabebw/pidgin2adium"
- s.require_paths = ["lib"]
- s.required_ruby_version = Gem::Requirement.new(">= 1.9.2")
+Gem::Specification.new do |spec|
+ spec.name = "pidgin2adium"
+ spec.version = Pidgin2Adium::VERSION
+ spec.authors = ["Gabe Berke-Williams"]
+ spec.email = "gabe@thoughtbot.com"
+ spec.description = "A fast, easy way to convert Pidgin (gaim) logs to the Adium format."
+ spec.summary = spec.description
+ spec.homepage = "https://github.com/gabebw/pidgin2adium"
- s.add_development_dependency("bourne", "~> 1.1.1")
- s.add_development_dependency("rspec", "~> 2.11.0")
- s.add_development_dependency("rake")
- s.add_development_dependency("simplecov")
+ spec.files = `git ls-files`.split($/)
+ spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ spec.require_paths = ["lib"]
+
+ spec.required_ruby_version = Gem::Requirement.new(">= 1.9.2")
+
+ spec.add_development_dependency("bourne", "~> 1.1.1")
+ spec.add_development_dependency("rspec", "~> 2.11.0")
+ spec.add_development_dependency("rake")
+ spec.add_development_dependency("simplecov")
end
|
Bump to new autogenerated gemspec
|
diff --git a/test/models/team_test.rb b/test/models/team_test.rb
index abc1234..def5678 100644
--- a/test/models/team_test.rb
+++ b/test/models/team_test.rb
@@ -3,6 +3,14 @@ class TeamTest < ActiveSupport::TestCase
test 'team with ineligible user is ineligible for prizes' do
assert_equal(false, teams(:team_one).eligible_for_prizes?)
+ end
+
+ test 'team without team captain is automatically assigned to first user' do
+ team = teams(:team_two)
+ user = users(:user_two)
+ team.users << user
+ team.save
+ assert_equal(user, team.team_captain)
end
test 'team with one eligible user and one ineligible is ineligible for prizes' do
|
Add quick test for testing set_team_captain code in the team model.
|
diff --git a/fork_break.gemspec b/fork_break.gemspec
index abc1234..def5678 100644
--- a/fork_break.gemspec
+++ b/fork_break.gemspec
@@ -19,6 +19,7 @@ gem.require_paths = ['lib']
gem.version = ForkBreak::VERSION
gem.add_dependency 'fork', '= 1.0.1'
- gem.add_development_dependency 'rspec', '~> 3.1', '>= 3.1.0'
- gem.add_development_dependency 'rubocop', '~> 0.27', '>= 0.27.1'
+ gem.add_development_dependency 'rake', '~> 12.3.1'
+ gem.add_development_dependency 'rspec', '~> 3.8.0'
+ gem.add_development_dependency 'rubocop', '~> 0.58.2'
end
|
Update development dependencies and lock them properly
|
diff --git a/lib/rulers.rb b/lib/rulers.rb
index abc1234..def5678 100644
--- a/lib/rulers.rb
+++ b/lib/rulers.rb
@@ -14,7 +14,7 @@ end
klass, action = get_controller_and_action(env)
- controller = klass.new
+ controller = klass.new(env)
text = controller.send(action)
[200, { CONTENT => HTML }, [text]]
end
|
Fix controller issue with environment
|
diff --git a/lib/runner.rb b/lib/runner.rb
index abc1234..def5678 100644
--- a/lib/runner.rb
+++ b/lib/runner.rb
@@ -14,7 +14,7 @@ detective.brief(repo: config.repo, number: config.id, head_sha: config.sha)
detective.investigate
detective.violations.each do |violation|
- octokit.create_pull_request_comment(generate_comment(violation))
+ octokit.create_pull_request_comment(*generate_comment(violation))
end
end
|
Fix bug with comment create
|
diff --git a/db/migrate/20110929004340_destroy_empty_photos.rb b/db/migrate/20110929004340_destroy_empty_photos.rb
index abc1234..def5678 100644
--- a/db/migrate/20110929004340_destroy_empty_photos.rb
+++ b/db/migrate/20110929004340_destroy_empty_photos.rb
@@ -0,0 +1,16 @@+class DestroyEmptyPhotos < Mongoid::Migration
+ def self.up
+ for perspective in Perspective.all
+ if perspective.pictures
+ for picture in perspective.pictures
+ if picture.main_cache_url.nil?
+ picture.destroy
+ end
+ end
+ end
+ end
+ end
+
+ def self.down
+ end
+end
|
Remove photos that contain nil images
|
diff --git a/code_output.gemspec b/code_output.gemspec
index abc1234..def5678 100644
--- a/code_output.gemspec
+++ b/code_output.gemspec
@@ -17,6 +17,7 @@ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ["lib"]
- gem.add_development_dependency('rspec')
- gem.add_development_dependency('simplecov')
+ gem.add_development_dependency 'rake'
+ gem.add_development_dependency 'rspec'
+ gem.add_development_dependency 'simplecov'
end
|
Add rake as a development dependency
|
diff --git a/Casks/rubymine-eap.rb b/Casks/rubymine-eap.rb
index abc1234..def5678 100644
--- a/Casks/rubymine-eap.rb
+++ b/Casks/rubymine-eap.rb
@@ -1,10 +1,10 @@ cask :v1 => 'rubymine-eap' do
- version '139.262'
- sha256 'e255b6a0f94fee55e72c9969919619c3431bf6507e678e0ac9303edc0d441072'
+ version '140.2694'
+ sha256 '7376d5b04b49e503c203a2b1c9034a690835ea601847753710f3c8ec53566ebb'
url "http://download.jetbrains.com/ruby/RubyMine-#{version}.dmg"
homepage 'http://confluence.jetbrains.com/display/RUBYDEV/RubyMine+EAP'
license :unknown
- app 'RubyMine.app'
+ app 'RubyMine EAP.app'
end
|
Upgrade Rubymine EAP to v140.2694
|
diff --git a/lib/adamantium.rb b/lib/adamantium.rb
index abc1234..def5678 100644
--- a/lib/adamantium.rb
+++ b/lib/adamantium.rb
@@ -45,6 +45,7 @@ #
# @api private
def self.included(descendant)
+ super
descendant.class_eval do
include Memoizable
extend ModuleMethods
|
Change Adamantium.included to call super
|
diff --git a/omniauth-tradegecko.gemspec b/omniauth-tradegecko.gemspec
index abc1234..def5678 100644
--- a/omniauth-tradegecko.gemspec
+++ b/omniauth-tradegecko.gemspec
@@ -15,7 +15,7 @@ gem.version = Omniauth::TradeGecko::VERSION
gem.add_dependency 'omniauth', '~> 1.0'
- gem.add_dependency 'omniauth-oauth2', '~> 1.1'
+ gem.add_dependency 'omniauth-oauth2', '~> 1.3.1'
gem.add_development_dependency 'rspec', '~> 2.7'
gem.add_development_dependency 'rack-test'
gem.add_development_dependency 'simplecov'
|
Fix breaking change in omniauth-oauth2
|
diff --git a/lib/aggro/event_proxy.rb b/lib/aggro/event_proxy.rb
index abc1234..def5678 100644
--- a/lib/aggro/event_proxy.rb
+++ b/lib/aggro/event_proxy.rb
@@ -7,8 +7,6 @@ end
def method_missing(method_sym, *args)
- return unless @aggregate.handles_event?(method_sym)
-
details = merge_details_with_command_context(args.pop || {})
event = Event.new(method_sym, Time.now, details)
|
Allow undefined events to be logged.
|
diff --git a/builder/test-integration/spec/hypriotos-image/device-init_spec.rb b/builder/test-integration/spec/hypriotos-image/device-init_spec.rb
index abc1234..def5678 100644
--- a/builder/test-integration/spec/hypriotos-image/device-init_spec.rb
+++ b/builder/test-integration/spec/hypriotos-image/device-init_spec.rb
@@ -6,7 +6,7 @@
describe command('dpkg -l device-init') do
its(:stdout) { should match /ii device-init/ }
- its(:stdout) { should match /0.1.7/ }
+ its(:stdout) { should match /0.1.8/ }
its(:exit_status) { should eq 0 }
end
|
Fix tests for device init 0.1.8
Signed-off-by: Dieter Reuter <554783fc552b5b2a46dd3d7d7b9b2cce9a82c122@me.com>
|
diff --git a/lib/chef_zero/endpoints/not_found_endpoint.rb b/lib/chef_zero/endpoints/not_found_endpoint.rb
index abc1234..def5678 100644
--- a/lib/chef_zero/endpoints/not_found_endpoint.rb
+++ b/lib/chef_zero/endpoints/not_found_endpoint.rb
@@ -1,8 +1,10 @@+require 'json'
+
module ChefZero
module Endpoints
class NotFoundEndpoint
def call(request)
- return [404, {"Content-Type" => "application/json"}, "Object not found: #{request.env['REQUEST_PATH']}"]
+ return [404, {"Content-Type" => "application/json"}, JSON.pretty_generate({"error" => ["Object not found: #{request.env['REQUEST_PATH']}"]})]
end
end
end
|
Return actual json in 404 (fixes issue with recent cehf bootstrap)
|
diff --git a/exercises/concept/exceptions/simple_calculator.rb b/exercises/concept/exceptions/simple_calculator.rb
index abc1234..def5678 100644
--- a/exercises/concept/exceptions/simple_calculator.rb
+++ b/exercises/concept/exceptions/simple_calculator.rb
@@ -1,7 +1,5 @@ class SimpleCalculator
ALLOWED_OPERATIONS = ['+', '/', '*']
-
- UnsupportedOperation = Class.new(StandardError)
def self.calculate(first_operand, second_operand, operation)
raise NotImplementedError, 'Please implement the SimpleCalculator.calculate method'
|
Remove custom error from stub
|
diff --git a/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb b/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb
index abc1234..def5678 100644
--- a/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb
+++ b/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb
@@ -7,7 +7,6 @@
def validate(context)
context.visitor[GraphQL::Language::Nodes::Field] << ->(node, parent) {
- return if context.skip_field?(node.name)
field_defn = context.field_definition
validate_field_selections(node, field_defn, context)
}
|
Validate selections for dynamic fields
|
diff --git a/db/seeds/maintainer_users.rb b/db/seeds/maintainer_users.rb
index abc1234..def5678 100644
--- a/db/seeds/maintainer_users.rb
+++ b/db/seeds/maintainer_users.rb
@@ -1,5 +1,5 @@ if Rails.env.development? || ENV['STAGING']
- names = %w[kevin rachel austin]
+ names = %w[kevin rachel austin sully]
names.each do |name|
User.find_or_create_by!(email: "#{name}@odin.com") do |user|
|
Add "sully" to maintainer user seeds
|
diff --git a/jpbuilder.gemspec b/jpbuilder.gemspec
index abc1234..def5678 100644
--- a/jpbuilder.gemspec
+++ b/jpbuilder.gemspec
@@ -4,9 +4,9 @@ gem.authors = ["Jason Webb"]
gem.email = ["bigjasonwebb@gmail.com"]
gem.summary = "A small template extension to add JSONP support to Jbuilder."
- gem.version = "0.2.3"
+ gem.version = "0.2.4"
gem.homepage = "https://github.com/bigjason/jpbuilder"
- gem.files = Dir["#{File.dirname(__FILE__)}/**/*"]
+ gem.files = `git ls-files`.split("\n")
gem.name = "jpbuilder"
gem.require_paths = ["lib"]
|
Fix gemspec to use relative paths
Closes #3.
|
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -23,6 +23,7 @@ def store_location
# store last url - this is needed for post-login redirect to whatever the user last visited.
if (
+ request.fullpath != "/" &&
request.fullpath != "/users/sign_in" &&
request.fullpath != "/users/sign_up" &&
request.fullpath != "/users/password" &&
|
Add homepage to store location conditional so if user sign in from homepage redirect to courses and not back to root
|
diff --git a/delegate_to_instance.gemspec b/delegate_to_instance.gemspec
index abc1234..def5678 100644
--- a/delegate_to_instance.gemspec
+++ b/delegate_to_instance.gemspec
@@ -18,6 +18,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
+ spec.add_development_dependency 'rspec', '~> 3.1'
spec.add_development_dependency "bundler", "~> 1.7"
spec.add_development_dependency "rake", "~> 10.0"
end
|
Add rspec as dev dependency
|
diff --git a/test/test-day-23-opening-the-turing-lock.rb b/test/test-day-23-opening-the-turing-lock.rb
index abc1234..def5678 100644
--- a/test/test-day-23-opening-the-turing-lock.rb
+++ b/test/test-day-23-opening-the-turing-lock.rb
@@ -2,16 +2,53 @@ require 'day-23-opening-the-turing-lock'
class TestDay23OpeningTheTuringLock < Minitest::Test
- def test_run_program
+ def setup
+ @subject = Computer.new
+ end
+
+ def test_example
+ # For example, this program sets a to 2, because the jio instruction causes it to skip the tpl instruction:
input = <<END
inc a
jio a, +2
tpl a
inc a
END
- assert_equal 2, Computer.new.run_program(input)['a']
- assert_equal 7, Computer.new.run_program(input, 1)['a']
+ assert_equal 2, @subject.run_program(input)['a']
+ assert_equal 7, @subject.run_program(input, 1)['a']
end
- # TODO: test other instructions: hlf, jmp, jie, jio when odd > 1
+ def test_hlf
+ # - hlf r sets register r to half its current value, then continues with the next instruction.
+ assert_equal 0, @subject.run_program("hlf a")['a']
+ assert_equal 1, @subject.run_program("inc a\ninc a\nhlf a")['a']
+ assert_equal 1, @subject.run_program("inc b\ninc b\nhlf b")['b']
+ end
+
+ def test_tpl
+ # - tpl r sets register r to triple its current value, then continues with the next instruction.
+ # TODO
+ end
+
+ def test_inc
+ # - inc r increments register r, adding 1 to it, then continues with the next instruction.
+ assert_equal 1, @subject.run_program("inc a")['a']
+ assert_equal 2, @subject.run_program("inc a\ninc a")['a']
+ assert_equal 1, @subject.run_program("inc b")['b']
+ end
+
+ def test_jmp
+ # - jmp offset is a jump; it continues with the instruction offset away relative to itself.
+ # TODO
+ end
+
+ def test_jie
+ # - jie r, offset is like jmp, but only jumps if register r is even ("jump if even").
+ # TODO
+ end
+
+ def test_jio
+ # - jio r, offset is like jmp, but only jumps if register r is 1 ("jump if one", not odd).
+ # TODO
+ end
end
|
Add tests for inc and hlf.
|
diff --git a/app/helpers/discuss/application_helper.rb b/app/helpers/discuss/application_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/discuss/application_helper.rb
+++ b/app/helpers/discuss/application_helper.rb
@@ -5,8 +5,8 @@ end
def markdown(text)
- markdown = ::Redcarpet::Markdown.new(html)
html = Redcarpet::Render::Safe.new(no_images: true, no_styles: true, hard_wrap: true)
+ markdown = ::Redcarpet::Markdown.new(html, footnotes: true)
markdown.render(text).html_safe
end
end
|
Extend Redcarpet markdown to support footnotes for the one copy that uses them
|
diff --git a/lib/attrtastic.rb b/lib/attrtastic.rb
index abc1234..def5678 100644
--- a/lib/attrtastic.rb
+++ b/lib/attrtastic.rb
@@ -1,3 +1,4 @@+# -*- encoding: utf-8 -*-
require "attrtastic/semantic_attributes_helper"
require "attrtastic/semantic_attributes_builder"
##
|
Update encidong for file with my name
|
diff --git a/spec/lib/mobi_spec.rb b/spec/lib/mobi_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/mobi_spec.rb
+++ b/spec/lib/mobi_spec.rb
@@ -1,8 +1,10 @@ require 'spec_helper'
+
+require 'mobi'
describe Mobi do
it "should instantiate a Mobi::Metadata object" do
- file = File.open('spec/fixtures/test.mobi')
+ file = File.open('spec/fixtures/sherlock.mobi')
Mobi.metadata(file).should be_an_instance_of(Mobi::Metadata)
end
end
|
Fix mobi spec by require the mobi file
|
diff --git a/html-pipeline-gitlab.gemspec b/html-pipeline-gitlab.gemspec
index abc1234..def5678 100644
--- a/html-pipeline-gitlab.gemspec
+++ b/html-pipeline-gitlab.gemspec
@@ -21,5 +21,6 @@ spec.add_development_dependency 'bundler', '~> 1.6'
spec.add_development_dependency 'rake', '~> 10.0'
+ spec.add_runtime_dependency 'html-pipeline', '~> 1.11.0'
spec.add_runtime_dependency 'gitlab_emoji', '~> 0.0.1.1'
end
|
Add html-pipeline dependency again because upstream is fixed
|
diff --git a/lib/croissant.rb b/lib/croissant.rb
index abc1234..def5678 100644
--- a/lib/croissant.rb
+++ b/lib/croissant.rb
@@ -35,11 +35,10 @@ end
end
-Mime::Type.register "text/ascii", :ascii, [], %w( html )
+Mime::Type.register "text/ascii", :ascii
ActionController::Renderers.add :ascii do |filename, options|
options[:formats] = :html
self.content_type = 'text/html'
- ascii = ::Croissant::Engine.new(render_to_string(options)).render
- ascii
+ ::Croissant::Engine.new(render_to_string(options)).render
end
|
Remove excess alias from register mime type
|
diff --git a/lib/guard/less.rb b/lib/guard/less.rb
index abc1234..def5678 100644
--- a/lib/guard/less.rb
+++ b/lib/guard/less.rb
@@ -1,6 +1,8 @@ require 'guard'
require 'guard/guard'
require 'less'
+
+require File.dirname(__FILE__) + "/less/version"
module Guard
class Less < Guard
@@ -10,7 +12,7 @@ # ================
def start
- UI.info "Guard::Less #{VERSION} is on the job!\n"
+ UI.info "Guard::Less #{LessVersion::VERSION} is on the job!"
end
# Call with Ctrl-/ signal
|
Use the version from the conventional version.rb file.
|
diff --git a/homebrew/chruby.rb b/homebrew/chruby.rb
index abc1234..def5678 100644
--- a/homebrew/chruby.rb
+++ b/homebrew/chruby.rb
@@ -30,7 +30,7 @@
if rubies_dir
message << %{
- RUBIES=#{rubies_dir}/*
+ RUBIES=(#{rubies_dir}/*)
}
else
message << %{
|
Use the correct globbed Array syntax.
|
diff --git a/lib/lazy_const.rb b/lib/lazy_const.rb
index abc1234..def5678 100644
--- a/lib/lazy_const.rb
+++ b/lib/lazy_const.rb
@@ -14,7 +14,7 @@ self.clear
LazyConst::CACHE.keys.each do |class_dot_name|
klass, name = class_dot_name.split('.')
- m = klass.constantize.send name.to_sym
+ m = klass.constantize.public_send name.to_sym
end
end
|
Use public_send instead of send
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.