diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/config/initializers/redis.rb b/config/initializers/redis.rb index abc1234..def5678 100644 --- a/config/initializers/redis.rb +++ b/config/initializers/redis.rb @@ -1,6 +1,8 @@ if Rails.env.test? $redis = Redis.new else + return unless ENV['REDISTOGO_URL'] + uri = URI.parse(ENV['REDISTOGO_URL']) $redis = Redis.new(host: uri.host, port: uri.port, password: uri.password) end
Add check for env variable. Because: The deploy to Heroku button is launching builds that break due to a missing env variable. This: Adds a guard clause to short circuit before redis attempts to use the env variable.
diff --git a/errbit_github_plugin.gemspec b/errbit_github_plugin.gemspec index abc1234..def5678 100644 --- a/errbit_github_plugin.gemspec +++ b/errbit_github_plugin.gemspec @@ -11,7 +11,7 @@ spec.description = %q{GitHub integration for Errbit} spec.summary = %q{GitHub integration for Errbit} - spec.homepage = "https://github.com/brandedcrate/errbit_github_plugin" + spec.homepage = "https://github.com/errbit/errbit_github_plugin" spec.license = "MIT" spec.files = `git ls-files`.split($/)
Fix homepage to reflect the new github repo.
diff --git a/config/unicorn/production.rb b/config/unicorn/production.rb index abc1234..def5678 100644 --- a/config/unicorn/production.rb +++ b/config/unicorn/production.rb @@ -8,7 +8,7 @@ listen "127.0.0.1:8080" # Spawn unicorn master worker for user apps (group: apps) -user 'root', 'rails' +user 'root', 'root' # Fill path to your app working_directory app_path
Test with another user for unicorn deployment
diff --git a/app/controllers/manager/administrateurs_controller.rb b/app/controllers/manager/administrateurs_controller.rb index abc1234..def5678 100644 --- a/app/controllers/manager/administrateurs_controller.rb +++ b/app/controllers/manager/administrateurs_controller.rb @@ -15,6 +15,7 @@ def update Administrateur.find_inactive_by_id(params[:id]).invite! + flash.notice = "Invitation renvoyée" redirect_to manager_administrateur_path(params[:id]) end
Add flash when resending invitation
diff --git a/spec/views/assets/_transit_facility_fta.html.haml_spec.rb b/spec/views/assets/_transit_facility_fta.html.haml_spec.rb index abc1234..def5678 100644 --- a/spec/views/assets/_transit_facility_fta.html.haml_spec.rb +++ b/spec/views/assets/_transit_facility_fta.html.haml_spec.rb @@ -3,8 +3,8 @@ describe "assets/_transit_facility_fta.html.haml", :type => :view do it 'fta info' do - test_asset = create(:bus_shelter, :fta_funding_type_id => 1, :pcnt_capital_responsibility =>22, :fta_facility_type_id => 1) - test_asset.fta_mode_types << FtaModeType.first + test_asset = create(:bus_shelter, :fta_funding_type_id => 1, :pcnt_capital_responsibility =>22, :fta_facility_type_id => 1, :primary_fta_mode_type => FtaModeType.first, :fta_private_mode_type => FtaPrivateModeType.first) + test_asset.secondary_fta_mode_types << FtaModeType.second test_asset.save! assign(:asset, test_asset) render @@ -12,6 +12,8 @@ expect(rendered).to have_content(FtaFundingType.first.to_s) expect(rendered).to have_content('22%') expect(rendered).to have_content(FtaModeType.first.to_s) + expect(rendered).to have_content(FtaModeType.second.to_s) + expect(rendered).to have_content(FtaPrivateModeType.first.to_s) expect(rendered).to have_content(FtaFacilityType.first.to_s) end end
Update transit_facility_fta tests based on f2460cc, e4fadaf, and 6729a66
diff --git a/examples/radial_example.rb b/examples/radial_example.rb index abc1234..def5678 100644 --- a/examples/radial_example.rb +++ b/examples/radial_example.rb @@ -0,0 +1,71 @@+require './lib/lodo' + +ROW_COUNT = 9 +COL_COUNT = 9 +COLOR_COUNT = 18 + +board = Lodo::Board.new + +offset = 0.0 +spread = 1.3 +border_brightness = 0.0 +border_brightness_increasing = true +border_brightness_speed = 0.2 + +distance_table = [] + +COL_COUNT.times do |col| + distance_table[col] = [] + ROW_COUNT.times do |row| + distance_table[col][row] = Math.sqrt(((row - 4) ** 2)+((col - 4)) ** 2) + end +end + + +loop do + COL_COUNT.times do |col| + ROW_COUNT.times do |row| + distance = distance_table[col][row] + brightness = Math.sin((distance + offset) * spread) * 100 + # puts "(#{row - 4}, #{col-4}, #{distance})" + # brightness = (distance - 2) * -255 + 255 + + # if distance <= 2 + # board.draw_pixel(col, row, {red: 255, blue: 255, green: 255}) + if brightness <= 0 + board.draw_pixel(col, row, {red: 0, blue: 0, green: 0}) + else + board.draw_pixel(col, row, {red: brightness.abs.to_i, blue: brightness.abs.to_i, green: brightness.abs.to_i}) + end + end + end + + [0,8].each do |col| + ROW_COUNT.times do |row| + board.draw_pixel(col, row, {red: border_brightness, blue: 0, green: 0}) + end + end + + COL_COUNT.times do |col| + [0,8].each do |row| + board.draw_pixel(col, row, {red: border_brightness.to_i, blue: 0, green: 0}) + end + end + + if border_brightness_increasing + border_brightness += border_brightness_speed + else + border_brightness -= border_brightness_speed + end + + if border_brightness >= 100 + border_brightness_increasing = false + border_brightness = 100 + elsif border_brightness <= 0 + border_brightness_increasing = true + border_brightness = 0 + end + + board.save + offset -= 0.005 +end
Add radial example of circles
diff --git a/config/deploy/production.rb b/config/deploy/production.rb index abc1234..def5678 100644 --- a/config/deploy/production.rb +++ b/config/deploy/production.rb @@ -4,7 +4,7 @@ # uncomment in case of travis, capistrano will have its own set :ssh_options, keys: ["config/deploy_id_rsa"] if File.exist?("config/deploy_id_rsa") set :ssh_options, port: 7047 -set :api_token, "cVQsIA7WIBVzuS9VTpUpASnjJUHvUah668zOI7uaHQZCsjiMZDDjf1TyVkuyLc6R" +set :api_token, "AbSn3B7xZe1imvJPRbow2w4lcRIrKtJTVlIYvPXW4XFrTYHuA6rC2wxeNGWhApBf" set :deploy_to, "/var/www/pricewars-merchant" # Configuration
Update token for merchant 1
diff --git a/config/boot.rb b/config/boot.rb index abc1234..def5678 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,4 +1,17 @@ require 'rubygems' +require 'rails/commands/server' + +# Set default binding to 0.0.0.0 to allow connections from everyone if +# under development +if Rails.env.development? + module Rails + class Server + def default_options + super.merge(Host: '0.0.0.0', Port: 3000) + end + end + end +end # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
CONFIG: Set binding to 0.0.0.0 port 3000 on dev start To allow connections to all developmental devices, including mobile devices that want to connect.
diff --git a/Bulldog.podspec b/Bulldog.podspec index abc1234..def5678 100644 --- a/Bulldog.podspec +++ b/Bulldog.podspec @@ -8,6 +8,7 @@ s.authors = { 'Suraj Pathak' => 'freesuraj@gmail.com' } s.source = { :git => 'https://github.com/freesuraj/Bulldog.git', :tag => s.version } s.ios.deployment_target = '9.0' - s.swift_version = '5.0' + s.swift_version = "4.2" + s.swift_versions = ['4.0', '4.2', '5.0'] s.source_files = 'Source/*swift' end
Set swift version no to 5.0
diff --git a/lib/briefcase.rb b/lib/briefcase.rb index abc1234..def5678 100644 --- a/lib/briefcase.rb +++ b/lib/briefcase.rb @@ -1,5 +1,4 @@ require 'yaml' - require 'active_support/core_ext/hash/deep_merge' require File.expand_path('briefcase/commands', File.dirname(__FILE__)) @@ -7,28 +6,34 @@ module Briefcase - # The user's home path - DEFAULT_HOME_PATH = '~' - - # The default path wher dotfiles are stored - DEFAULT_DOTFILES_PATH = File.join(DEFAULT_HOME_PATH, '.dotfiles') - - # The default path to where secret information is stored - DEFAULT_SECRETS_PATH = File.join(DEFAULT_HOME_PATH, '.briefcase_secrets') - class << self attr_accessor :dotfiles_path, :home_path, :secrets_path, :testing + # The user's home path + def default_home_path + '~' + end + + # The default path where dotfiles are stored + def default_dotfiles_path + File.join(home_path, '.dotfiles') + end + + # The default path to where secret information is stored + def default_secrets_path + File.join(home_path, '.briefcase_secrets') + end + def dotfiles_path - @dotfiles_path ||= File.expand_path(ENV['BRIEFCASE_DOTFILES_PATH'] || DEFAULT_DOTFILES_PATH) + @dotfiles_path ||= File.expand_path(ENV['BRIEFCASE_DOTFILES_PATH'] || default_dotfiles_path) end def home_path - @home_path ||= File.expand_path(ENV['BRIEFCASE_HOME_PATH'] || DEFAULT_HOME_PATH) + @home_path ||= File.expand_path(ENV['BRIEFCASE_HOME_PATH'] || default_home_path) end def secrets_path - @secrets_path ||= File.expand_path(ENV['BRIEFCASE_SECRETS_PATH'] || DEFAULT_SECRETS_PATH) + @secrets_path ||= File.expand_path(ENV['BRIEFCASE_SECRETS_PATH'] || default_secrets_path) end def testing?
Replace the use of constants with class methods so they can inherit an overridden home path
diff --git a/lib/mumblr.rb b/lib/mumblr.rb index abc1234..def5678 100644 --- a/lib/mumblr.rb +++ b/lib/mumblr.rb @@ -3,28 +3,20 @@ require "pry" require "open-uri" require "progressbar" +require "data_mapper" module Mumblr - def load_database(connection_string) - model_glob = File.join(File.dirname(__FILE__), "mumblr/models/**.rb") - Dir[model_glob].each { |model| require model } - DataMapper.setup(:default, connection_string) - end - - def normalize_base_hostname - if match = /(?:http:\/\/)(?<bhn>(?!www).+)\.tumblr\.com/.match(@base_hostname) or match = /(?:http:\/\/)(?<bhn>)(?:\/)/.match(@base_hostname) - match['bhn'] + class Mumblr + def self.load_database(db_path) + connection_string = "sqlite://#{db_path}" + require 'mumblr/models/model' + model_glob = File.join(File.dirname(__FILE__), "mumblr/models/**.rb") + Dir[model_glob].each { |model| require model } + DataMapper.setup(:default, connection_string) + DataMapper.finalize + unless File.exists?(db_path) + DataMapper.auto_upgrade! + end end end - - def client - unless @client - Tumblr.configure do |config| - config.consumer_key = ENV['MUMBLR_API_KEY'] - config.consumer_secret = ENV['MUMBLR_API_SECRET'] - end - @client = Tumblr::Client.new - end - @client - end end
Put datamapper in the master class for the module
diff --git a/lib/stairs/railtie.rb b/lib/stairs/railtie.rb index abc1234..def5678 100644 --- a/lib/stairs/railtie.rb +++ b/lib/stairs/railtie.rb @@ -1,5 +1,7 @@ module Stairs class Railtie < Rails::Railtie - load "stairs/tasks.rb" + rake_tasks do + load "stairs/tasks.rb" + end end end
Use proper config option in Railtie
diff --git a/lib/uri/query_hash.rb b/lib/uri/query_hash.rb index abc1234..def5678 100644 --- a/lib/uri/query_hash.rb +++ b/lib/uri/query_hash.rb @@ -2,19 +2,6 @@ ## # Extends a hash with query string reordering/deleting capabilities module QueryHash - def ordered_query_string(*args) - unmentioned_keys = keys.reject { |key| args.include?(key.to_s) || args.include?(key.to_sym) } - ( - args.uniq.map { |key| render_value(key, self[key]) }.reject { |i| i.nil? } + - unmentioned_keys.map { |key| render_value(key, self[key]) } - ).join('&') - end - - def delete_keys(*args) - args.uniq.map { |key| delete(key.to_s) } - to_s - end - def [](key) item = super key item = super(key.to_s) if item.nil? || item.length == 0
Remove redundant methods from QueryHash
diff --git a/lib/routes.rb b/lib/routes.rb index abc1234..def5678 100644 --- a/lib/routes.rb +++ b/lib/routes.rb @@ -7,10 +7,10 @@ use Pliny::Middleware::Timeout, timeout: Config.timeout.to_i if Config.timeout.to_i > 0 use Pliny::Middleware::Versioning, default: Config.versioning_default, - app_name: Config.versioning_app_name if Config.versioning.downcase == 'true' + app_name: Config.versioning_app_name if Config.versioning? == 'true' use Rack::Deflater use Rack::MethodOverride - use Rack::SSL if Config.force_ssl.downcase == 'true' + use Rack::SSL if Config.force_ssl? == 'true' use Pliny::Router do # mount all endpoints here
Switch to question mark versions of config /cc @tmaier
diff --git a/lib/slatan.rb b/lib/slatan.rb index abc1234..def5678 100644 --- a/lib/slatan.rb +++ b/lib/slatan.rb @@ -5,18 +5,38 @@ require "slatan/buttocks" module Slatan + class << self + ## running slatan + # @param options + # daemonize: running on daemon mode(default false) + def run(options = {}) + { + daemonize: false + }.merge(options) - class << self - def run Buttocks.init @heart = Heart.new begin + daemonize if options[:daemonize] @heart.beat rescue => e Buttocks.fatal "#{e.backtrace.first}: #{e.message} (#{e.class})" end end + + def daemonize + begin + Process.daemon + + File.open(Spirit.pid_file_path, 'w') do |f| + f << Process.pid + end + rescue => e + Buttocks.fatal "failed to daemonize slatan.(#{e.message})" + exit + end + end end end
Add daemonize mode to Slatan
diff --git a/app/models/lesson.rb b/app/models/lesson.rb index abc1234..def5678 100644 --- a/app/models/lesson.rb +++ b/app/models/lesson.rb @@ -1,8 +1,8 @@ class Lesson < ActiveRecord::Base attr_accessible :background, :title - validates :title, :presence => { :message => "for course can't be blank" } - validates :background, :presence => { :message => "for course can't be blank" } + validates :title, :presence => { :message => "for lesson can't be blank" } + validates :background, :presence => { :message => "for lesson can't be blank" } belongs_to :course @@ -15,7 +15,7 @@ end def assign_defaults - self.title = Settings.lessons[:default_title] + self.title = "Lesson #{(course.lessons.count + 1)} - #{Settings.lessons[:default_title]}" self.background = Settings.lessons[:default_background] end end
Update Validation Message for Lesson Fix typo (stated 'Course') in the validation message for the Lesson validation.
diff --git a/emailer.rb b/emailer.rb index abc1234..def5678 100644 --- a/emailer.rb +++ b/emailer.rb @@ -1,18 +1,21 @@ class Emailer def initialize - @client = SendGrid::Client.new(api_key: ENV["SENDGRID_API_KEY"]) + @sendgrid = SendGrid::API.new(api_key: ENV["SENDGRID_API_KEY"]) end def voicemail_notification(url, duration, phone_number) body = "A new voicemail has arrived from #{phone_number}!\n\nListen to it here: #{url}\n#{duration} seconds long." - message = SendGrid::Mail.new( - to: ENV["EMAIL_TO"], - from: ENV["EMAIL_FROM"], - subject: "New Voicemail from #{phone_number}", - text: body, - html: body.gsub(/\n/, '<br>') - ) - response = @client.send(message) - raise "#{response.code}: #{response.body}" if response.code != 200 + message = SendGrid::Mail.new + message.from = SendGrid::Email.new(email: ENV["EMAIL_FROM"]) + message.subject = "New Voicemail from #{phone_number}" + personalization = SendGrid::Personalization.new + personalization.add_to(SendGrid::Email.new(email: ENV["EMAIL_TO"])) + message.add_personalization(personalization) + + message.add_content(SendGrid::Content.new(type: 'text/plain', value: body)) + message.add_content(SendGrid::Content.new(type: 'text/html', value: body.gsub(/\n/, '<br>'))) + + response = @sendgrid.client.mail._('send').post(request_body: message.to_json) + raise "#{response.status_code}: #{response.body}" if response.status_code != "202" end end
Update sendgrid code for new gem
diff --git a/features/step_definitions/event_registration_steps.rb b/features/step_definitions/event_registration_steps.rb index abc1234..def5678 100644 --- a/features/step_definitions/event_registration_steps.rb +++ b/features/step_definitions/event_registration_steps.rb @@ -16,6 +16,14 @@ Given /^my email address is "(.*)"$/ do |email| @email = email +end + +Given /^my phone number is "(.*?)"$/ do |phone| + @phone = phone +end + +Given /^my address is "(.*?)"$/ do |address| + @address = address end Given /^that company has a invoice contact email of "(.*?)"$/ do |email|
Add steps for personal phone and address 0:10
diff --git a/norada-solve360.gemspec b/norada-solve360.gemspec index abc1234..def5678 100644 --- a/norada-solve360.gemspec +++ b/norada-solve360.gemspec @@ -15,6 +15,6 @@ gem.version = NoradaSolve360::VERSION gem.add_dependency("json") gem.add_dependency("rest-client") - gem.add_development_dependency "bundler", "~> 1.7" + gem.add_development_dependency "bundler", "~> 2.0" gem.add_development_dependency "rake", "~> 12.3" end
Update bundler requirement from ~> 1.7 to ~> 2.0 Updates the requirements on [bundler](https://github.com/bundler/bundler) to permit the latest version. - [Release notes](https://github.com/bundler/bundler/releases) - [Changelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md) - [Commits](https://github.com/bundler/bundler/compare/v1.7.0...v2.0.1) Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,3 +1,5 @@+Topic.destroy_all +TwitterHandle.destroy_all require_relative "news_seeds.rb" #Tana require_relative "companies_seeds.rb" #Tana require_relative "celebs_seeds.rb" #Monica
Destroy existing seeded data before re-seeding This prevents doubling up on topics and handles.
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,6 +1,10 @@ CardTemplate.delete_all Card.delete_all AdminUser.delete_all + +if Rails.env.development? + AdminUser.create(username: "dev", password: "dev") +end template_list = [ {
Add default admin for development environment
diff --git a/app/models/concerns/cube_data_model/vocabularies.rb b/app/models/concerns/cube_data_model/vocabularies.rb index abc1234..def5678 100644 --- a/app/models/concerns/cube_data_model/vocabularies.rb +++ b/app/models/concerns/cube_data_model/vocabularies.rb @@ -6,5 +6,6 @@ QB = RDF::Vocabulary.new('http://purl.org/linked-data/cube#') UKHPI = RDF::Vocabulary.new('http://landregistry.data.gov.uk/def/ukhpi/') QUDT = RDF::Vocabulary.new('http://qudt.org/schema/qudt#') + DBPEDIA_RESOURCE = RDF::Vocabulary.new('http://dbpedia.org/resource/') end end
Add vocabulary for DbPedia resources
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -16,7 +16,8 @@ repository = Factory.create(:repository, { user: user, - owner: user + owner: user, + name: "repo1" }) sleep(10) # Wait for repository to be created
Add repo name to seed repository generator
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -8,5 +8,7 @@ puts 'SETTING UP DEFAULT USER LOGIN' user = User.create! :name => 'First User', :email => 'user@example.com', :password => 'please', :password_confirmation => 'please' puts 'New user created: ' << user.name -user2 = User.create! :name => 'Second User', :email => 'user2@example.com', :password => 'please', :password_confirmation => 'please' -puts 'New user created: ' << user2.name +root_page = Page.create! :slug => "/", :content => {"page_title"=>"front", "page_content"=>"content"} +puts 'Root page created' +info_page = Page.create! :slug => "info", :content => {"page_title"=>"info", "page_content"=>"content"} +puts 'Info page created'
Add couple of pages to seed data.
diff --git a/lib/bme/runner.rb b/lib/bme/runner.rb index abc1234..def5678 100644 --- a/lib/bme/runner.rb +++ b/lib/bme/runner.rb @@ -8,8 +8,13 @@ threads.times do |thread_index| groups.each_with_index do |g, group_index| thread_group << Thread.new do - repetitions.times do |i| - g.call("[#{group_index}][#{thread_index}][#{i}]") + begin + repetitions.times do |i| + g.call("[#{group_index}][#{thread_index}][#{i}]") + end + rescue => e + warn "#{e.inspect}\n#{e.backtrace.join("\n\t")}" + exit(0) end end end
Exit immediately if an exception bubbles out to Thread run - Don't want test to be corrupted by missing runs from dead threads
diff --git a/Casks/clion-bundled-jdk.rb b/Casks/clion-bundled-jdk.rb index abc1234..def5678 100644 --- a/Casks/clion-bundled-jdk.rb +++ b/Casks/clion-bundled-jdk.rb @@ -0,0 +1,21 @@+cask :v1 => 'clion-bundled-jdk' do + version '1.0' + sha256 '3e18c548084122e33bf2545b62425b6ae2b3fc74945133b7edd03fac34f7f2f2' + + url "https://download.jetbrains.com/cpp/CLion-#{version}-custom-jdk-bundled.dmg" + name 'CLion' + homepage 'https://www.jetbrains.com/clion' + license :commercial + + app 'CLion.app' + + zap :delete => [ + '~/Library/Preferences/com.jetbrains.CLion.plist', + "~/Library/Preferences/clion10", + "~/Library/Application Support/clion10", + "~/Library/Caches/clion10", + "~/Library/Logs/clion10", + ] + + conflicts_with :cask => 'clion' +end
Add CLion 1.0 with bundled JDK 1.8
diff --git a/core/lib/spree/core/permalinks.rb b/core/lib/spree/core/permalinks.rb index abc1234..def5678 100644 --- a/core/lib/spree/core/permalinks.rb +++ b/core/lib/spree/core/permalinks.rb @@ -9,7 +9,7 @@ class_attribute :permalink_options end - module ClassMethods + class_methods do def make_permalink(options = {}) options[:field] ||= :permalink self.permalink_options = options
Use ActiveSupport::Concern syntax in Permalinks
diff --git a/core/lib/generators/templates/db/migrate/20100223170312_sti_for_transactions.rb b/core/lib/generators/templates/db/migrate/20100223170312_sti_for_transactions.rb index abc1234..def5678 100644 --- a/core/lib/generators/templates/db/migrate/20100223170312_sti_for_transactions.rb +++ b/core/lib/generators/templates/db/migrate/20100223170312_sti_for_transactions.rb @@ -3,7 +3,7 @@ rename_table "creditcard_txns", "transactions" add_column "transactions", "type", :string remove_column "transactions", "creditcard_id" - Transaction.update_all(:type => 'CreditcardTxn') + Transaction.update_all(:type => 'CreditcardTxn') if defined? Transaction end def self.down
Fix for legacy migration due to removal of Transaction class.
diff --git a/lib/alephant/views/base.rb b/lib/alephant/views/base.rb index abc1234..def5678 100644 --- a/lib/alephant/views/base.rb +++ b/lib/alephant/views/base.rb @@ -1,16 +1,16 @@ require 'mustache' require 'alephant/views' require 'hashie' - +require 'json' require 'i18n' module Alephant::Views class Base < Mustache attr_accessor :data, :locale - def initialize(data = {}) + def initialize(data = {}, locale = 'en') @data = Hashie::Mash.new data - @locale = 'en' + @locale = locale end def locale=(l) @@ -19,7 +19,14 @@ def t(*args) I18n.locale = @locale - I18n.t(*args) + lambda do |comma_delimited_args| + args = comma_delimited_args.strip.split ',' + key = args.shift + params = args.empty? ? {} : JSON.parse(args.first).with_indifferent_access + prefix = /\/([^\/]+)\./.match(template_file)[1] + + I18n.translate("#{prefix}.#{key}", params) + end end def self.inherited(subclass)
Return a lambda in the translation instead of a standard value. Also adds template name as prefix key for translation
diff --git a/ls_stash.gemspec b/ls_stash.gemspec index abc1234..def5678 100644 --- a/ls_stash.gemspec +++ b/ls_stash.gemspec @@ -8,15 +8,16 @@ s.authors = ['Chris Fordham'] s.email = 'chris@fordham-nagy.id.au' s.homepage = 'https://github.com/flaccid/ls_stash' - + s.licenses = ['Apache-2.0'] s.summary = %(Atlassian Stash listing tool.) s.description = %(A command line tool that lists objects from Atlassian Stash.) - s.add_runtime_dependency('thor') + s.add_runtime_dependency 'thor', '~> 0' s.files = Dir.glob('bin/*') + - Dir.glob('lib/*.rb') + Dir.glob('lib/*.rb') + + Dir.glob('lib/*/*.rb') s.executables = Dir.glob('bin/*').map { |f| File.basename(f) } end
Add licenses, included all libs, better define thor dep in gemspec.
diff --git a/lib/bond/readlines/ruby.rb b/lib/bond/readlines/ruby.rb index abc1234..def5678 100644 --- a/lib/bond/readlines/ruby.rb +++ b/lib/bond/readlines/ruby.rb @@ -1,7 +1,7 @@ # A pure ruby readline which requires {rb-readline}[https://github.com/luislavena/rb-readline]. class Bond::Ruby < Bond::Readline def self.readline_setup - require 'rb-readline' + require 'readline' rescue LoadError abort "Bond Error: rb-readline gem is required for this readline plugin" + " -> gem install rb-readline"
Fix require readline bug. When using gem rb-readline, require 'readline' not 'rb-readline'
diff --git a/lib/vagrant-ca-certificates/config/ca_certificates.rb b/lib/vagrant-ca-certificates/config/ca_certificates.rb index abc1234..def5678 100644 --- a/lib/vagrant-ca-certificates/config/ca_certificates.rb +++ b/lib/vagrant-ca-certificates/config/ca_certificates.rb @@ -21,12 +21,13 @@ @certs = [] if @certs == UNSET_VALUE @certs_path = '/usr/share/ca-certificates' if @certs_path == UNSET_VALUE - @certs.each do |cert| - next unless cert.is_a?(URL) - tempfile = Tempfile.new(['cacert', '.pem']) - Vagrant::Util::Downloader.new(cert.to_s, tempfile.path) - cert = tempfile.path - end + # This blows up with "...CaCertificates::URL (NameError)" + #@certs.each do |cert| + # next unless cert.is_a?(URL) + # tempfile = Tempfile.new(['cacert', '.pem']) + # Vagrant::Util::Downloader.new(cert.to_s, tempfile.path) + # cert = tempfile.path + #end end end end
Comment out a block of code in the config code due to URL name error.
diff --git a/FanBeat.podspec b/FanBeat.podspec index abc1234..def5678 100644 --- a/FanBeat.podspec +++ b/FanBeat.podspec @@ -15,7 +15,7 @@ s.ios.deployment_target = '8.0' - s.source_files = 'FanBeat/{Resources,Classes}/**/*' + s.source_files = 'FanBeat/Classes/**/*' s.frameworks = 'UIKit', 'StoreKit' s.dependency 'Branch', '~> 0.12'
Revert "trying to fix build error" This reverts commit e947a61f344cf01a6c073513d582e1f9ed7325f8.
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,4 +1,4 @@-Post.create(title: "Lorem ipsum", "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...") +Post.create(title: "Lorem ipsum", body: "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...") Post.create(title: "Dolor sit amet", body: "Consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")
Fix typo in seed file
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,3 +1,4 @@ User.create!([ - {email: "admin@example.com", password: "changeme", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 1, current_sign_in_at: "2014-03-10 11:28:22", last_sign_in_at: "2014-03-10 11:28:22", current_sign_in_ip: "127.0.0.1", last_sign_in_ip: "127.0.0.1", role: 2}, {email: "user@example.com", password: "changeme", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 1, current_sign_in_at: "2014-03-10 11:28:22", last_sign_in_at: "2014-03-10 11:28:22", current_sign_in_ip: "127.0.0.1", last_sign_in_ip: "127.0.0.1", role: 0} + { name: "Admin", username: "admin", email: "admin@example.com", password: "changeme", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 1, current_sign_in_at: "2014-03-10 11:28:22", last_sign_in_at: "2014-03-10 11:28:22", current_sign_in_ip: "127.0.0.1", last_sign_in_ip: "127.0.0.1", role: 2 }, + { name: "User", username: "user", email: "user@example.com", password: "changeme", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 1, current_sign_in_at: "2014-03-10 11:28:22", last_sign_in_at: "2014-03-10 11:28:22", current_sign_in_ip: "127.0.0.1", last_sign_in_ip: "127.0.0.1", role: 0 } ])
Update seed.rb to include username and user
diff --git a/lib/cookieless_sessions.rb b/lib/cookieless_sessions.rb index abc1234..def5678 100644 --- a/lib/cookieless_sessions.rb +++ b/lib/cookieless_sessions.rb @@ -20,14 +20,8 @@ Rails.application.config.session_options[:key] end - if Rails::VERSION::MAJOR < 4 - def session_id - request.session_options[:id] - end - else - def session_id - request.session.id - end + def session_id + request.session.id end def session_is_not_cookie_only?
Remove support for rails < 4
diff --git a/app/controllers/concerns/gobierto_people/dates_range_helper.rb b/app/controllers/concerns/gobierto_people/dates_range_helper.rb index abc1234..def5678 100644 --- a/app/controllers/concerns/gobierto_people/dates_range_helper.rb +++ b/app/controllers/concerns/gobierto_people/dates_range_helper.rb @@ -0,0 +1,50 @@+module GobiertoPeople + module DatesRangeHelper + extend ActiveSupport::Concern + + included do + helper_method :dates_range?, :filter_start_date, :filter_end_date + end + + def filter_start_date + date_from_param_or_session(:start_date, empty_date_range_param?) if site_configuration_dates_range? + end + + def filter_end_date + date_from_param_or_session(:end_date, empty_date_range_param?) if site_configuration_dates_range? + end + + def site_configuration_dates_range? + site_configuration_date_range.values.compact.present? + end + + def empty_date_range_param? + (params.keys & ["start_date", "end_date"]).empty? + end + + private + + def site_configuration_date_range + @site_configuration_date_range ||= { start_date: parse_date(current_site.configuration.configuration_variables["gobierto_people_default_filter_start_date"]), + end_date: parse_date(current_site.configuration.configuration_variables["gobierto_people_default_filter_end_date"]) } + end + + def parse_date(date) + return unless date + Time.zone.parse(date) + rescue ArgumentError + nil + end + + def date_from_param_or_session(param, use_default) + date = if params[param].present? + Time.zone.parse(params[param]) + else + use_default ? site_configuration_date_range[param] :nil + end + session[param] = date + rescue ArgumentError + default_value + end + end +end
Add concern to filter by date ranges in gobierto_people controllers
diff --git a/lib/draper/test/rspec_integration.rb b/lib/draper/test/rspec_integration.rb index abc1234..def5678 100644 --- a/lib/draper/test/rspec_integration.rb +++ b/lib/draper/test/rspec_integration.rb @@ -12,11 +12,19 @@ } end +module Draper + module RSpec + class Railtie < Rails::Railtie + config.after_initialize do |app| + if defined?(Capybara) + require 'capybara/rspec/matchers' -if defined?(Capybara) - require 'capybara/rspec/matchers' - - RSpec.configure do |config| - config.include Capybara::RSpecMatchers, :type => :decorator + ::RSpec.configure do |config| + config.include Capybara::RSpecMatchers, :type => :decorator + end + end + end + end end end +
Fix race condition in Capybara integration. Fixes #365.
diff --git a/lib/dragonfly-imaginary.rb b/lib/dragonfly-imaginary.rb index abc1234..def5678 100644 --- a/lib/dragonfly-imaginary.rb +++ b/lib/dragonfly-imaginary.rb @@ -9,6 +9,7 @@ include Dragonfly::Configurable configurable_attr :server_url + configurable_attr :cdn_url configurable_attr :bucket configurable_attr :username configurable_attr :password @@ -19,7 +20,8 @@ bucket: bucket, username: username, password: password, - secret: secret) + secret: secret, + cdn_base_url: cdn_url) end def store(temp_object, opts={})
Support cdn_base_url. Need to improve naming. :-)
diff --git a/lib/git_pissed.rb b/lib/git_pissed.rb index abc1234..def5678 100644 --- a/lib/git_pissed.rb +++ b/lib/git_pissed.rb @@ -7,7 +7,7 @@ require 'git_pissed/cli' module GitPissed - MAX_REVISIONS = 5 + MAX_REVISIONS = 30 DEFAULT_WORDS = %w( shit
Increase default max revisions to 30
diff --git a/lib/ldapter/adapters/net_ldap_ext.rb b/lib/ldapter/adapters/net_ldap_ext.rb index abc1234..def5678 100644 --- a/lib/ldapter/adapters/net_ldap_ext.rb +++ b/lib/ldapter/adapters/net_ldap_ext.rb @@ -1,11 +1,13 @@ require 'net/ldap' -# Monkey-patched in support for new superior. class Net::LDAP # :nodoc: + + # Erroneously descends from Exception remove_const(:LdapError) class LdapError < RuntimeError # :nodoc: end class Connection # :nodoc: + # Monkey-patched in support for new superior. def rename args old_dn = args[:olddn] or raise "Unable to rename empty DN" new_rdn = args[:newrdn] or raise "Unable to rename to empty RDN" @@ -18,7 +20,7 @@ pkt = [next_msgid.to_ber, request].to_ber_sequence @conn.write pkt - (be = @conn.read_ber(AsnSyntax)) && (pdu = LdapPdu.new( be )) && (pdu.app_tag == 13) or raise LdapError.new( "response missing or invalid" ) + (be = @conn.read_ber(AsnSyntax)) && (pdu = Net::LdapPdu.new( be )) && (pdu.app_tag == 13) or raise LdapError.new( "response missing or invalid" ) pdu.result_code end end
Fix scope issues in new rename method
diff --git a/HTMLKit.podspec b/HTMLKit.podspec index abc1234..def5678 100644 --- a/HTMLKit.podspec +++ b/HTMLKit.podspec @@ -14,9 +14,9 @@ s.source = { :git => "https://github.com/iabudiab/HTMLKit.git", :tag => s.version } - s.source_files = "HTMLKit", "HTMLKit/**/*.{h,m}" + s.source_files = "Sources", "Sources/**/*.{h,m}" s.private_header_files = [ - 'HTMLKit/**/*{HTMLToken,HTMLTokens,HTMLTagToken,HTMLCharacterToken,HTMLCommentToken,HTMLDOCTYPEToken,HTMLEOFToken,HTMLTokenizer,HTMLTokenizerCharacters,HTMLTokenizerEntities,HTMLTokenizerStates,HTMLElementAdjustment,HTMLElementTypes,HTMLInputStreamReader,HTMLListOfActiveFormattingElements,HTMLNodeTraversal,HTMLParseErrorToken,HTMLParserInsertionModes,HTMLStackOfOpenElements,HTMLNode+Private,HTMLMarker,CSSCodePoints,CSSInputStream}.h' + 'Sources/**/*{HTMLToken,HTMLTokens,HTMLTagToken,HTMLCharacterToken,HTMLCommentToken,HTMLDOCTYPEToken,HTMLEOFToken,HTMLTokenizer,HTMLTokenizerCharacters,HTMLTokenizerEntities,HTMLTokenizerStates,HTMLElementAdjustment,HTMLElementTypes,HTMLInputStreamReader,HTMLListOfActiveFormattingElements,HTMLNodeTraversal,HTMLParseErrorToken,HTMLParserInsertionModes,HTMLStackOfOpenElements,HTMLNode+Private,HTMLMarker,CSSCodePoints,CSSInputStream}.h' ] s.requires_arc = true
Fix source code and header paths in podspec file Source code resides in "Sources" and "Sources/include" now after spm refactor
diff --git a/test/unit/tedrahcu_test.rb b/test/unit/tedrahcu_test.rb index abc1234..def5678 100644 --- a/test/unit/tedrahcu_test.rb +++ b/test/unit/tedrahcu_test.rb @@ -2,7 +2,7 @@ class TedrahcuTest < Minitest::Test def test_detects_charset - assert_equal nil, Tedrahcu.detect(nil) + assert_nil Tedrahcu.detect(nil) assert_equal '', Tedrahcu.detect('') assert_equal 'UTF-8', Tedrahcu.detect('é') assert_equal 'ASCII', Tedrahcu.detect('There are so many ASCII characters.')
Use assert_nil to test for nil.
diff --git a/lib/netzke/basepack/search_window.rb b/lib/netzke/basepack/search_window.rb index abc1234..def5678 100644 --- a/lib/netzke/basepack/search_window.rb +++ b/lib/netzke/basepack/search_window.rb @@ -20,6 +20,7 @@ super.tap do |s| s[:items] = [:search_panel.component(:prevent_header => true)] s[:title] = I18n.t('netzke.basepack.search_window.title') + s[:persistence] = false end end
Disable persistence for search window in GridPanel
diff --git a/lib/rails/generators/alchemy/base.rb b/lib/rails/generators/alchemy/base.rb index abc1234..def5678 100644 --- a/lib/rails/generators/alchemy/base.rb +++ b/lib/rails/generators/alchemy/base.rb @@ -34,7 +34,7 @@ def load_alchemy_yaml(name) YAML.safe_load(ERB.new(File.read("#{Rails.root}/config/alchemy/#{name}")).result, YAML_WHITELIST_CLASSES, [], true) rescue Errno::ENOENT - puts "\nERROR: Could not read config/alchemy/#{name} file. Please run: rails generate alchemy:scaffold" + puts "\nERROR: Could not read config/alchemy/#{name} file. Please run: `rails generate alchemy:install`" end end end
Fix the error message for missing yml file.
diff --git a/db/migrate/20130801155107_rename_staff_action_pk.rb b/db/migrate/20130801155107_rename_staff_action_pk.rb index abc1234..def5678 100644 --- a/db/migrate/20130801155107_rename_staff_action_pk.rb +++ b/db/migrate/20130801155107_rename_staff_action_pk.rb @@ -0,0 +1,9 @@+class RenameStaffActionPk < ActiveRecord::Migration + def up + execute "ALTER INDEX admin_logs_pkey RENAME TO staff_action_logs_pkey" + end + + def down + execute "ALTER INDEX staff_action_logs_pkey RENAME TO admin_logs_pkey" + end +end
Rename the PK index to support table rename
diff --git a/spec/helpers/application_helper/buttons/db_new_spec.rb b/spec/helpers/application_helper/buttons/db_new_spec.rb index abc1234..def5678 100644 --- a/spec/helpers/application_helper/buttons/db_new_spec.rb +++ b/spec/helpers/application_helper/buttons/db_new_spec.rb @@ -0,0 +1,18 @@+describe ApplicationHelper::Button::DbNew do + let(:view_context) { setup_view_context_with_sandbox({}) } + let(:dashboard_count) { 9 } + let(:widgetsets) { Array.new(dashboard_count) { |_i| FactoryGirl.create(:miq_widget_set) } } + let(:button) { described_class.new(view_context, {}, {'widgetsets' => widgetsets}, {}) } + + describe '#calculate_properties' do + before { button.calculate_properties } + + context 'when dashboard group is full' do + let(:dashboard_count) { 10 } + it_behaves_like 'a disabled button', 'Only 10 Dashboards are allowed for a group' + end + context 'when dashboard group has still room for a new dashboard' do + it_behaves_like 'an enabled button' + end + end +end
Create spec examples for DbNew button class
diff --git a/spec/qiita/teams/services/services/chatwork_v1_spec.rb b/spec/qiita/teams/services/services/chatwork_v1_spec.rb index abc1234..def5678 100644 --- a/spec/qiita/teams/services/services/chatwork_v1_spec.rb +++ b/spec/qiita/teams/services/services/chatwork_v1_spec.rb @@ -1,5 +1,117 @@ describe Qiita::Team::Services::Services::ChatworkV1 do + include Qiita::Team::Services::Helpers::EventHelper + include Qiita::Team::Services::Helpers::HttpClientStubHelper include Qiita::Team::Services::Helpers::ServiceHelper + EXPECTED_AVAILABLE_EVENT_NAMES = [ + :comment_created, + :item_became_coediting, + :item_created, + :item_updated, + :project_activated, + :project_archived, + :project_created, + :project_updated, + :team_member_added, + ] + + shared_context "Delivery success" do + before do + stubs = get_http_client_stub(service) + stubs.post("/v1/rooms/#{room_id}/messages") do |env| + [200, { "Content-Type" => "application/json" }, { message_id: 1 }] + end + end + end + + shared_context "Delivery fail" do + before do + stubs = get_http_client_stub(service) + stubs.post("/v1/rooms/#{room_id}/messages") do |env| + [400, {}, ""] + end + end + end + + let(:service) do + described_class.new(properties) + end + + let(:properties) do + { "room_id" => room_id, "token" => token } + end + + let(:room_id) do + 1 + end + + let(:token) do + "abc" + end + it_behaves_like "service" + + describe ".service_name" do + subject do + described_class.service_name + end + + it { should eq "ChatWork" } + end + + describe ".available_event_names" do + subject do + described_class.available_event_names + end + + it { should match_array EXPECTED_AVAILABLE_EVENT_NAMES } + end + + describe "#ping" do + subject do + service.ping + end + + it "sends a text message" do + expect(service).to receive(:send_message).with(a_kind_of(String)) + subject + end + + context "when message is delivered successful" do + include_context "Delivery success" + + it { expect { subject }.not_to raise_error } + end + + context "when message is not delivered" do + include_context "Delivery fail" + + it { expect { subject }.not_to raise_error } + end + end + + EXPECTED_AVAILABLE_EVENT_NAMES.each do |event_name| + describe "##{event_name}" do + subject do + service.public_send(event_name, public_send("#{event_name}_event")) + end + + it "sends a text message" do + expect(service).to receive(:send_message).with(a_kind_of(String)) + subject + end + + context "when message is delivered successfully" do + include_context "Delivery success" + + it { expect { subject }.not_to raise_error } + end + + context "when message is not delivered successfully" do + include_context "Delivery fail" + + it { expect { subject }.to raise_error(Qiita::Team::Services::DeliveryError) } + end + end + end end
Add spec of ChatWork service
diff --git a/spec/rspec/rails/matchers/relation_match_array_spec.rb b/spec/rspec/rails/matchers/relation_match_array_spec.rb index abc1234..def5678 100644 --- a/spec/rspec/rails/matchers/relation_match_array_spec.rb +++ b/spec/rspec/rails/matchers/relation_match_array_spec.rb @@ -0,0 +1,19 @@+require "spec_helper" + +describe "ActiveSupport::Relation =~ matcher" do + let!(:models) { Array.new(3) { MockableModel.create } } + + it "verifies that the scope returns the records on the right hand side, regardless of order" do + MockableModel.scoped.should =~ models.reverse + end + + it "fails if the scope encompasses more records than on the right hand side" do + another_model = MockableModel.create + + MockableModel.scoped.should_not =~ models.reverse + end + + it "fails if the scope encompasses fewer records than on the right hand side" do + MockableModel.limit(models.length - 1).should_not =~ models.reverse + end +end
Add spec coverage for ActiveSupport::Relation =~ matcher
diff --git a/spec/unit/mutant/loader/eval/class_methods/run_spec.rb b/spec/unit/mutant/loader/eval/class_methods/run_spec.rb index abc1234..def5678 100644 --- a/spec/unit/mutant/loader/eval/class_methods/run_spec.rb +++ b/spec/unit/mutant/loader/eval/class_methods/run_spec.rb @@ -6,9 +6,9 @@ subject { object.run(node, mutation_subject) } - let(:object) { described_class } - let(:path) { 'test.rb' } - let(:line) { 1 } + let(:object) { described_class } + let(:path) { __FILE__ } + let(:line) { 1 } let(:mutation_subject) do double('Subject', :source_path => path, :source_line => line) @@ -43,6 +43,6 @@ subject ::SomeNamespace::Bar .instance_method(:some_method) - .source_location.should eql(['test.rb', 3]) + .source_location.should eql([__FILE__, 3]) end end
Update path name to report the filename better on failure
diff --git a/app/controllers/news_items_controller.rb b/app/controllers/news_items_controller.rb index abc1234..def5678 100644 --- a/app/controllers/news_items_controller.rb +++ b/app/controllers/news_items_controller.rb @@ -1,9 +1,10 @@ class NewsItemsController < ApplicationController include NewsItemsHelper + before_filter :load_networks, :only => [:index, :search] + def index get_news_items - @networks = Network.all end def sort_options @@ -26,4 +27,8 @@ model = model_name.classify.constantize @news_items = model.with_sort(params[:sort_by]).by_network(current_network).paginate(:page => params[:page]) end + + def load_networks + @networks = Network.all + end end
Load networks for browsing and searching news items
diff --git a/app/controllers/thumbnails_controller.rb b/app/controllers/thumbnails_controller.rb index abc1234..def5678 100644 --- a/app/controllers/thumbnails_controller.rb +++ b/app/controllers/thumbnails_controller.rb @@ -6,7 +6,7 @@ def create thumb = Thumbnail.create( url_prefix: params["url_prefix"], - image: [params["image"]], + image: BSON::Binary.new(params["image"].force_encoding(Encoding::BINARY), :old), ) thumb.save
Fix a bug when storing binary image to database
diff --git a/app/services/process_hashtags_service.rb b/app/services/process_hashtags_service.rb index abc1234..def5678 100644 --- a/app/services/process_hashtags_service.rb +++ b/app/services/process_hashtags_service.rb @@ -4,7 +4,7 @@ def call(status, tags = []) tags = status.text.scan(Tag::HASHTAG_RE).map(&:first) if status.local? - tags.map { |str| str.mb_chars.downcase }.uniq.each do |tag| + tags.map { |str| str.mb_chars.downcase }.uniq{ |t| t.to_s }.each do |tag| status.tags << Tag.where(name: tag).first_or_initialize(name: tag) end
Call uniq on the string version of mb_chars tags
diff --git a/lib/primer/base_service.rb b/lib/primer/base_service.rb index abc1234..def5678 100644 --- a/lib/primer/base_service.rb +++ b/lib/primer/base_service.rb @@ -1,13 +1,22 @@ module Primer class BaseService class << self - attr_reader :running_command - def set_running_command command + attr_reader :running_command, :port, :repo_name + + def set_port(port) + @port = port + end + + def set_repo_name(repo_name) + @repo_name = repo_name + end + + def set_running_command(command) @running_command = command end - def register name - Primer.register name, self + def register(name) + Primer.register(name, self) end end @@ -32,7 +41,7 @@ end end - status = if stopped then :stopped else :started end + status = stopped ? :stopped : :started [status, pid] end @@ -42,10 +51,10 @@ end protected - def run command + def run(command) Bundler.with_clean_env do system command end end end -end+end
Add methods to dry up service classes
diff --git a/lib/plyr/rails.rb b/lib/plyr/rails.rb index abc1234..def5678 100644 --- a/lib/plyr/rails.rb +++ b/lib/plyr/rails.rb @@ -6,17 +6,23 @@ initializer :append_dependent_assets_path, :group => :all do |app| app.config.assets.paths += %w( sprite ) - app.config.assets.precompile += %w( plyr-captions-off.svg ) - app.config.assets.precompile += %w( plyr-captions-on.svg ) - app.config.assets.precompile += %w( plyr-enter-fullscreen.svg ) - app.config.assets.precompile += %w( plyr-exit-fullscreen.svg ) - app.config.assets.precompile += %w( plyr-fast-forward.svg ) - app.config.assets.precompile += %w( plyr-muted.svg ) - app.config.assets.precompile += %w( plyr-pause.svg ) - app.config.assets.precompile += %w( plyr-play.svg ) - app.config.assets.precompile += %w( plyr-restart.svg ) - app.config.assets.precompile += %w( plyr-rewind.svg ) - app.config.assets.precompile += %w( plyr-volume.svg ) + app.config.assets.precompile += %w( plyr-airplay.svg ) + app.config.assets.precompile += %w( plyr-captions-off.svg ) + app.config.assets.precompile += %w( plyr-captions-on.svg ) + app.config.assets.precompile += %w( plyr-download.svg ) + app.config.assets.precompile += %w( plyr-enter-fullscreen.svg ) + app.config.assets.precompile += %w( plyr-exit-fullscreen.svg ) + app.config.assets.precompile += %w( plyr-fast-forward.svg ) + app.config.assets.precompile += %w( plyr-logo-vimeo.svg ) + app.config.assets.precompile += %w( plyr-logo-youtube.svg ) + app.config.assets.precompile += %w( plyr-muted.svg ) + app.config.assets.precompile += %w( plyr-pause.svg ) + app.config.assets.precompile += %w( plyr-pip.svg ) + app.config.assets.precompile += %w( plyr-play.svg ) + app.config.assets.precompile += %w( plyr-restart.svg ) + app.config.assets.precompile += %w( plyr-rewind.svg ) + app.config.assets.precompile += %w( plyr-settings.svg ) + app.config.assets.precompile += %w( plyr-volume.svg ) end end
Add the Sprite to assets precompile
diff --git a/lib/syoboemon/connector.rb b/lib/syoboemon/connector.rb index abc1234..def5678 100644 --- a/lib/syoboemon/connector.rb +++ b/lib/syoboemon/connector.rb @@ -5,43 +5,45 @@ DB_PATH = "/db.php" JSON_PATH = "/json.php" - def rss2_get(query) - connection.get(rss2_path, query) - end + class << self + def rss2_get(query) + connection.get(rss2_path, query) + end - def db_get(query) - connection.get(db_path, query) - end + def db_get(query) + connection.get(db_path, query) + end - def json_get(query) - connection.get(json_path, query) - end + def json_get(query) + connection.get(json_path, query) + end - private + private - def connection - connection ||= Faraday::Connection.new(url: url) do |c| - c.request :url_encoded - c.response :logger - c.adapter :net_http - c.response :raise_error + def connection + connection ||= Faraday::Connection.new(url: url) do |c| + c.request :url_encoded + c.response :logger + c.adapter :net_http + c.response :raise_error + end end - end - def url - URL - end + def url + URL + end - def rss2_path - RSS2_PATH - end + def rss2_path + RSS2_PATH + end - def db_path - DB_PATH - end + def db_path + DB_PATH + end - def json_path - JSON_PATH + def json_path + JSON_PATH + end end end end
Use class_method in Syoboemon::Connector module (add 'class<<self')
diff --git a/NSRails.podspec b/NSRails.podspec index abc1234..def5678 100644 --- a/NSRails.podspec +++ b/NSRails.podspec @@ -0,0 +1,39 @@+# +# Be sure to run `pod spec lint NSRails.podspec' to ensure this is a +# valid spec. +# +# Remove all comments before submitting the spec. Optional attributes are commented. +# +# For details see: https://github.com/CocoaPods/CocoaPods/wiki/The-podspec-format +# +Pod::Spec.new do |s| + s.name = "NSRails" + s.version = "2.0.1" + s.summary = "iOS/Mac OS framework for Rails." + s.homepage = "https://github.com/dingbat/nsrails" + s.license = { :type => 'Copyright (c) 2012 Dan Hassin', :file => 'license.md' } + s.author = { "Dan Hassin" => "danhassin@mac.com" } + s.source = { :git => "https://github.com/dingbat/nsrails.git", :tag => "v2.0.1" } + + # If this Pod runs only on iOS or OS X, then specify the platform and + # the deployment target. + # + s.platform = :ios, '5.0' + s.platform = :ios + + s.ios.deployment_target = '5.0' + s.osx.deployment_target = '10.7' + + # A list of file patterns which select the source files that should be + # added to the Pods project. If the pattern is a directory then the + # path will automatically have '*.{h,m,mm,c,cpp}' appended. + # + # Alternatively, you can use the FileList class for even more control + # over the selected files. + # (See http://rake.rubyforge.org/classes/Rake/FileList.html.) + # + s.source_files = 'nsrails', 'nsrails/Source/**/*.{h,m}' + s.public_header_files = 'nsrails/Source/**/*.h' + s.framework = 'CoreData' + s.requires_arc = true +end
Add spec file for cocopods.org
diff --git a/Pageboy.podspec b/Pageboy.podspec index abc1234..def5678 100644 --- a/Pageboy.podspec +++ b/Pageboy.podspec @@ -4,7 +4,7 @@ s.ios.deployment_target = '9.0' s.tvos.deployment_target = '10.0' - s.swift_version = '4.0' + s.swift_version = '4.2' s.requires_arc = true
Update swift version in podspec
diff --git a/app/controllers/planning_application/issues_controller.rb b/app/controllers/planning_application/issues_controller.rb index abc1234..def5678 100644 --- a/app/controllers/planning_application/issues_controller.rb +++ b/app/controllers/planning_application/issues_controller.rb @@ -4,7 +4,7 @@ def new @issue = @planning_application.populate_issue - @start_location = @planning_application.location + @start_location = @planning_application.location || index_start_location render 'issues/new' end
Add a default if a planning app has no location Fixes #508
diff --git a/activemodel/lib/active_model/validations/helper_methods.rb b/activemodel/lib/active_model/validations/helper_methods.rb index abc1234..def5678 100644 --- a/activemodel/lib/active_model/validations/helper_methods.rb +++ b/activemodel/lib/active_model/validations/helper_methods.rb @@ -1,6 +1,6 @@ module ActiveModel module Validations - module HelperMethods + module HelperMethods # :nodoc: private def _merge_attributes(attr_names) options = attr_names.extract_options!.symbolize_keys
Add nodoc to the Validations::Helpers [ci skip]
diff --git a/app/controllers/image_management/application_controller.rb b/app/controllers/image_management/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/image_management/application_controller.rb +++ b/app/controllers/image_management/application_controller.rb @@ -1,5 +1,5 @@ module ImageManagement - class ApplicationController < ActionController::Base + class ApplicationController < ::ApplicationController protect_from_forgery # FIXME Remove filter once support for custom XML with nested resources is
Extend application controller from host
diff --git a/db/post_migrate/20180105101928_schedule_build_stage_migration.rb b/db/post_migrate/20180105101928_schedule_build_stage_migration.rb index abc1234..def5678 100644 --- a/db/post_migrate/20180105101928_schedule_build_stage_migration.rb +++ b/db/post_migrate/20180105101928_schedule_build_stage_migration.rb @@ -3,7 +3,7 @@ DOWNTIME = false MIGRATION = 'MigrateBuildStage'.freeze - BATCH = 10_000 + BATCH = 1000 class Build < ActiveRecord::Base include EachBatch
Reduce batch size of stages we schedule for a migration
diff --git a/app/models/mdm/user.rb b/app/models/mdm/user.rb index abc1234..def5678 100644 --- a/app/models/mdm/user.rb +++ b/app/models/mdm/user.rb @@ -27,6 +27,10 @@ serialized_prefs_attr_accessor :time_zone, :session_key serialized_prefs_attr_accessor :last_login_address # specifically NOT last_login_ip to prevent confusion with AuthLogic magic columns (which dont work for serialized fields) + # Model Associations + + attr_accessible :owned_workspaces, :tags, :workspaces + Metasploit::Concern.run(self) end
Revert "Drop another attr_accessible call" This reverts commit c5bcead4c75126e093ac7717886105b3bb256a1e.
diff --git a/lib/wiselinks/rendering.rb b/lib/wiselinks/rendering.rb index abc1234..def5678 100644 --- a/lib/wiselinks/rendering.rb +++ b/lib/wiselinks/rendering.rb @@ -14,7 +14,7 @@ self.headers['Cache-Control'] = 'no-cache, no-store, max-age=0, must-revalidate' self.headers['Pragma'] = 'no-cache' - if self.request.wiselinks_partial? + if self.request.wiselinks_partial? || options[:partial].present? Wiselinks.log("Processing partial request") options[:partial] ||= action_name else
Add more flexible render process.
diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index abc1234..def5678 100644 --- a/lib/tasks/db.rake +++ b/lib/tasks/db.rake @@ -1,6 +1,5 @@ namespace :db do namespace :clear do - desc 'Remove all votes.' task :votes => :environment do Vote.destroy_all @@ -20,6 +19,64 @@ task :issues => :environment do Issue.destroy_all end + end + + namespace :dump do + task :issues => :environment do + data = Issue.all.map { |issue| + i = issue.as_json + + # not mass-assignable + i.delete('created_at') + i.delete('updated_at') + i.delete('slug') + i.delete('id') + + i['topic_names'] = issue.topics.map { |e| e.name } + i['promise_external_ids'] = issue.promises.map { |e| e.external_id } + + i + } + + out = "issues.json" + File.open(out, "w") { |io| io << data.to_json } + + puts "wrote #{out}" + end + + task :users => :environment do + data = User.all.as_json(:methods => :encrypted_password) + + out = "users.json" + File.open(out, "w") { |io| io << data.to_json } + + puts "wrote #{out}" + end + end + + namespace :load do + task :issues => :environment do + file = ENV['FILE'] or raise "must set FILE" + data = MultiJson.decode(open(file).read) + + data.each do |hash| + topics = hash.delete('topic_names').map { |name| Topic.find_by_name!(name) } + promises = hash.delete('promise_external_ids').map { |id| Promise.find_by_external_id!(id) } + + issue = Issue.create(hash) + issue.topics = topics + issue.promises = promises + + issue.save! + end + end + + task :users => :environment do + file = ENV['FILE'] or raise "must set FILE" + data = MultiJson.decode(open(file).read) + + raise NotImplementedError + end end -end+end
Add some tasks to dump / load issues and users, in preparation for changing DB.
diff --git a/spec/features/admin/authentication_spec.rb b/spec/features/admin/authentication_spec.rb index abc1234..def5678 100644 --- a/spec/features/admin/authentication_spec.rb +++ b/spec/features/admin/authentication_spec.rb @@ -10,15 +10,15 @@ scenario "logging into admin redirects home, then back to admin" do # This is the first admin spec, so give a little extra load time for slow systems - Capybara.using_wait_time(60) do + Capybara.using_wait_time(120) do visit spree.admin_path + + fill_in "Email", with: user.email + fill_in "Password", with: user.password + click_login_button + page.should have_content "DASHBOARD" + current_path.should == spree.admin_path end - - fill_in "Email", with: user.email - fill_in "Password", with: user.password - click_login_button - page.should have_content "DASHBOARD" - current_path.should == spree.admin_path end scenario "viewing my account" do
Fix first feature spec sometimes timing out
diff --git a/lib/capistrano/tasks/deploy_status.rake b/lib/capistrano/tasks/deploy_status.rake index abc1234..def5678 100644 --- a/lib/capistrano/tasks/deploy_status.rake +++ b/lib/capistrano/tasks/deploy_status.rake @@ -3,8 +3,11 @@ task :status do |t| require 'open-uri' system("git fetch -q") + protocol = fetch(:protocol, 'http') + port = fetch(:port, 80) on roles(:app) do |host| - open("http://#{host}:80/deploy_status", ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE) do |f| + addr = "#{protocol}://#{host}:#{port}/deploy_status" + open(addr, ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE) do |f| status = f.read.gsub("\n","") branch = fetch(:branch, 'HEAD') remote_commit = status.split('|').first.split[1]
Make it possible to change protocol and port
diff --git a/lib/generators/raptor_editor_rails/install/install_generator.rb b/lib/generators/raptor_editor_rails/install/install_generator.rb index abc1234..def5678 100644 --- a/lib/generators/raptor_editor_rails/install/install_generator.rb +++ b/lib/generators/raptor_editor_rails/install/install_generator.rb @@ -1,4 +1,5 @@ require "raptor_editor_rails" +require "raptor_editor_rails/version" module RaptorEditorRails module Generators
Include version numbers so intall generator will work
diff --git a/anyway_config.gemspec b/anyway_config.gemspec index abc1234..def5678 100644 --- a/anyway_config.gemspec +++ b/anyway_config.gemspec @@ -23,6 +23,6 @@ s.required_ruby_version = '>= 2.3' s.add_development_dependency "rspec", "~> 3.5" - s.add_development_dependency "rubocop", "~> 0.59.0" + s.add_development_dependency "rubocop", "~> 0.60.0" s.add_development_dependency "simplecov", ">= 0.3.8" end
Update rubocop to version 0.60.0
diff --git a/spec/rails_locale_detection/config_spec.rb b/spec/rails_locale_detection/config_spec.rb index abc1234..def5678 100644 --- a/spec/rails_locale_detection/config_spec.rb +++ b/spec/rails_locale_detection/config_spec.rb @@ -1,7 +1,12 @@ require 'spec_helper' describe RailsLocaleDetection do - + describe 'backwards compatility' do + it 'should be possible to configure using the previous module name' do + Rails::LocaleDetection.should respond_to(:config) + end + end + describe '.locale_expiry' do it "is set to 3 months by default" do RailsLocaleDetection.config do |c|
Add spec for backwards compatibility
diff --git a/lib/puppet/provider/remote_file/ruby.rb b/lib/puppet/provider/remote_file/ruby.rb index abc1234..def5678 100644 --- a/lib/puppet/provider/remote_file/ruby.rb +++ b/lib/puppet/provider/remote_file/ruby.rb @@ -45,7 +45,7 @@ end c = Net::HTTP.new(p.host, p.port) c.use_ssl = p.scheme == "https" ? true : false - c.request_get(p.path) do |req| + c.request_get(p.request_uri) do |req| case req.code when /30[12]/ get req['location'], i+1
Use request_uri instead of path when downloading files to capture path + query string
diff --git a/lib/action_meta_tags/base.rb b/lib/action_meta_tags/base.rb index abc1234..def5678 100644 --- a/lib/action_meta_tags/base.rb +++ b/lib/action_meta_tags/base.rb @@ -17,9 +17,9 @@ tags << Tags::Meta.new(attrs, &block) end - %i(keywords description).each do |method_name| - define_method method_name do |&block| - tags << Tags::Meta.new(name: method_name, &block) + %w(keywords description).each do |method| + define_method method do |&block| + tags << meta(name: method, &block) end end @@ -27,9 +27,11 @@ 'og:title', 'og:image', 'og:description' - ].each do |property_name| - define_method property_name.gsub(':', '_') do |&block| - tags << Tags::Meta.new(property: property_name, &block) + ].each do |property| + method = property.gsub(':', '_') + + define_method method do |&block| + tags << meta(property: property, &block) end end end
Make code a bit better
diff --git a/lib/application_responder.rb b/lib/application_responder.rb index abc1234..def5678 100644 --- a/lib/application_responder.rb +++ b/lib/application_responder.rb @@ -4,5 +4,5 @@ # Redirects resources to the collection path (index action) instead # of the resource path (show action) for POST/PUT/DELETE requests. - # include Responders::CollectionResponder + include Responders::CollectionResponder end
Change location redirection to collection path
diff --git a/app/pdfs/login_pdf.rb b/app/pdfs/login_pdf.rb index abc1234..def5678 100644 --- a/app/pdfs/login_pdf.rb +++ b/app/pdfs/login_pdf.rb @@ -0,0 +1,27 @@+class LoginPdf + include Prawn::View + + def initialize(classroom) + @classroom = classroom + list_students + end + + def list_students + count = 0 + @classroom.students.each do |student| + # We have to make sure that we don't have a page break in the middle + # of a student's login information. At the default font size, we can fit + # 10 students on one page. After that, we add two line breaks to move to + # the following page as we can fit 52 lines of text, and each student + # takes up 5 lines. + if count == 10 + count = 0 + text "\n\n" + else + count += 1 + text "<b>#{student.name}</b>\nusername:\t\t#{student.username}\npassword:\t\t\t#{student.last_name}\n\n\n", inline_format: true + end + end + end + +end
Add LoginPdf class to generate student login PDFs
diff --git a/mutations.gemspec b/mutations.gemspec index abc1234..def5678 100644 --- a/mutations.gemspec +++ b/mutations.gemspec @@ -15,6 +15,4 @@ s.add_dependency 'activesupport' s.add_development_dependency 'minitest', '~> 4' s.add_development_dependency 'rake' - - s.required_ruby_version = '>= 1.9.2' end
Remove required ruby version from gemspec
diff --git a/lib/dry/types/constraints.rb b/lib/dry/types/constraints.rb index abc1234..def5678 100644 --- a/lib/dry/types/constraints.rb +++ b/lib/dry/types/constraints.rb @@ -3,22 +3,14 @@ module Dry module Types - module Predicates - include Logic::Predicates - - predicate(:type?) do |type, value| - value.kind_of?(type) - end - end - def self.Rule(options) rule_compiler.( - options.map { |key, val| [:val, Predicates[:"#{key}?"].curry(val).to_ast] } + options.map { |key, val| [:val, Logic::Predicates[:"#{key}?"].curry(val).to_ast] } ).reduce(:and) end def self.rule_compiler - @rule_compiler ||= Logic::RuleCompiler.new(Types::Predicates) + @rule_compiler ||= Logic::RuleCompiler.new(Logic::Predicates) end end end
Remove custom predicates mod (dry-logic now has type? predicate)
diff --git a/lib/happy/context/helpers.rb b/lib/happy/context/helpers.rb index abc1234..def5678 100644 --- a/lib/happy/context/helpers.rb +++ b/lib/happy/context/helpers.rb @@ -15,7 +15,7 @@ end def render_template(name, variables = {}, &blk) - path = @controller ? @controller.config[:views] : './views' + path = @controller.config[:views] || './views' HappyHelpers::Templates.render(File.join(path, name), self, variables, &blk) end
Fix ./views/ as a default view path.
diff --git a/lib/mgit/commands/foreach.rb b/lib/mgit/commands/foreach.rb index abc1234..def5678 100644 --- a/lib/mgit/commands/foreach.rb +++ b/lib/mgit/commands/foreach.rb @@ -5,7 +5,7 @@ Registry.chdir_each do |repo| pinfo "Executing command in repository #{repo.name}..." - if !system(command) && !ask("Executing command '#{command}' in repository '#{repo.name}' failed. Would you like to continue anyway?".red) + if !system(command) && !agree("Executing command '#{command}' in repository '#{repo.name}' failed. Would you like to continue anyway?".red) break end end
Foreach: Fix broken continue confirmation question.
diff --git a/lib/testjour/commands/run.rb b/lib/testjour/commands/run.rb index abc1234..def5678 100644 --- a/lib/testjour/commands/run.rb +++ b/lib/testjour/commands/run.rb @@ -9,9 +9,6 @@ class Run < Command def execute - testjour_path = File.expand_path(File.dirname(__FILE__) + "/../../../bin/testjour") - cmd = "#{testjour_path} local:run #{@args.join(' ')}" - HttpQueue.with_queue do require 'cucumber/cli/main' configuration.load_language @@ -24,11 +21,26 @@ end end - status, stdout, stderr = systemu(cmd) + testjour_path = File.expand_path(File.dirname(__FILE__) + "/../../../bin/testjour") + cmd = "#{testjour_path} local:run #{@args.join(' ')}" + systemu(cmd) - @out_stream.write stdout - @err_stream.write stderr - status.exitstatus + results = [] + + HttpQueue.with_net_http do |http| + configuration.feature_files.each do |feature_file| + get = Net::HTTP::Get.new("/results") + results << http.request(get).body + end + end + + if results.include?("F") + @out_stream.write "Failed" + 1 + else + @out_stream.write "Passed" + 0 + end end end
Read results from the queue
diff --git a/lib/active_admin/gallery/active_record_extension.rb b/lib/active_admin/gallery/active_record_extension.rb index abc1234..def5678 100644 --- a/lib/active_admin/gallery/active_record_extension.rb +++ b/lib/active_admin/gallery/active_record_extension.rb @@ -3,9 +3,9 @@ def has_image(name) has_one name, + -> { where(imageable_relation: name.to_s) }, as: :imageable, - class_name: "ActiveAdmin::Gallery::Image", - conditions: { imageable_relation: name.to_s } + class_name: "ActiveAdmin::Gallery::Image" define_method "#{name}=" do |image| super(image) @@ -17,9 +17,9 @@ def has_many_images(name) has_many name, + -> { where(imageable_relation: name.to_s) }, as: :imageable, - class_name: "ActiveAdmin::Gallery::Image", - conditions: { imageable_relation: name.to_s } + class_name: "ActiveAdmin::Gallery::Image" define_method "#{name}=" do |images| super(images) @@ -33,4 +33,3 @@ end end -
Remove deprecated :conditions for ActiveRecord associations
diff --git a/cookbooks/universe_ubuntu/test/recipes/default_test.rb b/cookbooks/universe_ubuntu/test/recipes/default_test.rb index abc1234..def5678 100644 --- a/cookbooks/universe_ubuntu/test/recipes/default_test.rb +++ b/cookbooks/universe_ubuntu/test/recipes/default_test.rb @@ -28,3 +28,7 @@ it { should be_installed } end end + +describe file '/tmp/kitchen/cache/Anaconda3-4.2.0-Linux-x86_64.sh' do + it { should exist } +end
Add test on anaconda install file
diff --git a/rom-sql.gemspec b/rom-sql.gemspec index abc1234..def5678 100644 --- a/rom-sql.gemspec +++ b/rom-sql.gemspec @@ -17,7 +17,7 @@ spec.required_ruby_version = ">= 2.3.0" - spec.add_runtime_dependency 'sequel', '>= 4.43', '~> 5.0' + spec.add_runtime_dependency 'sequel', '>= 4.49' spec.add_runtime_dependency 'dry-equalizer', '~> 0.2' spec.add_runtime_dependency 'dry-types', '~> 0.11', '>= 0.11.1' spec.add_runtime_dependency 'dry-core', '~> 0.3'
Update Sequel dep, again, geez
diff --git a/lib/sequel/schema-sharding/connection_strategies/random.rb b/lib/sequel/schema-sharding/connection_strategies/random.rb index abc1234..def5678 100644 --- a/lib/sequel/schema-sharding/connection_strategies/random.rb +++ b/lib/sequel/schema-sharding/connection_strategies/random.rb @@ -1,10 +1,14 @@+# This strategy is used for choosing a :read_only server +# to connect to. +# +# A random server will be chosen from the replica list +# for this physical shard. module Sequel module SchemaSharding module ConnectionStrategy class Random def self.choose(db, config) - choice = rand(config['replicas'].size) - config['replicas'][choice] + config['replicas'].sample end end end
Simplify ruby code by using sample instead of rand
diff --git a/src/retryingfetcher/lib/retryingfetcher.rb b/src/retryingfetcher/lib/retryingfetcher.rb index abc1234..def5678 100644 --- a/src/retryingfetcher/lib/retryingfetcher.rb +++ b/src/retryingfetcher/lib/retryingfetcher.rb @@ -16,7 +16,7 @@ yield response.body if block_given? return response.body rescue => e - puts "RetyingFetcher.get error: %s" % e.message + puts "RetryingFetcher.get error: %s" % e.message end end nil
Fix a typo in a puts statement
diff --git a/attributes/default.rb b/attributes/default.rb index abc1234..def5678 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -18,6 +18,6 @@ # default['thrift']['version'] = '0.9.0' -default['thrift']['mirror'] = 'http://apache.mirrors.tds.net' +default['thrift']['mirror'] = 'http://archive.apache.org/dist/' default['thrift']['checksum'] = '71d129c49a2616069d9e7a93268cdba59518f77b3c41e763e09537cb3f3f0aac' default['thrift']['configure_options'] = []
Use Apache archive instead of mirror Mirror does not have thrift 0.9.0 anymore.
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 @@ -16,8 +16,8 @@ if document.previous_sibling siblings.merge!( previous_page: { - "title" => "Previous page", - "url" => document.previous_sibling.base_path + title: "Previous page", + url: document.previous_sibling.base_path } ) end @@ -25,8 +25,8 @@ if document.next_sibling siblings.merge!( next_page: { - "title" => "Next page", - "url" => document.next_sibling.base_path + title: "Next page", + url: document.next_sibling.base_path } ) end
Use symbols, not strings, for component object keys We should only use one style of keys for objects used in components, to avoid reduce confusion when using components. Consistency is good. After discussion with @edds we agreed to use symbols as this makes more sense in a ruby/rails environment. The first step was to support both, as clients of those components will still be sending string key'd objects and can't be updated at the time as this app, so we have to; 1. Support both kinds of keys on components that expect strings 2. Update clients sending string keys to use symbols instead 3. Remove support for string keys from those components This PR is step 2. for `previous_and_next_navigation`, but also needs doing in `finder-frontend` for `options_select`. Step 1 is: https://github.com/alphagov/static/pull/601
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 @@ -2,7 +2,7 @@ # render bidder group name from award def render_bidder_group award if award.is_ute? - str = 'UTE: ' + str = award.get_ute_groups().length > 1 ? 'UTE: ' : '' award.get_ute_groups().each_with_index do |group, i| str += i==0 ? '' : ' - ' str += link_to group[:name], bidder_path(group[:slug])
Hide 'UTE' prefix in bidder group name if there's only one group in the UTE
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 @@ -14,6 +14,7 @@ { site: current_site.name, reverse: true, + description: current_site.tagline, } end end
Set site.tagline to meta description for now TODO: Add site.description?
diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -2,22 +2,24 @@ class ApplicationMailer class << self def set(option) - return unless option.eql?(:load_settings) - begin - yml = YAML.load_file(File.join(Rails.root, 'config', 'mail.yml')) - raise "empty" if yml.blank? - rescue => e - return nil + if option == :load_settings + begin + yml = YAML.load_file(File.join(Rails.root, 'config', 'mail.yml')) + raise "empty" if yml.blank? + rescue => e + return nil + end + + mail = yml[Rails.env.to_s] + ActionMailer::Base.delivery_method = mail['delivery_method'] + ActionMailer::Base.default from: mail['default_from'], charset: mail['default_charset'] + if mail['delivery_method'] == :smtp + smtp(mail) + elsif mail['delivery_method'] == :sendmail + sendmail(mail) + end end - mail = yml[Rails.env.to_s] - ActionMailer::Base.delivery_method = mail['delivery_method'] - ActionMailer::Base.default from: mail['default_from'], charset: mail['default_charset'] - if mail['delivery_method'] == :smtp - smtp(mail) - elsif mail['delivery_method'] == :sendmail - sendmail(mail) - end end def smtp(mail)
Revert "rewrite if block guard to return guard" This reverts commit fb3fae5a1b0e9b4dee6cd896fc641c2d2a53e67b. Conflicts: app/mailers/application_mailer.rb
diff --git a/lib/generators/announcements/install/install_generator.rb b/lib/generators/announcements/install/install_generator.rb index abc1234..def5678 100644 --- a/lib/generators/announcements/install/install_generator.rb +++ b/lib/generators/announcements/install/install_generator.rb @@ -8,7 +8,7 @@ say "--- Creating model in app/models..." template "announcement.rb", "app/models/announcement.rb" say "--- Creating the migration ..." - generate("model", "announcement body:text heading:text type:string --skip") + generate("model", "announcement body:text heading:text type:string visible_at:datetime invisible_at:datetime --skip") say "--- Running the migration..." rake("db:migrate") end
Add the timing-fields to the generated migration Otherwise, these are not persisted.
diff --git a/test/spec/metrics_spec.rb b/test/spec/metrics_spec.rb index abc1234..def5678 100644 --- a/test/spec/metrics_spec.rb +++ b/test/spec/metrics_spec.rb @@ -1,25 +1,25 @@ require_relative 'spec_helper' describe "JVM Metrics" do - - before(:each) do - set_java_version(app.directory, jdk_version) - app.setup! - app.set_config( - "JVM_COMMON_BUILDPACK" => - "https://api.github.com/repos/heroku/heroku-buildpack-jvm-common/tarball/#{jvm_common_branch}") - `heroku features:enable runtime-heroku-metrics --app #{app.name}` - end - - ["1.7", "1.8", "11", "14"].each do |version| - context "a simple java app on jdk-#{version}" do - let(:app) { new_app_with_defaults("java-servlets-sample", - :buildpack_url => "https://github.com/heroku/heroku-buildpack-java") } - let(:jdk_version) { version } + ["1.7", "1.8", "11", "14"].each do |jdk_version| + context "a simple java app on jdk-#{jdk_version}" do it "should deploy" do - app.deploy do |app| - expect(app.output).to include("BUILD SUCCESS") - expect(successful_body(app)).to eq("Hello from Java!") + Hatchet::Runner.new( + "java-servlets-sample", + labs: "runtime-heroku-metrics", + buildpacks: ["https://github.com/heroku/heroku-buildpack-java"], + stack: ENV["HEROKU_TEST_STACK"], + config: { + "JVM_COMMON_BUILDPACK" => "https://api.github.com/repos/heroku/heroku-buildpack-jvm-common/tarball/#{jvm_common_branch}" + } + ).tap do |app| + app.before_deploy do + set_java_version(Dir.pwd, jdk_version) + end + app.deploy do + expect(app.output).to include("BUILD SUCCESS") + expect(successful_body(app)).to eq("Hello from Java!") + end end end end
Update metrics spec to run in parallel
diff --git a/lib/generators/ruby_rabbitmq_janus/create_request_generator.rb b/lib/generators/ruby_rabbitmq_janus/create_request_generator.rb index abc1234..def5678 100644 --- a/lib/generators/ruby_rabbitmq_janus/create_request_generator.rb +++ b/lib/generators/ruby_rabbitmq_janus/create_request_generator.rb @@ -5,9 +5,29 @@ # Create an class for generate a custom configuration file class CreateRequestGenerator < Rails::Generators::Base desc 'Create an request to json format for RubyRabbitmqJanus transaction.' + argument :type_name, type: :string, default: '' + argument :janus_type, type: :string, default: '' + argument :content, type: :string, default: '' def create_request - puts "Create a super request in config/request/#{file_name}/#{class_name}.json" + File.open(file_json, 'w') do |file| + file.write(write_json) + end + end + + private + + def file_json + base_file = 'config/requests' + base_file = "#{base_file}/#{type_name}" unless type_name.empty? + "#{base_file}/#{janus_type}.json" + end + + def write_json + hash = {} + hash['janus'] = janus_type + hash['body'] = content + JSON.pretty_generate(hash) end end end
Complete generator with creation file
diff --git a/app/helpers/orgs_helper.rb b/app/helpers/orgs_helper.rb index abc1234..def5678 100644 --- a/app/helpers/orgs_helper.rb +++ b/app/helpers/orgs_helper.rb @@ -1,19 +1,17 @@ module OrgsHelper + # frozen_string_literal: true - DEFAULT_EMAIL = '%{organisation_email}'.freeze + DEFAULT_EMAIL = '%{organisation_email}' # Tooltip string for Org feedback form. # # @param org [Org] The current Org we're updating feedback form for. # @return [String] The tooltip message def tooltip_for_org_feedback_form(org) - output = <<~TEXT - Someone will respond to your request within 48 hours. If you have - questions pertaining to this action please contact us at - %{email}. - TEXT - email = org.contact_email.present? ? org.contact_email : DEFAULT_EMAIL - _(output % { email: email }) + email = org.contact_email.presence || DEFAULT_EMAIL + _("Someone will respond to your request within 48 hours. If you have \ + questions pertaining to this action please contact us at %{email}") % { + email: email + } end - end
Fix how strings are wrapped in translation helper
diff --git a/hash_db.gemspec b/hash_db.gemspec index abc1234..def5678 100644 --- a/hash_db.gemspec +++ b/hash_db.gemspec @@ -8,8 +8,9 @@ gem.version = HashDB::VERSION gem.authors = ["Utkarsh Kukreti"] gem.email = ["utkarshkukreti@gmail.com"] - gem.description = %q{TODO: Write a gem description} - gem.summary = %q{TODO: Write a gem summary} + gem.description = "A minimal, in-memory, ActiveRecord like database, " + + "backed by a Ruby Hash." + gem.summary = gem.description gem.homepage = "" gem.license = "MIT"
Add gem description and summary.
diff --git a/spec/validators/variable_duplicates_validator_spec.rb b/spec/validators/variable_duplicates_validator_spec.rb index abc1234..def5678 100644 --- a/spec/validators/variable_duplicates_validator_spec.rb +++ b/spec/validators/variable_duplicates_validator_spec.rb @@ -0,0 +1,67 @@+require 'spec_helper' + +describe VariableDuplicatesValidator do + let(:validator) { described_class.new(attributes: [:variables], **options) } + + describe '#validate_each' do + let(:project) { build(:project) } + + subject { validator.validate_each(project, :variables, project.variables) } + + context 'with no scope' do + let(:options) { {} } + let(:variables) { build_list(:ci_variable, 2, project: project) } + + before do + project.variables << variables + end + + it 'does not have any errors' do + subject + + expect(project.errors.empty?).to be true + end + + context 'with duplicates' do + before do + project.variables.build(key: variables.first.key, value: 'dummy_value') + end + + it 'has a duplicate key error' do + subject + + expect(project.errors[:variables]).to include("Duplicate variables: #{project.variables.last.key}") + end + end + end + + context 'with a scope attribute' do + let(:options) { { scope: :environment_scope } } + let(:first_variable) { build(:ci_variable, key: 'test_key', environment_scope: '*', project: project) } + let(:second_variable) { build(:ci_variable, key: 'test_key', environment_scope: 'prod', project: project) } + + before do + project.variables << first_variable + project.variables << second_variable + end + + it 'does not have any errors' do + subject + + expect(project.errors.empty?).to be true + end + + context 'with duplicates' do + before do + project.variables.build(key: second_variable.key, value: 'dummy_value', environment_scope: second_variable.environment_scope) + end + + it 'has a duplicate key error' do + subject + + expect(project.errors[:variables]).to include("Duplicate variables: #{project.variables.last.key}") + end + end + end + end +end
Add specs for VariableDuplicates validator
diff --git a/spec/lib/duffel_spec.rb b/spec/lib/duffel_spec.rb index abc1234..def5678 100644 --- a/spec/lib/duffel_spec.rb +++ b/spec/lib/duffel_spec.rb @@ -14,14 +14,14 @@ context 'with a fallback passed' do it 'should return the fallback' do expect( - subject.another_non_existing_method(fallback: 'blah') + subject.another_non_existing_method(:fallback => 'blah') ).to eq 'blah' end context 'fallback is nil' do it 'should return nil' do expect( - subject.yet_another_non_existing_method(fallback: nil) + subject.yet_another_non_existing_method(:fallback => nil) ).to eq nil end end
Make tests compatible with older rubies.
diff --git a/runner.rb b/runner.rb index abc1234..def5678 100644 --- a/runner.rb +++ b/runner.rb @@ -36,7 +36,10 @@ <title>My Profile Page</title> </head> <body> - <p>This is my profile page.</p> + <p>This is my profile page. Username: Matt Baker</p> + <blockquote>Favorite Quote: + <br> + There is science, logic, reason; there is thought verified by experience.And then there is California. --Edward Abbey </body> </html> }, @@ -48,5 +51,5 @@ loop do server.start server.send_message - server.stop + server.stop end
Edit the Profile page to be more descriptive
diff --git a/lib/git_statistics/pipe.rb b/lib/git_statistics/pipe.rb index abc1234..def5678 100644 --- a/lib/git_statistics/pipe.rb +++ b/lib/git_statistics/pipe.rb @@ -2,10 +2,12 @@ class Pipe include Enumerable - attr_reader :command def initialize(command) - command.gsub!(/^\|/i, '') @command = command + end + + def command + @command.dup.gsub(/\A\|/i, '') end def each(&block)
Remove side effect on Pipe initialization
diff --git a/lib/jobmon/rake_monitor.rb b/lib/jobmon/rake_monitor.rb index abc1234..def5678 100644 --- a/lib/jobmon/rake_monitor.rb +++ b/lib/jobmon/rake_monitor.rb @@ -13,7 +13,7 @@ args, estimate_time = resolve_args(args) task *args do |t| job_id = client.job_start(t, estimate_time) - block.call + block.call(t) client.job_end(job_id) end end
Add task object to block params
diff --git a/app/controllers/optional_modules/blogs/blogs_controller.rb b/app/controllers/optional_modules/blogs/blogs_controller.rb index abc1234..def5678 100644 --- a/app/controllers/optional_modules/blogs/blogs_controller.rb +++ b/app/controllers/optional_modules/blogs/blogs_controller.rb @@ -13,7 +13,7 @@ # GET /blog # GET /blog.json def index - @blogs = Blog.includes(:translations, :user).online.order(created_at: :desc) + @blogs = Blog.includes(:translations, :user, :blog_category, :picture, :video_uploads, :video_platforms).online.order(created_at: :desc) per_p = @setting.per_page == 0 ? @blogs.count : @setting.per_page @blogs = BlogDecorator.decorate_collection(@blogs.page(params[:page]).per(per_p)) seo_tag_index category
Fix N+1 query with blogs objects