diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/flack.gemspec b/flack.gemspec index abc1234..def5678 100644 --- a/flack.gemspec +++ b/flack.gemspec @@ -32,7 +32,7 @@ s.add_runtime_dependency 'flor' s.add_runtime_dependency 'rack', '>= 1.6', '< 3.0' - s.add_runtime_dependency 'httpclient', '~> 2.8' + #s.add_runtime_dependency 'httpclient', '~> 2.8' s.add_development_dependency 'rspec', '~> 3'
Remove dependency on httpclient gem
diff --git a/Casks/bitwig-studio.rb b/Casks/bitwig-studio.rb index abc1234..def5678 100644 --- a/Casks/bitwig-studio.rb +++ b/Casks/bitwig-studio.rb @@ -1,11 +1,13 @@ cask 'bitwig-studio' do - version '1.3.3' - sha256 '6d614095b1b39e387ed4c96a70342c5d982a6d4a5c71e6a4498f25b7898b909b' + version '1.3.5' + sha256 'f15404e9a2a84fbd0165243af49629da1846252ed5915db4853f212a43daecf1' - url "https://downloads.bitwig.com/Bitwig%20Studio%20#{version}.dmg" + url "https://downloads.bitwig.com/stable/#{version}/Bitwig%20Studio%20#{version}.dmg" name 'Bitwig Studio' homepage 'https://www.bitwig.com' license :commercial + auto_updates true + app 'Bitwig Studio.app' end
Update Bitwig Studio cask to 1.3.5 Add Bitwig Studio auto_updates stanza
diff --git a/test/test_action_scp.rb b/test/test_action_scp.rb index abc1234..def5678 100644 --- a/test/test_action_scp.rb +++ b/test/test_action_scp.rb @@ -0,0 +1,10 @@+require 'helper' + +class TestActionSCP < Test::Unit::TestCase + context "The 'rutty scp' action" do + setup { ensure_fresh_config! } + teardown { clean_test_config! } + + end +end +
Add 'rutty scp' tests file
diff --git a/spec/models/club_spec.rb b/spec/models/club_spec.rb index abc1234..def5678 100644 --- a/spec/models/club_spec.rb +++ b/spec/models/club_spec.rb @@ -1,5 +1,26 @@ require 'spec_helper' describe Club do - skip "add some examples to (or delete) #{__FILE__}" + let(:creator) { + FactoryGirl::create(:user) + } + + let(:club_attrs) { + FactoryGirl::attributes_for(:club) + } + describe "Creation with creator specified" do + it "Adds creator as an admin after the club is created" do + club_attrs["creator"] = creator + club = Club.create(club_attrs) + expect(ClubAdmin.exists?(club_id: club.id, user_id: creator.id)).to be true + end + end + + describe "Creation without creator specified" do + it "Does not change admn count after the club is created" do + expect { + Club.create(club_attrs) + }.not_to change(ClubAdmin, :count) + end + end end
Add tests for club model
diff --git a/site-cookbooks/backup_restore/recipes/setup.rb b/site-cookbooks/backup_restore/recipes/setup.rb index abc1234..def5678 100644 --- a/site-cookbooks/backup_restore/recipes/setup.rb +++ b/site-cookbooks/backup_restore/recipes/setup.rb @@ -1,4 +1,9 @@ include_recipe 'cron' + +package ['zlib-devel', 'xz-devel'] do + action :install +end + # install gem backup with options --no-ri --no-rdoc before include_recipe 'backup' gem_package 'backup' do version node['backup']['version'] if node['backup']['version']
Add required packages to build nokogiri.
diff --git a/Casks/gitbox.rb b/Casks/gitbox.rb index abc1234..def5678 100644 --- a/Casks/gitbox.rb +++ b/Casks/gitbox.rb @@ -3,5 +3,5 @@ homepage 'http://gitboxapp.com/' version '1.6.2' sha1 '20fdea01bf3b26f6ba23fa2b909a7d56cddb6250' - link :app, 'Gitbox.app' + link 'Gitbox.app' end
Simplify link :app, to link
diff --git a/spec/blocktrain/client_spec.rb b/spec/blocktrain/client_spec.rb index abc1234..def5678 100644 --- a/spec/blocktrain/client_spec.rb +++ b/spec/blocktrain/client_spec.rb @@ -20,5 +20,13 @@ expect(described_class.index).to eq('my_cool_index') end + + it 'builds the endpoint' do + allow(ENV).to receive(:[]).with('ES_INDEX') { nil } + allow(ENV).to receive(:[]).with('ES_URL') { 'http://elastic.search' } + + expect(described_class.endpoint).to eq("http://elastic.search/train_data/_search") + end + end end
Add test for endpoint building
diff --git a/lib/tinami.rb b/lib/tinami.rb index abc1234..def5678 100644 --- a/lib/tinami.rb +++ b/lib/tinami.rb @@ -19,7 +19,7 @@ end # Delegate to {TINAMI::Client} - def self.respond_to?(method_name) - return client.respond_to?(method_name) || super + def self.respond_to?(method_name, include_private = false) + return client.respond_to?(method_name, include_private) || super end end
Add optional arg include_private to TINAMI.method_missing
diff --git a/acapi.gemspec b/acapi.gemspec index abc1234..def5678 100644 --- a/acapi.gemspec +++ b/acapi.gemspec @@ -8,8 +8,8 @@ spec.version = Acapi::VERSION spec.authors = ["Dan Thomas"] spec.email = ["dan.thomas@dc.gov"] - spec.summary = %q{Enterprise communication onramp to Affordable Care Act API} - spec.description = %q{TODO: Write a longer description. Optional.} + spec.summary = %q{Enterprise communication onramp to Affordable Care Act API (ACApi)} + spec.description = %q{Publish and subscribe to ACApi cross-application events, services and logging.} spec.homepage = "" spec.license = "MIT"
Add description to avoid bundler throwing exception during install
diff --git a/EliteFramework.podspec b/EliteFramework.podspec index abc1234..def5678 100644 --- a/EliteFramework.podspec +++ b/EliteFramework.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |spec| spec.name = "EliteFramework" - spec.version = "4.0.1" + spec.version = "4.2.1" spec.summary = "UI and NS extended, write shortcode do more." spec.homepage = "https://github.com/Lifelong-Study/EliteFramework" spec.license = { type: 'MIT', file: 'LICENSE' }
Update .podspec version to 4.2.1
diff --git a/test/register_test.rb b/test/register_test.rb index abc1234..def5678 100644 --- a/test/register_test.rb +++ b/test/register_test.rb @@ -0,0 +1,22 @@+require 'test_helper' + +describe 'Redis::Breadcrumb' do + before do + Redis::Breadcrumb.redis = MockRedis.new + end + + it 'can register owned keys for a specific object' do + class OwnedBreadcrumb < Redis::Breadcrumb + owns 'widget:<id>' + end + + obj = Object.new + class << obj + def id; "foo"; end + end + + breadcrumb = OwnedBreadcrumb.register(obj) + + assert_equal [["del", "widget:foo"]], breadcrumb.tracked_keys + end +end
Add test 'can register owned keys for a specific object'
diff --git a/app/controllers/metrics_controller.rb b/app/controllers/metrics_controller.rb index abc1234..def5678 100644 --- a/app/controllers/metrics_controller.rb +++ b/app/controllers/metrics_controller.rb @@ -6,12 +6,21 @@ STEP = 10 # GET def get + unless params[:metric] then + render json: available_metrics + return + end + m = params[:metric] + now = Time.now().to_i - start = (params[:start] || now - START).to_i stop = (params[:stop] || now - STOP).to_i step = (params[:step] || STEP).to_i - m = params[:metric] + + unless available_metrics.include? m then + render json: {error: "Metric '#{m}' not in list of available metrics"} + return + end begin metric = get_metric(m, start, stop, step) @@ -23,6 +32,10 @@ end # Functions + def available_metrics + Backend::GenericBackend.new.get_cached_metrics_list + end + def get_metric m, start, stop, step type, metric = m.split(":")
Add metrics listing to metrics controller when no metric given Logic and API RESTfulness to follow
diff --git a/app/controllers/sources_controller.rb b/app/controllers/sources_controller.rb index abc1234..def5678 100644 --- a/app/controllers/sources_controller.rb +++ b/app/controllers/sources_controller.rb @@ -13,6 +13,8 @@ end def create + return redirect_alert unless @is_admin + if SourceResolver.resolve(source) redirect_to sources_path else @@ -32,6 +34,10 @@ private + def redirect_alert + redirect_to(sources_url, alert: 'Wrong permissions') + end + def source_params params.require(:source).permit( :name,
Add permissions check when submitting sources form
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -19,6 +19,10 @@ module Transitmix class App < Sinatra::Application set :root, File.expand_path('../', __FILE__) + + configure :production do + require 'newrelic_npm' + end end end
Set New Relic to only run on prod
diff --git a/app/models/spree/variant_decorator.rb b/app/models/spree/variant_decorator.rb index abc1234..def5678 100644 --- a/app/models/spree/variant_decorator.rb +++ b/app/models/spree/variant_decorator.rb @@ -0,0 +1,11 @@+Spree::Variant.class_eval do + + scope :complete_order, -> { joins(:orders).where.not(spree_orders: { completed_at: nil }) } + + def self.sales_sku + select("spree_variants.id, spree_variants.sku, spree_products.name, spree_variants.variant_name, SUM(spree_line_items.quantity) AS quantity, spree_prices.amount"). + joins(:product, :default_price). + complete_order. + group("spree_variants.id, spree_variants.sku, spree_products.name, spree_prices.amount, spree_variants.variant_name") + end +end
Add scope for get variant data
diff --git a/has_magic_columns.gemspec b/has_magic_columns.gemspec index abc1234..def5678 100644 --- a/has_magic_columns.gemspec +++ b/has_magic_columns.gemspec @@ -1,6 +1,5 @@ # -*- encoding: utf-8 -*- -#lib = File.expand_path('../lib/', __FILE__) -$:.push File.expand_path("../lib", __FILE__) #lib unless $:.include?(lib) +$:.push File.expand_path("../lib", __FILE__) require 'has_magic_columns/version' Gem::Specification.new do |s|
Remove old comments from gemspec
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 @@ -1,4 +1,7 @@- class CodeclimateCi::GetGpa +module CodeclimateCi + class GetGpa + NULL_VALUE = 0 + def initialize(api_requester, branch) @api_requester, @branch = api_requester, branch end @@ -9,7 +12,7 @@ wait_and_refresh! end - 0 + NULL_VALUE end private
Add NULL_VALUE constant in GetGpa class
diff --git a/server.rb b/server.rb index abc1234..def5678 100644 --- a/server.rb +++ b/server.rb @@ -1,20 +1,13 @@ require 'sinatra' # dumblib -class App - @@text_id = nil - def self.text_id *args - if args.empty? - @@text_id - else - @@text_id = args.first - end - end -end - module Dumbstore module Text @@apps = {} + + def self.apps + @@apps + end def self.get id # TODO app not found @@ -23,6 +16,17 @@ def self.register_app id, app_class @@apps[id] = app_class + end + end +end + +class App + @@text_id = nil + def self.text_id *args + if args.empty? + @@text_id + else + @@text_id = args.first end end end @@ -37,13 +41,12 @@ end def text params - puts "the weather in #{params['Body']} is probably shitty!" + "<Response><Sms>The weather in #{params['Body']} is probably shitty!</Sms></Response>" end end # startup Dumbstore::Text.register_app Weather.text_id, Weather - get '/' do erb :index
Fix bugs in dummy weather app
diff --git a/imgur.gemspec b/imgur.gemspec index abc1234..def5678 100644 --- a/imgur.gemspec +++ b/imgur.gemspec @@ -4,7 +4,7 @@ require 'imgur/version' Gem::Specification.new do |spec| - spec.name = 'imgur' + spec.name = 'imgur-api' spec.version = Imgur::VERSION spec.authors = ['August'] spec.email = ['augustt198@gmail.com']
Change name to avoid RubyGems conflict
diff --git a/TreasureData-iOS-SDK.podspec b/TreasureData-iOS-SDK.podspec index abc1234..def5678 100644 --- a/TreasureData-iOS-SDK.podspec +++ b/TreasureData-iOS-SDK.podspec @@ -4,7 +4,7 @@ s.summary = "TreasureData SDK for iOS." s.license = "Apache" s.author = { "TreasureData" => "mitsu@treasure-data.com" } - s.platforms = { :ios => "", :tvos => "" } + s.platforms = { :ios => "5.0", :tvos => "5.0" } s.homepage = "https://github.com/treasure-data/td-ios-sdk" s.source = { :git => "https://github.com/treasure-data/td-ios-sdk.git", :tag => "0.1.17.1" } s.source_files = 'TreasureData'
Set minimum iOS version on `platform` in the podspec file
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -10,6 +10,7 @@ include_recipe 'pacman' package('git') { action :install } +package('hub') { action :install } git "#{Chef::Config[:file_cache_path]}/git-extras" do repository 'git://github.com/visionmedia/git-extras.git'
Install 'hub' from community package
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -22,6 +22,6 @@ template "/etc/apt/sources.list" do mode 00644 variables :code_name => node['lsb']['codename'] - notifies :run, resources(:execute => "apt-get update"), :immediately + notifies :run, "execute[apt-get update]", :immediately source "sources.list.erb" -end +end
Use the new format for notifies
diff --git a/recipes/disable.rb b/recipes/disable.rb index abc1234..def5678 100644 --- a/recipes/disable.rb +++ b/recipes/disable.rb @@ -23,7 +23,8 @@ swap_devices += node['filesystem'].select { |_fs, conf| conf['fs_type'] == 'swap' }.keys swap_devices.uniq.each do |swap_device| - mount 'none' do + mount "none_#{swap_device}" do + name 'none' device swap_device fstype 'swap' action :disable
Make sure resource name is unique on each loop run
diff --git a/recipes/smartos.rb b/recipes/smartos.rb index abc1234..def5678 100644 --- a/recipes/smartos.rb +++ b/recipes/smartos.rb @@ -18,5 +18,10 @@ # potentially_at_compile_time do + package 'autoconf' + package 'binutils' package 'build-essential' + package 'gcc47' + package 'gmake' + package 'pkg-config' end
Add more development packages for SmartOS
diff --git a/justice.gemspec b/justice.gemspec index abc1234..def5678 100644 --- a/justice.gemspec +++ b/justice.gemspec @@ -21,7 +21,7 @@ s.test_files = s.files.grep(%r{^(spec|features)/}) s.require_paths = [ 'lib' ] - s.add_development_dependency 'bundler', '~> 1.3' + s.add_development_dependency 'bundler', '>= 1.2.5' s.add_development_dependency 'rake' s.add_development_dependency 'rspec' end
Allow Bundler 1.2.5 for Ruby 1.0.
diff --git a/db/migrate/20171019023214_add_tenant_name_to_sites.rb b/db/migrate/20171019023214_add_tenant_name_to_sites.rb index abc1234..def5678 100644 --- a/db/migrate/20171019023214_add_tenant_name_to_sites.rb +++ b/db/migrate/20171019023214_add_tenant_name_to_sites.rb @@ -4,6 +4,9 @@ def change add_column(:sites, :tenant_name, :string) add_index(:sites, :tenant_name) + + Site.connection.schema_cache.clear! + Site.reset_column_information reversible do |direction| direction.up { apply_tenant_name if main_site? }
Update schema information for site when update tenant name
diff --git a/yertle_formatter.gemspec b/yertle_formatter.gemspec index abc1234..def5678 100644 --- a/yertle_formatter.gemspec +++ b/yertle_formatter.gemspec @@ -18,7 +18,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_runtime_dependency "rspec", ">= 3.0.0" + spec.add_runtime_dependency "rspec", ">= 3.0" spec.add_development_dependency "bundler", "~> 1.6" spec.add_development_dependency "rake"
Update to support any 3.x version of rspec
diff --git a/lib/rubocop/cop/lint/duplicate_case_condition.rb b/lib/rubocop/cop/lint/duplicate_case_condition.rb index abc1234..def5678 100644 --- a/lib/rubocop/cop/lint/duplicate_case_condition.rb +++ b/lib/rubocop/cop/lint/duplicate_case_condition.rb @@ -17,7 +17,7 @@ # end # class DuplicateCaseCondition < Cop - MSG = 'Redundant when condition detected.'.freeze + MSG = 'Duplicate `when` condition detected.'.freeze def on_case(case_node) _condition, *whens, _else = *case_node
Improve a bit the message of DuplicateCaseCondition
diff --git a/lib/slackbot_frd/slack_methods/validate_slack.rb b/lib/slackbot_frd/slack_methods/validate_slack.rb index abc1234..def5678 100644 --- a/lib/slackbot_frd/slack_methods/validate_slack.rb +++ b/lib/slackbot_frd/slack_methods/validate_slack.rb @@ -13,7 +13,7 @@ else 'Slack returned an error' end - raise AuthenticationFailedError.new("#{msg} - response: #{response}") + raise StandardError.new("#{msg} - response: #{response}") end end end
Switch validation error to StandardError
diff --git a/lib/ruby_hue.rb b/lib/ruby_hue.rb index abc1234..def5678 100644 --- a/lib/ruby_hue.rb +++ b/lib/ruby_hue.rb @@ -1,10 +1,12 @@ require "ruby_hue/version" -require "ruby_hue/client" -require "ruby_hue/model" -require "ruby_hue/light" -require "ruby_hue/light/basic_state" -require "ruby_hue/light/state" -require "ruby_hue/bridge" module RubyHue + autoload :Client, "ruby_hue/client" + autoload :Bridge, "ruby_hue/bridge" + autoload :Model, "ruby_hue/model" + autoload :Light, "ruby_hue/light" + autoload :LightsCollection, "ruby_hue/lights_collection" end + +require "ruby_hue/light/basic_state" +require "ruby_hue/light/state"
Move everything into autoloads that can be.
diff --git a/scss_toolkit_rails.gemspec b/scss_toolkit_rails.gemspec index abc1234..def5678 100644 --- a/scss_toolkit_rails.gemspec +++ b/scss_toolkit_rails.gemspec @@ -18,6 +18,6 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_development_dependency "bundler", "~> 1.6" + spec.add_development_dependency "bundler", "~> 1.6.0.pre.1" spec.add_development_dependency "rake" end
Change bundler version spec in Gemfile
diff --git a/Casks/scansnap-manager.rb b/Casks/scansnap-manager.rb index abc1234..def5678 100644 --- a/Casks/scansnap-manager.rb +++ b/Casks/scansnap-manager.rb @@ -2,7 +2,7 @@ url 'http://www.fujitsu.com/downloads/IMAGE/driver/ss/mgr/m-sv600/MacScanSnapV62L10WW.dmg' homepage 'http://www.fujitsu.com/global/support/computing/peripheral/scanners/software/' version '6.2L10' - no_checksum + sha256 '7273034398e9a57eb0fa89167c9e801ad2bf9fe56b52b3d9591628e978168afb' install 'ScanSnap Manager.pkg' uninstall :pkgutil => 'jp.co.pfu.ScanSnap.*' end
Update sha256 for ScanSnap Manager
diff --git a/lib/helper.rb b/lib/helper.rb index abc1234..def5678 100644 --- a/lib/helper.rb +++ b/lib/helper.rb @@ -5,32 +5,15 @@ class LadderHelper - def self.dynamic_chunk(klass_or_collection, factor = 1) + def self.chunkify(klass_or_collection, opts = {}) - # super rough/hacky free mem calculation (includes inactive) - mem_total_bytes = `sysctl -n hw.memsize`.to_i - return 1000 if 0 == mem_total_bytes - - if klass_or_collection.is_a? Mongoid::Collection - stats = klass_or_collection.stats - else - stats = klass_or_collection.collection.stats + # ensure we are dealing with a Mongoid::Criteria + unless klass_or_collection.is_a? Mongoid::Criteria + klass_or_collection = Mongoid::Criteria.new(klass_or_collection) end - mem_used_bytes = `ps -Ao rss=` - mem_free_bytes = mem_total_bytes - mem_used_bytes.split.map(&:to_i).inject(&:+).to_i * 1024 - max_per_proc = (klass_or_collection.size(true).to_f / Parallel.processor_count.to_f) - max_per_free = mem_free_bytes.to_f / (stats['avgObjSize'].to_f * Parallel.processor_count.to_f) - - # minimum chunk size is 1000 - chunk_size = [([max_per_proc.to_f, max_per_free.to_f].min + 1).ceil / factor, 1000].max - - chunk_size - end - - def self.chunkify(klass_or_collection, opts = {}) - - options = {:chunk_num => 1, :per_chunk => dynamic_chunk(klass_or_collection)}.merge(opts) + # default to chunks of 1000 to avoid mongo cursor timeouts for large sets + options = {:chunk_num => 1, :per_chunk => 1000}.merge(opts) chunks = [] while chunk = klass_or_collection.page(options[:chunk_num]).per(options[:per_chunk]) \
Remove LadderHelper::dynamic chunk; default to 1000 docs/chunk
diff --git a/db/migrate/20151119100750_change_description_column_types.rb b/db/migrate/20151119100750_change_description_column_types.rb index abc1234..def5678 100644 --- a/db/migrate/20151119100750_change_description_column_types.rb +++ b/db/migrate/20151119100750_change_description_column_types.rb @@ -4,7 +4,7 @@ [:draft_content_items, DraftContentItem], [:live_content_items, LiveContentItem], ].each do |table, model| - add_column table, :new_description, :json, default: { value: nil } + add_column table, :new_description, :json # http://www.postgresql.org/docs/9.3/static/functions-json.html#FUNCTIONS-JSON-TABLE ActiveRecord::Base.connection.execute(%{ @@ -12,6 +12,11 @@ where description is not null }) + change_column_default table, :new_description, { value: nil } + model.where(new_description: nil).find_each do |item| + item.update_column(:new_description, { value: nil }.to_json) + end + rename_column table, :description, :old_description rename_column table, :new_description, :description end
Set the column default after the data migration… This makes it so that the table isn’t locked during the slow data migration (about 15 seconds or so)
diff --git a/lib/rtrail.rb b/lib/rtrail.rb index abc1234..def5678 100644 --- a/lib/rtrail.rb +++ b/lib/rtrail.rb @@ -0,0 +1,19 @@+[ + 'api', + 'case', + 'client', + 'entity', + 'exceptions', + 'plan', + 'project', + 'result', + 'run', + 'suite', + 'test' +].each do |file| + require_relative "rtrail/#{file}" +end + +module RTrail +end +
Make it easier to require all of RTrail
diff --git a/transam_spatial.gemspec b/transam_spatial.gemspec index abc1234..def5678 100644 --- a/transam_spatial.gemspec +++ b/transam_spatial.gemspec @@ -23,7 +23,7 @@ s.add_development_dependency "rspec-rails" s.add_development_dependency "factory_girl_rails" s.add_development_dependency "database_cleaner" - s.add_development_dependency "sqlite3" + s.add_development_dependency "mysql2" s.add_development_dependency "cucumber-rails" end
Use the mysql gem required for testing
diff --git a/omniauth-teamsnap.gemspec b/omniauth-teamsnap.gemspec index abc1234..def5678 100644 --- a/omniauth-teamsnap.gemspec +++ b/omniauth-teamsnap.gemspec @@ -19,7 +19,7 @@ spec.add_dependency "omniauth", "~> 1.2" spec.add_dependency "omniauth-oauth2", "1.3.1" - spec.add_dependency "faraday", ">= 0.9.2" + spec.add_dependency "faraday", "~> 0.9", ">= 0.9.2" spec.add_development_dependency "rspec", "~> 2.7" spec.add_development_dependency "rack-test" spec.add_development_dependency "simplecov"
Improve version reference for Faraday
diff --git a/SwiftlySalesforce.podspec b/SwiftlySalesforce.podspec index abc1234..def5678 100644 --- a/SwiftlySalesforce.podspec +++ b/SwiftlySalesforce.podspec @@ -22,7 +22,7 @@ 'SwiftlySalesforce' => ['Pod/Assets/*.png'] } - s.dependency 'PromiseKit', '~> 3.0' + s.dependency 'PromiseKit', '~> 3.2.1' s.dependency 'Alamofire', '~> 3.0' s.dependency 'Locksmith', '~> 2.0' end
Upgrade PromiseKit dependency to '~> 3.2.1'
diff --git a/spec/models/publisher_spec.rb b/spec/models/publisher_spec.rb index abc1234..def5678 100644 --- a/spec/models/publisher_spec.rb +++ b/spec/models/publisher_spec.rb @@ -36,4 +36,9 @@ other = build(:publisher, endpoint: publisher.endpoint) expect(other).not_to be_valid end + + it 'requires a city' do + publisher = build(:publisher, city: '') + expect(publisher).not_to be_valid + end end
Add spec for publisher validation
diff --git a/nokogiri/google_finance/spec/stock_trend_spec.rb b/nokogiri/google_finance/spec/stock_trend_spec.rb index abc1234..def5678 100644 --- a/nokogiri/google_finance/spec/stock_trend_spec.rb +++ b/nokogiri/google_finance/spec/stock_trend_spec.rb @@ -4,10 +4,29 @@ let(:s) { StockTrend.new } - # check google finance url - it 'should have the google url' do - webpage = 'https://www.google.com/finance?hl=en&ei=DongVvm_MdOS2AaU9JbAAQ' - expect(s.url).to eq(webpage) + describe 'variables' do + # check google finance url + it 'should have the google url' do + webpage = 'https://www.google.com/finance?hl=en&ei=DongVvm_MdOS2AaU9JbAAQ' + expect(s.url).to eq(webpage) + end + + # check google finance url + it 'should have the goolge target ID' do + id = '#topmovers' + expect(s.trend_id).to eq(id) + end + + # check data array to be empty + it 'should have an empty array for data' do + expect(s.data.length).to be(0) + end end + pending '#html' do + it 'returns a Nokogiri object back' do + html = s.html + expect(html).to be_instance_of(Nokogiri) + end + end end
Return html nokogiri objects back
diff --git a/test/integration_test.rb b/test/integration_test.rb index abc1234..def5678 100644 --- a/test/integration_test.rb +++ b/test/integration_test.rb @@ -25,7 +25,7 @@ def test_fizz_test_is_selected @repo.checkout('change_fizz') output = RakeHelper.rake('ttnt:test:run', dir: @repo.workdir) - assert_match /1 runs, 1 assertions, 1 failures/, output[:stdout] + assert_match '1 runs, 1 assertions, 1 failures', output[:stdout] end end end
Use string instead of regexp
diff --git a/event_store-client-http.gemspec b/event_store-client-http.gemspec index abc1234..def5678 100644 --- a/event_store-client-http.gemspec +++ b/event_store-client-http.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'event_store-client-http' - s.version = '0.3.0' + s.version = '0.3.1' s.summary = 'HTTP Client for EventStore' s.description = ' '
Package version is increased from 0.3.0 to 0.3.1
diff --git a/Formula/chocolate-doom.rb b/Formula/chocolate-doom.rb index abc1234..def5678 100644 --- a/Formula/chocolate-doom.rb +++ b/Formula/chocolate-doom.rb @@ -7,6 +7,7 @@ depends_on 'sdl' depends_on 'sdl_net' + depends_on 'sdl_mixer' def install system "./configure", "--prefix=#{prefix}",
Add missing depend for sdl_mixer
diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb index abc1234..def5678 100644 --- a/test/application_system_test_case.rb +++ b/test/application_system_test_case.rb @@ -21,7 +21,7 @@ "#{file_name}-#{format("%02d", @counter)}.png" ) page.save_screenshot(Rails.root.join(relative_location)) - puts "[Screenshot]: #{relative_location}" + # puts "[Screenshot]: #{relative_location}" end def click_form_submit
Remove extra output in system tests
diff --git a/test/test_helper.rb b/test/test_helper.rb index abc1234..def5678 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -19,6 +19,7 @@ class ActiveSupport::TestCase fixtures :all + include FactoryGirl::Syntax::Methods end require_dependency 'auth/current_user_provider'
Add FactoryGirl helpers to tests
diff --git a/test/test_helper.rb b/test/test_helper.rb index abc1234..def5678 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -15,6 +15,7 @@ require 'rails/test_help' require 'mocha/setup' +Mocha::Configuration.prevent(:stubbing_non_existent_method) require 'webmock/minitest' WebMock.disable_net_connect!(allow_localhost: true, net_http_connect_on_start: true)
Configure Mocha to prevent stubbing of non-existent methods Stubbing non-existent methods can lead to tests which don't test the real interactions between objects. Dangerous!
diff --git a/TilllessBCScanner.podspec b/TilllessBCScanner.podspec index abc1234..def5678 100644 --- a/TilllessBCScanner.podspec +++ b/TilllessBCScanner.podspec @@ -1,24 +1,25 @@ Pod::Spec.new do |s| - s.name = "TilllessBCScanner" - s.version = "0.0.2" - s.summary = "TBarcodeScannerViewController suitable for working with RubyMotion." - s.description = <<-DESC - Concrete implementation of AVCaptureMetadataOutputObjectsDelegate in - TBarcodeScannerViewController to work with RubyMotion. - DESC - s.homepage = 'https://github.com/tillless/bcscanner' - s.license = 'MIT' - s.author = { "Tillless" => "info@tillless.com" } - s.source = { :git => 'https://github.com/tillless/bcscanner.git', :tag => s.version.to_s } - s.social_media_url = 'https://twitter.com/tillless' + s.name = "TilllessBCScanner" + s.version = "0.0.2" + s.summary = "TBarcodeScannerViewController suitable for working with RubyMotion." + s.description = <<-DESC + Concrete implementation of AVCaptureMetadataOutputObjectsDelegate in + TBarcodeScannerViewController to work with RubyMotion. + DESC + s.homepage = 'https://github.com/tillless/bcscanner' + s.license = 'MIT' + s.author = { "Tillless" => "info@tillless.com" } + s.source = { :git => 'https://github.com/tillless/bcscanner.git', :tag => s.version.to_s } + s.social_media_url = 'https://twitter.com/tillless' - s.platform = :ios, '8.1' - s.requires_arc = true + s.platform = :ios, '8.1' + s.requires_arc = true - s.source_files = 'Pod/Classes/**/*' - s.resource_bundles = { + s.source_files = 'Pod/Classes/**/*' + s.public_header_files = 'Pod/Classes/**/*.h' + s.resource_bundles = { 'TilllessBCScanner' => ['Pod/Assets/*.png'] } - s.frameworks = 'UIKit', 'QuartzCore' + s.frameworks = 'UIKit', 'QuartzCore' end
Update to remedy after upgrade to 0.36.1 of cocoapods
diff --git a/lib/benchmark_email_api.rb b/lib/benchmark_email_api.rb index abc1234..def5678 100644 --- a/lib/benchmark_email_api.rb +++ b/lib/benchmark_email_api.rb @@ -3,11 +3,14 @@ require "net/https" require "openssl" require "xmlrpc/client" +require "uri" module BenchmarkEmailApi class Client def initialize(username,password,api_url) - @server = XMLRPC::Client.new2(api_url) + uri = URI(api_url) + @server = XMLRPC::Client.new2(uri) + @server.http_header_extra = {'accept-encoding' => 'identity'} $ok, result = @server.call2('login', username, password) if $ok @token = result
Add headers to avoid error.
diff --git a/lib/cocoapods/file_list.rb b/lib/cocoapods/file_list.rb index abc1234..def5678 100644 --- a/lib/cocoapods/file_list.rb +++ b/lib/cocoapods/file_list.rb @@ -30,18 +30,7 @@ end end -module Pod - FileList = Rake::FileList -end - -class Pathname - alias_method :_original_sum, :+ - def +(other) - if other.is_a?(Rake::FileList) - other.prepend_patterns(self) - other - else - _original_sum(other) - end - end -end +# TODO Defined in CocoaPods Core +# module Pod +# FileList = Rake::FileList +# end
[FileList] Remove unnecessary monkey patch and move definition of Pod::FileList
diff --git a/lib/dbd_onto/provenance.rb b/lib/dbd_onto/provenance.rb index abc1234..def5678 100644 --- a/lib/dbd_onto/provenance.rb +++ b/lib/dbd_onto/provenance.rb @@ -12,23 +12,27 @@ def provenance return @provenance if @provenance @provenance = Dbd::ProvenanceResource.new - context_public = Dbd::ProvenanceFact.new( - predicate: 'prov:context', - object: 'public') - @provenance << context_public + @provenance << provenance_fact_context_public end def resource return @resource if @resource @resource = Dbd::Resource.new(provenance_subject: provenance.subject) - predicate_context = Dbd::Fact.new( - predicate: 'meta:defines_predicate', - object: 'prov:context') - label_context = Dbd::Fact.new( - predicate: RDF::RDFS.label.qname.join(':'), - object: 'Context') - @resource << predicate_context - @resource << label_context + @resource << fact_defines_predicate_prov_context + @resource << fact_label_context + end + + def provenance_fact_context_public + Dbd::ProvenanceFact.new(predicate: 'prov:context', object: 'public') + end + + def fact_defines_predicate_prov_context + Dbd::Fact.new(predicate: 'meta:defines_predicate', object: 'prov:context') + end + + def fact_label_context + # TODO in Dbd : turn predicate into a proper Predicate class + Dbd::Fact.new(predicate: RDF::RDFS.label.qname.join(':'), object: 'Context') end end
Apply some Sandi Metz rules for refactoring * a lot more readable now :-) * spefically the paragraph below from http://robots.thoughtbot.com/post/50655960596/sandi-metz-rules-for-developers is relevant: "Having only one line per branch urged us to use well-named private methods to get work done. Private methods are great documentation. They need very clear names, which forced us to think about the content of the code we were extracting."
diff --git a/lib/docs/scrapers/cmake.rb b/lib/docs/scrapers/cmake.rb index abc1234..def5678 100644 --- a/lib/docs/scrapers/cmake.rb +++ b/lib/docs/scrapers/cmake.rb @@ -21,8 +21,13 @@ Licensed under the BSD 3-clause License. HTML + version '3.7' do + self.release = '3.7.0' + self.base_url = 'https://cmake.org/cmake/help/v3.6/' + end + version '3.6' do - self.release = '3.6.2' + self.release = '3.6.3' self.base_url = 'https://cmake.org/cmake/help/v3.6/' end
Update CMake documentation (3.7.0, 3.6.3, 3.5.2)
diff --git a/lib/feed2email/database.rb b/lib/feed2email/database.rb index abc1234..def5678 100644 --- a/lib/feed2email/database.rb +++ b/lib/feed2email/database.rb @@ -11,11 +11,18 @@ private - def setup_connection(options) - @connection = Sequel.connect(options) + def create_entries_table + connection.create_table? :entries do + primary_key :id + foreign_key :feed_id, :feeds, null: false, index: true, + on_delete: :cascade + String :uri, null: false, unique: true + Time :created_at + Time :updated_at + end end - def setup_schema + def create_feeds_table connection.create_table? :feeds do primary_key :id String :uri, null: false, unique: true @@ -27,15 +34,15 @@ Time :created_at Time :updated_at end + end - connection.create_table? :entries do - primary_key :id - foreign_key :feed_id, :feeds, null: false, index: true, - on_delete: :cascade - String :uri, null: false, unique: true - Time :created_at - Time :updated_at - end + def setup_connection(options) + @connection = Sequel.connect(options) + end + + def setup_schema + create_feeds_table + create_entries_table end end end
Create each table in a separate method SRP
diff --git a/lib/frecon/models/robot.rb b/lib/frecon/models/robot.rb index abc1234..def5678 100644 --- a/lib/frecon/models/robot.rb +++ b/lib/frecon/models/robot.rb @@ -11,9 +11,13 @@ module FReCon class Robot < Model + # This is an optional field we included for organization. field :name, type: String belongs_to :competition belongs_to :team + + validates :competition_id, :team_id, presence: true + validates :team_id, uniqueness: { scope: :competition_id } end end
Add some validations for the Robot
diff --git a/lib/honey_format/header.rb b/lib/honey_format/header.rb index abc1234..def5678 100644 --- a/lib/honey_format/header.rb +++ b/lib/honey_format/header.rb @@ -10,8 +10,12 @@ # @param [Array] valid array of symbols representing valid columns. # @raise [MissingCSVHeaderError] raised when header is missing (empty or nil). def initialize(header, valid: :all, converter: ConvertHeaderValue) - @column_names = build_header(header) - @columns = Columns.new(@column_names, valid: valid, converter: converter) + if header.nil? || header.empty? + fail(MissingCSVHeaderError, "CSV header can't be empty.") + end + + @column_names = header + @columns = Columns.new(header, valid: valid, converter: converter) end # Returns columns as array. @@ -19,14 +23,5 @@ def columns @columns.to_a end - - private - - def build_header(header) - if header.nil? || header.empty? - fail(MissingCSVHeaderError, "CSV header can't be empty.") - end - Sanitize.array!(header) - end end end
Remove unneeded method and call to Sanitize::array
diff --git a/lib/mutant/mutator/self.rb b/lib/mutant/mutator/self.rb index abc1234..def5678 100644 --- a/lib/mutant/mutator/self.rb +++ b/lib/mutant/mutator/self.rb @@ -0,0 +1,21 @@+module Mutant + class Mutator + # Mutator for Rubinius::AST::Self + class Self < Mutator + + handle(Rubinius::AST::Self) + + private + + # Emit mutations + # + # @return [undefined] + # + # @api private + # + def dispatch + # noop + end + end + end +end
Add noop mutator for Rubinius::AST::Self
diff --git a/lib/pdf/reader/bookmark.rb b/lib/pdf/reader/bookmark.rb index abc1234..def5678 100644 --- a/lib/pdf/reader/bookmark.rb +++ b/lib/pdf/reader/bookmark.rb @@ -16,7 +16,7 @@ end def level - parent ? parent.level + 1 : 1 + @parent ? @parent.level + 1 : 1 end def find_page(object, objects)
Fix problem with level calculation in Bookmark
diff --git a/lib/smartsheet/api/faraday_adapter/middleware/response_parser.rb b/lib/smartsheet/api/faraday_adapter/middleware/response_parser.rb index abc1234..def5678 100644 --- a/lib/smartsheet/api/faraday_adapter/middleware/response_parser.rb +++ b/lib/smartsheet/api/faraday_adapter/middleware/response_parser.rb @@ -13,7 +13,7 @@ def call(env) @app.call(env).on_complete do |response_env| - if response_env[:response_headers]['content-type'] =~ /\bjson\b/ + if response_env[:response_headers]['content-type'] =~ /\bapplication\/json\b/ response_env[:body] = JSON.parse(response_env[:body], symbolize_names: true) end
Change json parser to check for 'application/json' not 'json'
diff --git a/POSLMDB.podspec b/POSLMDB.podspec index abc1234..def5678 100644 --- a/POSLMDB.podspec +++ b/POSLMDB.podspec @@ -12,7 +12,7 @@ s.source = { :git => 'https://github.com/pavelosipov/POSLMDB.git', :submodules => true } s.source_files = %w{ mdb.c lmdb.h midl.h midl.c }.map { |f| File.join "lmdb-library/libraries/liblmdb", f } - s.module_name = 'lmdb' + s.header_mappings_dir = 'lmdb-library/libraries' s.requires_arc = false s.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'MDB_USE_POSIX_SEM=1'
Replace module_name attribute with header_mappings_dir.
diff --git a/db/migrate/20160802075029_create_user_notifications.rb b/db/migrate/20160802075029_create_user_notifications.rb index abc1234..def5678 100644 --- a/db/migrate/20160802075029_create_user_notifications.rb +++ b/db/migrate/20160802075029_create_user_notifications.rb @@ -2,7 +2,7 @@ change do create_table :user_notifications do foreign_key :user_id, :users, type: :uuid, null: false, on_delete: :cascade, primary_key: true - String :notifications, null: false, type: 'json' + String :notifications, null: false, type: 'json', default: '{}' end end end
Add default to user notifications
diff --git a/logs/attributes/default.rb b/logs/attributes/default.rb index abc1234..def5678 100644 --- a/logs/attributes/default.rb +++ b/logs/attributes/default.rb @@ -3,5 +3,5 @@ default[:logs][:apache] = true default[:logs][:symfony_datetime] = '[%Y-%m-%d %H:%M:%S]' default[:logs][:install_dir] = '/opt/aws/cloudwatch' -default[:logs][:script_url] = 'https://s3.amazonaws.com/aws-cloudwatch/downloads/latest/awslogs-agent-setup.py' +default[:logs][:script_url] = 'https://s3.amazonaws.com/aws-cloudwatch/downloads/1.3.9/awslogs-agent-setup.py' default[:logs][:script] = 'awslogs-agent-setup.py'
Use version 1.3.9 of cloud watch installer as its broken in newer release
diff --git a/lib/jsonapi/rails/serializable_active_model_errors.rb b/lib/jsonapi/rails/serializable_active_model_errors.rb index abc1234..def5678 100644 --- a/lib/jsonapi/rails/serializable_active_model_errors.rb +++ b/lib/jsonapi/rails/serializable_active_model_errors.rb @@ -25,7 +25,7 @@ end def as_jsonapi - @errors.keys.flat_map do |key| + error_keys.flat_map do |key| @errors.full_messages_for(key).map do |message| SerializableActiveModelError.new(field: key, message: message, pointer: @reverse_mapping[key]) @@ -33,6 +33,12 @@ end end end + + private + + def error_keys + @errors.respond_to?(:attribute_names) ? @errors.attribute_names : @errors.keys + end end end end
Use active record error attribute_names intead errors.keys if available
diff --git a/peeek.gemspec b/peeek.gemspec index abc1234..def5678 100644 --- a/peeek.gemspec +++ b/peeek.gemspec @@ -4,19 +4,20 @@ require 'peeek/version' Gem::Specification.new do |spec| - spec.name = 'peeek' - spec.version = Peeek::VERSION - spec.authors = ['Takahiro Kondo'] - spec.email = ['heartery@gmail.com'] - spec.description = %q{TODO: Write a gem description} - spec.summary = %q{TODO: Write a gem summary} - spec.homepage = '' - spec.license = 'MIT' + spec.name = 'peeek' + spec.version = Peeek::VERSION + spec.authors = ['Takahiro Kondo'] + spec.email = ['heartery@gmail.com'] + spec.description = %q{Peek at calls of a method} + spec.summary = spec.description + spec.homepage = 'https://github.com/takkkun/peeek' + spec.license = 'MIT' + spec.required_ruby_version = '>= 1.8.7' - spec.files = `git ls-files`.split($/) - spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) - spec.require_paths = ['lib'] + spec.files = `git ls-files`.split($/) + spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } + spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) + spec.require_paths = ['lib'] spec.add_development_dependency 'bundler', '~> 1.3' spec.add_development_dependency 'rake'
Write summary and description of gemspec
diff --git a/week-4/simple-string.rb b/week-4/simple-string.rb index abc1234..def5678 100644 --- a/week-4/simple-string.rb +++ b/week-4/simple-string.rb @@ -0,0 +1,26 @@+# Solution Below + +# RSpec Tests. They are included in this file because the local variables you are creating are not accessible across files. If we try to run these files as a separate file per normal operation, the local variable checks will return nil. + +old_string = "Ruby is cool" +new_string = old_string.reverse.upcase + +describe "old_string" do + it 'is defined as a local variable' do + expect(defined?(old_string)).to eq 'local-variable' + end + + it "has the value 'Ruby is cool'" do + expect(old_string).to eq "Ruby is cool" + end +end + +describe 'new_string' do + it 'is defined as a local variable' do + expect(defined?(new_string)).to eq 'local-variable' + end + + it 'has the value "LOOC SI YBUR"' do + expect(new_string).to eq "LOOC SI YBUR" + end +end
Test code for reverse and upcase string - 0 failures
diff --git a/board_spec.rb b/board_spec.rb index abc1234..def5678 100644 --- a/board_spec.rb +++ b/board_spec.rb @@ -0,0 +1,40 @@+require_relative 'board' + +describe 'ChessBoard' do + + it 'should instantiate a new ChessBoard' do + board = ChessBoard.new + expect(board).to be_a ChessBoard + end + + it 'should print out a board with initial piece settings' do + board = ChessBoard.new + expect(board.to_s) + end +#tests below for specific methods -- change arguments + it 'should get a piece from the board' do + board = ChessBoard.new + expect(board.get_piece(source)). + end + + it 'should move a piece' do + board = ChessBoard.new + expect(board.move_piece(source, destination)) + end + + it 'should tell us if a piece is valid' do + board = ChessBoard.new + expect(board.valid_piece?(piece_location, player_color)) + end + + it 'should retrieve a column' do + board = ChessBoard.new + expect(board.retrieve_column(col_num)) + end + + it 'retrieve a row' do + board = ChessBoard.new + expect(retrieve_row(row_num)) + end + +end
Set up skeleton for board specs
diff --git a/config/initializers/exlibris_aleph.rb b/config/initializers/exlibris_aleph.rb index abc1234..def5678 100644 --- a/config/initializers/exlibris_aleph.rb +++ b/config/initializers/exlibris_aleph.rb @@ -3,6 +3,7 @@ Exlibris::Aleph::TablesManager.instance.sub_libraries.all # Load all the item circulation policies when the application starts Exlibris::Aleph::TablesManager.instance.item_circulation_policies.all + p 'Exlibris::Aleph initialized' rescue Errno::ENOENT => e message = "Skipping Exlibris::Aleph initialization since \"#{e.message}\"" p message
Print a message to standard output indicating that Exlibris::Aleph has completed initialization
diff --git a/lib/candy_check/app_store/receipt_collection.rb b/lib/candy_check/app_store/receipt_collection.rb index abc1234..def5678 100644 --- a/lib/candy_check/app_store/receipt_collection.rb +++ b/lib/candy_check/app_store/receipt_collection.rb @@ -15,7 +15,7 @@ # Check if the latest expiration date is passed # @return [bool] def expired? - last_expires_date.to_date <= Date.today + overdue_days > 0 end # Check if in trial @@ -29,6 +29,12 @@ def last_expires_date @receipts.last.expires_date end + + # Get number of overdue days. If this is negative, it is not overdue. + # @return [Integer] + def overdue_days + (Date.today - last_expires_date.to_date).to_i + end end end end
Add method for getting overdue days
diff --git a/lib/lucid/generators/project/events-symbiont.rb b/lib/lucid/generators/project/events-symbiont.rb index abc1234..def5678 100644 --- a/lib/lucid/generators/project/events-symbiont.rb +++ b/lib/lucid/generators/project/events-symbiont.rb @@ -16,12 +16,14 @@ Dir::mkdir('results') if not File.directory?('results') screenshot = "./results/FAILED_#{scenario.name.gsub(' ','_').gsub(/[^0-9A-Za-z_]/, '')}.png" - # This way attempts to save the screenshot as a file. - #@browser.driver.save_screenshot(screenshot) + if @browser + # This way attempts to save the screenshot as a file. + #@browser.driver.save_screenshot(screenshot) - # This way the image is encoded into the results. - encoded_img = @browser.driver.screenshot_as(:base64) - embed("data:image/png;base64,#{encoded_img}", 'image/png') + # This way the image is encoded into the results. + encoded_img = @browser.driver.screenshot_as(:base64) + embed("data:image/png;base64,#{encoded_img}", 'image/png') + end # This is an alternative way to embed. #embed screenshot, 'image/png'
Fix for non-browser after event.
diff --git a/Casks/aptana-studio.rb b/Casks/aptana-studio.rb index abc1234..def5678 100644 --- a/Casks/aptana-studio.rb +++ b/Casks/aptana-studio.rb @@ -1,7 +1,7 @@ class AptanaStudio < Cask - url 'http://download.aptana.com/studio3/standalone/3.5.0/mac/Aptana_Studio_3_Setup_3.5.0.dmg' + url 'http://download.aptana.com/studio3/standalone/3.4.2/mac/Aptana_Studio_3_Setup_3.4.2.dmg' homepage 'http://www.aptana.com/' - version '3.5.0' - sha1 '6a509859583a53ef72d240dee1c4552bc2382614' link 'Aptana Studio 3' + version '3.4.2' + sha1 '2c73735ada5a5cf81c149787ec1b3665b1813917' end
Downgrade Aptana Studio to version 3.4.2 The previous version 3.5.0 is no longer available, and the url is dead. Perhaps it was a pre-release.
diff --git a/src/modules/module_say_spec.rb b/src/modules/module_say_spec.rb index abc1234..def5678 100644 --- a/src/modules/module_say_spec.rb +++ b/src/modules/module_say_spec.rb @@ -0,0 +1,20 @@+require 'rubygems' +require 'mocha' +require 'rspec' +require 'module_say' + +describe Module_Say, "#privmsg" do + + before(:each) do + @bot = mock('bot') + @m = Module_Say.new + @m.init_module(@bot) + end + + it "always invokes system call" do + @m.expects(:system).once + @m.privmsg(@bot, "huamn", "#channel", "") + end +end + +
Add simple spec for module_say Signed-off-by: Aki Saarinen <278bc57fbbff6b7b38435aea0f9d37e3d879167e@akisaarinen.fi>
diff --git a/poorsmatic.rb b/poorsmatic.rb index abc1234..def5678 100644 --- a/poorsmatic.rb +++ b/poorsmatic.rb @@ -58,9 +58,9 @@ delete '/term/:id' do TorqueBox.transaction do Term.get(params[:id]).destroy + terms_changed end - terms_changed redirect to('/terms') end
Send notification to the queue after term removal only when the record deletion in database was successfull
diff --git a/spec/controllers/events/localities_controller_spec.rb b/spec/controllers/events/localities_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/events/localities_controller_spec.rb +++ b/spec/controllers/events/localities_controller_spec.rb @@ -1,30 +1,29 @@ require 'rails_helper' -# describe LocalitiesController, type: :controller do -# before(:example) do -# sign_in_user(double('user', role?: 'admin')) -# end -# -# describe 'GET :index' do -# it 'assigns all localities not participating in the event to @localities' do -# locality_names = create_list(:locality, 2).map(&:city) -# ev = create(:event_with_registrations, registrations_count: 1) -# loc_with_registration = ev.registrations.first.locality -# -# get :index -# -# expect(assigns(:localities).map(&:city)).to include(locality_names.first) -# expect(assigns(:localities).map(&:city)).to include(locality_names.second) -# expect(assigns(:localities).map(&:city)).to_not include(loc_with_registration) -# end -# -# it 'assigns all event localities to @event_localities' do -# event = create(:event_with_registrations, ensure_unique_locality: false) -# event_localities = event.localities.map(&:city) -# -# get :index -# -# expect(assigns(:event_localities)).to match_array([event_localities]) -# end -# end -# end +describe Events::LocalitiesController, type: :controller do + before(:example) do + sign_in_user(double('user', role?: 'admin')) + end + + describe 'GET :index' do + it 'assigns all localities not participating in the event to @localities' do + locality_names = create_list(:locality, 2).map(&:city) + event = create(:event_with_registrations, registrations_count: 1) + loc_with_registration = event.registrations.first.locality + + get :index, event_id: event.id + + expect(assigns(:localities).map(&:city)).to include(locality_names.first) + expect(assigns(:localities).map(&:city)).to include(locality_names.second) + expect(assigns(:localities).map(&:city)).to_not include(loc_with_registration) + end + + it 'assigns all event localities to @event_localities' do + event = create(:event_with_registrations, ensure_unique_locality: false) + + get :index, event_id: event.id + + expect(assigns(:event_localities)).to match_array(event.localities) + end + end +end
Fix get :index call - add missing event id. Passing tests.
diff --git a/spec/rspec/rails/example/mailer_example_group_spec.rb b/spec/rspec/rails/example/mailer_example_group_spec.rb index abc1234..def5678 100644 --- a/spec/rspec/rails/example/mailer_example_group_spec.rb +++ b/spec/rspec/rails/example/mailer_example_group_spec.rb @@ -8,6 +8,12 @@ allow(Rails).to receive_message_chain(:configuration, :action_mailer, :default_url_options).and_return({}) end + # On 1.9.2, we're getting travis failures from warnings being emitted by these specs + # only on 1.9.2 (and only on travis; can't repro locally). The warning is: + # /home/travis/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/smtp.rb:584: warning: previous definition of tlsconnect was here + # For now, we're just going to silence the warning. + around { |ex| with_isolated_stderr(&ex) } if RUBY_VERSION == '1.9.2' + it_behaves_like "an rspec-rails example group mixin", :mailer, './spec/mailers/', '.\\spec\\mailers\\' end
Deal with odd 1.9.2 warning on Travis. See this build: https://travis-ci.org/rspec/rspec-rails/jobs/23480818#L471
diff --git a/spec/unit/morpher/evaluator/transformer/block_spec.rb b/spec/unit/morpher/evaluator/transformer/block_spec.rb index abc1234..def5678 100644 --- a/spec/unit/morpher/evaluator/transformer/block_spec.rb +++ b/spec/unit/morpher/evaluator/transformer/block_spec.rb @@ -0,0 +1,69 @@+require 'spec_helper' + +describe Morpher::Evaluator::Transformer::Block do + + let(:body_a) do + s(:key_fetch, 'foo') + end + + let(:body_b) do + s(:primitive, String) + end + + let(:ast) do + s(:block, body_a, body_b) + end + + let(:object) do + Morpher.evaluator(ast) + end + + let(:evaluator_a) do + Morpher.evaluator(body_a) + end + + let(:evaluator_b) do + Morpher.evaluator(body_b) + end + + let(:input) { { 'foo' => 'bar' } } + let(:output) { true } + + describe '#inverse' do + subject { object.inverse } + + it { should eql(described_class.new([evaluator_b.inverse, evaluator_a.inverse])) } + end + + describe '#call' do + context 'with valid input' do + subject { object.call(input) } + + it 'returns output' do + should eql(output) + end + end + end + + describe '#evaluation' do + subject { object.evaluation(input) } + + let(:evaluations) do + [ + evaluator_a.evaluation(input), + evaluator_b.evaluation('bar') + ] + end + + context 'with valid input' do + it 'returns evaluation' do + should eql(Morpher::Evaluation::Nary.new( + input: input, + evaluator: object, + evaluations: evaluations, + output: output + )) + end + end + end +end
Add mutation covering unit spec for Morpher::Evaluator::Transformer::Block
diff --git a/qwtplot3d.rb b/qwtplot3d.rb index abc1234..def5678 100644 --- a/qwtplot3d.rb +++ b/qwtplot3d.rb @@ -6,7 +6,7 @@ sha256 "8ed5f5cc9d5db2ca195e41280dbe8d2c971ca12253a0c02368fb37c491e5952b" depends_on :x11 - depends_on 'qt' + depends_on 'cartr/qt4/qt' def install
Fix formula for new qt
diff --git a/rain.gemspec b/rain.gemspec index abc1234..def5678 100644 --- a/rain.gemspec +++ b/rain.gemspec @@ -4,9 +4,9 @@ Gem::Specification.new do |s| s.authors = ["Vaughn Draughon"] s.email = ["vaughn@rocksolidwebdesign.com"] - s.license = "BSD" - s.summary = %q{TODO: Ruby Artificial Intelligence and Neural Network library} - s.description = %q{TODO: A ruby library for commonly desired utilities in the artificial intelligence and machine learning world such as discretizers/discretization and learning classification systems such as genetic algorithms and neural networks} + s.license = "BSD" + s.summary = %q{Ruby Artificial Intelligence and Neural Network library} + s.description = %q{A ruby library for commonly desired utilities in the artificial intelligence and machine learning world such as discretizers/discretization and learning classification systems such as genetic algorithms and neural networks} s.homepage = "" s.files = `git ls-files`.split($\)
Remove todo from gemspec description
diff --git a/spec/active_replicas/proxying_connection_pool_spec.rb b/spec/active_replicas/proxying_connection_pool_spec.rb index abc1234..def5678 100644 --- a/spec/active_replicas/proxying_connection_pool_spec.rb +++ b/spec/active_replicas/proxying_connection_pool_spec.rb @@ -0,0 +1,59 @@+require 'spec_helper' + +describe ActiveReplicas::ProxyingConnectionPool do + subject { ActiveReplicas::ProxyingConnectionPool } + + before do + @primary_pool = double 'primary connection pool' + @replica_pool = double 'replica connection pool' + + allow(subject).to receive(:connection_pool_for_spec) do |spec| + case spec + when :primary then @primary_pool + when :replica then @replica_pool + else raise "Un-stubbed connection specification: #{spec}" + end + end + + @subject = subject.new primary: :primary, + replicas: { default0: :replica } + end + + describe '#initialize' do + it 'sets up its primary and replica pools' do + expect(@subject.primary_pool).to eq @primary_pool + expect(@subject.replica_pools[:default0]).to eq @replica_pool + end + end + + describe '#connection' do + it 'returns a connection from the current pool' do + connection = double 'connection' + expect(@replica_pool).to receive(:connection).and_return(connection) + expect(@subject.connection).to_not be_nil + end + + it 'returns a proxied connection' do + connection = double 'connection' + @replica_pool.stub connection: connection + + proxying_connection = @subject.connection + expect(proxying_connection).to be_a ActiveReplicas::ProxyingConnection + expect(proxying_connection.proxied_connection).to eq connection + end + end + + describe '#current_pool' do + it 'defaults to the next replica pool' do + expect(@subject.current_pool).to eq @replica_pool + end + + it 'respects overrides' do + @primary_pool.stub connection: double('connection') + + @subject.with_primary do + expect(@subject.current_pool).to eq @primary_pool + end + end + end +end
Add basic specs for `ProxyingConnectionPool`
diff --git a/actionmailer/lib/action_mailer/mail_delivery_job.rb b/actionmailer/lib/action_mailer/mail_delivery_job.rb index abc1234..def5678 100644 --- a/actionmailer/lib/action_mailer/mail_delivery_job.rb +++ b/actionmailer/lib/action_mailer/mail_delivery_job.rb @@ -3,7 +3,7 @@ require "active_job" module ActionMailer - # The <tt>ActionMailer::NewDeliveryJob</tt> class is used when you + # The <tt>ActionMailer::MailDeliveryJob</tt> class is used when you # want to send emails outside of the request-response cycle. It supports # sending either parameterized or normal mail. #
Fix class name in the documentation [ci skip]
diff --git a/spec/easy_settings_test/spec/easy_settings_spec.rb b/spec/easy_settings_test/spec/easy_settings_spec.rb index abc1234..def5678 100644 --- a/spec/easy_settings_test/spec/easy_settings_spec.rb +++ b/spec/easy_settings_test/spec/easy_settings_spec.rb @@ -2,8 +2,9 @@ describe EasySettings do subject { described_class } - its(:namespace) { is_expected.to eq Rails.env } - its(:app_name) { is_expected.to eq "Test App for EasySettings" } - its(:endpoint) { is_expected.to eq "https://endpoint-for-test" } - its(:apikey) { is_expected.to eq "EASYSETTINGS" } + its(:namespace) { is_expected.to eq Rails.env } + its(:source_file) { is_expected.to eq Rails.root.join("config/settings.yml").to_s } + its(:app_name) { is_expected.to eq "Test App for EasySettings" } + its(:endpoint) { is_expected.to eq "https://endpoint-for-test" } + its(:apikey) { is_expected.to eq "EASYSETTINGS" } end
:white_check_mark: Add test of source_file for rails integration
diff --git a/lib/acts_as_reviewable.rb b/lib/acts_as_reviewable.rb index abc1234..def5678 100644 --- a/lib/acts_as_reviewable.rb +++ b/lib/acts_as_reviewable.rb @@ -2,7 +2,7 @@ # The named scopes are: # in_order: Returns reviews in the order they were created (created_at ASC). # recent: Returns reviews by how recently they were created (created_at DESC). - # limit(N): Return no more than N reviews. + module Review def self.included(review_model) @@ -13,14 +13,19 @@ end module Finders - # Helper class method to lookup all reviews assigned to a given user. + # All reviews assigned to a given user. def find_reviews_by_user(user_id) where(["reviewer_id = ?", user_id]).order("created_at DESC") end - # Helper class method to lookup all reviews assigned to a given drama. + # All reviews assigned to a given drama. def find_reviews_for_drama(drama_id) where(["drama_id = ?", drama_id]).order("created_at DESC") + end + + #Reviews with a rating + def with_rating + where('rating is not null') end end
Add with rating helper method
diff --git a/app/models/setup/deletion.rb b/app/models/setup/deletion.rb index abc1234..def5678 100644 --- a/app/models/setup/deletion.rb +++ b/app/models/setup/deletion.rb @@ -7,7 +7,12 @@ def run(message) if (model = data_type_from(message).records_model) scope = objects_from(message) - destroy_callback = model.send(:get_callbacks, :destroy).present? + destroy_callback = + begin + model.send(:get_callbacks, :destroy).present? + rescue + false + end if destroy_callback progress_step = 10 step_size = scope.count / progress_step
Fix | Destroy callback for non active-models
diff --git a/lib/ap/core_ext/string.rb b/lib/ap/core_ext/string.rb index abc1234..def5678 100644 --- a/lib/ap/core_ext/string.rb +++ b/lib/ap/core_ext/string.rb @@ -11,7 +11,7 @@ define_method :"#{color}ish" do "\033[0;#{30+i}m#{self}\033[0m" end else define_method color do self end - alias :"#{color}ish" color # <- This break Rdoc: Name or symbol expected (got #<RubyToken::TkDSTRING + alias_method :"#{color}ish", color # <- This break Rdoc: Name or symbol expected (got #<RubyToken::TkDSTRING end end
Switch to alias_method from alias to fix non-tty method aliasing.
diff --git a/lib/bricolage/sqlutils.rb b/lib/bricolage/sqlutils.rb index abc1234..def5678 100644 --- a/lib/bricolage/sqlutils.rb +++ b/lib/bricolage/sqlutils.rb @@ -11,7 +11,7 @@ alias s sql_string_literal def escape_sql_string(s) - s.gsub(/'/, "''") + s.gsub(/'/, "''").gsub(/\\/, '\\\\') end def sql_timestamp_literal(time)
Add backslash escape to sql escape method
diff --git a/lib/creatubbles/client.rb b/lib/creatubbles/client.rb index abc1234..def5678 100644 --- a/lib/creatubbles/client.rb +++ b/lib/creatubbles/client.rb @@ -3,12 +3,13 @@ class Creatubbles::Client attr_writer :api_url, :username, :password - def initialize(client_id: nil, client_secret: nil, username: nil, password: nil, api_url: Creatubbles::DEFAULT_API_URL) + def initialize(client_id: nil, client_secret: nil, username: nil, password: nil, api_url: Creatubbles::DEFAULT_API_URL, scope: nil) @client_id = client_id @client_secret = client_secret @username = username @password = password @api_url = api_url + @scope = scope end def connection @@ -32,9 +33,9 @@ def get_oauth_token oauth = OAuth2::Client.new(@client_id, @client_secret, site: @api_url) if @username && @password - oauth.password.get_token(@username, @password) + oauth.password.get_token(@username, @password, scope: @scope) else - oauth.client_credentials.get_token + oauth.client_credentials.get_token(scope: @scope) end end end
Add scope when getting an oauth token
diff --git a/lib/guard/motion/tasks.rb b/lib/guard/motion/tasks.rb index abc1234..def5678 100644 --- a/lib/guard/motion/tasks.rb +++ b/lib/guard/motion/tasks.rb @@ -15,7 +15,7 @@ spec_files = App.config.spec_files.select{|file_path| !(file_path =~ /_spec.rb$/)} spec_files += files.split(';') App.config.instance_variable_set("@spec_files", spec_files) - Rake::Task["simulator"].invoke + Rake::Task["spec"].invoke end end end
Switch to rake spec to support both RubyMotion iOS and OSX
diff --git a/lib/mongoid/references.rb b/lib/mongoid/references.rb index abc1234..def5678 100644 --- a/lib/mongoid/references.rb +++ b/lib/mongoid/references.rb @@ -13,7 +13,7 @@ end else define_method(field) do - klass.where.in(_id: (self.send("#{field_singular}_ids") || [])).to_a + klass.where(:id.in => (self.send("#{field_singular}_ids") || [])).to_a end end end
drop-webapp: Fix Mongoid::References for Mongoid 3+
diff --git a/lib/qspec/spork_helper.rb b/lib/qspec/spork_helper.rb index abc1234..def5678 100644 --- a/lib/qspec/spork_helper.rb +++ b/lib/qspec/spork_helper.rb @@ -5,15 +5,39 @@ PORT = ::Spork::TestFramework::Qspec::DEFAULT_PORT def start_spork_workers + Signal.trap(:INT){ + output.puts "Stop spork processes" + remove_port_file + exit(0) + } + + ports = [] @qspec_opts[:count].times do |i| spawn({ "TEST_ENV_NUMBER" => i == 0 ? '' : (i + 1).to_s }, "spork qspec --port #{PORT+i}") + ports << PORT+i end - Signal.trap(:INT){ - output.puts "Stop spork processes" - exit(0) - } + create_port_file(ports) Process.waitall.all? { |pid, status| status.exitstatus == 0 } ? 0 : 1 + end + + def create_port_file(ports) + File.open('tmp/qspec_spork', 'w') do |f| + f.puts ports.join("\n") + end + end + + def runnning_ports + @runnning_ports ||= begin + ports = File.readlines('tmp/qspec_spork').map { |line| line.strip.to_i } + ports.empty? ? nil : ports + rescue Errno::ENOENT + nil + end + end + + def remove_port_file + File.unlink('tmp/qspec_spork') end end end
Create file for port numbers
diff --git a/lib/rspec-live/monitor.rb b/lib/rspec-live/monitor.rb index abc1234..def5678 100644 --- a/lib/rspec-live/monitor.rb +++ b/lib/rspec-live/monitor.rb @@ -17,26 +17,29 @@ @runner.on_update { @display.update @suite } @suite.reset while !@quit do - if services.any?(&:updates_available?) - key_handler.process_updates - @suite.process_updates - @display.update @suite - end + process_updates if updates_available? sleep 0.05 end + rescue Interrupt end private - def services - [key_handler, @file_watcher] + def process_updates + key_handler.process_updates + @suite.process_updates + @display.update @suite + end + + def updates_available? + [key_handler, @file_watcher].any?(&:updates_available?) end def key_handler @key_handler ||= KeyHandler.new.tap do |handler| handler.on("a") { @detail.toggle_all } handler.on("n") { @detail.focus_next } - handler.on("q", :interrupt) { @quit = true } + handler.on("q") { @quit = true } handler.on("r") { @suite.reset } handler.on("v") { @detail.cycle_verbosity } end
Refactor update loop and handle interrupts in Monitor
diff --git a/lib/swagger/v2/example.rb b/lib/swagger/v2/example.rb index abc1234..def5678 100644 --- a/lib/swagger/v2/example.rb +++ b/lib/swagger/v2/example.rb @@ -23,10 +23,6 @@ parser = Swagger::MimeType.parser_for(media_type) parser.parse(@raw) end - - def inspect - @raw.inspect - end end end end
Remove extra inspect method from Example
diff --git a/lib/terragov/terraform.rb b/lib/terragov/terraform.rb index abc1234..def5678 100644 --- a/lib/terragov/terraform.rb +++ b/lib/terragov/terraform.rb @@ -26,6 +26,10 @@ Dir.chdir directory init(backend, dryrun, verbose) + if command == 'plan' + command = 'plan -detailed-exitcode' + end + full_command = "bash -c 'terraform #{command} #{vars}'" run(full_command, dryrun, verbose) @@ -41,7 +45,15 @@ puts command else puts command if verbose - abort("There was an issue running the command: #{command}") unless system(command) + system(command) + + # Catch the output of "-detailed-exitcode" + if $?.exitstatus == 2 + puts "Command completed successfully, but with updates available to apply" + exit 2 + elsif $?.exitstatus != (0 or 2) + abort("There was an issue running command: #{command}") + end end end end
Add "detailed-exitcode" as default to plan This is a useful flag that should be included when we run a plan, so we can use the exitcode to determine if an apply needs to happen upon a project. Update the error checking so we do not overwrite the exitcode, as the abort writes the exitcode to 1 since it gathers that 2 is not a clean exit.
diff --git a/SetNeedsReadable.podspec b/SetNeedsReadable.podspec index abc1234..def5678 100644 --- a/SetNeedsReadable.podspec +++ b/SetNeedsReadable.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'SetNeedsReadable' - s.version = '2.1' + s.version = '2.2' s.summary = 'Helpful extensions for CGFloat and UIView aimed to enhance readability of layout code.' s.homepage = 'https://github.com/rehatkathuria/SetNeedsReadable' s.license = { :type => 'MIT', :file => 'LICENSE' }
Update .podspec to reference latest tag
diff --git a/lib/chicago/rake_tasks.rb b/lib/chicago/rake_tasks.rb index abc1234..def5678 100644 --- a/lib/chicago/rake_tasks.rb +++ b/lib/chicago/rake_tasks.rb @@ -4,7 +4,7 @@ # Rake tasks for a Chicago project. class RakeTasks < Rake::TaskLib def initialize(db) - @migration_dir = "db/migrate" + @migration_dir = "migrations" @db = db @test_dir = "test" define @@ -19,7 +19,14 @@ CodeStatistics.new(*stats_dirs).to_s end - namespace :schema do + namespace :db do + desc "Write Null dimension records" + task :prepare do + # TODO: replace this with proper logging. + warn "Loading NULL records." + Schema::Dimension.definitions.each {|dimension| dimension.create_null_records(@db) } + end + desc "Writes a migration file to change the database based on defined Facts & Dimensions" task :write_migrations do Schema::MigrationFileWriter.new(@db, @migration_dir).write_migration_file
Add rake task to create null records.
diff --git a/lib/docs/scrapers/node.rb b/lib/docs/scrapers/node.rb index abc1234..def5678 100644 --- a/lib/docs/scrapers/node.rb +++ b/lib/docs/scrapers/node.rb @@ -23,7 +23,7 @@ HTML version do - self.release = '5.11.0' + self.release = '6.0.0' self.base_url = 'https://nodejs.org/api/' end
Update Node.js documentation (6.0.0, 4.4.3)
diff --git a/lib/action_sms/connection_adapters/abstract_adapter.rb b/lib/action_sms/connection_adapters/abstract_adapter.rb index abc1234..def5678 100644 --- a/lib/action_sms/connection_adapters/abstract_adapter.rb +++ b/lib/action_sms/connection_adapters/abstract_adapter.rb @@ -16,6 +16,7 @@ http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true if uri.scheme == 'https' + http.verify_mode = OpenSSL::SSL::VERIFY_NONE resp = http.start do http.request(req) end
Set verify mode to none for https
diff --git a/lib/gooddata/bricks/middleware/restforce_middleware.rb b/lib/gooddata/bricks/middleware/restforce_middleware.rb index abc1234..def5678 100644 --- a/lib/gooddata/bricks/middleware/restforce_middleware.rb +++ b/lib/gooddata/bricks/middleware/restforce_middleware.rb @@ -15,8 +15,6 @@ oauth_token = params[:salesforce_oauth_token] refresh_token = params[:salesforce_refresh_token] host = params[:salesforce_host] - - credentials = {} credentials = if (username && password && token) {
Remove empty and not used initializer
diff --git a/civil.gemspec b/civil.gemspec index abc1234..def5678 100644 --- a/civil.gemspec +++ b/civil.gemspec @@ -22,4 +22,5 @@ spec.add_development_dependency "bundler", "~> 1.10" spec.add_development_dependency "rake", "~> 10.0" spec.add_development_dependency "rspec", "~> 3.5" + spec.add_development_dependency "pry", "~> 0.10" end
Add pry as dev dependency
diff --git a/lib/parole/commentable.rb b/lib/parole/commentable.rb index abc1234..def5678 100644 --- a/lib/parole/commentable.rb +++ b/lib/parole/commentable.rb @@ -11,8 +11,7 @@ # Role-specific comments for the record commentable_options.fetch(:roles).each do |role| - options = association_options.merge before_add: lambda { |_, comment| comment.role = role } - has_many :"#{role}_comments", lambda { where(role: role) }, options + has_many :"#{role}_comments", lambda { where(role: role) }, association_options end end end
Remove unnecessary “before_add” association option
diff --git a/lib/simple_gate/router.rb b/lib/simple_gate/router.rb index abc1234..def5678 100644 --- a/lib/simple_gate/router.rb +++ b/lib/simple_gate/router.rb @@ -23,22 +23,20 @@ # The graph must be acyclical or it will loop forever. def find(start, target) return [target] if start == target - if paths.has_key?(start) - # Map all possible paths to the target - routes = paths[start].map do |next_node| - find(next_node, target) - end - # Reduce the collection to the shortest path - shortest_route = routes.compact.inject(nil) {|shortest,possibility| - next possibility if shortest.nil? - possibility.size < shortest.size ? possibility : shortest - } - if shortest_route - return [start] + shortest_route - else - return nil - end + return nil unless paths.has_key?(start) + # Map all possible paths to the target + routes = paths[start].map do |next_node| + find(next_node, target) end - return nil + # Reduce the collection to the shortest path + shortest_route = routes.compact.inject(nil) {|shortest,possibility| + next possibility if shortest.nil? + possibility.size < shortest.size ? possibility : shortest + } + if shortest_route + return [start] + shortest_route + else + return nil + end end end
Use inline unless to make code more readable
diff --git a/lib/tasks/generators.rake b/lib/tasks/generators.rake index abc1234..def5678 100644 --- a/lib/tasks/generators.rake +++ b/lib/tasks/generators.rake @@ -2,8 +2,8 @@ desc "Create classes" task :create_classes do root = File.expand_path("../../", File.dirname(__FILE__)) - target = Rake.original_dir - p root - p target + target = "#{Rake.original_dir}/config/turf/" + FileUtils.mkdir_p(target) + FileUtils.cp("#{root}/templates/*.rb", target) end end
Add the rake task to actually copy the files... let's see if this works
diff --git a/lib/tasks/panopticon.rake b/lib/tasks/panopticon.rake index abc1234..def5678 100644 --- a/lib/tasks/panopticon.rake +++ b/lib/tasks/panopticon.rake @@ -1,6 +1,6 @@ namespace :panopticon do - desc "Register application metadata with panopticon" - task :register => [:environment] do + desc "Republish all tags to panopticon" + task :republish_tags => [:environment] do Tag.published.find_each do |tag| PanopticonNotifier.update_tag(TagPresenter.presenter_for(tag)) end
Rename rake task to republish tags `rake panopticon:republish_tags` is more descriptive and won't interfere with the pattern of running `panopticon:register` on each deploy.
diff --git a/app/models/meeting.rb b/app/models/meeting.rb index abc1234..def5678 100644 --- a/app/models/meeting.rb +++ b/app/models/meeting.rb @@ -1,7 +1,7 @@ class Meeting < ActiveRecord::Base default_scope { order("met DESC") } - scope :met_between, ->(start_time, end_time) { where("met >= ? AND met < ?", start_time, end_time) } + scope :met_between, ->(start_time, end_time) { where("met >= ? AND met < ?", end_time, start_time) } scope :met_after, ->(time) { where("met > ?", time) } scope :for_school, lambda {|school|
Fix previous 30 days stat