diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/week-9/ruby-review-1/ruby-review.rb b/week-9/ruby-review-1/ruby-review.rb
index abc1234..def5678 100644
--- a/week-9/ruby-review-1/ruby-review.rb
+++ b/week-9/ruby-review-1/ruby-review.rb
@@ -0,0 +1,139 @@+# Create a Car Class from User Stories
+
+
+# I worked on this challenge [by myself, with: ].
+
+
+# 2. Pseudocode
+# -Create Car Class with attributes of model and color.
+# -Create method distance that accpets distance as an argument
+# -create mileage method
+# -create a method to display last move
+
+# create Drive class
+# -Create method distance that accpets distance as an argument
+# - create a method speed for current speed
+# - create a method turn that accepts left and right as arguments
+# - create a method velocity (maybe in speed method)
+# -create stop method (maybe in velocity)
+
+
+
+
+
+# 3. Initial Solution
+
+
+ class Car
+
+ @@display = display
+ attr_reader :car
+
+
+
+
+
+ def initialize(model, color)
+
+ @model= model
+ @color= color
+
+
+ end
+ end
+
+
+ class Drive
+
+ def initialize
+ @ride= Car.new("Ford", "Blue")
+ @@display = 0
+
+ end
+
+ def distance(miles)
+ puts "Your #{@ride.car} drove #{miles}."
+ @@display += miles
+
+ end
+
+ def speed(mph)
+ puts "Your speed is #{mph}."
+ @mph = mph
+ end
+
+ def turn(direction)
+ if direction == "left"
+ puts "You've turned left"
+ elsif direction == "right"
+ puts "You've turned right"
+ end
+
+ end
+
+# def mileage
+# puts "current mileage is #{}"
+# end
+
+ def accelerate(num)
+ puts "You are now driving #{@mph+num}"
+ end
+
+ def decelerate(num)
+ puts "You are now driving #{@mph-num}"
+ end
+
+ def stop
+ puts "You stopped"
+ end
+
+ def display
+ puts "Current mileage #{@@display}"
+
+ end
+
+end
+
+# car= Car.new("Ford", "Blue")
+# car= Car.new("Ford", "Blue")
+drive= Drive.new
+drive.distance(0.25)
+drive.speed(25)
+drive.stop
+drive.turn("right")
+drive.distance(1.5)
+drive.accelerate(10)
+drive.speed(35)
+drive.decelerate(20)
+drive.distance(0.25)
+drive.stop
+drive.turn("left")
+drive.distance(1.4)
+drive.speed(35)
+drive.stop
+drive.display
+
+
+# Create a new car of your desired model and type
+# Drive .25 miles (speed limit is 25 mph)
+# At the stop sign, turn right
+# Drive 1.5 miles (speed limit is 35 mph)
+# At the school zone, check your speed
+# Slow down to speed limit 15 mph
+# Drive .25 miles more miles
+# At the stop sign, turn left
+# Drive 1.4 miles (speed limit is 35 mph)
+# Stop at your destination
+# Log your total distance travelled
+
+# 4. Refactored Solution
+
+
+
+
+
+
+# 1. DRIVER TESTS GO BELOW THIS LINE
+
+
+
|
Add ruby review 1 again
|
diff --git a/config/initializers/logging.rb b/config/initializers/logging.rb
index abc1234..def5678 100644
--- a/config/initializers/logging.rb
+++ b/config/initializers/logging.rb
@@ -1,4 +1,5 @@ def log(msg, level = :info)
+ msg = msg.to_s
if Sidekiq::Logging.logger
Sidekiq::Logging.logger.send level, msg
elsif Rails.logger
|
Convert log message to format; fails on array, int, etc.
|
diff --git a/cf-cli.rb b/cf-cli.rb
index abc1234..def5678 100644
--- a/cf-cli.rb
+++ b/cf-cli.rb
@@ -9,7 +9,7 @@
depends_on :arch => :x86_64
- conflicts_with "cloudfoundry-cli", :because => "the Pivotal tap ships an older cli distribution"
+ conflicts_with "pivotal/tap/cloudfoundry-cli", :because => "the Pivotal tap ships an older cli distribution"
def install
bin.install 'cf'
|
Use fully-qualified tap name in conflicts_with
Signed-off-by: Muhammad Altaf <62c4feecf50ce9eaca6c8296bee7297f5ed184af@gmail.com>
|
diff --git a/plugins/morse.rb b/plugins/morse.rb
index abc1234..def5678 100644
--- a/plugins/morse.rb
+++ b/plugins/morse.rb
@@ -1,7 +1,7 @@ class Morse < Linkbot::Plugin
Linkbot::Plugin.register('morse', self, {
- :message => {:regex => /\A[\s\/\.-]+\z/i, :handler => :on_message}
+ :message => {:regex => /\A[\s\|\?\/\.-]+\z/i, :handler => :on_message}
})
def self.on_message(message, matches)
@@ -11,10 +11,10 @@ '-.-' => 'K', '.-..' => 'L', '--' => 'M', '-.' => 'N', '---' => 'O',
'.--.' => 'P', '--.-' => 'Q', '.-.' => 'R', '...' => 'S', '-' => 'T',
'..-' => 'U', '...-' => 'V', '.--' => 'W', '-..-' => 'X', '-.--' => 'Y',
- '--..' => 'Z', '/' => ' '
+ '--..' => 'Z', '/' => ' ', '|' => ' '
}
- translation = message.body.split(' ').map {|code| morse_map[code]}.join
+ translation = message.body.split(' ').map {|code| morse_map.fetch(code) {'?'} }.join
"Mo-o-o-o-orse: #{translation}"
end
|
Support | as spaces and ? for unmappable characters.
|
diff --git a/app/policies/document_policy.rb b/app/policies/document_policy.rb
index abc1234..def5678 100644
--- a/app/policies/document_policy.rb
+++ b/app/policies/document_policy.rb
@@ -17,20 +17,4 @@
alias_method :unpublish?, :publish?
alias_method :discard?, :publish?
-
- def user_organisation_owns_document_type?
- document_class.organisations.include?(user.organisation_content_id)
- end
-
- def departmental_editor?
- user_organisation_owns_document_type? && user.permissions.include?('editor')
- end
-
- def writer?
- user_organisation_owns_document_type?
- end
-
- def gds_editor?
- user.gds_editor?
- end
end
|
Remove redundant methods from DocumentPolicy
DocumentPolicy inherits from ApplicationPolicy where these methods are
already defined, so we can drop them.
|
diff --git a/config.ru b/config.ru
index abc1234..def5678 100644
--- a/config.ru
+++ b/config.ru
@@ -1,6 +1,7 @@ # This file is used by Rack-based servers to start the application.
unless defined?(PhusionPassenger)
+ require 'unicorn'
# Unicorn self-process killer
require 'unicorn/worker_killer'
|
Fix 'uninitialized constant Unicorn' error
|
diff --git a/config.ru b/config.ru
index abc1234..def5678 100644
--- a/config.ru
+++ b/config.ru
@@ -13,6 +13,16 @@ ).
reject { |key, _| key == 'HTTP_ACCEPT_ENCODING' }
end
+
+ def rewrite_response(response)
+ status, headers, body = response
+
+ [
+ status,
+ headers.reject { |key, _| key == 'status' },
+ body
+ ]
+ end
end
run Proxy.new
|
Remove Status header from response
gov.uk sends this header, but the Rack specification says
that it shouldn't be part of the response.
|
diff --git a/acceptance/tests/reports/basic_event_query.rb b/acceptance/tests/reports/basic_event_query.rb
index abc1234..def5678 100644
--- a/acceptance/tests/reports/basic_event_query.rb
+++ b/acceptance/tests/reports/basic_event_query.rb
@@ -0,0 +1,70 @@+require 'json'
+require 'time'
+require 'uri'
+
+test_name "validation of basic PuppetDB resource event queries" do
+
+ Log.notify "Setting up manifest file"
+ manifest = <<MANIFEST
+notify { "hi":
+ message => "Hi ${::clientcert}"
+}
+MANIFEST
+
+ tmpdir = master.tmpdir('report_storage')
+
+ manifest_file = File.join(tmpdir, 'site.pp')
+
+ create_remote_file(master, manifest_file, manifest)
+
+ on master, "chmod -R +rX #{tmpdir}"
+
+ # NOTE: this implementation assumes that the test coordinator machine and
+ # all of the SUTs are using NTP, and that their system date/times are roughly
+ # in sync with one another. If this causes problems we could loop over the
+ # agents and build up a map of their timestamps, and then build our queries
+ # based on those values.
+ query_start_time = Time.now.iso8601
+
+
+ # TODO: the module should be setting up the report processors so that we don't
+ # have to add it on the CLI here
+ with_master_running_on master, "--storeconfigs --storeconfigs_backend puppetdb --reports=store,puppetdb --autosign true --manifest #{manifest_file}", :preserve_ssl => true do
+ step "Run agents once to submit reports" do
+ run_agent_on agents, "--test --server #{master}", :acceptable_exit_codes => [0,2]
+ end
+ end
+
+ # Wait until all the commands have been processed
+ sleep_until_queue_empty database
+
+ agents.each do |agent|
+ step "Querying for Notify event on agent '#{agent.node_name}'" do
+
+ # NOTE: this query is overly complex and has a few useless clauses
+ # in it, which are only intended to exercise a larger subset of
+ # the functionality of the query language.
+ query = <<EOM
+["and",
+ ["=", "certname", "#{agent.node_name}"],
+ ["=", "resource-type", "Notify"],
+ ["not",
+ ["=", "resource-title", "bunk"]],
+ ["or",
+ ["=", "status", "success"],
+ ["=", "status", "booyah"]],
+ ["~", "property", "^[Mm]essage$"],
+ ["~", "message", "Hi #{agent.node_name}"],
+ [">", "timestamp", "#{query_start_time}"]]
+EOM
+ query = URI.escape(query)
+
+ # Now query for all of the event for this agent
+ result = on database, %Q|curl -G -H 'Accept: application/json' 'http://localhost:8080/experimental/events' --data 'query=#{query}'|
+ events = JSON.parse(result.stdout)
+
+ assert_equal(1, events.length, "Expected exactly one matching 'Notify' event for host '#{agent.node_name}'; found #{events.length}.")
+ end
+ end
+
+end
|
Add basic acceptance test for event queries
|
diff --git a/cocoapods-bugsnag.gemspec b/cocoapods-bugsnag.gemspec
index abc1234..def5678 100644
--- a/cocoapods-bugsnag.gemspec
+++ b/cocoapods-bugsnag.gemspec
@@ -6,11 +6,17 @@ spec.summary = "To get meaningful stacktraces from your crashes, the Bugsnag service needs your dSYM file for your build. This plugin adds an upload phase to your project where needed."
spec.authors = [ "Delisa Mason" ]
spec.email = [ "delisa@bugsnag.com" ]
- spec.files = [ "lib/cocoapods_bugsnag.rb", "lib/cocoapods_plugin.rb" ]
+ spec.files = [
+ "lib/cocoapods_bugsnag.rb",
+ "lib/cocoapods_plugin.rb",
+ "cocoapods-bugsnag.gemspec"
+ ]
+ spec.extra_rdoc_files = [ "README.md", "CHANGELOG.md" ]
spec.test_files = [ "spec/cocoapods_bugsnag_spec.rb" ]
spec.require_paths = [ "lib" ]
spec.license = "MIT"
+ spec.add_dependency "cocoapods", "~> 0.39.0"
spec.add_development_dependency "rake"
spec.add_development_dependency "bacon"
end
|
[gemspec] Fix specification warning, add cocoapods dependency
|
diff --git a/lib/capistrano/tasks/nexus.rake b/lib/capistrano/tasks/nexus.rake
index abc1234..def5678 100644
--- a/lib/capistrano/tasks/nexus.rake
+++ b/lib/capistrano/tasks/nexus.rake
@@ -1,6 +1,6 @@ namespace :nexus do
def strategy
- @strategy ||= Capistrano::Nexus.new(self, Capistrano::Nexus::DefaultStrategy)
+ @strategy ||= Capistrano::Nexus.new(self, fetch(:nexus_strategy, Capistrano::Nexus::DefaultStrategy))
end
desc 'Copy artifact contents to releases'
|
Allow overriding the default strategy
|
diff --git a/lib/custom_public_exceptions.rb b/lib/custom_public_exceptions.rb
index abc1234..def5678 100644
--- a/lib/custom_public_exceptions.rb
+++ b/lib/custom_public_exceptions.rb
@@ -1,7 +1,8 @@ class CustomPublicExceptions < ActionDispatch::PublicExceptions
def call(env)
status = env["PATH_INFO"][1..-1]
- if status == "404"
+
+ if status == "404" || status == "500"
Rails.application.routes.call(env)
else
super
|
Add logic to our customer dispatcher to catch 500 errors in addition to
400 errors.
|
diff --git a/lib/discordrb/events/message.rb b/lib/discordrb/events/message.rb
index abc1234..def5678 100644
--- a/lib/discordrb/events/message.rb
+++ b/lib/discordrb/events/message.rb
@@ -1,4 +1,4 @@-module Discordrb
+module Discordrb::Events
class MessageEvent
attr_reader :message
|
Use the proper namespace for MessageEvent
|
diff --git a/app/controllers/password_resets_controller.rb b/app/controllers/password_resets_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/password_resets_controller.rb
+++ b/app/controllers/password_resets_controller.rb
@@ -28,13 +28,25 @@ return
end
- @user.password_confirmation = params[:user][:password_confirmation]
+ if params[:user][:password].blank?
+ flash.now[:alert] = "Password cannot be blank"
+ render :edit
+ else
+ if @user.update_attributes(user_params)
+ auto_login(@user)
+ redirect_to root_path, notice: 'Reset Password was successfully'
+ else
+ render :edit
+ end
+ end
+ end
- if @user.change_password!(params[:user][:password])
- auto_login(@user)
- redirect_to root_path, notice: 'Reset Password was successfully'
- else
- render action: :edit
- end
+
+ private
+ def user_params
+ params.require(:user).permit(
+ :password,
+ :password_confirmation,
+ )
end
end
|
Add Provident User From Entering Blanks
Add validation to provident the User from entering blanks into the Reset
Password form because they should not be doing so. Also this will make
the site hard to use since they having if they do not enter a password
then they would have to do the reset password again.
|
diff --git a/lib/panther/operation/errors.rb b/lib/panther/operation/errors.rb
index abc1234..def5678 100644
--- a/lib/panther/operation/errors.rb
+++ b/lib/panther/operation/errors.rb
@@ -1,7 +1,7 @@ # frozen_string_literal: true
module Panther
module Operation
- class OperationError
+ class OperationError < StandardError
attr_reader :status
def as_json(_options)
|
Make OperationError inherit from StandardError
|
diff --git a/lib/voicearchive/task_client.rb b/lib/voicearchive/task_client.rb
index abc1234..def5678 100644
--- a/lib/voicearchive/task_client.rb
+++ b/lib/voicearchive/task_client.rb
@@ -11,10 +11,10 @@ JSON.parse(response.body)
end
- def create_retake(task_id, reason_id)
- response = call("task/#{task_id}/create-retake", {
+ def create_retake(task_id, reason_id, params = {})
+ response = call("task/#{task_id}/create-retake", params.merge({
reasonId: reason_id
- }, 'put');
+ }), 'put');
JSON.parse(response.body)
end
|
Add support for custom params on the create retake method
|
diff --git a/rconomic.gemspec b/rconomic.gemspec
index abc1234..def5678 100644
--- a/rconomic.gemspec
+++ b/rconomic.gemspec
@@ -17,7 +17,7 @@ s.version = Rconomic::VERSION
s.platform = Gem::Platform::RUBY
- s.add_runtime_dependency "savon", "~> 2.2", "< 2.11.2"
+ s.add_runtime_dependency "savon", "~> 2.2"
s.add_development_dependency "rspec", "> 3.0"
s.files = `git ls-files`.split("\n").reject { |filename| [".gitignore"].include?(filename) }
|
Revert "Force usage of Savon prior to 2.11.2"
This reverts commit 3d653902f78c14788dc62e993da658f8f53f59a2.
Now that we no longer need to support connect_with_credentials, we don't need to
monkeypatch Savon, thus we can work on newer versions as well, yay!
|
diff --git a/recipes/rspec.rb b/recipes/rspec.rb
index abc1234..def5678 100644
--- a/recipes/rspec.rb
+++ b/recipes/rspec.rb
@@ -1,4 +1,4 @@-gem 'rspec-rails', '>= 2.0.0.beta.22', :group => [:development, :test]
+gem 'rspec-rails', '>= 2.0.1', :group => [:development, :test]
stategies << lambda do
generate 'rspec:install'
|
Update RSpec to version 2.0.1
|
diff --git a/test/functional/browse_controller_test.rb b/test/functional/browse_controller_test.rb
index abc1234..def5678 100644
--- a/test/functional/browse_controller_test.rb
+++ b/test/functional/browse_controller_test.rb
@@ -0,0 +1,41 @@+require_relative "../test_helper"
+
+class BrowseControllerTest < ActionController::TestCase
+ context "GET index" do
+ should "list all categories" do
+ content_api_has_root_sections(["crime-and-justice"])
+ get :index
+ url = "http://www.test.gov.uk/browse/crime-and-justice"
+ assert_select "ul h2 a", "Crime and justice"
+ assert_select "ul h2 a[href=#{url}]"
+ end
+ end
+
+ context "GET section" do
+ should "list the sub sections" do
+ content_api_has_section("crime-and-justice")
+ content_api_has_subsections("crime-and-justice", ["alpha"])
+ get :section, section: "crime-and-justice"
+
+ assert_select "h1", "Crime and justice"
+ assert_select "ul h2 a", "Alpha"
+ end
+
+ should_eventually "404 if the section does not exist"
+ end
+
+ context "GET sub_section" do
+ should "list the content in the sub section" do
+ content_api_has_section("crime-and-justice/judges", "crime-and-justice")
+ content_api_has_artefacts_in_a_section("crime-and-justice/judges", ["judge-dredd"])
+
+ get :sub_section, section: "crime-and-justice", sub_section: "judges"
+
+ assert_select "h1", "Crime and justice"
+ assert_select "h2", "Judges"
+ assert_select "li h2 a", "Judge dredd"
+ end
+
+ should_eventually "404 if the sub section does not exist"
+ end
+end
|
Add tests for browse controller
|
diff --git a/hero_mapper/app/controllers/heroes_controller.rb b/hero_mapper/app/controllers/heroes_controller.rb
index abc1234..def5678 100644
--- a/hero_mapper/app/controllers/heroes_controller.rb
+++ b/hero_mapper/app/controllers/heroes_controller.rb
@@ -8,7 +8,7 @@ end
def all
- url = 'https://gateway.marvel.com:443/v1/public/characters?orderBy=name' + '&ts=' + timestamp + '&apikey=' + ENV["MARVEL_PUBLIC"] + '&hash=' + marvel_hash
+ url = 'https://gateway.marvel.com:443/v1/public/characters?limit=100' + '&ts=' + timestamp + '&apikey=' + ENV["MARVEL_PUBLIC"] + '&hash=' + marvel_hash
# debugger
uri = URI(url)
response = Net::HTTP.get(uri)
|
Update api query to maximum limit
|
diff --git a/week-4/factorial/my_solution.rb b/week-4/factorial/my_solution.rb
index abc1234..def5678 100644
--- a/week-4/factorial/my_solution.rb
+++ b/week-4/factorial/my_solution.rb
@@ -10,7 +10,7 @@ if number == 0
return 1
else
- while number > n
+ while number > 0
x = x * number
number -= 1
end
|
Add final changes to factorial solution
|
diff --git a/app/controllers/review_controller.rb b/app/controllers/review_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/review_controller.rb
+++ b/app/controllers/review_controller.rb
@@ -6,8 +6,8 @@ @incomplete = {}
Body.all.each do |b|
@incomplete[b.state] = []
- @incomplete[b.state].concat Paper.where(['published_at > ?', Date.today])
- @incomplete[b.state].concat Paper.where(page_count: nil).limit(50)
+ @incomplete[b.state].concat Paper.where(body: b).where(['published_at > ?', Date.today])
+ @incomplete[b.state].concat Paper.where(body: b, page_count: nil).limit(50)
@incomplete[b.state].concat Paper.find_by_sql(
["SELECT p.* FROM papers p LEFT OUTER JOIN paper_originators o ON (o.paper_id = p.id AND o.originator_type = 'Person') WHERE p.body_id = ? AND o.id IS NULL", b.id]
)
@@ -19,6 +19,6 @@ end
def ministries
- @ministries = Ministry.where('length(name) > 70 OR length(name) < 15')
+ @ministries = Ministry.where('length(name) > 70 OR length(name) < 12')
end
end
|
Review: Fix duplicate papers, lower min length for ministry name
|
diff --git a/app/controllers/routes_controller.rb b/app/controllers/routes_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/routes_controller.rb
+++ b/app/controllers/routes_controller.rb
@@ -1,23 +1,26 @@ require 'lib/route_collection'
+require 'lib/engine_route_collection'
module Roots
class RoutesController < ActionController::Base
layout false
def routes
- @route_collection = RouteCollection.new(app_routes: application_routes, eng_routes: engine_routes)
+ @routes = application_routes + engline_routes
end
private
def engine_routes
- ::Rails::Engine.subclasses.map do |engine|
- { engine: engine.name, routes: [*engine.routes.routes.routes] }
- end.flatten
+ RouteCollection.new(
+ ::Rails::Engine.subclasses.map do |engine|
+ { engine: engine.name, routes: [*engine.routes.routes.routes] }
+ end.flatten
+ )
end
def application_routes
- [*Rails.application.routes.routes]
+ EngineRouteCollection.new([*Rails.application.routes.routes])
end
end
end
|
Use new EngineRouteCollection in controller
|
diff --git a/app/helpers/authentication_helper.rb b/app/helpers/authentication_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/authentication_helper.rb
+++ b/app/helpers/authentication_helper.rb
@@ -19,7 +19,7 @@ end
def api_token
- @api_token ||= params[:api_token]
+ @api_token ||= request['X-API-TOKEN'] || params[:api_token]
end
def require_authentication?
|
Allow authentication with X-API-TOKEN headder
|
diff --git a/scube-cli.gemspec b/scube-cli.gemspec
index abc1234..def5678 100644
--- a/scube-cli.gemspec
+++ b/scube-cli.gemspec
@@ -17,6 +17,7 @@
s.add_dependency 'faraday', '~> 0.9'
s.add_dependency 'faraday_middleware', '~> 0.9'
+ s.add_dependency 'id3tag', '~> 0.8'
s.add_development_dependency 'aruba', '~> 0.9'
s.add_development_dependency 'cucumber', '~> 2.0'
|
Declare id3tag gem as runtime dependency
|
diff --git a/app/models/eventable.rb b/app/models/eventable.rb
index abc1234..def5678 100644
--- a/app/models/eventable.rb
+++ b/app/models/eventable.rb
@@ -6,7 +6,7 @@ belongs_to :created_by, :foreign_key => "created_by_id", :class_name => "Person", :dependent => :destroy
has_many :events, :as => :eventable, :dependent => :destroy
- before_validation {|e| update_attribute("created_by_id", Person.user)}
+ before_validation {|e| update_attribute("created_by_id", Person.user.id)}
validates :person_id, :presence => true
|
Fix typo so that created_by in Eventables is set correctly
|
diff --git a/lib/formtastic-bootstrap/helpers/input_helper.rb b/lib/formtastic-bootstrap/helpers/input_helper.rb
index abc1234..def5678 100644
--- a/lib/formtastic-bootstrap/helpers/input_helper.rb
+++ b/lib/formtastic-bootstrap/helpers/input_helper.rb
@@ -16,6 +16,20 @@ raise Formtastic::UnknownInputError, "Unable to find input class #{input_class_name}"
end
end
+
+ def input_class_by_trying(as)
+ begin
+ custom_input_class_name(as).constantize
+ rescue NameError
+ begin
+ standard_input_class_name(as).constantize
+ rescue
+ standard_formtastic_class_name(as).constantize
+ end
+ end
+ rescue NameError
+ raise Formtastic::UnknownInputError, "Unable to find input class for #{as}"
+ end
def standard_input_class_name(as)
"FormtasticBootstrap::Inputs::#{as.to_s.camelize}Input"
|
Support for non standard input classes
Avoids the exception when using an input class not defined in FormtasticBootstrap namespace.
For example, this error raises when using activeadmin-select2 gem with FormtasticBootstrap form builder.
|
diff --git a/lib/luban/deployment/packages/monit/installer.rb b/lib/luban/deployment/packages/monit/installer.rb
index abc1234..def5678 100644
--- a/lib/luban/deployment/packages/monit/installer.rb
+++ b/lib/luban/deployment/packages/monit/installer.rb
@@ -3,8 +3,6 @@ module Packages
class Monit
class Installer < Luban::Deployment::Service::Installer
- include Configurator::Paths
-
default_executable 'monit'
def source_repo
@@ -24,6 +22,15 @@ def with_openssl_dir(dir)
@configure_opts << "--with-ssl-static=#{dir}"
end
+
+ protected
+
+ def install!
+ super
+ # Symlink 'etc' to the profile path
+ # 'etc' is the default search path for control file
+ ln(profile_path, install_path.join('etc'))
+ end
end
end
end
|
Use "etc" as the default search path for control file
|
diff --git a/app/models/tree_node.rb b/app/models/tree_node.rb
index abc1234..def5678 100644
--- a/app/models/tree_node.rb
+++ b/app/models/tree_node.rb
@@ -1,7 +1,7 @@ class TreeNode
attr_reader :taxon, :children
- delegate :title, :base_path, :content_id, :parent_taxons, :parent_taxons=, to: :taxon
attr_accessor :parent_node
+ delegate :title, :base_path, :content_id, to: :taxon
delegate :map, :each, to: :tree
def initialize(title:, content_id:)
|
Remove unused methods in TreeNode
|
diff --git a/scaffolding_extensions.gemspec b/scaffolding_extensions.gemspec
index abc1234..def5678 100644
--- a/scaffolding_extensions.gemspec
+++ b/scaffolding_extensions.gemspec
@@ -1,6 +1,6 @@ spec = Gem::Specification.new do |s|
s.name = "scaffolding_extensions"
- s.version = '1.1.5'
+ s.version = '1.1.6'
s.author = "Jeremy Evans"
s.email = "code@jeremyevans.net"
s.platform = Gem::Platform::RUBY
@@ -8,7 +8,7 @@ s.files = %w'LICENSE README' + Dir['{lib,doc,contrib,scaffolds,test}/**/*']
s.require_paths = ["lib"]
s.has_rdoc = true
- s.rdoc_options = %w'--inline-source --line-numbers README lib'
+ s.rdoc_options = %w'--inline-source --line-numbers README LICENSE lib' + Dir['doc/*.txt']
s.rubyforge_project = 'scaffolding-ext'
s.homepage = 'http://scaffolding-ext.rubyforge.org/'
end
|
Add LICENSE and documenation files to the gem RDoc; Bump version to 1.1.6
|
diff --git a/etc/deploy/tasks/doctrine.rake b/etc/deploy/tasks/doctrine.rake
index abc1234..def5678 100644
--- a/etc/deploy/tasks/doctrine.rake
+++ b/etc/deploy/tasks/doctrine.rake
@@ -26,7 +26,7 @@ desc "Execute doctrine migrations"
task :migrate do
on roles(:db) do
- symfony_console "doctrine:migrations:migrate", "--no-interaction"
+ symfony_console "doctrine:migrations:migrate", "--allow-no-migration --no-interaction"
end
end
end
|
Fix deployment config when there are no migrations
|
diff --git a/revenant.gemspec b/revenant.gemspec
index abc1234..def5678 100644
--- a/revenant.gemspec
+++ b/revenant.gemspec
@@ -2,19 +2,16 @@
Gem::Specification.new do |s|
s.name = %q{revenant}
- s.version = "0.0.2"
+ s.version = "0.0.3"
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.7")
s.authors = ["Wilson Bilkovich"]
- s.date = %q{2010-06-06}
+ s.date = %q{2014-04-20}
s.email = %q{wilson@supremetyrant.com}
- s.files = Dir['lib/**/*.rb']
+ s.files = Dir['{LICENSE,README}'] + Dir['lib/**/*.rb'] + Dir['example/*']
s.has_rdoc = false
s.homepage = %q{http://github.com/wilson/revenant}
s.require_paths = ["lib"]
- s.rubygems_version = %q{1.3.7}
s.summary = %q{Distributed daemons that just will not die.}
s.description = "A framework for building reliable distributed workers."
-
- s.specification_version = 2
end
|
Add missing LICENSE, README, and example files to gemspec
|
diff --git a/csv_shaper.gemspec b/csv_shaper.gemspec
index abc1234..def5678 100644
--- a/csv_shaper.gemspec
+++ b/csv_shaper.gemspec
@@ -13,6 +13,8 @@ comes with support for it's own template handling.
}
+ gem.licenses = ['MIT']
+
gem.homepage = "http://github.com/paulspringett/csv_shaper"
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
Add MIT license to gemspec
|
diff --git a/spec/factories.rb b/spec/factories.rb
index abc1234..def5678 100644
--- a/spec/factories.rb
+++ b/spec/factories.rb
@@ -8,6 +8,7 @@
factory :entry do
user
+ date Time.zone.now
body 'Entry body'
end
|
Add date to Entry factory
|
diff --git a/chrono_model.gemspec b/chrono_model.gemspec
index abc1234..def5678 100644
--- a/chrono_model.gemspec
+++ b/chrono_model.gemspec
@@ -16,4 +16,5 @@ gem.version = ChronoModel::VERSION
gem.add_dependency "activerecord", "~> 3.0"
+ gem.add_dependency "pg"
end
|
Add the PG driver as an explicit dependency
|
diff --git a/devise-dummy_authenticable.gemspec b/devise-dummy_authenticable.gemspec
index abc1234..def5678 100644
--- a/devise-dummy_authenticable.gemspec
+++ b/devise-dummy_authenticable.gemspec
@@ -18,6 +18,8 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = %w(lib)
+ spec.add_dependency 'devise', '>= 2.1.0'
+
spec.add_development_dependency 'bundler', '~> 1.3'
spec.add_development_dependency 'rake'
end
|
Add Devise as a dependency
|
diff --git a/NSData+TDTImageMIMEDetection.podspec b/NSData+TDTImageMIMEDetection.podspec
index abc1234..def5678 100644
--- a/NSData+TDTImageMIMEDetection.podspec
+++ b/NSData+TDTImageMIMEDetection.podspec
@@ -3,7 +3,7 @@ s.version = "0.1.0"
s.summary = "Category on NSData to check if it represents PNG or JPEG."
s.homepage = "https://github.com/talk-to/NSData-ImageMIMEDetection"
- s.license = { :type => 'BSD', :text => 'Property of Talk.to FZC' }
+ s.license = { :type => 'BSD' }
s.author = { 'Ayush Goel' => 'ayush.g@directi.com' }
s.source = { :git => "git@github.com:talk-to/NSData-ImageMIMEDetection.git", :tag => '#{s.version}' }
|
Remove text for license from podspec
|
diff --git a/lib/sequel/extensions/seek_pagination.rb b/lib/sequel/extensions/seek_pagination.rb
index abc1234..def5678 100644
--- a/lib/sequel/extensions/seek_pagination.rb
+++ b/lib/sequel/extensions/seek_pagination.rb
@@ -2,35 +2,33 @@ require 'sequel/extensions/seek_pagination/version'
module Sequel
- class Dataset
- module SeekPagination
- def seek_paginate(count, after: nil)
- ds = limit(count)
+ module SeekPagination
+ def seek_paginate(count, after: nil)
+ ds = limit(count)
- if after
- column, direction = parse_column_and_direction(opts[:order].first)
+ if after
+ column, direction = parse_column_and_direction(opts[:order].first)
- case direction
- when :asc then ds.where{|r| r.>(r.__send__(column), after)}
- when :desc then ds.where{|r| r.<(r.__send__(column), after)}
- else raise "Bad direction!: #{direction.inspect}"
- end
- else
- ds
+ case direction
+ when :asc then ds.where{|r| r.>(r.__send__(column), after)}
+ when :desc then ds.where{|r| r.<(r.__send__(column), after)}
+ else raise "Bad direction!: #{direction.inspect}"
end
- end
-
- private
-
- def parse_column_and_direction(order)
- case order
- when Symbol then [order, :asc]
- when Sequel::SQL::OrderedExpression then [order.expression, order.descending ? :desc : :asc]
- else raise "Unrecognized order!: #{order.inspect}"
- end
+ else
+ ds
end
end
- register_extension(:seek_pagination, SeekPagination)
+ private
+
+ def parse_column_and_direction(order)
+ case order
+ when Symbol then [order, :asc]
+ when Sequel::SQL::OrderedExpression then [order.expression, order.descending ? :desc : :asc]
+ else raise "Unrecognized order!: #{order.inspect}"
+ end
+ end
end
+
+ Dataset.register_extension(:seek_pagination, SeekPagination)
end
|
Move SeekPagination out of Sequel::Dataset to Sequel, to keep it simple.
|
diff --git a/lib/sparkle_formation/resources/azure.rb b/lib/sparkle_formation/resources/azure.rb
index abc1234..def5678 100644
--- a/lib/sparkle_formation/resources/azure.rb
+++ b/lib/sparkle_formation/resources/azure.rb
@@ -9,7 +9,7 @@ class Azure < Resources
# Characters to be removed from supplied key on matching
- RESOURCE_TYPE_TR = '.'
+ RESOURCE_TYPE_TR = '_'
# String to split for resource namespacing
RESOURCE_TYPE_NAMESPACE_SPLITTER = '/'
|
Update type character replacement to be regular underscore
|
diff --git a/lib/tasks/taxonomy/fixup_taxon_urls.rake b/lib/tasks/taxonomy/fixup_taxon_urls.rake
index abc1234..def5678 100644
--- a/lib/tasks/taxonomy/fixup_taxon_urls.rake
+++ b/lib/tasks/taxonomy/fixup_taxon_urls.rake
@@ -0,0 +1,39 @@+namespace :taxonomy do
+ desc "fixup taxon URLs"
+ task fixup_taxon_urls: :environment do
+ total = RemoteTaxons.new.search.search_response["total"]
+ taxon_ids = RemoteTaxons.new.search(per_page: total).taxons.map(&:content_id)
+
+ errors = []
+
+ taxon_ids.each do |taxon_id|
+ taxon = Taxonomy::BuildTaxon.call(content_id: taxon_id)
+
+ if !taxon.path_prefix.blank? && !taxon.path_slug.blank?
+ if taxon.path_prefix != '/alpha-taxonomy'
+ puts "Skipping #{taxon.title} with path #{taxon.path_prefix + taxon.path_slug}"
+ next
+ end
+ end
+
+ puts "Updating #{taxon.title}'s base path"
+ taxon.base_path = Theme::EDUCATION_THEME_BASE_PATH + '/' + taxon.title.parameterize
+ begin
+ Taxonomy::PublishTaxon.call(taxon: taxon)
+ rescue Taxonomy::PublishTaxon::InvalidTaxonError => e
+ puts "#{taxon.title} is invalid"
+ puts e.cause
+ errors.push(taxon_base_path: taxon.base_path, taxon_id: taxon.content_id, e: e)
+ end
+ end
+
+ puts "Finished with #{errors.length} errors"
+
+ unless errors.empty?
+ puts "The following taxons could not be updated:"
+ errors.each do |error|
+ puts "#{error[:taxon_id]} #{error[:taxon_base_path]}"
+ end
+ end
+ end
+end
|
Add rake task to update taxon URLs
|
diff --git a/kapachow_yo.rb b/kapachow_yo.rb
index abc1234..def5678 100644
--- a/kapachow_yo.rb
+++ b/kapachow_yo.rb
@@ -18,6 +18,7 @@ fail unless CONFIG
@gmail = nil
@debug = CONFIG['debug_logging']
+ @yo_attempts = 0
Yo.api_key = CONFIG['yo_api_key']
check
end
@@ -38,14 +39,21 @@ end
def send_yo
+ puts "Yo attempts so far: #{@yo_attempts}" if @debug
+ return if @yo_attempts > 5
+
link = CONFIG['yo_link']
begin
if link
+ puts "Sending Yo with link #{link}" if @debug
Yo.all!({ :link => link })
else
+ puts "Sending Yo with no link" if @debug
Yo.all!
end
rescue YoRateLimitExceeded
+ puts "Too many Yos sent. Waiting a minute..." if @debug
+ @yo_attempts += 1
sleep(60)
send_yo
end
|
Debug logging and multiple Yo attempts if sending fails.
|
diff --git a/minimal-mistakes-jekyll.gemspec b/minimal-mistakes-jekyll.gemspec
index abc1234..def5678 100644
--- a/minimal-mistakes-jekyll.gemspec
+++ b/minimal-mistakes-jekyll.gemspec
@@ -15,14 +15,13 @@ f.match(%r{^(assets|_(includes|layouts|sass)/|(LICENSE|README|CHANGELOG)((\.(txt|md|markdown)|$)))}i)
end
- spec.add_dependency "jekyll", "~> 3.3"
-
- spec.add_development_dependency "bundler", "~> 1.12"
- spec.add_development_dependency "rake", "~> 10.0"
-
+ spec.add_runtime_dependency "jekyll", "~> 3.3"
spec.add_runtime_dependency "jekyll-paginate", "~> 1.1"
spec.add_runtime_dependency "jekyll-sitemap", "~> 0.12"
spec.add_runtime_dependency "jekyll-gist", "~> 1.4"
spec.add_runtime_dependency "jekyll-feed", "~> 0.8"
spec.add_runtime_dependency "jemoji", "~> 0.7"
+
+ spec.add_development_dependency "bundler", "~> 1.12"
+ spec.add_development_dependency "rake", "~> 10.0"
end
|
Change Jekyll to a runtime dependency
|
diff --git a/spec/centos/services_spec.rb b/spec/centos/services_spec.rb
index abc1234..def5678 100644
--- a/spec/centos/services_spec.rb
+++ b/spec/centos/services_spec.rb
@@ -19,3 +19,11 @@ describe service('sshd') do
it { should be_enabled }
end
+
+describe service('ntpd') do
+ it { should be_enabled }
+end
+
+describe service('ntpdate') do
+ it { should be_enabled }
+end
|
Make sure ntpd and ntpdate are enabled
|
diff --git a/spec/classes/mod/dir_spec.rb b/spec/classes/mod/dir_spec.rb
index abc1234..def5678 100644
--- a/spec/classes/mod/dir_spec.rb
+++ b/spec/classes/mod/dir_spec.rb
@@ -0,0 +1,27 @@+describe 'apache::mod::dir', :type => :class do
+ let :pre_condition do
+ 'include apache'
+ end
+ context "on a Debian OS" do
+ let :facts do
+ {
+ :osfamily => 'Debian',
+ :operatingsystemrelease => '6',
+ :concat_basedir => '/dne',
+ }
+ end
+ it { should include_class("apache::params") }
+ it { should contain_apache__mod('dir') }
+ end
+ context "on a RedHat OS" do
+ let :facts do
+ {
+ :osfamily => 'RedHat',
+ :operatingsystemrelease => '6',
+ :concat_basedir => '/dne',
+ }
+ end
+ it { should include_class("apache::params") }
+ it { should contain_apache__mod('dir') }
+ end
+end
|
Add basic spec test for mod_dir
Note: No package test as it seems mod_dir is distributed _with_ the Apache package.
|
diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb
index abc1234..def5678 100644
--- a/spec/spec_helper_acceptance.rb
+++ b/spec/spec_helper_acceptance.rb
@@ -1,10 +1,16 @@ require 'beaker-rspec'
-hosts.each do |host|
- # Install Puppet
- install_package host, 'rubygems'
- on host, 'gem install puppet --no-ri --no-rdoc'
- on host, "mkdir -p #{host['distmoduledir']}"
+unless ENV['RS_PROVISION'] == 'no'
+ hosts.each do |host|
+ # Install Puppet
+ if host.is_pe?
+ install_pe
+ else
+ install_package host, 'rubygems'
+ on host, 'gem install puppet --no-ri --no-rdoc'
+ on host, "mkdir -p #{host['distmoduledir']}"
+ end
+ end
end
RSpec.configure do |c|
|
Make sure we handle PE properly.
|
diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb
index abc1234..def5678 100644
--- a/spec/spec_helper_acceptance.rb
+++ b/spec/spec_helper_acceptance.rb
@@ -1,11 +1,12 @@+# This file is completely managed via modulesync
require 'voxpupuli/acceptance/spec_helper_acceptance'
-configure_beaker do |host|
- if fact_on(host, 'os.name') == 'CentOS'
- install_module_from_forge('puppetlabs-apt', '>= 4.1.0 < 8.0.0')
- install_module_from_forge('puppetlabs-java', '>= 2.1.0 < 7.0.0')
- install_module_from_forge('puppetlabs-java_ks', '>= 1.6.0 < 4.0.0')
- install_module_from_forge('puppetlabs-mysql', '>= 4.0.1 < 11.0.0')
- install_module_from_forge('puppetlabs-postgresql', '>= 5.1.0 < 7.0.0')
- end
+configure_beaker do |_host|
+ install_module_from_forge('puppetlabs-apt', '>= 4.1.0 < 8.0.0') if fact('os.family') == 'Debian'
+ install_module_from_forge('puppetlabs-java', '>= 2.1.0 < 7.0.0')
+ install_module_from_forge('puppetlabs-java_ks', '>= 1.6.0 < 4.0.0')
+ install_module_from_forge('puppetlabs-mysql', '>= 4.0.1 < 11.0.0')
+ install_module_from_forge('puppetlabs-postgresql', '>= 5.1.0 < 7.0.0')
end
+
+Dir['./spec/support/acceptance/**/*.rb'].sort.each { |f| require f }
|
Fix module dependencies for acceptance tests
|
diff --git a/performance/rubinius.rb b/performance/rubinius.rb
index abc1234..def5678 100644
--- a/performance/rubinius.rb
+++ b/performance/rubinius.rb
@@ -18,4 +18,5 @@ end
profile { 10000.times { Phony.normalize "+81-3-9999-9999" } }
-profile { 10000.times { Phony.format "81399999999" } }+profile { 10000.times { Phony.format "81399999999" } }
+profile { 10000.times { Phony.plausible? "+81-3-9999-9999" } }
|
Add plausible? to performance script.
|
diff --git a/lib/cli.rb b/lib/cli.rb
index abc1234..def5678 100644
--- a/lib/cli.rb
+++ b/lib/cli.rb
@@ -15,7 +15,7 @@ def ask(question, default=nil, valid_response=nil, invalid_message=nil)
loop do
print "#{question}"
- print "[#{default}]" if default
+ print " [#{default}]" if default
print ": "
answer = STDIN.gets.chomp
answer = default if default && answer.empty?
|
Add space between question and default in ask
|
diff --git a/Casks/intellij-idea-ce.rb b/Casks/intellij-idea-ce.rb
index abc1234..def5678 100644
--- a/Casks/intellij-idea-ce.rb
+++ b/Casks/intellij-idea-ce.rb
@@ -1,6 +1,6 @@ cask :v1 => 'intellij-idea-ce' do
- version '15.0.1'
- sha256 '70715153d78808493bd6f3da839b2f6872e4f94c423ca1f0d9fc848503a7e3ff'
+ version '15.0.2'
+ sha256 'f50d75277851db6e6a349149ea5d3a696f1232501a9b4a846ba68fed2284cc41'
url "https://download.jetbrains.com/idea/ideaIC-#{version}-custom-jdk-bundled.dmg"
name 'IntelliJ IDEA Community Edition'
|
Update IntelliJ Idea CE to v15.0.2
|
diff --git a/contrib/requirements-warning.rb b/contrib/requirements-warning.rb
index abc1234..def5678 100644
--- a/contrib/requirements-warning.rb
+++ b/contrib/requirements-warning.rb
@@ -1,24 +1,19 @@-DEBUG = false
-
# Get the commits before the merge
# ex. heads = ["<latest commit of master>", "<previous commit of master>", ...]
heads = `git reflog -n 2 | awk '{ print $1 }'`.split
# Make sure our revision history has at least 2 entries
if heads.length < 2
- exit 0
+ exit 0
end
-files = `git diff --name-only #{heads[1]} #{heads[0]} | grep requirements.txt`
-diffFiles = `git diff --name-only #{heads[1]} #{heads[0]} | grep requirements.txt | tr "\n" " "`
-if diffFiles then
+# Get all files that changed
+files = `git diff --name-only #{heads[1]} #{heads[0]}`
+
+# If (dev_)requrements.txt changed, alert the user!
+if /requirements.txt/ =~ files
default = "\e[0m"
- red = "\e[31m"
+ red = "\e[31m"
puts "[#{red}requirements-warning.rb hook#{default}]: New python requirements."
- puts "pip install #{diffFiles}"
-
- if DEBUG then
- # Print the diff with 0 lines of context
- puts `git diff -U0 #{heads[1]} #{heads[0]} -- #{diffFiles}`
- end
+ puts "pip install *requirements.txt"
end
|
Fix falsy test in pip requirements hook
|
diff --git a/cf-cli.rb b/cf-cli.rb
index abc1234..def5678 100644
--- a/cf-cli.rb
+++ b/cf-cli.rb
@@ -5,7 +5,7 @@ head 'https://cli.run.pivotal.io/edge?arch=macosx64&source=homebrew'
url 'https://cli.run.pivotal.io/stable?release=macosx64-binary&version=6.18.0&source=homebrew'
version '6.18.0'
- sha256 '9a60d7542a7cbc46b31aa82fea91b7fc06fbdbecd09e39a31ce01c44cd7065c5'
+ sha256 '0fc455d33b990e8c463e77f6a3218e7d8df1d54a851276985318254dcfb3576f'
depends_on :arch => :x86_64
|
Update the sha256 of 6.18.0
[fixes #119335073]
|
diff --git a/core/app/models/spree/promotion/rules/user.rb b/core/app/models/spree/promotion/rules/user.rb
index abc1234..def5678 100644
--- a/core/app/models/spree/promotion/rules/user.rb
+++ b/core/app/models/spree/promotion/rules/user.rb
@@ -6,7 +6,7 @@
has_many :promotion_rule_users, class_name: 'Spree::PromotionRuleUser',
foreign_key: :promotion_rule_id
- has_many :users, through: :promotion_rule_users, class_name: ::Spree.user_class.to_s
+ has_many :users, through: :promotion_rule_users, class_name: "::#{Spree.user_class.to_s}"
def applicable?(promotable)
promotable.is_a?(Spree::Order)
|
Fix wrong association class bug in User PromotionRule
We have a custom User class in our app. It is unsurprisingly called "User".
The `Spree::Promotion::Rules::User` class has an association to `:users` set,
where the class name is bound to be `::Spree.user_class`. In our app, this evaluates to
`User`. Since the namespacing `::` were missing, the rule would return a collection
of instances of `Spree::Promotion::Rules::User` instead of actual users.
This concern has been addressed in the `belongs_to` association in the same file (forcing
the correct namespace by interpolating `::` in front of whatever is returned by `Spree.user_class`).
I use the same technique also for the `has_many` association.
|
diff --git a/spec/unit/veritas/tuple/class_methods/coerce_spec.rb b/spec/unit/veritas/tuple/class_methods/coerce_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/veritas/tuple/class_methods/coerce_spec.rb
+++ b/spec/unit/veritas/tuple/class_methods/coerce_spec.rb
@@ -20,7 +20,7 @@
it { should be_instance_of(object) }
- it { should == tuple }
+ it { should eql(tuple) }
end
context 'when the argument is not a Tuple and does not respond to #to_ary' do
|
Change spec to use a stronger matcher
|
diff --git a/db/migrate/20141231192544_allow_null_for_project_id_on_transactions.rb b/db/migrate/20141231192544_allow_null_for_project_id_on_transactions.rb
index abc1234..def5678 100644
--- a/db/migrate/20141231192544_allow_null_for_project_id_on_transactions.rb
+++ b/db/migrate/20141231192544_allow_null_for_project_id_on_transactions.rb
@@ -0,0 +1,9 @@+class AllowNullForProjectIdOnTransactions < ActiveRecord::Migration
+ def up
+ change_column_null(:giro_checkout_transactions, :project_id, true)
+ end
+
+ def down
+ change_column_null(:giro_checkout_transactions, :project_id, false)
+ end
+end
|
Make project_id nullable in database fpr transactions
|
diff --git a/db/migrate/20170402231018_remove_index_for_users_current_sign_in_at.rb b/db/migrate/20170402231018_remove_index_for_users_current_sign_in_at.rb
index abc1234..def5678 100644
--- a/db/migrate/20170402231018_remove_index_for_users_current_sign_in_at.rb
+++ b/db/migrate/20170402231018_remove_index_for_users_current_sign_in_at.rb
@@ -1,6 +1,7 @@ # See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
+# rubocop:disable RemoveIndex
class RemoveIndexForUsersCurrentSignInAt < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
|
Fix RuboCop for removing index
|
diff --git a/Library/Formula/gqview.rb b/Library/Formula/gqview.rb
index abc1234..def5678 100644
--- a/Library/Formula/gqview.rb
+++ b/Library/Formula/gqview.rb
@@ -0,0 +1,14 @@+require 'formula'
+
+class Gqview <Formula
+ url 'http://downloads.sourceforge.net/project/gqview/gqview/2.0.4/gqview-2.0.4.tar.gz'
+ homepage 'http://gqview.sourceforge.net'
+ md5 '7196deab04db94cec2167637cddc02f9'
+
+ depends_on 'gtk+'
+
+ def install
+ system "./configure", "--disable-debug", "--disable-dependency-tracking", "--prefix=#{prefix}", "--mandir=#{man}"
+ system "make install"
+ end
+end
|
Add formula for GQview, a gtk-based image browser.
Signed-off-by: Adam Vandenberg <34c2b6407fd5a10249a15d699d40f9ed1782e98c@gmail.com>
|
diff --git a/Library/Formula/o-make.rb b/Library/Formula/o-make.rb
index abc1234..def5678 100644
--- a/Library/Formula/o-make.rb
+++ b/Library/Formula/o-make.rb
@@ -31,3 +31,16 @@ module Exec =
struct
(*
+diff --git a/OMakefile b/OMakefile
+index 9b77a25..1d61d70 100644
+--- a/OMakefile
++++ b/OMakefile
+@@ -57,7 +57,7 @@ if $(not $(defined CAMLLIB))
+ #
+ # OCaml options
+ #
+-OCAMLFLAGS[] += -w Ae$(if $(OCAML_ACCEPTS_Z_WARNING), z)
++OCAMLFLAGS[] += -w Ae$(if $(OCAML_ACCEPTS_Z_WARNING), z)-9-27..29
+ if $(THREADS_ENABLED)
+ OCAMLFLAGS += -thread
+ export
|
Patch OMake to build under OCaml 3.12
Signed-off-by: Adam Vandenberg <34c2b6407fd5a10249a15d699d40f9ed1782e98c@gmail.com>
|
diff --git a/app/controllers/api/drops_controller.rb b/app/controllers/api/drops_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/drops_controller.rb
+++ b/app/controllers/api/drops_controller.rb
@@ -3,6 +3,9 @@
def index
if params[:longitude] && params[:latitude]
+ places_within_radius = Place.near([52.5380655, 13.3939808], 1, :units => :km)
+ @drops = Drop.where(place_id: places_within_radius)
+ #ids = Ids.all
#give back drops within radius 1 km: Place.near([40.71, -100.23], 20, :units => :km)
else
@drops = Drop.all
|
Add active record queries to retrieve drops within radius
|
diff --git a/app/helpers/multi_year_charts_helper.rb b/app/helpers/multi_year_charts_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/multi_year_charts_helper.rb
+++ b/app/helpers/multi_year_charts_helper.rb
@@ -11,11 +11,6 @@
def can_use_as_myc_scenario?(saved_scenario)
scenario = saved_scenario.scenario
-
- scenario && (
- scenario.loadable? &&
- scenario.end_year == 2050 &&
- scenario.area_code == 'nl'
- )
+ scenario && (scenario.loadable? && scenario.end_year == 2050)
end
end
|
Allow MYC to use scenarios from any region
Ref #3081
|
diff --git a/lib/after_do/logging/aspect.rb b/lib/after_do/logging/aspect.rb
index abc1234..def5678 100644
--- a/lib/after_do/logging/aspect.rb
+++ b/lib/after_do/logging/aspect.rb
@@ -35,7 +35,7 @@ end
def id(object)
- "[#{id}]" if object.respond_to?(:id)
+ "[#{object.id}]" if object.respond_to?(:id)
end
end
end
|
Fix object id message on log
|
diff --git a/app/representers/service_representer.rb b/app/representers/service_representer.rb
index abc1234..def5678 100644
--- a/app/representers/service_representer.rb
+++ b/app/representers/service_representer.rb
@@ -19,5 +19,6 @@ property :short_desc
property :urls
property :wait
+ property :updated_at
end
|
Add updated_at field to service representer
|
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/groups_controller.rb
+++ b/app/controllers/groups_controller.rb
@@ -1,5 +1,10 @@ class GroupsController < ApplicationController
def inquire
+ end
+
+ def reassign
+ current_user.update(group_id: nil)
+ redirect_to groups_assign_path
end
def assign
|
Add a reassign route in the Group Controller.
This route gives the user the ability to re-set their group to a nil
status. The user will then be redirected to a form in which they can
input their new neighborhood.
|
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -0,0 +1,40 @@+class IssuesController < ApplicationController
+
+ def index
+ @issues_report = Issue.aggregate_issues
+ @unresolved_issues = Issue.unresolved
+
+ render json: { issues_report: @issues_report, unresolved_issues: @unresolved_issues }
+ end
+
+ def new
+ @issue_categories = ['Incorrect phone number', 'Office location moved', 'Trouble downloading v-card', 'Incorrect Email']
+ @issue = Issue.new
+
+ render json: { issue_categories: @issue_categories, issue: @issue }
+ end
+
+ def create
+ @issue = Issue.create(issue_params)
+ if @issue.save
+ render json: { status: :created }
+ else
+ render json: { status: :unprocessable_entity }
+ end
+ end
+
+ def update
+ issue = Issue.find_by(id: params[:id])
+ if issue.update_attributes(resolved: true)
+ render json: { status: :reset_content }
+ else
+ render json: { status: :unprocessable_entity }
+ end
+ end
+
+ private
+
+ def issue_params
+ params.require(:issue).permit(:issue_type, :resolved, :office_location_id)
+ end
+end
|
Add methods to create, update, and view summary of issues pertaining to a congressional office.
|
diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/topics_controller.rb
+++ b/app/controllers/topics_controller.rb
@@ -7,7 +7,12 @@
def show
@topic = Topic.find(params[:id])
- render json: @topic.responses_json
+ case @topic.id
+ when 1
+ render json: @topic.responses_json_obama_approval
+ when 2
+ render json: @topic.responses_2016_gop
+ end
end
end
|
Update topics controller to return the proper JSON response depending on topic
|
diff --git a/app/models/miq_web_service_worker.rb b/app/models/miq_web_service_worker.rb
index abc1234..def5678 100644
--- a/app/models/miq_web_service_worker.rb
+++ b/app/models/miq_web_service_worker.rb
@@ -27,4 +27,15 @@ super
Api::ApiConfig.collections.each { |_k, v| v.klass.try(:constantize).try(:descendants) }
end
+
+ def container_port
+ 3001
+ end
+
+ def configure_service_worker_deployment(definition)
+ super
+
+ definition[:spec][:template][:spec][:containers].first[:volumeMounts] << {:name => "api-httpd-config", :mountPath => "/etc/httpd/conf.d"}
+ definition[:spec][:template][:spec][:volumes] << {:name => "api-httpd-config", :configMap => {:name => "api-httpd-configs", :defaultMode => 420}}
+ end
end
|
Enable httpd in the API pod
- Add volume mounts for httpd configuration
- Change the Rails port to 3001
|
diff --git a/lib/guard/rspectacle/runner.rb b/lib/guard/rspectacle/runner.rb
index abc1234..def5678 100644
--- a/lib/guard/rspectacle/runner.rb
+++ b/lib/guard/rspectacle/runner.rb
@@ -1,11 +1,17 @@ # coding: utf-8
+require 'guard/rspectacle/notifier'
+
require 'rspec/core/runner'
+require 'rspec/core/command_line'
+require 'rspec/core/world'
+require 'rspec/core/configuration'
+require 'rspec/core/configuration_options'
+
+require 'stringio'
module Guard
class RSpectacle
-
- autoload :Formatter, 'guard/rspectacle/formatter'
# The RSpectacle runner handles the execution of the rspec test.
#
@@ -22,7 +28,18 @@
Formatter.info "Run #{ paths.join('') }"
- RSpec::Core::Runner.run(paths)
+ # RSpec hardcore reset
+ world = RSpec::Core::World.new
+ configuration = RSpec::Core::Configuration.new
+
+ RSpec.instance_variable_set :@world, world
+ RSpec.instance_variable_set :@configuration, configuration
+
+ #TODO: Add Formatter: configuration.add_formatter ::Guard::RSpectacle::Notifier
+
+ RSpec::Core::CommandLine.new(RSpec::Core::ConfigurationOptions.new(paths), configuration, world).run($stderr, $stdout)
+
+ #TODO: Get failed examples
rescue Exception => e
Formatter.error "Error while spec run: #{ e.message }"
|
Reset RSpec world and configuration.
|
diff --git a/lib/compare.rb b/lib/compare.rb
index abc1234..def5678 100644
--- a/lib/compare.rb
+++ b/lib/compare.rb
@@ -31,5 +31,7 @@ end
end
-evaluate_turn
-print_turn_result
+if __FILE__ == $0
+ evaluate_turn
+ print_turn_result
+end
|
Add evaluation code example for run in place
|
diff --git a/lib/lita/handlers/web_title.rb b/lib/lita/handlers/web_title.rb
index abc1234..def5678 100644
--- a/lib/lita/handlers/web_title.rb
+++ b/lib/lita/handlers/web_title.rb
@@ -12,7 +12,7 @@
def parse_uri_request(request)
requestUri = URI::extract(request.message.body, URI_PROTOCOLS).first
- if config.ignore_patterns
+ if config.ignore_patterns then
if config.ignore_patterns.kind_of?(String) then
Array(config.ignore_patterns)
end
|
Use consistent style for ifs
|
diff --git a/config/initializers/site_settings.rb b/config/initializers/site_settings.rb
index abc1234..def5678 100644
--- a/config/initializers/site_settings.rb
+++ b/config/initializers/site_settings.rb
@@ -1,3 +1,7 @@ RailsMultisite::ConnectionManagement.each_connection do
- SiteSetting.refresh!
+ begin
+ SiteSetting.refresh!
+ rescue ActiveRecord::StatementInvalid
+ # This will happen when migrating a new database
+ end
end
|
Fix error during db:migrate on a new database
|
diff --git a/duckduckgo.gemspec b/duckduckgo.gemspec
index abc1234..def5678 100644
--- a/duckduckgo.gemspec
+++ b/duckduckgo.gemspec
@@ -13,14 +13,6 @@ spec.homepage = 'https://github.com/stevesoltys/duckduckgo'
spec.license = 'MIT'
- # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
- # delete this section to allow pushing this gem to any host.
- if spec.respond_to?(:metadata)
- spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
- else
- raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
- end
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
Allow for pushing to RubyGems in gemspec
|
diff --git a/app/services/comment_look_manager.rb b/app/services/comment_look_manager.rb
index abc1234..def5678 100644
--- a/app/services/comment_look_manager.rb
+++ b/app/services/comment_look_manager.rb
@@ -1,5 +1,7 @@ class CommentLookManager
def self.comment_look(user, comment)
+ return unless user
+
participation = user.participations.find_by_task_id(comment.task_id)
if participation && comment.created_at >= participation.created_at
read_at = Time.now if comment.created_by?(user)
|
Return gracefully if no user.
We know this is going to happen when comment looks are serlialized
in the event stream.
|
diff --git a/app/serializers/api/admin/for_order_cycle/enterprise_serializer.rb b/app/serializers/api/admin/for_order_cycle/enterprise_serializer.rb
index abc1234..def5678 100644
--- a/app/serializers/api/admin/for_order_cycle/enterprise_serializer.rb
+++ b/app/serializers/api/admin/for_order_cycle/enterprise_serializer.rb
@@ -34,7 +34,7 @@ visible_for(order_cycle.coordinator).
select('DISTINCT spree_products.*')
end
- products_relation.order(:name)
+ products_relation
end
def products
|
Remove unnecessary order statement, the relation will only be used for counting products
|
diff --git a/cookbooks/vagrant/recipes/windows.rb b/cookbooks/vagrant/recipes/windows.rb
index abc1234..def5678 100644
--- a/cookbooks/vagrant/recipes/windows.rb
+++ b/cookbooks/vagrant/recipes/windows.rb
@@ -1,6 +1,5 @@ # Make the path Windows-style if we're on Windows
-package_name = node[:vagrant][:gem_name]
-package_name = package_name.gsub("/", "\\")
+package_name = node[:vagrant][:gem_path].gsub("/", "\\")
# Make the environment paths windows style as well
env_vars["GEM_HOME"] = env_vars["GEM_HOME"].gsub("/", "\\")
|
Windows: Use the new chef-built gem
|
diff --git a/lib/fauxhai.rb b/lib/fauxhai.rb
index abc1234..def5678 100644
--- a/lib/fauxhai.rb
+++ b/lib/fauxhai.rb
@@ -1,8 +1,8 @@ module Fauxhai
- require 'fauxhai/exception'
- require 'fauxhai/fetcher'
- require 'fauxhai/mocker'
- require 'fauxhai/version'
+ autoload :Exception, 'fauxhai/exception'
+ autoload :Fetcher, 'fauxhai/fetcher'
+ autoload :Mocker, 'fauxhai/mocker'
+ autoload :VERSION, 'fauxhai/version'
def self.root
@@root ||= File.expand_path('../../', __FILE__)
|
Switch these to autoloads to avoid loading net-ssh unless you actually use the Fetcher system.
|
diff --git a/railties/test/commands/dev_cache_test.rb b/railties/test/commands/dev_cache_test.rb
index abc1234..def5678 100644
--- a/railties/test/commands/dev_cache_test.rb
+++ b/railties/test/commands/dev_cache_test.rb
@@ -22,8 +22,8 @@
test 'dev:cache deletes file and outputs message' do
Dir.chdir(app_path) do
- output = `rails dev:cache`
- output = `rails dev:cache`
+ `rails dev:cache` # Create caching file.
+ output = `rails dev:cache` # Delete caching file.
assert_not File.exist?('tmp/caching-dev.txt')
assert_match(%r{Development mode is no longer being cached}, output)
end
|
Clarify the need to run command twice.
We had 2 pull requests erronously trying to remove the first command.
Add some comments for clarity.
|
diff --git a/config.rb b/config.rb
index abc1234..def5678 100644
--- a/config.rb
+++ b/config.rb
@@ -1,6 +1,5 @@ # Compass configuration, used by cartodb UI grunt task.
# Require any additional compass plugins here.
-
# Set this to the root of your project when deployed:
http_path = "/"
|
Revert "check that canceling still working"
This reverts commit cae99cbb58a1befb8729e8fd54d31c0593964f1d.
|
diff --git a/config.ru b/config.ru
index abc1234..def5678 100644
--- a/config.ru
+++ b/config.ru
@@ -2,6 +2,7 @@
configure do
set :auth_token, 'YOUR_AUTH_TOKEN'
+ set :default_dashboard, 'tv'
helpers do
def protected!
@@ -15,4 +16,4 @@ run Sinatra::Application.sprockets
end
-run Sinatra::Application+run Sinatra::Application
|
Set tv as default route.
|
diff --git a/config.ru b/config.ru
index abc1234..def5678 100644
--- a/config.ru
+++ b/config.ru
@@ -5,10 +5,14 @@
require "./lib/identity"
+# initialization/configuration
Airbrake.configure do |config|
config.api_key = Identity::Config.airbrake_api_key
end if Identity::Config.airbrake_api_key
Excon.defaults[:ssl_verify_peer] = Identity::Config.ssl_verify_peer?
+Rack::Instruments.configure do |config|
+ config.id_generator = -> { SecureRandom.uuid }
+end
Slim::Engine.set_default_options pretty: !Identity::Config.production?
run Identity::Main
|
Use UUIDs for request identifiers
|
diff --git a/config.ru b/config.ru
index abc1234..def5678 100644
--- a/config.ru
+++ b/config.ru
@@ -3,9 +3,9 @@ require ::File.expand_path('../config/environment', __FILE__)
run Prometheus20::Application
-#require 'unicorn/oob_gc'
-#
-#use Unicorn::OobGC, 10
+require 'unicorn/oob_gc'
+GC.disable # Don't run GC during requests
+use Unicorn::OobGC, 10
# Unicorn self-process killer
require 'unicorn/worker_killer'
|
Enable Out of band GC
|
diff --git a/lib/jpm/cli.rb b/lib/jpm/cli.rb
index abc1234..def5678 100644
--- a/lib/jpm/cli.rb
+++ b/lib/jpm/cli.rb
@@ -6,6 +6,11 @@
module JPM
class CLI < Thor
+ class_option :verbose, :type => :boolean,
+ :banner => 'Enable verbose output'
+ class_option :offline, :type => :boolean,
+ :banner => 'Use `jpm` in a fully offline mode'
+
desc 'list', "List the installed Jenkins plugins"
def list
if JPM.installed?
|
Add the verbose and offline CLI options for later
At some point I'll need to expose these down into the guts
|
diff --git a/lib/task.rb b/lib/task.rb
index abc1234..def5678 100644
--- a/lib/task.rb
+++ b/lib/task.rb
@@ -40,6 +40,8 @@ add_extra_tags_in_list(new_tag_names)
end
+ private
+
def remove_tags_not_in_list(new_tag_names)
tags.select do |tag|
!new_tag_names.include? tag.name
|
Add private scope to Task
|
diff --git a/app/controllers/api/srpms_controller.rb b/app/controllers/api/srpms_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/srpms_controller.rb
+++ b/app/controllers/api/srpms_controller.rb
@@ -17,7 +17,7 @@ end
parameter do
key :name, :branch_id
- key :in, :path
+ key :in, :query
key :description, 'Branch id. Default: Sisyphus branch id.'
key :type, :integer
key :format, :int64
|
Fix branch_id pass for srpms controller
|
diff --git a/app/controllers/questions_controller.rb b/app/controllers/questions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/questions_controller.rb
+++ b/app/controllers/questions_controller.rb
@@ -16,15 +16,15 @@ @question = Question.new(question_params)
if @question.save
- redirect_to @post, notice: 'Post was successfully created.'
+ redirect_to @question, notice: 'Post was successfully created.'
else
render :new, notice: 'Post failed to create, try again.'
end
end
def update
- if @question.update(post_params)
- redirect_to @post, notice: 'Post was successfully updated.'
+ if @question.update(question_params)
+ redirect_to @question, notice: 'Post was successfully updated.'
else
render :edit, notice: 'Post failed to update, try again.'
end
@@ -42,7 +42,7 @@ @question = Question.find(params[:id])
end
- def post_params
+ def question_params
params.require(:question).permit(:title,:caption,:image_path)
end
|
Fix Redirects And Names In Controller
|
diff --git a/db/migrate/20110715150711_add_profile_photo_remote_url_to_users.rb b/db/migrate/20110715150711_add_profile_photo_remote_url_to_users.rb
index abc1234..def5678 100644
--- a/db/migrate/20110715150711_add_profile_photo_remote_url_to_users.rb
+++ b/db/migrate/20110715150711_add_profile_photo_remote_url_to_users.rb
@@ -0,0 +1,9 @@+class AddProfilePhotoRemoteUrlToUsers < ActiveRecord::Migration
+ def self.up
+ add_column :users, :profile_photo_remote_url, :string
+ end
+
+ def self.down
+ remove_column :users, :profile_photo_remote_url
+ end
+end
|
Add field for remote url that profile image was sourced from
|
diff --git a/db/migrate/20140122205815_rename_issues_version_to_flag_version.rb b/db/migrate/20140122205815_rename_issues_version_to_flag_version.rb
index abc1234..def5678 100644
--- a/db/migrate/20140122205815_rename_issues_version_to_flag_version.rb
+++ b/db/migrate/20140122205815_rename_issues_version_to_flag_version.rb
@@ -0,0 +1,9 @@+class RenameIssuesVersionToFlagVersion < ActiveRecord::Migration
+ def up
+ rename_column :issues, :version, :flag_version
+ end
+
+ def down
+ rename_column :issues, :flag_version, :version
+ end
+end
|
Include migration for renaming Issues version column to flag_version
|
diff --git a/db/migrate/20180228092312_add_analytical_fields_journal_entries.rb b/db/migrate/20180228092312_add_analytical_fields_journal_entries.rb
index abc1234..def5678 100644
--- a/db/migrate/20180228092312_add_analytical_fields_journal_entries.rb
+++ b/db/migrate/20180228092312_add_analytical_fields_journal_entries.rb
@@ -0,0 +1,11 @@+class AddAnalyticalFieldsJournalEntries < ActiveRecord::Migration
+ def up
+ add_reference :journal_entry_items, :project_budget, index: true, foreign_key: true
+ add_column :journal_entry_items, :equipment_id, :integer
+ end
+
+ def down
+ remove_reference :journal_entry_items, :project_budget, index: true, foreign_key: true
+ remove_column :journal_entry_items, :equipment_id
+ end
+end
|
Add projects budget and equipments to journal_entry_items
|
diff --git a/app/helpers/blacklight_helper.rb b/app/helpers/blacklight_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/blacklight_helper.rb
+++ b/app/helpers/blacklight_helper.rb
@@ -31,4 +31,12 @@ has_user_authentication_provider? and current_or_guest_user.present?
end
+ protected
+
+ ##
+ # Context in which to evaluate blacklight configuration conditionals
+ def blacklight_configuration_context
+ @blacklight_configuration_context ||= Blacklight::Configuration::Context.new(self)
+ end
+
end
|
Fix blacklight helper error (cucumber not passing)
|
diff --git a/app/models/concerns/from_gtfs.rb b/app/models/concerns/from_gtfs.rb
index abc1234..def5678 100644
--- a/app/models/concerns/from_gtfs.rb
+++ b/app/models/concerns/from_gtfs.rb
@@ -2,6 +2,7 @@ extend ActiveSupport::Concern
included do
def self.from_gtfs(entity)
+ raise NotImplementedError
end
end
end
|
Mark as abstract method with NotImplementedError
|
diff --git a/app/controllers/shopping/api_controller.rb b/app/controllers/shopping/api_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/shopping/api_controller.rb
+++ b/app/controllers/shopping/api_controller.rb
@@ -1,14 +1,7 @@ module Shopping
class ApiController < ApplicationController
include JSONAPI::ActsAsResourceController
- protect_from_forgery with: :null_session
rescue_from Shopping::NotAuthorizedError, with: :reject_forbidden_request
-
- # before_action :verify_content_type_header
-
- # before_action :doorkeeper_authorize!
- # if this is inheriting from the host ApplicationController
- # does it have access to current user?
def reject_forbidden_request(e)
type = e.resource_klass.name.underscore.humanize(capitalize: false)
|
Remove CSRF check and comments
|
diff --git a/test/rails_translation_manager/validator_test.rb b/test/rails_translation_manager/validator_test.rb
index abc1234..def5678 100644
--- a/test/rails_translation_manager/validator_test.rb
+++ b/test/rails_translation_manager/validator_test.rb
@@ -0,0 +1,51 @@+# encoding: utf-8
+require 'test_helper'
+require 'rails_translation_manager/validator'
+require 'tmpdir'
+require 'fileutils'
+
+module RailsTranslationManager
+ class ValidatorTest < Minitest::Test
+ def setup
+ @translation_path = Dir.mktmpdir
+ @translation_validator = Validator.new(@translation_path)
+ end
+
+ def teardown
+ FileUtils.remove_entry_secure(@translation_path)
+ end
+
+ def create_translation_file(locale, content)
+ File.open(File.join(@translation_path, "#{locale}.yml"), "w") do |f|
+ f.write(content.lstrip)
+ end
+ end
+
+ test "can create a flattened list of substitutions" do
+ translation_file = YAML.load(%q{
+en:
+ view: View '%{title}'
+ test: foo
+})
+ expected = [Validator::TranslationEntry.new(%w{en view}, "View '%{title}'")]
+ assert_equal expected, @translation_validator.substitutions_in(translation_file)
+ end
+
+ test "detects extra substitution keys" do
+ create_translation_file("en", %q{
+en:
+ document:
+ view: View '%{title}'
+})
+ create_translation_file("sr", %q{
+sr:
+ document:
+ view: Pročitajte '%{naslov}'
+})
+ errors = Validator.new(@translation_path).check!
+
+ expected = %q{Key "sr.document.view": Extra substitutions: ["naslov"]. Missing substitutions: ["title"].}
+ assert_equal [expected], errors.map(&:to_s)
+ end
+ end
+end
|
Add unit test for validator
taken from the whitehall app
|
diff --git a/app/models/review_line.rb b/app/models/review_line.rb
index abc1234..def5678 100644
--- a/app/models/review_line.rb
+++ b/app/models/review_line.rb
@@ -24,4 +24,8 @@ comments
end
+ def title
+ self[:title]
+ end
+
end
|
Use proper titles in review lines
|
diff --git a/app/helpers/user_info_helper.rb b/app/helpers/user_info_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/user_info_helper.rb
+++ b/app/helpers/user_info_helper.rb
@@ -1,11 +1,36 @@ module UserInfoHelper
+ include PitchHelper
def inject_extra_user_props(user)
user_as_json = JSON.parse(user.to_json)
user_as_json["full_name"] = user["first_name"] + " " + user["last_name"]
- user_as_json["votes"] = JSON.parse(user.votes.to_json)
+ user_as_json["votes"] = JSON.parse(user.votes.to_json)
+
+ user_as_json["votes"].map! do |vote|
+ vote_obj = Vote.find(vote["id"])
+
+ if vote_obj.votable_type == "Pitch"
+ vote["votable_title"] = vote_obj.votable.title
+ else
+ vote["votable_title"] = vote_obj.votable.pitch.title
+ end
+
+ vote
+ end
+
+ user_as_json["pitches"] = JSON.parse(user.pitches.to_json)
+ user_as_json["pitches"].map! do |pitch|
+ pitch["vote_count"] = Pitch.find(pitch["id"]).votes.count
+ pitch
+ end
+ user_as_json["comments"] = JSON.parse(user.comments.to_json)
+ user_as_json["comments"].map! do |comment|
+ comment["vote_count"] = Comment.find(comment["id"]).votes.count
+ comment["pitch_title"] = Comment.find(comment["id"]).pitch.title
+ comment
+ end
user_as_json
end
|
Add more vote information to user json
|
diff --git a/app/jobs/ahoy/geocode_v2_job.rb b/app/jobs/ahoy/geocode_v2_job.rb
index abc1234..def5678 100644
--- a/app/jobs/ahoy/geocode_v2_job.rb
+++ b/app/jobs/ahoy/geocode_v2_job.rb
@@ -11,9 +11,9 @@ nil
end
- if location
+ if location && location.country.present?
data = {
- country: location.try(:country).presence,
+ country: location.country,
region: location.try(:state).presence,
city: location.try(:city).presence,
postal_code: location.try(:postal_code).presence,
|
Make sure country is present [skip ci]
|
diff --git a/lib/active_interaction/filters/hash_filter.rb b/lib/active_interaction/filters/hash_filter.rb
index abc1234..def5678 100644
--- a/lib/active_interaction/filters/hash_filter.rb
+++ b/lib/active_interaction/filters/hash_filter.rb
@@ -10,7 +10,7 @@ def cast(value)
case value
when Hash
- filters.reduce({}) do |h, f|
+ filters.reduce(@options.fetch(:strip, true) ? {} : value) do |h, f|
k = f.name
h[k] = f.clean(value[k])
h
|
Allow wildcard hashes with `strip: false`
|
diff --git a/lib/generators/mailboxer/install_generator.rb b/lib/generators/mailboxer/install_generator.rb
index abc1234..def5678 100644
--- a/lib/generators/mailboxer/install_generator.rb
+++ b/lib/generators/mailboxer/install_generator.rb
@@ -17,16 +17,19 @@ end
def copy_migrations
- migrations = [["20110511145103_create_mailboxer.rb","create_mailboxer.rb"],
- ["20110719110700_add_notified_object.rb","add_notified_object.rb"],
- ["20110912163911_add_notification_code.rb","add_notification_code.rb"],
- ["20111204163911_add_attachments.rb","add_attachments.rb"]]
- migrations.each do |migration|
- # begin
+ if Rails.version < "3.1"
+ migrations = [["20110511145103_create_mailboxer.rb","create_mailboxer.rb"],
+ ["20110719110700_add_notified_object.rb","add_notified_object.rb"],
+ ["20110912163911_add_notification_code.rb","add_notification_code.rb"],
+ ["20111204163911_add_attachments.rb","add_attachments.rb"]]
+ migrations.each do |migration|
migration_template "../../../../db/migrate/" + migration[0], "db/migrate/" + migration[1]
- # rescue
- # puts "Another migration is already named '" + migration + "'. Moving to next one."
- # end
+ end
+ else
+ require 'rake'
+ Rails.application.load_tasks
+ Rake::Task['railties:install:migrations'].reenable
+ Rake::Task['mailboxer_engine:install:migrations'].invoke
end
end
-end+end
|
Use rake migration generator in Rails > 3.0
|
diff --git a/lib/hamlit/block/script_compiler_extension.rb b/lib/hamlit/block/script_compiler_extension.rb
index abc1234..def5678 100644
--- a/lib/hamlit/block/script_compiler_extension.rb
+++ b/lib/hamlit/block/script_compiler_extension.rb
@@ -10,7 +10,7 @@ [:block, "#{var} = #{node.value[:text]}",
[:multi,
[:newline],
- [:capture, var, yield(node)],
+ [:capture, @identity.generate, yield(node)],
],
],
]
|
Use another local variable inside block
|
diff --git a/lib/rspec/support/spec/deprecation_helpers.rb b/lib/rspec/support/spec/deprecation_helpers.rb
index abc1234..def5678 100644
--- a/lib/rspec/support/spec/deprecation_helpers.rb
+++ b/lib/rspec/support/spec/deprecation_helpers.rb
@@ -1,7 +1,8 @@ module RSpecHelpers
- def expect_deprecation_with_call_site(file, line)
+ def expect_deprecation_with_call_site(file, line, snippet=//)
expect(RSpec.configuration.reporter).to receive(:deprecation) do |options|
expect(options[:call_site]).to include([file, line].join(':'))
+ expect(options[:deprecated]).to match(snippet)
end
end
|
Allow `expect_deprecation_with_call_site` to take a snippet as well.
|
diff --git a/spec/models/alchemy/essence_file_spec.rb b/spec/models/alchemy/essence_file_spec.rb
index abc1234..def5678 100644
--- a/spec/models/alchemy/essence_file_spec.rb
+++ b/spec/models/alchemy/essence_file_spec.rb
@@ -2,7 +2,7 @@
module Alchemy
describe EssenceFile do
- let(:attachment) { build_stubbed(:alchemy_attachment) }
+ let(:attachment) { create(:alchemy_attachment) }
let(:essence) { EssenceFile.new(attachment: attachment) }
it_behaves_like "an essence" do
|
Create instead attachment in essence file spec
Only stubbing it does not work because in the shared example we access the database.
Factory Girl 4.8.0 complained about and was totally right.
|
diff --git a/rack-canonical-hostname.gemspec b/rack-canonical-hostname.gemspec
index abc1234..def5678 100644
--- a/rack-canonical-hostname.gemspec
+++ b/rack-canonical-hostname.gemspec
@@ -15,4 +15,5 @@ gem.require_paths = ["lib"]
gem.version = Rack::CanonicalHost::VERSION
gem.add_development_dependency 'rspec', '~> 2.0'
+ gem.add_development_dependency 'rack'
end
|
Add development dependency in order to make specs pass
|
diff --git a/lib/handlebars_assets/engine.rb b/lib/handlebars_assets/engine.rb
index abc1234..def5678 100644
--- a/lib/handlebars_assets/engine.rb
+++ b/lib/handlebars_assets/engine.rb
@@ -2,9 +2,10 @@ # NOTE: must be an engine because we are including assets in the gem
class Engine < ::Rails::Engine
initializer "handlebars_assets.assets.register", :group => :all do |app|
- ::HandlebarsAssets::register_extensions(app.assets)
+ sprockets_env = app.assets || Sprockets
+ ::HandlebarsAssets::register_extensions(sprockets_env)
if Gem::Version.new(Sprockets::VERSION) < Gem::Version.new('3')
- ::HandlebarsAssets::add_to_asset_versioning(app.assets)
+ ::HandlebarsAssets::add_to_asset_versioning(sprockets_env)
end
end
end
|
Handle when asset compilation is off in rails.
|
diff --git a/lib/icloud-reminders-cli/app.rb b/lib/icloud-reminders-cli/app.rb
index abc1234..def5678 100644
--- a/lib/icloud-reminders-cli/app.rb
+++ b/lib/icloud-reminders-cli/app.rb
@@ -1,5 +1,6 @@ #!/usr/bin/env ruby
# vim: et ts=2 sw=2
+# encoding: UTF-8
require "thor"
@@ -18,10 +19,11 @@
if reminders.any?
reminders.each_with_index do |reminder, i|
- puts reminder.title
+ status = reminder.complete? ? "☑" : "☐"
+ puts status + " " + reminder.title
reminder.alarms.each do |alarm|
- puts("Date: " + alarm.on_date.strftime("%d/%m/%Y %H:%M")) if alarm.on_date
+ puts(" Date: " + alarm.on_date.strftime("%d/%m/%Y %H:%M")) if alarm.on_date
end
puts
|
Add ridiculous(ly cute) unicode checkboxes
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.