diff stringlengths 65 26.7k | message stringlengths 7 9.92k |
|---|---|
diff --git a/config/initializers/log_formatting.rb b/config/initializers/log_formatting.rb
index abc1234..def5678 100644
--- a/config/initializers/log_formatting.rb
+++ b/config/initializers/log_formatting.rb
@@ -1,19 +1,21 @@ # Taken from: http://cbpowell.wordpress.com/2013/08/09/beautiful-logging-for-ruby-on-rails-4/
-class ActiveSupport::Logger::SimpleFormatter
- SEVERITY_TO_TAG_MAP = {'DEBUG'=>'meh', 'INFO'=>'fyi', 'WARN'=>'hmm', 'ERROR'=>'wtf', 'FATAL'=>'omg', 'UNKNOWN'=>'???'}
- SEVERITY_TO_COLOR_MAP = {'DEBUG'=>'0;37', 'INFO'=>'32', 'WARN'=>'33', 'ERROR'=>'31', 'FATAL'=>'31', 'UNKNOWN'=>'37'}
- USE_HUMOROUS_SEVERITIES = false
-
- def call(severity, time, progname, msg)
- if USE_HUMOROUS_SEVERITIES
- formatted_severity = sprintf("%-3s",SEVERITY_TO_TAG_MAP[severity])
- else
- formatted_severity = sprintf("%-5s",severity)
+unless Rails.env == "development"
+ class ActiveSupport::Logger::SimpleFormatter
+ SEVERITY_TO_TAG_MAP = {'DEBUG'=>'meh', 'INFO'=>'fyi', 'WARN'=>'hmm', 'ERROR'=>'wtf', 'FATAL'=>'omg', 'UNKNOWN'=>'???'}
+ SEVERITY_TO_COLOR_MAP = {'DEBUG'=>'0;37', 'INFO'=>'32', 'WARN'=>'33', 'ERROR'=>'31', 'FATAL'=>'31', 'UNKNOWN'=>'37'}
+ USE_HUMOROUS_SEVERITIES = false
+
+ def call(severity, time, progname, msg)
+ if USE_HUMOROUS_SEVERITIES
+ formatted_severity = sprintf("%-3s",SEVERITY_TO_TAG_MAP[severity])
+ else
+ formatted_severity = sprintf("%-5s",severity)
+ end
+
+ formatted_time = time.strftime("%Y-%m-%d %H:%M:%S.") << time.usec.to_s[0..2].rjust(3)
+ color = SEVERITY_TO_COLOR_MAP[severity]
+
+ "\033[0;37m#{formatted_time}\033[0m [\033[#{color}m#{formatted_severity}\033[0m] #{msg.strip} (pid:#{$$})\n"
end
-
- formatted_time = time.strftime("%Y-%m-%d %H:%M:%S.") << time.usec.to_s[0..2].rjust(3)
- color = SEVERITY_TO_COLOR_MAP[severity]
-
- "\033[0;37m#{formatted_time}\033[0m [\033[#{color}m#{formatted_severity}\033[0m] #{msg.strip} (pid:#{$$})\n"
end
-end+end
| Use the smaller and default log format in dev
PR #55
refs #1391
|
diff --git a/hi.gemspec b/hi.gemspec
index abc1234..def5678 100644
--- a/hi.gemspec
+++ b/hi.gemspec
@@ -18,7 +18,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
- spec.add_development_dependency "bundler", "~> 1.5"
- spec.add_development_dependency "rake"
+ spec.add_development_dependency 'bundler', '~> 1.5'
+ spec.add_development_dependency 'rake', '~> 10.1.1'
spec.add_development_dependency 'rspec', '~> 2.14.1'
end
| Add version to rake in gemspec
|
diff --git a/app/controllers/users.rb b/app/controllers/users.rb
index abc1234..def5678 100644
--- a/app/controllers/users.rb
+++ b/app/controllers/users.rb
@@ -1,14 +1,28 @@+get '/users/:id/edit' do
+ @user = current_user
+
+ if @user && (@user.id == params[:id].to_i)
+ erb :'users/edit'
+ else
+ redirect '/surveys'
+ end
+end
+
get '/signup' do
erb :'users/signup'
end
get '/login' do
- erb :'users/login'
+ unless logged_in?
+ erb :'users/login'
+ else
+ redirect '/surveys'
+ end
end
get '/logout' do
session.clear
- redirect '/'
+ redirect '/surveys'
end
post '/login' do
@@ -18,13 +32,14 @@ @errors = ["Cannot find user #{params[:username]}."]
erb :'users/login'
elsif @user.password == params[:password]
- session[:user_id] == @user.id
- redirect '/'
+ session[:user_id] = @user.id
+ redirect '/surveys'
else
@errors = ["Incorrect password."]
erb :'users/login'
end
end
+
get '/users/:id' do
@user = User.find(params[:id])
@@ -35,6 +50,7 @@ @user = User.new(params[:user])
if @user.save
+ session[:user_id] = @user.id
redirect '/'
else
@errors = @user.errors.full_messages
| Add route that shows a form where the user can edit their own password.
|
diff --git a/app/controllers/votes.rb b/app/controllers/votes.rb
index abc1234..def5678 100644
--- a/app/controllers/votes.rb
+++ b/app/controllers/votes.rb
@@ -24,11 +24,32 @@
post '/answers/:id/vote' do
answer = Answer.find(params[:id])
- question = answer.question
- if params[:vote] == "upvote"
- answer.votes.create(value: 1, user_id: current_user.id )
- else
- answer.votes.create(value: -1, user_id: current_user.id )
+ @question = answer.question
+ @answers = @question.answers
+ @score = get_score(@question)
+
+ if params[:vote] == "upvote"
+ vote = answer.votes.new(value: 1, user_id: current_user.id )
+ if vote.save
+ redirect "/questions/#{@question.id}"
+ else
+ @errors = vote.errors.full_messages
+ erb :"questions/show"
+ end
+ else params[:vote] == "downvote"
+ vote = answer.votes.new(value: -1, user_id: current_user.id )
+ if vote.save
+ redirect "/questions/#{@question.id}"
+ else
+ @errors = vote.errors.full_messages
+ erb :"questions/show"
+ end
end
- redirect "/questions/#{question.id}"
-end+end
+# if params[:vote] == "upvote"
+# answer.votes.create(value: 1, user_id: current_user.id )
+# else
+# answer.votes.create(value: -1, user_id: current_user.id )
+# end
+# redirect "/questions/#{question.id}"
+# end | Add logic to answer vote buttons
|
diff --git a/lib/remitano/client/coin_withdrawals.rb b/lib/remitano/client/coin_withdrawals.rb
index abc1234..def5678 100644
--- a/lib/remitano/client/coin_withdrawals.rb
+++ b/lib/remitano/client/coin_withdrawals.rb
@@ -10,11 +10,12 @@ config.net.post("/coin_withdrawals/#{id}/cancel").execute
end
- def withdraw(coin_address, coin_amount)
+ def withdraw(coin_address:, coin_amount:, destination_tag: nil)
params = {
coin_address: coin_address,
coin_currency: coin,
- coin_amount: coin_amount
+ coin_amount: coin_amount,
+ destination_tag: destination_tag,
}
response = config.net.post("/coin_withdrawals", coin_withdrawal: params).execute
config.action_confirmations.confirm_if_neccessary!(response)
| Allow withdraw coin with destination tag
|
diff --git a/lib/exceptions/backends/honeybadger.rb b/lib/exceptions/backends/honeybadger.rb
index abc1234..def5678 100644
--- a/lib/exceptions/backends/honeybadger.rb
+++ b/lib/exceptions/backends/honeybadger.rb
@@ -2,7 +2,7 @@
module Exceptions
module Backends
- # Public: The Honeybadger backend is a Backend implementation that sends the
+ # Public: The Honeybadger backend is a Backend implementation that sends the
# exception to Honeybadger.
class Honeybadger < Backend
attr_reader :honeybadger
@@ -11,22 +11,20 @@ @honeybadger = honeybadger
end
- def notify(exception, options = {})
- return if options[:rack_env] && rack_ignore?(options[:rack_env])
- defaults = { backtrace: caller.drop(1) }
- if id = honeybadger.notify_or_ignore(exception, defaults.merge(options))
- Result.new id
+ def notify(exception_or_opts, opts = {})
+ if id = honeybadger.notify(exception_or_opts, opts)
+ Result.new(id)
else
BadResult.new
end
end
def context(ctx)
- honeybadger.context ctx
+ honeybadger.context(ctx)
end
def clear_context
- honeybadger.clear!
+ honeybadger.context.clear!
end
class Result < ::Exceptions::Result
@@ -34,16 +32,6 @@ "https://www.honeybadger.io/notice/#{id}"
end
end
-
- private
-
- def rack_ignore?(env)
- return honeybadger.
- configuration.
- ignore_user_agent.
- flatten.
- any? { |ua| ua === env['HTTP_USER_AGENT'] }
- end
end
end
end
| Update to be compatible w HB 2
|
diff --git a/lib/rpush/daemon/interruptible_sleep.rb b/lib/rpush/daemon/interruptible_sleep.rb
index abc1234..def5678 100644
--- a/lib/rpush/daemon/interruptible_sleep.rb
+++ b/lib/rpush/daemon/interruptible_sleep.rb
@@ -5,15 +5,21 @@ class InterruptibleSleep
def initialize(duration)
@duration = duration
- @obj = Object.new
- @obj.extend(MonitorMixin)
- @condition = @obj.new_cond
@stop = false
+
+ @wakeup_obj = Object.new
+ @wakeup_obj.extend(MonitorMixin)
+ @wakeup_condition = @wakeup_obj.new_cond
+
+ @sleep_obj = Object.new
+ @sleep_obj.extend(MonitorMixin)
+ @sleep_condition = @sleep_obj.new_cond
end
def sleep
return if @stop
- @obj.synchronize { @condition.wait(100_000) }
+ goto_sleep
+ wait_for_wakeup
end
def start
@@ -21,6 +27,7 @@
@thread = Thread.new do
loop do
+ wait_for_sleeper
break if @stop
Kernel.sleep(@duration)
wakeup
@@ -35,7 +42,21 @@ end
def wakeup
- @obj.synchronize { @condition.signal }
+ @wakeup_obj.synchronize { @wakeup_condition.signal }
+ end
+
+ private
+
+ def goto_sleep
+ @sleep_obj.synchronize { @sleep_condition.signal }
+ end
+
+ def wait_for_wakeup
+ @wakeup_obj.synchronize { @wakeup_condition.wait(@duration * 2) }
+ end
+
+ def wait_for_sleeper
+ @sleep_obj.synchronize { @sleep_condition.wait }
end
end
end
| Fix InterruptibleSleep so that it always sleep for the given duration.
|
diff --git a/lib/localized/parser/numeric_parser.rb b/lib/localized/parser/numeric_parser.rb
index abc1234..def5678 100644
--- a/lib/localized/parser/numeric_parser.rb
+++ b/lib/localized/parser/numeric_parser.rb
@@ -22,7 +22,7 @@ private
def build_object(value)
- value.gsub(delimiter, '_').gsub(separator, '.').to_f
+ BigDecimal.new value.gsub(delimiter, '_').gsub(separator, '.')
end
def delimiter
| Use BigDecimal.new insted of to_f avoiding rounding errors.
|
diff --git a/lib/services/base/uniqueness_checker.rb b/lib/services/base/uniqueness_checker.rb
index abc1234..def5678 100644
--- a/lib/services/base/uniqueness_checker.rb
+++ b/lib/services/base/uniqueness_checker.rb
@@ -7,16 +7,18 @@
def check_uniqueness!(*args)
raise 'A variable named @uniqueness_key is already defined. Have you called `check_uniqueness!` twice?' if defined?(@uniqueness_key)
- args = method(__method__).parameters.map { |arg| eval arg[1].to_s } if args.empty?
+ raise 'Could not find @uniqueness_all_args' unless defined?(@uniqueness_all_args)
+ args = @uniqueness_all_args if args.empty?
@uniqueness_key = uniqueness_key(args)
- if Services.configuration.redis.exists(@uniqueness_key)
- raise self.class::NotUniqueError
+ if similar_service_id = Services.configuration.redis.get(@uniqueness_key)
+ raise self.class::NotUniqueError, "Service #{self.class} with args #{args} is not unique, a similar service is already running: #{similar_service_id}"
else
- Services.configuration.redis.setex @uniqueness_key, 60 * 60, Time.now
+ Services.configuration.redis.setex @uniqueness_key, 60 * 60, @id
end
end
def call(*args)
+ @uniqueness_all_args = args
super
ensure
Services.configuration.redis.del @uniqueness_key if defined?(@uniqueness_key)
@@ -28,9 +30,10 @@ [
'services',
'uniqueness',
- self.class.to_s,
- Digest::MD5.hexdigest(args.to_s)
- ].join(':')
+ self.class.to_s
+ ].tap do |key|
+ key << Digest::MD5.hexdigest(args.to_s) unless args.empty?
+ end.join(':')
end
end
end
| Refactor and fix service uniqueness checker, set a custom message on NotUniqueError
|
diff --git a/spec/models/student_spec.rb b/spec/models/student_spec.rb
index abc1234..def5678 100644
--- a/spec/models/student_spec.rb
+++ b/spec/models/student_spec.rb
@@ -1,7 +1,7 @@ require 'rails_helper'
require 'shoulda-matchers'
RSpec.describe Student, type: :model do
- it { should belong_to :user }
+ it { should belong_to :teacher }
it { should validate_presence_of :first_name }
it { should validate_presence_of :last_name }
it { should validate_presence_of :grade }
| Fix student validation to check for belongs_to teacher instead of user
|
diff --git a/app/workers/import_connection_data_job.rb b/app/workers/import_connection_data_job.rb
index abc1234..def5678 100644
--- a/app/workers/import_connection_data_job.rb
+++ b/app/workers/import_connection_data_job.rb
@@ -24,6 +24,6 @@ end
def date_fields
- %w(creation_date startDate publishedAt pushed_at)
+ %w(creation_date startDate publishedAt pushed_at created)
end
end
| Add created at field for meetup
|
diff --git a/crass.gemspec b/crass.gemspec
index abc1234..def5678 100644
--- a/crass.gemspec
+++ b/crass.gemspec
@@ -11,6 +11,13 @@ s.homepage = 'https://github.com/rgrove/crass/'
s.license = 'MIT'
+ s.metadata = {
+ 'bug_tracker_uri' => 'https://github.com/rgrove/crass/issues',
+ 'changelog_uri' => "https://github.com/rgrove/crass/blob/v#{s.version}/HISTORY.md",
+ 'documentation_uri' => "https://www.rubydoc.info/gems/crass/#{s.version}",
+ 'source_code_uri' => "https://github.com/rgrove/crass/tree/v#{s.version}",
+ }
+
s.platform = Gem::Platform::RUBY
s.required_ruby_version = Gem::Requirement.new('>= 1.9.2')
| Add project metadata to the gemspec
As per https://guides.rubygems.org/specification-reference/#metadata,
add metadata to the gemspec file. This'll allow people to more easily
access the source code, raise issues and read the changelog. These
`bug_tracker_uri`, `changelog_uri`, `documentation_uri`, and
`source_code_uri` links will appear on the rubygems page at
https://rubygems.org/gems/crass and be available via the rubygems API
after the next release.
|
diff --git a/lib/plugins/commit_msg/release_note.rb b/lib/plugins/commit_msg/release_note.rb
index abc1234..def5678 100644
--- a/lib/plugins/commit_msg/release_note.rb
+++ b/lib/plugins/commit_msg/release_note.rb
@@ -0,0 +1,14 @@+module Causes::GitHook
+ class ReleaseNote < HookSpecificCheck
+ include HookRegistry
+
+ EMPTY_RELEASE_NOTE = /^release notes?\s*[:.]?\n{2,}/im
+ def run_check
+ if commit_message.join =~ EMPTY_RELEASE_NOTE
+ return :warn, 'Empty release note found, either add one or remove it'
+ end
+
+ :good
+ end
+ end
+end
| Add empty 'release note' linter for commit message
Still a warning, but better than letting these slip through.
Related story:
https://www.pivotaltracker.com/story/show/48023785 (delivery)
Change-Id: I45e6fdb7dfa64ba2e5e6e9b6444cb51fb87e13ee
Reviewed-on: https://gerrit.causes.com/22211
Tested-by: Aiden Scandella <1faf1e8390cdac9204f160c35828cc423b7acd7b@causes.com>
Reviewed-by: Joe Lencioni <1dd72cf724deaab5db236f616560fc7067b734e1@causes.com>
|
diff --git a/lib/serf/receivers/msgpack_receiver.rb b/lib/serf/receivers/msgpack_receiver.rb
index abc1234..def5678 100644
--- a/lib/serf/receivers/msgpack_receiver.rb
+++ b/lib/serf/receivers/msgpack_receiver.rb
@@ -10,10 +10,15 @@ class MsgpackHandler
def initialize(app, options={})
@app = app
+ @logger = options.fetch(:logger) { ::Serf::NullObject.new }
end
def call(env)
@app.call env.stringify_keys
+ rescue => e
+ @logger = options.fetch(:logger) { ::Serf::NullObject.new }
+ # We reraise this error so it's passed on through to the remote client.
+ raise e
end
end
| Add error logging and reraising of errors in msgpack receiver.
Details:
* Want some local logging of caught errors in msgpack receiver.
So now both msgpack and redis_pubsub receivers will log an error
if an exception is routed up to them.
* We are ok with reraising the error since msgpack rpc is good
for us that way. Let the remote client know.
This is for cases where we want handlers to return data
directly to the client. This is the case of query commands.
|
diff --git a/app/models/admin_area.rb b/app/models/admin_area.rb
index abc1234..def5678 100644
--- a/app/models/admin_area.rb
+++ b/app/models/admin_area.rb
@@ -22,6 +22,10 @@ class AdminArea < ActiveRecord::Base
belongs_to :region
- has_friendly_id :short_name, :use_slug => true
+ has_friendly_id :slug_name, :use_slug => true
+ def slug_name
+ return short_name if short_name
+ return name
+ end
end
| Handle older format data where there is no short name
|
diff --git a/app/models/api/client.rb b/app/models/api/client.rb
index abc1234..def5678 100644
--- a/app/models/api/client.rb
+++ b/app/models/api/client.rb
@@ -15,7 +15,7 @@ end
def post(path, body)
- response = ActiveSupport::Notifications.instrument('api_request', path: path, method: 'post') do
+ response = log_request(path, 'post') do
client.post(uri(path), json: body, ssl_context: @ssl_context)
end
@response_handler.handle_response(response.status, 201, response.to_s)
@@ -28,6 +28,12 @@
private
+ def log_request(path, method)
+ ActiveSupport::Notifications.instrument('api_request', path: path, method: method) do
+ yield
+ end
+ end
+
def uri(path)
@host + "/api" + path
end
| 3433: Refactor to facilitate logging of api requests
Authors: 366e0de6ccd0189907498dabc55231b9a53e9bf8@richardtowers
|
diff --git a/app/models/assignment.rb b/app/models/assignment.rb
index abc1234..def5678 100644
--- a/app/models/assignment.rb
+++ b/app/models/assignment.rb
@@ -11,20 +11,20 @@
def as_json(options={})
json = {
- :id => id,
- :user_id => user_id,
- :project_id => project_id,
- :title => title,
- :completed_at => completed_at,
- :current_node_id => current_node_id,
- :description => description,
- :visible => visible
+ :id => self.id,
+ :user_id => self.user_id,
+ :project_id => self.project_id,
+ :title => self.title,
+ :completed_at => self.completed_at,
+ :current_node_id => self.current_node_id,
+ :description => self.description,
+ :visible => self.visible
}
- if public_url_token.present? && visible
+ if self.public_url_token.present? && visible
json[:url] = Rails.application.routes.url_helpers.public_map_url(
- :token => public_url_token,
- :host => options.fetch(:host, "app.trailblazer.io"))
+ :token => self.public_url_token,
+ :host => options.fetch(:host, "app.trailblazer.io"))
end
json
| Use self.* for model fields
|
diff --git a/app/models/repository.rb b/app/models/repository.rb
index abc1234..def5678 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -13,4 +13,31 @@ length: { maximum: Constants::NAME_MAX_LENGTH }
validates :team, presence: true
validates :created_by, presence: true
+
+ def copy(created_by, name)
+ new_repo = nil
+
+ begin
+ Repository.transaction do
+ # Clone the repository object
+ new_repo = dup
+ new_repo.created_by = created_by
+ new_repo.name = name
+ new_repo.save!
+
+ # Clone columns (only if new_repo was saved)
+ repository_columns.find_each do |col|
+ new_col = col.dup
+ new_col.repository = new_repo
+ new_col.created_by = created_by
+ new_col.save!
+ end
+ end
+ rescue ActiveRecord::RecordInvalid
+ return false
+ end
+
+ # If everything is okay, return new_repo
+ new_repo
+ end
end
| Implement 'copy' method on Repository object
|
diff --git a/mongoid-find_by.gemspec b/mongoid-find_by.gemspec
index abc1234..def5678 100644
--- a/mongoid-find_by.gemspec
+++ b/mongoid-find_by.gemspec
@@ -1,3 +1,6 @@+$:.unshift(File.expand_path('../lib', __FILE__))
+require "mongoid-find_by"
+
Gem::Specification.new do |spec|
spec.homepage = "https://github.com/envygeeks/mongoid-find_by"
spec.summary = "Add ActiveRecord like finders to Mongoid."
@@ -5,10 +8,10 @@ spec.name = "mongoid-find_by"
spec.has_rdoc = false
spec.license = "MIT"
- spec.version = 0.3
spec.require_paths = ["lib"]
spec.authors = "Jordon Bedwell"
spec.email = "envygeeks@gmail.com"
+ spec.version = Mongoid::Finders::FindBy::VERSION
spec.add_runtime_dependency("mongoid", "~> 3.0.19")
spec.add_development_dependency("rake", "~> 10.0.3")
spec.add_development_dependency("rspec", "~> 2.12.0")
| Make the version a bit dynamic.
|
diff --git a/benchmark-ips/bm_js_symbols_vs_strings.rb b/benchmark-ips/bm_js_symbols_vs_strings.rb
index abc1234..def5678 100644
--- a/benchmark-ips/bm_js_symbols_vs_strings.rb
+++ b/benchmark-ips/bm_js_symbols_vs_strings.rb
@@ -0,0 +1,28 @@+Benchmark.ips do |x|
+ %x{
+ var o = {}
+ o[Symbol.for('foo')] = 123
+ o.foo = 123
+ var foo = Symbol('foo')
+ o[foo] = 123
+ var a = 0, b = 0, c = 0
+ }
+
+ x.report('global symbol') do
+ `a += o[Symbol.for('foo')]`
+ end
+
+ x.report('symbol') do
+ `a += o[foo]`
+ end
+
+ x.report('ident') do
+ `b += o.foo`
+ end
+
+ x.report('string') do
+ `c += o['foo']`
+ end
+
+ x.compare!
+end
| Add a benchmark about using JS Symbols vs Strings
|
diff --git a/nanoc-conref-fs.gemspec b/nanoc-conref-fs.gemspec
index abc1234..def5678 100644
--- a/nanoc-conref-fs.gemspec
+++ b/nanoc-conref-fs.gemspec
@@ -15,7 +15,7 @@ spec.test_files = spec.files.grep(%r{^(test)/})
spec.require_paths = ['lib']
- spec.add_runtime_dependency 'nanoc', '~> 4.3'
+ spec.add_runtime_dependency 'nanoc', '~> 4.3.0'
spec.add_runtime_dependency 'activesupport', '~> 4.2'
spec.add_runtime_dependency 'liquid', '3.0.6'
| Revert "Relax version requirement of dependency on Nanoc"
|
diff --git a/lib/cc/cli/upgrade_config_generator.rb b/lib/cc/cli/upgrade_config_generator.rb
index abc1234..def5678 100644
--- a/lib/cc/cli/upgrade_config_generator.rb
+++ b/lib/cc/cli/upgrade_config_generator.rb
@@ -22,11 +22,11 @@ private
def engine_eligible?(engine)
- base_eligble = super
+ base_eligible = super
if engine["upgrade_languages"].present?
- base_eligble && (engine["upgrade_languages"] & classic_languages).any?
+ base_eligible && (engine["upgrade_languages"] & classic_languages).any?
else
- base_eligble
+ base_eligible
end
end
| Fix typo in lvar name
|
diff --git a/no-style-please.gemspec b/no-style-please.gemspec
index abc1234..def5678 100644
--- a/no-style-please.gemspec
+++ b/no-style-please.gemspec
@@ -2,7 +2,7 @@
Gem::Specification.new do |spec|
spec.name = "no-style-please"
- spec.version = "0.4.3"
+ spec.version = "0.4.4"
spec.authors = ["Riccardo Graziosi"]
spec.email = ["riccardo.graziosi97@gmail.com"]
| Update gem version to 0.4.4
|
diff --git a/app/controllers/admin.rb b/app/controllers/admin.rb
index abc1234..def5678 100644
--- a/app/controllers/admin.rb
+++ b/app/controllers/admin.rb
@@ -21,8 +21,10 @@ Merb.run_later do
log.info("File has been uploaded to the server. Now processing it into a bunch of csv files")
file.process_excel_to_csv
- log.info("CSVs extraction complete. Processing files.")
+ log.info("CSV extraction complete. Processing files.")
file.load_csv(log)
+ log.info("CSV files are now loaded into the DB. Creating loan schedules.")
+ `rake mock:update_history`
log.info("<h2>Processing complete! Your MIS is now ready for use. Please take a note of all the errors reported here(if any) and rectify them.</h2>")
end
redirect "/admin/upload_status/#{file.directory}"
| Update history to be run as part of upload script
|
diff --git a/lib/finite_machine/transition_event.rb b/lib/finite_machine/transition_event.rb
index abc1234..def5678 100644
--- a/lib/finite_machine/transition_event.rb
+++ b/lib/finite_machine/transition_event.rb
@@ -35,10 +35,11 @@ # @return [self]
#
# @api private
- def initialize(transition, *data)
- @name = transition.name
- @from = transition.latest_from_state
- @to = transition.to_state(*data)
+ # def initialize(transition, *data)
+ def initialize(hook_event, to)
+ @name = hook_event.event_name
+ @from = hook_event.from
+ @to = to
freeze
end
end # TransitionEvent
| Change to simple value object.
|
diff --git a/db/samples.rb b/db/samples.rb
index abc1234..def5678 100644
--- a/db/samples.rb
+++ b/db/samples.rb
@@ -1,8 +1,13 @@ require 'active_record/fixtures'
+require 'fileutils'
puts "adding seed data from fixtures..."
Dir.glob(File.join(Rails.root, "db", "fixtures", "*.csv")).each do |file|
puts "Adding data from: " + File.basename(file)
- Fixtures.create_fixtures('db/fixtures', File.basename(file, '.*'))
+ fixture_filename = File.join('db', 'fixtures', File.basename(file, '.*'))
+
+ # Throws exception if 'db/fixtures/#{filename}.yml' doesn't yet exist
+ FileUtils.touch(fixture_filename)
+ ActiveRecord::Fixtures.create_fixtures(fixture_filename)
end
| Fix fixtures reference and rake db:nuke_pave
- s/Fixtures/ActiveRecord::Fixtures/g (necessary for > 4.0 Rails)
- Touches a 'db/fixtures/#{filename}.yml' because create_fixtures
doesn't seem to create file if not present.
|
diff --git a/test/lib/octobox/configurator_test.rb b/test/lib/octobox/configurator_test.rb
index abc1234..def5678 100644
--- a/test/lib/octobox/configurator_test.rb
+++ b/test/lib/octobox/configurator_test.rb
@@ -0,0 +1,18 @@+require 'test_helper'
+
+class ConfiguratorTest < ActiveSupport::TestCase
+
+ [
+ {env_value: nil, expected: 'https://github.com/octobox/octobox'},
+ {env_value: '', expected: 'https://github.com/octobox/octobox'},
+ {env_value: ' ', expected: 'https://github.com/octobox/octobox'},
+ {env_value: 'https://github.com/foo/bar', expected: 'https://github.com/foo/bar'}
+ ].each do |t|
+ env_value_string = t[:env_value].nil? ? 'nil' : "'#{t[:env_value].to_s}'"
+ test "When ENV['SOURCE_REPO'] is #{env_value_string}, config.source_repo is '#{t[:expected]}'" do
+ stub_env_var('SOURCE_REPO', t[:env_value])
+ assert_equal t[:expected], Octobox.config.source_repo
+ end
+ end
+
+end | Add failing tests for blank SOURCE_REPO environment variable
|
diff --git a/recipes/mysql_user.rb b/recipes/mysql_user.rb
index abc1234..def5678 100644
--- a/recipes/mysql_user.rb
+++ b/recipes/mysql_user.rb
@@ -2,6 +2,14 @@ template node[:tungsten][:mysqlConfigFile] do
mode 00644
source "tungsten_my_cnf.erb"
+ owner "root"
+ group "root"
+ action :create
+end
+
+template "#{node[:tungsten][:rootHome]}/.my.cnf" do
+ mode 00600
+ source "tungsten_root_my_cnf.erb"
owner "root"
group "root"
action :create
| Add root user credential file to user recipe
|
diff --git a/cats.gemspec b/cats.gemspec
index abc1234..def5678 100644
--- a/cats.gemspec
+++ b/cats.gemspec
@@ -8,8 +8,8 @@ spec.version = Cats::VERSION
spec.authors = ["Nicolas McCurdy"]
spec.email = ["thenickperson@gmail.com"]
- spec.description = %q{TODO: Write a gem description}
- spec.summary = %q{TODO: Write a gem summary}
+ spec.description = "A pointless placeholder gem that might do something cat-related eventually."
+ spec.summary = "A pointless placeholder gem that might do something cat-related eventually."
spec.homepage = ""
spec.license = "MIT"
| Add an initial description and summary
|
diff --git a/processors/parsers/postfix-received.rb b/processors/parsers/postfix-received.rb
index abc1234..def5678 100644
--- a/processors/parsers/postfix-received.rb
+++ b/processors/parsers/postfix-received.rb
@@ -0,0 +1,36 @@+module Extruder
+ module Parser
+ class PostfixReceivedProcessor
+ def process(msg, metadata)
+ first = extract_first(msg).to_s
+ if first =~ /from\s+
+ (?<heloname>\S+)\s+
+ \((?:(?<rdns>\S+)\s+)?
+ \[(?:(?<protocol>IPv6):)?(?<address>[^\]]+)\]\)\s+
+ (?:\(using\s(?<tlsprotocol>\S+)\swith\scipher\s(?<tlscipher>\S+)\s+
+ \([^\)]+\)\))?.*?
+ by\s(?<server>\S+)\s\(Postfix\)\s+
+ with\s+(?<smtpprotocol>\S+)\s+
+ id\s+(?<queueid>\S+)\s+
+ for\s+<(?<destaddress>[^>]+)>/x
+
+ metadata[:received] = {}
+ $~.names.each { |x| metadata[:received][x.to_sym] = $~[x] }
+ metadata[:received][:protocol] ||= "IPv4"
+ end
+
+ metadata
+ end
+
+ private
+ def extract_first(msg)
+ received = msg.received
+ if received.is_a?(Array)
+ received[0]
+ else
+ received
+ end
+ end
+ end
+ end
+end
| Add a processor for Postfix received lines.
Signed-off-by: brian m. carlson <738bdd359be778fee9f0fc4e2934ad72f436ceda@crustytoothpaste.net>
|
diff --git a/app/services/lessons_token_creator.rb b/app/services/lessons_token_creator.rb
index abc1234..def5678 100644
--- a/app/services/lessons_token_creator.rb
+++ b/app/services/lessons_token_creator.rb
@@ -14,19 +14,31 @@
private
+ def payload
+ {
+ user_id: user_id,
+ role: user_role,
+ classroom_activity_id: classroom_activity_id
+ }
+ end
+
def user_id
if user.present?
user.id
+ end
+ end
+
+ def user_role
+ if user.present?
+ user.role
else
'anonymous'
end
end
- def payload
- @payload ||= Hash.new.tap do |data|
- data[:user_id] = user_id
- data[:role] = user.role if user.present?
- data[:classroom_activity_id] = classroom_activity.id if valid_classroom_activity?
+ def classroom_activity_id
+ if valid_classroom_activity?
+ classroom_activity.id
end
end
| Tweak payload of lessons token
|
diff --git a/app/controllers/api/v1/customers_controller.rb b/app/controllers/api/v1/customers_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/v1/customers_controller.rb
+++ b/app/controllers/api/v1/customers_controller.rb
@@ -1,7 +1,32 @@ module Api
module V1
- class CustomersController < ApplicationController
- respond_to :json
+ class CustomersController < ApiApplicationController
+
+ def index
+ respond_with Customer.all
+ end
+ def show
+ respond_with Customer.find(params[:id])
+ end
+ def create
+ respond_with Customer.create(customer_params)
+ end
+ def update
+ respond_with Customer.update(params[:id],customer_params)
+ end
+ def destroy
+ respond_with Customer.destroy(params[:id])
+ end
+ def customer_location
+ @customer = Customer.find(params[:id])
+ respond_with @customer.location.to_json(only: [:id, :lat , :long] ) , status: :ok
+ end
+
+ private
+ # Never trust parameters from the scary internet, only allow the white list through.
+ def customer_params
+ params.require(:customer).permit(:name, :email, :device_model, :gcm_id ,:password, location_attributes: [:lat , :long])
+ end
end
end
end | Add API version for CustomerController
|
diff --git a/app/controllers/community/topics_controller.rb b/app/controllers/community/topics_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/community/topics_controller.rb
+++ b/app/controllers/community/topics_controller.rb
@@ -4,7 +4,7 @@
def show
@topic = Community::Topic.find_by_slug params[:id]
- not_found! if @topic.nil?
+ raise ActionController::RoutingError.new('Not Found') if @topic.nil?
@first_post = @topic.posts.order(:created_at).first
@posts = @topic.posts.order(:created_at).page(params[:page]).per(20)
end
| Fix accidental error instead of 404.
|
diff --git a/app/controllers/ecm/staff/people_controller.rb b/app/controllers/ecm/staff/people_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/ecm/staff/people_controller.rb
+++ b/app/controllers/ecm/staff/people_controller.rb
@@ -27,7 +27,7 @@ end
def load_resource
- resource_scope.find(params[:id])
+ resource_scope.friendly.find(params[:id])
end
end
end | Fix show action not finding records.
|
diff --git a/app/controllers/runs/application_controller.rb b/app/controllers/runs/application_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/runs/application_controller.rb
+++ b/app/controllers/runs/application_controller.rb
@@ -9,7 +9,11 @@
if params[:blank] == '1' # Build a fake, non-persisted run
fake_run = Run.new(category: @run.category, program: ExchangeFormat.to_sym)
- @run.segments.find_each do |segment|
+
+ # We can't use find_each here since it doesn't respect order. We need the order to be applied correctly on append,
+ # because we're not persisting this run to the database so we can't sort it on "select". We have to keep all
+ # segments in memory on the fake run anyway, so 2x that should be fine.
+ @run.segments.order(segment_number: :asc).each do |segment|
fake_run.segments << Segment.new(segment_number: segment.segment_number, name: segment.name)
end
| Fix bad order on route-only exports
|
diff --git a/test/mrb_memcached.rb b/test/mrb_memcached.rb
index abc1234..def5678 100644
--- a/test/mrb_memcached.rb
+++ b/test/mrb_memcached.rb
@@ -2,10 +2,26 @@ ## Memcached Test
##
-assert("Memcached#set,get") do
+assert("Memcached#set,get with string") do
m = Memcached.new "127.0.0.1", 11211
m.set "test", "1"
real = m.get "test"
m.close
assert_equal("1", real)
end
+
+assert("Memcached#set,get with symbol") do
+ m = Memcached.new "127.0.0.1", 11211
+ m.set :hoge, 10
+ real = m.get :hoge
+ m.close
+ assert_equal("10", real)
+end
+
+assert("Memcached#set,get with symbol and string") do
+ m = Memcached.new "127.0.0.1", 11211
+ m.set "foo", 100
+ real = m.get :foo
+ m.close
+ assert_equal("100", real)
+end
| Add test of symbol key
|
diff --git a/app/models/user_selected_topic.rb b/app/models/user_selected_topic.rb
index abc1234..def5678 100644
--- a/app/models/user_selected_topic.rb
+++ b/app/models/user_selected_topic.rb
@@ -2,4 +2,6 @@ belongs_to :user
belongs_to :topic
has_many :availabilities
+
+ validates :user, uniqueness: {scope: :topic}
end
| Add validation for unique user/topic combo in UST
|
diff --git a/lib/active_admin_datetimepicker/base.rb b/lib/active_admin_datetimepicker/base.rb
index abc1234..def5678 100644
--- a/lib/active_admin_datetimepicker/base.rb
+++ b/lib/active_admin_datetimepicker/base.rb
@@ -1,11 +1,15 @@ module ActiveAdminDatetimepicker
module Base
+ mattr_accessor :default_datetime_picker_options do
+ {}
+ end
+
+ mattr_accessor :format do
+ '%Y-%m-%d %H:%M'
+ end
+
def html_class
'date-time-picker'
- end
-
- def format
- '%Y-%m-%d %H:%M'
end
def input_html_data
@@ -33,8 +37,23 @@ # backport support both :datepicker_options AND :datetime_picker_options
options = self.options.fetch(:datepicker_options, {})
options = self.options.fetch(:datetime_picker_options, options)
- Hash[options.map { |k, v| [k.to_s.camelcase(:lower), v] }]
+ options = Hash[options.map { |k, v| [k.to_s.camelcase(:lower), v] }]
+ _default_datetime_picker_options.merge(options)
end
+ end
+
+ protected
+
+ def _default_datetime_picker_options
+ res = default_datetime_picker_options.map do |k, v|
+ if v.respond_to?(:call) || v.is_a?(Proc)
+ [k, v.call]
+ else
+ [k, v]
+ end
+ end
+ Hash[res]
end
end
end
+
| Move default_datetime_picker_options and format to mattr_accessor for easy override
|
diff --git a/lib/devise_cas_authenticatable/model.rb b/lib/devise_cas_authenticatable/model.rb
index abc1234..def5678 100644
--- a/lib/devise_cas_authenticatable/model.rb
+++ b/lib/devise_cas_authenticatable/model.rb
@@ -12,7 +12,13 @@ if ticket.is_valid?
conditions = {:username => ticket.response.user}
- resource = find_for_authentication(conditions)
+ # We don't want to override Devise 1.1's find_for_authentication
+ resource = if respond_to?(:find_for_authentication)
+ find_for_authentication(conditions)
+ else
+ find(:first, :conditions => conditions)
+ end
+
resource = new(conditions) if (resource.nil? and ::Devise.cas_create_user)
return nil unless resource
| Work even under conditions where find_for_authentication doesn't exist
|
diff --git a/lib/hexdump/numeric/base/hexadecimal.rb b/lib/hexdump/numeric/base/hexadecimal.rb
index abc1234..def5678 100644
--- a/lib/hexdump/numeric/base/hexadecimal.rb
+++ b/lib/hexdump/numeric/base/hexadecimal.rb
@@ -25,6 +25,14 @@ def initialize(type)
case type
when Type::Float
+ if RUBY_ENGINE == 'jruby'
+ begin
+ "%a" % 1.0
+ rescue ArgumentError
+ raise(NotImplementedError,"jruby #{RUBY_ENGINE_VERSION} does not support the \"%a\" format string")
+ end
+ end
+
# NOTE: jruby does not currently support the %a format string
@width = FLOAT_WIDTH
super("% #{@width}a"); @width += 1
| Test whether jruby supports the "%a" format string.
|
diff --git a/lib/react/rails/controller_lifecycle.rb b/lib/react/rails/controller_lifecycle.rb
index abc1234..def5678 100644
--- a/lib/react/rails/controller_lifecycle.rb
+++ b/lib/react/rails/controller_lifecycle.rb
@@ -5,10 +5,10 @@
included do
# use both names to support Rails 3..5
- before_action_with_fallback = begin method(:before_action); rescue method(:before_filter); end
- after_action_with_fallback = begin method(:after_action); rescue method(:after_filter); end
- before_action_with_fallback.call :setup_react_component_helper
- after_action_with_fallback.call :teardown_react_component_helper
+ before_action_with_fallback = respond_to?(:before_action) ? :before_action : :before_filter
+ after_action_with_fallback = respond_to?(:after_action) ? :after_action : :after_filter
+ public_send(before_action_with_fallback, :setup_react_component_helper)
+ public_send(after_action_with_fallback, :teardown_react_component_helper)
attr_reader :__react_component_helper
end
| Use a respond_to? strategy instead
|
diff --git a/lib/ruboty/brains/google_spreadsheet.rb b/lib/ruboty/brains/google_spreadsheet.rb
index abc1234..def5678 100644
--- a/lib/ruboty/brains/google_spreadsheet.rb
+++ b/lib/ruboty/brains/google_spreadsheet.rb
@@ -42,7 +42,8 @@
def reauthenticate
loop do
- sleep 1800
+ # access token will expire in 3600 sec.
+ sleep 3599
@client.authenticate!
@data = nil
end
| Fix the interval for reauthorization
|
diff --git a/features/step_definitions/search_steps.rb b/features/step_definitions/search_steps.rb
index abc1234..def5678 100644
--- a/features/step_definitions/search_steps.rb
+++ b/features/step_definitions/search_steps.rb
@@ -8,7 +8,7 @@ end
When(/^I drill into a specific search result$/) do
- click_link specific_search_result[:title]
+ click_link specific_search_result.fetch(:title)
end
When(/^I search for something work related$/) do
@@ -35,6 +35,7 @@
Then(/^I should see SOC occupations related to my search term$/) do
expected_search_results.each do |search_result|
- expect(page).to have_text(search_result[:title])
+ expect(page).to have_text(search_result.fetch(:title))
+ expect(page).to have_text(search_result.fetch(:description))
end
end
| Access Cucumber fixture data with .fetch
Missing attributes should raise an exception rather than return nil
|
diff --git a/cookbooks/nelhage/recipes/money.rb b/cookbooks/nelhage/recipes/money.rb
index abc1234..def5678 100644
--- a/cookbooks/nelhage/recipes/money.rb
+++ b/cookbooks/nelhage/recipes/money.rb
@@ -1,10 +1,4 @@-package "nodejs" do
- action [ :install, :upgrade ]
-end
-
-package "nodejs-legacy" do
- action [ :install, :upgrade ]
-end
+include_recipe "nodejs"
daemontools_service "money-srv" do
directory "/etc/sv/money-srv"
| Install node using the nodejs cookbook.
|
diff --git a/roles/db-slave.rb b/roles/db-slave.rb
index abc1234..def5678 100644
--- a/roles/db-slave.rb
+++ b/roles/db-slave.rb
@@ -10,12 +10,12 @@ :hot_standby_feedback => "on",
:standby_mode => "on",
:primary_conninfo => {
- :host => "katla",
+ :host => "katla.ic.openstreetmap.org",
:port => "5432",
:user => "replication",
:passwords => { :bag => "db", :item => "passwords" }
},
- :restore_command => "/usr/bin/rsync katla::archive/%f %p"
+ :restore_command => "/usr/bin/rsync katla.ic.openstreetmap.org::archive/%f %p"
}
}
}
| Use fully qualified name for katla
|
diff --git a/assets/samples/sample_activity.rb b/assets/samples/sample_activity.rb
index abc1234..def5678 100644
--- a/assets/samples/sample_activity.rb
+++ b/assets/samples/sample_activity.rb
@@ -1,21 +1,23 @@-require 'ruboto'
+require 'ruboto/activity'
+require 'ruboto/widget'
+require 'ruboto/util/toast'
ruboto_import_widgets :Button, :LinearLayout, :TextView
-$activity.handle_create do |bundle|
+$activity.start_ruboto_activity "$sample_activity" do
setTitle 'This is the Title'
- setup_content do
- linear_layout :orientation => LinearLayout::VERTICAL do
- @text_view = text_view :text => 'What hath Matz wrought?', :id => 42
- button :text => 'M-x butterfly', :width => :wrap_content, :id => 43
- end
+ def on_create(bundle)
+ self.content_view =
+ linear_layout(:orientation => :vertical) do
+ @text_view = text_view :text => 'What hath Matz wrought?', :id => 42
+ button :text => 'M-x butterfly', :width => :wrap_content, :id => 43,
+ :on_click_listener => @handle_click
+ end
end
- handle_click do |view|
- if view.getText == 'M-x butterfly'
- @text_view.setText 'What hath Matz wrought!'
+ @handle_click = proc do |view|
+ @text_view.text = 'What hath Matz wrought!'
toast 'Flipped a bit via butterfly'
- end
end
end
| Update sample to match new ruboto split
|
diff --git a/spec/views/games/new.html.erb_spec.rb b/spec/views/games/new.html.erb_spec.rb
index abc1234..def5678 100644
--- a/spec/views/games/new.html.erb_spec.rb
+++ b/spec/views/games/new.html.erb_spec.rb
@@ -2,20 +2,19 @@
RSpec.describe "games/new", type: :view do
before(:each) do
- assign(:game, Game.new())
+ assign(:game, Game.new(
+ :starting_lives => 5
+ ))
end
it "renders new game form" do
render
assert_select "form[action=?][method=?]", games_path, "post" do
+
+ assert_select "input#game_starting_lives[name=?]", "game[starting_lives]"
end
end
- it "has a field for starting lives" do
- render
-
- assert_select "form input#game_starting_lives"
- end
pending "TODO add tests for showing errors on creating a game"
end
| Fix up new game view spec to match generated
|
diff --git a/Casks/opera-developer.rb b/Casks/opera-developer.rb
index abc1234..def5678 100644
--- a/Casks/opera-developer.rb
+++ b/Casks/opera-developer.rb
@@ -1,6 +1,6 @@ cask :v1 => 'opera-developer' do
- version '30.0.1812.0'
- sha256 'ec032b5545358e5358f96cdf16f5eb813f726727d9fcb878520f2669473f2bc7'
+ version '30.0.1820.0'
+ sha256 'ea0adb5c2e4c215ccdd784222b0432546137649eec3bc7c829d76662bd2326c8'
url "http://get.geo.opera.com/pub/opera-developer/#{version}/mac/Opera_Developer_#{version}_Setup.dmg"
homepage 'http://www.opera.com/developer'
| Upgrade Opera Developer.app to v30.0.1820.0
|
diff --git a/Casks/playlist-assist.rb b/Casks/playlist-assist.rb
index abc1234..def5678 100644
--- a/Casks/playlist-assist.rb
+++ b/Casks/playlist-assist.rb
@@ -1,11 +1,11 @@ cask :v1 => 'playlist-assist' do
- version '1.2.1'
- sha256 '70ef4c3cf78d39f8b1750ca44b6db42c3e72e24968ebd203fc146b2c189d5346'
+ version '1.2.2'
+ sha256 '6bcc953cabcee2e47497bb3b51cd76c3ee6dcb6ac5e4222740a5ec775f221e75'
- url "http://dougscripts.com/itunes/scrx/playlistassistv#{version.to_i}.zip"
+ url "http://dougscripts.com/itunes/scrx/playlistassistv#{version.delete('.')}.zip"
name 'Playlist Assist'
appcast 'http://dougscripts.com/itunes/itinfo/playlistassist_appcast.xml',
- :sha256 => 'd4d8bda02c2420b837298134743ad00af55c8801dcb4fd1f62e461d17419526e'
+ :sha256 => 'b9b4840b8437e81c9427aed67c17dce861dc4153cbac22a3a14f13058ab06d39'
homepage 'http://dougscripts.com/apps/playlistassistapp.php'
license :commercial
| Update Playlist Assist to 1.2.2
|
diff --git a/core/app/controllers/topics_controller.rb b/core/app/controllers/topics_controller.rb
index abc1234..def5678 100644
--- a/core/app/controllers/topics_controller.rb
+++ b/core/app/controllers/topics_controller.rb
@@ -15,7 +15,7 @@ end
def facts
- @facts = interactor :'topics/facts', topic.id.to_s, nil, nil
+ @facts = interactor :'topics/facts', params[:id], nil, nil
respond_to do |format|
format.json { render json: @facts.map {|fact| Facts::Fact.for(fact: fact[:item],view: view_context, timestamp: fact[:score])} }
| Use slug_title in topics/facts query
|
diff --git a/lib/classy/aliasable.rb b/lib/classy/aliasable.rb
index abc1234..def5678 100644
--- a/lib/classy/aliasable.rb
+++ b/lib/classy/aliasable.rb
@@ -1,11 +1,10 @@ module Aliasable
def self.extended (klass) #nodoc;
klass.class_exec do
- class_variable_set(:@@aliases, {})
+ class_variable_set(:@@classy_aliases, {})
end
end
- ##
# When passed a class, just returns it. When passed a symbol that is an
# alias for a class, returns that class.
#
@@ -13,17 +12,15 @@ #
def find (klass)
return klass if klass.kind_of? Class
- class_variable_get(:@@aliases)[klass] or raise ArgumentError, "Could not find alias #{klass}"
+ class_variable_get(:@@classy_aliases)[klass] or raise ArgumentError, "Could not find alias #{klass}"
end
- ##
# Forget all known aliases.
#
def forget_aliases
- class_variable_get(:@@aliases).clear
+ class_variable_get(:@@classy_aliases).clear
end
- ##
# Specifies a symbol (or several) that a given framework might be known
# by. For example, if you wanted to refer to RSpec by :rspec or :spec,
# you might do this:
@@ -35,16 +32,15 @@ #
def aka (*names)
names.each do |name|
- raise ArgumentError, "Called aka with an alias that is already taken." if class_variable_get(:@@aliases).include? name
- class_variable_get(:@@aliases)[name] = self
+ raise ArgumentError, "Called aka with an alias that is already taken." if class_variable_get(:@@classy_aliases).include? name
+ class_variable_get(:@@classy_aliases)[name] = self
end
end
- ##
# Return a hash of known aliases to Class objects
#
def aliases
- class_variable_get(:@@aliases).dup
+ class_variable_get(:@@classy_aliases).dup
end
end
| Use @@classy_aliases instead of just @@aliases
|
diff --git a/lib/gotgastro/models.rb b/lib/gotgastro/models.rb
index abc1234..def5678 100644
--- a/lib/gotgastro/models.rb
+++ b/lib/gotgastro/models.rb
@@ -5,6 +5,7 @@ Sequel::Model.plugin :dataset_associations
Sequel::Model.plugin :timestamps, :update_on_create => true
Sequel::Model.plugin :validation_helpers
+Sequel::Model.plugin :table_select
models_path = Pathname.new(__FILE__).parent.join('models').join('*.rb')
models = Dir.glob(models_path)
| Add table select plugin, so columns in the other tables do not appear in the result sets of JOINs
|
diff --git a/lib/pacproxy/runtime.rb b/lib/pacproxy/runtime.rb
index abc1234..def5678 100644
--- a/lib/pacproxy/runtime.rb
+++ b/lib/pacproxy/runtime.rb
@@ -26,7 +26,7 @@ private
def autodetect
- name = ENV['PROXYPAC_RUNTIME']
+ name = ENV['PACPROXY_RUNTIME']
return Runtimes::Node.runtime if name || /Node/ =~ name
ENV['JS_RUNTIME'] = name
| Fix miss spelling for PACPROXY_RUNTIME
|
diff --git a/lib/spbtv_code_style.rb b/lib/spbtv_code_style.rb
index abc1234..def5678 100644
--- a/lib/spbtv_code_style.rb
+++ b/lib/spbtv_code_style.rb
@@ -1,4 +1,4 @@ # Just namespace for version number
module SpbtvCodeStyle
- VERSION = '1.3.2'.freeze
+ VERSION = '1.3.1'.freeze
end
| Revert "Bump version to 1.3.2"
This reverts commit 327bdc2ccd80f1444b601d1acb6916229d60bced.
|
diff --git a/test/integration/concerns/messaging.rb b/test/integration/concerns/messaging.rb
index abc1234..def5678 100644
--- a/test/integration/concerns/messaging.rb
+++ b/test/integration/concerns/messaging.rb
@@ -7,11 +7,9 @@ assert_content 'Mensaje enviado'
end
- def send_message(params)
- subject = params[:subject]
-
+ def send_message(body: nil, subject: nil)
fill_in('subject', with: subject) if subject
- fill_in 'body', with: params[:body]
+ fill_in 'body', with: body
click_button 'Enviar'
end
end
| Use keyword arguments for readability
We are using modern rubies, use modern features.
|
diff --git a/app/helpers/application_helper/toolbar/basic.rb b/app/helpers/application_helper/toolbar/basic.rb
index abc1234..def5678 100644
--- a/app/helpers/application_helper/toolbar/basic.rb
+++ b/app/helpers/application_helper/toolbar/basic.rb
@@ -12,13 +12,19 @@ end
def extension_classes_filtered(record)
- return extension_classes if record.nil?
-
- # Example:
+ # If the toolbar class reponds to `record_valid?`, we call it. Even for null record.
+ #
+ # Else we use a mechanism that matches records with provider names.
+ # In this case null record means "match".
+ #
+ # Example for matching:
+ #
# "ManageIQ::Providers::Amazon::ToolbarOverrides::EmsCloudCenter" is a match for
# "ManageIQ::Providers::Amazon::CloudManager
extension_classes.find_all do |ext|
- ext.name.split('::')[0..2] == record.class.name.split('::')[0..2]
+ ext.respond_to?(:record_valid?) ?
+ ext.record_valid?(record) :
+ (record.nil? || ext.name.split('::')[0..2] == record.class.name.split('::')[0..2])
end
end
| Extend toolbar pluggability to all plugins.
Newly any plugin can add content to to toolbars. Not only providers.
Plugged-in toolbars should implement class method:
def self.record_valid?(record)
...
end
that decides if the toolbar is to be displayed for a particular record.
Example display only for RHEV VMs:
def self.record_valid?(record)
record.kind_of?(ManageIQ::Providers::Vmware::InfraManager::Vm)
end
Please note that such level of control is only available for the
toolbars on the detail pages. Not for the toolbars on the listing pages.
|
diff --git a/Casks/dungeon-crawl-stone-soup-tiles.rb b/Casks/dungeon-crawl-stone-soup-tiles.rb
index abc1234..def5678 100644
--- a/Casks/dungeon-crawl-stone-soup-tiles.rb
+++ b/Casks/dungeon-crawl-stone-soup-tiles.rb
@@ -1,8 +1,8 @@ cask 'dungeon-crawl-stone-soup-tiles' do
- version '0.16.2'
- sha256 '610b6c876c4704a343e066f5a9a1704c491fe25820707c7af66ebf3e6728ab61'
+ version '0.17.1-1'
+ sha256 'ef6eb0e5a9fb3ab9a08f50a264eb10c0ab29ff7a114eeea5a841d4448ff1475c'
- url "https://crawl.develz.org/release/stone_soup-#{version}-tiles-macos.zip"
+ url "https://crawl.develz.org/release/stone_soup-#{version}-tiles-macosx.zip"
name 'Dungeon Crawl Stone Soup'
homepage 'https://crawl.develz.org'
license :gpl
| Update DCSS Tiles to 0.17.1-1
|
diff --git a/RKParallaxEffect.podspec b/RKParallaxEffect.podspec
index abc1234..def5678 100644
--- a/RKParallaxEffect.podspec
+++ b/RKParallaxEffect.podspec
@@ -1,22 +1,14 @@-#
-# Be sure to run `pod lib lint RKParallaxEffect.podspec' to ensure this is a
-# valid spec and remove all comments before submitting the spec.
-#
-# Any lines starting with a # are optional, but encouraged
-#
-# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
-#
-
Pod::Spec.new do |s|
s.name = "RKParallaxEffect"
s.version = "1.0.0"
s.summary = "RKParallaxEffect is written in Swift and provides API to create a parallax effect on UITableHeaderView"
- s.homepage = "https://github.com/RahulKatariya/RKParallaxEffect"
+ s.homepage = "https://rahulkatariya.github.io/RKParallaxEffect"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "Rahul Katariya" => "rahulkatariya@me.com" }
- s.source = { :git => "https://github.com/RahulKatariya/RKParallaxEffect.git", :tag => "v#{s.version}" }
+ s.source = { :git => "https://github.com/RahulKatariya/RKParallaxEffect.git", :tag => s.version }
s.social_media_url = 'https://twitter.com/rahulkatariya91'
- s.platform = :ios, '8.0'
+ s.platform = :ios
+ s.ios.deployment_target = '8.0'
s.requires_arc = true
s.source_files = 'RKParallaxEffect/*.swift'
end
| Add iOS deployment target 8.0
|
diff --git a/spec/github/error/validations_spec.rb b/spec/github/error/validations_spec.rb
index abc1234..def5678 100644
--- a/spec/github/error/validations_spec.rb
+++ b/spec/github/error/validations_spec.rb
@@ -0,0 +1,21 @@+# encoding: utf-8
+
+require 'spec_helper'
+
+describe Github::Error::Validations do
+ describe '#message' do
+ let(:error) { described_class.new(:username => nil) }
+
+ it 'contains the problem in the message' do
+ error.message.should include "Attempted to send request with nil arguments"
+ end
+
+ it 'contains the summary in the message' do
+ error.message.should include "Each request expects certain number of arguments."
+ end
+
+ it 'contains the resolution in the message' do
+ error.message.should include "Double check that the provided arguments are set to some value."
+ end
+ end
+end # Github::Error::Validations
| Add tests for the validation error type.
|
diff --git a/spec/features/sessions/destroy_spec.rb b/spec/features/sessions/destroy_spec.rb
index abc1234..def5678 100644
--- a/spec/features/sessions/destroy_spec.rb
+++ b/spec/features/sessions/destroy_spec.rb
@@ -1,11 +1,10 @@ require "spec_helper"
RSpec.feature "Logging out", :type => :feature do
- scenario "Log out while correctly logged in" do
+ scenario "Log out while correctly logged in", js: true do
user = login
expect(page).to have_selector('#user-info', text: user.username)
- # TODO: Use js:true and logout button, rather than manually submitting a DELETE.
- page.driver.submit(:delete, logout_path, {})
+ click_button "Log out"
expect(page).to have_selector('.flash.success', text: 'You have been logged out.')
expect(page).to have_no_selector('#user-info')
| Use js:true and click logout button directly
|
diff --git a/app/controllers/spree/admin/look_book_images_controller.rb b/app/controllers/spree/admin/look_book_images_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/spree/admin/look_book_images_controller.rb
+++ b/app/controllers/spree/admin/look_book_images_controller.rb
@@ -0,0 +1,87 @@+# frozen_string_literal: true
+module Spree
+ module Admin
+ class LookBookImagesController < ResourceController
+ before_action :set_look_book
+ before_action :set_look_book_image, only: %i(edit update destroy)
+
+ respond_to :html
+
+ def index
+ @look_book_images = @look_book.look_book_images.all
+ end
+
+ def new
+ @look_book_image = @look_book.look_book_images.build
+ @look_book_image.look_book_image_products.build
+ end
+
+ def edit; end
+
+ def create
+ @look_book_image = @look_book.look_book_images.build(look_book_image_params)
+
+ if @look_book_image.save
+ flash[:success] = "Image has been created."
+ redirect_to admin_look_book_look_book_images_path
+ else
+ flash[:alert] = "Image not created successfully"
+ render action: :new
+ end
+ end
+
+ def destroy
+ if @look_book_image.destroy
+ flash[:success] = "Look Book Image was deleted successfully"
+ else
+ flash[:error] = 'There was an error deleting the look book image. Please try again'
+ end
+
+ respond_with(@look_book_image) do |format|
+ format.html { redirect_to admin_look_book_look_book_images_path(@look_book) }
+ format.js { render_js_for_destroy }
+ end
+ end
+
+ def update
+ if @look_book_image.update(look_book_image_params)
+ @look_book_image.save
+ flash[:success] = "Look book image successfully updated"
+ redirect_to edit_admin_look_book_look_book_image_path
+ else
+ flash[:error] = "Something went wrong"
+ render action: :edit
+ end
+ end
+
+ def update_positions
+ ActiveRecord::Base.transaction do
+ params[:positions].each do |id, index|
+ model_class.find(id).set_list_position(index)
+ end
+ end
+
+ respond_to do |format|
+ format.js { render text: 'Ok' }
+ end
+ end
+
+ private
+
+ def set_look_book_image
+ @look_book_image = @look_book.look_book_images.find(params[:id])
+ rescue ActiveRecord::RecordNotFound
+ flash[:alert] = "The image you were looking for could not be found."
+ end
+
+ def set_look_book
+ @look_book = LookBook.find(params[:look_book_id])
+ end
+
+ def look_book_image_params
+ params.require(:look_book_image).permit(:alt_text, :attachment, :look_book_id, :position,
+ look_book_image_products_attributes: %i(id look_book_image_id position spree_product_id _destroy))
+ end
+ end
+ end
+end
| Add admin look book images controller
|
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -8,7 +8,7 @@ def dashboard
@recent_organizations = Organization.where('created_at > ?', 1.week.ago)
@recent_users = User.where('created_at > ?', 1.week.ago)
- @active_users = User.where('last_request_at > ?', 1.week.ago.utc)
+ @active_users = User.where('last_request_at > ?', 1.week.ago.utc).includes(:organization).order('organizations.name')
@top_10_other = Item.by_partner_key('other').where.not(name: "Other").group(:name).limit(10).order('count_name DESC').count(:name)
@donation_count = Donation.where('created_at > ?', 1.week.ago).count
@distribution_count = Distribution.where('created_at > ?', 1.week.ago).count
| Sort the recent users on the admin dashboard by organization.
|
diff --git a/app/controllers/items_controller.rb b/app/controllers/items_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/items_controller.rb
+++ b/app/controllers/items_controller.rb
@@ -22,17 +22,17 @@
def create
item.save
- redirect_to(campaign_items_path(campaign))
+ redirect_to campaign_items_path(campaign)
end
def update
item.save
- respond_with(item)
+ redirect_to campaign_items_path(campaign)
end
def destroy
item.destroy
- redirect_to(campaign_items_path(campaign))
+ redirect_to campaign_items_path(campaign)
end
private
| Fix items controller action redirects
|
diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/pages_controller.rb
+++ b/app/controllers/pages_controller.rb
@@ -8,7 +8,7 @@ else
logger.error("[Forest][Error] 404 page not found. Looked for path \"#{request.fullpath}\"")
@body_classes ||= []
- @body_classes << 'page--404'
+ @body_classes << 'controller--errors action--not_found'
return render 'errors/not_found'
end
end
| Add controller name to 404 page to match actual errors controller classes
|
diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/posts_controller.rb
+++ b/app/controllers/posts_controller.rb
@@ -13,9 +13,9 @@ # TODO (Shimmy): Watch out for duplicates
# TODO (Shimmy): Flash success notification on send
def create
+ # TODO (Shimmy): Get rid of the line below this using load_and_authorize_resource from cancancan
@group = Group.friendly.find(params[:group_id])
- @post = @group.posts.build(post_params)
- @post.save
+ @post.create(post_params)
end
def destroy
| Use create instead of build in create method
|
diff --git a/spec/support/missing_factory_helper.rb b/spec/support/missing_factory_helper.rb
index abc1234..def5678 100644
--- a/spec/support/missing_factory_helper.rb
+++ b/spec/support/missing_factory_helper.rb
@@ -3,17 +3,21 @@ module Support
module MissingFactoryHelper
def build(factory, *args, &block)
- registered_factory_symbols.include?(factory) ? super : class_from_symbol(factory).new(*args)
+ factory_exists?(factory) ? super : class_from_symbol(factory).new(*args)
end
def create(factory, *args, &block)
- registered_factory_symbols.include?(factory) ? super : class_from_symbol(factory).create!(*args)
+ factory_exists?(factory) ? super : class_from_symbol(factory).create!(*args)
end
private
def class_from_symbol(symbol)
symbol.to_s.classify.constantize
+ end
+
+ def factory_exists?(factory)
+ registered_factory_symbols.include?(factory.to_sym)
end
def registered_factory_symbols
| Allow usage of string factories
|
diff --git a/app/serializers/paper_serializer.rb b/app/serializers/paper_serializer.rb
index abc1234..def5678 100644
--- a/app/serializers/paper_serializer.rb
+++ b/app/serializers/paper_serializer.rb
@@ -5,7 +5,7 @@ has_many relation, embed: :ids, include: true
end
- %i(assignees editors reviewers).each do |relation|
+ %i(assignees editors reviewers collaborators).each do |relation|
has_many relation, embed: :ids, include: true, root: :users
end
@@ -29,6 +29,10 @@ object.reviewers.includes(:affiliations)
end
+ def collaborators
+ object.collaborators.includes(:affiliations)
+ end
+
def event_name
EventStream.name(object.id)
end
| Add collaborators to paper serializer |
diff --git a/config/development_application.rb b/config/development_application.rb
index abc1234..def5678 100644
--- a/config/development_application.rb
+++ b/config/development_application.rb
@@ -2,7 +2,4 @@ set :development, true
# Rack middleware
-use Rack::CommonLogger
-use Rack::Lint
use Rack::Reloader, 0
-use Rack::ShowExceptions
| Remove default Rack middleware from configs
|
diff --git a/lib/asynchronic/queue_engine/in_memory.rb b/lib/asynchronic/queue_engine/in_memory.rb
index abc1234..def5678 100644
--- a/lib/asynchronic/queue_engine/in_memory.rb
+++ b/lib/asynchronic/queue_engine/in_memory.rb
@@ -22,14 +22,23 @@ end
- class Queue < ::Queue
+ class Queue
- def to_a
- @que.dup
+ extend Forwardable
+
+ def_delegators :@queue, :size, :empty?, :to_a
+
+ def initialize
+ @queue = []
+ @mutex = Mutex.new
end
def pop
- super rescue nil
+ @mutex.synchronize { @queue.shift }
+ end
+
+ def push(message)
+ @mutex.synchronize { @queue.push message }
end
end
| Refactor in memory queue for error in JRuby
|
diff --git a/lib/autoparts/packages/graphics_magick.rb b/lib/autoparts/packages/graphics_magick.rb
index abc1234..def5678 100644
--- a/lib/autoparts/packages/graphics_magick.rb
+++ b/lib/autoparts/packages/graphics_magick.rb
@@ -0,0 +1,34 @@+module Autoparts
+ module Packages
+ class GraphicsMagick < Package
+ name 'graphics_magick'
+ version '1.3.19'
+ description 'GraphicsMagick: the swiss army knife of image processing.'
+ category Category::UTILITIES
+
+ source_url 'http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/1.3.19/GraphicsMagick-1.3.19.tar.gz'
+ source_sha1 '4176b88a046319fe171232577a44f20118c8cb83'
+ source_filetype 'tar.gz'
+
+ def compile
+ Dir.chdir('GraphicsMagick-1.3.19') do
+ args = [
+ "--prefix=#{prefix_path}"
+ ]
+ execute './configure', *args
+ execute 'make'
+ end
+ end
+
+ def install
+ Dir.chdir('GraphicsMagick-1.3.19') do
+ execute 'make', 'install'
+ end
+ end
+
+ def graphics_magick_path
+ bin_path + 'graphics_magick'
+ end
+ end
+ end
+end
| Add GraphicsMagick as a new package
GraphicsMagick is an image processing library, similar to ImageMagick
See http://www.graphicsmagick.org/ for more details
|
diff --git a/lib/buildr_plus/roles/model_qa_support.rb b/lib/buildr_plus/roles/model_qa_support.rb
index abc1234..def5678 100644
--- a/lib/buildr_plus/roles/model_qa_support.rb
+++ b/lib/buildr_plus/roles/model_qa_support.rb
@@ -31,4 +31,8 @@
package(:jar)
package(:sources)
+
+ check package(:jar), 'should contain generated classes' do
+ it.should contain("#{project.root_project.group.gsub('.','/')}/server/test/util/#{BuildrPlus::Naming.pascal_case(project.root_project.name)}RepositoryModule.class")
+ end
end
| Add check to ensure generated content is present
|
diff --git a/lib/podio/models/application_field.rb b/lib/podio/models/application_field.rb
index abc1234..def5678 100644
--- a/lib/podio/models/application_field.rb
+++ b/lib/podio/models/application_field.rb
@@ -6,7 +6,7 @@
alias_method :id, :field_id
delegate_to_hash :config, :label, :description, :delta, :settings, :required?, :visible?
- delegate_to_hash :settings, :allowed_values, :referenceable_types, :allowed_currencies
+ delegate_to_hash :settings, :allowed_values, :referenceable_types, :allowed_currencies, :valid_types
class << self
def find(app_id, field_id)
| Add valid_types to application field
|
diff --git a/lib/spree_brewbit_dashboard/engine.rb b/lib/spree_brewbit_dashboard/engine.rb
index abc1234..def5678 100644
--- a/lib/spree_brewbit_dashboard/engine.rb
+++ b/lib/spree_brewbit_dashboard/engine.rb
@@ -17,6 +17,6 @@
config.to_prepare &method(:activate).to_proc
- config.app_middleware.insert_before "Rack::Lock", "WebSocket::DeviceServer"
+ #config.app_middleware.insert_before "Rack::Lock", "WebSocket::DeviceServer"
end
end
| Clean up layout and homepage styling.
|
diff --git a/cookbooks/uiuc_vmd/recipes/mac.rb b/cookbooks/uiuc_vmd/recipes/mac.rb
index abc1234..def5678 100644
--- a/cookbooks/uiuc_vmd/recipes/mac.rb
+++ b/cookbooks/uiuc_vmd/recipes/mac.rb
@@ -16,4 +16,19 @@ type "app"
package_id "edu.uiuc.ks.vmd"
version "1.9.1"
-end+end
+
+# Create dock folder, if it does not exist
+dock_add "Natural Sciences and Mathematics" do
+ all_users true
+ action :folder_create
+ show_as "list"
+ display_as "folder"
+ arrangement "name"
+end
+
+# Add icon to dock
+dock_add "/Applications/VMD 1.9.1.app" do
+ all_users true
+ group "Natural Sciences and Mathematics"
+end
| Add dock shortcut for VMD
|
diff --git a/lib/compound_commands/compound_command.rb b/lib/compound_commands/compound_command.rb
index abc1234..def5678 100644
--- a/lib/compound_commands/compound_command.rb
+++ b/lib/compound_commands/compound_command.rb
@@ -18,7 +18,7 @@ protected
def execute
self.class.commands.inject(input) do |data, command_class|
- command = command_class.new(*data)
+ command = build_command(command_class, data)
command.perform
if command.halted?
@@ -35,5 +35,13 @@ command.result
end
end
+
+ def build_command(klass, data)
+ if data.respond_to?(:to_ary)
+ klass.new(*data)
+ else
+ klass.new(data)
+ end
+ end
end
end
| Move command instantication to build_command method
|
diff --git a/spec/factories.rb b/spec/factories.rb
index abc1234..def5678 100644
--- a/spec/factories.rb
+++ b/spec/factories.rb
@@ -56,6 +56,7 @@ factory :user do
email
password "password"
+ admin false
factory :admin do
admin true
| Add admin default false to user factory since database default will load as false
|
diff --git a/spec/i18n_spec.rb b/spec/i18n_spec.rb
index abc1234..def5678 100644
--- a/spec/i18n_spec.rb
+++ b/spec/i18n_spec.rb
@@ -7,7 +7,7 @@
it 'does not have missing keys' do
expect(missing_keys).to be_empty,
- "Missing #{missing_keys.leaves.count} i18n keys, run `i18n-tasks"\
+ "Missing #{missing_keys.leaves.count} i18n keys, run `i18n-tasks "\
"missing' to show them"
end
| Fix typo in i18n spec
|
diff --git a/examples/my_projects.rb b/examples/my_projects.rb
index abc1234..def5678 100644
--- a/examples/my_projects.rb
+++ b/examples/my_projects.rb
@@ -2,17 +2,17 @@
p "configuring.."
Kickscraper.configure do |config|
- config.email = 'your-kickstarter-email-address@domain.com'
- config.password = 'This is not my real password. Seriously.'
+ config.email = 'your-kickstarter-email-address@domain.com'
+ config.password = 'This is not my real password. Seriously.'
end
p "logging in.."
c = Kickscraper.client
p "got access token #{Kickscraper.token.gsub(/\w{30}$/, "X" * 30)}"
-puts " A | C |"
-puts "------------------------"
+puts " Active | Met Goal |"
+puts "--------------------"
c.user.backed_projects.each {|x|
- print (x.active? ? ' X |' : ' |')
- print (x.successful? ? ' X | ' : ' | ')
- puts x.name
+ print (x.active? ? ' X |' : ' |')
+ print (x.successful? ? ' X | ' : ' | ')
+ puts x.name
}
| Change up the example's format a tad
|
diff --git a/spec/site_spec.rb b/spec/site_spec.rb
index abc1234..def5678 100644
--- a/spec/site_spec.rb
+++ b/spec/site_spec.rb
@@ -7,6 +7,7 @@
describe '#generate' do
before { subject.generate }
+ after { FileUtils.remove_dir(subject.paths[:destination]) }
it 'finds all the templates' do
expect(subject.templates.count).to eq(3)
| Clean up the output directory
|
diff --git a/spec/assumption_spec.rb b/spec/assumption_spec.rb
index abc1234..def5678 100644
--- a/spec/assumption_spec.rb
+++ b/spec/assumption_spec.rb
@@ -2,28 +2,28 @@ include Stats::Assumption
module Stats
- describe "#assume" do
- before do
- self.should_receive(:caller).twice.and_return(["`my_statistical_test'"])
- end
-
- it "does nothing if its associated block returns true" do
- self.should_not_receive(:puts)
- assume :equal_variance do
- true
- end
- end
-
- it "displays a warning if its associated block returns false" do
- warning_message = <<-WARNING
-[warning] Assumption not met: equal variance in my_statistical_test"
- Test is likely not valid"
- WARNING
-
- self.should_receive(:puts).with(warning_message)
- assume :equal_variance do
- false
- end
- end
- end
+# describe "#assume" do
+# before do
+# self.should_receive(:caller).twice.and_return(["`my_statistical_test'"])
+# end
+#
+# it "does nothing if its associated block returns true" do
+# self.should_not_receive(:puts)
+# assume :equal_variance do
+# true
+# end
+# end
+#
+# it "displays a warning if its associated block returns false" do
+# warning_message = <<-WARNING
+# [warning] Assumption not met: equal variance in my_statistical_test"
+# Test is likely not valid"
+# WARNING
+#
+# self.should_receive(:puts).with(warning_message)
+# assume :equal_variance do
+# false
+# end
+# end
+# end
end
| Disable assumption specs on this branch - working on features/assumption for now.
|
diff --git a/spec/simple_app_spec.rb b/spec/simple_app_spec.rb
index abc1234..def5678 100644
--- a/spec/simple_app_spec.rb
+++ b/spec/simple_app_spec.rb
@@ -10,7 +10,8 @@ describe 'simple failing test' do
it 'fails' do
# Only the must_equal format gives the file and line where the failure occurred
- say_bye.must_equal 'Bye'
+ say_bye.must_equal 'Hello'
+ # say_bye.must_equal 'Bye'
# expect(say_bye).to_equal 'Bye'
end
end
| Create new branch with specs passing and features failing
|
diff --git a/Library/Homebrew/test/test_hardware.rb b/Library/Homebrew/test/test_hardware.rb
index abc1234..def5678 100644
--- a/Library/Homebrew/test/test_hardware.rb
+++ b/Library/Homebrew/test/test_hardware.rb
@@ -10,7 +10,8 @@
def test_hardware_intel_family
if Hardware.cpu_type == :intel
- assert [:core, :core2, :penryn, :nehalem, :arrandale, :sandybridge].include?(Hardware.intel_family)
+ assert [:core, :core2, :penryn, :nehalem,
+ :arrandale, :sandybridge, :ivybridge].include?(Hardware.intel_family)
end
end
end
| Fix test failure on ivybridge cpus.
Closes Homebrew/homebrew#18371.
Signed-off-by: Adam Vandenberg <34c2b6407fd5a10249a15d699d40f9ed1782e98c@gmail.com>
|
diff --git a/core/db/migrate/20140410141842_add_many_missing_indexes.rb b/core/db/migrate/20140410141842_add_many_missing_indexes.rb
index abc1234..def5678 100644
--- a/core/db/migrate/20140410141842_add_many_missing_indexes.rb
+++ b/core/db/migrate/20140410141842_add_many_missing_indexes.rb
@@ -13,6 +13,5 @@ add_index :spree_product_option_types, :product_id
add_index :spree_products_taxons, :position
add_index :spree_promotions, :starts_at
- add_index :spree_stores, :url
end
end
| Remove spree_stores from index list.
|
diff --git a/Casks/mail-designer.rb b/Casks/mail-designer.rb
index abc1234..def5678 100644
--- a/Casks/mail-designer.rb
+++ b/Casks/mail-designer.rb
@@ -0,0 +1,11 @@+cask :v1 => 'mail-designer' do
+ version '2.3.1'
+ sha256 'ea4052960959f7a9fdc2033441eaba2267b0d0df01a7c70da57f747ee5438afd'
+
+ url "http://download.equinux.com/files/other/Mail_Designer_#{version}.zip"
+ name 'Mail Designer'
+ homepage 'http://equinux.com/us/products/maildesigner2/'
+ license :commercial
+
+ app 'Mail Designer.app'
+end
| Add Mail Designer.app version 2.3.1
|
diff --git a/spec/integration/commands/copy_spec.rb b/spec/integration/commands/copy_spec.rb
index abc1234..def5678 100644
--- a/spec/integration/commands/copy_spec.rb
+++ b/spec/integration/commands/copy_spec.rb
@@ -0,0 +1,51 @@+require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
+
+describe "Copy command" do
+
+ before(:all) do
+ @kvs = storage_connection
+ end
+
+ context "copying local file to bucket" do
+
+ before(:all) { purge_bucket('my_bucket') }
+
+ context "when local file does not exist" do
+ it "should exit with file not found" do
+ response = capture(:stdout){ HPCloud::CLI.start(['copy', 'foo.txt', ':my_bucket']) }
+ response.should eql("File not found at 'foo.txt'.\n")
+ end
+ end
+
+ context "when bucket does not exist" do
+ it "should exit with bucket not found" do
+ response = capture(:stdout){ HPCloud::CLI.start(['copy', 'spec/fixtures/files/foo.txt', ':my_bucket']) }
+ response.should eql("You don't have a bucket 'my_bucket'.\n")
+ end
+ end
+
+ context "when file and bucket exist" do
+ before(:all) do
+ @kvs.put_bucket('my_bucket')
+ @response = capture(:stdout){ HPCloud::CLI.start(['copy', 'spec/fixtures/files/foo.txt', ':my_bucket']) }
+ @get = @kvs.get_object('my_bucket', 'foo.txt')
+ end
+
+ it "should report success" do
+ @response.should eql("Copied spec/fixtures/files/foo.txt => :my_bucket/foo.txt\n")
+ end
+
+ it "should copy file to bucket" do
+ @get.status.should eql(200)
+ end
+
+ it "should preserve content-type" do
+ @get.headers["content-type"].should eql('text/plain')
+ end
+
+ after(:all) { purge_bucket('my_bucket') }
+ end
+
+ end
+
+end | Test coverage for copy command file => bucket
|
diff --git a/app/controllers/superadmin/organizations_controller.rb b/app/controllers/superadmin/organizations_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/superadmin/organizations_controller.rb
+++ b/app/controllers/superadmin/organizations_controller.rb
@@ -2,7 +2,7 @@ class OrganizationsController < ::Superadmin::SuperadminController
respond_to :json
- ssl_required :show, :create, :update, :destroy, :index
+ ssl_required :show, :index
layout 'application'
def show
| Remove filter pointing to old controller actions
|
diff --git a/new_relic-crepe.gemspec b/new_relic-crepe.gemspec
index abc1234..def5678 100644
--- a/new_relic-crepe.gemspec
+++ b/new_relic-crepe.gemspec
@@ -18,7 +18,7 @@ s.test_files = Dir['spec/**/*.rb']
# We can only support the same Ruby versions as Crepe itself, after all.
- s.required_ruby_version = '>= 2.0.0'
+ s.required_ruby_version = '>= 2.1.0'
s.add_dependency 'newrelic_rpm', '>= 3.9.0.229'
s.add_dependency 'crepe', '>= 0.0.1.pre'
| Bump Ruby requirement to 2.1.0
Signed-off-by: David Celis <b1c1d8736f20db3fb6c1c66bb1455ed43909f0d8@davidcel.is>
|
diff --git a/test/test_helpers.rb b/test/test_helpers.rb
index abc1234..def5678 100644
--- a/test/test_helpers.rb
+++ b/test/test_helpers.rb
@@ -3,34 +3,28 @@ class TestHelpers < Test::Unit::TestCase
context "The Rutty::Helpers module" do
setup do
- class Testing
- include Rutty::Helpers
- end
-
- @obj = Testing.new
+ ensure_fresh_config!
+ @obj = Rutty::Runner.new TEST_CONF_DIR
end
should "mixin its helper methods" do
assert_respond_to @obj, :check_installed!
- assert_respond_to @obj, :get_version
+ end
+
+ should "respond to its static methods" do
+ assert_respond_to Rutty::Helpers, :get_version
end
should "get the correct version" do
- assert_equal @obj.get_version, Rutty::Version::STRING
+ assert_equal Rutty::Helpers.get_version, Rutty::Version::STRING
end
should "correctly check the installation status" do
- if File.exists? Rutty::Consts::CONF_DIR
- %x(mv #{Rutty::Consts::CONF_DIR} #{Rutty::Consts::CONF_DIR}.bak)
- end
+ clean_test_config
assert_raise Rutty::NotInstalledError do
@obj.check_installed!
end
-
- if File.exists? "#{Rutty::Consts::CONF_DIR}.bak"
- %x(mv #{Rutty::Consts::CONF_DIR}.bak #{Rutty::Consts::CONF_DIR})
- end
end
end
end
| Rewrite much of the Rutty::Helpers tests to reflect changes
|
diff --git a/core_gems.rb b/core_gems.rb
index abc1234..def5678 100644
--- a/core_gems.rb
+++ b/core_gems.rb
@@ -8,6 +8,7 @@ download "cool.io", "1.6.0"
download 'serverengine', '2.2.1'
download "oj", "3.8.1"
+ download "async-http", "0.50.2"
end
download "http_parser.rb", "0.6.0"
download "yajl-ruby", "1.4.1"
| Add async-http to core gems
|
diff --git a/sprout-osx-base/attributes/versions.rb b/sprout-osx-base/attributes/versions.rb
index abc1234..def5678 100644
--- a/sprout-osx-base/attributes/versions.rb
+++ b/sprout-osx-base/attributes/versions.rb
@@ -1 +1 @@-node.default['versions']['bash_it'] = '5cb0ecc1c813bc5619e0f708b8015a4596a37d6c'
+node.default['versions']['bash_it'] = '8bf641baec4316cebf1bc1fd2757991f902506dc'
| Update bash-it sha to latest for chruby support
* existing version is from Aug 2012
* changes: https://github.com/revans/bash-it/compare/5cb0ecc...8bf641b
Signed-off-by: Brian Cunnie <08b1994189fa435ac5418242919427d718cd7695@pivotallabs.com>
|
diff --git a/lib/openstack/openstack_handle/identity_delegate.rb b/lib/openstack/openstack_handle/identity_delegate.rb
index abc1234..def5678 100644
--- a/lib/openstack/openstack_handle/identity_delegate.rb
+++ b/lib/openstack/openstack_handle/identity_delegate.rb
@@ -15,7 +15,7 @@ def visible_tenants
response = Handle.try_connection do |scheme, connection_options|
url = Handle.url(@os_handle.address, @os_handle.port, scheme, "/v2.0/tenants")
- connection = Fog::Connection.new(url, false, connection_options)
+ connection = Fog::Core::Connection.new(url, false, connection_options)
response = connection.request(
:expects => [200, 204],
:headers => {'Content-Type' => 'application/json',
| Fix deprecation warning regarding Fog::Connection
|
diff --git a/features/support/env.rb b/features/support/env.rb
index abc1234..def5678 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -15,7 +15,31 @@ install_fixture_gems
end
+class RunnerEnvironment < Hash
+ # Override Hash#clear with a version that keeps the API key and endpoint
+ # These are set before every test anyway, so there's no need to get rid of them
+ def clear
+ self.keep_if do |key, value|
+ key == "BUGSNAG_API_KEY" || key == "BUGSNAG_ENDPOINT"
+ end
+ end
+end
+
Before do
+ # FIXME: This is a hack to work around a Maze Runner bug!
+ # Maze Runner now clears the environment between tests automatically, but this
+ # happens _after_ this Before block runs. Therefore the API key and endpoint
+ # that we set here are removed, so all of the tests fail because they can't
+ # report anything. Once that issue is resolved, we can remove this and the
+ # RunnerEnvironment class
+ class Runner
+ class << self
+ def environment
+ @env ||= RunnerEnvironment.new
+ end
+ end
+ end
+
Docker.compose_project_name = "#{rand.to_s}:#{Time.new.strftime("%s")}"
Runner.environment.clear
Runner.environment["BUGSNAG_API_KEY"] = $api_key
| Add hack to workaround a maze runner bug
This is temporary to get CI passing, not something we want to keep!
|
diff --git a/features/support/env.rb b/features/support/env.rb
index abc1234..def5678 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -1,5 +1,5 @@ require 'aruba/cucumber'
Before do
- @aruba_timeout_seconds = 30
+ @aruba_timeout_seconds = 300
end
| Increase aruba timeout for Travis rbx-2.0.
|
diff --git a/TodUni/app/controllers/projects_controller.rb b/TodUni/app/controllers/projects_controller.rb
index abc1234..def5678 100644
--- a/TodUni/app/controllers/projects_controller.rb
+++ b/TodUni/app/controllers/projects_controller.rb
@@ -23,7 +23,8 @@
def create
@user = current_user
- @project = @user.projects.build(project_params)
+ @project = Project.new(project_params)
+ @user.projects << @project
assign_usernames(@project)
if @project.save
| Fix user creates a project
|
diff --git a/ZVideoRecorder.podspec b/ZVideoRecorder.podspec
index abc1234..def5678 100644
--- a/ZVideoRecorder.podspec
+++ b/ZVideoRecorder.podspec
@@ -30,7 +30,7 @@ s.dependency "PBJVision", '0.2.1'
s.dependency "PBJVideoPlayer"
s.dependency "AFNetworking", '1.3.4'
- s.dependency "ZProgressView", '0.2.1'
+ s.dependency "ZProgressView"
end
| Remove version requirement for ZProgressView dependency
Signed-off-by: Jai Govindani <5e20fe37a69ce9fbd5fcf1954669306b1d3f834f@gmail.com>
|
diff --git a/db/data_migration/20130320151156_replace_target_url_with_new_for_undeleted_edition.rb b/db/data_migration/20130320151156_replace_target_url_with_new_for_undeleted_edition.rb
index abc1234..def5678 100644
--- a/db/data_migration/20130320151156_replace_target_url_with_new_for_undeleted_edition.rb
+++ b/db/data_migration/20130320151156_replace_target_url_with_new_for_undeleted_edition.rb
@@ -0,0 +1,2 @@+Unpublishing.from_slug('cabinet-office-staff-and-salary-data-30-september-2012', Publication).
+ update_column(:alternative_url, 'https://www.gov.uk/government/publications/cabinet-office-staff-and-salary-data-30-september-2012--2')
| Update alternative_url for unpublished edition
https://www.pivotaltracker.com/story/show/46443439
|
diff --git a/spec/support/inspectable_mock_server.rb b/spec/support/inspectable_mock_server.rb
index abc1234..def5678 100644
--- a/spec/support/inspectable_mock_server.rb
+++ b/spec/support/inspectable_mock_server.rb
@@ -47,14 +47,18 @@
def handle_connection(client_socket)
if hold_requests
- condition = Celluloid::Condition.new
- request_queue << condition
-
read_request client_socket
- condition.wait
+ hold_request
write_response client_socket
else
super
end
end
+
+ def hold_request
+ Celluloid::Condition.new.tap do |condition|
+ request_queue << condition
+ condition.wait
+ end
+ end
end
| Make InspectableMockServer register request before holding it
|
diff --git a/lib/aws/plugins/s3_location_constraint.rb b/lib/aws/plugins/s3_location_constraint.rb
index abc1234..def5678 100644
--- a/lib/aws/plugins/s3_location_constraint.rb
+++ b/lib/aws/plugins/s3_location_constraint.rb
@@ -5,8 +5,8 @@ class Handler < Seahorse::Client::Handler
def call(context)
- s3_endpoint = context.config[:endpoint]
- region = context.config[:region]
+ s3_endpoint = context.config.endpoint
+ region = context.config.region
create_bucket_params = context.params[:create_bucket_configuration]
location_constraint = nil
| Use Struct Syntax for Context Config
In the s3_location_constraint plugin, use struct syntax over hash syntax
for access to the context.config object.
|
diff --git a/juvet.gemspec b/juvet.gemspec
index abc1234..def5678 100644
--- a/juvet.gemspec
+++ b/juvet.gemspec
@@ -18,7 +18,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
- spec.required_ruby_version = ">= 2.2"
+ spec.required_ruby_version = ">= 2.1"
spec.add_runtime_dependency("redis")
end
| Reduce the ruby verion requirement
|
diff --git a/core/db/migrate/20100209144531_polymorphic_payments.rb b/core/db/migrate/20100209144531_polymorphic_payments.rb
index abc1234..def5678 100644
--- a/core/db/migrate/20100209144531_polymorphic_payments.rb
+++ b/core/db/migrate/20100209144531_polymorphic_payments.rb
@@ -10,8 +10,11 @@ end
execute "UPDATE payments SET payable_type = 'Order'"
- Creditcard.all.each do |creditcard|
- if checkout = Checkout.find_by_id(creditcard.checkout_id) and checkout.order
+ Spree::Creditcard.table_name = "creditcards"
+ Spree::Checkout.table_name = "checkouts"
+
+ Spree::Creditcard.all.each do |creditcard|
+ if checkout = Spree::Checkout.find_by_id(creditcard.checkout_id) and checkout.order
if payment = checkout.order.payments.first
execute "UPDATE payments SET source_type = 'Creditcard', source_id = #{creditcard.id} WHERE id = #{payment.id}"
end
@@ -21,6 +24,9 @@ change_table :creditcards do |t|
t.remove :checkout_id
end
+
+ Spree::Creditcard.table_name = "spree_creditcards"
+ Spree::Checkout.table_name = "spree_checkouts"
end
def self.down
| Correct namespace in polymorphic payments migration
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.