diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/controllers/api/v1/base_controller_v1.rb b/app/controllers/api/v1/base_controller_v1.rb index abc1234..def5678 100644 --- a/app/controllers/api/v1/base_controller_v1.rb +++ b/app/controllers/api/v1/base_controller_v1.rb @@ -2,6 +2,13 @@ class BaseControllerV1 < ApplicationController respond_to :json - + + before_action :set_access_control_headers + + def set_access_control_headers + headers['Access-Control-Allow-Origin'] = '*' + headers['Access-Control-Allow-Methods'] = 'GET' + headers['Access-Control-Expose-Headers'] = 'Link, Total, Per-Page' + end end -end+end
Add CORS headers to API endpoints
diff --git a/app/controllers/api/v1/reports_controller.rb b/app/controllers/api/v1/reports_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/v1/reports_controller.rb +++ b/app/controllers/api/v1/reports_controller.rb @@ -8,15 +8,14 @@ # GET api/v1/reports/:id def show offering = Portal::Offering.find(params[:id]) - # authorize offering, :api_report? + authorize offering, :api_report? render json: API::V1::Report.new(offering, request.protocol, request.host_with_port).to_json end # PUT api/v1/reports/:id def update offering = Portal::Offering.find(params[:id]) - # authorize offering, :api_report? - puts params + authorize offering, :api_report? if params[:visibility_filter] update_visibility_filter(offering.report_embeddable_filter, params[:visibility_filter]) end @@ -27,6 +26,8 @@ private def update_visibility_filter(filter, filter_params) + # In some cases client can send only one parameter, so make sure that the second one won't be affected. + # Note that we should accept an empty array, so #present? or #blank? can't be used here. filter.embeddable_keys = filter_params[:questions] unless filter_params[:questions].nil? filter.ignore = !filter_params[:active] unless filter_params[:active].nil? filter.save!
Enable authorization in Report API [#114840697]
diff --git a/app/controllers/course/courses_controller.rb b/app/controllers/course/courses_controller.rb index abc1234..def5678 100644 --- a/app/controllers/course/courses_controller.rb +++ b/app/controllers/course/courses_controller.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class Course::CoursesController < Course::Controller include Course::ActivityFeedsConcern + + before_action :load_todos, only: [:show] def index # :nodoc: @courses = Course.publicly_accessible.page(page_param) @@ -39,4 +41,13 @@ params.require(:course). permit(:title, :description, :status, :start_at, :end_at, :logo) end + + def load_todos + if current_course_user && current_course_user.student? + @todos = Course::LessonPlan::Todo.pending_for(current_course_user). + includes(:user, item: [:actable, :course]) + # TODO: Fix n+1 query for #can_user_start? + @todos = @todos.select(&:can_user_start?).first(3) + end + end end
Load todos for course students in course homepage
diff --git a/lib/everything/blog/s3_site.rb b/lib/everything/blog/s3_site.rb index abc1234..def5678 100644 --- a/lib/everything/blog/s3_site.rb +++ b/lib/everything/blog/s3_site.rb @@ -26,6 +26,8 @@ end end + include Everything::Logger::LogIt + attr_reader :output_files def initialize(output_files) @@ -39,7 +41,15 @@ end def send_remote_files - remote_files.each(&:send) + info_it("Uploading blog output files to S3...") + + remote_files + .tap do |o| + info_it("Uploading a total of `#{o.count}` output files") + end + .each(&:send) + + info_it("Upload to S3 complete.") end end end
Add info messages to s3 site
diff --git a/lib/restulicious/collection.rb b/lib/restulicious/collection.rb index abc1234..def5678 100644 --- a/lib/restulicious/collection.rb +++ b/lib/restulicious/collection.rb @@ -13,7 +13,7 @@ end def each(&block) - send(collection_key).each { |item| block.call(item) } + send(collection_key).each(&block) end def empty?
Fix include Enumerable to honor interface
diff --git a/lib/specinfra/configuration.rb b/lib/specinfra/configuration.rb index abc1234..def5678 100644 --- a/lib/specinfra/configuration.rb +++ b/lib/specinfra/configuration.rb @@ -36,7 +36,7 @@ def method_missing(meth, val=nil) key = meth.to_s key.gsub!(/=$/, '') - if val + if ! val.nil? instance_variable_set("@#{key}", val) RSpec.configuration.send(:"#{key}=", val) if defined?(RSpec) end
Set value when val is not nil. Before fixing it, we cannot set false with this condition
diff --git a/test/tc_causal_delivery.rb b/test/tc_causal_delivery.rb index abc1234..def5678 100644 --- a/test/tc_causal_delivery.rb +++ b/test/tc_causal_delivery.rb @@ -9,22 +9,37 @@ end class TestCausalDelivery < Test::Unit::TestCase + def register_sent_cb(bud, q) + bud.register_callback(:pipe_sent) do + q.push(true) + end + end + def test_basic agents = (1..3).map { CausalAgent.new } agents.each {|a| a.run_bg} a, b, c = agents + q_b = Queue.new + q_c = Queue.new + register_sent_cb(b, q_b) + register_sent_cb(c, q_c) + a.sync_do { a.pipe_in <+ [[b.ip_port, a.ip_port, 1, "foo1"]] } + q_b.pop + a.sync_do { a.pipe_in <+ [[b.ip_port, a.ip_port, 2, "foo2"]] } + q_b.pop + a.sync_do { a.pipe_in <+ [[c.ip_port, a.ip_port, 3, "bar"]] } + q_c.pop - sleep 3 agents.each {|a| a.stop} end end
Tweak causal delivery test case.
diff --git a/app/api/v1/blocks.rb b/app/api/v1/blocks.rb index abc1234..def5678 100644 --- a/app/api/v1/blocks.rb +++ b/app/api/v1/blocks.rb @@ -8,13 +8,11 @@ resource :blocks do resource :preview do get do + block_type = params[:block_type] + return forbidden! unless block_type.constantize <= Block profile = environment.profiles.find_by(id: params[:profile_id]) - block_type = params[:block_type] - box = Box.new - box.owner = profile - block_class = block_type.constantize - block = block_class.new - block.box = box + box = Box.new(:owner => profile) + block = block_type.constantize.new(:box => box) present_partial block, :with => Entities::Block, display_api_content: true end end
Add check to prevent unwanted block_type parameter
diff --git a/spec/workers/asset_file_metadata_worker_spec.rb b/spec/workers/asset_file_metadata_worker_spec.rb index abc1234..def5678 100644 --- a/spec/workers/asset_file_metadata_worker_spec.rb +++ b/spec/workers/asset_file_metadata_worker_spec.rb @@ -18,7 +18,7 @@ worker.perform(asset.id.to_s) - expect(asset.reload.last_modified.to_i).to eq(asset.last_modified_from_file.to_i) + expect(asset.reload.last_modified).to be_within(0.001).of(asset.last_modified_from_file) end it 'sets Asset#md5_hexdigest to Asset#md5_hexdigest_from_file in database' do
Use be_within RSpec matcher to make spec example less brittle Mongoid rounds Time objects to 3 decimal places. By using the be_within matcher we can make this assertion less flakey.
diff --git a/app/models/export.rb b/app/models/export.rb index abc1234..def5678 100644 --- a/app/models/export.rb +++ b/app/models/export.rb @@ -43,17 +43,16 @@ def create_spreadsheet return if @created - begin - book = SpreadsheetExporter.new.master_inventory - book.write tempfile - rescue => e - Rails.logger.error "Spreadsheet wasn't able to be created and written to file - *** Error Output *** -#{e} - *** End Error Output ***" - @error_message = "Error creating spreadsheet!" - ensure - @created = true - end + book = SpreadsheetExporter.new.master_inventory + book.write tempfile + rescue => e + Rails.logger.error "Spreadsheet wasn't able to be created and written to file + *** Error Output *** +#{e} (#{e.class}) + #{e.backtrace.join("\n ")} + *** End Error Output ***" + @error_message = "Error creating spreadsheet!" + ensure + @created = true end end
Drop unneeded begin/end and add more info to logging
diff --git a/app/models/wizard.rb b/app/models/wizard.rb index abc1234..def5678 100644 --- a/app/models/wizard.rb +++ b/app/models/wizard.rb @@ -41,4 +41,8 @@ end end + def pick_up + 'I throw myself to the ground and pick myself up again.' + end + end
Throw self to ground and GET me
diff --git a/Library/Formula/objective-caml.rb b/Library/Formula/objective-caml.rb index abc1234..def5678 100644 --- a/Library/Formula/objective-caml.rb +++ b/Library/Formula/objective-caml.rb @@ -6,10 +6,10 @@ @md5='fe011781f37f6b41fe08e0706969a89e' def install + system "./configure --prefix #{prefix}" + system "make world" # 'world' can be built in parallel, but the other targets have problems ENV.deparallelize - system "./configure --prefix #{prefix}" - system "make -j#{Hardware.processor_count} world" system "make opt" system "make opt.opt" system "make install"
Update OCaml recipe per spicyj suggestion.
diff --git a/models/rules_enum.rb b/models/rules_enum.rb index abc1234..def5678 100644 --- a/models/rules_enum.rb +++ b/models/rules_enum.rb @@ -9,5 +9,6 @@ GROUP_CREATE_GROUP = 'GROUP_CREATE_GROUP' GROUP_DELETE_GROUP = 'GROUP_DELETE_GROUP' + GROUP_MANAGE_GROUPS = 'GROUP_MANAGE_GROUPS' end
Create a new rule: GROUP_MANAGE_GROUPS.
diff --git a/ENVLicenseParser.podspec b/ENVLicenseParser.podspec index abc1234..def5678 100644 --- a/ENVLicenseParser.podspec +++ b/ENVLicenseParser.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "ENVLicenseParser" - s.version = "1.0.0" + s.version = "1.0.1" s.summary = "A parser for AAMVA license barcode formats" s.homepage = "https://github.com/envoy/ENVLicenseParser" s.license = "MIT" @@ -10,6 +10,6 @@ s.osx.deployment_target = "10.7" s.source = { :git => "https://github.com/envoy/ENVLicenseParser", :tag => "v#{ s.version }" } s.source_files = "ENVLicenseParser/*.{h,m}" - s.public_header_files = "ENVLicenseParser/ENVPerson.h", "ENVLicenseParser/ENVBaseLicenseParser.h" + s.public_header_files = "ENVLicenseParser/ENVPerson.h", "ENVLicenseParser/ENVBaseLicenseParser.h", "ENVLicenseParser/ENVLicenseParser.h", "ENVLicenseParser/ENVLicenseParserProtocol.h" s.requires_arc = true end
Add missing public header files
diff --git a/week-5/pgs2_2.rb b/week-5/pgs2_2.rb index abc1234..def5678 100644 --- a/week-5/pgs2_2.rb +++ b/week-5/pgs2_2.rb @@ -0,0 +1,13 @@+ items = "carrots apples cereal pizza" + +def groceries(items) + word_array = items.split(' ') + grocery_list = Hash.new + word_array.each do |item| + grocery_list[item] = 1 + end + # TODO: Update with print method #5 call + # This is just a todo. + + return grocery_list +end
Create GPS week 5 file
diff --git a/tools/snippet-testing/language_handler/curl_language_handler.rb b/tools/snippet-testing/language_handler/curl_language_handler.rb index abc1234..def5678 100644 --- a/tools/snippet-testing/language_handler/curl_language_handler.rb +++ b/tools/snippet-testing/language_handler/curl_language_handler.rb @@ -30,7 +30,11 @@ end def text_with_specific_replacements(file_content) - text_without_bash_symbol(file_content) + text_without_gt_lt_symbols(text_without_bash_symbol(file_content)) + end + + def text_without_gt_lt_symbols(file_content) + file_content.gsub(/[<>]{1}/, '') end def text_without_bash_symbol(file_content)
Remove lower and greater than symbols from curl snippets when testing
diff --git a/spec/controllers/ops_controller/settings/analysis_profiles_spec.rb b/spec/controllers/ops_controller/settings/analysis_profiles_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/ops_controller/settings/analysis_profiles_spec.rb +++ b/spec/controllers/ops_controller/settings/analysis_profiles_spec.rb @@ -14,4 +14,31 @@ end end end + + describe '#ap_edit' do + context 'adding a new Analysis Profile' do + let(:desc) { 'Description1' } + let(:edit) do + {:scan_id => nil, + :key => 'ap_edit__new', + :new => {:name => 'Name1', + :description => desc, + "file" => {:definition => {"stats" => [{}]}}}} + end + + before do + allow(controller).to receive(:assert_privileges) + allow(controller).to receive(:ap_set_record_vars_set).and_call_original + allow(controller).to receive(:get_node_info) + allow(controller).to receive(:replace_right_cell) + allow(controller).to receive(:session).and_return(:edit => edit) + controller.instance_variable_set(:@_params, :button => 'add') + end + + it 'sets the flash message for adding a new Analysis Profile properly' do + expect(controller).to receive(:add_flash).with("Analysis Profile \"#{desc}\" was saved") + controller.send(:ap_edit) + end + end + end end
Add spec test to check flash message for Analysis Profile to be created
diff --git a/db/migrate/20190518184430_add_published_version_to_gplan_nodes.rb b/db/migrate/20190518184430_add_published_version_to_gplan_nodes.rb index abc1234..def5678 100644 --- a/db/migrate/20190518184430_add_published_version_to_gplan_nodes.rb +++ b/db/migrate/20190518184430_add_published_version_to_gplan_nodes.rb @@ -0,0 +1,7 @@+# frozen_string_literal: true + +class AddPublishedVersionToGplanNodes < ActiveRecord::Migration[5.2] + def change + add_column :gplan_nodes, :published_version, :integer + end +end
Add migration to include a published_version column in gplan_nodes
diff --git a/veritrans.gemspec b/veritrans.gemspec index abc1234..def5678 100644 --- a/veritrans.gemspec +++ b/veritrans.gemspec @@ -13,7 +13,7 @@ s.test_files = [] s.require_paths = ["lib"] - #s.executables = ["veritrans"] + s.executables = ["veritrans"] #s.add_runtime_dependency "addressable" #s.add_runtime_dependency "faraday" s.add_runtime_dependency "excon", "~> 0.20"
Edit executable settings in gemfile
diff --git a/cookbooks/universe_ubuntu/recipes/default.rb b/cookbooks/universe_ubuntu/recipes/default.rb index abc1234..def5678 100644 --- a/cookbooks/universe_ubuntu/recipes/default.rb +++ b/cookbooks/universe_ubuntu/recipes/default.rb @@ -37,3 +37,9 @@ checksum '73b51715a12b6382dd4df3dd1905b531bd6792d4aa7273b2377a0436d45f0e78' notifies :run, 'execute[install_anaconda]', :immediately end + +execute 'install_anaconda' do + user 'vagrant' + command 'bash /tmp/Anaconda3-4.2.0-Linux-x86_64.sh -b' + not_if '[ -x /home/vagrant/anaconda3/bin/conda ]' +end
Install anaconda as vagrant user
diff --git a/app/decorators/controllers/forem/topics_controller_decorator.rb b/app/decorators/controllers/forem/topics_controller_decorator.rb index abc1234..def5678 100644 --- a/app/decorators/controllers/forem/topics_controller_decorator.rb +++ b/app/decorators/controllers/forem/topics_controller_decorator.rb @@ -1,5 +1,7 @@ Forem::TopicsController.class_eval do def show + @hide_footer_ad = true + if find_topic register_view
Hide footer advert in forum threads.
diff --git a/spec/features/groups/labels/subscription_spec.rb b/spec/features/groups/labels/subscription_spec.rb index abc1234..def5678 100644 --- a/spec/features/groups/labels/subscription_spec.rb +++ b/spec/features/groups/labels/subscription_spec.rb @@ -11,7 +11,7 @@ gitlab_sign_in user end - scenario 'users can subscribe/unsubscribe to labels', js: true do + scenario 'users can subscribe/unsubscribe to group labels', js: true do visit group_labels_path(group) expect(page).to have_content('feature')
Improve scenario description for the group labels subscription spec
diff --git a/spec/support/it_behaves_like_maps_json_fields.rb b/spec/support/it_behaves_like_maps_json_fields.rb index abc1234..def5678 100644 --- a/spec/support/it_behaves_like_maps_json_fields.rb +++ b/spec/support/it_behaves_like_maps_json_fields.rb @@ -1,12 +1,12 @@ shared_examples_for 'maps JSON fields' do |mapped_attributes| let!(:json_handler) { described_class.send(:json) } - describe described_class.send(:json) do + context "Handler" do subject { json_handler.new(json) } mapped_attributes.each do |from, to| it "maps #{from.inspect} to #{to.inspect}" do - expect(subject[to]).to eq(json[from]) + expect(subject[to]).to eq(subject[from]) end end end @@ -15,7 +15,7 @@ shared_examples_for 'ignores JSON fields' do |ignored_attributes| let!(:json_handler) { described_class.send(:json) } - describe described_class.send(:json) do + context "Handler" do ignored_attributes.each do |name| it "ignores #{name.inspect}" do expect(json_handler.new(json.merge(name => 'ignored'))).to_not have_key(name)
Fix described_class nesting changes in rspec described_class now returns the nested class, not the outer class. So we need to adjust our specs.
diff --git a/Rakefile.d/cucumber.rake b/Rakefile.d/cucumber.rake index abc1234..def5678 100644 --- a/Rakefile.d/cucumber.rake +++ b/Rakefile.d/cucumber.rake @@ -13,10 +13,11 @@ namespace :cucumber do task :setup do + current_gemfile = ENV['BUNDLE_GEMFILE'] Bundler.with_clean_env do gemfile = "cucumber_test_app/Gemfile" rm_rf "cucumber_test_app" - sh "bundle exec rails new cucumber_test_app --skip-spring --skip-javascript --skip-sprockets --skip-bootsnap" + sh "BUNDLE_GEMFILE=#{current_gemfile} bundle exec rails new cucumber_test_app --skip-spring --skip-javascript --skip-sprockets --skip-bootsnap" sh "echo 'gem \"cucumber-rails\", :require => false' >> #{gemfile}" sh "echo 'gem \"rspec-rails\", \"~>3.0\"' >> #{gemfile}" sh "echo 'gem \"pickle\", path: \"#{__dir__}/..\"' >> #{gemfile}"
Create rails app after passing BUNDLE_GEMFILE env var to the subshell
diff --git a/henson.gemspec b/henson.gemspec index abc1234..def5678 100644 --- a/henson.gemspec +++ b/henson.gemspec @@ -24,7 +24,7 @@ gem.add_dependency "thor", "~> 0.16.0" # development dependencies - gem.add_development_dependency "mocha", "~> 0.12.7" + gem.add_development_dependency "mocha", "~> 0.13.3" gem.add_development_dependency "rspec", "~> 2.11" gem.add_development_dependency "simplecov", "0.7.1" gem.add_development_dependency "rake"
Update mocha for ruby 2.x fixes
diff --git a/lib/generators/spree_return_requests/install/install_generator.rb b/lib/generators/spree_return_requests/install/install_generator.rb index abc1234..def5678 100644 --- a/lib/generators/spree_return_requests/install/install_generator.rb +++ b/lib/generators/spree_return_requests/install/install_generator.rb @@ -5,13 +5,13 @@ class_option :auto_run_migrations, :type => :boolean, :default => false def add_javascripts - append_file 'app/assets/javascripts/store/all.js', "//= require store/spree_return_requests\n" - append_file 'app/assets/javascripts/admin/all.js', "//= require admin/spree_return_requests\n" + append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require spree/frontend/spree_return_requests\n" + append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/spree_return_requests\n" end def add_stylesheets - inject_into_file 'app/assets/stylesheets/store/all.css', " *= require store/spree_return_requests\n", :before => /\*\//, :verbose => true - inject_into_file 'app/assets/stylesheets/admin/all.css', " *= require admin/spree_return_requests\n", :before => /\*\//, :verbose => true + inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/spree_return_requests\n", :before => /\*\//, :verbose => true + inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/spree_return_requests\n", :before => /\*\//, :verbose => true end def add_migrations
Update generator to work with Spree 2.2
diff --git a/test/fixtures/cookbooks/test/recipes/default.rb b/test/fixtures/cookbooks/test/recipes/default.rb index abc1234..def5678 100644 --- a/test/fixtures/cookbooks/test/recipes/default.rb +++ b/test/fixtures/cookbooks/test/recipes/default.rb @@ -1,4 +1,4 @@-apt_update 'update' if platform_family?('ubuntu') +apt_update 'update' if platform_family?('debian') include_recipe 'djbdns::server' include_recipe 'djbdns::cache'
Fix bad platform_family check in test Cookstyle fixed this Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/spec/changelog_spec.lint.rb b/spec/changelog_spec.lint.rb index abc1234..def5678 100644 --- a/spec/changelog_spec.lint.rb +++ b/spec/changelog_spec.lint.rb @@ -1,4 +1,4 @@-SimpleCov.command_name "lint" +SimpleCov.command_name "lint" if ENV["COVERAGE"] == true RSpec.describe "Changelog" do subject(:changelog) do
Fix crash when running specs without coverage
diff --git a/spec/features/basic_spec.rb b/spec/features/basic_spec.rb index abc1234..def5678 100644 --- a/spec/features/basic_spec.rb +++ b/spec/features/basic_spec.rb @@ -0,0 +1,60 @@+require 'spec_helper' +require 'json' +require "net/http" +require "uri" + +describe 'Basic tests of all public curricular Lab interactives', :sauce => true do + + LAB_URL = 'http://lab.concord.org/' + interactives_to_test = [] + + # Download interactives.json and populate interactives_to_test array. + uri = URI.parse(LAB_URL + 'interactives.json') + http = Net::HTTP.new(uri.host, uri.port) + request = Net::HTTP::Get.new(uri.request_uri) + + response = http.request(request) + + if response.code == '200' + result = JSON.parse(response.body) + # Test only 'public' interactives that belong to 'Curriculum' group. + group_key_allowed = {} + groups = result['groups'] + groups.each do |g| + if g['category'] == 'Curriculum' + group_key_allowed[g['path']] = true; + end + end + result['interactives'].each do |int| + if int['publicationStatus'] == 'public' and group_key_allowed[int['groupKey']] + interactives_to_test << int['path'] + end + end + else + puts LAB_URL + 'interactives.json cannot be found!' + end + + # Define actual tests. + interactives_to_test.each do |int_path| + it int_path do + visit LAB_URL + 'embeddable-dev.html#' + int_path + begin + # Capybara throws an exception if the element is not found + play_btn = find('.play-pause') + if play_btn.visible? + start_time = page.evaluate_script 'script.get("time");' + play_btn.click + sleep 0.5 + play_btn.click + end_time = page.evaluate_script 'script.get("time");' + # Additional check assuming that model has property 'time'. + expect(end_time).to be > start_time if start_time != nil + end + rescue Capybara::ElementNotFound + # No play button found, so the best we can get is the lack of JS errors + # or a screenshot on SauceLabs (assuming that we run tests there). + true + end + end + end +end
Add basic tests of all public curricular interactives [#67779220] It will load each interactive and run it for 0.5s if there is a 'play' button available.
diff --git a/pubsubhub.gemspec b/pubsubhub.gemspec index abc1234..def5678 100644 --- a/pubsubhub.gemspec +++ b/pubsubhub.gemspec @@ -20,6 +20,8 @@ spec.files = Dir['lib/**/*.rb'] spec.require_paths = ['lib'] + spec.required_ruby_version = '>= 2.0.0' + spec.add_development_dependency 'bundler', '~> 1.3' spec.add_development_dependency 'rake' end
Add dependency on Ruby 2.0.0 I'm about to import the PubSubHub files from the causes.git repo, and they effectively depend on Ruby 2.0.0 because they use 2.0.0 syntax. Make that dependency explicit in the gemspec. Change-Id: I9fb4711004b402eb8e5e1150a28e0382a410daad Reviewed-on: https://gerrit.causes.com/26272 Reviewed-by: Lann Martin <564fa7a717c51b612962ea128f146981a0e99d90@causes.com> Tested-by: Greg Hurrell <79e2475f81a6317276bf7cbb3958b20d289b78df@causes.com>
diff --git a/spec/models/article_spec.rb b/spec/models/article_spec.rb index abc1234..def5678 100644 --- a/spec/models/article_spec.rb +++ b/spec/models/article_spec.rb @@ -2,19 +2,20 @@ describe Article do let(:user) { User.create!(username: "sampleuser", permission_level: "author", password: "password") } - let(:article) { Article.new(orig_author: :user, title: "When Awesome Groups Make Awesome Apps") } + let(:article) { Article.new(orig_author: user, title: "When Awesome Groups Make Awesome Apps") } describe '#orig_author' do it 'must have an original author' do + p article.orig_author expect(article.orig_author).not_to be nil end it 'has a user as its original author' do - expect(article.orig_author).to_be_instance_of(User) + expect(article.orig_author).to be_instance_of User end it 'returns the user who authored the article' do - expect(article.orig_author).to eq(:user) + expect(article.orig_author).to eq(user) end end
Correct article specs (all passing)
diff --git a/spec/concurrent/set_spec.rb b/spec/concurrent/set_spec.rb index abc1234..def5678 100644 --- a/spec/concurrent/set_spec.rb +++ b/spec/concurrent/set_spec.rb @@ -2,6 +2,44 @@ module Concurrent RSpec.describe Set do let!(:set) { described_class.new } + + describe '.[]' do + describe 'when initializing with no arguments' do + it do + expect(described_class[]).to be_empty + end + end + + describe 'when initializing with arguments' do + it 'creates a set with the given objects' do + expect(described_class[:hello, :world]).to eq ::Set.new([:hello, :world]) + end + end + end + + describe '.new' do + describe 'when initializing with no arguments' do + it do + expect(described_class.new).to be_empty + end + end + + describe 'when initializing with an enumerable object' do + let(:enumerable_object) { [:hello, :world] } + + it 'creates a set with the contents of the enumerable object' do + expect(described_class.new(enumerable_object)).to eq ::Set.new([:hello, :world]) + end + + describe 'when initializing with a block argument' do + let(:block_argument) { proc { |value| :"#{value}_ruby" } } + + it 'creates a set with the contents of the enumerable object' do + expect(described_class.new(enumerable_object, &block_argument)).to eq ::Set.new([:hello_ruby, :world_ruby]) + end + end + end + end context 'concurrency' do it do
Add specs for Set initialization behavior
diff --git a/config/schedule.rb b/config/schedule.rb index abc1234..def5678 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -5,8 +5,6 @@ # We need Rake to use our own environment job_type :rake, "cd :path && govuk_setenv whitehall bundle exec rake :task --silent :output" -# We need Rails to use our own environment -job_type :runner, "cd :path && govuk_setenv whitehall script/rails runner -e :environment ':task' :output" # Run every SCHEDULED_PUBLISHING_PRECISION_IN_MINUTES minutes, 2 minutes before the due moment # this allows the the ruby process (and rails) time to boot up. The scheduler then sleeps until @@ -18,5 +16,5 @@ ## 14:45 is during our regular release slot, this may have to change ## post-April. 2am is our regular time for this. every :day, at: ['2am', '11:45am'], roles: [:admin] do - runner 'script/dump_all_admin_to_public_documents_and_non_documents.rb' + rake "export:redirector_mappings" end
Use export:redirector_mappings in the cron job This replaces the old and now removed script. Additionally clean up the now unused job_type.
diff --git a/spec/cli_spec.rb b/spec/cli_spec.rb index abc1234..def5678 100644 --- a/spec/cli_spec.rb +++ b/spec/cli_spec.rb @@ -14,9 +14,9 @@ after(:each) { Wright::CLI.send(:private, :parse) } it 'parses -e COMMAND' do - argv = %w[-e foo -e bar -- --baz] - @cli.parse(argv).must_equal %w[--baz] - @cli.send(:commands).must_equal %w[foo bar] + argv = %w(-e foo -e bar -- --baz) + @cli.parse(argv).must_equal %w(--baz) + @cli.send(:commands).must_equal %w(foo bar) end end
Fix rubocop warnings (%w[] array literals)
diff --git a/spec/support/fake_github.rb b/spec/support/fake_github.rb index abc1234..def5678 100644 --- a/spec/support/fake_github.rb +++ b/spec/support/fake_github.rb @@ -0,0 +1,35 @@+require 'sinatra/base' + +class FakeGitHub < Sinatra::Base + get '/user/repos' do + json_response 200, 'repos.json' + end + + get '/user/orgs' do + json_response 200, 'orgs.json' + end + + get '/orgs/:org/repos' do + json_response 200, 'org_repos.json' + end + + get '/repos/:owner/:repo/issues' do + json_response 200, 'repo_issues.json' + end + + get '/repos/testrepo/milestones' do + json_response 200, 'milestones.json' + end + + get '/issues' do + json_response 200, 'repo_issues.json' + end + + private + + def json_response(response_code, file_name) + content_type :json + status response_code + File.open(File.dirname(__FILE__) + '/fixtures/' + file_name, 'rb').read + end +end
Create a fake github service
diff --git a/spec/models/comment_spec.rb b/spec/models/comment_spec.rb index abc1234..def5678 100644 --- a/spec/models/comment_spec.rb +++ b/spec/models/comment_spec.rb @@ -1,5 +1,18 @@ require 'rails_helper' RSpec.describe Comment, type: :model do - pending "add some examples to (or delete) #{__FILE__}" + let(:question) { create(:question) } + let(:user) {create(:user, username: 'Tyaasdfasdf', email: 'ty@example.com')} + before do + allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(user) + end + + it { should belong_to(:user) } + + it { should belong_to(:response) } + + it 'throws an error if content is nil' do + comment = Comment.create(content: '') + expect(comment.errors).to_not be_nil + end end
Add tests for comment model
diff --git a/spec/models/product_spec.rb b/spec/models/product_spec.rb index abc1234..def5678 100644 --- a/spec/models/product_spec.rb +++ b/spec/models/product_spec.rb @@ -16,9 +16,9 @@ expect(product.categories.last.name).to eq('Travel Gear') end - it 'shows quantity sold' do - expect(product.sold).to eq(0) + it 'shows quantity sold per day' do + expect(product.sold[Date.today]).to eq(nil) Customer.last.orders.create.products << product - expect(product.sold).to eq(1) + expect(product.sold[Date.today]).to eq(1) end end
Revise product spec for quantity sold per day
diff --git a/lib/skywriter/resource_property/ec2/security_group_rule.rb b/lib/skywriter/resource_property/ec2/security_group_rule.rb index abc1234..def5678 100644 --- a/lib/skywriter/resource_property/ec2/security_group_rule.rb +++ b/lib/skywriter/resource_property/ec2/security_group_rule.rb @@ -6,6 +6,9 @@ property :ToPort property :IpProtocol property :CidrIp + property :SourceSecurityGroupId + property :SourceSecurityGroupOwnerId + property :DestinationSecurityGroupId end end end
Add missing properties to Security Group Rule resource property type
diff --git a/spec/percona/sm-tools_spec.rb b/spec/percona/sm-tools_spec.rb index abc1234..def5678 100644 --- a/spec/percona/sm-tools_spec.rb +++ b/spec/percona/sm-tools_spec.rb @@ -0,0 +1,19 @@+require 'spec_helper' + +# sm-list-dbs + +describe command('sm-list-dbs mysql') do + its(:exit_status) { should eq 0 } +end + +describe command('sm-list-dbs') do + its(:exit_status) { should eq 2 } + its(:stderr) { should match /Usage: \/opt\/local\/bin\/sm-list-dbs [options] TYPE/ } +end + +describe command('sm-list-dbs mysql') do + its(:stdout) { should match /information_schema/ } + its(:stdout) { should match /mysql/ } + its(:stdout) { should match /mysql/ } + its(:stdout) { should match /performance_schema/ } +end
Add test for sm-tools: sm-list-dbs
diff --git a/Casks/virtualbox-extension-pack.rb b/Casks/virtualbox-extension-pack.rb index abc1234..def5678 100644 --- a/Casks/virtualbox-extension-pack.rb +++ b/Casks/virtualbox-extension-pack.rb @@ -0,0 +1,24 @@+cask :v1 => 'virtualbox-extension-pack' do + version '5.0.0-101573' + sha256 'c357e36368883df821ed092d261890a95c75e50422b75848c40ad20984086a7a' + + url "http://download.virtualbox.org/virtualbox/#{version.sub(%r{-.*},'')}/Oracle_VM_VirtualBox_Extension_Pack-#{version}.vbox-extpack" + name 'VirtualBox Extension Pack' + homepage 'https://www.virtualbox.org' + license :closed + tags :vendor => 'Oracle' + + stage_only true + + container :type => :naked + + postflight do + system 'sudo', 'VBoxManage', 'extpack', 'install', '--replace', "#{staged_path}/Oracle_VM_VirtualBox_Extension_Pack-#{version}.vbox-extpack" + end + + uninstall_postflight do + system 'sudo', 'VBoxManage', 'extpack', 'uninstall', 'Oracle VM VirtualBox Extension Pack' + end + + depends_on :cask => 'virtualbox' +end
Add VirtualBox Extension Pack v5.0.0-101573 installs and uninstalls using VBoxManage (part of VirtualBox)
diff --git a/Casks/gopanda.rb b/Casks/gopanda.rb index abc1234..def5678 100644 --- a/Casks/gopanda.rb +++ b/Casks/gopanda.rb @@ -0,0 +1,7 @@+class Gopanda < Cask + url 'http://pandanet-igs.com/gopanda2/installer/stable/mac-32/gopanda2-mac-32.zip' + homepage 'http://pandanet-igs.com/communities/gopanda2' + version 'latest' + no_checksum + link 'GoPanda2.app' +end
Add Go Panda (Client for Pandanet - The Internet Go Server)
diff --git a/Casks/airdroid.rb b/Casks/airdroid.rb index abc1234..def5678 100644 --- a/Casks/airdroid.rb +++ b/Casks/airdroid.rb @@ -4,7 +4,7 @@ url "http://dl.airdroid.com/AirDroid_Desktop_Client_#{version}.dmg" name 'AirDroid' - homepage 'http://airdroid.com' + homepage 'https://www.airdroid.com/' license :closed app 'AirDroid.app'
Fix homepage to use SSL in AirDroid 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/Sqwiggle.podspec b/Sqwiggle.podspec index abc1234..def5678 100644 --- a/Sqwiggle.podspec +++ b/Sqwiggle.podspec @@ -12,7 +12,7 @@ s.public_header_files = "iOSSDK/*.h" s.source_files = "iOSSDK/*.{h,m}" - s.dependency 'AFNetworking', "~> 2.0.3" + s.dependency 'AFNetworking', "~> 2.3.1" s.dependency "ObjectiveSugar", '~> 0.9' s.prefix_header_contents = '#import <ObjectiveSugar/ObjectiveSugar.h>', '#import <AFNetworking/AFNetworking.h>'
Update podspec to use AFNetworking 2.3.1
diff --git a/ceo.gemspec b/ceo.gemspec index abc1234..def5678 100644 --- a/ceo.gemspec +++ b/ceo.gemspec @@ -8,8 +8,8 @@ s.name = "ceo" s.version = CEO::VERSION.dup s.authors = ['Jesse Herrick'] - s.email = ['me@jesse.codes'] - s.homepage = "TODO" + s.email = ['jesse@littlelines.com'] + s.homepage = 'https://github.com/littlelines/ceo' s.summary = 'An admin tool that puts object oriented design over DSLs.' s.description = 'A useful admin tool that gets out of your way' s.license = 'MIT'
Update gemspec with homepage and diff. email
diff --git a/poltergeist-suppressor.gemspec b/poltergeist-suppressor.gemspec index abc1234..def5678 100644 --- a/poltergeist-suppressor.gemspec +++ b/poltergeist-suppressor.gemspec @@ -8,8 +8,8 @@ spec.version = Poltergeist::Suppressor::VERSION spec.authors = ["Kazato Sugimoto"] spec.email = ["uiureo@gmail.com"] - spec.description = %q{TODO: Write a gem description} - spec.summary = %q{TODO: Write a gem summary} + spec.description = %q{A noisy warnings suppressor for poltergeist.} + spec.summary = %q{A noisy warnings suppressor for poltergeist.} spec.homepage = "" spec.license = "MIT"
Add a description to gemspec
diff --git a/app/helpers/sufia/blacklight_override.rb b/app/helpers/sufia/blacklight_override.rb index abc1234..def5678 100644 --- a/app/helpers/sufia/blacklight_override.rb +++ b/app/helpers/sufia/blacklight_override.rb @@ -1,25 +1,5 @@ module Sufia module BlacklightOverride - # TODO: we can remove this override when we can depend on https://github.com/projecthydra-labs/curation_concerns/pull/711 - def render_constraints_query(localized_params = params) - # So simple don't need a view template, we can just do it here. - return "".html_safe if localized_params[:q].blank? - - render_constraint_element(constraint_query_label(localized_params), - localized_params[:q], - classes: ["query"], - remove: remove_constraint_url(localized_params)) - end - - # TODO: we can remove this override when we can depend on https://github.com/projecthydra-labs/curation_concerns/pull/711 - def remove_constraint_url(localized_params) - scope = localized_params.delete(:route_set) || self - options = localized_params.merge(q: nil, action: 'index') - .except(*fields_to_exclude_from_constraint_element) - options.permit! - scope.url_for(options) - end - # This overrides curation_concerns so we aren't removing any fields. # @return [Array<Symbol>] a list of fields to remove on the render_constraint_element # You can override this if you have different fields to remove
Remove methods that moved to curation_concerns
diff --git a/Formula/jython.rb b/Formula/jython.rb index abc1234..def5678 100644 --- a/Formula/jython.rb +++ b/Formula/jython.rb @@ -3,10 +3,16 @@ class Jython <Formula url "http://downloads.sourceforge.net/project/jython/jython/2.5.1/jython_installer-2.5.1.jar", :using => :nounzip - md5 '2ee978eff4306b23753b3fe9d7af5b37' homepage 'http://www.jython.org' - head "http://downloads.sourceforge.net/project/jython/jython-dev/2.5.2b2/jython_installer-2.5.2b2.jar", + + head "http://downloads.sourceforge.net/project/jython/jython-dev/2.5.2rc3/jython_installer-2.5.2rc3.jar", :using => :nounzip + + if ARGV.build_head? + sha1 '547c424a119661ed1901079ff8f4e45af7d57b56' + else + md5 '2ee978eff4306b23753b3fe9d7af5b37' + end def install system "java", "-jar", Pathname.new(@url).basename, "-s", "-d", libexec
Update Jython HEAD to 2.5.2rc3
diff --git a/example/free_guest.rb b/example/free_guest.rb index abc1234..def5678 100644 --- a/example/free_guest.rb +++ b/example/free_guest.rb @@ -0,0 +1,39 @@+require 'noam-lemma' + +# This is an example of a Ruby Lemma that publishes message and *also* uses the +# "Guest" model of connection. This Lemma will advertise that it's available on +# the local network and only begin playing messages once a server requests a +# connection from the Lemma. + +publisher = Noam::Lemma.new( + 'example-publisher', + 'ruby-script', + 9000, + [], + ["e3"]) + +# Using the `advertise` method asks the Lemma to announce it's presence and +# wait for a message from a server that may want to connect to it. +# +# The "local-test" parameter is the room name. Servers with a room name that's +# the same as the Lemma's advertised room name will connect automatically. +publisher.advertise("local-test") + +seq = 0 +e = "e3" +loop do + # Construct a value to send with the event. + v = {"seq" => seq, "time" => Time.now.to_s} + + # If `play` returns false, we're unable to play the message likely because + # the socket has closed. The connection would have to be restarted. + unless publisher.play(e, v) + puts "Done" + break + end + puts "Wrote: #{e} -> #{v.inspect}" + + seq += 1 + # Sleep for a while so that we don't bog down the network. + sleep(1) +end
Add an example of a free guest.
diff --git a/add-vault-tokens.gemspec b/add-vault-tokens.gemspec index abc1234..def5678 100644 --- a/add-vault-tokens.gemspec +++ b/add-vault-tokens.gemspec @@ -19,7 +19,7 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_dependency "vault" + spec.add_dependency "vault", "~> 0.2.0" spec.add_development_dependency "bundler", "~> 1.10" spec.add_development_dependency "rake", "~> 10.0"
Upgrade to vault client 0.2.0 This is the latest version, so we might as well use it.
diff --git a/plugins/networking/app/models/networking/security_group.rb b/plugins/networking/app/models/networking/security_group.rb index abc1234..def5678 100644 --- a/plugins/networking/app/models/networking/security_group.rb +++ b/plugins/networking/app/models/networking/security_group.rb @@ -2,7 +2,7 @@ module Networking # Represents the Openstack Security Group - class SecurityGroup < Core::ServiceLayer::Model + class SecurityGroup < Core::ServiceLayerNg::Model validates :name, presence: true def rule_objects
Fix wrong base model class for SecurityGroup
diff --git a/tests/functional/get_tests.rb b/tests/functional/get_tests.rb index abc1234..def5678 100644 --- a/tests/functional/get_tests.rb +++ b/tests/functional/get_tests.rb @@ -32,7 +32,7 @@ def test_static_jpg assert_same_static '/small.gif' - assert_same_static '/small.jpg' + assert_same_static '/large.jpg' end def test_dynamic @@ -41,10 +41,10 @@ end def assert_same_static path, filename=nil - filename ||= "/test/static/#{path}" + filename ||= "tests/static#{path}" response = @http.get(path) assert_equal "200", response.code - assert_equal File.open(filename), response.body + assert_equal File.binread(filename), response.body end def assert_same_dynamic path, expected
Use correct method to read binary file in Ruby.
diff --git a/lib/event_girl_client.rb b/lib/event_girl_client.rb index abc1234..def5678 100644 --- a/lib/event_girl_client.rb +++ b/lib/event_girl_client.rb @@ -11,8 +11,8 @@ attr_reader :api_token, :url def initialize(url, api_token) - @url = url - @api_token = api_token + @url = url.to_s + @api_token = api_token.to_s end def send_event(title)
Make url and api_token nil-safe
diff --git a/db/migrate/20091002164750_make_documents_title_and_subtitle_text.rb b/db/migrate/20091002164750_make_documents_title_and_subtitle_text.rb index abc1234..def5678 100644 --- a/db/migrate/20091002164750_make_documents_title_and_subtitle_text.rb +++ b/db/migrate/20091002164750_make_documents_title_and_subtitle_text.rb @@ -0,0 +1,10 @@+class MakeDocumentsTitleAndSubtitleText < ActiveRecord::Migration + def self.up + change_column :documents, :title, :text + change_column :documents, :subtitle, :text + end + + def self.down + raise ActiveRecord::IrreversibleMigration + end +end
Add migration to convert title and subtitle to "text" fields from varchar(255).
diff --git a/lib/henson/source/git.rb b/lib/henson/source/git.rb index abc1234..def5678 100644 --- a/lib/henson/source/git.rb +++ b/lib/henson/source/git.rb @@ -7,6 +7,20 @@ @name = name @repo = repo @options = opts + + if branch = @options.fetch(:branch, nil) + @target_revision = branch + @ref_type = :branch + elsif tag = @options.fetch(:tag, nil) + @target_revision = tag + @ref_type = :tag + elsif sha = @options.fetch(:sha, nil) + @target_revision = sha + @ref_type = :sha + else + @target_revision = 'master' + @ref_type = :branch + end end def fetched? @@ -48,16 +62,12 @@ end def target_revision - @target_revision ||= if branch = options.delete(:branch) - branch - elsif tag = options.delete(:tag) - tag - elsif ref = options.delete(:ref) - ref - else - 'master' - end + @target_revision + end + + def ref_type + @ref_type end end end -end+end
Store the ref type for internal use
diff --git a/lib/mako/view_helpers.rb b/lib/mako/view_helpers.rb index abc1234..def5678 100644 --- a/lib/mako/view_helpers.rb +++ b/lib/mako/view_helpers.rb @@ -12,6 +12,6 @@ # # @return [String] def last_updated - Time.now.strftime('%m %b %Y %H:%M:%S') + Time.now.strftime('%d %b %Y %H:%M:%S') end end
Fix bug where last_updated returned wrong date
diff --git a/feathericon-sass.gemspec b/feathericon-sass.gemspec index abc1234..def5678 100644 --- a/feathericon-sass.gemspec +++ b/feathericon-sass.gemspec @@ -16,6 +16,6 @@ s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] - s.add_runtime_dependency 'sass', '>= 3.2' - s.add_development_dependency 'sass-rails' + s.add_runtime_dependency 'sassc', '>= 2.0' + s.add_development_dependency 'sassc-rails' end
Replace eol ruby-sass to sassc
diff --git a/exe/build_database.rb b/exe/build_database.rb index abc1234..def5678 100644 --- a/exe/build_database.rb +++ b/exe/build_database.rb @@ -0,0 +1,18 @@+#!/usr/bin/env ruby -I lib + +require 'bundler' +Bundler.require(:default) + +require_relative '../lib/flickr_to_google_photos' + +flickr = FlickrToGooglePhotos::Flickr.new(ENV['FLICKR_CONSUMER_KEY'], + ENV['FLICKR_CONSUMER_SECRET'], + ENV['FLICKR_ACCESS_TOKEN'], + ENV['FLICKR_ACCESS_TOKEN_SECRET']) +albums = flickr.each_albums +albums.map(&:save) +albums.each do |album| + flickr.each_photos_by_album(album).map(&:save) +end + +flickr.each_photos_not_in_set.map(&:save)
Add script to biuld database
diff --git a/Casks/font-anonymous-pro.rb b/Casks/font-anonymous-pro.rb index abc1234..def5678 100644 --- a/Casks/font-anonymous-pro.rb +++ b/Casks/font-anonymous-pro.rb @@ -2,7 +2,7 @@ url 'http://www.marksimonson.com/assets/content/fonts/AnonymousPro-1.002.zip' homepage 'http://www.marksimonson.com/fonts/view/anonymous-pro' version '1.002' - sha1 '87651de93312fdd3f27e50741d2a0630a41ec30d' + sha256 '86665847a51cdfb58a1e1dfd8b1ba33f183485affe50b53e3304f63d3d3552ab' font 'AnonymousPro-1.002.001/Anonymous Pro B.ttf' font 'AnonymousPro-1.002.001/Anonymous Pro BI.ttf' font 'AnonymousPro-1.002.001/Anonymous Pro I.ttf'
Update Anonymous Pro to sha256 checksums
diff --git a/rb/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb b/rb/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb index abc1234..def5678 100644 --- a/rb/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb +++ b/rb/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb @@ -21,7 +21,8 @@ # driver = Selenium::WebDriver.for :remote # driver.file_detector = lambda do |args| # # args => ["/path/to/file"] - # str if File.exist?(args.first.to_s) + # str = args.first.to_s + # str if File.exist?(str) # end # # driver.find_element(:id => "upload").send_keys "/path/to/file"
JariBakken: Fix error in the file_detector example. r15466
diff --git a/Casks/datagrip.rb b/Casks/datagrip.rb index abc1234..def5678 100644 --- a/Casks/datagrip.rb +++ b/Casks/datagrip.rb @@ -0,0 +1,11 @@+cask :v1 => 'datagrip' do + version '1.0' + sha256 '32640fd394c57b4c5625e254971d423e84b3e39c0dede63cad17620be52ca155' + + url "https://download.jetbrains.com/datagrip/datagrip-#{version}-custom-jdk-bundled.dmg" + name 'DataGrip' + homepage 'https://www.jetbrains.com/datagrip/' + license :commercial + + app 'DataGrip.app' +end
Add cask for first stable release of DataGrip
diff --git a/spec/integration/mapping_relations_spec.rb b/spec/integration/mapping_relations_spec.rb index abc1234..def5678 100644 --- a/spec/integration/mapping_relations_spec.rb +++ b/spec/integration/mapping_relations_spec.rb @@ -0,0 +1,35 @@+# encoding: utf-8 + +require 'spec_helper' + +describe 'Mapping relations' do + let!(:env) { Environment.coerce(:test => 'memory://test') } + let!(:model) { mock_model(:id, :name) } + + specify 'I can define a relation and its mapping' do + schema = Schema.build do + base_relation :users do + repository :test + + attribute :id, Integer + attribute :user_name, String + + key :id + end + end + + env.load_schema(schema) + + # TODO: replace that with mapper DSL once ready + header = Mapper::Header.coerce(schema[:users].header, map: { user_name: :name }) + mapper = Mapper.build(header, model) + + users = Relation.build(env.repository(:test).get(:users), mapper) + + jane = model.new(id: 1, name: 'Jane') + + users.insert(jane) + + expect(users.to_a).to eql([jane]) + end +end
Add integration spec showing relation mapping
diff --git a/spec/lib/disable_email_interceptor_spec.rb b/spec/lib/disable_email_interceptor_spec.rb index abc1234..def5678 100644 --- a/spec/lib/disable_email_interceptor_spec.rb +++ b/spec/lib/disable_email_interceptor_spec.rb @@ -13,6 +13,9 @@ end after do + # Removing interceptor from the list because unregister_interceptor is + # implemented in later version of mail gem + # See: https://github.com/mikel/mail/pull/705 Mail.class_variable_set(:@@delivery_interceptors, []) end
Add a comment in interceptor spec.
diff --git a/DeallocationChecker.podspec b/DeallocationChecker.podspec index abc1234..def5678 100644 --- a/DeallocationChecker.podspec +++ b/DeallocationChecker.podspec @@ -12,8 +12,6 @@ s.author = { "Arkadiusz Holko" => "fastred@fastred.org" } s.social_media_url = "" s.ios.deployment_target = "8.0" - s.osx.deployment_target = "10.9" - s.watchos.deployment_target = "2.0" s.tvos.deployment_target = "9.0" s.source = { :git => "https://github.com/fastred/DeallocationChecker.git", :tag => s.version.to_s } s.source_files = "Sources/**/*"
Remove macOS and watchOS platforms from podspec
diff --git a/evertrue_app_assets.gemspec b/evertrue_app_assets.gemspec index abc1234..def5678 100644 --- a/evertrue_app_assets.gemspec +++ b/evertrue_app_assets.gemspec @@ -11,4 +11,11 @@ s.add_dependency 'itunes-search-api', '~> 0' s.add_dependency 'httparty', '~> 0.10', '>= 0.10.0' + + # General + s.add_development_dependency 'bundler', '~> 1.5', '>= 1.5.1' + s.add_development_dependency 'rake', '~> 10.1', '>= 10.1.1' + + # Release + s.add_development_dependency 'fury', '~> 0.0', '>= 0.0.5' end
Add Bundler, Rake, & Fury as dev gems to Gemspec Ensures we have all the tools we need to build & ship a release
diff --git a/config/initializers/cve_2015_3226_fix.rb b/config/initializers/cve_2015_3226_fix.rb index abc1234..def5678 100644 --- a/config/initializers/cve_2015_3226_fix.rb +++ b/config/initializers/cve_2015_3226_fix.rb @@ -0,0 +1,13 @@+raise "Check monkey patch for CVE-2015-3226 is still needed" unless Rails::VERSION::STRING == '3.2.22' +module ActiveSupport + module JSON + module Encoding + private + class EscapedString + def to_s + self + end + end + end + end +end
Patch Rails security issue not fixed in a 3.2.x
diff --git a/config/initializers/non_digest_assets.rb b/config/initializers/non_digest_assets.rb index abc1234..def5678 100644 --- a/config/initializers/non_digest_assets.rb +++ b/config/initializers/non_digest_assets.rb @@ -1,6 +1,6 @@ NonStupidDigestAssets.whitelist += [ - "logo.gif", - "logo-small.gif", + /logo\..*$/, + /logo-small.*/, "inat-logo-pb.png", /spritesheet/, /\.xsl$/,
Allow more assets without digests.
diff --git a/app/mailers/invitations_mailer.rb b/app/mailers/invitations_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/invitations_mailer.rb +++ b/app/mailers/invitations_mailer.rb @@ -5,8 +5,9 @@ @event_dates = event_dates @event_venue = event_venue @days_to_confirm = Setting.get.days_to_confirm_invitation + @contact_email = contact_email + mail(to: email, subject: 'Confirm your Rails Girls Kraków 2017 participation!') - @contact_email = contact_email end def reminder_email(submission, event_dates, event_venue, contact_email) @@ -14,7 +15,8 @@ @token = submission.invitation_token @event_dates = event_dates @event_venue = event_venue + @contact_email = contact_email + mail(to: email, subject: 'Your invitation link expires soon!') - @contact_email = contact_email end end
[168] Fix showing contact_mail in mails
diff --git a/app/controllers/index.rb b/app/controllers/index.rb index abc1234..def5678 100644 --- a/app/controllers/index.rb +++ b/app/controllers/index.rb @@ -15,9 +15,13 @@ access_token = client.auth_code.get_token(params[:code], :redirect_uri => 'http://localhost:9393/callback') response = access_token.get('https://www.googleapis.com/oauth2/v1/userinfo?alt=json') - puts "START" - puts '*' * 40 - p user_info = JSON.parse(response.body) - #=> user_info is {"id"=>"108553686725590595849", "email"=>"nzeplowitz@gmail.com", "verified_email"=>true, "name"=>"Nathan Zeplowitz", "given_name"=>"Nathan", "family_name"=>"Zeplowitz", "link"=>"https://plus.google.com/108553686725590595849", "picture"=>"https://lh6.googleusercontent.com/-ljNCYRCxZ0g/AAAAAAAAAAI/AAAAAAAAAuk/r6hMRgwCzD0/photo.jpg", "gender"=>"male"} - redirect "/#{session[:current_user]}" -end+ + user_info = JSON.parse(response.body) + p response.inspect + puts access_token.inspect + puts user_info + @user = User.find_or_create_by(email: user_info["email"], name: user_info["name"], picture: user_info["picture"] ) + session[:current_user] = @user.id + + redirect "/users/#{session[:current_user]}" +end
Delete Tests and Fix Up Login Routes
diff --git a/app/models/sidekiq/monitor/job.rb b/app/models/sidekiq/monitor/job.rb index abc1234..def5678 100644 --- a/app/models/sidekiq/monitor/job.rb +++ b/app/models/sidekiq/monitor/job.rb @@ -6,6 +6,8 @@ serialize :args serialize :result + after_destroy :destroy_in_queue + STATUSES = [ 'queued', 'running', @@ -13,11 +15,19 @@ 'failed' ] - def self.destroy_by_queue(queue_name, conditions={}) - jobs = where(conditions).where(status: 'queued', queue: queue_name).destroy_all + def destroy_in_queue + return true unless status == 'queued' + sidekiq_queue = Sidekiq::Queue.new(queue) + sidekiq_queue.each do |job| + return job.delete if job.jid == jid + end + end + + def self.destroy_by_queue(queue, conditions={}) + jobs = where(conditions).where(status: 'queued', queue: queue).destroy_all jids = jobs.map(&:jid) - queue = Sidekiq::Queue.new(queue_name) - queue.each do |job| + sidekiq_queue = Sidekiq::Queue.new(queue) + sidekiq_queue.each do |job| job.delete if conditions.blank? || jids.include?(job.jid) end jobs
Destroy the corresponding Sidekiq::Job when a Sidekiq::Monitor::Job is destroyed
diff --git a/tco_method.gemspec b/tco_method.gemspec index abc1234..def5678 100644 --- a/tco_method.gemspec +++ b/tco_method.gemspec @@ -8,8 +8,8 @@ spec.version = TCOMethod::VERSION spec.authors = ["Danny Guinther"] spec.email = ["dannyguinther@gmail.com"] - spec.summary = %q{Simplifies creating tail call optimized procs/lambdas/methods in Ruby.} - spec.description = %q{Simplifies creating tail call optimized procs/lambdas/methods in Ruby.} + spec.summary = %q{Simplifies compiling code with tail call optimization in MRI Ruby.} + spec.description = %q{Simplifies compiling code with tail call optimization in MRI Ruby.} spec.homepage = "https://github.com/tdg5/tco_method" spec.license = "MIT"
Fix gemspec summary and description
diff --git a/jquery-qtip2-rails.gemspec b/jquery-qtip2-rails.gemspec index abc1234..def5678 100644 --- a/jquery-qtip2-rails.gemspec +++ b/jquery-qtip2-rails.gemspec @@ -8,14 +8,14 @@ gem.summary = %q{qTip2 packaged for the Rails 3.1+ asset pipeline} gem.homepage = "http://github.com/tkrotoff/jquery-qtip2-rails/" - gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } - gem.files = `git ls-files`.split("\n") - gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") + gem.files = `git ls-files`.split($\) + gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } + gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.name = "jquery-qtip2-rails" gem.require_paths = ["lib"] gem.version = Jquery::Qtip2::Rails::VERSION - gem.add_dependency "railties", ">= 3.1.0" + gem.add_dependency 'railties', '>= 3.1.0' gem.add_development_dependency 'rails' gem.add_development_dependency 'jquery-rails'
Update gemspec file Using Bundler version 1.1.5
diff --git a/app/controllers/songs.rb b/app/controllers/songs.rb index abc1234..def5678 100644 --- a/app/controllers/songs.rb +++ b/app/controllers/songs.rb @@ -7,6 +7,10 @@ 'show single song' end -put '/songs/:id/edit' do +put '/songs/:id' do + 'edit single song' +end +delete 'songs/:id' do + 'delete single song' end
Create DELETE route for single song
diff --git a/spec/aoede/attributes/base_spec.rb b/spec/aoede/attributes/base_spec.rb index abc1234..def5678 100644 --- a/spec/aoede/attributes/base_spec.rb +++ b/spec/aoede/attributes/base_spec.rb @@ -0,0 +1,35 @@+require 'spec_helper' + +describe Aoede::Attributes::Base do + let(:filename) { File.expand_path('Test - Track.wav', 'spec/support/') } + let(:track) { Aoede::Track.new(filename) } + + describe :ClassMethods do + + describe :included do + + it "defines attribute getters on the receiving object" do + Aoede::Attributes::Base::ATTRIBUTES.each do |method| + expect(track).to respond_to(method) + end + end + + it "defines attribute setters on the receiving object" do + Aoede::Attributes::Base::ATTRIBUTES.each do |method| + expect(track).to respond_to("#{method}=") + end + end + end + end + + describe :InstanceMethods do + + describe :attributes do + pending + end + + describe :audio_properties do + pending + end + end +end
Add base spec for Attributes::Base
diff --git a/spec/support/search_spec_helper.rb b/spec/support/search_spec_helper.rb index abc1234..def5678 100644 --- a/spec/support/search_spec_helper.rb +++ b/spec/support/search_spec_helper.rb @@ -15,7 +15,8 @@ settings: described_class.tire.settings } - index.create(opts) or raise "unable to create index for #{described_class}\n#{opts.inspect}" + ok = index.create(opts) + ok or raise "unable to create index for #{described_class}: #{index.response.body}" end def results_for(query)
Improve error message when index creation fails.
diff --git a/lib/analytical/modules/google_tag_manager.rb b/lib/analytical/modules/google_tag_manager.rb index abc1234..def5678 100644 --- a/lib/analytical/modules/google_tag_manager.rb +++ b/lib/analytical/modules/google_tag_manager.rb @@ -0,0 +1,40 @@+module Analytical + module Modules + class GoogleTagManager + include Analytical::Modules::Base + + def initialize(options={}) + super + @tracking_command_location = :body_prepend + end + + def init_javascript(location) + init_location(location) do + js = <<-HTML.gsub(/^ {10}/, '') + <!-- Google Tag Manager --> + <noscript><iframe src="//www.googletagmanager.com/ns.html?id=#{options[:key]}" + height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> + <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': + new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], + j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= + '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); + })(window,document,'script','gtmDataLayer','#{options[:key]}');</script> + <!-- End Google Tag Manager --> + HTML + js + end + end + + def event(*args) # name, options, callback + <<-JS.gsub(/^ {10}/, '') + var gtmVariables = {}; + for (var k in options) { + gtmVariables[k] = options[k]; + } + gtmVariables.event = name; + gtmDataLayer.push(gtmVariables); + JS + end + end + end +end
Add Google Tag Manager module
diff --git a/ext/did_you_mean/extconf.rb b/ext/did_you_mean/extconf.rb index abc1234..def5678 100644 --- a/ext/did_you_mean/extconf.rb +++ b/ext/did_you_mean/extconf.rb @@ -1,10 +1,10 @@ require 'mkmf' case RUBY_VERSION -when /1.9.3/, /2.0.0/, /2.1.0/, /2.1.1/, /2.2.0/ +when /1.9.3/, /2.0.0/, /^2.1.\d/, /2.2.0/ abs_ruby_header_path = File.join(File.dirname(File.realpath(__FILE__)), "ruby_headers") - version_suffix = if RUBY_VERSION == "2.1.1" + version_suffix = if /^2.1.\d/ =~ RUBY_VERSION "210" else RUBY_VERSION.tr(".", "")
Add support for Ruby 2.1.2
diff --git a/test/integration/default/serverspec/localhost/cron_spec.rb b/test/integration/default/serverspec/localhost/cron_spec.rb index abc1234..def5678 100644 --- a/test/integration/default/serverspec/localhost/cron_spec.rb +++ b/test/integration/default/serverspec/localhost/cron_spec.rb @@ -27,3 +27,13 @@ it { should be_installed } end end + +if os[:family] == 'freebsd' + describe file('/etc/crontab') do + its(:content) { should match /\* \* \* \* \* appuser \/bin\/true/ } + end +else + describe file('/etc/cron.d/nil_value_check') do + its(:content) { should match /\* \* \* \* \* appuser \/bin\/true/ } + end +end
Add serverspec for the LWRP
diff --git a/app/settings/settings.rb b/app/settings/settings.rb index abc1234..def5678 100644 --- a/app/settings/settings.rb +++ b/app/settings/settings.rb @@ -1,26 +1,26 @@ require 'yaml' module Settings - extend self - + class << self @_settings = {} - def load - @_settings = YAML.load_file("#{Rails.root}/config/settings.yml") - end + def load + @_settings = YAML.load_file("#{Rails.root}/config/settings.yml") + end - def get(key) - @_settings[key.to_s] - end + def get(key) + @_settings[key.to_s] + end - def set(key, value) - @_settings[key.to_s] = value - write - end + def set(key, value) + @_settings[key.to_s] = value + write + end - def write - File.open("#{Rails.root}/config/settings.yml", 'w+') do |f| - f.write(YAML.dump(@_settings)) + def write + File.open("#{Rails.root}/config/settings.yml", 'w+') do |f| + f.write(YAML.dump(@_settings)) + end end end
Modify Settings as class singleton
diff --git a/lib/spree/hub/handler/add_product_handler.rb b/lib/spree/hub/handler/add_product_handler.rb index abc1234..def5678 100644 --- a/lib/spree/hub/handler/add_product_handler.rb +++ b/lib/spree/hub/handler/add_product_handler.rb @@ -43,10 +43,12 @@ private def set_up_shipping_category - if shipping_category = params.delete(:shipping_category) - id = ShippingCategory.find_or_create_by(name: shipping_category).id - params[:shipping_category_id] = id - end + id = ShippingCategory.find_or_create_by(name: shipping_category).id + params[:shipping_category_id] = id + end + + def shipping_category + params.delete(:shipping_category) || parameters["spree_shipping_category"] || "Default" end end end
Add defaults to product shipping_category
diff --git a/app/controllers/index.rb b/app/controllers/index.rb index abc1234..def5678 100644 --- a/app/controllers/index.rb +++ b/app/controllers/index.rb @@ -1,7 +1,7 @@ get '/' do - redirect '/homepage' + erb :'homepage/index' end -get '/homepage' do - erb :'homepage/index' +get '/dashboard' do + erb :'/dashboard' end
Change homepage route to '/' and create get dashboard route
diff --git a/0_code_wars/7_caffeine_buzz.rb b/0_code_wars/7_caffeine_buzz.rb index abc1234..def5678 100644 --- a/0_code_wars/7_caffeine_buzz.rb +++ b/0_code_wars/7_caffeine_buzz.rb @@ -0,0 +1,19 @@+# http://www.codewars.com/kata/5434283682b0fdb0420000e6/ +# iteration 1 +def caffeineBuzz(n) + if n % 3 == 0 && n % 4 == 0 + str = "Coffee" + elsif n % 3 == 0 + str = "Java" + end + return "mocha_missing!" unless str + n.even? ? str << "Script" : str +end + +# iteration 2 +def caffeineBuzz(n) + str = "Coffee" if n % 12 == 0 + str ||= "Java" if n % 3 == 0 + return "mocha_missing!" unless str + n.even? ? str << "Script" : str +end
Add code wars (7) caffeine buzz
diff --git a/0_code_wars/combine_objects.rb b/0_code_wars/combine_objects.rb index abc1234..def5678 100644 --- a/0_code_wars/combine_objects.rb +++ b/0_code_wars/combine_objects.rb @@ -0,0 +1,19 @@+# http://www.codewars.com/kata/56bd9e4b0d0b64eaf5000819 +# --- iteration 1 --- +def combine(*objects) + objects.reduce({}) do |acc, el| + el.each do |k, v| + if acc.key?(k) + acc[k] += v + else + acc[k] = v + end + end + acc + end +end + +# --- iteration 2 --- +def combine(*objects) + objects.reduce{ |acc, obj| acc.merge(obj){ |k, o, n| o.to_i + n } } +end
Add code wars (7) - combine objects
diff --git a/lib/greek_string/container.rb b/lib/greek_string/container.rb index abc1234..def5678 100644 --- a/lib/greek_string/container.rb +++ b/lib/greek_string/container.rb @@ -17,9 +17,11 @@ @container.flat_map { |letter| letter.to_s(args) } end - def method_missing(meth, *args) - @container.map! { |l| l if l.send(meth) }.flatten! - @container.delete_if { |el| !el == true } + def select_by_type(*meths) + meths.each do |meth| + @container.map! { |l| l if l.send(meth) }.flatten! + @container.delete_if { |el| !el == true } + end self.class.new(@container) end end
Refactor change method_missing to select_by_type
diff --git a/lib/migrate.rb b/lib/migrate.rb index abc1234..def5678 100644 --- a/lib/migrate.rb +++ b/lib/migrate.rb @@ -1,6 +1,9 @@ # Since we've designed metrics/docs tables to revolve around # the pods table, but be independent of each other, we can # run all trunk migrations first, then all others. +# + +# NOTE Set the versions to the ones you want to migrate to. # # Trunk migrations.
Add note (implying why versions are necessary).
diff --git a/smartview.gemspec b/smartview.gemspec index abc1234..def5678 100644 --- a/smartview.gemspec +++ b/smartview.gemspec @@ -8,7 +8,7 @@ spec.email = 'adam.b.gardiner@gmail.com' spec.require_paths = ['lib'] spec.files = ['README.rdoc', 'COPYING'] + Dir['lib/**/*.rb'] - spec.version = '0.0.2' + spec.version = '0.0.3' spec.add_dependency 'builder' spec.add_dependency 'hpricot' spec.add_dependency 'httpclient'
Update gem version to 0.0.3
diff --git a/cf_spec/integration/deploy_a_rails51_app_spec.rb b/cf_spec/integration/deploy_a_rails51_app_spec.rb index abc1234..def5678 100644 --- a/cf_spec/integration/deploy_a_rails51_app_spec.rb +++ b/cf_spec/integration/deploy_a_rails51_app_spec.rb @@ -1,9 +1,8 @@ require 'cf_spec_helper' describe 'Rails 5.1 (Webpack/Yarn) App' do - let(:buildpack) { ENV.fetch('SHARED_HOST')=='true' ? 'ruby_buildpack' : 'ruby-test-buildpack' } subject(:app) do - Machete.deploy_app(app_name, buildpack: buildpack) + Machete.deploy_app(app_name) end let(:browser) { Machete::Browser.new(app) }
Revert "Make sure rails51 uses ruby buildpack" [#142382213] This reverts commit cb72ad960b8893a534764be51ac7dcecae96efcc.
diff --git a/lib/stevenson/deployers/s3.rb b/lib/stevenson/deployers/s3.rb index abc1234..def5678 100644 --- a/lib/stevenson/deployers/s3.rb +++ b/lib/stevenson/deployers/s3.rb @@ -13,12 +13,22 @@ end def deploy!(directory) - Dir.glob("#{directory}/**/*").each do |file| + entries_for(directory).each do |file_path, file_name| s3_bucket.files.create( - key: File.join(deployment_key, file.partition(directory).last), - body: File.read(file), + key: File.join(deployment_key, file_name), + body: File.read(file_path), public: true, - ) if File.file?(file) + ) if File.file?(file_path) + end + end + + def entries_for(directory) + if File.file?(directory) + [ + [directory, File.basename(directory)] + ] + else + Dir.glob("#{directory}/**/*").collect { |f| [f, f.partition(directory).last] } end end
Refactor S3 deployment for single file deployment
diff --git a/app/helpers/application_helper/button/old_dialogs_edit_delete.rb b/app/helpers/application_helper/button/old_dialogs_edit_delete.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper/button/old_dialogs_edit_delete.rb +++ b/app/helpers/application_helper/button/old_dialogs_edit_delete.rb @@ -1,4 +1,4 @@-class ApplicationHelper::Button::OrchestrationOldDialogsEditDelete < ApplicationHelper::Button::Basic +class ApplicationHelper::Button::OldDialogsEditDelete < ApplicationHelper::Button::Basic def calculate_properties super if @view_context.x_active_tree == :old_dialogs_tree && @record && @record[:default]
Correct name of class according to name of file
diff --git a/LoremIpsum.podspec b/LoremIpsum.podspec index abc1234..def5678 100644 --- a/LoremIpsum.podspec +++ b/LoremIpsum.podspec @@ -3,7 +3,6 @@ s.version = "2.0.0-beta.1" s.summary = "A lightweight lorem ipsum and image placeholders generator for Objective-C." s.homepage = "https://github.com/lukaskubanek/LoremIpsum" - s.screenshots = "https://raw.github.com/lukaskubanek/LoremIpsum/master/Screenshot.png" s.license = { :type => 'MIT', :file => 'LICENSE.md' } s.author = { "Lukas Kubanek" => "lukas.kubanek@me.com" } s.source = { :git => "https://github.com/lukaskubanek/LoremIpsum.git", :tag => "v#{s.version}" }
Remove reference to missing screenshot.
diff --git a/app/models/submission.rb b/app/models/submission.rb index abc1234..def5678 100644 --- a/app/models/submission.rb +++ b/app/models/submission.rb @@ -2,7 +2,7 @@ validates :full_name, :age, :email, :codeacademy_username, :description, :html, :css, :js, :ror, :db, :programming_others, :english, :operating_system, :first_time, :goals, presence: true - validates :age, numericality: {greater_than: 0, less_than: 110} + validates :age, numericality: { greater_than: 0, less_than: 110 } validates_format_of :email, with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i end
Add spaces in Submission age validator
diff --git a/lib/unparser/emitter/float.rb b/lib/unparser/emitter/float.rb index abc1234..def5678 100644 --- a/lib/unparser/emitter/float.rb +++ b/lib/unparser/emitter/float.rb @@ -14,9 +14,10 @@ private def dispatch - if value.eql?(INFINITY) + case value + when INFINITY write('10e1000000000000000000') - elsif value.eql?(NEG_INFINITY) + when NEG_INFINITY write('-10e1000000000000000000') else write(value.inspect)
Change to case over if else
diff --git a/app/controllers/saml_controller.rb b/app/controllers/saml_controller.rb index abc1234..def5678 100644 --- a/app/controllers/saml_controller.rb +++ b/app/controllers/saml_controller.rb @@ -17,7 +17,7 @@ unless @user.blank? auto_login @user User.increment_counter(:visit_count, @user.id) - session[:course_id] = @user.default_course.id + session[:course_id] = CourseRouter.current_course_for @user respond_with @user, location: dashboard_path else redirect_to um_pilot_path
Use the CourseRouter to retrieve the current course
diff --git a/app/controllers/shop_controller.rb b/app/controllers/shop_controller.rb index abc1234..def5678 100644 --- a/app/controllers/shop_controller.rb +++ b/app/controllers/shop_controller.rb @@ -12,9 +12,8 @@ @order = nil @most_recent_item = nil - if current_member - @order = current_member.current_order - @most_recent_item = @order.order_items.first if @order - end + return unless current_member + @order = current_member.current_order + @most_recent_item = @order.order_items.first if @order end end
Use a guard clasue in shop controller
diff --git a/lib/analyze_staff_table.rb b/lib/analyze_staff_table.rb index abc1234..def5678 100644 --- a/lib/analyze_staff_table.rb +++ b/lib/analyze_staff_table.rb @@ -0,0 +1,35 @@+require 'csv' + +class AnalyzeStaffTable < Struct.new(:path) + + def contents + encoding_options = { + invalid: :replace, + undef: :replace, + replace: '' + } + + @file ||= File.read(path).encode('UTF-8', 'binary', encoding_options) + .gsub(/\\\\/, '') + .gsub(/\\"/, '') + end + + def data + csv_options = { + headers: true, + header_converters: :symbol, + converters: ->(h) { nil_converter(h) } + } + + @parsed_csv ||= CSV.parse(contents, csv_options) + end + + def nil_converter(value) + value unless value == '\N' + end + + def get_educator_data_by_full_name(full_name) + data.select { |row| row[:stf_name_view] == full_name }[0].to_hash + end + +end
Add code for parsing/searching educator file dump + Useful for hunting for educators with missing / incomplete data + i.e. #6
diff --git a/lib/certmeister/version.rb b/lib/certmeister/version.rb index abc1234..def5678 100644 --- a/lib/certmeister/version.rb +++ b/lib/certmeister/version.rb @@ -1,7 +1,24 @@-require 'semver' +begin -module Certmeister + require 'semver' - VERSION = SemVer.find.format("%M.%m.%p%s") unless defined?(VERSION) - + module Certmeister + + VERSION = SemVer.find.format("%M.%m.%p%s") unless defined?(VERSION) + + end + +rescue LoadError + + $stderr.puts "warning: ignoring missing semver gem for initial bundle" + $stderr.puts "warning: please run bundle again to fix certmeister version number" + + module Certmeister + + VERSION = '0' + + end + end + +
Work around chick-egg problem with semver2 Our gemspec uses semver2 to get our version number. Bundler uses our gemspec to get our version unumber. We use bundler to install semver2.
diff --git a/app/controllers/concerns/last_active_classroom.rb b/app/controllers/concerns/last_active_classroom.rb index abc1234..def5678 100644 --- a/app/controllers/concerns/last_active_classroom.rb +++ b/app/controllers/concerns/last_active_classroom.rb @@ -13,7 +13,7 @@ if last_active_arr.any? limit ? last_active_arr.map(&:id).uniq[0..limit - 1 ] : last_active_arr.map(&:id).uniq else - nil + [] end end
Fix calling first on nil
diff --git a/HTAutocompleteTextField.podspec b/HTAutocompleteTextField.podspec index abc1234..def5678 100644 --- a/HTAutocompleteTextField.podspec +++ b/HTAutocompleteTextField.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |s| s.name = "HTAutocompleteTextField" - s.version = "1.2.6" + s.version = "1.3.0" s.summary = "A subclass of UITextField that displays text completion suggestions while a user types. Perfect for suggestion email address domains." s.homepage = "https://github.com/hoteltonight/HTAutocompleteTextField" s.license = 'MIT' s.author = { "Jonathan Sibley" => "jonsibley@gmail.com" } - s.source = { :git => "https://github.com/hoteltonight/HTAutocompleteTextField.git", :tag => "1.2.6" } + s.source = { :git => "https://github.com/hoteltonight/HTAutocompleteTextField.git", :tag => "1.3.0" } s.platform = :ios s.ios.deployment_target = '5.0' s.source_files = 'Classes/*.{h,m}'
Update podspec to point to 1.3.0
diff --git a/lib/db_charmer/db_magic.rb b/lib/db_charmer/db_magic.rb index abc1234..def5678 100644 --- a/lib/db_charmer/db_magic.rb +++ b/lib/db_charmer/db_magic.rb @@ -14,9 +14,7 @@ # Set up slaves pool opt[:slaves] ||= [] opt[:slaves] << opt[:slave] if opt[:slave] - db_magic_slaves(opt[:slaves], should_exist) - - self.extend(DbCharmer::MultiDbProxy::MasterSlaveClassMethods) + db_magic_slaves(opt[:slaves], should_exist) if opt[:slaves].any? end private @@ -32,6 +30,7 @@ self.extend(DbCharmer::FinderOverrides::ClassMethods) self.send(:include, DbCharmer::FinderOverrides::InstanceMethods) + self.extend(DbCharmer::MultiDbProxy::MasterSlaveClassMethods) end end end
Enable master-slave stuff only when there are some slaves
diff --git a/lib/zipline.rb b/lib/zipline.rb index abc1234..def5678 100644 --- a/lib/zipline.rb +++ b/lib/zipline.rb @@ -18,7 +18,7 @@ module Zipline def zipline(files, zipname = 'zipline.zip') zip_generator = ZipGenerator.new(files) - headers['Content-Disposition'] = "attachment; filename=#{zipname}" + headers['Content-Disposition'] = "attachment; filename=\"#{zipname}\"" headers['Content-Type'] = Mime::Type.lookup_by_extension('zip').to_s response.sending_file = true response.cache_control[:public] ||= false
Use zip filename in Content-Disposition as quoted string.
diff --git a/voicemail.gemspec b/voicemail.gemspec index abc1234..def5678 100644 --- a/voicemail.gemspec +++ b/voicemail.gemspec @@ -17,12 +17,10 @@ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.require_paths = ["lib"] - s.add_runtime_dependency %q<adhearsion>, [">= 2.0.0"] - s.add_runtime_dependency %q<adhearsion-asterisk> - s.add_runtime_dependency %q<activesupport>, [">= 3.0.10"] + s.add_runtime_dependency %q<adhearsion>, ["~> 2.4"] s.add_development_dependency %q<bundler> - s.add_development_dependency %q<rspec>, [">= 2.5.0"] + s.add_development_dependency %q<rspec>, ["~> 2.14.0"] s.add_development_dependency %q<yard>, ["~> 0.6.0"] s.add_development_dependency %q<rake>, [">= 0"] s.add_development_dependency %q<guard-rspec>
Update .gemspec to require adhearsion 2.4, and not require adhearsion-asterisk