diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/Casks/wowza-streaming-engine.rb b/Casks/wowza-streaming-engine.rb index abc1234..def5678 100644 --- a/Casks/wowza-streaming-engine.rb +++ b/Casks/wowza-streaming-engine.rb @@ -0,0 +1,21 @@+cask 'wowza-streaming-engine' do + version '4.4.1' + sha256 '2d87573f3aa0af2b23bbef9b327774ed83f6dea5de5c70d66a66545b7db693b4' + + url "https://www.wowza.com/downloads/WowzaStreamingEngine-#{version.dots_to_hyphens}/WowzaStreamingEngine-#{version}-osx-installer.dmg" + appcast 'https://www.wowza.com/rss/wowzastreamingengineupdates.xml', + checkpoint: '8bb015c2f19e8f3748ba1215434cd624f9508043108c45cb1ffe38eac3b1a51d' + name 'Wowza Streaming Engine' + homepage 'https://www.wowza.com/products/streaming-engine' + license :commercial + + auto_updates true + + installer manual: "WowzaStreamingEngine-#{version}-osx-installer.app" + + uninstall script: { + executable: "/Applications/Wowza Streaming Engine #{version}/Wowza Streaming Engine Uninstall.app/Contents/MacOS/installbuilder.sh", + args: ['--mode', 'text'], + sudo: true, + } +end
Add Wowza Streaming Engine v4.4.1
diff --git a/react-native-onesignal.podspec b/react-native-onesignal.podspec index abc1234..def5678 100644 --- a/react-native-onesignal.podspec +++ b/react-native-onesignal.podspec @@ -9,7 +9,7 @@ s.homepage = "https://github.com/geektimecoil/react-native-onesignal" s.license = package_json["license"] s.author = { package_json["author"] => package_json["author"] } - s.platform = :ios, "9.0" + s.platform = :ios, "7.0" s.source = { :git => package_json["repository"]["url"] } s.source_files = 'ios/RCTOneSignal/*.{h,m}' s.dependency 'React'
Allow iOS versions >= 7.0 OneSignal itself needs >= 6.1 and React Native needs >= 7.0.
diff --git a/benchmarks/src/complex_view.rb b/benchmarks/src/complex_view.rb index abc1234..def5678 100644 --- a/benchmarks/src/complex_view.rb +++ b/benchmarks/src/complex_view.rb @@ -1,4 +1,8 @@+require 'tilt' + class ComplexView + include Tilt::CompileSite + def header "Colors" end @@ -10,4 +14,4 @@ items << { :name => 'blue', :current => false, :url => '#blue' } items end -end+end
Benchmark: Include Tilt::CompileSite to improve performance
diff --git a/fragrant.gemspec b/fragrant.gemspec index abc1234..def5678 100644 --- a/fragrant.gemspec +++ b/fragrant.gemspec @@ -3,7 +3,7 @@ Gem::Specification.new do |s| s.name = 'fragrant' - s.version = "0.0.2" + s.version = "0.0.3" s.platform = Gem::Platform::RUBY s.authors = ['Matt Whiteley'] s.email = ['[email protected]'] @@ -25,6 +25,6 @@ s.require_path = 'lib' s.executables = ['fragrant'] - s.files = Dir.glob('{bin,lib,vendor}/**/*') + %w(LICENSE README.md) - s.test_files = Dir.glob('{spec}/**/*') + s.files = Dir.glob('{bin,lib,vendor,templates}/**/*') + %w(LICENSE README.md) + s.test_files = Dir.glob('{spec}/**/*') + %w(Rakefile Gemfile Gemfile.lock) end
Include 'templates' dir in gem, bump to version 0.0.3
diff --git a/test/psl_test.rb b/test/psl_test.rb index abc1234..def5678 100644 --- a/test/psl_test.rb +++ b/test/psl_test.rb @@ -32,14 +32,7 @@ failures = [] self.class.tests.each do |input, output| - domain = begin - - - d = PublicSuffix.parse(input) - [d.sld, d.tld].join(".") - rescue - nil - end + domain = PublicSuffix.domain(input) rescue nil failures << [input, output, domain] if output != domain end
Simplify the test using PublicSuffix.domain
diff --git a/test/test_gem.rb b/test/test_gem.rb index abc1234..def5678 100644 --- a/test/test_gem.rb +++ b/test/test_gem.rb @@ -13,7 +13,7 @@ require 'systemu' # Require clean environment - assert_empty Dir['nanoc-*.gem'], "Ensure no nanoc-*.gem files exist" + Dir['nanoc-*.gem'].each { |f| FileUtils.rm(f) } # Build files_before = Set.new Dir['**/*']
Make gem test remove existing gem files
diff --git a/turnpike.gemspec b/turnpike.gemspec index abc1234..def5678 100644 --- a/turnpike.gemspec +++ b/turnpike.gemspec @@ -16,6 +16,6 @@ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ['lib'] - s.add_runtime_dependency 'redis', '~> 3.0.0.rc1' - s.add_development_dependency 'rake', '~> 0.9' + s.add_runtime_dependency 'redis', '~> 3.0' + s.add_development_dependency 'rake' end
Update Redis version in gemspec
diff --git a/twitchus.gemspec b/twitchus.gemspec index abc1234..def5678 100644 --- a/twitchus.gemspec +++ b/twitchus.gemspec @@ -17,9 +17,11 @@ gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ["lib"] - gem.add_development_dependency "pry" - gem.add_development_dependency "rake" - gem.add_development_dependency "rspec" - gem.add_development_dependency "cucumber" - gem.add_development_dependency "aruba" + gem.add_dependency "jtv", "~> 0.0.3" + + gem.add_development_dependency "pry", "~> 0.9.10" + gem.add_development_dependency "rake", "~> 0.9.2.2" + gem.add_development_dependency "rspec", "~> 2.11.0" + gem.add_development_dependency "cucumber", "~> 1.2.1" + gem.add_development_dependency "aruba", "~> 0.4.11" end
Add jtv gem + specify version
diff --git a/vmdb/app/models/file_depot_ftp_anonymous.rb b/vmdb/app/models/file_depot_ftp_anonymous.rb index abc1234..def5678 100644 --- a/vmdb/app/models/file_depot_ftp_anonymous.rb +++ b/vmdb/app/models/file_depot_ftp_anonymous.rb @@ -9,16 +9,16 @@ private - def create_directory_structure(_ftp) + def create_directory_structure(_path) nil end - def destination_file_exists?(_ftp, _file) + def file_exists?(_file) false end def destination_path - "/incoming" + Pathname.new("incoming") end def login_credentials
Update FileDepotFtpAnonymous to match changes to FileDepotFtp. destination_file_exists? was renamed to file_exists? since it's used for the destination directories in addition to the destination file. destination_path needs to return a Pathname object that responds to join. https://bugzilla.redhat.com/show_bug.cgi?id=1184465
diff --git a/features/step_definitions/app_steps.rb b/features/step_definitions/app_steps.rb index abc1234..def5678 100644 --- a/features/step_definitions/app_steps.rb +++ b/features/step_definitions/app_steps.rb @@ -29,7 +29,7 @@ app = Application.find_by_name(app_name) visit('/') - click_on 'Deployable Apps' + click_on 'Applications' within "#application_#{app.id}" do click_on 'Show App'
Change Deployable Apps to Applications
diff --git a/field_types/core/tag/tag_field_type.rb b/field_types/core/tag/tag_field_type.rb index abc1234..def5678 100644 --- a/field_types/core/tag/tag_field_type.rb +++ b/field_types/core/tag/tag_field_type.rb @@ -13,7 +13,7 @@ end def data=(data_hash) - @tag_list = data_hash.deep_symbolize_keys[:tag_list] + @tag_list = data_hash.deep_symbolize_keys[:tag_list].split(",") end def metadata=(metadata_hash)
Change Tag input to expect and sanitize comma separated string
diff --git a/mayhem-rails.gemspec b/mayhem-rails.gemspec index abc1234..def5678 100644 --- a/mayhem-rails.gemspec +++ b/mayhem-rails.gemspec @@ -10,7 +10,7 @@ spec.email = ['[email protected]'] spec.description = 'Mayhem is a tool for sowing discord within text. Mayhem Rails makes it easy to include in a Rails project.' spec.summary = 'Mayhem for Rails.' - spec.homepage = '' + spec.homepage = 'https://github.com/sephonicus/mayhem-rails' spec.license = 'MIT' spec.files = `git ls-files`.split($/)
Add homepage to gem spec
diff --git a/airborne.gemspec b/airborne.gemspec index abc1234..def5678 100644 --- a/airborne.gemspec +++ b/airborne.gemspec @@ -15,5 +15,5 @@ s.add_runtime_dependency 'rack-test', '< 2.0', '>= 1.1.0' s.add_runtime_dependency 'rack' s.add_runtime_dependency 'activesupport' - s.add_development_dependency 'webmock', '~> 0' + s.add_development_dependency 'webmock', '~> 3' end
Update webmock requirement from ~> 0 to ~> 3 Updates the requirements on [webmock](https://github.com/bblimke/webmock) to permit the latest version. - [Release notes](https://github.com/bblimke/webmock/releases) - [Changelog](https://github.com/bblimke/webmock/blob/master/CHANGELOG.md) - [Commits](https://github.com/bblimke/webmock/compare/v0.9.0...v3.5.1) Signed-off-by: dependabot[bot] <[email protected]>
diff --git a/db/migrate/20150424055233_add_physical_id_to_serverspec_schedule.rb b/db/migrate/20150424055233_add_physical_id_to_serverspec_schedule.rb index abc1234..def5678 100644 --- a/db/migrate/20150424055233_add_physical_id_to_serverspec_schedule.rb +++ b/db/migrate/20150424055233_add_physical_id_to_serverspec_schedule.rb @@ -1,5 +1,5 @@ class AddPhysicalIdToServerspecSchedule < ActiveRecord::Migration def change - add_column :serverspec_schedules, :physical_id, :string, null: false + add_column :serverspec_schedules, :physical_id, :string end end
Change a NOT NULL column to allow NULL
diff --git a/Library/Formula/shared-desktop-ontologies.rb b/Library/Formula/shared-desktop-ontologies.rb index abc1234..def5678 100644 --- a/Library/Formula/shared-desktop-ontologies.rb +++ b/Library/Formula/shared-desktop-ontologies.rb @@ -1,9 +1,9 @@ require 'formula' class SharedDesktopOntologies <Formula - url 'http://downloads.sourceforge.net/project/oscaf/shared-desktop-ontologies/0.2/shared-desktop-ontologies-0.2.tar.bz2' + url 'http://downloads.sourceforge.net/project/oscaf/shared-desktop-ontologies/0.5/shared-desktop-ontologies-0.5.tar.bz2' homepage 'http://sourceforge.net/apps/trac/oscaf/' - md5 '6c004e1c377f768cae5b321bc111876b' + md5 '067ec9023c4a48e0d53fb15484d78971' depends_on 'cmake' => :build
Update Shared Desktop Ontologies to 0.5.
diff --git a/Casks/iterm2-beta.rb b/Casks/iterm2-beta.rb index abc1234..def5678 100644 --- a/Casks/iterm2-beta.rb +++ b/Casks/iterm2-beta.rb @@ -1,8 +1,8 @@ class Iterm2Beta < Cask - version '1.0.0.20140629' - sha256 'fdda227b01497c90f7c35ad9bde73ee477bb452f27acef9abbf97dc42fdf3bb5' + version '2.0.0.20141022' + sha256 'd2e16b172548bd0f08b7b1fa42f0b42f5781f4e2a6452e6ad21a24301b38577c' - url 'http://www.iterm2.com/downloads/beta/iTerm2-1_0_0_20140629.zip' + url 'https://iterm2.com/downloads/beta/iTerm2-2_0_0_20141022.zip' homepage 'http://www.iterm2.com/' license :oss
Update iTerm2 beta formula to the latest version. iTerm 2 has been updated to 2.0.0.20141022 https://iterm2.com/downloads/beta/iTerm2-2_0_0_20141022.zip
diff --git a/Casks/spotifybeta.rb b/Casks/spotifybeta.rb index abc1234..def5678 100644 --- a/Casks/spotifybeta.rb +++ b/Casks/spotifybeta.rb @@ -1,6 +1,6 @@ cask :v1 => 'spotifybeta' do - version '1.0.0.909.ge4845795-1223' - sha256 '9279b76b13185d2cba4afcbf19464a97229b3a50620fbfff4311fef8cf9b8c50' + version '1.0.0.974.ga39487e3-1439' + sha256 '55ab8ed9446654f007a8dc1782f26d836b3ddd585a6dbc36b19148f7d624c18b' url "http://download.spotify.com/beta/spotify-app-#{version}.dmg" name 'Spotify Beta'
Update SpotifBeta.app to version 1.0.0.974.ga39487e3-1439
diff --git a/lib/http_eventstore/actions/read_all_stream_events.rb b/lib/http_eventstore/actions/read_all_stream_events.rb index abc1234..def5678 100644 --- a/lib/http_eventstore/actions/read_all_stream_events.rb +++ b/lib/http_eventstore/actions/read_all_stream_events.rb @@ -19,11 +19,18 @@ attr_reader :client def get_all_stream_entries(stream_name, start_point = nil, entries = []) + loop do + start_point, entries = get_next_stream_entries(stream_name, start_point, entries) + break if start_point.nil? + end + entries + end + + def get_next_stream_entries(stream_name, start_point = nil, entries = []) stream_data = get_stream_batch(stream_name, start_point) entries = append_entries(entries, stream_data['entries']) start_point = get_next_start_point(stream_data['links']) - return entries if start_point.nil? - get_all_stream_entries(stream_name, start_point, entries) + [start_point, entries] end def return_events(entries)
Read all stream events is not recursive so can read arbitrarily long streams
diff --git a/lib/tasks/temp_remove_landlord_immigration_check.rake b/lib/tasks/temp_remove_landlord_immigration_check.rake index abc1234..def5678 100644 --- a/lib/tasks/temp_remove_landlord_immigration_check.rake +++ b/lib/tasks/temp_remove_landlord_immigration_check.rake @@ -0,0 +1,5 @@+desc "Remove Landlord Immigration Check page" + +task remove_landlord_immigration_check: :environment do + Artefact.find_by(slug: "landlord-immigration-check").delete +end
Add Rake task to delete old Artefact reserving needed slug This Artefact is an old StartPage that has not been touched since 2015. StartPages are now published in SmartAnswers, and this example is leftover from before they were moved from Publisher. There is now a need for Publisher to re-use the `landlord-immigration-check` slug, and this new Artefact cannot be created while the slug is associated with the old StartPage.
diff --git a/rack-geo.gemspec b/rack-geo.gemspec index abc1234..def5678 100644 --- a/rack-geo.gemspec +++ b/rack-geo.gemspec @@ -17,7 +17,7 @@ s.extra_rdoc_files = ['README.rdoc', 'HISTORY.rdoc', 'LICENSE.txt'] s.require_paths = ["lib"] - s.add_dependency 'rack', '~> 1.0' + s.add_dependency 'rack', '< 3' s.add_development_dependency 'rake' s.add_development_dependency 'rack-test', '~> 0.5' s.add_development_dependency 'rspec', '~> 2.6'
Update gemspec to allow using with Rack 2 Required to use gem with Rails 5+
diff --git a/db/migrate/20140226191212_add_payment_service_fee_paid_by_user_to_contributions.rb b/db/migrate/20140226191212_add_payment_service_fee_paid_by_user_to_contributions.rb index abc1234..def5678 100644 --- a/db/migrate/20140226191212_add_payment_service_fee_paid_by_user_to_contributions.rb +++ b/db/migrate/20140226191212_add_payment_service_fee_paid_by_user_to_contributions.rb @@ -0,0 +1,6 @@+class AddPaymentServiceFeePaidByUserToContributions < ActiveRecord::Migration + def change + change_column_default :contributions, :payment_service_fee, 0 + add_column :contributions, :payment_service_fee_paid_by_user, :boolean, default: false + end +end
Restructure payments fields on Contributions We will be storing contribution's fees in contributions table to help us generate reports.
diff --git a/kontrast.gemspec b/kontrast.gemspec index abc1234..def5678 100644 --- a/kontrast.gemspec +++ b/kontrast.gemspec @@ -8,7 +8,7 @@ spec.version = Kontrast::VERSION spec.authors = ["Ilya Rubnich"] spec.email = ["[email protected]"] - spec.summary = %q{An automated testing tool for comparing two versions of a website.} + spec.summary = %q{An automated testing tool for comparing visual differences between two versions of a website.} #spec.description = %q{TODO: Write a longer description. Optional.} spec.homepage = "" spec.license = "MIT"
Update gemspec summary to match readme
diff --git a/vendor/refinerycms/core/lib/generators/refinery_engine/templates/refinerycms-plural_name.gemspec b/vendor/refinerycms/core/lib/generators/refinery_engine/templates/refinerycms-plural_name.gemspec index abc1234..def5678 100644 --- a/vendor/refinerycms/core/lib/generators/refinery_engine/templates/refinerycms-plural_name.gemspec +++ b/vendor/refinerycms/core/lib/generators/refinery_engine/templates/refinerycms-plural_name.gemspec @@ -1,12 +1,10 @@-<% description = "Ruby on Rails #{plural_name.titleize} engine for Refinery CMS" %> - Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'refinerycms-<%= plural_name %>' s.version = '1.0' - s.description = '<%= description %>' + s.description = 'Ruby on Rails <%= plural_name.titleize %> engine for Refinery CMS' s.date = '<%= Time.now.strftime('%Y-%m-%d') %>' - s.summary = '<%= description %>' + s.summary = '<%= plural_name.titleize %> engine for Refinery CMS' s.require_paths = %w(lib) s.files = Dir['lib/**/*', 'config/**/*', 'app/**/*'] end
Remove whitespace and ensure the summary differs from the description.
diff --git a/app/models/components/course/experience_points_records_ability_component.rb b/app/models/components/course/experience_points_records_ability_component.rb index abc1234..def5678 100644 --- a/app/models/components/course/experience_points_records_ability_component.rb +++ b/app/models/components/course/experience_points_records_ability_component.rb @@ -0,0 +1,23 @@+# frozen_string_literal: true +module Course::ExperiencePointsRecordsAbilityComponent + include AbilityHost::Component + + def define_permissions + if user + allow_staff_manage_experience_points_records + allow_student_read_own_experience_points_records + end + + super + end + + private + + def allow_staff_manage_experience_points_records + can :manage, Course::ExperiencePointsRecord, course_user: course_staff_hash + end + + def allow_student_read_own_experience_points_records + can :read, Course::ExperiencePointsRecord, course_user: { user_id: user.id } + end +end
Define Experience Points Record abilities
diff --git a/config/initializers/spree.rb b/config/initializers/spree.rb index abc1234..def5678 100644 --- a/config/initializers/spree.rb +++ b/config/initializers/spree.rb @@ -14,7 +14,7 @@ config.shipping_instructions = true config.checkout_zone = 'Australia' config.address_requires_state = true - config.default_country_id = 12 # This should be Australia, see: spree/core/db/default/spree/countries.yml + config.default_country_id = Spree::Country.find_by_name('Australia').id config.searcher_class = OpenFoodWeb::Searcher
Remove hardcoded ID for Australia
diff --git a/Casks/adium-nightly16.rb b/Casks/adium-nightly16.rb index abc1234..def5678 100644 --- a/Casks/adium-nightly16.rb +++ b/Casks/adium-nightly16.rb @@ -2,9 +2,16 @@ version '1.6hgr5915' sha256 '70619777433df646a7251a10eb74baecdc5a47be085cd83d35f3750fcfea9e1b' - url "http://nightly.adium.im/adium-adium-1.6/Adium_#{version}.dmg" + url "http://nightly.adium.im/adium-adium-1.6/Adium_#{version}.dmg + name 'Adium' homepage 'http://nightly.adium.im/?repo_branch=adium-adium-1.6' - license :oss + license :gpl app 'Adium.app' + + zap :delete => [ + '~/Library/Caches/Adium', + '~/Library/Caches/com.adiumX.adiumX', + '~/Library/Preferences/com.adiumX.adiumX.plist', + ] end
Add missing stanzas to Adium Nightly16
diff --git a/config/initializers/gds_sso.rb b/config/initializers/gds_sso.rb index abc1234..def5678 100644 --- a/config/initializers/gds_sso.rb +++ b/config/initializers/gds_sso.rb @@ -2,5 +2,5 @@ config.user_model = 'User' config.oauth_id = ENV['OAUTH_ID'] || "abcdefghjasndjkasndcontenttagger" config.oauth_secret = ENV['OAUTH_SECRET'] || "secret" - config.oauth_root_url = Plek.find('signon') + config.oauth_root_url = Plek.new.external_url_for('signon') end
Handle external URLs for Signon Use the new external_url_for method of Plek to generate external URLs for Signon. This makes Policy Publisher more compatible with environments where there is a difference between internal and external routing, which is the way GOV.UK is being deployed to Amazon Web Services.
diff --git a/app/controllers/spree/admin/orders/customer_details_controller_decorator.rb b/app/controllers/spree/admin/orders/customer_details_controller_decorator.rb index abc1234..def5678 100644 --- a/app/controllers/spree/admin/orders/customer_details_controller_decorator.rb +++ b/app/controllers/spree/admin/orders/customer_details_controller_decorator.rb @@ -0,0 +1,8 @@+Spree::Admin::Orders::CustomerDetailsController.class_eval do + #Override BaseController.authorize_admin to inherit CanCan permissions for the current order + def authorize_admin + load_order unless @order + authorize! :admin, @order + authorize! params[:action].to_sym, @order + end +end
Add more order privileges for distributor enterprise users
diff --git a/lib/appsignal/integrations/que.rb b/lib/appsignal/integrations/que.rb index abc1234..def5678 100644 --- a/lib/appsignal/integrations/que.rb +++ b/lib/appsignal/integrations/que.rb @@ -4,26 +4,36 @@ module Appsignal module Integrations module QuePlugin - def _run - Appsignal.monitor_transaction( - 'perform_job.que', - :class => attrs[:job_class], - :method => 'run', - :metadata => { - :id => attrs[:job_id], - :queue => attrs[:queue], - :run_at => attrs[:run_at].to_s, - :priority => attrs[:priority], - :attempts => attrs[:error_count].to_i - }, - :params => attrs[:args] - ) { super } + def self.included(base) + base.class_eval do + + def _run_with_appsignal + Appsignal.monitor_transaction( + 'perform_job.que', + :class => attrs[:job_class], + :method => 'run', + :metadata => { + :id => attrs[:job_id], + :queue => attrs[:queue], + :run_at => attrs[:run_at].to_s, + :priority => attrs[:priority], + :attempts => attrs[:error_count].to_i + }, + :params => attrs[:args] + ) { _run_without_appsignal } + end + + alias_method :_run_without_appsignal, :_run + alias_method :_run, :_run_with_appsignal + + end end end end end class Que::Job - prepend Appsignal::Integrations::QuePlugin + # For Ruby 2+ prepend would be more beautiful, but we support 1.9.3 too. + include Appsignal::Integrations::QuePlugin end end
Support Ruby 1.9.3 again with Que integration
diff --git a/lib/knife-cloudformation/utils.rb b/lib/knife-cloudformation/utils.rb index abc1234..def5678 100644 --- a/lib/knife-cloudformation/utils.rb +++ b/lib/knife-cloudformation/utils.rb @@ -52,5 +52,18 @@ end end + + module Ssher + def remote_file_contents(address, user, path, ssh_opts={}) + require 'net/sftp' + content = nil + Net::SFTP.start(address, user, ssh_opts) do |con| + con.file.open(path) do |f| + content = f.read + end + end + content + end + end end end
Include helper for ssh file pulls
diff --git a/lib/stradivari/xlsx/controller.rb b/lib/stradivari/xlsx/controller.rb index abc1234..def5678 100644 --- a/lib/stradivari/xlsx/controller.rb +++ b/lib/stradivari/xlsx/controller.rb @@ -19,16 +19,21 @@ end def _stradivari_xlsx_file_name(filename) - if filename.nil? || filename.strip.length == 0 - filename = 'export' - end + filename = + if filename.nil? || filename.strip.length == 0 + 'export' + else + filename.dup + end - if filename.length > 128 + filename.sub!(/\.xlsx$/i, '') + + if filename.length > 119 filename = filename[0..118] + '-cut' # 119 + 4 = 123 end # Here we reach at most 128 chars. - filename << '.xlsx' unless filename =~ /\.xlsx$/ + filename << '.xlsx' return filename end
Fix filename length calculations thx @lleirborras
diff --git a/lib/twoffein-client/exceptions.rb b/lib/twoffein-client/exceptions.rb index abc1234..def5678 100644 --- a/lib/twoffein-client/exceptions.rb +++ b/lib/twoffein-client/exceptions.rb @@ -1,9 +1,15 @@ module Twoffein - class Error < StandardError - attr_reader :type, :message - def initialize(type, message) - @type = type - @message = message + module Server + class Error < StandardError + attr_reader :type, :message + def initialize(type, message) + @type = type + @message = message + end + + def to_s + "Server::Error: #@type (#@message)" + end end end end
Add Error in module Server and add a to_s
diff --git a/lib/icims/job.rb b/lib/icims/job.rb index abc1234..def5678 100644 --- a/lib/icims/job.rb +++ b/lib/icims/job.rb @@ -4,7 +4,7 @@ class Job < OpenStruct - DEFAULT_FIELDS = %w(id folder jobtitle positioncategory positiontype joblocation additionallocations overview) + DEFAULT_FIELDS = %w(id updateddate folder jobtitle positioncategory positiontype joblocation additionallocations overview) class << self
Add updateddate to default list
diff --git a/Blindside.podspec b/Blindside.podspec index abc1234..def5678 100644 --- a/Blindside.podspec +++ b/Blindside.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |s| s.name = "Blindside" - s.version = "1.0-alpha" + s.version = "1.0.0" s.summary = "Blindside provides dependency injection capabilities for Objective-C on iOS and OS X" s.homepage = "https://github.com/jbsf/blindside" s.license = 'MIT' s.author = { "JB Steadman" => "[email protected]" } - s.source = { :git => "https://github.com/jbsf/blindside.git", :commit => "362b99b97008bd3d46f789803afeb8ef88710ec4" } + s.source = { :git => "https://github.com/jbsf/blindside.git", :tag => '1.0.0' } s.requires_arc = true s.ios.deployment_target = '5.0'
Update source to reference 1.0.0 tag * Pod lint requires a release to be specified
diff --git a/Casks/spacious.rb b/Casks/spacious.rb index abc1234..def5678 100644 --- a/Casks/spacious.rb +++ b/Casks/spacious.rb @@ -2,9 +2,9 @@ version :latest sha256 :no_check - url 'http://static.iospirit.com/static/objectfiles/file/159/Spacious.zip' + url 'https://www.iospirit.com/static/objectfiles/file/159/Spacious.zip' name 'Spacious' - homepage 'http://www.iospirit.com/products/spacious' + homepage 'https://www.iospirit.com/products/spacious' license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder app 'Spacious.app'
Fix url and homepage to use SSL in Spacious Cask The HTTP URL is already getting redirected to HTTPS. Using the HTTPS URL directly makes it more secure and saves a HTTP round-trip.
diff --git a/app/models/manageiq/providers/amazon/network_manager/load_balancer.rb b/app/models/manageiq/providers/amazon/network_manager/load_balancer.rb index abc1234..def5678 100644 --- a/app/models/manageiq/providers/amazon/network_manager/load_balancer.rb +++ b/app/models/manageiq/providers/amazon/network_manager/load_balancer.rb @@ -1,2 +1,48 @@ class ManageIQ::Providers::Amazon::NetworkManager::LoadBalancer < ::LoadBalancer + def self.raw_create_load_balancer(load_balancer_manager, load_balancer_name, options = {}) + load_balancer_manager.with_provider_connection(:service => :ElasticLoadBalancing) do |service| + _load_balancer = service.client.create_load_balancer(:load_balancer_name => load_balancer_name, + :listeners => options[:load_balancer_listeners], + :subnets => options[:cloud_subnets], + :security_groups => options[:security_groups]) + service.client.register_instances_with_load_balancer(:load_balancer_name => load_balancer_name, + :instances => options[:vms]) + service.client.configure_health_check(:load_balancer_name => load_balancer_name, + :health_check => options[:load_balancer_health_checks].first) + end + return load_balancer_name + rescue => err + _log.error "load_balancer=[#{load_balancer_name}], error: #{err}" + raise MiqException::MiqLoadBalancerProvisionError, err.to_s, err.backtrace + end + + def raw_update_load_balancer(_options) + raise 'Not supported' + rescue => err + _log.error "load_balancer=[#{name}], error: #{err}" + raise MiqException::MiqLoadBalancerUpdateError, err.to_s, err.backtrace + end + + def raw_delete_load_balancer + ext_management_system.with_provider_connection(:service => :ElasticLoadBalancing) do |service| + service.client.delete_load_balancer(:load_balancer_name => name) + end + rescue => err + _log.error "load_balancer=[#{name}], error: #{err}" + raise MiqException::MiqLoadBalancerDeleteError, err.to_s, err.backtrace + end + + def raw_status + ext_management_system.with_provider_connection(:service => :ElasticLoadBalancing) do |service| + load_balancer = service.client.describe_load_balancers.load_balancer_descriptions.detect do |x| + x.load_balancer_name == name + end + return 'create_complete' if load_balancer + end + raise MiqException::MiqLoadBalancerNotExistError, "Load Balancer #{name} in Provider #{ext_management_system.name} does not exist" + end + + def raw_exists? + true + end end
Add Amazon load balancer create and delete Add Amazon load balancer create and delete
diff --git a/lib/coding_test_dg/rule/discount.rb b/lib/coding_test_dg/rule/discount.rb index abc1234..def5678 100644 --- a/lib/coding_test_dg/rule/discount.rb +++ b/lib/coding_test_dg/rule/discount.rb @@ -1,6 +1,6 @@ module Rule class Discount - DEFAULT_RULE = {product_code:"SR1", qty:3, price:4.50} + DEFAULT_RULE = {product_code:"SR1", qty:3, price:5.00, rate:0.1} def initialize(rule={}) @rule = DEFAULT_RULE.merge(rule) end @@ -8,9 +8,9 @@ def apply(checkout) product_count = checkout.cart.map(&:product_code).count(@rule.fetch(:product_code)) if product_count >= @rule.fetch(:qty) - @rule.fetch(:price) * product_count + (@rule.fetch(:price) * @rule.fetch(:rate)) * product_count else - checkout.cart.map(&:price).first * product_count + 0 end end end
Return 0 when condition is not meet
diff --git a/lib/license-url-docinfoprocessor.rb b/lib/license-url-docinfoprocessor.rb index abc1234..def5678 100644 --- a/lib/license-url-docinfoprocessor.rb +++ b/lib/license-url-docinfoprocessor.rb @@ -0,0 +1,36 @@+require 'asciidoctor/extensions' unless RUBY_ENGINE == 'opal' + +include ::Asciidoctor + +# A postprocessor that emits an appropriate license URL into a document. +# Requires that the license attribute contain one or more http or https URL. +# +# Usage +# +# :license: http://opensource.org/licenses/MIT +# +Extensions.register do + docinfo_processor do + at_location :header + process do |doc| + next unless doc.attr? 'license' + backend = doc.backend + + result = [] + + # Support dual licensing. + (doc.attr 'license').split(/\s+/).each do |url| + next unless url.start_with? 'http://', 'https://' + if backend == 'docbook5' + result << %(<dct:license xmlns:dct="http://purl.org/dc/terms/">#{url}</dct:license>) + elsif backend == 'html5' + result << %(<link rel="license" href="#{url}">) + elsif backend == 'xhtml5' + result << %(<link rel="license" href="#{url}" />) + end + end + + result * EOL + end + end +end
Add a DocinfoProcessor to emit license information.
diff --git a/lib/calabash/android/operations.rb b/lib/calabash/android/operations.rb index abc1234..def5678 100644 --- a/lib/calabash/android/operations.rb +++ b/lib/calabash/android/operations.rb @@ -16,6 +16,9 @@ Calabash::Device.default.start_test_server(application, test_options) end + + def _shutdown_test_server(options={}) + Calabash::Device.default.shutdown_test_server(options) end end end
Add _shutdown_test_server impl for Android
diff --git a/lib/translate.rb b/lib/translate.rb index abc1234..def5678 100644 --- a/lib/translate.rb +++ b/lib/translate.rb @@ -2,7 +2,7 @@ module Translate class Engine < Rails::Engine - end if defined?(Rails) && Rails::VERSION::MAJOR == 3 + end if defined?(Rails) && Rails::VERSION::MAJOR >= 3 class << self # For configuring Google Translate API key
Create Engine for Rails 4.+ as well.
diff --git a/lib/expando/api_ai/system_entity_examples.rb b/lib/expando/api_ai/system_entity_examples.rb index abc1234..def5678 100644 --- a/lib/expando/api_ai/system_entity_examples.rb +++ b/lib/expando/api_ai/system_entity_examples.rb @@ -3,8 +3,12 @@ module SystemEntityExamples # Example system entity values to use when replacing/annotating entity values. # - # @see https://docs.api.ai/docs/concept-entities#section-system-entities + # @see https://dialogflow.com/docs/reference/system-entities VALUES = { + 'sys.unit-currency' => [ + '5 dollars', + '25 pounds' + ], 'sys.date-time' => [ 'Tomorrow', '5:30 pm', @@ -30,6 +34,17 @@ 'Robert', 'Lauren' ], + 'sys.number-integer' => [ + '1', + '34', + '5' + ], + 'sys.number' => [ + 'ten', + 'twenty', + 'tenth', + 'third' + ], 'sys.time' => [ '1 pm', '20:30',
Add more system entity examples
diff --git a/lib/clarifai/client/curator_search.rb b/lib/clarifai/client/curator_search.rb index abc1234..def5678 100644 --- a/lib/clarifai/client/curator_search.rb +++ b/lib/clarifai/client/curator_search.rb @@ -18,11 +18,18 @@ def tags_search(index, tags, size=50, start=0, search_options={}) tags = [tags] if tags.is_a? String + options = { - query: { tags: tags }, num: size, start: start } + + if tags.is_a? Array + options[:query] = { tags: tags } + elsif tags.is_a? Hash + options[:query] = { tags: { tags: tags } } + end + search(index, options) end
Fix markup for tags search
diff --git a/middleman-core/lib/middleman-more/extensions/automatic_image_sizes.rb b/middleman-core/lib/middleman-more/extensions/automatic_image_sizes.rb index abc1234..def5678 100644 --- a/middleman-core/lib/middleman-more/extensions/automatic_image_sizes.rb +++ b/middleman-core/lib/middleman-more/extensions/automatic_image_sizes.rb @@ -24,7 +24,7 @@ begin width, height = ::FastImage.size(full_path, raise_on_failure: true) # Check for @2x and @3x image - retina = full_path.match/(@(\d)x\.[a-zA-Z]{3,4}$/) + retina = full_path.match(/@(\d)x\.[a-zA-Z]{3,4}$/) if retina factor = retina[1].to_i width = width / factor
Fix syntax bug on retina file matching
diff --git a/lib/hairballs/plugins/colorize_json.rb b/lib/hairballs/plugins/colorize_json.rb index abc1234..def5678 100644 --- a/lib/hairballs/plugins/colorize_json.rb +++ b/lib/hairballs/plugins/colorize_json.rb @@ -18,7 +18,7 @@ is_json = JSON.parse(@context.last_value) rescue nil if is_json - vputs 'return value is JSON-like' + vputs "[#{plugin.name}] Return value is JSON-like" printf @context.return_format, JSON.pretty_generate(JSON.parse(@context.last_value)).colorize(plugin.color) else
Prepend "Hairballs" to log messages
diff --git a/lib/invoker/power/setup/distro/base.rb b/lib/invoker/power/setup/distro/base.rb index abc1234..def5678 100644 --- a/lib/invoker/power/setup/distro/base.rb +++ b/lib/invoker/power/setup/distro/base.rb @@ -6,13 +6,15 @@ RINETD_FILE = "/etc/rinetd.conf" def self.distro_installer - case Facter[:lsbdistid].value + case Facter[:operatingsystem].value when "Ubuntu" require "invoker/power/setup/distro/ubuntu" Ubuntu.new when "Fedora" require "invoker/power/setup/distro/redhat" Redhat.new + else + raise "Your selected distro is not supported by Invoker" end end
Use operating systen and raise error if distro is not supported
diff --git a/lib/lockfile_preserver/ruby_version.rb b/lib/lockfile_preserver/ruby_version.rb index abc1234..def5678 100644 --- a/lib/lockfile_preserver/ruby_version.rb +++ b/lib/lockfile_preserver/ruby_version.rb @@ -27,7 +27,39 @@ private_constant :NEW_LINE def keep_ruby_version + if updated.include? RUBY_VERSION + retains_ruby_version + else + add_ruby_version + end + end + + def retains_ruby_version updated.sub(REGEXP, ruby_version_section) + end + + # How RUBY VERSION added to lockfile: https://git.io/voWNN + def add_ruby_version + updated_lines = updated.lines + + # Find BUNDLED WITH line + bundled_with_index = updated.lines.index { |line| line.include? "BUNDLED WITH" } + + # RUBY VERSION should be added before BUNDLED WITH + add_ruby_version_index = bundled_with_index-1 + + # Find where to add RUBY VERSION section + while updated_lines[add_ruby_version_index] != "\n" + add_ruby_version_index -= 1 + end + + # Add RUBY VERSION section + updated_lines.insert( + add_ruby_version_index, "\nRUBY VERSION\n", " #{ruby_version}\n" + ) + + # Reconstruct lockfile + updated_lines.join end def remove_ruby_version
Fix RubyVersion does not add RUBY VERSION section back
diff --git a/lib/protobuf/rpc/servers/zmq_runner.rb b/lib/protobuf/rpc/servers/zmq_runner.rb index abc1234..def5678 100644 --- a/lib/protobuf/rpc/servers/zmq_runner.rb +++ b/lib/protobuf/rpc/servers/zmq_runner.rb @@ -41,7 +41,7 @@ logger.info do <<-THREAD_TRACE #{thread.inspect}: - #{thread.backtrace.join($INPUT_RECORD_SEPARATOR)}" + #{thread.backtrace.try(:join, $INPUT_RECORD_SEPARATOR)}" THREAD_TRACE end end
Fix unhandled error in trap signal handler Thread#backtrace can be nil. If this is the case, this signal handler will throw an error and terminate the process. In the case of nil here, we will just print nothing and continue on.
diff --git a/lib/scss_lint/linter/property_units.rb b/lib/scss_lint/linter/property_units.rb index abc1234..def5678 100644 --- a/lib/scss_lint/linter/property_units.rb +++ b/lib/scss_lint/linter/property_units.rb @@ -4,7 +4,6 @@ include LinterRegistry def visit_prop(node) - @node = node @global_allowed = config['global'].to_set @properties = config['properties'] @property = node.name.join @@ -12,26 +11,26 @@ return if @units.empty? - global_allows_ok? && property_allows_ok? + global_allows_ok?(node) && property_allows_ok?(node) end private - def global_allows_ok? + def global_allows_ok?(node) not_allowed = units_not_allowed_globally unless property_units_defined? unless not_allowed.empty? - add_lint(@node, "Units are not allowed globally: #{not_allowed.join(' ')}") + add_lint(node, "Units are not allowed globally: #{not_allowed.join(' ')}") end return false end true end - def property_allows_ok? + def property_allows_ok?(node) not_allowed = units_not_allowed_on_property unless not_allowed.empty? - add_lint(@node, "Units are not allowed on #{@property}: #{not_allowed.join(' ')}") + add_lint(node, "Units are not allowed on #{@property}: #{not_allowed.join(' ')}") return false end true
Remove unnecessary instance variable for node While not declaring the `node` as a parameter for these helpers can make things seem cleaner, it reduces the locality of the value's declaration to its use.
diff --git a/lib/timer.rb b/lib/timer.rb index abc1234..def5678 100644 --- a/lib/timer.rb +++ b/lib/timer.rb @@ -2,14 +2,16 @@ require 'g' module Timer - def time(message="") + def time(message="", options={}) + title = options[:title] || "" + start_time = Time.now yield end_time = Time.now - put_elapsed_time(start_time, end_time, message) + put_elapsed_time(start_time, end_time, message, title) end - def put_elapsed_time(start_time, end_time, message="") + def put_elapsed_time(start_time, end_time, message="", title=nil) seconds = end_time - start_time if seconds > 59 minutes = seconds / 60.0 @@ -34,6 +36,15 @@ e = message + e e += "Elapsed time: #{elapsed_time}" puts e - g(e) + if title + g(e, :title => title) + else + g(e) + end + rescue StandardError => e + # growl isn't turned on, fail silently + unless e.message =~ /Connection refused/ + raise e + end end end
Handle growl a little more gracefully
diff --git a/KWStepper.podspec b/KWStepper.podspec index abc1234..def5678 100644 --- a/KWStepper.podspec +++ b/KWStepper.podspec @@ -6,10 +6,10 @@ s.license = { :type => "MIT", :file => "LICENSE" } s.author = { "Kyle Weiner" => "[email protected]" } s.screenshots = "https://raw.githubusercontent.com/kyleweiner/KWStepper/master/screenshots.png" - s.platform = :ios, '7.0' s.source = { :git => "https://github.com/kyleweiner/KWStepper.git", :tag => s.version.to_s } s.requires_arc = true s.source_files = "KWStepper/*.swift" + s.platform = :ios s.description = <<-DESC KWStepper is a stepper control written in Swift. Unlike UIStepper, KWStepper allows for a fully customized UI and provides optional delegate methods for tailoring the UX. DESC
Update podspec to pass validation
diff --git a/db/data_migration/20130325152008_fix_home_office_detailed_guide_category.rb b/db/data_migration/20130325152008_fix_home_office_detailed_guide_category.rb index abc1234..def5678 100644 --- a/db/data_migration/20130325152008_fix_home_office_detailed_guide_category.rb +++ b/db/data_migration/20130325152008_fix_home_office_detailed_guide_category.rb @@ -0,0 +1,9 @@+to_fix = MainstreamCategory.where(title: 'Powers of entry').first + +if to_fix + to_fix.title = 'Policing and crime prevention' + to_fix.slug = 'policing' + if to_fix.save + puts "Mainstream category '#{to_fix.title}' updated" + end +end
Fix broken Home Office detailed guide category https://www.pivotaltracker.com/story/show/46822955
diff --git a/lib/jekyll/assets/compressors/scss.rb b/lib/jekyll/assets/compressors/scss.rb index abc1234..def5678 100644 --- a/lib/jekyll/assets/compressors/scss.rb +++ b/lib/jekyll/assets/compressors/scss.rb @@ -21,11 +21,11 @@ # -- Sprockets.register_compressor "text/css", :assets_scss, Scss Hook.register :env, :after_init, priority: 3 do |e| - unless Utils.activate("sassc") - e.css_compressor = nil - next unless e.asset_config[:compression] - e.css_compressor = :jekyll_assets_scss - end + next if Utils.activate("sassc") && !Utils.old_sprockets? + + e.css_compressor = nil + next unless e.asset_config[:compression] + e.css_compressor = :jekyll_assets_scss end end end
Make sure we allow compression on old sprockets...
diff --git a/lib/jekyll/minibundle/asset_bundle.rb b/lib/jekyll/minibundle/asset_bundle.rb index abc1234..def5678 100644 --- a/lib/jekyll/minibundle/asset_bundle.rb +++ b/lib/jekyll/minibundle/asset_bundle.rb @@ -15,6 +15,7 @@ def make_bundle rd, wr = IO.pipe pid = spawn bundling_cmd, out: @temp_file.path, in: rd + puts "Bundling #{@type} assets:" @assets.each do |asset| puts " #{asset}" IO.foreach(asset) { |line| wr.write line }
Add printing when bundling begins
diff --git a/lib/stackato-lkg/amazon/service.rb b/lib/stackato-lkg/amazon/service.rb index abc1234..def5678 100644 --- a/lib/stackato-lkg/amazon/service.rb +++ b/lib/stackato-lkg/amazon/service.rb @@ -0,0 +1,35 @@+require 'aws-sdk' +require 'contracts' +require_relative 'support/rate_limit_handler' +require_relative '../config' + +module StackatoLKG + module Amazon + class Service + include ::Contracts::Core + include ::Contracts::Builtin + include Support::RateLimitHandler + + Contract Maybe[Config] => Service + def initialize(config = nil) + @config = config + self + end + + Contract None => Aws::Client + def client + raise NotImplementedError + end + + Contract None => Aws::Client + def api + @api ||= client.new region: config.region + end + + Contract None => Config + def config + @config ||= Config.new + end + end + end +end
Add Amazon Service base class
diff --git a/lib/woodhouse/runners/bunny_runner.rb b/lib/woodhouse/runners/bunny_runner.rb index abc1234..def5678 100644 --- a/lib/woodhouse/runners/bunny_runner.rb +++ b/lib/woodhouse/runners/bunny_runner.rb @@ -6,38 +6,42 @@ def subscribe bunny = Bunny.new(@config.server_info) bunny.start - bunny.qos(:prefetch_count => 1) - queue = bunny.queue(@worker.queue_name) - exchange = bunny.exchange(@worker.exchange_name, :type => :headers) + channel = bunny.create_channel + channel.prefetch(1) + queue = channel.queue(@worker.queue_name) + exchange = channel.exchange(@worker.exchange_name, :type => :headers) queue.bind(exchange, :arguments => @worker.criteria.amqp_headers) - while not @stopped - message = queue.pop(:ack => true) - if message[:header].nil? - sleep 0.01 - else - job = make_job(message) + queue.subscribe(:ack => true, :block => false) do |delivery, props, payload| + begin + job = make_job(props, payload) if can_service_job?(job) - queue.ack message - service_job(job) + if service_job(job) + channel.acknowledge(delivery.delivery_tag, false) + else + channel.reject(delivery.delivery_tag, false) + end else - queue.reject message + @config.logger.error("Cannot service job #{job.describe} in queue for #{@worker.describe}") + channel.reject(delivery.delivery_tag, false) end - sleep 0.1 + rescue => err + @config.logger.error("Error bubbled up out of worker. This shouldn't happen. #{err.message}") + err.backtrace.each do |btr| + @config.logger.error(" #{btr}") + end + spin_down end end - bunny.stop - signal :spun_down + wait :spin_down end def spin_down - @stopped = true - wait :spun_down + signal :spin_down end - def make_job(message) + def make_job(properties, payload) Woodhouse::Job.new(@worker.worker_class_name, @worker.job_method) do |job| - args = message[:header].properties.merge(:payload => message[:payload]) - args.merge!(args.delete(:headers) || {}) + args = properties.headers.merge(:payload => payload) job.arguments = args end end
Update BunnyRunner to use new asynchronous Bunny consumer API.
diff --git a/m3u8.gemspec b/m3u8.gemspec index abc1234..def5678 100644 --- a/m3u8.gemspec +++ b/m3u8.gemspec @@ -20,7 +20,7 @@ spec.add_development_dependency 'bundler' spec.add_development_dependency 'rake' - spec.add_development_dependency 'rspec', '~> 3.4' + spec.add_development_dependency 'rspec', '>=3.0' spec.add_development_dependency 'coveralls' spec.add_development_dependency 'guard' spec.add_development_dependency 'guard-rspec'
Change rspec version to work with older rubies
diff --git a/spec/integration/start_spec.rb b/spec/integration/start_spec.rb index abc1234..def5678 100644 --- a/spec/integration/start_spec.rb +++ b/spec/integration/start_spec.rb @@ -1,34 +1,22 @@ # encoding: utf-8 RSpec.describe 'teletype' do - xit "prints available commands and global options" do - logo = <<-EOS - ┏━━━┓ - ┏━┳╋┳┳━┻━━┓ - ┣━┫┗┫┗┳┳┳━┫ - ┃ ┃┏┫┏┫┃┃★┃ - ┃ ┗━┻━╋┓┃ ┃ - ┗━━━━━┻━┻━┛ -EOS - output = <<-OUT -\e[31m#{logo}\e[0m + it "prints available commands and global options" do + command = "bundle exec teletype" + + out = `#{command}` + + expect(out).to include(<<-OUT) Commands: + teletype add COMMAND_NAME [OPTIONS] # Add a command to the command line app. teletype help [COMMAND] # Describe available commands or one specific command teletype new PROJECT_NAME [OPTIONS] # Create a new command line app skeleton. - teletype version # tty version + teletype version # TTY version Options: [--no-color] # Disable colorization in output. -r, [--dry-run], [--no-dry-run] # Run but do not make any changes. [--debug], [--no-debug] # Run with debug logging. - OUT - - puts output.encoding - - command = "bundle exe teletype" - out = `#{command}` - puts out.encoding - expect(out).to eq(output) end end
Change to fix spec to test no argument execution
diff --git a/spec/mars_photos/rover_spec.rb b/spec/mars_photos/rover_spec.rb index abc1234..def5678 100644 --- a/spec/mars_photos/rover_spec.rb +++ b/spec/mars_photos/rover_spec.rb @@ -1,5 +1,4 @@ require 'spec_helper' - describe MarsPhotos::Rover do let(:rover) { MarsPhotos::Rover.new("curiosity") } @@ -10,7 +9,15 @@ describe '#get' do it "retrieves the photos in an array for a rover when given the sol" do sol = 1000 - response = rover.get(sol) + response = rover.get(sol: sol) + expect(response.class).to eq(Array) + expect(response.first.keys.include?("img_src")).to be_truthy + expect(response.first.keys.include?("camera")).to be_truthy + end + + it "retrieves photos in array for a rover when given the earth date" do + earth_date = "2015-6-3" + response = rover.get(earth_date: earth_date) expect(response.class).to eq(Array) expect(response.first.keys.include?("img_src")).to be_truthy expect(response.first.keys.include?("camera")).to be_truthy
Add rspec test for get photos by earth_date
diff --git a/spec/packet_subclasses_spec.rb b/spec/packet_subclasses_spec.rb index abc1234..def5678 100644 --- a/spec/packet_subclasses_spec.rb +++ b/spec/packet_subclasses_spec.rb @@ -6,7 +6,7 @@ it "will display sensible peek information" do p = pclass.new p.respond_to?(:peek).should be_true - p.peek.size.should be_<=(80), p.peek.inspect + p.peek.size.should be <= 80, p.peek.inspect p.peek.should match(/^[A-Z0-9?]../) end end
Fix spec for less than-ness
diff --git a/spec/requests/deals_js_spec.rb b/spec/requests/deals_js_spec.rb index abc1234..def5678 100644 --- a/spec/requests/deals_js_spec.rb +++ b/spec/requests/deals_js_spec.rb @@ -13,20 +13,29 @@ Deal::Base.delete_all end - describe "残高明細の削除" do + include_context "太郎 logged in" + + describe "通常明細を削除できる" do + before do + FactoryGirl.create(:general_deal, :date => Date.new(2012, 7, 10)) + visit "/deals/2012/7" + click_link('削除') + page.driver.browser.switch_to.alert.accept + end + it do + page.should have_content("削除しました。") + end + end + + describe "残高明細を削除できる" do before do FactoryGirl.create(:balance_deal, :date => Date.new(2012, 7, 20)) + visit "/deals/2012/7" + click_link('削除') + page.driver.browser.switch_to.alert.accept end - include_context "太郎 logged in" - context "target is a balance deal" do - before do - visit "/deals/2012/7" - click_link('削除') - page.driver.browser.switch_to.alert.accept - end - it do - page.should have_content("削除しました。") - end + it do + page.should have_content("削除しました。") end end end
Add spec to destroy a general deal.
diff --git a/spree_product_assembly.gemspec b/spree_product_assembly.gemspec index abc1234..def5678 100644 --- a/spree_product_assembly.gemspec +++ b/spree_product_assembly.gemspec @@ -16,7 +16,7 @@ s.require_path = 'lib' s.requirements << 'none' - s.add_dependency('spree', '~> 1.0') + s.add_dependency('spree', '~> 2.0.0') s.add_development_dependency 'rspec-rails', '~> 2.7' s.add_development_dependency 'sqlite3'
Allow any Spree 2.0.0 version
diff --git a/spec/integration/asynchronous_publishing_and_consuming_with_retries_spec.rb b/spec/integration/asynchronous_publishing_and_consuming_with_retries_spec.rb index abc1234..def5678 100644 --- a/spec/integration/asynchronous_publishing_and_consuming_with_retries_spec.rb +++ b/spec/integration/asynchronous_publishing_and_consuming_with_retries_spec.rb @@ -0,0 +1,103 @@+require 'spec_helper' +require 'integration/jobs/print_line_job' + +describe "Asynchronous publishing and consuming with retries" do + include_context "Evented spec" + include_context "StringIO logger" + + before(:all) { QueueingRabbit.client = QueueingRabbit::Client::AMQP } + after(:all) { QueueingRabbit.client = QueueingRabbit.default_client } + + context "basic consuming" do + let(:line) { "Hello, world!" } + let(:connection) { QueueingRabbit.connection } + let(:job) { + Class.new(QueueingRabbit::AbstractJob) do + class << self + attr_accessor :io, :times_executed + end + + include QueueingRabbit::JobExtensions::Retryable + queue 'retryable_print_line_job' + + def perform + self.class.times_executed = self.class.times_executed.to_i + 1 + if retries > 2 + self.class.io << 'Hello, world!' + else + retry_upto(3) + end + end + end + } + let(:job_name) { 'RetryablePrintLineJob' } + let(:io) { StringIO.new } + let(:worker) { QueueingRabbit::Worker.new(job_name) } + + before(:each) do + QueueingRabbit.drop_connection + end + + before do + job.io = io + stub_const(job_name, job) + end + + it "processes enqueued jobs" do + em { + QueueingRabbit.connect + @queue_size = nil + + def request_queue_size + connection.open_channel do |c, _| + connection.define_queue(c, job.queue_name, job.queue_options).status do |s, _| + @queue_size = s + end + end + end + + delayed(0.5) { + 3.times { job.enqueue(line) } + } + + delayed(1.5) { + request_queue_size + } + + delayed(2.0) { + @queue_size.should == 3 + } + + delayed(2.5) { + worker.work + } + + delayed(3.5) { + request_queue_size + } + + done(4.0) { + @queue_size.should be_zero + job.times_executed.should == 12 + } + } + end + + it "actually outputs the line" do + em { + QueueingRabbit.connect + + delayed(0.5) { job.enqueue(line) } + + delayed(1.0) { + worker.work + } + + done(2.0) { + io.string.should include(line) + } + } + end + end +end +
Add integration test for retriable job extension.
diff --git a/spec/integration/contract/class_interface/rule/array_spec.rb b/spec/integration/contract/class_interface/rule/array_spec.rb index abc1234..def5678 100644 --- a/spec/integration/contract/class_interface/rule/array_spec.rb +++ b/spec/integration/contract/class_interface/rule/array_spec.rb @@ -23,8 +23,8 @@ context 'when the value is an array' do it 'applies rule when an item passed schema checks' do - expect(contract.(nums: ['oops', 1, 4]).errors.to_h) - .to eql(nums: { 0 => ['must be an integer'], 1 => ['invalid']}) + expect(contract.(nums: ['oops', 1, 4, 0]).errors.to_h) + .to eql(nums: { 0 => ['must be an integer'], 1 => ['invalid'], 3 => ['invalid']}) end end end
Make spec a bit more robust
diff --git a/pg_simulator.gemspec b/pg_simulator.gemspec index abc1234..def5678 100644 --- a/pg_simulator.gemspec +++ b/pg_simulator.gemspec @@ -18,6 +18,7 @@ lib/pg_simulator/environment.rb ] + s.add_development_dependency 'rake' s.add_development_dependency 'rspec', '~> 2.0' s.add_runtime_dependency "json", '~> 1.8'
Add rake to development dependencies.
diff --git a/test/decorators/optional_modules/mailings/mailing_message_decorator_test.rb b/test/decorators/optional_modules/mailings/mailing_message_decorator_test.rb index abc1234..def5678 100644 --- a/test/decorators/optional_modules/mailings/mailing_message_decorator_test.rb +++ b/test/decorators/optional_modules/mailings/mailing_message_decorator_test.rb @@ -1,4 +1,29 @@ require 'test_helper' +# +# == MailingMessageDecorator test +# class MailingMessageDecoratorTest < Draper::TestCase + include Draper::LazyHelpers + + setup :initialize_test + + test 'should return correct value for sent_at method' do + mailing_message_decorated = MailingMessageDecorator.new(@mailing_message) + assert_equal 'Envoyée le mercredi 09 décembre 2015 à 18h10', mailing_message_decorated.sent_at_message + end + + # + # == Status tag + # + test 'should return correct status_tag for sent attribute' do + mailing_message_decorated = MailingMessageDecorator.new(@mailing_message) + assert_match "<span class=\"status_tag envoyé red\">Envoyé</span>", mailing_message_decorated.status + end + + private + + def initialize_test + @mailing_message = mailing_messages(:one) + end end
Add tests for mailing messages decorator
diff --git a/Conductor.podspec b/Conductor.podspec index abc1234..def5678 100644 --- a/Conductor.podspec +++ b/Conductor.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Conductor" -s.version = "0.99" +s.version = "0.99.1" s.summary = "A framework for displaying an 'on-boarding' UI" s.homepage = "https://github.com/exsortis/Conductor" @@ -9,7 +9,7 @@ s.source = { :git => "https://github.com/exsortis/Conductor.git", :tag => s.version.to_s } s.source_files = 'Conductor/*.swift' -#s.resources = ['Conductor/*.storyboard'] +s.resources = ['Conductor/**/*.storyboard', 'Conductor/**/*.xcassets', 'Conductor/**/*.strings'] s.frameworks = 'UIKit' s.pod_target_xcconfig = { 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES' }
Update spec to include resources.
diff --git a/solutions/uri/1010/1010.rb b/solutions/uri/1010/1010.rb index abc1234..def5678 100644 --- a/solutions/uri/1010/1010.rb +++ b/solutions/uri/1010/1010.rb @@ -0,0 +1,8 @@+s = 0.0 + +STDIN.read.split("\n").each do |a| + a, b, c = a.split.map { |x| x.to_f } + s += c * b +end + +puts "VALOR A PAGAR: R$ #{'%.2f' % s}"
Solve Simple Calculate in ruby
diff --git a/lib/sastrawi/morphology/disambiguator/disambiguator_prefix_rule35.rb b/lib/sastrawi/morphology/disambiguator/disambiguator_prefix_rule35.rb index abc1234..def5678 100644 --- a/lib/sastrawi/morphology/disambiguator/disambiguator_prefix_rule35.rb +++ b/lib/sastrawi/morphology/disambiguator/disambiguator_prefix_rule35.rb @@ -0,0 +1,17 @@+module Sastrawi + module Morphology + module Disambiguator + class DisambiguatorPrefixRule35 + def disambiguate(word) + contains = /^ter([bcdfghjkpqstvxz])(er[bcdfghjklmnpqrstvwxyz])(.*)$/.match(word) + + if contains + matches = contains.captures + + return matches[0] << matches[1] << matches[2] + end + end + end + end + end +end
Add implementation of thirtieth-fifth rule of disambiguator prefix
diff --git a/test/helper.rb b/test/helper.rb index abc1234..def5678 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -3,6 +3,4 @@ add_filter '/test|deps/' end -gem 'test-unit' -require 'test/unit' -require 'test/unit/rr' +require 'test/unit/full'
Use test/unit/full instead of test/unit
diff --git a/week-4/hash.rb b/week-4/hash.rb index abc1234..def5678 100644 --- a/week-4/hash.rb +++ b/week-4/hash.rb @@ -1,6 +1,6 @@ # Define a Hash -# I worked on this challenge [by myself, with: ]. +# I worked on this challenge [by myself]. # Your Solution Below @@ -12,9 +12,6 @@ :hometown => "San Francicso", :age => 30 } - - - # 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.
Add solution file for challenge 4.6
diff --git a/spec/controllers/deliveries_controller_spec.rb b/spec/controllers/deliveries_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/deliveries_controller_spec.rb +++ b/spec/controllers/deliveries_controller_spec.rb @@ -3,7 +3,7 @@ describe DeliveriesController do before(:each) do activate_authlogic - UserSession.create Factory(:user) + UserSession.create Factory(:admin_user) end it "should list deliveries only for soul food farm" do
Fix spec to use user with admin auth
diff --git a/spec/controllers/pd_regimes_controller_spec.rb b/spec/controllers/pd_regimes_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/pd_regimes_controller_spec.rb +++ b/spec/controllers/pd_regimes_controller_spec.rb @@ -2,9 +2,13 @@ RSpec.describe PdRegimesController, :type => :controller do + before do + @patient = create(:patient) + end + describe 'GET #new' do it 'renders the new template' do - get :new + get :new, patient_id: @patient.id expect(response).to render_template('new') end end @@ -12,14 +16,14 @@ describe 'POST #create' do context "with valid attributes" do it 'creates a new PD Regime' do - expect { post :create, pd_regime: { start_date: '01/02/2015' } }.to change(PdRegime, :count).by(1) + expect { post :create, patient_id: @patient.id, pd_regime: { start_date: '01/02/2015' } }.to change(PdRegime, :count).by(1) expect(response).to redirect_to(pd_info_patient_path(@patient)) end end context "with invalid attributes" do it 'creates a new PD Regime' do - expect { post :create, pd_regime: { start_date: nil } }.to change(PdRegime, :count).by(0) + expect { post :create, patient_id: @patient.id, pd_regime: { start_date: nil } }.to change(PdRegime, :count).by(0) expect(response).to render_template(:new) end end
Set up spec tests for new/create actions for pd_regimes.
diff --git a/modules/govuk_elasticsearch/spec/classes/govuk_elasticsearch_spec.rb b/modules/govuk_elasticsearch/spec/classes/govuk_elasticsearch_spec.rb index abc1234..def5678 100644 --- a/modules/govuk_elasticsearch/spec/classes/govuk_elasticsearch_spec.rb +++ b/modules/govuk_elasticsearch/spec/classes/govuk_elasticsearch_spec.rb @@ -3,13 +3,7 @@ describe 'govuk_elasticsearch', :type => :class do describe '#use_mirror' do let(:facts) {{ - :kernel => 'Linux', - :configdir => '/woody', - :package_dir => '/rex', - :installpath => '/slinky/dog', - :plugindir => '/mr/potato/head', - :plugintool => 'bopeep', - :datadir => '/buzz/lightyear', + :kernel => 'Linux', }} context 'true (default)' do
Remove unnecessary stubbed facts for Elasticsearch The third-party `elasticsearch` module which `govuk_elasticsearch` calls needs the `Linux` fact to be stubbed so that `elasticsearch::params` can determine the appropriate user/group for that platform. The other facts listed in here look like the names of parameters on the `elasticsearch` class rather than the names of facts (they aren't generic enough). The tests don't fail without them, so I'm removing them for clarity.
diff --git a/ParallaxView.podspec b/ParallaxView.podspec index abc1234..def5678 100644 --- a/ParallaxView.podspec +++ b/ParallaxView.podspec @@ -6,7 +6,7 @@ s.summary = "Add parallax effect like in tvOS applications to any view." s.requires_arc = true s.license = "MIT" - s.version = "3.0.0" + s.version = "3.1.0" s.swift_version = '5.0' s.license = { :type => "MIT", :file => "LICENSE" } s.author = { "[Łukasz Śliwiński]" => "[[email protected]]" }
Update podspec for the 3.1.0 release
diff --git a/script/htmlproof.rb b/script/htmlproof.rb index abc1234..def5678 100644 --- a/script/htmlproof.rb +++ b/script/htmlproof.rb @@ -11,9 +11,9 @@ :timeframe => '1w', }, :typhoeus => { + :ssl_verifypeer => false, :timeout => 15, # seconds }, :url_ignore => [ - /html5rocks.com/, ], }).run
Stop ignoring html5rocks.com, disable SSL in link checks
diff --git a/test/controllers/backend/activity_budgets_controller_test.rb b/test/controllers/backend/activity_budgets_controller_test.rb index abc1234..def5678 100644 --- a/test/controllers/backend/activity_budgets_controller_test.rb +++ b/test/controllers/backend/activity_budgets_controller_test.rb @@ -1,7 +1,7 @@ require 'test_helper' module Backend class ActivityBudgetsControllerTest < ActionController::TestCase - test_restfully_all_actions duplicate: { params: { activity_id: 1, campaign_id: 6 } }, except: :show + test_restfully_all_actions duplicate: { params: { activity_id: 1, campaign_id: 6 } }, except: [:show, :index] test 'show action' do get :show, id: 'NaID', redirect: root_url, locale: @locale @@ -13,5 +13,10 @@ assert_not_nil assigns(:activity_budget) end end + + test 'index action' do + get :index, redirect: root_url, locale: @locale + assert_redirected_to backend_activities_url + end end end
Fix activity budgets index action test
diff --git a/spec/classes/historical_spec.rb b/spec/classes/historical_spec.rb index abc1234..def5678 100644 --- a/spec/classes/historical_spec.rb +++ b/spec/classes/historical_spec.rb @@ -24,5 +24,11 @@ :command => '/bin/systemctl daemon-reload', } )} + it { should contain_service('druid-historical').with( + { + :ensure => 'running', + :enable => true, + } + )} end end
Add test for the druid-historical service management. The druid::historical class needs to ensure the druid-historical service is running and enabled.
diff --git a/lib/bot/plugins/commands/ban_info.rb b/lib/bot/plugins/commands/ban_info.rb index abc1234..def5678 100644 --- a/lib/bot/plugins/commands/ban_info.rb +++ b/lib/bot/plugins/commands/ban_info.rb @@ -27,7 +27,7 @@ # A ternary would be illogical here for length. message = if bans > 0 - "#{username} has been banned! What a loser! They've been banned #{bans} times!" + "#{username} has been banned! What a loser! They've been banned #{bans} time#{bans == 1 ? '' : 's'}!" else "#{username} has not been banned! What a gentle person!" end
:bug: Fix bad plural in Fishbans plugin
diff --git a/lib/gds_api/test_helpers/need_api.rb b/lib/gds_api/test_helpers/need_api.rb index abc1234..def5678 100644 --- a/lib/gds_api/test_helpers/need_api.rb +++ b/lib/gds_api/test_helpers/need_api.rb @@ -1,4 +1,5 @@ require 'gds_api/test_helpers/json_client_helper' +require 'gds_api/test_helpers/common_responses' module GdsApi module TestHelpers
Add require for common responses module
diff --git a/db/data_migration/20200330092543_correct_first_published_for_nda_document.rb b/db/data_migration/20200330092543_correct_first_published_for_nda_document.rb index abc1234..def5678 100644 --- a/db/data_migration/20200330092543_correct_first_published_for_nda_document.rb +++ b/db/data_migration/20200330092543_correct_first_published_for_nda_document.rb @@ -0,0 +1,12 @@+document = Document.find(305774) +editions = document.editions.order(:created_at) +correct_first_published_at = editions.first.first_published_at + +editions.each do |edition| + if edition.first_published_at != correct_first_published_at + edition.first_published_at = correct_first_published_at + edition.save(validate: false) + end +end + +PublishingApiDocumentRepublishingWorker.new.perform(document.id)
Correct first_published_at for NDA document While working on importing news content for the Nuclear Decommissioning Authority in to Content Publisher we discovered a data inconsistency for the `first_published_at` value for one of their documents. In the first edition (id: 539202) the document was published on 3rd September 2015 and backdated to 23 August 2015. In a later edition (id: 560382), the document was backdated once more to 6 November 2015. The impact of this is that when importing the document in to Content Publisher, the integrity checker fails because the proposed payload generated drops any change notes that exist prior to the `first_published_at` date for the document. In this case, all change notes prior to 6 November 2015 have been dropped, which doesn't match up with the change history that exists in Publishing API. In this commit we change the `first_published_at` date for all editions belonging to this document to the earliest known backdate, 23 August 2015, as it shouldn't be possible to backdate to a date later than when the document originally got published. There is a validation in place on `first_published_at` which prevents it from being updated on superseded editions, so unfortunately we have needed to skip this in order to save the change.
diff --git a/lib/jeweler/generator/rspec_mixin.rb b/lib/jeweler/generator/rspec_mixin.rb index abc1234..def5678 100644 --- a/lib/jeweler/generator/rspec_mixin.rb +++ b/lib/jeweler/generator/rspec_mixin.rb @@ -2,7 +2,7 @@ class Generator module RspecMixin def self.extended(generator) - generator.development_dependencies << ["rspec", ">= 2.0.0.beta.19"] + generator.development_dependencies << ["rspec", "~> 2.0.0"] end def default_task
Add the rspec ~> 2.0.0 development dependencey in the RspecMixin.
diff --git a/lib/omniauth/strategies/stylitics.rb b/lib/omniauth/strategies/stylitics.rb index abc1234..def5678 100644 --- a/lib/omniauth/strategies/stylitics.rb +++ b/lib/omniauth/strategies/stylitics.rb @@ -18,13 +18,13 @@ # additional calls (if the user id is returned with the token # or as a URI parameter). This may not be possible with all # providers. - uid{ raw_info['webID'] } + uid{ raw_info['id'] } info do { - :first_name => raw_info['nameFirst'], + :first_name => raw_info['first_name'], :email => raw_info['email'], - :user_name => raw_info['userName'] + :user_name => raw_info['username'] } end @@ -35,7 +35,7 @@ end def raw_info - @raw_info ||= access_token.get('/api/v1/me').parsed + @raw_info ||= access_token.get('/api/v1/external/user_stats').parsed end end end
Use new API endpoint for user data
diff --git a/lib/tasks/app_credentials_tasks.rake b/lib/tasks/app_credentials_tasks.rake index abc1234..def5678 100644 --- a/lib/tasks/app_credentials_tasks.rake +++ b/lib/tasks/app_credentials_tasks.rake @@ -0,0 +1,28 @@+namespace :cenit do + namespace :admin do + namespace :app do + desc "Show identifier and secret of Cenit-Admin build-in-app" + task :credentials => :environment do + printf("--------------------------------------------------------------------------------------------------\n") + printf(" IDENTIFIER AND SECRET OF CENIT-ADMIN APPLICATION\n") + printf("--------------------------------------------------------------------------------------------------\n") + Cenit::BuildInApp.where(slug: 'admin').each do |app| + printf(" IDENTIFIER: %s\n", app.identifier) + printf(" SECRET: %s\n", app.secret) + printf(" CALLBACKS: %s\n", app.configuration.redirect_uris.join("\n ")) + printf("--------------------------------------------------------------------------------------------------\n") + end + end + + desc "Add new callbacks url to Cenit-Admin build-in-app" + task :add_callback, [:url] => :environment do |t, args| + Cenit::BuildInApp.where(slug: 'admin').each do |app| + app.configuration.redirect_uris << args[:url] unless app.configuration.redirect_uris.include?(args[:url]) + app.save! + Rake::Task["cenit:admin:app:credentials"].invoke + end + end + + end + end +end
Add rake task to get cenit-admin application credentials
diff --git a/db/migrate/20131008061545_add_identifications_count_to_observations.rb b/db/migrate/20131008061545_add_identifications_count_to_observations.rb index abc1234..def5678 100644 --- a/db/migrate/20131008061545_add_identifications_count_to_observations.rb +++ b/db/migrate/20131008061545_add_identifications_count_to_observations.rb @@ -2,6 +2,7 @@ def up add_column :observations, :identifications_count, :integer, :default => 0 max_id = Identification.maximum(:id) + return if max_id.nil? batch_size = 1000 # (1..max_id).in_groups_of(100) do |grp| (max_id / batch_size).times do |i|
Fix migration error on database with zero IDs
diff --git a/canon-creator.rb b/canon-creator.rb index abc1234..def5678 100644 --- a/canon-creator.rb +++ b/canon-creator.rb @@ -0,0 +1,57 @@+$: << '/home/emily/Software/SonicPi/sonic-pi/app/server/vendor/mini_kanren/lib' + +require 'mini_kanren' + +res = MiniKanren.exec do + + # make a structure, 4 bars long + + struct = {type: "round", num_bars: 4, time_sig: [4,4], + bars: [ + {num_notes: 4, notes: [{pitch: fresh, duration: fresh}, {pitch: fresh, duration: fresh}, {pitch: fresh, duration: fresh}, {pitch: fresh, duration: fresh}]}, + {num_notes: 4, notes: [{pitch: fresh, duration: fresh}, {pitch: fresh, duration: fresh}, {pitch: fresh, duration: fresh}, {pitch: fresh, duration: fresh}]}, + {num_notes: 4, notes: [{pitch: fresh, duration: fresh}, {pitch: fresh, duration: fresh}, {pitch: fresh, duration: fresh}, {pitch: fresh, duration: fresh}]}, + {num_notes: 4, notes: [{pitch: fresh, duration: fresh}, {pitch: fresh, duration: fresh}, {pitch: fresh, duration: fresh}, {pitch: fresh, duration: fresh}]}]} + + # add some basic constraints + + def in_key_of_c(x) + conde(eq(x, :c), eq(x, :d), eq(x, :d), eq(x, :e), eq(x, :f), eq(x, :g), eq(x, :a), eq(x, :b)) + end + + def is_some_duration(x) + conde(eq(x, 0.5), eq(x, 1), eq(x, 1.5), eq(x, 2), eq(x, 3), eq(x, 4)) + end + + def adds_up_to(current_bar, duration) + project(current_bar, lambda { |x| + sum = 0 + for k in 0..x[:num_notes] - 1 + sum += x[:notes][k][:duration] + end + eq(sum, duration) }) + end + + # do the constraints + + constraints = [] + + for i in 0..struct[:num_bars] - 1 + current_bar = struct[:bars][i] + for j in 0..current_bar[:num_notes] - 1 + constraints << in_key_of_c(current_bar[:notes][j][:pitch]) + constraints << is_some_duration(current_bar[:notes][j][:duration]) + end + for j in 0..current_bar[:num_notes] - 1 + constraints << adds_up_to(current_bar, 4) + end + end + + + # run it! + q = fresh + run(1, q, eq(q, struct), *constraints) + +end + +puts res
Set up very basic hard coded structure with key and duration constraints, including sum of durations.
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,32 @@+# Solution Below +old_string = "Ruby is cool" + +new_string = old_string.upcase.reverse + +puts new_string + + + + +# 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. + + +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
Add 4.2.2 Simple String Method Assignment
diff --git a/spec/lib/tumblfetch/cli_spec.rb b/spec/lib/tumblfetch/cli_spec.rb index abc1234..def5678 100644 --- a/spec/lib/tumblfetch/cli_spec.rb +++ b/spec/lib/tumblfetch/cli_spec.rb @@ -3,36 +3,38 @@ describe Tumblfetch::CLI do describe '#version' do - subject { capture(:stdout) { Tumblfetch::CLI.new.invoke('version') }.strip } - it { should be_eql Tumblfetch::VERSION } + it 'should print correct version' do + output = capture(:stdout) { subject.version } + expect(output).to include Tumblfetch::VERSION + end end describe '#init' do context 'when ~/.tumblr is nonexistent' do it 'should print execute `tumblr`' do File.stub(:exist?).and_return(false) - msg = capture(:stderr) { Tumblfetch::CLI.new.invoke('init') } - expect(msg).to include Tumblfetch::CLI::EXECUTE_TUMBLR_MSG + output = capture(:stderr) { subject.init } + expect(output).to include Tumblfetch::CLI::EXECUTE_TUMBLR_MSG end end context 'when .tumblfetch is nonexistent' do it 'should generate a .tumblfetch' do - capture(:stdout) { Tumblfetch::CLI.new.invoke('init') } + output = capture(:stdout) { subject.init } File.exist?('./.tumblfetch').should be_true end it 'should print success message' do - msg = capture(:stdout) { Tumblfetch::CLI.new.invoke('init') } - expect(msg).to include Tumblfetch::CLI::SETTINGS_GENERATED_MSG + output = capture(:stdout) { subject.init } + expect(output).to include Tumblfetch::CLI::SETTINGS_GENERATED_MSG end end context 'when .tumblfetch already exist' do it 'should print warning message' do File.open('./.tumblfetch', 'w').close - msg = capture(:stderr) { Tumblfetch::CLI.new.invoke('init') } - expect(msg).to include Tumblfetch::CLI::SETTINGS_EXIST_MSG + output = capture(:stderr) { subject.init } + expect(output).to include Tumblfetch::CLI::SETTINGS_EXIST_MSG end end end
Use subject.method instead of Tumblfetch::CLI.new.invoke('method')
diff --git a/spec/unit/libraries/api_spec.rb b/spec/unit/libraries/api_spec.rb index abc1234..def5678 100644 --- a/spec/unit/libraries/api_spec.rb +++ b/spec/unit/libraries/api_spec.rb @@ -29,7 +29,7 @@ describe 'list_repositories' do it 'returns repos' do stub_request(:get, 'http://localhost/sample/api') - .with(basic_auth: %w[admin admin123]) + .with(basic_auth: %w(admin admin123)) .to_return(body: json_response(repo_list), headers: { 'Content-Type' => 'application/json' }) expect(api_client.list_repositories).to eq(repo_list)
Fix Rubocop issue with %w literals
diff --git a/polymorpheus.gemspec b/polymorpheus.gemspec index abc1234..def5678 100644 --- a/polymorpheus.gemspec +++ b/polymorpheus.gemspec @@ -20,6 +20,6 @@ s.add_dependency('activerecord', '>= 3.2', '< 5') s.add_development_dependency('rake', '~> 10.4.2') - s.add_development_dependency('rspec-rails', '~> 2.14.0') + s.add_development_dependency('rspec', '~> 2.14.0') s.add_development_dependency('mysql2', '~> 0.3.10') end
Switch from rspec-rails to rspec This commit drops the development dependency on `rspec-rails`. The specs for `polymorpheus` don't use any of the extra functionality beyond what is provided by `rspec`.
diff --git a/modules/motd/spec/classes/motd_spec.rb b/modules/motd/spec/classes/motd_spec.rb index abc1234..def5678 100644 --- a/modules/motd/spec/classes/motd_spec.rb +++ b/modules/motd/spec/classes/motd_spec.rb @@ -0,0 +1,10 @@+require_relative '../../../../spec_helper' + +describe 'motd', :type => :class do + + it { is_expected.to compile } + + it { is_expected.to compile.with_all_deps } + + it { is_expected.to contain_class('motd') } +end
Add stub rspec test to motd module
diff --git a/06-physics/entities/components/tank_graphics.rb b/06-physics/entities/components/tank_graphics.rb index abc1234..def5678 100644 --- a/06-physics/entities/components/tank_graphics.rb +++ b/06-physics/entities/components/tank_graphics.rb @@ -1,4 +1,11 @@ class TankGraphics < Component + DEBUG_COLORS = [ + Gosu::Color::RED, + Gosu::Color::BLUE, + Gosu::Color::YELLOW, + Gosu::Color::WHITE + ] + def initialize(game_object) super(game_object) @body = units.frame('tank1_body.png') @@ -22,18 +29,13 @@ end def draw_bounding_box - colors = [ - Gosu::Color::RED, - Gosu::Color::BLUE, - Gosu::Color::YELLOW, - Gosu::Color::WHITE - ] i = 0 object.box.each_slice(2) do |x, y| + color = DEBUG_COLORS[i] $window.draw_triangle( - x - 3, y - 3, colors[i], - x, y, colors[i], - x + 3 , y - 3, colors[i], + x - 3, y - 3, color, + x, y, color, + x + 3, y - 3, color, 100) i = (i + 1) % 4 end
Rewrite tank bounding box method
diff --git a/tokite.gemspec b/tokite.gemspec index abc1234..def5678 100644 --- a/tokite.gemspec +++ b/tokite.gemspec @@ -9,7 +9,7 @@ s.version = Tokite::VERSION s.authors = ["hogelog"] s.email = ["[email protected]"] - s.homepage = "https://github.com/hogelog/tokite/" + s.homepage = "https://github.com/cookpad/tokite/" s.summary = "Customizable Slack notification from GitHub" s.description = "Customizable Slack notification from GitHub" s.license = "MIT"
Fix homepage URL in the gemspec
diff --git a/business.gemspec b/business.gemspec index abc1234..def5678 100644 --- a/business.gemspec +++ b/business.gemspec @@ -20,7 +20,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_development_dependency "gc_ruboconfig", "~> 3.0.1" + spec.add_development_dependency "gc_ruboconfig", "~> 3.1.0" spec.add_development_dependency "rspec", "~> 3.1" spec.add_development_dependency "rspec_junit_formatter", "~> 0.5.1" spec.add_development_dependency "rubocop", "~> 1.29.1"
Update gc_ruboconfig requirement from ~> 3.0.1 to ~> 3.1.0 Updates the requirements on [gc_ruboconfig](https://github.com/gocardless/ruboconfig) to permit the latest version. - [Release notes](https://github.com/gocardless/ruboconfig/releases) - [Changelog](https://github.com/gocardless/gc_ruboconfig/blob/master/CHANGELOG.md) - [Commits](https://github.com/gocardless/ruboconfig/compare/v3.0.1...v3.1.0) --- updated-dependencies: - dependency-name: gc_ruboconfig dependency-type: direct:development ... Signed-off-by: dependabot[bot] <[email protected]>
diff --git a/spec/factories/applications.rb b/spec/factories/applications.rb index abc1234..def5678 100644 --- a/spec/factories/applications.rb +++ b/spec/factories/applications.rb @@ -1,8 +1,7 @@ FactoryGirl.define do - name = FactoryGirl.generate(:name) factory :application do - name { name } - key { name } + name { FactoryGirl.generate(:name) } + key { FactoryGirl.generate(:name) } canvas_api_permissions do { default: [
Use factory for name and key
diff --git a/spec/fpm/package/empty_spec.rb b/spec/fpm/package/empty_spec.rb index abc1234..def5678 100644 --- a/spec/fpm/package/empty_spec.rb +++ b/spec/fpm/package/empty_spec.rb @@ -1,10 +1,5 @@ require "spec_setup" -require 'fileutils' require "fpm" # local -require "fpm/package/deb" # local -require "fpm/package/dir" # local -require "stud/temporary" -require "English" # for $CHILD_STATUS describe FPM::Package::Empty do describe "#to_s" do
Remove unnecessary requires lines from spec
diff --git a/spec/models/iep_storer_spec.rb b/spec/models/iep_storer_spec.rb index abc1234..def5678 100644 --- a/spec/models/iep_storer_spec.rb +++ b/spec/models/iep_storer_spec.rb @@ -0,0 +1,25 @@+require 'rails_helper' + +RSpec.describe IepStorer, type: :model do + subject { + IepStorer.new( + file_name: 'IEP Document', + path_to_file: '/path/to/file', + file_date: DateTime.current, + local_id: 'abc_student_local_id' + ) + } + + context 'local id matches to student' do + it 'stores an object to the db' do + + end + end + + context 'local id does not match to student' do + it 'does not store an object to the db' do + + end + end + +end
Write context blocks for the IepStorer spec
diff --git a/active_force.gemspec b/active_force.gemspec index abc1234..def5678 100644 --- a/active_force.gemspec +++ b/active_force.gemspec @@ -19,6 +19,7 @@ spec.require_paths = ["lib"] spec.add_dependency 'active_attr', '~> 0.8' + spec.add_dependency 'restforce', '~> 1.4' spec.add_development_dependency 'bundler', '~> 1.3' spec.add_development_dependency 'rake' spec.add_development_dependency 'rspec'
Add obvious dependency on restforce.
diff --git a/biblicit.gemspec b/biblicit.gemspec index abc1234..def5678 100644 --- a/biblicit.gemspec +++ b/biblicit.gemspec @@ -12,7 +12,7 @@ gem.summary = %q{Extract citations from PDFs.} gem.homepage = "http://github.com/academia-edu/biblicit" - gem.files = `git ls-files`.split($\) + gem.files = `git ls-files`.split("\n") gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } gem.test_files = gem.files.grep(%r{^spec/}) gem.require_paths = ["lib"]
Fix gemspec for files with spaces in the names
diff --git a/Casks/opera-developer.rb b/Casks/opera-developer.rb index abc1234..def5678 100644 --- a/Casks/opera-developer.rb +++ b/Casks/opera-developer.rb @@ -1,6 +1,6 @@ cask :v1 => 'opera-developer' do - version '29.0.1794.0' - sha256 'c6d875407a276a4b48a5d6b271ba5e40b7292c3734510635d74a56ccd7a1b6e8' + version '29.0.1795.0' + sha256 '33b33c56d079c524e43e41ff588f3cfa6bc3481f87f4c4705623220464462023' url "http://get.geo.opera.com/pub/opera-developer/#{version}/mac/Opera_Developer_#{version}_Setup.dmg" homepage 'http://www.opera.com/developer'
Upgrade Opera Developer.app to 29.0.1795.0
diff --git a/activerecord-peoplesoft_models.gemspec b/activerecord-peoplesoft_models.gemspec index abc1234..def5678 100644 --- a/activerecord-peoplesoft_models.gemspec +++ b/activerecord-peoplesoft_models.gemspec @@ -19,10 +19,10 @@ spec.require_paths = ["lib"] spec.add_dependency "composite_primary_keys", "~> 8.0" - spec.add_dependency "activerecord-oracle_enhanced-adapter", "~> 1.5" - spec.add_dependency "ruby-oci8", "~> 2.1" unless RUBY_PLATFORM == "java" spec.add_development_dependency "bundler", "~> 1.7" spec.add_development_dependency "rake", "~> 10.0" spec.add_development_dependency "sqlite3", "~> 1.3.10" + spec.add_development_dependency "activerecord-oracle_enhanced-adapter", "~> 1.5" + spec.add_development_dependency "ruby-oci8", "~> 2.1" unless RUBY_PLATFORM == "java" end
Move oracle-related dependecies to the development section While it'll usually be the case, there's no reason to assume this will be used with Oracle. We shouldn't force it here.