diff stringlengths 65 26.7k | message stringlengths 7 9.92k |
|---|---|
diff --git a/lib/apipie/params/dsl.rb b/lib/apipie/params/dsl.rb
index abc1234..def5678 100644
--- a/lib/apipie/params/dsl.rb
+++ b/lib/apipie/params/dsl.rb
@@ -14,7 +14,7 @@ # Example:
# param :greeting, String, :desc => "arbitrary text", :required => true
#
- def param(param_name, descriptor_arg, desc_or_options = nil, options = {}, &block) #:doc:
+ def param(param_name, descriptor_arg = nil, desc_or_options = nil, options = {}, &block) #:doc:
if desc_or_options.is_a? String
options = options.merge(:desc => desc_or_options)
end
| Make the validator argument for param optional
|
diff --git a/lib/tentd/models/entity.rb b/lib/tentd/models/entity.rb
index abc1234..def5678 100644
--- a/lib/tentd/models/entity.rb
+++ b/lib/tentd/models/entity.rb
@@ -5,6 +5,8 @@
def self.first_or_create(entity_uri)
first(:entity => entity_uri) || create(:entity => entity_uri)
+ rescue Sequel::UniqueConstraintViolation
+ first(:entity => entity_uri)
end
end
| Fix race condition for Entity.first_or_create
|
diff --git a/app/controllers/carto/api/received_notifications_controller.rb b/app/controllers/carto/api/received_notifications_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/carto/api/received_notifications_controller.rb
+++ b/app/controllers/carto/api/received_notifications_controller.rb
@@ -8,7 +8,7 @@
ssl_required :update
- before_filter :only_owner
+ before_filter :load_user
before_filter :load_notification, only: [:update]
setup_default_rescues
@@ -30,14 +30,13 @@
private
- def only_owner
- unless current_user.id == params[:user_id]
- raise Carto::UnauthorizedError.new('Can only access own notifications')
- end
+ def load_user
+ @user = Carto::User.find(current_user.id)
+ raise Carto::UnauthorizedError.new('Can only access own notifications') unless @user.id == params[:user_id]
end
def load_notification
- @received_notification = ReceivedNotification.where(user_id: current_user.id, id: params[:id]).first!
+ @received_notification = @user.received_notifications.find(params[:id])
end
end
end
| Revert "Avoid loading user model"
This reverts commit 0990bf5b67d84cb5559145a80c811442233a5676.
|
diff --git a/examples/test_ffi_struct.rb b/examples/test_ffi_struct.rb
index abc1234..def5678 100644
--- a/examples/test_ffi_struct.rb
+++ b/examples/test_ffi_struct.rb
@@ -0,0 +1,40 @@+require 'ffi'
+require 'forwardable'
+
+class Foo < FFI::Struct
+ layout :a, :int, :b, :int
+end
+
+class Bar < Foo
+ layout :p, Foo, :c, :int
+end
+
+bar = Bar.new
+bar[:p][:a] = 20
+foo = Foo.new(bar.to_ptr)
+puts foo[:a]
+
+class Foo2
+ extend Forwardable
+ def_delegators :@struct, :[], :to_ptr
+ class Struct < FFI::Struct
+ layout :a, :int, :b, :int
+ end
+ def initialize(ptr=nil)
+ @struct = Struct.new(ptr)
+ end
+end
+
+class Bar2 < Foo2
+ class Struct < FFI::Struct
+ layout :p, Foo2::Struct, :c, :int
+ end
+ def initialize(ptr=nil)
+ @struct = Struct.new(ptr)
+ end
+end
+
+bar = Bar2.new
+bar[:p][:a] = 20
+foo = Foo2.new(bar.to_ptr)
+puts foo[:a]
| Add test for inheritance with FFI::Struct (2 options).
|
diff --git a/spec/nc_spec.rb b/spec/nc_spec.rb
index abc1234..def5678 100644
--- a/spec/nc_spec.rb
+++ b/spec/nc_spec.rb
@@ -1,10 +1,4 @@ require 'nc'
-
-RSpec.configure do |config|
- config.color_enabled = true
- config.formatter = 'doc'
- config.formatter = 'Nc'
-end
describe Nc do
let(:formatter) { Nc.new(StringIO.new) }
| Remove RSpec configuration from the spec file.
|
diff --git a/lib/blossom.rb b/lib/blossom.rb
index abc1234..def5678 100644
--- a/lib/blossom.rb
+++ b/lib/blossom.rb
@@ -13,14 +13,12 @@ set :views, root
set :index, index
- Compass.configuration do |config|
- config.project_path = root
- config.sass_dir = ""
- config.images_dir = "static"
- config.http_images_path = "/"
- config.output_style = :compact
- config.line_comments = false
- end
+ Compass.configuration.project_path = root
+ Compass.configuration.sass_dir = ""
+ Compass.configuration.images_dir = "static"
+ Compass.configuration.http_images_path = "/"
+ Compass.configuration.output_style = :compact
+ Compass.configuration.line_comments = false
set :haml, { :format => :html5, :attr_wrapper => '"' }
set :sass, Compass.sass_engine_options
| Use inline Compass configuration instead of passing block.
|
diff --git a/lib/database_cleaner/spec/shared_examples.rb b/lib/database_cleaner/spec/shared_examples.rb
index abc1234..def5678 100644
--- a/lib/database_cleaner/spec/shared_examples.rb
+++ b/lib/database_cleaner/spec/shared_examples.rb
@@ -13,3 +13,12 @@ it { is_expected.to respond_to(:clean) }
it { is_expected.to respond_to(:cleaning) }
end
+
+RSpec.shared_examples_for "a database_cleaner adapter" do
+ it { expect(described_class).to respond_to(:available_strategies) }
+ it { expect(described_class).to respond_to(:default_strategy) }
+
+ it 'default_strategy should be part of available_strategies' do
+ expect(described_class.available_strategies).to include(described_class.default_strategy)
+ end
+end
| Add shared example for database_cleaner adapter
|
diff --git a/haxby.rb b/haxby.rb
index abc1234..def5678 100644
--- a/haxby.rb
+++ b/haxby.rb
@@ -3,7 +3,7 @@ class Haxby < Formula
homepage 'https://github.com/tabletcorry/haxby'
url "https://github.com/tabletcorry/haxby/tarball/haxby-0.4"
- head "git://github.com/tabletcorry/haxby.git"
+ head "https://github.com/tabletcorry/haxby.git"
sha256 "64c36303f41a10462971a6a75bf7c511b4bbf75a97cb78a66bfa07475691073a"
depends_on 'coreutils' # Specifically greadlink
| Switch HEAD url to https, per brew best practices
|
diff --git a/lib/brewery.rb b/lib/brewery.rb
index abc1234..def5678 100644
--- a/lib/brewery.rb
+++ b/lib/brewery.rb
@@ -2,7 +2,6 @@ require "brewery/auth_core"
require "jquery-rails"
-require "sass-rails"
require "coffee-rails"
require "bootstrap-sass"
| Remove sass-rails as a dependency
|
diff --git a/lib/rspec_api_documentation/api_formatter.rb b/lib/rspec_api_documentation/api_formatter.rb
index abc1234..def5678 100644
--- a/lib/rspec_api_documentation/api_formatter.rb
+++ b/lib/rspec_api_documentation/api_formatter.rb
@@ -1,7 +1,7 @@-require 'rspec/core/formatters/base_formatter'
+require 'rspec/core/formatters/base_text_formatter'
module RspecApiDocumentation
- class ApiFormatter < RSpec::Core::Formatters::BaseFormatter
+ class ApiFormatter < RSpec::Core::Formatters::BaseTextFormatter
def initialize(output)
super
| Change ApiFormatter to subclass BaseTextFormatter
|
diff --git a/lib/rubycritic/source_control_systems/git.rb b/lib/rubycritic/source_control_systems/git.rb
index abc1234..def5678 100644
--- a/lib/rubycritic/source_control_systems/git.rb
+++ b/lib/rubycritic/source_control_systems/git.rb
@@ -17,7 +17,7 @@ end
def head_reference
- `git rev-parse --verify HEAD`.chomp
+ `git rev-parse --verify HEAD`.chomp!
end
def travel_to_head
| Modify string in place with bang method
|
diff --git a/lib/money-rails/money.rb b/lib/money-rails/money.rb
index abc1234..def5678 100644
--- a/lib/money-rails/money.rb
+++ b/lib/money-rails/money.rb
@@ -2,8 +2,9 @@ require "active_support/core_ext/hash/reverse_merge.rb"
class Money
+ alias_method :orig_format, :format
- def format_with_settings(*rules)
+ def format(*rules)
rules = normalize_formatting_rules(rules)
# Apply global defaults for money only for non-nil values
@@ -19,9 +20,7 @@ rules.reverse_merge!(MoneyRails::Configuration.default_format)
end
- format_without_settings(rules)
+ orig_format(rules)
end
- alias_method_chain :format, :settings
-
end
| Use alias_method instead of alias_method_chain
|
diff --git a/lib/nehm/path_manager.rb b/lib/nehm/path_manager.rb
index abc1234..def5678 100644
--- a/lib/nehm/path_manager.rb
+++ b/lib/nehm/path_manager.rb
@@ -13,8 +13,19 @@ # Checks path for validation and returns it if valid
def self.get_path(path)
- # Check path for existence
- UI.term 'Invalid download path. Please enter correct path' unless Dir.exist?(path)
+ unless Dir.exist?(path)
+ UI.warning "This directory doesn't exist."
+ wish = UI.ask('Want to create it? (Y/n):')
+ wish = 'y' if wish == ''
+
+ if wish.downcase =~ /y/
+ UI.say "Creating directory: #{path}"
+ UI.newline
+ Dir.mkdir(File.expand_path(path), 0775)
+ else
+ UI.term
+ end
+ end
File.expand_path(path)
end
| Add creation a directory entered in `to` option
|
diff --git a/lib/phil_columns/seed.rb b/lib/phil_columns/seed.rb
index abc1234..def5678 100644
--- a/lib/phil_columns/seed.rb
+++ b/lib/phil_columns/seed.rb
@@ -2,11 +2,12 @@ class Seed
def self.envs( *envs )
- @_envs = envs.sort.map( &:to_s )
+ _envs += envs.sort.map( &:to_s )
+ end
end
def self.tags( *tags )
- @_tags = tags.sort.map( &:to_s )
+ _tags += tags.sort.map( &:to_s )
end
def self._envs
| Make 'envs' and 'tags' statements callable more than once
|
diff --git a/lib/optical.rb b/lib/optical.rb
index abc1234..def5678 100644
--- a/lib/optical.rb
+++ b/lib/optical.rb
@@ -35,7 +35,7 @@ end
if exits.any?{|e| !e}
- on_error.call("A thread failed")
+ on_error.call("A thread failed near: #{caller_locations(2,1)[0].to_s}")
return false
end
return true
| Add a little more debug/loc info on thread failures
|
diff --git a/lib/promise.rb b/lib/promise.rb
index abc1234..def5678 100644
--- a/lib/promise.rb
+++ b/lib/promise.rb
@@ -58,10 +58,10 @@ end
end
- def reject(reason = Error, backtrace = nil)
+ def reject(reason = nil, backtrace = nil)
dispatch(backtrace) do
@state = :rejected
- @reason = reason
+ @reason = reason || Error
end
end
| Revert "Set default reason in arglist, previously counted as ControlParameter"
This reverts commit cbfe6f20ec693c7e6d1cbf58f750b6639bb42a46.
|
diff --git a/slack-gamebot/api/presenters/status_presenter.rb b/slack-gamebot/api/presenters/status_presenter.rb
index abc1234..def5678 100644
--- a/slack-gamebot/api/presenters/status_presenter.rb
+++ b/slack-gamebot/api/presenters/status_presenter.rb
@@ -11,14 +11,8 @@
property :games_count
property :games
- property :gc
private
-
- def gc
- GC.start
- GC.stat
- end
def games_count
Game.count
| Remove aggressive GC, a better solution is to split processes.
|
diff --git a/black_list.rb b/black_list.rb
index abc1234..def5678 100644
--- a/black_list.rb
+++ b/black_list.rb
@@ -12,5 +12,6 @@ ["coq-compcert.3.5", "Error: Corrupted compiled interface"], # flaky Makefile
["coq-metacoq-erasure.1.0~alpha+8.8", "make inconsistent assumptions over interface Quoter"],
["coq-stalmarck.8.5.0", "Error: Could not find the .cmi file for interface stal.mli."], # flaky Makefile
+ ["coq-stalmarck.8.12.0", "coq-stalmarck -> coq >= 8.12"], # flaky Makefile
["coq-vst.2.2", "Error: Corrupted compiled interface"]
]
| Add coq-stalmarck.8.12.0 to the black-list
|
diff --git a/lib/quality/process_runner.rb b/lib/quality/process_runner.rb
index abc1234..def5678 100644
--- a/lib/quality/process_runner.rb
+++ b/lib/quality/process_runner.rb
@@ -4,9 +4,9 @@ # Wrapper around IO.popen that allows exit status to be mocked in tests.
class ProcessRunner
def initialize(full_cmd,
- popener: IO)
+ dependencies = {})
@full_cmd = full_cmd
- @popener = popener
+ @popener = dependencies[:popener] || IO
end
def run
| Fix compatibility with Ruby 1.9.3
|
diff --git a/core/app/classes/open_graph/objects/og_fact.rb b/core/app/classes/open_graph/objects/og_fact.rb
index abc1234..def5678 100644
--- a/core/app/classes/open_graph/objects/og_fact.rb
+++ b/core/app/classes/open_graph/objects/og_fact.rb
@@ -1,9 +1,13 @@ module OpenGraph::Objects
class OgFact < OpenGraph::Object
def initialize fact
- open_graph_field :type, 'factlinkdevelopment:factlink'
+ open_graph_field :type, "#{facebook_app_namespace}:factlink"
open_graph_field :url, fact.url.sharing_url
open_graph_field :title, fact.displaystring
end
+
+ def facebook_app_namespace
+ FactlinkUI::Application.config.facebook_app_namespace
+ end
end
end
| Use correct Facebook app namespace in meta tag for each environment
|
diff --git a/lib/specinfra/ec2_metadata.rb b/lib/specinfra/ec2_metadata.rb
index abc1234..def5678 100644
--- a/lib/specinfra/ec2_metadata.rb
+++ b/lib/specinfra/ec2_metadata.rb
@@ -3,20 +3,73 @@ class Ec2Metadata
def initialize
@base_uri = 'http://169.254.169.254/latest/meta-data/'
+ @metadata = {}
end
- def get(path='')
+ def get
+ @metadata = get_metadata
+ self
+ end
+
+ def [](key)
+ if @metadata[key].nil?
+ begin
+ require "specinfra/ec2_metadata/#{key}"
+ inventory_class = Specinfra::Ec2Metadata.const_get(key.to_camel_case)
+ @metadata[key] = inventory_class.get
+ rescue LoadError
+ @metadata[key] = nil
+ rescue
+ @metadata[key] = nil
+ end
+ end
+
+ @metadata[key]
+ end
+
+ def empty?
+ @metadata.empty?
+ end
+
+ def each
+ keys.each do |k|
+ yield k, @metadata[k]
+ end
+ end
+
+ def each_key
+ keys.each do |k|
+ yield k
+ end
+ end
+
+ def each_value
+ keys.each do |k|
+ yield @metadata[k]
+ end
+ end
+
+ def keys
+ @metadata.keys
+ end
+
+ def inspect
+ @metadata
+ end
+
+ private
+ def get_metadata(path='')
metadata = {}
keys = Specinfra::Runner.run_command("curl #{@base_uri}#{path}").stdout.split("\n")
keys.each do |key|
if key =~ %r{/$}
- metadata[key[0..-2]] = get(path + key)
+ metadata[key[0..-2]] = get_metadata(path + key)
else
if key =~ %r{=}
key = key.split('=')[0] + '/'
- metadata[key[0..-2]] = get(path + key)
+ metadata[key[0..-2]] = get_metadata(path + key)
else
ret = get_endpoint(path)
metadata[key] = get_endpoint(path + key) if ret
| Fix to extend Ec2Metadata easily by external gem
|
diff --git a/spec/requests/tool_integration/annuities_spec.rb b/spec/requests/tool_integration/annuities_spec.rb
index abc1234..def5678 100644
--- a/spec/requests/tool_integration/annuities_spec.rb
+++ b/spec/requests/tool_integration/annuities_spec.rb
@@ -3,12 +3,8 @@ context 'when the feature flag is enabled' do
it 'routes correctly' do
Feature.with(:annuities_landing_page) do
- expect(get('/en/tools/annuities')).to route_to(
- controller: 'landing_pages',
- action: 'show',
- locale: 'en',
- id: 'annuities'
- )
+ get('/en/tools/annuities')
+ expect(response).to be_success
end
end
end
| Change the matcher verification for annuites spec
* The spec was renamed to requests so the route to does not exist
here. Changing the matcher will fix the spec.
* This only spec can be runned with anuites feature flag turn on
|
diff --git a/lib/grape_devise_token_auth/token_authorizer.rb b/lib/grape_devise_token_auth/token_authorizer.rb
index abc1234..def5678 100644
--- a/lib/grape_devise_token_auth/token_authorizer.rb
+++ b/lib/grape_devise_token_auth/token_authorizer.rb
@@ -11,8 +11,12 @@ @resource_class = devise_interface.mapping_to_class(mapping)
return nil unless resource_class
+ # client id is not required
+ client_id = data.client_id || 'default'
+
resource_from_existing_devise_user
- return resource if correct_resource_type_logged_in?
+ return resource if correct_resource_type_logged_in? &&
+ resource_does_not_have_client_token?(client_id)
return nil unless data.token_prerequisites_present?
load_user_from_uid
@@ -42,5 +46,9 @@ def correct_resource_type_logged_in?
resource && resource.class == resource_class
end
+
+ def resource_does_not_have_client_token?(client_id)
+ resource.tokens[client_id].nil?
+ end
end
end
| Add check for client id on warden user
A user signed into warden (through devise for example), GTDA wasn't
checking to see if that user already has a client_id. This commmit
changes it so that it does.
|
diff --git a/lib/facter/virtualenv_version.rb b/lib/facter/virtualenv_version.rb
index abc1234..def5678 100644
--- a/lib/facter/virtualenv_version.rb
+++ b/lib/facter/virtualenv_version.rb
@@ -6,7 +6,7 @@ has_weight 100
setcode do
begin
- Facter::Util::Resolution.exec('virtualenv --version')
+ Facter::Util::Resolution.exec('virtualenv --version') || "absent"
rescue
false
end
| Return 'absent' instead of nil
|
diff --git a/lib/rom/support/class_builder.rb b/lib/rom/support/class_builder.rb
index abc1234..def5678 100644
--- a/lib/rom/support/class_builder.rb
+++ b/lib/rom/support/class_builder.rb
@@ -1,10 +1,24 @@ module ROM
+ # Internal support class for generating classes
+ #
+ # @private
class ClassBuilder
include Options
option :name, type: String, reader: true
option :parent, type: Class, reader: true, parent: Object
+ # Generate a class based on options
+ #
+ # @example
+ # builder = ROM::ClasBuilder.new(name: 'MyClass')
+ #
+ # klass = builder.call
+ # klass.name # => "MyClass"
+ #
+ # @return [Class]
+ #
+ # @api private
def call
klass = Class.new(parent)
| Add YARD docs to ClassBuilder support class
|
diff --git a/spec/volunteermatch/api/hello_world_spec.rb b/spec/volunteermatch/api/hello_world_spec.rb
index abc1234..def5678 100644
--- a/spec/volunteermatch/api/hello_world_spec.rb
+++ b/spec/volunteermatch/api/hello_world_spec.rb
@@ -4,6 +4,11 @@ subject { Volunteermatch::Client.new('VolunteerMatch','test_key') }
describe "helloWorld api call" do
+ it "should call #test with appropriate arguments" do
+ expect(subject).to receive(:test).with("VolunteerMatch")
+ subject.test("VolunteerMatch")
+ end
+
it "returns the correct name" do
url = URI.parse("http://www.volunteermatch.org/api/call?action=helloWorld&query=" + URI.encode({name: "VolunteerMatch"}.to_json))
stub = stub_get(url).to_return(status: 200, body: fixture("hello_world.json"), headers: { content_type: "application/json" })
| Add additional test to helloWorld api call
|
diff --git a/ab.gemspec b/ab.gemspec
index abc1234..def5678 100644
--- a/ab.gemspec
+++ b/ab.gemspec
@@ -23,4 +23,5 @@ spec.add_development_dependency 'bundler', '~> 1.3'
spec.add_development_dependency 'rake', '~> 10.1', '>= 10.1.0'
spec.add_development_dependency 'rspec', '~> 2.14', '>= 2.14.0'
+ spec.add_development_dependency 'json-schema', '~> 2.2.2', '>= 2.2.2'
end
| Add json-schema as development dependency
|
diff --git a/spec/adapter_spec.rb b/spec/adapter_spec.rb
index abc1234..def5678 100644
--- a/spec/adapter_spec.rb
+++ b/spec/adapter_spec.rb
@@ -38,7 +38,7 @@ end
it 'should not have duplicate ids' do
- file = @adapter.send(:yaml_file, Example)
+ file = adapter.send(:yaml_file, Example)
results = YAML.load(open(file).read)
results[0]['id'].should_not == results[1]['id']
end
| Fix specs to use method defined by let() rather than an ivar
|
diff --git a/test/everypolitician_index_test.rb b/test/everypolitician_index_test.rb
index abc1234..def5678 100644
--- a/test/everypolitician_index_test.rb
+++ b/test/everypolitician_index_test.rb
@@ -4,10 +4,8 @@ def test_country
VCR.use_cassette('countries_json') do
index = Everypolitician::Index.new
- australia = index.country('Australia')
- assert_equal 'Australia', australia.name
- assert_equal 'AU', australia.code
- assert_equal 2, australia.legislatures.size
+ sweden = index.country('Sweden')
+ assert_equal 94_415, sweden.legislature('Riksdag').statement_count
end
end
| Make it clear we're expecting different data for different SHAs
This makes the tests in everypolitician_index_test.rb similar to each
other, so it's clearer that we're testing for the same thing against
different version of the data.
|
diff --git a/tests/serverspec/spec/spec_init.rb b/tests/serverspec/spec/spec_init.rb
index abc1234..def5678 100644
--- a/tests/serverspec/spec/spec_init.rb
+++ b/tests/serverspec/spec/spec_init.rb
@@ -10,6 +10,12 @@ print "------------------------\n"
print " DOCKERIMAGE_ID: " + ENV['DOCKERIMAGE_ID'] + "\n"
print " DOCKER_IMAGE: " + ENV['DOCKER_IMAGE'] + "\n"
+print " DOCKER_TAG: " + ENV['DOCKER_TAG'] + "\n"
print " OS_FAMILY: " + ENV['OS_FAMILY'] + "\n"
print " OS_VERSION: " + ENV['OS_VERSION'] + "\n"
print "\n"
+print "--- internal config -----\n"
+$testConfiguration.each {|key, value| puts " #{key}: #{value}" }
+print "\n"
+
+
| Print internal configuration hash in serverspec
|
diff --git a/db/migrate/20160524170457_create_sub_splits.rb b/db/migrate/20160524170457_create_sub_splits.rb
index abc1234..def5678 100644
--- a/db/migrate/20160524170457_create_sub_splits.rb
+++ b/db/migrate/20160524170457_create_sub_splits.rb
@@ -9,10 +9,6 @@ add_index :sub_splits, :bitkey, unique: true
add_index :sub_splits, :kind, unique: true
- SubSplit.create(bitkey: 1, kind: 'In')
- # 64.to_s(2) = 1000000; this allows room for new sub_splits that would sort between 'in' and 'out'
- SubSplit.create(bitkey: 64, kind: 'Out')
-
end
def self.down
| Remove SubSplit object creation from create_sub_splits migration (allows heroku to migrate up despite code having been updated to remove SubSplit as an ActiveRecord model).
|
diff --git a/plugins/providers/hyperv/action/delete_vm.rb b/plugins/providers/hyperv/action/delete_vm.rb
index abc1234..def5678 100644
--- a/plugins/providers/hyperv/action/delete_vm.rb
+++ b/plugins/providers/hyperv/action/delete_vm.rb
@@ -9,6 +9,14 @@ def call(env)
env[:ui].info("Deleting the machine...")
env[:machine].provider.driver.delete_vm
+ # NOTE: We remove the data directory and recreate it
+ # to overcome an issue seen when running within
+ # the WSL. Hyper-V will successfully remove the
+ # VM and the files will appear to be gone, but
+ # on a subsequent up, they will cause collisions.
+ # This forces them to be gone for real.
+ FileUtils.rm_rf(env[:machine].data_dir)
+ FileUtils.mkdir_p(env[:machine].data_dir)
@app.call(env)
end
end
| Delete and re-create data directory when destroying guest
|
diff --git a/services/importer/lib/importer/result.rb b/services/importer/lib/importer/result.rb
index abc1234..def5678 100644
--- a/services/importer/lib/importer/result.rb
+++ b/services/importer/lib/importer/result.rb
@@ -33,6 +33,16 @@ def update_support_tables(new_list)
@support_tables = new_list
end
+
+ def to_s
+ "<Result #{name}>"
+ end
+
+ def inspect
+ attrs = (ATTRIBUTES - ['log_trace']).map { |attr| "@#{attr}=#{instance_variable_get "@#{attr}"}" }.join(', ')
+ "<#{self.class} #{attrs}>"
+ end
+
end
end
end
| Remove log_trace from Result inspection
Fixes #9615
|
diff --git a/spec/libs/bearer_token/bearer_token_spec.rb b/spec/libs/bearer_token/bearer_token_spec.rb
index abc1234..def5678 100644
--- a/spec/libs/bearer_token/bearer_token_spec.rb
+++ b/spec/libs/bearer_token/bearer_token_spec.rb
@@ -0,0 +1,72 @@+require 'spec_helper'
+require 'delorean'
+def addToken(user, client, expires_at)
+ grant = user.access_grants.create({
+ :client => client,
+ :state => nil,
+ :access_token_expires_at => expires_at },
+ :without_protection => true
+ )
+ grant.access_token
+end
+
+describe BearerToken:BearerTokenAuthenticatable do
+ after(:each) { Delorean.back_to_the_present }
+
+ let(:strategy) { BearerTokenAuthenticatable::BearerToken.new(nil) }
+ let(:request) { mock('request') }
+ let(:mapping) { Devise.mappings[:user] }
+ let(:expires) { Time.now + 10.minutes}
+ let(:token) { addToken(user, client, expires) }
+ let(:headers) { {"Authorization" => "Bearer #{token}"} }
+ let(:user) { FactoryGirl.create(:user) }
+ let(:params) { {} }
+ let(:client) { Client.find_or_create_by_name(
+ :name => "test_api_client",
+ :app_id => "test_api_client",
+ :app_secret => SecureRandom.uuid
+ )}
+ before(:each) {
+ request.stub!(:headers).and_return(headers)
+ request.stub!(:params).and_return(params)
+ strategy.stub!(:mapping).and_return(mapping)
+ strategy.stub!(:request).and_return(request)
+ }
+
+ context 'a user with a short-lived authentication token' do
+ let(:expires) { Time.now + 10.minutes}
+ it 'should authenticate the user' do
+ strategy.authenticate!.should eql :success
+ end
+
+ it 'the token should expire 12 minutes into the futre' do
+ Delorean.jump(12 * 60) # move 12 minutes into the future
+ strategy.authenticate!.should eql :failure
+ end
+ end
+
+ context 'a user with an expired authentication token' do
+ let(:expires) { Time.now - 10.minutes}
+ it 'should NOT authenticate the user' do
+ strategy.authenticate!.should eql :failure
+ end
+ end
+
+ context 'a user with one expired authentication token, and a valid token' do
+ let(:good_token) { addToken(user, client, Time.now + 10.minutes) }
+ let(:expired_token) { addToken(user, client, Time.now - 10.minutes) }
+ context 'when sending the good bearer token' do
+ let(:token){ good_token }
+ it "should authenticate" do
+ strategy.authenticate!.should eql :success
+ end
+ end
+ context 'when sending the expired token' do
+ let(:token){ expired_token }
+ it "authentication should fail" do
+ strategy.authenticate!.should eql :failure
+ end
+ end
+ end
+
+end
| Verify bearer token devise strategy accounts for token expiration
[#111242640]
https://www.pivotaltracker.com/story/show/111242640
|
diff --git a/spec/policies/task_templates_policy_spec.rb b/spec/policies/task_templates_policy_spec.rb
index abc1234..def5678 100644
--- a/spec/policies/task_templates_policy_spec.rb
+++ b/spec/policies/task_templates_policy_spec.rb
@@ -4,7 +4,7 @@ let(:journal) { FactoryGirl.create(:journal) }
let(:manuscript_manager_template) { FactoryGirl.create(:manuscript_manager_template, journal: journal) }
let(:phase_template) { FactoryGirl.create(:phase_template, manuscript_manager_template: manuscript_manager_template) }
- let(:task_template) { FactoryGirl.create(:task_template, phase_template: phase_template, journal_task_type: journal.journal_task_types.first) }
+ let(:task_template) { FactoryGirl.build(:task_template, phase_template: phase_template, journal_task_type: journal.journal_task_types.first) }
let(:policy) { TaskTemplatesPolicy.new(current_user: user, task_template: task_template) }
context "admin" do
| Build task_template instead of create
|
diff --git a/objective-c/auth_sample/AuthTestService.podspec b/objective-c/auth_sample/AuthTestService.podspec
index abc1234..def5678 100644
--- a/objective-c/auth_sample/AuthTestService.podspec
+++ b/objective-c/auth_sample/AuthTestService.podspec
@@ -0,0 +1,35 @@+Pod::Spec.new do |s|
+ s.name = "AuthTestService"
+ s.version = "0.0.1"
+ s.license = "New BSD"
+
+ s.ios.deployment_target = "6.0"
+ s.osx.deployment_target = "10.8"
+
+ # Base directory where the .proto files are.
+ src = "../../protos"
+
+ # Directory where the generated files will be place.
+ dir = "Pods/" + s.name
+
+ # Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients.
+ s.prepare_command = <<-CMD
+ mkdir -p #{dir}
+ protoc -I #{src} --objc_out=#{dir} --objcgrpc_out=#{dir} #{src}/auth_sample.proto
+ CMD
+
+ s.subspec "Messages" do |ms|
+ ms.source_files = "#{dir}/*.pbobjc.{h,m}", "#{dir}/**/*.pbobjc.{h,m}"
+ ms.header_mappings_dir = dir
+ ms.requires_arc = false
+ ms.dependency "Protobuf", "~> 3.0.0-alpha-3"
+ end
+
+ s.subspec "Services" do |ss|
+ ss.source_files = "#{dir}/*.pbrpc.{h,m}", "#{dir}/**/*.pbrpc.{h,m}"
+ ss.header_mappings_dir = dir
+ ss.requires_arc = true
+ ss.dependency "gRPC", "~> 0.5"
+ ss.dependency "#{s.name}/Messages"
+ end
+end
| Add podspec for auth proto library
|
diff --git a/spec/classes/hitch_spec.rb b/spec/classes/hitch_spec.rb
index abc1234..def5678 100644
--- a/spec/classes/hitch_spec.rb
+++ b/spec/classes/hitch_spec.rb
@@ -5,7 +5,24 @@ context "on #{os}" do
let(:facts) { os_facts }
- it { is_expected.to compile }
+ context 'defaults' do
+ it { is_expected.to compile }
+ it { is_expected.to contain_exec('hitch::config generate dhparams') }
+ it {
+ is_expected.to contain_file('/etc/hitch/dhparams.pem')
+ .without_content
+ }
+ end
+
+ context 'with dhparams_content' do
+ let(:params) { { dhparams_content: 'BEGIN DH PARAMETERS' } }
+
+ it { is_expected.not_to contain_exec('hitch::config generate dhparams') }
+ it {
+ is_expected.to contain_file('/etc/hitch/dhparams.pem')
+ .with_content(%r{BEGIN DH PARAMETERS})
+ }
+ end
end
end
end
| Add test for missing dhparams content
This should fail until #6 is fixed.
|
diff --git a/spec/lib/resources_spec.rb b/spec/lib/resources_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/resources_spec.rb
+++ b/spec/lib/resources_spec.rb
@@ -3,7 +3,7 @@ describe Cathode::Resource do
describe '.new' do
context 'with a nonexistent resource' do
- subject { Class.new(Cathode::Base) { resource :boxes, actions: [:all] } }
+ subject { Cathode::Resource.new(:boxes, [:all]) }
it 'raises an error' do
expect { subject }.to raise_error(Cathode::UnknownResourceError)
@@ -11,11 +11,7 @@ end
context 'with an existing resource' do
- before do
- Rails::Application.class_eval 'class Product < ActiveRecord::Base; end'
- end
-
- subject { Class.new(Cathode::Base) { resource :products, actions: [:all] } }
+ subject { Cathode::Resource.new(:products, [:all]) }
it 'creates a controller' do
subject
| Test against the actual resource instantiation method
|
diff --git a/spec/rules_checker_spec.rb b/spec/rules_checker_spec.rb
index abc1234..def5678 100644
--- a/spec/rules_checker_spec.rb
+++ b/spec/rules_checker_spec.rb
@@ -10,21 +10,21 @@ fourth_rule: { proper_controllers_amount: 2, total_controllers_amount: 2 }
}
end
-
+
let(:succeed_conditions) do
{
first_rule: { small_classes_amount: 2, total_classes_amount: 2 },
second_rule: { small_methods_amount: 2, total_methods_amount: 2 },
third_rule: { proper_method_calls: 2, total_method_calls: 2 },
- fourth_rule: { proper_controllers_amount: 2, total_controllers_amount: 2 }
+ fourth_rule: { proper_controllers_amount: 0, total_controllers_amount: 0 }
}
end
-
+
describe "#ok?" do
it "returns false in any of conditions fail" do
expect(SandiMeter::RulesChecker.new(fail_conditions)).to_not be_ok
end
-
+
it "returns true if all of conditions succeed" do
expect(SandiMeter::RulesChecker.new(succeed_conditions)).to be_ok
end
| Test case for RulesChecker with 0 controllers
|
diff --git a/spec/abstract_class_spec.rb b/spec/abstract_class_spec.rb
index abc1234..def5678 100644
--- a/spec/abstract_class_spec.rb
+++ b/spec/abstract_class_spec.rb
@@ -1,4 +1,4 @@-require_relative '../lib/abstract_class'
+require File.expand_path('../../lib/abstract_class', __FILE__)
RSpec.describe AbstractClass do
let(:abstract) { Class.new.extend(described_class) }
| Use require with expand_path instead of require_relative
|
diff --git a/spec/models/payload_spec.rb b/spec/models/payload_spec.rb
index abc1234..def5678 100644
--- a/spec/models/payload_spec.rb
+++ b/spec/models/payload_spec.rb
@@ -6,11 +6,25 @@ describe 'attributes' do
it { expect(@payload).to respond_to :header }
it { expect(@payload).to respond_to :data }
+ it { expect(@payload).to respond_to :header_type }
end
describe 'attribute types' do
it { expect(@payload.header).to be_kind_of Fixnum }
it { expect(@payload.data).to be_kind_of String }
+ it { expect(@payload.header_type).to be_kind_of String }
+ end
+
+ describe 'header' do
+ it 'should use default value' do
+ @payload = Payload.new 'asdfg', 'data'
+ expect(@payload.header).to equal 0
+ end
+
+ it 'should not be negative' do
+ @payload = Payload.new -125, 'data'
+ expect(@payload.header).to equal 0
+ end
end
end | Add new tests for Payload attributes
|
diff --git a/spec/raptor/version_spec.rb b/spec/raptor/version_spec.rb
index abc1234..def5678 100644
--- a/spec/raptor/version_spec.rb
+++ b/spec/raptor/version_spec.rb
@@ -1,6 +1,6 @@ require 'spec_helper'
-describe Raptor::VERSION do
+describe "Raptor::VERSION" do
it 'holds the version number of the library' do
splits = Raptor::VERSION.to_s.split( '.' )
| Use a string to avoid expansion
|
diff --git a/spec/support/auth_helper.rb b/spec/support/auth_helper.rb
index abc1234..def5678 100644
--- a/spec/support/auth_helper.rb
+++ b/spec/support/auth_helper.rb
@@ -1,13 +1,8 @@ module AuthHelper
def visit_protected(path)
- password = gen_secure_pass
- user = create(:user, password: password)
+ user = create(:user, password: gen_secure_pass)
- visit path
-
- fill_in 'Username or Email', with: user.username
- fill_in 'Password', with: password
- click_button 'Sign In'
+ visit_protected_path(path, user.username, password)
end
def visit_protected_as(path, create_params)
@@ -17,21 +12,11 @@ password = create_params[:password]
user = create(:user, create_params)
- visit path
-
- fill_in 'Username or Email', with: user.username
- fill_in 'Password', with: password
- click_button 'Sign In'
+ visit_protected_path(path, user.username, password)
end
def visit_protected_as_user(path, user)
- password = gen_new_user_pass(user)
-
- visit path
-
- fill_in 'Username or Email', with: user.username
- fill_in 'Password', with: password
- click_button 'Sign In'
+ visit_protected_path(path, user.username, gen_new_user_pass(user))
end
shared_examples 'a protected page' do |path_as_sym|
@@ -59,4 +44,12 @@ password_confirmation: password)
password
end
+
+ def visit_protected_path(path, username, password)
+ visit path
+
+ fill_in 'Username or Email', with: username
+ fill_in 'Password', with: password
+ click_button 'Sign In'
+ end
end
| Refactor visit_protected* methods in AuthHelper
|
diff --git a/app/controllers/spree/checkout_controller_decorator.rb b/app/controllers/spree/checkout_controller_decorator.rb
index abc1234..def5678 100644
--- a/app/controllers/spree/checkout_controller_decorator.rb
+++ b/app/controllers/spree/checkout_controller_decorator.rb
@@ -2,13 +2,13 @@
Spree::PermittedAttributes.checkout_attributes << :gift_code
- durably_decorate :update, mode: 'soft', sha: '908d25b70eff597d32ddad7876cd89d3683d6734' do
+ durably_decorate :update, mode: 'soft', sha: '9774bcd294f748bd6185a0c8f7d518e624b99ff7' do
if @order.update_from_params(params, permitted_checkout_attributes)
if @order.gift_code.present?
render :edit and return unless apply_gift_code
end
- persist_user_address
+ @order.temporary_address = !params[:save_user_address]
unless @order.next
flash[:error] = @order.errors.full_messages.join("\n")
redirect_to checkout_state_path(@order.state) and return
| Update checkout decorator for Spree 2.4
The checkout controller has changed between spree 2.2 -> 2.4, in that
the address parameters now appear to be part of the order details rather
than having to persist it separately.
The commit that changed it in spree is:
https://github.com/spree/spree/commit/7c16987c822b1ca97e2b3f781aa991e1db9697ec#diff-41759f421fa5ee0d427fec7411738b50
|
diff --git a/spree_bank_transfer.gemspec b/spree_bank_transfer.gemspec
index abc1234..def5678 100644
--- a/spree_bank_transfer.gemspec
+++ b/spree_bank_transfer.gemspec
@@ -1,7 +1,7 @@ # encoding: UTF-8
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
- s.name = 'spree_bank_transfer'
+ s.name = 'spree-bank-transfer'
s.version = '2.1.0'
s.summary = 'Creates bank transfer payment method'
s.description = 'This extension allows admin to provide bank transfer payment method to its users.'
| Update gem name in gemspec
|
diff --git a/schema_to_scaffold.gemspec b/schema_to_scaffold.gemspec
index abc1234..def5678 100644
--- a/schema_to_scaffold.gemspec
+++ b/schema_to_scaffold.gemspec
@@ -9,7 +9,7 @@ gem.authors = ["Humberto Pinto", "João Soares"]
gem.email = ["h.lsp999@gmail.com", "jsoaresgeral@gmail.com"]
gem.description = <<-EOD
- Command line app for windows and linux which parses a schema.rb file obtained from your rails repo or by running rake:schema:dump
+ Command line app which parses a schema.rb file obtained from your rails repo or by running rake:schema:dump
EOD
gem.summary = %q{Generate rails scaffold script from a schema.rb file.}
gem.homepage = "http://github.com/frenesim/schema_to_scaffold"
| Remove OS references in description
Since this is now a gem it should work for all platforms with
ruby and rubygems-bundler installed
Signed-off-by: João Soares <aa8bbb841c16da95f4aa0fde9f93d16ce9f21700@gmail.com>
|
diff --git a/app/controllers/import/gitorious_controller.rb b/app/controllers/import/gitorious_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/import/gitorious_controller.rb
+++ b/app/controllers/import/gitorious_controller.rb
@@ -15,7 +15,7 @@ @already_added_projects = current_user.created_projects.where(import_type: "gitorious")
already_added_projects_names = @already_added_projects.pluck(:import_source)
- @repos.to_a.reject! { |repo| already_added_projects_names.include? repo.full_name }
+ @repos.reject! { |repo| already_added_projects_names.include? repo.full_name }
end
def jobs
| Fix Gitorious import status page hiding of already added projects.
|
diff --git a/app/models/france_connect_entreprise_client.rb b/app/models/france_connect_entreprise_client.rb
index abc1234..def5678 100644
--- a/app/models/france_connect_entreprise_client.rb
+++ b/app/models/france_connect_entreprise_client.rb
@@ -2,8 +2,8 @@
def initialize params={}
super(
- identifier: FRANCE_CONNECT.identifier,
- secret: FRANCE_CONNECT.secret,
+ identifier: FRANCE_CONNECT.entreprise_identifier,
+ secret: FRANCE_CONNECT.entreprise_secret,
redirect_uri: FRANCE_CONNECT.entreprise_redirect_uri,
| Change identifier and secret name for FranceConnect::Entreprise connection
|
diff --git a/black_list.rb b/black_list.rb
index abc1234..def5678 100644
--- a/black_list.rb
+++ b/black_list.rb
@@ -8,5 +8,6 @@ ["coq-compcert.3.3.0", "Error: Corrupted compiled interface"], # flaky Makefile
["coq-compcert.3.6", "Error: Corrupted compiled interface"], # flaky Makefile
["coq-metacoq-erasure.1.0~alpha+8.8", "make inconsistent assumptions over interface Quoter"],
- ["coq-stalmarck.8.5.0", "Error: Could not find the .cmi file for interface stal.mli."] # flaky Makefile
+ ["coq-stalmarck.8.5.0", "Error: Could not find the .cmi file for interface stal.mli."], # flaky Makefile
+ ["coq-vst.2.2", "Error: Corrupted compiled interface"]
]
| Add VST to the black-list for the CompCert dependency
|
diff --git a/app/controllers/api/users_controller.rb b/app/controllers/api/users_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/users_controller.rb
+++ b/app/controllers/api/users_controller.rb
@@ -21,6 +21,7 @@ params.require(:user).permit(:firstname, :lastname, :program, :start_year,
:avatar, :student_id, :phone, :display_phone,
:remove_avatar, :food_custom, :notify_messages,
- :notify_event_users, :notify_event_closing, food_preferences: [])
+ :notify_event_users, :notify_event_closing,
+ :notify_event_open, food_preferences: [])
end
end
| Fix bug where notification setting could not be updated via the API
|
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
@@ -13,11 +13,11 @@ end
def show
- send_file @document.document.path, type: @document.document_content_type, disposition: 'inline'
+ send_file @document.document.url, type: @document.document_content_type, disposition: 'inline'
end
def download
- send_file @document.document.path, type: @document.document_content_type, x_sendfile: true
+ send_file @document.document.url, type: @document.document_content_type, x_sendfile: true
end
def update
| Fix broken download links on heroku
The path call works with filesystems, but not where S3 buckets are
concerned. This is a quick-fix for that for now.
|
diff --git a/app/controllers/languages_controller.rb b/app/controllers/languages_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/languages_controller.rb
+++ b/app/controllers/languages_controller.rb
@@ -6,11 +6,11 @@ def show
find_language
- @created = Project.language(@language).few_versions.order('projects.created_at DESC').limit(5).includes(:github_repository)
- @updated = Project.language(@language).many_versions.order('projects.latest_release_published_at DESC').limit(5).includes(:github_repository)
+ @created = []#Project.language(@language).few_versions.order('projects.created_at DESC').limit(5).includes(:github_repository)
+ @updated = []#Project.language(@language).many_versions.order('projects.latest_release_published_at DESC').limit(5).includes(:github_repository)
@color = Languages::Language[@language].try(:color)
- @watched = Project.language(@language).most_watched.limit(5)
- @popular = Project.language(@language).order('projects.rank DESC').limit(5).includes(:github_repository)
+ @watched = []#Project.language(@language).most_watched.limit(5)
+ @popular = []#Project.language(@language).order('projects.rank DESC').limit(5).includes(:github_repository)
end
def find_language
| Disable the language pages for a minute |
diff --git a/app/controllers/effective/pages_controller.rb b/app/controllers/effective/pages_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/effective/pages_controller.rb
+++ b/app/controllers/effective/pages_controller.rb
@@ -5,7 +5,9 @@ @pages = @pages.published if params[:edit].to_s != 'true'
@page = @pages.find(params[:id])
- raise Effective::AccessDenied unless (@page.present? && @page.roles_permit?(current_user))
+
+ raise ActiveRecord::RecordNotFound unless @page.present? # Incase .find() isn't raising it
+ raise Effective::AccessDenied unless @page.roles_permit?(current_user)
EffectivePages.authorized?(self, :show, @page)
| Raise the proper 404 even if find() has been overridden not to.
|
diff --git a/lib/dbcode.rb b/lib/dbcode.rb
index abc1234..def5678 100644
--- a/lib/dbcode.rb
+++ b/lib/dbcode.rb
@@ -3,10 +3,11 @@ autoload :Schema, 'dbcode/schema'
autoload :Graph, 'dbcode/graph'
extend self
- attr_accessor :sql_file_path
+ attr_accessor :sql_file_path, :code_schema_name
+ self.code_schema_name ||= 'code'
def ensure_freshness!
- code = Schema.new connection: ActiveRecord::Base.connection, name: 'code'
+ code = Schema.new connection: ActiveRecord::Base.connection, name: code_schema_name
code.within_schema do
unless code.digest == graph.digest
code.reset!
| Allow configuration of code schema name
|
diff --git a/acceptance/fips/test/integration/fips-integration/serverspec/fips-integration_spec.rb b/acceptance/fips/test/integration/fips-integration/serverspec/fips-integration_spec.rb
index abc1234..def5678 100644
--- a/acceptance/fips/test/integration/fips-integration/serverspec/fips-integration_spec.rb
+++ b/acceptance/fips/test/integration/fips-integration/serverspec/fips-integration_spec.rb
@@ -46,6 +46,7 @@ end
it "passes the integration specs" do
- run_rspec_test("spec/integration")
+ skip
+ #run_rspec_test("spec/integration")
end
end
| Disable FIPS integration tests for now.
|
diff --git a/lib/quotes.rb b/lib/quotes.rb
index abc1234..def5678 100644
--- a/lib/quotes.rb
+++ b/lib/quotes.rb
@@ -1,12 +1,12 @@ require 'quotes/version'
-require './lib/quotes/helpers/validation_helpers'
+require 'quotes/support/validation_helpers'
-require './lib/quotes/entities'
-require './lib/quotes/services'
-require './lib/quotes/gateways'
-require './lib/quotes/tasks'
-require './lib/quotes/use_cases'
+require 'quotes/entities'
+require 'quotes/services'
+require 'quotes/gateways'
+require 'quotes/tasks'
+require 'quotes/use_cases'
module Quotes
end
| Change how files are required in manifest file
|
diff --git a/lib/banzai/reference_parser/project_parser.rb b/lib/banzai/reference_parser/project_parser.rb
index abc1234..def5678 100644
--- a/lib/banzai/reference_parser/project_parser.rb
+++ b/lib/banzai/reference_parser/project_parser.rb
@@ -13,16 +13,15 @@
# Returns an Array of Project ids that can be read by the given user.
#
- # projects - The projects to reduce down to those readable by the user.
# user - The User for which to check the projects
- def readable_project_ids_for(projects, user)
- strong_memoize(:readable_project_ids_for) do
- Project.public_or_visible_to_user(user).where("projects.id IN (?)", projects.map(&:id)).pluck(:id)
- end
+ def readable_project_ids_for(user)
+ @project_ids_by_user ||= {}
+ @project_ids_by_user[user] ||=
+ Project.public_or_visible_to_user(user).where("projects.id IN (?)", @projects_for_nodes.values.map(&:id)).pluck(:id)
end
def can_read_reference?(user, ref_project, node)
- readable_project_ids_for(@projects_for_nodes.values, user).include?(ref_project.try(:id))
+ readable_project_ids_for(user).include?(ref_project.try(:id))
end
end
end
| Use a hash to memoize readable_project_ids with user objects as keys
|
diff --git a/core/db/migrate/20150121022521_remove_environment_from_payment_method.rb b/core/db/migrate/20150121022521_remove_environment_from_payment_method.rb
index abc1234..def5678 100644
--- a/core/db/migrate/20150121022521_remove_environment_from_payment_method.rb
+++ b/core/db/migrate/20150121022521_remove_environment_from_payment_method.rb
@@ -0,0 +1,6 @@+class RemoveEnvironmentFromPaymentMethod < ActiveRecord::Migration
+ def up
+ Spree::PaymentMethod.where('environment != ?', Rails.env).update_all(active: false)
+ remove_column :spree_payment_methods, :environment
+ end
+end
| Remove the environment column from payment_method
Sets any payment method not in the current environment to be inactive.
Can't be reversed as we have set the active = false
(cherry picked from commit 42cf3f0155b218d506afc3a8e653db73b6a442fa in freerunningtech/spree)
|
diff --git a/config/initializers/00_deprecate_prototype.rb b/config/initializers/00_deprecate_prototype.rb
index abc1234..def5678 100644
--- a/config/initializers/00_deprecate_prototype.rb
+++ b/config/initializers/00_deprecate_prototype.rb
@@ -0,0 +1,33 @@+# Mostly copied from:
+# https://github.com/rails/rails/blob/3-2-stable/activesupport/lib/active_support/deprecation/method_wrappers.rb
+def deprecate_methods(target_module, *method_names)
+ options = method_names.extract_options!
+ method_names += options.keys
+
+ method_names.each do |method_name|
+ target_module.alias_method_chain(method_name, :deprecation) do |target, punctuation|
+ target_module.module_eval(<<-end_eval, __FILE__, __LINE__ + 1)
+ def #{target}_with_deprecation#{punctuation}(*args, &block)
+ ::ActiveSupport::Deprecation.warn("Prototype Usage: #{method_name}", caller)
+ send(:#{target}_without_deprecation#{punctuation}, *args, &block)
+ end
+ end_eval
+ end
+ end
+end
+
+# This must be done after_initialize because
+# prototype_rails has its own engine initializer
+# that runs after local/app initializers.
+Rails.application.config.after_initialize do
+ namespaces = [
+ ActionView::Helpers::PrototypeHelper,
+ ActionView::Helpers::ScriptaculousHelper,
+ PrototypeHelper,
+ ActionView::Helpers::JavaScriptHelper
+ ]
+ namespaces.each do |namespace|
+ methods = namespace.public_instance_methods
+ deprecate_methods(namespace, *methods)
+ end
+end | Add initializer to deprecate prototype
|
diff --git a/cookbooks/get-repositories/recipes/default.rb b/cookbooks/get-repositories/recipes/default.rb
index abc1234..def5678 100644
--- a/cookbooks/get-repositories/recipes/default.rb
+++ b/cookbooks/get-repositories/recipes/default.rb
@@ -46,6 +46,6 @@ end
execute "#{destination} -> git clone #{url}" do
- command "sudo -u afronski 'git clone #{url}'"
+ command "su afronski -c 'git clone #{url}'"
end
end | Change to su from sudo
|
diff --git a/core/app/controllers/spree/base_controller.rb b/core/app/controllers/spree/base_controller.rb
index abc1234..def5678 100644
--- a/core/app/controllers/spree/base_controller.rb
+++ b/core/app/controllers/spree/base_controller.rb
@@ -1,4 +1,4 @@ class Spree::BaseController < ApplicationController
- include SpreeBase
+ include Spree::Core::ControllerHelpers
include SpreeRespondWith
end
| Fix require to Spree::Core::ControllerHelpers in BaseController
|
diff --git a/lib/facebooker/rails/facebook_request_fix.rb b/lib/facebooker/rails/facebook_request_fix.rb
index abc1234..def5678 100644
--- a/lib/facebooker/rails/facebook_request_fix.rb
+++ b/lib/facebooker/rails/facebook_request_fix.rb
@@ -7,7 +7,7 @@ request_method_without_facebooker
end
- if methods.include?("request_method")
+ if new.methods.include?("request_method")
alias_method_chain :request_method, :facebooker
end
end
| Fix for rails 1.2 exclusion
git-svn-id: abd3364c23bece18756deaf5558fcfa62d3b1b71@118 06148572-b36b-44fe-9aa8-f68b04d8b080
|
diff --git a/lib/generators/templates/create_addresses.rb b/lib/generators/templates/create_addresses.rb
index abc1234..def5678 100644
--- a/lib/generators/templates/create_addresses.rb
+++ b/lib/generators/templates/create_addresses.rb
@@ -7,16 +7,10 @@ t.string :buildingable_type
t.string :postal_code
t.string :building_number
- t.string :building_name
- t.string :street_name
t.string :road
t.string :floor
- t.string :province_name
- t.string :district_name
- t.string :sub_district_name
t.decimal :latitude, precision: 15, scale: 12
t.decimal :longitude, precision: 15, scale: 12
- t.text :extra_info
t.timestamps
end
@@ -24,8 +18,8 @@ add_index :addresses, [:addressable_id, :addressable_type]
add_index :addresses, [:buildingable_id, :buildingable_type]
- Address.create_translation_table! building_name: :string, street_name: :string,
- street_name: :string, road: :string, province_name: :string, district_name: :string, sub_district_name: :string,
+ Address.create_translation_table! building_name: :string, street_name: :string,
+ road: :string, province_name: :string, district_name: :string, sub_district_name: :string,
extra_info: :text
end
end
| Remove translate from main table
|
diff --git a/lib/vagrant/action/builtin/write_box_info.rb b/lib/vagrant/action/builtin/write_box_info.rb
index abc1234..def5678 100644
--- a/lib/vagrant/action/builtin/write_box_info.rb
+++ b/lib/vagrant/action/builtin/write_box_info.rb
@@ -11,10 +11,13 @@ end
def call(env)
- box_url = env[:box_url]
- box_added = env[:box_added]
+ box_url = env[:box_url]
+ box_added = env[:box_added]
+ box_state_file = env[:box_state_file]
- # TODO: Persist box_url / provider / datetime
+ # Mark that we downloaded the box
+ @logger.info("Adding the box to the state file...")
+ box_state_file.add_box(box_added, box_url)
@app.call(env)
end
| core: Write box information after download
|
diff --git a/templates/mongoid/features/support/hooks.rb b/templates/mongoid/features/support/hooks.rb
index abc1234..def5678 100644
--- a/templates/mongoid/features/support/hooks.rb
+++ b/templates/mongoid/features/support/hooks.rb
@@ -1,3 +1,3 @@ Before do |scenario|
- Mongoid.master.collections.reject { |c| c.name == 'system.indexes'}.each(&:drop)
+ Mongoid.master.collections.select {|c| c.name !~ /system/ }.each(&:drop)
end | Update mongoid collection drop statement to match rspec version
|
diff --git a/rspec-puppet-facts.gemspec b/rspec-puppet-facts.gemspec
index abc1234..def5678 100644
--- a/rspec-puppet-facts.gemspec
+++ b/rspec-puppet-facts.gemspec
@@ -24,4 +24,5 @@ s.add_runtime_dependency 'json'
s.add_runtime_dependency 'facter'
s.add_runtime_dependency 'facterdb', '>= 0.3.0'
+ s.add_runtime_dependency 'mcollective-client'
end
| Add mcollective-client as runtime dependency
|
diff --git a/anchored.gemspec b/anchored.gemspec
index abc1234..def5678 100644
--- a/anchored.gemspec
+++ b/anchored.gemspec
@@ -15,6 +15,8 @@ spec.files = Dir["LICENSE.txt", "README.md", "lib/**/*"]
spec.require_paths = ["lib"]
+ spec.required_ruby_version = ">= 2.3.0"
+
spec.add_development_dependency "rake", "~> 12.0"
spec.add_development_dependency "minitest", "~> 5.10"
spec.add_development_dependency "activesupport", "~> 5.0"
| Add required ruby version to gemspec (2.3+)
|
diff --git a/dayrb.gemspec b/dayrb.gemspec
index abc1234..def5678 100644
--- a/dayrb.gemspec
+++ b/dayrb.gemspec
@@ -1,7 +1,6 @@ Gem::Specification.new do |s|
s.name = 'dayrb'
s.version = '2.0.2'
- s.date = '08-17-2014'
s.summary = "To-do & Time-Tracking CLI App"
s.description = "Create and track time on tasks via command-line."
s.authors = ["Cameron Carroll"]
| Remove date field from gemspec
|
diff --git a/lib/active_job/retriable.rb b/lib/active_job/retriable.rb
index abc1234..def5678 100644
--- a/lib/active_job/retriable.rb
+++ b/lib/active_job/retriable.rb
@@ -12,10 +12,10 @@ rescue_from Exception do |ex|
tag_logger self.class.name, job_id do
if retries_exhausted?
- logger.info 'Retries exhauseted'
+ logger.info "Retries exhauseted at #{retry_attempt}"
else
- logger.warn "Retrying due to #{ex.message}"
+ logger.warn "Retrying due to #{ex.message} on #{ex.backtrace.try(:first)}"
retry_job wait: retry_delay unless retries_exhausted?
end
| Add a more detailed retry log messages
|
diff --git a/lib/bedi/parsing_helpers.rb b/lib/bedi/parsing_helpers.rb
index abc1234..def5678 100644
--- a/lib/bedi/parsing_helpers.rb
+++ b/lib/bedi/parsing_helpers.rb
@@ -13,7 +13,7 @@ def remove_artifacts(match)
match.captures.each_with_object({}) do |(key, val), result|
next if (Numeric === key) || (key.to_s =~ /^([A-Z]|ignore|newline)/)
- result[key] = val.first
+ result[key] = val.first.to_str
end
end
end
| Convert match values to string
|
diff --git a/lib/booking_requests/api.rb b/lib/booking_requests/api.rb
index abc1234..def5678 100644
--- a/lib/booking_requests/api.rb
+++ b/lib/booking_requests/api.rb
@@ -9,10 +9,30 @@ private
def connection
- HTTPConnectionFactory.build(api_uri).tap do |c|
+ HTTPConnectionFactory.build(api_uri, connection_options).tap do |c|
c.headers[:accept] = 'application/json'
c.authorization :Bearer, bearer_token if bearer_token
end
+ end
+
+ def connection_options
+ {
+ timeout: read_timeout,
+ open_timeout: open_timeout,
+ retries: retries
+ }
+ end
+
+ def open_timeout
+ ENV.fetch('BOOKING_REQUESTS_API_OPEN_TIMEOUT', 10)
+ end
+
+ def read_timeout
+ ENV.fetch('BOOKING_REQUESTS_API_READ_TIMEOUT', 10)
+ end
+
+ def retries
+ ENV.fetch('BOOKING_REQUESTS_API_RETRIES', 0)
end
def bearer_token
| Configure HTTP connections for bookings API
Bumps the default timeout to 10 seconds for both connect and read.
Also, since the endpoint is not considered idempotent I have disabled
retries.
|
diff --git a/design/api.rb b/design/api.rb
index abc1234..def5678 100644
--- a/design/api.rb
+++ b/design/api.rb
@@ -1,19 +1,19 @@ Praxis::ApiDefinition.define do |api|
-
+
# Applies to all API versions
- api.info do
+ api.info do
name "bloggy"
title "A Blog API example application"
description "This is a longer description about what this API service is all about"
version_with :path
base_path '/api/v:api_version'
- consumes 'json', 'x-www-form-urlencoded', 'form-data'
- produces 'json', 'form-data'
+ consumes 'json', 'x-www-form-urlencoded', 'form-data', 'xml'
+ produces 'json', 'form-data', 'xml'
end
# Applies to 1.0 version
# Also inherits everything else form the global one
- api.info("1.0") do
+ api.info("1.0") do
description "This is the 1.0 version of Bloggy"
end
@@ -21,5 +21,5 @@ description "The requested API resource could not be found for the provided :id"
status 404
end
-
+
end | Add XML consumes and produces (more as an example than anything else since we’re not using/requesting XML docs)
Signed-off-by: Josep M. Blanquer <843d9a062ab1c6792ebebca5589f22ce86ac85ce@rightscale.com>
|
diff --git a/svg_tag.gemspec b/svg_tag.gemspec
index abc1234..def5678 100644
--- a/svg_tag.gemspec
+++ b/svg_tag.gemspec
@@ -19,7 +19,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
- spec.add_dependency "actionview"
+ spec.add_runtime_dependency "rails", '~> 3.2', '>= 3'
spec.add_development_dependency "bundler", "~> 1.5"
spec.add_development_dependency "rake"
| Fix gemspec for older Rails (should test for newer Rails).
|
diff --git a/lib/google/places/client.rb b/lib/google/places/client.rb
index abc1234..def5678 100644
--- a/lib/google/places/client.rb
+++ b/lib/google/places/client.rb
@@ -30,6 +30,14 @@ )
end
+ def place_photos(photo_reference, options = {})
+ options = options.with_indifferent_access
+ self.class.get(
+ "/photo",
+ { query: build_photo_request_parameters(photo_reference, options) }
+ )
+ end
+
private
def build_request_parameters(input, options = {})
@@ -37,6 +45,11 @@ required_params.merge(options)
end
+ def build_photo_request_parameters(photo_reference, options = {})
+ required_params = { key: api_key, photoreference: photo_reference }
+ required_params.merge(options)
+ end
+
end
end
end
| Add Place Photos API support
|
diff --git a/lib/bricks.rb b/lib/bricks.rb
index abc1234..def5678 100644
--- a/lib/bricks.rb
+++ b/lib/bricks.rb
@@ -3,7 +3,11 @@
module Bricks
class << self
- attr_accessor :builders
+ attr_writer :builders
+
+ def builders
+ @builders ||= BuilderHashSet.new
+ end
end
class BuilderHashSet
| Initialize global `builders' var if it's nil.
|
diff --git a/config/environments/test.rb b/config/environments/test.rb
index abc1234..def5678 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -9,8 +9,4 @@ config.action_controller.allow_forgery_protection = false
config.action_mailer.delivery_method = :test
config.active_support.deprecation = :stderr
-
- Mail.defaults do
- delivery_method :test
- end
end
| Remove stray 'Mail' reference which was erroring
|
diff --git a/test/controllers/static_pages_controller_test.rb b/test/controllers/static_pages_controller_test.rb
index abc1234..def5678 100644
--- a/test/controllers/static_pages_controller_test.rb
+++ b/test/controllers/static_pages_controller_test.rb
@@ -1,4 +1,20 @@ require 'test_helper'
class StaticPagesControllerTest < ActionController::TestCase
+
+ test "should get home" do
+ get :home
+ assert_response :success
+ end
+
+ test "should get about" do
+ get :about
+ assert_response :success
+ end
+
+ test "should get contact" do
+ get :contact
+ assert_response :success
+ end
+
end
| Add basic tests for the static pages controller
The get tests that have been added are for the sake of completeness.
|
diff --git a/test/unit/models/link_checker_api_report_test.rb b/test/unit/models/link_checker_api_report_test.rb
index abc1234..def5678 100644
--- a/test/unit/models/link_checker_api_report_test.rb
+++ b/test/unit/models/link_checker_api_report_test.rb
@@ -0,0 +1,30 @@+require "test_helper"
+require "gds_api/test_helpers/link_checker_api"
+
+class LinkCheckerApiReportTest < ActiveSupport::TestCase
+ include GdsApi::TestHelpers::LinkCheckerApi
+
+ test "replaces a batch report if it already exists" do
+ link = "http://www.example.com"
+ publication = create(:publication, body: "[link](#{link})")
+
+ batch_id = 5
+
+ report_payload = link_checker_api_batch_report_hash(
+ id: batch_id,
+ links: [{ uri: link }],
+ status: "completed",
+ ).with_indifferent_access
+
+ LinkCheckerApiReport.create!(
+ batch_id: batch_id,
+ link_reportable: publication,
+ status: "in_progress",
+ )
+
+ LinkCheckerApiReport.create_from_batch_report(report_payload, publication)
+
+ report = LinkCheckerApiReport.find_by(batch_id: batch_id)
+ assert_equal "completed", report.status
+ end
+end
| Add a test for replacing link checker api reports
|
diff --git a/lib/joiner.rb b/lib/joiner.rb
index abc1234..def5678 100644
--- a/lib/joiner.rb
+++ b/lib/joiner.rb
@@ -1,4 +1,5 @@ require 'set'
+require 'active_record'
module Joiner
class AssociationNotFound < StandardError
| Make sure ActiveRecord is loaded.
|
diff --git a/app/controllers/admin/user_needs_controller.rb b/app/controllers/admin/user_needs_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/admin/user_needs_controller.rb
+++ b/app/controllers/admin/user_needs_controller.rb
@@ -1,6 +1,6 @@ class Admin::UserNeedsController < Admin::BaseController
def create
- user_need = UserNeed.new(params[:user_need])
+ user_need = UserNeed.new(user_need_params)
if user_need.save
render json: { id: user_need.id, text: user_need.to_s }
@@ -8,5 +8,9 @@ render json: { errors: user_need.errors }, status: 422
end
end
+
+private
+ def user_need_params
+ params.require(:user_need).permit(:user, :need, :goal)
+ end
end
-
| Add strong params for user needs
|
diff --git a/app/controllers/concerns/admin/acts_as_list.rb b/app/controllers/concerns/admin/acts_as_list.rb
index abc1234..def5678 100644
--- a/app/controllers/concerns/admin/acts_as_list.rb
+++ b/app/controllers/concerns/admin/acts_as_list.rb
@@ -8,8 +8,8 @@ extend ActiveSupport::Concern
included do
- before_filter :get_object, :only => [:position]
- before_filter :check_resource_ownership, :only => [:position]
+ before_filter :get_object, :except => [:index]
+ before_filter :check_resource_ownership, :except => [:index, :show]
end
def position
| Fix ActsAsList concern so it doesn't prevent before_filters from running on other actions when included
|
diff --git a/app/factories/shopify/product_image_factory.rb b/app/factories/shopify/product_image_factory.rb
index abc1234..def5678 100644
--- a/app/factories/shopify/product_image_factory.rb
+++ b/app/factories/shopify/product_image_factory.rb
@@ -20,9 +20,9 @@ # else if it's hosted online we must get the `url` of the image.
# I haven't found a better way of doing that yet.
begin
- bytes = File.open(image.attachment.url, "rb").read
+ bytes = open(image.attachment.url, "rb").read
rescue Errno::ENOENT
- bytes = File.open(image.attachment.path, "rb").read
+ bytes = open(image.attachment.path, "rb").read
ensure
encoded = Base64.encode64(bytes)
end
| Use open instead of File.open
That way we can open the online URLs instead of just local files.
|
diff --git a/paperclip-storage-ftp.gemspec b/paperclip-storage-ftp.gemspec
index abc1234..def5678 100644
--- a/paperclip-storage-ftp.gemspec
+++ b/paperclip-storage-ftp.gemspec
@@ -7,7 +7,7 @@ gem.homepage = "https://github.com/xing/paperclip-storage-ftp"
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
- gem.files = `git ls-files -- lib spec LICENSE Gemfile paperclip-storage-ftp.gemspec Rakefile README.md`.split("\n")
+ gem.files = `git ls-files`.split("\n")
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
gem.name = "paperclip-storage-ftp"
gem.require_paths = ["lib"]
| Put vendor directory back in gem, to allow all tests to run
|
diff --git a/ci_environment/phantomjs/recipes/2.0.rb b/ci_environment/phantomjs/recipes/2.0.rb
index abc1234..def5678 100644
--- a/ci_environment/phantomjs/recipes/2.0.rb
+++ b/ci_environment/phantomjs/recipes/2.0.rb
@@ -1,8 +1,18 @@ # Install PhantomJS 2.0.0 from custom-built archive
package 'libjpeg-dev'
-package 'libpng-dev'
-package 'libicu-dev'
+
+package 'libpng-dev' do
+ not_if { node['lsb']['release'] == 'precise' }
+end
+
+package 'libicu48' do
+ only_if { node['lsb']['release'] == 'precise' }
+end
+
+package 'libicu-dev' do
+ not_if { node['lsb']['release'] == 'precise' }
+end
archive_path = File.join(Chef::Config[:file_cache_path], 'phantomjs.tar.bz2')
version = '2.0.0'
@@ -23,4 +33,4 @@ group 'root'
code "tar xjf #{archive_path} -C #{local_dir}"
creates File.join(local_dir, 'phantomjs')
-end+end
| Adjust dependency packages for phantomjs on trusty & precise
|
diff --git a/lib/haml/template/plugin.rb b/lib/haml/template/plugin.rb
index abc1234..def5678 100644
--- a/lib/haml/template/plugin.rb
+++ b/lib/haml/template/plugin.rb
@@ -1,3 +1,4 @@+# :stopdoc:
# This file makes Haml work with Rails
# using the > 2.0.1 template handler API.
@@ -19,3 +20,4 @@ end
ActionView::Base.register_template_handler(:haml, Haml::Template)
+# :startdoc:
| Make sure that the proper Haml module docs show up in the RDoc.
git-svn-id: 4f3887ee22fa92c7515d4a1b1e550bc0e860970c@723 7063305b-7217-0410-af8c-cdc13e5119b9
|
diff --git a/lib/nessus/client/policy.rb b/lib/nessus/client/policy.rb
index abc1234..def5678 100644
--- a/lib/nessus/client/policy.rb
+++ b/lib/nessus/client/policy.rb
@@ -21,11 +21,15 @@ # @return [String] looks up policy ID by policy name
def policy_id_by_name(name)
policy_list.find{|policy| policy['policyname'].eql? name}['policyid']
+ rescue
+ nil
end
# @return [String] looks up policy name by policy ID
def policy_name_by_id(id)
policy_list.find{|policy| policy['policyid'].eql? id}['policyname']
+ rescue
+ nil
end
#@!endgroup
| Add rescue to return nil
|
diff --git a/lib/sections/header_data.rb b/lib/sections/header_data.rb
index abc1234..def5678 100644
--- a/lib/sections/header_data.rb
+++ b/lib/sections/header_data.rb
@@ -18,6 +18,13 @@ new_header[5] = team.warning
new_header[6] = team.patreon > 0 ? "patreon" : "no patreon"
+ # Add raid bosses to header, spreadsheet relies on it being in the 141th column
+ data = []
+ VALID_RAIDS.each do |raid|
+ data << "#{raid['encounters'].map{|boss| boss['name']}.join('_')}@#{raid['name']}@"
+ end
+ new_header[142] = data.join("")
+
new_header
end
end
| Add raid bosses to header in new implementation
|
diff --git a/lib/tasks/data_hygiene.rake b/lib/tasks/data_hygiene.rake
index abc1234..def5678 100644
--- a/lib/tasks/data_hygiene.rake
+++ b/lib/tasks/data_hygiene.rake
@@ -1,4 +1,5 @@ namespace :data_hygiene do
+ desc "Verify that artefacts have the correct `owning_app`"
task :verify_formats => [:environment] do
Artefact::FORMATS_BY_DEFAULT_OWNING_APP.detect do |app_name, formats|
mislabeled = Artefact.where(owning_app: app_name, :kind.nin => formats)
@@ -7,4 +8,15 @@ puts "#{mislabeled.size} docs with foreign formats: #{mislabeled.map(&:kind).uniq.inspect}"
end
end
+
+ desc "See which artefacts don't have content IDs"
+ task :inspect_content_ids => [:environment] do
+ owning_apps = Artefact.all.distinct("owning_app")
+ owning_apps.each do |owning_app|
+ without_content_id = Artefact.where(content_id: nil, owning_app: owning_app).count
+ with_content_id = Artefact.where(owning_app: owning_app).count - without_content_id
+
+ puts "#{owning_app}: #{without_content_id} without, #{with_content_id} with"
+ end
+ end
end
| Add rake task to list artefacts without content_id
In the future all artefacts should have a content_id. This rake task
lists artefacts per app and displays how many of them do/don't have a
content_id.
|
diff --git a/lib/tasks/email_topics.rake b/lib/tasks/email_topics.rake
index abc1234..def5678 100644
--- a/lib/tasks/email_topics.rake
+++ b/lib/tasks/email_topics.rake
@@ -7,9 +7,17 @@
desc "check the email topics for all documents"
task check_all_documents: :environment do
- Document.published.find_in_batches(batch_size: 20).each do |documents|
+ offset = ENV.fetch("OFFSET", 0)
+ puts "Continuing from offset #{offset}"
+
+ Document.published.offset(offset).find_in_batches(batch_size: 20).each do |documents|
threads = documents.map do |document|
- checker = EmailTopicChecker.new(document, verbose: false)
+ begin
+ checker = EmailTopicChecker.new(document, verbose: false)
+ rescue StandardError => ex
+ puts "#{document.content_id} raised #{ex.message}"
+ next
+ end
Thread.new do
begin
@@ -22,7 +30,7 @@ end
end
- threads.each(&:join)
+ threads.compact.each(&:join)
end
end
| Make check_all_documents more robust and continue from offset
The script errored during the EmailTopicChecker
initializer. This handles errors in this case.
we’ve also added the ability to continue from an
offset so we don’t need to run the script from the
beginning. |
diff --git a/app/controllers/admin/feedback_controller.rb b/app/controllers/admin/feedback_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/admin/feedback_controller.rb
+++ b/app/controllers/admin/feedback_controller.rb
@@ -1,6 +1,6 @@ class Admin::FeedbackController < Admin::ApplicationController
def index
- @feedback = Feedback.all
+ @feedback = Feedback.includes(:coach, :tutorial).all
end
end
| Fix N+1 query issue wrt feedback index page for admins
|
diff --git a/spec/configuration_spec.rb b/spec/configuration_spec.rb
index abc1234..def5678 100644
--- a/spec/configuration_spec.rb
+++ b/spec/configuration_spec.rb
@@ -8,7 +8,7 @@ it { should eq Specinfra.configuration.path }
end
-SpecInfra.configuration.os = 'foo'
-describe SpecInfra.configuration.os do
+Specinfra.configuration.os = 'foo'
+describe Specinfra.configuration.os do
it { should eq 'foo' }
end
| Change SpecInfra to Specinfa after merging master
|
diff --git a/lib/generators/forest/block/templates/model.rb b/lib/generators/forest/block/templates/model.rb
index abc1234..def5678 100644
--- a/lib/generators/forest/block/templates/model.rb
+++ b/lib/generators/forest/block/templates/model.rb
@@ -18,27 +18,27 @@
<% if class_name.match(/image/i) -%>
def self.display_icon_name
- 'glyphicon glyphicon-picture'
+ 'image<%= 's' if class_name.match(/gallery/i) -%>'
end
<% elsif class_name.match(/video/i) -%>
def self.display_icon_name
- 'glyphicon glyphicon-play'
+ 'play'
end
<% elsif class_name.match(/title/i) -%>
def self.display_icon_name
- 'glyphicon glyphicon-font'
+ 'type-h1'
end
<% elsif class_name.match(/text/i) -%>
def self.display_icon_name
- 'glyphicon glyphicon-align-left'
+ 'justify-left'
end
<% elsif class_name.match(/accordion/i) -%>
def self.display_icon_name
- 'glyphicon glyphicon-th-list'
+ 'list'
end
<% else -%>
# def self.display_icon_name
- # 'glyphicon glyphicon-align-left'
+ # 'Replace with a relevant bootstrap icon name https://icons.getbootstrap.com/'
# end
<% end -%>
end
| Update block template with bootstrap 4 icon names
|
diff --git a/lib/project_tango_foxtrot/proof_of_concept1.rb b/lib/project_tango_foxtrot/proof_of_concept1.rb
index abc1234..def5678 100644
--- a/lib/project_tango_foxtrot/proof_of_concept1.rb
+++ b/lib/project_tango_foxtrot/proof_of_concept1.rb
@@ -1,3 +1,9 @@+# Proof of Concept: guaranteed time-to-render
+# ------
+# The purpose of this demonstration is to show that regardless of a
+# slow-performing query, the request is replied to in a guaranteed minimum time
+# frame. This is a desirable trait for quite a few systems, and is also a nice
+# benefit that's not hard to gain in an SOA-style system.
require 'sinatra'
require File.expand_path("../echo.rb", __FILE__)
| Add explanation to first PoC
|
diff --git a/jquery_mobile_rails.gemspec b/jquery_mobile_rails.gemspec
index abc1234..def5678 100644
--- a/jquery_mobile_rails.gemspec
+++ b/jquery_mobile_rails.gemspec
@@ -7,11 +7,12 @@ Gem::Specification.new do |s|
s.name = "jquery_mobile_rails"
s.version = JqueryMobileRails::VERSION
- s.authors = ["Tiago Scolari"]
- s.email = ["tscolari@gmail.com"]
+ s.authors = ["Tiago Scolari", "Dylan Markow"]
+ s.email = ["tscolari@gmail.com", "dylan@dylanmarkow.com"]
s.homepage = "https://github.com/tscolari/jquery-mobile-rails"
s.summary = "JQuery Mobile files for Rails 3.1."
s.description = "JQuery Mobile files for Rails 3.1 assets pipeline"
+ s.license = 'MIT'
s.files = Dir["{app,config,db,lib,vendor}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
s.test_files = Dir["test/**/*"]
| Update gemspec authors and license.
Closes #24.
|
diff --git a/lib/stagehand/connection_adapter_extensions.rb b/lib/stagehand/connection_adapter_extensions.rb
index abc1234..def5678 100644
--- a/lib/stagehand/connection_adapter_extensions.rb
+++ b/lib/stagehand/connection_adapter_extensions.rb
@@ -1,15 +1,22 @@ module Stagehand
module Connection
def self.with_production_writes(model, &block)
- model.connection.allow_writes(&block)
+ state = allow_unsynced_production_writes?
+ allow_unsynced_production_writes!(true)
+ return block.call
+ ensure
+ allow_unsynced_production_writes!(state)
+ end
+
+ def self.allow_unsynced_production_writes!(state = true)
+ Thread.current[:stagehand_allow_unsynced_production_writes] = state
+ end
+
+ def self.allow_unsynced_production_writes?
+ !!Thread.current[:stagehand_allow_unsynced_production_writes]
end
module AdapterExtensions
- def self.prepended(base)
- base.set_callback :checkout, :after, :update_readonly_state
- base.set_callback :checkin, :before, :clear_readonly_state
- end
-
def exec_insert(*)
handle_readonly_writes!
super
@@ -25,34 +32,14 @@ super
end
- def allow_writes(&block)
- state = readonly?
- readonly!(false)
- return block.call
- ensure
- readonly!(state)
- end
-
- def readonly!(state = true)
- @readonly = state
- end
-
- def readonly?
- !!@readonly
- end
-
private
- def update_readonly_state
- readonly! unless Configuration.single_connection? || @config[:database] == Database.staging_database_name
- end
-
- def clear_readonly_state
- readonly!(false)
+ def write_access?
+ Configuration.single_connection? || @config[:database] == Database.staging_database_name || Connection.allow_unsynced_production_writes?
end
def handle_readonly_writes!
- if !readonly?
+ if write_access?
return
elsif Configuration.allow_unsynced_production_writes?
Rails.logger.warn "Writing directly to #{@config[:database]} database using readonly connection"
| Make unsynced production write blocks more robust
When we create a block that allows unsynced production writes, we expect that any connection opened within that block would be allowed to write to the production database. Unfortunately, only the current `ActiveRecord::Base.connection` instance is marked as being read/write. This has caused an issue when attempting to allow rake db:test:load_structure to rake both databases as the connection we mark as read/write is not the one that ends up being used to write to the production database.
Instead of storing the state on the connection instance, we store it on `Thread.current`. This ensures that any connection we open for the duration of the block will be allowed to write to the production database.
|
diff --git a/yomou.gemspec b/yomou.gemspec
index abc1234..def5678 100644
--- a/yomou.gemspec
+++ b/yomou.gemspec
@@ -19,6 +19,8 @@ spec.require_paths = ["lib"]
spec.add_runtime_dependency "thor", "~> 0.19"
+ spec.add_runtime_dependency "grn_mini", "~> 0.5"
+ spec.add_runtime_dependency "rroonga", "~> 4.0.4"
spec.add_development_dependency "bundler", "~> 1.7"
spec.add_development_dependency "rake", "~> 10.0"
| Add runtime dependency to Rroonga
|
diff --git a/api/lib/tasks/heroku_scheduler.rake b/api/lib/tasks/heroku_scheduler.rake
index abc1234..def5678 100644
--- a/api/lib/tasks/heroku_scheduler.rake
+++ b/api/lib/tasks/heroku_scheduler.rake
@@ -38,4 +38,14 @@ task queue_collect_projects_shipped_job: :environment do
CollectProjectsShippedJob.perform_later
end
+
+ desc 'Schedule check-ins'
+ task queue_schedule_check_ins: :environment do
+ ScheduleLeaderCheckInsJob.perform_now true
+ end
+
+ desc 'Close check-ins'
+ task queue_close_check_ins: :environment do
+ CloseCheckInsJob.perform_now
+ end
end
| Add rake tasks for closing and scheduling check-ins
Fix #172
|
diff --git a/app/controllers/items_controller.rb b/app/controllers/items_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/items_controller.rb
+++ b/app/controllers/items_controller.rb
@@ -19,7 +19,7 @@ def show
today = Time.zone.today
@item = Item.find(params[:id])
- redirect_to root_path if today.month != "12" || @item.advent_calendar_item.date > today.day
+ redirect_to root_path if today.month != 12 || @item.advent_calendar_item.date > today.day
end
def edit
| Fix conditions to properly redirect to the top page.
|
diff --git a/app/controllers/likes_controller.rb b/app/controllers/likes_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/likes_controller.rb
+++ b/app/controllers/likes_controller.rb
@@ -3,12 +3,37 @@ before_action :find_likeable
def create
+ current_user.like(@item)
+ render text: @item.reload.likes_count
end
def destroy
+ current_user.unlike(@item)
+ render text: @item.reload.likes_count
end
private
def find_likeable
+ @success = false
+ @element_id = "likable_#{params[:type]}_#{params[:id]}"
+ unless params[:type].in?(%W(Topic Reply))
+ render text: '-1'
+ false
+ end
+
+ case @params[:type].downcase
+ when 'topic'
+ klass = Topic
+ when 'reply'
+ klass = Reply
+ else
+ false
+ end
+
+ @item = klass.find_by_id(params[:id])
+ if @item.blank?
+ render text: '-2'
+ false
+ end
end
end
| Add the find_likable before_action to find something able to the liked based on the params.
|
diff --git a/app/classes/meme_captain_web/gend_image_script.rb b/app/classes/meme_captain_web/gend_image_script.rb
index abc1234..def5678 100644
--- a/app/classes/meme_captain_web/gend_image_script.rb
+++ b/app/classes/meme_captain_web/gend_image_script.rb
@@ -32,23 +32,7 @@ private
def json
- JSON.pretty_generate(
- private: @gend_image.private,
- src_image_id: @gend_image.src_image.id_hash,
- captions_attributes: captions
- )
- end
-
- def captions
- @gend_image.captions.map do |caption|
- {
- text: caption.text,
- top_left_x_pct: caption.top_left_x_pct,
- top_left_y_pct: caption.top_left_y_pct,
- width_pct: caption.width_pct,
- height_pct: caption.height_pct
- }
- end
+ GendImageApiRequestJson.new(@gend_image).json
end
end
end
| Remove redundant gend image api request json generation
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.