diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/element_factory.gemspec b/element_factory.gemspec index abc1234..def5678 100644 --- a/element_factory.gemspec +++ b/element_factory.gemspec @@ -25,5 +25,6 @@ gem.add_development_dependency('guard-rspec') gem.add_development_dependency('rake') gem.add_development_dependency('rb-fsevent', '~> 0.9.1') - gem.add_development_dependency('activesupport', '~> 3.2.11') + + gem.add_dependency('activesupport', '~> 3.2.11') end
Add activesupport as a dependency.
diff --git a/week-5/pad-array/my_solution.rb b/week-5/pad-array/my_solution.rb index abc1234..def5678 100644 --- a/week-5/pad-array/my_solution.rb +++ b/week-5/pad-array/my_solution.rb @@ -2,6 +2,7 @@ # I worked on this challenge [by myself, with: ] # => With Sepand Assadi + # I spent [] hours on this challenge. @@ -13,20 +14,44 @@ # 0. Pseudocode -# What is the input? an array and the minimum size -# What is the output? (i.e. What should the code return?) +# What is the input? array, integer, value +# What is the output? (i.e. What should the code return?) array # What are the steps needed to solve the problem? +# IF user minumum size is equal or less than array length +# return the array +# ELSE +# Create a variable to store the difference between user minumum size and array length +# Create temporary array with a size of "difference variable" +# Create new array and store both user array and temp array +# Replace user array with new array # 1. Initial Solution + def pad!(array, min_size, value = nil) #destructive - # Your code here + + if min_size <= array.length + array + else + diff_size = min_size - array.length + temp_array = [value] * diff_size + new_array = array + temp_array + end + return array end + def pad(array, min_size, value = nil) #non-destructive - # Your code here + new_array = array.clone + if min_size <= array.length + return new_array + else + diff_size = min_size - array.length + temp_array = [value] * diff_size + new2_array = array + temp_array + end + new2_array end - # 3. Refactored Solution
Add files for post pairing 5.2
diff --git a/examples/enabled_for_actor.rb b/examples/enabled_for_actor.rb index abc1234..def5678 100644 --- a/examples/enabled_for_actor.rb +++ b/examples/enabled_for_actor.rb @@ -0,0 +1,43 @@+require File.expand_path('../example_setup', __FILE__) + +require 'flipper' +require 'flipper/adapters/memory' + +# Some class that represents what will be trying to do something +class User + attr_reader :id + + def initialize(id, admin) + @id = id + @admin = admin + end + + def admin? + @admin + end + + # Must respond to flipper_id + alias_method :flipper_id, :id +end + +user1 = User.new(1, true) +user2 = User.new(2, false) + +# pick an adapter +adapter = Flipper::Adapters::Memory.new + +# get a handy dsl instance +flipper = Flipper.new(adapter) + +Flipper.register :admins do |actor| + actor.admin? +end + +flipper[:search].enable +flipper[:stats].enable_actor user1 +flipper[:pro_stats].enable_percentage_of_actors 50 +flipper[:tweets].enable_group :admins +flipper[:posts].enable_actor user2 + +pp flipper.features.select { |feature| feature.enabled?(user1) }.map(&:name) +pp flipper.features.select { |feature| feature.enabled?(user2) }.map(&:name)
Add example of how to get enabled features for a given user
diff --git a/roles/web.rb b/roles/web.rb index abc1234..def5678 100644 --- a/roles/web.rb +++ b/roles/web.rb @@ -16,7 +16,7 @@ :pool_idle_time => 3600 }, :web => { - :status => "database_readonly", + :status => "online", :memcached_servers => %w[spike-06.ams spike-07.ams spike-08.ams] } )
Revert "Put site in readonly mode" This reverts commit 0764432cba7bb4889ba1436dcd58bb2b78760861.
diff --git a/scraiping.rb b/scraiping.rb index abc1234..def5678 100644 --- a/scraiping.rb +++ b/scraiping.rb @@ -3,6 +3,9 @@ # require './lib/holidaydoc_ishikawa.rb' + +# Time Zone +ENV['TZ'] = 'Asia/Tokyo' # URL url = 'http://i-search.pref.ishikawa.jp/toban/index.php?a=3'
Fix timezone issue. (Add timezone setting in scraping.rb)
diff --git a/lib/cloudflair/api/zone/custom_hostname.rb b/lib/cloudflair/api/zone/custom_hostname.rb index abc1234..def5678 100644 --- a/lib/cloudflair/api/zone/custom_hostname.rb +++ b/lib/cloudflair/api/zone/custom_hostname.rb @@ -6,7 +6,7 @@ attr_reader :zone_id, :custom_hostname_id deletable true - patchable_fields :ssl, :custom_origin_server + patchable_fields :ssl, :custom_origin_server, :custom_metadata path 'zones/:zone_id/custom_hostnames/:custom_hostname_id' def initialize(zone_id, custom_hostname_id)
Add custom_metadata as patchable field on custom hostname endpoint
diff --git a/lib/filter_factory/active_record/filter.rb b/lib/filter_factory/active_record/filter.rb index abc1234..def5678 100644 --- a/lib/filter_factory/active_record/filter.rb +++ b/lib/filter_factory/active_record/filter.rb @@ -20,4 +20,6 @@ end end -ActiveRecord::Base.send(:extend, FilterFactory::ActiveRecord::Filter) if defined?(ActiveRecord::Base) +if defined?(ActiveRecord::Base) + ActiveRecord::Base.send(:extend, FilterFactory::ActiveRecord::Filter) +end
Use regular if instead of modifier in ActiveRecord::Filter.
diff --git a/lib/generators/devise/install_generator.rb b/lib/generators/devise/install_generator.rb index abc1234..def5678 100644 --- a/lib/generators/devise/install_generator.rb +++ b/lib/generators/devise/install_generator.rb @@ -11,7 +11,7 @@ source_root File.expand_path("../../templates", __FILE__) desc "Creates a Devise initializer and copy locale files to your application." - class_option :orm + class_option :orm, required: true def copy_initializer unless options[:orm]
Fix another thor deprecation warning in the install generator This one has been showing up when running tests: Deprecation warning: Expected string default value for '--orm'; got false (boolean). This will be rejected in the future unless you explicitly pass the options `check_default_type: false` or call `allow_incompatible_default_type!` in your code You can silence deprecations warning by setting the environment variable THOR_SILENCE_DEPRECATION.
diff --git a/KeenClient.podspec b/KeenClient.podspec index abc1234..def5678 100644 --- a/KeenClient.podspec +++ b/KeenClient.podspec @@ -11,9 +11,14 @@ The Keen client is designed to be simple to develop with, yet incredibly flexible. Our goal is to let you decide what events are important to you, use your own vocabulary to describe them, and decide when you want to send them to Keen service. DESC spec.source = { :git => 'https://github.com/keenlabs/KeenClient-iOS.git', :tag => '3.3.0' } - spec.source_files = 'KeenClient/*.{h,m}','Library/sqlite-amalgamation/*.{h,c}','Library/Reachability/*.{h,m}' + spec.source_files = 'KeenClient/*.{h,m}','Library/Reachability/*.{h,m}' spec.public_header_files = 'KeenClient/*.h' - spec.private_header_files = 'Library/sqlite-amalgamation/*.h' spec.frameworks = 'CoreLocation' spec.requires_arc = true + + spec.subspec 'keen_sqlite' do |ks| + ks.source_files = 'Library/sqlite-amalgamation/*.{h,c}' + ks.private_header_files = 'Library/sqlite-amalgamation/*.h' + ks.compiler_flags = '-w', '-Xanalyzer', '-analyzer-disable-all-checks' + end end
Move sqlite amalgamation to a subspec Move sqlite amalgamation to a subspec in order to add compiler flags to its files and stop showing warnings
diff --git a/kbam.gemspec b/kbam.gemspec index abc1234..def5678 100644 --- a/kbam.gemspec +++ b/kbam.gemspec @@ -3,7 +3,7 @@ Gem::Specification.new do |spec| spec.name = 'kbam' spec.version = Kbam::VERSION - spec.date = Date.today.strptime("%Y-%m-%d") + spec.date = Date.today.strftime("%Y-%m-%d") spec.summary = "K'bam!" spec.description = "Simple gem that makes working with raw MySQL in Ruby efficient and fun! It's basically a query string builder (not an ORM!) that takes care of sanatization and sql chaining." spec.author = "Leopold Burdyl"
Fix date format bug in gemspec
diff --git a/vendor/gobierto_engines/custom-fields-data-grid-plugin/test/integration/budgets_plugin_test.rb b/vendor/gobierto_engines/custom-fields-data-grid-plugin/test/integration/budgets_plugin_test.rb index abc1234..def5678 100644 --- a/vendor/gobierto_engines/custom-fields-data-grid-plugin/test/integration/budgets_plugin_test.rb +++ b/vendor/gobierto_engines/custom-fields-data-grid-plugin/test/integration/budgets_plugin_test.rb @@ -0,0 +1,68 @@+# frozen_string_literal: true + +require "test_helper" +require_relative "../../../../../test/factories/budget_line_factory" + +class BudgetsPluginTest < ActionDispatch::IntegrationTest + + def site + @site ||= sites(:madrid) + end + + def admin + @admin ||= gobierto_admin_admins(:natasha) + end + + def project + @project ||= gobierto_plans_nodes(:political_agendas) + end + + def plan + @plan ||= gobierto_plans_plans(:strategic_plan) + end + + def within_plugin(params = nil) + within("#custom_field_budgets") do + if params + within(params) { yield } + else + yield + end + end + end + + def seed_budget_lines + common_args = { + kind: GobiertoData::GobiertoBudgets::EXPENSE, + indexes: [:forecast] + } + + BudgetLineFactory.new(common_args.merge(code: "1", year: 2014, area: GobiertoData::GobiertoBudgets::ECONOMIC_AREA_NAME)) + BudgetLineFactory.new(common_args.merge(code: "2", year: 2015, area: GobiertoData::GobiertoBudgets::ECONOMIC_AREA_NAME)) + BudgetLineFactory.new(common_args.merge(code: "3", year: 2016, area: GobiertoData::GobiertoBudgets::FUNCTIONAL_AREA_NAME)) + end + + def test_show + seed_budget_lines + + with(site: site, js: true, admin: admin) do + visit edit_admin_plans_plan_project_path(plan, project) + + within_plugin do + assert has_content?("1 - Gastos de personal") + assert has_content?("123,457") + assert has_content?("10") + assert has_content?("12,346") + + assert has_content?("2 - Gastos en bienes corrientes y servicios") + assert has_content?("15") + assert has_content?("18,519") + + assert has_content?("3 - Producci") + assert has_content?("20") + assert has_content?("24,691") + end + end + end + +end
Add simple test for budgets plugin
diff --git a/ruby_event_store/lib/ruby_event_store/event.rb b/ruby_event_store/lib/ruby_event_store/event.rb index abc1234..def5678 100644 --- a/ruby_event_store/lib/ruby_event_store/event.rb +++ b/ruby_event_store/lib/ruby_event_store/event.rb @@ -3,14 +3,14 @@ module RubyEventStore class Event - def initialize(**args) - attributes(args).each do |key, value| + def initialize(event_id: SecureRandom.uuid, metadata: {}, **data) + data.each do |key, value| singleton_class.__send__(:define_method, key) { value } end - @event_id = (args[:event_id] || generate_id).to_s - @metadata = args[:metadata] || {} - @data = attributes(args) + @event_id = event_id.to_s + @metadata = metadata + @data = data @metadata[:timestamp] ||= Time.now.utc end attr_reader :event_id, :metadata, :data @@ -32,15 +32,5 @@ end alias_method :eql?, :== - - private - - def attributes(args) - args.reject { |k| [:event_id, :metadata].include? k } - end - - def generate_id - SecureRandom.uuid - end end end
Move default arguments to constructor Tiny refactoring to make default values more explicit and to remove private methods.
diff --git a/slugworth.gemspec b/slugworth.gemspec index abc1234..def5678 100644 --- a/slugworth.gemspec +++ b/slugworth.gemspec @@ -12,7 +12,9 @@ spec.homepage = "https://github.com/mattpolito/slugworth" spec.license = "MIT" - spec.files = `git ls-files`.split($/) + spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do + `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|.github)/}) } + end spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"]
Remove test files from gem build
diff --git a/vagrant_base/networking_basic/recipes/default.rb b/vagrant_base/networking_basic/recipes/default.rb index abc1234..def5678 100644 --- a/vagrant_base/networking_basic/recipes/default.rb +++ b/vagrant_base/networking_basic/recipes/default.rb @@ -10,20 +10,16 @@ packages = [ 'lsof', 'iptables', - 'jwhois', 'whois', 'curl', 'wget', 'rsync', - 'jnettop', 'nmap', 'traceroute', 'ethtool', 'iproute', 'iputils-ping', - 'netcat-openbsd', 'tcpdump', - 'bind9-host', "libcurl4-openssl-dev" ]
Exclude packages we don't need that may not be available in 11.04 without apt sources tweaks
diff --git a/test/models/date_extractor_test.rb b/test/models/date_extractor_test.rb index abc1234..def5678 100644 --- a/test/models/date_extractor_test.rb +++ b/test/models/date_extractor_test.rb @@ -15,6 +15,7 @@ DATES = [Date.parse('2004-12-10'), Date.parse('1419-1-2')] it "correctly extracts dates from text" do + skip("Need to decide on Date.parse behavior for American dates") dates = DC::Import::DateExtractor.new.extract_dates(DOC).map {|d| d[:date] } assert_equal dates.sort, DATES.sort end
Mark test as skipped - Date.parse behavior
diff --git a/test/unit/release/scm/base_test.rb b/test/unit/release/scm/base_test.rb index abc1234..def5678 100644 --- a/test/unit/release/scm/base_test.rb +++ b/test/unit/release/scm/base_test.rb @@ -0,0 +1,23 @@+require "test_helper" +require "mocha/test_unit" + +module Roger + # Test for Roger Base scm + class BaseScmTest < ::Test::Unit::TestCase + def setup + @scm = Roger::Release::Scm::Base.new + end + + def test_implements_scm_interfase + assert @scm.respond_to?(:version) + assert @scm.respond_to?(:date) + assert @scm.respond_to?(:previous) + end + + def test_only_abstract_methods + assert_raise(RuntimeError) { @scm.version } + assert_raise(RuntimeError) { @scm.date } + assert_raise(RuntimeError) { @scm.previous } + end + end +end
Add test for base SCM class
diff --git a/spec/brainstem/api_docs_spec.rb b/spec/brainstem/api_docs_spec.rb index abc1234..def5678 100644 --- a/spec/brainstem/api_docs_spec.rb +++ b/spec/brainstem/api_docs_spec.rb @@ -21,6 +21,7 @@ output_extension base_presenter_class base_controller_class + base_application_proc document_empty_presenter_associations document_empty_presenter_filters ).each do |meth|
Test our configuration option for a "base" application proc This proc returns either a Rails application (probably `Rails.application` or an engine (for example, Api::Engine) that the routes will be documented.
diff --git a/spec/lib/gitlab/ci/status/scheduled_spec.rb b/spec/lib/gitlab/ci/status/scheduled_spec.rb index abc1234..def5678 100644 --- a/spec/lib/gitlab/ci/status/scheduled_spec.rb +++ b/spec/lib/gitlab/ci/status/scheduled_spec.rb @@ -0,0 +1,27 @@+require 'spec_helper' + +describe Gitlab::Ci::Status::Scheduled do + subject do + described_class.new(double('subject'), double('user')) + end + + describe '#text' do + it { expect(subject.text).to eq 'scheduled' } + end + + describe '#label' do + it { expect(subject.label).to eq 'scheduled' } + end + + describe '#icon' do + it { expect(subject.icon).to eq 'status_scheduled' } + end + + describe '#favicon' do + it { expect(subject.favicon).to eq 'favicon_status_scheduled' } + end + + describe '#group' do + it { expect(subject.group).to eq 'scheduled' } + end +end
Add spec for scheduled status
diff --git a/spec/support/shared_contexts.rb b/spec/support/shared_contexts.rb index abc1234..def5678 100644 --- a/spec/support/shared_contexts.rb +++ b/spec/support/shared_contexts.rb @@ -3,7 +3,8 @@ shared_context "StringIO logger" do before(:all) do - QueueingRabbit.logger = Logger.new(StringIO.new) + @session_log = StringIO.new + QueueingRabbit.logger = Logger.new(@session_log) end after(:all) do @@ -12,6 +13,22 @@ end +shared_context "Auto-disconnect" do + + after(:each) do + QueueingRabbit.disconnect + end + +end + +shared_context "No existing connections" do + + before(:each) do + QueueingRabbit.drop_connection + end + +end + shared_context "Evented spec" do include EventedSpec::SpecHelper end
Update the 'StringIO logger' shared context to write logs into a variable.
diff --git a/spec/factories.rb b/spec/factories.rb index abc1234..def5678 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -14,6 +14,12 @@ mtime { Time.now } end + factory :duration, class: Server::Duration do + file + date { Time.now } + duration { Random.rand(1000) } + end + sequence :name do |n| "project_#{n}" end
Factories: Add a new :duration factory.
diff --git a/google_custom_search_api.gemspec b/google_custom_search_api.gemspec index abc1234..def5678 100644 --- a/google_custom_search_api.gemspec +++ b/google_custom_search_api.gemspec @@ -9,7 +9,7 @@ s.authors = ["Ben Wiseley"] s.email = ["wiseleyb@gmail.com"] s.homepage = "http://github.com/wiseleyb/google_custom_search_api" - s.date = Date.today.to_s + s.date = Time.now s.summary = "Ruby lib for Google's Custom Search Api." s.description = "Ruby lib for Google's Custom Search Api." # s.files = `git ls-files`.split("\n") - %w[google_custom_search_api.gemspec Gemfile init.rb]
Fix error in gemspec when running specs
diff --git a/lib/actionview-fields_for_with_template.rb b/lib/actionview-fields_for_with_template.rb index abc1234..def5678 100644 --- a/lib/actionview-fields_for_with_template.rb +++ b/lib/actionview-fields_for_with_template.rb @@ -5,13 +5,16 @@ options = args.extract_options! options[:child_index] = NumericSequence.new args << options - fields_for record_or_name_or_array, *args, &block - fields_for record_or_name_or_array, object.send(record_or_name_or_array).new, :child_index => "NEW_RECORD" do |f| - @template.concat %|<div class="template" style="display:none">| + + result = fields_for record_or_name_or_array, *args, &block + result << fields_for record_or_name_or_array, object.send(record_or_name_or_array).new, :child_index => "NEW_RECORD" do |f| + @template.concat %|<div class="template" style="display:none">|.html_safe block.call f - @template.concat %|</div>| + @template.concat %|</div>|.html_safe end + + result end end end -end +end
Update for Rails 3 RC
diff --git a/app/models/francis_cms/webmention.rb b/app/models/francis_cms/webmention.rb index abc1234..def5678 100644 --- a/app/models/francis_cms/webmention.rb +++ b/app/models/francis_cms/webmention.rb @@ -7,9 +7,9 @@ validates :source, format: { :with => URI::regexp(%w(http https)) } validates :target, format: { :with => %r{\A#{FrancisCms.configuration.site_url}?} } - delegate :author_name, :author_photo_url, :author_url, - :entry_content, :entry_name, :entry_url, - :entry_url_host, :published_at, to: :webmention_entry + delegate :author_avatar, :author_avatar_url, :author_name, :author_photo_url, + :author_url, :entry_content, :entry_name, :entry_url, :entry_url_host, + :published_at, to: :webmention_entry def add_webmention_entry(collection) WebmentionEntry.create_from_collection(self, collection)
Add author_avatar and author_avatar_url to list of delegates.
diff --git a/app/models/shard.rb b/app/models/shard.rb index abc1234..def5678 100644 --- a/app/models/shard.rb +++ b/app/models/shard.rb @@ -18,7 +18,9 @@ end def self.by_name(name) - find_or_create_by(name: name) + transaction(requires_new: true) do + find_or_create_by(name: name) + end rescue ActiveRecord::RecordNotUnique retry end
Fix transaction pollution in Shard.by_name
diff --git a/qa/spec/runtime/rsa_key.rb b/qa/spec/runtime/rsa_key.rb index abc1234..def5678 100644 --- a/qa/spec/runtime/rsa_key.rb +++ b/qa/spec/runtime/rsa_key.rb @@ -0,0 +1,9 @@+describe QA::Runtime::RSAKey do + describe '#public_key' do + subject { described_class.new.public_key } + + it 'generates a public RSA key' do + expect(subject).to match(/\Assh\-rsa AAAA[0-9A-Za-z+\/]+={0,3}\z/) + end + end +end
Add an test for QA::Runtime::RSAKey
diff --git a/db/migrate/20101208082840_create_inquiries.rb b/db/migrate/20101208082840_create_inquiries.rb index abc1234..def5678 100644 --- a/db/migrate/20101208082840_create_inquiries.rb +++ b/db/migrate/20101208082840_create_inquiries.rb @@ -25,6 +25,8 @@ t.datetime "updated_at" end unless ::InquirySetting.table_exists? + Page.reset_column_information + load(Rails.root.join('db', 'seeds', 'pages_for_inquiries.rb').to_s) end
Fix against failing first "rake db:migrate"
diff --git a/opal/clearwater/router/route_collection.rb b/opal/clearwater/router/route_collection.rb index abc1234..def5678 100644 --- a/opal/clearwater/router/route_collection.rb +++ b/opal/clearwater/router/route_collection.rb @@ -33,12 +33,15 @@ end def [] route_names - route_names = route_names[1..-1] if route_names.first == @namespace + if route_names.any? && route_names.first == @namespace + route_names = route_names[1..-1] + end routes = @routes.map { |r| r.match route_names.first, route_names[1..-1] - }.compact || - raise(ArgumentError, "No route matches #{route_names.join("/")}") - routes.flatten + } + routes.compact! + routes.flatten! + routes end private
Fix nil route with no namespace case
diff --git a/problem_2/problem_2.rb b/problem_2/problem_2.rb index abc1234..def5678 100644 --- a/problem_2/problem_2.rb +++ b/problem_2/problem_2.rb @@ -1,16 +1,12 @@ # Solves => https://github.com/mdsrosa/project_euler/issues/2 - -f = ->(x){ x < 2 ? x : f[x-1] + f[x-2] } - s = 0 a = 1 b = 1 c = a+b - while c < 4000000 - s += c # 2, 10 - a = b+c # 3, 13 - b = a+c # 5, 21 - c = a+b # 8, 34... + s += c + a = b+c + b = a+c + c = a+b end puts s
Remove useless fibonacci function and comments from ruby solution for problem 2
diff --git a/lib/crdts/replicated_integer_collection.rb b/lib/crdts/replicated_integer_collection.rb index abc1234..def5678 100644 --- a/lib/crdts/replicated_integer_collection.rb +++ b/lib/crdts/replicated_integer_collection.rb @@ -1,5 +1,4 @@-require 'crdts/integer' -require 'crdts/replica' +require 'crdts/replicated_integer' module Crdts class ReplicaNotFound < StandardError
Fix up requires for replicated integer collection
diff --git a/lib/fog/rackspace/models/compute/flavor.rb b/lib/fog/rackspace/models/compute/flavor.rb index abc1234..def5678 100644 --- a/lib/fog/rackspace/models/compute/flavor.rb +++ b/lib/fog/rackspace/models/compute/flavor.rb @@ -34,6 +34,8 @@ 1/2.0 when 15872 1 + when 30720 + 2 end end
[rackspace/compute] Add 30GB (30720) compute size Rackspace has [30GB compute nodes][1]. If you've got these nodes on your account and try to do a flavor.cores you an exception like: ``` TypeError: nil can't be coerced into Fixnum from /Users/philkates/.rvm/gems/ruby-1.9.3-p0/gems/fog-1.1.2/lib/fog/rackspace/models/compute/flavor.rb:37:in `*' from /Users/philkates/.rvm/gems/ruby-1.9.3-p0/gems/fog-1.1.2/lib/fog/rackspace/models/compute/flavor.rb:37:in `cores' from (irb):6:in `<main>' from ./bin/fog:52:in `block in <main>' from ./bin/fog:52:in `catch' from ./bin/fog:52:in `<main>' ``` This is my incredibly simplistic fix. [1]: http://www.rackspace.com/cloud/cloud_hosting_products/servers/pricing/
diff --git a/spec/views/spree/orders/edit.html.haml_spec.rb b/spec/views/spree/orders/edit.html.haml_spec.rb index abc1234..def5678 100644 --- a/spec/views/spree/orders/edit.html.haml_spec.rb +++ b/spec/views/spree/orders/edit.html.haml_spec.rb @@ -10,6 +10,7 @@ helper SharedHelper helper FooterLinksHelper helper MarkdownHelper + helper TermsAndConditionsHelper let(:order) { create(:completed_order_with_fees) }
Add helper to view spec needing it
diff --git a/process_shared.gemspec b/process_shared.gemspec index abc1234..def5678 100644 --- a/process_shared.gemspec +++ b/process_shared.gemspec @@ -10,7 +10,7 @@ s.email = 'pat@polycrystal.org' s.homepage = 'https://github.com/pmahoney/process_shared' s.files = Dir['lib/**/*.rb', 'lib/**/libpsem*', 'ext/**/*.{c,h,rb}', 'spec/**/*.rb'] - s.extensions = FileList["ext/**/extconf.rb"] + s.extensions = Dir['ext/**/extconf.rb'] s.add_dependency('ffi', '~> 1.0')
Use Dir glob rather than FileList in gemspec.
diff --git a/spec/factories.rb b/spec/factories.rb index abc1234..def5678 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -37,6 +37,9 @@ address "Marble Street, 12345 City" url "http://example.com/canteen_feed.xml" + sequence(:latitude) { |n| (n % 180) - 90 } + sequence(:longitude) { |n| (n % 360) - 180 } + association :user end
Add lat and lng to canteen factory
diff --git a/db/migrate/20180503081248_add_hour_counter_to_product_categories.rb b/db/migrate/20180503081248_add_hour_counter_to_product_categories.rb index abc1234..def5678 100644 --- a/db/migrate/20180503081248_add_hour_counter_to_product_categories.rb +++ b/db/migrate/20180503081248_add_hour_counter_to_product_categories.rb @@ -1,17 +1,56 @@ class AddHourCounterToProductCategories < ActiveRecord::Migration def up - varieties = [:tractor, - :heavy_equipment, - :handling_equipment] + varieties = [:tractor] + product_nature_names = [:dumper, :forklift, :truck, :wheel_loader] + update_by_variety(varieties) + update_by_name(product_nature_names) + end + + def down + varieties = [:tractor] + product_nature_names = [:dumper, :forklift, :truck, :wheel_loader] + + update_by_variety(varieties, remove_hour_counter: true) + update_by_name(product_nature_names, remove_hour_counter: true) + end + + private + + def update_by_variety(varieties, remove_hour_counter: false) product_natures = ProductNature.where(variety: varieties) + update_hour_counter(product_natures, remove_hour_counter: remove_hour_counter) + end + + def update_by_name(product_natures_names, remove_hour_counter: false) + locale = Entity.of_company.language.to_sym + + product_natures_names.each do |product_nature_name| + translated_name = I18n.t("nomenclatures.product_nature_variants.items.#{ product_nature_name }", locale: locale) + + product_natures = ProductNature.where(name: translated_name) + update_hour_counter(product_natures, remove_hour_counter: remove_hour_counter) + end + end + + def update_hour_counter(product_natures, remove_hour_counter: false) product_natures.each do |product_nature| - product_nature.variable_indicators_list << :hour_counter + if remove_hour_counter + remove_variable_indicator(product_nature, :hour_counter) + else + product_nature.variable_indicators_list << :hour_counter + end + product_nature.save! end end - def down + def remove_variable_indicator(product_nature, variable_indicator) + variable_indicator_index = product_nature.variable_indicators_list.index(variable_indicator) + + return if variable_indicator_index.nil? + + product_nature.variable_indicators_list.delete_at(variable_indicator_index) end end
Add migration for product nature hour counter
diff --git a/lib/break_dance/application_record_additions.rb b/lib/break_dance/application_record_additions.rb index abc1234..def5678 100644 --- a/lib/break_dance/application_record_additions.rb +++ b/lib/break_dance/application_record_additions.rb @@ -3,22 +3,28 @@ extend ActiveSupport::Concern class_methods do + # We cannot use alias_method here, because "super" of the aliased method is the "super" of the original method. + %w(default_scoped unscoped).each do |method_name| + define_method method_name do |unsecured: false, &block| + if RequestLocals.store[:break_dance_enabled] && !unsecured + policy = RequestLocals.store[:break_dance_policy] - def default_scoped(unsecured: false) - if RequestLocals.store[:break_dance_enabled] && !unsecured - policy = RequestLocals.store[:break_dance_policy] + raise PolicyNotFound.new('BreakDance::Policy is not defined. By design BreakDance requires all models to be scoped.') unless policy.is_a?(BreakDance::Policy) + raise ModelWithoutScope.new("Model \"#{self.name}\" is missing BreakDance::Policy declaration. By design BreakDance requires all models to be scoped.") unless policy.scopes.has_key?(self.name) - raise PolicyNotFound.new('BreakDance::Policy is not defined. By design BreakDance requires all models to be scoped.') unless policy.is_a?(BreakDance::Policy) - raise ModelWithoutScope.new("Model \"#{self.name}\" is missing BreakDance::Policy declaration. By design BreakDance requires all models to be scoped.") unless policy.scopes.has_key?(self.name) - - super().merge(policy.scopes[self.name]) - else - super() + super(&block).merge(policy.scopes[self.name]) + else + super(&block) + end end end - def unsecured! - default_scoped unsecured: true + def unsecured!(&block) + default_scoped(unsecured: true, &block) + end + + def unsecured_unscoped!(&block) + unscoped(unsecured: true, &block) end end
Apply BreakDance also on unscoped
diff --git a/spec/test_spec.rb b/spec/test_spec.rb index abc1234..def5678 100644 --- a/spec/test_spec.rb +++ b/spec/test_spec.rb @@ -0,0 +1,13 @@+require 'spec_helper' + +RSpec.describe HashAttributeAssignment do + context 'group of tests to break on purpose' do + it 'breaks' do + expect(1).to eq 2 + end + + it 'works' do + expect(1).to eq 1 + end + end +end
Add another file to split on for parrallelization
diff --git a/sample_app.rb b/sample_app.rb index abc1234..def5678 100644 --- a/sample_app.rb +++ b/sample_app.rb @@ -23,11 +23,12 @@ # ----------------------------------- config.secret_key_base = 'my secret key base' - config.logger = Logger.new($stdout) - Rails.logger = config.logger + file = File.open('sample_app.log', 'w') + logger = Logger.new(file) + Rails.logger = logger routes.draw do - get 'raise_exception', to: 'exceptions#sample' + get 'raise_sample_exception', to: 'exceptions#raise_sample_exception' end end @@ -37,7 +38,8 @@ class ExceptionsController < ActionController::Base include Rails.application.routes.url_helpers - def sample + def raise_sample_exception + puts 'Raising exception!' raise 'Sample exception raised, you should receive a notification!' end end @@ -48,7 +50,8 @@ include Rack::Test::Methods def test_raise_exception - get '/raise_exception' + get '/raise_sample_exception' + puts "Working OK!" end private
Change method names and add info
diff --git a/_rake/features/support/pages/home_page.rb b/_rake/features/support/pages/home_page.rb index abc1234..def5678 100644 --- a/_rake/features/support/pages/home_page.rb +++ b/_rake/features/support/pages/home_page.rb @@ -27,7 +27,7 @@ end def btn_continue - return section_bio.find_element(:class => 'continue') + return section_bio.find_element(:class => 'btn-continue') end # EndRegion
Fix Cucumber tests by updating locator
diff --git a/app/controllers/admin/educators_controller.rb b/app/controllers/admin/educators_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/educators_controller.rb +++ b/app/controllers/admin/educators_controller.rb @@ -8,10 +8,12 @@ super end - # Define a custom finder by overriding the `find_resource` method: - # def find_resource(param) - # Educator.find_by!(slug: param) - # end + def resource_params + # Turn user-entered string into an array: + + params["educator"]["grade_level_access"] = params["educator"]["grade_level_access"].split(', ') + params.require(resource_name).permit(*permitted_attributes, grade_level_access: []) + end # See https://administrate-docs.herokuapp.com/customizing_controller_actions # for more information
Make Administrate work with Postgres array field
diff --git a/app/controllers/jmd/appearances_controller.rb b/app/controllers/jmd/appearances_controller.rb index abc1234..def5678 100644 --- a/app/controllers/jmd/appearances_controller.rb +++ b/app/controllers/jmd/appearances_controller.rb @@ -9,6 +9,7 @@ has_scope :in_contest_category, only: :index has_scope :in_age_group, only: :index has_scope :on_date, only: :index + has_scope :at_stage_venue, only: :index has_scope :in_genre, only: :index def index
Fix venue filter on result entry screen
diff --git a/init.rb b/init.rb index abc1234..def5678 100644 --- a/init.rb +++ b/init.rb @@ -6,7 +6,10 @@ # render a 404 response instead. def rescue_action_in_public_with_request_error(exception) if exception.kind_of? RequestError - render :file => "#{RAILS_ROOT}/public/404.html", :status => "404 Not Found" + respond_to do |type| + type.html { render :file => "#{RAILS_ROOT}/public/404.html", :status => "404 Not Found" } + type.all { render :nothing => true, :status => "404 Not Found" } + end end end alias_method_chain :rescue_action_in_public, :request_error
Make production responder friendly to non-HTML requests as well. git-svn-id: 36d0598828eae866924735253b485a592756576c@8083 da5c320b-a5ec-0310-b7f9-e4d854caa1e2
diff --git a/recipes/kore_server.rb b/recipes/kore_server.rb index abc1234..def5678 100644 --- a/recipes/kore_server.rb +++ b/recipes/kore_server.rb @@ -41,7 +41,7 @@ ExecStart=/bin/bash -lc 'kore -c telize.config' StandardOutput=syslog StandardError=syslog - SyslogIdentitifer=kore + SyslogIdentifier=kore [Install] WantedBy=multi-user.target
Fix typo in systemd syslog definition
diff --git a/recipes/nginx_vhost.rb b/recipes/nginx_vhost.rb index abc1234..def5678 100644 --- a/recipes/nginx_vhost.rb +++ b/recipes/nginx_vhost.rb @@ -25,5 +25,5 @@ :listen_port => node['roundcube']['listen_port'], :server_name => node['roundcube']['server_name'] ) - notifies :restart, "service[nginx]", :delayed + notifies :restart, 'service[nginx]', :delayed end
Use single quotes in ref.
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -7,6 +7,8 @@ flash[:warning] = 'Resource not found.' redirect_back_or root_path end + + private def redirect_back_or(path) redirect_to request.referer || path @@ -26,4 +28,15 @@ user_dashboard_path(current_user) end + def set_user + @user = User.find(params[:id]) + end + + def user_owner + if current_user != @user + flash[:danger] = "You don't have permissions to do that." + redirect_to user_dashboard_path(current_user) + end + end + end
Add here the older user methods and can be share between controllers
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,4 +2,6 @@ # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception + + include Trailblazer::Operation::Controller end
Update application controller to use trailblazer
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -10,6 +10,11 @@ end helper_method :current_user + def user_signed_in? + @current_user.present? + end + helper_method :user_signed_in? + def authenticate_user! if current_user or Rails.env == "development" true
Add user_signed_in? method like Devise
diff --git a/lib/active_admin/reorderable/table_methods.rb b/lib/active_admin/reorderable/table_methods.rb index abc1234..def5678 100644 --- a/lib/active_admin/reorderable/table_methods.rb +++ b/lib/active_admin/reorderable/table_methods.rb @@ -11,8 +11,10 @@ private def reorder_handle_for(resource) - aa_resource = active_admin_namespace.resource_for(resource.class) - url = url_for [:reorder, aa_resource.route_prefix, resource] + aa_resource = active_admin_namespace.resource_for(resource.class) + instance_name = aa_resource.resources_configuration[:self][:route_instance_name] + + url = send([:reorder, aa_resource.route_prefix, instance_name, :path].join('_'), resource) span(reorder_handle_content, :class => 'reorder-handle', 'data-reorder-url' => url) end
Fix route in reorderable table Building the route the way the older ActiveAdmin versions do. Should eventually be updated for AA 1.2
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -5,6 +5,7 @@ @data = {} @actual_path = request.original_fullpath @is_production = Rails.env.production? + response.headers['X-FRAME-OPTIONS'] = 'ALLOWALL' render 'index' end end
Allow embed x frame options
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -5,6 +5,8 @@ before_filter :get_broadcasts helper_method :in_demo? + + layout :layout_by_resource protected @@ -31,4 +33,12 @@ def in_demo? user_signed_in? && current_user.email =~ /@demoaccount.com/ end + + def layout_by_resource + if devise_controller? && resource_name == :admin + "magic" + else + "application" + end + end end
Use the magic layout for admin sign in.
diff --git a/lib/cloud_foundry/language_pack/extensions.rb b/lib/cloud_foundry/language_pack/extensions.rb index abc1234..def5678 100644 --- a/lib/cloud_foundry/language_pack/extensions.rb +++ b/lib/cloud_foundry/language_pack/extensions.rb @@ -8,6 +8,8 @@ require 'cloud_foundry/language_pack/ruby' require 'cloud_foundry/language_pack/helpers/plugins_installer' require 'cloud_foundry/language_pack/helpers/readline_symlink' + +ENV['STACK'] ||= '' module LanguagePack module Extensions
Set ENV['STACK'] to an empty string if not set. This is a workaround for multiple faults arising from the mismatch between Heroku's environmental assumptions and the CF execution environment. Setting STACK to an empty string avoids several code paths that misbehave on CF. [#78677868]
diff --git a/app/models/team.rb b/app/models/team.rb index abc1234..def5678 100644 --- a/app/models/team.rb +++ b/app/models/team.rb @@ -1,7 +1,7 @@ class Team < ApplicationRecord has_secure_password - validates_presence_of :name, :password + validates_presence_of :name, :password, if: :password_digest_changed? validates_inclusion_of :active, in: [true, false] belongs_to :owner, class_name: "User", foreign_key: "owner_id"
Add password 'presence of' validation condition, to check only when password changed
diff --git a/app/models/tree.rb b/app/models/tree.rb index abc1234..def5678 100644 --- a/app/models/tree.rb +++ b/app/models/tree.rb @@ -7,7 +7,8 @@ @entries = Gitlab::Git::Tree.where(git_repo, sha, path) if readme_tree = @entries.find(&:readme?) - @readme = Gitlab::Git::Blob.find(git_repo, sha, readme_tree.name) + readme_path = path == '/' ? readme_tree.name : File.join(path, readme_tree.name) + @readme = Gitlab::Git::Blob.find(git_repo, sha, readme_path) end end
Fix README detection for subdir
diff --git a/lib/descriptive_statistics/percentile_rank.rb b/lib/descriptive_statistics/percentile_rank.rb index abc1234..def5678 100644 --- a/lib/descriptive_statistics/percentile_rank.rb +++ b/lib/descriptive_statistics/percentile_rank.rb @@ -1,6 +1,6 @@ module DescriptiveStatistics def percentile_rank(p) sorted = self.sort - return sorted.find_index{ |x| x >= p} / sorted.length.to_f + return sorted.find_index{ |x| x >= p} / sorted.length.to_f * 100.0 end end
Change result from [0,1] to [0,100]
diff --git a/lib/nrser/props/mutable/instance_variables.rb b/lib/nrser/props/mutable/instance_variables.rb index abc1234..def5678 100644 --- a/lib/nrser/props/mutable/instance_variables.rb +++ b/lib/nrser/props/mutable/instance_variables.rb @@ -0,0 +1,60 @@+# Requirements +# ======================================================================= + +# Stdlib +# ----------------------------------------------------------------------- + +# Deps +# ----------------------------------------------------------------------- + +# Project / Package +# ----------------------------------------------------------------------- +require_relative '../../props' +require_relative '../storage/key' +require_relative '../storage/instance_variables' + + +# Declarations +# ======================================================================== + +module NRSER::Props::Mutable; end + + +# Definitions +# ======================================================================= + +# Mix-in to store property values in instance variables of the same name. +# +module NRSER::Props::Mutable::InstanceVariables + + STORAGE = NRSER::Props::Storage::InstanceVariables.new immutable: false + + + # Class Methods + # ====================================================================== + + def self.included base + base.include NRSER::Props + base.metadata.storage STORAGE + base.metadata.freeze + end + + + # Instance Methods + # ====================================================================== + + # Since the {NRSER::Props::Immutable::InstanceVariables} mix-in does *not* + # need to tap into the initialize chain, + # + def initialize_props values = {} + self.class.metadata.each_primary_prop_value_from( values ) { |prop, value| + instance_variable_set "@#{ prop.name }", value + } + + # Check additional type invariants + self.class.invariants.each do |type| + type.check self + end + end # #initialize_props + +end # module NRSER::Props::Immutable
Add a mutable inst var storage mix-in to props sys
diff --git a/ordered_find.gemspec b/ordered_find.gemspec index abc1234..def5678 100644 --- a/ordered_find.gemspec +++ b/ordered_find.gemspec @@ -10,7 +10,7 @@ spec.email = ["takeofujita@gmail.com"] spec.summary = %q{ordered find} spec.description = %q{ordered find} - spec.homepage = "" + spec.homepage = "https://github.com/tkeo/ordered_find" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0")
Add homepage url to gemspec
diff --git a/lib/rocket_pants/cache_middleware.rb b/lib/rocket_pants/cache_middleware.rb index abc1234..def5678 100644 --- a/lib/rocket_pants/cache_middleware.rb +++ b/lib/rocket_pants/cache_middleware.rb @@ -1,7 +1,7 @@ module RocketPants class CacheMiddleware - NOT_MODIFIED = [304, {}, []].freeze + NOT_MODIFIED = [304, {}, []] def initialize(app) @app = app @@ -15,7 +15,7 @@ @env = env if has_valid_etag? debug "Cache key is valid, returning not modified response." - NOT_MODIFIED + NOT_MODIFIED.dup else @app.call env end
Add fixes for the frozen not modified
diff --git a/test/test.rb b/test/test.rb index abc1234..def5678 100644 --- a/test/test.rb +++ b/test/test.rb @@ -51,4 +51,13 @@ def test_all_is_same_as_report assert_equal ShippingForecast.report, ShippingForecast.all end + + def test_report_includes_wind + assert_not_nil ShippingForecast["Viking"].wind + end + + def test_report_includes_weather + assert_not_nil ShippingForecast["Viking"].weather + end + end
Test for wind and weather
diff --git a/app/controllers/application_controller/feature.rb b/app/controllers/application_controller/feature.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller/feature.rb +++ b/app/controllers/application_controller/feature.rb @@ -1,5 +1,5 @@ class ApplicationController - Feature = Struct.new(:role, :role_any, :name, :accord_name, :tree_name, :title, :container, :listn_name) do + Feature = Struct.new(:role, :role_any, :name, :accord_name, :tree_name, :title, :container) do def self.new_with_hash(hash) feature = new(*members.collect { |m| hash[m] }) feature.autocomplete
Remove unused list_name from the ApplicationController::Feature struct It was a typo, but not even used, that's why we did not notice
diff --git a/lib/nanoc.rb b/lib/nanoc.rb index abc1234..def5678 100644 --- a/lib/nanoc.rb +++ b/lib/nanoc.rb @@ -8,7 +8,7 @@ gem_info = defined?(Gem) ? "with RubyGems #{Gem::VERSION}" : 'without RubyGems' engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby' res = '' - res << "nanoc #{Nanoc::VERSION} © 2007-2013 Denis Defreyne.\n" + res << "nanoc #{Nanoc::VERSION} © 2007-2014 Denis Defreyne.\n" res << "Running #{engine} #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) on #{RUBY_PLATFORM} #{gem_info}.\n" res end
Update copyright year to 2014 A bit late, I guess! We’re well in 2014 now.
diff --git a/MHPrettyDate.podspec b/MHPrettyDate.podspec index abc1234..def5678 100644 --- a/MHPrettyDate.podspec +++ b/MHPrettyDate.podspec @@ -8,6 +8,7 @@ s.source = { :git => "https://github.com/bobjustbob/MHPrettyDate.git", :tag => "v1.0.1" } s.platform = :ios, '5.0' s.source_files = 'MHPrettyDate/**/*.{h,m}' + s.resources = "#{s.name}/**/*.{lproj}" s.requires_arc = true s.framework = 'Foundation' end
Update podspec to copy lproj files
diff --git a/spec/publisher_spec.rb b/spec/publisher_spec.rb index abc1234..def5678 100644 --- a/spec/publisher_spec.rb +++ b/spec/publisher_spec.rb @@ -9,7 +9,7 @@ context "on publish!" do it "publish all files" do - AWS::S3::Client.any_instance.expects(:put_object).times(4) + AWS::S3::Client::V20060301.any_instance.expects(:put_object).times(4) path = File.join(@root, 'sample') Capistrano::S3::Publisher.publish!('s3.amazonaws.com', 'abc', '123', 'mybucket.amazonaws.com', path, {})
Fix broken spec due to AWS SDK change.
diff --git a/lib/pixiv.rb b/lib/pixiv.rb index abc1234..def5678 100644 --- a/lib/pixiv.rb +++ b/lib/pixiv.rb @@ -10,8 +10,15 @@ module Pixiv ROOT_URL = 'http://www.pixiv.net' + # @deprecated Use {.client} instead. Will be removed in 0.1.0. # Delegates to {Pixiv::Client#initialize} def self.new(*args, &block) Pixiv::Client.new(*args, &block) end + + # See {Pixiv::Client#initialize} + # @return [Pixiv::Client] + def self.client(*args, &block) + Pixiv::Client.new(*args, &block) + end end
Add Pixiv.client and deprecate Pixiv.new
diff --git a/lib/diesel/request_context.rb b/lib/diesel/request_context.rb index abc1234..def5678 100644 --- a/lib/diesel/request_context.rb +++ b/lib/diesel/request_context.rb @@ -12,13 +12,15 @@ end def perform - if endpoint.url.base_host - endpoint.url.subdomain = options[:subdomain] + url = endpoint.url.dup + + if url.base_host + url.subdomain = options[:subdomain] end env = { method: endpoint.request_method, - url: endpoint.url, + url: url, params: {}, request_headers: {}, logger: logger, @@ -31,10 +33,6 @@ def authenticator group.authenticator - end - - def endpoint_url - endpoint.url end def logger
Duplicate URL to avoid overwriting spec data
diff --git a/iris.gemspec b/iris.gemspec index abc1234..def5678 100644 --- a/iris.gemspec +++ b/iris.gemspec @@ -20,5 +20,5 @@ spec.add_development_dependency "bundler", "~> 1.5" spec.add_development_dependency "rake" - spec.add_development_dependency "rspec" + spec.add_development_dependency "rspec", "3.0.0.beta2" end
Set RSpec version 3.0 for output matcher
diff --git a/provider/db/seeds.rb b/provider/db/seeds.rb index abc1234..def5678 100644 --- a/provider/db/seeds.rb +++ b/provider/db/seeds.rb @@ -5,4 +5,7 @@ # # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }]) # Major.create(:name => 'Daley', :city => cities.first) -User.create!(:email => 'admin', :password => 'p')+User.create!(:email => 'admin', :password => 'p') +User.create!(:email => 'mingledev01@thoughtworks.com', :password => 'p') +User.create!(:email => 'mingledev02@thoughtworks.com', :password => 'p') +User.create!(:email => 'admin@thoughtworks.com', :password => 'p')
Add some more seed data.
diff --git a/providers/default.rb b/providers/default.rb index abc1234..def5678 100644 --- a/providers/default.rb +++ b/providers/default.rb @@ -16,7 +16,7 @@ end action :set do - if new_resource.locales === String + if new_resource.locales.kind_of?(String) locales new_resource.locales do action :add end @@ -24,7 +24,7 @@ only_if { ENV['LANG'] != new_resource.locales } end else - Log.error('Locales must be a String') + Log.error('locales must be a String') end end
Use a better test for type
diff --git a/templates/polygon.noe/src/spec/test_sitemap.rb b/templates/polygon.noe/src/spec/test_sitemap.rb index abc1234..def5678 100644 --- a/templates/polygon.noe/src/spec/test_sitemap.rb +++ b/templates/polygon.noe/src/spec/test_sitemap.rb @@ -18,7 +18,7 @@ let(:got) do urls = [] - body.scan %r{<loc>http://[^\/]+/(.*)</loc>} do |match| + body.gsub('&#47;', '/').scan %r{<loc>http://[^\/]+/(.*)</loc>} do |match| urls << match.first.gsub('&#47;', '/') end Relation(:path => urls)
Convert slashes in all body
diff --git a/benchmarks/tocsv.rb b/benchmarks/tocsv.rb index abc1234..def5678 100644 --- a/benchmarks/tocsv.rb +++ b/benchmarks/tocsv.rb @@ -0,0 +1,8 @@+require 'csv' + +CSV.open(ARGV[0] + '.csv', 'wb') do |csv| + csv << %w[concurrent time total loss throughput] + File.readlines(ARGV[0]).each do |line| + csv << line.split(', ').map { |x| x.split('=')[1] }[0..4] + end +end
Convert stress.sh output to CSV.
diff --git a/core/lib/refinery/menu.rb b/core/lib/refinery/menu.rb index abc1234..def5678 100644 --- a/core/lib/refinery/menu.rb +++ b/core/lib/refinery/menu.rb @@ -15,7 +15,7 @@ end def roots - @roots ||= items.select {|item| item.parent_id.nil?} + @roots ||= items.select {|item| !item.has_parent?} end def to_s
Decrease coupling by using available methods.
diff --git a/spree_multi_domain.gemspec b/spree_multi_domain.gemspec index abc1234..def5678 100644 --- a/spree_multi_domain.gemspec +++ b/spree_multi_domain.gemspec @@ -1,4 +1,4 @@-version = '3.0.0' +version = '3.0.1' Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY @@ -13,7 +13,7 @@ # s.homepage = 'http://www.rubyonrails.org' # s.rubyforge_project = 'actionmailer' - s.files = Dir['CHANGELOG', 'README', 'MIT-LICENSE', 'lib/**/*', 'app/**/*'] + s.files = Dir['CHANGELOG', 'README', 'MIT-LICENSE', 'lib/**/*', 'app/**/*', 'config/*'] s.require_path = 'lib' s.requirements << 'none'
Include config dir files in gemspec
diff --git a/config/initializers/new_framework_defaults_5_1.rb b/config/initializers/new_framework_defaults_5_1.rb index abc1234..def5678 100644 --- a/config/initializers/new_framework_defaults_5_1.rb +++ b/config/initializers/new_framework_defaults_5_1.rb @@ -7,7 +7,7 @@ # Read the Guide for Upgrading Ruby on Rails for more info on each option. # Make `form_with` generate non-remote forms. -Rails.application.config.action_view.form_with_generates_remote_forms = false +Rails.application.config.action_view.form_with_generates_remote_forms = true # Unknown asset fallback will return the path passed in when the given # asset is not present in the asset pipeline.
Apply new framework defaults for Rails 5.1
diff --git a/test/boot.rb b/test/boot.rb index abc1234..def5678 100644 --- a/test/boot.rb +++ b/test/boot.rb @@ -14,6 +14,8 @@ PLUGIN_ROOT = pwd + '..' ADAPTER = ENV['DB'] || 'mysql' +$LOAD_PATH << (PLUGIN_ROOT + 'lib') << (PLUGIN_ROOT + 'test/models') + config_file = PLUGIN_ROOT + 'test/database.yml' db_config = YAML::load(IO.read(config_file)) logger_file = PLUGIN_ROOT + "test/#{ADAPTER}-debug.log"
Add some directories in the LOAD_PATH for the tests
diff --git a/lib/md_inc.rb b/lib/md_inc.rb index abc1234..def5678 100644 --- a/lib/md_inc.rb +++ b/lib/md_inc.rb @@ -3,6 +3,10 @@ module MdInc class TextProcessor + def root(path) + Commands.root(path) + end + def process(string) Commands.process(string) end
Allow user to set root path from MdInc
diff --git a/spec/requests/user_link_spec.rb b/spec/requests/user_link_spec.rb index abc1234..def5678 100644 --- a/spec/requests/user_link_spec.rb +++ b/spec/requests/user_link_spec.rb @@ -2,8 +2,8 @@ # Test for #83 describe "user links" do - let(:topic) { Factory(:topic) } - let(:post) { Factory(:post, :topic => topic) } + let(:topic) { Factory(:approved_topic) } + let(:post) { Factory(:approved_post, :topic => topic) } context "with user_profile_links on" do before { Forem.user_profile_links = true }
Set approved topic + post in user link spec
diff --git a/pages/lib/pages/marketable_routes.rb b/pages/lib/pages/marketable_routes.rb index abc1234..def5678 100644 --- a/pages/lib/pages/marketable_routes.rb +++ b/pages/lib/pages/marketable_routes.rb @@ -1,9 +1,10 @@-::Refinery::Application.routes.draw do - match '*path' => 'pages#show' -end -# Add any parts of routes as reserved words. if Page.use_marketable_urls? + ::Refinery::Application.routes.draw do + match '*path' => 'pages#show' + end + + # Add any parts of routes as reserved words. route_paths = ::Refinery::Application.routes.named_routes.routes.map{|name, route| route.path} Page.friendly_id_config.reserved_words |= route_paths.map { |path| path.to_s.gsub(/^\//, '').to_s.split('(').first.to_s.split(':').first.to_s.split('/')
Make the catch-all pages route for marketable URLs be controlled by the configuration switch.
diff --git a/app/controllers/dumps_controller.rb b/app/controllers/dumps_controller.rb index abc1234..def5678 100644 --- a/app/controllers/dumps_controller.rb +++ b/app/controllers/dumps_controller.rb @@ -6,7 +6,7 @@ # GET /dumps # GET /dumps.json def index - dump_list = YAML.load_file('/var/rails/metasmoke/shared/dumps/files.yml') + dump_list = YAML.load_file('/var/railsapps/metasmoke/shared/dumps') @dumps = dump_list['database'].map { |k, v| { name: "#{k}.sql", url: v } } @redis_dumps = dump_list['redis'].map { |k, v| { name: "#{k}.rdb", url: v } } end
Fix DB dumps YAML path Actually make this work with the actual path heh.
diff --git a/app/controllers/ideas_controller.rb b/app/controllers/ideas_controller.rb index abc1234..def5678 100644 --- a/app/controllers/ideas_controller.rb +++ b/app/controllers/ideas_controller.rb @@ -1,6 +1,6 @@ class IdeasController < ApplicationController expose(:idea, attributes: :idea_params) - expose(:ideas) { campaign.user_accessible_ideas(current_user) } + expose(:ideas) { campaign.user_accessible_ideas(current_user).order(interesting: :desc) } expose(:campaign) expose(:campaigns) expose(:user)
Order ideas- interesting ideas moves on top of index
diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index abc1234..def5678 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -3,7 +3,8 @@ def show unless @page - raise ActionController::RoutingError.new('Not Found') + logger.error("[Forest][Error] 404 page not found. Looked for path \"#{request.fullpath}\"") + return render 'errors/not_found' end authorize @page
Update pages controller to render not found template instead of error Raising ActionController::RoutingError spits out a bunch of junk in the rails logs. Rendering the not found page directly avoids this and makes it easier to filter out from your logs, thus making it easier to discover other issues.
diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index abc1234..def5678 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -1,7 +1,13 @@ class PagesController < ApplicationController - layout :choose_layout + before_filter :public_view_check + layout :choose_layout def home end + private + + def public_view_check + redirect_to app_home_path if current_user + end end
Add redirect to app_home if logged in at public area
diff --git a/app/models/specification_wrapper.rb b/app/models/specification_wrapper.rb index abc1234..def5678 100644 --- a/app/models/specification_wrapper.rb +++ b/app/models/specification_wrapper.rb @@ -39,8 +39,8 @@ def validation_errors results = {} - results['warnings'] = linter.warnings.map(&:message) unless linter.warnings.empty? - results['errors'] = linter.errors.map(&:message) unless linter.errors.empty? + results['warnings'] = remove_prefixes(linter.warnings) unless linter.warnings.empty? + results['errors'] = remove_prefixes(linter.errors) unless linter.errors.empty? results end @@ -49,6 +49,12 @@ def linter @linter ||= Specification::Linter.new(@specification) end + + def remove_prefixes(results) + results.map do |result| + result.message.sub(/^\[.+?\]\s*/, '') + end + end end end end
[pods] Make specs green by removing linter message prefixes.
diff --git a/app/policies/union_domain_policy.rb b/app/policies/union_domain_policy.rb index abc1234..def5678 100644 --- a/app/policies/union_domain_policy.rb +++ b/app/policies/union_domain_policy.rb @@ -0,0 +1,19 @@+# frozen_string_literal: true + +class UnionDomainPolicy < ApplicationPolicy + def index? + staff? + end + + def show? + staff? + end + + def create? + staff? + end + + def destroy? + staff? + end +end
Fix action log on union domain. * Add UnionDomainPolicy
diff --git a/scripts/db_backup.rb b/scripts/db_backup.rb index abc1234..def5678 100644 --- a/scripts/db_backup.rb +++ b/scripts/db_backup.rb @@ -1,4 +1,4 @@-klnblkblkbklblkcdStandup.script :node do +Standup.script :node do def run exec "s3cmd mb #{bucket}"
Fix for the most obscure & hard bug ever
diff --git a/spec/benchmark_spec.rb b/spec/benchmark_spec.rb index abc1234..def5678 100644 --- a/spec/benchmark_spec.rb +++ b/spec/benchmark_spec.rb @@ -0,0 +1,16 @@+require File.dirname(__FILE__) + '/spec_helper' + +describe "Benchmarking", :type => :formatter do + fixtures = self.fixtures + version = RedCloth::VERSION.is_a?(Module) ? RedCloth::VERSION::STRING : RedCloth::VERSION + platform = RedCloth.const_defined?(:EXTENSION_LANGUAGE) ? RedCloth::EXTENSION_LANGUAGE : (version < "4.0.0" ? "ruby-regex" : "C") + + it "should not be too slow" do + puts "Benchmarking version #{version} compiled in #{platform}..." + fixtures.each do |name, doc| + if doc['html'] + RedCloth.new(doc['in']).to_html + end + end + end +end
Add a little benchmarking script. Doesn't actually test anything right now, but the RSpec framework is handy.
diff --git a/lib/can_haz_poster/grabber.rb b/lib/can_haz_poster/grabber.rb index abc1234..def5678 100644 --- a/lib/can_haz_poster/grabber.rb +++ b/lib/can_haz_poster/grabber.rb @@ -11,6 +11,8 @@ movie_url = parse_movie_url(fetch_search_results(title), year) parse_poster_url(fetch_movie_page(movie_url)) end + + private def fetch_search_results(title) open(SERVICE_HOST + SEARCH_PATH % {query: URI.encode_www_form_component(title)})
Make Grabber's internal methods private
diff --git a/spec/unit/association/many_to_many_spec.rb b/spec/unit/association/many_to_many_spec.rb index abc1234..def5678 100644 --- a/spec/unit/association/many_to_many_spec.rb +++ b/spec/unit/association/many_to_many_spec.rb @@ -21,6 +21,7 @@ it 'prepares joined relations' do relation = assoc.call(container.relations) + expect(relation.attributes).to eql(%i[id name task_id]) expect(relation.to_a).to eql([id: 1, name: 'important', task_id: 1]) end end
Add expectation about attributes in many-to-many join
diff --git a/lib/codeclimate_ci/get_gpa.rb b/lib/codeclimate_ci/get_gpa.rb index abc1234..def5678 100644 --- a/lib/codeclimate_ci/get_gpa.rb +++ b/lib/codeclimate_ci/get_gpa.rb @@ -7,12 +7,9 @@ end def gpa - retry_counter = 0 - retry_count.times do return last_snapshot_gpa if analyzed? - retry_counter += 1 - wait_and_refresh!(retry_counter) + wait_and_refresh! end NULL_VALUE @@ -20,10 +17,16 @@ private - def wait_and_refresh!(retry_counter) - Report.result_not_ready(retry_counter, @branch) + def wait_and_refresh! + increment_retry_counter + Report.result_not_ready(@retry_counter, @branch) refresh! sleep(sleep_time) + end + + def increment_retry_counter + @retry_counter ||= 0 + @retry_counter += 1 end def retry_count
Move retry_counter in to wait_and_refresh method in GetGpa class
diff --git a/lib/dry/component/injector.rb b/lib/dry/component/injector.rb index abc1234..def5678 100644 --- a/lib/dry/component/injector.rb +++ b/lib/dry/component/injector.rb @@ -16,7 +16,7 @@ def initialize(container, options: {}, strategy: :default) @container = container @options = options - @injector = ::Dry::AutoInject(container, options).send(strategy) + @injector = ::Dry::AutoInject(container, options).public_send(strategy) end # @api public
Use public_send instead of send
diff --git a/lib/eaco/adapters/postgres.rb b/lib/eaco/adapters/postgres.rb index abc1234..def5678 100644 --- a/lib/eaco/adapters/postgres.rb +++ b/lib/eaco/adapters/postgres.rb @@ -5,6 +5,8 @@ # Requires Postgres 9.4 and a jsonb column named `acl`. # def accessible_by(user) + return scoped if user.is_admin? + designators = user.designators.map {|d| quote_value(d) } where("acl ?| array[#{designators.join(',')}]")
Return all records for admin users in the pg adapter
diff --git a/lib/query_string_search/comparator.rb b/lib/query_string_search/comparator.rb index abc1234..def5678 100644 --- a/lib/query_string_search/comparator.rb +++ b/lib/query_string_search/comparator.rb @@ -1,29 +1,31 @@-module Comparator - def self.does(subject) - Comparison.new(subject) - end - - class Comparison - attr_accessor :subject - - def initialize(subject) - self.subject = subject +module QueryStringSearch + module Comparator + def self.does(subject) + Comparison.new(subject) end - def equal?(other) - normalize(subject) == normalize(other) - end + class Comparison + attr_accessor :subject - def normalize(unnormalized) - if unnormalized.respond_to?(:each) - unnormalized.map(&:to_s).map(&:upcase) - else - unnormalized.to_s.upcase + def initialize(subject) + self.subject = subject end - end - def contain?(other) - normalize(subject).include?(normalize(other)) + def equal?(other) + normalize(subject) == normalize(other) + end + + def normalize(unnormalized) + if unnormalized.respond_to?(:each) + unnormalized.map(&:to_s).map(&:upcase) + else + unnormalized.to_s.upcase + end + end + + def contain?(other) + normalize(subject).include?(normalize(other)) + end end end end
Move Comparator under the QueryStringSearch namespace
diff --git a/lib/aws/xray/request.rb b/lib/aws/xray/request.rb index abc1234..def5678 100644 --- a/lib/aws/xray/request.rb +++ b/lib/aws/xray/request.rb @@ -2,26 +2,32 @@ module Xray attrs = [:method, :url, :user_agent, :client_ip, :x_forwarded_for, :traced] class Request < Struct.new(*attrs) - def self.build_from_rack_env(env) - new( - env['REQUEST_METHOD'], # method - env['REQUEST_URI'], # url - env['HTTP_USER_AGENT'], # user_agent - env['X-Forwarded-For'], # client_ip - !!env['X-Forwarded-For'], # x_forwarded_for - false, # traced - ) - end + class << self + def build(method:, url:, user_agent: nil, client_ip: nil, x_forwarded_for: nil, traced: false) + new(method, url, user_agent, client_ip, x_forwarded_for, traced) + end - def self.build_from_faraday_env(env) - new( - env.method.to_s.upcase, # method - env.url.to_s, # url - env.request_headers['User-Agent'], # user_agent - nil, # client_ip - false, # x_forwarded_for - false, # traced - ) + def build_from_rack_env(env) + build( + method: env['REQUEST_METHOD'], + url: env['REQUEST_URI'], + user_agent: env['HTTP_USER_AGENT'], + client_ip: env['X-Forwarded-For'], + x_forwarded_for: !!env['X-Forwarded-For'], + traced: false, + ) + end + + def build_from_faraday_env(env) + build( + method: env.method.to_s.upcase, + url: env.url.to_s, + user_agent: env.request_headers['User-Agent'], + client_ip: nil, + x_forwarded_for: false, + traced: false, + ) + end end end end
Add Request.build to accept keyword argument
diff --git a/lib/beatport/support.rb b/lib/beatport/support.rb index abc1234..def5678 100644 --- a/lib/beatport/support.rb +++ b/lib/beatport/support.rb @@ -3,5 +3,23 @@ def self.constantize(string) Beatport.const_get(string.capitalize) end + + def self.camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true) + if first_letter_in_uppercase + lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase } + else + lower_case_and_underscored_word.to_s[0].chr.downcase + camelize(lower_case_and_underscored_word)[1..-1] + end + end + + def self.underscore(camel_cased_word) + word = camel_cased_word.to_s.dup + word.gsub!(/::/, '/') + word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2') + word.gsub!(/([a-z\d])([A-Z])/,'\1_\2') + word.tr!("-", "_") + word.downcase! + word + end end end
Add camelize and underscore functions for future usage
diff --git a/lib/bouncefetch/rule.rb b/lib/bouncefetch/rule.rb index abc1234..def5678 100644 --- a/lib/bouncefetch/rule.rb +++ b/lib/bouncefetch/rule.rb @@ -10,6 +10,7 @@ def normalized_body mail, plain = false r = mail.body.decoded.force_encoding("UTF-8") + r = r..encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: ' ') r = r.downcase if !plain && @opts[:downcase] r = r.squish if !plain && @opts[:squish] r = r.tr("\n", " ").tr("\r", "") if !plain && @opts[:oneline]
Fix invalid UTF-8 byte sequences by replacing broken characters which most likely will not be used for matching bounces (but rather are part of the original mail)
diff --git a/lib/copian/collector/hp/ports.rb b/lib/copian/collector/hp/ports.rb index abc1234..def5678 100644 --- a/lib/copian/collector/hp/ports.rb +++ b/lib/copian/collector/hp/ports.rb @@ -16,10 +16,6 @@ yield if_index, addresses end end - protected - def suboid_to_mac(oid) - super(oid.to_s.gsub(/^[0-9]+\./, '')) - end end end -end+end
Fix bug in HP port collector for extracting mac addresses from suboids
diff --git a/lib/copperegg/alerts.rb b/lib/copperegg/alerts.rb index abc1234..def5678 100644 --- a/lib/copperegg/alerts.rb +++ b/lib/copperegg/alerts.rb @@ -15,8 +15,19 @@ end def modify_schedule(name, *args) - @schedules.select { |h| h['name'] == name }.each do |schedule| - @client.put('alerts/schedules/' + schedule['id'] + '.json', body) + body = {} + args.each { |arg| body.deep_merge!(arg) } + selected_schedules = @schedules.select { |h| h['name'] == name } + if selected_schedules + @schedules -= selected_schedules + selected_schedules.each do |s| + result = @client.put?("alerts/schedules/#{s['id']}.json", body) + if result == nil + @schedules << s + else + @schedules << result + end + end end end @@ -30,18 +41,19 @@ args.each { |arg| defaults.deep_merge!(arg) } if result = @client.post?('alerts/schedules.json', defaults) @schedules << result.parsed_response - else - warn("No alert schedule created (HTTP response code: #{result.code})") end end def reset_schedules(name) - selected_schedules = @schedules.reject! { |h| h['name'] == name } - selected_schedules.each { |s| - if not @client.delete?("alerts/schedules/#{s['id']}.json") - @schedules << s + selected_schedules = @schedules.select { |h| h['name'] == name } + if selected_schedules + @schedules -= selected_schedules + selected_schedules.each do |s| + if @client.delete?("alerts/schedules/#{s['id']}.json") == nil + @schedules << s + end end - } if selected_schedules + end end end end
Debug instance list handling, implement modify/put/update method
diff --git a/lib/ice_nine/version.rb b/lib/ice_nine/version.rb index abc1234..def5678 100644 --- a/lib/ice_nine/version.rb +++ b/lib/ice_nine/version.rb @@ -1,5 +1,8 @@ # encoding: utf-8 module IceNine + + # Current gem version VERSION = '0.3.0' -end + +end # module IceNine
Add docs to IceNine module to match convention
diff --git a/lib/tasks/merchants_info.rake b/lib/tasks/merchants_info.rake index abc1234..def5678 100644 --- a/lib/tasks/merchants_info.rake +++ b/lib/tasks/merchants_info.rake @@ -1,17 +1,43 @@ desc "Fetch merchant infos" task :fetch_infos => :environment do require 'open-uri' - - url = "http://www.yp.com.hk/Medical-Beauty-Health-Care-Services-b/Beauty-Health/Beauty-Salons/p1/en/" - doc = Nokogiri::HTML(open(url)) - doc.css(".listing_div").each do |merchant| - name = merchant.at_css(".cname").text - address = merchant.at_css(".addr").text - phone = merchant.at_css(".blacklink").text - if merchant.at_css("div > .bluelink.overunder") != nil - website = merchant.at_css("div > .bluelink.overunder").text - end + + list = [ {url: "Beauty-Health/Beauty-Salons/p1/en/", name: Category.create(name: 'Beauty Salon')}, + {url: "Personal-Services/Massage/p1/en/", name: Category.create(name: 'Massage')}] + + list.each do |category| + fetch_merchants(category[:url], category[:name]) + end +end - puts "#{name} - #{address} - #{phone} - #{website}" +def fetch_merchants(nextUrl, category) + + prefix = "http://www.yp.com.hk/Medical-Beauty-Health-Care-Services-b/" + nextLinkText = "Next" + + while (!nextUrl.empty?) + doc = Nokogiri::HTML(open(prefix+nextUrl)) + doc.css(".listing_div").each do |m| + extract_merchant(m, category) + end + nextUrl = doc.xpath("//a[text()='#{nextLinkText}']/@href").first.to_s + pause 1 end + +end + +def extract_merchant(merchant, category) + m = Merchant.new + m.name = extract_css(merchant, '.cname') + m.address = extract_css(merchant, '.addr') + m.phone = extract_css(merchant, '.blacklink') + m.website = extract_css(merchant, 'div > .bluelink.overunder') + m.category = category + m.save + + puts "[MerchantSaved][#{}] #{m.name} - #{m.address} - #{m.phone} - #{m.website}" +end + +def extract_css(merchant, cssClass) + return (merchant.at_css(cssClass) == nil) ? nil : merchant.at_css(cssClass).text end
Rewrite the nokogiri script to go from page to page
diff --git a/lib/tasks/parallel_testing.rb b/lib/tasks/parallel_testing.rb index abc1234..def5678 100644 --- a/lib/tasks/parallel_testing.rb +++ b/lib/tasks/parallel_testing.rb @@ -7,4 +7,49 @@ concurrency = Sauce::TestBroker.concurrencies ParallelTests::CLI.new.run(["--type", "saucerspec"] + ["-n #{concurrency}", "spec"]) end + + task :install => :create_helper do + spec_helper_path = "spec/spec_helper.rb" + unless File.open(spec_helper_path) { |f| f.read.match "require \"sauce_helper\""} + File.open("spec/spec_helper.rb", "a") do |f| + f.write "require \"sauce_helper\"" + end + else + puts "WARNING - The Sauce gem is already integrated into your rspec setup" + end + puts <<-ENDLINE +The Sauce gem is now installed! + +Next steps: + +1. Edit spec/sauce_helper.rb with your required platforms +2. Make sure we've not mangled your spec/spec_helper.rb requiring sauce_helper +3. Set the SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables +3. Run your tests with 'rake sauce:spec' + + ENDLINE + end + + task :create_helper do + sauce_helper_path = "spec/sauce_helper.rb" + unless File.exists? sauce_helper_path + File.open(sauce_helper_path, "w") do |f| + f.write (<<-ENDFILE +# You should edit this file with the browsers you wish to use +# For options, check out http://www.saucelabs.com/platforms +require "sauce" + +Sauce.config do |c| + c.browsers = [ + ["BROWSER", "OS", "VERSION"], + ["ANOTHER BROWSER", "OS", "VERSION"] + ] end +ENDFILE + ) + end + else + STDERR.puts "WARNING - sauce_helper has already been created." + end + end +end
Install task for rspec parallel Added a task for creating sauce_helper, editing spec_helper, giving further directions upon installation
diff --git a/lib/w2tags/block/block_hot.rb b/lib/w2tags/block/block_hot.rb index abc1234..def5678 100644 --- a/lib/w2tags/block/block_hot.rb +++ b/lib/w2tags/block/block_hot.rb @@ -2,7 +2,8 @@ module Block module BlockHot def bhot_skip_initialize - @key_hot= '' #key for hot + @end_hot= nil + @key_hot= '' #key for hot @doc_hot= [] #bhot buffer @bht = 99 #hot indentation block end @@ -15,6 +16,7 @@ if @bht != 99 make_hot end + @end_hot= nil @key_hot= $3.strip @doc_hot= [] #bhot buffer @bht = @spc.size @@ -23,7 +25,11 @@ make_hot @bht = 99 elsif @row.strip!='' - @doc_hot<< @row + if /(\<\<\/)(.+)/ =~ @row + @end_hot= $2 + else + @doc_hot<< @row + end end end @row = '' if @bht!=99 @@ -41,7 +47,7 @@ end end ref =@doc_hot.collect{|l|l[les,999]}.join - @tg_hot[@key_hot]= [proc {|this|ref}, nil] + @tg_hot[@key_hot]= [proc {|this|ref}, [@end_hot]] end end end
Add functionality for end tags in hot
diff --git a/lib/mina/slack/tasks.rb b/lib/mina/slack/tasks.rb index abc1234..def5678 100644 --- a/lib/mina/slack/tasks.rb +++ b/lib/mina/slack/tasks.rb @@ -4,12 +4,12 @@ if (url = fetch(:slack_url)) && (room = fetch(:slack_room)) if set?(:user) Net::SSH.start(fetch(:domain), fetch(:user)) do |ssh| - set(:last_revision, ssh.exec!("cd #{fetch(:deploy_to)}/scm; git log -n 1 --pretty=format:'%H' origin/#{fetch(:branch)} --")) + set(:last_revision, ssh.exec!("cd #{fetch(:deploy_to)}/scm; git log -n 1 --pretty=format:'%H' #{fetch(:branch)} --")) end else login_data = fetch(:domain).split('@') Net::SSH.start(login_data[1], login_data[0]) do |ssh| - set(:last_revision, ssh.exec!("cd #{fetch(:deploy_to)}/scm; git log -n 1 --pretty=format:'%H' origin/#{fetch(:branch)} --")) + set(:last_revision, ssh.exec!("cd #{fetch(:deploy_to)}/scm; git log -n 1 --pretty=format:'%H' #{fetch(:branch)} --")) end end
Fix fetch last revision from server
diff --git a/lib/minichat/msocket.rb b/lib/minichat/msocket.rb index abc1234..def5678 100644 --- a/lib/minichat/msocket.rb +++ b/lib/minichat/msocket.rb @@ -26,6 +26,8 @@ else nil end + rescue Errno::ECONNRESET => e + nil end def send_message(message)
Handle connection reset by peer