diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/spec/support/login_macro.rb b/spec/support/login_macro.rb index abc1234..def5678 100644 --- a/spec/support/login_macro.rb +++ b/spec/support/login_macro.rb @@ -2,8 +2,8 @@ def login_with(user) visit '/sessions/new' within("form") do - fill_in 'session_name', :with => exists_user.name - fill_in 'session_password', :with => exists_user.password + fill_in 'session_name', :with => user.name + fill_in 'session_password', :with => user.password end click_button I18n.t("terms.sign_in") end
Use argument value instead of `let` value
diff --git a/lib/email_assessor.rb b/lib/email_assessor.rb index abc1234..def5678 100644 --- a/lib/email_assessor.rb +++ b/lib/email_assessor.rb @@ -18,6 +18,6 @@ file_name ||= "" domain = domain.downcase - File.open(file_name).each_line.any? { |line| domain =~ %r{\A(.*\.)*#{line.chomp}\z}i } + File.open(file_name).each_line.any? { |line| domain =~ %r{\A(?:.+\.)*?#{line.chomp}\z}i } end end
Make regex group non capturing
diff --git a/config/initializers/delayed_job_config.rb b/config/initializers/delayed_job_config.rb index abc1234..def5678 100644 --- a/config/initializers/delayed_job_config.rb +++ b/config/initializers/delayed_job_config.rb @@ -24,3 +24,4 @@ # ActiveRecord::Base.logger = Delayed::Worker.logger # Rails.logger = Delayed::Worker.logger # end +Delayed::Worker.max_run_time = 8.hours
Adjust the max run time to 8 hours
diff --git a/Casks/model-boiler.rb b/Casks/model-boiler.rb index abc1234..def5678 100644 --- a/Casks/model-boiler.rb +++ b/Casks/model-boiler.rb @@ -0,0 +1,13 @@+cask 'model-boiler' do + version '2.1.2' + sha256 '8169af020a1354ee1ee688da28d5dcde741e342dff73ab17a1fa94dcfa7d4d1e' + + url "https://github.com/nodes-ios/ModelBoiler/releases/download/#{version}/Model.Boiler.app.zip" + appcast 'https://github.com/nodes-ios/ModelBoiler/releases.atom', + checkpoint: '9f66dbb98f73f69f4a1759d4bdb8d2552060d599548427740e239ca45185fe5c' + name 'ModelBoiler' + homepage 'https://github.com/nodes-ios/ModelBoiler' + license :mit + + app 'Model Boiler.app' +end
Add Model Boiler cask v2.1.2
diff --git a/lib/gon/watch.rb b/lib/gon/watch.rb index abc1234..def5678 100644 --- a/lib/gon/watch.rb +++ b/lib/gon/watch.rb @@ -25,7 +25,7 @@ variable = {} @watch_variables ||= {} env = Gon::Request.env - variable['url'] = env['ORIGINAL_FULLPATH'] + variable['url'] = env['ORIGINAL_FULLPATH'] || env['REQUEST_URI'] variable['method'] = env['REQUEST_METHOD'] variable['name'] = name
Fix for empty original fullpath
diff --git a/Casks/phpstorm-eap.rb b/Casks/phpstorm-eap.rb index abc1234..def5678 100644 --- a/Casks/phpstorm-eap.rb +++ b/Casks/phpstorm-eap.rb @@ -1,7 +1,7 @@ class PhpstormEap < Cask - url 'http://download.jetbrains.com/webide/PhpStorm-EAP-138.1161.dmg' + url 'http://download.jetbrains.com/webide/PhpStorm-EAP-138.1289.dmg' homepage 'http://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Early+Access+Program' - version '138.1161' - sha256 '81d8ff642965a00b59b09924363a6a376ca705a7a09f42de6541bcd8739b413c' + version '138.1289' + sha256 'ee693ae0ffb60dc71a324fecd40a14597e307ad3c7be3644509e75180da4abe6' link 'PhpStorm EAP.app' end
Update PHPStorm EAP to 138.1289
diff --git a/Casks/phpstorm-eap.rb b/Casks/phpstorm-eap.rb index abc1234..def5678 100644 --- a/Casks/phpstorm-eap.rb +++ b/Casks/phpstorm-eap.rb @@ -1,6 +1,6 @@ cask :v1 => 'phpstorm-eap' do - version '139.873' - sha256 '8405a198ee9720e05f0b589367514ae4b86bb28064cd7d2a9cc9a015b30a53c3' + version '139.1226' + sha256 '7f9e55d3f5070fb5869eb7053566f21067600d11f93435074fad9cf399ea1626' url "http://download.jetbrains.com/webide/PhpStorm-EAP-#{version}.dmg" homepage 'http://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Early+Access+Program'
Update PhpStorm EAP Cask to v139.1226
diff --git a/lib/hotchkiss.rb b/lib/hotchkiss.rb index abc1234..def5678 100644 --- a/lib/hotchkiss.rb +++ b/lib/hotchkiss.rb @@ -1,3 +1,4 @@+require 'hotchkiss/version' require 'hotchkiss/router' require 'hotchkiss/controller' require 'hotchkiss/fast_responder'
Fix require issue at server start
diff --git a/lib/syoboemon.rb b/lib/syoboemon.rb index abc1234..def5678 100644 --- a/lib/syoboemon.rb +++ b/lib/syoboemon.rb @@ -1,17 +1,24 @@ $:.unshift File.dirname(__FILE__) -# gems +# ruby gems require 'rubygems' require 'faraday' require 'happymapper' -# syoboemon files -require "syoboemon/version" -require "syoboemon/client" -require "syoboemon/connector" -require "syoboemon/query_builder/base" -require "syoboemon/query_builder/program_basic_data" +# syoboemon ruby files +# version file +require "./syoboemon/version" +# Syoboemon::Client class +require "./syoboemon/client" +# Syoboemon::Connector +require "./syoboemon/connector" +# Syoboemon::QueryBuilder module +require "./syoboemon/query_builder/base" +require "./syoboemon/query_builder/program_basic_data" +require "./syoboemon/query_builder/voice_actors_list" +# Syoboemon::Parser module +require "./syoboemon/parser/base" module Syoboemon - # Your code goes here... + end
Add file names to require ruby file list
diff --git a/util.rb b/util.rb index abc1234..def5678 100644 --- a/util.rb +++ b/util.rb @@ -1,6 +1,7 @@ module Util def self.ago_in_words(time1, time2) diff = time1.to_i - time2.to_i + ago = '' if diff == 1 ago = "#{diff} second ago" @@ -9,19 +10,19 @@ elsif diff < 120 ago = "a minute ago" elsif diff < 3600 - ago = "#{diff.to_i / 60} minutes ago" + ago = "#{(diff / 60).to_i} minutes ago" elsif diff < 7200 ago = "an hour ago" elsif diff < 86400 - ago = "#{diff.to_i / 3600} hours ago" + ago = "#{(diff / 3600).to_i} hours ago" elsif diff < 172800 ago = "yesterday" elsif diff < 604800 - ago = "#{diff.to_i / 86400} days ago" + ago = "#{(diff / 86400).to_i} days ago" elsif diff < 1209600 ago = "last week" else - ago = "#{diff.to_i / 604800} weeks ago" + ago = "#{(diff / 604800).to_i} weeks ago" end ago end
Make the time output look a little better than something non-sensical
diff --git a/lib/blacklight_cornell_requests/oracle_connection.rb b/lib/blacklight_cornell_requests/oracle_connection.rb index abc1234..def5678 100644 --- a/lib/blacklight_cornell_requests/oracle_connection.rb +++ b/lib/blacklight_cornell_requests/oracle_connection.rb @@ -0,0 +1,14 @@+module BlacklightCornellRequests + + # This is based on the OracleConnection class from cornell-voyager-backend + class OracleConnection + + def initialize(user, password, service) + @connection = OCI8.new(user, password, service) + @connection.prefetch_rows(1000) + end + + + end + +end
Add OracleConnection class for future use
diff --git a/lib/cramp/generators/templates/application/config.ru b/lib/cramp/generators/templates/application/config.ru index abc1234..def5678 100644 --- a/lib/cramp/generators/templates/application/config.ru +++ b/lib/cramp/generators/templates/application/config.ru @@ -5,6 +5,9 @@ if <%= app_const %>.env == 'development' require 'async-rack' use AsyncRack::CommonLogger + + # Enable code reloading on every request + use Rack::Reloader, 0 end # Running thin :
Use Rack::Reloader in dev mode
diff --git a/lib/pv/bug_tracker.rb b/lib/pv/bug_tracker.rb index abc1234..def5678 100644 --- a/lib/pv/bug_tracker.rb +++ b/lib/pv/bug_tracker.rb @@ -2,18 +2,26 @@ module Pv class BugTracker - def initialize with_username, and_password + attr_reader :username, :password, :token + + def initialize with_username=nil, and_password=nil + @username = with_username || Pv.config.username + @password = and_password || Pv.config.password + @token = PivotalTracker::Client.token(username, password) + PivotalTracker::Client.use_ssl = true - @token = PivotalTracker::Client.token(with_username, and_password) end def connected? @token != nil end - def stories for_project_id, and_full_name - project = PivotalTracker::Project.all.select { |p| p.id == for_project_id }.first - project.stories.all(owned_by: and_full_name) + def stories for_project_id=nil, and_full_name=nil + project_id = for_project_id || Pv.config.project_id + user = and_full_name || Pv.config.name + + project = PivotalTracker::Project.all.select { |p| p.id == project_id }.first + project.stories.all(owned_by: user) end end end
Refactor BugTracker to also read from file configuration
diff --git a/lib/routes/content.rb b/lib/routes/content.rb index abc1234..def5678 100644 --- a/lib/routes/content.rb +++ b/lib/routes/content.rb @@ -10,8 +10,13 @@ delete '/content' do begin require_authentication - raw_result = find_result_by_link(params["link"]) - delete_result_from_index(raw_result) + Clusters.active.map do |cluster| + search_config = SearchConfig.instance(cluster) + raw_result = find_result_by_link(params["link"], search_config) + index = search_config.search_server.index(raw_result['real_index_name']) + index.delete(raw_result['_id']) + end + json_result 204, "Deleted the link from search index" rescue SearchIndices::IndexLocked json_result 423, "The index is locked. Please try again later." @@ -20,12 +25,8 @@ private - def index - SearchConfig.default_instance.content_index - end - - def find_result_by_link(link) - raw_result = index.get_document_by_link(link) + def find_result_by_link(link, search_config = SearchConfig.default_instance) + raw_result = search_config.content_index.get_document_by_link(link) unless raw_result halt 404, "No document found with link #{link}." @@ -33,9 +34,4 @@ raw_result end - - def delete_result_from_index(raw_result) - index = search_server.index(raw_result['real_index_name']) - index.delete(raw_result['_id']) - end end
Delete results from all clusters
diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb index abc1234..def5678 100644 --- a/test/controllers/users_controller_test.rb +++ b/test/controllers/users_controller_test.rb @@ -0,0 +1,16 @@+require 'test_helper' + +class UsersControllerTest < ActionDispatch::IntegrationTest + setup do + stub_notifications_request + @user = users(:andrew) + end + + test 'should update user' do + sign_in_as(@user) + patch user_url(@user), params: {user: { personal_access_token: '12345'}} + @user.reload + assert_equal '12345', @user.personal_access_token + end + +end
Add test for updating personal access token
diff --git a/lib/stylus/railtie.rb b/lib/stylus/railtie.rb index abc1234..def5678 100644 --- a/lib/stylus/railtie.rb +++ b/lib/stylus/railtie.rb @@ -9,22 +9,23 @@ config.app_generators.stylesheet_engine :stylus - initializer :setup_stylus, :after => 'sprockets.environment', :group => :all do |app| + initializer 'stylus.register', :after => 'sprockets.environment', :group => :all do |app| if app.config.assets.enabled app.assets.register_engine '.styl', Tilt::StylusTemplate app.assets.register_preprocessor 'text/css', Stylus::ImportProcessor end end - # After initialization block to inspect the `Sprockets` configuration + # Initializer block to inspect the `Sprockets` configuration # And reflect it on the `Stylus` module; # It also includes the `Rails` asset load path into `Stylus` so any # `.styl` file inside it can be imported by the `Stylus` API. - config.after_initialize do |app| - if app.config.assets.enabled - Stylus.compress = app.config.assets.compress - Stylus.debug = app.config.assets.debug - Stylus.paths.concat app.assets.paths + initializer 'stylus.config', :after => :append_assets_path, :group => :all do |app| + sprockets = app.config.assets + if sprockets.enabled + Stylus.compress = sprockets.compress + Stylus.debug = sprockets.debug + Stylus.paths.concat sprockets.paths end end end
Rewrite the after_initialize block as an initializer to append paths properly.
diff --git a/bin/recog_verify.rb b/bin/recog_verify.rb index abc1234..def5678 100644 --- a/bin/recog_verify.rb +++ b/bin/recog_verify.rb @@ -37,7 +37,7 @@ if ARGV.empty? $stderr.puts 'Missing XML fingerprint files' puts option_parser - exit + exit(1) end ARGV.each do |file|
Exit non-zero if the arguments are wrong
diff --git a/lib/tasks/resque.rake b/lib/tasks/resque.rake index abc1234..def5678 100644 --- a/lib/tasks/resque.rake +++ b/lib/tasks/resque.rake @@ -14,6 +14,8 @@ if time_running > max_time_running w.unregister_worker end + + Resque.workers.each { |w| w.unregister_worker unless w.working? } end end
Clear working workers count in Resque Resque will show something like "2 of 356 Workers Working" which is clearly false. This will clear that count, back to sane numbers.
diff --git a/spec/models/menu_spec.rb b/spec/models/menu_spec.rb index abc1234..def5678 100644 --- a/spec/models/menu_spec.rb +++ b/spec/models/menu_spec.rb @@ -11,6 +11,9 @@ describe 'Associations' do it { is_expected.to have_and_belong_to_many :menu_items } + it 'join table should have unique index' do + ActiveRecord::Migration.index_exists?(:menu_items_menus, [:menu_id, :menu_item_id], unique: true) + end end describe 'Database schema' do
Add test for join table index Conflicts: spec/models/menu_spec.rb
diff --git a/spec/tesla/model_spec.rb b/spec/tesla/model_spec.rb index abc1234..def5678 100644 --- a/spec/tesla/model_spec.rb +++ b/spec/tesla/model_spec.rb @@ -1,7 +1,14 @@ require File.join(File.dirname(__FILE__), '..', 'spec_helper') describe Tesla::Model do - it "should fail" do - flunk "fail!" + + describe "persistably included" do + before do + class ::Egg; include Tesla::Model end + end + + it "should pass along persistability" do + ::Egg.maglev_persistable?.must_equal true + end end end
Add basic spec for persistability on class
diff --git a/rails/app/controllers/application_controller.rb b/rails/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/rails/app/controllers/application_controller.rb +++ b/rails/app/controllers/application_controller.rb @@ -4,6 +4,11 @@ protect_from_forgery with: :exception before_action :ensure_signed_in helper_method :user, :sign_in, :sign_out, :signed_in?, :eva + + Octokit.configure do |c| + c.api_endpoint = "http://gits-15.sys.kth.se/api/v3/" + c.web_endpoint = "http://gits-15.sys.kth.se" + end def user if session[:user_id]
Switch to KTH Github endpoint
diff --git a/lib/vhdl_connector.rb b/lib/vhdl_connector.rb index abc1234..def5678 100644 --- a/lib/vhdl_connector.rb +++ b/lib/vhdl_connector.rb @@ -10,11 +10,13 @@ require "vhdl_connector/port_wrapper" module VhdlConnector - def parse_entity(vhdl_str) - EntityWrapper.new(VHDL_Parser.parse(vhdl_str)) - end + class << self + def parse_entity(vhdl_str) + EntityWrapper.new(VHDL_Parser.parse(vhdl_str)) + end - def parse_entity_file(path) - EntityWrapper.new(VHDL_Parser.parse_file(path)) + def parse_entity_file(path) + EntityWrapper.new(VHDL_Parser.parse_file(path)) + end end end
Move top module method to uniq class method
diff --git a/app/controllers/api/v1/sessions_controller.rb b/app/controllers/api/v1/sessions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/v1/sessions_controller.rb +++ b/app/controllers/api/v1/sessions_controller.rb @@ -3,7 +3,7 @@ def create @user = User.find_by username: user_params[:username] if @user.present? && @user.authenticate(user_params[:password]) - render json: { notice: t('session.flash.create.success'), api_key: @user.api_key } + render else render json: { error: t('session.flash.create.failure'), status: :unprocessable_entity } end
Send full user for api login
diff --git a/app/controllers/connection_logs_controller.rb b/app/controllers/connection_logs_controller.rb index abc1234..def5678 100644 --- a/app/controllers/connection_logs_controller.rb +++ b/app/controllers/connection_logs_controller.rb @@ -3,14 +3,19 @@ def create if ConnectionLogsController.key == params[:key] - domain = ActiveRecord::Base.transaction do - domain = Domain.find_by(name: params[:host]) - if domain.nil? + + domain = Domain.find_by(name: params[:host]) + if domain.nil? + # In case another thread has created a record between the find above and + # the create below we put an extra guard around it + begin domain = Domain.create!(name: params[:host]) - UpdateDomainWorker.perform_async(domain.id) + rescue ActiveRecord::RecordNotUnique + domain = Domain.find_by(name: params[:host]) end - domain + UpdateDomainWorker.perform_async(domain.id) end + domain ConnectionLog.create!( ip_address: params[:ip_address], domain_id: domain.id
Remove transaction to try to remedy "Deadlock found when trying to get lock; try restarting transaction" Replace with a simpler scheme that just retries
diff --git a/lib/helpers/number_formatter.rb b/lib/helpers/number_formatter.rb index abc1234..def5678 100644 --- a/lib/helpers/number_formatter.rb +++ b/lib/helpers/number_formatter.rb @@ -8,6 +8,10 @@ "%.1f%c" % [(self.to_f / 1000 ** exp).round(1), suffix[exp-1]] end end + + def with_commas + self.to_s.reverse.gsub(/...(?=.)/,'\&,').reverse + end end class Numeric
Add with_commas method to NumberFormatter module
diff --git a/chef/lib/chef/run_list/versioned_recipe_list.rb b/chef/lib/chef/run_list/versioned_recipe_list.rb index abc1234..def5678 100644 --- a/chef/lib/chef/run_list/versioned_recipe_list.rb +++ b/chef/lib/chef/run_list/versioned_recipe_list.rb @@ -1,6 +1,7 @@ # # Author:: Stephen Delano (<stephen@opscode.com>) -# Copyright:: Copyright (c) 2010 Opscode, Inc. +# Author:: Seth Falcon (<seth@opscode.com>) +# Copyright:: Copyright 2010 Opscode, Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,6 +15,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +require 'chef/version_class' class Chef class RunList @@ -26,7 +28,7 @@ def add_recipe(name, version=nil) if version && @versions.has_key?(name) - unless Gem::Version.new(@versions[name]) == Gem::Version.new(version) + unless Chef::Version.new(@versions[name]) == Chef::Version.new(version) raise Chef::Exceptions::RecipeVersionConflict, "Run list requires recipe #{name} at versions #{@versions[name]} and #{version}" end end @@ -39,4 +41,4 @@ end end end -end+end
Use Chef::Version in VersionedRecipeList CHEF-1818
diff --git a/bumbleworks.gemspec b/bumbleworks.gemspec index abc1234..def5678 100644 --- a/bumbleworks.gemspec +++ b/bumbleworks.gemspec @@ -20,4 +20,7 @@ spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" + spec.add_runtime_dependency "ruote" + spec.add_runtime_dependency "ruote-redis" + spec.add_runtime_dependency "ruote-sequel" end
Add puntine dependance on ruote, ruote-redis and ruote-sequel
diff --git a/bundler_ext.gemspec b/bundler_ext.gemspec index abc1234..def5678 100644 --- a/bundler_ext.gemspec +++ b/bundler_ext.gemspec @@ -20,4 +20,5 @@ s.requirements = ['Install the linux_admin gem and set BEXT_ACTIVATE_VERSIONS to true to activate rpm/deb installed gems'] s.add_development_dependency('rspec', '>=1.3.0') + s.add_development_dependency('rake', '>= 12', '< 14') end
Add rake as a development dependency
diff --git a/lib/rack_tracker/plugins/dsl.rb b/lib/rack_tracker/plugins/dsl.rb index abc1234..def5678 100644 --- a/lib/rack_tracker/plugins/dsl.rb +++ b/lib/rack_tracker/plugins/dsl.rb @@ -8,8 +8,8 @@ def initialize plugin_name, &block @@currently_defining = plugin_name + eval define_plugin_module plugin_name, &block yield Rack::Tracker::DSL - eval define_plugin_module plugin_name, &block end class << self
Define the plugin name before yielding the block
diff --git a/spec/controllers/collections_controller_spec.rb b/spec/controllers/collections_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/collections_controller_spec.rb +++ b/spec/controllers/collections_controller_spec.rb @@ -0,0 +1,30 @@+require 'spec_helper' + +describe CollectionsController do + + let(:user) {User.create!(first_name: 'John', last_name: "Doe", username: "john123", password: 'password ' )} + let(:game) {Game.create!(name: 'Test Game', description: 'blahblahblah', release_year: 1984)} + + def add_game_to_collection + post :create, user_id: user.id, game_id: game.id + end + + describe "create" do + + it "adds a game to user's collection" do + add_game_to_collection + expect(user.games.last).to eq(game) + end + + it "redirects to the root page" do + add_game_to_collection + expect(response).to redirect_to(root_path) + end + end + + # describe "destroy" do + # it "deletes a game from a user's collection" do + # end + # end + +end
Add rspec tests for collections controller
diff --git a/cleaner.rb b/cleaner.rb index abc1234..def5678 100644 --- a/cleaner.rb +++ b/cleaner.rb @@ -5,6 +5,7 @@ self.rename_file file, path else puts file + " is a folder" + self.clean_folder file end end "Cleaned files in folder: " + path
Make clean folder recursive so that it clears an entire tree of files
diff --git a/hashtel.gemspec b/hashtel.gemspec index abc1234..def5678 100644 --- a/hashtel.gemspec +++ b/hashtel.gemspec @@ -15,7 +15,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_development_dependency "bundler", "~> 1.5" + spec.add_development_dependency "bundler", "~> 2.2" spec.add_development_dependency "rspec" spec.add_development_dependency "rake" end
Update bundler requirement from ~> 1.5 to ~> 2.2 Updates the requirements on [bundler](https://github.com/rubygems/rubygems) to permit the latest version. - [Release notes](https://github.com/rubygems/rubygems/releases) - [Changelog](https://github.com/rubygems/rubygems/blob/master/bundler/CHANGELOG.md) - [Commits](https://github.com/rubygems/rubygems/compare/v1.5.0...bundler-v2.2.0) Signed-off-by: dependabot[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@github.com>
diff --git a/spec/penguin_spec.rb b/spec/penguin_spec.rb index abc1234..def5678 100644 --- a/spec/penguin_spec.rb +++ b/spec/penguin_spec.rb @@ -5,13 +5,8 @@ describe Penguin do include Rack::Test::Methods - let(:middleware) { - Penguin::Middleware.new( - lambda { |env| ['200', {'Content-Type' => 'text/html'}, ["Hey!\n"]] }, - {limit: 20}) - } - - let(:app) { Rack::Lint.new(middleware) } + let(:rack_app) { lambda { |env| ['200', {'Content-Type' => 'text/html'}, ["Hey!\n"]] } } + let(:app) { Rack::Lint.new(Penguin::Middleware.new(rack_app, {limit: 20})) } before(:each) { get '/' } @@ -30,7 +25,9 @@ end it 'prevents access when limit exceeded' do - 20.times { get '/' } + 19.times { get '/' } + expect(rack_app).not_to receive(:call) + get '/' expect(last_response.status).to eq(429) end end
Test app is not called when limit exceeded
diff --git a/app/helpers/schema_org_helper.rb b/app/helpers/schema_org_helper.rb index abc1234..def5678 100644 --- a/app/helpers/schema_org_helper.rb +++ b/app/helpers/schema_org_helper.rb @@ -1,17 +1,17 @@ module SchemaOrgHelper def meta_person_schema_url - 'http://schema.org/Person' + 'https://schema.org/Person' end def meta_address_schema_url - 'http://schema.org/Address' + 'https://schema.org/Address' end def meta_article_schema_url - 'http://schema.org/TechArticle' + 'https://schema.org/TechArticle' end def meta_comment_schema_url - 'http://schema.org/Comment' + 'https://schema.org/Comment' end end
Use HTTPS for schema.org requests
diff --git a/db/migrate/20131216190859_add_integration_id.rb b/db/migrate/20131216190859_add_integration_id.rb index abc1234..def5678 100644 --- a/db/migrate/20131216190859_add_integration_id.rb +++ b/db/migrate/20131216190859_add_integration_id.rb @@ -0,0 +1,48 @@+class AddIntegrationId < ActiveRecord::Migration + tag :predeploy + disable_ddl_transaction! + + def self.up + add_column :pseudonyms, :integration_id, :string + add_column :course_sections, :integration_id, :string + add_column :courses, :integration_id, :string + add_column :enrollment_terms, :integration_id, :string + add_column :accounts, :integration_id, :string + + add_index :pseudonyms, [:integration_id, :account_id], + unique: true, algorithm: :concurrently, + name: "index_pseudonyms_on_integration_id", + where: "integration_id IS NOT NULL" + add_index :course_sections, [:integration_id, :root_account_id], + unique: true, algorithm: :concurrently, + name: "index_sections_on_integration_id", + where: "integration_id IS NOT NULL" + add_index :courses, [:integration_id, :root_account_id], + unique: true, algorithm: :concurrently, + name: "index_courses_on_integration_id", + where: "integration_id IS NOT NULL" + add_index :enrollment_terms, [:integration_id, :root_account_id], + unique: true, algorithm: :concurrently, + name: "index_terms_on_integration_id", + where: "integration_id IS NOT NULL" + add_index :accounts, [:integration_id, :root_account_id], + unique: true, algorithm: :concurrently, + name: "index_accounts_on_integration_id", + where: "integration_id IS NOT NULL" + + end + + def self.down + remove_index :pseudonyms, name: "index_pseudonyms_on_integration_id" + remove_index :course_sections, name: "index_sections_on_integration_id" + remove_index :courses, name: "index_courses_on_integration_id" + remove_index :enrollment_terms, name: "index_terms_on_integration_id" + remove_index :accounts, name: "index_accounts_on_integration_id" + + remove_column :pseudonyms, :integration_id + remove_column :course_sections, :integration_id + remove_column :courses, :integration_id + remove_column :enrollment_terms, :integration_id + remove_column :accounts, :integration_id + end +end
Add integration_id to SIS models An integration_id can be used in a way similar to sis_source_id in that it documents a 3rd party identifier for a particular object. The reason we use an integration_id instead of a sis_source_id for some SIS integrations is that there is BOTH a sis_source_id and another id that is used (as in the case of SIF) to ferry information between systems. Models that have an integration_id now include: - pseudonyms - course_sections - courses - enrollment_terms - accounts Test Plan: - make sure the above tables have an integration_id column after "rake db:migrate" Fixes SIS-107 Change-Id: I80a03d7384fc6ff243436bdf18798ece5059acb7 Reviewed-on: https://gerrit.instructure.com/27593 Reviewed-by: Cody Cutrer <c4fe2b1d90ef8f2548c8aeabfa633434316f0305@instructure.com> Reviewed-by: Ken Romney <4369dabf8e7d5ba636f3ef79948e6ca3ce23a99f@instructure.com> Tested-by: Jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@instructure.com> Reviewed-by: Brian Palmer <3cb4e1df5ec4da2c7c4af7c52cec8cf340a55a10@instructure.com> Product-Review: Duane Johnson <0a02221ea64f4c9685145b5f44cf84715b4a8bb5@instructure.com> QA-Review: Duane Johnson <0a02221ea64f4c9685145b5f44cf84715b4a8bb5@instructure.com>
diff --git a/app/models/project_suggestion.rb b/app/models/project_suggestion.rb index abc1234..def5678 100644 --- a/app/models/project_suggestion.rb +++ b/app/models/project_suggestion.rb @@ -9,8 +9,8 @@ end def pending - (repository_url.present? && repository_url != project.repository_url) || - (licenses.present? && licenses != project.licenses) || - (status.present? && status != project.status) + (repository_url.present? && repository_url != project.try(:repository_url)) || + (licenses.present? && licenses != project.try(:licenses)) || + (status.present? && status != project.try(:status)) end end
Handle deleted projects when filtering suggestions
diff --git a/kato-cli.gemspec b/kato-cli.gemspec index abc1234..def5678 100644 --- a/kato-cli.gemspec +++ b/kato-cli.gemspec @@ -8,8 +8,9 @@ spec.version = Kato::Cli::VERSION spec.authors = ["Tom McDonald"] spec.email = ["tommcdo@gmail.com"] - spec.summary = %q{CLI client for posting to kato.im rooms} - spec.homepage = "" + spec.summary = %q{Kato.im CLI tool} + spec.description = %q{A simple command line tool for posting messages in kato.im chat rooms} + spec.homepage = "http://tommcdo.com" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0")
Update gemspec with more detail
diff --git a/app/views/feeds/show.xml.builder b/app/views/feeds/show.xml.builder index abc1234..def5678 100644 --- a/app/views/feeds/show.xml.builder +++ b/app/views/feeds/show.xml.builder @@ -14,10 +14,10 @@ xml.guid "http://" + request.host_with_port + "/articles/#{article.id}" xml.description do if article.authors_list - xml << "<p>#{article.authors_list}</p>" + xml << "<p style=\"font-weight: bold\">#{article.authors_list}</p>" end if article.attributes['section'] - xml << "<p>#{article.attributes['section']}</p>" + xml << "<p style=\"font-weight: bold\">#{article.attributes['section']}</p>" end xml << markdown(article.bodytext) end
Make RSS feed author list and section bold.
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,6 +1,10 @@ module ApplicationHelper def phone_to(number) - link_to number, "tel:#{number}" + if number.nil? + return "" + else + link_to number, "tel:#{number}" + end end def sortable(column, title=nil)
Remove ':tel' display on member page when nil Added logic to application_helper to check if phone value is nil and remove ':tel' display value
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,7 +1,15 @@ module ApplicationHelper module AuthorizeHelper def client - @client ||= Instagram.client + unless @client + if authenticated? + @client = Instagram.client access_token: session[:access_token] + else + @client = Instagram.client + end + end + + @client end def authenticated?
Change client method to return authorized client when authenticated.
diff --git a/icepick.gemspec b/icepick.gemspec index abc1234..def5678 100644 --- a/icepick.gemspec +++ b/icepick.gemspec @@ -20,7 +20,7 @@ gem.add_runtime_dependency 'awesome_print', '~> 1.2' gem.add_runtime_dependency 'colorize', '~> 0.7' gem.add_runtime_dependency 'pry', '~> 0.10' - gem.add_runtime_dependency 'pry-byebug', '~> 2.0' + gem.add_runtime_dependency 'pry-byebug', '~> 3.1.0' gem.add_runtime_dependency 'pry-doc', '~> 0.6' gem.add_runtime_dependency 'pry-docmore', '~> 0.1' gem.add_runtime_dependency 'pry-rescue', '~> 1.4'
Update byebug to latest and greatest
diff --git a/app/helpers/import_task_report.rb b/app/helpers/import_task_report.rb index abc1234..def5678 100644 --- a/app/helpers/import_task_report.rb +++ b/app/helpers/import_task_report.rb @@ -6,17 +6,9 @@ @models_for_report = models_for_report end - def humanize_class_name(klass) - klass.to_s.pluralize.underscore.humanize - end - - def humanize_count(count) - ActionController::Base.helpers.number_with_delimiter(count, delimiter: ',') - end - def initial_counts_report models_for_report.map do |klass| - "* #{humanize_class_name(klass).capitalize}: #{humanize_count(klass.count)}" + count_report_for_class(klass) end end @@ -35,8 +27,29 @@ def end_of_task_report_for_klass(klass, initial_count) klass_diff = klass.count - initial_count - diff_sign = klass_diff >= 0 ? '+' : '-' - "* #{humanize_class_name(klass).capitalize}: #{humanize_count(klass.count)} (#{diff_sign}#{humanize_count(klass_diff)})" + count_report_for_class(klass) + diff_report_for_class(klass_diff) + end + + private + + def count_report_for_class(klass) + "* #{humanize_class_name(klass).capitalize}: #{humanize_count(klass.count)} " + end + + def diff_report_for_class(klass_diff) + "(#{diff_sign(klass_diff)}#{humanize_count(klass_diff)})" + end + + def diff_sign(klass_diff) + klass_diff >= 0 ? '+' : '-' + end + + def humanize_class_name(klass) + klass.to_s.pluralize.underscore.humanize + end + + def humanize_count(count) + ActionController::Base.helpers.number_with_delimiter(count, delimiter: ',') end end
Define private interface for import task report
diff --git a/lib/persistence/article_service.rb b/lib/persistence/article_service.rb index abc1234..def5678 100644 --- a/lib/persistence/article_service.rb +++ b/lib/persistence/article_service.rb @@ -4,9 +4,7 @@ end def fetch(id) - article = @db[:articles].where(:id => id).first - article[:category] = CategoryService.new(@db).fetch(article[:category_id])[:name] - article + @db[:articles].where(:id => id).first end def fetch_all
Remove useless category lookup in ArticleService
diff --git a/lib/ppcurses/form/input_element.rb b/lib/ppcurses/form/input_element.rb index abc1234..def5678 100644 --- a/lib/ppcurses/form/input_element.rb +++ b/lib/ppcurses/form/input_element.rb @@ -11,7 +11,13 @@ end def show(screen) + # Show Label screen.addstr("#{@label}: ") + + # Show input value + screen.attron(A_UNDERLINE) + screen.addstr(''.ljust(@size)) + screen.attroff(A_UNDERLINE) end end
Add input value portion scaffolding.
diff --git a/lib/protobuf/field/varint_field.rb b/lib/protobuf/field/varint_field.rb index abc1234..def5678 100644 --- a/lib/protobuf/field/varint_field.rb +++ b/lib/protobuf/field/varint_field.rb @@ -21,14 +21,6 @@ def self.default 0 - end - - def self.decode(bytes) - value = 0 - bytes.each_with_index do |byte, index| - value |= byte << (7 * index) - end - value end def self.encode(value)
Remove unused VarintField.decode method (handled by Decoder)
diff --git a/clock.rb b/clock.rb index abc1234..def5678 100644 --- a/clock.rb +++ b/clock.rb @@ -30,11 +30,16 @@ # This only really needs to run once an hour, but no harm comes # from running it more frequently, so let's try several times an # hour to avoid problems + # + # N.B.: If this becomes too heavyweight, we may want to pull it + # out into its own Procfile entry instead of using Clockwork schedule_time = Time.now resolver = Transferatu::ScheduleResolver.new processor = Transferatu::ScheduleProcessor.new(resolver) manager = Transferatu::ScheduleManager.new(processor) + logger.log "Starting scheduled transfers for #{scheduled_time}" manager.run_schedules(scheduled_time) + logger.log "Finished scheduled transfers for #{scheduled_time}" end every(4.hours, "mark-restart") do
Add logging to scheduled transfer invocation
diff --git a/history_book.gemspec b/history_book.gemspec index abc1234..def5678 100644 --- a/history_book.gemspec +++ b/history_book.gemspec @@ -8,6 +8,7 @@ s.authors = ['John Downey'] s.email = ['jdowney@gmail.com'] s.homepage = 'http://github.com/jtdowney/history_book' + s.license = 'MIT' s.summary = %q{HistoryBook is a ruby implementation of the event sourcing pattern.} s.description = %q{This library provides an interface for event sourcing over a pluggable back end data store. Currently it supports the Sequel gem and its data stores as well as an in-memory data store for testing.}
Add MIT license to gemspec
diff --git a/spec/unit/concurrent/synchronized_sorted_set_spec.rb b/spec/unit/concurrent/synchronized_sorted_set_spec.rb index abc1234..def5678 100644 --- a/spec/unit/concurrent/synchronized_sorted_set_spec.rb +++ b/spec/unit/concurrent/synchronized_sorted_set_spec.rb @@ -3,30 +3,32 @@ describe Bunny::Concurrent::SynchronizedSortedSet do it "synchronizes common operations needed by Bunny" do - subject.length.should == 0 + s = described_class.new + s.length.should == 0 10.times do Thread.new do - subject << 1 - subject << 1 - subject << 2 - subject << 3 - subject << 4 - subject << 4 - subject << 4 - subject << 4 - subject << 5 - subject << 5 - subject << 5 - subject << 5 - subject << 6 - subject << 7 - subject << 8 - subject.delete 8 - subject.delete_if { |i| i == 1 } + s << 1 + s << 1 + s << 2 + s << 3 + s << 4 + s << 4 + s << 4 + s << 4 + s << 5 + s << 5 + s << 5 + s << 5 + s << 6 + s << 7 + s << 8 + s.delete 8 + s.delete_if { |i| i == 1 } end end + sleep 2.0 - subject.length.should == 6 + s.length.should == 6 end end
Fix race conditions in this trivial unit test. Headdesk.
diff --git a/libraries/drivers_db_postgresql.rb b/libraries/drivers_db_postgresql.rb index abc1234..def5678 100644 --- a/libraries/drivers_db_postgresql.rb +++ b/libraries/drivers_db_postgresql.rb @@ -4,7 +4,7 @@ module Db class Postgresql < Base adapter :postgresql - allowed_engines :postgres, :postgresql, :'aurora-postresql' + allowed_engines :postgres, :postgresql, :'aurora-postgresql' packages debian: 'libpq-dev', rhel: 'postgresql96-devel' end end
fix(db): Fix typo for aurora postgresql
diff --git a/lib/codebase.rb b/lib/codebase.rb index abc1234..def5678 100644 --- a/lib/codebase.rb +++ b/lib/codebase.rb @@ -18,7 +18,7 @@ def request(url, data) uri = URI.parse(url) req = Net::HTTP::Post.new(uri.path) - req.set_form_data(data, ';') + req.set_form_data(data) res = Net::HTTP.new(uri.host, uri.port) if uri.scheme == 'https'
Allow Net::HTTP to use it's default delimiter A semicolon with no space is no longer supported by rack, so request will be malformed
diff --git a/lib/congress.rb b/lib/congress.rb index abc1234..def5678 100644 --- a/lib/congress.rb +++ b/lib/congress.rb @@ -1,27 +1,27 @@ require 'congress/client' module Congress - class << self - attr_accessor :key - def configure - yield self - end + extend self # rubocop:disable ModuleFunction + attr_accessor :key - # Alias for Congress::Client.new - # - # @return [Congress::Client] - def new - Congress::Client.new - end + def configure + yield self + end - # Delegate to Congress::Client - def method_missing(method, *args, &block) - return super unless new.respond_to?(method) - new.send(method, *args, &block) - end + # Alias for Congress::Client.new + # + # @return [Congress::Client] + def new + Congress::Client.new + end - def respond_to?(method, include_private = false) - new.respond_to?(method, include_private) || super(method, include_private) - end + # Delegate to Congress::Client + def method_missing(method, *args, &block) + return super unless new.respond_to?(method) + new.send(method, *args, &block) + end + + def respond_to?(method, include_private = false) + new.respond_to?(method, include_private) || super(method, include_private) end end
Refactor “class << self” to “extend self” in module Congress.
diff --git a/lib/knapsack.rb b/lib/knapsack.rb index abc1234..def5678 100644 --- a/lib/knapsack.rb +++ b/lib/knapsack.rb @@ -7,6 +7,7 @@ require_relative 'knapsack/presenter' require_relative 'knapsack/report' require_relative 'knapsack/allocator' +require_relative 'knapsack/allocator_builder' require_relative 'knapsack/task_loader' require_relative 'knapsack/distributors/base_distributor' require_relative 'knapsack/distributors/report_distributor'
Add missing require for allocator builder
diff --git a/vampires-deck.rb b/vampires-deck.rb index abc1234..def5678 100644 --- a/vampires-deck.rb +++ b/vampires-deck.rb @@ -0,0 +1,34 @@+class Deck + + + def compare + if user_input == pick_card.question + output_correct + pick_card + elsif user_input == 'exit' + puts "Quitter." + else + output_incorrect + user_input + end + + end + + def output_correct + puts "Wow you must be some kind of genius...Next question!" + end + + def output_incorrect + puts "You suck! If this were actual Jeopardy Trebeck would have laughed you out of town" + end +end + +class Card + attr_reader :definition, :question + + def initialize(args) + @definition = args[:defintion] + @question = args[:question] + end + +end
Add compare method and Card class
diff --git a/lib/lineprof.rb b/lib/lineprof.rb index abc1234..def5678 100644 --- a/lib/lineprof.rb +++ b/lib/lineprof.rb @@ -2,12 +2,13 @@ require 'rack/lineprof/source_extension' class Lineprof - IGNORE_PATTERN = /lib\/lineprof\.rb$/ + IGNORE_PATTERN = /lib\/lineprof\.rb$/ + DEFAULT_PATTERN = /./ class << self - def profile(&block) - value = nil - result = lineprof(/./) { value = block.call } + def profile(filename = caller_filename(caller), &block) + value = nil + result = lineprof(filename) { value = block.call } puts Term::ANSIColor.blue("\n[Lineprof] #{'=' * 70}") puts "\n#{format(result)}\n" @@ -15,6 +16,10 @@ end private + + def caller_filename(caller_lines) + caller_lines.first.split(':').first || DEFAULT_PATTERN + end def format(result) sources = result.map do |filename, samples|
Use caller filename by default
diff --git a/learn-co.gemspec b/learn-co.gemspec index abc1234..def5678 100644 --- a/learn-co.gemspec +++ b/learn-co.gemspec @@ -23,5 +23,6 @@ spec.add_runtime_dependency "learn-test", ">= 1.1.1" spec.add_runtime_dependency "learn-config", ">= 0.0.32" + spec.add_runtime_dependency "learn-open" spec.add_runtime_dependency "thor" end
Add learn-open as runtime dep
diff --git a/lib/fulmar/domain/task/database_sync.rake b/lib/fulmar/domain/task/database_sync.rake index abc1234..def5678 100644 --- a/lib/fulmar/domain/task/database_sync.rake +++ b/lib/fulmar/domain/task/database_sync.rake @@ -1,13 +1,8 @@ require 'pp' db_configs = [] -full_configuration[:environments].each_key do |env| - next if env == :all - full_configuration[:environments][env].each_pair do |target, data| - if data[:type] == 'maria' - db_configs << [env, target] - end - end +configuration.each do |env, target, data| + db_configs << [env, target] if data[:type] == 'maria' end def create_update_task(from_db, to_db)
[REFACTORING] Use the fantastic new .each method
diff --git a/lib/rails-footnotes/notes/assigns_note.rb b/lib/rails-footnotes/notes/assigns_note.rb index abc1234..def5678 100644 --- a/lib/rails-footnotes/notes/assigns_note.rb +++ b/lib/rails-footnotes/notes/assigns_note.rb @@ -3,7 +3,20 @@ module Footnotes module Notes class AssignsNote < AbstractNote - @@ignored_assigns = %w( @template @_request @db_rt_before_render @db_rt_after_render @view_runtime ) + @@ignored_assigns = [ + :@real_format, + :@before_filter_chain_aborted, + :@performed_redirect, + :@performed_render, + :@_params, + :@_response, + :@url, + :@template, + :@_request, + :@db_rt_before_render, + :@db_rt_after_render, + :@view_runtime + ] cattr_accessor :ignored_assigns, :instance_writter => false def initialize(controller) @@ -29,11 +42,14 @@ protected def assigns - return @assigns if @assigns - - @assigns = @controller.instance_variables - @assigns -= @controller.protected_instance_variables if @controller.respond_to? :protected_instance_variables - @assigns -= ignored_assigns + assign = [] + ignored = @@ignored_assigns + + @controller.instance_variables.each {|x| assign << x.intern } + @controller.protected_instance_variables.each {|x| ignored << x.intern } if @controller.respond_to? :protected_instance_variables + + assign -= ignored + return assign end def assigned_value(key)
Fix ruby 1.9 issue where it doesn't ignore most assigns because controller.protected_instance_variables array looks like string in ruby 1.8.7 and like :string in 1.9
diff --git a/sinatra-github_webhooks.gemspec b/sinatra-github_webhooks.gemspec index abc1234..def5678 100644 --- a/sinatra-github_webhooks.gemspec +++ b/sinatra-github_webhooks.gemspec @@ -21,8 +21,8 @@ spec.add_dependency 'sinatra' spec.add_dependency 'rack-github_webhooks', '>= 0.3.0' - spec.add_development_dependency 'bundler', '~> 1.10' - spec.add_development_dependency 'rake', '~> 10.0' + spec.add_development_dependency 'bundler' + spec.add_development_dependency 'rake' spec.add_development_dependency 'minitest' spec.add_development_dependency 'pry' spec.add_development_dependency 'rack-test'
Remove explicit versions of development dependencies Probably better to fix problems with newer versions of development tooling, rather than pin to old versions.
diff --git a/lib/migrator.rb b/lib/migrator.rb index abc1234..def5678 100644 --- a/lib/migrator.rb +++ b/lib/migrator.rb @@ -7,7 +7,7 @@ end def self.available_migrations - Dir["#{migrations_path}/[0-9]*_*.rb"].sort + Dir["#{migrations_path}/[1-9]*_*.rb"].sort_by { |name| name.scan(/\d+/).first.to_i } end def self.current_schema_version
Fix admin/ migration problem with 0_initial_schema, from Eridius git-svn-id: 70ab0960c3db1cbf656efd6df54a8f3de72dc710@607 820eb932-12ee-0310-9ca8-eeb645f39767
diff --git a/app/workers/spam_worker.rb b/app/workers/spam_worker.rb index abc1234..def5678 100644 --- a/app/workers/spam_worker.rb +++ b/app/workers/spam_worker.rb @@ -5,7 +5,7 @@ @message = Georgia::Message.find(message_id) @message.update_attributes(spam: @message.spam?, verified_at: Time.zone.now) # TODO: Move this to a seperate worker, possibly a single bulk daily email - Notifier.notify_info(@message).deliver unless @message.spam + Notifier.notify_info(@message).deliver end
Send message even when spam for now
diff --git a/app/models/ability.rb b/app/models/ability.rb index abc1234..def5678 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -3,6 +3,8 @@ def initialize(subject) super + + admin = (!Site.current.nil?) and (can? :update, Site.current) if subject.is_a?(Application) && subject.store? can :create, Purchase @@ -19,9 +21,10 @@ end #SCIM2 Permissions - # Pending. An Admin or SCIM Master role must be implemented. - # can :manageSCIM, :all can :showSCIM, :all + if admin + can :manageSCIM, :all + end end end
Allow admins to use SCIM API
diff --git a/lib/rbraspag.rb b/lib/rbraspag.rb index abc1234..def5678 100644 --- a/lib/rbraspag.rb +++ b/lib/rbraspag.rb @@ -16,12 +16,6 @@ require 'rbraspag/order' module Braspag - def self.logger=(logger) - HTTPI.log = true - HTTPI.logger = logger - HTTPI.log_level = :debug - end - def self.config_file_path=(path) @config_path = path end
Revert "Forcing logger enabling from outside to HTTPI" This reverts commit 3035c99cb09764fc02052c7e418a8229b867734f.
diff --git a/lib/chatrix/bot.rb b/lib/chatrix/bot.rb index abc1234..def5678 100644 --- a/lib/chatrix/bot.rb +++ b/lib/chatrix/bot.rb @@ -19,7 +19,7 @@ # Initializes a new Bot instance. # @param file [String] File to load config from. - def initialize(file = 'config.yaml') + def initialize(file = Config::DEFAULT_CONFIG_PATH) @config = Config.load file @log = Logger.new @config[:log_file], 'daily' @log.level = @config[:log_level]
Use config const instead of hardcoded value in Bot It was using a hardcoded string for the default config path.
diff --git a/backend/app/helpers/spree/admin/adjustments_helper.rb b/backend/app/helpers/spree/admin/adjustments_helper.rb index abc1234..def5678 100644 --- a/backend/app/helpers/spree/admin/adjustments_helper.rb +++ b/backend/app/helpers/spree/admin/adjustments_helper.rb @@ -29,7 +29,7 @@ end def display_shipment(shipment) - "Shipment ##{shipment.number}<br>#{shipment.display_cost}".html_safe + "#{Spree.t(:shipment)} ##{shipment.number}<br>#{shipment.display_cost}".html_safe end end end
Use translated text for shipment in AdjustmentsHelper
diff --git a/spec/expando/expander_spec.rb b/spec/expando/expander_spec.rb index abc1234..def5678 100644 --- a/spec/expando/expander_spec.rb +++ b/spec/expando/expander_spec.rb @@ -1,9 +1,9 @@ require 'spec_helper' describe Expando::Expander do - it 'properly expands tokenized text' do - lines = [ '(I|we|they) heard you (love|hate) (cars|boats|bikes)' ] - expanded_lines = [ + let(:lines) { [ '(I|we|they) heard you (love|hate) (cars|boats|bikes)' ] } + let(:expanded_lines) { + [ 'I heard you love cars', 'I heard you love boats', 'I heard you love bikes', @@ -23,7 +23,22 @@ 'they heard you hate boats', 'they heard you hate bikes', ] + } + it 'properly expands the tokenized text' do expect( Expando::Expander.expand!( lines ) ).to eq( expanded_lines ) end + + context 'when some lines are commented out' do + let(:lines) { + [ + '# this is a comment', + '(I|we|they) heard you (love|hate) (cars|boats|bikes)' + ] + } + + it 'properly expands the tokenized text, ignoring the commented lines' do + expect( Expando::Expander.expand!( lines ) ).to eq( expanded_lines ) + end + end end
Add a failing spec for ignoring comments OS-10
diff --git a/SwiftyReceiptValidator.podspec b/SwiftyReceiptValidator.podspec index abc1234..def5678 100644 --- a/SwiftyReceiptValidator.podspec +++ b/SwiftyReceiptValidator.podspec @@ -18,6 +18,6 @@ :tag => s.version } -s.source_files = "SwiftyReceiptValidator/**/*.{swift}" +s.source_files = "Sources/**/*.{swift}" end
Update podspec to point to correct file
diff --git a/spec/support/twilio_matchers.rb b/spec/support/twilio_matchers.rb index abc1234..def5678 100644 --- a/spec/support/twilio_matchers.rb +++ b/spec/support/twilio_matchers.rb @@ -0,0 +1,29 @@+require 'nokogiri' + +RSpec::Matchers.define :redirect_twilio_to do |expected| + match do |actual| + doc = Nokogiri::XML::Document.parse(actual) + node = doc.xpath('Response/Redirect') + !node.empty? && node.text == expected + end +end + +RSpec::Matchers.define :play_twilio_url do |expected| + match do |actual| + doc = Nokogiri::XML::Document.parse(actual) + node = doc.xpath('Response//Play') + if expected.is_a?(Regexp) + !node.empty? && expected =~ node.map(&:text).join(' ') + else + !node.empty? && node.map(&:text).include?(expected) + end + end +end + +RSpec::Matchers.define :hangup_twilio do |expected| + match do |actual| + doc = Nokogiri::XML::Document.parse(actual) + nodes = doc.xpath('Response/Hangup') + !nodes.empty? + end +end
Add custom RSpec Twilio matchers from CityVoice, via @ohrite
diff --git a/spec/unit/query_builder_spec.rb b/spec/unit/query_builder_spec.rb index abc1234..def5678 100644 --- a/spec/unit/query_builder_spec.rb +++ b/spec/unit/query_builder_spec.rb @@ -11,15 +11,15 @@ end it "should return empty conditions if the search query is nil" do - ScopedSearch::QueryBuilder.build_query(@definition, nil).should == { } + ScopedSearch::QueryBuilder.build_query(@definition, nil).should == { :order => nil } end it "should return empty conditions if the query is blank" do - ScopedSearch::QueryBuilder.build_query(@definition, "").should == { } + ScopedSearch::QueryBuilder.build_query(@definition, "").should == { :order => nil } end it "should return empty conditions if the query is whitespace only" do - ScopedSearch::QueryBuilder.build_query(@definition, "\t ").should == { } + ScopedSearch::QueryBuilder.build_query(@definition, "\t ").should == { :order => nil } end end
Fix query builder specs by including :order => nil
diff --git a/lib/hooks_utils.rb b/lib/hooks_utils.rb index abc1234..def5678 100644 --- a/lib/hooks_utils.rb +++ b/lib/hooks_utils.rb @@ -1,5 +1,5 @@ module HooksUtils - extend self + module_function # Gets an array of Git push options from the environment def get_push_options
Use `module_fuction` instead of `extend self` https://github.com/rubocop-hq/ruby-style-guide#module-function
diff --git a/app/jobs/geocode_adviser_job.rb b/app/jobs/geocode_adviser_job.rb index abc1234..def5678 100644 --- a/app/jobs/geocode_adviser_job.rb +++ b/app/jobs/geocode_adviser_job.rb @@ -10,6 +10,6 @@ private def stat(key) - Stats.increment("radsignup.geocode_adviser.#{key}") + Stats.increment("radsignup.geocode.adviser.#{key}") end end
Use dots instead of underscores for statsd keys.
diff --git a/test/spec/database_integration/get_not_found.rb b/test/spec/database_integration/get_not_found.rb index abc1234..def5678 100644 --- a/test/spec/database_integration/get_not_found.rb +++ b/test/spec/database_integration/get_not_found.rb @@ -0,0 +1,19 @@+require_relative './database_integration_init' + +describe "Get a Stream that Doesn't Exist" do + stream_name = EventStore::Client::HTTP::Controls::StreamName.get "testNotFound" + path = "/streams/#{stream_name}" + + data = EventStore::Client::HTTP::Controls::EventData::Batch::JSON.text + + get = EventStore::Client::HTTP::Request::Get.build + body_text, response = get.! path + + specify "Response status is 404 Not Found" do + assert(response.is_a? Net::HTTPNotFound) + end + + specify "Body is empty" do + assert(body_text.empty?) + end +end
Test for get of stream that doesn't exist
diff --git a/Casks/mongohub.rb b/Casks/mongohub.rb index abc1234..def5678 100644 --- a/Casks/mongohub.rb +++ b/Casks/mongohub.rb @@ -0,0 +1,11 @@+cask :v1 => 'mongohub' do + version :latest + sha256 :no_check + + url 'https://mongohub.s3.amazonaws.com/MongoHub.zip' + name 'MongoHub' + homepage 'https://github.com/jeromelebel/MongoHub-Mac' + license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder + + app 'MongoHub.app' +end
Add MongoHub.app latest current version 3.1.4
diff --git a/Casks/sqwiggle.rb b/Casks/sqwiggle.rb index abc1234..def5678 100644 --- a/Casks/sqwiggle.rb +++ b/Casks/sqwiggle.rb @@ -0,0 +1,7 @@+class Sqwiggle < Cask + url 'https://www.sqwiggle.com/download/mac' + homepage 'https://www.sqwiggle.com' + version '0.4.2' + sha1 '15c49c5443780749ca833605bd61f9ee0b4d8105' + link 'Sqwiggle.app' +end
Add new cask for Sqwiggle.app.
diff --git a/gutentag.gemspec b/gutentag.gemspec index abc1234..def5678 100644 --- a/gutentag.gemspec +++ b/gutentag.gemspec @@ -15,6 +15,8 @@ s.add_runtime_dependency 'activerecord', '>= 3.2.0' s.add_runtime_dependency 'appraisal', '~> 1.0.2' + + s.add_development_dependency 'bundler', '>= 1.7.12' s.add_development_dependency 'combustion', '0.5.1' s.add_development_dependency 'rspec-rails', '~> 3.1' s.add_development_dependency 'sqlite3', '~> 1.3.7'
Use latest release of bundler. Required for ruby_22 flag.
diff --git a/db/migrate/20201219120055_add_order_to_adjustments.rb b/db/migrate/20201219120055_add_order_to_adjustments.rb index abc1234..def5678 100644 --- a/db/migrate/20201219120055_add_order_to_adjustments.rb +++ b/db/migrate/20201219120055_add_order_to_adjustments.rb @@ -21,7 +21,17 @@ # Migrate adjustments on line_items Spree::Adjustment.where(order_id: nil, adjustable_type: "Spree::LineItem").includes(:adjustable).find_each do |adjustment| - adjustment.update_column(:order_id, adjustment.adjustable.order_id) + line_item = adjustment.adjustable + + # In some cases a line item has been deleted but an orphaned adjustment remains in the + # database. There is no way for this orphan to ever be returned or accessed via any scopes, + # and no way to know what order it related to. In this case we can remove the record. + if line_item.nil? + adjustment.delete + next + end + + adjustment.update_column(:order_id, line_item.order_id) end end end
Fix issue with orphaned adjustments in migration
diff --git a/lib/spot_rate.rb b/lib/spot_rate.rb index abc1234..def5678 100644 --- a/lib/spot_rate.rb +++ b/lib/spot_rate.rb @@ -31,5 +31,5 @@ end end -require './lib/spot_rate/google_currency_converter' +require 'spot_rate/google_currency_converter' SpotRate.register_currency_converter :default, SpotRate::GoogleCurrencyConverter
Update require path, amateur hour over here
diff --git a/lib/rails_admin/models/setup/delayed_message_admin.rb b/lib/rails_admin/models/setup/delayed_message_admin.rb index abc1234..def5678 100644 --- a/lib/rails_admin/models/setup/delayed_message_admin.rb +++ b/lib/rails_admin/models/setup/delayed_message_admin.rb @@ -10,7 +10,11 @@ navigation_label 'Administration' visible { ::User.current_super_admin? } - configure :live_publish_at, :datetime + configure :live_publish_at, :datetime do + label do + "On #{::Setup::DelayedMessage.adapter.to_s.split('::').last.to_title}" + end + end edit do field :message
Fix | Contextualizing delayed message config with adapter
diff --git a/test/locotimezone_test.rb b/test/locotimezone_test.rb index abc1234..def5678 100644 --- a/test/locotimezone_test.rb +++ b/test/locotimezone_test.rb @@ -1,27 +1,41 @@ require 'test_helper' class LocotimezoneTest < Minitest::Test - attr_reader :loco + attr_reader :locotime + attr_reader :just_location + attr_reader :just_timezone + + def setup + @locotime = Locotimezone.locotime address + @just_location = Locotimezone.locotime address, loction_only: true + @just_timezone = Locotimezone.locotime address, timezone_only: true + end def test_that_it_has_a_version_number refute_nil ::Locotimezone::VERSION end - def setup - @loco = Locotimezone.locotime address - end - def test_that_it_has_correct_formatted_address assert_equal '525 NW 1st Ave, Fort Lauderdale, FL 33301, USA', - loco[:formatted_address] + locotime[:formatted_address] end def test_that_it_has_correct_geolocation - assert_equal 26.1288238, loco[:location]['lat'] - assert_equal -80.1449743, loco[:location]['lng'] + assert_equal 26.1288238, locotime[:location]['lat'] + assert_equal -80.1449743, locotime[:location]['lng'] end def test_that_it_has_correct_timezone_id - assert_equal 'America/New_York', loco[:timezone]['timeZoneId'] + assert_equal 'America/New_York', locotime[:timezone]['timeZoneId'] + end + + def test_that_it_only_returns_location + refute_nil just_location[:location] + assert_nil just_location[:timezone] + end + + def test_that_it_only_returns_timezone + assert_nil just_location[:location] + refute_nil just_location[:timezone] end end
Test options for location_only and timezone_only
diff --git a/db/migrate/20191010143350_add_conditioning_unit_to_products.rb b/db/migrate/20191010143350_add_conditioning_unit_to_products.rb index abc1234..def5678 100644 --- a/db/migrate/20191010143350_add_conditioning_unit_to_products.rb +++ b/db/migrate/20191010143350_add_conditioning_unit_to_products.rb @@ -27,7 +27,7 @@ AND p.conditioning_unit_id IS NULL SQL - # change_column_null :products, :conditioning_unit_id, false + change_column_null :products, :conditioning_unit_id, false end def down
Revert "Fix bug during deployment on not null column conditionning_unit in products." This reverts commit 27b3244eba4901962aef6b3f2832efb3d532d740.
diff --git a/aruba-doubles.gemspec b/aruba-doubles.gemspec index abc1234..def5678 100644 --- a/aruba-doubles.gemspec +++ b/aruba-doubles.gemspec @@ -12,6 +12,7 @@ s.add_dependency 'cucumber', '>= 1.0.2' s.add_dependency 'rspec', '>= 2.6.0' + s.add_development_dependency 'rake', '>= 0.9.2.2' s.add_development_dependency 'aruba', '>= 0.4.6' s.add_development_dependency 'guard-cucumber', '>= 0.7.3' s.add_development_dependency 'guard-rspec', '>= 0.5.1'
Fix missing dev dependency rake
diff --git a/looksee.gemspec b/looksee.gemspec index abc1234..def5678 100644 --- a/looksee.gemspec +++ b/looksee.gemspec @@ -22,4 +22,5 @@ s.add_development_dependency 'ritual', '>= 0.2.0' s.add_development_dependency 'rspec', '>= 2.0.0' s.add_development_dependency 'mocha' + s.add_development_dependency 'wirble' end
Add wirble as a development dependency.
diff --git a/db/migrate/007_add_user_id_to_search_terms.rb b/db/migrate/007_add_user_id_to_search_terms.rb index abc1234..def5678 100644 --- a/db/migrate/007_add_user_id_to_search_terms.rb +++ b/db/migrate/007_add_user_id_to_search_terms.rb @@ -0,0 +1,44 @@+migration 7, :add_user_id_to_search_terms do + up do + execute 'DROP INDEX searchable_messages_tsv' + execute 'DROP MATERIALIZED VIEW searchable_messages;' + + execute <<~SQL + CREATE MATERIALIZED VIEW searchable_messages AS + SELECT + messages.*, + channels.name AS channel_name, + users.image AS user_image, + users.real_name AS user_real_name, + users.name AS user_name, + to_tsvector(messages.text || ' ' || channels.name || ' ' || users.id || ' ' || users.real_name || ' ' || users.name) AS tsv + FROM messages + INNER JOIN users ON messages.user_id = users.id + INNER JOIN channels ON messages.channel_id = channels.id + WITH NO DATA; + SQL + + execute 'CREATE INDEX searchable_messages_tsv ON searchable_messages USING gin(tsv)' + end + + down do + execute 'DROP INDEX searchable_messages_tsv' + execute 'DROP MATERIALIZED VIEW searchable_messages;' + + execute <<~SQL + CREATE MATERIALIZED VIEW searchable_messages AS + SELECT + messages.*, + channels.name AS channel_name, + users.image AS user_image, + users.real_name AS user_real_name, + users.name AS user_name, + to_tsvector(messages.text || ' ' || channels.name || ' ' || users.real_name || ' ' || users.name) AS tsv + FROM messages + INNER JOIN users ON messages.user_id = users.id + INNER JOIN channels ON messages.channel_id = channels.id + WITH NO DATA; + SQL + end +end +
Add user id to search terms
diff --git a/attributes/default.rb b/attributes/default.rb index abc1234..def5678 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -1,5 +1,5 @@ default['selenium']['url'] = - 'https://selenium-release.storage.googleapis.com/2.47/selenium-server-standalone-2.47.0.jar' + 'https://selenium-release.storage.googleapis.com/2.47/selenium-server-standalone-2.47.1.jar' default['selenium']['windows']['home'] = "#{ENV['SYSTEMDRIVE']}/selenium" default['selenium']['windows']['java'] = "#{ENV['SYSTEMDRIVE']}\\java\\bin\\java.exe"
Use selenium jar version 1.47.1
diff --git a/site-cookbooks/backup_restore/spec/recipes/restore_spec.rb b/site-cookbooks/backup_restore/spec/recipes/restore_spec.rb index abc1234..def5678 100644 --- a/site-cookbooks/backup_restore/spec/recipes/restore_spec.rb +++ b/site-cookbooks/backup_restore/spec/recipes/restore_spec.rb @@ -0,0 +1,51 @@+require_relative '../spec_helper' + +describe 'backup_restore::restore' do + let(:chef_run) do + runner = ChefSpec::Runner.new( + cookbook_path: %w(site-cookbooks cookbooks), + platform: 'centos', + version: '6.5' + )do |node| + node.set['backup_restore']['destinations']['enabled'] = %w(s3) + node.set['backup_restore']['destinations']['s3'] = { + bucket: 's3bucket', + access_key_id: 'access_key_id', + secret_access_key: 'secret_access_key', + region: 'us-east-1', + prefix: '/backup' + } + node.set['backup_restore']['restore']['target_sources'] = %w(directory mysql ruby) + end + + runner.converge(described_recipe) + end + + it 'create temporary directory' do + expect(chef_run).to create_directory('/tmp/backup/restore').with( + recursive: true + ) + end + + it 'run directory backup' do + expect(chef_run).to include_recipe('backup_restore::fetch_s3') + end + + it 'run directory backup' do + expect(chef_run).to include_recipe('backup_restore::restore_directory') + end + + it 'run directory backup' do + expect(chef_run).to include_recipe('backup_restore::restore_mysql') + end + + it 'run directory backup' do + expect(chef_run).to include_recipe('backup_restore::restore_ruby') + end + + it 'delete temporary directory' do + expect(chef_run).to delete_directory('/tmp/backup/restore').with( + recursive: true + ) + end +end
Add chef-spec for restore recipe
diff --git a/lib/extensions/string.rb b/lib/extensions/string.rb index abc1234..def5678 100644 --- a/lib/extensions/string.rb +++ b/lib/extensions/string.rb @@ -5,7 +5,7 @@ end def extract_settings - gsub(/ /, '').split(',') + split(",").map { |x| x.strip } end def remove_prefix(prefix = 'admin/')
Use split instead of gsub.
diff --git a/lib/minotaur/document.rb b/lib/minotaur/document.rb index abc1234..def5678 100644 --- a/lib/minotaur/document.rb +++ b/lib/minotaur/document.rb @@ -1,5 +1,4 @@ require 'nokogiri' -require 'pry' module Minotaur class Document
Remove pry require in Document
diff --git a/test/integration/justhub-version/serverspec/server_spec.rb b/test/integration/justhub-version/serverspec/server_spec.rb index abc1234..def5678 100644 --- a/test/integration/justhub-version/serverspec/server_spec.rb +++ b/test/integration/justhub-version/serverspec/server_spec.rb @@ -8,9 +8,9 @@ it { should be_installed.with_version('1-4.0.el6') } end end +describe file('/usr/bin/ghc') do + it { should be_executable } +end describe command('/usr/bin/ghc --version | awk \'{print $NF}\'') do it { should return_stdout '7.4.1' } end -describe file('/usr/bin/ghc') do - it { should be_executable } -end
Check if the file exists before we try to get version information from it
diff --git a/localdoc.gemspec b/localdoc.gemspec index abc1234..def5678 100644 --- a/localdoc.gemspec +++ b/localdoc.gemspec @@ -26,5 +26,9 @@ s.add_development_dependency "pry-rails" s.add_development_dependency "byebug" - s.post_install_message = "Run `(cd `bundle show localdoc` && npm install) && rake localdoc:webpack` to generate this engine's assets." + s.post_install_message = <<EOS +Run the following comamnd to generate this engine's assets: + + (cd `bundle show localdoc` && npm install) && bundle exec rake localdoc:webpack +EOS end
Use bundle exec in post install message's suggested command
diff --git a/classy_hash.gemspec b/classy_hash.gemspec index abc1234..def5678 100644 --- a/classy_hash.gemspec +++ b/classy_hash.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'classy_hash' - s.version = '0.2.0' + s.version = '0.2.1' s.license = 'MIT' s.files = ['lib/classy_hash.rb', 'lib/classy_hash/generate.rb'] s.summary = 'Classy Hash: Keep your Hashes classy; a Hash schema validator' @@ -13,5 +13,5 @@ s.email = ['webdev@deseretbook.com', 'mike@mikebourgeous.com'] s.homepage = 'https://github.com/deseretbook/classy_hash' - s.required_ruby_version = ['>= 2.0', '< 2.4.0'] + s.required_ruby_version = ['>= 2.0'] end
Bump gem version and allow Ruby 2.4.
diff --git a/lib/ovirt/base_object.rb b/lib/ovirt/base_object.rb index abc1234..def5678 100644 --- a/lib/ovirt/base_object.rb +++ b/lib/ovirt/base_object.rb @@ -12,5 +12,11 @@ def parse_version xml (xml/'version').first[:major] +"."+ (xml/'version').first[:minor] end + + def parse_bool text + return true if text =~ /^true$/i + return false if text =~ /^false$/i + raise ArgumentError.new %Q[The string "#{text}" isn't a valid boolean, it should be "true" or "false"] + end end -end+end
Add method to parse XML booleans Currently we don't convert boolean objects returned by the server to the Ruby representation of booleans. This complicates further treatment of these values, as they have to be treated as strings. To avoid that this patch introduces a new "parse_bool" method in the base object class intended to convert the boolean representation used by the server into the Ruby representation. This method will be used in later changes. Signed-off-by: Juan Hernandez <59e5b8140de97cc91c3fb6c5342dce948469af8c@redhat.com>
diff --git a/lib/rack/test/methods.rb b/lib/rack/test/methods.rb index abc1234..def5678 100644 --- a/lib/rack/test/methods.rb +++ b/lib/rack/test/methods.rb @@ -1,45 +1,33 @@+require "forwardable" + module Rack module Test - module Methods - - def self.delegate_to_rack_test_session(*meths) - meths.each do |meth| - self.class_eval <<-RUBY - def #{meth}(*args, &blk) - rack_test_session.#{meth}(*args, &blk) - end - RUBY - end - end + extend Forwardable def rack_test_session @_rack_test_session ||= Rack::Test::Session.new(app) end - - delegate_to_rack_test_session \ + + METHODS = [ :request, - # HTTP verbs :get, :post, :put, :delete, :head, - # Redirects :follow_redirect!, - # Header-related features :header, :authorize, - # Expose the last request and response :last_response, :last_request - - + ] + + def_delegators :rack_test_session, *METHODS end - end -end+end
Use forwardable from the stdlib
diff --git a/features/step_definitions/attachment_steps.rb b/features/step_definitions/attachment_steps.rb index abc1234..def5678 100644 --- a/features/step_definitions/attachment_steps.rb +++ b/features/step_definitions/attachment_steps.rb @@ -24,6 +24,8 @@ When /^the (?:attachment|image)s? (?:has|have) been virus\-checked$/ do FileUtils.cp_r(Whitehall.incoming_uploads_root + '/.', Whitehall.clean_uploads_root + "/") + FileUtils.rm_rf(Whitehall.incoming_uploads_root) + FileUtils.mkdir(Whitehall.incoming_uploads_root) end Then /^the image will be quarantined for virus checking$/ do
Fix the cucumber virus checker so that it mimics the VirusScanHelper This is needed as we will mark the files a not clean otherwise. And Images on people have many variations which also need moving
diff --git a/MDCSwipeToChoose.podspec b/MDCSwipeToChoose.podspec index abc1234..def5678 100644 --- a/MDCSwipeToChoose.podspec +++ b/MDCSwipeToChoose.podspec @@ -8,7 +8,7 @@ s.social_media_url = 'https://twitter.com/modocache' s.source = { :git => 'https://github.com/modocache/MDCSwipeToChoose.git', :tag => "v#{s.version}" } s.source_files = 'MDCSwipeToChoose/**/*.{h,m}' - s.public_header_files = 'MDCSwipeToChoose/Public/**/*.{h,m}' + s.public_header_files = 'MDCSwipeToChoose/Public/**/*.h' s.requires_arc = true s.platform = :ios, '7.0' s.framework = 'UIKit'
Remove .m files from public_header_files in .podspec
diff --git a/app/workers/update_scheduler.rb b/app/workers/update_scheduler.rb index abc1234..def5678 100644 --- a/app/workers/update_scheduler.rb +++ b/app/workers/update_scheduler.rb @@ -7,7 +7,7 @@ recurrence { hourly } def perform - Component.all.each do |component| + Component.select(:name).find_each do |component| UpdateComponent.perform_async(component.name) end end
fix: Make update scheduler more performant
diff --git a/acts_as_paranoid.gemspec b/acts_as_paranoid.gemspec index abc1234..def5678 100644 --- a/acts_as_paranoid.gemspec +++ b/acts_as_paranoid.gemspec @@ -17,8 +17,8 @@ spec.test_files = Dir["test/*.rb"] spec.require_paths = ["lib"] - spec.add_dependency "activerecord", ">= 4.2", "< 6.0" - spec.add_dependency "activesupport", ">= 4.2", "< 6.0" + spec.add_dependency "activerecord", ">= 4.2", "< 7.0" + spec.add_dependency "activesupport", ">= 4.2", "< 7.0" spec.add_development_dependency "bundler", ">= 1.5", "< 3.0" spec.add_development_dependency "rake"
Allow ActiveRecord and ActiveSupport 6.0
diff --git a/config/initializers/crowdblog.rb b/config/initializers/crowdblog.rb index abc1234..def5678 100644 --- a/config/initializers/crowdblog.rb +++ b/config/initializers/crowdblog.rb @@ -2,3 +2,20 @@ Rails.application.config.discus_key = ENV['DISQUS_KEY'] Rails.application.config.publishers = ENV['PUBLISHERS'] + +CarrierWave.configure do |config| + if Rails.env.production? + config.storage = :fog + + config.fog_credentials = { + :provider => 'AWS', + :aws_access_key_id => ENV['AWS_ACCESS_KEY'], + :aws_secret_access_key => ENV['AWS_SECRET_KEY'] + } + config.fog_directory = ENV['AWS_BUCKET'] + config.fog_public = true + config.fog_attributes = {'Cache-Control' => 'max-age=315576000'} + else + config.storage = :file + end +end
Add carrier wave AWS configuration
diff --git a/config/initializers/us_states.rb b/config/initializers/us_states.rb index abc1234..def5678 100644 --- a/config/initializers/us_states.rb +++ b/config/initializers/us_states.rb @@ -0,0 +1,60 @@+US_STATES = { + 'AL' => 'Alabama', + 'AK' => 'Alaska', + 'AS' => 'America Samoa', + 'AZ' => 'Arizona', + 'AR' => 'Arkansas', + 'CA' => 'California', + 'CO' => 'Colorado', + 'CT' => 'Connecticut', + 'DE' => 'Delaware', + 'DC' => 'District of Columbia', + 'FM' => 'Micronesia1', + 'FL' => 'Florida', + 'GA' => 'Georgia', + 'GU' => 'Guam', + 'HI' => 'Hawaii', + 'ID' => 'Idaho', + 'IL' => 'Illinois', + 'IN' => 'Indiana', + 'IA' => 'Iowa', + 'KS' => 'Kansas', + 'KY' => 'Kentucky', + 'LA' => 'Louisiana', + 'ME' => 'Maine', + 'MH' => 'Islands1', + 'MD' => 'Maryland', + 'MA' => 'Massachusetts', + 'MI' => 'Michigan', + 'MN' => 'Minnesota', + 'MS' => 'Mississippi', + 'MO' => 'Missouri', + 'MT' => 'Montana', + 'NE' => 'Nebraska', + 'NV' => 'Nevada', + 'NH' => 'New Hampshire', + 'NJ' => 'New Jersey', + 'NM' => 'New Mexico', + 'NY' => 'New York', + 'NC' => 'North Carolina', + 'ND' => 'North Dakota', + 'OH' => 'Ohio', + 'OK' => 'Oklahoma', + 'OR' => 'Oregon', + 'PW' => 'Palau', + 'PA' => 'Pennsylvania', + 'PR' => 'Puerto Rico', + 'RI' => 'Rhode Island', + 'SC' => 'South Carolina', + 'SD' => 'South Dakota', + 'TN' => 'Tennessee', + 'TX' => 'Texas', + 'UT' => 'Utah', + 'VT' => 'Vermont', + 'VI' => 'Virgin Island', + 'VA' => 'Virginia', + 'WA' => 'Washington', + 'WV' => 'West Virginia', + 'WI' => 'Wisconsin', + 'WY' => 'Wyoming' +}
Add US States abbreviations -> full name hash
diff --git a/config/software/datadog-gohai.rb b/config/software/datadog-gohai.rb index abc1234..def5678 100644 --- a/config/software/datadog-gohai.rb +++ b/config/software/datadog-gohai.rb @@ -9,6 +9,6 @@ build do command "$GOROOT/bin/go get -d -u github.com/DataDog/gohai", :env => env - command "cd $GOPATH/src/github.com/DataDog/gohai/ && git checkout #{default_version} %% git pull", :env => env + command "cwd $GOPATH/src/github.com/DataDog/gohai/ && git checkout #{default_version} %% git pull", :env => env command "$GOROOT/bin/go build -o #{install_dir}/bin/gohai $GOPATH/src/github.com/DataDog/gohai/gohai.go", :env => env end
Use cwd instead of cd for gohai software
diff --git a/test/unit/test_movie_walker_parse.rb b/test/unit/test_movie_walker_parse.rb index abc1234..def5678 100644 --- a/test/unit/test_movie_walker_parse.rb +++ b/test/unit/test_movie_walker_parse.rb @@ -0,0 +1,30 @@+# -*- coding: utf-8 -*- + +require 'test-unit' +require 'nokogiri' +require 'open-uri' + +require 'shishakai_bot/movie_walker' + +module ShishakaiBot + class TestMovieWalkerParse < Test::Unit::TestCase + + class <<self + def startup + @@doc = Nokogiri::HTML(open(MovieWalker::BASE_URI)) + end + end + + test "previewMovieInfo要素が存在していること" do + assert { 0 != @@doc.css("div.previewMovieInfo").length } + end + + test "previewMovieInfoの各テーブルヘッダが応募締切、開催日時、開催場所であること" do + table_header = @@doc.css("div.previewMovieInfo").first.css("th") + assert_equal("応募締切", table_header[0].text) + assert_equal("開催日時", table_header[1].text) + assert_equal("開催場所", table_header[2].text) + end + + end +end
Add test for parsing MovieWalker page.
diff --git a/app/models/meeting_proposal.rb b/app/models/meeting_proposal.rb index abc1234..def5678 100644 --- a/app/models/meeting_proposal.rb +++ b/app/models/meeting_proposal.rb @@ -4,5 +4,5 @@ belongs_to :meeting, counter_cache: :proposals_count belongs_to :proposal - delegate :title, to: :proposal + delegate :title, :participatory_process, to: :proposal end
Fix url generation by meeting proposal model