diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/signup/product_helper.rb b/lib/signup/product_helper.rb index abc1234..def5678 100644 --- a/lib/signup/product_helper.rb +++ b/lib/signup/product_helper.rb @@ -1,4 +1,13 @@ module ProductHelper + + def products + [ + :supporter, + :member, + :sponsor, + :partner + ] + end def product_value(product) case product.to_sym
Add product list to helper
diff --git a/lib/signup/product_helper.rb b/lib/signup/product_helper.rb index abc1234..def5678 100644 --- a/lib/signup/product_helper.rb +++ b/lib/signup/product_helper.rb @@ -1,4 +1,13 @@ module ProductHelper + + def products + [ + :supporter, + :member, + :sponsor, + :partner + ] + end def product_value(product) case product.to_sym
Add product list to helper
diff --git a/lib/active_null.rb b/lib/active_null.rb index abc1234..def5678 100644 --- a/lib/active_null.rb +++ b/lib/active_null.rb @@ -17,6 +17,7 @@ def null_model(method_name=nil, &block) @null_model_overrides = if block_given? Module.new.tap { |m| m.module_eval(&block) } + end if method_name singleton_class.class_eval do
Fix missing end from @iachettifederico
diff --git a/lib/lita/common.rb b/lib/lita/common.rb index abc1234..def5678 100644 --- a/lib/lita/common.rb +++ b/lib/lita/common.rb @@ -10,5 +10,5 @@ end end -I18n.load_path << Dir[File.join(Lita.template_root, "locales", "*.yml")] +I18n.load_path += Dir[File.join(Lita.template_root, "locales", "*.yml")] I18n.enforce_available_locales = true
Concatenate I18n.load_path instead of shoveling.
diff --git a/Casks/cyberduck.rb b/Casks/cyberduck.rb index abc1234..def5678 100644 --- a/Casks/cyberduck.rb +++ b/Casks/cyberduck.rb @@ -0,0 +1,5 @@+class Cyberduck < Cask + url 'http://cyberduck.ch/Cyberduck-4.2.1.zip' + homepage 'http://cyberduck.ch' + version '4.2.1' +end
Add Cyberduck - Libre FTP, SFTP, WebDAV & cloud storage browser for Mac & Windows.
diff --git a/Casks/launchbar.rb b/Casks/launchbar.rb index abc1234..def5678 100644 --- a/Casks/launchbar.rb +++ b/Casks/launchbar.rb @@ -5,8 +5,8 @@ sha256 '22a1ec0c10de940e5efbcccd18b8b048d95fb7c63213a01c7976a76d6be69a4d' url "http://www.obdev.at/downloads/launchbar/legacy/LaunchBar-#{version}.dmg" else - version '6.3' - sha256 '0ee5bacc02dc5213fc80934fed66124a718fd72d654ce3a4365cc694d76c1578' + version '6.4' + sha256 '320c177839bad91f3dda90bd2fb4476bb31c5a6d723437505d776456dd8688cc' url "http://www.obdev.at/downloads/launchbar/LaunchBar-#{version}.dmg" end
Update Launchbar to version 6.4 This commit updates the version stanza and the SHA
diff --git a/lib/random_yiff.rb b/lib/random_yiff.rb index abc1234..def5678 100644 --- a/lib/random_yiff.rb +++ b/lib/random_yiff.rb @@ -31,5 +31,4 @@ def method_missing(m) post["#{m}"] || super end - end
Remove empty line at end of RandomYiff
diff --git a/business_time.gemspec b/business_time.gemspec index abc1234..def5678 100644 --- a/business_time.gemspec +++ b/business_time.gemspec @@ -13,7 +13,7 @@ s.files = `git ls-files -- {lib,rails_generators,LICENSE,README.rdoc}`.split("\n") - s.add_dependency('activesupport','~> 3.0.11') + s.add_dependency('activesupport','~> 3.0.10') s.add_dependency('tzinfo','>= 0.3.31') s.add_development_dependency 'rake'
Add more precise activesupport version
diff --git a/test/lib/generators/slim/mailer_generator_test.rb b/test/lib/generators/slim/mailer_generator_test.rb index abc1234..def5678 100644 --- a/test/lib/generators/slim/mailer_generator_test.rb +++ b/test/lib/generators/slim/mailer_generator_test.rb @@ -11,14 +11,37 @@ test "should invoke template engine" do run_generator - assert_file File.join "app", "views", "notifier", "foo.text.slim" do |view| - assert_match %r(app/views/notifier/foo\.text\.slim), view - assert_match /\= @greeting/, view - end - assert_file File.join "app", "views", "notifier", "bar.text.slim" do |view| - assert_match %r(app/views/notifier/bar\.text\.slim), view - assert_match /\= @greeting/, view + if ::Rails.version.to_s >= '4.2' + + assert_file "app/views/layouts/mailer.text.slim" do |view| + assert_match /\= yield/, view + end + + assert_file "app/views/layouts/mailer.html.slim" do |view| + assert_match /\= yield/, view + end + + assert_file "app/views/notifier/foo.html.slim" do |view| + assert_match %r(app/views/notifier/foo\.html\.slim), view + assert_match /\= @greeting/, view + end + + assert_file "app/views/notifier/bar.html.slim" do |view| + assert_match %r(app/views/notifier/bar\.html\.slim), view + assert_match /\= @greeting/, view + end + + else + assert_file file.join "app", "views", "notifier", "foo.text.slim" do |view| + assert_match %r(app/views/notifier/foo\.text\.slim), view + assert_match /\= @greeting/, view + end + + assert_file file.join "app", "views", "notifier", "bar.text.slim" do |view| + assert_match %r(app/views/notifier/bar\.text\.slim), view + assert_match /\= @greeting/, view + end end end end
Add assertions for rails4.2 in MailerGeneratorTest I am basically copying tests from `indirect/haml-rails`, and changing to slim where necessary.
diff --git a/core/app/controllers/application_controller.rb b/core/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/core/app/controllers/application_controller.rb +++ b/core/app/controllers/application_controller.rb @@ -15,12 +15,7 @@ end def after_sign_in_path_for(resource) - - if session[:"user.return_to"].nil? - return user_profile_path(@current_user.username) - else - return view_context.url_for(fact_path(session[:"user.return_to"].to_s)) - end + user_profile_path(resource.username) end def current_graph_user
Return path is not used anymore
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -13,6 +13,7 @@ module ContentTagger class Application < Rails::Application config.active_record.raise_in_transactional_callbacks = true + config.autoload_paths += %W(#{config.root}/lib) config.action_view.default_form_builder = GenericFormBuilder config.action_view.field_error_proc = proc {|html_tag, _| html_tag }
Add lib to autoload paths
diff --git a/config/environment.rb b/config/environment.rb index abc1234..def5678 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -9,6 +9,7 @@ config.action_controller.session = { :key => "_mockr_session", :secret => "my cat is yellow" } + config.action_controller.asset_host = "http://#{ENV['APP_HOST']}" end ActionView::Helpers::AssetTagHelper. @@ -16,5 +17,3 @@ 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js' ] - -config.action_controller.asset_host = "http://#{ENV['APP_HOST']}"
Move config declaration to the appropriate place
diff --git a/lib/active_encode/engine_adapters/ffmpeg_adapter.rb b/lib/active_encode/engine_adapters/ffmpeg_adapter.rb index abc1234..def5678 100644 --- a/lib/active_encode/engine_adapters/ffmpeg_adapter.rb +++ b/lib/active_encode/engine_adapters/ffmpeg_adapter.rb @@ -1,17 +1,41 @@+require 'fileutils' + module ActiveEncode module EngineAdapters class FfmpegAdapter def create(encode) new_encode = encode.class.new(encode.input, encode.options) new_encode.id = SecureRandom.uuid - # TODO mkdir(File.join(working_dir,new_encode.id)) + new_encode.state = :running + new_encode.current_operations = [] + new_encode.percent_complete = 10 + new_encode.errors = [] + new_encode.created_at = Time.new + new_encode.tech_metadata = [] + # working_dir = "encodes/" # Should read from config + # FileUtils.mkdir_p File.join(working_dir, new_encode.id) new_encode end + # Return encode object from file system def find(id, opts={}) + encode_class = opts[:cast] + encode = encode_class.new(nil, opts) + encode.id = id + encode.state = :running + encode.current_operations = ["transcoding"] + encode.percent_complete = 50 + encode.errors = [] + # Read directory timestamps? + encode.created_at = Time.new + encode.updated_at = Time.new + 1 + encode.tech_metadata = [] + encode end + # Cancel ongoing encode using pid file def cancel(encode) + end end end
Make a few tests green
diff --git a/db/data/20150311194246_associate_provers_with_ontology_versions.rb b/db/data/20150311194246_associate_provers_with_ontology_versions.rb index abc1234..def5678 100644 --- a/db/data/20150311194246_associate_provers_with_ontology_versions.rb +++ b/db/data/20150311194246_associate_provers_with_ontology_versions.rb @@ -18,12 +18,12 @@ ontology_version.retrieve_available_provers rescue Net::ReadTimeout if max_attempts > 0 - puts "Timeout, trying again: OntologyVersion #{ontology_version.id}" + $stderr.puts "Timeout, trying again: OntologyVersion #{ontology_version.id}" retry_provers_retrieval(ontology_version, max_attempts - 1) else - puts "Timeout, limit reached: OntologyVersion #{ontology_version.id}" + $stderr.puts "Timeout, limit reached: OntologyVersion #{ontology_version.id}" end rescue ::StandardError => e - puts "Errored at OntologyVersion #{ontology_version.id}" + $stderr.puts "Errored at OntologyVersion #{ontology_version.id}" end end
Print error messages on stderr.
diff --git a/jekyll-github-metadata.gemspec b/jekyll-github-metadata.gemspec index abc1234..def5678 100644 --- a/jekyll-github-metadata.gemspec +++ b/jekyll-github-metadata.gemspec @@ -19,6 +19,7 @@ spec.add_development_dependency "bundler", "~> 1.5" spec.add_development_dependency "rake" + spec.add_development_dependency "netrc" spec.add_development_dependency "rspec" - spec.add_development_dependency "jekyll", "~> 2.0" + spec.add_development_dependency "jekyll", ">= 2.0" end
Add netrc as dev dep and use any version of Jekyll over 2.
diff --git a/lib/octoshark/active_record_extensions.rb b/lib/octoshark/active_record_extensions.rb index abc1234..def5678 100644 --- a/lib/octoshark/active_record_extensions.rb +++ b/lib/octoshark/active_record_extensions.rb @@ -1,8 +1,8 @@ module Octoshark module ConnectionHandler def establish_connection(*args) + Octoshark::ConnectionPoolsManager.reset_connection_managers! super(*args) - Octoshark::ConnectionPoolsManager.reset_connection_managers! end end @@ -19,10 +19,9 @@ end end -if defined?(ActiveRecord::ConnectionAdapters::ConnectionSpecification) +if defined?(ActiveRecord::ConnectionAdapters::ConnectionHandler) + # Rails 3.2, 4.0, 4.1, 4.2, 5.0 ActiveRecord::ConnectionAdapters::ConnectionHandler.send(:prepend, Octoshark::ConnectionHandler) -elsif defined?(ActiveRecord::ConnectionAdapters::ConnectionPool::ConnectionHandler) - ActiveRecord::ConnectionAdapters::ConnectionPool::ConnectionHandler.send(:prepend, Octoshark::ConnectionHandler) else # Rails 3.0 and 3.1 does not lazy load require 'active_record/connection_adapters/abstract_adapter'
Fix undefined method `connection' when using Passenger server
diff --git a/spec/lib/user_agent_spec.rb b/spec/lib/user_agent_spec.rb index abc1234..def5678 100644 --- a/spec/lib/user_agent_spec.rb +++ b/spec/lib/user_agent_spec.rb @@ -0,0 +1,20 @@+require "spec_helper" + +class UserAgentTest + attr_accessor :user_agent + include UserAgent + + def initialize(user_agent) + @user_agent = user_agent + end +end + +describe UserAgent do + context "Mobile Safari / iOS" do + let(:u) { UserAgentTest.new("Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Mobile/11D257") } + it { expect(u.ua_family).to eq "Mobile Safari" } + it { expect(u.ua_version).to eq "7.1.2" } + it { expect(u.os_family).to eq "iOS" } + it { expect(u.os_version).to eq "7.1.2" } + end +end
Add a basic test for UserAgent
diff --git a/spec/reindeer/types_spec.rb b/spec/reindeer/types_spec.rb index abc1234..def5678 100644 --- a/spec/reindeer/types_spec.rb +++ b/spec/reindeer/types_spec.rb @@ -6,7 +6,7 @@ with Reindeer::Role::TypeConstraint def verify(val) - val =~ /^[a-z]+$/ + val.downcase == val end meta.compose! @@ -23,4 +23,31 @@ obj = SoftlySpoken.new(start: 'LOUD NOISES') }.to raise_error(Reindeer::TypeConstraint::Invalid) end + + it 'should have useful a error message' do + class LoudWord < Reindeer + with Reindeer::Role::TypeConstraint + + def verify(val) + val.upcase == val + end + + def error_message_for(val) + "THE VALUE '#{val}' WASN'T LOUD ENOUGH" + end + + meta.compose! + end + + class SergeantMajor < Reindeer + has :order, is_a: String, type_of: LoudWord + end + + obj = SergeantMajor.new(order: 'TEN HUT') + expect(obj.order).to eq('TEN HUT') + + expect { + SergeantMajor.new(order: 'quiet please') + }.to raise_error(Reindeer::TypeConstraint::Invalid, /WASN'T LOUD ENOUGH/) + end end
Test for meaningful type error messages.
diff --git a/spec/rspec_matchers_spec.rb b/spec/rspec_matchers_spec.rb index abc1234..def5678 100644 --- a/spec/rspec_matchers_spec.rb +++ b/spec/rspec_matchers_spec.rb @@ -0,0 +1,9 @@+require 'models' +require 'rspec/acts_as_matchers' + +RSpec.describe "Custom RSpec matchers" do + it { expect(Product).to be_actable } + + it { expect(Pen).to act_as(:product) } + it { expect(Pen).to act_as(Product) } +end
Create specs for RSpec custom matchers
diff --git a/app/controllers/clubs_controller.rb b/app/controllers/clubs_controller.rb index abc1234..def5678 100644 --- a/app/controllers/clubs_controller.rb +++ b/app/controllers/clubs_controller.rb @@ -7,6 +7,6 @@ def show @club = Club.find(params[:id]) - @meetings = @club.meetings.order(created_at: :asc) + @meetings = @club.meetings.order(created_at: :desc) end end
Order meetings in list by date descending
diff --git a/lib/generators/authentication/templates/identities_controller.rb b/lib/generators/authentication/templates/identities_controller.rb index abc1234..def5678 100644 --- a/lib/generators/authentication/templates/identities_controller.rb +++ b/lib/generators/authentication/templates/identities_controller.rb @@ -8,6 +8,7 @@ @<%= resource_name %> = <%= resource_name.classify %>.new <%= resource_name %>_params if @<%= resource_name %>.save + session[:<%=resource_name %>_id] = <%= resource_name %>.id redirect_to root_url, notice: t('.sign_up') else render :new
Set model id in session after create
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -10,7 +10,7 @@ def create @user = User.new(user_params) if @user.save - # Handle successful save + redirect_to @user else render 'new' end
Create redirects to the new user page
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,4 +1,9 @@ class UsersController < ApplicationController + + # May try to make custom 404 page later + # def index + # not_found + # end def new end @@ -14,7 +19,6 @@ def create user = User.new(user_params) - p user user.save if user.save session[:user_id] = user.id
Delete print statements from users controller
diff --git a/app/controllers/votes_controller.rb b/app/controllers/votes_controller.rb index abc1234..def5678 100644 --- a/app/controllers/votes_controller.rb +++ b/app/controllers/votes_controller.rb @@ -1,14 +1,25 @@-<<<<<<< HEAD -class VotesController < UserActionsController -======= class VotesController < ApplicationController - def new - @vote = Vote.new - @user = User.find_by(id: params[:user_id]) + def create + @vote = Vote.new(vote_params) + @vote.voter_id = current_user.id + if vote.save + flash[:success] = "Thank you for your feedback!" + redirect_to user_path(current_user) + else + flash[:now] = "Your vote has failed" + end end ->>>>>>> Add new method for initializing a vote and finding a user - def create - end + private + + def vote_params + params.require(:vote).permit(:value) + end + + def find_candidate + @vote.candidate_id = Vote.find(params[:vote][:candidate_id]) + end end + +
Update logic in votes controller
diff --git a/lib/anego/client.rb b/lib/anego/client.rb index abc1234..def5678 100644 --- a/lib/anego/client.rb +++ b/lib/anego/client.rb @@ -14,8 +14,8 @@ request :get, "/accounts/#{account_id}/products" end - def product_ratings(product) - request :get, "/apps/#{product.market}/app/#{product.product_id}/ratings" + def product_ratings(market, product_id) + request :get, "/apps/#{market}/app/#{product_id}/ratings" end private
Improve params of product ratings api
diff --git a/lib/arena/client.rb b/lib/arena/client.rb index abc1234..def5678 100644 --- a/lib/arena/client.rb +++ b/lib/arena/client.rb @@ -35,6 +35,9 @@ rescue JSON::ParserError nil + rescue TypeError + nil + rescue Exception => exception puts exception.inspect puts exception.backtrace
Return nil for TypeError (from attempting to parse nil)
diff --git a/app/grids/signups_grid.rb b/app/grids/signups_grid.rb index abc1234..def5678 100644 --- a/app/grids/signups_grid.rb +++ b/app/grids/signups_grid.rb @@ -6,20 +6,27 @@ end column(:id, header: "Seq") - column(:status) do |signup| - if signup.bucket - "Confirmed" - else - "Waitlisted" - end - end + column(:state) column(:name, order: "users.last_name, users.first_name") do |signup| format(signup.user_con_profile.name_inverted) do |name| link_to name, [@event, @run, signup] end end - column(:bucket) do |signup| - signup.bucket.try(:name) + column(:bucket, order: 'signups.bucket_key') do |signup| + if signup.counted? + bucket_name = signup.bucket.try!(:name) + requested_bucket_name = signup.requested_bucket.try!(:name) + + if bucket_name == requested_bucket_name + bucket_name + elsif requested_bucket_name + "#{bucket_name || "None"} (requested #{requested_bucket_name})" + else + nil + end + else + "Not counted" + end end column(:age, order: "users.birth_date") do |signup| signup.user_con_profile.age_as_of signup.run.starts_at
Update the signups list for recent schema changes Things have gotten both simpler (in one place) and more complicated (in others) in the signups table in this branch. The signups list needs to be updated to account for the new logic in there.
diff --git a/lib/nehm/command.rb b/lib/nehm/command.rb index abc1234..def5678 100644 --- a/lib/nehm/command.rb +++ b/lib/nehm/command.rb @@ -1,51 +1,88 @@ module Nehm + # Base class for all Nehm commands. When creating a new nehm command, define + # #initialize, #execute, #arguments, #description, #program_name, #summary + # and #usage (as appropriate). + # See the above mentioned methods for details. class Command - + + ## + # Hash with options of the command. + attr_accessor :options - attr_reader :post_value_options - - attr_reader :pre_value_options - - attr_reader :subcommands - - def execute - end + ## + # Invoke the command with the given list of arguments. def invoke(args) handle_options(args) execute end - def add_subcommand(subcommand, desc) - @subcommands ||= [] - @subcommands_descs ||= {} + ## + # Handle the given list of arguments by parsing them and recording the + # results. - @subcommands << subcommand - @subcommands_descs[subcommand] = desc + def handle_options(args) + parser = OptionParser.new(args, self) + parser.parse end - def add_post_value_option(option, desc) - @post_value_options ||= [] + ## + # Override to provide command handling. + # + # #options will be filled in with your parsed options, unparsed options will + # be left in #options[:args]. + def execute + end + + ## + # Override to provide details of the arguments a command takes. It should + # return a left-justified string, one argument per line. + # + # For example: + # + # def usage + # "nehm help COMMAND" + # end + # + # def arguments + # "COMMAND name of command to show help" + # end + + def arguments + end + + ## + # Override to display a longer description of what this command does. + + def description + end + + ## + # Override to display a short description of what this command does. + + def summary + end + + ## + # Override to display the usage for an individual nehm command. + # + # The text "[options]" is automatically appended to the usage text. + + def usage + end + + ## + # Add a command-line option + # + # Nehm don't use options with dashes to be more user-friendly + + def add_option(option, desc) + @options ||= {} @options_descs ||= {} - @post_value_options << option + @options[option] = nil @options_descs[option] = desc - end - - def add_pre_value_option(option, desc) - @pre_value_options ||= [] - @options_descs ||= {} - - @pre_value_options << option - @options_descs[option] = desc - end - - private - - def handle_options(args) - parser = ArgumentParser.new(args, self) - parser.parse end end
Add some functionality and comment Command class Inspired by rubygems
diff --git a/lib/pcap/handler.rb b/lib/pcap/handler.rb index abc1234..def5678 100644 --- a/lib/pcap/handler.rb +++ b/lib/pcap/handler.rb @@ -38,7 +38,7 @@ PCap.pcap_setdirection(@pcap,dir) end - def loop(data,&block) + def loop(data=nil,&block) callback(&block) if block PCap.pcap_loop(@pcap,@count,@callback,data) @@ -46,7 +46,7 @@ alias :each :loop - def dispatch(data,&block) + def dispatch(data=nil,&block) callback(&block) if block PCap.pcap_dispatch(@pcap,@count,@callback,data)
Make the data argument optional for loop and dispatch.
diff --git a/LeetCode/remote/remove_duplicates_from_sorted_array_II.rb b/LeetCode/remote/remove_duplicates_from_sorted_array_II.rb index abc1234..def5678 100644 --- a/LeetCode/remote/remove_duplicates_from_sorted_array_II.rb +++ b/LeetCode/remote/remove_duplicates_from_sorted_array_II.rb @@ -0,0 +1,29 @@+# https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii/ +# Follow up for "Remove Duplicates": +# What if duplicates are allowed at most twice? +# +# For example, +# Given sorted array nums = [1,1,1,2,2,3], +# +# Your function should return length = 5, with the first five elements of nums being 1, 1, 2, 2 and 3. +# It doesn't matter what you leave beyond the new length. +# https://leetcode.com/submissions/detail/55928207/ +# +# Submission Details +# 164 / 164 test cases passed. +# Status: Accepted +# Runtime: 88 ms +# +# Submitted: 0 minutes ago +# You are here! +# Your runtime beats 100.00% of rubysubmissions. +def remove_duplicates(nums) + write = 0 + (0...nums.size).each { |i| + next if write > 1 && nums[i] == nums[write - 2] + nums[write] = nums[i] + write += 1 + } + + write +end
Remove duplicates from sorted array II
diff --git a/lib/active_record_like_interface.rb b/lib/active_record_like_interface.rb index abc1234..def5678 100644 --- a/lib/active_record_like_interface.rb +++ b/lib/active_record_like_interface.rb @@ -60,6 +60,10 @@ id && id.to_s end + def model_name + self.class.model_name + end + def self.included(into) into.extend ClassMethods end
Fix ActiveRecordLikeInterface to expose a model_name instance method
diff --git a/tests/setup_master.rb b/tests/setup_master.rb index abc1234..def5678 100644 --- a/tests/setup_master.rb +++ b/tests/setup_master.rb @@ -11,6 +11,7 @@ require 'wakame' require 'wakame/initializer' +require 'wakame/util' require 'ext/eventmachine'
Add a require for util classes.
diff --git a/lib/app_frame/controller_methods.rb b/lib/app_frame/controller_methods.rb index abc1234..def5678 100644 --- a/lib/app_frame/controller_methods.rb +++ b/lib/app_frame/controller_methods.rb @@ -18,7 +18,7 @@ module PaginationSupport # paginate collection def collection - get_collection_ivar || set_collection_ivar(end_of_association_chain.scoped.paginate(:page => params[:page], :per_page => per_page)) + get_collection_ivar || set_collection_ivar(end_of_association_chain.page(params[:page]).per(per_page)) end def per_page
Use kaminari syntax for pagination
diff --git a/railties/lib/rails/generators/rails/app/templates/config/boot.rb b/railties/lib/rails/generators/rails/app/templates/config/boot.rb index abc1234..def5678 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/boot.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/boot.rb @@ -1,6 +1,9 @@ require 'rubygems' + # Set up gems listed in the Gemfile. -if File.exist?(File.expand_path('../../Gemfile', __FILE__)) +gemfile = File.expand_path('../../Gemfile', __FILE__) +if File.exist?(gemfile) + ENV['BUNDLE_GEMFILE'] = gemfile require 'bundler' Bundler.setup -end +end
Allow a Rails application to be initialized from any directory and not just from inside it (ht: Andre Arko).
diff --git a/lib/facebook_share_widget/engine.rb b/lib/facebook_share_widget/engine.rb index abc1234..def5678 100644 --- a/lib/facebook_share_widget/engine.rb +++ b/lib/facebook_share_widget/engine.rb @@ -7,10 +7,5 @@ module FacebookShareWidget class Engine < ::Rails::Engine isolate_namespace FacebookShareWidget - - initializer "facebook_share_widget.assets.precompile" do |app| - app.config.assets.compress = false - end - end end
Revert "turn off compression to help with debugging in production." This reverts commit d3bc0d0eb5b44688b50a02475ae629f1a6eaa04c.
diff --git a/features/support/ui/sections/child_category.rb b/features/support/ui/sections/child_category.rb index abc1234..def5678 100644 --- a/features/support/ui/sections/child_category.rb +++ b/features/support/ui/sections/child_category.rb @@ -3,7 +3,7 @@ module UI::Sections class ChildCategory < UI::Section element :heading, 'h2' - element :title, 'h2 a' + element :title, 'h2' # can be a list of categories or content items elements :items, 'ol li a'
Fix cucumber error due to link being removed
diff --git a/app/services/submission_rejector.rb b/app/services/submission_rejector.rb index abc1234..def5678 100644 --- a/app/services/submission_rejector.rb +++ b/app/services/submission_rejector.rb @@ -1,8 +1,7 @@ class SubmissionRejector RULES = [ Rules::EnglishRule.new, - Rules::FirstTimeRule.new, - Rules::AdultRule.new + Rules::FirstTimeRule.new ] def initialize(rules = RULES)
[155] Remove adult rule from SubmissionRejector
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index abc1234..def5678 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,5 +1,11 @@ require 'rails_helper' RSpec.describe User, type: :model do - pending "add some examples to (or delete) #{__FILE__}" + + it {should have_many :tutor_connections} + it {should have_many :learner_connections} + it {should have_many :tutors} + it {should have_many :learners} + + end
Add passing tests on user relations: tutor_connections, learner_connections, tutors, learners
diff --git a/spec/sample_file_spec.rb b/spec/sample_file_spec.rb index abc1234..def5678 100644 --- a/spec/sample_file_spec.rb +++ b/spec/sample_file_spec.rb @@ -1,31 +1,24 @@ require 'spec_helper' describe SampleFile do - describe :image do - it "should call #file on an instance of Image" do - described_class::Image.any_instance.should_receive(:file) - described_class.image + %w(Image Video).each do |class_name| + klass = const_get("SampleFile::#{class_name}") + + file_method = class_name.downcase + describe file_method do + it "should call #file on an instance of #{class_name}" do + klass.any_instance.should_receive(:file) + described_class.send file_method + end end - end - describe :image_path do - it "should call #file_path on an instance of Image" do - described_class::Image.any_instance.should_receive(:file_path) - described_class.image_path + file_path_method = "#{file_method}_path" + describe file_path_method do + it "should call #file_path on an instance of #{class_name}" do + klass.any_instance.should_receive(:file_path) + described_class.send file_path_method + end end - end - describe :video do - it "should call #file on an instance of Video" do - described_class::Video.any_instance.should_receive(:file) - described_class.video - end - end - - describe :video_path do - it "should call #file_path on an instance of Video" do - described_class::Video.any_instance.should_receive(:file_path) - described_class.video_path - end end end
Remove duplication from SampleFile spec
diff --git a/simple_mvc.gemspec b/simple_mvc.gemspec index abc1234..def5678 100644 --- a/simple_mvc.gemspec +++ b/simple_mvc.gemspec @@ -23,4 +23,5 @@ spec.add_runtime_dependency "rack" spec.add_runtime_dependency "tilt" + spec.add_runtime_dependency "haml" end
Add haml gem to gemspec
diff --git a/lib/rack/canonical_host/redirect.rb b/lib/rack/canonical_host/redirect.rb index abc1234..def5678 100644 --- a/lib/rack/canonical_host/redirect.rb +++ b/lib/rack/canonical_host/redirect.rb @@ -19,34 +19,30 @@ end def known_host? - request_host == @host || ignored_host? + request_uri.host == @host || ignored_host? end def response - [ - 301, - { 'Location' => url, 'Content-Type' => 'text/html' }, - [HTML_TEMPLATE % url] - ] + headers = { 'Location' => new_url, 'Content-Type' => 'text/html' } + [301, headers, [HTML_TEMPLATE % new_url]] end - - def request_host - @request_host ||= @env['SERVER_NAME'] - end - private :request_host def ignored_host? if ignored_hosts = @options[:ignored_hosts] - ignored_hosts.include?(request_host) + ignored_hosts.include?(request_uri.host) end end private :ignored_host? - def url - url = Rack::Request.new(@env).url - url.sub(%r{\A(https?://)(.*?)(:\d+)?(/|$)}, "\\1#{@host}\\3/") + def new_url + request_uri.tap { |uri| uri.host = @host }.to_s end - private :url + private :new_url + + def request_uri + URI.parse(Rack::Request.new(@env).url) + end + private :request_uri end end end
Use URI to simplify host detection and generation.
diff --git a/test/lib/shopify_app/login_protection_test.rb b/test/lib/shopify_app/login_protection_test.rb index abc1234..def5678 100644 --- a/test/lib/shopify_app/login_protection_test.rb +++ b/test/lib/shopify_app/login_protection_test.rb @@ -0,0 +1,56 @@+require 'test_helper' +require 'action_controller' + +class HelpersController < ActionController::Base + include ShopifyApp::LoginProtection + helper_method :shop_session + + def index + render nothing: true + end +end + +class LoginProtectionTest < ActionController::TestCase + tests HelpersController + + def setup + ShopifySessionRepository.storage = InMemorySessionStore + @session = ShopifyAPI::Session.new('shop.myshopify.com', 'abracadabra') + end + + def test_calling_shop_session_returns_nil_when_session_is_nil + with_application_test_routes do + session[:shopify] = nil + get :index + assert_nil @controller.shop_session + end + end + + def test_calling_shop_session_retreives_session_from_storage + with_application_test_routes do + session[:shopify] = "foobar" + get :index + ShopifySessionRepository.expects(:retrieve).returns(@session).once + @controller.shop_session + end + end + + def test_shop_session_is_memoized_and_does_not_retreive_session_twice + with_application_test_routes do + session[:shopify] = "foobar" + get :index + ShopifySessionRepository.expects(:retrieve).returns(@session).once + @controller.shop_session + @controller.shop_session + end + end + + def with_application_test_routes + with_routing do |set| + set.draw do + get '/' => 'helpers#index' + end + yield + end + end +end
Add controller tests for LoginProtection module
diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb index abc1234..def5678 100644 --- a/spec/support/matchers.rb +++ b/spec/support/matchers.rb @@ -1,7 +1,7 @@ # Define matchers for the docker LWRPs # Need chef-docker to define its own LWRP matchers eventually -module DockerLWRPs +module DockerLWRPMatchers [:pull, :build, :remove, :import].each do |meth| self.send(:define_method,"#{meth}_docker_image") do |resource_name| ChefSpec::Matchers::ResourceMatcher.new(:docker_image, meth, resource_name) @@ -15,4 +15,14 @@ end end -include DockerLWRPs +include DockerLWRPMatchers + +module SudoLWRPMatchers + [:install, :remove].each do |meth| + self.send(:define_method,"#{meth}_sudo") do |resource_name| + ChefSpec::Matchers::ResourceMatcher.new(:sudo, meth, resource_name) + end + end +end + +include SudoLWRPMatchers
Add sudo LWRP matcher and rename docker matcher module
diff --git a/db/migrate/1_create_seo_data.rb b/db/migrate/1_create_seo_data.rb index abc1234..def5678 100644 --- a/db/migrate/1_create_seo_data.rb +++ b/db/migrate/1_create_seo_data.rb @@ -5,6 +5,8 @@ t.string :meta_keywords t.string :meta_title t.text :meta_description + + t.timestamps end end end
Include timestamps to SeoDatum table
diff --git a/ember-cli-rails-assets.gemspec b/ember-cli-rails-assets.gemspec index abc1234..def5678 100644 --- a/ember-cli-rails-assets.gemspec +++ b/ember-cli-rails-assets.gemspec @@ -15,4 +15,6 @@ s.license = "MIT" s.files = Dir["{app,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] + + s.add_dependency 'nokogiri' end
Add nokogiri as a dependency
diff --git a/recipes/_repo.rb b/recipes/_repo.rb index abc1234..def5678 100644 --- a/recipes/_repo.rb +++ b/recipes/_repo.rb @@ -4,8 +4,8 @@ when 'nginx-stable' include_recipe 'yum-nginx::default' when 'nginx-mainline' - node.default['yum-nginx']['repos']['nginx-stable']['manages'] = false - node.default['yum-nginx']['repos']['nginx-mainline']['manages'] = true + node.default['yum-nginx']['repos']['nginx-stable']['managed'] = false + node.default['yum-nginx']['repos']['nginx-mainline']['managed'] = true include_recipe 'yum-nginx::default' else fail("#{node['nginx_server']['repo']} is not an allowed value for
Fix attirbute names that allow choosing the nginx-mainline repo
diff --git a/bureaucrat.gemspec b/bureaucrat.gemspec index abc1234..def5678 100644 --- a/bureaucrat.gemspec +++ b/bureaucrat.gemspec @@ -9,7 +9,7 @@ s.specification_version = 2 if s.respond_to? :specification_version= - s.files = ["lib/bureaucrat/fields.rb", "lib/bureaucrat/forms.rb", "lib/bureaucrat/formsets.rb", "lib/bureaucrat/quickfields.rb", "lib/bureaucrat/utils.rb", "lib/bureaucrat/validation.rb", "lib/bureaucrat/validation_old.rb", "lib/bureaucrat/widgets.rb", "lib/bureaucrat/wizard.rb", "lib/bureaucrat.rb", "README.md", "LICENSE", "test/fields_test.rb", "test/forms_test.rb", "test/formsets_test.rb", "test/test_helper.rb", "test/widgets_test.rb"] + s.files = ["lib/bureaucrat/fields.rb", "lib/bureaucrat/forms.rb", "lib/bureaucrat/formsets.rb", "lib/bureaucrat/media.rb", "lib/bureaucrat/quickfields.rb", "lib/bureaucrat/temporary_uploaded_file.rb", "lib/bureaucrat/utils.rb", "lib/bureaucrat/validators.rb", "lib/bureaucrat/widgets.rb", "lib/bureaucrat.rb", "README.md", "LICENSE", "test/fields_test.rb", "test/forms_test.rb", "test/formsets_test.rb", "test/test_helper.rb", "test/utils_test.rb", "test/widgets_test.rb"] s.require_paths = ['lib']
Fix gemspec for this branch
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -17,7 +17,7 @@ # limitations under the License. # prime the search to avoid 2 masters -node.save +node.save # ~FC075 unless node['drbd']['custom_repo'] include_recipe 'yum-elrepo' if platform_family?('rhel', 'fedora')
Disable FC075 where we actually need it Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/db/migrate/20141219034321_add_permalink_to_enterprises.rb b/db/migrate/20141219034321_add_permalink_to_enterprises.rb index abc1234..def5678 100644 --- a/db/migrate/20141219034321_add_permalink_to_enterprises.rb +++ b/db/migrate/20141219034321_add_permalink_to_enterprises.rb @@ -13,7 +13,7 @@ counter += 1 end - enterprise.update_attribute('permalink', permalink) + enterprise.update_column :permalink, permalink end change_column :enterprises, :permalink, :string, null: false
Switch to update_column, which will not run geocoding callback of Enterprise
diff --git a/db/migrate/20190206235119_change_category_id_to_bigint.rb b/db/migrate/20190206235119_change_category_id_to_bigint.rb index abc1234..def5678 100644 --- a/db/migrate/20190206235119_change_category_id_to_bigint.rb +++ b/db/migrate/20190206235119_change_category_id_to_bigint.rb @@ -0,0 +1,15 @@+class ChangeCategoryIdToBigint < ActiveRecord::Migration[6.0] + def up + change_column :categories, :id, :bigint + + change_column :documents, :category_id, :bigint + change_column :videos, :category_id, :bigint + end + + def down + change_column :categories, :id, :integer + + change_column :documents, :category_id, :integer + change_column :videos, :category_id, :integer + end +end
Update category_id primary and foreign keys to bigint
diff --git a/UIScrollSlidingPages.podspec b/UIScrollSlidingPages.podspec index abc1234..def5678 100644 --- a/UIScrollSlidingPages.podspec +++ b/UIScrollSlidingPages.podspec @@ -16,6 +16,5 @@ "UIScrollViewSlidingPages/Source/**/*.{h,m}" ] s.requires_arc = true - s.resources = "UIScrollViewSlidingPages/Source/Images/**/*.png" end
Remove unused resources from podfile
diff --git a/lib/ap/core_ext/action_view.rb b/lib/ap/core_ext/action_view.rb index abc1234..def5678 100644 --- a/lib/ap/core_ext/action_view.rb +++ b/lib/ap/core_ext/action_view.rb @@ -1,4 +1,17 @@ module AwesomePrintActionView + + def self.included(base) + unless base.const_defined?(:AP_ANSI_TO_HTML) + hash = {} # Build ANSI => HTML color map. + [ :gray, :red, :green, :yellow, :blue, :purple, :cyan, :white ].each_with_index do |color, i| + hash["\033[1;#{30+i}m"] = color + end + [ :black, :darkred, :darkgreen, :sienna, :navy, :darkmagenta, :darkcyan, :slategray ].each_with_index do |color, i| + hash["\033[0;#{30+i}m"] = color + end + base.const_set(:AP_ANSI_TO_HTML, hash.freeze) + end + end def ap_debug(object, options = {}) formatted = object.ai(options) @@ -6,16 +19,8 @@ if options[:plain] %Q|<pre class="debug_dump">#{h(formatted).gsub(" ", "&nbsp; ")}</pre>| else - hash = {} # Build ANSI => HTML color map. - [ :gray, :red, :green, :yellow, :blue, :purple, :cyan, :white ].each_with_index do |color, i| - hash["\033[1;#{30+i}m"] = color - end - [ :black, :darkred, :darkgreen, :sienna, :navy, :darkmagenta, :darkcyan, :slategray ].each_with_index do |color, i| - hash["\033[0;#{30+i}m"] = color - end - formatted = h(formatted).gsub(" ", "&nbsp; ") - hash.each do |key, value| + self.class::AP_ANSI_TO_HTML.each do |key, value| formatted.gsub!(key, %Q|<font color="#{value}">|) end formatted.gsub!("\033[0m", "</font>")
Build ansi => html conversion hash once when the module gets included
diff --git a/mixlib-shellout-x86-mingw32.gemspec b/mixlib-shellout-x86-mingw32.gemspec index abc1234..def5678 100644 --- a/mixlib-shellout-x86-mingw32.gemspec +++ b/mixlib-shellout-x86-mingw32.gemspec @@ -3,6 +3,6 @@ gemspec.platform = "x86-mingw32" -gemspec.add_dependency "win32-process", "~> 0.6.5" +gemspec.add_dependency "win32-process", "~> 0.7.0" gemspec
Update to use win32-process ~> 0.7.0
diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb index abc1234..def5678 100644 --- a/app/controllers/root_controller.rb +++ b/app/controllers/root_controller.rb @@ -16,6 +16,7 @@ NON_LAYOUT_TEMPLATES = %w( barclays_epdq beta_notice + beta_label campaign print proposition_menu
Mark the beta_label template as a non-layout template Include "beta_label" as part of the NON_LAYOUT_TEMPLATES list, so that we don't show the GOV.UK wrapper around it when we include it in other pages.
diff --git a/app/helpers/notification_helper.rb b/app/helpers/notification_helper.rb index abc1234..def5678 100644 --- a/app/helpers/notification_helper.rb +++ b/app/helpers/notification_helper.rb @@ -4,19 +4,20 @@ include ActionView::Helpers::TagHelper def banner_notification - banner = NotificationFileLookup.instance.banner - if banner - content_tag(:section, "<div>#{banner[:file]}</div>", {:id => "banner-notification", :class => banner[:colour]}, false) - else - '' - end + node_replacement_notification(NotificationFileLookup.instance.banner, "banner") end - # This is only used to replace homepage campaigns for urgent matters. + # Only used to replace homepage campaigns for urgent matters. def campaign_replacement_notification - campaign = NotificationFileLookup.instance.campaign - if campaign - content_tag(:section, "<div>#{campaign[:file]}</div>", {:id => "campaign-notification", :class => campaign[:colour]}, false) + node_replacement_notification(NotificationFileLookup.instance.campaign, "campaign") + end + + private + + def node_replacement_notification(node, type) + if node + content_tag(:section, "<div>#{node[:file]}</div>", + {:id => "#{type}-notification", :class => node[:colour]}, false) else '' end
Refactor duplicate method bodies into shared private method
diff --git a/app/models/mails/initiated_mail.rb b/app/models/mails/initiated_mail.rb index abc1234..def5678 100644 --- a/app/models/mails/initiated_mail.rb +++ b/app/models/mails/initiated_mail.rb @@ -5,7 +5,7 @@ SLUG = "initiated_mail" TEMPLATE_NAME = "mails/initiated_mail" DISPLAYED_NAME = 'Accusé de réception' - DEFAULT_OBJECT = 'Votre dossier TPS nº --numero_dossier-- a été bien reçu' + DEFAULT_OBJECT = 'Votre dossier TPS nº --numero_dossier-- a bien été reçu' ALLOWED_TAGS = [TAG_NUMERO_DOSSIER, TAG_LIEN_DOSSIER, TAG_LIBELLE_PROCEDURE] end end
Fix the wording of the initiated email’s subject
diff --git a/lib/tasks/tmp_update_hmrc_manual_sections.rake b/lib/tasks/tmp_update_hmrc_manual_sections.rake index abc1234..def5678 100644 --- a/lib/tasks/tmp_update_hmrc_manual_sections.rake +++ b/lib/tasks/tmp_update_hmrc_manual_sections.rake @@ -0,0 +1,42 @@+# Following decommissioning of manuals-frontend we are improving simplicity of rendering +# these manuals in government-frontend by adding the manual title to the manual sections +# in the publishing_api via this temporary Rake task. It will only update +# sections of editions that are currently live in the content-store, +# drafts will be updated when published from the API. + +def update_hmrc_manual_section_titles(dry_run: false) + hmrc_manual_sections = Document.presented.where(editions: { publishing_app: "hmrc-manuals-api", document_type: "hmrc_manual_section" }) + + hmrc_manual_sections.each do |document| + edition = document.live + + next if edition.blank? + + details = edition.details + manual_edition = Edition.live.where(base_path: details[:manual][:base_path]).first + + if manual_edition + details[:manual][:title] = manual_edition.title + puts("Updating HMRC Manual Section #{document.content_id} to set manual title to #{details[:manual][:title]}") + unless dry_run + edition.update!(details: details) + Commands::V2::RepresentDownstream.new.call(document.content_id) + end + else + puts("Error: no parent manual found for HMRC Manual Section #{document.content_id}") + end + end +end + +namespace :tmp_update_hmrc_manual_sections do + desc "Show hmrc_manual_section items that will be updated with the title of the containing manual" + task dry_run: :environment do + puts("DRY RUN (no actual changes will be saved)") + update_hmrc_manual_section_titles(dry_run: true) + end + + desc "Update hmrc_manual_section items with the title of the containing manual" + task go: :environment do + update_hmrc_manual_section_titles + end +end
Add temporary rake task to update titles on hmrc_manual_Section items. To simplify front-end rendering, we need to add the parent manual title to hmrc manual section items. This commit adds a task to update the values on existing records (can be removed once this job is complete and all existing and new hmrc_manual_sections will have the title already).
diff --git a/lib/rails_ops/profiler/node.rb b/lib/rails_ops/profiler/node.rb index abc1234..def5678 100644 --- a/lib/rails_ops/profiler/node.rb +++ b/lib/rails_ops/profiler/node.rb @@ -4,7 +4,7 @@ @object_id = object_id @description = description @parent = parent - parent&.add_child(self) + parent.add_child(self) if parent @children = [] @erroneous = false @t_start = Time.now
Remove usage of Safe Navigation Operator '&.' The Safe Navigation Operator was introduced in ruby 2.3. However, it would be nice to have compatibility with ruby versions below that. This commit has been tested with ruby 2.2.4.
diff --git a/lib/reek/source/source_code.rb b/lib/reek/source/source_code.rb index abc1234..def5678 100644 --- a/lib/reek/source/source_code.rb +++ b/lib/reek/source/source_code.rb @@ -1,4 +1,8 @@-require 'ruby_parser' +if RUBY_VERSION < "1.9.3" + require 'ruby_parser' +else + require 'ripper_ruby_parser' +end require File.join(File.dirname(File.expand_path(__FILE__)), 'config_file') require File.join(File.dirname(File.expand_path(__FILE__)), 'tree_dresser') @@ -22,7 +26,13 @@ attr_reader :desc - def initialize(code, desc, parser = RubyParser.new) + PARSER_CLASS = if RUBY_VERSION < "1.9.3" + RubyParser + else + RipperRubyParser::Parser + end + + def initialize(code, desc, parser = PARSER_CLASS.new) @source = code @desc = desc @parser = parser
Replace ruby_parser with ripper_ruby_parser for Ruby 1.9.
diff --git a/mongo_rates.gemspec b/mongo_rates.gemspec index abc1234..def5678 100644 --- a/mongo_rates.gemspec +++ b/mongo_rates.gemspec @@ -8,7 +8,7 @@ spec.version = MongoRates::VERSION spec.authors = ["Justin Ridgewell"] spec.email = ["justin@ridgewell.name"] - spec.description = %q{Ratings and Recommendations using MongoDB} + spec.summary = %q{Ratings and Recommendations using MongoDB} spec.homepage = "" spec.license = "MIT"
Use gem.summary instead of gem.description Noob mistake
diff --git a/lib/skimlinks/configuration.rb b/lib/skimlinks/configuration.rb index abc1234..def5678 100644 --- a/lib/skimlinks/configuration.rb +++ b/lib/skimlinks/configuration.rb @@ -20,7 +20,7 @@ def reset VALID_CONFIG_KEYS.each do |key| - self.send "#{key}=", self.class.const_get("DEFAULT_#{key.to_s.upcase}") + self.send "#{key}=", self.class.const_get("DEFAULT_#{key.upcase}") end end end
Revert "Explicitely call to_s on symbol before calling upcase" This reverts commit f57cafe5d8d13f9d3a557950bb8d4ea7243ee475.
diff --git a/lib/tasks/metadata_tagger.rake b/lib/tasks/metadata_tagger.rake index abc1234..def5678 100644 --- a/lib/tasks/metadata_tagger.rake +++ b/lib/tasks/metadata_tagger.rake @@ -0,0 +1,7 @@+require 'rummager' + +desc "Apply metadata from the json file" +task :tag_json_metadata do + file_path = File.join(settings.root, '../../config/metadata.json') + Indexer::MetadataTagger.amend_indexes_for_file(file_path) +end
Add rake task to apply metadata
diff --git a/XDKAirMenu.podspec b/XDKAirMenu.podspec index abc1234..def5678 100644 --- a/XDKAirMenu.podspec +++ b/XDKAirMenu.podspec @@ -1,10 +1,10 @@ Pod::Spec.new do |s| s.name = "XDKAirMenu" - s.version = "1.1.11" - s.summary = "A short description of XDKAirMenu." + s.version = "1.1.12" + s.summary = "XDKAirMenu provides a iOs menu like the FIFA app playing with scale and alpha." s.license = 'MIT' - s.author = { "Xavier De Koninck": "xavier.dekoninck@gmail.com" } - s.source = { :git => "https://github.com/appunite/XDKAirMenu.git"} + s.author = { "Xavier De Koninck" => "xavier.dekoninck@gmail.com" } + s.source = { :git => "https://github.com/appunite/XDKAirMenu.git", :tag => s.version } s.platform = :ios, '8.0' s.requires_arc = true s.source_files = 'XDKAirMenu/XDKAirMenu/*.{h,m}'
Change podspec to be valid
diff --git a/test/factories/users_factory.rb b/test/factories/users_factory.rb index abc1234..def5678 100644 --- a/test/factories/users_factory.rb +++ b/test/factories/users_factory.rb @@ -2,10 +2,10 @@ FactoryGirl.define do factory :user do - username { Faker::Internet.user_name } - email { Faker::Internet.email } first_name { Faker::Name.first_name } last_name { Faker::Name.last_name } + username { Faker::Internet.unique.username } + email { Faker::Internet.unique.safe_email } password { "password" } role { Role.student }
FIX: Create unique username and password
diff --git a/test/support/config_helpers.rb b/test/support/config_helpers.rb index abc1234..def5678 100644 --- a/test/support/config_helpers.rb +++ b/test/support/config_helpers.rb @@ -9,34 +9,12 @@ # ... # end def use_config(options, &example) - original_config = {} - - options.each do |key, val| - original_config[key] = ::Judoscale::Config.instance.send(key) - ::Judoscale::Config.instance.send "#{key}=", val - end - - example.call - ensure - options.each do |key, val| - ::Judoscale::Config.instance.send "#{key}=", original_config[key] - end + swap_config Judoscale::Config.instance, options, example end def use_adapter_config(adapter_identifier, options, &example) - adapter_config = ::Judoscale::Config.instance.public_send(adapter_identifier) - original_config = {} - - options.each do |key, val| - original_config[key] = adapter_config.public_send(key) - adapter_config.public_send "#{key}=", val - end - - example.call - ensure - options.each do |key, val| - adapter_config.public_send "#{key}=", original_config[key] - end + adapter_config = Judoscale::Config.instance.public_send(adapter_identifier) + swap_config adapter_config, options, example end # Reset config instance after each test to ensure changes don't leak to other tests. @@ -44,6 +22,23 @@ Judoscale::Config.instance.reset super end + + private + + def swap_config(config_instance, options, example) + original_config = {} + + options.each do |key, val| + original_config[key] = config_instance.public_send(key) + config_instance.public_send "#{key}=", val + end + + example.call + ensure + options.each do |key, val| + config_instance.public_send "#{key}=", original_config[key] + end + end end Judoscale::Test.include ConfigHelpers
Refactor config helpers to share logic that swaps config values It's the same logic, just working on a different config instance object, so we can have a shared method used by both.
diff --git a/lib/gpgme/misc.rb b/lib/gpgme/misc.rb index abc1234..def5678 100644 --- a/lib/gpgme/misc.rb +++ b/lib/gpgme/misc.rb @@ -12,10 +12,17 @@ attr_reader :signatures end + class Recipient + private_class_method :new + + attr_reader :pubkey_algo, :keyid, :status + end + class DecryptResult private_class_method :new attr_reader :unsupported_algorithm, :wrong_key_usage + attr_reader :recipients, :file_name end class SignResult
Define readers of DecryptResult and Recipient instance variables
diff --git a/lib/heroku_san.rb b/lib/heroku_san.rb index abc1234..def5678 100644 --- a/lib/heroku_san.rb +++ b/lib/heroku_san.rb @@ -1,4 +1,4 @@-require 'railtie' if defined?(Rails) && Rails::VERSION::MAJOR >= 3 +require File.join(File.dirname(__FILE__), 'railtie.rb') if defined?(Rails) && Rails::VERSION::MAJOR >= 3 require 'git' require 'heroku_san/stage' require 'heroku_san/project'
Use full path to require railtie
diff --git a/serverspec.gemspec b/serverspec.gemspec index abc1234..def5678 100644 --- a/serverspec.gemspec +++ b/serverspec.gemspec @@ -21,7 +21,6 @@ spec.add_runtime_dependency "rspec", "~> 3.0" spec.add_runtime_dependency "rspec-its" spec.add_runtime_dependency "specinfra", "~> 2.1" - spec.add_runtime_dependency "test-unit", "~> 3.0" spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake", "~> 10.1.1" end
Remove dependency on test-unit because test-unit/power_assert support is experimental currently
diff --git a/webpack-rails.gemspec b/webpack-rails.gemspec index abc1234..def5678 100644 --- a/webpack-rails.gemspec +++ b/webpack-rails.gemspec @@ -18,5 +18,6 @@ s.test_files = Dir["test/**/*"] s.add_dependency "railties", ">= 3.2.0" + s.add_development_dependency "rails", ">= 3.2.0" s.required_ruby_version = '>= 2.0.0' end
Add rails back as a dev dependency
diff --git a/lib/atlas/initializer_input.rb b/lib/atlas/initializer_input.rb index abc1234..def5678 100644 --- a/lib/atlas/initializer_input.rb +++ b/lib/atlas/initializer_input.rb @@ -8,6 +8,7 @@ attribute :share_group, Symbol attribute :priority, Integer, default: 0 attribute :unit, String + attribute :update_type, String validates_presence_of :query end
Add 'update type' property to initializer input class
diff --git a/lib/capybara/server/checker.rb b/lib/capybara/server/checker.rb index abc1234..def5678 100644 --- a/lib/capybara/server/checker.rb +++ b/lib/capybara/server/checker.rb @@ -3,6 +3,8 @@ module Capybara class Server class Checker + TRY_HTTPS_ERRORS = [EOFError, Net::ReadTimeout, Errno::ECONNRESET].freeze + def initialize(host, port) @host, @port = host, port @ssl = false @@ -10,7 +12,7 @@ def request(&block) ssl? ? https_request(&block) : http_request(&block) - rescue EOFError, Net::ReadTimeout + rescue *TRY_HTTPS_ERRORS res = https_request(&block) @ssl = true res
Add Errno::ECONNRESET to the errors that trigger https attempt
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 @@ -0,0 +1,11 @@+namespace :db do + desc "drops, creates, migrates, and seeds database" + task :nuke_pave => :environment do + unless Rails.env == "Production" + Rake::Task["db:drop"].execute + Rake::Task["db:create"].execute + Rake::Task["db:migrate"].execute + Rake::Task["db:seed"].execute + end + end +end
Add nuke_pave task for resetting development database
diff --git a/lib/emeril/metadata_chopper.rb b/lib/emeril/metadata_chopper.rb index abc1234..def5678 100644 --- a/lib/emeril/metadata_chopper.rb +++ b/lib/emeril/metadata_chopper.rb @@ -24,10 +24,10 @@ def initialize(metadata_file) eval(IO.read(metadata_file), nil, metadata_file) %w{name version}.map(&:to_sym).each do |attr| - if self[attr].nil? - raise MetadataParseError, - "Missing attribute `#{attr}' must be set in #{metadata_file}" - end + next unless self[attr].nil? + + raise MetadataParseError, + "Missing attribute `#{attr}' must be set in #{metadata_file}" end end
Use a next to skip iteration in each block (style).
diff --git a/lib/facter/package_provider.rb b/lib/facter/package_provider.rb index abc1234..def5678 100644 --- a/lib/facter/package_provider.rb +++ b/lib/facter/package_provider.rb @@ -12,7 +12,7 @@ Facter.add(:package_provider) do setcode do - if Gem::Version.new(Facter.value(:puppetversion).split(' ')[0]) >= Gem::Version.new('3.6') + if defined? Gem and Gem::Version.new(Facter.value(:puppetversion).split(' ')[0]) >= Gem::Version.new('3.6') Puppet::Type.type(:package).newpackage(:name => 'dummy', :allow_virtual => 'true')[:provider].to_s else Puppet::Type.type(:package).newpackage(:name => 'dummy')[:provider].to_s
Add check if Gem is defined On e.g. Ubuntu 12.04 LTS Gem is not there by default so i added a check to not fail in that fact if this is the case.
diff --git a/lib/hiraoyogi/database/base.rb b/lib/hiraoyogi/database/base.rb index abc1234..def5678 100644 --- a/lib/hiraoyogi/database/base.rb +++ b/lib/hiraoyogi/database/base.rb @@ -1,3 +1,5 @@+require "nkf" + module Hiraoyogi module Database class Base @@ -17,7 +19,7 @@ protected def body_text(doc) - doc.css("body").text.gsub(/\n|\t/, "") + NKF.nkf("-w", doc.css("body").text).gsub(/\n|\t/, "") end def transpose_index_table
Convert page text to UTF-8
diff --git a/datadog.gemspec b/datadog.gemspec index abc1234..def5678 100644 --- a/datadog.gemspec +++ b/datadog.gemspec @@ -20,5 +20,5 @@ spec.add_development_dependency 'bundler', '~> 1.3' spec.add_development_dependency 'rake' - spec.add_development_dependency 'rubocop', '~> 0.23.0' + spec.add_development_dependency 'rubocop', '~> 0.49.0' end
Update rubocop version for security See CVE-2017-8418 Signed-off-by: Mike Fiedler <af44b651315133051dded0e55830cbf76e9bfef9@gmail.com>
diff --git a/lib/restulicious/connection.rb b/lib/restulicious/connection.rb index abc1234..def5678 100644 --- a/lib/restulicious/connection.rb +++ b/lib/restulicious/connection.rb @@ -4,7 +4,7 @@ def get(url, params) request = ::Typhoeus::Request.new(url, method: :get, - headers: { Accept: "text/json" }, + headers: { Accept: "application/json" }, timeout: 100000, # milliseconds cache_timeout: 60, # seconds params: params) @@ -13,7 +13,7 @@ def post(url, params) request = ::Typhoeus::Request.new(url, method: :post, - headers: { Accept: "text/json" }, + headers: { Accept: "application/json" }, timeout: 100000, # milliseconds cache_timeout: 60, # seconds body: params.to_json)
Change accept header to application/json
diff --git a/spec/jsonapi_app/config/initializers/jsonapi_resources.rb b/spec/jsonapi_app/config/initializers/jsonapi_resources.rb index abc1234..def5678 100644 --- a/spec/jsonapi_app/config/initializers/jsonapi_resources.rb +++ b/spec/jsonapi_app/config/initializers/jsonapi_resources.rb @@ -0,0 +1,7 @@+JSONAPI.configure do |config| + # built in paginators are :none, :offset, :paged + config.default_paginator = :paged + + config.default_page_size = 10 + config.maximum_page_size = 20 +end
Set up pagination in testing app
diff --git a/lib/active_record/connection_adapters/sqlserver/core_ext/calculations.rb b/lib/active_record/connection_adapters/sqlserver/core_ext/calculations.rb index abc1234..def5678 100644 --- a/lib/active_record/connection_adapters/sqlserver/core_ext/calculations.rb +++ b/lib/active_record/connection_adapters/sqlserver/core_ext/calculations.rb @@ -18,6 +18,7 @@ end ] + relation = relation.unscope(:order) subquery = relation.arel.as(Arel.sql("subquery_for_count")) select_value = operation_over_aggregate_column(column_alias || Arel.star, "count", false) @@ -31,8 +32,8 @@ ActiveSupport.on_load(:active_record) do if ActiveRecord::VERSION::MAJOR == 5 && - ActiveRecord::VERSION::MINOR == 1 && - ActiveRecord::VERSION::TINY >= 4 + ActiveRecord::VERSION::MINOR == 2 && + ActiveRecord::VERSION::TINY >= 0 mod = ActiveRecord::ConnectionAdapters::SQLServer::CoreExt::Calculations ActiveRecord::Relation.prepend(mod) end
Remove order from count subquery
diff --git a/lib/traceview/api/layerinit.rb b/lib/traceview/api/layerinit.rb index abc1234..def5678 100644 --- a/lib/traceview/api/layerinit.rb +++ b/lib/traceview/api/layerinit.rb @@ -11,11 +11,13 @@ # layer. # def report_init(layer = 'rack') - # Don't send __Init in development or test - return if %w(development test).include? ENV['RACK_ENV'] - - # Don't send __Init if the c-extension hasn't loaded - return unless TraceView.loaded + # Don't send __Init in development, test or if the gem + # isn't fully loaded (e.g. missing c-extension) + if %w(development test).include? ENV['RACK_ENV'] || + ENV.key?('TRACEVIEW_GEM_TEST') || + !TraceView.loaded + return + end platform_info = TraceView::Util.build_init_report
Consolidate __Init checks inside report_init method
diff --git a/try/14_auth_methods_tryouts.rb b/try/14_auth_methods_tryouts.rb index abc1234..def5678 100644 --- a/try/14_auth_methods_tryouts.rb +++ b/try/14_auth_methods_tryouts.rb @@ -1,8 +1,6 @@ require "rye" -# May need to update this in the future with a -# different free SSH provider -@hostname = "shellmix.com" +@hostname = "onetimesecret.com" ## Don't prompt for password if "publickey" is the only :auth_method box = Rye::Box.new(
Change SSH server in auth methods test
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -23,7 +23,7 @@ remote_directory node['chef_handler']['handler_path'] do source 'handlers' unless platform?('windows') - owner 'root' + owner node['root_user'] mode '0755' recursive true end
Use root_user attribute in recipe
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -22,6 +22,7 @@ when 'rhel', 'fedora' node['platform_version'].to_f >= 6.0 ? 'cronie' : 'vixie-cron' end + action :upgrade end service 'cron' do
Install tmpwatch (tmpreaper on Ubuntu).
diff --git a/spec/helpers/collection_spec.rb b/spec/helpers/collection_spec.rb index abc1234..def5678 100644 --- a/spec/helpers/collection_spec.rb +++ b/spec/helpers/collection_spec.rb @@ -24,7 +24,9 @@ Fog.wait_for { !subject.all.map(&:identity).include? instance_one.identity } Fog.wait_for { !subject.all.map(&:identity).include? instance_two.identity } + end + it "has no identity if it has not been persisted" do assert_nil subject.get(subject.new(params).identity) end
[shindo-minitest] Split up CollectionSpec tests into smaller bits
diff --git a/spec/release/deployment_spec.rb b/spec/release/deployment_spec.rb index abc1234..def5678 100644 --- a/spec/release/deployment_spec.rb +++ b/spec/release/deployment_spec.rb @@ -26,7 +26,7 @@ uri = URI("http://localhost:9200/#{index}/_search?q=#{log.data}") output = gateway.execute_on(deployment.master_ip, "curl -s #{uri}") response = JSON.parse(output) - expect(JSON.parse(response["hits"]["hits"].first["@message"])["testvalue"]).to eq log.data + expect(JSON.parse(response["hits"]["hits"].first["_source"]["@message"])["testvalue"]).to eq log.data end end
Fix bug in test when accessing @message field [#116514499] Signed-off-by: Derik Evangelista <70505a31063ee00d819d9d243caf579a659cbb4f@pivotal.io>
diff --git a/spec/feels_spec.rb b/spec/feels_spec.rb index abc1234..def5678 100644 --- a/spec/feels_spec.rb +++ b/spec/feels_spec.rb @@ -1,6 +1,6 @@ ENV['RACK_ENV'] = 'test' -require_relative '../app/feels' # <-- your sinatra app +require_relative '../app/feels' require 'rspec' require 'rack/test' @@ -16,48 +16,22 @@ expect(last_response).to be_ok end - it "has a code of conduct" do - get '/conduct' - expect(last_response).to be_ok - end + routes = %w( + conduct + diversity + prospectus + schedule + speakers + sponsors + talk-ideas + tickets + visiting + ) - it "has a diversity statement" do - get '/diversity' - expect(last_response).to be_ok - end - - it "has a prospectus page" do - get '/prospectus' - expect(last_response).to be_ok - end - - it "has a schedule page" do - get '/schedule' - expect(last_response).to be_ok - end - - it "has a speakers page" do - get '/speakers' - expect(last_response).to be_ok - end - - it "has a sponsors page" do - get '/sponsors' - expect(last_response).to be_ok - end - - it "has a tickets page" do - get '/tickets' - expect(last_response).to be_ok - end - - it "has a talk ideas page" do - get '/talk-ideas' - expect(last_response).to be_ok - end - - it "has a visiting page" do - get '/visiting' - expect(last_response).to be_ok + routes.each do |route| + it "has a #{route} page" do + get "/#{route}" + expect(last_response).to be_ok + end end end
Make the specs shorter by listing routes in word array.
diff --git a/spec/stack_spec.rb b/spec/stack_spec.rb index abc1234..def5678 100644 --- a/spec/stack_spec.rb +++ b/spec/stack_spec.rb @@ -20,6 +20,10 @@ expect(@stack.top).to eq(nil) end + it "allows you to pop from an empty stack" do + expect(@stack.pop).to eq(nil) + end + describe "empty?" do it "should return true if empty" do expect(@stack.empty?).to be(true)
Add test for popping from an empty Stack
diff --git a/test/adapters/mongo_test.rb b/test/adapters/mongo_test.rb index abc1234..def5678 100644 --- a/test/adapters/mongo_test.rb +++ b/test/adapters/mongo_test.rb @@ -7,7 +7,8 @@ def setup host = '127.0.0.1' port = '27017' - collection = Mongo::Client.new(["#{host}:#{port}"], server_selection_timeout: 1, database: 'testing')['testing'] + logger = Logger.new("/dev/null") + collection = Mongo::Client.new(["#{host}:#{port}"], server_selection_timeout: 1, database: 'testing', logger: logger)['testing'] begin collection.drop collection.create
Send mongo logging to dev null
diff --git a/lib/openxml/docx/elements/abstract_number.rb b/lib/openxml/docx/elements/abstract_number.rb index abc1234..def5678 100644 --- a/lib/openxml/docx/elements/abstract_number.rb +++ b/lib/openxml/docx/elements/abstract_number.rb @@ -21,6 +21,13 @@ # value_property :name # value_property :style_link # value_property :num_style_link + + def property_xml(xml) + props = properties.keys.map(&method(:send)).compact + return if props.none?(&:render?) + + props.each { |prop| prop.to_xml(xml) } + end end end end
Make properties appear on the root level of the element
diff --git a/test/jenkins_sample_test.rb b/test/jenkins_sample_test.rb index abc1234..def5678 100644 --- a/test/jenkins_sample_test.rb +++ b/test/jenkins_sample_test.rb @@ -6,10 +6,15 @@ class JenkinsSampleTest < MiniTest::Unit::TestCase def setup - @webpage = Net::HTTP.get(URI("http://#{ENV['TEST_IP_ADDRESS']}:8000/index.html")) + uri_params = { + :host => ENV['TEST_IP_ADDRESS'] || 'localhost', + :port => (ENV['TEST_PORT'] || '80').to_i, + :path => '/index.html' + } + @webpage = Net::HTTP.get(URI::HTTP.build(uri_params)) end def test_congratulations - assert(@webpage =~ /Congratulations!/) + assert(@webpage =~ /Congratulations/) end -end+end
Change default test port to 80 The test port can be configured with the env variable TEST_PORT.
diff --git a/lib/woocommerce_api/concerns/associations.rb b/lib/woocommerce_api/concerns/associations.rb index abc1234..def5678 100644 --- a/lib/woocommerce_api/concerns/associations.rb +++ b/lib/woocommerce_api/concerns/associations.rb @@ -19,7 +19,7 @@ define_method association_name do association_class = class_name.constantize - resource_uri = "/#{self.class.resource_name}/#{self.id}" + resource_uri = "/#{self.class.collection_name}/#{self.id}" resource_uri.concat(options[:resource_uri].presence || "/#{association_class.resource_name}") resource = http_request(:get, resource_uri) self.extract_resource(resource)
Fix error since we moved to 'collection_name'
diff --git a/config/initializers/carrierwave.rb b/config/initializers/carrierwave.rb index abc1234..def5678 100644 --- a/config/initializers/carrierwave.rb +++ b/config/initializers/carrierwave.rb @@ -34,10 +34,6 @@ region: 'eu-west-1' } - if s3['vhost'] - credentials.merge!(host: s3['vhost']) - end - config.fog_credentials = credentials config.fog_directory = s3['vhost'] || s3['bucket'] end
Remove host from s3 fog credentials
diff --git a/spec/swagger_docs_generator/configuration/configuration_default_spec.rb b/spec/swagger_docs_generator/configuration/configuration_default_spec.rb index abc1234..def5678 100644 --- a/spec/swagger_docs_generator/configuration/configuration_default_spec.rb +++ b/spec/swagger_docs_generator/configuration/configuration_default_spec.rb @@ -15,9 +15,14 @@ it_behaves_like 'variable exist', true end - context 'base_controller' do - let(:variable) { SwaggerDocsGenerator.config.base_controller } - it_behaves_like 'variable exist', '' + context 'doc_class' do + let(:variable) { SwaggerDocsGenerator.config.doc_class } + it_behaves_like 'variable does not exist' + end + + context 'doc_folder' do + let(:variable) { SwaggerDocsGenerator.config.doc_folder } + it_behaves_like 'variable does not exist' end context 'base_path' do
Test doc_class and doc_folder attribute
diff --git a/composer/recipes/install.rb b/composer/recipes/install.rb index abc1234..def5678 100644 --- a/composer/recipes/install.rb +++ b/composer/recipes/install.rb @@ -8,5 +8,8 @@ php composer.phar install --no-dev --no-interaction --prefer-dist EOH only_if { ::File.exist?("#{deploy[:deploy_to]}/current/composer.json")} + code <<-EOH + laravel new recipe + EOH end -end+end
Add laravel project at deploy Add laravel project at deploy
diff --git a/modules/php5/spec/extension/newrelic/spec.rb b/modules/php5/spec/extension/newrelic/spec.rb index abc1234..def5678 100644 --- a/modules/php5/spec/extension/newrelic/spec.rb +++ b/modules/php5/spec/extension/newrelic/spec.rb @@ -14,3 +14,7 @@ its(:stdout) { should match /daemon\.logfile => \/var\/log\/newrelic\/newrelic-daemon\.log/ } its(:stdout) { should match /browser_monitoring\.auto_instrument => enabled/ } end + +describe file('/var/log/php/error.log') do + its(:content) { should_not match /Warning.*newrelic.*already loaded/ } +end
Duplicate extension - Change test object
diff --git a/config/initializers/i18n.rb b/config/initializers/i18n.rb index abc1234..def5678 100644 --- a/config/initializers/i18n.rb +++ b/config/initializers/i18n.rb @@ -9,7 +9,7 @@ # set up fallbacks require "i18n/backend/fallbacks" I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks) -Rails.application.config.i18n.fallbacks = [ :en ] +I18n.fallbacks.map( iw: :he ) # from and to locales for the translate gem (translation ui) Rails.application.config.from_locales = [:en, :es]
Use he (current Hebrew locale) as the fallback locale for iw (old Hebrew locale)
diff --git a/db/migrate/20120101170000_remove_unique_constraint_from_titles_on_mock_lists.rb b/db/migrate/20120101170000_remove_unique_constraint_from_titles_on_mock_lists.rb index abc1234..def5678 100644 --- a/db/migrate/20120101170000_remove_unique_constraint_from_titles_on_mock_lists.rb +++ b/db/migrate/20120101170000_remove_unique_constraint_from_titles_on_mock_lists.rb @@ -0,0 +1,11 @@+class RemoveUniqueConstraintFromTitlesOnMockLists < ActiveRecord::Migration + def self.up + remove_index :mock_lists, [:project_id, :title] + add_index :mock_lists, [:project_id, :title] + end + + def self.down + remove_index :mock_lists, [:project_id, :title] + add_index :mock_lists, [:project_id, :title], :unique => true + end +end
Remove unique constraint on mock titles
diff --git a/config/schedule.rb b/config/schedule.rb index abc1234..def5678 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -1,4 +1,4 @@-env 'PATH', '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' +env 'PATH', '/opt/ruby/bin:/usr/sbin:/usr/bin:/sbin:/bin' every :day, at: '12:00am' do runner 'ApplicationSubmission.move_to_dashboard'
Change the path to where ruby will be
diff --git a/config/schedule.rb b/config/schedule.rb index abc1234..def5678 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -1,3 +1,5 @@+job_type :rake, "cd :path && RACK_ENV=:environment bundle exec rake :task --silent :output" + set :output, '/home/stillmaintained/shared/log/cron.log' every 6.hours do
Fix whenever environment variables from RAILS_ENV to RACK_ENV
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -5,3 +5,5 @@ # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Character.create(name: 'Luke', movie: movies.first) + +badge = Badge.create(name: 'Chemical Spill', description: "This pin is used to warn people of any type of chemical spilled where it shouldn't be.", category: "Reporting", medal: "Bronze", image_id: 1)
Create first badge to seed database