diff stringlengths 65 26.7k | message stringlengths 7 9.92k |
|---|---|
diff --git a/spec/models/entity_descriptor_spec.rb b/spec/models/entity_descriptor_spec.rb
index abc1234..def5678 100644
--- a/spec/models/entity_descriptor_spec.rb
+++ b/spec/models/entity_descriptor_spec.rb
@@ -5,4 +5,11 @@
it { is_expected.to validate_presence :entities_descriptor }
it { is_expected.to validate_presence :entity_id }
+
+ context 'optional attributes' do
+ it { is_expected.to respond_to :organization }
+ it { is_expected.to respond_to :contact_people }
+ it { is_expected.to respond_to :additional_metadata_locations }
+ end
+
end
| Enhance test cases for EntityDescriptor
|
diff --git a/spec/support/matchers/be_parsed_as.rb b/spec/support/matchers/be_parsed_as.rb
index abc1234..def5678 100644
--- a/spec/support/matchers/be_parsed_as.rb
+++ b/spec/support/matchers/be_parsed_as.rb
@@ -6,6 +6,7 @@ end
failure_message do |actual|
- %Q{expected "#{actual}" to be parsed as #{expected}}
+ %Q{expected "#{actual}" to be parsed as #{expected}\n} +
+ %Q{got #{CodeBreaker::Parser.new(actual).run} instead}
end
end
| Add 'got instead' message to custom matcher
|
diff --git a/redis-semaphore.gemspec b/redis-semaphore.gemspec
index abc1234..def5678 100644
--- a/redis-semaphore.gemspec
+++ b/redis-semaphore.gemspec
@@ -15,7 +15,6 @@ s.add_dependency 'redis'
s.add_development_dependency 'rake'
s.add_development_dependency 'rspec', '>= 2.14'
- s.add_development_dependency 'pry'
s.add_development_dependency 'timecop'
s.description = <<description
| Remove `pry` as development dependency
|
diff --git a/spec/ruby/core/file/initialize_spec.rb b/spec/ruby/core/file/initialize_spec.rb
index abc1234..def5678 100644
--- a/spec/ruby/core/file/initialize_spec.rb
+++ b/spec/ruby/core/file/initialize_spec.rb
@@ -2,6 +2,14 @@
describe "File#initialize" do
it "needs to be reviewed for spec completeness"
+end
+
+ruby_version_is '1.8' do
+ describe "File#initialize" do
+ it 'ignores encoding options in mode parameter' do
+ lambda { File.new(__FILE__, 'r:UTF-8:iso-8859-1') }.should_not raise_error
+ end
+ end
end
ruby_version_is '1.9' do
| Add spec for ignoring encoding options in 1.8
|
diff --git a/active_importer.gemspec b/active_importer.gemspec
index abc1234..def5678 100644
--- a/active_importer.gemspec
+++ b/active_importer.gemspec
@@ -8,8 +8,8 @@ spec.version = ActiveImporter::VERSION
spec.authors = ["Ernesto Garcia"]
spec.email = ["gnapse@gmail.com"]
- spec.description = %q{TODO: Write a gem description}
- spec.summary = %q{TODO: Write a gem summary}
+ spec.description = %q{Import tabular data from spreadsheets or similar sources into data models}
+ spec.summary = %q{Import tabular data into data models}
spec.homepage = ""
spec.license = "MIT"
| Add sensible summary and description strings to gemspec
|
diff --git a/lib/express_templates/components/forms/basic_fields.rb b/lib/express_templates/components/forms/basic_fields.rb
index abc1234..def5678 100644
--- a/lib/express_templates/components/forms/basic_fields.rb
+++ b/lib/express_templates/components/forms/basic_fields.rb
@@ -3,7 +3,7 @@ module Forms
module BasicFields
ALL = %w(email phone text password color date datetime
- datetime_local file number range
+ datetime_local number range
search telephone time url week)
ALL.each do |type|
@@ -28,6 +28,13 @@ # }
# end
+ class File < FormComponent
+ contains {
+ label_tag(label_name, label_text)
+ file_field_tag field_name_attribute, field_helper_options
+ }
+ end
+
class Textarea < FormComponent
contains {
label_tag(label_name, label_text)
| Make basic file field component
|
diff --git a/spec/epr_spec_helper.rb b/spec/epr_spec_helper.rb
index abc1234..def5678 100644
--- a/spec/epr_spec_helper.rb
+++ b/spec/epr_spec_helper.rb
@@ -30,7 +30,7 @@ #
# @note This assumes the driver is on a page with the avatar dropdown menu
def self.logout
- avatar_icon = driver.find_element(:css, '.header-nav-link .avatar')
+ avatar_icon = driver.find_element(:css, '.HeaderNavlink .avatar')
avatar_icon.location_once_scrolled_into_view
avatar_icon.click
driver.find_element(:class, 'logout-form').click
| Fix CSS selector for logging out in tests
|
diff --git a/spec/features/access_control_spec.rb b/spec/features/access_control_spec.rb
index abc1234..def5678 100644
--- a/spec/features/access_control_spec.rb
+++ b/spec/features/access_control_spec.rb
@@ -0,0 +1,61 @@+require 'spec_helper'
+
+RSpec.feature "Access control", type: :feature do
+ def log_in_as_editor(editor)
+ user = FactoryGirl.create(editor)
+ GDS::SSO.test_user = user
+ end
+
+ before do
+ fields = [
+ :base_path,
+ :content_id,
+ :title,
+ :public_updated_at,
+ :details,
+ :description,
+ ]
+
+ publishing_api_has_fields_for_format('specialist_document', [], fields)
+ end
+
+ context "as a CMA Editor" do
+ before do
+ log_in_as_editor(:cma_editor)
+ end
+
+ scenario "visiting /cma-cases" do
+ visit "/cma-cases"
+
+ expect(page.status_code).to eq(200)
+ expect(page).to have_content("CMA Cases")
+ end
+
+ scenario "visiting /aaib-reports" do
+ visit "/aaib-reports"
+
+ expect(page.current_path).to eq("/cma-cases")
+ expect(page).to have_content("You aren't permitted to access AAIB Reports")
+ end
+ end
+
+ context "as an AAIB Editor" do
+ before do
+ log_in_as_editor(:aaib_editor)
+ end
+
+ scenario "visiting /aaib-reports" do
+ visit "/aaib-reports"
+
+ expect(page.status_code).to eq(200)
+ expect(page).to have_content("AAIB Reports")
+ end
+
+ scenario "visiting /cma-cases" do
+ visit "/cma-cases"
+
+ expect(page.current_path).to eq("/aaib-reports")
+ expect(page).to have_content("You aren't permitted to access CMA Cases")
+ end
+ end
+end
| Add failing test for access control
|
diff --git a/spec/item_merge_spec.rb b/spec/item_merge_spec.rb
index abc1234..def5678 100644
--- a/spec/item_merge_spec.rb
+++ b/spec/item_merge_spec.rb
@@ -0,0 +1,29 @@+require 'spec_helper'
+
+class Poloxy::Config
+ attr_accessor :deliver
+end
+
+klass = 'Poloxy::ItemMerge::PerItem'
+describe klass do
+ before :context do
+ @mkcfg = ->(merger){
+ config = TestPoloxy.config
+ config.deliver = { 'item' => { 'merger' => merger } }
+ config
+ }
+ end
+
+ describe '#new' do
+ describe 'Configured "deliver.item.merger" is loaded' do
+ %w[PerItem PerGroup PerAddress].each do |klass|
+ it "P::ItemMerge::#{klass} is loaded" do
+ im = Poloxy::ItemMerge.new config: @mkcfg.call(klass)
+ expect(im.merger).to be_an_instance_of(
+ Object.const_get("Poloxy::ItemMerge::#{klass}")
+ )
+ end
+ end
+ end
+ end
+end
| Add test for P::ItemMerge factory
|
diff --git a/spec/features/stats_features_spec.rb b/spec/features/stats_features_spec.rb
index abc1234..def5678 100644
--- a/spec/features/stats_features_spec.rb
+++ b/spec/features/stats_features_spec.rb
@@ -0,0 +1,58 @@+require 'spec_helper'
+
+describe "Stats" do
+ before :all do
+ load "#{Rails.root}/db/seeds.rb"
+ end
+
+ before :each do
+ user = FactoryGirl.create(:user)
+ user.add_role :admin
+ sign_in_user(user)
+ visit '/stats'
+ end
+
+ it "should show the stats page" do
+ page.should have_content "Stats"
+ end
+
+ it "should show clients by subscriptions" do
+ within("#clients-by-subscriptions") { find("td", :text => "test") }
+ end
+
+ it "should show clients by environment" do
+ within("#clients-by-environment") { find("td", :text => "None") }
+ end
+
+ it "should show miscellaneous client stats" do
+ within("#clients-misc tbody") do
+ find("td", :text => "Total Clients")
+ page.should have_content Client.all.count
+ end
+ end
+
+ it "should show events by check" do
+ within("#events-by-check") do
+ page.should have_content "test"
+ end
+ end
+
+ it "should show events by environment" do
+ within("#events-by-environment") do
+ page.should have_content "1"
+ end
+ end
+
+ it "should show events per client" do
+ within("#events-per-client") do
+ page.should have_content "i-424242"
+ end
+ end
+
+ it "should show miscellaneous event stats" do
+ within("#events-misc") do
+ page.should have_content "Total Events"
+ end
+ end
+
+end
| Update stats feature specs to run against sensu api v0.10.2
|
diff --git a/spec/steps/step_spec.rb b/spec/steps/step_spec.rb
index abc1234..def5678 100644
--- a/spec/steps/step_spec.rb
+++ b/spec/steps/step_spec.rb
@@ -1,16 +1,8 @@ require "rails_helper"
describe Step do
- class TestQuestionA < Question
- self.model_attribute = :first_name
- end
-
- class TestQuestionB < Question
- self.model_attribute = :last_name
- end
-
class TestStep < Step
- self.questions = [TestQuestionA, TestQuestionB]
+ self.questions = [FirstName, LastName]
end
describe ".find" do
@@ -28,7 +20,7 @@
context "when everything is valid" do
it "updates the app" do
- step.update({ test_question_a: "Alice", test_question_b: "Aardvark" })
+ step.update({ first_name: "Alice", last_name: "Aardvark" })
expect(step).to be_valid
expect(app.reload.first_name).to eq "Alice"
expect(app.reload.last_name).to eq "Aardvark"
@@ -36,7 +28,14 @@ end
context "when some fields are invalid" do
+ it "does not update the app" do
+ app.update! first_name: "Alice", last_name: "Aardvark"
+ step.update({ first_name: "Billy", last_name: nil })
+ expect(step).not_to be_valid
+ expect(app.reload.first_name).to eq "Alice"
+ expect(app.reload.last_name).to eq "Aardvark"
+ end
end
end
end
| Test coverage for invalid fields not updating the model
|
diff --git a/lib/polymer-rails/railtie.rb b/lib/polymer-rails/railtie.rb
index abc1234..def5678 100644
--- a/lib/polymer-rails/railtie.rb
+++ b/lib/polymer-rails/railtie.rb
@@ -3,7 +3,7 @@ class Railtie < ::Rails::Railtie
initializer :polymer_html_import do
helpers = %q{ include AssetTagHelper }
- ::ActionView::Helpers::AssetTagHelper.module_eval(helpers)
+ ::ActionView::Base.module_eval(helpers)
::Rails.application.assets.context_class.class_eval(helpers)
end
| Fix html_import_tag helper in Rails 3
|
diff --git a/lib/projector/projections.rb b/lib/projector/projections.rb
index abc1234..def5678 100644
--- a/lib/projector/projections.rb
+++ b/lib/projector/projections.rb
@@ -13,12 +13,12 @@ @json = get_json path
@json.each do |_regex, options|
- @commands.push options['type'] if options.key? 'type'
+ @commands.push(options['type']) if options.key? 'type'
end
end
def command?(command)
- @commands.include? command
+ @commands.include?(command)
end
private
@@ -32,14 +32,14 @@ end
end
@json_file_existed = true
- File.open(path, 'r') { |f| JSON.parse f.read }
+ File.open(path, 'r') { |f| JSON.parse(f.read) }
end
def projections_path
path = File.expand_path './.projections.json'
until File.exist? path
- return nil if [false, '/'].include? File.dirname path
- path = File.expand_path '../../.projections.json', path
+ return nil if [false, '/'].include?(File.dirname path)
+ path = File.expand_path('../../.projections.json', path)
end
path
| Switch to parentheses for some things
|
diff --git a/lib/puppet/type/x509_cert.rb b/lib/puppet/type/x509_cert.rb
index abc1234..def5678 100644
--- a/lib/puppet/type/x509_cert.rb
+++ b/lib/puppet/type/x509_cert.rb
@@ -39,6 +39,7 @@
newparam(:days) do
newvalues(/\d+/)
+ defaultto(3650)
end
newparam(:owner) do
| Add default value for days
|
diff --git a/fluent-plugin-in-kinesis.gemspec b/fluent-plugin-in-kinesis.gemspec
index abc1234..def5678 100644
--- a/fluent-plugin-in-kinesis.gemspec
+++ b/fluent-plugin-in-kinesis.gemspec
@@ -12,7 +12,9 @@ spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
spec.require_paths = ["lib"]
- spec.add_runtime_dependency "fluentd"
+ spec.add_runtime_dependency "fluentd", ">= 0.12.15", "< 0.13"
+ spec.add_runtime_dependency "aws-sdk-core", ">= 2.0.12", "< 3.0"
+ spec.add_runtime_dependency "multi_json", "~> 1.0"
spec.add_development_dependency "bundler"
spec.add_development_dependency "rake"
| Add missing dependencies and specify versions
|
diff --git a/app/business_processes/enrollment_event_client.rb b/app/business_processes/enrollment_event_client.rb
index abc1234..def5678 100644
--- a/app/business_processes/enrollment_event_client.rb
+++ b/app/business_processes/enrollment_event_client.rb
@@ -5,10 +5,10 @@
def initialize
@stack = Middleware::Builder.new do |b|
- b.use Handlers::ReducerHandler
- b.use Handlers::EnricherHandler
- b.use Handlers::PersistanceHandler
- b.use Handlers::PublisherHandler
+ b.use Handlers::ReduceHandler
+ b.use Handlers::EnrichHandler
+ b.use Handlers::PersistHandler
+ b.use Handlers::PublishHandler
end
end
| Change chain names to match updated handler names
|
diff --git a/app/controllers/fancyengine/webhook_controller.rb b/app/controllers/fancyengine/webhook_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/fancyengine/webhook_controller.rb
+++ b/app/controllers/fancyengine/webhook_controller.rb
@@ -10,6 +10,9 @@ head :bad_request and return
end
+ # Fancy Hands uses a single URL for all webhooks.
+ # We need to iterate through the request classes to find one
+ # that has the key from the response.
[CustomRequest].each do |request_class|
break if request_instance = request_class.find_by(key: response["key"])
end
| Add comment explaining the need to iterate through the request classes in the webhook controller.
|
diff --git a/lib/sql_condition_builder.rb b/lib/sql_condition_builder.rb
index abc1234..def5678 100644
--- a/lib/sql_condition_builder.rb
+++ b/lib/sql_condition_builder.rb
@@ -3,7 +3,7 @@ MINOR = 1
TINY = 0
VERSION = "#{MAJOR}.#{MINOR}.#{TINY}"
-
+
def initialize
@strings = []
@bind_variables = []
@@ -14,12 +14,12 @@
def add_condition(string, bind_variable=EmptyCondition.new)
@strings << string
-
+
unless bind_variable.kind_of?(EmptyCondition)
@bind_variables << bind_variable
end
end
-
+
def to_a
[@strings.join(" AND "), @bind_variables].flatten
end
@@ -33,7 +33,7 @@ def respond_to?(sym, include_private=false)
accessor?(sym) || super
end
-
+
def merge!(hash)
hash.each do |key, value|
send "#{key}=", value
@@ -54,7 +54,9 @@ sym.to_s =~ /.*\=$/ ? true : false
end
+ class Sanitizer < ActiveRecord::Base; end
+
def sanitize_sql(array)
- ActiveRecord::Base.send :sanitize_sql, array
+ Sanitizer.send :sanitize_sql, array
end
end
| Use a descendant AR class to get around errors in rails 2.3.5
|
diff --git a/lib/sslyze/x509/extension.rb b/lib/sslyze/x509/extension.rb
index abc1234..def5678 100644
--- a/lib/sslyze/x509/extension.rb
+++ b/lib/sslyze/x509/extension.rb
@@ -1,3 +1,5 @@+require 'delegate'
+
module SSLyze
module X509
#
@@ -5,64 +7,7 @@ #
# @see http://www.rubydoc.info/stdlib/openssl/OpenSSL/X509/Extension
#
- class Extension
-
- #
- # @param [OpenSSL::X509::Extension] ext
- #
- def initialize(ext)
- @ext = ext
- end
-
- #
- # @see http://www.rubydoc.info/stdlib/openssl/OpenSSL/X509/Extension#critical%3F-instance_method
- #
- def critical?
- @ext.critical?
- end
-
- #
- # @see http://www.rubydoc.info/stdlib/openssl/OpenSSL/X509/Extension#oid-instance_method
- #
- def oid
- @ext.oid
- end
-
- #
- # @see http://www.rubydoc.info/stdlib/openssl/OpenSSL/X509/Extension#to_a-instance_method
- #
- def to_a
- @ext.to_a
- end
-
- #
- # @see http://www.rubydoc.info/stdlib/openssl/OpenSSL/X509/Extension#to_der-instance_method
- #
- def to_der
- @ext.to_der
- end
-
- #
- # @see http://www.rubydoc.info/stdlib/openssl/OpenSSL/X509/Extension#to_h-instance_method
- #
- def to_h
- @ext.to_h
- end
-
- #
- # @see http://www.rubydoc.info/stdlib/openssl/OpenSSL/X509/Extension#to_s-instance_method
- #
- def to_s
- @ext.to_s
- end
-
- #
- # @see http://www.rubydoc.info/stdlib/openssl/OpenSSL/X509/Extension#value-instance_method
- #
- def value
- @ext.value
- end
-
+ class Extension < SimpleDelegator
end
end
end
| Use SimpleDelegator for the SSLyze::X509::Extension base class.
|
diff --git a/lib/text/simon_similarity.rb b/lib/text/simon_similarity.rb
index abc1234..def5678 100644
--- a/lib/text/simon_similarity.rb
+++ b/lib/text/simon_similarity.rb
@@ -8,22 +8,23 @@ # Author: Wilker Lúcio <wilkerlucio@gmail.com>
#
+require "set"
+
module Text
module SimonSimilarity
def compare_strings(str1, str2)
pairs1 = word_letter_pairs(str1.upcase)
pairs2 = word_letter_pairs(str2.upcase)
+ lookup = Set.new(pairs2)
+
intersection = 0
union = pairs1.length + pairs2.length
- pairs1.each do |pair1|
- pairs2.each_with_index do |pair2, j|
- if pair1 == pair2
- intersection += 1
- pairs2.delete_at(j)
- break
- end
+ pairs1.each do |pair|
+ if lookup.include?(pair)
+ lookup.delete pair
+ intersection += 1
end
end
| Use a Set for simpler, more efficient lookups.
|
diff --git a/spec/lib/hamster/hash/new_spec.rb b/spec/lib/hamster/hash/new_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/hamster/hash/new_spec.rb
+++ b/spec/lib/hamster/hash/new_spec.rb
@@ -14,7 +14,7 @@ hash['snazzy?'].should == 'oh yeah'
end
- describe "from a subclass" do
+ context "from a subclass" do
it "returns a frozen instance of the subclass" do
subclass = Class.new(Hamster::Hash)
instance = subclass.new("some" => "values")
| Use 'context' to describe test context in Hash.new spec
|
diff --git a/spec/nio/selectables/pipe_spec.rb b/spec/nio/selectables/pipe_spec.rb
index abc1234..def5678 100644
--- a/spec/nio/selectables/pipe_spec.rb
+++ b/spec/nio/selectables/pipe_spec.rb
@@ -18,8 +18,13 @@ let :unwritable_subject do
reader, pipe = IO.pipe
+ #HACK: On OS X 10.8, this str must be larger than PIPE_BUF. Otherwise,
+ # the write is atomic and select() will return writable but write()
+ # will throw EAGAIN if there is too little space to write the string
+ # TODO: Use FFI to lookup the platform-specific size of PIPE_BUF
+ str = "JUNK IN THE TUBES" * 10000
begin
- pipe.write_nonblock "JUNK IN THE TUBES"
+ pipe.write_nonblock str
_, writers = select [], [pipe], [], 0
rescue Errno::EPIPE
break
| Fix the setup of unwritable_subject in tests on OS X 10.8
|
diff --git a/lib/action_mailbox/mail_ext/addresses.rb b/lib/action_mailbox/mail_ext/addresses.rb
index abc1234..def5678 100644
--- a/lib/action_mailbox/mail_ext/addresses.rb
+++ b/lib/action_mailbox/mail_ext/addresses.rb
@@ -1,26 +1,21 @@ class Mail::Message
def from_address
- Mail::Address.new from.first
+ header[:from]&.address_list&.addresses&.first
end
def recipients_addresses
- convert_to_addresses recipients
+ to_addresses + cc_addresses + bcc_addresses
end
def to_addresses
- convert_to_addresses to
+ Array(header[:to]&.address_list&.addresses)
end
def cc_addresses
- convert_to_addresses cc
+ Array(header[:cc]&.address_list&.addresses)
end
def bcc_addresses
- convert_to_addresses bcc
+ Array(header[:bcc]&.address_list&.addresses)
end
-
- private
- def convert_to_addresses(recipients)
- Array(recipients).collect { |recipient| Mail::Address.new recipient }
- end
end
| Use the address lists that have already been supplied to ensure we get the names as well
|
diff --git a/lib/ci_in_a_can/cli/structure_builder.rb b/lib/ci_in_a_can/cli/structure_builder.rb
index abc1234..def5678 100644
--- a/lib/ci_in_a_can/cli/structure_builder.rb
+++ b/lib/ci_in_a_can/cli/structure_builder.rb
@@ -11,14 +11,24 @@ def create
directories_to_create = [@root, "#{@root}/jobs", "#{@root}/repos", "#{@root}/web", "#{@root}/service", "#{@root}/results"]
- directories_to_create.each { |d| Dir.mkdir(d) unless File.exists?(d) }
+ directories_to_create.each { |d| create_directory d }
files = ::CiInACan::Cli::Files.for @id, @root
- File.open("#{@root}/Rakefile", 'w') { |f| f.write files.rake_file }
- File.open("#{@root}/service/service.rb", 'w') { |f| f.write files.service_file }
- File.open("#{@root}/web/stay_alive.rb", 'w') { |f| f.write files.web_daemon }
- File.open("#{@root}/web/config.ru", 'w') { |f| f.write files.web_file }
+ create_file "#{@root}/Rakefile", files.rake_file
+ create_file "#{@root}/service/service.rb", files.service_file
+ create_file "#{@root}/web/stay_alive.rb", files.web_daemon
+ create_file "#{@root}/web/config.ru", files.web_file
+ end
+
+ private
+
+ def create_directory directory
+ Dir.mkdir(directory) unless File.exists?(directory)
+ end
+
+ def create_file file, content
+ File.open(file, 'w') { |f| f.write content }
end
end
| Break out file operations to single methods.
|
diff --git a/lib/link_to_active_state/view_helpers.rb b/lib/link_to_active_state/view_helpers.rb
index abc1234..def5678 100644
--- a/lib/link_to_active_state/view_helpers.rb
+++ b/lib/link_to_active_state/view_helpers.rb
@@ -1,8 +1,6 @@ module LinkToActiveState
module ViewHelpers
- alias_method :rails_link_to, :link_to
-
- def link_to(*args, &block)
+ def link_to_with_active_state(*args, &block)
html_options = if block_given?
args.second
else
@@ -15,6 +13,8 @@ active = case active_on
when String
request.fullpath == active_on
+ when Array
+ active_on.include?(request.fullpath)
when Regexp
request.fullpath =~ active_on
when Proc
@@ -35,8 +35,10 @@ html_options.delete(:active_state)
end
- rails_link_to(*args, &block)
+ link_to_without_active_state(*args, &block)
end
+
+ alias_method_chain :link_to, :active_state
private
def merge_class(original, new)
| Use alias_method_chain for more standard override, and support arrays for :active_on
|
diff --git a/lib/mechanize/robots_disallowed_error.rb b/lib/mechanize/robots_disallowed_error.rb
index abc1234..def5678 100644
--- a/lib/mechanize/robots_disallowed_error.rb
+++ b/lib/mechanize/robots_disallowed_error.rb
@@ -22,7 +22,7 @@ end
def to_s
- "Access disallowed by robots.txt: #{uri}"
+ "Access disallowed by robots.txt: #{url}"
end
alias :inspect :to_s
end
| Use url instead of uri.
|
diff --git a/lib/pronto/formatter/github_formatter.rb b/lib/pronto/formatter/github_formatter.rb
index abc1234..def5678 100644
--- a/lib/pronto/formatter/github_formatter.rb
+++ b/lib/pronto/formatter/github_formatter.rb
@@ -13,8 +13,6 @@ message.path,
message.line.new_lineno)
end
-
- "#{messages.count} pronto messages posted to GitHub"
end
private
| Remove output message in GitHub formatter
|
diff --git a/cookbooks/wt_cam/attributes/default.rb b/cookbooks/wt_cam/attributes/default.rb
index abc1234..def5678 100644
--- a/cookbooks/wt_cam/attributes/default.rb
+++ b/cookbooks/wt_cam/attributes/default.rb
@@ -7,10 +7,10 @@ #
default['wt_cam']['app_pool'] = "CAM"
-default['wt_cam'][['cam']'download_url'] = ""
+default['wt_cam']['download_url'] = ""
default['wt_cam']['cam_plugins']['download_url'] = ""
default['wt_cam']['db_server'] = "(local)"
default['wt_cam']['db_name'] = "Cam"
default['wt_cam']['tokenExpirationMinutes'] = 60
default['wt_cam']['port'] = 80
-default['wt_cam']['log_level'] = "INFO"
+default['wt_cam']['log_level'] = "INFO" | Fix a typo in the wt_cam attributes file
|
diff --git a/rb/lib/selenium/webdriver/firefox/bridge.rb b/rb/lib/selenium/webdriver/firefox/bridge.rb
index abc1234..def5678 100644
--- a/rb/lib/selenium/webdriver/firefox/bridge.rb
+++ b/rb/lib/selenium/webdriver/firefox/bridge.rb
@@ -6,11 +6,7 @@ class Bridge < Remote::Bridge
def initialize(opts = {})
- @launcher = Launcher.new(
- Binary.new,
- opts.delete(:port) || DEFAULT_PORT,
- opts.delete(:profile)
- )
+ @launcher = create_launcher(opts)
http_client = opts.delete(:http_client)
@@ -45,6 +41,16 @@ nil
end
+ private
+
+ def create_launcher(opts)
+ Launcher.new(
+ Binary.new,
+ opts.delete(:port) || DEFAULT_PORT,
+ opts.delete(:profile)
+ )
+ end
+
end # Bridge
end # Firefox
end # WebDriver
| JariBakken: Add ability to override Firefox::Bridge's @launcher
git-svn-id: aa1aa1384423cb28c2b1e29129bb3a91de1d9196@11117 07704840-8298-11de-bf8c-fd130f914ac9
|
diff --git a/app/models/concierge.rb b/app/models/concierge.rb
index abc1234..def5678 100644
--- a/app/models/concierge.rb
+++ b/app/models/concierge.rb
@@ -16,10 +16,10 @@ # Returns a Conversation.
def find_conversation
# If we have an explicit conversation number try that first
- conversation = @conversations.where(number: @params.fetch(:conversation, nil)).first
+ conversation = @conversations.where(number: @params[:conversation]).first
# If that didn't work, match on the recipient email address, looking for replies
- conversation ||= Conversation.match_mailbox(@params.fetch(:recipient, nil))
+ conversation ||= Conversation.match_mailbox(@params[:recipient])
# If that didn't work, create a new conversation
conversation ||= @conversations.create
| Use params[] instead of params.fetch()
|
diff --git a/test/features/visit_all_page_test.rb b/test/features/visit_all_page_test.rb
index abc1234..def5678 100644
--- a/test/features/visit_all_page_test.rb
+++ b/test/features/visit_all_page_test.rb
@@ -12,7 +12,8 @@ return if visited.include? current_path
visited << current_path
all('a').each do |a|
- visit a[:href] && visit_all_links(visited)
+ visit a[:href]
+ visit_all_links(visited)
end
end
end
| Fix some linked page aren't visited.
|
diff --git a/lib/futures_pipeline/client.rb b/lib/futures_pipeline/client.rb
index abc1234..def5678 100644
--- a/lib/futures_pipeline/client.rb
+++ b/lib/futures_pipeline/client.rb
@@ -18,11 +18,12 @@ get("/api/v1/careers.json", options)
end
- # Get a single career using O*NET code.
+ # Get a single career using O\*NET code.
#
- # @param onet_soc_code [String] The O*NET code
+ # @param onet_soc_code [String] The O\*NET code
# @param options [Hash] A customizable set of options.
# @return [Hashie::Mash]
+ # @raise [Faraday::Error::ResourceNotFound] If O\*NET code is not found.
# @example
# @client = FuturesPipeline.new
# @client.career("11-1011.00")
| Add documentation for error handling
|
diff --git a/config/initializers/kaminari_config.rb b/config/initializers/kaminari_config.rb
index abc1234..def5678 100644
--- a/config/initializers/kaminari_config.rb
+++ b/config/initializers/kaminari_config.rb
@@ -1,5 +1,5 @@ Kaminari.configure do |config|
- # config.default_per_page = 25
+ # config.default_per_page = 10
# config.max_per_page = nil
# config.window = 4
# config.outer_window = 0
| Change config to default of 10 listings per page
|
diff --git a/db/migrate/20120223093906_make_project_membership_polymorphic_on_subject.rb b/db/migrate/20120223093906_make_project_membership_polymorphic_on_subject.rb
index abc1234..def5678 100644
--- a/db/migrate/20120223093906_make_project_membership_polymorphic_on_subject.rb
+++ b/db/migrate/20120223093906_make_project_membership_polymorphic_on_subject.rb
@@ -1,15 +1,7 @@-class ProjectMembership < ActiveRecord::Base
- belongs_to :project
- belongs_to :member, :polymorphic => true
-end
-
class MakeProjectMembershipPolymorphicOnSubject < ActiveRecord::Migration
def self.up
add_column :project_memberships, :content_type, :string
- ProjectMembership.all.each do |pm|
- pm.content_type = "Project"
- pm.save!
- end
+ execute "update project_memberships set content_type='Project'"
rename_table :project_memberships, :content_memberships
rename_column :content_memberships, :project_id, :content_id
end
@@ -18,10 +10,7 @@ def self.down
rename_table :content_memberships, :project_memberships
- ProjectMembership.all.each do |pm|
- pm.delete if pm.content_type != "Project"
- end
-
+ execute "delete from project_memberships where content_type='Project'"
remove_column :project_memberships, :content_type
rename_column :project_memberships, :content_id, :project_id
end
| Resolve an issue where migrations would be canceled in production Rails.env
Referencing a model inside a migration seems to confuse AR's mapping
of tables and columns. Doing a raw execute resolves this.
|
diff --git a/spec/virtualbox_spec.rb b/spec/virtualbox_spec.rb
index abc1234..def5678 100644
--- a/spec/virtualbox_spec.rb
+++ b/spec/virtualbox_spec.rb
@@ -4,7 +4,7 @@ it { should be_installed.by('homebrew_cask') }
end
-describe package('virtualbox'), :if => os[:family] == 'debian' do
+describe package('virtualbox-5.0'), :if => os[:family] == 'debian' do
it { should be_installed.by('apt') }
end
| Fix package name on Debian.
|
diff --git a/lib/kosmos/packages/mechjeb.rb b/lib/kosmos/packages/mechjeb.rb
index abc1234..def5678 100644
--- a/lib/kosmos/packages/mechjeb.rb
+++ b/lib/kosmos/packages/mechjeb.rb
@@ -0,0 +1,8 @@+class MechJeb < Kosmos::Package
+ title 'MechJeb'
+ url 'http://addons.cursecdn.com/files/2201/514/MechJeb2-2.2.1.0.zip'
+
+ def install
+ merge_directory 'MechJeb2', into: 'GameData'
+ end
+end
| Add a package for MechJeb.
|
diff --git a/db/migrate/20151031092713_change_conference_id_to_venue_id_in_rooms.rb b/db/migrate/20151031092713_change_conference_id_to_venue_id_in_rooms.rb
index abc1234..def5678 100644
--- a/db/migrate/20151031092713_change_conference_id_to_venue_id_in_rooms.rb
+++ b/db/migrate/20151031092713_change_conference_id_to_venue_id_in_rooms.rb
@@ -19,7 +19,7 @@ end
def up
- add_column :rooms, :venue_id, :integer, null: false
+ add_column :rooms, :venue_id, :integer
TempRoom.all.each do |room|
venue = TempVenue.find_by(conference_id: room.conference_id)
@@ -32,11 +32,12 @@ room.save!
end
+ change_column :rooms, :venue_id, :integer, null: false
remove_column :rooms, :conference_id
end
def down
- add_column :rooms, :conference_id, :integer, null: false
+ add_column :rooms, :conference_id, :integer
TempRoom.all.each do |room|
venue = TempVenue.find(room.venue_id)
@@ -49,6 +50,7 @@ room.save!
end
+ change_column :rooms, :conference_id, :integer, null: false
remove_column :rooms, :venue_id
end
end
| Fix sqlite behavior with not null constraint, so that it works both for sqlite and mysql
|
diff --git a/app/models/stance_choice.rb b/app/models/stance_choice.rb
index abc1234..def5678 100644
--- a/app/models/stance_choice.rb
+++ b/app/models/stance_choice.rb
@@ -2,7 +2,7 @@ belongs_to :poll_option
belongs_to :stance, dependent: :destroy
has_one :poll, through: :poll_option
- delegate :has_variable_score, to: :poll
+ delegate :has_variable_score, to: :poll, allow_nil: true
validates_presence_of :poll_option
validates :score, numericality: { greater_than_or_equal_to: 0 }
| Allow nil for has_variable_score for stances
|
diff --git a/event_girl_client.gemspec b/event_girl_client.gemspec
index abc1234..def5678 100644
--- a/event_girl_client.gemspec
+++ b/event_girl_client.gemspec
@@ -7,7 +7,7 @@ spec.name = "event_girl_client"
spec.version = EventGirlClient::VERSION
spec.authors = ["Susanne Dewein", "Tam Eastley"]
- spec.email = ["susanne.dewein@gmail.com", "tam.eastley@googlemail.com"]
+ spec.email = ["susanne.dewein@gmail.com", "tam.eastley@gmail.com"]
spec.description = %q{TODO: Write a gem description}
spec.summary = %q{TODO: Write a gem summary}
spec.homepage = ""
| Add Tam to author emails |
diff --git a/lib/stackato-lkg/amazon/ec2.rb b/lib/stackato-lkg/amazon/ec2.rb
index abc1234..def5678 100644
--- a/lib/stackato-lkg/amazon/ec2.rb
+++ b/lib/stackato-lkg/amazon/ec2.rb
@@ -0,0 +1,94 @@+require 'aws-sdk'
+require 'contracts'
+require_relative 'service'
+
+module StackatoLKG
+ module Amazon
+ class EC2 < Service
+ Contract None => ArrayOf[::Aws::EC2::Types::Vpc]
+ def vpcs
+ @vpcs ||= vpcs!
+ end
+
+ Contract None => ArrayOf[::Aws::EC2::Types::Vpc]
+ def vpcs!
+ @vpcs = call_api(:describe_vpcs).vpcs
+ end
+
+ Contract None => ArrayOf[::Aws::EC2::Types::Subnet]
+ def subnets
+ @subnets ||= subnets!
+ end
+
+ Contract None => ArrayOf[::Aws::EC2::Types::Subnet]
+ def subnets!
+ @subnets = call_api(:describe_subnets).subnets
+ end
+
+ Contract None => ArrayOf[::Aws::EC2::Types::Instance]
+ def instances
+ @instances ||= instances!
+ end
+
+ Contract None => ArrayOf[::Aws::EC2::Types::Instance]
+ def instances!
+ @instances = call_api(:describe_instances)
+ .reservations
+ .flat_map(&:instances)
+ end
+
+ Contract None => ArrayOf[::Aws::EC2::Types::Address]
+ def addresses
+ @addresses ||= addresses!
+ end
+
+ Contract None => ArrayOf[::Aws::EC2::Types::Address]
+ def addresses!
+ @addresses = call_api(:describe_addresses).addresses
+ end
+
+ Contract None => ArrayOf[::Aws::EC2::Types::TagDescription]
+ def tags
+ @tags ||= tags!
+ end
+
+ Contract None => ArrayOf[::Aws::EC2::Types::TagDescription]
+ def tags!
+ @tags = call_api(:describe_tags).tags
+ end
+
+ Contract None => ::Aws::EC2::Types::Vpc
+ def create_vpc
+ call_api(:create_vpc, cidr_block: config.cidr_block).vpc
+ end
+
+ Contract ArrayOf[String], ArrayOf[{ key: String, value: String}] => Bool
+ def create_tags(resources, tags)
+ call_api(:create_tags, resources: resources, tags: tags).successful?
+ end
+
+ Contract String, Args[String] => Bool
+ def assign_name(name, *resources)
+ create_tags(resources, [{ key: 'Name', value: name } ])
+ end
+
+ Contract KeywordArgs[
+ type: Optional[String],
+ key: Optional[String],
+ value: Optional[String]
+ ] => ArrayOf[::Aws::EC2::Types::TagDescription]
+ def tagged(type: nil, key: nil, value: nil)
+ tags
+ .select { |tag| type.nil? || tag.resource_type == type }
+ .select { |tag| tag.key == (key || 'Name') }
+ .select { |tag| value.nil? || tag.value == value }
+ end
+
+ private
+
+ def client
+ Aws::EC2::Client
+ end
+ end
+ end
+end
| Add interface to EC2 service
|
diff --git a/lib/tasks/data_generators.rake b/lib/tasks/data_generators.rake
index abc1234..def5678 100644
--- a/lib/tasks/data_generators.rake
+++ b/lib/tasks/data_generators.rake
@@ -0,0 +1,16 @@+namespace :higgins do
+ namespace :test_data do
+ desc 'Create 10 test questions about the artifact of the day'
+ task :test_questions => :environment do
+ artifact = Artifact.of_the_day
+
+ 10.times do |i|
+ artifact.questions.create(
+ nickname: 'bbaggins',
+ email: 'bilbo@baggins.net',
+ question: "Test question #{i}"
+ )
+ end
+ end
+ end
+end | Add a rake task to generate test question.
|
diff --git a/lib/flip_fab/features_by_name.rb b/lib/flip_fab/features_by_name.rb
index abc1234..def5678 100644
--- a/lib/flip_fab/features_by_name.rb
+++ b/lib/flip_fab/features_by_name.rb
@@ -17,6 +17,6 @@ FeaturesByName.new Hash[@features_by_name.map{|name, feature| [name, (feature.with_context context)]}]
end
- def_delegators :@features_by_name, :[]=, :clear, :count
+ def_delegators :@features_by_name, :[]=, :clear, :count, :each
end
end
| Add support for :each to FeaturesByName instances
|
diff --git a/lib/frecon/configuration_file.rb b/lib/frecon/configuration_file.rb
index abc1234..def5678 100644
--- a/lib/frecon/configuration_file.rb
+++ b/lib/frecon/configuration_file.rb
@@ -19,8 +19,14 @@ end
def read
- data = open(@filename, "rb") do |io|
- io.read
+ begin
+ data = open(@filename, "rb") do |io|
+ io.read
+ end
+
+ Configuration.new(YAML.load(data))
+ rescue Errno::ENOENT
+ nil
end
Configuration.new(YAML.load(data))
| Return nil if ConfigurationFile is unreadable.
|
diff --git a/lib/gitlab/optimistic_locking.rb b/lib/gitlab/optimistic_locking.rb
index abc1234..def5678 100644
--- a/lib/gitlab/optimistic_locking.rb
+++ b/lib/gitlab/optimistic_locking.rb
@@ -16,6 +16,6 @@ end
end
- alias :retry_optimistic_lock :retry_lock
+ alias_method :retry_optimistic_lock, :retry_lock
end
end
| Fix Rubocop offense in OptimisticLocking module
|
diff --git a/attributes/passenger.rb b/attributes/passenger.rb
index abc1234..def5678 100644
--- a/attributes/passenger.rb
+++ b/attributes/passenger.rb
@@ -7,4 +7,4 @@
# the default value of this attribute is set in the recipe. if set here using "which
# ruby" it results in failed chef runs on Windows just by being a dependency
-node.default["nginx"]["passenger"]["ruby"] = ""+node.default["nginx"]["passenger"]["ruby"] = nil | Change empty string to nil
|
diff --git a/lib/link_thumbnailer/response.rb b/lib/link_thumbnailer/response.rb
index abc1234..def5678 100644
--- a/lib/link_thumbnailer/response.rb
+++ b/lib/link_thumbnailer/response.rb
@@ -18,8 +18,8 @@
def extract_charset
content_type = @response['Content-Type'] || ''
- m = content_type.match(/charset=(\w+)/)
- (m && m[1]) || @response.body.scrub =~ /<meta[^>]*charset\s*=\s*["']?(.+)["']/i && $1.upcase || ''
+ m = content_type.match(/charset=([\w-]+)/)
+ (m && m[1]) || @response.body.scrub =~ /<meta[^>]*charset\s*=\s*["']?(.+?)["' >]/i && $1 || ''
end
def extract_body
| Fix a mistake in regular expression
|
diff --git a/lib/simple_captcha_audio/view.rb b/lib/simple_captcha_audio/view.rb
index abc1234..def5678 100644
--- a/lib/simple_captcha_audio/view.rb
+++ b/lib/simple_captcha_audio/view.rb
@@ -4,9 +4,11 @@ alias_method :__simple_captcha_options__, :simple_captcha_options
def simple_captcha_options(options = {})
- key = simple_captcha_key(options[:object])
+ super_options = __simple_captcha_options__(options)
- __simple_captcha_options__(options).merge({
+ key = super_options[:field_value]
+
+ super_options.merge({
audio: simple_captcha_audio(key, options)
})
end
@@ -15,7 +17,7 @@ def simple_captcha_audio(simple_captcha_key, options = {})
url = simple_captcha_audio_url simple_captcha_key, options: options
id = simple_captcha_audio_id(options)
- tag('audio', :src => url, :id => id)
+ tag('audio', :src => url, :id => id, controls: true)
end
def simple_captcha_audio_url(simple_captcha_key, options = {})
| Correct logic for the audio link generation and make audio ag visible
|
diff --git a/lib/tasks/gulp_assets_tasks.rake b/lib/tasks/gulp_assets_tasks.rake
index abc1234..def5678 100644
--- a/lib/tasks/gulp_assets_tasks.rake
+++ b/lib/tasks/gulp_assets_tasks.rake
@@ -1,7 +1,7 @@ namespace :gulp_assets do
desc "Compile Gulp Assets"
task :precompile do
- system('gulp precompile')
+ sh "gulp precompile"
end
end
| Use sh in rake task instead of system |
diff --git a/libraries/selinux_file_helper.rb b/libraries/selinux_file_helper.rb
index abc1234..def5678 100644
--- a/libraries/selinux_file_helper.rb
+++ b/libraries/selinux_file_helper.rb
@@ -29,7 +29,7 @@ line.chomp
# extracting version and module name
- if (match = line.match(/^module\s+(\w+)\s+([\d\.\-]+);/))
+ if (match = line.match(/^module\s+([\w_-]+)\s+([\d\.\-]+);/))
@module_name, @version = match.captures
end
| Allow "-" and "_" for module names
Without this change, it will force the module to be installed on every run which
slows client runs considerably if you have multiple modules you add.
This patch is the same as noted in this PR [1].
[1] https://github.com/chef-cookbooks/selinux/pull/61
Signed-off-by: Lance Albertson <3161cdc7bf197e4c3a35b9cbe358c79910f27e90@osuosl.org>
|
diff --git a/udp2sqs_server.gemspec b/udp2sqs_server.gemspec
index abc1234..def5678 100644
--- a/udp2sqs_server.gemspec
+++ b/udp2sqs_server.gemspec
@@ -6,8 +6,8 @@ Gem::Specification.new do |spec|
spec.name = "udp2sqs_server"
spec.version = Udp2sqsServer::VERSION
- spec.authors = ["MalcyL, mmmmmrob"]
- spec.email = ["malcolm@landonsonline.me.uk, rob@dynamicorange.com"]
+ spec.authors = ["MalcyL, mmmmmrob", "iHiD"]
+ spec.email = ["malcolm@landonsonline.me.uk, rob@dynamicorange.com", "jeremy@meducation.net"]
spec.description = %q{Simple UDP server. Posts UDP payloads to a configured AWS SQS queue.}
spec.summary = %q{See also udp2sqs-client}
spec.homepage = ""
| Add me to Gemspec :blue_heart:
|
diff --git a/lib/email_assessor.rb b/lib/email_assessor.rb
index abc1234..def5678 100644
--- a/lib/email_assessor.rb
+++ b/lib/email_assessor.rb
@@ -28,13 +28,13 @@
protected
- def self.domain_in_file?(domain, filename)
- return false unless filename.present? && File.exists?(filename)
+ def self.domain_in_file?(domain, file_name)
+ return false unless file_name.present? && File.exists?(file_name)
domain = domain.downcase
domain_matched = false
- File.open(filename).each do |line|
+ File.open(file_name).each do |line|
if domain.end_with?(line.chomp)
domain_matched = true
break
| Rename the variable filename to file_name for better semantics
|
diff --git a/motion/core_ext/ns_dictionary.rb b/motion/core_ext/ns_dictionary.rb
index abc1234..def5678 100644
--- a/motion/core_ext/ns_dictionary.rb
+++ b/motion/core_ext/ns_dictionary.rb
@@ -7,5 +7,5 @@ end
end
- delegate :symbolize_keys, :to => :to_hash
+ delegate :symbolize_keys, :with_indifferent_access, :nested_under_indifferent_access, :to => :to_hash
end
| Add more delegation to NSDictionary
|
diff --git a/assertions/published_gem.rb b/assertions/published_gem.rb
index abc1234..def5678 100644
--- a/assertions/published_gem.rb
+++ b/assertions/published_gem.rb
@@ -12,7 +12,7 @@
def check
begin
- json = RestClient.get("http://rubygems.org/api/v1/versions/#{engine.project_name}.json")
+ json = RestClient.get("https://rubygems.org/api/v1/versions/#{engine.project_name}.json")
rescue RestClient::ResourceNotFound
return nil
end
| Use https to access rubygems.org
|
diff --git a/railties/lib/rails/tasks/yarn.rake b/railties/lib/rails/tasks/yarn.rake
index abc1234..def5678 100644
--- a/railties/lib/rails/tasks/yarn.rake
+++ b/railties/lib/rails/tasks/yarn.rake
@@ -3,7 +3,7 @@ namespace :yarn do
desc "Install all JavaScript dependencies as specified via Yarn"
task :install do
- system("./bin/yarn install --no-progress --production")
+ system("./bin/yarn install --no-progress --freeze-lockfile --production")
end
end
| Raise an error when lockfile diff is generated
https://yarnpkg.com/en/docs/cli/install#toc-yarn-install-frozen-lockfile |
diff --git a/lib/puppet-lint/plugins/absolute_template_path.rb b/lib/puppet-lint/plugins/absolute_template_path.rb
index abc1234..def5678 100644
--- a/lib/puppet-lint/plugins/absolute_template_path.rb
+++ b/lib/puppet-lint/plugins/absolute_template_path.rb
@@ -1,27 +1,25 @@ PuppetLint.new_check(:absolute_template_path) do
def check
resource_indexes.each do |resource|
- if resource[:type].value == 'file'
- resource[:param_tokens].select { |param_token|
- param_token.value == 'content'
- }.each do |content_token|
+ next unless resource[:type].value == 'file'
- value_token = content_token.next_code_token.next_code_token
+ content_tokens = resource[:param_tokens].select { |pt| pt.value == 'content' }
- if value_token.value.start_with? 'template'
- template_path = value_token.next_code_token.next_code_token.value
+ content_tokens.each do |content_token|
+ value_token = content_token.next_code_token.next_code_token
- if template_path.start_with? '/'
+ next unless value_token.value.start_with? 'template'
- notify :warning, {
- message: 'template module paths should be relative, not absolute',
- line: value_token.line,
- column: value_token.column,
- param_token: content_token,
- value_token: value_token,
- }
- end
- end
+ template_path = value_token.next_code_token.next_code_token.value
+
+ if template_path.start_with? '/'
+ notify :warning, {
+ message: 'template module paths should be relative, not absolute',
+ line: value_token.line,
+ column: value_token.column,
+ param_token: content_token,
+ value_token: value_token,
+ }
end
end
end
| Refactor the lint plugin to add short circuits
These changes add more proactive filtering to avoid deeper nesting
by testing for values and ending the iteration faster.
|
diff --git a/module_creation_helper.gemspec b/module_creation_helper.gemspec
index abc1234..def5678 100644
--- a/module_creation_helper.gemspec
+++ b/module_creation_helper.gemspec
@@ -14,4 +14,6 @@ s.test_files = `git ls-files -- test/*`.split("\n")
s.rdoc_options = %w(--line-numbers --inline-source --title module_creation_helper --main README.rdoc)
s.extra_rdoc_files = %w(README.rdoc CHANGELOG.rdoc LICENSE)
+
+ s.add_development_dependency("rake")
end
| Add missing dependencies to gemspec
|
diff --git a/spec/middleware_spec.rb b/spec/middleware_spec.rb
index abc1234..def5678 100644
--- a/spec/middleware_spec.rb
+++ b/spec/middleware_spec.rb
@@ -1,7 +1,6 @@-# -*- encoding: utf-8 -*-
require 'spec_helper'
-describe 'UTF8Cleaner::Middleware' do
+describe UTF8Cleaner::Middleware do
let :env do
{
'PATH_INFO' => 'foo/%FFbar%2e%2fbaz%26%3B',
| Clean up Middleware spec file a little bit
|
diff --git a/lib/status_checker.rb b/lib/status_checker.rb
index abc1234..def5678 100644
--- a/lib/status_checker.rb
+++ b/lib/status_checker.rb
@@ -17,9 +17,8 @@ if response.nil?
{
'message_id' => @message_id,
- 'notifications' => [{ 'level' => "info",
- 'subject' => "Quickbooks id: #{@id} Failed to Import"
- 'description' => get_errors }]
+ 'events' => [{ 'code' => 400,
+ 'error' => get_errors }]
}
elsif response.synchronized == "true"
{ 'message_id' => @message_id }
| Revert "Replace events with notifications", as it's a v5 feature and has
syntax errors and is causing production problems.
This reverts commit 689dbf388241f41eb1a98739e0ccb8d761a56780.
|
diff --git a/lib/tumblr/request.rb b/lib/tumblr/request.rb
index abc1234..def5678 100644
--- a/lib/tumblr/request.rb
+++ b/lib/tumblr/request.rb
@@ -18,6 +18,9 @@
# Performs post request
def post(path, params={})
+ if Array === params[:tags]
+ params[:tags] = params[:tags].join(',')
+ end
response = connection.post do |req|
req.url path
req.body = params unless params.empty?
| Allow tags to be passed as an array
Closes #6
|
diff --git a/lib/npmdc/modules_directory.rb b/lib/npmdc/modules_directory.rb
index abc1234..def5678 100644
--- a/lib/npmdc/modules_directory.rb
+++ b/lib/npmdc/modules_directory.rb
@@ -16,14 +16,6 @@
def scoped?
basename.start_with?('@')
- end
-
- def files
- Dir.glob("#{path}/*").map { |file_path| self.class.new(file_path) }
- end
-
- def directories
- files.select(&:directory?)
end
def valid_directories
@@ -53,5 +45,15 @@ def exists?
File.file?(path)
end
+
+ private
+
+ def files
+ Dir.glob("#{path}/*").map { |file_path| self.class.new(file_path) }
+ end
+
+ def directories
+ files.select(&:directory?)
+ end
end
end
| Move ModulesDirectory methods to private
|
diff --git a/lib/petstore/resources/pets.rb b/lib/petstore/resources/pets.rb
index abc1234..def5678 100644
--- a/lib/petstore/resources/pets.rb
+++ b/lib/petstore/resources/pets.rb
@@ -4,6 +4,10 @@ module Resources
class Pets < Petstore::Resource
set_path 'pet'
+
+ def get(id)
+ super
+ end
def find_by_status(status)
Petstore::Request.new(conn: conn, partial_path: partial_path('findByStatus'),
| Add get method with required id parameter.
|
diff --git a/ext/concurrent/extconf.rb b/ext/concurrent/extconf.rb
index abc1234..def5678 100644
--- a/ext/concurrent/extconf.rb
+++ b/ext/concurrent/extconf.rb
@@ -1,5 +1,6 @@ require 'fileutils'
+$:.unshift(File.expand_path('../../../lib', __FILE__))
require 'concurrent/utility/native_extension_loader'
EXTENSION_NAME = 'extension'
| Fix building using native extensions
|
diff --git a/spec/models/pin_spec.rb b/spec/models/pin_spec.rb
index abc1234..def5678 100644
--- a/spec/models/pin_spec.rb
+++ b/spec/models/pin_spec.rb
@@ -1,6 +1,8 @@ require 'rails_helper'
RSpec.describe Pin, type: :model do
+ let!(:pin) { create(:pin)}
+
describe 'validations' do
it { is_expected.to validate_numericality_of :lat }
it { is_expected.to validate_numericality_of :lng }
@@ -19,6 +21,8 @@
describe 'class method' do
it "changes the tag object's to a string" do
+
+ expect(Pin.tags_to_s(pin)).to eq "Quirky"
end
end
end
| Add pin class method spec; not passing yet
|
diff --git a/test/integration/pdf_delivery_test.rb b/test/integration/pdf_delivery_test.rb
index abc1234..def5678 100644
--- a/test/integration/pdf_delivery_test.rb
+++ b/test/integration/pdf_delivery_test.rb
@@ -11,4 +11,15 @@ headers["Content-Disposition"]
assert_equal "application/pdf", headers["Content-Type"]
end
+
+ test "pdf renderer uses the specific template" do
+ get another_path(format: :pdf)
+
+ assert_match "PDF", response.body
+ assert_equal "binary", headers["Content-Transfer-Encoding"]
+
+ assert_equal "attachment; filename=\"contents.pdf\"",
+ headers["Content-Disposition"]
+ assert_equal "application/pdf", headers["Content-Type"]
+ end
end | Add test to confirm the chosen template is rendered
|
diff --git a/test/example/global_options_example.rb b/test/example/global_options_example.rb
index abc1234..def5678 100644
--- a/test/example/global_options_example.rb
+++ b/test/example/global_options_example.rb
@@ -0,0 +1,64 @@+# coding: utf-8
+
+require "example_helper"
+
+Feature "global options" do
+ as_a "user"
+ i_want_to "set global options"
+ in_order_to "affect general application behavior"
+
+ def setup
+ super
+ stub_http_request(:get, %r{https://api.twitter.com/1/statuses/home_timeline\.json\?count=\d+&page=\d+}).to_return(:body => fixture_file('home.json'))
+ end
+
+ Scenario "colors" do
+ When "I start the application with '--colors' option" do
+ @output = start_cli %w{--colors}
+ end
+
+ Then "the application shows tweets with colors" do
+ @output[0].should == "\e[32mpelit\e[0m, 11 days ago:"
+ @output[1].should == "F1-kausi alkaa marraskuussa \e[36mhttp://bit.ly/1qQwjQ\e[0m"
+ @output[2].should == ""
+ @output[58].should == "\e[32mradar\e[0m, 15 days ago:"
+ @output[59].should == "Four short links: 29 September 2009 \e[36mhttp://bit.ly/dYxay\e[0m"
+ end
+ end
+
+ Scenario "show reverse" do
+ When "I start the application with '--reverse' option" do
+ @output = start_cli %w{--reverse}
+ end
+
+ Then "the application shows tweets in reverse order" do
+ @output[0].should == "radar, 15 days ago:"
+ @output[1].should == "Four short links: 29 September 2009 http://bit.ly/dYxay"
+ @output[2].should == ""
+ @output[58].should == "pelit, 11 days ago:"
+ @output[59].should == "F1-kausi alkaa marraskuussa http://bit.ly/1qQwjQ"
+ end
+ end
+
+ Scenario "num" do
+ When "I start the application with '--num <n>' option" do
+ @num = 2
+ @output = start_cli %W{--num #{@num}}
+ end
+
+ Then "the application requests the specified number of tweets" do
+ assert_requested(:get, %r{/home_timeline\.json\?count=#{@num}&page=\d+})
+ end
+ end
+
+ Scenario "page" do
+ When "I start the application with '--page <p>' option" do
+ @page = 2
+ @output = start_cli %W{--page #{@page}}
+ end
+
+ Then "the application requests the specified page number for tweets" do
+ assert_requested(:get, %r{/home_timeline\.json\?count=\d+&page=#{@page}})
+ end
+ end
+end
| Add example for global options
|
diff --git a/railties/lib/rails/tasks/statistics.rake b/railties/lib/rails/tasks/statistics.rake
index abc1234..def5678 100644
--- a/railties/lib/rails/tasks/statistics.rake
+++ b/railties/lib/rails/tasks/statistics.rake
@@ -8,7 +8,7 @@ %w(Models app/models),
%w(Mailers app/mailers),
%w(Channels app/channels),
- %w(Javascripts app/assets/javascripts),
+ %w(JavaScripts app/assets/javascripts),
%w(Libraries lib/),
%w(Tasks lib/tasks),
%w(APIs app/apis),
| Use JavaScripts instead of Javascripts in `rake stats`
|
diff --git a/test/models/request_geolocator_test.rb b/test/models/request_geolocator_test.rb
index abc1234..def5678 100644
--- a/test/models/request_geolocator_test.rb
+++ b/test/models/request_geolocator_test.rb
@@ -18,7 +18,13 @@ end
test "does not suggests a location unless it's city-specific" do
- # This ip address is correctly resolved to Brazil, but not a specific city
- assert_nil RequestGeolocator.new('179.168.191.163').suggest
+ assert_nil \
+ RequestGeolocator.new(ip_from_brazil_but_not_a_specific_city).suggest
+ end
+
+ private
+
+ def ip_from_brazil_but_not_a_specific_city
+ '179.168.191.163'
end
end
| Migrate a comment to code
|
diff --git a/lib/extensions/action_controller/base.rb b/lib/extensions/action_controller/base.rb
index abc1234..def5678 100644
--- a/lib/extensions/action_controller/base.rb
+++ b/lib/extensions/action_controller/base.rb
@@ -6,7 +6,29 @@
helper_method :current_user, :current_user?
- protected
+ def current_user
+ @current_user ||= if session[:user_id]
+ User.find(session[:user_id])
+ elsif cookies[:remember_token]
+ User.find_by_remember_token(cookies[:remember_token])
+ else
+ false
+ end
+ end
+
+ def current_user?
+ !!current_user
+ end
+
+ def current_user=(user)
+ user.tap do |user|
+ user.remember
+ session[:user_id] = user.id
+ cookies[:remember_token] = user.remember_token
+ end
+ end
+
+ protected
# Filters
@@ -30,28 +52,6 @@ session[:return_to] = nil
end
- def current_user
- @current_user ||= if session[:user_id]
- User.find(session[:user_id])
- elsif cookies[:remember_token]
- User.find_by_remember_token(cookies[:remember_token])
- else
- false
- end
- end
-
- def current_user?
- !!current_user
- end
-
- def current_user=(user)
- user.tap do |user|
- user.remember
- session[:user_id] = user.id
- cookies[:remember_token] = user.remember_token
- end
- end
-
def logout!
session[:user_id] = nil
@current_user = nil
| Move current_user from protection section so it can be used in a controller
|
diff --git a/test/features/create_service_test.rb b/test/features/create_service_test.rb
index abc1234..def5678 100644
--- a/test/features/create_service_test.rb
+++ b/test/features/create_service_test.rb
@@ -19,12 +19,6 @@ assert_content page, "No se pudo crear el servicio"
end
- test "Attempt to create a service with an invalid file" do
- attach_file 'service_spec_file', Rails.root.join('README.md')
- click_button "Crear Servicio"
- assert_content page, "Spec file Archivo no está en formato JSON o YAML"
- end
-
test "Create a valid service" do
attach_file 'service_spec_file', Rails.root.join(
'test', 'files', 'sample-services', 'petsfull.yaml')
| Remove test for service creation with invalid file
|
diff --git a/lib/cucumber/gherkin/steps_parser.rb b/lib/cucumber/gherkin/steps_parser.rb
index abc1234..def5678 100644
--- a/lib/cucumber/gherkin/steps_parser.rb
+++ b/lib/cucumber/gherkin/steps_parser.rb
@@ -12,11 +12,9 @@ end
def parse(text)
ast_builder = ::Gherkin::AstBuilder.new
- token_matcher = ::Gherkin::TokenMatcher.new
- token_matcher.send(:change_dialect, @language, nil) unless @language == 'en'
context = ::Gherkin::ParserContext.new(
::Gherkin::TokenScanner.new(text),
- token_matcher,
+ ::Gherkin::TokenMatcher.new(@language),
[],
[]
)
| Remove hack to set the i18n language when parsing nested steps.
The possibility to initialise the matcher with a language was introduced
in gherkin v3.1.2. To work with earlier gherkin v3.x.x versions using
send to call a private method was necessary.
|
diff --git a/lib/with_advisory_lock/postgresql.rb b/lib/with_advisory_lock/postgresql.rb
index abc1234..def5678 100644
--- a/lib/with_advisory_lock/postgresql.rb
+++ b/lib/with_advisory_lock/postgresql.rb
@@ -10,7 +10,7 @@ end
def execute_successful?(pg_function)
- sql = "SELECT #{pg_function}(#{lock_keys.join(',')}) AS #{unique_column_name}"
+ sql = "SELECT #{pg_function}(#{lock_keys.join(',')}) AS #{unique_column_name} /* #{lock_name} */"
result = connection.select_value(sql)
# MRI returns 't', jruby returns true. YAY!
(result == 't' || result == true)
| Add SQL comment to original lock string for PostgreSQL
The PostgreSQL implementation requires translating the user-specified
lock string into a pair of 32 bit numbers, which makes the lock and
unlock statements opaque in the SQL logs.
To aid debugging, add a SQL comment containing the original lock string.
The comment will be removed from the input by the PostgreSQL parser, but
it will still show up in logs. |
diff --git a/lib/wpclient/paginated_collection.rb b/lib/wpclient/paginated_collection.rb
index abc1234..def5678 100644
--- a/lib/wpclient/paginated_collection.rb
+++ b/lib/wpclient/paginated_collection.rb
@@ -9,6 +9,8 @@ @current_page = current_page
@per_page = per_page
end
+
+ alias total_entires total
def each
if block_given?
| Add alias for total_entries to total
|
diff --git a/lib/active_cmis/internal/connection.rb b/lib/active_cmis/internal/connection.rb
index abc1234..def5678 100644
--- a/lib/active_cmis/internal/connection.rb
+++ b/lib/active_cmis/internal/connection.rb
@@ -11,8 +11,6 @@
# The return value is the unparsed body, unless an error occured
# If an error occurred, exceptions are thrown (see _ActiveCMIS::Exception
- #
- # TODO? add a method to get the parsed result (and possibly handle XML errors?)
def get(url)
case url
when URI; uri = url
@@ -36,6 +34,15 @@ raise HTTPError.new("A HTTP #{status} error occured, for more precision update the code")
end
end
+
+ def get_xml(url)
+ Nokogiri.parse(get(url))
+ end
+
+ def get_atom_entry(url)
+ # FIXME: add validation that first child is really an entry
+ Nokogiri.parse(get(url)).child
+ end
end
end
end
| Add helper function to get an atom entry
|
diff --git a/lib/netsuite/records/payment_method.rb b/lib/netsuite/records/payment_method.rb
index abc1234..def5678 100644
--- a/lib/netsuite/records/payment_method.rb
+++ b/lib/netsuite/records/payment_method.rb
@@ -5,7 +5,8 @@ include Support::RecordRefs
include Support::Actions
- actions :get
+ actions :add, :delete, :get, :get_list, :search, :search_more_with_id,
+ :update, :upsert, :upsert_list
fields :credit_card, :express_checkout_arrangement, :is_debit_card, :is_inactive, :is_online, :name,
:pay_pal_email_address, :undep_funds, :use_express_checkout
| Add missing actions to payment methods
https://system.na1.netsuite.com/help/helpcenter/en_US/Output/Help/SuiteCloudCustomizationScriptingWebServices/SuiteTalkWebServices/PaymentMethod.html
|
diff --git a/lib/conjure/provision/docker/host.rb b/lib/conjure/provision/docker/host.rb
index abc1234..def5678 100644
--- a/lib/conjure/provision/docker/host.rb
+++ b/lib/conjure/provision/docker/host.rb
@@ -18,7 +18,7 @@ end
def started_container_id(image_name, daemon_command, run_options = nil)
- all_options = "-d #{run_options.to_s} #{image_name} #{daemon_command}"
+ all_options = "-d --restart=always #{run_options.to_s} #{image_name} #{daemon_command}"
@platform.run("docker run #{all_options}").strip
end
| Add auto-restart setting to containers |
diff --git a/lib/superstore/belongs_to/association.rb b/lib/superstore/belongs_to/association.rb
index abc1234..def5678 100644
--- a/lib/superstore/belongs_to/association.rb
+++ b/lib/superstore/belongs_to/association.rb
@@ -51,7 +51,7 @@ if reflection.default_primary_key?
association_class.find_by_id(record_id)
else
- association_class.where(reflection.primary_key => record_id).first
+ association_class.find_by(reflection.primary_key => record_id)
end
end
| Use find_by rather than where for belongs_to query
|
diff --git a/ostatus/lib/social_stream/ostatus/models/activity.rb b/ostatus/lib/social_stream/ostatus/models/activity.rb
index abc1234..def5678 100644
--- a/ostatus/lib/social_stream/ostatus/models/activity.rb
+++ b/ostatus/lib/social_stream/ostatus/models/activity.rb
@@ -21,7 +21,7 @@ content: stream_content,
verb: verb,
author: Proudhon::Author.new(name: sender.name,
- uri: sender.webfinger_id)
+ uri: sender.webfinger_uri)
salmon = entry.to_salmon
# FIXME: Rails 4 queues
| Include webfinger uri in Salmon instead of ID
|
diff --git a/lib/travis/api/v3/models/subscription.rb b/lib/travis/api/v3/models/subscription.rb
index abc1234..def5678 100644
--- a/lib/travis/api/v3/models/subscription.rb
+++ b/lib/travis/api/v3/models/subscription.rb
@@ -1,16 +1,17 @@ module Travis::API::V3
- class Models::Subscription < Struct.new(:id, :valid_to, :plan, :coupon, :status, :source, :billing_info, :credit_card_info, :owner)
+ class Models::Subscription
+ attr_reader :id, :valid_to, :plan, :coupon, :status, :source, :billing_info, :credit_card_info, :owner
+
def initialize(attributes = {})
- super(
- attributes.fetch('id'),
- attributes.fetch('valid_to') && DateTime.parse(attributes.fetch('valid_to')),
- attributes.fetch('plan'),
- attributes['coupon'],
- attributes.fetch('status'),
- attributes.fetch('source'),
- attributes['billing_info'],
- attributes['credit_card_info'],
- attributes.fetch('owner'))
+ @id = attributes.fetch('id')
+ @valid_to = attributes.fetch('valid_to') && DateTime.parse(attributes.fetch('valid_to'))
+ @plan = attributes.fetch('plan')
+ @coupon = attributes['coupon']
+ @status = attributes.fetch('status')
+ @source = attributes.fetch('source')
+ @billing_info = attributes['billing_info']
+ @credit_card_info = attributes['credit_card_info']
+ @owner = attributes.fetch('owner')
end
end
end
| Change struct to a real class
|
diff --git a/lib/gene_genie/template_evaluator.rb b/lib/gene_genie/template_evaluator.rb
index abc1234..def5678 100644
--- a/lib/gene_genie/template_evaluator.rb
+++ b/lib/gene_genie/template_evaluator.rb
@@ -19,7 +19,7 @@ # maximum of 1000
def recommended_size
[
- [((Math.log(permutations))**2).ceil, 4000].min,
+ [((Math.log(permutations))**2).ceil, 5000].min,
[6, permutations].min,
3
].max
| Increase maximum pool size to 5000
|
diff --git a/lib/nyan_cat_wide_music_formatter.rb b/lib/nyan_cat_wide_music_formatter.rb
index abc1234..def5678 100644
--- a/lib/nyan_cat_wide_music_formatter.rb
+++ b/lib/nyan_cat_wide_music_formatter.rb
@@ -0,0 +1,9 @@+# -*- coding: utf-8 -*-
+require 'nyan_cat_formatter'
+require 'nyan_cat_format/wide'
+require 'nyan_cat_format/music'
+
+NyanCatWideMusicFormatter = Class.new(NyanCatFormatter) do
+ include NyanCatFormat::Wide
+ include NyanCatFormat::Music
+end
| Add NyanCatWideMusicFormatter (combination of 'wide' and 'music').
|
diff --git a/lib/extlib/string.rb b/lib/extlib/string.rb
index abc1234..def5678 100644
--- a/lib/extlib/string.rb
+++ b/lib/extlib/string.rb
@@ -1,4 +1,13 @@ class String
+ # Overwrite this method to provide your own translations.
+ def self.translate(value)
+ translations[value] || value
+ end
+
+ def self.translations
+ @translations ||= {}
+ end
+
# Matches any whitespace (including newline) and replaces with a single space
#
# @example
@@ -23,4 +32,14 @@ end
lines.map { |line| line.sub(/^\s{#{min_margin}}/, '') }.join($/)
end
+
+ # Formats String for easy translation. Replaces an arbitrary number of
+ # values using numeric identifier replacement.
+ #
+ # @example
+ # "%s %s %s" % %w(one two three) #=> "one two three"
+ # "%3$s %2$s %1$s" % %w(one two three) #=> "three two one"
+ def t(*values)
+ self.class::translate(self) % values
+ end
end # class String
| Add missing String methods that broke dm-validations completely.
|
diff --git a/lib/findrepos/cli.rb b/lib/findrepos/cli.rb
index abc1234..def5678 100644
--- a/lib/findrepos/cli.rb
+++ b/lib/findrepos/cli.rb
@@ -18,13 +18,22 @@ def list(directory = '.') # :nodoc:
Findrepos.list(directory, recursive: options[:recursive]).each do |repo|
if Findrepos.clean?(repo)
- say_status 'clean', repo, :green if !options[:dirty]
+ say_git_status true, repo if !options[:dirty]
else
- say_status 'dirty', repo, :red if !options[:clean]
+ say_git_status false, repo if !options[:clean]
end
end
end
default_command :list
+
+ private
+
+ def say_git_status(clean, message)
+ status = clean ? 'clean' : 'dirty'
+ color = clean ? :green : :red
+ status = set_color status, color, true
+ puts "#{status} #{message}"
+ end
end
end
| Add and use a say_git_status helper
|
diff --git a/lib/flyover_comments/authorization.rb b/lib/flyover_comments/authorization.rb
index abc1234..def5678 100644
--- a/lib/flyover_comments/authorization.rb
+++ b/lib/flyover_comments/authorization.rb
@@ -22,7 +22,7 @@ end
def can_flag_flyover_comment?(comment, user)
- if Object.const_defined?("Pundit") && policy = Pundit.policy(user, comment)
+ if Object.const_defined?("Pundit") && policy = Pundit.policy(user, FlyoverComments::Flag.new(comment: comment, user: user))
policy.create?
elsif user.respond_to?(:can_flag_flyover_comment?)
user.can_flag_flyover_comment?(comment)
| Make pundit use a flag policy, not comment policy if app is using pundit
|
diff --git a/lib/stroke_counter/keyboard/logger.rb b/lib/stroke_counter/keyboard/logger.rb
index abc1234..def5678 100644
--- a/lib/stroke_counter/keyboard/logger.rb
+++ b/lib/stroke_counter/keyboard/logger.rb
@@ -44,8 +44,8 @@ hand = log[:hand]
end
size[hand] -= 1 unless hand.nil?
- l2r = counts[:l2r] / size[:left] rescue nil
- r2l = counts[:r2l] / size[:right] rescue nil
+ l2r = counts[:l2r] / size[:left].to_f rescue nil
+ r2l = counts[:r2l] / size[:right].to_f rescue nil
{ left_to_right: l2r, right_to_left: r2l }
end
end
| Add to_f to fix float probabilities problem
|
diff --git a/lib/thinking_sphinx/rake_interface.rb b/lib/thinking_sphinx/rake_interface.rb
index abc1234..def5678 100644
--- a/lib/thinking_sphinx/rake_interface.rb
+++ b/lib/thinking_sphinx/rake_interface.rb
@@ -9,7 +9,7 @@ end
def configure
- ThinkingSphinx::Commands::Configure.call configuration, options
+ ThinkingSphinx::Commander.call :configure, configuration, options
end
def daemon
| Use configure command via commander.
This way, it can be safely overridden.
|
diff --git a/Casks/dwarf-fortress.rb b/Casks/dwarf-fortress.rb
index abc1234..def5678 100644
--- a/Casks/dwarf-fortress.rb
+++ b/Casks/dwarf-fortress.rb
@@ -5,7 +5,7 @@ url "http://www.bay12games.com/dwarves/df_#{version.sub(%r{^0+\.},'').gsub('.','_')}_osx.tar.bz2"
name 'Dwarf Fortress'
homepage 'http://www.bay12games.com/dwarves/'
- license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder
+ license :gratis
suite 'df_osx', :target => 'Dwarf Fortress'
end
| Update license for Dwarf Fortress to 'gratis'.
Dwarf Fortress is closed source but may be freely distributed. The
following is the copyright information provided with the software.
*** COPYRIGHT INFORMATION ****************************
Copyright (c) 2002-2015. All rights are retained by Tarn Adams, save
the following: you may redistribute the binary and accompanying files,
unmodified, provided you do so free of charge. If you'd like to
distribute a modified version of the game or portion of the archive and
are worried about copyright infringement, please contact Tarn Adams at
toadyone@bay12games.com.
This software is still in development, and this means that there are
going to be problems, including serious problems that, however unlikely,
might damage your system or the information stored on it. Please be
aware of this before playing.
|
diff --git a/lib/paypoint/blue.rb b/lib/paypoint/blue.rb
index abc1234..def5678 100644
--- a/lib/paypoint/blue.rb
+++ b/lib/paypoint/blue.rb
@@ -25,7 +25,11 @@ #
# @return [Hashie::Mash] the parsed, snake_cased response
def self.parse_payload(json)
- payload = JSON.parse(json.is_a?(IO) ? json.read : json.to_s)
+ payload = json.respond_to?(:read) ? json.read : json.to_s
+ if payload.encoding == Encoding::ASCII_8BIT
+ payload.force_encoding 'iso-8859-1'
+ end
+ payload = JSON.parse(payload)
payload = Utils.snakecase_and_symbolize_keys(payload)
Hashie::Mash.new(payload)
end
| Fix payload parsing for binary encoded JSON |
diff --git a/spec/controllers/tags_controller_spec.rb b/spec/controllers/tags_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/tags_controller_spec.rb
+++ b/spec/controllers/tags_controller_spec.rb
@@ -28,5 +28,10 @@ get :show, {id: 2}
expect(response).to render_template("show")
end
+
+ it "assigns tags correctly" do
+ get :show, {id: 5}
+ expect(assigns(:tag)).to eq(Tag.find(5))
+ end
end
end | Add test for assigning tags
|
diff --git a/lib/proxy_fetcher.rb b/lib/proxy_fetcher.rb
index abc1234..def5678 100644
--- a/lib/proxy_fetcher.rb
+++ b/lib/proxy_fetcher.rb
@@ -3,7 +3,12 @@ require "proxy_fetcher/proxy"
module ProxyFetcher
- SOURCES = ["http://www.xroxy.com/proxyrss.xml"]
+ SOURCES = [
+ "http://www.xroxy.com/proxyrss.xml",
+ "http://www.freeproxylists.com/rss",
+ "http://www.proxz.com/proxylists.xml"
+ ]
+
@@list = nil
def self.list
@@ -12,26 +17,27 @@ list = {}
SOURCES.each do |url|
xml = Nokogiri::XML(open url)
- xml.xpath("//prx:proxy").each do |proxy|
- list["#{ip}:#{port}"] ||= ProxyFetcher::Proxy.new(self.xml_node_to_hash proxy, url)
+ xml.xpath("//prx:proxy").each do |node|
+ proxy = ProxyFetcher::Proxy.new( self.xml_node_to_hash(node, url) )
+ list["#{proxy.ip}:#{proxy.port}"] ||= proxy
end
end
@@list = list.to_a.map(&:last)
end
def self.xml_node_to_hash(node, source)
- ip = proxy.xpath("prx:ip").text
- port = proxy.xpath("prx:port").text
+ ip = node.xpath("prx:ip").text
+ port = node.xpath("prx:port").text
{
ip: ip,
port: port,
- type: proxy.xpath("prx:type").text,
- ssl: proxy.xpath("prx:type").text.downcase == "true",
- registered_at: Time.at(proxy.xpath("prx:check_timestamp").text.to_i),
- country_code: proxy.xpath("prx:country_code").text,
- latency: proxy.xpath("prx:latency").text.to_i,
- reliability: proxy.xpath("prx:reliability").text.to_i,
+ type: node.xpath("prx:type").text,
+ ssl: node.xpath("prx:ssl").text.downcase == "true",
+ registered_at: Time.at(node.xpath("prx:check_timestamp").text.to_i),
+ country_code: node.xpath("prx:country_code").text,
+ latency: node.xpath("prx:latency").text.to_i,
+ reliability: node.xpath("prx:reliability").text.to_i,
source: source
}
end
| Rename variables missed after refactor, add additional proxy sources
|
diff --git a/spec/migrations/migrate_pipeline_sidekiq_queues_spec.rb b/spec/migrations/migrate_pipeline_sidekiq_queues_spec.rb
index abc1234..def5678 100644
--- a/spec/migrations/migrate_pipeline_sidekiq_queues_spec.rb
+++ b/spec/migrations/migrate_pipeline_sidekiq_queues_spec.rb
@@ -0,0 +1,50 @@+require 'spec_helper'
+require Rails.root.join('db', 'post_migrate', '20170822101017_migrate_pipeline_sidekiq_queues.rb')
+
+describe MigratePipelineSidekiqQueues, :sidekiq, :redis do
+ include Gitlab::Database::MigrationHelpers
+
+ context 'when there are jobs in the queues' do
+ it 'correctly migrates queue when migrating up' do
+ Sidekiq::Testing.disable! do
+ stubbed_worker(queue: :pipeline).perform_async('Something', [1])
+ stubbed_worker(queue: :build).perform_async('Something', [1])
+
+ described_class.new.up
+
+ expect(sidekiq_queue_length('pipeline')).to eq 0
+ expect(sidekiq_queue_length('build')).to eq 0
+ expect(sidekiq_queue_length('pipeline_default')).to eq 2
+ end
+ end
+
+ it 'correctly migrates queue when migrating down' do
+ Sidekiq::Testing.disable! do
+ stubbed_worker(queue: :pipeline_default).perform_async('Class', [1])
+ stubbed_worker(queue: :pipeline_default).perform_async('Class', [2])
+
+ described_class.new.down
+
+ expect(sidekiq_queue_length('pipeline')).to eq 2
+ expect(sidekiq_queue_length('pipeline_default')).to eq 0
+ end
+ end
+ end
+
+ context 'when there are no jobs in the queues' do
+ it 'does not raise error when migrating up' do
+ expect { described_class.new.up }.not_to raise_error
+ end
+
+ it 'does not raise error when migrating down' do
+ expect { described_class.new.down }.not_to raise_error
+ end
+ end
+
+ def stubbed_worker(queue:)
+ Class.new do
+ include Sidekiq::Worker
+ sidekiq_options queue: queue
+ end
+ end
+end
| Add specs for pipeline sidekiq queues migration
|
diff --git a/Casks/1password-beta.rb b/Casks/1password-beta.rb
index abc1234..def5678 100644
--- a/Casks/1password-beta.rb
+++ b/Casks/1password-beta.rb
@@ -1,6 +1,6 @@ cask :v1 => '1password-beta' do
- version '5.3.BETA-16'
- sha256 '173e337ec6b2636579ce5362401f714b18808daa69e734a35c5615b0cdddf019'
+ version '5.3.BETA-17'
+ sha256 'faa9f98a2b1cddc5a5f7479ae6a3effea8db99e206100fae02566a97a5b8efb8'
url "https://cache.agilebits.com/dist/1P/mac4/1Password-#{version}.zip"
name '1Password'
| Update 1Password.app to version 5.3.BETA-17
|
diff --git a/Casks/rowmote-helper.rb b/Casks/rowmote-helper.rb
index abc1234..def5678 100644
--- a/Casks/rowmote-helper.rb
+++ b/Casks/rowmote-helper.rb
@@ -1,6 +1,6 @@ cask :v1 => 'rowmote-helper' do
- version '3.9.4'
- sha256 'ea0b33ef5e5572892985b6abe07b214efe29483f36a1aa903339b75fb3c3028d'
+ version '4.1.2'
+ sha256 '795359b6c5af08985acd7bffe7665be4c60656a7345c92c2602dd123b54380c2'
url "http://regularrateandrhythm.com/rowmote-pro/rh/rowmote-helper-#{version}.zip"
name 'Rowmote Helper'
| Upgrade Rowmote Helper.app to v4.1.2
change version + sha256
|
diff --git a/lib/document_generator.rb b/lib/document_generator.rb
index abc1234..def5678 100644
--- a/lib/document_generator.rb
+++ b/lib/document_generator.rb
@@ -29,7 +29,6 @@
def generate_spec_helper!
unless File.exist?("spec/spec_helper.rb")
- puts "The file does not exist"
File.open("spec/spec_helper.rb", "a+") do |file|
file.puts "\nrequire 'rack/test'"
end
| Remove puts statement used for debugging
|
diff --git a/lib/brewery_db.rb b/lib/brewery_db.rb
index abc1234..def5678 100644
--- a/lib/brewery_db.rb
+++ b/lib/brewery_db.rb
@@ -14,7 +14,7 @@ extend self
def respond_to?(method, include_private=false)
- client.respond_to?(method, include_private) || super
+ super || client.respond_to?(method, include_private)
end
def method_missing(method, *args, &block)
| Call super first in respond_to?.
|
diff --git a/lib/buoys/link.rb b/lib/buoys/link.rb
index abc1234..def5678 100644
--- a/lib/buoys/link.rb
+++ b/lib/buoys/link.rb
@@ -3,12 +3,17 @@ attr_accessor :text, :options
attr_reader :current
+ CONFIG = {
+ current_class: (Buoys::Config.current_class || 'current'),
+ link_current: (Buoys::Config.link_current || false),
+ }.with_indifferent_access
+
def initialize(text, url, options)
- @text, @_url, @options = text, url, options
+ @text, @_url, @options = text, url, options.with_indifferent_access
end
def mark_as_current!
- options.deep_merge!(class: 'current')
+ options.deep_merge!(class: config[:current_class])
@current = true
end
@@ -23,5 +28,14 @@ def url=(str)
@_url = str
end
+
+ private
+
+ def config
+ override_options = (options.keys & CONFIG.keys).each_with_object({}) {|key, hash|
+ hash[key] = options[key]
+ }
+ CONFIG.merge(override_options)
+ end
end
end
| Use Buoys::Config class to treat configurations
|
diff --git a/lib/tasks/tasks.rake b/lib/tasks/tasks.rake
index abc1234..def5678 100644
--- a/lib/tasks/tasks.rake
+++ b/lib/tasks/tasks.rake
@@ -2,6 +2,7 @@ require 'pry'
require './lib/sequence_base'
require 'dm-core'
+require 'csv'
['lib', 'models'].each do |dir|
Dir.glob(File.join(File.expand_path('../..', File.dirname(File.absolute_path(__FILE__))),dir, '**','*.rb')).each do |file|
@@ -10,17 +11,23 @@ end
desc 'Generate List of All Tests'
-task :all_tests do
+task :tests_to_csv do
- out = SequenceBase.subclasses.map do |klass|
+ flat_tests = SequenceBase.subclasses.map do |klass|
klass.tests.map do |test|
test[:sequence] = klass.to_s
test
end
end.flatten.sort_by { |t| t[:test_index] }
- puts = 'Sequence\tName\tDescription\tUrl"\n'
- puts out.map { |test| "#{test[:sequence]}\t#{test[:name]}\t#{test[:description]}\t#{test[:url]}" }.join("\n")
+ csv_out = CSV.generate do |csv|
+ csv << ['Sequence', 'Name', 'Description', 'Url']
+ flat_tests.each do |test|
+ csv << [ test[:sequence], test[:name], test[:description], test[:url] ]
+ end
+ end
+
+ puts csv_out
end
| Change print from tab delimited to csv.
|
diff --git a/lib/figaro/cli.rb b/lib/figaro/cli.rb
index abc1234..def5678 100644
--- a/lib/figaro/cli.rb
+++ b/lib/figaro/cli.rb
@@ -7,14 +7,14 @@ desc "heroku:set", "Send Figaro configuration to Heroku"
method_option "app",
- aliases: ["a"],
+ aliases: ["-a"],
desc: "Specify a Heroku app"
method_option "environment",
- aliases: ["e"],
+ aliases: ["-e"],
desc: "Specify an application environment",
required: true
method_option "path",
- aliases: ["p"],
+ aliases: ["-p"],
default: "config/application.yml",
desc: "Specify a configuration file path"
| Fix Thor aliases to work for older versions of Thor
…as is required in older versions of Rails (< 3.2).
|
diff --git a/lib/hubert/dsl.rb b/lib/hubert/dsl.rb
index abc1234..def5678 100644
--- a/lib/hubert/dsl.rb
+++ b/lib/hubert/dsl.rb
@@ -1,5 +1,20 @@ module Hubert
module DSL
+ class << self
+ def extended(klass)
+ builders[klass] = Builder.new
+ end
+
+ def builders
+ @builder ||= {}
+ end
+
+ def builder_for(klass)
+ builders.fetch(klass)
+ end
+ end
+
+
def path(path, options = {})
unless options.key?(:as)
fail PathAliasNotSet, 'Please specify ":as" options when calling path method'
@@ -8,7 +23,7 @@ method_name = "#{options[:as]}_path"
define_method(method_name) do |ctx = {}|
- Template.new(path).render(ctx)
+ DSL.builder_for(self.class).path(path, ctx)
end
end
end
| Use Builder object to generate paths
|
diff --git a/lib/patch_mailer_paths.rb b/lib/patch_mailer_paths.rb
index abc1234..def5678 100644
--- a/lib/patch_mailer_paths.rb
+++ b/lib/patch_mailer_paths.rb
@@ -5,5 +5,4 @@ Rails.configuration.to_prepare do
# Add theme templates to the mailer templates (not overriding the defaults).
ActionMailer::Base.append_view_path File.join(File.dirname(__FILE__), "views")
- Rails.logger.debug "patch_mailer_paths.rb: view_paths = #{ActionMailer::Base.view_paths.inspect}"
end
| Remove some very verbose debug logging
|
diff --git a/lib/physeng/simulation.rb b/lib/physeng/simulation.rb
index abc1234..def5678 100644
--- a/lib/physeng/simulation.rb
+++ b/lib/physeng/simulation.rb
@@ -26,7 +26,7 @@ p.move!
rects << [screenx, screeny, 1, 1]
end
- @screen.update_rects *dirty
+ @screen.update_rect 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT
SDL::delay time_to_next_update
@next_update += UPDATE_INTERVAL
end
| Update whole screen instead of just dirty rects
Updating the dirty rects seems to trigger some X error
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.