diff stringlengths 65 26.7k | message stringlengths 7 9.92k |
|---|---|
diff --git a/app/models/odi_locale.rb b/app/models/odi_locale.rb
index abc1234..def5678 100644
--- a/app/models/odi_locale.rb
+++ b/app/models/odi_locale.rb
@@ -1,7 +1,7 @@ class OdiLocale
def self.changed_locale_path(current_path, new_locale)
- current_path.gsub(%r{\A/[a-z]{2}/(.*)}, "/#{new_locale}/\\1")
+ current_path.gsub(%r{\A/[a-z]{2}(_[A-Z]{2})?/(.*)}, "/#{new_locale}/\\2")
end
end
| Handle more complex locales in switching helper |
diff --git a/lib/engineyard-cloud-client/version.rb b/lib/engineyard-cloud-client/version.rb
index abc1234..def5678 100644
--- a/lib/engineyard-cloud-client/version.rb
+++ b/lib/engineyard-cloud-client/version.rb
@@ -1,7 +1,7 @@ # This file is maintained by a herd of rabid monkeys with Rakes.
module EY
class CloudClient
- VERSION = '1.0.6'
+ VERSION = '1.0.7.pre'
end
end
# Please be aware that the monkeys like tho throw poo sometimes.
| Add .pre for next release
|
diff --git a/lib/airbrake/cli/runner.rb b/lib/airbrake/cli/runner.rb
index abc1234..def5678 100644
--- a/lib/airbrake/cli/runner.rb
+++ b/lib/airbrake/cli/runner.rb
@@ -22,6 +22,7 @@ c.api_key = options.api_key
c.host = options.host if options.host
c.port = options.port if options.port
+ c.secure = options.port.to_i == 443
end
exception_id = Airbrake.notify(:error_class => options.error,
:error_message => "#{options.error}: #{options.message}",
| Add support for SSL in the command line tool.
|
diff --git a/lib/alfred/task_manager.rb b/lib/alfred/task_manager.rb
index abc1234..def5678 100644
--- a/lib/alfred/task_manager.rb
+++ b/lib/alfred/task_manager.rb
@@ -12,7 +12,7 @@
def self.load_tasks
task_dirs.each do |dir|
- Dir[dir + '/lib/tasks/**_task.rb'].each { |task_file| load(task_file) }
+ Dir[dir + '/lib/tasks/**/*_task.rb'].each { |task_file| load(task_file) }
end
end
| Fix TaskManager.load_tasks so the tasks in namespaces are also loaded.
|
diff --git a/lib/input_sanitizer/v2/types.rb b/lib/input_sanitizer/v2/types.rb
index abc1234..def5678 100644
--- a/lib/input_sanitizer/v2/types.rb
+++ b/lib/input_sanitizer/v2/types.rb
@@ -9,7 +9,7 @@ end
end
- class NonStrictIntegerCheck
+ class CoercingIntegerCheck
def call(value)
Integer(value)
rescue ArgumentError
@@ -35,7 +35,7 @@ end
end
- class NonStrictBooleanCheck
+ class CoercingBooleanCheck
def call(value)
if [true, 'true'].include?(value)
true
| Rename NonStrict checks to Coercing.
|
diff --git a/lib/seek/download_handling/streamer.rb b/lib/seek/download_handling/streamer.rb
index abc1234..def5678 100644
--- a/lib/seek/download_handling/streamer.rb
+++ b/lib/seek/download_handling/streamer.rb
@@ -21,13 +21,14 @@ private
def get_uri(uri, output, redirect_count = 0)
+ max_size = Seek::Config.hard_max_cachable_size
Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
http.request(Net::HTTP::Get.new(uri)) do |res|
if res.code == '200'
total_size = 0
res.read_body do |chunk|
total_size += chunk.size
- raise SizeLimitExceededException.new(total_size) if total_size > Seek::Config.hard_max_cachable_size
+ raise SizeLimitExceededException.new(total_size) if total_size > max_size
output << chunk
end
total_size
| Stop excessive config-related database queries
|
diff --git a/lib/semaphoreapp/json_api.rb b/lib/semaphoreapp/json_api.rb
index abc1234..def5678 100644
--- a/lib/semaphoreapp/json_api.rb
+++ b/lib/semaphoreapp/json_api.rb
@@ -24,6 +24,25 @@ raise_if_error(JSON.parse(super))
end
+ def self.get_servers(project_hash_id, options={})
+ raise_if_error(JSON.parse(super))
+ end
+
+ def self.get_server_status(project_hash_id, id, options={})
+ raise_if_error(JSON.parse(super))
+ end
+
+ def self.get_server_history(project_hash_id, id, options={})
+ raise_if_error(JSON.parse(super))
+ end
+
+ def self.get_deploy_information(project_hash_id, id, deploy_number, options={})
+ raise_if_error(JSON.parse(super))
+ end
+
+ def self.get_deploy_log(project_hash_id, id, deploy_number, options={})
+ raise_if_error(JSON.parse(super))
+ end
private
| Add server APIs to JsonApi.
|
diff --git a/unicorn.rb b/unicorn.rb
index abc1234..def5678 100644
--- a/unicorn.rb
+++ b/unicorn.rb
@@ -2,3 +2,22 @@
listen 4000
worker_processes 8
+
+before_fork do |server, worker|
+ # Single server rolling reaper.
+ # 1. Start new master, flag old as old
+ # 2. Bring up 1 new worker and request old master gently kill one worker
+ # 3. Repeat until all old workers are dead
+ # 4. Reap old master
+ old_pid = "#{server.config[:pid]}.oldbin"
+ if old_pid != server.pid
+ begin
+ sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU
+ Process.kill(sig, File.read(old_pid).to_i)
+ rescue Errno::ENOENT, Errno::ESRCH
+ # someone else did our job for us
+ end
+ end
+
+ sleep 1 # Time between each new worker thread start (single thread warmup period)
+end
| Use the process-at-a-time rolling restart.
|
diff --git a/lib/stack_master/prompter.rb b/lib/stack_master/prompter.rb
index abc1234..def5678 100644
--- a/lib/stack_master/prompter.rb
+++ b/lib/stack_master/prompter.rb
@@ -6,6 +6,7 @@ if StackMaster.stdin.tty? && StackMaster.stdout.tty?
StackMaster.stdin.getch.chomp
else
+ StackMaster.stdout.puts
StackMaster.stdout.puts "STDOUT or STDIN was not a TTY. Defaulting to no. To force yes use -f"
'n'
end
| Add additional puts to end the previous line |
diff --git a/lib/tasks/arxiv_oai_update.rake b/lib/tasks/arxiv_oai_update.rake
index abc1234..def5678 100644
--- a/lib/tasks/arxiv_oai_update.rake
+++ b/lib/tasks/arxiv_oai_update.rake
@@ -10,18 +10,18 @@ # Hence the use of submit_date instead of update_date.
# There is some risk here that we could end up with holes in the
# database if a sync fails somewhere; needs further investigation.
- last_paper = Paper.order("submit_date asc").last
+ last_paper = Paper.order("pubdate asc").last
if last_paper.nil?
date = Date.today-1.days
else
date = last_paper.update_date
- end
- syncdate = nil
- if last_paper.pubdate > Date.today-1.days
- # We're in a daily sync cycle and can timestamp without estimating
- syncdate = Time.now.utc.change(hour: 1)
+ syncdate = nil
+ if last_paper.pubdate > Date.today-1.days
+ # We're in a daily sync cycle and can timestamp without estimating
+ syncdate = Time.now.utc.change(hour: 1)
+ end
end
| Fix oai_update when no papers in database
|
diff --git a/lib/tasks/errbit/bootstrap.rake b/lib/tasks/errbit/bootstrap.rake
index abc1234..def5678 100644
--- a/lib/tasks/errbit/bootstrap.rake
+++ b/lib/tasks/errbit/bootstrap.rake
@@ -7,7 +7,7 @@ configs = {
'config.example.yml' => 'config.yml',
'deploy.example.rb' => 'deploy.rb',
- 'mongoid.example.yml' => 'mongoid.yml'
+ (ENV['HEROKU'] ? 'mongoid.mongohq.yml' : 'mongoid.example.yml') => 'mongoid.yml'
}
puts "Copying example config files..."
| Copy mongohq example conf on heroku
|
diff --git a/lib/tasks/islay_shop_tasks.rake b/lib/tasks/islay_shop_tasks.rake
index abc1234..def5678 100644
--- a/lib/tasks/islay_shop_tasks.rake
+++ b/lib/tasks/islay_shop_tasks.rake
@@ -1,5 +1,16 @@ namespace :islay_shop do
namespace :db do
+ desc "Fixes ordering of product categories and products"
+ task :order_fix => :environment do
+ Product.all.group_by {|p| p.product_category_id}.each do |g, a|
+ a.each_with_index {|p, i| p.update_attribute :position, i + 1}
+ end
+
+ ProductCategory.all.group_by {|p| p.product_category_id || 'NULL'}.each do |g, a|
+ a.each_with_index {|p, i| p.update_attribute :position, i + 1}
+ end
+ end
+
desc "Loads in seed data for bootstrapping a fresh Islay app."
task :seed => :environment do
require 'islay/spec'
| Add a rake task for repairing product and category orders.
|
diff --git a/gogogibbon_tools.gemspec b/gogogibbon_tools.gemspec
index abc1234..def5678 100644
--- a/gogogibbon_tools.gemspec
+++ b/gogogibbon_tools.gemspec
@@ -17,10 +17,11 @@ s.test_files = Dir["test/**/*"]
s.add_dependency "slim"
- s.add_dependency "rails", "~> 3.2.13.rc1"
+ s.add_dependency "rails", "~>4.2"
s.add_dependency "gogogibbon", "~> 1.1.1"
- s.add_dependency "bootstrap-sass", '3.1.1.0'
- s.add_dependency "sass-rails", '> 3.2', '< 5'
+ s.add_dependency "bootstrap-sass"
+ s.add_dependency "sass-rails"
+ s.add_dependency "protected_attributes"
# s.add_dependency "jquery-rails"
end
| Upgrade gems to latest versions.
|
diff --git a/lib/yard/rake/yardoc_task.rb b/lib/yard/rake/yardoc_task.rb
index abc1234..def5678 100644
--- a/lib/yard/rake/yardoc_task.rb
+++ b/lib/yard/rake/yardoc_task.rb
@@ -15,6 +15,9 @@ @files = []
yield self if block_given?
+ self.options += ENV['OPTS'].split(' ') if ENV['OPTS']
+ self.files += ENV['FILES'].split(',') if ENV['FILES']
+
define
end
| Allow command line parameters to extend rake task
|
diff --git a/lib/routemaster/jobs/backends/resque.rb b/lib/routemaster/jobs/backends/resque.rb
index abc1234..def5678 100644
--- a/lib/routemaster/jobs/backends/resque.rb
+++ b/lib/routemaster/jobs/backends/resque.rb
@@ -10,7 +10,7 @@ end
def enqueue(queue, job_class, *args)
- job_data = data_for(job_class, args)
+ job_data = Job.data_for(job_class, args)
@adapter.enqueue_to(queue, JobWrapper, job_data)
end
| LT-113: Add missing 'Job' qualifier :-/
|
diff --git a/lib/sunlight/influence/entity_search.rb b/lib/sunlight/influence/entity_search.rb
index abc1234..def5678 100644
--- a/lib/sunlight/influence/entity_search.rb
+++ b/lib/sunlight/influence/entity_search.rb
@@ -1,5 +1,4 @@ class Sunlight::Influence::EntityTest < OpenStruct
- attr_accessor :result
extend CallConstructor
def self.search(name)
@@ -36,4 +35,9 @@ sunlight_call(bar)
end
+ def self.retrieve_overview(entity_id, cycle)
+ uri = URI("#{Sunlight::Influence::BASE_URI}/entities/#{entity_id}.json?cycle=#{cycle}&apikey=#{Sunlight::Influence.api_key}")
+ JSON.load(Net:HTTP.get(uri))["results"].collect{|json| new(json)}
+ end
+
end
| Add entity overview method to entity
|
diff --git a/lib/feed2email/logger.rb b/lib/feed2email/logger.rb
index abc1234..def5678 100644
--- a/lib/feed2email/logger.rb
+++ b/lib/feed2email/logger.rb
@@ -14,7 +14,7 @@ private
def log_to
- if log_path.nil? || log_path == true
+ if log_path == true
$stdout
elsif log_path # truthy but not true (a path)
File.expand_path(log_path)
| Remove config default for log_path
|
diff --git a/lib/fpm/cookery/facts.rb b/lib/fpm/cookery/facts.rb
index abc1234..def5678 100644
--- a/lib/fpm/cookery/facts.rb
+++ b/lib/fpm/cookery/facts.rb
@@ -17,9 +17,9 @@
def self.target
@target ||= case platform
- when :centos, :redhat, :fedora then :rpm
- when :debian, :ubuntu then :deb
- when :darwin then :osxpkg
+ when :centos, :redhat, :fedora, :amazon then :rpm
+ when :debian, :ubuntu then :deb
+ when :darwin then :osxpkg
end
end
| Add amazon linux to the list of RPM-based distros
|
diff --git a/lib/helios/cylon_effect.rb b/lib/helios/cylon_effect.rb
index abc1234..def5678 100644
--- a/lib/helios/cylon_effect.rb
+++ b/lib/helios/cylon_effect.rb
@@ -7,6 +7,8 @@ lights = args.fetch('lights', [1, '..', 25])
@iterations = args.fetch('iterations', 5)
@lights = get_lights(lights)
+ @color = args.values_at('r', 'g', 'b')
+ @color = RED if @color.none?
end
def change!
@@ -14,7 +16,7 @@
@iterations.times do
cylon_lights = Array.new(size, BLACK)
- cylon_lights[0] = RED
+ cylon_lights[0] = @color
size.times do
set_lights(cylon_lights, @lights)
| Allow Cylon effect to have a specified color
Allow the Cylon effect to have a specified color, defaulting to red (255, 0, 0) |
diff --git a/lib/inpost/machines_api.rb b/lib/inpost/machines_api.rb
index abc1234..def5678 100644
--- a/lib/inpost/machines_api.rb
+++ b/lib/inpost/machines_api.rb
@@ -4,31 +4,40 @@
ENDPOINT_URL = 'https://api-pl.easypack24.net/v4/machines'
- def initialize(endpoint_url: ENDPOINT_URL, cache_store: Inpost::CacheFileStore)
+ def initialize(endpoint_url: ENDPOINT_URL, cache_store: Inpost::CacheFileStore.new)
@endpoint_url = endpoint_url
@cache = cache_store
end
def machines
- response = request(:get)
- machine_collection = parse_response(response)
- @cache.write(machine_collection)
+ get_from_cache || write_to_cache(get_from_http)
end
def machine(id)
- machines = machines['_embedded']['machines'].find do |machine|
- machine['id'] == id
- end
+ machines.find { |machine| machine['id'] == id }
end
- private
+ protected
- def request(method=:get)
- RestClient::Request.execute(method: method, url: @endpoint_url)
+ def request(method=:get, url)
+ RestClient::Request.execute(method: method, url: url)
end
def parse_response(response)
- JSON.parse(response)
+ JSON.parse(response)['_embedded']['machines']
+ end
+
+ def get_from_cache
+ return nil unless @cache
+ @cache.read
+ end
+
+ def write_to_cache(data)
+ @cache.write(data) if @cache
+ end
+
+ def get_from_http
+ parse_response(request(:get, @endpoint_url))
end
end
| Add cache in machine api
|
diff --git a/lib/moneymanager/parser.rb b/lib/moneymanager/parser.rb
index abc1234..def5678 100644
--- a/lib/moneymanager/parser.rb
+++ b/lib/moneymanager/parser.rb
@@ -33,7 +33,7 @@ entry = Entry.new
entry.date = Date.strptime(row[:buchungstag], '%d.%m.%y')
entry.reason = row[:verwendungszweck].squeeze(' ')
- entry.amount = row[:betrag].to_f
+ entry.amount = row[:betrag].to_s.gsub(',', '.').to_f
entry.company = row[:beguenstigterzahlungspflichtiger].squeeze(' ')
entry.raw = row.to_csv.squeeze(' ')
entries << entry
| Fix import with decimal points
|
diff --git a/lib/tasks/coveralls.rake b/lib/tasks/coveralls.rake
index abc1234..def5678 100644
--- a/lib/tasks/coveralls.rake
+++ b/lib/tasks/coveralls.rake
@@ -1,3 +1,3 @@ require 'coveralls/rake/task'
Coveralls::RakeTask.new
-task :test_with_coveralls => ['spec:models', :features, 'coveralls:push']
+task :test_with_coveralls => ['spec:models', :cucumber, 'coveralls:push']
| Use non-deprecated 'cucumber' rake task.
The 'features' task is deprecated.
|
diff --git a/lib/testjour/pid_file.rb b/lib/testjour/pid_file.rb
index abc1234..def5678 100644
--- a/lib/testjour/pid_file.rb
+++ b/lib/testjour/pid_file.rb
@@ -8,7 +8,7 @@
def verify_doesnt_exist
if File.exist?(@path)
- puts "!!! PID file #{pid_file} already exists. testjour could be running already."
+ puts "!!! PID file #{@path} already exists. testjour could be running already."
puts "!!! Exiting with error. You must stop testjour and clear the .pid before I'll attempt a start."
exit 1
end
| Fix minor bug in Pidfile
|
diff --git a/lib/walmart_open/item.rb b/lib/walmart_open/item.rb
index abc1234..def5678 100644
--- a/lib/walmart_open/item.rb
+++ b/lib/walmart_open/item.rb
@@ -20,17 +20,21 @@ attr_reader attr_name
end
+ attr_reader :raw_attributes
+
def initialize(attrs)
- load_known_attributes(attrs)
+ @raw_attributes = attrs
+
+ extract_known_attributes
end
private
- def load_known_attributes(api_attrs)
+ def extract_known_attributes
API_ATTRIBUTES_MAPPING.each do |api_attr, attr|
- next unless api_attrs.has_key?(api_attr)
+ next unless raw_attributes.has_key?(api_attr)
- instance_variable_set("@#{attr}", api_attrs[api_attr])
+ instance_variable_set("@#{attr}", raw_attributes[api_attr])
end
end
end
| Save the raw attributes incase we need it
|
diff --git a/lib/tty/command/version.rb b/lib/tty/command/version.rb
index abc1234..def5678 100644
--- a/lib/tty/command/version.rb
+++ b/lib/tty/command/version.rb
@@ -2,6 +2,6 @@
module TTY
class Command
- VERSION = '0.8.1'
+ VERSION = '0.8.2'.freeze
end # Command
end # TTY
| Change to bump patch level up
|
diff --git a/lib/twterm/history/base.rb b/lib/twterm/history/base.rb
index abc1234..def5678 100644
--- a/lib/twterm/history/base.rb
+++ b/lib/twterm/history/base.rb
@@ -11,7 +11,11 @@ return
end
- @history = YAML.load(File.read(history_file)) || []
+ begin
+ @history = YAML.load(File.read(history_file)) || []
+ rescue
+ @history = []
+ end
end
def add(hashtag)
| Handle error when history file cannot be loaded correctly
|
diff --git a/spec/bandwidth/xml/verbs/gather_spec.rb b/spec/bandwidth/xml/verbs/gather_spec.rb
index abc1234..def5678 100644
--- a/spec/bandwidth/xml/verbs/gather_spec.rb
+++ b/spec/bandwidth/xml/verbs/gather_spec.rb
@@ -2,8 +2,8 @@ describe Gather do
describe '#to_xml' do
it 'should generate valid xml' do
- expect(Helper.to_xml(Gather.new(:request_url => "http://localhost"))).to eql("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Response><Gather requestUrl=\"http://localhost\"/></Response>")
- expect(Helper.to_xml(Gather.new(:request_url => "http://localhost", :max_digits => 2))).to eql("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Response><Gather requestUrl=\"http://localhost\" maxDigits=\"2\"/></Response>")
+ expect(Helper.to_xml(Gather.new(:request_url => "http://localhost"))).to eql("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Response><Gather requestUrl=\"http://localhost\"></Gather></Response>")
+ expect(Helper.to_xml(Gather.new(:request_url => "http://localhost", :max_digits => 2))).to eql("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Response><Gather requestUrl=\"http://localhost\" maxDigits=\"2\"></Gather></Response>")
end
end
end
| Gather should generate valid XML.
|
diff --git a/spec/features/dashboard/datetime_on_tooltips_spec.rb b/spec/features/dashboard/datetime_on_tooltips_spec.rb
index abc1234..def5678 100644
--- a/spec/features/dashboard/datetime_on_tooltips_spec.rb
+++ b/spec/features/dashboard/datetime_on_tooltips_spec.rb
@@ -6,7 +6,7 @@ let(:user) { create(:user) }
let(:project) { create(:project, name: 'test', namespace: user.namespace) }
let(:created_date) { Date.yesterday.to_time }
- let(:expected_format) { created_date.strftime('%b %d, %Y %l:%M%P UTC') }
+ let(:expected_format) { created_date.strftime('%b %-d, %Y %l:%M%P UTC') }
context 'on the activity tab' do
before do
| Change date format to be non zero padded in order to fix failing test
|
diff --git a/lib/elocal_api_support/actions/index.rb b/lib/elocal_api_support/actions/index.rb
index abc1234..def5678 100644
--- a/lib/elocal_api_support/actions/index.rb
+++ b/lib/elocal_api_support/actions/index.rb
@@ -2,6 +2,25 @@ module Actions
module Index
def index
+ add_pagination_headers \
+ if paginated_request? && paginate_with_headers?
+
+ render_filtered_objects_as_json
+ end
+
+ protected
+
+ # Her library likes to paginate with headers,
+ # ActiveResource cannot handle headers.
+ # So awesomely, two implementations. To use the "Her" implementation with headers
+ # this method should be overridend to return true
+ def paginate_with_headers?
+ false
+ end
+
+ private
+
+ def render_paginated_results_without_headers
render json: {
current_page: current_page,
per_page: paginated_request? ? per_page : filtered_objects.total_count,
@@ -11,7 +30,24 @@ }
end
- private
+ def render_paginated_results_with_headers
+ render json: filtered_objects_for_json
+ end
+
+ def render_filtered_objects_as_json
+ if paginate_with_headers?
+ render_paginated_results_with_headers
+ else
+ render_paginated_results_without_headers
+ end
+ end
+
+ def add_pagination_headers
+ logger.debug { format 'Adding pagination headers for filtered_objects collection of size %d', filtered_objects.total_count }
+ response.headers['x-total'] = filtered_objects.total_count
+ response.headers['x-per-page'] = per_page
+ response.headers['x-page'] = current_page
+ end
def paginated_request?
params[:page].present? || params[:per_page].present?
| Add ability to paginate using header
|
diff --git a/External-Cmds/brew-cd.rb b/External-Cmds/brew-cd.rb
index abc1234..def5678 100644
--- a/External-Cmds/brew-cd.rb
+++ b/External-Cmds/brew-cd.rb
@@ -12,9 +12,11 @@ end
f = ARGV.formulae.first
-op = f.opt_prefix
+fpfx = f.prefix
-odie "No install at #{op}" if !op.directory? || op.children.empty?
+odie "No install at #{fpfx}" if !fpfx.directory? || fpfx.children.empty?
-`cd #{op}`
+`echo "cd #{fpfx}" | tr "\n" " " | pbcopy`
+puts "'cd #{fpfx}' on clipboard"
+
exit 0
| Update brew cd cmd to place command on clipboard
|
diff --git a/UIImageColors.podspec b/UIImageColors.podspec
index abc1234..def5678 100644
--- a/UIImageColors.podspec
+++ b/UIImageColors.podspec
@@ -10,4 +10,7 @@ spec.ios.deployment_target = "8.0"
spec.source_files = "Sources/*.swift"
spec.requires_arc = true
+ s.pod_target_xcconfig = {
+ 'SWIFT_VERSION' => '3.0'
+ }
end
| Use pod_target_xcconfig to configure Swift version
|
diff --git a/app/controllers/backend/tags_controller.rb b/app/controllers/backend/tags_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/backend/tags_controller.rb
+++ b/app/controllers/backend/tags_controller.rb
@@ -15,7 +15,7 @@
def destroy
find_model.tagged_items.where(tag_id: find_tag.id).destroy_all
- render json: { tag: params[:tag] }
+ render json: { success: true }
end
private
| Enhance json output when a tag is deleted.
|
diff --git a/app/controllers/forest/admin_controller.rb b/app/controllers/forest/admin_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/forest/admin_controller.rb
+++ b/app/controllers/forest/admin_controller.rb
@@ -4,9 +4,11 @@ class AdminController < ApplicationController
before_action :authenticate_user!
+ RESOURCES = [Page, Menu, MediaItem, Setting, User, UserGroup]
+
def index
authorize :dashboard, :index?
- @resources = [Page, Menu, MediaItem, User, UserGroup]
+ @resources = RESOURCES.sort_by(&:name)
@page_title = 'Dashboard'
end
end
| Add settings resource to dashboard
|
diff --git a/lib/currency_spy/walutomat.rb b/lib/currency_spy/walutomat.rb
index abc1234..def5678 100644
--- a/lib/currency_spy/walutomat.rb
+++ b/lib/currency_spy/walutomat.rb
@@ -9,21 +9,26 @@
def medium_rate
regexp = Regexp.new(currency_code)
- return 1.0
+ res = nil
+ page.search("//td[@name='pair']").each do |td|
+ if (regexp.match(td.content))
+ res = td.next_element.content.to_f
+ end
+ end
+ return res
end
def rate_time
- regexp = Regexp.new(/\d\d\d\d-\d\d-\d\d/)
+ regexp = Regexp.new(currency_code)
+ time_regexp = Regexp.new(/\d+:\d+/)
res = nil
- page.search('//p[@class="nag"]').each do |p|
- p.search('b').each do |b|
- if (regexp.match(b.content))
- res = b.content
- end
+ page.search("//td[@name='pair']").each do |td|
+ if (regexp.match(td.content))
+ hour = td.next_element.next_element.content
+ res = DateTime.parse(hour)
end
end
- return DateTime.new
+ return res
end
-
end
end
| Add basic support for Walutomat
|
diff --git a/test/unit/integrations/helper_test.rb b/test/unit/integrations/helper_test.rb
index abc1234..def5678 100644
--- a/test/unit/integrations/helper_test.rb
+++ b/test/unit/integrations/helper_test.rb
@@ -0,0 +1,12 @@+require 'test_helper'
+
+class HelperTest < Test::Unit::TestCase
+ include ActiveMerchant::Billing::Integrations
+
+ def test_mappings_gets_initialized
+ helper_klass_without_mappings = Class.new(ActiveMerchant::Billing::Integrations::Helper)
+ # assert_equal Hash.new, helper_klass_without_mappings.mappings
+
+ assert_nothing_raised { helper_klass_without_mappings.new(123,'some_key', :amount => 500) }
+ end
+end
| Add regression test for helper bug
|
diff --git a/app/mailers/spree/email_delivery_mailer.rb b/app/mailers/spree/email_delivery_mailer.rb
index abc1234..def5678 100644
--- a/app/mailers/spree/email_delivery_mailer.rb
+++ b/app/mailers/spree/email_delivery_mailer.rb
@@ -3,4 +3,6 @@ @inventory_units = shipment.inventory_units
mail :to => shipment.order.user.email
end
+
+ handle_asynchronously :electronic_delivery_email
end
| Send license key email asynchronously.
We need to send emails asynchronously so that in case something,
the mailer will keep trying to send the email.
|
diff --git a/lib/rubyonacid/factories/random_walk.rb b/lib/rubyonacid/factories/random_walk.rb
index abc1234..def5678 100644
--- a/lib/rubyonacid/factories/random_walk.rb
+++ b/lib/rubyonacid/factories/random_walk.rb
@@ -7,6 +7,8 @@
#The maximum amount to change counters by.
attr_accessor :interval
+ #The numeric seed used for the random number generator.
+ attr_accessor :rng_seed
#Takes a hash with all keys supported by Factory, plus these keys and defaults:
# :interval => 0.001
@@ -16,7 +18,7 @@ @start_value = 0.0
@values = {}
@interval = options[:interval] || 0.001
- @rng = Random.new(options[:rng_seed] || Random.new_seed)
+ @rng_seed = options[:rng_seed] || Random.new_seed
end
#Add a random amount ranging between interval and -1 * interval to the given key's value and return the new value.
@@ -29,7 +31,8 @@ end
private def generate_random_number
- @rng.rand
+ @random_number_generator ||= Random.new(rng_seed)
+ @random_number_generator.rand
end
end
| Add attr_accessor :rng_seed to RandomWalkFactory
|
diff --git a/test/smartsheet/api/middleware/error_translator_test.rb b/test/smartsheet/api/middleware/error_translator_test.rb
index abc1234..def5678 100644
--- a/test/smartsheet/api/middleware/error_translator_test.rb
+++ b/test/smartsheet/api/middleware/error_translator_test.rb
@@ -0,0 +1,22 @@+require_relative '../../../test_helper'
+require 'smartsheet/api/middleware/error_translator'
+require 'mocha'
+
+describe Smartsheet::API::Middleware::ErrorTranslator do
+ it 'wraps Faraday errors raised during request handling' do
+ failure_message = 'Failure'
+ app = mock
+ app.stubs(:call).raises(Faraday::Error, failure_message)
+ error_translator = Smartsheet::API::Middleware::ErrorTranslator.new(app)
+
+ -> { error_translator.call('Environment') }.must_raise Smartsheet::API::Error
+ end
+
+ it 'passes through with no effect when no error is raised' do
+ env = { key: 'value' }.freeze
+ app = mock
+ app.expects(:call)
+ error_translator = Smartsheet::API::Middleware::ErrorTranslator.new(app)
+ error_translator.call(env) # Changes to env violate frozen hash
+ end
+end | Add tests for the error translator middleware.
|
diff --git a/app/models/user.rb b/app/models/user.rb
index abc1234..def5678 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -4,8 +4,8 @@ has_many :shares
validates_presence_of :name
- validates_presence_of :email_notify
- validates_presence_of :text_notify
+ validates_inclusion_of :email_notify, in: [true, false], message: "can't be blank"
+ validates_inclusion_of :text_notify, in: [true, false], message: "can't be blank"
validates_presence_of :cellphone, message: "must be present for text notifications", if: 'text_notify'
def cellphone=(cellphone_number)
| Correct validations for booleans in User model
Validation of the presence booleans in model must be performed via
validates_inclusion_of, rather than validates_presence_of.
|
diff --git a/test/fixtures/common/v2v_config.rb b/test/fixtures/common/v2v_config.rb
index abc1234..def5678 100644
--- a/test/fixtures/common/v2v_config.rb
+++ b/test/fixtures/common/v2v_config.rb
@@ -25,6 +25,7 @@ end
it 'has the sudoers file for the mechadora' do
- expect(file('/etc/sudoers.d/abiquo-tomcat-mechadora')).to contain('tomcat ALL=(ALL) NOPASSWD: /usr/bin/mechadora')
+ expect(file('/etc/sudoers.d/abiquo-tomcat-v2v')).to contain('tomcat ALL=(ALL) NOPASSWD: /usr/bin/v2v-diskmanager')
+ expect(file('/etc/sudoers.d/abiquo-tomcat-v2v')).to contain('tomcat ALL=(ALL) NOPASSWD: /usr/bin/mechadora')
end
end
| Align v2v checks with the latest package
|
diff --git a/app/controllers/articles_controller.rb b/app/controllers/articles_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/articles_controller.rb
+++ b/app/controllers/articles_controller.rb
@@ -1,26 +1,30 @@ class ArticlesController < ApplicationController
-
+
before_action :set_article, only: [:show, :edit, :update, :destroy]
# GET - Show all the articles.
def index
@articles = Article.all
end
-
+
# GET - Show a single article.
def show
end
-
+
# GET - Show new form for create a artice.
def new
@article = Article.new
end
-
+
# POST - Create a new article.
def create
+
+ # debugger - Stops the server a allows to debug the app.
+
# render plain: params[:article].inspect
@article = Article.new(article_params)
-
+ @article.user = User.first
+
if @article.save
flash[:success] = "The articles was created successfully."
redirect_to article_path(@article)
@@ -28,11 +32,11 @@ render :new
end
end
-
+
# GET - Show edit form.
def edit
end
-
+
# PUT - Edit the article
def update
@@ -43,25 +47,25 @@ render :edit
end
end
-
+
# DELETE - Delete an article.
def destroy
-
+
@article.destroy
flash[:danger] = "The articles was deleted"
-
+
redirect_to articles_path
end
-
-
+
+
private
-
+
def set_article
@article = Article.find(params[:id])
end
-
+
def article_params
params.require(:article).permit(:title, :description)
end
-end+end
| Add a user for every article for now.
|
diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/comments_controller.rb
+++ b/app/controllers/comments_controller.rb
@@ -1,2 +1,14 @@ class CommentsController < ApplicationController
+ before_action :require_user
+
+ def create
+ @comment = Comment.new(comment_params)
+ @comment.user = current_user
+ @success = @comment.save
+ end
+
+ private
+ def comment_params
+ params.require(:comment).permit(:commentable_type, :commentable_id, :body)
+ end
end
| Add the comments controller for user to comment commentable items.
|
diff --git a/app/extractors/name_party_extractor.rb b/app/extractors/name_party_extractor.rb
index abc1234..def5678 100644
--- a/app/extractors/name_party_extractor.rb
+++ b/app/extractors/name_party_extractor.rb
@@ -10,6 +10,7 @@
pairs.each do |line|
m = line.match(/(.+)\s\((.+)\)/)
+ next if m.nil?
people << m[1].strip.gsub(/\p{Z}+/, ' ')
parties << m[2].strip.gsub(/\p{Z}+/, ' ')
end
| Fix NamePartyExtractor when regex doesn't match
|
diff --git a/app/presenters/start_node_presenter.rb b/app/presenters/start_node_presenter.rb
index abc1234..def5678 100644
--- a/app/presenters/start_node_presenter.rb
+++ b/app/presenters/start_node_presenter.rb
@@ -27,4 +27,8 @@ custom_button_text = @renderer.content_for(:start_button_text)
custom_button_text.presence || "Start now"
end
+
+ def view_template_path
+ "smart_answers/landing"
+ end
end
| Add view template path for Start Node
This adds the location of the landing page template for start nodes. This will be used by the FlowController to resolve the landing page template.
|
diff --git a/app/services/shop/order_cycles_list.rb b/app/services/shop/order_cycles_list.rb
index abc1234..def5678 100644
--- a/app/services/shop/order_cycles_list.rb
+++ b/app/services/shop/order_cycles_list.rb
@@ -8,7 +8,7 @@ end
def self.ready_for_checkout_for(distributor, customer)
- return OrderCycle.none if !distributor.ready_for_checkout?
+ return OrderCycle.none unless distributor.ready_for_checkout?
new(distributor, customer).call
end
| Change 'if !' to 'unless' in OrderCyclesList
Co-authored-by: Maikel <3db1433c7298ef0d91dd12baeaaf90dc122deafc@email.org.au> |
diff --git a/jbuilder.gemspec b/jbuilder.gemspec
index abc1234..def5678 100644
--- a/jbuilder.gemspec
+++ b/jbuilder.gemspec
@@ -9,5 +9,6 @@ s.add_dependency 'activesupport', '>= 3.0.0'
s.add_development_dependency 'rake', '~> 10.0.3'
- s.files = Dir["#{File.dirname(__FILE__)}/**/*"]
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- test/*`.split("\n")
end
| Use `git ls-files` to create the file list for the gem
Fixes an issue with the gem for jbuilder 1.0.2
which includes 3 .gem files inside
|
diff --git a/lib/pastel/decorator_chain.rb b/lib/pastel/decorator_chain.rb
index abc1234..def5678 100644
--- a/lib/pastel/decorator_chain.rb
+++ b/lib/pastel/decorator_chain.rb
@@ -16,7 +16,11 @@ #
# @api public
def add(decorator)
- self.class.new(decorators + [decorator])
+ if decorators.include?(decorator)
+ self.class.new(decorators)
+ else
+ self.class.new(decorators + [decorator])
+ end
end
# Iterate over list of decorators
| Change to prevent duplicate colors.
|
diff --git a/icalendar_extractor.rb b/icalendar_extractor.rb
index abc1234..def5678 100644
--- a/icalendar_extractor.rb
+++ b/icalendar_extractor.rb
@@ -36,4 +36,31 @@ return (summary_sum.to_f / self.event_count)
end
+
+ def average_days_to_dtstart
+ distances = distances_from_created_to_dtstart
+ return distances.average
+ end
+
+ # 予定作成からdays以内に実施される予定の数
+ def num_of_events_held_within(days)
+ distances = distances_from_created_to_dtstart
+ return (distances.select {|d| d <= days }).count
+ end
+
+ private
+ def distances_from_created_to_dtstart
+ distances = Array.new
+ @calendar.events.each do |e|
+ # iCalendar::Values::DateTime クラスは,
+ # なぜかオブジェクト同士の加減算ができない
+ dtstart =
+ Date.new(e.dtstart.year, e.dtstart.month, e.dtstart.day)
+ created =
+ Date.new(e.created.year, e.created.month, e.created.day)
+ distances << (dtstart - created).to_i
+ end
+ return distances
+ end
+
end
| Add methods in IcsExtractor Class |
diff --git a/lib/simctl/device_settings.rb b/lib/simctl/device_settings.rb
index abc1234..def5678 100644
--- a/lib/simctl/device_settings.rb
+++ b/lib/simctl/device_settings.rb
@@ -14,14 +14,15 @@ def disable_keyboard_helpers!
edit(path.preferences_plist) do |plist|
%w(
+ KeyboardAllowPaddle
+ KeyboardAssistant
+ KeyboardAutocapitalization
+ KeyboardAutocorrection
+ KeyboardCapsLock
+ KeyboardCheckSpelling
KeyboardPeriodShortcut
- KeyboardAutocapitalization
- KeyboardCheckSpelling
- KeyboardAssistant
- KeyboardAutocorrection
KeyboardPrediction
KeyboardShowPredictionBar
- KeyboardCapsLock
).each do |key|
plist[key] = false
end
| Sort & add missing keyboard options
|
diff --git a/lib/tasks/user_exercises.rake b/lib/tasks/user_exercises.rake
index abc1234..def5678 100644
--- a/lib/tasks/user_exercises.rake
+++ b/lib/tasks/user_exercises.rake
@@ -16,7 +16,6 @@ DB::Connection.establish
sql = "SELECT DISTINCT user_id, language, slug FROM submissions s LEFT JOIN user_exercises e ON s.user_exercise_id=e.id WHERE e.id IS NULL"
- sql = "SELECT DISTINCT user_id, language, slug FROM submissions"
ActiveRecord::Base.connection.execute(sql).each do |result|
begin
Hack::UpdatesUserExercise.new(result["user_id"], result["language"], result["slug"]).update
| Optimize user exercise data migration
|
diff --git a/activerecord/lib/active_record/asynchronous_queries_tracker.rb b/activerecord/lib/active_record/asynchronous_queries_tracker.rb
index abc1234..def5678 100644
--- a/activerecord/lib/active_record/asynchronous_queries_tracker.rb
+++ b/activerecord/lib/active_record/asynchronous_queries_tracker.rb
@@ -6,6 +6,9 @@ class << self
def active?
true
+ end
+
+ def finalize
end
end
end
@@ -50,7 +53,7 @@ end
def finalize_session
- @current_session.finalize if @current_session.respond_to?(:finalize)
+ @current_session.finalize
@current_session = NullSession
end
end
| Add `finalize` to NullSession so it quacks like a Session
|
diff --git a/1_codility/0_training/11_1_count_semiprimes.rb b/1_codility/0_training/11_1_count_semiprimes.rb
index abc1234..def5678 100644
--- a/1_codility/0_training/11_1_count_semiprimes.rb
+++ b/1_codility/0_training/11_1_count_semiprimes.rb
@@ -0,0 +1,44 @@+# 100/100
+def solution(n, p, q)
+ # get primes up to n
+ primes = [false, false].concat([true] * (n - 1))
+ (2..Math.sqrt(n)).each do |i|
+ j = i * i
+ until j > n
+ primes[j] = false
+ j += i
+ end
+ end
+
+ # get semiprimes
+ semiprimes = [false] * n
+ (2..Math.sqrt(n)).each do |i|
+ next unless primes[i]
+
+ k = i
+ j = i * k
+ until j > n
+ semiprimes[j] = true
+ k = next_prime(primes, k)
+ j = i * k
+ end
+ end
+
+ p_sum = 0
+ partial_sums = semiprimes.map do |sp|
+ p_sum += sp ? 1 : 0
+ p_sum
+ end
+
+ results = []
+ p.size.times do |i|
+ results << (partial_sums.fetch(q[i], partial_sums[-1]) - partial_sums[p[i] - 1])
+ end
+ results
+end
+
+def next_prime(primes, k)
+ i = k + 1
+ i += 1 until primes[i]
+ i
+end
| Add codility training - count semiprimes
|
diff --git a/spec/features/photos/show_photo_spec.rb b/spec/features/photos/show_photo_spec.rb
index abc1234..def5678 100644
--- a/spec/features/photos/show_photo_spec.rb
+++ b/spec/features/photos/show_photo_spec.rb
@@ -0,0 +1,48 @@+require 'rails_helper'
+
+feature "show photo page" do
+
+ let (:photo) { FactoryGirl.create(:photo) }
+
+ context "signed in member" do
+ let (:member) { FactoryGirl.create(:member) }
+
+ background do
+ login_as(member)
+ end
+
+ context "linked to planting" do
+ let (:planting) { FactoryGirl.create(:planting) }
+
+ scenario "shows linkback to planting" do
+ planting.photos << photo
+ visit photo_path(photo)
+ expect(page).to have_link planting, :href => planting_path(planting)
+ end
+ end
+
+ context "linked to harvest" do
+ let (:harvest) { FactoryGirl.create(:harvest) }
+
+ scenario "shows linkback to harvest" do
+ harvest.photos << photo
+ visit photo_path(photo)
+ expect(page).to have_link harvest, :href => harvest_path(harvest)
+ end
+ end
+
+ context "linked to garden" do
+ let (:garden) { FactoryGirl.create(:garden) }
+
+ scenario "shows linkback to garden" do
+ garden.photos << photo
+ visit photo_path(photo)
+ expect(page).to have_link garden, :href => garden_path(garden)
+ end
+
+ end
+
+ end
+
+end
+
| Test for linkback of photos to harvest/garden/planting
|
diff --git a/spec/support/capybara/console_errors.rb b/spec/support/capybara/console_errors.rb
index abc1234..def5678 100644
--- a/spec/support/capybara/console_errors.rb
+++ b/spec/support/capybara/console_errors.rb
@@ -4,12 +4,15 @@ config.after(:each, type: :system) do
next if page.driver.browser.browser != :chrome
- errors = page.driver.browser.manage.logs.get(:browser).select { |m| m.level == 'SEVERE' && m.to_s =~ %r{EvalError|InternalError|RangeError|ReferenceError|SyntaxError|TypeError|URIError} }
+ logs = page.driver.browser.manage.logs.get(:browser)
+ errors = logs.select { |m| m.level == 'SEVERE' && m.to_s =~ %r{EvalError|InternalError|RangeError|ReferenceError|SyntaxError|TypeError|URIError} }
if errors.present?
Rails.logger.error "JS ERRORS: #{errors.to_json}"
errors.each do |error|
puts "#{error.message}\n\n"
end
+
+ File.write(Rails.root.join('log/browser.log'), logs.map { |l| "#{l.level}|#{l.message}" }.join("\n"))
end
expect(errors.length).to eq(0)
| Maintenance: Save browser logs to log/browser.log in tests.
|
diff --git a/drivers/ruby/tests/basictest.rb b/drivers/ruby/tests/basictest.rb
index abc1234..def5678 100644
--- a/drivers/ruby/tests/basictest.rb
+++ b/drivers/ruby/tests/basictest.rb
@@ -5,12 +5,15 @@
#@conn = Cake.new("localhost", 8888)
@conn = CakeDB.new
-#@conn.write("a","cheeseburger")
-#@conn.write("a","chips")
-#@conn.write("a","softdrink")
-#@conn.write("a","nachos")
-#@conn.write("a","sushi")
+@conn.write("a","cheeseburger")
+@conn.write("a","chips")
+@conn.write("a","softdrink")
+@conn.write("a","nachos")
+@conn.write("a","sushi")
includedTime = 0
+
+puts "Sleeping to ensure data hits the disk..."
+sleep 10
@conn.allSince("a", 0).each do |line|
puts line["ts"].to_s + "|" + line["data"]
end
| Test script needs to actually write something before it can query. Added a 10 second pause to ensure the data hits the disk before the query tests start.
|
diff --git a/lib/happy/worker/base.rb b/lib/happy/worker/base.rb
index abc1234..def5678 100644
--- a/lib/happy/worker/base.rb
+++ b/lib/happy/worker/base.rb
@@ -24,7 +24,9 @@ def perform_(job, base, counter)
Happy.logger.debug { "before balance: #{job.local['balances']}" }
worker(job) do |w|
- w.wait(w.local_balances[base])
+ unless base.currency == Currency::BTC_X && counter.currency == Currency::KRW_X
+ w.wait(w.local_balances[base])
+ end
w.exchange(w.local_balances[base], counter)
end
Happy.logger.debug { "after balance: #{job.local['balances']}" }
| Add exception for BTC_X -> KRW_X
|
diff --git a/event_store-client-http.gemspec b/event_store-client-http.gemspec
index abc1234..def5678 100644
--- a/event_store-client-http.gemspec
+++ b/event_store-client-http.gemspec
@@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'event_store-client-http'
- s.version = '0.1.9'
+ s.version = '0.2.0'
s.summary = 'HTTP Client for EventStore'
s.description = ' '
| Package version is increased from 0.1.9 to 0.2.0
|
diff --git a/lib/process_info/info.rb b/lib/process_info/info.rb
index abc1234..def5678 100644
--- a/lib/process_info/info.rb
+++ b/lib/process_info/info.rb
@@ -14,7 +14,7 @@ end
def to_h
- keys.zip(load_process_info).to_h
+ Hash[keys.zip(load_process_info)]
end
private
| Make backwards compatible to ruby 2.0
|
diff --git a/lib/skyed/git.rb b/lib/skyed/git.rb
index abc1234..def5678 100644
--- a/lib/skyed/git.rb
+++ b/lib/skyed/git.rb
@@ -14,7 +14,7 @@ ENV['GIT_SSH'] = '/tmp/ssh-git'
path = "/tmp/skyed.#{SecureRandom.hex}"
r = ::Git.clone(stack[:custom_cookbooks_source][:url], path)
- puts Skyed::Init.repo_path(r)
+ puts r.log.first.message
path
end
end
| INF-941: Add check if remore is cloned
|
diff --git a/lib/wrkflo/steps/atom.rb b/lib/wrkflo/steps/atom.rb
index abc1234..def5678 100644
--- a/lib/wrkflo/steps/atom.rb
+++ b/lib/wrkflo/steps/atom.rb
@@ -6,4 +6,3 @@ `atom #{config}`
end
end
-0
| Remove spurious `0` after `Atom` step definition
|
diff --git a/features/step_definitions/index_steps.rb b/features/step_definitions/index_steps.rb
index abc1234..def5678 100644
--- a/features/step_definitions/index_steps.rb
+++ b/features/step_definitions/index_steps.rb
@@ -15,6 +15,6 @@ @blocks = @idx.find([int], @parser)
end
-Then /^(\d+) blocks are obtained$/ do |num|
+Then /^(\d+) blocks? (?:is|are) obtained$/ do |num|
@blocks.size.should == num.to_i
end
| Tweak language of number-of-blocks matcher.
|
diff --git a/lib/engineyard-cloud-client/version.rb b/lib/engineyard-cloud-client/version.rb
index abc1234..def5678 100644
--- a/lib/engineyard-cloud-client/version.rb
+++ b/lib/engineyard-cloud-client/version.rb
@@ -1,7 +1,7 @@ # This file is maintained by a herd of rabid monkeys with Rakes.
module EY
class CloudClient
- VERSION = '2.1.0'
+ VERSION = '2.1.1-pre.1'
end
end
# Please be aware that the monkeys like tho throw poo sometimes.
| Add .pre for next release
|
diff --git a/lib/formotion/row_type/web_link_row.rb b/lib/formotion/row_type/web_link_row.rb
index abc1234..def5678 100644
--- a/lib/formotion/row_type/web_link_row.rb
+++ b/lib/formotion/row_type/web_link_row.rb
@@ -1,6 +1,6 @@ module Formotion
module RowType
- class WebLinkRow < StaticRow
+ class WebLinkRow < ObjectRow
def after_build(cell)
super
@@ -10,7 +10,7 @@ end
def on_select(tableView, tableViewDelegate)
- if row.value.is_a?(String) && row.value[0..3] == "http"
+ if (row.value.is_a?(String) && row.value[0..3] == "http") || row.value.is_a?(NSURL)
App.open_url row.value
end
end
| Allow WebLinkRow to accept an NSURL and not just a string.
|
diff --git a/Rakefile.rb b/Rakefile.rb
index abc1234..def5678 100644
--- a/Rakefile.rb
+++ b/Rakefile.rb
@@ -3,7 +3,6 @@ task default: %w(create_db spec)
task :create_db do
- sh 'rm rs-db'
sh 'sqlite3 rs-db < create-db.sql'
end
| Remove command to delete rs-db file
|
diff --git a/spec/acceptance/swap_file_class_spec.rb b/spec/acceptance/swap_file_class_spec.rb
index abc1234..def5678 100644
--- a/spec/acceptance/swap_file_class_spec.rb
+++ b/spec/acceptance/swap_file_class_spec.rb
@@ -0,0 +1,45 @@+require 'spec_helper_acceptance'
+
+describe 'swap_file class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
+
+ context 'swap_file' do
+ context 'ensure => present' do
+ it 'should work with no errors' do
+ pp = <<-EOS
+ class { 'swap_file':
+ files => {
+ 'swapfile' => {
+ ensure => 'present',
+ },
+ 'use fallocate' => {
+ swapfile => '/tmp/swapfile.fallocate',
+ cmd => 'fallocate',
+ },
+ 'remove swap file' => {
+ ensure => 'absent',
+ swapfile => '/tmp/swapfile.old',
+ },
+ },
+ }
+ EOS
+
+ # Run it twice and test for idempotency
+ apply_manifest(pp, :catch_failures => true)
+ apply_manifest(pp, :catch_changes => true)
+ end
+ it 'should contain the default swapfile' do
+ shell('/sbin/swapon -s | grep /mnt/swap.1', :acceptable_exit_codes => [0])
+ end
+ it 'should contain the default fstab setting' do
+ shell('cat /etc/fstab | grep /mnt/swap.1', :acceptable_exit_codes => [0])
+ shell('cat /etc/fstab | grep defaults', :acceptable_exit_codes => [0])
+ end
+ it 'should contain the default swapfile' do
+ shell('/sbin/swapon -s | grep /tmp/swapfile.fallocate', :acceptable_exit_codes => [0])
+ end
+ it 'should contain the default fstab setting' do
+ shell('cat /etc/fstab | grep /tmp/swapfile.fallocate', :acceptable_exit_codes => [0])
+ end
+ end
+ end
+end
| Add new acceptance test for class |
diff --git a/app/helpers/bio_helper.rb b/app/helpers/bio_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/bio_helper.rb
+++ b/app/helpers/bio_helper.rb
@@ -7,7 +7,9 @@ if sanitized_bio.present?
simple_format(sanitized_bio, sanitize: false)
else
- content_tag(:em, "No bio provided")
+ content_tag(:p) do
+ content_tag(:em, "No bio provided")
+ end
end
end
end | Put 'no bio provided' on its own line
|
diff --git a/tests/variables_spec.rb b/tests/variables_spec.rb
index abc1234..def5678 100644
--- a/tests/variables_spec.rb
+++ b/tests/variables_spec.rb
@@ -1,11 +1,20 @@ describe ACL::UserVariables do
before do
- end
-
- it "should add some variables to be used by validators" do
- ACL::some_arbitrary_value = true
-
+ $string_variable = "Test string"
+ $hash_variable = Hash.new
end
+ it "should add some variables to be used by validators" do
+ ACL.some_arbitrary_value = true
+ ACL.string_value = $string_variable
+ ACL.hash_value = $hash_variable
+ ACL.controller.variables.length.should == 3
+ end
+
+ it "should be able to access to previous defined variables" do
+ ACL.some_arbitrary_value.should be_true
+ ACL.string_value.should eq $string_variable
+ ACL.hash_value.should == $hash_variable
+ end
end | Convert instance variables into global variables to be used by other tests
|
diff --git a/lib/miq_automation_engine/service_models/miq_ae_service_orchestration_template_vnfd.rb b/lib/miq_automation_engine/service_models/miq_ae_service_orchestration_template_vnfd.rb
index abc1234..def5678 100644
--- a/lib/miq_automation_engine/service_models/miq_ae_service_orchestration_template_vnfd.rb
+++ b/lib/miq_automation_engine/service_models/miq_ae_service_orchestration_template_vnfd.rb
@@ -1,3 +1,12 @@ module MiqAeMethodService
- class MiqAeServiceOrchestrationTemplateVnfd < MiqAeServiceOrchestrationTemplate; end
+ class MiqAeServiceOrchestrationTemplateVnfd < MiqAeServiceOrchestrationTemplate
+ CREATE_ATTRIBUTES = [:name, :description, :content, :draft, :orderable, :ems_id]
+
+ def self.create(options = {})
+ attributes = options.symbolize_keys.slice(*CREATE_ATTRIBUTES)
+ attributes[:remote_proxy] = true
+
+ ar_method { MiqAeServiceOrchestrationTemplateVnfd.wrap_results(OrchestrationTemplateVnfd.create!(attributes)) }
+ end
+ end
end
| Make Vnfd template creatable from automate
Make Vnfd template creatable from automate
(transferred from ManageIQ/manageiq@88a6e5b4527a1946c7115cb7f78c113ae47bd3db)
|
diff --git a/spec/code_parser/inline_conditionals.rb b/spec/code_parser/inline_conditionals.rb
index abc1234..def5678 100644
--- a/spec/code_parser/inline_conditionals.rb
+++ b/spec/code_parser/inline_conditionals.rb
@@ -1,5 +1,3 @@-include DittoCode::Exec
-
print "I'm pro" if DittoCode::Exec.is 'PRO'
print "I'm pro or free" if DittoCode::Exec.is 'PRO,FREE'
print "I'm premium" if DittoCode::Exec.is 'PREMIUM'
| Change the include into the spec_helper |
diff --git a/spec/factories/proof_attempt_factory.rb b/spec/factories/proof_attempt_factory.rb
index abc1234..def5678 100644
--- a/spec/factories/proof_attempt_factory.rb
+++ b/spec/factories/proof_attempt_factory.rb
@@ -12,7 +12,8 @@ after(:build) do |proof_attempt|
proof_attempt.proof_attempt_configuration.ontology =
proof_attempt.ontology
- build :prover_output, proof_attempt: proof_attempt
+ proof_attempt.proof_attempt_configuration.save!
+ create :prover_output, proof_attempt: proof_attempt
end
after(:create) do |proof_attempt|
| Fix ProofAttempt factory not having a configuration.
|
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index abc1234..def5678 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -1,10 +1,4 @@ require 'spec_helper'
describe ApplicationHelper do
- context "representative_carousel_content" do
- it "should group array into subarrays" do
- array = [1,2,3,4,5,6,7,8]
- get_representative_carousel_content(array).should == [[1,2,3,4], [5,6,7,8]]
- end
- end
end
| Remove spec for removed method.
|
diff --git a/server/config/unicorn.rb b/server/config/unicorn.rb
index abc1234..def5678 100644
--- a/server/config/unicorn.rb
+++ b/server/config/unicorn.rb
@@ -1,4 +1,4 @@-worker_processes Integer(ENV[WEB_CONCURRENCY] || 3)
+worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3)
timeout 15
preload_app true
| Fix typo in Unicorn config
|
diff --git a/lib/feedback_router.rb b/lib/feedback_router.rb
index abc1234..def5678 100644
--- a/lib/feedback_router.rb
+++ b/lib/feedback_router.rb
@@ -1,5 +1,8 @@ require "feedback_router/version"
module FeedbackRouter
- # Your code goes here...
+ def self.send(feedback_object, application_name)
+ @destination = ENV['FEEDBACK_LOCATION']
+
+ end
end
| Add send method with proper params
|
diff --git a/lib/feedback_router.rb b/lib/feedback_router.rb
index abc1234..def5678 100644
--- a/lib/feedback_router.rb
+++ b/lib/feedback_router.rb
@@ -9,8 +9,8 @@
private
- def set_up_destination(url)
- matches = url.match(/(https?:\/\/[\w._:-]+)(.*)/)
+ def set_up_destination
+ matches = ENV['FEEDBACK_LOCATION'].match(/(https?:\/\/[\w._:-]+)(.*)/)
base_url = matches[1], controller_route = matches[2]
end
| Change URL Argument to ENV Variable
|
diff --git a/lib/firebolt/warmer.rb b/lib/firebolt/warmer.rb
index abc1234..def5678 100644
--- a/lib/firebolt/warmer.rb
+++ b/lib/firebolt/warmer.rb
@@ -20,7 +20,7 @@ # Private instance methods
#
def _warmer_expires_in
- @_warmer_expires_in ||= ::Firebolt.config.frequency + 1.hour
+ @_warmer_expires_in ||= ::Firebolt.config.warming_frequency + 1.hour
end
def _warmer_raise_failed_result
| Fix old reference to config.frequency.
|
diff --git a/lib/flipper/railtie.rb b/lib/flipper/railtie.rb
index abc1234..def5678 100644
--- a/lib/flipper/railtie.rb
+++ b/lib/flipper/railtie.rb
@@ -5,7 +5,8 @@ env_key: "flipper",
memoize: true,
preload: true,
- instrumenter: ActiveSupport::Notifications
+ instrumenter: ActiveSupport::Notifications,
+ logging: true
)
end
@@ -29,6 +30,10 @@ end
end
+ initializer "flipper.logging", after: :load_config_initializers do |app|
+ require "flipper/instrumentation/log_subscriber" if app.config.flipper.logging
+ end
+
initializer "flipper.identifier" do
ActiveSupport.on_load(:active_record) do
ActiveRecord::Base.include Flipper::Identifier
| Enable log subscriber by default in Rails
|
diff --git a/spec/mailers/cloud_note_mailer_spec.rb b/spec/mailers/cloud_note_mailer_spec.rb
index abc1234..def5678 100644
--- a/spec/mailers/cloud_note_mailer_spec.rb
+++ b/spec/mailers/cloud_note_mailer_spec.rb
@@ -1,27 +1,31 @@+# encoding: utf-8
+
describe CloudNoteMailer do
describe '.syncdown_note_failed' do
let(:provider) { 'PROVIDER01' }
let(:guid) { 'USER01' }
let(:username) { 'USER01' }
- let(:error) { mock('error', :class => 'ERRORCLASS', :message => 'ERRORMESSAGE', :backtrace => ['ERROR', 'BACKTRACE']) }
+ let(:error) { double('error', class: 'ERRORCLASS', message: 'ERRORMESSAGE', backtrace: %w(ERROR BACKTRACE)) }
let(:mail) { CloudNoteMailer.syncdown_note_failed(provider, guid, username, error) }
-
+
it 'renders the subject' do
- mail.subject.should == I18n.t('notes.sync.failed.email.subject', :provider => provider.titlecase, :guid => guid, :username => username)
+ mail.subject.should == I18n.t('notes.sync.failed.email.subject', provider: provider.titlecase,
+ guid: guid,
+ username: username)
end
-
+
it 'renders the receiver email' do
mail.to.should == [Settings.monitoring.email]
end
-
+
it 'renders the sender email' do
mail.from.should == [Settings.admin.email]
end
-
+
it 'assigns @name' do
mail.body.encoded.should match(Settings.monitoring.name)
end
-
+
it 'assigns @user' do
mail.body.encoded.should match(username)
end
| Use double instead of mock
Mock is deprecated when creating a test double.
|
diff --git a/lib/pacproxy/config.rb b/lib/pacproxy/config.rb
index abc1234..def5678 100644
--- a/lib/pacproxy/config.rb
+++ b/lib/pacproxy/config.rb
@@ -8,7 +8,7 @@ DEFAULT_CONFIG = {
'daemonize' => false,
'port' => 3128,
- 'proxy_pac' => { 'location' => nil },
+ 'pac_file' => { 'location' => nil },
'general_log' => { 'location' => 'pacproxy.log' }
}
| Fix a miss for pac_file
|
diff --git a/test/models/registration_policy_test.rb b/test/models/registration_policy_test.rb
index abc1234..def5678 100644
--- a/test/models/registration_policy_test.rb
+++ b/test/models/registration_policy_test.rb
@@ -31,18 +31,5 @@ policy.wont_be :valid?
assert policy.errors.full_messages.first =~ /at most 1 flex bucket/
end
-
- it 'validates that the anything bucket is at the end' do
- policy = RegistrationPolicy.new(
- buckets: [
- RegistrationPolicy::Bucket.new(key: "pcs"),
- RegistrationPolicy::Bucket.new(key: "dont_care", anything: true),
- RegistrationPolicy::Bucket.new(key: "npcs")
- ]
- )
-
- policy.wont_be :valid?
- assert policy.errors.full_messages.first =~ /last in the priority list/
- end
end
end
| Remove test for the validation we removed
|
diff --git a/bali-phy.rb b/bali-phy.rb
index abc1234..def5678 100644
--- a/bali-phy.rb
+++ b/bali-phy.rb
@@ -12,7 +12,6 @@ # void operator()(const T& t){push_back(t);}
def install
- # docs say build oos
mkdir 'macbuild' do
system "../configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}",
| Remove 'oos' comments from cmake-built stuff
|
diff --git a/lib/webidl/ast/type.rb b/lib/webidl/ast/type.rb
index abc1234..def5678 100644
--- a/lib/webidl/ast/type.rb
+++ b/lib/webidl/ast/type.rb
@@ -22,7 +22,7 @@ private
def camel_case_type(name)
- name.split(/[_ ]/).map { |e| e[0] = e[0].upcase; e }.join
+ name.split(/[_ ]/).map { |e| e[0,1] = e[0,1].upcase; e }.join
end
end # Type
| Fix for ruby < 1.9
|
diff --git a/Rover.podspec b/Rover.podspec
index abc1234..def5678 100644
--- a/Rover.podspec
+++ b/Rover.podspec
@@ -8,7 +8,6 @@ s.platform = :ios, "10.0"
s.source = { :git => "https://github.com/RoverPlatform/rover-ios.git", :tag => "v#{s.version}" }
s.cocoapods_version = ">= 1.4.0"
- s.swift_version = "5.0"
s.source_files = "Sources/**/*.swift"
s.frameworks = "SafariServices", "WebKit"
end
| Remove hardcoded Swift version from Podspec
|
diff --git a/harvestman.gemspec b/harvestman.gemspec
index abc1234..def5678 100644
--- a/harvestman.gemspec
+++ b/harvestman.gemspec
@@ -9,7 +9,7 @@ gem.authors = ["Gabriel Vieira"]
gem.email = ["gluisvieira@gmail.com"]
gem.summary = %q{Lightweight web crawler}
- gem.homepage = ""
+ gem.homepage = "https://github.com/mion/harvestman"
# Runtime dependencies
gem.add_dependency "nokogiri", "~> 1.5"
| Add GB page to gemspec
|
diff --git a/lib/activerecord_sane_schema_dumper.rb b/lib/activerecord_sane_schema_dumper.rb
index abc1234..def5678 100644
--- a/lib/activerecord_sane_schema_dumper.rb
+++ b/lib/activerecord_sane_schema_dumper.rb
@@ -7,4 +7,4 @@
# Modules
require 'active_record/sane_schema_dumper/extension'
-require 'active_record/sane_schema_dumper/railtie' if defined?(Rails) && Rails::VERSION::MAJOR >= 3
+require 'active_record/sane_schema_dumper/railtie'
| Remove useless Rails version 3 condition since we depend on Rails 4
|
diff --git a/lib/engineyard-cloud-client/version.rb b/lib/engineyard-cloud-client/version.rb
index abc1234..def5678 100644
--- a/lib/engineyard-cloud-client/version.rb
+++ b/lib/engineyard-cloud-client/version.rb
@@ -1,7 +1,7 @@ # This file is maintained by a herd of rabid monkeys with Rakes.
module EY
class CloudClient
- VERSION = '1.0.11'
+ VERSION = '1.0.12.pre'
end
end
# Please be aware that the monkeys like tho throw poo sometimes.
| Add .pre for next release
|
diff --git a/test/integration/generated_gst_test.rb b/test/integration/generated_gst_test.rb
index abc1234..def5678 100644
--- a/test/integration/generated_gst_test.rb
+++ b/test/integration/generated_gst_test.rb
@@ -0,0 +1,19 @@+require 'gir_ffi_test_helper'
+
+GirFFI.setup :Gst
+Gst.init []
+
+# Tests behavior of objects in the generated Gio namespace.
+describe 'the generated Gst module' do
+ describe 'Gst::FakeSink' do
+ let(:instance) { Gst::ElementFactory.make('fakesink', 'sink') }
+
+ it 'allows the handoff signal to be connected and emitted' do
+ skip
+ a = nil
+ instance.signal_connect('handoff') { a = 10 }
+ instance.signal_emit('handoff')
+ a.must_equal 10
+ end
+ end
+end
| Add skipped integration tests for unintrospectable signals
|
diff --git a/db/migrate/20080916153239_resize_photos.rb b/db/migrate/20080916153239_resize_photos.rb
index abc1234..def5678 100644
--- a/db/migrate/20080916153239_resize_photos.rb
+++ b/db/migrate/20080916153239_resize_photos.rb
@@ -2,7 +2,7 @@ def self.up
require 'mini_magick'
%w(families groups people pictures recipes).each do |kind|
- Dir["#{Rails.root}/db/photos/#{kind}/*.jpg"].each do |pic|
+ Dir["#{DB_PHOTO_PATH}/#{kind}/*.jpg"].each do |pic|
next if pic =~ /large|medium|small|tn|full/
img = MiniMagick::Image.from_file(pic)
img.thumbnail(PHOTO_SIZES[:full])
| Use proper path for photo resize migration.
|
diff --git a/minimal-mistakes-jekyll.gemspec b/minimal-mistakes-jekyll.gemspec
index abc1234..def5678 100644
--- a/minimal-mistakes-jekyll.gemspec
+++ b/minimal-mistakes-jekyll.gemspec
@@ -2,7 +2,7 @@
Gem::Specification.new do |spec|
spec.name = "minimal-mistakes-jekyll"
- spec.version = "4.0.0.pre.beta1"
+ spec.version = "4.0.1"
spec.authors = ["Michael Rose"]
spec.summary = %q{A flexible two-column Jekyll theme.}
@@ -11,7 +11,12 @@
spec.metadata["plugin_type"] = "theme"
- spec.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r{^(_layouts|_includes|_sass|assets|LICENSE|README|CHANGELOG)/i}) }
+ spec.files = `git ls-files -z`.split("\x0").select do |f|
+ f.match(%r{^((_includes|_layouts|_sass|assets)/|(LICENSE|README|CHANGELOG)((\.(txt|md|markdown)|$)))}i)
+ end
+
+ spec.bindir = "exe"
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.add_development_dependency "jekyll", "~> 3.2"
spec.add_development_dependency "bundler", "~> 1.12"
| Remove `pre` from version and bump to 4.0.1
|
diff --git a/app/main_controller.rb b/app/main_controller.rb
index abc1234..def5678 100644
--- a/app/main_controller.rb
+++ b/app/main_controller.rb
@@ -8,18 +8,20 @@ def generate_login_url end_point
case end_point
when "prod"
- @end_point = "https://login.salesforce.com?retURL=/one/one.app"
+ @end_point = "https://login.salesforce.com"
@window_title = "Production Org"
when "sandbox"
- @end_point = "https://test.salesforce.com?retURL=/one/one.app"
+ @end_point = "https://test.salesforce.com"
@window_title = "Sandbox Org"
when "pre"
- @end_point = "https://gs0.salesforce.com?retURL=/one/one.app"
+ @end_point = "https://gs0.salesforce.com"
@window_title = "Pre-Release Org"
else
- @end_point = "https://login.salesforce.com?retURL=/one/one.app"
+ @end_point = "https://login.salesforce.com"
@window_title = "Production Org"
end
+ # Per PR-1, i've changed this from retURL to startURL to support SSO
+ @end_point += "?startURL=/one/one.app"
end
def init end_point
| Convert to startURL instead of retURL and dry it up a bit.
|
diff --git a/test/unit/wkhtmltopdf_location_test.rb b/test/unit/wkhtmltopdf_location_test.rb
index abc1234..def5678 100644
--- a/test/unit/wkhtmltopdf_location_test.rb
+++ b/test/unit/wkhtmltopdf_location_test.rb
@@ -0,0 +1,50 @@+
+
+class WkhtmltopdfLocationTest < ActiveSupport::TestCase
+ setup do
+ @saved_config = WickedPdf.config
+ WickedPdf.config = {}
+ end
+
+ teardown do
+ WickedPdf.config = @saved_config
+ end
+
+ test 'should correctly locate wkhtmltopdf without bundler' do
+ bundler_module = Bundler
+ Object.send(:remove_const, :Bundler)
+
+ assert_nothing_raised do
+ WickedPdf.new
+ end
+
+ Object.const_set(:Bundler, bundler_module)
+ end
+
+ test 'should correctly locate wkhtmltopdf with bundler' do
+ assert_nothing_raised do
+ WickedPdf.new
+ end
+ end
+
+ class LocationNonWritableTest < ActiveSupport::TestCase
+ setup do
+ @saved_config = WickedPdf.config
+ WickedPdf.config = {}
+
+ @old_home = ENV['HOME']
+ ENV['HOME'] = '/not/a/writable/directory'
+ end
+
+ teardown do
+ WickedPdf.config = @saved_config
+ ENV['HOME'] = @old_home
+ end
+
+ test 'should correctly locate wkhtmltopdf with bundler while HOME is set to a non-writable directory' do
+ assert_nothing_raised do
+ WickedPdf.new
+ end
+ end
+ end
+end
| Add tests around erroneous behavior from using the shell
|
diff --git a/lib/chroot/repository/client/config.rb b/lib/chroot/repository/client/config.rb
index abc1234..def5678 100644
--- a/lib/chroot/repository/client/config.rb
+++ b/lib/chroot/repository/client/config.rb
@@ -8,20 +8,18 @@
desc "setup", "Setup initial configuration"
def setup
- template = [
- {
- 'interface' => 'eth0',
- 'chroot_dir' => '/var/lib/chroot',
- 'deb' => {
- 'codes' => ['squeeze', 'wheezy', 'jessie', 'unstable'],
- 'arch' => ['i386', 'amd64']
- },
- 'rpm' => {
- 'dists' => ['centos-5', 'centos-6', 'fedora-19'],
- 'arch' => ['i386', 'x86_64']
- }
- }
- ]
+ template = {
+ 'interface' => 'eth0',
+ 'chroot_dir' => '/var/lib/chroot',
+ 'deb' => {
+ 'codes' => ['squeeze', 'wheezy', 'jessie', 'unstable'],
+ 'arch' => ['i386', 'amd64']
+ },
+ 'rpm' => {
+ 'dists' => ['centos-5', 'centos-6', 'fedora-19'],
+ 'arch' => ['i386', 'x86_64']
+ }
+ }
config_dir = File.expand_path("~/.chroot-repository-client")
Dir.mkdir(config_dir) unless File.exist?(config_dir)
Dir.chdir(config_dir) do
| Remove needless nested bracket from template
|
diff --git a/scripts/install_brews.rb b/scripts/install_brews.rb
index abc1234..def5678 100644
--- a/scripts/install_brews.rb
+++ b/scripts/install_brews.rb
@@ -8,6 +8,7 @@ brew-cask
cloog-ppl015
curl
+ elasticsearch
faac
ffmpeg
freetype
| Add elasticsearch to brew pkgs
|
diff --git a/lib/appsignal/railtie.rb b/lib/appsignal/railtie.rb
index abc1234..def5678 100644
--- a/lib/appsignal/railtie.rb
+++ b/lib/appsignal/railtie.rb
@@ -1,8 +1,5 @@ module Appsignal
class Railtie < Rails::Railtie
- rake_tasks do
- load "tasks/auth_check.rake"
- end
initializer "appsignal.configure_rails_initialization" do |app|
# Some apps when run from the console do not have Rails.root set, there's
| Remove rake task in favor of CLI
|
diff --git a/lib/helpers/find_or_create_students.rb b/lib/helpers/find_or_create_students.rb
index abc1234..def5678 100644
--- a/lib/helpers/find_or_create_students.rb
+++ b/lib/helpers/find_or_create_students.rb
@@ -13,7 +13,7 @@ email: "#{username}@doubtfire.com",
username: username
}
- if !AuthenticationHelpers.aaf_auth?
+ unless AuthenticationHelpers.aaf_auth?
profile[:password] = 'password'
profile[:password_confirmation] = 'password'
end
| QUALITY: Use unless of if !
|
diff --git a/lib/scss_lint/reporter/xml_reporter.rb b/lib/scss_lint/reporter/xml_reporter.rb
index abc1234..def5678 100644
--- a/lib/scss_lint/reporter/xml_reporter.rb
+++ b/lib/scss_lint/reporter/xml_reporter.rb
@@ -6,12 +6,13 @@
output << '<lint>'
lints.group_by(&:filename).each do |filename, file_lints|
- output << "<file name='#{filename}'>"
+ output << "<file name=#{filename.encode(:xml => :attr)}>"
+
file_lints.each do |lint|
- output << "<issue line='#{lint.line}' " <<
- "severity='#{lint.severity}' " <<
- "reason='#{lint.description}' />"
+ output << "<issue line=\"#{lint.line}\" " <<
+ "severity=\"#{lint.severity}\" " <<
+ "reason=#{lint.description.encode(:xml => :attr)} />"
end
output << '</file>'
| Update XmlReporter to XML encode attribute strings
Avoids problem where filename or description contains illegal XML
characters (like an ampersand) by escaping the output.
Change-Id: I161de23cd8d52d5b8bab540457fd5fcb4d44add9
Reviewed-on: http://gerrit.causes.com/37215
Tested-by: jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@causes.com>
Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com>
|
diff --git a/lib/tasks/test_publishing_schemas.rake b/lib/tasks/test_publishing_schemas.rake
index abc1234..def5678 100644
--- a/lib/tasks/test_publishing_schemas.rake
+++ b/lib/tasks/test_publishing_schemas.rake
@@ -3,7 +3,7 @@ namespace :test do
Rake::TestTask.new(publishing_schemas: "test:prepare") do |t|
t.libs << "test"
- t.test_files = `grep -rlE "valid_against_(links_)?schema" test`.lines.map(&:chomp)
+ t.test_files = FileList["test/unit/finder_schema_validation_test.rb", "test/unit/presenters/publishing_api/*_test.rb"]
t.warning = false
end
| Change method of selecting schema test cases
We are currently running schema tests by grepping the test names for a
specific string. However there are tests for valid schemas that do not
have a name in this format that we are currently missing.
By running all the Publishing API presenter tests (and a validation test
for the hardcoded finders), we will ensure no tests are missed.
This adds an extra (approximately) 15 seconds to the test run, but
ensures we have full test coverage.
|
diff --git a/lib/riiif/file_system_file_resolver.rb b/lib/riiif/file_system_file_resolver.rb
index abc1234..def5678 100644
--- a/lib/riiif/file_system_file_resolver.rb
+++ b/lib/riiif/file_system_file_resolver.rb
@@ -10,7 +10,7 @@ private
def input_types
- @input_types ||= %w(png jpg tiff jp jp2)
+ @input_types ||= %w(png jpg tiff jp2)
end
end
end
| Remove jp as a valid file extension
I think this was a typo.
|
diff --git a/lib/rubocop/cop/rspec/hook_argument.rb b/lib/rubocop/cop/rspec/hook_argument.rb
index abc1234..def5678 100644
--- a/lib/rubocop/cop/rspec/hook_argument.rb
+++ b/lib/rubocop/cop/rspec/hook_argument.rb
@@ -16,23 +16,28 @@ # ...
# end
class HookArgument < RuboCop::Cop::Cop
- include RuboCop::RSpec::Util
+ MSG = 'Omit the default `%p` argument for RSpec hooks.'.freeze
- MSG = 'Omit the default `:%s` argument for RSpec hooks.'.freeze
+ HOOKS = '{:before :after :around}'.freeze
- HOOK_METHODS = [:after, :around, :before].freeze
- DEFAULT_ARGS = [:each, :example].freeze
+ def_node_matcher :scoped_hook, <<-PATTERN
+ (block (send nil #{HOOKS} $(sym {:each :example})) ...)
+ PATTERN
- def on_send(node)
- return unless HOOK_METHODS.include?(node.method_name) &&
- node.children.drop(2).one?
+ def_node_matcher :unscoped_hook, "(block (send nil #{HOOKS}) ...)"
- arg_node = one(node.method_args)
- arg, = *arg_node
+ def on_block(node)
+ hook(node) do |scope|
+ return unless scope
- return unless DEFAULT_ARGS.include?(arg)
+ add_offense(scope, :expression, format(MSG, *scope))
+ end
+ end
- add_offense(arg_node, :expression, format(MSG, arg))
+ private
+
+ def hook(node, &block)
+ scoped_hook(node, &block) || unscoped_hook(node, &block)
end
end
end
| Refactor cop to use node_matcher
|
diff --git a/lib/finite_machine/transition_builder.rb b/lib/finite_machine/transition_builder.rb
index abc1234..def5678 100644
--- a/lib/finite_machine/transition_builder.rb
+++ b/lib/finite_machine/transition_builder.rb
@@ -39,8 +39,8 @@ # @api public
def call(transitions)
StateParser.parse(transitions) do |from, to|
- @attributes.merge!(states: { from => to })
- transition = Transition.new(@machine.env.target, @attributes)
+ transition = Transition.new(@machine.env.target,
+ @attributes.merge(states: {from => to}))
name = @attributes[:name]
silent = @attributes.fetch(:silent, false)
| Change to stop mutating attributes
|
diff --git a/lib/knapsack_pro/runners/rspec_runner.rb b/lib/knapsack_pro/runners/rspec_runner.rb
index abc1234..def5678 100644
--- a/lib/knapsack_pro/runners/rspec_runner.rb
+++ b/lib/knapsack_pro/runners/rspec_runner.rb
@@ -16,8 +16,11 @@ end
RSpec::Core::RakeTask.new(task_name) do |t|
- t.rspec_opts = "#{args} --default-path #{runner.test_dir}"
- t.pattern = runner.test_file_paths
+ # we cannot pass runner.test_file_paths array to t.pattern
+ # because pattern does not accept test example path like spec/a_spec.rb[1:2]
+ # instead we pass test files and test example paths to t.rspec_opts
+ t.pattern = []
+ t.rspec_opts = "#{args} --default-path #{runner.test_dir} #{runner.stringify_test_file_paths}"
end
Rake::Task[task_name].invoke
end
| Fix bug with not running test examples in Regular Mode when you use test files and test examples at the same time
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.