diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/tests/spec/requests/malformed_json_spec.rb b/tests/spec/requests/malformed_json_spec.rb
index abc1234..def5678 100644
--- a/tests/spec/requests/malformed_json_spec.rb
+++ b/tests/spec/requests/malformed_json_spec.rb
@@ -0,0 +1,44 @@+# coding: utf-8
+
+require 'net/http'
+require 'spec_helper'
+
+RSpec.feature "JSON argument deserialization", type: :request do
+ let(:evaluate_json_uri) { URI.join(Capybara.app_host, '/evaluate.json') }
+
+ context "when the JSON data is malformed" do
+ let(:body) { JSON.generate({}) }
+
+ it "responds with a JSON error" do
+ Net::HTTP.start(evaluate_json_uri.host, evaluate_json_uri.port) do |http|
+ request = Net::HTTP::Post.new(evaluate_json_uri)
+ request.body = body
+ request['Content-Type'] = 'application/json'
+
+ response = http.request(request)
+
+ expect(response['Content-Type']).to eq('application/json')
+ body = JSON.parse(response.body)
+ expect(body['error']).to match('Unable to deserialize request')
+ end
+ end
+ end
+
+ context "when the data is not JSON" do
+ let(:body) { 'lolhello' }
+
+ it "responds with a JSON error" do
+ Net::HTTP.start(evaluate_json_uri.host, evaluate_json_uri.port) do |http|
+ request = Net::HTTP::Post.new(evaluate_json_uri)
+ request.body = body
+ request['Content-Type'] = 'text/plain'
+
+ response = http.request(request)
+
+ expect(response['Content-Type']).to eq('application/json')
+ body = JSON.parse(response.body)
+ expect(body['error']).to match('Unable to deserialize request')
+ end
+ end
+ end
+end
|
Test for fundamental API deserialization errors
|
diff --git a/effective_datatables.gemspec b/effective_datatables.gemspec
index abc1234..def5678 100644
--- a/effective_datatables.gemspec
+++ b/effective_datatables.gemspec
@@ -20,5 +20,5 @@ s.add_dependency 'coffee-rails'
s.add_dependency 'effective_bootstrap'
s.add_dependency 'effective_resources'
- s.add_dependency 'sass'
+ s.add_dependency 'sassc'
end
|
Remove deprecated sass gem in favour of sassc
https://github.com/sass/ruby-sass#ruby-sass-has-reached-end-of-life
|
diff --git a/tasks/docs.rake b/tasks/docs.rake
index abc1234..def5678 100644
--- a/tasks/docs.rake
+++ b/tasks/docs.rake
@@ -14,7 +14,8 @@ FileUtils.cd(TMP_DIR) do
sh("wget http://mirror.ctan.org/systems/texlive/tlnet/#{LATEX_TAR}")
sh("tar xvzf #{LATEX_TAR}")
- FileUtils.cd("install-tl-20130815") do
+ tar_directory = Dir["/tmp/install-tl-2*"][0]
+ FileUtils.cd(tar_directory) do
sh("sudo ./install-tl")
end
end
|
Determine path tar writes to, cd into that dir
|
diff --git a/spec_helper.rb b/spec_helper.rb
index abc1234..def5678 100644
--- a/spec_helper.rb
+++ b/spec_helper.rb
@@ -1,8 +1,6 @@-Dir[ARGV[1] || 'algorithms/**/*.md'].each do |filename|
- matcher = File.read(filename).match(/~~~\n(require 'rspec'\n.+?)\n~~~/m)
-
- next if matcher.nil?
-
- puts "Evaluating #{filename}"
- matcher.captures.each { |capture| eval capture }
+Dir[ENV['MD'] || 'algorithms/**/*.md'].each do |filename|
+ File.read(filename).scan(/~~~\n(require 'rspec'\n.+?)\n~~~/m).flatten.each_with_index do |snippet, i|
+ puts "Evaluating #{i + 1} snippet in #{filename}"
+ eval snippet
+ end
end
|
Simplify spec helper even further and use scan so that we can evaluate all snippets in a file.
|
diff --git a/Formula/d-bus.rb b/Formula/d-bus.rb
index abc1234..def5678 100644
--- a/Formula/d-bus.rb
+++ b/Formula/d-bus.rb
@@ -16,7 +16,8 @@ # Fix the TMPDIR to one D-Bus doesn't reject due to odd symbols
ENV["TMPDIR"] = "/tmp"
system "./configure", "--prefix=#{prefix}", "--disable-xml-docs",
- "--disable-doxygen-docs", "--disable-dependency-tracking"
+ "--disable-doxygen-docs", "--disable-dependency-tracking",
+ "--without-x"
system "make install"
# Generate D-Bus's UUID for this machine
|
Build D-Bus without X dependency.
|
diff --git a/app/models/offsite_link.rb b/app/models/offsite_link.rb
index abc1234..def5678 100644
--- a/app/models/offsite_link.rb
+++ b/app/models/offsite_link.rb
@@ -1,6 +1,6 @@ class OffsiteLink < ActiveRecord::Base
belongs_to :parent, polymorphic: true
- validates :title, :summary, :link_type, :url, presence: true
+ validates :title, :summary, :link_type, :url, presence: true, length: { maximum: 255 }
validate :url_is_govuk
validates :link_type, presence: true, inclusion: {in: %w{alert blog_post campaign careers service}}
|
Validate the length of fields in Offsite Links
Rather than letting the database raise an error (now that we have a MySQL
version which doesn't silently truncate), let's validate it in the model and
show the user a helpful validation message, not a 5xx error page.
|
diff --git a/atomic.gemspec b/atomic.gemspec
index abc1234..def5678 100644
--- a/atomic.gemspec
+++ b/atomic.gemspec
@@ -7,10 +7,15 @@ s.date = Time.now.strftime('%Y-%m-%d')
s.description = "An atomic reference implementation for JRuby and green or GIL-threaded impls"
s.email = ["headius@headius.com", "mental@rydia.net"]
- s.files = Dir['{lib,examples,test,ext}/**/*'] + Dir['{*.txt,*.gemspec,Rakefile}']
s.homepage = "http://github.com/headius/ruby-atomic"
s.require_paths = ["lib"]
s.summary = "An atomic reference implementation for JRuby and green or GIL-threaded impls"
s.test_files = Dir["test/test*.rb"]
- s.extensions = 'ext/extconf.rb'
+ if defined?(JRUBY_VERSION)
+ s.files = Dir['{lib,examples,test}/**/*'] + Dir['{*.txt,*.gemspec,Rakefile}']
+ s.platform = 'java'
+ else
+ s.files = Dir['{lib,examples,test,ext}/**/*'] + Dir['{*.txt,*.gemspec,Rakefile}']
+ s.extensions = 'ext/extconf.rb'
+ end
end
|
Split gem into -java and normal versions, so JRuby doesn't attempt to build native ext it will never use.
|
diff --git a/spec/cucumber/formatter/backtrace_filter_spec.rb b/spec/cucumber/formatter/backtrace_filter_spec.rb
index abc1234..def5678 100644
--- a/spec/cucumber/formatter/backtrace_filter_spec.rb
+++ b/spec/cucumber/formatter/backtrace_filter_spec.rb
@@ -0,0 +1,32 @@+require 'cucumber/formatter/backtrace_filter'
+
+module Cucumber
+ module Formatter
+ describe BacktraceFilter do
+ context '#exception' do
+ before do
+ trace = %w(a b
+ _anything__/vendor/rails__anything_
+ _anything__lib/cucumber__anything_
+ _anything__bin/cucumber:__anything_
+ _anything__lib/rspec__anything_
+ _anything__gems/__anything_
+ _anything__minitest__anything_
+ _anything__test/unit__anything_
+ _anything__.gem/ruby__anything_
+ _anything__lib/ruby/__anything_
+ _anything__bin/bundle__anything_)
+ @exception = Exception.new
+ @exception.set_backtrace(trace)
+ end
+
+ it 'filters unnecessary traces' do
+ BacktraceFilter.new(@exception).exception
+ expect(@exception.backtrace).to eql %w(a b)
+ end
+ end
+ end
+ end
+end
+
+
|
Add unit tests for backtrace_filter
|
diff --git a/test/enum_field_test.rb b/test/enum_field_test.rb
index abc1234..def5678 100644
--- a/test/enum_field_test.rb
+++ b/test/enum_field_test.rb
@@ -27,12 +27,10 @@
model.stubs(:gender).returns("male")
assert model.male?
+ assert !model.female?
model.stubs(:gender).returns("female")
assert !model.male?
-
assert model.female?
- model.stubs(:gender).returns("male")
- assert !model.female?
end
should "extend active record base with method" do
|
Remove unnecessary operations from one of the tests
|
diff --git a/app.rb b/app.rb
index abc1234..def5678 100644
--- a/app.rb
+++ b/app.rb
@@ -2,7 +2,7 @@ Bundler.require
assets {
- js :application, ['/js/generic.js', '/js/rainbow.min.js', '/js/shell.js']
+ js :application, ['/js/rainbow.min.js', '/js/generic.js', '/js/shell.js']
css :application, ['/css/github.css', '/css/fss.css']
}
|
Fix order of js includes
|
diff --git a/lib/docs/scrapers/phpunit.rb b/lib/docs/scrapers/phpunit.rb
index abc1234..def5678 100644
--- a/lib/docs/scrapers/phpunit.rb
+++ b/lib/docs/scrapers/phpunit.rb
@@ -24,7 +24,7 @@ HTML
version '5' do
- self.release = '5.5'
+ self.release = '5.7'
self.base_url = "https://phpunit.de/manual/#{release}/en/"
end
|
Update PHPUnit documentation (5.7, 4.8)
|
diff --git a/test/middleware_test.rb b/test/middleware_test.rb
index abc1234..def5678 100644
--- a/test/middleware_test.rb
+++ b/test/middleware_test.rb
@@ -19,7 +19,7 @@
def test_middleware_processor
response = build_stack("flex.css").get("/javascripts/src/test.js")
- assert response.body.include?("-webkit-flex;")
+ assert response.body.include?("-webkit-box;")
assert_equal response.status, 200
end
end
|
Update test as -webkit-flex is no longer prefixed
|
diff --git a/lib/restforce/db/registry.rb b/lib/restforce/db/registry.rb
index abc1234..def5678 100644
--- a/lib/restforce/db/registry.rb
+++ b/lib/restforce/db/registry.rb
@@ -6,56 +6,51 @@ # established in the system.
class Registry
- class << self
+ extend Enumerable
- include Enumerable
- attr_accessor :collection
+ # Public: Get the Restforce::DB::Mapping entry for the specified model.
+ #
+ # model - A String or Class.
+ #
+ # Returns a Restforce::DB::Mapping.
+ def self.[](model)
+ @collection[model]
+ end
- # Public: Get the Restforce::DB::Mapping entry for the specified model.
- #
- # model - A String or Class.
- #
- # Returns a Restforce::DB::Mapping.
- def [](model)
- collection[model]
- end
+ # Public: Iterate through all registered Restforce::DB::Mappings.
+ #
+ # Yields one Mapping for each database-to-Salesforce mapping.
+ # Returns nothing.
+ def self.each
+ @collection.each do |model, mappings|
+ # Since each mapping is inserted twice, we ignore the half which
+ # were inserted via Salesforce model names.
+ next unless model.is_a?(Class)
- # Public: Iterate through all registered Restforce::DB::Mappings.
- #
- # Yields one Mapping for each database-to-Salesforce mapping.
- # Returns nothing.
- def each
- collection.each do |model, mappings|
- # Since each mapping is inserted twice, we ignore the half which
- # were inserted via Salesforce model names.
- next unless model.is_a?(Class)
-
- mappings.each do |mapping|
- yield mapping
- end
+ mappings.each do |mapping|
+ yield mapping
end
end
+ end
- # Public: Add a mapping to the overarching Mapping collection. Appends
- # the mapping to the collection for both its database and salesforce
- # object types.
- #
- # mapping - A Restforce::DB::Mapping.
- #
- # Returns nothing.
- def <<(mapping)
- [mapping.database_model, mapping.salesforce_model].each do |model|
- collection[model] << mapping
- end
+ # Public: Add a mapping to the overarching Mapping collection. Appends
+ # the mapping to the collection for both its database and salesforce
+ # object types.
+ #
+ # mapping - A Restforce::DB::Mapping.
+ #
+ # Returns nothing.
+ def self.<<(mapping)
+ [mapping.database_model, mapping.salesforce_model].each do |model|
+ @collection[model] << mapping
end
+ end
- # Public: Clear out any existing registered mappings.
- #
- # Returns nothing.
- def clean!
- self.collection = Hash.new { |h, k| h[k] = [] }
- end
-
+ # Public: Clear out any existing registered mappings.
+ #
+ # Returns nothing.
+ def self.clean!
+ @collection = Hash.new { |h, k| h[k] = [] }
end
clean!
|
Use more explicit Registry self.method definitions
|
diff --git a/lib/usesthis/api/endpoint.rb b/lib/usesthis/api/endpoint.rb
index abc1234..def5678 100644
--- a/lib/usesthis/api/endpoint.rb
+++ b/lib/usesthis/api/endpoint.rb
@@ -4,6 +4,10 @@ module Api
# A class that models a static API endpoint.
class Endpoint
+ def self.publish(output_path, items, type, pagination = false)
+ new(output_path, items, type, pagination).publish
+ end
+
def initialize(output_path, items, type, pagination = false)
@type = type
@output_path = output_path
|
Add the publish class method
|
diff --git a/lib/generators/clearance/install/templates/db/migrate/add_clearance_to_users.rb b/lib/generators/clearance/install/templates/db/migrate/add_clearance_to_users.rb
index abc1234..def5678 100644
--- a/lib/generators/clearance/install/templates/db/migrate/add_clearance_to_users.rb
+++ b/lib/generators/clearance/install/templates/db/migrate/add_clearance_to_users.rb
@@ -24,7 +24,7 @@ def self.down
change_table :users do |t|
<% if config[:new_columns].any? -%>
- t.remove <%= new_columns.keys.map { |column| ":#{column}" }.join(",") %>
+ t.remove <%= new_columns.keys.map { |column| ":#{column}" }.join(", ") %>
<% end -%>
end
end
|
Make generated code follow the current style guide
Since these migrations are generated, we want them to follow the current
style guide. So when opening a PR, there will be no violations reported
from [Hound].
[Hound]: https://houndci.com
|
diff --git a/test/test_collection.rb b/test/test_collection.rb
index abc1234..def5678 100644
--- a/test/test_collection.rb
+++ b/test/test_collection.rb
@@ -18,7 +18,7 @@ assert_equal 10, Collection.new(10).results
end
- def test_collection_assigns_results
+ def test_collection_assigns_start
assert_equal 2, Collection.new(10, 2).start
end
|
Fix typo in test name.
|
diff --git a/spec/features/order/order_order_items_spec.rb b/spec/features/order/order_order_items_spec.rb
index abc1234..def5678 100644
--- a/spec/features/order/order_order_items_spec.rb
+++ b/spec/features/order/order_order_items_spec.rb
@@ -30,6 +30,28 @@ end
+ feature '注文の修正' do
+ scenario '注文者は自分の注文を修正できる' do
+ create(:lunchbox)
+ order = create(:order)
+ order_item = create(:order_item)
+
+ visit order_order_items_path(order)
+ expect(page).to have_text(order_item.customer_name)
+
+ # edit name
+ click_link(order_item.customer_name)
+ expect(page).not_to have_text(order_item.customer_name)
+ fill_in "Customer name", with:"another_name"
+
+ # update confirm
+ click_button "Update Order item"
+ expect(page).not_to have_text(order_item.customer_name)
+ expect(page).to have_text("another_name")
+
+ end
+ end
+
end
|
Add test for edit order
|
diff --git a/spec/omniauth/strategies/digitalocean_spec.rb b/spec/omniauth/strategies/digitalocean_spec.rb
index abc1234..def5678 100644
--- a/spec/omniauth/strategies/digitalocean_spec.rb
+++ b/spec/omniauth/strategies/digitalocean_spec.rb
@@ -1,8 +1,8 @@ require 'spec_helper'
-describe OmniAuth::Strategies::DigitalOcean do
+describe OmniAuth::Strategies::Digitalocean do
subject do
- OmniAuth::Strategies::DigitalOcean.new({})
+ described_class.new({})
end
context "client options" do
|
Fix class name in spec to match existing class.
|
diff --git a/spec/features/show_game_pairings_spec.rb b/spec/features/show_game_pairings_spec.rb
index abc1234..def5678 100644
--- a/spec/features/show_game_pairings_spec.rb
+++ b/spec/features/show_game_pairings_spec.rb
@@ -8,7 +8,7 @@ let!(:game_one) { create(:game_appointment, round: round) }
let!(:game_two) { create(:game_appointment, round: round) }
let!(:game_three) { create(:game_appointment, round: round) }
- fit "can navigate to a page showing the games for a tournament" do
+ it "can navigate to a page showing the games for a tournament" do
round_link = "Round #{round.number}"
visit tournament_path(tournament, year: tournament.year)
click_on(round_link)
|
Update show game pairings feature test
|
diff --git a/spec/models/events/deck_shuffled_spec.rb b/spec/models/events/deck_shuffled_spec.rb
index abc1234..def5678 100644
--- a/spec/models/events/deck_shuffled_spec.rb
+++ b/spec/models/events/deck_shuffled_spec.rb
@@ -12,6 +12,10 @@ expect(event.state_attribute).to be nil
end
+ it "should have no encoded value" do
+ expect(event.encoded_value).to be nil
+ end
+
it "should have an empty array for a value" do
expect(event.value).to be_empty
end
|
Add test case for bare DeckShuffled object
|
diff --git a/app/controllers/sitemap_controller.rb b/app/controllers/sitemap_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/sitemap_controller.rb
+++ b/app/controllers/sitemap_controller.rb
@@ -3,6 +3,7 @@ def index
@static_pages = static_pages
@courses = Course.all
+
respond_to do |format|
format.xml
end
|
Add a newline between the respond_to block and the instance variables
|
diff --git a/app/controllers/sitemap_controller.rb b/app/controllers/sitemap_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/sitemap_controller.rb
+++ b/app/controllers/sitemap_controller.rb
@@ -1,5 +1,5 @@ class SitemapController < ApplicationController
def index
- @articles = ContentService.new.list_articles.sort { |a, b| b.created_at <=> a.created_at }
+ @articles = ContentService.instance.list_articles.sort { |a, b| b.created_at <=> a.created_at }
end
-end+end
|
fix: Use the signleton contenful service insteado f instansiating a new one.
|
diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/welcome_controller.rb
+++ b/app/controllers/welcome_controller.rb
@@ -1,6 +1,6 @@ class WelcomeController < ApplicationController
- caches_action :index, expires_in: 1.minutes
+ caches_action :index
def index
render"landing_page" if !current_user
|
Remove time from caching-wasn't working
|
diff --git a/OmniBase.podspec b/OmniBase.podspec
index abc1234..def5678 100644
--- a/OmniBase.podspec
+++ b/OmniBase.podspec
@@ -3,7 +3,7 @@ s.version = "0.1.0"
s.summary = "The core Omni open source framework."
s.homepage = "https://github.com/wjk/OmniBase"
- s.license = { :type => 'OMNI', :file => 'OmniSourceLicense.html' }
+ s.license = { :type => 'Omni', :file => 'LICENSE' }
s.author = { "William Kent" => "https://github.com/wjk" }
s.source = { :git => "https://github.com/wjk/OmniBase.git", :tag => s.version.to_s }
|
Update license reference in podspec
|
diff --git a/app/models/spree/variant_decorator.rb b/app/models/spree/variant_decorator.rb
index abc1234..def5678 100644
--- a/app/models/spree/variant_decorator.rb
+++ b/app/models/spree/variant_decorator.rb
@@ -1,9 +1,4 @@ Spree::Variant.class_eval do
has_many :variant_images, -> { order(:position) }, class_name: '::Spree::VariantImage'
- has_many :images_for_variant, through: :variant_images, source: :image
- has_many :images, -> { order(:position) }, as: :viewable
-
- def images
- images_for_variant
- end
+ has_many :images, through: :variant_images, source: :image
end
|
Clean up variant images association
The "has_many :images" was broken since it didn't specify the class name, and I couldn't figure out why these were defined this way anyway.
Consolidating "images_for_variant" and "images" into a single normal association. Will make stuff like preloading easier to work with.
|
diff --git a/app/representers/event_representer.rb b/app/representers/event_representer.rb
index abc1234..def5678 100644
--- a/app/representers/event_representer.rb
+++ b/app/representers/event_representer.rb
@@ -20,7 +20,7 @@ property :room, getter: -> (args) { room.to_s }
collection :teacher_ids, as: :teachers
collection :student_ids, as: :students
- property :applied_schedule_exception_ids, as: :applied_schedule_exceptions
+ property :applied_schedule_exception_ids, as: :applied_exceptions
end
def parallel
|
Rename applied_schedule_exceptions link to applied_exceptions.
|
diff --git a/Casks/dwarf-fortress.rb b/Casks/dwarf-fortress.rb
index abc1234..def5678 100644
--- a/Casks/dwarf-fortress.rb
+++ b/Casks/dwarf-fortress.rb
@@ -1,10 +1,9 @@ class DwarfFortress < Cask
- version '0.40.01'
- sha256 'c4f729f094790671b1fde995c02c5d547d652d87790785b13a6cdc9f35dec6be'
+ version '0.40.12'
+ sha256 'e493942db5553a33ac38a150ea16dfb9748192a3f7c1961a342a7436f64cc6c0'
- url 'http://www.bay12games.com/dwarves/df_40_01_osx.tar.bz2'
+ url 'http://www.bay12games.com/dwarves/df_40_12_osx.tar.bz2'
homepage 'http://www.bay12games.com/dwarves/'
link 'df_osx/df', :target => 'Dwarf Fortress/df'
end
-
|
Update Dwarf Fortress to 0.40.12
|
diff --git a/lib/carto/db/migration_helper.rb b/lib/carto/db/migration_helper.rb
index abc1234..def5678 100644
--- a/lib/carto/db/migration_helper.rb
+++ b/lib/carto/db/migration_helper.rb
@@ -39,6 +39,7 @@ run 'ROLLBACK TO SAVEPOINT before_migration'
sleep WAIT_BETWEEN_RETRIES_S
else
+ puts e.message
raise e
end
end
|
Add extra error information to migration helper
|
diff --git a/lib/minty/objects/transaction.rb b/lib/minty/objects/transaction.rb
index abc1234..def5678 100644
--- a/lib/minty/objects/transaction.rb
+++ b/lib/minty/objects/transaction.rb
@@ -32,8 +32,10 @@ @row["Labels"]
end
+ DATE_FORMAT = '%m/%d/%Y'
+
def date
- @row["Date"]
+ Date.strptime(@row["Date"], DATE_FORMAT)
end
def original_description
|
Convert date string to Date object
|
diff --git a/lib/user_agent/browsers/gecko.rb b/lib/user_agent/browsers/gecko.rb
index abc1234..def5678 100644
--- a/lib/user_agent/browsers/gecko.rb
+++ b/lib/user_agent/browsers/gecko.rb
@@ -24,7 +24,7 @@
def platform
if comment = application.comment
- if comment[0] == 'compatible'
+ if comment[0] == 'compatible' || comment[0] == 'Mobile'
nil
elsif /^Windows / =~ comment[0]
'Windows'
@@ -41,13 +41,17 @@ def os
if comment = application.comment
i = if comment[1] == 'U'
- 2
- elsif /^Windows / =~ comment[0]
- 0
- else
- 1
- end
+ 2
+ elsif /^Windows / =~ comment[0] || /^Android/ =~ comment[0]
+ 0
+ elsif comment[0] == 'Mobile'
+ nil
+ else
+ 1
+ end
+ return nil if i.nil?
+
OperatingSystems.normalize_os(comment[i])
end
end
|
Fix a couple issues parsing Gecko user agents.
|
diff --git a/app/models/concerns/taggable.rb b/app/models/concerns/taggable.rb
index abc1234..def5678 100644
--- a/app/models/concerns/taggable.rb
+++ b/app/models/concerns/taggable.rb
@@ -22,7 +22,7 @@ after_save :save_tags
def tag_list
- tags.map(&:name)
+ TagList.new tags.map(&:name)
end
def tag_list=(list)
|
Use TagList class to tag_list method
|
diff --git a/application.rb b/application.rb
index abc1234..def5678 100644
--- a/application.rb
+++ b/application.rb
@@ -14,7 +14,7 @@ haml :root
end
post '/' do
- if redis.sismember("EMAIL", params[:username])
+ if redis.sismember("EMAIL", params[:email])
haml :bad
else
haml :good
|
Change tired code to be broke not
|
diff --git a/spec/bundler/fetcher/compact_index_spec.rb b/spec/bundler/fetcher/compact_index_spec.rb
index abc1234..def5678 100644
--- a/spec/bundler/fetcher/compact_index_spec.rb
+++ b/spec/bundler/fetcher/compact_index_spec.rb
@@ -4,7 +4,7 @@ describe Bundler::Fetcher::CompactIndex do
let(:downloader) { double(:downloader) }
let(:remote) { double(:remote, :cache_slug => "lsjdf") }
- let(:display_uri) { URI("http://sample_uri.com") }
+ let(:display_uri) { URI("http://sampleuri.com") }
let(:compact_index) { described_class.new(downloader, remote, display_uri) }
# Testing private method. Do not commit.
|
Fix issue with older versions of Ruby and URI.
|
diff --git a/spec/classes/elasticsearch_package_spec.rb b/spec/classes/elasticsearch_package_spec.rb
index abc1234..def5678 100644
--- a/spec/classes/elasticsearch_package_spec.rb
+++ b/spec/classes/elasticsearch_package_spec.rb
@@ -6,6 +6,6 @@ it do
should contain_homebrew__formula("elasticsearch")
- should contain_package("boxen/brews/elasticsearch").with_ensure("0.90.5-boxen1")
+ should contain_package("boxen/brews/elasticsearch").with_ensure("1.1.1-boxen1")
end
end
|
Fix failling spec due to the elasticsearch formula update
|
diff --git a/spec/unit/sequel/plugins/auditable_spec.rb b/spec/unit/sequel/plugins/auditable_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/sequel/plugins/auditable_spec.rb
+++ b/spec/unit/sequel/plugins/auditable_spec.rb
@@ -0,0 +1,21 @@+require "rails_helper"
+
+describe "Auditable sequel plugin" do
+ let(:model_with_plugin) { create :section_note, content: "first content" }
+
+ describe "Model hooks" do
+ it "creates an audit record when updated" do
+ expect {
+ model_with_plugin.update(content: "test")
+ }.to change { Audit.count }.by(1)
+ end
+
+ it "the new audit record created keeps the record of the changes" do
+ model_with_plugin.update(content: "second content")
+ result = JSON.parse(model_with_plugin.audits.last.changes)
+
+ expect(result["content"][0]).to eq("first content")
+ expect(result["content"][1]).to eq("second content")
+ end
+ end
+end
|
Add spec for the auditable plugin
|
diff --git a/lesson9/hit_the_road_jack.rb b/lesson9/hit_the_road_jack.rb
index abc1234..def5678 100644
--- a/lesson9/hit_the_road_jack.rb
+++ b/lesson9/hit_the_road_jack.rb
@@ -0,0 +1,22 @@+# Lesson 9 - More Chords: D, E, A and B Flat
+# Rhythm - Left Note/Right Chord (Hit the Road, Jack)
+use_synth :piano
+
+play :D3
+sleep 0.5
+play chord(:D4, :minor)
+sleep 0.5
+
+play :C3
+sleep 0.5
+play chord(:C4)
+sleep 0.5
+
+play :Bb2
+sleep 0.5
+play chord(:Bb3)
+sleep 0.25
+
+play :A2
+sleep 0.75
+play chord(:A3)
|
Add first song from Lesson 9
|
diff --git a/comrad.gemspec b/comrad.gemspec
index abc1234..def5678 100644
--- a/comrad.gemspec
+++ b/comrad.gemspec
@@ -18,8 +18,8 @@ s.add_development_dependency 'rubocop', '~> 0.30.0'
s.files = `git ls-files -z`.split("\x0")
- s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
+ s.executables = s.name
s.require_paths = ['lib']
s.extra_rdoc_files = ['README.md']
- s.rdoc_options = ['--line-numbers', '--inline-source', '--title', 'reagan', '--main', 'README.md']
+ s.rdoc_options = ['--line-numbers', '--inline-source', '--title', 'comrad', '--main', 'README.md']
end
|
Simplify determining the executable and get the name for docs right
|
diff --git a/polymorphic_identity.gemspec b/polymorphic_identity.gemspec
index abc1234..def5678 100644
--- a/polymorphic_identity.gemspec
+++ b/polymorphic_identity.gemspec
@@ -14,4 +14,7 @@ s.test_files = `git ls-files -- test/*`.split("\n")
s.rdoc_options = %w(--line-numbers --inline-source --title polymorphic_identity --main README.rdoc)
s.extra_rdoc_files = %w(README.rdoc CHANGELOG.rdoc LICENSE)
+
+ s.add_development_dependency("rake")
+ s.add_development_dependency("plugin_test_helper", ">= 0.3.2")
end
|
Add missing dependencies to gemspec
|
diff --git a/lib/pig_latin.rb b/lib/pig_latin.rb
index abc1234..def5678 100644
--- a/lib/pig_latin.rb
+++ b/lib/pig_latin.rb
@@ -3,17 +3,17 @@ module PigLatin
# Your code goes here...
def self.cut_front(word)
- if /\A[aeiou]/.match(word) != nil
+ if /\A[aeiou]/i.match(word) != nil
return "w"
- elsif /\Ay/.match(word).to_s == "y" || /y/.match(word) == nil
- /[^aeiou]+/.match(word).to_s
+ elsif /\Ay/i.match(word).to_s == "y" || /y/i.match(word) == nil
+ /[^aeiou]+/i.match(word).to_s
else
- /[^aeiouy]+/.match(word).to_s
+ /[^aeiouy]+/i.match(word).to_s
end
end
def self.capture_back(word)
- /\Ay/.match(word).to_s == "y" || /y/.match(word) == nil ? /[aeiou](.*)/.match(word).to_s : /[aeiouy](.*)/.match(word).to_s
+ /\Ay/i.match(word).to_s == "y" || /y/i.match(word) == nil ? /[aeiou](.*)/.match(word).to_s : /[aeiouy](.*)/.match(word).to_s
end
def self.translate(word)
|
Change code so it is case insensitive
|
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -24,4 +24,10 @@ render status: :unauthorized, text: "You are not authorised to access that page."
end
end
+
+ def set_flash_message(type, options = {})
+ flash_key = if type == :success then :notice else :alert end
+ options.reverse_merge!(scope: "#{controller_path.gsub('/', '.')}.#{action_name}")
+ flash[flash_key] = I18n.t(type, options)
+ end
end
|
Add set_flash_message(type) for automatic translation of flash messages.
Based on: https://github.com/rails/rails/issues/473
|
diff --git a/lib/embulk/guess/jsonpath.rb b/lib/embulk/guess/jsonpath.rb
index abc1234..def5678 100644
--- a/lib/embulk/guess/jsonpath.rb
+++ b/lib/embulk/guess/jsonpath.rb
@@ -11,8 +11,8 @@ json_path = parser_config.param("root",:string,default: "$")
json = JsonPath.new(json_path).on(sample_text).first
if( json.kind_of?(Array) )
- row = json.first
- raise RuntimeError,"Can't guess row data must be hash" unless row.kind_of?(Hash)
+ no_hash = json.find{ |j| !j.kind_of?(Hash) }
+ raise RuntimeError,"Can't exec guess. The row data must be hash." if no_hash
columns = Embulk::Guess::SchemaGuess.from_hash_records(json).map do |c|
column = {name: c.name, type: c.type}
column[:format] = c.format if c.format
@@ -22,7 +22,7 @@ parser_guessed["columns"] = columns
return {"parser" => parser_guessed}
else
- raise RuntimeError,"Can't guess specified path(#{json_path})"
+ raise RuntimeError,"Can't guess specified the JSONPath: #{json_path}. The results does not return an Array."
end
end
|
Check all data in Array. Change message
|
diff --git a/lib/growl-transfer/gt_scp.rb b/lib/growl-transfer/gt_scp.rb
index abc1234..def5678 100644
--- a/lib/growl-transfer/gt_scp.rb
+++ b/lib/growl-transfer/gt_scp.rb
@@ -8,7 +8,7 @@ @output.puts "Downloading #{remote}"
params = remote.split(":")
file = params.last.split("/").last
- Net::SCP.start(params[0], "clint") do |scp|
+ Net::SCP.start(params[0], ENV['USER']) do |scp|
scp.download!(params[1], local_path, {:recursive => true, :verbose => true}) do |ch, name, sent, total|
# => progress?
end
|
Use current UNIX user, incase your name isn't Clint
|
diff --git a/lib/hatokura/fairy_garden.rb b/lib/hatokura/fairy_garden.rb
index abc1234..def5678 100644
--- a/lib/hatokura/fairy_garden.rb
+++ b/lib/hatokura/fairy_garden.rb
@@ -9,6 +9,7 @@ Cost = 1
Link = 1
MainType = :land
+ Rarity = :basic
AuthorityPoint = -2
PlayedAbility = Proc.new {[]} # TODO: List moves.
end
@@ -18,6 +19,7 @@ Cost = 3
Link = 1
MainType = :land
+ Rarity = :basic
PlayedAbility = Proc.new {[]} # TODO: List moves.
end
@@ -26,6 +28,7 @@ Cost = 6
Link = 1
MainType = :land
+ Rarity = :basic
PlayedAbility = Proc.new {[]} # TODO: List moves.
end
@@ -34,6 +37,7 @@ Cost = 2
Link = nil
MainType = :authority
+ Rarity = :basic
AuthorityPoint = -2
end
@@ -42,6 +46,7 @@ Cost = 3
Link = nil
MainType = :authority
+ Rarity = :basic
AuthorityPoint = 2
end
@@ -50,6 +55,7 @@ Cost = 5
Link = nil
MainType = :authority
+ Rarity = :basic
AuthorityPoint = 3
end
@@ -58,6 +64,7 @@ Cost = 8
Link = nil
MainType = :authority
+ Rarity = :basic
AuthorityPoint = 6
end
end
|
Add missing rarity for each card
|
diff --git a/lib/mrT/git_branch_select.rb b/lib/mrT/git_branch_select.rb
index abc1234..def5678 100644
--- a/lib/mrT/git_branch_select.rb
+++ b/lib/mrT/git_branch_select.rb
@@ -16,8 +16,8 @@ if `git status --porcelain | wc -l`.chomp.to_i == 0
Kernel.exec 'git', 'checkout', action.target
else
- system "echo 'Please, commit your changes or stash them before you can switch branches.'"
- exit 0
+ puts 'Please, commit your changes or stash them before you can switch branches.'
+ exit 1
end
end
|
Use puts instead of system echo
|
diff --git a/lib/resque/heroku-signals.rb b/lib/resque/heroku-signals.rb
index abc1234..def5678 100644
--- a/lib/resque/heroku-signals.rb
+++ b/lib/resque/heroku-signals.rb
@@ -6,16 +6,16 @@ def unregister_signal_handlers
trap('TERM') do
trap('TERM') do
- puts "[resque-heroku] received second term signal, throwing term exception"
+ log_with_severity :info, "[resque-heroku] received second term signal, throwing term exception"
trap('TERM') do
- puts "[resque-heroku] third or more time receiving TERM, ignoring"
+ log_with_severity :info, "[resque-heroku] third or more time receiving TERM, ignoring"
end
raise Resque::TermException.new("SIGTERM")
end
- puts "[resque-heroku] received first term signal from heroku, ignoring"
+ log_with_severity :info, "[resque-heroku] received first term signal from heroku, ignoring"
end
|
Use logger instead of puts
|
diff --git a/lib/ripl/commands/history.rb b/lib/ripl/commands/history.rb
index abc1234..def5678 100644
--- a/lib/ripl/commands/history.rb
+++ b/lib/ripl/commands/history.rb
@@ -25,7 +25,7 @@ else
''
end
- file = Tempfile.new('edit_string').path
+ file = Tempfile.new('ripl-editor').path
File.open(file, 'w') {|f| f.puts(body) }
system(editor, file)
Ripl.shell.loop_eval(@last_edit = File.read(file))
|
Change tempfile name to ripl-editor.
|
diff --git a/test/precompile_test.rb b/test/precompile_test.rb
index abc1234..def5678 100644
--- a/test/precompile_test.rb
+++ b/test/precompile_test.rb
@@ -28,7 +28,7 @@
contents = File.read(application_js_path)
- assert_match %r{Ember\.VERSION}, contents, 'application.js should contain Ember.VERSION'
+ assert_match %r{Ember\.VERSION|_emberVersion\.default}, contents, 'application.js should contain Ember.VERSION'
assert_match %r{Handlebars\.VERSION|COMPILER_REVISION}, contents, 'applciation.js should contain Handlebars.VERSION'
end
|
Fix test to match `Ember.VERSION`
|
diff --git a/config/initializers/messenger.rb b/config/initializers/messenger.rb
index abc1234..def5678 100644
--- a/config/initializers/messenger.rb
+++ b/config/initializers/messenger.rb
@@ -1,6 +1,6 @@ require 'messenger'
-unless File.basename($0) == 'rake' || Rails.env.test?
+unless Rails.env.test?
host = Rails.env.production? ? 'support.cluster' : 'localhost'
uri = URI::Generic.build scheme: 'stomp', host: host, port: 61613
Messenger.transport = Stomp::Client.new uri.to_s
|
Connect Stomp client when running rake tasks
|
diff --git a/config/initializers/rabl_init.rb b/config/initializers/rabl_init.rb
index abc1234..def5678 100644
--- a/config/initializers/rabl_init.rb
+++ b/config/initializers/rabl_init.rb
@@ -1,4 +1,5 @@ Rabl.configure do |config|
+ config.json_engine = Oj
config.cache_all_output = false
config.cache_sources = Rails.env.production?
config.include_json_root = false
|
Make sure Rabl is using Oj
|
diff --git a/16_aunt_sue.rb b/16_aunt_sue.rb
index abc1234..def5678 100644
--- a/16_aunt_sue.rb
+++ b/16_aunt_sue.rb
@@ -0,0 +1,28 @@+DESIRES = {
+ children: [3, :==.to_proc],
+ cats: [7, :>.to_proc],
+ samoyeds: [2, :==.to_proc],
+ pomeranians: [3, :<.to_proc],
+ akitas: [0, :==.to_proc],
+ vizslas: [0, :==.to_proc],
+ goldfish: [5, :<.to_proc],
+ trees: [3, :>.to_proc],
+ cars: [2, :==.to_proc],
+ perfumes: [1, :==.to_proc],
+}.freeze
+DESIRES.each_value(&:freeze)
+
+puts ARGF.each_line.with_object([[], []]) { |line, found|
+ name, traits = line.split(': ', 2)
+ sue_id = Integer(name.delete_prefix('Sue '))
+ traits = traits.split(', ').map { |trait|
+ key, value = trait.split(': ')
+ [key.to_sym, Integer(value)]
+ }
+
+ found[0] << sue_id if traits.all? { |key, value| DESIRES[key].first == value }
+ found[1] << sue_id if traits.all? { |key, value|
+ thresh, func = DESIRES[key]
+ func[value, thresh]
+ }
+}
|
Add day 16: Aunt Sue
|
diff --git a/lib/tasks/courses_wikis.rake b/lib/tasks/courses_wikis.rake
index abc1234..def5678 100644
--- a/lib/tasks/courses_wikis.rake
+++ b/lib/tasks/courses_wikis.rake
@@ -4,10 +4,12 @@ desc 'Creates CoursesWikis association for existing courses through revisions'
task migrate: :environment do
Rails.logger.debug 'Creating CoursesWikis associations'
+ default_wiki = Features.wiki_ed? ? [] : [Wiki.get_or_create(language: nil, project: 'wikidata')]
+
Course.all.each do |course|
# The Course#wiki_ids method is removed
# and hence its contents is used here.
- wiki_ids = ([course.home_wiki_id] + course.revisions.pluck(Arel.sql('DISTINCT wiki_id'))).uniq
+ wiki_ids = ([course.home_wiki_id] + [default_wiki] + course.assignments.pluck(:wiki_id))
course.update(wikis: Wiki.find(wiki_ids))
end
end
|
Update CoursesWikis data migration task to use Assignments
This matches the way we previously imported revisions for courses; the wiki_ids feature was an edge case that didn't reflect the intention.
|
diff --git a/lib/tasks/pull_requests.rake b/lib/tasks/pull_requests.rake
index abc1234..def5678 100644
--- a/lib/tasks/pull_requests.rake
+++ b/lib/tasks/pull_requests.rake
@@ -1,6 +1,17 @@ desc "Download new pull requests"
task :download_pull_requests => :environment do
+
+ def load_user
+ u = User.order('created_at desc').limit(50).sample(1).first
+ if u.github_client.rate_limit.remaining < 4000
+ p 'finding another user'
+ load_user
+ else
+ u
+ end
+ end
+
User.all.each do |user|
- user.download_pull_requests
+ user.download_pull_requests(load_user.token)
end
-end+end
|
Use a random users token for downloading pull requests
Avoids the case of expired tokens
|
diff --git a/cookbooks/php/recipes/default.rb b/cookbooks/php/recipes/default.rb
index abc1234..def5678 100644
--- a/cookbooks/php/recipes/default.rb
+++ b/cookbooks/php/recipes/default.rb
@@ -17,4 +17,7 @@ # limitations under the License.
#
-package "php"
+package %W[
+ php
+ php#{node[:php][:version]}-fpm
+]
|
Install php-fpm whenever we install php
This stops apt (un)helpfully installing and activating mod_php for us.
|
diff --git a/ruby_hue.gemspec b/ruby_hue.gemspec
index abc1234..def5678 100644
--- a/ruby_hue.gemspec
+++ b/ruby_hue.gemspec
@@ -19,6 +19,9 @@
gem.add_development_dependency "rspec", "~> 2.13.0"
gem.add_development_dependency "awesome_print", "~> 1.1.0"
+ gem.add_development_dependency "webmock", "~> 1.11.0"
+ gem.add_development_dependency "typhoeus", "~> 0.6.2"
gem.add_runtime_dependency "httparty", "~> 0.10.2"
+ gem.add_runtime_dependency "multi_json", "~> 1.7.2"
end
|
Add webmock, typhoeus, and multi_json to gemspec.
|
diff --git a/railitics.gemspec b/railitics.gemspec
index abc1234..def5678 100644
--- a/railitics.gemspec
+++ b/railitics.gemspec
@@ -17,9 +17,10 @@ s.test_files = Dir["test/**/*"]
s.add_dependency "rails", "~> 3.2.3"
+ s.add_dependency 'mongoid'
# s.add_dependency "jquery-rails"
s.add_development_dependency 'rspec'
- s.add_development_dependency 'mongoid'
+ s.add_development_dependency 'capybara'
end
|
Move mongoid to normal dependancy
|
diff --git a/recipes/_idmap.rb b/recipes/_idmap.rb
index abc1234..def5678 100644
--- a/recipes/_idmap.rb
+++ b/recipes/_idmap.rb
@@ -19,8 +19,6 @@
include_recipe 'nfs::_common'
-package 'nfs-kernel-server' if node['platform_family'] == 'debian'
-
# Configure idmap template for NFSv4 client/server support
template node['nfs']['config']['idmap_template'] do
mode 00644
|
Remove installation of nfs-kernel-server for debian
the idmap recipe on debian does not require nfs-kernel-server to be installed for functionality. see #43
|
diff --git a/cookbooks/wt_streamingcollection/recipes/default.rb b/cookbooks/wt_streamingcollection/recipes/default.rb
index abc1234..def5678 100644
--- a/cookbooks/wt_streamingcollection/recipes/default.rb
+++ b/cookbooks/wt_streamingcollection/recipes/default.rb
@@ -57,5 +57,6 @@ execute "delete_install_source" do
user "root"
group "root"
- run "rm -f /tmp/#{tarball}"
+ execute "rm -f /tmp/#{tarball}"
+ action :run
end
|
Fix the execute resource in streamingcollection
Former-commit-id: 754a691b7d70942367421fda3f49828c95143d8c [formerly 9b59ab7efbf5713065e233c29a79bf1cc44f02ff] [formerly d41ec10e314aaa2d9434ff7678b697c9cf4a4b4b [formerly 99e096defa786188fcc445f38b2cd9dfd30a211b [formerly 0e5ed870a45f6982a2c9d137d59365909cb56cb1]]]
Former-commit-id: 00f65482376f232084f5d511d415f1a8579af1d6 [formerly 5310ded105106312921ae4562d5c5fb1f919b83b]
Former-commit-id: ca186ff0d4005fa89336245860d4082d153fefd3
Former-commit-id: be15f665b4dafe993f95af8ca62a74a1624bc343
|
diff --git a/app/models/rule.rb b/app/models/rule.rb
index abc1234..def5678 100644
--- a/app/models/rule.rb
+++ b/app/models/rule.rb
@@ -22,10 +22,10 @@ end
def self.rule_type_values(key)
- constants = []
+ values = []
Rules.each do |rule|
- constants << Settings.rule_types.send(rule).send(key)
+ values << Settings.rule_types.send(rule).send(key)
end
- constants
+ values
end
end
|
Update array name to more accurately reflect updated purpose of storing any general value
|
diff --git a/app/controllers/projects/refs_controller.rb b/app/controllers/projects/refs_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/projects/refs_controller.rb
+++ b/app/controllers/projects/refs_controller.rb
@@ -37,7 +37,7 @@ 0
end
- @limit = 10
+ @limit = 25
@path = params[:path]
|
Increase commit log amount for tree view from 10 to 25
Signed-off-by: Dmitriy Zaporozhets <be23d75b156792e5acab51b196a2deb155d35d6a@gmail.com>
|
diff --git a/app/controllers/subscriptions_controller.rb b/app/controllers/subscriptions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/subscriptions_controller.rb
+++ b/app/controllers/subscriptions_controller.rb
@@ -1,12 +1,6 @@ class SubscriptionsController < ApplicationController
- before_action :set_subscription, only: [:show, :update, :destroy]
-
- def index
- @subscriptions = Subscription.all
- render json: @subscriptions
- end
-
def show
+ @subscription = current_user.subscription
render json: @subscription
end
@@ -27,25 +21,9 @@ render json: @subscription
end
- def update
- attributes = subscription_params
- attributes.delete(:authenticity_token)
- @subscription.update_attributes attributes
- render json: @subscription
+ private
+ def subscription_params
+ params.require(:account_type)
+ params.permit(:id, :user_id, :expiration, :account_limit, :account_type, :authenticity_token)
end
-
- def destroy
- @subscription.destroy
- render json: @subscription
- end
-
- private
- def subscription_params
- params.require(:account_type)
- params.permit(:id, :user_id, :expiration, :account_limit, :account_type, :authenticity_token)
- end
-
- def set_subscription
- @subscription = Subscription.find subscription_params[:id]
- end
end
|
Remove destructive and enumerative methods from the subscriptions controller, scope show to current_user
|
diff --git a/app/controllers/user_sessions_controller.rb b/app/controllers/user_sessions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/user_sessions_controller.rb
+++ b/app/controllers/user_sessions_controller.rb
@@ -7,8 +7,11 @@ @user = current_user
if @user = login(params[:email], params[:password])
-
- @item = @user.user_votes.last.item_id + 1
+ @item = if @user.user_votes.count == 0
+ Item.first.id
+ else
+ @user.user_votes.last.item_id + 1
+ end
redirect_back_or_to item_url(@item, notice: 'Login successful')
else
|
Fix Last Vote Item Being Nil When User Not Log In
|
diff --git a/app/models/user.rb b/app/models/user.rb
index abc1234..def5678 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -11,7 +11,7 @@ def find_for_github_oauth(user_hash)
user_details = user_data_from_github_data(user_hash)
- if user = User.find_by_github_id(user_details['uid'])
+ if user = User.find_by_github_id(user_details['github_uid'])
user.update_attributes(user_details)
user
else
|
Revert "a small typo => 500 error"
This reverts commit 60a80d41ff88850333f29026b7310c7219a0bc5f.
|
diff --git a/app/models/user.rb b/app/models/user.rb
index abc1234..def5678 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1,6 +1,5 @@ class User < ActiveRecord::Base
- # Include default devise modules. Others available are:
- # :confirmable, :lockable, :timeoutable and :omniauthable
+ validates_presence_of :email, :encrypted_password
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
end
|
Add validation for email and password
|
diff --git a/app/routes/root.rb b/app/routes/root.rb
index abc1234..def5678 100644
--- a/app/routes/root.rb
+++ b/app/routes/root.rb
@@ -5,7 +5,7 @@ end
post '/' do
- link = Link.find_or_create_by(url: params[:url])
+ Link.find_or_create_by(url: params[:url])
redirect to('/')
end
|
Remove unnecessary variable from POST / action
|
diff --git a/config/software/chef-gem.rb b/config/software/chef-gem.rb
index abc1234..def5678 100644
--- a/config/software/chef-gem.rb
+++ b/config/software/chef-gem.rb
@@ -17,7 +17,7 @@ name 'chef-gem'
# The version here should be in agreement with /Gemfile.lock so that our rspec
# testing stays consistent with the package contents.
-default_version '15.13.19'
+default_version '15.14.0'
license 'Apache-2.0'
license_file 'LICENSE'
|
Apply 1 suggestion(s) to 1 file(s)
|
diff --git a/app/helpers/forest_errors_helper.rb b/app/helpers/forest_errors_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/forest_errors_helper.rb
+++ b/app/helpers/forest_errors_helper.rb
@@ -1,7 +1,7 @@ module ForestErrorsHelper
# Display errors that are only visible to admin users
def forest_admin_error(error, options = {})
- if !Rails.env.production?
+ if Rails.env.production?
logger.error("[Forest][AdminError] #{error.class}")
logger.error(error.message)
logger.error(error.backtrace.first(10).join("\n"))
|
Fix forest error logic from testing
|
diff --git a/app/models/spree/order_decorator.rb b/app/models/spree/order_decorator.rb
index abc1234..def5678 100644
--- a/app/models/spree/order_decorator.rb
+++ b/app/models/spree/order_decorator.rb
@@ -8,8 +8,6 @@ ensure_valid_shipments
orig_process_payments!
end
-
- private
def ensure_valid_shipments
if shipments.any?
|
Make order shipment validation a public method
|
diff --git a/app/models/time_based_repo_rater.rb b/app/models/time_based_repo_rater.rb
index abc1234..def5678 100644
--- a/app/models/time_based_repo_rater.rb
+++ b/app/models/time_based_repo_rater.rb
@@ -1,4 +1,5 @@ require "date"
+require_relative "repo_rater"
module HazCommitz
class TimeBasedRepoRater < RepoRater
|
Add require for super class
|
diff --git a/app/views/funded_projects/index.xml.builder b/app/views/funded_projects/index.xml.builder
index abc1234..def5678 100644
--- a/app/views/funded_projects/index.xml.builder
+++ b/app/views/funded_projects/index.xml.builder
@@ -7,7 +7,7 @@ entry.title "#{project.chapter.name} – #{project.title}"
entry.content(project.funded_description, type: 'html')
- if project.has_images? && mime_type = MIME::Types.type_for(project.primary_image.url).first
+ if mime_type = MIME::Types.type_for(project.primary_image.url).first
entry.link(href: image_url(project.primary_image.url), rel: 'enclosure', type: mime_type)
end
|
Revert 601dfd93f230 (which removed images from atom feed if a project had no image)
While technically correct, we use some external services that rely on
an image enclosure to be in place, so just for consistency, we'll
always include an image, even if it's the placeholder.
|
diff --git a/ruby/import_js.rb b/ruby/import_js.rb
index abc1234..def5678 100644
--- a/ruby/import_js.rb
+++ b/ruby/import_js.rb
@@ -8,13 +8,3 @@ require_relative 'import_js/importer'
require_relative 'import_js/vim_editor'
require_relative 'import_js/configuration'
-
-# @deprecated we've moved to JSON configuration, so the old YAML file is no
-# longer supported
-if File.exist?('.importjs')
- fail <<-EOS.split.join(' ')
- [import-js] this project is no longer configured with YAML. Please
- migrate your .importjs file to a JSON file called ".importjs.json"
- instead.'
- EOS
-end
|
Remove warning about deprecated .importjs
This deprecation has been there long enough to serve its purpose. I'm
cleaning it out to stay lean.
|
diff --git a/db/migrate/20140117051315_rename_payment_methods.rb b/db/migrate/20140117051315_rename_payment_methods.rb
index abc1234..def5678 100644
--- a/db/migrate/20140117051315_rename_payment_methods.rb
+++ b/db/migrate/20140117051315_rename_payment_methods.rb
@@ -0,0 +1,13 @@+class RenamePaymentMethods < ActiveRecord::Migration
+ def up
+ execute <<-SQL
+ update spree_payment_methods set type = 'Spree::Gateway::PayPalExpress' WHERE type = 'Spree::BillingIntegration::PaypalExpress'
+ SQL
+ end
+
+ def down
+ execute <<-SQL
+ update spree_payment_methods set type = 'Spree::BillingIntegration::PaypalExpress' WHERE type = 'Spree::Gateway::PayPalExpress'
+ SQL
+ end
+end
|
Fix an issue with old payment methods from the original paypal extension.
Signed-off-by: Nathan Lowrie <nate@finelineautomation.com>
Fixes #58
|
diff --git a/automobile.gemspec b/automobile.gemspec
index abc1234..def5678 100644
--- a/automobile.gemspec
+++ b/automobile.gemspec
@@ -21,5 +21,5 @@
s.add_runtime_dependency 'earth', '~>1.0.0'
s.add_runtime_dependency 'emitter', '~>0.12.0'
- s.add_development_dependency 'sniff', '~>1.0.0'
+ s.add_development_dependency 'sniff', '~> 1.0.0'
end
|
Update sniff dependency to 1.x
|
diff --git a/app/controllers/wor/elfinder_controller.rb b/app/controllers/wor/elfinder_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/wor/elfinder_controller.rb
+++ b/app/controllers/wor/elfinder_controller.rb
@@ -17,14 +17,17 @@ 'application/zip' => ['unzip', '-qq', '-o'],
'application/x-gzip' => ['tar', '-xzf'],
},
- :archivers => {
+ :archivers => {
'application/zip' => ['.zip', 'zip', '-qr9'],
'application/x-gzip' => ['.tgz', 'tar', '-czf'],
},
- :thumbs => true
+ :thumbs => true,
+ :debug => true
).run(params)
headers.merge!(h)
- render (r.empty? ? {:nothing => true} : {:text => r.to_json}), :layout => false
+ render plain: r.to_json
+
+ # render (r.empty? ? {:nothing => true} : {:text => r.to_json}), :layout => false
end
end
|
Fix elfinder error on rails5
|
diff --git a/scripts/config.ru b/scripts/config.ru
index abc1234..def5678 100644
--- a/scripts/config.ru
+++ b/scripts/config.ru
@@ -1,5 +1,5 @@ # Required so that we can set path correctly for Config, which is loaded statically due to a bug in cijoe
-$project_path = File.dirname(__FILE__) + '/app'
+$project_path = File.expand_path(File.dirname(__FILE__) + '/app')
require 'cijoe'
class CIJoe
|
Expand the path so we're always in correct dir
|
diff --git a/config/software/ctl-man.rb b/config/software/ctl-man.rb
index abc1234..def5678 100644
--- a/config/software/ctl-man.rb
+++ b/config/software/ctl-man.rb
@@ -16,7 +16,7 @@ #
name "ctl-man"
-default_version "0.1.0"
+default_version "master"
dependency "private-chef-ctl"
|
Fix version in chef-server-ctl manpage software definition
|
diff --git a/benchmark/instance_counter_performance.rb b/benchmark/instance_counter_performance.rb
index abc1234..def5678 100644
--- a/benchmark/instance_counter_performance.rb
+++ b/benchmark/instance_counter_performance.rb
@@ -0,0 +1,39 @@+#!/usr/bin/env ruby
+
+require 'benchmark'
+require 'active_record'
+require 'sqlite3'
+require File.dirname(__FILE__) + "/../lib/oink.rb"
+require File.dirname(__FILE__) + "/../init"
+
+ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => ':memory:'
+ActiveRecord::Migration.verbose = false
+
+ActiveRecord::Schema.define do
+ create_table :users, :force => true do |t|
+ t.timestamps
+ end
+end
+
+class User < ActiveRecord::Base
+end
+
+Benchmark.bm(15) do |x|
+ x.report "40,000 empty iterations" do
+ 40_000.times {}
+ end
+
+ x.report "without instance type counter - instantiating 40,000 objects" do
+ 40_000.times do
+ User.new
+ end
+ end
+
+ x.report "with instance type counter - instating 40,000 objects" do
+ ActiveRecord::Base.send(:include, Oink::OinkInstanceTypeCounterInstanceMethods)
+
+ 40_000.times do
+ User.new
+ end
+ end
+end
|
Add benchmark for allocating 40k objects with + without oink:
user system total real
40,000 empty iterations 0.000000 0.000000 0.000000 ( 0.002370)
without instance type counter - instantiating 40,000 objects 0.910000 0.020000 0.930000 ( 0.922722)
with instance type counter - instating 40,000 objects 2.620000 0.070000 2.690000 ( 2.700390)
|
diff --git a/benchmarks/output_stringio_vs_tempfile.rb b/benchmarks/output_stringio_vs_tempfile.rb
index abc1234..def5678 100644
--- a/benchmarks/output_stringio_vs_tempfile.rb
+++ b/benchmarks/output_stringio_vs_tempfile.rb
@@ -0,0 +1,31 @@+require 'rubygems'
+require 'bundler/setup'
+require 'benchmark'
+require 'rspec/expectations'
+include RSpec::Matchers
+
+n = 100_000
+
+Benchmark.bm(25) do |bm|
+ bm.report("to_stdout with StringIO") do
+ n.times { expect {}.not_to output('foo').to_stdout }
+ end
+
+ bm.report("to_stdout with Tempfile") do
+ n.times { expect {}.not_to output('foo').to_stdout_from_any_process }
+ end
+
+ bm.report("to_stderr with StringIO") do
+ n.times { expect {}.not_to output('foo').to_stderr }
+ end
+
+ bm.report("to_stderr with Tempfile") do
+ n.times { expect {}.not_to output('foo').to_stderr_from_any_process }
+ end
+end
+
+# user system total real
+# to_stdout with StringIO 0.470000 0.010000 0.480000 ( 0.467317)
+# to_stdout with Tempfile 8.920000 7.420000 16.340000 ( 16.355174)
+# to_stderr with StringIO 0.460000 0.000000 0.460000 ( 0.454059)
+# to_stderr with Tempfile 8.930000 7.560000 16.490000 ( 16.494696)
|
Add benchmarks around `to_std(out|err)_from_any_process` matchers
|
diff --git a/business.gemspec b/business.gemspec
index abc1234..def5678 100644
--- a/business.gemspec
+++ b/business.gemspec
@@ -20,7 +20,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
- spec.add_development_dependency "gc_ruboconfig", "~> 2.33.0"
+ spec.add_development_dependency "gc_ruboconfig", "~> 3.0.1"
spec.add_development_dependency "rspec", "~> 3.1"
spec.add_development_dependency "rspec_junit_formatter", "~> 0.5.1"
spec.add_development_dependency "rubocop", "~> 1.25.0"
|
Update gc_ruboconfig requirement from ~> 2.33.0 to ~> 3.0.1
Updates the requirements on [gc_ruboconfig](https://github.com/gocardless/ruboconfig) to permit the latest version.
- [Release notes](https://github.com/gocardless/ruboconfig/releases)
- [Changelog](https://github.com/gocardless/gc_ruboconfig/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gocardless/ruboconfig/compare/v2.33.0...v3.0.1)
---
updated-dependencies:
- dependency-name: gc_ruboconfig
dependency-type: direct:development
...
Signed-off-by: dependabot[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@github.com>
|
diff --git a/db/migrate/20091123062515_set_poll_and_vote_types.rb b/db/migrate/20091123062515_set_poll_and_vote_types.rb
index abc1234..def5678 100644
--- a/db/migrate/20091123062515_set_poll_and_vote_types.rb
+++ b/db/migrate/20091123062515_set_poll_and_vote_types.rb
@@ -1,39 +1,41 @@ class SetPollAndVoteTypes < ActiveRecord::Migration
- def self.update_type_for_poll_votes(poll, type_name)
- poll.votes.each do |vote|
- vote.update_attribute('type', type_name)
- end
- end
-
- def self.update_type_for_ranking_poll
- RankedVotePage.all(:include => :data).each do |ranked_page|
- poll = ranked_page.data
- next if poll.nil?
-
- poll.update_attribute('type', 'RankingPoll')
- poll.reload
- update_type_for_poll_votes(poll, 'RankingVote')
- end
- end
-
- def self.update_type_for_rating_poll
- RateManyPage.all(:include => :data).each do |ranked_page|
- poll = ranked_page.data
- next if poll.nil?
-
- poll.update_attribute('type', 'RatingPoll')
- poll.reload
- update_type_for_poll_votes(poll, 'RatingVote')
- end
- end
-
def self.up
- update_type_for_ranking_poll
- update_type_for_rating_poll
+ update_poll_type("RankingPoll", "RankedVotePage")
+ update_vote_type("RankingVote", "RankingPoll")
+ update_poll_type("RatingPoll", "RateManyPage")
+ update_vote_type("RatingVote", "RatingPoll")
end
def self.down
Poll.update_all('type = NULL')
+ Vote.update_all('type = NULL')
end
+
+ protected
+
+ def self.update_poll_type(poll_type, page_type)
+ sql = <<-EOSQL
+ UPDATE polls,pages
+ SET polls.type="#{poll_type}"
+ WHERE polls.id=pages.data_id
+ AND polls.type IS NULL
+ AND pages.data_type="Poll"
+ AND pages.type="#{page_type}"
+ EOSQL
+ Poll.connection.execute sql
+ end
+
+ def self.update_vote_type(vote_type, poll_type)
+ sql = <<-EOSQL
+ UPDATE polls,votes
+ SET votes.type="#{vote_type}"
+ WHERE polls.id=votes.votable_id
+ AND votes.type IS NULL
+ AND ( votes.votable_type="Poll" OR votes.votable_type IS NULL )
+ AND polls.type="#{poll_type}"
+ EOSQL
+ Vote.connection.execute sql
+ end
+
end
|
Use pure sql to migrate poll and vote types
|
diff --git a/week-6/gps.rb b/week-6/gps.rb
index abc1234..def5678 100644
--- a/week-6/gps.rb
+++ b/week-6/gps.rb
@@ -0,0 +1,42 @@+# Your Names
+# 1)
+# 2)
+
+# We spent [#] hours on this challenge.
+
+# Bakery Serving Size portion calculator.
+
+def serving_size_calc(item_to_make, order_quantity)
+ library = {"cookie" => 1, "cake" => 5, "pie" => 7}
+ error_counter = 3
+
+ library.each do |food|
+ if library[food] != library[item_to_make]
+ p error_counter += -1
+ end
+ end
+
+ if error_counter > 0
+ raise ArgumentError.new("#{item_to_make} is not a valid input")
+ end
+
+ serving_size = library.values_at(item_to_make)[0]
+ serving_size_mod = order_quantity % serving_size
+
+ case serving_size_mod
+ when 0
+ return "Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}"
+ else
+ return "Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}, you have #{serving_size_mod} leftover ingredients. Suggested baking items: TODO: MAKE THIS FEATURE"
+ end
+end
+
+p serving_size_calc("pie", 7)
+p serving_size_calc("pie", 8)
+p serving_size_calc("cake", 5)
+p serving_size_calc("cake", 7)
+p serving_size_calc("cookie", 1)
+p serving_size_calc("cookie", 10)
+p serving_size_calc("THIS IS AN ERROR", 5)
+
+# Reflection
|
Add blank file for GPS
|
diff --git a/app/helpers/sandbox_helper.rb b/app/helpers/sandbox_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/sandbox_helper.rb
+++ b/app/helpers/sandbox_helper.rb
@@ -3,7 +3,7 @@ content_tag(:div, nil, class: 'download-and-submit') do
content_tag(:div, nil, class: 'download-report') do
content_tag(:i, nil, class: 'fa fa-download') +
- link_to(t('download_report_on_errors'), '#', class: 'bold')
+ link_to(t('download_report_on_errors'), download_error_report_path, class: 'bold')
end +
content_tag(:div, nil, class: 'submit-shipments') do
validation_errors = @annual_report_upload.validation_errors
|
Add download functionality to download link in errors page
|
diff --git a/app/mailers/contact_mailer.rb b/app/mailers/contact_mailer.rb
index abc1234..def5678 100644
--- a/app/mailers/contact_mailer.rb
+++ b/app/mailers/contact_mailer.rb
@@ -23,11 +23,10 @@ mail(subject: @message.subject, bcc: @emails)
end
- def payment_reminder(message, emails, event)
+ def payment_reminder(message, email, event)
@event = event
@message = message
- @emails = emails
- mail(subject: @message.subject, bcc: @emails)
+ mail(subject: @message.subject, to: email)
end
def registration_reminder(message, email)
|
Fix to be `to` instead of `bcc`
|
diff --git a/app/models/split_time_data.rb b/app/models/split_time_data.rb
index abc1234..def5678 100644
--- a/app/models/split_time_data.rb
+++ b/app/models/split_time_data.rb
@@ -4,16 +4,16 @@ # The time zone parsing methods in Rails are slow and create an unacceptable delay
# when working with many objects, particularly in a full spread view.
-# SplitTimeData is designed to receive both an absolute_time string
-# and a localized (day_and_time) string from the database query.
+# SplitTimeData receives both a non-localized absolute_time_string and a localized
+# absolute_time_local_string from the database query.
-SplitTimeData = Struct.new(:id, :effort_id, :lap, :split_id, :bitkey, :stopped_here, :pacer, :data_status_numeric, :absolute_time_string,
- :absolute_time_local_string, :time_from_start, :segment_time, :military_time, keyword_init: true) do
+SplitTimeData = Struct.new(:id, :effort_id, :lap, :split_id, :bitkey, :stopped_here, :pacer, :data_status_numeric,
+ :absolute_time_string, :absolute_time_local_string, :time_from_start, :segment_time,
+ :military_time, keyword_init: true) do
include TimePointMethods
# absolute_time is an ActiveSupport::TimeWithZone for compatibility and useful math operations.
-
def absolute_time
absolute_time_string&.in_time_zone('UTC')
end
@@ -21,7 +21,6 @@ # absolute_time_local is a Ruby DateTime object for speed of conversion.
# The events/spread view relies on this attribute and slows unacceptably
# when it is parsed into an ActiveSupport::TimeWithZone object.
-
def absolute_time_local
absolute_time_local_string&.to_datetime
end
|
Improve docs in SplitTimeData model
|
diff --git a/feeds/stock.rb b/feeds/stock.rb
index abc1234..def5678 100644
--- a/feeds/stock.rb
+++ b/feeds/stock.rb
@@ -1,3 +1,5 @@+app.feed(:silent, desc: "don't show anything") { false }
+
app.feed(:hidden, desc: "include hidden") { $rec.hidden? }
app.feed(:visible, desc: "exclude hidden") { !$rec.hidden? || app.opts[:show_hidden] }
|
Add silent feed (for benchmark)
|
diff --git a/test/test_zip_tuples.rb b/test/test_zip_tuples.rb
index abc1234..def5678 100644
--- a/test/test_zip_tuples.rb
+++ b/test/test_zip_tuples.rb
@@ -0,0 +1,25 @@+# -*- encoding : utf-8 -*-
+require File.expand_path(File.dirname(__FILE__)) + '/helper'
+
+class ZipTuplesTest < Test::Unit::TestCase
+ include Tracksperanto::ZipTuples
+
+ def test_zip_with_empty
+ assert_equal [], zip_curve_tuples([])
+ end
+
+ def test_zip_with_standard_dataset
+ assert_equal [[1, 123, 234]], zip_curve_tuples([[1, 123], [1,234]])
+ end
+
+ def test_zip_with_missing_step
+ assert_equal [[1, 123, 345], [2, 234]], zip_curve_tuples([[1, 123], [1, 345], [2,234]])
+ end
+
+ def test_zip_with_two_curves
+ curve_a = [[1, 123], [2, 345]]
+ curve_b = [[1, 23.4], [2, 14.5]]
+ result = [[1, 123, 23.4], [2, 345, 14.5]]
+ assert_equal result, zip_curve_tuples(curve_a, curve_b)
+ end
+end
|
Add a test for tuple zipper
|
diff --git a/Opus-ios.podspec b/Opus-ios.podspec
index abc1234..def5678 100644
--- a/Opus-ios.podspec
+++ b/Opus-ios.podspec
@@ -1,5 +1,5 @@ Pod::Spec.new do |s|
- s.name = "Opus-iOS"
+ s.name = "Opus-ios"
s.version = "1.0"
s.summary = "iOS build scripts for the Opus Codec."
s.homepage = "https://chatsecure.org"
|
Fix spec name in podspec.
|
diff --git a/git-hooks/dont-commit-github-token.rb b/git-hooks/dont-commit-github-token.rb
index abc1234..def5678 100644
--- a/git-hooks/dont-commit-github-token.rb
+++ b/git-hooks/dont-commit-github-token.rb
@@ -1,4 +1,5 @@ #!/usr/bin/ruby
+# pre-commit hook
gitconfig = File.expand_path("./gitconfig")
|
Add a note which hook is meant for the git-hook
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -13,7 +13,6 @@ map.resources :users
map.resources :home, :collection => {:mock_set => :get}
map.claim '/claim', :controller => :claim
- map.connect '/intro', :controller => :intro
map.home '', :controller => 'home', :actions => 'index'
map.usage '/usage', :controller => 'usage'
|
Remove reference to unused controller.
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -9,9 +9,11 @@ namespace :api, defaults: { format: 'json' } do
resources :patients, only: [] do
resources :consultations, only: [:index] do
- post 'previous', on: :collection
- post 'next', on: :collection
- post 'last', on: :collection
+ collection do
+ post 'previous'
+ post 'next'
+ post 'last'
+ end
end
end
|
Use collection as a block
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -5,7 +5,7 @@ get '/logout', :to => 'auth#logout', :as => :logout
get '/loginerror', :to => 'auth#unauthenticated'
get '/auth/federation', :to => 'auth#federation_login'
- get '/auth/development', :to => 'auth#development_login'
+ post '/auth/development', :to => 'auth#development_login'
end
end
|
Fix routing for /auth/development which should have been POST
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -6,10 +6,12 @@ get '/login', to: 'sessions#new', as: :login
get '/logout', to: 'sessions#destroy', as: :logout
- resources :timeslots, only: [:update, :show, :destroy]
+ resources :timeslots, only: [:update, :show]
namespace :api, defaults: {format: :json} do
+
patch 'timeslots/:id/cancel', to: 'timeslots#cancel', as: :cancel
- resources :timeslots, only: [:index, :create, :update]
+ resources :timeslots, only: [:index, :create, :update, :destroy]
+
end
end
|
Move destroy route to api timeslots controller
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,4 +1,5 @@ Rails.application.routes.draw do
+ root "sessions#new"
resources :users, except: :index
resources :videos
resources :descriptions, except: :index
|
Set login as root page
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -47,8 +47,8 @@
# Make sure this routeset is defined last
namespace :api, path: '/' do
- get '/(*locale)/categories(.:format)' => 'category_contents#index'
- get '/(*locale)/categories/(*id)(.:format)' => 'category_contents#show'
+ get '/:locale/categories(.:format)' => 'category_contents#index'
+ get '/:locale/categories/(*id)(.:format)' => 'category_contents#show'
get '/preview(/*cms_path)(.:format)' => 'content#preview', as: 'preview_content'
get '/(*cms_path)(.:format)' => 'content#show', as: 'content'
end
|
Remove wildcard matcher on category path
|
diff --git a/plugins/simple_tracker/lib/db.rb b/plugins/simple_tracker/lib/db.rb
index abc1234..def5678 100644
--- a/plugins/simple_tracker/lib/db.rb
+++ b/plugins/simple_tracker/lib/db.rb
@@ -12,6 +12,31 @@
Jetpants.topology.tracker.spares = spares
Jetpants.topology.update_tracker_data
+ end
+
+ def cleanup_spare!
+ # If the node is already a valid spare, do not do anything
+ return true if probe! && usable_spare?
+
+ if running?
+ datadir = mysql_root_cmd('select @@datadir;').chomp("\n/")
+ mysql_root_cmd("PURGE BINARY LOGS BEFORE NOW();") rescue nil
+ else
+ datadir = '/var/lib/mysql'
+ end
+
+ stop_mysql
+ output "Initializing the MySQL data directory"
+ ssh_cmd [
+ "rm -rf #{datadir}/*",
+ '/usr/bin/mysql_install_db'
+ ], 1
+
+ output service(:start, 'mysql')
+ confirm_listening
+ @running = true
+
+ usable_spare?
end
##### CALLBACKS ############################################################
|
Implement cleanup_spare! in the simple_tracker plugin
|
diff --git a/jekyll-sitemap.gemspec b/jekyll-sitemap.gemspec
index abc1234..def5678 100644
--- a/jekyll-sitemap.gemspec
+++ b/jekyll-sitemap.gemspec
@@ -1,16 +1,21 @@-Gem::Specification.new do |s|
- s.name = "jekyll-sitemap"
- s.summary = "Automatically generate a sitemap.xml for your Jekyll site."
s.version = "0.4.1"
- s.authors = ["GitHub, Inc."]
- s.email = "support@github.com"
- s.homepage = "https://github.com/github/jekyll-sitemap"
- s.licenses = ["MIT"]
+# coding: utf-8
- s.files = Dir["lib/*"]
- s.require_paths = ["lib"]
+Gem::Specification.new do |spec|
+ spec.name = "jekyll-sitemap"
+ spec.summary = "Automatically generate a sitemap.xml for your Jekyll site."
+ spec.authors = ["GitHub, Inc."]
+ spec.email = "support@github.com"
+ spec.homepage = "https://github.com/jekyll/jekyll-sitemap"
+ spec.licenses = ["MIT"]
- s.add_dependency "jekyll", "~> 2.0"
- s.add_development_dependency "rspec", "~> 3.0"
- s.add_development_dependency "rake"
+ spec.files = `git ls-files -z`.split("\x0")
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
+ spec.require_paths = ["lib"]
+
+ spec.add_development_dependency "jekyll", "~> 2.0"
+ spec.add_development_dependency "rspec", "~> 3.0"
+ spec.add_development_dependency "rake"
+ spec.add_development_dependency "bundler", "~> 1.6"
end
|
Bring the spec into the 21st century
|
diff --git a/lib/bitcoin/network/peer_discovery.rb b/lib/bitcoin/network/peer_discovery.rb
index abc1234..def5678 100644
--- a/lib/bitcoin/network/peer_discovery.rb
+++ b/lib/bitcoin/network/peer_discovery.rb
@@ -24,8 +24,9 @@ Socket.getaddrinfo(seed, Bitcoin.chain_params.default_port).map{|a|a[2]}.uniq
rescue SocketError => e
logger.error "SocketError occurred when load DNS seed: #{seed}, error: #{e.message}"
+ nil
end
- }.flatten
+ }.flatten.compact
end
end
|
Fix a bug that contains an incorrect IP when an error occurs when searching seeds
|
diff --git a/lib/bodogem/slack_interface/client.rb b/lib/bodogem/slack_interface/client.rb
index abc1234..def5678 100644
--- a/lib/bodogem/slack_interface/client.rb
+++ b/lib/bodogem/slack_interface/client.rb
@@ -8,13 +8,13 @@ def initialize(channel_name)
@client = Bodogem::SlackInterface::Client.connect
@channel = @client.web_client.channels_list['channels'].detect { |c| c['name'] == channel_name }
- @router = Bodogem::SlackInterface::Router.new
+ @router = nil
@client.on :message do |data|
- if current_channel?(data) && !self_message?(data)
+ if current_channel?(data) && !self_message?(data) && router
# TODO: Logger
p data
- @router.dispatch(data['text'])
+ router.dispatch(data['text'])
end
end
end
|
Set null to default router
|
diff --git a/lib/builderator/patch/thor-actions.rb b/lib/builderator/patch/thor-actions.rb
index abc1234..def5678 100644
--- a/lib/builderator/patch/thor-actions.rb
+++ b/lib/builderator/patch/thor-actions.rb
@@ -30,7 +30,10 @@ io.write(input)
## Stream output
- output.write(io.readpartial(4096)) until io.eof?
+ loop do
+ output.write(io.readpartial(4096))
+ output.flush
+ end until io.eof?
end
end
|
Call flush on STDOUT to make Jenkins print it correctly
|
diff --git a/puppet-lint-duplicate_class_parameters-check.gemspec b/puppet-lint-duplicate_class_parameters-check.gemspec
index abc1234..def5678 100644
--- a/puppet-lint-duplicate_class_parameters-check.gemspec
+++ b/puppet-lint-duplicate_class_parameters-check.gemspec
@@ -22,7 +22,7 @@ spec.add_development_dependency 'rspec', '~> 3.9.0'
spec.add_development_dependency 'rspec-its', '~> 1.0'
spec.add_development_dependency 'rspec-collection_matchers', '~> 1.0'
- spec.add_development_dependency 'rubocop', '~> 0.78.0'
+ spec.add_development_dependency 'rubocop', '~> 0.79.0'
spec.add_development_dependency 'rake', '~> 13.0.0'
spec.add_development_dependency 'rspec-json_expectations', '~> 2.2'
spec.add_development_dependency 'simplecov', '~> 0.17.1'
|
Update rubocop requirement from ~> 0.78.0 to ~> 0.79.0
Updates the requirements on [rubocop](https://github.com/rubocop-hq/rubocop) to permit the latest version.
- [Release notes](https://github.com/rubocop-hq/rubocop/releases)
- [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop-hq/rubocop/compare/v0.78.0...v0.79.0)
Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
|
diff --git a/lib/computer_player.rb b/lib/computer_player.rb
index abc1234..def5678 100644
--- a/lib/computer_player.rb
+++ b/lib/computer_player.rb
@@ -15,7 +15,7 @@ when :random then Random.new
when :min_max then MinMax.new
else
- raise ArgumentError, "Bad strategy: %s" % game_strategy
+ raise ArgumentError, "Bad strategy: #{game_strategy.inspect}"
end
end
|
Use interpolation rather than sprintf
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.