diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/grid_pattern_editor/command.rb b/lib/grid_pattern_editor/command.rb index abc1234..def5678 100644 --- a/lib/grid_pattern_editor/command.rb +++ b/lib/grid_pattern_editor/command.rb @@ -23,23 +23,23 @@ parser = OptionParser.new parser.on("-w", "--width=WIDTH", - Integer) do |integer| - options[:width] = integer + Integer) do |width| + options[:width] = width end parser.on("-h", "--height=HEIGHT", - Integer) do |integer| - options[:height] = integer + Integer) do |height| + options[:height] = height end parser.on("--columns=NUMBER_OF_COLUMUNS", - Integer) do |integer| - options[:columns] = integer + Integer) do |columns| + options[:columns] = columns end parser.on("--rows=NUMBER_OF_ROWS", - Integer) do |integer| - options[:rows] = integer + Integer) do |rows| + options[:rows] = rows end parser.parse!(arguments)
Fix block local variable names
diff --git a/lib/underglow/rails/environment.rb b/lib/underglow/rails/environment.rb index abc1234..def5678 100644 --- a/lib/underglow/rails/environment.rb +++ b/lib/underglow/rails/environment.rb @@ -1,3 +1,5 @@+require 'pathname' + # Require this file for quick access to Rails environment properties unless defined? Rails # Mock a Rails class that supplies the env and root if it's not defined @@ -9,13 +11,19 @@ def self.root # File.dirname(File.dirname(File.expand_path(__FILE__))) if env == "development" - "/vagrant" if File.exists?("/vagrant") + if File.exists?("/vagrant") + root = "/vagrant" + else + raise Exception, "Couldn't find root!" + end else caller_path = "#{Dir.pwd}/#{caller.last.split(":").first}" # Assume we are using capistrano, so whatever is /*/current would be the root - caller_path.sub(/\/current\/.*/, "/current") + root = caller_path.sub(/\/current\/.*/, "/current") end + + Pathname.new(root) end end end
Return root as a Pathname object
diff --git a/spec/core_ext_spec.rb b/spec/core_ext_spec.rb index abc1234..def5678 100644 --- a/spec/core_ext_spec.rb +++ b/spec/core_ext_spec.rb @@ -19,7 +19,6 @@ end it "should define Kernel.hexdump" do - expect(Kernel).to include(Hexdump::ModuleMethods) - expect(Kernel).to respond_to(:hexdump) + expect(::Kernel).to include(Hexdump::ModuleMethods) end end
Simplify the Kernel core_ext spec.
diff --git a/jekyll-opal.gemspec b/jekyll-opal.gemspec index abc1234..def5678 100644 --- a/jekyll-opal.gemspec +++ b/jekyll-opal.gemspec @@ -17,7 +17,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_runtime_dependency "opal", "~> 0.8.0" + spec.add_runtime_dependency "opal", "~> 0.8" spec.add_development_dependency "bundler", "~> 1.6" spec.add_development_dependency "rake"
Allow using versions of Opal beyond 0.8.x (aka 0.9.x)
diff --git a/lib/github_api/user.rb b/lib/github_api/user.rb index abc1234..def5678 100644 --- a/lib/github_api/user.rb +++ b/lib/github_api/user.rb @@ -9,12 +9,15 @@ return GitHub::Browser.get "/user/show/#{login}" end + def auth_info + {:login => self.login, :token => self.token} + end + def post(login, options = {}) if [:self, :me].include? login login = self.login end - auth_info = {:login => self.login, :token => self.token} - return GitHub::Browser.post "/user/show/#{login}", options.merge(auth_info) + return GitHub::Browser.post "/user/show/#{login}", options.merge(self.auth_info) end end end
Add auth_info hash for User.
diff --git a/lib/hiredis/em/base.rb b/lib/hiredis/em/base.rb index abc1234..def5678 100644 --- a/lib/hiredis/em/base.rb +++ b/lib/hiredis/em/base.rb @@ -15,7 +15,7 @@ def receive_data(data) @reader.feed(data) - while reply = @reader.gets + until (reply = @reader.gets) == false receive_reply(reply) end end
Fix issue with nil replies to eventmachine client
diff --git a/lib/kindle/org_mode.rb b/lib/kindle/org_mode.rb index abc1234..def5678 100644 --- a/lib/kindle/org_mode.rb +++ b/lib/kindle/org_mode.rb @@ -10,7 +10,7 @@ file.puts("\n** Notes \n") book.notes.each do |note| - file.puts(note.content.to_s + "\n") + file.puts(note.content.to_s + "\n\n") end end
Use two newlines after each note
diff --git a/lib/nominatim/place.rb b/lib/nominatim/place.rb index abc1234..def5678 100644 --- a/lib/nominatim/place.rb +++ b/lib/nominatim/place.rb @@ -7,27 +7,45 @@ @attrs = attrs end + # Returns display name + # + # @return [String] def display_name @display_name ||= @attrs[:display_name] end + # Return a class + # + # @return [String] def class @class ||= @attrs[:class] end + # Return a type + # + # @return [String] def type @type ||= @attrs[:type] end + # Return an address + # + # @return [Nominatim::Address] def address @address ||= Nominatim::Address.new(@attrs[:address]) unless @attrs[:address].nil? end + # Return a latitude + # + # @return [Float] def lat point.lat end alias latitude lat + # Return a longitude + # + # @return [Float] def lon point.lon end @@ -42,14 +60,23 @@ @polygonpoints ||= @attrs[:polygonpoints] end + # Return a place id + # + # @return [Integer] def place_id @place_id ||= @attrs[:place_id].to_i if @attrs[:place_id] end + # Return an OSM id + # + # @return [Integer] def osm_id @osm_id ||= @attrs[:osm_id].to_i if @attrs[:osm_id] end + # Return an OSM type + # + # @return [String] def osm_type @osm_type ||= @attrs[:osm_type] end
Add docs to the Place class.
diff --git a/lib/ohm/transaction.rb b/lib/ohm/transaction.rb index abc1234..def5678 100644 --- a/lib/ohm/transaction.rb +++ b/lib/ohm/transaction.rb @@ -2,22 +2,14 @@ module Ohm class Transaction - attr_accessor :observed_keys - attr_accessor :reading_procs - attr_accessor :writing_procs - attr_accessor :before_procs - attr_accessor :after_procs + attr_accessor :blocks def self.define(&block) new.tap(&block) end def initialize(*transactions) - @observed_keys = ::Set.new - @reading_procs = ::Set.new - @writing_procs = ::Set.new - @before_procs = ::Set.new - @after_procs = ::Set.new + @blocks = Hash.new { |h, k| h[k] = ::Set.new } transactions.each do |t| append(t) @@ -25,53 +17,51 @@ end def append(t) - @observed_keys += t.observed_keys - @reading_procs += t.reading_procs - @writing_procs += t.writing_procs - @before_procs += t.before_procs - @after_procs += t.after_procs + t.blocks.each do |key, block| + blocks[key] += block + end end def watch(*keys) - @observed_keys += keys + @blocks[:watch] += keys end def read(&block) - @reading_procs << block + @blocks[:read] << block end def write(&block) - @writing_procs << block + @blocks[:write] << block end def before(&block) - @before_procs << block + @blocks[:before] << block end def after(&block) - @after_procs << block + @blocks[:after] << block end def commit(db) - run(before_procs) + run(blocks[:before]) loop do - if observed_keys.any? - db.watch(*observed_keys) + if blocks[:watch].any? + db.watch(*blocks[:watch]) end - run(reading_procs) + run(blocks[:read]) break if db.multi do - run(writing_procs) + run(blocks[:write]) end end - run(after_procs) + run(blocks[:after]) end def run(procs) procs.each { |p| p.call } end end -end+end
Remove the repetition in Ohm::Transaction - use a #blocks Hash to store all Sets
diff --git a/spec/models/data_import_regression.rb b/spec/models/data_import_regression.rb index abc1234..def5678 100644 --- a/spec/models/data_import_regression.rb +++ b/spec/models/data_import_regression.rb @@ -0,0 +1,24 @@+# encoding: utf-8 +require_relative '../spec_helper' +require 'ruby-debug' + +describe DataImport do + before(:all) do + User.all.each(&:destroy) + @user = create_user(:username => 'test', :email => "client@example.com", :password => "clientex") + @table = create_table :user_id => @user.id + end + + folder = ENV['TEST_FILES'] || File.join(File.dirname(__FILE__), '../support/data/') + Dir[folder + '/*'].each do |file| + it "imports #{file}" do + data_import = DataImport.create( + :user_id => @user.id, + :data_source => '/../'+Pathname.new(file).relative_path_from(Pathname.new(Rails.root.to_s)).to_s, + :updated_at => Time.now + ).run_import! + table = Table[data_import.table_id] + table.should_not be_nil + end + end +end
[importer] Add DataImport model regression test
diff --git a/spec/resources/storage_schema_spec.rb b/spec/resources/storage_schema_spec.rb index abc1234..def5678 100644 --- a/spec/resources/storage_schema_spec.rb +++ b/spec/resources/storage_schema_spec.rb @@ -0,0 +1,29 @@+require "spec_helper" +load_resource("graphite", "storage_schema") + +describe Chef::Resource::GraphiteStorageSchema do + + let(:resource_name) { "theone" } + + it "sets the name attribute to name" do + expect(resource.name).to eq("theone") + end + + it "attribute config defaults to nil" do + expect(resource.config).to be_nil + end + + it "attribute config takes a Hash value" do + resource.config("a" => "b") + + expect(resource.config).to eq("a" => "b") + end + + it "action defaults to :create" do + expect(resource.action).to eq(:create) + end + + it "actions include :delete" do + expect(resource.allowed_actions).to include(:delete) + end +end
Add spec coverage for the graphite_storage_schema resource.
diff --git a/app/overrides/add_product_relation_admin_sub_menu_tab.rb b/app/overrides/add_product_relation_admin_sub_menu_tab.rb index abc1234..def5678 100644 --- a/app/overrides/add_product_relation_admin_sub_menu_tab.rb +++ b/app/overrides/add_product_relation_admin_sub_menu_tab.rb @@ -2,5 +2,5 @@ virtual_path: 'spree/admin/shared/sub_menu/_product', name: 'add_product_relation_admin_sub_menu_tab', insert_bottom: '[data-hook="admin_product_sub_tabs"]', - text: '<%= tab :relation_types, label: Spree::RelationType.model_name.human(count: :many) %>' + text: '<%= tab :relation_types, label: plural_resource_name(Spree::RelationType) %>' )
Fix pluralization of Spree::RelationType model in menu See https://github.com/spree/spree/issues/5842
diff --git a/lib/ahoy/stores/active_record_store.rb b/lib/ahoy/stores/active_record_store.rb index abc1234..def5678 100644 --- a/lib/ahoy/stores/active_record_store.rb +++ b/lib/ahoy/stores/active_record_store.rb @@ -27,7 +27,7 @@ event_model.new do |e| e.id = options[:id] e.visit_id = ahoy.visit_id - e.user = user + e.user = user if e.respond_to?(:user=) e.name = name e.properties = properties e.time = options[:time]
Check if event_model responds to :user=
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.15' + VERSION = '1.0.16.pre' end end # Please be aware that the monkeys like tho throw poo sometimes.
Add .pre for next release
diff --git a/lib/event_store/client/http/request.rb b/lib/event_store/client/http/request.rb index abc1234..def5678 100644 --- a/lib/event_store/client/http/request.rb +++ b/lib/event_store/client/http/request.rb @@ -23,11 +23,8 @@ module Configure def configure(receiver, attr_name=nil, session: nil) attr_name ||= :request - - logger.opt_trace "Configuring request (Receiver: #{receiver})" request = build session: session receiver.send "#{attr_name}=", request - logger.opt_debug "Configured request (Receiver: #{receiver})" request end
Configure methods don't write log messages
diff --git a/lib/go-cda-tools/import/go-importer.rb b/lib/go-cda-tools/import/go-importer.rb index abc1234..def5678 100644 --- a/lib/go-cda-tools/import/go-importer.rb +++ b/lib/go-cda-tools/import/go-importer.rb @@ -18,7 +18,7 @@ def parse_with_ffi(file) data = file.kind_of?(String) ? file : file.to_xml patient_json_string = import_cat1(data) - if patient_json_string.start_with?("Error") + if patient_json_string.start_with?("Import Failed") raise patient_json_string end patient = Record.new(JSON.parse(patient_json_string))
Change error check to new message prefix
diff --git a/lib/json_schema/artesano/tools/null.rb b/lib/json_schema/artesano/tools/null.rb index abc1234..def5678 100644 --- a/lib/json_schema/artesano/tools/null.rb +++ b/lib/json_schema/artesano/tools/null.rb @@ -0,0 +1,31 @@+# +# This tool (strategy) doesn't provide any value. +# Assigns 'nil' to any primitive or enum property. +# + +module JsonSchema + module Artesano + module Tools + class Null + def initialize + end + + def shape_object(material) + material + end + + def shape_array(material) + material + end + + def shape_primitive(material) + nil + end + + def shape_enum(material) + nil + end + end + end + end +end
Add Tools::Null (prof of concept) A strategy that doesn't provide any real value / transformation. Assigns 'nil' to any primitive or enum property for a given schema.
diff --git a/lib/postgresql_tools/schema_creator.rb b/lib/postgresql_tools/schema_creator.rb index abc1234..def5678 100644 --- a/lib/postgresql_tools/schema_creator.rb +++ b/lib/postgresql_tools/schema_creator.rb @@ -7,7 +7,7 @@ def from_sql(file) original_path = @connection.schema_search_path - @connection.create_schema(@schema) + @connection.execute("CREATE SCHEMA IF NOT EXISTS #{@schema}") @connection.schema_search_path = @schema @connection.execute(File.read(file)) ensure
Create schema only if it not exists
diff --git a/backend/app/controllers/spree/admin/prices_controller.rb b/backend/app/controllers/spree/admin/prices_controller.rb index abc1234..def5678 100644 --- a/backend/app/controllers/spree/admin/prices_controller.rb +++ b/backend/app/controllers/spree/admin/prices_controller.rb @@ -29,7 +29,7 @@ def supported_currencies_for_all_stores @supported_currencies_for_all_stores = begin ( - Spree::Store.pluck(:supported_currencies).map { |c| c.split(',') }.flatten + Spree::Store.pluck(:default_currency) + Spree::Store.pluck(:supported_currencies).map { |c| c&.split(',') }.flatten + Spree::Store.pluck(:default_currency) ). compact.uniq.map { |code| ::Money::Currency.find(code.strip) } end
Add safeguard for scenarios where supported_currencies is nil
diff --git a/lib/spree_komoju/controller_helpers.rb b/lib/spree_komoju/controller_helpers.rb index abc1234..def5678 100644 --- a/lib/spree_komoju/controller_helpers.rb +++ b/lib/spree_komoju/controller_helpers.rb @@ -1,5 +1,11 @@ module SpreeKomoju module ControllerHelpers + extend ActiveSupport::Concern + + included do + before_action :add_request_env_to_payments, only: :update + end + def permitted_source_attributes super.push(permitted_komoju_konbini_attributes) super.push(permitted_komoju_banktransfer_attributes) @@ -25,5 +31,9 @@ def permitted_komoju_web_money_attributes [:email, :prepaid_number] end + + def add_request_env_to_payments + @order.payments.each {|payment| payment.request_env = request.headers.env } + end end end
Include request headers in payments
diff --git a/ginger_scenarios.rb b/ginger_scenarios.rb index abc1234..def5678 100644 --- a/ginger_scenarios.rb +++ b/ginger_scenarios.rb @@ -15,13 +15,9 @@ # Rails 3 only works on Ruby 1.8.7 and 1.9.2 if %w[1.8.7 1.9.2].include?(RUBY_VERSION) - if ENV['TEST_RAILS_3_1'] - versions << '3.1.0.rc4' - else - versions << '3.0.8' - end + versions += %w(3.1.1 3.1.0 3.0.8) end - versions += %w( 2.3.8 2.3.5 2.3.4 2.3.3 2.3.2 ) + versions += %w( 2.3.14 2.3.8 2.3.5 2.3.4 2.3.3 2.3.2 ) versions += %w( 2.2.3 2.2.2 2.1.2 2.1.1 2.1.0
Add Rails 3.1.* and 2.3.14 to test suite all pass without nulldb modification
diff --git a/git_tracker.gemspec b/git_tracker.gemspec index abc1234..def5678 100644 --- a/git_tracker.gemspec +++ b/git_tracker.gemspec @@ -14,7 +14,7 @@ EOF gem.add_development_dependency 'rspec', '~> 2.14' - gem.add_development_dependency 'activesupport', '~> 4.0' + gem.add_development_dependency 'activesupport', '~> 3.2' gem.add_development_dependency 'pry', '~> 0.9.11' # Use Rake < 10.2 (requires Ruby 1.9+) until we drop Ruby 1.8.7 support gem.add_development_dependency 'rake', '~> 10.1.1'
Revert newer ActiveSupport - requires Ruby 1.9.3+
diff --git a/lib/xcodeproj/project/xcproj_helper.rb b/lib/xcodeproj/project/xcproj_helper.rb index abc1234..def5678 100644 --- a/lib/xcodeproj/project/xcproj_helper.rb +++ b/lib/xcodeproj/project/xcproj_helper.rb @@ -41,7 +41,7 @@ # def execute(command) output = `#{command} 2>&1` - success = $CHILD_STATUS.exitstatus.zero? + success = $?.exitstatus.zero? [success, output] end
Use $? instead of $CHILD_STATUS
diff --git a/lib/arf/listener.rb b/lib/arf/listener.rb index abc1234..def5678 100644 --- a/lib/arf/listener.rb +++ b/lib/arf/listener.rb @@ -19,12 +19,13 @@ def listen_for_build_completions! Travis::Pro.listen(*repos) do |stream| stream.on 'build:finished' do |event| + puts "Build finished: #{event.build}\t Status: #{event.build.status}" case event when STATUSES[:broken].curry(event.build) Arf::Broken.new(build: event.build) when STATUSES[:fixed].curry(event.repository.recent_builds.to_a[-2]) Arf::Fixed.new(build: event.build) - end.trigger! + end.transmit! end end end
Print some logs, and actually call the correct method
diff --git a/spec/github/api_factory_spec.rb b/spec/github/api_factory_spec.rb index abc1234..def5678 100644 --- a/spec/github/api_factory_spec.rb +++ b/spec/github/api_factory_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Github::ApiFactory do +describe Github::API::Factory do subject(:factory) { described_class }
Fix spec for api factory.
diff --git a/spec/haml_lint/reporter_spec.rb b/spec/haml_lint/reporter_spec.rb index abc1234..def5678 100644 --- a/spec/haml_lint/reporter_spec.rb +++ b/spec/haml_lint/reporter_spec.rb @@ -0,0 +1,13 @@+require 'spec_helper' + +describe HamlLint::Reporter do + let(:reporter) { HamlLint::Reporter.new(double) } + + describe '#display_report' do + subject { reporter.display_report(double) } + + it 'raises an error' do + expect { subject }.to raise_error NotImplementedError + end + end +end
Add spec for Reporter base class
diff --git a/lib/bounding_box.rb b/lib/bounding_box.rb index abc1234..def5678 100644 --- a/lib/bounding_box.rb +++ b/lib/bounding_box.rb @@ -1,7 +1 @@-class BoundingBox - attr_reader :x, :y, :width, :height - - def initialize(x, y, width, height) - @x, @y, @width, @height = [x, y, width, height] - end -end +BoundingBox = Struct.new(:x, :y, :width, :height)
Use a Struct for BoundingBox
diff --git a/spec/provision/dns/ddns_spec.rb b/spec/provision/dns/ddns_spec.rb index abc1234..def5678 100644 --- a/spec/provision/dns/ddns_spec.rb +++ b/spec/provision/dns/ddns_spec.rb @@ -4,7 +4,7 @@ require 'provision/core/machine_spec' class Provision::DNS::DDNS - attr_reader :network, :broadcast, :min_allocation + attr_reader :network, :broadcast, :min_allocation, :max_allocation end describe Provision::DNS::DDNS do @@ -13,6 +13,7 @@ expect(dns.network.to_s).to eq('192.168.1.0') expect(dns.broadcast.to_s).to eq('192.168.1.255') expect(dns.min_allocation.to_s).to eq('192.168.1.10') + expect(dns.max_allocation.to_s).to eq('192.168.1.254') end end
Check we calculate max_allocation correctly
diff --git a/lib/facter/vagrant_jiocloud_network.rb b/lib/facter/vagrant_jiocloud_network.rb index abc1234..def5678 100644 --- a/lib/facter/vagrant_jiocloud_network.rb +++ b/lib/facter/vagrant_jiocloud_network.rb @@ -0,0 +1,32 @@+## +# Custom fact for ipaddress and interface based on network and netmask +# This will help to configure ipaddress and interfaces for various services +# without assuming IP address on specific interface. +# If the machine have 2 nics with network 192.168.0.0/24 and 10.0.0.0/8, this +# code will create facts like below with appropriate values. +# ipaddress_192_168_0_0_24, interface_192_168_0_0_24, +# ipaddress_10.0.0.0_24, interface_10.0.0.0_24 +## +require 'ipaddr' +Facter.value('interfaces').split(',').reject{ |r| r == 'lo' }.each do |iface| + ipaddress = Facter.value('ipaddress_' + iface) + if ipaddress + ## + # converting netmask to cidr, so that providing fact name would be easier + # - rather than typing ipaddress_192_168_0_0_255_255_255_0 just type + # 192_168_0_0_24 (<network>_<cidr>) + ## + cidr = IPAddr.new(Facter.value('netmask_' + iface)).to_i.to_s(2).count("1").to_s + network = Facter.value('network_' + iface).gsub('.', '_') + Facter.add('ipaddress_' + network + '_' + cidr) do + setcode do + ipaddress + end + end + Facter.add('interface_' + network + '_' + cidr) do + setcode do + iface + end + end + end +end
Replace jiocloud_network.rb with this file for vagrant set up
diff --git a/lib/cloudapp_api.rb b/lib/cloudapp_api.rb index abc1234..def5678 100644 --- a/lib/cloudapp_api.rb +++ b/lib/cloudapp_api.rb @@ -1,6 +1,6 @@ require "httparty" require "yaml" unless defined?(YAML) -YAML::ENGINE.yamler = "syck" if defined?(YAML::ENGINE) +YAML::ENGINE.yamler = "syck" if defined?(YAML::ENGINE) && RUBY_VERSION < "2.0.0" ["base", "drop", "account", "gift_card", "client", "multipart", "httparty", "core_ext", "response_error"].each do |inc| require File.join(File.dirname(__FILE__), "cloudapp", inc)
Use syck only on Ruby < 2.0 Inspired by https://github.com/tamc/Slogger/commit/916e3e35598c09991327386256113c9340243a9a
diff --git a/gulp_assets.gemspec b/gulp_assets.gemspec index abc1234..def5678 100644 --- a/gulp_assets.gemspec +++ b/gulp_assets.gemspec @@ -25,7 +25,7 @@ EOF s.license = "MIT" - s.files = Dir["{lib,template}/**/{.,}*", "MIT-LICENSE", "README.md"] + s.files = Dir["{lib,template}/**/{.,}*", "MIT-LICENSE", "README.md"].reject{|p| p.start_with?("template/node_modules")} s.add_runtime_dependency 'rails', '>= 3.1.0' s.add_runtime_dependency "rack-livereload", "~> 0.3.16"
Fix gemspec not to include node_modules
diff --git a/lib/stack_master/parameter_resolver.rb b/lib/stack_master/parameter_resolver.rb index abc1234..def5678 100644 --- a/lib/stack_master/parameter_resolver.rb +++ b/lib/stack_master/parameter_resolver.rb @@ -37,7 +37,7 @@ begin @resolvers[class_name] = Kernel.const_get("StackMaster::ParameterResolvers::#{class_name}").new(@config, @stack_definition) rescue NameError - raise ResolverNotFound, class_name + raise ResolverNotFound, "Could not find parameter resolver for #{class_name}, please double check your configuration" end end end
Add an easier to understand error message... ...when the parameter resolver can not be found.
diff --git a/lib/versionator/detector/phpmyadmin.rb b/lib/versionator/detector/phpmyadmin.rb index abc1234..def5678 100644 --- a/lib/versionator/detector/phpmyadmin.rb +++ b/lib/versionator/detector/phpmyadmin.rb @@ -17,7 +17,9 @@ set :newest_version_regexp, /^Download (.+)$/ def project_url_for_version(version) - if version >= Versionomy.parse('3.3.9') + if version < Versionomy.parse('3.3.9') + "http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/#{version}/phpMyAdmin-#{version}-notes.html/view" + elsif Versionomy.parse('3.3.9') <= version && version < Versionomy.parse('3.4.7.1') "http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/#{version}/phpMyAdmin-#{version}.html/view" else "http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/#{version}/phpMyAdmin-#{version}-notes.html/view"
Fix release links for phpMyAdmin.
diff --git a/mongo_mapper_acts_as_versioned.gemspec b/mongo_mapper_acts_as_versioned.gemspec index abc1234..def5678 100644 --- a/mongo_mapper_acts_as_versioned.gemspec +++ b/mongo_mapper_acts_as_versioned.gemspec @@ -17,7 +17,6 @@ gem.files = Dir['{lib,spec}/**/*', 'LICENSE', 'README.md'] & `git ls-files -z`.split("\0") - gem.add_runtime_dependency 'mongo_mapper' gem.add_development_dependency 'rspec' gem.required_rubygems_version = '>= 1.3.6' end
Remove MM dependency from gemspec
diff --git a/simple-conf.gemspec b/simple-conf.gemspec index abc1234..def5678 100644 --- a/simple-conf.gemspec +++ b/simple-conf.gemspec @@ -4,9 +4,9 @@ Gem::Specification.new do |gem| gem.authors = ["Alexander Korsak"] gem.email = ["alex.korsak@gmail.com"] - gem.description = %q{TODO: Write a gem description} - gem.summary = %q{TODO: Write a gem summary} - gem.homepage = "" + gem.description = "Simple configuration library for yml files for loading from the config folder" + gem.summary = "Simple configuration library for yml files for loading from the config folder" + gem.homepage = "http://github.com/oivoodoo/simple-conf/" gem.files = `git ls-files`.split($\) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
Add description to the gemspec for the gem
diff --git a/lib/saves/config.rb b/lib/saves/config.rb index abc1234..def5678 100644 --- a/lib/saves/config.rb +++ b/lib/saves/config.rb @@ -0,0 +1,23 @@+module Saves + class Config + class << self + def games_list + return @games_list if @games_list + + games_list = config_file('games.yml') + @games_list = YAML.load_file(games_list) + end + + private + + def config_dir + root_path = File.expand_path(File.join(__FILE__, '..', '..', '..')) + File.join(root_path, 'config') + end + + def config_file(config_file) + File.expand_path File.join(config_dir, config_file) + end + end + end +end
Add the Configuration code layer
diff --git a/config/unicorn_local.rb b/config/unicorn_local.rb index abc1234..def5678 100644 --- a/config/unicorn_local.rb +++ b/config/unicorn_local.rb @@ -0,0 +1,29 @@+# see https://raw.github.com/defunkt/unicorn/master/examples/unicorn.conf.rb + +APP_PATH = File.expand_path File.join(File.dirname(__FILE__), '..') +def app_path(local_path) + File.join APP_PATH, local_path +end + +listen app_path("tmp/sockets/unicorn.sock") + +worker_processes 3 + +pid app_path("tmp/pids/unicorn.pid") + +stdout_path app_path("log/unicorn.log") +stderr_path app_path("log/unicorn.log") + +preload_app true + +before_fork do |server, worker| + # the following is highly recomended for Rails + "preload_app true" + # as there's no need for the master process to hold a connection + defined?(ActiveRecord::Base) and + ActiveRecord::Base.connection.disconnect! +end + +after_fork do |server, worker| + defined?(ActiveRecord::Base) and + ActiveRecord::Base.establish_connection +end
Add configuration for local Unicorn/Nginx setip
diff --git a/csv_class_maker.gemspec b/csv_class_maker.gemspec index abc1234..def5678 100644 --- a/csv_class_maker.gemspec +++ b/csv_class_maker.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = %q{csv_class_maker} - s.version = '0.2.0' + s.version = '0.2.1' s.date = %q{2014-03-06} s.authors = ['Mark Platt'] s.email = 'mplatt@mrkplt.com'
Update gemspec file This is why you do features and changes in branches.
diff --git a/motion-rest.gemspec b/motion-rest.gemspec index abc1234..def5678 100644 --- a/motion-rest.gemspec +++ b/motion-rest.gemspec @@ -7,20 +7,12 @@ spec.name = "motion-rest" spec.version = Motion::Rest::VERSION spec.authors = ["Andrew Havens"] - spec.email = ["andrewh@copiousinc.com"] + spec.email = ["email@andrewhavens.com"] - spec.summary = %q{TODO: Write a short summary, because Rubygems requires one.} - spec.description = %q{TODO: Write a longer description or delete this line.} - spec.homepage = "TODO: Put your gem's website or public repo URL here." + spec.summary = %q{A RubyMotion model framework for RESTful JSON APIs.} + # spec.description = %q{TODO: Write a longer description or delete this line.} + spec.homepage = "https://github.com/andrewhavens/motion-rest" spec.license = "MIT" - - # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or - # delete this section to allow pushing this gem to any host. - if spec.respond_to?(:metadata) - spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'" - else - raise "RubyGems 2.0 or newer is required to protect against public gem pushes." - end spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } spec.bindir = "exe"
Update summary and other metadata
diff --git a/src/make_new_entry.rb b/src/make_new_entry.rb index abc1234..def5678 100644 --- a/src/make_new_entry.rb +++ b/src/make_new_entry.rb @@ -0,0 +1,44 @@+################################################################################ +#This program will connect to a world model at a user-provided address and port +#and push a sensor entry into it. For use with the gwt owl demo. +################################################################################ + +#Require rubygems for old (pre 1.9 versions of Ruby and Debian-based systems) +require 'rubygems' +require 'solver_world_model' +require 'wm_data' +require 'buffer_manip' + +if (ARGV.length != 6) + puts "This program needs six arguments." + puts "The ip address and solver port a world model to connect to" + puts "and a username for the solver connection" + puts "The next three arguments are the full demo object name," + puts "a sensor ID (in decimal), and a dislay name of a pip to add" + puts "to the demo page." + exit +end + +wmip = ARGV[0] +solver_port = ARGV[1].to_i +username = ARGV[2] + +wmid = ARGV[3] +sensorid = ARGV[4].to_i +displayname = ARGV[5] + + +#The third argument is the origin name, which should be your solver or +#client's name +swm = SolverWorldModel.new(wmip, solver_port, username) +#All data is given a timestamp in milliseconds. The getMsecTime function is in the wm_data file. +datatime = getMsecTime() + +#Physical layer 1 plus the ID for the sensor attribute +attribs = [WMAttribute.new('sensor', [0x01].pack('C') + packuint128(sensorid), datatime), + WMAttribute.new('displayName', strToUnicode(displayname), datatime)] +#Making a world model data entry with these attributes +data_a = WMData.new(wmid, attribs) + +swm.pushData([data_a], true) +
Add a new entry into the world model, for example with the gtk demo. new file: make_new_entry.rb
diff --git a/app/controllers/api/docs_controller.rb b/app/controllers/api/docs_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/docs_controller.rb +++ b/app/controllers/api/docs_controller.rb @@ -14,6 +14,9 @@ def get_url_query_parameters_for(section) case section when :Agendas + { + committee_id: "Search for an Agenda by their Committee ID" + } when :Councillors { ward_id: "Display the councillor who is representing this ward",
Add URL Query Help Text For Agendas In API Docs
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 @@ -2,7 +2,7 @@ USER_KEY = :user TEXT_KEY = :text TIMESTAMP_KEY = :timestamp - MAX_COMMENTS_TO_LOAD = 200 + MAX_COMMENTS_TO_LOAD = 150 def create fail ArgumentError, 'Incorrect post submitted' unless params.key?(:request) @@ -17,11 +17,11 @@ def show comments = [] - Comment.limit(MAX_COMMENTS_TO_LOAD).order('id asc').each do |c| + Comment.order('id desc').limit(MAX_COMMENTS_TO_LOAD).each do |c| tmp = c.as_json tmp[TIMESTAMP_KEY] = c[TIMESTAMP_KEY].to_f * 1000 tmp['user_name'] = User.find(c['user_id']).name - comments.push(tmp) + comments.unshift(tmp) #Ensure earlier comments appear at top end render json: comments end
Fix comments not appearing properly when you have more than the max comments amount
diff --git a/app/controllers/services_controller.rb b/app/controllers/services_controller.rb index abc1234..def5678 100644 --- a/app/controllers/services_controller.rb +++ b/app/controllers/services_controller.rb @@ -16,7 +16,7 @@ end def create - @service = Service.new(params.require(:service).permit(:service_type, :name)) + @service = Service.new(params.require(:service).permit(:service_type, :name, :hosted, :port)) if @service.save StartServiceJob.perform_later(@service) redirect_to services_path
Allow saving of port and hosted bool
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -11,7 +11,9 @@ else flash[:error] = "You need a codescool.com or envylabs.com account to sign in." end - redirect_to( session["return_to"] || root_url ) + # OmniAuth automaticall saves the HTTP_REFERER when you begin the auth process + # Oh my dog, so nice, right? + redirect_to( request.env['omniauth.origin'] || root_url ) end def destroy
Fix OAuth callback triggering of return_to.
diff --git a/tasks/local.rake b/tasks/local.rake index abc1234..def5678 100644 --- a/tasks/local.rake +++ b/tasks/local.rake @@ -10,7 +10,7 @@ argv = ARGV[1..-1] # If it's a rails command, or we're using Rails 5, auto add the rails script - rails_commands = %w(generate console server dbconsole g c s runner) + rails_commands = %w(generate console server db dbconsole g c s runner) if Rails::VERSION::MAJOR >= 5 || rails_commands.include?(argv[0]) argv.unshift('rails')
Add db to rails_commands list
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,8 +4,8 @@ require 'simplecov' SimpleCov.start unless ENV['skip_coverage'] - # require "codeclimate-test-reporter" - # CodeClimate::TestReporter.start if ENV['CODECLIMATE_REPO_TOKEN'] + require "codeclimate-test-reporter" + CodeClimate::TestReporter.start if ENV['CODECLIMATE_REPO_TOKEN'] require 'coveralls' Coveralls.wear!
Revert "Temporarily disable CodeClimate test reporting to see if thats " This reverts commit 05df6ebadbcb51e959f5fad3f015667a3b189524.
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -23,8 +23,6 @@ options = Net::SSH::Config.for(host) -options[:user] ||= Etc.getlogin - set :host, options[:host_name] || host # Get HostName and User value from Env Vars if available
Fix ssh user issue with helper script
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -10,11 +10,6 @@ def run_erl(code) cmd = %Q{erl -noshell -eval "A = #{code.split.join(' ')}, io:put_chars(binary_to_list(A))." -s erlang halt} `#{cmd}` - end - - def encode_packet(code) - bin = run_erl("term_to_binary(#{code})") - [bin.length, bin].pack("Na#{bin.length}") end def word_length
Remove dead test helper method.
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,6 +6,7 @@ require 'timecop' ENV['ES_URL'] = nil +ENV['TZ'] = 'Europe/Amsterdam' # Test in a specific timezone. RSpec.configure do |config| config.order = 'random'
Fix the timezone for the specs. We test in a specific timezone.
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,3 +8,4 @@ require "lita-wikipedia" require "lita/rspec" +Lita.version_3_compatibility_mode = false
Disable Lita v3 compatibility mode
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -13,6 +13,10 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'libraries')) # Require all our libraries -Dir["#{File.join(File.dirname(__FILE__), '..', 'libraries')}/*.rb"].each { |f| require File.expand_path(f) } +require "#{File.join(File.dirname(__FILE__), '..', 'libraries')}/helpers.rb" +require "#{File.join(File.dirname(__FILE__), '..', 'libraries')}/loader.rb" +require "#{File.join(File.dirname(__FILE__), '..', 'libraries')}/load_balancer.rb" +Dir["#{File.join(File.dirname(__FILE__), '..', 'libraries')}/resource_*.rb"].each { |f| require File.expand_path(f) } +Dir["#{File.join(File.dirname(__FILE__), '..', 'libraries')}/provider_*.rb"].each { |f| require File.expand_path(f) } at_exit { ChefSpec::Coverage.report! }
Load libraries in specific order for Travis CI
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -17,8 +17,3 @@ config.before { Rapporteur.clear_checks } end - - -# This is a shim to allow for Ruby 1.9.3, Rails 3.2 testing to pass. -# See https://github.com/rspec/rspec-rails/issues/1171. -Test::Unit.run = true if defined?(Test::Unit) && Test::Unit.respond_to?(:run=)
Remove Ruby 1.9.3, Rails 3.2 Test::Unit shim.
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,14 +5,17 @@ require 'rspec' require 'openreqs' -set :environment, :test +configure do + set :mongo, Mongo::Connection.new.db("openreqs-test") +end + Capybara.app = Sinatra::Application RSpec.configure do |config| config.before(:all) do @db = Capybara.app.mongo - @db.connection.drop_database("openreqs") + @db.connection.drop_database(@db.name) @docs, @requirements = @db["docs"], @db["requirements"] end end
Use a different db for the tests
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,11 +6,11 @@ ENV['RAILS_ENV'] = 'test' ENV['BUNDLE_GEMFILE'] ||= TESTAPP_ROOT + '/Gemfile' +require "#{TESTAPP_ROOT}/config/environment" require 'rspec' require 'bourne' require 'shoulda-matchers' require 'rspec/rails' -require "#{TESTAPP_ROOT}/config/environment" PROJECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')).freeze
Rearrange requires such that tests pass.
diff --git a/lib/pact_broker/api/decorators/version_decorator.rb b/lib/pact_broker/api/decorators/version_decorator.rb index abc1234..def5678 100644 --- a/lib/pact_broker/api/decorators/version_decorator.rb +++ b/lib/pact_broker/api/decorators/version_decorator.rb @@ -9,14 +9,6 @@ property :number collection :tags, embedded: true, :extend => PactBroker::Api::Decorators::EmbeddedTagDecorator - - link :self do | options | - { - title: 'Version', - name: represented.number, - href: version_url(options.fetch(:base_url), represented) - } - end link :self do | options | {
Remove duplicate :self block in VersionDecorator.
diff --git a/syntax.gemspec b/syntax.gemspec index abc1234..def5678 100644 --- a/syntax.gemspec +++ b/syntax.gemspec @@ -9,7 +9,7 @@ s.homepage = "https://github.com/dblock/syntax" s.license = "BSD" - s.add_development_dependency "rake" + s.add_development_dependency "rake", "< 11.0.0" s.add_development_dependency "rake-contrib" s.add_development_dependency "rdoc" s.add_development_dependency "test-unit"
Use an old rake release for 1.9.2 and 1.8.7
diff --git a/omnibus-ctl.gemspec b/omnibus-ctl.gemspec index abc1234..def5678 100644 --- a/omnibus-ctl.gemspec +++ b/omnibus-ctl.gemspec @@ -13,6 +13,7 @@ s.required_ruby_version = ">= 2.6" + s.add_development_dependency "chefstyle", "2.0.9" s.add_development_dependency "rake" s.add_development_dependency "rspec", "~> 3.2" s.add_development_dependency "rspec_junit_formatter"
Add chefstyle as a dep Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/test/db/mssql.rb b/test/db/mssql.rb index abc1234..def5678 100644 --- a/test/db/mssql.rb +++ b/test/db/mssql.rb @@ -1,9 +1,9 @@-host = ENV['SQLHOST'] || 'localhost' config = { :username => 'blog', :password => '', :adapter => 'mssql', :database => 'weblog_development' } +config[:host] = ENV['SQLHOST'] if ENV['SQLHOST'] ActiveRecord::Base.establish_connection( config )
Allow override of host where sqlserver is running through ENV['SQLHOST']
diff --git a/app/controllers/api/docs_controller.rb b/app/controllers/api/docs_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/docs_controller.rb +++ b/app/controllers/api/docs_controller.rb @@ -10,8 +10,8 @@ key :description, 'Prometheus 2.0 API documentation.' end key :schemes, ['http'] - # key :host, 'packages.altlinux.org' - key :host, 'localhost:3000' + key :host, 'packages.altlinux.org' + # key :host, 'localhost:3000' key :basePath, '/api' key :consumes, %w(application/json) key :produces, %w(application/json)
Change api url to production
diff --git a/app/controllers/api/tags_controller.rb b/app/controllers/api/tags_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/tags_controller.rb +++ b/app/controllers/api/tags_controller.rb @@ -1,4 +1,3 @@-require 'byebug' class Api::TagsController < ApplicationController before_action :ensure_logged_in
Remove byebug from tags controller
diff --git a/test/template.rb b/test/template.rb index abc1234..def5678 100644 --- a/test/template.rb +++ b/test/template.rb @@ -12,6 +12,9 @@ gem 'mysql2' gem 'nokogiri' gem 'sassc' +gem 'google-protobuf' +gem 'ox' +gem 'oj' # Ensure that git works gem 'currencies', git: 'https://github.com/hexorx/currencies.git', tag: 'v0.4.3'
Add ox, oj and google-protobuf to tested gems
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,7 +1,11 @@ class SessionsController < ApplicationController def show - user = User.find(session[:user_id]) - render json: {sessionID: user.id, userName: user.name } + if session[:user_id] + user = User.find(session[:user_id]) + render json: {sessionID: user.id, userName: user.name } + else + render json: {sessionID: nil} + end end def create
Refactor session controller to not use session if it doesn't exist
diff --git a/tabulo.gemspec b/tabulo.gemspec index abc1234..def5678 100644 --- a/tabulo.gemspec +++ b/tabulo.gemspec @@ -29,5 +29,4 @@ spec.add_development_dependency "simplecov" spec.add_development_dependency "coveralls" spec.add_development_dependency "yard" - spec.add_development_dependency "yard-tomdoc" end
Remove unused development dependency (yard-tomdoc).
diff --git a/app/helpers/defence_requests_helper.rb b/app/helpers/defence_requests_helper.rb index abc1234..def5678 100644 --- a/app/helpers/defence_requests_helper.rb +++ b/app/helpers/defence_requests_helper.rb @@ -14,7 +14,7 @@ "tomorrow" elsif initial_date < today "in_past" - elsif + else "after_tomorrow" end [today, tomorrow, initial_date, initial_date_type]
Fix date chooser helper - broken `if` statement.
diff --git a/lib/bouncer/preemptive_rules.rb b/lib/bouncer/preemptive_rules.rb index abc1234..def5678 100644 --- a/lib/bouncer/preemptive_rules.rb +++ b/lib/bouncer/preemptive_rules.rb @@ -10,9 +10,9 @@ def self.try(context, renderer) request = context.request if request.host == 'www.environment-agency.gov.uk' - if request.non_canonicalised_fullpath =~ %r{^/homeandleisure/floods/riverlevels/(.*)$} + if request.non_canonicalised_fullpath =~ %r{^/homeandleisure/floods/riverlevels/(.*)$}i redirect("http://apps.environment-agency.gov.uk/river-and-sea-levels/#{$1}") - elsif request.non_canonicalised_fullpath =~ %r{^/homeandleisure/floods/((cy/)?(34678|34681|147053)\.aspx(\?.*)?)$} + elsif request.non_canonicalised_fullpath =~ %r{^/homeandleisure/floods/((cy/)?(34678|34681|147053)\.aspx(\?.*)?)$}i redirect("http://apps.environment-agency.gov.uk/flood/#{$1}") end end
Make EA rules case insensitive
diff --git a/temple.gemspec b/temple.gemspec index abc1234..def5678 100644 --- a/temple.gemspec +++ b/temple.gemspec @@ -21,4 +21,5 @@ # can be used without it. s.add_development_dependency('tilt') s.add_development_dependency('bacon') + s.add_development_dependency('rake') end
Add rake as development dependency
diff --git a/lib/ardes/rc_responses_module.rb b/lib/ardes/rc_responses_module.rb index abc1234..def5678 100644 --- a/lib/ardes/rc_responses_module.rb +++ b/lib/ardes/rc_responses_module.rb @@ -1,14 +1,24 @@ module Ardes - # Just like ResponsesModule, but also handles the :except, :only stuff + # Just like ResponsesModule, but also handles the :except, :only options module RcResponsesModule - include Ardes::ResponsesModule include Ardes::ResourcesController::IncludeActions + def self.extended(mixin) + mixin.extend Ardes::ResponsesModule + end + # as well as undefing an exlcuded action from the dup mixin, we - # also remove it's response - def remove_action(action) + # also remove its response + def remove_action_method(action) undef_method action remove_response_for action + end + + # when we dup, we need to copy our action_responses + def dup + returning super do |mixin| + mixin.instance_variable_set('@action_responses', action_responses.dup) + end end end end
Make sure we dup our action_responses when the module is dup'd
diff --git a/lib/pod/command/dependencies.rb b/lib/pod/command/dependencies.rb index abc1234..def5678 100644 --- a/lib/pod/command/dependencies.rb +++ b/lib/pod/command/dependencies.rb @@ -32,7 +32,7 @@ config.podfile, @ignore_lockfile ? nil : config.lockfile ) - specs = analyzer.analyze(false).specs_by_target.values.flatten(1) + specs = analyzer.analyze(true).specs_by_target.values.flatten(1) lockfile = Lockfile.generate(config.podfile, specs) pods = lockfile.to_hash['PODS'] end
Allow analyzer to fetch external specs
diff --git a/lib/rails_admin/config/proxy.rb b/lib/rails_admin/config/proxy.rb index abc1234..def5678 100644 --- a/lib/rails_admin/config/proxy.rb +++ b/lib/rails_admin/config/proxy.rb @@ -2,7 +2,7 @@ module Config class Proxy - instance_methods.each { |m| undef_method m unless m =~ /^__/ || m == "object_id" } + instance_methods.each {|m| undef_method m unless m =~ /^(__|instance_eval|object_id)/ } attr_reader :bindings
Fix warning about undefining object_id in the Proxy class
diff --git a/lib/range_sentence_validator.rb b/lib/range_sentence_validator.rb index abc1234..def5678 100644 --- a/lib/range_sentence_validator.rb +++ b/lib/range_sentence_validator.rb @@ -9,6 +9,6 @@ # validates :year_sentence, :range_sentence => true # end def validate_each(record, attribute, value) - record.errors.add(attribute) if RangeSentenceParser.new(value).invalid? + record.errors.add(attribute) if RangeSentenceParser.invalid?(value) end end
Use RangeSentenceParser.invalid? instead of instance method
diff --git a/lib/devise/models/validatable.rb b/lib/devise/models/validatable.rb index abc1234..def5678 100644 --- a/lib/devise/models/validatable.rb +++ b/lib/devise/models/validatable.rb @@ -12,14 +12,18 @@ def self.included(base) base.class_eval do + attribute = authentication_keys.first - validates_presence_of :email - validates_uniqueness_of :email, :allow_blank => true - validates_format_of :email, :with => EMAIL_REGEX, :allow_blank => true + validates_presence_of attribute + validates_uniqueness_of attribute, :allow_blank => true + validates_format_of attribute, :with => EMAIL_REGEX, :allow_blank => true, + :scope => authentication_keys[1..-1] - validates_presence_of :password, :if => :password_required? - validates_confirmation_of :password, :if => :password_required? - validates_length_of :password, :within => 6..20, :allow_blank => true, :if => :password_required? + with_options :if => :password_required? do |v| + v.validates_presence_of :password + v.validates_confirmation_of :password + v.validates_length_of :password, :within => 6..20, :allow_blank => true + end end end
Make validations based on authentication keys.
diff --git a/lib/siebel_donations/address.rb b/lib/siebel_donations/address.rb index abc1234..def5678 100644 --- a/lib/siebel_donations/address.rb +++ b/lib/siebel_donations/address.rb @@ -7,7 +7,7 @@ def type case @type - when 'Mailing Address' + when 'Mailing Address', 'Ship To', 'Ma', 'Mailng', 'M', 'Billing', 'Mailin', 'Mailig' 'Mailing' else @type
Add more data corrections for bad Siebel data
diff --git a/lib/smart_api/params_handler.rb b/lib/smart_api/params_handler.rb index abc1234..def5678 100644 --- a/lib/smart_api/params_handler.rb +++ b/lib/smart_api/params_handler.rb @@ -36,7 +36,7 @@ end class Parameters < Struct.new(:values, :errors) - delegate :has_key?, :==, :[], :to_hash, :to => :values + delegate :slice, :except, :has_key?, :==, :[], :to_hash, :to => :values end end end
Add slice/except to parameters class
diff --git a/test/helper.rb b/test/helper.rb index abc1234..def5678 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -6,22 +6,34 @@ require 'json' def test_site - @site ||= UsesThis::Site.new(Dimples::Configuration.new( + @test_site ||= UsesThis::Site.new(test_configuration) +end + +def test_configuration + @test_configuration ||= Dimples::Configuration.new( 'source_path' => File.join(__dir__, 'source'), - 'destination_path' => File.join(File::SEPARATOR, 'tmp', 'site', "usesthis-#{Time.new.to_i}"), + 'destination_path' => temp_site_path, 'class_overrides' => { 'site' => 'UsesThis::Site', 'post' => 'UsesThis::Interview' } - )) + ) +end + +def temp_site_path + File.join(File::SEPARATOR, 'tmp', "usesthis-#{Time.new.to_i}") +end + +def test_interview + @test_interview ||= read_fixture('interview') end def read_api_file(path = nil) path = File.join(test_site.output_paths[:site], 'api', path, 'index.json') - JSON.load(File.read(path)) + JSON.parse(File.read(path)) end def read_fixture(name) path = File.join(__dir__, 'fixtures', "#{name}.json") - JSON.load(File.read(path)) + JSON.parse(File.read(path)) end
Add a test_configuration, temp_site_path and test_interview method, switch to JSON.parse.
diff --git a/test/helper.rb b/test/helper.rb index abc1234..def5678 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -7,7 +7,6 @@ rescue LoadError end -require "rubygems" require "cutest" def silence_warnings
Remove rubygems require. Ohm supports Ruby >=1.9.
diff --git a/test/helper.rb b/test/helper.rb index abc1234..def5678 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -12,8 +12,8 @@ if RUBY_VERSION =~ /^1.9/ begin require 'turn/autorun' - f = ENV['format'] - Turn.config.format = f.to_sym + # f = ENV['format'] || 'progress' + # Turn.config.format = f.to_sym if f rescue LoadError end end
Remove automatic progress so 'turn' command line util will work
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/rubocop/cop/favor_sprintf.rb b/lib/rubocop/cop/favor_sprintf.rb index abc1234..def5678 100644 --- a/lib/rubocop/cop/favor_sprintf.rb +++ b/lib/rubocop/cop/favor_sprintf.rb @@ -15,10 +15,12 @@ next unless matching?(operator, op1, op2) # FIXME implement reliable lineno extraction + # we either have some string literal if op1[0] == :string_literal lineno_struct = s[1][1][1][2] lineno = lineno_struct.lineno if lineno_struct.respond_to?(:lineno) else + # or some identifier lineno_struct = s[1][1][2] lineno = lineno_struct.lineno if lineno_struct.respond_to?(:lineno) end
Add a bit of explanation to FavorSprintf
diff --git a/lib/tassadar/server/whitelist.rb b/lib/tassadar/server/whitelist.rb index abc1234..def5678 100644 --- a/lib/tassadar/server/whitelist.rb +++ b/lib/tassadar/server/whitelist.rb @@ -11,8 +11,8 @@ @app.call(env) else [ 403, - {'Content-Type' => 'text/plain; charset=utf-8'}, - 'IP is not whitelisted' + { 'Content-Type' => 'text/plain; charset=utf-8' }, + Array( 'IP is not whitelisted' ) ] end end
Fix the same issue rack-throttle had
diff --git a/lib/yahoo_quote/configuration.rb b/lib/yahoo_quote/configuration.rb index abc1234..def5678 100644 --- a/lib/yahoo_quote/configuration.rb +++ b/lib/yahoo_quote/configuration.rb @@ -2,9 +2,13 @@ class Configuration def self.cache_dir=(path) - dir = path.to_s - Dir.mkdir(dir) unless dir.empty? || File.directory?(dir) - @@cache_dir = dir + if !path + @@cache_dir = path + else + dir = path.to_s + Dir.mkdir(dir) unless dir.empty? || File.directory?(dir) + @@cache_dir = dir + end end def self.cache_dir
Fix case path = nil
diff --git a/parallel_rspec.gemspec b/parallel_rspec.gemspec index abc1234..def5678 100644 --- a/parallel_rspec.gemspec +++ b/parallel_rspec.gemspec @@ -21,5 +21,4 @@ spec.add_dependency "rake", "> 10.0" spec.add_dependency "rspec" - spec.add_development_dependency "bundler", "~> 1.10" end
Remove an unnecessary dev dependency to pacify dependabot
diff --git a/lib/did_you_mean/core_ext/name_error.rb b/lib/did_you_mean/core_ext/name_error.rb index abc1234..def5678 100644 --- a/lib/did_you_mean/core_ext/name_error.rb +++ b/lib/did_you_mean/core_ext/name_error.rb @@ -12,7 +12,9 @@ def to_s msg = original_message - msg << did_you_mean?.to_s if IGNORED_CALLERS.all? {|ignored| caller.first(8).grep(ignored).empty? } + bt = caller.first(6) + + msg << did_you_mean?.to_s if IGNORED_CALLERS.all? {|ignored| bt.grep(ignored).empty? } msg rescue original_message
Reduce memory allocation by about 40% https://gist.github.com/yuki24/5025a7b8603c25dcdd89/d3c11b614c06aa0fc1193f252960ecfb8a0c368a
diff --git a/core/app/models/calculator/per_item.rb b/core/app/models/calculator/per_item.rb index abc1234..def5678 100644 --- a/core/app/models/calculator/per_item.rb +++ b/core/app/models/calculator/per_item.rb @@ -10,7 +10,7 @@ ShippingMethod.register_calculator(self) end - def compute(line_items=nil) - self.preferred_amount * line_items.length + def compute(object=nil) + self.preferred_amount * object.line_items.length end end
Revert "Fix error in PerItem calculator" This reverts commit 5f270b7ad263859c2da75f72ff0405e4ab1e770b.
diff --git a/lib/github-pages.rb b/lib/github-pages.rb index abc1234..def5678 100644 --- a/lib/github-pages.rb +++ b/lib/github-pages.rb @@ -13,8 +13,8 @@ "rdiscount" => "2.1.7", "redcarpet" => "2.3.0", "RedCloth" => "4.2.9", - "jemoji" => "0.0.10", - "jekyll-mentions" => "0.0.5", + "jemoji" => "0.1.0", + "jekyll-mentions" => "0.0.6", "jekyll-redirect-from" => "0.3.1", } end
Update jemoji and jekyll-mentions dependencies to allow for Jekyll 1.5.0
diff --git a/lib/jiraSOAP/url.rb b/lib/jiraSOAP/url.rb index abc1234..def5678 100644 --- a/lib/jiraSOAP/url.rb +++ b/lib/jiraSOAP/url.rb @@ -5,6 +5,7 @@ # URI object if you are running on CRuby, but it will be an NSURL if you # are running on MacRuby. class URL + # @return [NSURL, URI::HTTP] the type depends on your RUBY_ENGINE attr_accessor :url # Initializes @url with the correct object type.
Document the type for the URL class' only attribute
diff --git a/app/helpers/assets_helper.rb b/app/helpers/assets_helper.rb index abc1234..def5678 100644 --- a/app/helpers/assets_helper.rb +++ b/app/helpers/assets_helper.rb @@ -1,9 +1,9 @@ module AssetsHelper - def render_asset(asset,custom_class) + def render_asset(asset, custom_class=nil) case(asset.mime.split('/').first) when 'image' - content_tag(:img, nil, src: asset.url, alt: asset.alt, title: asset.title, class: 'media-object '+custom_class) + content_tag(:img, nil, src: asset.url, alt: asset.alt, title: asset.title, class: ['media-object', custom_class].join(' ')) else link_to asset.url, asset.url end
Make custom_class optional in render_asset helper
diff --git a/lib/rspec/sidekiq/matchers/be_unique.rb b/lib/rspec/sidekiq/matchers/be_unique.rb index abc1234..def5678 100644 --- a/lib/rspec/sidekiq/matchers/be_unique.rb +++ b/lib/rspec/sidekiq/matchers/be_unique.rb @@ -17,7 +17,15 @@ def matches?(job) @klass = job.is_a?(Class) ? job : job.class @actual = @klass.get_sidekiq_options[unique_key] - [true, :all].include?(@actual) + valid_value? + end + + def valid_value? + if sidekiq_enterprise? + @actual > 0 + elsif sidekiq_unique_jobs? + [true, :all].include?(@actual) + end end def unique_key
Verify the value based on which uniquing type is available
diff --git a/lib/salesforce_bulk/salesforce_error.rb b/lib/salesforce_bulk/salesforce_error.rb index abc1234..def5678 100644 --- a/lib/salesforce_bulk/salesforce_error.rb +++ b/lib/salesforce_bulk/salesforce_error.rb @@ -9,10 +9,18 @@ def initialize(response) self.response = response - data = XmlSimple.xml_in(response.body) + data = XmlSimple.xml_in(response.body, 'ForceArray' => false) if data - message = url = data['Body'][0]['Fault'][0]['faultstring'][0] + # seems responses for CSV requests use a different XML return format + # (use invalid_error.xml for reference) + if !data['exceptionMessage'].nil? + message = data['exceptionMessage'] + else + # SOAP error response + message = data['Body']['Fault']['faultstring'] + end + self.error_code = response.code end
Update SalesforceError to parse XML response for CSV requests (plain XML format is used over SOAP in those cases).
diff --git a/lib/snowplow_ruby_duid/domain_userid.rb b/lib/snowplow_ruby_duid/domain_userid.rb index abc1234..def5678 100644 --- a/lib/snowplow_ruby_duid/domain_userid.rb +++ b/lib/snowplow_ruby_duid/domain_userid.rb @@ -1,3 +1,5 @@+require 'securerandom' + module SnowplowRubyDuid # Generates a pseudo-unique ID to fingerprint the user # Deviates from this Snowplow Javascript: https://github.com/snowplow/snowplow-javascript-tracker/blob/d3d10067127eb5c95d0054c8ae60f3bdccba619d/src/js/tracker.js#L468-L472
Fix failing specs due to missing secure random require
diff --git a/lib/templates/rspec/model/model_spec.rb b/lib/templates/rspec/model/model_spec.rb index abc1234..def5678 100644 --- a/lib/templates/rspec/model/model_spec.rb +++ b/lib/templates/rspec/model/model_spec.rb @@ -2,15 +2,15 @@ <% module_namespacing do -%> RSpec.describe <%= class_name %>, :type => :model do - subject { described_class } + # subject { described_class } - context 'initialized' do - subject { build(:<%= singular_table_name %>) } - end + # context 'initialized' do + # subject { build(:<%= singular_table_name %>) } + # end - context 'persisted' do - subject { create(:<%= singular_table_name %>) } - end + # context 'persisted' do + # subject { create(:<%= singular_table_name %>) } + # end pending "add some examples to (or delete) #{__FILE__}" end
Adjust rspec model template to comment out boilerplate
diff --git a/app/models/condition_type.rb b/app/models/condition_type.rb index abc1234..def5678 100644 --- a/app/models/condition_type.rb +++ b/app/models/condition_type.rb @@ -12,11 +12,17 @@ order("rating DESC").first.rating end def self.min_rating - order("rating ASC").first.rating + where('name <> ?', 'Unknown').order("rating ASC").first.rating end def self.from_rating(estimated_rating) - ConditionType.where("rating = ?", [[estimated_rating.ceil, 1].max, 5].min).first unless estimated_rating.nil? + return if estimated_rating.nil? + # Round the condition type to the nearest whole number + val = (estimated_rating + 0.5).floor + # bound it + val = [est_rat, max_rating].min + val = [est_rat, min_rating].max + ConditionType.where("rating = ?", val).first end end
Fix determination of rating value
diff --git a/api.rb b/api.rb index abc1234..def5678 100644 --- a/api.rb +++ b/api.rb @@ -18,12 +18,20 @@ route_param :id do desc 'Returns all messages for an inbox.' + params do + optional :from, type: String + end get 'messages' do inbox = Models::Inbox[params['id']] - error!('Inbox not found', 404) unless inbox - present inbox.messages.to_a, with: Entities::Message + if params[:from] + messages = inbox.messages.find(from: params[:from]) + else + messages = inbox.messages + end + + present messages.to_a, with: Entities::Message end end end
Add from parameter on inbox messages
diff --git a/test_examples/fast/spec_test.rb b/test_examples/fast/spec_test.rb index abc1234..def5678 100644 --- a/test_examples/fast/spec_test.rb +++ b/test_examples/fast/spec_test.rb @@ -0,0 +1,25 @@+require 'minitest/autorun' + +class FakeCalculator + def add(x, y) + x + y + end + + def mal(x, y) + x * y + end +end + +describe FakeCalculator do + before do + @calc = FakeCalculator.new + end + + it '#add' do + @calc.add(2, 3).must_equal 5 + end + + it '#mal' do + @calc.mal(2, 3).must_equal 6 + end +end
Add example minitest with rspec syntax
diff --git a/lib/roots/engine.rb b/lib/roots/engine.rb index abc1234..def5678 100644 --- a/lib/roots/engine.rb +++ b/lib/roots/engine.rb @@ -1,5 +1,11 @@ module Roots class Engine < ::Rails::Engine isolate_namespace Roots + + initializer 'roots', before: :load_config_initializers do |app| + Rails.application.routes.append do + mount Roots::Engine, at: '/roots' + end + end end end
Allow Roots to mount itself
diff --git a/lib/specter/spec.rb b/lib/specter/spec.rb index abc1234..def5678 100644 --- a/lib/specter/spec.rb +++ b/lib/specter/spec.rb @@ -8,23 +8,14 @@ @_block end - def scopes - Specter.now.scopes - end - - def prepares - scopes.map(&:prepares).flatten - end - def initialize(description, &block) @_description = description @_block = block end def prepare - scope = scopes.last - - prepares.each { |block| scope.instance_eval(&block) } + prepares = Specter.now.scopes.map(&:prepares).flatten + prepares.each { |block| instance_eval(&block) } end def run
Simplify calling of prepare blocks.
diff --git a/tzinfo.gemspec b/tzinfo.gemspec index abc1234..def5678 100644 --- a/tzinfo.gemspec +++ b/tzinfo.gemspec @@ -16,6 +16,6 @@ s.rdoc_options << '--title' << 'TZInfo' << '--main' << 'README.md' s.extra_rdoc_files = ['README.md', 'CHANGES.md', 'LICENSE'] - s.required_ruby_version = '>= 1.8.6' + s.required_ruby_version = '>= 1.8.7' s.add_dependency 'thread_safe', '~> 0.1' end
Raise minimum Ruby version to 1.8.7. minitest v5 is not compatible with Ruby 1.8.6.
diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb index abc1234..def5678 100644 --- a/config/initializers/wrap_parameters.rb +++ b/config/initializers/wrap_parameters.rb @@ -1,13 +1,13 @@ # Be sure to restart your server when you modify this file. -# + # This file contains settings for ActionController::ParamsWrapper # Enable parameter wrapping for JSON. -# ActiveSupport.on_load(:action_controller) do -# wrap_parameters format: [:json] if respond_to?(:wrap_parameters) -# end +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] if respond_to?(:wrap_parameters) +end # To enable root element in JSON for ActiveRecord objects. -# ActiveSupport.on_load(:active_record) do -# self.include_root_in_json = true -# end +ActiveSupport.on_load(:active_record) do + self.include_root_in_json = true +end
Include wrap paramters for User controller
diff --git a/video_embed.rb b/video_embed.rb index abc1234..def5678 100644 --- a/video_embed.rb +++ b/video_embed.rb @@ -6,9 +6,9 @@ Hosts = { "ted" => ->(id) { "https://embed-ssl.ted.com/talks/#{id}.html" }, - "ustream" => ->(id) { "http://ustream.tv/embed/#{id}" }, + "ustream" => ->(id) { "https://ustream.tv/embed/#{id}" }, "vimeo" => ->(id) { "https://player.vimeo.com/video/#{id}" }, - "youtube" => ->(id) { "http://youtube.com/embed/#{id}" } + "youtube" => ->(id) { "https://youtube.com/embed/#{id}" } } def initialize(tag_name, markup, tokens)
Add https support for youtube and ustream
diff --git a/wait_up.gemspec b/wait_up.gemspec index abc1234..def5678 100644 --- a/wait_up.gemspec +++ b/wait_up.gemspec @@ -20,7 +20,7 @@ s.add_dependency('gir_ffi-gtk', ['~> 0.8.0']) s.add_dependency('gir_ffi-gst', ['~> 0.0.1']) - s.add_dependency('gir_ffi', ['~> 0.8.3.pre1']) + s.add_dependency('gir_ffi', ['~> 0.8.3']) s.add_development_dependency('rake', ['~> 10.1']) s.add_development_dependency('minitest', ['~> 5.5']) s.add_development_dependency('atspi_app_driver', ['0.0.3'])
Use released gir_ffi gem version
diff --git a/lib/bwoken/build.rb b/lib/bwoken/build.rb index abc1234..def5678 100644 --- a/lib/bwoken/build.rb +++ b/lib/bwoken/build.rb @@ -12,7 +12,7 @@ end def sdk - 'iphonesimulator5.1' + 'iphoneos' end def env_variables
Use most recent sdk by default