diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/motorcycle.gemspec b/motorcycle.gemspec index abc1234..def5678 100644 --- a/motorcycle.gemspec +++ b/motorcycle.gemspec @@ -24,6 +24,6 @@ s.add_runtime_dependency 'earth', '~>0.12.0' s.add_dependency 'emitter', '~> 1.0.0' - s.add_development_dependency 'sniff', '~>0.11.3' + s.add_development_dependency 'sniff', '~> 1.0.0' s.add_development_dependency 'sqlite3' end
Update sniff dependency to 1.x
diff --git a/lib/capistrano_deploy_webhook/notifier.rb b/lib/capistrano_deploy_webhook/notifier.rb index abc1234..def5678 100644 --- a/lib/capistrano_deploy_webhook/notifier.rb +++ b/lib/capistrano_deploy_webhook/notifier.rb @@ -23,7 +23,7 @@ {'app' => application_name, 'user' => GIT_USER_EMAIL.chomp, 'head' => GIT_CURRENT_REV_SHORT, - 'head_long' => GIT_CURRENT_REV, + 'head_long' => GIT_CURRENT_REV.chomp, 'prev_head' => self[:previous_revision], 'url' => self[:url]}, ';')
Remove carriage return from the current rev sha t:5
diff --git a/app/models/events/push_event.rb b/app/models/events/push_event.rb index abc1234..def5678 100644 --- a/app/models/events/push_event.rb +++ b/app/models/events/push_event.rb @@ -22,6 +22,6 @@ end def action_description - "#{user.username} pushed #{size} to #{repository.display_name}" + "#{user.username} pushed #{size} commits to #{repository.display_name}" end end
Fix push event action description.
diff --git a/lib/dm-core/adapters/sqlserver_adapter.rb b/lib/dm-core/adapters/sqlserver_adapter.rb index abc1234..def5678 100644 --- a/lib/dm-core/adapters/sqlserver_adapter.rb +++ b/lib/dm-core/adapters/sqlserver_adapter.rb @@ -1,6 +1,5 @@ require DataMapper.root / 'lib' / 'dm-core' / 'adapters' / 'data_objects_adapter' -gem 'do_sqlserver', '~>0.0.1' require 'do_sqlserver' module DataMapper
Remove usage of RubyGems in newly added SQLServer adapter Signed-off-by: Alex Coles <60c6d277a8bd81de7fdde19201bf9c58a3df08f4@alexcolesportfolio.com>
diff --git a/lib/kindle/annotator/models/annotation.rb b/lib/kindle/annotator/models/annotation.rb index abc1234..def5678 100644 --- a/lib/kindle/annotator/models/annotation.rb +++ b/lib/kindle/annotator/models/annotation.rb @@ -9,7 +9,7 @@ end def <=>(other) - self.book_id <=> other.book_id + self.location <=> other.location end def id
Sort by `location`, not `book_id`
diff --git a/lib/mi_bridges/driver/home_log_in_page.rb b/lib/mi_bridges/driver/home_log_in_page.rb index abc1234..def5678 100644 --- a/lib/mi_bridges/driver/home_log_in_page.rb +++ b/lib/mi_bridges/driver/home_log_in_page.rb @@ -6,6 +6,7 @@ delegate :latest_drive_attempt, to: :snap_application def setup + latest_drive_attempt.update(driven_at: DateTime.current) visit "https://www.mibridges.michigan.gov/access/" end
Update driven_at datetime when we log back in
diff --git a/test/dummy/app/models/merit/point_rules.rb b/test/dummy/app/models/merit/point_rules.rb index abc1234..def5678 100644 --- a/test/dummy/app/models/merit/point_rules.rb +++ b/test/dummy/app/models/merit/point_rules.rb @@ -30,7 +30,7 @@ end end - score -> (comment) { comment.comment.to_i }, to: :user, on: 'comments#create' do |object| + score lambda { |comment| comment.comment.to_i }, to: :user, on: 'comments#create' do |object| object.comment.to_i > 0 end end
Use ruby 1.9 compatible lambda syntax
diff --git a/test/functional/schemes_controller_test.rb b/test/functional/schemes_controller_test.rb index abc1234..def5678 100644 --- a/test/functional/schemes_controller_test.rb +++ b/test/functional/schemes_controller_test.rb @@ -1,8 +1,13 @@ require 'test_helper' class SchemesControllerTest < ActionController::TestCase - test "should get new" do - get :new + test 'redirect to splash if not logged in' do + get :new, {}, {id: nil} + assert_redirected_to :root + end + + test 'gets new if logged in' do + get :new, {}, {id: true} assert_response :success end
Change some tests for schemes controller
diff --git a/test/api/activity_types_test.rb b/test/api/activity_types_test.rb index abc1234..def5678 100644 --- a/test/api/activity_types_test.rb +++ b/test/api/activity_types_test.rb @@ -35,4 +35,19 @@ activity_type = ActivityType.find(last_response_body['id']) assert_json_matches_model(last_response_body, activity_type, response_keys) end + + def test_put_activity_types + data_to_put = { + activity_type: FactoryGirl.build(:activity_type), + auth_token: auth_token + } + + # Update activity_type with id = 1 + put_json '/api/activity_types/1', data_to_put + assert_equal 200, last_response.status + + response_keys = %w(name abbreviation) + first_activity_type = ActivityType.first + assert_json_matches_model(last_response_body, first_activity_type, response_keys) + end end
TEST: Check put activity type endpoint
diff --git a/test/api/group_sets_api_test.rb b/test/api/group_sets_api_test.rb index abc1234..def5678 100644 --- a/test/api/group_sets_api_test.rb +++ b/test/api/group_sets_api_test.rb @@ -1,5 +1,4 @@ require 'test_helper' -require 'user' class GroupSetsApiTest < ActiveSupport::TestCase include Rack::Test::Methods @@ -14,10 +13,14 @@ def test_get_all_groups_in_unit_with_authorization # Create a group newGroup = FactoryBot.create(:group) - # Obtain the unit of the group + + # Obtain the unit from the group newUnit = newGroup.group_set.unit get with_auth_token "/api/units/#{newUnit.id}/groups",newUnit.main_convenor_user + #check returning number of groups + assert_equal newUnit.groups.all.count, last_response_body.count + #Check response response_keys = %w(id name) last_response_body.each do | data |
FIX: Change get tests for group_sets_api
diff --git a/config/initializers/application.rb b/config/initializers/application.rb index abc1234..def5678 100644 --- a/config/initializers/application.rb +++ b/config/initializers/application.rb @@ -1,6 +1,3 @@-require 'active_record' -require "#{Rails.root}/lib/extensions/active_record" - require 'periscope' require "#{Rails.root}/lib/extensions/periscope"
Stop trying to load non-existent extension This commit removes the load of the active_record extension that was removed in aae2ee33605c9ea90821b3b7a3f67f5d5c03579e so that the app will start up properly.
diff --git a/config/initializers/carrierwave.rb b/config/initializers/carrierwave.rb index abc1234..def5678 100644 --- a/config/initializers/carrierwave.rb +++ b/config/initializers/carrierwave.rb @@ -1,6 +1,6 @@ CarrierWave.configure do |config| if Rails.env.production? - config.storage :fog + # config.storage :fog config.fog_provider = 'fog/aws' # required config.fog_credentials = { provider: 'AWS', # required
Move fog to production group
diff --git a/config/initializers/website_one.rb b/config/initializers/website_one.rb index abc1234..def5678 100644 --- a/config/initializers/website_one.rb +++ b/config/initializers/website_one.rb @@ -2,3 +2,4 @@ require 'youtube_videos' Dir[File.join(Rails.root, "lib", "core_ext", '**', "*.rb")].each {|l| require l } +Dir[File.join(Rails.root, "lib", "validators", "*.rb")].each {|l| require l }
Add Validators Directory to Autoloading Path
diff --git a/data_objects/lib/data_objects/transaction.rb b/data_objects/lib/data_objects/transaction.rb index abc1234..def5678 100644 --- a/data_objects/lib/data_objects/transaction.rb +++ b/data_objects/lib/data_objects/transaction.rb @@ -1,4 +1,5 @@ require 'digest' +require 'digest/sha2' module DataObjects @@ -23,7 +24,7 @@ # def initialize(uri) @connection = DataObjects::Connection.new(uri) - @id = Digest::SHA2.hexdigest("#{HOST}:#{$$}:#{Time.now.to_f}:#{@@counter += 1}") + @id = Digest::SHA256.hexdigest("#{HOST}:#{$$}:#{Time.now.to_f}:#{@@counter += 1}") end def close
Fix for "uninitialized constant" error running specs on JRuby 1.1.3 * Use Digest::SHA256 not Digest::SHA2 (they should be functionally identical).
diff --git a/db/migrate/008_data_bag_item_fk.rb b/db/migrate/008_data_bag_item_fk.rb index abc1234..def5678 100644 --- a/db/migrate/008_data_bag_item_fk.rb +++ b/db/migrate/008_data_bag_item_fk.rb @@ -0,0 +1,9 @@+require File.expand_path('../settings', __FILE__) + +Sequel.migration do + change do + alter_table(:data_bag_items) do + add_foreign_key [:org_id, :data_bag_name], :data_bags, :key => [:org_id, :name], :on_delete => :cascade, :on_update => :cascade + end + end +end
Add foreign key constraint to data bag items
diff --git a/config/environments/development.rb b/config/environments/development.rb index abc1234..def5678 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -16,5 +16,11 @@ # Don't care if the mailer can't send config.action_mailer.raise_delivery_errors = false -# Uncomment the following line if you're getting "A copy of XX has been removed from the module tree but is still active!" as it may help you: -# config.after_initialize { Dependencies.load_once_paths = Dependencies.load_once_paths.select { |path| (path =~ /app/).nil? } }+# Uncomment the following lines if you're getting +# "A copy of XX has been removed from the module tree but is still active!" +# or you want to develop a plugin and don't want to restart every time a change is made: +#config.after_initialize do +# ::ActiveSupport::Dependencies.load_once_paths = ::ActiveSupport::Dependencies.load_once_paths.select do |path| +# (path =~ /app/).nil? +# end +#end
Update the code that reloads plugin app directories to more robust code
diff --git a/config/initializers/carrierwave.rb b/config/initializers/carrierwave.rb index abc1234..def5678 100644 --- a/config/initializers/carrierwave.rb +++ b/config/initializers/carrierwave.rb @@ -15,5 +15,7 @@ config.fog_directory = AWS_CONFIG['bucket'] # required config.fog_public = false # optional, defaults to true config.fog_attributes = {'Cache-Control'=>'max-age=315576000'} # optional, defaults to {} + config.fog_authenticated_url_expiration = 1 << 30 # optional time (in seconds) that authenticated urls will be valid. + # when fog_public is false and provider is AWS or Google, defaults to 600 end end
Expire fog links after 34 years
diff --git a/app/uploaders/excel_uploader.rb b/app/uploaders/excel_uploader.rb index abc1234..def5678 100644 --- a/app/uploaders/excel_uploader.rb +++ b/app/uploaders/excel_uploader.rb @@ -7,7 +7,7 @@ # Add a white list of extensions which are allowed to be uploaded. # For images you might use something like this: def extension_white_list - %w(xls xlsx csv) + %w(xls xlsx) end end
Remove CSV from excel uploader whitelist
diff --git a/cookbooks/wt_netacuity/metadata.rb b/cookbooks/wt_netacuity/metadata.rb index abc1234..def5678 100644 --- a/cookbooks/wt_netacuity/metadata.rb +++ b/cookbooks/wt_netacuity/metadata.rb @@ -3,5 +3,4 @@ license "All rights reserved" description "Installs/Configures NetAcuity with a Webtrends license" long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version "1.0.9" -depends "java"+version "1.0.9"
Remove java dependency for netacuity Former-commit-id: d1255a9c38b9fc99af33e4dbc2ef0a9c5aa55dac [formerly 5bcda3eb4b752ccfded46b2f836b1cd3183e2e58] [formerly 19719f66e5d2280fb7d642b0bf91b24718cdf5a0 [formerly e86a5e5ebc51aafd884093d8a6e67f5c0e61a6da]] Former-commit-id: dee74baa1b9e3f71c84b6dd697162f58560eeb40 [formerly df5d72a11269165959fc205e54d3dd51df075fd1] Former-commit-id: e42c35ed712177eb852e4f952dc7a6ce71d9693f
diff --git a/test/functional/me/tasks_controller_test.rb b/test/functional/me/tasks_controller_test.rb index abc1234..def5678 100644 --- a/test/functional/me/tasks_controller_test.rb +++ b/test/functional/me/tasks_controller_test.rb @@ -7,7 +7,7 @@ class MeTasksControllerTest < Test::Unit::TestCase fixtures :users, :groups, :memberships, :user_participations, :group_participations, - :pages, :tasks, :tasks_users, :task_lists + :pages, :tasks, :task_participations, :task_lists def setup @controller = Me::TasksController.new
Fix fixtures in tasks_controller_tast to use task_participations fixtures, instead of no-longer existant tasks_users fixtures. Now all functional tests pass!
diff --git a/dupkt.gemspec b/dupkt.gemspec index abc1234..def5678 100644 --- a/dupkt.gemspec +++ b/dupkt.gemspec @@ -16,4 +16,6 @@ gem.version = DUKPT::VERSION gem.metadata['allowed_push_host'] = 'https://rubygems.org' + + gem.add_development_dependency("rake") end
Add rake as a dependency
diff --git a/sms_broker.gemspec b/sms_broker.gemspec index abc1234..def5678 100644 --- a/sms_broker.gemspec +++ b/sms_broker.gemspec @@ -18,7 +18,7 @@ #s.test_files = Dir["test/**/*"] s.test_files = Dir["spec/**/*"] - s.add_dependency "rails", "~> 4" + s.add_dependency "rails", ">= 4" s.add_dependency "delayed_job", "~> 4" s.add_dependency "pswincom", "~>0.1.8"
Remove strict dependency from rails 4
diff --git a/test/models/archive_test.rb b/test/models/archive_test.rb index abc1234..def5678 100644 --- a/test/models/archive_test.rb +++ b/test/models/archive_test.rb @@ -1,6 +1,7 @@-# Encoding: utf-8 +# Encoding utf-8 require 'test_helper' +# Test archive model class ArchiveTest < ActiveSupport::TestCase # test "the truth" do # assert true
Add class header to archive testing model
diff --git a/environment/kernel/alpha/string.rb b/environment/kernel/alpha/string.rb index abc1234..def5678 100644 --- a/environment/kernel/alpha/string.rb +++ b/environment/kernel/alpha/string.rb @@ -33,7 +33,7 @@ self end def to_i - @str.to_i + @str.to_num end def +(other)
Use to_num instead of to_i for c9 primitives
diff --git a/app/helpers/playlists_helper.rb b/app/helpers/playlists_helper.rb index abc1234..def5678 100644 --- a/app/helpers/playlists_helper.rb +++ b/app/helpers/playlists_helper.rb @@ -1,11 +1,11 @@ # Copyright 2011-2017, The Trustees of Indiana University and Northwestern # University. Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. -# +# # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software distributed # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR # CONDITIONS OF ANY KIND, either express or implied. See the License for the @@ -14,7 +14,10 @@ module PlaylistsHelper def human_friendly_visibility(visibility) - icon = visibility == Playlist::PUBLIC ? 'unlock' : 'lock' - safe_join([content_tag(:span, '', class:"glyphicon glyphicon-#{icon}", title: t("playlist.#{icon}AltText")),t("playlist.#{icon}Text")], ' ') + if (visibility == Playlist::PUBLIC) + safe_join([content_tag(:span, '', class:"fa fa-globe fa-lg", title: t("playlist.unlockAltText")),t("playlist.unlockText")], ' ') + else + safe_join([content_tag(:span, '', class:"fa fa-lock fa-lg", title: t("playlist.lockAltText")),t("playlist.lockText")], ' ') + end end end
Fix helper and remove glyph icons
diff --git a/foreplay.gemspec b/foreplay.gemspec index abc1234..def5678 100644 --- a/foreplay.gemspec +++ b/foreplay.gemspec @@ -19,5 +19,5 @@ s.add_runtime_dependency 'foreman', '>= 0.76', '< 1.0' s.add_runtime_dependency 'ssh-shell', '>= 0.4', '< 1.0' - s.add_runtime_dependency 'activesupport', '>= 3.2.22' + s.add_runtime_dependency 'activesupport', '>= 3.2.22', '<= 5' end
Fix gemspec for gem release
diff --git a/app/controllers/admin/bulk_uploads_controller.rb b/app/controllers/admin/bulk_uploads_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/bulk_uploads_controller.rb +++ b/app/controllers/admin/bulk_uploads_controller.rb @@ -1,8 +1,8 @@ class Admin::BulkUploadsController < Admin::BaseController before_filter :find_edition - before_filter :limit_edition_access! - before_filter :enforce_permissions! - before_filter :prevent_modification_of_unmodifiable_edition + before_filter :limit_edition_access! + before_filter :enforce_permissions! + before_filter :prevent_modification_of_unmodifiable_edition def new @bulk_upload_zip_file = BulkUpload::ZipFile.new @@ -33,7 +33,7 @@ @edition = Edition.find(params[:edition_id]) end - def enforce_permissions! - enforce_permission!(:update, @edition) - end + def enforce_permissions! + enforce_permission!(:update, @edition) + end end
Convert hard tabs to soft tabs
diff --git a/app/models/template_division.rb b/app/models/template_division.rb index abc1234..def5678 100644 --- a/app/models/template_division.rb +++ b/app/models/template_division.rb @@ -7,7 +7,7 @@ validates :start, numericality: { greater_than_or_equal_to: 1, less_than_or_equal_to: :end, only_integer: true } - validates :end, numericality: { greater_than_or_equal_to: :start, + validates :end, numericality: { less_than_or_equal_to: TemplateDivision.first.exam_template.num_pages, only_integer: true } validates :label, uniqueness: true, allow_blank: false
Add a new validation for :end to be less than :num_pages
diff --git a/script/imported_filesize_reporter.rb b/script/imported_filesize_reporter.rb index abc1234..def5678 100644 --- a/script/imported_filesize_reporter.rb +++ b/script/imported_filesize_reporter.rb @@ -0,0 +1,10 @@+# Calculates average file size per attachment, +# And average total usage per imported row. + +include ActionView::Helpers::NumberHelper + +total_attachment_size = AttachmentData.sum(:file_size) +per_attachment = total_attachment_size / AttachmentData.count + +puts "Total uploaded attachments: #{number_to_human_size(total_attachment_size)}" +puts "Size per attachment: #{number_to_human_size(per_attachment)}"
Add a script to report on filesize
diff --git a/bench/bench_new_valid.rb b/bench/bench_new_valid.rb index abc1234..def5678 100644 --- a/bench/bench_new_valid.rb +++ b/bench/bench_new_valid.rb @@ -0,0 +1,44 @@+=begin ++----------+------+-----+---------+-----------------+----------------+ +| Field | Type | Null | Key | Default | Extra | ++-------------+--------------+------+-----+---------+----------------+ +| id | int(11) | NO | PRI | NULL | auto_increment | +| name | varchar(255) | YES | | NULL | | +| description | text | YES | | NULL | | +| created_at | datetime | YES | | NULL | | +| updated_at | datetime | YES | | NULL | | ++-------------+--------------+------+-----+---------+----------------+ +=end + +ENV["RAILS_ENV"] = "production" +require 'rubygems' +require 'active_record' +require 'benchmark' + +is_jruby = defined? RUBY_ENGINE && RUBY_ENGINE == "jruby" + +ActiveRecord::Base.establish_connection( + :adapter => is_jruby ? "jdbcmysql" : "mysql", + :host => "localhost", + :username => "root", + :database => "ar_bench" +) + +class Widget < ActiveRecord::Base; end + +TIMES = (ARGV[0] || 5).to_i +Benchmark.bm(30) do |make| + TIMES.times do + make.report("Widget.new") do + 100_000.times do + Widget.new + end + end + make.report("widget.valid?") do + w = Widget.new + 100_000.times do + w.valid? + end + end + end +end
Add the first benchmark from JRUBY-2184. git-svn-id: 0d15740d2b2329e9094a4e8932733054e5d3e04c@1114 8ba958d5-0c1a-0410-94a6-a65dfc1b28a6
diff --git a/KeyStorage.podspec b/KeyStorage.podspec index abc1234..def5678 100644 --- a/KeyStorage.podspec +++ b/KeyStorage.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = 'KeyStorage' - s.version = '0.2.1' + s.version = '0.2.2' s.summary = 'KeyStorage is a simple secure key persistance library written in Swift.' s.description = <<-DESC @@ -15,7 +15,7 @@ s.social_media_url = 'https://twitter.com/bencoding' s.ios.deployment_target = '9.0' - + s.watchos.deployment_target = '2.0' s.source_files = 'KeyStorage/Classes/**/*' end
Add watchOS support to Pod
diff --git a/LightRoute.podspec b/LightRoute.podspec index abc1234..def5678 100644 --- a/LightRoute.podspec +++ b/LightRoute.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "LightRoute" - s.version = "2.1.11" + s.version = "2.1.12" s.summary = "LightRoute is easy transition between view controllers and support many popylar arhitectures" s.description = <<-DESC LightRoute is easy transition between view controllers and support many popylar arhitectures. This framework very flow for settings your transition and have userfriendly API.
Update spec to version 2.1.12
diff --git a/test/harmonize_test.rb b/test/harmonize_test.rb index abc1234..def5678 100644 --- a/test/harmonize_test.rb +++ b/test/harmonize_test.rb @@ -4,8 +4,9 @@ def setup samples_one = [0, 1, 0, -1] samples_two = [1, 0, -1, 0] + @samples_three = [-1, 0, 1, 0, -1] - @subject = MusicTheory::Harmonize.new(samples_one, samples_two) + @subject = MusicTheory::Harmonize.new(samples_one, samples_two, @samples_three) end def test_samples_not_clipping @@ -13,4 +14,9 @@ max = samples.map {|s| s.abs }.max assert_equal 1.0, max end + + def test_duration_matches_longest_input + result_len = @subject.samples.length + assert_equal @samples_three.length, result_len + end end
Add test for length of samples
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -1,16 +1,21 @@-# Install Ruby via rvm -# Include here so that we can set Ruby version in this recipe -include_recipe "rvm::user" -include_recipe "rvm::vagrant" +# Add ppa with newer Ruby version +apt_repository "brightbox-ruby-ng" do + action :add + uri "http://ppa.launchpad.net/brightbox/ruby-ng/ubuntu" + distribution "precise" + components ["main"] + keyserver "keyserver.ubuntu.com" + key "C3173AA6" +end -# Install required packages -%w{curl}.each do |pkg| +# Install Ruby and other required packages +%w{ruby2.0 curl}.each do |pkg| package pkg do action :install end end gem_package "bundler" do - action :install + gem_binary "/usr/bin/gem" end # Install required gems via bundler
Use PPA to install Ruby 2.0
diff --git a/recipes/disable.rb b/recipes/disable.rb index abc1234..def5678 100644 --- a/recipes/disable.rb +++ b/recipes/disable.rb @@ -3,7 +3,7 @@ # Recipe:: disable # -package 'iptables-services' +package 'iptables-services' if node['firewalld']['iptables_fallback'] service 'firewalld' do action [:disable, :stop]
Make iptables installation conditional on fallback attribute.
diff --git a/grit-ext.gemspec b/grit-ext.gemspec index abc1234..def5678 100644 --- a/grit-ext.gemspec +++ b/grit-ext.gemspec @@ -7,14 +7,13 @@ s.name = 'grit-ext' s.version = Grit::Ext::VERSION s.platform = Gem::Platform::RUBY - s.authors = ['Mindaugas Mozūras'] - s.email = ['mindaugas.mozuras@gmail.com'] + s.author = 'Mindaugas Mozūras' + s.email = 'mindaugas.mozuras@gmail.com' s.homepage = 'http://github.org/mmozuras/grit-ext' s.summary = 'grit-ext' s.description = 'Collection of extensions for grit' s.required_rubygems_version = '>= 1.3.6' - s.rubyforge_project = 'grit-ext' s.license = 'MIT' s.files = Dir.glob('{lib}/**/*') + %w[LICENSE README.md]
Remove unnecessary stuff from gemspec
diff --git a/app/forms/sessions_form.rb b/app/forms/sessions_form.rb index abc1234..def5678 100644 --- a/app/forms/sessions_form.rb +++ b/app/forms/sessions_form.rb @@ -3,7 +3,13 @@ attr_accessor :organization_login_name, :user_email, :user_password + validates :organization_login_name, presence: true + validates :user_email, presence: true + validates :user_password, presence: true + def login + return false unless valid? + false end end
Add presence validation to sessions form
diff --git a/app/controllers/api/action_plans_controller.rb b/app/controllers/api/action_plans_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/action_plans_controller.rb +++ b/app/controllers/api/action_plans_controller.rb @@ -35,7 +35,7 @@ def proposals @proposals = @action_plan.proposals - render json: { proposals: @proposals } + render json: @proposals, root: 'proposals' end private
Fix action plans' related proposals
diff --git a/app/overrides/add_schweine_links_to_sidebar.rb b/app/overrides/add_schweine_links_to_sidebar.rb index abc1234..def5678 100644 --- a/app/overrides/add_schweine_links_to_sidebar.rb +++ b/app/overrides/add_schweine_links_to_sidebar.rb @@ -1,4 +1,9 @@ Deface::Override.new(:virtual_path => 'spree/home/index', - :name => 'add_schweine_links_to_sidebar', + :name => 'add_schweine_links_to_sidebar_on_home_page', :insert_bottom => '[data-hook="homepage_sidebar_navigation"]', - :partial => 'spree/schweine/sidebar')+ :partial => 'spree/schweine/sidebar') + +Deface::Override.new(:virtual_path => 'spree/products/index', + :name => 'add_schweine_links_to_sidebar_on_products_page', + :insert_bottom => '[data-hook="homepage_sidebar_navigation"]', + :partial => 'spree/schweine/sidebar')
Add schweine links to sidebar on product index page.
diff --git a/app/models/payment_icon.rb b/app/models/payment_icon.rb index abc1234..def5678 100644 --- a/app/models/payment_icon.rb +++ b/app/models/payment_icon.rb @@ -1,5 +1,13 @@ class PaymentIcon < FrozenRecord::Base self.base_path = File.expand_path('../../db/', __dir__) + + GROUPS = { + credit_cards: 'Credit cards', + cryptocurrencies: 'Digital currencies', + bank_transfers: 'Bank transfers', + wallets: 'Digital wallets', + other: 'Other' + } def path "payment_icons/#{name}.svg"
Add a method for returning the group keys and labels
diff --git a/app/models/user_session.rb b/app/models/user_session.rb index abc1234..def5678 100644 --- a/app/models/user_session.rb +++ b/app/models/user_session.rb @@ -8,13 +8,14 @@ h = {} return h unless pds_user h[:marli_admin] = true if default_admins.include? pds_user.uid - patron = Exlibris::Aleph::Patron.new(patron_id: pds_user.nyuidn) - addr_info = patron.address - h[:address] = {} - h[:address][:street_address] = addr_info["z304_address_2"]["__content__"] - h[:address][:city] = addr_info["z304_address_3"]["__content__"] - h[:address][:state] = addr_info["z304_address_4"]["__content__"] - h[:address][:postal_code] = addr_info["z304_zip"]["__content__"] + patron = Exlibris::Aleph::Patron.new(pds_user.nyuidn) + address = patron.address + h[:address] = { + street_address: address.address2, + city: address.address3, + state: address.address4, + postal_code: address.zip + } return h end
Use the latest Exlibris::Aleph library
diff --git a/chef/cookbooks/cdo-repository/recipes/default.rb b/chef/cookbooks/cdo-repository/recipes/default.rb index abc1234..def5678 100644 --- a/chef/cookbooks/cdo-repository/recipes/default.rb +++ b/chef/cookbooks/cdo-repository/recipes/default.rb @@ -10,6 +10,13 @@ action :checkout checkout_branch node.chef_environment user node[:current_user] + notifies :run, "execute[select-upstream-branch]", :immediately +end + +execute "select-upstream-branch" do + command "git branch --set-upstream-to=origin/#{node.chef_environment} #{node.chef_environment}" + cwd "/home/#{node[:current_user]}/#{node.chef_environment}" + action :nothing end template "/home/#{node[:current_user]}/.gemrc" do
Set upstream branch when install repo via chef.
diff --git a/app/models/user.rb b/app/models/user.rb index abc1234..def5678 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -8,11 +8,9 @@ has_many :questions has_many :answers has_many :likes - - has_attached_file :avatar, styles: { thumb: "100x100>" }, default_url: "/images/users/:id/:style/:basename.:extension" - validates_attachment_presence :photo - validates_attachment_size :photo, less_than: 5.megabytes - validates_attachment_content_type :avatar, content_type: ['image/jpeg', 'image/png'] + + has_attached_file :avatar, :styles => { :thumb => "100x100>" }, :default_url => "/images/:style/missing.png" + validates_attachment_content_type :avatar, :content_type => /\Aimage\/.*\Z/ def to_s email
Change validation in User model
diff --git a/app/models/user.rb b/app/models/user.rb index abc1234..def5678 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,5 +1,6 @@ class User < ActiveRecord::Base acts_as_authentic do |config| + config.validates_length_of_password_field_options = { minimum: 4 } config.crypto_provider = Authlogic::CryptoProviders::BCrypt end
Rollback min password length to 4 Authlogic v3.5 increased min password length from 4 to 8. This breaks tests and seeding. References: https://github.com/binarylogic/authlogic/blob/master/CHANGELOG.md
diff --git a/app/models/user.rb b/app/models/user.rb index abc1234..def5678 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2,5 +2,5 @@ has_many :questions, foreign_key: :asker_id has_many :answers, foreign_key: :responder_id has_many :votes, foreign_key: :voter_id - has_many :responses, foreign_key: :commenter_id + has_many :responses, foreign_key: :responder_id end
Fix foreign key from commenter_id to responder_id
diff --git a/app/models/user.rb b/app/models/user.rb index abc1234..def5678 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -8,4 +8,6 @@ has_many :questionnaires, through: :users_questionnaires has_many :users_addresses has_many :addresses, through: :users_addresses + has_many :listings + has_many :followed_listings end
Add Listing associations to User model - Add Listing association where User is creator of listing - Add Listing association where User is follower of listing
diff --git a/savon_spec.gemspec b/savon_spec.gemspec index abc1234..def5678 100644 --- a/savon_spec.gemspec +++ b/savon_spec.gemspec @@ -20,6 +20,7 @@ s.add_development_dependency "webmock", "~> 1.4.0" s.add_development_dependency "autotest" + s.add_development_dependency "rake" s.add_development_dependency "ZenTest", "4.5.0" s.files = `git ls-files`.split("\n")
Add rake to development dependecies
diff --git a/deployment/puppet/l23network/lib/puppet/parser/functions/get_nic_passthrough_whitelist.rb b/deployment/puppet/l23network/lib/puppet/parser/functions/get_nic_passthrough_whitelist.rb index abc1234..def5678 100644 --- a/deployment/puppet/l23network/lib/puppet/parser/functions/get_nic_passthrough_whitelist.rb +++ b/deployment/puppet/l23network/lib/puppet/parser/functions/get_nic_passthrough_whitelist.rb @@ -1,5 +1,10 @@-require 'puppetx/l23_network_scheme' - +begin + require 'puppetx/l23_network_scheme' +rescue LoadError => e + rb_file = File.join(File.dirname(__FILE__),'..','..','..','puppetx','l23_network_scheme.rb') + load rb_file if File.exists?(rb_file) or raise e +end +# Puppet::Parser::Functions::newfunction(:get_nic_passthrough_whitelist, :type => :rvalue, :arity => 1, :doc => <<-EOS This function gets pci_passthrough_whitelist mapping from transformations Returns NIL if no transformations with this provider found or list
Add workaround for import puppetx::* from parser functions in the Puppet-master mode. Change-Id: Id5dac8fbf71c96a6705a735e711eb5032319896f Closes-Bug: #1544040
diff --git a/elastic-schema.gemspec b/elastic-schema.gemspec index abc1234..def5678 100644 --- a/elastic-schema.gemspec +++ b/elastic-schema.gemspec @@ -4,7 +4,7 @@ Gem::Specification.new do |s| s.name = "elastic-schema" - s.version = '0.0.1' + s.version = '0.1.0' s.platform = Gem::Platform::RUBY s.license = "MIT" s.authors = ["Leandro Camargo"]
Update project version to something that makes more sense at this point
diff --git a/app/helpers/layouts_helper.rb b/app/helpers/layouts_helper.rb index abc1234..def5678 100644 --- a/app/helpers/layouts_helper.rb +++ b/app/helpers/layouts_helper.rb @@ -35,6 +35,12 @@ render 'common/prepend_body' end + # Prepend the flash message partial before yield + def prepend_yield + content_tag :div, :id => "main-flashes" do + end + end + # Boolean for whether or not to show tabs # This application doesn't need tabs def show_tabs
Add main-flashes element back but dont render flash partial
diff --git a/app/jobs/start_service_job.rb b/app/jobs/start_service_job.rb index abc1234..def5678 100644 --- a/app/jobs/start_service_job.rb +++ b/app/jobs/start_service_job.rb @@ -26,9 +26,9 @@ }, ) Rails.logger.info("Starting Container #{container.id} for Service ##{service.id}") - service.update!(container_id: container.id) container.start Rails.logger.info("Started Container #{container.id} for Service ##{service.id}") + service.update!(container_id: container.id) Rails.logger.debug(container) end end
Update container_id after start has initialized Using .wait() always causes a timeout error because it's a long running process
diff --git a/app/models/featured_report.rb b/app/models/featured_report.rb index abc1234..def5678 100644 --- a/app/models/featured_report.rb +++ b/app/models/featured_report.rb @@ -19,7 +19,7 @@ end def writeup_html - @writeup_html ||= RDiscount.new( writeup ).to_html + @writeup_html ||= RDiscount.new( writeup ).to_html.html_safe end def serializable_hash( options={} )
Mark generated HTML as html_safe for using in view
diff --git a/app/models/order_decorator.rb b/app/models/order_decorator.rb index abc1234..def5678 100644 --- a/app/models/order_decorator.rb +++ b/app/models/order_decorator.rb @@ -2,7 +2,7 @@ prepend SolidusShipwire::Proxy def self.prepended(base) - base.after_save :update_on_shipwire, if: :complete? + base.after_save :update_on_shipwire, if: :update_on_shipwire? base.state_machine.after_transition to: :complete, do: :in_shipwire, if: :line_items_in_shipwire? end @@ -51,6 +51,10 @@ private + def update_on_shipwire? + complete? && shipwire_id.present? + end + def shipwire_instance Shipwire::Orders.new end
Update order only if shipwire_id is present
diff --git a/lib/rumoji.rb b/lib/rumoji.rb index abc1234..def5678 100644 --- a/lib/rumoji.rb +++ b/lib/rumoji.rb @@ -15,7 +15,7 @@ end def decode(str) - str.gsub(/:(\w+):/) {|sym| Emoji.find($1.intern).to_s } + str.gsub(/:(\S?\w+):/) {|sym| Emoji.find($1.intern).to_s } end def encode_io(readable, writeable=StringIO.new("")) @@ -29,13 +29,9 @@ def decode_io(readable, writeable=StringIO.new("")) readable.each_line do |line| - writeable.write line.gsub(/:(\w+):/) {|sym| Emoji.find($1.intern).to_s } + writeable.write decode(line) end writeable end - def codepoint_as_hex(codepoint) - codepoint.to_s(16).upcase - end - end
Make emoji code pattern more permissive (to allow for :+1:)
diff --git a/config/initializers/cache.rb b/config/initializers/cache.rb index abc1234..def5678 100644 --- a/config/initializers/cache.rb +++ b/config/initializers/cache.rb @@ -1,3 +1,9 @@ unless Rails.env.production? Rails.cache.logger = Rails.logger +end + +revision = Rails.root.join('REVISION') + +if revision.exist? + ENV['RAILS_CACHE_ID'] = revision.read[0,7] end
Set RAILS_CACHE_ID to the current revision if available. This will ensure unique etags/cache keys.
diff --git a/bashcov.gemspec b/bashcov.gemspec index abc1234..def5678 100644 --- a/bashcov.gemspec +++ b/bashcov.gemspec @@ -18,7 +18,7 @@ gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ["lib"] - gem.add_dependency "simplecov", "~> 0.10.0" + gem.add_dependency "simplecov", "~> 0.11" gem.add_development_dependency "rake" gem.add_development_dependency "rspec", "~> 3"
Update SimpleCov and relax dependency to allow 0.11+
diff --git a/lib/facebooker/rails/facebook_request_fix.rb b/lib/facebooker/rails/facebook_request_fix.rb index abc1234..def5678 100644 --- a/lib/facebooker/rails/facebook_request_fix.rb +++ b/lib/facebooker/rails/facebook_request_fix.rb @@ -7,7 +7,7 @@ request_method_without_facebooker end - if methods.include?("request_method") + if new.methods.include?("request_method") alias_method_chain :request_method, :facebooker end end
Fix for rails 1.2 exclusion git-svn-id: 1f7e5a82df654d04b4d84ee010c8254081ce2632@118 06148572-b36b-44fe-9aa8-f68b04d8b080
diff --git a/lib/metacrunch/mab2/document/subfield_set.rb b/lib/metacrunch/mab2/document/subfield_set.rb index abc1234..def5678 100644 --- a/lib/metacrunch/mab2/document/subfield_set.rb +++ b/lib/metacrunch/mab2/document/subfield_set.rb @@ -34,6 +34,10 @@ @subfields.map{ |subfield| subfield.value } end + def first_value + values.find{ |v| v.present? } + end + end end end
Add helper to get the first subfield value that is not empty.
diff --git a/lib/delayed/plugins/exception_notifier.rb b/lib/delayed/plugins/exception_notifier.rb index abc1234..def5678 100644 --- a/lib/delayed/plugins/exception_notifier.rb +++ b/lib/delayed/plugins/exception_notifier.rb @@ -4,7 +4,7 @@ module Notify def error(job, exception) ::ExceptionNotifier::Notifier.background_exception_notification(exception).deliver - super + super if defined?(super) end end
Call super only if it's defined
diff --git a/lib/gym/xcodebuild_fixes/watchkit2_fix.rb b/lib/gym/xcodebuild_fixes/watchkit2_fix.rb index abc1234..def5678 100644 --- a/lib/gym/xcodebuild_fixes/watchkit2_fix.rb +++ b/lib/gym/xcodebuild_fixes/watchkit2_fix.rb @@ -27,7 +27,7 @@ # Does this application have a WatchKit target def watchkit2? Dir["#{PackageCommandGenerator.appfile_path}/**/*.plist"].any? do |plist_path| - `/usr/libexec/PlistBuddy -c 'Print DTSDKName' '#{plist_path}' 2>&1`.strip == 'watchos2.0' + `/usr/libexec/PlistBuddy -c 'Print DTSDKName' '#{plist_path}' 2>&1`.match(/^\s*watchos2\.\d+\s*$/) end end end
Update `Gym::XcodebuildFixes::watchkit2?` to match watchos2.1
diff --git a/lib/scss_lint/linter/declaration_order.rb b/lib/scss_lint/linter/declaration_order.rb index abc1234..def5678 100644 --- a/lib/scss_lint/linter/declaration_order.rb +++ b/lib/scss_lint/linter/declaration_order.rb @@ -18,18 +18,17 @@ end if children != sorted_children - add_lint(node.children.first) + add_lint(node.children.first, MESSAGE) end yield # Continue linting children end - def description + private + + MESSAGE = 'Rule sets should start with @extend declarations, followed by ' << 'properties and nested rule sets, in that order' - end - - private def important_node?(node) DECLARATION_ORDER.include? node.class
Remove description method from DeclarationOrder The `description` method is being deprecated. Change-Id: I27efec67970d21e98a1fe3e8db95d6ff4c23090a Reviewed-on: http://gerrit.causes.com/36726 Tested-by: jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@causes.com> Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com>
diff --git a/lib/spectrum/config/highly_recommended.rb b/lib/spectrum/config/highly_recommended.rb index abc1234..def5678 100644 --- a/lib/spectrum/config/highly_recommended.rb +++ b/lib/spectrum/config/highly_recommended.rb @@ -21,7 +21,7 @@ def get_sorts_from_facets(facets) return [] unless facets.data - Array(facets.data[field]).compact.map { |value| map(value) } + facets.find(field).map { |value| map(value) } end end end
Fix for a 500 status.
diff --git a/lib/tasks/load_tags_from_content_api.rake b/lib/tasks/load_tags_from_content_api.rake index abc1234..def5678 100644 --- a/lib/tasks/load_tags_from_content_api.rake +++ b/lib/tasks/load_tags_from_content_api.rake @@ -0,0 +1,48 @@+desc "Load tags from Content API into Collections Publisher." +task :load_tags_from_content_api => :environment do + require 'gds_api/content_api' + + content_api_endpoint = Plek.new.find("content_api") + content_api = GdsApi::ContentApi.new(content_api_endpoint) + + puts "There are currently #{Tag.count} tags in the database" + puts "Fetching all tags from the Content API..." + tags = content_api.get_list!("#{content_api_endpoint}/tags.json"). + with_subsequent_pages. + # Only import the tags that are sectors or specialist sectors. + select { |tag| ["section", "specialist_sector"].include?(tag.details.type) } + + puts "Received a total of #{tags.count} relevant tags" + puts "Loading tags into Collections Publisher..." + tags.each do |api_tag| + unless Tag.where(slug: api_tag.slug).any? + case api_tag.details.type + when "section" + klass = MainstreamBrowsePage + when "specialist_sector" + klass = Topic + end + + tag = klass.new(slug: api_tag.slug, + description: api_tag.details.description, + title: api_tag.title) + tag.save! + end + end + + # On the first run of this task, the tags might not exist in the database. + # Traverse through all fetched tags again and assign parents accodingly. + puts "Assigning child tags to parents..." + tags.each do |api_tag| + existing_tag = Tag.where(slug: api_tag.slug).first + + if existing_tag.parent.nil? and not api_tag.parent.nil? + parent = Tag.where(slug: api_tag.parent.slug).first + existing_tag.parent = parent + existing_tag.save! + end + end + + puts "There are now #{Tag.count} tags in the database" + puts "Finished loading tags" +end
Load tags from Content API into local database Tags will be migrated from Panopticon into Collections Publisher. To make this process smoother, create a Rake task to do most of the work for us. The task itself aims to only import `section` and `specialist_sector` tags. It then creates any tags that don't already exist.
diff --git a/lib/vagrant-libvirt/action/halt_domain.rb b/lib/vagrant-libvirt/action/halt_domain.rb index abc1234..def5678 100644 --- a/lib/vagrant-libvirt/action/halt_domain.rb +++ b/lib/vagrant-libvirt/action/halt_domain.rb @@ -13,22 +13,30 @@ def call(env) env[:ui].info(I18n.t('vagrant_libvirt.halt_domain')) + timeout = env[:machine].config.vm.graceful_halt_timeout domain = env[:machine].provider.driver.connection.servers.get(env[:machine].id.to_s) raise Errors::NoDomainError if domain.nil? begin - env[:machine].guest.capability(:halt) - rescue - @logger.info('Trying Libvirt graceful shutdown.') - domain.shutdown - end + Timeout.timeout(timeout) do + begin + env[:machine].guest.capability(:halt) + rescue Timeout::Error + raise + rescue + @logger.info('Trying Libvirt graceful shutdown.') + # Read domain object again + dom = env[:machine].provider.driver.connection.servers.get(env[:machine].id.to_s) + if dom.state.to_s == 'running' + dom.shutdown + end + end - - begin - domain.wait_for(30) do - !ready? + domain.wait_for(timeout) do + !ready? + end end - rescue Fog::Errors::TimeoutError + rescue Timeout::Error @logger.info('VM is still running. Calling force poweroff.') domain.poweroff end
Fix interaction with reload plugin
diff --git a/lib/vagrant/provisioners/puppet_server.rb b/lib/vagrant/provisioners/puppet_server.rb index abc1234..def5678 100644 --- a/lib/vagrant/provisioners/puppet_server.rb +++ b/lib/vagrant/provisioners/puppet_server.rb @@ -44,9 +44,14 @@ command = "puppetd #{options} --server #{config.puppet_server} --certname #{cn}" - env.ui.info I18n.t("vagrant.provisioners.puppet_server.running_puppetd") + env[:ui].info I18n.t("vagrant.provisioners.puppet_server.running_puppetd") env[:vm].channel.sudo(command) do |type, data| - env.ui.info(data) + # Output the data with the proper color based on the stream. + color = type == :stdout ? :green : :red + + # Note: Be sure to chomp the data to avoid the newlines that the + # Chef outputs. + env[:ui].info(data.chomp, :color => color, :prefix => false) end end end
Fix poor variable reference in puppet server. Also colorize output
diff --git a/lib/esb.rb b/lib/esb.rb index abc1234..def5678 100644 --- a/lib/esb.rb +++ b/lib/esb.rb @@ -3,9 +3,9 @@ class Esb def self.get_color - doc = Nokogiri::HTML(open("http://www.esbnyc.com/current_events_tower_lights.asp")) + doc = Nokogiri::HTML(open("https://www.esbnyc.com/explore/tower-lights")) puts " " - puts doc.css("#page-title").text.strip + puts doc.css(".view-tower-lighting #page-title").text.strip puts " " end end
Update URL and CSS selector. Scraping an ever-changing web is hard work
diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index abc1234..def5678 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -23,3 +23,7 @@ # For further information see the following documentation: # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only # Rails.application.config.content_security_policy_report_only = true + +Rails.application.config.content_security_policy do |policy| + policy.connect_src :self, :https, 'http://localhost:3035', 'ws://localhost:3035' if Rails.env.development? +end
Add webpacker dev server to CSP initializer
diff --git a/lib/gpx.rb b/lib/gpx.rb index abc1234..def5678 100644 --- a/lib/gpx.rb +++ b/lib/gpx.rb @@ -12,4 +12,4 @@ require File.expand_path('gpx/track_point', __dir__) require File.expand_path('gpx/waypoint', __dir__) require File.expand_path('gpx/magellan_track_log', __dir__) -require File.expand_path('gpx/geojson', __FILE__)+require File.expand_path('gpx/geojson', __dir__)
Fix merge error on geojson require
diff --git a/lib/hue.rb b/lib/hue.rb index abc1234..def5678 100644 --- a/lib/hue.rb +++ b/lib/hue.rb @@ -10,5 +10,5 @@ module Hue USERNAME_RANGE = 10..40 - USERNAME = '1234567890' + USERNAME = (ENV['HUE_BRIDGE_USER'] && ENV['HUE_BRIDGE_USER'] != '') ? ENV['HUE_BRIDGE_USER'] : '1234567890' end
Allow specifying user ID via env var.
diff --git a/lib/aptible/api/vhost.rb b/lib/aptible/api/vhost.rb index abc1234..def5678 100644 --- a/lib/aptible/api/vhost.rb +++ b/lib/aptible/api/vhost.rb @@ -8,7 +8,9 @@ field :id field :virtual_domain field :type + field :application_load_balancer_arn field :elastic_load_balancer_name + field :security_group_id field :external_host field :external_http_port field :external_https_port @@ -24,6 +26,7 @@ field :acme, type: Aptible::Resource::Boolean field :user_domain field :acme_status + field :ip_whitelist def account service.account
Add VHOST ip filtering fields And also add `application_load_balancer_arn`, which it seems we never added..!
diff --git a/lib/be_gateway/client.rb b/lib/be_gateway/client.rb index abc1234..def5678 100644 --- a/lib/be_gateway/client.rb +++ b/lib/be_gateway/client.rb @@ -5,7 +5,7 @@ TRANSACTIONS.each do |tr_type| define_method tr_type do |params| - response = post "/transactions/#{tr_type}s", { request: params } + response = post post_url(tr_type), { request: params } make_response(response) end end @@ -30,5 +30,15 @@ make_response(response) end + private + + def post_url(tr_type) + if tr_type == 'authorize' + "/transactions/authorizations" + else + "/transactions/#{tr_type}s" + end + end + end end
Change post url creation method. Add special case for ‘authrize’.
diff --git a/lib/blog/post_manager.rb b/lib/blog/post_manager.rb index abc1234..def5678 100644 --- a/lib/blog/post_manager.rb +++ b/lib/blog/post_manager.rb @@ -5,7 +5,7 @@ SAVE = 'Save' def self.manage_post(params) - DBAdapter.new_post(params[:title], params[:body]) if params[:action] == SAVE + save(params) if save_action?(params) delete(params) if delete_action?(params) end @@ -17,5 +17,13 @@ def self.delete_action?(params) params[:action] == DELETE end + + def self.save(params) + DBAdapter.new_post(params[:title], params[:body]) + end + + def self.save_action?(params) + params[:action] == SAVE + end end end
REFACTOR: Save action create new post
diff --git a/lib/hets/hets_options.rb b/lib/hets/hets_options.rb index abc1234..def5678 100644 --- a/lib/hets/hets_options.rb +++ b/lib/hets/hets_options.rb @@ -4,10 +4,6 @@ def self.from_hash(hash) new(hash['options']) - end - - def self.from_json(json) - from_hash(JSON.parse(json)) end def initialize(opts = {}) @@ -23,10 +19,6 @@ def merge!(hets_options) add(hets_options.options) - end - - def to_json - {'options' => options}.to_json end def ==(other)
Remove unused JSON conversion methods.
diff --git a/CMNavBarNotificationView.podspec b/CMNavBarNotificationView.podspec index abc1234..def5678 100644 --- a/CMNavBarNotificationView.podspec +++ b/CMNavBarNotificationView.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |s| s.name = "CMNavBarNotificationView" - s.version = "1.0.0" + s.version = "1.0.1" s.summary = "An in-app notification view above the navigation bar totally based on MPNotificationView." s.homepage = "https://github.com/edgurgel/CMNavBarNotificationView" s.license = 'MIT' s.authors = { "Eduardo Pinho" => "eduardo.gurgel@codeminer42.com", "Codeminer42" => "contato@codeminer42.com" } - s.source = { :git => "https://github.com/edgurgel/CMNavBarNotificationView.git", :tag => "1.0.0" } + s.source = { :git => "https://github.com/edgurgel/CMNavBarNotificationView.git", :tag => "1.0.1" } s.platform = :ios, '4.0' s.source_files = './CMNavBarNotificationView/*.{h,m}','./OBGradientView/*.{h,m}' s.public_header_files = 'CMNavBarNotificationView/**/*.h'
Update podspec version to 1.0.1
diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb index abc1234..def5678 100644 --- a/activesupport/test/core_ext/duration_test.rb +++ b/activesupport/test/core_ext/duration_test.rb @@ -10,11 +10,12 @@ assert_equal '7 days', 1.week.inspect assert_equal '14 days', 1.fortnight.inspect end - + def test_minus_with_duration_does_not_break_subtraction_of_date_from_date assert_nothing_raised { Date.today - Date.today } end - + + # FIXME: ruby 1.9 def test_plus_with_time assert_equal 1 + 1.second, 1.second + 1, "Duration + Numeric should == Numeric + Duration" end
Mark Duration test failing with Ruby 1.9 git-svn-id: afc9fed30c1a09d8801d1e4fbe6e01c29c67d11f@7648 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
diff --git a/spec/features/users/signin_and_signup_spec.rb b/spec/features/users/signin_and_signup_spec.rb index abc1234..def5678 100644 --- a/spec/features/users/signin_and_signup_spec.rb +++ b/spec/features/users/signin_and_signup_spec.rb @@ -3,7 +3,7 @@ RSpec.feature 'Sign in', :devise do scenario 'a user cannot sign in if not registered' do signin('test@example.com', 'please123') - expect(page).to have_content I18n.t 'devise.failure.not_found_in_database', authentication_keys: 'email' + expect(page).to have_content (/#{I18n.t('devise.failure.not_found_in_database', authentication_keys: 'email')}/i) end scenario 'a user can sign in with valid credentials' do @@ -15,13 +15,13 @@ scenario 'a user cannot sign in with a wrong email' do user = FactoryGirl.create(:user) signin('invalid@email.com', user.password) - expect(page).to have_content I18n.t 'devise.failure.not_found_in_database', authentication_keys: 'email' + expect(page).to have_content (/#{I18n.t('devise.failure.not_found_in_database', authentication_keys: 'email')}/i) end scenario 'a user cannot sign in with wrong password' do user = FactoryGirl.create(:user) signin(user.email, 'invalidpass') - expect(page).to have_content I18n.t 'devise.failure.invalid', authentication_keys: 'email' + expect(page).to have_content (/#{I18n.t('devise.failure.not_found_in_database', authentication_keys: 'email')}/i) end end
Revise sign-in, sign up specs for case-insensitivity Devise began humanizing the authentication_keys variable referenced in its default locale file in version 4.1.0. Setting specs to look for case-insensitive error messages that would contain "Email" based on authentication_key.
diff --git a/lib/mutations/outcome.rb b/lib/mutations/outcome.rb index abc1234..def5678 100644 --- a/lib/mutations/outcome.rb +++ b/lib/mutations/outcome.rb @@ -1,5 +1,7 @@ module Mutations class Outcome + attr_reader :result, :errors, :inputs + def initialize(is_success, result, errors, inputs) @success, @result, @errors, @inputs = is_success, result, errors, inputs end @@ -7,17 +9,5 @@ def success? @success end - - def result - @result - end - - def errors - @errors - end - - def inputs - @inputs - end end end
Use attr reader a bit
diff --git a/wdm.gemspec b/wdm.gemspec index abc1234..def5678 100644 --- a/wdm.gemspec +++ b/wdm.gemspec @@ -5,7 +5,7 @@ gem.email = ["maher@sallam.me"] gem.description = %q{Windows Directory Monitor (WDM) is a library which can be used to monitor directories for changes. It's mostly implemented in C and uses the Win32 API for a better performance.} gem.summary = %q{Windows Directory Monitor (WDM) is a threaded directories monitor for Windows.} - gem.homepage = "" + gem.homepage = "https://github.com/Maher4Ever/wdm" gem.files = `git ls-files`.split($\) gem.extensions = ['ext/wdm/extconf.rb'] @@ -15,5 +15,5 @@ gem.require_paths = ["lib"] gem.version = '0.0.1' - gem.add_development_dependency('rake-compiler') + gem.add_development_dependency 'rake-compiler' end
Add the repo url as the homepage for the project
diff --git a/lib/rsr_group/chunker.rb b/lib/rsr_group/chunker.rb index abc1234..def5678 100644 --- a/lib/rsr_group/chunker.rb +++ b/lib/rsr_group/chunker.rb @@ -11,11 +11,15 @@ end def add(row) - @chunk.clear if is_full? + reset if is_full? @chunk.push(row) @current_count += 1 + end + + def reset + @chunk.clear end def is_full?
Reset chunk if it's full
diff --git a/core/app/interactors/interactors/feed/index.rb b/core/app/interactors/interactors/feed/index.rb index abc1234..def5678 100644 --- a/core/app/interactors/interactors/feed/index.rb +++ b/core/app/interactors/interactors/feed/index.rb @@ -36,7 +36,7 @@ def retrieved_activities activities.below(timestamp || 'inf', - count: 11, + count: 20, reversed: true, withscores: true).compact end
Load 20 items per load
diff --git a/rack-exception_notifier.gemspec b/rack-exception_notifier.gemspec index abc1234..def5678 100644 --- a/rack-exception_notifier.gemspec +++ b/rack-exception_notifier.gemspec @@ -17,8 +17,8 @@ s.require_path = 'lib' s.add_dependency 'mail', '~> 2.5.3' - s.add_dependency 'rack', '>= 1.0' - s.add_development_dependency 'rspec', '~> 2.13' - s.add_development_dependency 'rake', '~> 10.0.3' + s.add_development_dependency 'rack', '1.5.2' + s.add_development_dependency 'rake', '10.0.4' + s.add_development_dependency 'rspec', '2.13.0' end
Move rack to a development dependency
diff --git a/rack-client.gemspec b/rack-client.gemspec index abc1234..def5678 100644 --- a/rack-client.gemspec +++ b/rack-client.gemspec @@ -18,4 +18,5 @@ s.add_development_dependency 'em-http-request' s.add_development_dependency 'typhoeus' s.add_development_dependency 'json' + s.add_development_dependency 'faraday', '>= 0.9.0.rc1' end
Add the faraday development dependency.
diff --git a/try/feature_example.rb b/try/feature_example.rb index abc1234..def5678 100644 --- a/try/feature_example.rb +++ b/try/feature_example.rb @@ -1,4 +1,4 @@-Test::Feature "Addition" do +Feature "Addition" do To "avoid silly mistakes" As "a math idiot" We "need to calculate the sum of numbers" @@ -25,7 +25,7 @@ @calculator = Calculator.new end - Given 'I have entered (((\d+))) into the calculator' do |n| + Given 'I have entered (\d+) into the calculator' do |n| @calculator.push n.to_i end @@ -33,7 +33,7 @@ @result = @calculator.add end - Then 'the result should be (((\d+))) on the screen' do |n| + Then 'the result should be (\d+) on the screen' do |n| @result.assert == n.to_i end end
Update example to reflect new match pattern. [doc]
diff --git a/test/tc_mdcodes.rb b/test/tc_mdcodes.rb index abc1234..def5678 100644 --- a/test/tc_mdcodes.rb +++ b/test/tc_mdcodes.rb @@ -8,7 +8,7 @@ require 'minitest/autorun' require File.join(File.dirname(__FILE__),'..','lib', 'adiwg-mdcodes.rb') -class TestMdcodes < MiniTest::Unit::TestCase +class TestMdcodes < Minitest::Test def test_yaml assert_silent { yaml = YAML.load_file(ADIWG::Mdcodes.getYamlPath)
Use Minitest::Test, MiniTest::Unit::TestCase is deprecated
diff --git a/config/initializers/markdown.rb b/config/initializers/markdown.rb index abc1234..def5678 100644 --- a/config/initializers/markdown.rb +++ b/config/initializers/markdown.rb @@ -1,5 +1,5 @@ MKD_RENDERER = Redcarpet::Markdown.new( - Redcarpet::Render::HTML.new(:filter_html => true), + Redcarpet::Render::HTML.new(:filter_html => true, :hard_wrap => true), :no_intra_emphasis => true, :autolink => true )
Convert newlines to br in comments
diff --git a/Casks/couchbase-server-enterprise.rb b/Casks/couchbase-server-enterprise.rb index abc1234..def5678 100644 --- a/Casks/couchbase-server-enterprise.rb +++ b/Casks/couchbase-server-enterprise.rb @@ -1,6 +1,6 @@ cask 'couchbase-server-enterprise' do version '4.1.0' - sha256 '0b8e56ce84169fd491ef70df81317f87e140784b81aff8c8b5740a3564b264cd' + sha256 '237837598a1bf663debaea5c909bce36a39fbc673139cf4d4ebc55fb5c276313' url "http://packages.couchbase.com/releases/#{version}/couchbase-server-enterprise_#{version}-macos_x86_64.zip" name 'Couchbase Server' @@ -9,5 +9,5 @@ homepage 'http://www.couchbase.com/' license :apache - app 'Couchbase Server.app' + app 'couchbase-server-enterprise_4/Couchbase Server.app' end
Fix couchbase-enterprise sha256sum & symlink path
diff --git a/lib/etsy/user.rb b/lib/etsy/user.rb index abc1234..def5678 100644 --- a/lib/etsy/user.rb +++ b/lib/etsy/user.rb @@ -6,27 +6,30 @@ # class User + def self.attribute(name, options = {}) + + from = options.fetch(:from, name) + + class_eval <<-CODE + def #{name} + @result['#{from}'] + end + CODE + end + # Find a user by username def self.find_by_username(username) response = Request.get("/users/#{username}") User.new(response.result) end + attribute :username, :from => :user_name + attribute :id, :from => :user_id + attribute :url + def initialize(result) # :nodoc: @result = result end - def username - @result['user_name'] - end - - def id - @result['user_id'] - end - - def url - @result['url'] - end - end end
Refactor attribute readers for User model
diff --git a/lib/ork/model.rb b/lib/ork/model.rb index abc1234..def5678 100644 --- a/lib/ork/model.rb +++ b/lib/ork/model.rb @@ -46,7 +46,8 @@ attributes.delete(model.__parent_key) if model.respond_to? :__parent_key model.embedding.each do |embedded| - attributes[embedded] = self.send(embedded).__persist_attributes + object = self.send(embedded) + attributes[embedded] = object.__persist_attributes unless object.nil? end attributes
Fix persistence for embedded objects not defined
diff --git a/lib/urban/cli.rb b/lib/urban/cli.rb index abc1234..def5678 100644 --- a/lib/urban/cli.rb +++ b/lib/urban/cli.rb @@ -9,7 +9,6 @@ @options = parse(args) end - # Main entry point to the CLI def run dictionary.define(@options) end @@ -18,13 +17,7 @@ @dictionary ||= Urban::Dictionary.new end - # result = args.first ? define(args.join(' ')) : random - private - # Parse options passed in from the CLI - # - # @param [Array<String>] args ARGV is the default - # @return [Object] options in a struct def parse(args) options = OpenStruct.new opts = OptionParser.new do |o|
Remove comments, this will be documented later
diff --git a/app/jobs/mailchimp_room_demand_online_job.rb b/app/jobs/mailchimp_room_demand_online_job.rb index abc1234..def5678 100644 --- a/app/jobs/mailchimp_room_demand_online_job.rb +++ b/app/jobs/mailchimp_room_demand_online_job.rb @@ -13,7 +13,7 @@ ROOM_TYPE: I18n.t("activerecord.attributes.room_demand.demand_types.#{room.demand_type}"), ROOM_TITLE: room.slogan, ROOM_URL: Rails.application.routes.url_helpers.room_demand_path(room), - ROOM_PLZS: room.districts.map(&:zip).join(", "), + ROOM_PLZ: room.districts.map(&:zip).join(", "), ROOM_CAT: room.room_categories.map(&:name).join(", "), ROOM_ID: room.id, ROOM_DATE: room.created_at
Use same field for Room PLZ
diff --git a/pagarme.rb b/pagarme.rb index abc1234..def5678 100644 --- a/pagarme.rb +++ b/pagarme.rb @@ -11,6 +11,7 @@ transaction.card_expiracy_month = "12" transaction.card_expiracy_year = "15" transaction.card_cvv = "314" + transaction.amount = 1000 transaction.charge @@ -22,6 +23,13 @@ puts chargebacked_transaction.status == transaction.status puts chargebacked_transaction.inspect + + hash_transaction = PagarMe::Transaction.new("bQQfLVIs0UB5qR28Cx3flweO5aIm9clBVJdlbgBHmKC418YVvrZR4tDBsuERitydeDqMqk6dXYWTHit4u2kHTOepqyXaKTuJVasYL6IiC0lEDhkRxcqbJeOKAAjsru4vTTP3V0XftAVwZ9ehFoGFTEZCnDFus3SSvZrY27HjOJ+VepWDzP4yq46A8n8RR9h6WhD3CmqYNSGOCvJGA5hO0j3CFQGFqcX1gQP7QUQwncEmZYVYjXG7B2W+jFTovjm/1DicmPcdHXxfHbtt7osgo/d4JYmM44BeNg6FzqSzphOuM+zceCu+Pn1QrRXJxUPi2DRSXnvz2EQjqdTyENK/hA==") + hash_transaction.amount = 1000 + + hash_transaction.charge + + puts hash_transaction.inspect rescue PagarMe::PagarMeError => e puts "Error: #{e}" end
Add test code for transaction initialized with card_hash
diff --git a/tasks/integration.rake b/tasks/integration.rake index abc1234..def5678 100644 --- a/tasks/integration.rake +++ b/tasks/integration.rake @@ -4,7 +4,7 @@ Dir.chdir("test_rails_4_app") do root = File.expand_path("../../", __FILE__) gemfiles, error_verbosity = if ENV["TRAVIS"] - [[ENV["BUNDLE_GEMFILE"]], "3"] + [[ENV["BUNDLE_GEMFILE"]], "1"] else [Dir[Pathname(File.join(root, "test_rails_4_app/gemfiles/*.gemfile")).expand_path], 0] end
Revert Error log back to level 1
diff --git a/spec/adminable/resource_spec.rb b/spec/adminable/resource_spec.rb index abc1234..def5678 100644 --- a/spec/adminable/resource_spec.rb +++ b/spec/adminable/resource_spec.rb @@ -24,6 +24,14 @@ end end + describe '#attributes' do + it 'returns attributes collection' do + expect(Adminable::Resource.new('users').attributes).to be_a( + Adminable::Attributes::Collection + ) + end + end + describe '#==' do it 'returns true for resource with same name' do expect(Adminable::Resource.new('users')).to eq(
Add spec for resource attributes method
diff --git a/lib/htmlbeautifier/parser.rb b/lib/htmlbeautifier/parser.rb index abc1234..def5678 100644 --- a/lib/htmlbeautifier/parser.rb +++ b/lib/htmlbeautifier/parser.rb @@ -32,7 +32,7 @@ end def source_so_far - @scanner.string[0..(@scanner.pos-1)] + @scanner.string[0...@scanner.pos] end def source_line_number
Use exclusive range to eliminate subtraction
diff --git a/lib/ruby/pathname_windows.rb b/lib/ruby/pathname_windows.rb index abc1234..def5678 100644 --- a/lib/ruby/pathname_windows.rb +++ b/lib/ruby/pathname_windows.rb @@ -1,6 +1,6 @@ class Pathname def relative? - @path[0] != File::SEPARATOR && @path[0] != File::ALT_SEPARATOR + @path[0] != File::SEPARATOR && @path[0] != File::ALT_SEPARATOR && !@path.match(/^[a-z]:/i) end def join(*args)
Fix relative? check on Windows
diff --git a/lib/suwabara/stored_image.rb b/lib/suwabara/stored_image.rb index abc1234..def5678 100644 --- a/lib/suwabara/stored_image.rb +++ b/lib/suwabara/stored_image.rb @@ -31,7 +31,7 @@ transform = ImageTransform.parse(transform) if transform.present? - path = Pathname.new(@storage) + path = Pathname.new(storage) path_with_transform = path.parent.join(transform.to_s, path.basename) url_for(path_with_transform)
Replace unused instance variable with method
diff --git a/test/perf/tc_derive.rb b/test/perf/tc_derive.rb index abc1234..def5678 100644 --- a/test/perf/tc_derive.rb +++ b/test/perf/tc_derive.rb @@ -0,0 +1,29 @@+require "rubygems" +require "bud" +require "fileutils" + +BENCH_LIMIT = 200 + +class TcBench + include Bud + + state do + tctable :t1, [:key] + scratch :done + end + + declare + def bench + t1 <= t1.map {|t| [t.key + 1] if t.key < BENCH_LIMIT} + done <= t1.map {|t| t if t.key >= BENCH_LIMIT} + end +end + +dir = File.dirname(__FILE__) + "/tc_tmp" +b = TcBench.new(:tc_dir => dir, :truncate => true) +b.run_bg +b.sync_do { + b.t1 <+ [[0]] +} +b.stop_bg +FileUtils.rm_r(dir)
Add simple perf benchmark for TC-backed tables.
diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index abc1234..def5678 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -2,7 +2,7 @@ class AnnouncementsController < ApplicationController before_action :verify_core - before_action :verify_admin, only: [:index, :expire] + before_action :verify_admin, only: [:expire] @markdown_renderer = Redcarpet::Markdown.new(Redcarpet::Render::HTML.new)
Allow everyone to view all announcements
diff --git a/lib/kosmos/packages/kerbal_engineer_redux.rb b/lib/kosmos/packages/kerbal_engineer_redux.rb index abc1234..def5678 100644 --- a/lib/kosmos/packages/kerbal_engineer_redux.rb +++ b/lib/kosmos/packages/kerbal_engineer_redux.rb @@ -1,8 +1,19 @@ class KerbalEngineerRedux < Kosmos::Package title 'Kerbal Engineer Redux' + aliases 'ker' url 'http://kerbal.curseforge.com/plugins/220285-kerbal-engineer-redux' def install merge_directory 'Engineer', into: 'GameData' end end + +class KerbalEngineerReduxPatch < Kosmos::Package + title 'Kerbal Engineer Redux - Patch for KSP 0.23.5' + aliases 'ker patch', 'kerbal engineer redux patch' + url 'https://www.dropbox.com/s/2b1d225vunp55ko/kerdlls.zip' + + def install + merge_directory '.', into: 'GameData/Engineer' + end +end
Add patches and aliases for Kerbal Engineer Redux.
diff --git a/app/controllers/diary_entries_controller.rb b/app/controllers/diary_entries_controller.rb index abc1234..def5678 100644 --- a/app/controllers/diary_entries_controller.rb +++ b/app/controllers/diary_entries_controller.rb @@ -1,9 +1,5 @@ class DiaryEntriesController < MyplaceonlineController protected - def insecure - true - end - def sorts ["diary_entries.diary_time DESC"] end
Make diary entries secure by default