diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/lib/commands/settings.rb b/lib/commands/settings.rb
index abc1234..def5678 100644
--- a/lib/commands/settings.rb
+++ b/lib/commands/settings.rb
@@ -0,0 +1,28 @@+# encoding: utf-8
+
+# Commands that deal with the settings file
+
+class PoddingCLI < Thor
+ desc "use NAME", "use project NAME to execute commands in (a project is one podding installation, specified in ~/.podding)"
+ def use(name)
+ if namespace_exists?( name )
+ set_default_namespace(name)
+ say "Now using podding '#{ name }' in #{ Settings.podding_root }.", :green
+ else
+ say "Podding #{ name } doesn't exist (yet).", :red
+
+ if "y" == ask( "Would you like to add it to your settings? (y/n)" )
+ invoke :add, [ name ]
+ set_default_namespace( name )
+ say "Set #{ name } as new default podding."
+ end # else terminate without doing anything
+ end
+ end
+
+ desc "add NAME", "add a new podding entry with NAME to ~/.podding file"
+ def add(name)
+ path = ask "Where is your podding installation located? (Please supply absolute path)"
+ create_namespace( name, path )
+ say "Added podding #{ name } to ~/.podding!", :green
+ end
+end
|
Add commands to deal with different podding installations
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -0,0 +1,60 @@+$:.unshift File.expand_path('..', __FILE__)
+$:.unshift File.expand_path('../../lib', __FILE__)
+require 'coveralls'
+Coveralls.wear_merged!
+require 'rspec'
+require 'vcr'
+require 'exlibris-nyu'
+require 'pry'
+
+# Use the included testmnt for testing.
+Exlibris::Aleph.configure do |config|
+ config.tab_path = "#{File.dirname(__FILE__)}/../test/mnt/aleph_tab" if ENV['CI']
+ config.yml_path = "#{File.dirname(__FILE__)}/../spec/config/aleph" if ENV['CI']
+end
+
+def aleph_host
+ @aleph_host ||= (ENV['ALEPH_HOST'] || 'aleph.library.edu')
+end
+
+def aleph_username
+ @aleph_username ||= (ENV['ALEPH_USERNAME'] || "USERNAME")
+end
+
+def aleph_password
+ @aleph_password ||= (ENV['ALEPH_PASSWORD'] || "PASSWORD")
+end
+
+def aleph_email
+ @aleph_email ||= (ENV['ALEPH_EMAIL'] || "username@library.edu")
+end
+
+def aleph_library
+ @aleph_library ||= (ENV['ALEPH_LIBRARY'] || "ADM50")
+end
+
+def aleph_sub_library
+ @aleph_sub_library ||= (ENV['ALEPH_SUB_LIBRARY'] || "SUB")
+end
+
+VCR.configure do |c|
+ c.cassette_library_dir = 'spec/vcr_cassettes'
+ c.configure_rspec_metadata!
+ c.hook_into :webmock
+ c.filter_sensitive_data("aleph.library.edu") { aleph_host }
+ c.filter_sensitive_data("USERNAME") { aleph_username }
+ c.filter_sensitive_data("username") { aleph_username.downcase }
+ c.filter_sensitive_data("verification=PASSWORD") { "verification=#{aleph_password}" }
+ c.filter_sensitive_data("username@library.edu") { aleph_email }
+ c.filter_sensitive_data("ADM50") { aleph_library }
+ c.filter_sensitive_data("SUB") { aleph_sub_library }
+end
+
+RSpec.configure do |config|
+ config.expect_with :rspec do |c|
+ c.syntax = :expect
+ end
+ # so we can use :vcr rather than :vcr => true;
+ # in RSpec 3 this will no longer be necessary.
+ config.treat_symbols_as_metadata_keys_with_true_values = true
+end
|
Add RSpec helper with initial configuration for filtering VCR sensitive data, expectation syntax, load paths, etc.
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,6 +1,7 @@ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
ENV["RELIABLE_TIMEOUT"] = "1"
ENV["RELIABLE_TIME_TRAVEL_DELAY"] = "1"
+ENV["REDIS_URI"] = "redis://127.0.0.1:6379/0"
require 'reliable'
RSpec.configure do |config|
|
Use localhost redis for specs
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -5,12 +5,14 @@ #
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
-require 'simplecov'
-require 'simplecov-rcov'
-SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
-SimpleCov.start do
- add_filter "spec"
- add_filter "vendor/bundler_gems"
+if ENV["COVERAGE"]
+ require 'simplecov'
+ require 'simplecov-rcov'
+ SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
+ SimpleCov.start do
+ add_filter "spec"
+ add_filter "vendor/bundler_gems"
+ end
end
require 'backup_jenkins'
|
Load simplecov only if environment variable is present
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -26,6 +26,8 @@ is :list, :scope => :user_id
end
+DataMapper.finalize
+
module TodoListHelper
##
# Keep things DRY shortcut
|
Call DataMapper.finalize after model definition
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -10,6 +10,8 @@ require "lita/rspec"
RSpec.configure do |config|
+ config.include Lita::RSpec
+
config.before do
allow(Lita).to receive(:logger).and_return(double("Logger").as_null_object)
end
|
Include Lita::RSpec to for the Redis test isolation.
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -14,7 +14,7 @@ RSpec.configure do |config|
config.use_transactional_fixtures = true
- config.after(:each) do
- sign_out!
+ config.before(:each) do
+ sign_out! # stubs out the current_user method to return nil
end
end
|
Call sign_out! *before* each spec, so that current_user is always set no matter what
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -2,3 +2,14 @@
$:.unshift File.dirname(__FILE__)
require "rails_app/config/environment"
+require 'rspec/rails'
+require 'rspec/autorun'
+
+require "capybara/rspec"
+require "capybara/rails"
+
+RSpec.configure do |config|
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
+ config.use_transactional_fixtures = true
+ config.infer_base_class_for_anonymous_controllers = false
+end
|
Add a proper spec helper for using Capybara+Rails
|
diff --git a/plugins/other/graceful-shutdown-check.rb b/plugins/other/graceful-shutdown-check.rb
index abc1234..def5678 100644
--- a/plugins/other/graceful-shutdown-check.rb
+++ b/plugins/other/graceful-shutdown-check.rb
@@ -0,0 +1,82 @@+#! /usr/bin/env ruby
+#
+# Graceful Shutdown Monitor
+# ===
+#
+# DESCRIPTION:
+# This check is responsible for removing clients from Sensu who have
+# graceful shutdown stashes associated with them, in an effort
+# to reduce the chance of a keepalive handler firing for them.
+#
+# PLATFORMS:
+# all
+#
+# DEPENDENCIES:
+# gem: sensu-plugin
+#
+# NOTES:
+# This check should be run where it can have access to the API server,
+# which is usually the sensu-server.
+#
+# This check should be run more frequently than the warning keepalive
+# handler time.
+#
+# LICENSE:
+# Copyright 2014 Yieldbot, Inc <devops@yieldbot.com>
+# Released under the same terms as Sensu (the MIT license); see LICENSE
+# for details.
+#
+
+require 'rubygems' if RUBY_VERSION < '1.9.0'
+require 'net/http'
+require 'sensu-plugin/check/cli'
+require 'sensu-plugin/utils'
+require 'json'
+
+class GracefulShutdownCheck < Sensu::Plugin::Check::CLI
+ include Sensu::Plugin::Utils
+
+ def api_request(method, path, &blk)
+ http = Net::HTTP.new(settings['api']['host'], settings['api']['port'])
+ req = net_http_req_class(method).new(path)
+ if settings['api']['user'] && settings['api']['password']
+ req.basic_auth(settings['api']['user'], settings['api']['password'])
+ end
+ yield(req) if block_given?
+ http.request(req)
+ end
+
+ def delete_sensu_client!(client)
+ api_request(:DELETE, "/clients/#{client}")
+ end
+
+ def graceful_clients
+ keyspace = settings['graceful-shutdown']['keyspace']
+
+ # Get a list of the stashes
+ response = api_request(:GET, '/stashes')
+
+ # Make sure we are able to retrieve the stathses
+ critical 'Unable to retrieve stashes' if response.code != '200'
+
+ #
+ all_stashes = JSON.parse(response.body)
+
+ # Filter the stathes
+ filtered_stashes = []
+ all_stashes.each do |stash|
+ if match = stash['path'].match(/^#{keyspace}\/(.*)/)
+ filtered_stashes << match.captures[0]
+ end
+ end
+
+ filtered_stashes
+ end
+
+ def run
+ graceful_clients.each do |client|
+ delete_sensu_client!(client)
+ end
+ ok
+ end
+end
|
Add graceful shutdown check that assists in client cleanup
|
diff --git a/app/models/clock.rb b/app/models/clock.rb
index abc1234..def5678 100644
--- a/app/models/clock.rb
+++ b/app/models/clock.rb
@@ -24,4 +24,17 @@ from_user.hand = 1
from_user.save!
end
+
+ module SortedStatuses
+ # Returns the same data as before, but sorts the list of statuses by their LCD
+ # number. (Intending so that the status with LCD 0 is at the top of the list.)
+ def statuses
+ super.sort_by do |status|
+ status.lcd
+ end
+ end
+ end
+
+ include SortedStatuses
end
+
|
Sort the list of statuses by LCD
Goal is to fix the weird order the statuses are showing up in production. This
is probably because the order of the list returned by PostgreSQL is different
than SQLite.
|
diff --git a/features/step_definitions/lockfile_steps.rb b/features/step_definitions/lockfile_steps.rb
index abc1234..def5678 100644
--- a/features/step_definitions/lockfile_steps.rb
+++ b/features/step_definitions/lockfile_steps.rb
@@ -22,6 +22,15 @@ }
end
+When 'I edit the lockfile as:' do |content|
+ steps %Q{
+ Given a lockfile with:
+ """
+ #{content}
+ """
+ }
+end
+
Then /^(?:a|the) lockfile is (?:created|updated) with:$/ do |content|
# For some reason, Cucumber drops the last newline from every docstring...
steps %Q{
|
Add a step to edit a lockfile
|
diff --git a/business.gemspec b/business.gemspec
index abc1234..def5678 100644
--- a/business.gemspec
+++ b/business.gemspec
@@ -23,5 +23,5 @@ spec.add_development_dependency "gc_ruboconfig", "~> 2.24.0"
spec.add_development_dependency "rspec", "~> 3.1"
spec.add_development_dependency "rspec_junit_formatter", "~> 0.4.1"
- spec.add_development_dependency "rubocop", "~> 1.10.0"
+ spec.add_development_dependency "rubocop", "~> 1.13.0"
end
|
Update rubocop requirement from ~> 1.10.0 to ~> 1.13.0
Updates the requirements on [rubocop](https://github.com/rubocop/rubocop) to permit the latest version.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.10.0...v1.13.0)
Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
|
diff --git a/vendor/buildr/buildr-osgi-runtime/lib/buildr/osgi/container.rb b/vendor/buildr/buildr-osgi-runtime/lib/buildr/osgi/container.rb
index abc1234..def5678 100644
--- a/vendor/buildr/buildr-osgi-runtime/lib/buildr/osgi/container.rb
+++ b/vendor/buildr/buildr-osgi-runtime/lib/buildr/osgi/container.rb
@@ -5,7 +5,7 @@
def initialize(runtime)
@runtime = runtime
- @parameters = {}
+ @parameters = OrderedHash.new
end
def []=(key, value)
|
Use an ordered has for parameters
|
diff --git a/test/countries/us_test.rb b/test/countries/us_test.rb
index abc1234..def5678 100644
--- a/test/countries/us_test.rb
+++ b/test/countries/us_test.rb
@@ -0,0 +1,14 @@+require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+
+## United States
+class USTest < Test::Unit::TestCase
+
+ def test_local
+ parse_test('+1 555 123 4567', '1', '555', '1234567')
+ end
+
+ def test_tollfree
+ parse_test('+1 800 555 3456', '1', '800', '5553456')
+ end
+
+end
|
Add US tests for completeness
|
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", "~> 3.1.0"
+ spec.add_development_dependency "gc_ruboconfig", "~> 3.2.0"
spec.add_development_dependency "rspec", "~> 3.1"
spec.add_development_dependency "rspec_junit_formatter", "~> 0.5.1"
spec.add_development_dependency "rubocop", "~> 1.29.1"
|
Update gc_ruboconfig requirement from ~> 3.1.0 to ~> 3.2.0
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/commits)
---
updated-dependencies:
- dependency-name: gc_ruboconfig
dependency-type: direct:development
...
Signed-off-by: dependabot[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@github.com>
|
diff --git a/generators/configured_components.rb b/generators/configured_components.rb
index abc1234..def5678 100644
--- a/generators/configured_components.rb
+++ b/generators/configured_components.rb
@@ -27,12 +27,14 @@ }
def component_types
- %w[test mock script renderer orm]
+ @component_types
end
+ # Defines a class option to allow a component to be chosen and add to component type list
# component_option :test, "Testing framework", :aliases => '-t'
def component_option(name, description, options = {})
class_option name, :default => default_for(name), :aliases => options[:aliases]
+ (@component_types ||= []) << name.to_s
end
def default_for(component)
|
Remove the need to define component_types twice (autocreate list)
|
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -31,6 +31,7 @@ #Don't redirect on JS send Created with info instead!
respond_to do |format|
format.html { redirect_to files_path(:tags=>selected_tags) }
+ format.json { render :location=>url_for(@file), :status=>201 }
end
end
|
Set location and status on json response
|
diff --git a/app/serializers/event_serializer.rb b/app/serializers/event_serializer.rb
index abc1234..def5678 100644
--- a/app/serializers/event_serializer.rb
+++ b/app/serializers/event_serializer.rb
@@ -1,5 +1,5 @@ class EventSerializer < ActiveModel::Serializer
- attributes :id, :title, :event_type, :start_time, :end_time, :start_date, :end_date, :description, :address, :skills_needed, :minimum_age, :url
+ attributes :id, :title, :start_time, :end_time, :start_date, :end_date, :description, :address, :skills_needed, :minimum_age, :url
has_one :cause
end
|
Remove event_type attribute causing AMS to fail
|
diff --git a/app/serializers/place_serializer.rb b/app/serializers/place_serializer.rb
index abc1234..def5678 100644
--- a/app/serializers/place_serializer.rb
+++ b/app/serializers/place_serializer.rb
@@ -1,9 +1,16 @@ class PlaceSerializer < ActiveModel::Serializer
- attributes :id, :name, :created_at
+ include Rails.application.routes.url_helpers
+
+ attributes :id, :name, :created_at, :category, :links
belongs_to :category
def id
object.external_id
end
+
+ def links
+ # TODO(toru): Stop hard coding the host
+ [{ self: place_url(object.external_id, host: 'api.torumk.com') }]
+ end
end
|
Add a `links` object to place representation
|
diff --git a/lib/active_admin/inputs/filters/select_input.rb b/lib/active_admin/inputs/filters/select_input.rb
index abc1234..def5678 100644
--- a/lib/active_admin/inputs/filters/select_input.rb
+++ b/lib/active_admin/inputs/filters/select_input.rb
@@ -7,7 +7,7 @@ def input_name
return method if seems_searchable?
- searchable_method_name.concat multiple? ? '_in' : '_eq'
+ searchable_method_name + (multiple? ? '_in' : '_eq')
end
def searchable_method_name
|
Fix select input name concatenation
Do not modify the source string when appending '_in' or '_eq' to
searchable_method_name otherwise it gets appended at each call.
Example: `payment_type_code_eq_eq_eq_eq_eq_eq_eq_eq_eq_eq`
Fixes #4121.
|
diff --git a/lib/remockable/active_model/allow_values_for.rb b/lib/remockable/active_model/allow_values_for.rb
index abc1234..def5678 100644
--- a/lib/remockable/active_model/allow_values_for.rb
+++ b/lib/remockable/active_model/allow_values_for.rb
@@ -3,22 +3,18 @@ @values = attributes_and_values
match_for_should do |actual|
- instance = subject.class.new
-
@values.all? do |value|
- instance.stub(@attribute).and_return(value)
- instance.valid?
- instance.errors[@attribute].empty?
+ subject.stub(@attribute).and_return(value)
+ subject.valid?
+ subject.errors[@attribute].empty?
end
end
match_for_should_not do |actual|
- instance = subject.class.new
-
@values.none? do |value|
- instance.stub(@attribute).and_return(value)
- instance.valid?
- instance.errors[@attribute].empty?
+ subject.stub(@attribute).and_return(value)
+ subject.valid?
+ subject.errors[@attribute].empty?
end
end
|
Use the subject instead of making a new instance.
This allows the subject to be configured ahead of time for validations
that rely on other attribute values within the instance.
|
diff --git a/app/controllers/payments_controller.rb b/app/controllers/payments_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/payments_controller.rb
+++ b/app/controllers/payments_controller.rb
@@ -8,6 +8,7 @@ intent = Stripe::PaymentIntent.create({
amount: (@amount * 100).to_i,
currency: 'usd',
+ receipt_email: @user.email,
metadata: {
user_id: @user.id
}
|
Add receipt_email so users can get automatic receipts for payments from Stripe
|
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -4,7 +4,14 @@ auth = request.env['omniauth.auth']
user = User.create_auth(auth)
session[:user_id] = user.id
- redirect_to twitter_path
+ case auth['provider']
+ when 'twitter'
+ redirect_to twitter_path
+ when 'github'
+ redirect_to github_path
+ else
+ redirect_to root_path
+ end
end
def destroy
|
:boom: Switch redirect path between twitter and github when login
|
diff --git a/app/controllers/tracking_controller.rb b/app/controllers/tracking_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/tracking_controller.rb
+++ b/app/controllers/tracking_controller.rb
@@ -6,6 +6,7 @@
def track
coordinate = @track.coordinates.build params
+ coordinate.time = Time.at(params[:millis].to_i / 1000) if params[:millis]
coordinate.user_id = @user.id
if coordinate.save
head :ok
|
Introduce param for time in milliseconds
|
diff --git a/haxby.rb b/haxby.rb
index abc1234..def5678 100644
--- a/haxby.rb
+++ b/haxby.rb
@@ -4,10 +4,10 @@ homepage 'https://github.com/tabletcorry/haxby'
head "git://github.com/tabletcorry/haxby.git"
- depends_on 'coreutils'
+ depends_on 'coreutils' # Specifically greadlink
def install
- bin.install ['bin/haxby']
+ bin.install Dir['bin/*']
(share+'haxby').install Dir['lib/*']
end
end
|
Clean up formula a bit, add comments
|
diff --git a/app/models/edition/related_policies.rb b/app/models/edition/related_policies.rb
index abc1234..def5678 100644
--- a/app/models/edition/related_policies.rb
+++ b/app/models/edition/related_policies.rb
@@ -5,10 +5,7 @@
included do
has_many :related_policies, through: :related_documents, source: :latest_edition, class_name: 'Policy'
- end
-
- def published_related_policies
- related_policies.published
+ has_many :published_related_policies, through: :related_documents, source: :published_edition, class_name: 'Policy'
end
# Ensure that when we set policy ids we don't remove other types of edition from the array
|
Fix bug with published related policies.
Mapping to #latest_edition then filtering by
published will get you false negatives if the
policy has a newer unpublished edition.
|
diff --git a/spec/customer_builder_spec.rb b/spec/customer_builder_spec.rb
index abc1234..def5678 100644
--- a/spec/customer_builder_spec.rb
+++ b/spec/customer_builder_spec.rb
@@ -0,0 +1,66 @@+require 'spec_helper'
+
+describe Vend::CustomerBuilder do
+ let(:customer_with_id) { {
+ 'id' => 'a123771197',
+ 'firstname' => 'Brian XX',
+ 'lastname' => 'Smith',
+ 'email' => 'spree@example.com',
+ 'shipping_address'=> {
+ 'address1' => '1234 Awesome Street',
+ 'address2' => '',
+ 'zipcode' => '90210',
+ 'city' => 'Hollywood',
+ 'state' => 'California',
+ 'country' => 'US',
+ 'phone' => '0000000000'
+ },
+ 'billing_address'=> {
+ 'address1' => '1234 Awesome Street',
+ 'address2' => '',
+ 'zipcode' => '90210',
+ 'city' => 'Hollywood',
+ 'state' => 'California',
+ 'country' => 'US',
+ 'phone' => '0000000000'
+ }
+ } }
+
+ let(:customer_without_id) { {
+ 'firstname' => 'Brian XX',
+ 'lastname' => 'Smith',
+ 'email' => 'spree@example.com',
+ 'shipping_address'=> {
+ 'address1' => '1234 Awesome Street',
+ 'address2' => '',
+ 'zipcode' => '90210',
+ 'city' => 'Hollywood',
+ 'state' => 'California',
+ 'country' => 'US',
+ 'phone' => '0000000000'
+ },
+ 'billing_address'=> {
+ 'address1' => '1234 Awesome Street',
+ 'address2' => '',
+ 'zipcode' => '90210',
+ 'city' => 'Hollywood',
+ 'state' => 'California',
+ 'country' => 'US',
+ 'phone' => '0000000000'
+ }
+ } }
+
+ describe '.build_customer' do
+
+ it 'create customer to add' do
+ customer_hash = Vend::CustomerBuilder.build_customer(nil, customer_without_id)
+ expect(customer_hash.has_key?(:id)).not_to be
+ end
+
+ it 'create customer to update' do
+ customer_hash = Vend::CustomerBuilder.build_customer(nil, customer_with_id)
+ expect(customer_hash.has_key?(:id)).to be true
+ end
+
+ end
+end
|
Add specs to customer builder
|
diff --git a/spec/features/profile_spec.rb b/spec/features/profile_spec.rb
index abc1234..def5678 100644
--- a/spec/features/profile_spec.rb
+++ b/spec/features/profile_spec.rb
@@ -0,0 +1,26 @@+require File.expand_path('../../spec_helper', __FILE__)
+
+feature 'profile settings' do
+ given(:expected_flash) {
+ I18n.t('flash.profile.updated')
+ }
+
+ background do
+ sign_in
+ end
+
+ background do
+ visit settings_profile_path
+ end
+
+ scenario "I update my profile" do
+ fill_in 'profile_name', :with => '19wu'
+ fill_in 'website', :with => 'http://19wu.com'
+ fill_in 'phone', :with => '195195195'
+ fill_in 'bio', :with => '**Launch your event now**'
+
+ find('.btn-primary').click
+
+ page.should have_content(expected_flash)
+ end
+end
|
Add feature test for profile edit
|
diff --git a/Casks/dbeaver-community.rb b/Casks/dbeaver-community.rb
index abc1234..def5678 100644
--- a/Casks/dbeaver-community.rb
+++ b/Casks/dbeaver-community.rb
@@ -1,11 +1,11 @@ cask :v1 => 'dbeaver-community' do
- version '3.1.4'
+ version '3.1.5'
if Hardware::CPU.is_32_bit?
- sha256 '017ef0d2aa6236685cfdec4988e05e0926a156db3cc46c48e09f11879b62402c'
+ sha256 '9d169d51f5849850eb13d879f2ee0247d026d35bb16d8acbf207b5a502cc3a33'
url "http://dbeaver.jkiss.org/files/dbeaver-#{version}-macosx.cocoa.x86.zip"
else
- sha256 '3da3c940f3891291c7ae332ce57a116336f5227972d854afbe062ec3045395c8'
+ sha256 'a4cb01e15061d5561a98d3b74b30272d4c29a845c0df623819cc8a548c313bf5'
url "http://dbeaver.jkiss.org/files/dbeaver-#{version}-macosx.cocoa.x86_64.zip"
end
|
Update DBeaver community to v3.1.5
|
diff --git a/spec/requests/archive_spec.rb b/spec/requests/archive_spec.rb
index abc1234..def5678 100644
--- a/spec/requests/archive_spec.rb
+++ b/spec/requests/archive_spec.rb
@@ -6,7 +6,7 @@
it "lists archived posts" do
visit "/monologue"
- within(".sidebar") do
+ within(".archive") do
page.should have_content("post X")
end
end
|
Check archive more specifically in request spec
|
diff --git a/Casks/plex-media-player.rb b/Casks/plex-media-player.rb
index abc1234..def5678 100644
--- a/Casks/plex-media-player.rb
+++ b/Casks/plex-media-player.rb
@@ -1,6 +1,6 @@ cask 'plex-media-player' do
- version '2.19.0.902-42a9f589'
- sha256 'b3f9e114586c84a665a5e2a87dab5495b4a6af5a4c7fd6230d66115f0b641268'
+ version '2.19.1.904-f679df4f'
+ sha256 '0f4a26e0fb6bec52be60dda0b730a35586dbe699cbe7e9507cfc7667878a2c25'
url "https://downloads.plex.tv/plexmediaplayer/#{version}/PlexMediaPlayer-#{version}-macosx-x86_64.zip"
appcast 'https://plex.tv/api/downloads/3.json'
|
Update Plex Media Player to 2.19.1.904-f679df4f
|
diff --git a/business.gemspec b/business.gemspec
index abc1234..def5678 100644
--- a/business.gemspec
+++ b/business.gemspec
@@ -23,5 +23,5 @@ spec.add_development_dependency "gc_ruboconfig", "~> 2.25.0"
spec.add_development_dependency "rspec", "~> 3.1"
spec.add_development_dependency "rspec_junit_formatter", "~> 0.4.1"
- spec.add_development_dependency "rubocop", "~> 1.13.0"
+ spec.add_development_dependency "rubocop", "~> 1.14.0"
end
|
Update rubocop requirement from ~> 1.13.0 to ~> 1.14.0
Updates the requirements on [rubocop](https://github.com/rubocop/rubocop) to permit the latest version.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.13.0...v1.14.0)
Signed-off-by: dependabot[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@github.com>
|
diff --git a/tools/export_functions.rb b/tools/export_functions.rb
index abc1234..def5678 100644
--- a/tools/export_functions.rb
+++ b/tools/export_functions.rb
@@ -29,10 +29,9 @@
begin
options = parseOptions
- p options
- #code = IO.read('testfile')
- #p code
+ code = IO.read(options[:filename])
+ p code
rescue Exception => exception
puts "Error: \"#{exception.message}\"."
end
|
Add file reading in export functions script.
|
diff --git a/scripts/s3/traverse_assets.rb b/scripts/s3/traverse_assets.rb
index abc1234..def5678 100644
--- a/scripts/s3/traverse_assets.rb
+++ b/scripts/s3/traverse_assets.rb
@@ -0,0 +1,67 @@+require "rubygems"
+require "aws-sdk"
+require "RMagick"
+
+def s3
+ @s3 = @s3 || AWS::S3.new(
+ :access_key_id => ENV["S3_ACCESS_KEY_ID"],
+ :secret_access_key => ENV["S3_SECRET_ACCESS_KEY"]
+ )
+ @s3
+end
+
+def strip_metadata object
+ blob = object.read
+ if blob.length > 0
+ image = Magick::Image.from_blob(blob).first
+ image.strip!
+ image.profile!("*", nil)
+ object.write(image.to_blob)
+ end
+end
+
+def create_tiny object, bucket
+ key = object.key
+ if key.start_with?("hike-images/") and key.end_with?("-original.jpg")
+ blob = object.read
+ if blob.length > 0
+ image = Magick::Image.from_blob(blob).first
+ image = image.unsharp_mask(2, 0.5, 0.7, 0)
+ if image.columns > image.rows
+ image.resize_to_fit!(200)
+ else
+ image.resize_to_fit!(200, 400)
+ end
+ bucket.objects[key.chomp("-original.jpg") + "-tiny.jpg"].write(image.to_blob { self.quality = 87 })
+ end
+ end
+end
+
+def create_tiny_thumb object, bucket
+ key = object.key
+ if key.start_with?("hike-images/") and key.end_with?("-original.jpg")
+ blob = object.read
+ if blob.length > 0
+ image = Magick::Image.from_blob(blob).first
+ image = image.unsharp_mask(2, 0.5, 0.7, 0)
+ image.crop_resized!(200, 200)
+ bucket.objects[key.chomp("-original.jpg") + "-thumb-tiny.jpg"].write(image.to_blob { self.quality = 87 })
+ end
+ end
+end
+
+def trace object
+ puts object.key
+end
+
+def main
+ bucket = s3.buckets["assets.hike.io"]
+ bucket.objects.each do |object|
+ #strip_metadata object
+ #create_tiny object, bucket
+ #trace object
+ create_tiny_thumb object, bucket
+ end
+end
+
+main
|
Add script which will easily traverse s3 tree.
|
diff --git a/lib/kitcat/terminal_width_calculator.rb b/lib/kitcat/terminal_width_calculator.rb
index abc1234..def5678 100644
--- a/lib/kitcat/terminal_width_calculator.rb
+++ b/lib/kitcat/terminal_width_calculator.rb
@@ -1,35 +1,37 @@ module TerminalWidthCalculator
- def self.calculate
- default_width = 80
+ class << self
+ def calculate
+ default_width = 80
- term_width = calculate_term_width
+ term_width = calculate_term_width
- term_width > 0 ? term_width : default_width
- end
+ term_width > 0 ? term_width : default_width
+ end
- private
+ private
- def self.calculate_term_width
- if ENV['COLUMNS'] =~ /^\d+$/
- ENV['COLUMNS'].to_i
- elsif tput_case?
- `tput cols`.to_i
- elsif stty_case?
- `stty size`.scan(/\d+/).map { |s| s.to_i }[1]
+ def calculate_term_width
+ if ENV['COLUMNS'] =~ /^\d+$/
+ ENV['COLUMNS'].to_i
+ elsif tput_case?
+ `tput cols`.to_i
+ elsif stty_case?
+ `stty size`.scan(/\d+/).map { |s| s.to_i }[1]
+ end
+ rescue
+ 0
end
- rescue
- 0
- end
- def self.tput_case?
- (RUBY_PLATFORM =~ /java/ || !STDIN.tty? && ENV['TERM']) && shell_command_exists?('tput')
- end
+ def tput_case?
+ (RUBY_PLATFORM =~ /java/ || !STDIN.tty? && ENV['TERM']) && shell_command_exists?('tput')
+ end
- def self.stty_case?
- STDIN.tty? && shell_command_exists?('stty')
- end
+ def stty_case?
+ STDIN.tty? && shell_command_exists?('stty')
+ end
- def self.shell_command_exists?(command)
- ENV['PATH'].split(File::PATH_SEPARATOR).any?{|d| File.exists? File.join(d, command) }
+ def shell_command_exists?(command)
+ ENV['PATH'].split(File::PATH_SEPARATOR).any?{|d| File.exists? File.join(d, command) }
+ end
end
end
|
Fix private methods on terminal width calculator
|
diff --git a/lib/rubygems/commands/yardoc_command.rb b/lib/rubygems/commands/yardoc_command.rb
index abc1234..def5678 100644
--- a/lib/rubygems/commands/yardoc_command.rb
+++ b/lib/rubygems/commands/yardoc_command.rb
@@ -10,7 +10,7 @@ end
def arguments # :nodoc:
- 'GEMNAME [GEMNAME ...] gem to generate YARD documentation'
+ 'GEMNAME [GEMNAME ...] gem to generate YARD documentation'
end
def usage # :nodoc:
|
Align argument description following gem rdoc
|
diff --git a/app.rb b/app.rb
index abc1234..def5678 100644
--- a/app.rb
+++ b/app.rb
@@ -9,7 +9,11 @@ view(:index)
end
- r.get('/about') do
+ r.on('/home') do
+ r.redirect('/')
+ end
+
+ r.on('/about') do
view(:about)
end
end
|
Adjust routing logic for about and home
|
diff --git a/spec/views/projects/new.html.erb_spec.rb b/spec/views/projects/new.html.erb_spec.rb
index abc1234..def5678 100644
--- a/spec/views/projects/new.html.erb_spec.rb
+++ b/spec/views/projects/new.html.erb_spec.rb
@@ -17,4 +17,13 @@ click_on I18n.t('projects.form.create_project')
expect(page).to have_content(wimi.chair.name)
end
+
+ it 'can invite initial user' do
+ chair_representative = FactoryGirl.create(:chair_representative, user: @user, chair: @chair)
+ wimi = FactoryGirl.create(:wimi, user: @wimi_user, chair: @chair).user
+ login_as wimi
+ visit new_project_path
+ expect(page).to have_selector(:link_or_button, 'Add new User')
+ expect(page).to have_xpath("//input[@name='invitationfield']")
+ end
end
|
Add view test for init invitation
|
diff --git a/lib/taem_c_kadai.rb b/lib/taem_c_kadai.rb
index abc1234..def5678 100644
--- a/lib/taem_c_kadai.rb
+++ b/lib/taem_c_kadai.rb
@@ -1,23 +1,27 @@+# -*- coding: utf-8 -*-
require "pebbles-soreyuke"
-#require "taem_c_kadai"
+require "taem_c_kadai/version"
require "taem_c_kadai/fumin"
require "taem_c_kadai/needed_calorie"
+require "taem_c_kadai/needed_bmi"
require "readline"
module TaemCKadai
- greeting = '不眠に悩んでいるのか体型に悩んでいるのか教えて\n enter fumin or weight'
- puts Pebbles::Soreyuke.AA('apm', greeting)
- input = Readline.readline("> ")
- case input
- when 'fumin' then
- # 不眠の処理
- when 'weight' then
- # 体重系の処理
- else
- puts Pebbles::Soreyuke.AA('apm', '人の話はちゃんと聞け')
- end
+ def main
+ greeting = '不眠に悩んでいるのか体型に悩んでいるのか教えて\n enter fumin or weight'
+ puts Pebbles::Soreyuke.AA('apm', greeting)
+ input = Readline.readline("> ")
+ case input
+ when 'fumin' then
+ # 不眠の処理
+ when 'weight' then
+ # 体重系の処理
+ else
+ puts Pebbles::Soreyuke.AA('apm', '人の話はちゃんと聞け')
+ end
- puts TaemCKadai.needed_calorie("M", 60)
- puts TaemCKadai.func_fumin()
+ puts TaemCKadai.needed_calorie("M", 60)
+ puts TaemCKadai.func_fumin()
+ end
end
|
Fix to work rake test
|
diff --git a/app/views/forms/_form.json.jbuilder b/app/views/forms/_form.json.jbuilder
index abc1234..def5678 100644
--- a/app/views/forms/_form.json.jbuilder
+++ b/app/views/forms/_form.json.jbuilder
@@ -1,5 +1,11 @@-json.extract! form, :id, :name, :description, :created_at, :updated_at, :questions, \
+json.extract! form, :id, :name, :description, :created_at, :updated_at, \
:version_independent_id, :version, :all_versions, :most_recent, :parent, \
:form_questions, :control_number, :status, :created_by_id, :published_by
json.user_id form.created_by.email if form.created_by.present?
json.url form_url(form, format: :json)
+
+json.questions form.questions do |q|
+ json.extract! q, :id, :content, :created_at, :created_by_id, :updated_at, :question_type_id, :description, :status, \
+ :version, :version_independent_id, \
+ :other_allowed
+end
|
Fix N+1 queries on individual form request
|
diff --git a/config/deploy.rb b/config/deploy.rb
index abc1234..def5678 100644
--- a/config/deploy.rb
+++ b/config/deploy.rb
@@ -1,6 +1,8 @@ lock '3.1.0'
set :application, 'whatsmydistrict'
set :repo_url, 'https://github.com/openlexington/WhatsMyDistrict.git'
+set :branch, :master
+set :deploy_to, '/opt/whatsmydistrict'
set :linked_dirs, %w{log tmp/pids tmp/sockets}
set :linked_files, %w{models/database_model.rb}
|
Set branch and application folder
|
diff --git a/activestorage/lib/active_storage/previewer/mupdf_previewer.rb b/activestorage/lib/active_storage/previewer/mupdf_previewer.rb
index abc1234..def5678 100644
--- a/activestorage/lib/active_storage/previewer/mupdf_previewer.rb
+++ b/activestorage/lib/active_storage/previewer/mupdf_previewer.rb
@@ -12,7 +12,7 @@ end
def mutool_exists?
- return @mutool_exists unless @mutool_exists.nil?
+ return @mutool_exists if defined?(@mutool_exists) && !@mutool_exists.nil?
system mutool_path, out: File::NULL, err: File::NULL
|
Remove warning of undefined instance variable
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,3 +1,4 @@ Rails.application.routes.draw do
+ get '/items', to: 'items#index'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
|
Add new route to access all items
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -10,6 +10,12 @@ end
resources :clubs, :only => [ :edit, :update ] do
+ member do
+ # handle image updates
+ match '/change_logo' => 'clubs#change_logo', :as => :change_logo_for
+ match '/upload_logo' => 'clubs#upload_logo', :as => :upload_logo_for
+ end
+
resources :courses, :only => [ :create ]
end
|
Update Routes for Club change_logo/upload_logo
Update the routes file to include change_logo and upload_logo routes for
the Club model.
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -11,9 +11,9 @@ put "/content/:content_id", to: "content_items#put_content"
get "/content/:content_id", to: "content_items#show"
end
+
+ post '/v2/content/:content_id/publish', to: 'content_items#publish'
end
-
- post '/v2/content/:content_id/publish', to: 'content_items#publish'
get '/healthcheck', :to => proc { [200, {}, ['OK']] }
end
|
Use a scope declaration to disallow the format variant
|
diff --git a/config/initializers/spree.rb b/config/initializers/spree.rb
index abc1234..def5678 100644
--- a/config/initializers/spree.rb
+++ b/config/initializers/spree.rb
@@ -13,6 +13,9 @@ # Example:
# Uncomment to stop tracking inventory levels in the application
# config.track_inventory_levels = false
+ config.layout = 'spree/layouts/spree_application'
+ config.logo = 'logo/spree_50.png'
+ config.admin_interface_logo = 'admin/logo.png'
end
Spree.user_class = 'Spree::User'
|
Fix Spree initializer for backward compability
|
diff --git a/lib/facter/oracle_webgate_exists.rb b/lib/facter/oracle_webgate_exists.rb
index abc1234..def5678 100644
--- a/lib/facter/oracle_webgate_exists.rb
+++ b/lib/facter/oracle_webgate_exists.rb
@@ -13,7 +13,7 @@ if !Dir.glob('/opt/netpoint/webgate/access/oblix/config/np*.txt').empty?
np = Dir['/opt/netpoint/webgate/access/oblix/config/np*.txt'][0]
str = IO.read(np)
- match = str.match(/^Release: .* BP(\d+)$/)
+ match = str.match(/^Release: .* BP(\d+).*$/)
match[1].to_i
else
'0'.to_i
|
Fix regexp in facter to work with non numeric versioning
|
diff --git a/app/controllers/spree/api/v1/products_controller_decorator.rb b/app/controllers/spree/api/v1/products_controller_decorator.rb
index abc1234..def5678 100644
--- a/app/controllers/spree/api/v1/products_controller_decorator.rb
+++ b/app/controllers/spree/api/v1/products_controller_decorator.rb
@@ -3,25 +3,25 @@ module V1
ProductsController.class_eval do
- def index
- @products = Spree::Product.all
+ def index
+ @products = Spree::Product.all
- # Filter products by price if params exist
- if params.has_key?(:price_floor) and params.has_key?(:price_ceiling)
- @products = @products.price_between(params[:price_floor], params[:price_ceiling])
- end
+ # Filter products by price if params exist
+ if params.has_key?(:price_floor) and params.has_key?(:price_ceiling)
+ @products = @products.price_between(params[:price_floor], params[:price_ceiling])
+ end
- # Only get products from taxon (category) IDs in params, if they exists
- if params.has_key?(:in_taxons)
- taxon_ids = params[:taxon_ids].split(',')
- @products = @products.in_taxons(taxon_ids)
- end
+ # Only get products from taxon (category) IDs in params, if they exists
+ if params.has_key?(:in_taxons)
+ taxon_ids = params[:taxon_ids].split(',')
+ @products = @products.in_taxons(taxon_ids)
+ end
- @products = @products.distinct.page(params[:page]).per(params[:per_page])
- expires_in 15.minutes, :public => true
- headers['Surrogate-Control'] = "max-age=#{15.minutes}"
- respond_with(@products)
- end
+ @products = @products.distinct.page(params[:page]).per(params[:per_page])
+ expires_in 15.minutes, :public => true
+ headers['Surrogate-Control'] = "max-age=#{15.minutes}"
+ respond_with(@products)
+ end
end
end
|
Fix indentation in product controller override
|
diff --git a/lib/arjdbc/relativity/connection_methods.rb b/lib/arjdbc/relativity/connection_methods.rb
index abc1234..def5678 100644
--- a/lib/arjdbc/relativity/connection_methods.rb
+++ b/lib/arjdbc/relativity/connection_methods.rb
@@ -5,14 +5,13 @@ config[:url] ||= "jdbc:relativity://#{config[:host]}:#{config[:port]}/#{ config[:database]}"
config[:driver] ||= 'relativity.jdbc.Driver'
config[:adapter_spec] ||= ::ArJdbc::Relativity
- config[:adapter_class] = ActiveRecord::ConnectionAdapters::RelativityAdapter unless config.key?(:adapter_class)
- if config.key?(:adapter_class) && config[:adapter_class].class == String
- config[:adapter_class] = config[:adapter_class].constantize
- elsif config.key?(:adapter_class)
- config[:adapter_class] = config[:adapter_class]
- else
- config[:adapter_class] = ActiveRecord::ConnectionAdapters::RelativityAdapter
- end
+ config[:adapter_class] = if config.key?(:adapter_class) && config[:adapter_class].class == String
+ config[:adapter_class].constantize
+ elsif config.key?(:adapter_class)
+ config[:adapter_class]
+ else
+ ActiveRecord::ConnectionAdapters::RelativityAdapter
+ end
jdbc_connection(config)
end
|
Clean up adapter class code ID:866
|
diff --git a/lib/capistrano/tasks/components/docker.rake b/lib/capistrano/tasks/components/docker.rake
index abc1234..def5678 100644
--- a/lib/capistrano/tasks/components/docker.rake
+++ b/lib/capistrano/tasks/components/docker.rake
@@ -23,7 +23,7 @@ task :docker_install do
on roles(:all) do
sudo :yum, '-y', 'install', 'docker'
- sudo :curl, '-Ls', '-o', '/usr/bin/docker-compose', '--retry', '3', 'https://github.com/docker/compose/releases/download/1.15.0/docker-compose-Linux-x86_64'
+ sudo :curl, '-Ls', '-o', '/usr/bin/docker-compose', '--retry', '3', 'https://github.com/docker/compose/releases/download/1.23.2/docker-compose-Linux-x86_64'
sudo :chmod, '+x', '/usr/bin/docker-compose'
end
end
|
Update Docker Compose to v1.23.2
|
diff --git a/lib/heroku-request-id/middleware.rb b/lib/heroku-request-id/middleware.rb
index abc1234..def5678 100644
--- a/lib/heroku-request-id/middleware.rb
+++ b/lib/heroku-request-id/middleware.rb
@@ -38,7 +38,6 @@ end
def each(&block)
- puts "html_comment = #{self.class.html_comment}"
if self.class.html_comment && @headers["Content-Type"].include?("text/html")
block.call("<!-- Heroku request id : #{@request_id} - Elapsed time : #{@elapsed} -->\n")
end
|
Remove a puts left from debugging
|
diff --git a/lib/ios/react-native-amap3d.podspec b/lib/ios/react-native-amap3d.podspec
index abc1234..def5678 100644
--- a/lib/ios/react-native-amap3d.podspec
+++ b/lib/ios/react-native-amap3d.podspec
@@ -16,5 +16,5 @@ s.source_files = '**/*.{h,m}'
s.dependency 'React'
- s.dependency 'AMap3DMap', "~> 6.3.0"
+ s.dependency 'AMap3DMap', "~> 6.6.0"
end
|
Upgrade ios sdk to v6.6.0
|
diff --git a/lib/zendesk_apps_support/app_requirement.rb b/lib/zendesk_apps_support/app_requirement.rb
index abc1234..def5678 100644
--- a/lib/zendesk_apps_support/app_requirement.rb
+++ b/lib/zendesk_apps_support/app_requirement.rb
@@ -1,5 +1,5 @@ module ZendeskAppsSupport
class AppRequirement
- TYPES = %w(automations macros targets ticket_fields triggers user_fields).freeze
+ TYPES = %w(automations macros targets views ticket_fields triggers user_fields).freeze
end
end
|
Add support for views as requirements
|
diff --git a/lib/shallow_attributes/type/date.rb b/lib/shallow_attributes/type/date.rb
index abc1234..def5678 100644
--- a/lib/shallow_attributes/type/date.rb
+++ b/lib/shallow_attributes/type/date.rb
@@ -27,6 +27,7 @@ when ::DateTime, ::Time then value.to_date
when ::Date then value
else
+ # TODO: ::Date.parse(Class.new.to_s) valid call and will create strange Data object
::Date.parse(value.to_s)
end
rescue
|
Create a note about strange ruby behaviour
|
diff --git a/lib/tasks/auto_annotate_models.rake b/lib/tasks/auto_annotate_models.rake
index abc1234..def5678 100644
--- a/lib/tasks/auto_annotate_models.rake
+++ b/lib/tasks/auto_annotate_models.rake
@@ -0,0 +1,34 @@+# NOTE: only doing this in development as some production environments (Heroku)
+# NOTE: are sensitive to local FS writes, and besides -- it's just not proper
+# NOTE: to have a dev-mode tool do its thing in production.
+if Rails.env.development?
+ task :set_annotation_options do
+ # You can override any of these by setting an environment variable of the
+ # same name.
+ Annotate.set_defaults({
+ 'position_in_routes' => "before",
+ 'position_in_class' => "before",
+ 'position_in_test' => "before",
+ 'position_in_fixture' => "before",
+ 'position_in_factory' => "before",
+ 'show_indexes' => "true",
+ 'simple_indexes' => "false",
+ 'model_dir' => "app/models",
+ 'include_version' => "false",
+ 'require' => "",
+ 'exclude_tests' => "false",
+ 'exclude_fixtures' => "false",
+ 'exclude_factories' => "false",
+ 'ignore_model_sub_dir' => "false",
+ 'skip_on_db_migrate' => "false",
+ 'format_bare' => "true",
+ 'format_rdoc' => "false",
+ 'format_markdown' => "false",
+ 'sort' => "false",
+ 'force' => "false",
+ 'trace' => "false",
+ })
+ end
+
+ Annotate.load_tasks
+end
|
ADD : annotate config file
|
diff --git a/lib/tasks/humanitarian_sectors.rake b/lib/tasks/humanitarian_sectors.rake
index abc1234..def5678 100644
--- a/lib/tasks/humanitarian_sectors.rake
+++ b/lib/tasks/humanitarian_sectors.rake
@@ -0,0 +1,20 @@+namespace :iom do
+ desc "Mark projects with 'Humanitarian Aid' sector as humanitarian"
+ task migrate_humanitarian_projects: :environment do
+ Project.find_each do |project|
+ if project.sectors.any? { |s| s.id == 18 }
+ project.update_attribute(:humanitarian, true)
+ end
+ end
+ end
+
+ desc "Import humanitarian scope types"
+ task import_humanitarian_scope_types: :environment do
+ HumanitarianScopeType.import("doc/schemas/humanitarian_scope_type.json")
+ end
+
+ desc "Import humanitarian scope vocabularies"
+ task import_humanitarian_scope_vocabularies: :environment do
+ HumanitarianScopeVocabulary.import("doc/schemas/humanitarian_scope_vocabulary.json")
+ end
+end
|
Add rake tasks for importing and data migration
|
diff --git a/lib/watnow/annotation/annotation.rb b/lib/watnow/annotation/annotation.rb
index abc1234..def5678 100644
--- a/lib/watnow/annotation/annotation.rb
+++ b/lib/watnow/annotation/annotation.rb
@@ -1,9 +1,10 @@ module Watnow
class Annotation
+ @@id = 0
@@instances = []
- attr_accessor :file, :lines
+ attr_accessor :id, :file, :lines, :priority
def self.all
@@instances
@@ -11,9 +12,11 @@
def initialize(opts)
super()
+ @priority = 0
@file = opts[:file]
@lines = set_lines(opts[:lines])
+ @id = @@id += 1
@@instances << self
end
|
Add id & priority to `Annotation`
|
diff --git a/config/features.rb b/config/features.rb
index abc1234..def5678 100644
--- a/config/features.rb
+++ b/config/features.rb
@@ -2,12 +2,15 @@ FeatureFlipper.features do
in_state :development do
- feature :alert, :description => "Journal and search alerts"
+ feature :alert, :description => "Journal and search alerts"
+ end
+
+ in_state :unstable do
+ feature :toc, :description => "Display table of contents on journal records"
end
in_state :staging do
feature :nal_map, :description => "Show Google Maps for NAL"
- feature :toc, :description => "Display table of contents on journal records"
end
in_state :live do
@@ -17,6 +20,7 @@
FeatureFlipper::Config.states = {
:development => ['development', 'test'].include?(Rails.env),
+ :unstable => ['development', 'test', 'unstable'].include?(Rails.env),
:staging => ['development', 'test', 'unstable', 'staging'].include?(Rails.env),
:live => true
}
|
Disable ToC UI in staging
|
diff --git a/config/initializers/exception_notification.rb b/config/initializers/exception_notification.rb
index abc1234..def5678 100644
--- a/config/initializers/exception_notification.rb
+++ b/config/initializers/exception_notification.rb
@@ -0,0 +1,44 @@+require 'exception_notification/rails'
+
+require 'exception_notification/sidekiq'
+
+ExceptionNotification.configure do |config|
+ # Ignore additional exception types.
+ # ActiveRecord::RecordNotFound, AbstractController::ActionNotFound and ActionController::RoutingError are already added.
+ # config.ignored_exceptions += %w{ActionView::TemplateError CustomError}
+
+ # Adds a condition to decide when an exception must be ignored or not.
+ # The ignore_if method can be invoked multiple times to add extra conditions.
+ config.ignore_if do |exception, options|
+ not Rails.env.production?
+ end
+
+ # Notifiers =================================================================
+
+ # Email notifier sends notifications by email.
+ config.add_notifier :email, {
+ email_prefix: "[EXCEPTION]",
+ email_format: :html,
+ sender_address: %{"notifier" <notifier@testributor.com>},
+ exception_recipients: %w{devs@testributor.com} }
+
+ # Campfire notifier sends notifications to your Campfire room. Requires 'tinder' gem.
+ # config.add_notifier :campfire, {
+ # :subdomain => 'my_subdomain',
+ # :token => 'my_token',
+ # :room_name => 'my_room'
+ # }
+
+ # HipChat notifier sends notifications to your HipChat room. Requires 'hipchat' gem.
+ # config.add_notifier :hipchat, {
+ # :api_token => 'my_token',
+ # :room_name => 'my_room'
+ # }
+
+ # Webhook notifier sends notifications over HTTP protocol. Requires 'httparty' gem.
+ # config.add_notifier :webhook, {
+ # :url => 'http://example.com:5555/hubot/path',
+ # :http_method => :post
+ # }
+
+end
|
Add exception notifier for background jobs (sidekiq)
https://github.com/smartinez87/exception_notification#background-notifications
|
diff --git a/config/schedule.rb b/config/schedule.rb
index abc1234..def5678 100644
--- a/config/schedule.rb
+++ b/config/schedule.rb
@@ -29,6 +29,6 @@ end
# For RANDOM2015 deployment, can be removed once that's done.
-every 60.minutes do
+every 10.minutes do
envcommand "rake 'import_from_easychair'"
end
|
Revert "10 minutes => 60minutes"
This reverts commit 666cfafb15be7b6f8571212517ed0ea8cf190ec7 [formerly 1c9e18bccd293e02bd8bc866073c625c8596271a] [formerly 9cfd17456dc4b208b676ae91c64ed20f38df337d] [formerly 626665c2bc7faa60b82a76cbbb4b6579ce8d3076 [formerly 26845000ae94debd87de2ead02eacf10009d916d]] [formerly 5749e759bf4e8f608e7d6138480d6639d3b0d3b1 [formerly 31ebfdfd57bd00e54e16fef50fcbcf40116b43d4] [formerly 9de5c63dc41c8c41098a762aa75c478d5f70bfca [formerly e8d64fa49afc28d009a9e0b1ace05db1f43ac50c]]] [formerly c346c7a4f4764916f89d52f9878dd1215d9ef932 [formerly dbb26e43906cee4b3afb82556f49b486389456c6] [formerly c2dbada4491840d188b65225bdb98e13cd0f7965 [formerly 8aebd5fd5b5249be6c310cdb90045c3522b84759]] [formerly 20016d3410faa00d5016d5bfebd7ca841936cdcc [formerly 5e257018bda19d4a828d8723f86ae7568d2ee011] [formerly 4bf3cdf9212f7556885ca00df8bb73e7cd9b2dc3 [formerly 4bf3cdf9212f7556885ca00df8bb73e7cd9b2dc3 [formerly fa1a073992c443552c2d0269abc991ca05ccd2db]]]]].
Former-commit-id: 0cea7df3754712f511024cfeaba3790b797c51e3 [formerly abe1261a119d8091326237dc1c0f7a35aff77b0b] [formerly 4490052dfe3ea390095e10821adbb220c616b1e9 [formerly bbb4eda73dd1f6210b87236bab0a52d69e4fce8f]] [formerly e9226edf745144f7cbf6e20ec25dc553a2a3a149 [formerly 7509784bdceccba2824bb0fa31d26c2d9ab127b5] [formerly 5394059aab5b02db7c4831acbcfda87dd28c0ef7 [formerly 5394059aab5b02db7c4831acbcfda87dd28c0ef7 [formerly 77699b19eae5192a1133fbb1ce1a4f3fee41522c]]]]
Former-commit-id: b74603a447f90c56f877696d0a498f347190e9d4 [formerly 271f2369c8849ffd92e754eefcb895f5ee6984bf] [formerly e0b9fdcb323890589b935314ff39332b07014d28 [formerly af06222667b86349bdc5130d7dafb04b7276f03f]]
Former-commit-id: 7a79e169bc6e362caf98d553c2b7f3ba77c8d723 [formerly 0740cf854410fd509b7c43392ecd0211dddf45f1]
Former-commit-id: 194851f497d7077979f98d615034741589882c01
Former-commit-id: 2c74d5ecabef6e8cb8060ed4001441b4a1012b6e
|
diff --git a/recipes/_package_rhel.rb b/recipes/_package_rhel.rb
index abc1234..def5678 100644
--- a/recipes/_package_rhel.rb
+++ b/recipes/_package_rhel.rb
@@ -1,7 +1,7 @@ include_recipe 'yum'
case node['platform_version'].to_f
- when 6.4, 6.5
+ when 6.4, 6.5, 6.6, 6.7
remote_file '/tmp/epel.rpm' do
source 'http://ftp.riken.jp/Linux/fedora/epel/6/i386/epel-release-6-8.noarch.rpm'
action :create_if_missing
|
Add support for Centos 6.6 and 6.7
This will indeed work with Centos 6.6 and 6.7 it turns out.
|
diff --git a/bosh-dev/lib/bosh/dev/bat_helper.rb b/bosh-dev/lib/bosh/dev/bat_helper.rb
index abc1234..def5678 100644
--- a/bosh-dev/lib/bosh/dev/bat_helper.rb
+++ b/bosh-dev/lib/bosh/dev/bat_helper.rb
@@ -31,7 +31,7 @@ end
def run_rake
- ENV['BAT_INFRASTRUCTURE'] = infrastructure.name
+ infrastructure_for_emitable_example
sanitize_directories
@@ -46,6 +46,10 @@
attr_reader :pipeline
+ def infrastructure_for_emitable_example
+ ENV['BAT_INFRASTRUCTURE'] = infrastructure.name
+ end
+
def sanitize_directories
FileUtils.rm_rf(artifacts_dir)
end
|
Move logic to named method for clarity
|
diff --git a/warden-doorkeeper.gemspec b/warden-doorkeeper.gemspec
index abc1234..def5678 100644
--- a/warden-doorkeeper.gemspec
+++ b/warden-doorkeeper.gemspec
@@ -9,7 +9,7 @@ s.email = "kolorahl@gmail.com"
s.homepage = "https://github.com/kolorahl/warden-doorkeeper"
s.summary = "Integration with Doorkeeper."
- s.description = "Integration with Doorkeeper."
+ s.description = "Integration with Doorkeeper, an OAuth 2.0 provider."
s.files = Dir["lib/**/*", "LICENSE", "README.md"]
|
Update description to remove gem build warning
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -8,6 +8,6 @@ else
Arturo::Engine.routes.draw do
resources :features, :controller => 'arturo/features'
- put 'features', :to => 'arturo/features#update_all', :as => 'features_all'
+ put 'features', :to => 'arturo/features#update_all', :as => 'features_update_all'
end
end
|
Rename route features_all to features_update_all
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -11,6 +11,9 @@ get 'gh' => redirect(Links::Github)
get 'fo' => redirect(Links::Foursquare)
+ get 'zshrc' => redirect('https://raw.githubusercontent.com/pfhayes/dotfiles/master/.zshrc')
+ get 'vimrc' => redirect('https://raw.githubusercontent.com/pfhayes/dotfiles/master/.vimrc')
+
# Nothing left, route to error page
get '*wild' => 'application#render_404', :as => :error_404
end
|
Add back some old redirects
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,6 +1,5 @@ Dippam::Application.routes.draw do
- resources :summary_documents, :vmr_tracks, :vmr_interviews,
- :eppi_lc_subjects, :ied_institutions
+ resources :summary_documents, :vmr_interviews, :eppi_lc_subjects, :ied_institutions
resources :eppi_documents do
resources :eppi_pages do
get :download, on: :member
|
Remove route for VMR tracks.
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -4,4 +4,5 @@
root 'skills#index'
get 'refresh' => 'skills#refresh', as: 'refresh'
+ get 'welcome' => 'skills#splash', as: 'welcome'
end
|
Add route for welcome page
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,8 +1,7 @@ Rails.application.routes.draw do
+ root to: "posts#index"
+
resources :posts
-
- root to: "users#index"
-
resources :users
mount Pancakes::Engine, at: "/pg"
|
Add article index as root
|
diff --git a/db/migrate/20160328115649_migrate_new_notification_setting.rb b/db/migrate/20160328115649_migrate_new_notification_setting.rb
index abc1234..def5678 100644
--- a/db/migrate/20160328115649_migrate_new_notification_setting.rb
+++ b/db/migrate/20160328115649_migrate_new_notification_setting.rb
@@ -7,7 +7,7 @@ #
class MigrateNewNotificationSetting < ActiveRecord::Migration
def up
- timestamp = Time.now
+ timestamp = Time.now.strftime('%F %T')
execute "INSERT INTO notification_settings ( user_id, source_id, source_type, level, created_at, updated_at ) SELECT user_id, source_id, source_type, notification_level, '#{timestamp}', '#{timestamp}' FROM members WHERE user_id IS NOT NULL"
end
|
Fix datetime format when migrating new notification settings on MySQL
|
diff --git a/templates/factory_bot_rspec.rb b/templates/factory_bot_rspec.rb
index abc1234..def5678 100644
--- a/templates/factory_bot_rspec.rb
+++ b/templates/factory_bot_rspec.rb
@@ -1,3 +1,5 @@+FactoryBot.use_parent_strategy = true
+
RSpec.configure do |config|
config.include FactoryBot::Syntax::Methods
end
|
Use parent strategy for factories
Setting FactoryBot.use_parent_strategy = true allows objects made with
the build strategy to use build instead of create for any
associations. Using this setting will generally reduce the number of
calls to `create`, and makes `build` generally
[a little faster](https://gist.github.com/composerinteralia/d4796df9140f431e36f88dfb6fe9733a)
than `build_stubbed`.
|
diff --git a/app/controllers/matrices_controller.rb b/app/controllers/matrices_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/matrices_controller.rb
+++ b/app/controllers/matrices_controller.rb
@@ -42,7 +42,7 @@
def new
# Get a list of kinds currently in the collection
- @kinds = kind_list
+ @kinds = helpers.kind_list
# Add an option for an "Other" kind if the submission is really different
@kinds.push("Other")
|
Fix scoping of helper function - add helpers.*
|
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -9,6 +9,6 @@
private
def session_params
- params.require(:session).permit(:user_id, :user_name, :browser)
+ params.require(:session).permit(:user_id, :user_name, :email, :browser)
end
end
|
Allow user email on sessions.
|
diff --git a/spec/dummy_app/db/migrate/00000000000006_devise_create_users.rb b/spec/dummy_app/db/migrate/00000000000006_devise_create_users.rb
index abc1234..def5678 100644
--- a/spec/dummy_app/db/migrate/00000000000006_devise_create_users.rb
+++ b/spec/dummy_app/db/migrate/00000000000006_devise_create_users.rb
@@ -5,16 +5,12 @@ t.recoverable
t.rememberable
t.trackable
- # t.confirmable
- # t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
- # t.token_authenticatable
+ t.encryptable
t.timestamps
end
add_index :users, :email, :unique => true
add_index :users, :reset_password_token, :unique => true
- # add_index :users, :confirmation_token, :unique => true
- # add_index :users, :unlock_token, :unique => true
end
def self.down
|
Add encryptable to old migration
|
diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/documents_controller.rb
+++ b/app/controllers/documents_controller.rb
@@ -21,6 +21,9 @@ expire_on_next_scheduled_publication([@document])
render :coming_soon
elsif @unpublishing = document_class.unpublished_as(params[:id])
+ # NOTE: We should be returning a 410 here, but because 4XX statuses get clobbered upstream,
+ # we are forced to return 200 for now. There may also be the potential to automatically redirect
+ # when the reason for unpublishing is UnpublishingReason::Duplicate or UnpublishingReason::Superseded.
render :unpublished
else
render text: "Not found", status: :not_found
|
Add note regarding the lack of 410 status
|
diff --git a/app/models/alchemy/essence_richtext.rb b/app/models/alchemy/essence_richtext.rb
index abc1234..def5678 100644
--- a/app/models/alchemy/essence_richtext.rb
+++ b/app/models/alchemy/essence_richtext.rb
@@ -25,26 +25,7 @@ private
def strip_content
- self.stripped_body = strip_tags(body)
- end
-
- # Stripping HTML Tags and only returns plain text.
- def strip_tags(html)
- return html if html.blank?
- if html.index("<")
- text = ""
- tokenizer = ::HTML::Tokenizer.new(html)
- while token = tokenizer.next
- node = ::HTML::Node.parse(nil, 0, 0, token, false)
- # result is only the content of any Text nodes
- text << node.to_s if node.class == ::HTML::Text
- end
- # strip any comments, and if they have a newline at the end (ie. line with
- # only a comment) strip that too
- text.gsub(/<!--(.*?)-->[\n]?/m, "")
- else
- html # already plain text
- end
+ self.stripped_body = Rails::Html::FullSanitizer.new.sanitize(body)
end
end
end
|
Use Rails HTML sanitizer to strip tags
We used to have a custom HTML sanitizer that does not work
any more with Rails 4.2
Now we use the default html sanitizer shipped with rails.
Fixes #1017
|
diff --git a/lib/docker_registry/registry.rb b/lib/docker_registry/registry.rb
index abc1234..def5678 100644
--- a/lib/docker_registry/registry.rb
+++ b/lib/docker_registry/registry.rb
@@ -35,6 +35,10 @@ end
end
+ def [](name)
+ DockerRegistry::Repository.new({ name: name }, self)
+ end
+
def repositry_tags(repository)
(@client.repositry_tags(repository.name) || {}).map do |name, image_id|
DockerRegistry::Tag.new(name, image_id, repository)
|
Add direct repository getting method
|
diff --git a/lib/fact_check_email_handler.rb b/lib/fact_check_email_handler.rb
index abc1234..def5678 100644
--- a/lib/fact_check_email_handler.rb
+++ b/lib/fact_check_email_handler.rb
@@ -7,11 +7,9 @@ # initializer and is typically called from the mail_fetcher script
class FactCheckEmailHandler
attr_accessor :errors
- attr_accessor :message_processor
def initialize
self.errors = []
- self.message_processor = FactCheckMessageProcessor
end
def is_relevant_message?(message)
@@ -20,7 +18,7 @@
def process_message(message)
if is_relevant_message?(message)
- return message_processor.process(message, $1)
+ return FactCheckMessageProcessor.process(message, $1)
end
return false
|
Fix undefined method message_processor error by removing unnecessary dependency injection
|
diff --git a/lib/git_cleanser/smart_thing.rb b/lib/git_cleanser/smart_thing.rb
index abc1234..def5678 100644
--- a/lib/git_cleanser/smart_thing.rb
+++ b/lib/git_cleanser/smart_thing.rb
@@ -1,11 +1,13 @@+require 'set'
+
module GitCleanser
class SmartThing
def initialize(config)
@config = config
- @compiled_files = sh(@config['compiled_files_command']).split
+ @compiled_files = sh(@config['compiled_files_command']).split.to_set
@ignored_and_untracked_files = git_ls_files(:ignored, :other)
@ignored_but_tracked_files = git_ls_files(:ignored)
- @all_files = Dir['**/*']
+ @all_files = Dir['**/*'].to_set
end
def generated_but_not_ignored
@@ -28,7 +30,7 @@
def git_ls_files *ruby_opts
shell_opts = ruby_opts.map { |opt| "--#{opt}" }.join(" ")
- sh("git ls-files -z --exclude-standard #{shell_opts}").split("\0")
+ sh("git ls-files -z --exclude-standard #{shell_opts}").split("\0").to_set
end
def sh(cmd)
|
Use Sets, because we can.
|
diff --git a/lib/generators/generic_api_rails/install/install_generator.rb b/lib/generators/generic_api_rails/install/install_generator.rb
index abc1234..def5678 100644
--- a/lib/generators/generic_api_rails/install/install_generator.rb
+++ b/lib/generators/generic_api_rails/install/install_generator.rb
@@ -14,7 +14,7 @@ end
def mount_engine
- inject_into_file routes_path, :after => "Application.routes.draw do\n" do
+ inject_into_file routes_path, :after => ".routes.draw do\n" do
" mount GenericApiRails::Engine => '/api' \n"
end
end
|
Add the GAPI routes regardless of rails version
|
diff --git a/processors/generators/postfix-filter.rb b/processors/generators/postfix-filter.rb
index abc1234..def5678 100644
--- a/processors/generators/postfix-filter.rb
+++ b/processors/generators/postfix-filter.rb
@@ -35,7 +35,7 @@ address = r.to_s
invmask = (~r.mask_addr & 0xffffffff) + 1
prefix = Math.log2(invmask).to_i
- puts "#{address}/#{prefix}\t#{@reject_reason}"
+ puts "#{address}/#{prefix}\tREJECT #{@reject_reason}"
end
nil
|
Make Postfix filter generator include "REJECT".
Signed-off-by: brian m. carlson <738bdd359be778fee9f0fc4e2934ad72f436ceda@crustytoothpaste.net>
|
diff --git a/lib/protobuf/tasks/compile.rake b/lib/protobuf/tasks/compile.rake
index abc1234..def5678 100644
--- a/lib/protobuf/tasks/compile.rake
+++ b/lib/protobuf/tasks/compile.rake
@@ -1,3 +1,5 @@+require 'fileutils'
+
namespace :protobuf do
desc 'Clean & Compile the protobuf source to ruby classes. Pass PB_NO_CLEAN=1 if you do not want to force-clean first.'
@@ -23,4 +25,34 @@ exec(full_command)
end
+ desc 'Clean the generated *.pb.rb files from the destination package. Pass PB_FORCE_CLEAN=1 to skip confirmation step.'
+ task :clean, [ :package, :destination ] do |task, args|
+ args.with_defaults(:destination => 'lib')
+
+ files_to_clean = ::File.join(args[:destination], args[:package], '**', '*.pb.rb')
+
+ if force_clean? || permission_to_clean?(files_to_clean)
+ ::Dir.glob(files_to_clean).each do |file|
+ ::FileUtils.rm(file)
+ end
+ end
+ end
+
+ def do_not_clean?
+ ! ::ENV.key?('PB_NO_CLEAN')
+ end
+
+ def force_clean?
+ ::ENV.key?('PB_FORCE_CLEAN')
+ end
+
+ def force_clean!
+ ::ENV['PB_FORCE_CLEAN'] = '1'
+ end
+
+ def permission_to_clean?(files_to_clean)
+ puts "Do you really want to remove files matching pattern #{files_to_clean}? (y/n)"
+ ::STDIN.gets.chomp =~ /y(es)?/i
+ end
+
end
|
Add protobuf:clean task for external use
To get this task simply `require ‘protobuf/tasks’` in your Rakefile.
Clean will ask for confirmation of removing previously compiled pb.rb
source files. You can skip the confirmation step by providing
PB_FORCE_CLEAN=1. A force clean is automatically invoked from the
`compile` task unless PB_NO_CLEAN=1 is specified.
The package argument must be specified. The destination argument
defaults to `lib`.
|
diff --git a/snippets/app/models/cheatsheet.rb b/snippets/app/models/cheatsheet.rb
index abc1234..def5678 100644
--- a/snippets/app/models/cheatsheet.rb
+++ b/snippets/app/models/cheatsheet.rb
@@ -1,3 +1,5 @@ class Cheatsheet < ActiveRecord::Base
belongs_to :user
+ has_many :cheatsheet_snippet
+ has_many :snippets, :through => :cheatsheet_snippets
end
|
Add new associations to Cheatsheet model
|
diff --git a/lib/telegram_bot/out_message.rb b/lib/telegram_bot/out_message.rb
index abc1234..def5678 100644
--- a/lib/telegram_bot/out_message.rb
+++ b/lib/telegram_bot/out_message.rb
@@ -4,6 +4,7 @@ attribute :chat, Channel
attribute :text, String
attribute :reply_to, Message
+ attribute :parse_mode, String
def send_with(bot)
bot.send_message(self)
@@ -17,13 +18,15 @@ if reply_to.nil? then
{
text: text,
- chat_id: chat.id
+ chat_id: chat.id,
+ parse_mode: parse_mode
}
else
{
text: text,
chat_id: chat.id,
- reply_to_message_id: reply_to.id
+ reply_to_message_id: reply_to.id,
+ parse_mode: parse_mode
}
end
end
|
Add parse_mode to OutMessage for markdown
|
diff --git a/app/serializers/category_serializer.rb b/app/serializers/category_serializer.rb
index abc1234..def5678 100644
--- a/app/serializers/category_serializer.rb
+++ b/app/serializers/category_serializer.rb
@@ -15,15 +15,21 @@
def transaction_ids
join_sql = if object.unassigned?
- "LEFT JOIN category_transactions ct ON (ct.transaction_id = txn.id) AND (ct.category_id IS NULL)"
+ "LEFT JOIN category_transactions ct ON (ct.transaction_id = txn.id)"
else
"INNER JOIN category_transactions ct ON (ct.transaction_id = txn.id) AND (ct.category_id = #{object.id})"
+ end
+ where_sql = if object.unassigned?
+ "WHERE ct.id IS NULL"
+ else
+ ""
end
Category.connection.select_values %Q{
SELECT txn.id
FROM transactions txn
#{join_sql}
+ #{where_sql}
}
end
|
Fix transactions query for the category
|
diff --git a/app/workers/reactive_caching_worker.rb b/app/workers/reactive_caching_worker.rb
index abc1234..def5678 100644
--- a/app/workers/reactive_caching_worker.rb
+++ b/app/workers/reactive_caching_worker.rb
@@ -12,7 +12,7 @@ end
return unless klass
- klass.find_by(id: id).try(:exclusively_update_reactive_cache!, *args)
+ klass.find_by(klass.primary_key => id).try(:exclusively_update_reactive_cache!, *args)
end
# rubocop: enable CodeReuse/ActiveRecord
end
|
Use record's primary key instead of hardcoded `id`
Enable caching for records which primary key is not `id`.
|
diff --git a/spec/libraries/prometheus_spec.rb b/spec/libraries/prometheus_spec.rb
index abc1234..def5678 100644
--- a/spec/libraries/prometheus_spec.rb
+++ b/spec/libraries/prometheus_spec.rb
@@ -1,6 +1,8 @@ require 'chef_helper'
describe Prometheus do
+ before { Services.add_services('gitlab', Gitlab::Services.list) }
+
it 'should return a list of known services' do
expect(Prometheus.services).to match_array(%w(
prometheus
|
Load services for the prometheus library test
|
diff --git a/spec/ruby/language/module_spec.rb b/spec/ruby/language/module_spec.rb
index abc1234..def5678 100644
--- a/spec/ruby/language/module_spec.rb
+++ b/spec/ruby/language/module_spec.rb
@@ -16,6 +16,24 @@ LangModuleSpec::Anon = Module.new
LangModuleSpec::Anon.name.should == "LangModuleSpec::Anon"
end
+
+ it "raises a TypeError if the constant is a class" do
+ class LangModuleSpec::C1; end
+
+ lambda {
+ module LangModuleSpec::C1; end
+ }.should raise_error(TypeError)
+ end
+
+ it "raises a TypeError if the constant is not a module" do
+ module LangModuleSpec
+ C2 = 2
+ end
+
+ lambda {
+ module LangModuleSpec::C2; end
+ }.should raise_error(TypeError)
+ end
end
describe "An anonymous module" do
|
Add spec for module trying to reopen a class
|
diff --git a/spec/support/chargeback_helper.rb b/spec/support/chargeback_helper.rb
index abc1234..def5678 100644
--- a/spec/support/chargeback_helper.rb
+++ b/spec/support/chargeback_helper.rb
@@ -10,6 +10,18 @@ def used_average_for(metric, hours_in_interval, resource)
resource.metric_rollups.sum(&metric) / hours_in_interval
end
+
+ def add_metric_rollups_for(resources, range, step, metric_rollup_params, trait = :with_data)
+ range.step_value(step).each do |time|
+ Array(resources).each do |resource|
+ metric_rollup_params[:timestamp] = time
+ metric_rollup_params[:resource_id] = resource.id
+ metric_rollup_params[:resource_name] = resource.name
+ params = [:metric_rollup_vm_hr, trait, metric_rollup_params].compact
+ resource.metric_rollups << FactoryGirl.create(*params)
+ end
+ end
+ end
end
end
end
|
Add helper method for generating MetricRollups
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -11,6 +11,8 @@ get 'summarize'
end
end
+
+ root 'proposals#index'
end
namespace 'monitoring' do
|
Add home route for voting namespace
Fix missing route for voting home (#4):
* add home for voting namespace
|
diff --git a/source/_plugins/playlister.rb b/source/_plugins/playlister.rb
index abc1234..def5678 100644
--- a/source/_plugins/playlister.rb
+++ b/source/_plugins/playlister.rb
@@ -1,5 +1,6 @@ require 'soundcloud'
require 'json'
+require 'open-uri'
module Jekyll
class Playlister < Liquid::Tag
@@ -14,14 +15,32 @@ # Get Playlist and render it
playlist = client.get('/resolve', :url => playlist)
playlist.tracks.each do |track|
- @list << "<li class='track'>" +
- "<img src='" + track.artwork_url + "' />" +
+ image_grabber(track.artwork_url, track.id.to_s)
+ @list << "<li class='track' id='" + track.id.to_s + "'>" +
+ "<img src='/" + @img_dest + "' />" +
"<span class='track__artist'>" + (track.user.username || "") + "</span><br />" +
"<span class='track__title'>" + track.title + "</span><br />" + track.permalink_url + "<br />" +
"</li>"
end
end
-
+
+ def image_grabber(url, id)
+ # Get a larger size of image
+ # See: https://developers.soundcloud.com/docs/api/reference#artwork_url for a list of sizes
+ url ["large"] = "t300x300"
+ @img_dest = "assets/images/artwork/" + id + ".jpg"
+
+ # Check if image has already been downloaded before copying to assets folder
+ if File.exist?(@img_dest)
+ puts "We already have " + id
+ else
+ puts "GETTING" + id
+ open(@img_dest, 'wb') do |file|
+ file << open(url).read
+ end
+ end
+ end
+
def render(context)
"<ul class='playlist'>#{@list}</ul>"
end
|
Copy all images to artwork folder
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -20,4 +20,6 @@ resources :users, except: :index
get '/signup' => 'users#new', as: 'signup'
+ post '/response/up_vote' => "responses#up_vote"
+
end
|
Resolve merge conflict by keeping the newest upvote POST route.
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,6 +1,6 @@ Ecm::Pictures::Backend::Engine.routes.draw do
- resources :galleries
- resources :pictures
+ backend_resources :galleries
+ backend_resources :pictures
root to: 'home#index'
end
|
Use itsf backend backend_resource method.
|
diff --git a/core/config/initializers/konacha.rb b/core/config/initializers/konacha.rb
index abc1234..def5678 100644
--- a/core/config/initializers/konacha.rb
+++ b/core/config/initializers/konacha.rb
@@ -8,6 +8,7 @@ config.driver = :poltergeist
config.stylesheets = []
if ENV['JENKINS_URL']
+ puts "!!!!!REOPENING FILE!!!!!"
config.formatters = [
RspecJunitFormatter.new(
File.new('tmp/konacha.junit.xml', 'w')
|
Add notification when file is opened.
|
diff --git a/test/specs/providers/azure/template_spec.rb b/test/specs/providers/azure/template_spec.rb
index abc1234..def5678 100644
--- a/test/specs/providers/azure/template_spec.rb
+++ b/test/specs/providers/azure/template_spec.rb
@@ -0,0 +1,34 @@+require_relative '../../../spec'
+
+describe 'Azure templates' do
+
+ describe 'Basic template structure' do
+
+ it 'should automatically reformat resources' do
+ result = SparkleFormation.new(:dummy, :provider => :azure) do
+ resources.test_resource do
+ value true
+ end
+ end.dump
+ result.keys.must_include 'resources'
+ result['resources'].must_be_kind_of Array
+ result['resources'].first.must_equal 'value' => true, 'name' => 'testResource'
+ end
+
+ end
+
+ describe 'Helper functions behavior' do
+
+ it 'should automatically include versioning and location information on builtin dynamics' do
+ result = SparkleFormation.new(:dummy, :provider => :azure) do
+ dynamic!(:compute_virtual_machines, :test)
+ end.dump
+ result['resources'].first['name'].must_equal 'testComputeVirtualMachines'
+ result['resources'].first.keys.must_include 'apiVersion'
+ result['resources'].first.keys.must_include 'type'
+ result['resources'].first.keys.must_include 'location'
+ end
+
+ end
+
+end
|
Add spec coverage on azure provider specific resource insertion
|
diff --git a/test/unit/code/builder/code_builder_test.rb b/test/unit/code/builder/code_builder_test.rb
index abc1234..def5678 100644
--- a/test/unit/code/builder/code_builder_test.rb
+++ b/test/unit/code/builder/code_builder_test.rb
@@ -8,7 +8,7 @@
include RamlPoliglota::Support
include RamlPoliglota::Code::Builder
- #include RamlPoliglota::Code::Builder::Java
+ include RamlPoliglota::Code::Builder::Java
def test_create
builder = CodeBuilder.create SUPPORTED_PROGRAMMING_LANGUAGES[:java]
|
Add method to build model class.
|
diff --git a/spec/ironmq_publisher_spec.rb b/spec/ironmq_publisher_spec.rb
index abc1234..def5678 100644
--- a/spec/ironmq_publisher_spec.rb
+++ b/spec/ironmq_publisher_spec.rb
@@ -8,11 +8,13 @@
it "should call post for IronMQ" do
expect_any_instance_of(IronMQ::Queue).to receive(:post) { |instance, serialized_encrypted_data|
- expect(instance.name).to eq("harrys-#{Rails.env}-v1-default_emitters")
- encrypted_data = RailsPipeline::EncryptedMessage.parse(serialized_encrypted_data)
- expect(encrypted_data.type_info).to eq(DefaultEmitter_1_0.to_s)
+ base64_decoded_data = Base64.strict_decode64(serialized_encrypted_data)
+ encrypted_data = RailsPipeline::EncryptedMessage.parse(base64_decoded_data)
serialized_payload = DefaultEmitter.decrypt(encrypted_data)
data = DefaultEmitter_1_0.parse(serialized_payload)
+
+ expect(instance.name).to eq("harrys-#{Rails.env}-v1-default_emitters")
+ expect(encrypted_data.type_info).to eq(DefaultEmitter_1_0.to_s)
expect(data.foo).to eq("baz")
}.once
@default_emitter.emit
|
Test updated to reflect the new use of Base64
|
diff --git a/cerializable.gemspec b/cerializable.gemspec
index abc1234..def5678 100644
--- a/cerializable.gemspec
+++ b/cerializable.gemspec
@@ -9,9 +9,9 @@ s.version = Cerializable::VERSION
s.authors = ["Eric Arnold"]
s.email = ["eric.ed.arnold@gmail.com"]
- s.homepage = "TODO"
- s.summary = "TODO: Summary of Cerializable."
- s.description = "TODO: Description of Cerializable."
+ s.homepage = "https://github.com/nativestranger/cerializable"
+ s.summary = "Flexible custom serialization for Rails models"
+ s.description = "Flexible custom serialization for Rails models."
s.license = "MIT"
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
|
Update homepage, summary, & description in .gemspec
|
diff --git a/10_balance_bots.rb b/10_balance_bots.rb
index abc1234..def5678 100644
--- a/10_balance_bots.rb
+++ b/10_balance_bots.rb
@@ -0,0 +1,47 @@+Bot = Struct.new(:id, :nums, :low_to, :high_to) {
+ def <<(n)
+ nums << n
+ nums.sort!
+ puts id if nums == [17, 61]
+ end
+
+ def ready?
+ nums.size == 2
+ end
+
+ def run!
+ [low_to, high_to].zip(nums.shift(2)).select { |to, num|
+ to << num
+ to.is_a?(Bot) && to.ready?
+ }.map(&:first)
+ end
+}
+
+bots = Hash.new { |h, k| h[k] = Bot.new(k, []) }
+outputs = Hash.new { |h, k| h[k] = [] }
+
+ARGF.each_line { |l|
+ words = l.split
+
+ parse_target = ->(at:) {
+ case (type = words[at])
+ when 'bot'; bots
+ when 'output'; outputs
+ else raise "what is a #{type}?"
+ end[Integer(words[at + 1])]
+ }
+
+ case (cmd = words[0])
+ when 'value'; bots[Integer(words[-1])] << Integer(words[1])
+ when 'bot'
+ bot = bots[Integer(words[1])]
+ bot.low_to = parse_target[at: 5]
+ bot.high_to = parse_target[at: -2]
+ else raise "what is a #{cmd}?"
+ end
+}
+
+ready_bots = bots.values.select(&:ready?)
+ready_bots = ready_bots.flat_map(&:run!) until ready_bots.empty?
+
+puts (0..2).map { |i| outputs[i].first }.reduce(:*)
|
Add day 10: Balance Bots
|
diff --git a/spec/pr_log/formatter_spec.rb b/spec/pr_log/formatter_spec.rb
index abc1234..def5678 100644
--- a/spec/pr_log/formatter_spec.rb
+++ b/spec/pr_log/formatter_spec.rb
@@ -33,20 +33,6 @@ TEXT
end
- it 'turns title into lower case sentence' do
- data = [{ title: 'Some Capitalized Title',
- number: 1 }]
- template = "- %{title} (#%{number})\n"
- formatter = Formatter.new(data, template, {})
-
- result = formatter.entries
-
- expect(result).to eq(<<-TEXT.unindent)
-
- - Some capitalized title (#1)
- TEXT
- end
-
it 'returns empty string if no pull requests are passed' do
template = "- %{title} (#%{number})\n"
formatter = Formatter.new([], template, {})
|
Delete test for capitalized title
|
diff --git a/recipes/apt_pgdg_postgresql.rb b/recipes/apt_pgdg_postgresql.rb
index abc1234..def5678 100644
--- a/recipes/apt_pgdg_postgresql.rb
+++ b/recipes/apt_pgdg_postgresql.rb
@@ -1,4 +1,4 @@-if not %w(squeeze wheezy sid lucid precise saucy trusty utopic).include? node['postgresql']['pgdg']['release_apt_codename']
+if not %w(jessie squeeze wheezy sid lucid precise saucy trusty utopic).include? node['postgresql']['pgdg']['release_apt_codename']
raise "Not supported release by PGDG apt repository"
end
|
Add Debian Jessie to whitelist for apt.postgresql.org repo
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.