diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/lib/sql/generator/emitter/binary_connective_operation.rb b/lib/sql/generator/emitter/binary_connective_operation.rb
index abc1234..def5678 100644
--- a/lib/sql/generator/emitter/binary_connective_operation.rb
+++ b/lib/sql/generator/emitter/binary_connective_operation.rb
@@ -46,12 +46,7 @@ #
# @api private
def parenthesize?
- case parent
- when self.class
- parent.node_type != node_type
- else
- false
- end
+ kind_of?(parent.class) && parent.node_type != node_type
end
end # ConnectiveOperation
|
Refactor parenthesize? test to be simpler
|
diff --git a/lib/pdfjs-rails-engine/engine.rb b/lib/pdfjs-rails-engine/engine.rb
index abc1234..def5678 100644
--- a/lib/pdfjs-rails-engine/engine.rb
+++ b/lib/pdfjs-rails-engine/engine.rb
@@ -9,15 +9,17 @@ pdf.js-gh-pages/web/viewer.js
pdf.js-gh-pages/build/pdf.js
pdf.js-gh-pages/build/pdf.worker.js
+ pdf.js-gh-pages/web/images/*
)
end
initializer 'pdfjs-rails-engine.assets.paths' do |app|
app.config.assets.paths << File.expand_path("#{root}/lib")
+ config.assets.precompile += %w(vendor/assets/images/*)
end
# initializer 'pdfjs-rails-engine.load_static_assets' do |app|
- # app.middleware.use ::ActionDispatch::Static, "#{root}/vendor"
+ # app.middleware.use ::ActionDispatch::Static, "#{root}/lib/web"
# end
end
end
|
Update path to static assets
|
diff --git a/config/initializers/sequel.rb b/config/initializers/sequel.rb
index abc1234..def5678 100644
--- a/config/initializers/sequel.rb
+++ b/config/initializers/sequel.rb
@@ -7,3 +7,5 @@
Sequel::Model.db.extension :pagination
Sequel::Model.db.extension :server_block
+
+Sequel.default_timezone = :utc
|
Set timezone configuration for Sequel
|
diff --git a/lib/carrierwave_accessors/orm/activerecord.rb b/lib/carrierwave_accessors/orm/activerecord.rb
index abc1234..def5678 100644
--- a/lib/carrierwave_accessors/orm/activerecord.rb
+++ b/lib/carrierwave_accessors/orm/activerecord.rb
@@ -25,7 +25,7 @@ def write_uploader(column, identifier)
ar_store = self.class.stored_attributes.find{|store, attributes| attributes.include?(column)}.try(:first)
if ar_store
- self.send(ar_store)[column.to_s] = identifier
+ self.__send__(ar_store)[column.to_s] = identifier
else
write_attribute(column, identifier)
end
@@ -34,7 +34,7 @@ def read_uploader(column)
ar_store = self.class.stored_attributes.find{|store, attributes| attributes.include?(column)}.try(:first)
if ar_store
- self.send(ar_store)[column.to_s]
+ self.__send__(ar_store).try(:[], column.to_s)
else
read_attribute(column)
end
@@ -46,4 +46,4 @@ end
end
end
-ActiveRecord::Base.extend CarrierWave::ActiveRecord::Accessable+ActiveRecord::Base.extend CarrierWave::ActiveRecord::Accessable
|
Fix case when field is not in hstore/jsonb
|
diff --git a/CocoaTouchHelpers.podspec b/CocoaTouchHelpers.podspec
index abc1234..def5678 100644
--- a/CocoaTouchHelpers.podspec
+++ b/CocoaTouchHelpers.podspec
@@ -17,7 +17,7 @@ s.default_subspec = 'Core'
s.subspec 'Core' do |cs|
- cs.source_files = "Main/Src/*.swift", "Main/Src/*.{h,m}", "Main/Src/Categories/*.{h,m}", "Main/Src/Classes/*.{h,m}"
+ cs.source_files = "Main/Src/*.{h,m}", "Main/Src/Categories/*.{h,m}", "Main/Src/Classes/*.{h,m}"
end
s.subspec 'ParseExt' do |ps|
|
Revert "Swift support fix in podspec file"
This reverts commit 616f0bc0dd4c8dabfba2916549021dd4d1f62cb8.
|
diff --git a/lib/generators/searcher/searcher_generator.rb b/lib/generators/searcher/searcher_generator.rb
index abc1234..def5678 100644
--- a/lib/generators/searcher/searcher_generator.rb
+++ b/lib/generators/searcher/searcher_generator.rb
@@ -23,6 +23,6 @@
private
def model_names
- ARGV[0..-2].map(&:underscore)
+ ARGV.map(&:underscore)
end
end
|
Undo logic that makes no sense with an optional param."
|
diff --git a/lib/jruby-visualizer/ast_tree_view_builder.rb b/lib/jruby-visualizer/ast_tree_view_builder.rb
index abc1234..def5678 100644
--- a/lib/jruby-visualizer/ast_tree_view_builder.rb
+++ b/lib/jruby-visualizer/ast_tree_view_builder.rb
@@ -13,20 +13,18 @@ node_string = "#{node.node_name}#{node_information} #{node.position.start_line}"
TreeItem.new(node_string)
end
+
+ def build_view(root)
+ @tree_view.root = build_tree_item(root)
+ root.child_nodes.each { |child| build_view_inner(child, @tree_view.root) }
+ end
- def build_view(node, parent_node=nil)
- if parent_node.nil?
- # root node
- parent_node = @tree_view.root = build_tree_item(node)
- else
- # non root node
- node_tree_item = build_tree_item(node)
- parent_node.children << node_tree_item
- parent_node = node_tree_item
- end
-
- node.child_nodes.each { |child| build_view(child, parent_node) }
+ def build_view_inner(node, parent_item)
+ tree_item = build_tree_item(node)
+ parent_item.children << tree_item
+ node.child_nodes.each { |child| build_view_inner(child, tree_item) }
end
+ private :build_view_inner
end
if __FILE__ == $0
|
Use inner method to remove conditional
|
diff --git a/alchemy-pg_search.gemspec b/alchemy-pg_search.gemspec
index abc1234..def5678 100644
--- a/alchemy-pg_search.gemspec
+++ b/alchemy-pg_search.gemspec
@@ -14,7 +14,6 @@ spec.license = "BSD"
spec.files = `git ls-files`.split($/)
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^spec/})
spec.require_paths = ["lib"]
|
Remove executables line from gemspec
|
diff --git a/ZXingObjC.podspec b/ZXingObjC.podspec
index abc1234..def5678 100644
--- a/ZXingObjC.podspec
+++ b/ZXingObjC.podspec
@@ -10,7 +10,7 @@ s.source = { :git => "https://github.com/TheLevelUp/ZXingObjC.git", :tag => "2.1.0" }
s.source_files = 'ZXingObjC/**/*.{h,m}'
- s.requires_arc = false
+ s.requires_arc = true
s.frameworks = 'ImageIO', 'CoreGraphics', 'CoreVideo', 'CoreMedia', 'QuartzCore', 'AVFoundation', 'AudioToolbox'
|
Mark ARC as required in the podspec
|
diff --git a/test/cases/bind_parameter_test_sqlserver.rb b/test/cases/bind_parameter_test_sqlserver.rb
index abc1234..def5678 100644
--- a/test/cases/bind_parameter_test_sqlserver.rb
+++ b/test/cases/bind_parameter_test_sqlserver.rb
@@ -1,62 +1,33 @@ require 'cases/sqlserver_helper'
require 'models/topic'
require 'models_sqlserver/topic'
+require 'cases/bind_parameter_test'
-class BindParameterTestSqlServer < ActiveRecord::TestCase
+# We don't coerce here because these tests are located inside of an if block
+# and don't seem to be able to be properly overriden with the coerce
+# functionality
+module ActiveRecord
+ class BindParameterTest
+ def test_binds_are_logged
+ sub = @connection.substitute_at(@pk, 0)
+ binds = [[@pk, 1]]
+ sql = "select * from topics where id = #{sub}"
- COERCED_TESTS = [
- :test_binds_are_logged,
- :test_binds_are_logged_after_type_cast
- ]
+ @connection.exec_query(sql, 'SQL', binds)
- include SqlserverCoercedTest
-
- fixtures :topics
-
- class LogListener
- attr_accessor :calls
-
- def initialize
- @calls = []
+ message = @listener.calls.find { |args| args[4][:sql].include? sql }
+ assert_equal binds, message[4][:binds]
end
- def call(*args)
- calls << args
+ def test_binds_are_logged_after_type_cast
+ sub = @connection.substitute_at(@pk, 0)
+ binds = [[@pk, "3"]]
+ sql = "select * from topics where id = #{sub}"
+
+ @connection.exec_query(sql, 'SQL', binds)
+
+ message = @listener.calls.find { |args| args[4][:sql].include? sql }
+ assert_equal [[@pk, 3]], message[4][:binds]
end
end
-
- def setup
- super
- @connection = ActiveRecord::Base.connection
- @listener = LogListener.new
- @pk = Topic.columns.find { |c| c.primary }
- ActiveSupport::Notifications.subscribe('sql.active_record', @listener)
- end
-
- def teardown
- ActiveSupport::Notifications.unsubscribe(@listener)
- end
-
- def test_coerced_binds_are_logged
- sub = @connection.substitute_at(@pk, 0)
- binds = [[@pk, 1]]
- sql = "select * from topics where id = #{sub}"
-
- @connection.exec_query(sql, 'SQL', binds)
-
- message = @listener.calls.find { |args| args[4][:sql].include? sql }
- assert_equal binds, message[4][:binds]
- end
-
- def test_coerced_binds_are_logged_after_type_cast
- sub = @connection.substitute_at(@pk, 0)
- binds = [[@pk, "3"]]
- sql = "select * from topics where id = #{sub}"
-
- @connection.exec_query(sql, 'SQL', binds)
-
- message = @listener.calls.find { |args| args[4][:sql].include? sql }
- assert_equal [[@pk, 3]], message[4][:binds]
- end
-
end
|
Fix how we are checking bind tests, can't use coerce since the test methods are defined in an if block
|
diff --git a/http.gemspec b/http.gemspec
index abc1234..def5678 100644
--- a/http.gemspec
+++ b/http.gemspec
@@ -3,8 +3,8 @@ require 'http/version'
Gem::Specification.new do |gem|
- gem.authors = %w(Tony Arcieri)
- gem.email = %w(tony.arcieri@gmail.com)
+ gem.authors = ['Tony Arcieri']
+ gem.email = ['tony.arcieri@gmail.com']
gem.description = <<-DESCRIPTION.strip.gsub(/\s+/, ' ')
An easy-to-use client library for making requests from Ruby.
@@ -14,13 +14,13 @@
gem.summary = 'HTTP should be easy'
gem.homepage = 'https://github.com/tarcieri/http.rb'
- gem.licenses = %w(MIT)
+ gem.licenses = ['MIT']
gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
gem.files = `git ls-files`.split("\n")
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
gem.name = 'http'
- gem.require_paths = %w(lib)
+ gem.require_paths = ['lib']
gem.version = HTTP::VERSION
gem.add_runtime_dependency 'http_parser.rb', '~> 0.6.0'
|
Replace %w() with [] in gemspec
Because sometimes it doesn't worth... ;))
|
diff --git a/lib/activerecord_reindex/update_document_monkey_patch.rb b/lib/activerecord_reindex/update_document_monkey_patch.rb
index abc1234..def5678 100644
--- a/lib/activerecord_reindex/update_document_monkey_patch.rb
+++ b/lib/activerecord_reindex/update_document_monkey_patch.rb
@@ -17,7 +17,14 @@ def update_document(*args, request_record: nil)
# defined in ActiverecordReindex::ReflectionReindex
update_document_hook(request_record)
- original_update_document(*args)
+
+ # If request_record passed - always use index_document to prevent
+ # update_document call on non-indexed record
+ if request_record
+ index_document(*args)
+ else
+ original_update_document(*args)
+ end
end
end
|
Fix indexing new associated records
|
diff --git a/lib/adhearsion/call_controller/output/abstract_player.rb b/lib/adhearsion/call_controller/output/abstract_player.rb
index abc1234..def5678 100644
--- a/lib/adhearsion/call_controller/output/abstract_player.rb
+++ b/lib/adhearsion/call_controller/output/abstract_player.rb
@@ -17,10 +17,6 @@ end
end
- def play_ssml_for(*args)
- play_ssml Formatter.ssml_for(args)
- end
-
def new_output(options)
defaults = {}
default_voice = Adhearsion.config.platform[:default_voice]
|
[CS] Remove unused method from private API
|
diff --git a/lib/fog/octocloud/requests/compute/remote_upload_cube.rb b/lib/fog/octocloud/requests/compute/remote_upload_cube.rb
index abc1234..def5678 100644
--- a/lib/fog/octocloud/requests/compute/remote_upload_cube.rb
+++ b/lib/fog/octocloud/requests/compute/remote_upload_cube.rb
@@ -14,7 +14,8 @@ import_file(Pathname.new(dir), upload)
upload = Dir[File.join(dir, '*.vmdk')].first
end
- remote_request(:method => :POST, :expects => [200], :path => "/api/cubes/#{id}.vmdk", :body => File.new(upload) )
+ remote_request(:method => :POST, :expects => [200], :path => "/api/cubes/#{id}.vmdk",
+ :body => File.new(upload), :read_timeout => 600, :write_timeout => 600)
FileUtils.rm_rf(dir) if dir
end
|
Extend timeouts on cube upload
|
diff --git a/spec/factories/meals/cost_factory.rb b/spec/factories/meals/cost_factory.rb
index abc1234..def5678 100644
--- a/spec/factories/meals/cost_factory.rb
+++ b/spec/factories/meals/cost_factory.rb
@@ -3,6 +3,7 @@ FactoryBot.define do
factory :meal_cost, class: "Meals::Cost" do
meal
+ association :reimbursee, factory: :user
ingredient_cost { 10.00 }
pantry_cost { 2.00 }
payment_method { "check" }
|
802: Add reimbursee to meal cost factory
|
diff --git a/spec/plugin/_erubis_escaping_spec.rb b/spec/plugin/_erubis_escaping_spec.rb
index abc1234..def5678 100644
--- a/spec/plugin/_erubis_escaping_spec.rb
+++ b/spec/plugin/_erubis_escaping_spec.rb
@@ -1,6 +1,7 @@ require File.expand_path("spec_helper", File.dirname(File.dirname(__FILE__)))
begin
+ require 'erubis'
require 'tilt/erb'
begin
require 'tilt/erubis'
|
Fix _erubis_escaping spec plugin guard
|
diff --git a/spec/routing/backend/content_spec.rb b/spec/routing/backend/content_spec.rb
index abc1234..def5678 100644
--- a/spec/routing/backend/content_spec.rb
+++ b/spec/routing/backend/content_spec.rb
@@ -0,0 +1,21 @@+require 'rails_helper'
+
+describe 'content routes' do
+ # namespace :content do
+ # resources :rows, only: [:index, :new, :destroy] do
+ # concerns :positionable
+ #
+ # scope module: 'rows' do
+ # resources :columns do
+ # concerns :positionable
+ # end
+ # end
+ # end
+ #
+ # scope module: 'rows' do
+ # Udongo.config.flexible_content.types.each do |content_type|
+ # resources content_type.to_s.pluralize.to_sym, only: [:edit, :update]
+ # end
+ # end
+ # end
+end
|
Prepare for the content routes.
|
diff --git a/mandel.rb b/mandel.rb
index abc1234..def5678 100644
--- a/mandel.rb
+++ b/mandel.rb
@@ -0,0 +1,30 @@+
+def pixels_for_count(count)
+ # count > 4 ? '#' : '.'
+ [' ','.','-','/','|','<','{','%','&','@','#'][count % 10]
+end
+
+acorn = -2.4
+bcorn = -1.2
+size = 3.1
+pixels = []
+(1..150).each do |j|
+ pixels[j-1] = []
+ (1..150).each do |k|
+ ca = acorn + ((j * size) / 150.0)
+ cb = bcorn + ((k * size) / 150.0)
+ count = zx = zy = 0
+ begin
+ count = count + 1
+ zxx = zx * zx
+ zyy = zy * zy
+ xtemp = zxx - zyy
+ zxy = zx * zy
+ zy = (2 * zxy) + cb
+ zx = xtemp + ca
+ end while (count < 100) && ((zxx + zyy) < 4)
+ pixels[j-1][k-1] = pixels_for_count(count)
+ end
+end
+
+puts pixels.transpose.map {|r| r.join}.join("\n")
|
Add ruby implementation as "check"
The Jack implementation is incredibly slow, and may not actually work so we add a ruby implementation as a check that our impl actually works. This ruby implementation is a direct transliteration of the Jack one (without the boolean logic decompression as I'm pretty sure that rubys' booleans work).
|
diff --git a/POSDataStructures.podspec b/POSDataStructures.podspec
index abc1234..def5678 100644
--- a/POSDataStructures.podspec
+++ b/POSDataStructures.podspec
@@ -1,11 +1,11 @@ Pod::Spec.new do |s|
s.name = 'POSDataStructures'
- s.version = '1.0.0'
+ s.version = '1.0.1'
s.license = 'MIT'
s.summary = 'Data Structures Collection. Contains only Binary Heap at that moment.'
s.homepage = 'https://github.com/pavelosipov/POSDataStructures'
s.author = { 'Pavel Osipov' => 'posipov84@gmail.com' }
- s.source = { :git => 'https://github.com/pavelosipov/POSDataStructures.git', :tag => '1.0.0' }
+ s.source = { :git => 'https://github.com/pavelosipov/POSDataStructures.git', :tag => '1.0.1' }
s.platform = :ios, '5.0'
s.requires_arc = true
s.source_files = 'POSDataStructures/*.{h,m}'
|
Update library version in podspec.
|
diff --git a/app/controllers/backend/schemes_controller.rb b/app/controllers/backend/schemes_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/backend/schemes_controller.rb
+++ b/app/controllers/backend/schemes_controller.rb
@@ -1,9 +1,5 @@ module Backend
class SchemesController < Backend::BaseController
- skip_before_filter :verify_authenticity_token, if: :auth_via_access_token
- skip_before_filter :authenticate_user!, if: :auth_via_access_token
- before_filter :set_user_as_michael, if: :auth_via_access_token
-
expose(:schemes) { |default| default.by_name }
expose_decorated(:scheme, attributes: :scheme_params)
@@ -47,12 +43,6 @@
private
- def auth_via_access_token
- authenticate_with_http_token do |token, options|
- token == SchemeFinderApi.api_access_token
- end if SchemeFinderApi.api_access_token.present?
- end
-
def scheme_params
params.require(:scheme).permit(
:had_direct_interactions, :logo, :logo_cache, :confirmed,
@@ -66,11 +56,5 @@ age_range_ids: []
)
end
-
- def set_user_as_michael
- if auth_via_access_token
- @current_user = User.find_by_email("michael.wallace@bitzesty.com")
- end
- end
end
end
|
Revert "temporary allowing to update schemes with token auth"
This reverts commit 6c5e107737872cb27a4fb746126ea3d4bed8c2dd.
|
diff --git a/providers/elastic_lb.rb b/providers/elastic_lb.rb
index abc1234..def5678 100644
--- a/providers/elastic_lb.rb
+++ b/providers/elastic_lb.rb
@@ -15,6 +15,8 @@ private
def elb
- @@elb ||= RightAws::ElbInterface.new(new_resource.aws_access_key, new_resource.aws_secret_access_key, { :logger => Chef::Log })
+ region = instance_availability_zone
+ region = region[0, region.length-1]
+ @@elb ||= RightAws::ElbInterface.new(new_resource.aws_access_key, new_resource.aws_secret_access_key, { :logger => Chef::Log, :region => region })
end
|
Support other regions besides us-east-1
|
diff --git a/MTBBarcodeScanner.podspec b/MTBBarcodeScanner.podspec
index abc1234..def5678 100644
--- a/MTBBarcodeScanner.podspec
+++ b/MTBBarcodeScanner.podspec
@@ -5,7 +5,7 @@ s.homepage = "https://github.com/mikebuss/MTBBarcodeScanner"
s.license = 'MIT'
s.author = { "Mike Buss" => "mike@mikebuss.com" }
- s.source = { :git => "git@github.com:mikebuss/MTBBarcodeScanner.git", :tag => s.version.to_s }
+ s.source = { :git => "https://github.com/mikebuss/MTBBarcodeScanner.git", :tag => s.version.to_s }
s.platform = :ios, '7.0'
s.ios.deployment_target = '7.0'
|
Use https link in podspec
|
diff --git a/lib/chargify_api_ares/resources/transaction.rb b/lib/chargify_api_ares/resources/transaction.rb
index abc1234..def5678 100644
--- a/lib/chargify_api_ares/resources/transaction.rb
+++ b/lib/chargify_api_ares/resources/transaction.rb
@@ -13,5 +13,10 @@ attrs.merge!(:payment_id => self.id)
Subscription.find(self.subscription_id).refund(attrs)
end
+
+ class Taxation < Base
+ class TaxRule < Base
+ end
+ end
end
end
|
Add blank Taxation and TaxRule classes
|
diff --git a/api/db/migrate/20120411123334_resize_api_key_field.rb b/api/db/migrate/20120411123334_resize_api_key_field.rb
index abc1234..def5678 100644
--- a/api/db/migrate/20120411123334_resize_api_key_field.rb
+++ b/api/db/migrate/20120411123334_resize_api_key_field.rb
@@ -1,5 +1,7 @@ class ResizeApiKeyField < ActiveRecord::Migration
def change
- change_column :spree_users, :api_key, :string, :limit => 48
+ unless defined?(User)
+ change_column :spree_users, :api_key, :string, :limit => 48
+ end
end
end
|
Check if User is defined on ResizeApiKeyField Migration (like others)
|
diff --git a/vagrant_base/rebar/recipes/default.rb b/vagrant_base/rebar/recipes/default.rb
index abc1234..def5678 100644
--- a/vagrant_base/rebar/recipes/default.rb
+++ b/vagrant_base/rebar/recipes/default.rb
@@ -26,10 +26,11 @@
script "install rebar" do
interpreter "bash"
- user node.rebar.user
+ user "root"
cwd "/tmp"
code <<-EOH
source /home/#{node.kerl.user}/otp/R14B02/activate
- tar xvf /tmp/rebar.tar.gz && cd /tmp/#{node.rebar.release_dir} && ./bootstrap && chmod +x rebar && sudo cp rebar #{node.rebar.path}
+ tar xvf /tmp/rebar.tar.gz && cd /tmp/#{node.rebar.release_dir} && ./bootstrap && chmod +x rebar && cp rebar #{node.rebar.path}
+ chown #{node.rebar.user} #{node.rebar.path}
EOH
end
|
Fix rebar recipe for Ubuntu 11.04, resolve conflicts
|
diff --git a/spec/helpers/cloud_volume_helper/textual_summary_spec.rb b/spec/helpers/cloud_volume_helper/textual_summary_spec.rb
index abc1234..def5678 100644
--- a/spec/helpers/cloud_volume_helper/textual_summary_spec.rb
+++ b/spec/helpers/cloud_volume_helper/textual_summary_spec.rb
@@ -10,5 +10,5 @@ attachments
custom_button_events
)
- include_examples "textual_group", "Properties", %i(name size bootable description)
+ include_examples "textual_group", "Properties", %i(name size bootable description status)
end
|
Add Status field to spec
|
diff --git a/lib/specinfra/command/opensuse/base/service.rb b/lib/specinfra/command/opensuse/base/service.rb
index abc1234..def5678 100644
--- a/lib/specinfra/command/opensuse/base/service.rb
+++ b/lib/specinfra/command/opensuse/base/service.rb
@@ -1,7 +1,12 @@ class Specinfra::Command::Opensuse::Base::Service < Specinfra::Command::Suse::Base::Service
class << self
+ include Specinfra::Command::Module::Systemd
def check_is_running(service)
"service #{escape(service)} status"
end
+
+ def check_is_enabled(service, level=nil)
+ "systemctl is-enabled #{escape(service)}"
+ end
end
end
|
Include other systemd actions and override is_enabled check
This PR adds all systemd functions to opensuse and overrides the is_enabled check to ensure
we also check for sysv style files in case we don't have a systemd service
|
diff --git a/config.rb b/config.rb
index abc1234..def5678 100644
--- a/config.rb
+++ b/config.rb
@@ -33,7 +33,7 @@ activate :blog do |blog|
blog.prefix = 'blog'
blog.layout = 'blog_layout'
- blog.permalink = '{title}.html'
+ blog.permalink = '{title}'
blog.summary_separator = /\n\n/
end
|
Drop the .html blog links
|
diff --git a/dm-core.gemspec b/dm-core.gemspec
index abc1234..def5678 100644
--- a/dm-core.gemspec
+++ b/dm-core.gemspec
@@ -10,9 +10,7 @@ gem.test_files = `git ls-files -- {spec}/*`.split("\n")
gem.extra_rdoc_files = %w[LICENSE README.rdoc]
- gem.add_dependency(%q<addressable>, ["~> 2.3"])
- gem.add_dependency(%q<rake>, ["~> 0.9.2"])
- gem.add_dependency(%q<rspec>, ["~> 1.3.2"])
+ gem.add_dependency('addressable', '~> 2.3.2')
gem.add_development_dependency('rake', '~> 0.9.2')
gem.add_development_dependency('rspec', '~> 1.3.2')
|
Remove development dependencies from the runtime dependency list
* Update addressable to reference the latest stable version
|
diff --git a/fabychy.gemspec b/fabychy.gemspec
index abc1234..def5678 100644
--- a/fabychy.gemspec
+++ b/fabychy.gemspec
@@ -1,15 +1,15 @@ lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
-require 'rubychy/version'
+require 'fabychy/version'
Gem::Specification.new do |spec|
- spec.name = "rubychy"
+ spec.name = "fabychy"
spec.version = Fabychy::VERSION
spec.authors = ["Nima Kaviani"]
spec.email = ["nima@robochy.com"]
spec.description = %q{Ruby client for Facebook Bot API}
spec.summary = %q{Ruby client for Facebook Bot API}
- spec.homepage = "https://github.com/nkaviani/rubychy"
+ spec.homepage = "https://github.com/nkaviani/fabychy"
spec.license = "MIT"
spec.files = `git ls-files`.split($/)
|
Fix the naming for the gem spec
|
diff --git a/spec/watirspec/watirspec.rake b/spec/watirspec/watirspec.rake
index abc1234..def5678 100644
--- a/spec/watirspec/watirspec.rake
+++ b/spec/watirspec/watirspec.rake
@@ -1,9 +1,9 @@ begin
- require 'spec'
+ require 'rspec'
rescue LoadError
begin
require 'rubygems'
- require 'spec'
+ require 'rspec'
rescue LoadError
puts <<-EOS
To use rspec for testing you must install rspec gem:
@@ -13,11 +13,11 @@ end
end
-require 'spec/rake/spectask'
+require 'rspec/core/rake_task'
namespace :watirspec do
desc "Run the specs under #{File.dirname(__FILE__)}"
- Spec::Rake::SpecTask.new(:run) do |t|
- t.spec_files = FileList["#{File.dirname(__FILE__)}/*_spec.rb"]
+ RSpec::Core::RakeTask.new(:run) do |t|
+ t.pattern = "#{File.dirname(__FILE__)}/*_spec.rb"
end
end
@@ -44,5 +44,4 @@ end
puts "\nYou're now accessing watirspec via the anonymous URL."
end
-
end
|
Fix the rakefile for RSpec 2.
|
diff --git a/spec/weather_reporter_spec.rb b/spec/weather_reporter_spec.rb
index abc1234..def5678 100644
--- a/spec/weather_reporter_spec.rb
+++ b/spec/weather_reporter_spec.rb
@@ -4,8 +4,4 @@ it "has a version number" do
expect(WeatherReporter::VERSION).not_to be nil
end
-
- it "does something useful" do
- expect(false).to eq(true)
- end
end
|
Remove auto generated test case
remove "does something useful" it block
|
diff --git a/043-substring-divisibility/solution.rb b/043-substring-divisibility/solution.rb
index abc1234..def5678 100644
--- a/043-substring-divisibility/solution.rb
+++ b/043-substring-divisibility/solution.rb
@@ -0,0 +1,45 @@+# The number, 1406357289, is a 0 to 9 pandigital number because it is made up of each of the digits 0 to 9
+# in some order, but it also has a rather interesting sub-string divisibility property.
+
+# Let d1 be the 1st digit, d2 be the 2nd digit, and so on. In this way, we note the following:
+
+# d2d3d4=406 is divisible by 2
+# d3d4d5=063 is divisible by 3
+# d4d5d6=635 is divisible by 5
+# d5d6d7=357 is divisible by 7
+# d6d7d8=572 is divisible by 11
+# d7d8d9=728 is divisible by 13
+# d8d9d10=289 is divisible by 17
+
+# Find the sum of all 0 to 9 pandigital numbers with this property.
+
+start_time = Time.now
+
+require 'prime'
+
+def has_substring_property?(pandigital)
+ return false if pandigital.to_s.length != 10
+ substrings = []
+ primes = Prime.first(7)
+
+ (1..7).each do |index|
+ substrings << pandigital.to_s[index..index + 2]
+ end
+
+ substrings.each_with_index {|substr, i| return false if substr.to_i % primes[i] != 0}
+
+ true
+end
+
+pandigitals09 = (0..9).to_a.permutation(10).to_a.map {|digits| digits.join("").to_i}
+
+pandigitals_with_curious_property = pandigitals09.select {|pan| has_substring_property?(pan.to_i)}
+
+p pandigitals_with_curious_property.reduce(:+)
+
+puts "Time elapsed: #{(Time.now - start_time)} sec"
+
+# => 16695334890
+
+# Takes 83 seconds to run on my machine, which is beyond the acceptable limit in my opinion.
+# Let's refactor this one later.
|
Complete P43, but refactoring badly needed
|
diff --git a/BHCDatabase/test/models/answer_test.rb b/BHCDatabase/test/models/answer_test.rb
index abc1234..def5678 100644
--- a/BHCDatabase/test/models/answer_test.rb
+++ b/BHCDatabase/test/models/answer_test.rb
@@ -1,7 +1,31 @@ require 'test_helper'
class AnswerTest < ActiveSupport::TestCase
- # test "the truth" do
- # assert true
- # end
+ def setup
+ @answer = answers(:one)
+ end
+
+ test 'should be valid' do
+ assert @answer.valid?
+ end
+
+ test 'response should be present' do
+ @answer.response = ''
+ assert_not @answer.valid?
+ end
+
+ test 'response should not be too long' do
+ @answer.response = 'a' * 65_537
+ assert_not @answer.valid?
+ end
+
+ test 'should have a question' do
+ @answer.question = nil
+ assert_not @answer.valid?
+ end
+
+ test "doesn't need a feedback" do
+ @answer.feedback = nil
+ assert @answer.valid?
+ end
end
|
Write model tests for an answer.
|
diff --git a/app/models/otu.rb b/app/models/otu.rb
index abc1234..def5678 100644
--- a/app/models/otu.rb
+++ b/app/models/otu.rb
@@ -4,11 +4,13 @@ belongs_to :import_job
has_one :csv_dataset, :through => :import_job
has_many :categorical_trait_values, :dependent => :destroy
+ has_many :categorical_trait_categories, :through => :categorical_trait_values
has_many :continuous_trait_values, :dependent => :destroy
scope :sorted, order('name ASC')
- # scope the categories
- # scope the traits
+ def categorical_traits
+ categorical_trait_categories.map{|x| x.categorical_trait}.uniq
+ end
def dataset_name
csv_dataset.csv_file_file_name if csv_dataset
|
Add method to get categorical_traits from Otu
|
diff --git a/features/step_definitions/website_management_steps.rb b/features/step_definitions/website_management_steps.rb
index abc1234..def5678 100644
--- a/features/step_definitions/website_management_steps.rb
+++ b/features/step_definitions/website_management_steps.rb
@@ -1,13 +1,13 @@ Given /^I am logged in as an administrator$/ do
@current_user = User.create!(
- :email => 'a@b.c',
+ :email => 'admin@example.org',
:name => 'Admin',
:password => 'admin'
) { |u| u.admin = true }
Given "I am on the login page"
- fill_in("Email", :with => 'a@b.c')
- fill_in("Password", :with => 'admin')
+ fill_in("Email", :with => @current_user.email)
+ fill_in("Password", :with => @current_user.password)
click_button("Login")
visit url_for response.redirected_to()
end
|
Use a valid email address for administrator user account in 'I am logged in as an administrator' cucumber step
|
diff --git a/app/controllers/chat/rooms/messages_controller.rb b/app/controllers/chat/rooms/messages_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/chat/rooms/messages_controller.rb
+++ b/app/controllers/chat/rooms/messages_controller.rb
@@ -9,7 +9,7 @@ end
def index
- @messages = @room.messages.order_by([:timestamp,:desc]).limit(50).reverse
+ @messages = @room.messages.order_by([:timestamp,:asc]).limit(50)
respond_to do |format|
format.json { render json: @messages.to_json }
end
|
Use mongo to sort messages instead of ruby
|
diff --git a/spec/features/show_active_matches_spec.rb b/spec/features/show_active_matches_spec.rb
index abc1234..def5678 100644
--- a/spec/features/show_active_matches_spec.rb
+++ b/spec/features/show_active_matches_spec.rb
@@ -0,0 +1,35 @@+require 'spec_helper'
+
+feature 'Show active matches in project page' do
+ background do
+ @project = create(:project, state: 'online', online_date: -1.day.from_now)
+ create(:match, project: @project, state: :pending)
+
+ create(:match,
+ project: @project,
+ user: create(:user, name: 'Neighbor.ly'),
+ state: :confirmed,
+ value_unit: 2,
+ starts_at: Date.today,
+ finishes_at: 3.days.from_now)
+
+ create(:match,
+ project: @project,
+ user: create(:user, name: 'Foo Bar Corporation'),
+ state: :confirmed,
+ value_unit: 5,
+ starts_at: Date.today,
+ finishes_at: 2.days.from_now)
+ end
+
+ scenario 'lists the active matches' do
+ visit project_path(@project)
+ expect(page).to have_text("Neighbor.ly has pledged to contribute $2 for every $1 raised between now and #{I18n.l(3.days.from_now.to_date, format: :long)}")
+ expect(page).to have_text("Foo Bar Corporation has pledged to contribute $5 for every $1 raised between now and #{I18n.l(2.days.from_now.to_date, format: :long)}")
+ end
+
+ scenario 'show summary of active matches' do
+ visit project_path(@project)
+ expect(page).to have_text("Your $1 is worth $7 from now until #{I18n.l(2.days.from_now.to_date)}")
+ end
+end
|
Create feature spec for showing active matches
Active matches are shown on project page
|
diff --git a/spec/unit/converters/convert_file_spec.rb b/spec/unit/converters/convert_file_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/converters/convert_file_spec.rb
+++ b/spec/unit/converters/convert_file_spec.rb
@@ -10,6 +10,7 @@ allow(::File).to receive(:dirname).and_return('.')
allow(::File).to receive(:join).and_return("test.txt")
allow(::File).to receive(:open).with("test.txt", any_args).and_return(file)
+ allow(file).to receive(:close)
answer = prompt.ask("Which file to open?", convert: :file)
|
Change to stub file close
|
diff --git a/lib/filelock.rb b/lib/filelock.rb
index abc1234..def5678 100644
--- a/lib/filelock.rb
+++ b/lib/filelock.rb
@@ -1,7 +1,7 @@ require 'filelock/version'
require 'timeout'
-if VERSION <= "1.8.7"
+if RUBY_VERSION <= "1.8.7"
require 'tempfile'
def Filelock(lockname, options = {}, &block)
|
fix: Use RUBY_VERSION instead of VERSION
|
diff --git a/lib/justcoin.rb b/lib/justcoin.rb
index abc1234..def5678 100644
--- a/lib/justcoin.rb
+++ b/lib/justcoin.rb
@@ -5,24 +5,34 @@
class Justcoin
- DEFAULT_URI = "https://justcoin.com/api/v1"
+ DEFAULT_URL = "https://justcoin.com/api/v1".freeze
attr_reader :key, :options, :client
def initialize(key, options={})
@key = key
+
+ options[:url] ||= DEFAULT_URL
@options = options
+
@client = build_client
end
private
+ def client_options
+ options.select { |k,v| Faraday::ConnectionOptions.members.include?(k) }
+ end
+
def build_client
- Faraday.new options[:uri] || DEFAULT_URI do |f|
+ Faraday.new(client_options) do |f|
f.request :json
+
f.response :json, content_type: /\bjson$/
f.response :logger, options[:logger] if options[:logger] || options[:log]
f.response :raise_error
+
+ f.adapter Faraday.default_adapter
end
end
|
Allow passing options to Faraday, set adapter
|
diff --git a/lib/tatooine.rb b/lib/tatooine.rb
index abc1234..def5678 100644
--- a/lib/tatooine.rb
+++ b/lib/tatooine.rb
@@ -13,5 +13,5 @@ require "tatooine/vehicle"
module Tatooine
- API_BASE = "http://swapi.co/api/"
+ API_BASE = "https://swapi.co/api/"
end
|
Change swap uri constant from http to https
|
diff --git a/lib/yubioath.rb b/lib/yubioath.rb
index abc1234..def5678 100644
--- a/lib/yubioath.rb
+++ b/lib/yubioath.rb
@@ -1,4 +1,16 @@+require 'bindata'
+
module YubiOATH
CLA = 0x00
AID = [0xA0, 0x00, 0x00, 0x05, 0x27, 0x21, 0x01, 0x01]
+
+ class Response < BinData::Record
+ count_bytes_remaining :data_length
+ string :data, read_length: -> { data_length - 2 }
+ array :success, type: :uint8, initial_length: 2
+
+ def success?
+ success == [0x90, 0x00]
+ end
+ end
end
|
Define a generic Response record which checks the trailing success code
|
diff --git a/app/helpers/url_helper.rb b/app/helpers/url_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/url_helper.rb
+++ b/app/helpers/url_helper.rb
@@ -10,7 +10,7 @@ if params[:profile].present?
options[:profile] = params[:profile]
end
- elsif @domain.profile and @domain.profile.identifier == options[:profile]
+ elsif options[:host].blank? and @domain.profile and @domain.profile.identifier == options[:profile]
# remove profile parameter for better URLs in custom domains
options.delete :profile
end
|
Allow host to be specified
|
diff --git a/app/models/taxon.rb b/app/models/taxon.rb
index abc1234..def5678 100644
--- a/app/models/taxon.rb
+++ b/app/models/taxon.rb
@@ -1,6 +1,6 @@ class Taxon < ActiveRecord::Base
- belongs_to :taxonomy, inverse_of: :taxons
+ belongs_to :taxonomy, inverse_of: :taxons, touch: true
validates :name, presence: true
validates :taxonomy_id, presence: true
|
Add touch to Taxon belongs_to Taxonomy association
|
diff --git a/emarsys.gemspec b/emarsys.gemspec
index abc1234..def5678 100644
--- a/emarsys.gemspec
+++ b/emarsys.gemspec
@@ -10,7 +10,7 @@ spec.email = ["daniel.schoppmann@absolventa.de"]
spec.description = %q{A Ruby library for interacting with the Emarsys API.}
spec.summary = %q{Easy to use ruby library for Emarsys Marketing Suite.}
- spec.homepage = "http://www.absolventa.de"
+ spec.homepage = "https://github.com/Absolventa/emarsys-rb"
spec.license = "MIT"
spec.files = `git ls-files`.split($/)
|
Use Github as gem homepage
|
diff --git a/kondate.gemspec b/kondate.gemspec
index abc1234..def5678 100644
--- a/kondate.gemspec
+++ b/kondate.gemspec
@@ -23,8 +23,8 @@ spec.add_dependency 'serverspec'
spec.add_dependency 'thor'
spec.add_dependency 'highline'
+ spec.add_dependency "rake"
spec.add_development_dependency "bundler"
- spec.add_development_dependency "rake"
spec.add_development_dependency "test-unit"
end
|
Move dependency for Rake from development to runtime.
|
diff --git a/app/views/api/v1/performances/index.json.jbuilder b/app/views/api/v1/performances/index.json.jbuilder
index abc1234..def5678 100644
--- a/app/views/api/v1/performances/index.json.jbuilder
+++ b/app/views/api/v1/performances/index.json.jbuilder
@@ -8,7 +8,7 @@ json.predecessor_host_country predecessor.associated_host.country_code.upcase
end
- json.appearances performance.appearances.role_order do |appearance|
+ json.appearances Appearance.sort_by_role!(performance.appearances) do |appearance|
json.participant_name appearance.participant.full_name
json.participant_role appearance.participant_role
json.instrument_name appearance.instrument.name
|
Speed up /performances API request by sorting appearances after query
|
diff --git a/test/cli/command/test_dump_fields.rb b/test/cli/command/test_dump_fields.rb
index abc1234..def5678 100644
--- a/test/cli/command/test_dump_fields.rb
+++ b/test/cli/command/test_dump_fields.rb
@@ -0,0 +1,87 @@+# frozen_string_literal: true
+
+require "helpers"
+
+# Tests for KBSecret::CLI::Command::DumpFields
+class KBSecretCommandDumpFieldsTest < Minitest::Test
+ include Helpers
+ include Helpers::CLI
+
+ def test_dump_fields_help
+ dump_fields_helps = [
+ %w[dump-fields --help],
+ %w[dump-fields -h],
+ %w[help dump-fields],
+ ]
+
+ dump_fields_helps.each do |dump_fields_help|
+ stdout, = kbsecret(*dump_fields_help)
+ assert_match(/Usage:/, stdout)
+ end
+ end
+
+ def test_dump_fields_too_few_arguments
+ _, stderr = kbsecret "dump-fields"
+
+ assert_match(/Too few arguments given/, stderr)
+ end
+
+ def test_dump_fields_no_such_record
+ _, stderr = kbsecret "pass", "this_record_really_should_not_exist"
+
+ assert_match(/No such login record/, stderr)
+ end
+
+ def test_dump_fields_dump_record
+ kbsecret "new", "login", "test-dump-fields", input: "foo\nbar\n"
+
+ stdout, = kbsecret "dump-fields", "test-dump-fields"
+
+ assert_match(/username: foo/, stdout)
+ assert_match(/password: bar/, stdout)
+ ensure
+ kbsecret "rm", "test-dump-fields"
+ end
+
+ def test_dump_fields_dump_record_terse
+ kbsecret "new", "login", "test-dump-fields-terse", input: "foo\nbar\n"
+
+ stdout, = kbsecret "dump-fields", "test-dump-fields-terse", "-x"
+
+ assert_match(/username:foo/, stdout)
+ assert_match(/password:bar/, stdout)
+
+ stdout, = kbsecret "dump-fields", "test-dump-fields-terse", "-xi", "$"
+
+ assert_match(/username\$foo/, stdout)
+ assert_match(/password\$bar/, stdout)
+
+ with_env("IFS" => "%") do
+ stdout, = kbsecret "dump-fields", "test-dump-fields-terse", "-x"
+
+ assert_match(/username%foo/, stdout)
+ assert_match(/password%bar/, stdout)
+ end
+ ensure
+ kbsecret "rm", "test-dump-fields-terse"
+ end
+
+ def test_dump_fields_accepts_session
+ session_label = "dump-fields-test-session"
+
+ kbsecret "session", "new", session_label, "-r", session_label
+
+ # N.B. we need to call this because the prior `session` call only updates `Config`
+ # in its copy of the process.
+ KBSecret::Config.load!
+
+ kbsecret "new", "-s", session_label, "login", "test-dump-fields-session", input: "foo\nbar\n"
+
+ stdout, = kbsecret "dump-fields", "-s", session_label, "test-dump-fields-session"
+
+ assert_match(/username: foo/, stdout)
+ assert_match(/password: bar/, stdout)
+ ensure
+ kbsecret "session", "rm", "-d", session_label
+ end
+end
|
test/cli: Add tests for `kbsecret dump-fields`
|
diff --git a/lib/copy_peste/models/analyse_result.rb b/lib/copy_peste/models/analyse_result.rb
index abc1234..def5678 100644
--- a/lib/copy_peste/models/analyse_result.rb
+++ b/lib/copy_peste/models/analyse_result.rb
@@ -6,6 +6,7 @@ field :options, type: Hash
embeds_many :results
+ default_scope -> { asc('_id') }
def add_array(header:, rows:, title: nil)
self.results << ArrayResult.new(header: header, rows: rows, title: title)
|
Fix problem MongoDB indexing data
|
diff --git a/lib/fpm/cookery/dependency_inspector.rb b/lib/fpm/cookery/dependency_inspector.rb
index abc1234..def5678 100644
--- a/lib/fpm/cookery/dependency_inspector.rb
+++ b/lib/fpm/cookery/dependency_inspector.rb
@@ -32,7 +32,8 @@ :ensure => "present"
})
result = Puppet::Resource.indirection.save(resource)[1]
- if result.status == "failed"
+ failed = Puppet::Resource.indirection.save(resource)[1].resource_statuses.values.first.failed
+ if failed
Log.fatal "While processing depends package '#{package}':"
result.logs.each {|log_line| Log.fatal log_line}
else
|
Check the individual resource status instead of overall status
|
diff --git a/nexpose.gemspec b/nexpose.gemspec
index abc1234..def5678 100644
--- a/nexpose.gemspec
+++ b/nexpose.gemspec
@@ -2,7 +2,7 @@
Gem::Specification.new do |s|
s.name = 'nexpose'
- s.version = '0.2.0'
+ s.version = '0.2.1'
s.homepage = 'https://github.com/rapid7/nexpose-client'
s.summary = 'Ruby API for Rapid7 Nexpose'
s.description = 'This gem provides a Ruby API to the Nexpose vulnerability management product by Rapid7.'
|
Bump version to add minor usability improvements.
|
diff --git a/lib/hexpress/processors/graphviz_dot.rb b/lib/hexpress/processors/graphviz_dot.rb
index abc1234..def5678 100644
--- a/lib/hexpress/processors/graphviz_dot.rb
+++ b/lib/hexpress/processors/graphviz_dot.rb
@@ -4,8 +4,12 @@ module Processors
# Turn embedded dot files into embedded SVGs
class GraphvizDot
- def initialize(selector)
+ def initialize(selector = '.language-dot')
@selector = selector
+ end
+
+ def self.call(doc)
+ self.new.call(doc)
end
def call(doc)
|
Make GraphvizDot class itself callable
|
diff --git a/robot-name/robot_name_test.rb b/robot-name/robot_name_test.rb
index abc1234..def5678 100644
--- a/robot-name/robot_name_test.rb
+++ b/robot-name/robot_name_test.rb
@@ -2,6 +2,11 @@ require_relative 'robot_name'
class RobotTest < Minitest::Test
+ COMMAND_QUERY = <<-MSG
+ Command/Query Separation:
+ Query methods should generally not change object state.
+ MSG
+
def test_has_name
# rubocop:disable Lint/AmbiguousRegexpLiteral
assert_match /^[A-Z]{2}\d{3}$/, Robot.new.name
@@ -29,7 +34,7 @@ robot.reset
name2 = robot.name
assert name != name2
- assert_equal name2, robot.name, 'Command/Query Separation: query methods should generally not change object state'
+ assert_equal name2, robot.name, COMMAND_QUERY
# rubocop:disable Lint/AmbiguousRegexpLiteral
assert_match /^[A-Z]{2}\d{3}$/, name2
# rubocop:enable Lint/AmbiguousRegexpLiteral
|
Fix style violations in robot-name
Rubocop was complaining about a long line. At first I changed
the failure message to be a heredoc, which triggered a "long method"
violation.
This feels a bit dirty, in that the method is legitimately long, but
perhaps it's not too bad to make the message a constant.
|
diff --git a/robot-name/robot_name_test.rb b/robot-name/robot_name_test.rb
index abc1234..def5678 100644
--- a/robot-name/robot_name_test.rb
+++ b/robot-name/robot_name_test.rb
@@ -3,7 +3,7 @@
class RobotTest < MiniTest::Unit::TestCase
def test_has_name
- assert_match /\w{2}\d{3}/, Robot.new.name
+ assert_match /[a-zA-Z]{2}\d{3}/, Robot.new.name
end
def test_name_sticks
|
Make robo-name test more strict
|
diff --git a/printnode.gemspec b/printnode.gemspec
index abc1234..def5678 100644
--- a/printnode.gemspec
+++ b/printnode.gemspec
@@ -1,16 +1,16 @@ Gem::Specification.new do |s|
- s.name = "printnode"
- s.version = "1.0.6"
- s.date = "2015-08-19"
- s.summary = "PrintNode-Ruby"
- s.description = "Ruby API Library for PrintNode remote printing service."
- s.authors = ["PrintNode","Jake Torrance"]
- s.email = ["support@printnode.com"]
- s.files = ["lib/printnode.rb","lib/printnode/client.rb","lib/printnode/api_exception.rb","lib/printnode/auth.rb","lib/printnode/account.rb","lib/printnode/printjob.rb"]
- s.homepage = "https://www.printnode.com"
- s.license = "MIT"
+ s.name = "printnode"
+ s.version = "1.0.6"
+ s.date = "2015-08-19"
+ s.summary = "PrintNode-Ruby"
+ s.description = "Ruby API Library for PrintNode remote printing service."
+ s.authors = ["PrintNode","Jake Torrance"]
+ s.email = ["support@printnode.com"]
+ s.files = ["lib/printnode.rb","lib/printnode/client.rb","lib/printnode/api_exception.rb","lib/printnode/auth.rb","lib/printnode/account.rb","lib/printnode/printjob.rb"]
+ s.homepage = "https://www.printnode.com"
+ s.license = "MIT"
s.required_ruby_version = '>=1.9'
- s.post_install_message = "Happy Printing!"
+ s.post_install_message = "Happy Printing!"
s.add_development_dependency 'json', '>=0'
s.add_development_dependency 'test-unit', '>=0'
end
|
Replace tabs with spaces in gemspec
|
diff --git a/lib/vagrant/actions/vm/forward_ports.rb b/lib/vagrant/actions/vm/forward_ports.rb
index abc1234..def5678 100644
--- a/lib/vagrant/actions/vm/forward_ports.rb
+++ b/lib/vagrant/actions/vm/forward_ports.rb
@@ -23,7 +23,7 @@
def clear
logger.info "Deleting any previously set forwarded ports..."
- @runner.vm.forwarded_ports.collect { |p| p.destroy(true) }
+ @runner.vm.forwarded_ports.collect { |p| p.destroy }
end
def forward_ports
|
Fix forwarded ports destroy method call to use new virtualbox format
|
diff --git a/tasks/cops_documentation.rake b/tasks/cops_documentation.rake
index abc1234..def5678 100644
--- a/tasks/cops_documentation.rake
+++ b/tasks/cops_documentation.rake
@@ -14,8 +14,3 @@ deps = %w[Bundler Gemspec Layout Lint Metrics Migration Naming Security Style]
CopsDocumentationGenerator.new(departments: deps).call
end
-
-desc 'Generate docs of all cops departments (obsolete)'
-task :generate_cops_documentation do
- puts 'Updating the documentation is now done automatically!'
-end
|
Remove an obsolete development task
This commit removes an obsolete `:generate_cops_documentation` development task.
It's been a year since it was introduced in https://github.com/rubocop/rubocop/commit/1905f1b
and is no longer in use.
|
diff --git a/lib/savannah.rb b/lib/savannah.rb
index abc1234..def5678 100644
--- a/lib/savannah.rb
+++ b/lib/savannah.rb
@@ -3,8 +3,93 @@
module Savannah
class Main
+ attr_accessor :router
+
+ def initialize(env={})
+ @router = Router.new
+ end
+
def call(env)
- [200, {}, ["Hello", "Whatever"]]
+ route = @router.route_for(env)
+ if route
+ response = route.execute(env)
+ response.rack_response
+ else
+ [404, {}, ["Page not found"]]
+ end
+ end
+ end
+
+ class Response
+ attr_accessor :status_code, :headers, :body
+
+ def initialize
+ @headers = {}
+ end
+
+ def rack_response
+ [status_code, headers, Array(body)]
+ end
+ end
+
+ class Router
+ attr_reader :routes
+
+ def initialize
+ @routes = Hash.new { |hash, key| hash[key] = [] }
+ end
+
+ def config(&block)
+ instance_eval &block
+ end
+
+ def route_for(env)
+ path = env["PATH_INFO"]
+ method = env["REQUEST_METHOD"].downcase.to_sym
+ route_array = @routes[method].detect do |route|
+ case route.first
+ when String
+ path == route.first
+ when Regexp
+ path =~ route.first
+ end
+ end
+
+ return Route.new(route_array) if route_array
+ return nil #No route matched
+ end
+
+ def get(path, options = {})
+ @routes[:get] << [path, parse_to(options[:to])]
+ end
+
+ private
+ def parse_to(controller_action)
+ klass, method = controller_action.split('#')
+ { klass: klass.capitalize, method: method }
+ end
+ end
+
+ class Route
+ attr_accessor :klass_name, :path, :instance_method
+
+ def initialize(route_array)
+ @path = route_array.first
+ @klass_name = route_array.last[:klass]
+ @instance_method = route_array.last[:method]
+ #handle_requires
+ end
+
+ def klass
+ Module.const_get(@klass_name)
+ end
+
+ def execute(env)
+ klass.new(env).send(@instance_method.to_sym)
+ end
+
+ def handle_requires
+ require File.join(File.dirname(__FILE__), '../', 'app', 'controllers', klass_name.downcase + '.rb')
end
end
end
|
Add initial Rack request/response handling classes.
|
diff --git a/week-4/defining-variables.rb b/week-4/defining-variables.rb
index abc1234..def5678 100644
--- a/week-4/defining-variables.rb
+++ b/week-4/defining-variables.rb
@@ -0,0 +1,39 @@+#Solution Below
+first_name = 'Colin'
+last_name = 'Razevich'
+age = 27
+
+
+
+# RSpec Tests. They are included in this file because the local variables you are creating are not accessible across files. If we try to run these files as a separate file per normal operation, the local variable checks will return nil.
+
+
+describe 'first_name' do
+ it "is defined as a local variable" do
+ expect(defined?(first_name)).to eq 'local-variable'
+ end
+
+ it "is a String" do
+ expect(first_name).to be_a String
+ end
+end
+
+describe 'last_name' do
+ it "is defined as a local variable" do
+ expect(defined?(last_name)).to eq 'local-variable'
+ end
+
+ it "be a String" do
+ expect(last_name).to be_a String
+ end
+end
+
+describe 'age' do
+ it "is defined as a local variable" do
+ expect(defined?(age)).to eq 'local-variable'
+ end
+
+ it "is an integer" do
+ expect(age).to be_a Fixnum
+ end
+end
|
Add ruby file for reflection
|
diff --git a/ext/sha3/extconf.rb b/ext/sha3/extconf.rb
index abc1234..def5678 100644
--- a/ext/sha3/extconf.rb
+++ b/ext/sha3/extconf.rb
@@ -1,13 +1,18 @@ require 'mkmf'
+require 'rbconfig'
FileUtils.rm "#{$srcdir}/KeccakF-1600-opt.c", :force => true
-case 1.size
-when 4 # x86 32bit optimized code
+build_cpu = RbConfig::CONFIG['build_cpu']
+
+if 1.size == 4 and build_cpu =~ /i386|x86_32/ # x86 32bit optimized code
+ Logging::message "=== Using i386 optimized Keccak code ===\n"
FileUtils.cp "#{$srcdir}/KeccakF-1600-opt32.c-arch", "#{$srcdir}/KeccakF-1600-opt.c"
-when 8 # x86 64bit optimized code
+elsif 1.size == 8 and build_cpu =~ /i686|x86_64/
+ Logging::message "=== Using i686 optimized Keccak code ===\n"
FileUtils.cp "#{$srcdir}/KeccakF-1600-opt64.c-arch", "#{$srcdir}/KeccakF-1600-opt.c"
else # Ha? Use reference code -- slow
+ Logging::message "=== Using reference Keccak code ===\n"
FileUtils.cp "#{$srcdir}/KeccakF-1600-reference.c-arch", "#{$srcdir}/KeccakF-1600-opt.c"
end
@@ -19,4 +24,3 @@
$CFLAGS = ' -fomit-frame-pointer -O3 -g0 -march=nocona '
create_makefile 'sha3_n'
-
|
FIX: Use x86 optimized code only when compiling on a x86 CPU.
- Resolves compilation errors on ARM based processor (defaults to reference code).
|
diff --git a/laravel/recipes/symlink_storage.rb b/laravel/recipes/symlink_storage.rb
index abc1234..def5678 100644
--- a/laravel/recipes/symlink_storage.rb
+++ b/laravel/recipes/symlink_storage.rb
@@ -7,6 +7,7 @@ mv current/storage/* shared
rm -rf current/storage
ln -s #{deploy[:deploy_to]}/shared #{deploy[:deploy_to]}/current/storage
+ chown -h #{deploy[:user]}:#{deploy[:group]} #{deploy[:deploy_to]}/current/storage
EOH
end
end
|
Adjust the permissions of the storage symlink
|
diff --git a/test/stream/http/auth_test.rb b/test/stream/http/auth_test.rb
index abc1234..def5678 100644
--- a/test/stream/http/auth_test.rb
+++ b/test/stream/http/auth_test.rb
@@ -0,0 +1,68 @@+# encoding: UTF-8
+
+require 'vines'
+require 'minitest/autorun'
+
+class HttpAuthTest < MiniTest::Unit::TestCase
+ def setup
+ @stream = MiniTest::Mock.new
+ @state = Vines::Stream::Http::Auth.new(@stream, nil)
+ end
+
+ def test_missing_body_raises_error
+ node = node('<presence type="unavailable"/>')
+ assert_raises(Vines::StreamErrors::NotAuthorized) { @state.node(node) }
+ end
+
+ def test_body_with_missing_namespace_raises_error
+ node = node('<body rid="42" sid="12"/>')
+ assert_raises(Vines::StreamErrors::NotAuthorized) { @state.node(node) }
+ end
+
+ def test_missing_rid_raises_error
+ node = node('<body xmlns="http://jabber.org/protocol/httpbind" sid="12"/>')
+ assert_raises(Vines::StreamErrors::NotAuthorized) { @state.node(node) }
+ end
+
+ def test_invalid_session_raises_error
+ @stream.expect(:valid_session?, false, ['12'])
+ node = node('<body xmlns="http://jabber.org/protocol/httpbind" rid="42" sid="12"/>')
+ assert_raises(Vines::StreamErrors::NotAuthorized) { @state.node(node) }
+ assert @stream.verify
+ end
+
+ def test_empty_body_raises_error
+ node = node('<body xmlns="http://jabber.org/protocol/httpbind" rid="42" sid="12"/>')
+ @stream.expect(:valid_session?, true, ['12'])
+ @stream.expect(:parse_body, [], [node])
+ assert_raises(Vines::StreamErrors::NotAuthorized) { @state.node(node) }
+ assert @stream.verify
+ end
+
+ def test_body_with_two_children_raises_error
+ node = node('<body xmlns="http://jabber.org/protocol/httpbind" rid="42" sid="12"><message/><message/></body>')
+ message = node('<message/>')
+ @stream.expect(:valid_session?, true, ['12'])
+ @stream.expect(:parse_body, [message, message], [node])
+ assert_raises(Vines::StreamErrors::NotAuthorized) { @state.node(node) }
+ assert @stream.verify
+ end
+
+ def test_valid_body_processes
+ auth = node(%Q{<auth xmlns="#{Vines::NAMESPACES[:sasl]}" mechanism="PLAIN"/>})
+ node = node('<body xmlns="http://jabber.org/protocol/httpbind" rid="42" sid="12"></body>')
+ node << auth
+ @stream.expect(:valid_session?, true, ['12'])
+ @stream.expect(:parse_body, [auth], [node])
+ # this error means we correctly called the parent method Client#node
+ @stream.expect(:error, nil, [Vines::SaslErrors::MalformedRequest.new])
+ @state.node(node)
+ assert @stream.verify
+ end
+
+ private
+
+ def node(xml)
+ Nokogiri::XML(xml).root
+ end
+end
|
Add http auth state tests.
|
diff --git a/examples/sprinkle/sprinkle.rb b/examples/sprinkle/sprinkle.rb
index abc1234..def5678 100644
--- a/examples/sprinkle/sprinkle.rb
+++ b/examples/sprinkle/sprinkle.rb
@@ -1,35 +1,11 @@-#!/usr/bin/env sprinkle -s
+#!/usr/bin/env sprinkle -c -s
-# Example of a simple Sprinkle script to install a single gem on a remote host.
+# Example of the simplest Sprinkle script to install a single gem on a remote host. This
+# particular script assumes that rubygems (and ruby, etc) are already installed on the remote
+# host. To see a larger example of installing an entire ruby, rubygems, gem stack from source,
+# please see the rails example.
-# Packages, sprinkle and its dependencies including rubygems and ruby, delivery mechanism
-# uses Vlad
-
-package :build_essential do
- description 'Build tools'
- apt 'build-essential'
-end
-
-package :ruby do
- description 'Ruby Virtual Machine'
- version '1.8.6'
- source "ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-#{version}-p111.tar.gz" # implicit :style => :gnu
- requires :ruby_dependencies
-end
-
-package :ruby_dependencies do
- description 'Ruby Virtual Machine Build Dependencies'
- apt %w( bison zlib1g-dev libssl-dev libreadline5-dev libncurses5-dev file )
-end
-
-package :rubygems do
- description 'Ruby Gems Package Management System'
- version '1.0.1'
- source "http://rubyforge.org/frs/download.php/29548/rubygems-#{version}.tgz" do
- custom_install 'ruby setup.rb'
- end
- requires :ruby
-end
+# Packages, only sprinkle is defined in this world
package :sprinkle do
description 'Sprinkle Provisioning Tool'
@@ -39,18 +15,18 @@ end
-# Policy, sprinkle policy requires only the sprinkle gem
+# Policies, sprinkle policy requires only the sprinkle gem
policy :sprinkle, :roles => :app do
requires :sprinkle
end
-# Deployment
+# Deployment settings
deployment do
- # mechanism for deployment
+ # use vlad for deployment
delivery :vlad do
role :app, 'yourhost.com'
end
|
Update Sprinkle example to really be an example of the smallest Sprinkle script possible for deploying a single gem to a remote host, also demonstrates and example of using package recommendations to optionally rely on rubygems
|
diff --git a/common/patches.rb b/common/patches.rb
index abc1234..def5678 100644
--- a/common/patches.rb
+++ b/common/patches.rb
@@ -1,5 +1,5 @@ class Array
def find_property(property, value)
- find { |e| e[property.to_s] && e[property.to_s] == value }
+ find { |e| e.send(property) == value }
end
end
|
Fix the find_property patch to work for objects and not just hashes
|
diff --git a/spec/features/merge_requests/pipelines_spec.rb b/spec/features/merge_requests/pipelines_spec.rb
index abc1234..def5678 100644
--- a/spec/features/merge_requests/pipelines_spec.rb
+++ b/spec/features/merge_requests/pipelines_spec.rb
@@ -41,7 +41,7 @@
scenario 'user visits merge request page' do
page.within('.merge-request-tabs') do
- expect(page).not_to have_link('Pipelines')
+ expect(page).to have_no_link('Pipelines')
end
end
end
|
Use have_no_link to test presence of button
|
diff --git a/Casks/yourkit-java-profiler.rb b/Casks/yourkit-java-profiler.rb
index abc1234..def5678 100644
--- a/Casks/yourkit-java-profiler.rb
+++ b/Casks/yourkit-java-profiler.rb
@@ -1,6 +1,6 @@ cask :v1 => 'yourkit-java-profiler' do
- version '2014-build-14120'
- sha256 '88ae356404b150121522a941dbd5efdaa796b29cbbb7ca4cd173e893bfbbbf51'
+ version '2015-build-15044'
+ sha256 '4a1ccfe84645026701dd45414e53ddfb948b2dd0fa88aaf5dece2fcd0c244037'
url "http://www.yourkit.com/download/yjp-#{version}-mac.zip"
name 'YourKit Java Profiler'
|
Update Yourkit Java Profiler to 2015-build-15044
|
diff --git a/gigasecond/gigasecond_test.rb b/gigasecond/gigasecond_test.rb
index abc1234..def5678 100644
--- a/gigasecond/gigasecond_test.rb
+++ b/gigasecond/gigasecond_test.rb
@@ -6,26 +6,26 @@ class GigasecondTest < MiniTest::Unit::TestCase
def test_1
- gs = Gigasecond.new(Date.new(2011, 4, 25))
+ gs = Gigasecond.from(Date.new(2011, 4, 25))
assert_equal Date.new(2043, 1, 1), gs.date
end
def test_2
skip
- gs = Gigasecond.new(Date.new(1977, 6, 13))
+ gs = Gigasecond.from(Date.new(1977, 6, 13))
assert_equal Date.new(2009, 2, 19), gs.date
end
def test_3
skip
- gs = Gigasecond.new(Date.new(1959, 7, 19))
+ gs = Gigasecond.from(Date.new(1959, 7, 19))
assert_equal Date.new(1991, 3, 27), gs.date
end
def test_yourself
skip
your_birthday = Date.new(year, month, day)
- gs = Gigasecond.new(your_birthday)
+ gs = Gigasecond.from(your_birthday)
assert_equal Date.new(2009, 1, 31), gs.date
end
|
Replace constructor by factory method for more expressiveness in Gigasecond
|
diff --git a/spec/carthage_cache/archive_installer_spec.rb b/spec/carthage_cache/archive_installer_spec.rb
index abc1234..def5678 100644
--- a/spec/carthage_cache/archive_installer_spec.rb
+++ b/spec/carthage_cache/archive_installer_spec.rb
@@ -14,7 +14,11 @@ let(:archive_path) { File.join(project.tmpdir, project.archive_filename) }
it "downloads and installs the archive" do
+ # download expectation
expect(repository).to receive(:download).with(project.archive_filename, archive_path)
+ # install expectation
+ expect(archiver).to receive(:unarchive).with(archive_path, project.carthage_build_directory)
+
archive_installer.install
end
|
Add test ensuring installer actually unarchives zip
This will be meaningful once we'll implement the check for the zip in
the local cache, as we'll ensure that the archive won't be downloaded
again
|
diff --git a/spec/rubocop/cops/cop_spec.rb b/spec/rubocop/cops/cop_spec.rb
index abc1234..def5678 100644
--- a/spec/rubocop/cops/cop_spec.rb
+++ b/spec/rubocop/cops/cop_spec.rb
@@ -8,23 +8,23 @@ let (:cop) { Cop.new }
it 'initially has 0 offences' do
- cop.offences.size.should == 0
+ expect(cop.offences).to be_empty
end
it 'initially has nothing to report' do
- cop.has_report?.should be_false
+ expect(cop.has_report?).to be_false
end
it 'keeps track of offences' do
cop.add_offence(:convention, 1, 'message')
- cop.offences.size.should == 1
+ expect(cop.offences.size).to eq(1)
end
it 'will report registered offences' do
cop.add_offence(:convention, 1, 'message')
- cop.has_report?.should be_true
+ expect(cop.has_report?).to be_true
end
end
end
|
Migrate spec from should to expect
|
diff --git a/spec/support/shell_helpers.rb b/spec/support/shell_helpers.rb
index abc1234..def5678 100644
--- a/spec/support/shell_helpers.rb
+++ b/spec/support/shell_helpers.rb
@@ -20,4 +20,16 @@ end
end
end
+
+ # Output text to file using `File#puts`, which mimics the behavior of the
+ # `echo` shell command.
+ #
+ # @param text [String] text to write
+ # @param file [String] path to target file
+ # @param options [Hash]
+ # @option options [Boolean] :append whether to append to existing file
+ def echo(text, file, options = {})
+ mode = options[:append] ? 'a' : 'w'
+ File.open(file, mode) { |f| f.puts(text) }
+ end
end
|
Add 'echo' helper method for cross-platform compatibility
|
diff --git a/lib/redd/utilities/rate_limiter.rb b/lib/redd/utilities/rate_limiter.rb
index abc1234..def5678 100644
--- a/lib/redd/utilities/rate_limiter.rb
+++ b/lib/redd/utilities/rate_limiter.rb
@@ -4,8 +4,8 @@ module Utilities
# Manages rate limiting by sleeping.
class RateLimiter
- def initialize(gap = 1)
- @gap = 1
+ def initialize(gap)
+ @gap = gap
@last_request_time = Time.now - gap
end
|
Fix bug with rate limit timing.
|
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -53,7 +53,7 @@ private
def course_params
- params.require(:course).permit(:name, :descriptisplits_attributes: [:id, :name, :distance_from_start, :kind])
+ params.require(:course).permit(:name, :description, splits_attributes: [:id, :name, :distance_from_start, :kind])
end
def query_params
|
Fix typo in courses controller
|
diff --git a/app/controllers/admin/problems_controller.rb b/app/controllers/admin/problems_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/admin/problems_controller.rb
+++ b/app/controllers/admin/problems_controller.rb
@@ -10,11 +10,14 @@ @problem = @contest.problems.create problem_parameters
uploaded_io = params[:problem][:attachment_ids]
- attachment = @problem.attachments.create(original_filename: uploaded_io.original_filename,
- content_type: uploaded_io.content_type)
- attachment.with_file('w') do |file|
- file.write(uploaded_io.read)
+ if uploaded_io
+ attachment = @problem.attachments.create(original_filename: uploaded_io.original_filename,
+ content_type: uploaded_io.content_type)
+
+ attachment.with_file('w') do |file|
+ file.write(uploaded_io.read)
+ end
end
if @problem.valid?
|
Check for existence of attachment on Problem upload.
|
diff --git a/app/controllers/api/v1/objects_controller.rb b/app/controllers/api/v1/objects_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/v1/objects_controller.rb
+++ b/app/controllers/api/v1/objects_controller.rb
@@ -8,6 +8,10 @@ File.open("#{@volume}/#{object_name}", "w") do |f|
f.write object
end
+ Brain.request path: "/cluster-api/v1/upload-tokens/#{params[:upload_token]}",
+ method: :delete,
+ query: { client_ip: request.remote_ip },
+ access_token: @jwt
ok
end
|
Delete upload token after upload is complete
|
diff --git a/app/controllers/tracking_lists_controller.rb b/app/controllers/tracking_lists_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/tracking_lists_controller.rb
+++ b/app/controllers/tracking_lists_controller.rb
@@ -6,6 +6,11 @@ before_filter :get_trackable_items_user
before_filter :get_tracking_list
+ def show
+ respond_to do |format|
+ format.html
+ end
+ end
protected
|
Add show method to Tracking List Controller.
Signed-off-by: Chris Toynbee <9bf3774ab19e71b4502fac9bd506468044cb6bd6@gmail.com>
|
diff --git a/lib/generators/the_moderator/install/install_generator.rb b/lib/generators/the_moderator/install/install_generator.rb
index abc1234..def5678 100644
--- a/lib/generators/the_moderator/install/install_generator.rb
+++ b/lib/generators/the_moderator/install/install_generator.rb
@@ -7,7 +7,7 @@ template 'moderation.rb', File.join('app', 'models', 'moderation.rb')
end
- def create_migration
+ def create_migration_file
migration_template 'migration.rb', 'db/migrate/create_moderations.rb'
end
|
Rename create_migration method in generator for Rails 4
Rails 4 already has a create_migration method in
Rails::Generators::Migration.
|
diff --git a/core/app/models/spree/gateway/bogus_simple.rb b/core/app/models/spree/gateway/bogus_simple.rb
index abc1234..def5678 100644
--- a/core/app/models/spree/gateway/bogus_simple.rb
+++ b/core/app/models/spree/gateway/bogus_simple.rb
@@ -4,6 +4,14 @@
def payment_profiles_supported?
false
+ end
+
+ def capture(money, response_code, options = {})
+ if response_code == '12345'
+ ActiveMerchant::Billing::Response.new(true, 'Bogus Gateway: Forced success', {}, :test => true, :authorization => '67890')
+ else
+ ActiveMerchant::Billing::Response.new(false, 'Bogus Gateway: Forced failure', :error => 'Bogus Gateway: Forced failure', :test => true)
+ end
end
def authorize(money, credit_card, options = {})
|
Add process method to BogusSimple gateway to be able to process payments.
Fixes issue where hitting "process" on payments screen breaks with
BogusSimple gateway.
Fixes #3824
|
diff --git a/app/controllers/manual_document_attachments_controller.rb b/app/controllers/manual_document_attachments_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/manual_document_attachments_controller.rb
+++ b/app/controllers/manual_document_attachments_controller.rb
@@ -41,6 +41,18 @@
private
def services
+ if current_user_is_gds_editor?
+ gds_editor_services
+ else
+ organisational_services
+ end
+ end
+
+ def gds_editor_services
+ ManualDocumentAttachmentServiceRegistry.new
+ end
+
+ def organisational_services
OrganisationalManualDocumentAttachmentServiceRegistry.new(
organisation_slug: current_organisation_slug,
)
|
Use separate services for GDS/non-GDS editors
When the User comes to add an attachment, if they were a GDS editor
editing a non GDS manual then this would come back with a "Manual not
found". This commit fixes that by using a new registry which isn't
scoped to an organisation for GDS editors.
This approach introduces some duplication. This is intended as it keeps
the attachment code similar to the code that deals with manuals. The
hope this is that this duplication can be removed more easily at a
later date.
Ticket:
https://trello.com/c/yo9nTcYO/85-attachments-can-t-be-added-to-manual-sections
|
diff --git a/rom-git.gemspec b/rom-git.gemspec
index abc1234..def5678 100644
--- a/rom-git.gemspec
+++ b/rom-git.gemspec
@@ -20,6 +20,7 @@
spec.add_development_dependency "bundler"
spec.add_development_dependency "rake"
+ spec.add_development_dependency "minitest"
spec.add_development_dependency "pry"
spec.add_development_dependency "anima"
end
|
Add minitest to the gemspec
|
diff --git a/app/serializers/payment_serializer.rb b/app/serializers/payment_serializer.rb
index abc1234..def5678 100644
--- a/app/serializers/payment_serializer.rb
+++ b/app/serializers/payment_serializer.rb
@@ -2,6 +2,6 @@ attributes :id, :name, :amount, :category_id, :type, :schedule, :upcoming
def upcoming
- schedule.next_occurrences(5)
+ schedule.occurrences_between(Date.today, Date.today + 30.days)
end
end
|
Include payment occurences for the next 30 days in `upcoming`
|
diff --git a/week-4/address/my_solution.rb b/week-4/address/my_solution.rb
index abc1234..def5678 100644
--- a/week-4/address/my_solution.rb
+++ b/week-4/address/my_solution.rb
@@ -6,7 +6,7 @@ # Your Solution Below
def make_address(street,city,state,zip)
- puts "You live at #{street}, in the beautiful city of #{city}, #{state}. Your zip is #{zip}."
+ p "You live at #{street}, in the beautiful city of #{city}, #{state}. Your zip is #{zip}."
end
make_address("633 Folsom St.", "San Francisco", "CA", "94107")
|
Change to p from puts
|
diff --git a/lib/doorkeeper/oauth/scopes.rb b/lib/doorkeeper/oauth/scopes.rb
index abc1234..def5678 100644
--- a/lib/doorkeeper/oauth/scopes.rb
+++ b/lib/doorkeeper/oauth/scopes.rb
@@ -53,7 +53,7 @@ end
def <=>(other)
- self.all.sort <=> other.all.sort
+ self.map(&:to_s).sort <=> other.map(&:to_s).sort
end
end
end
|
Fix for ruby 1.8 (cannot sort arrays of symbols)
|
diff --git a/db/migrations/016_refactor_filter_paper_tables.rb b/db/migrations/016_refactor_filter_paper_tables.rb
index abc1234..def5678 100644
--- a/db/migrations/016_refactor_filter_paper_tables.rb
+++ b/db/migrations/016_refactor_filter_paper_tables.rb
@@ -0,0 +1,14 @@+::Sequel.migration do
+ change do
+ alter_table(:filter_papers) do
+ drop_column :number_of_rows
+ drop_column :number_of_columns
+ end
+
+ alter_table(:locations) do
+ drop_column :position
+ end
+
+ rename_table(:locations, :filter_paper_aliquots)
+ end
+end
|
Add migration refactoring filter paper tables
|
diff --git a/lib/octokit/client/statuses.rb b/lib/octokit/client/statuses.rb
index abc1234..def5678 100644
--- a/lib/octokit/client/statuses.rb
+++ b/lib/octokit/client/statuses.rb
@@ -11,7 +11,7 @@ # @param repo [String, Repository, Hash] A GitHub repository
# @param sha [String] The SHA1 for the commit
# @return [Array<Sawyer::Resource>] A list of statuses
- # @see http://developer.github.com/v3/repos/status
+ # @see http://developer.github.com/v3/repos/statuses
def statuses(repo, sha, options = {})
get "repos/#{Repository.new(repo)}/statuses/#{sha}", options
end
@@ -23,7 +23,7 @@ # @param sha [String] The SHA1 for the commit
# @param state [String] The state: pending, success, failure, error
# @return [Sawyer::Resource] A status
- # @see http://developer.github.com/v3/repos/status
+ # @see http://developer.github.com/v3/repos/statuses
def create_status(repo, sha, state, options = {})
options.merge!(:state => state)
post "repos/#{Repository.new(repo)}/statuses/#{sha}", options
|
Update status.rb - fix link
Fixes documentation links in statuses.rb
|
diff --git a/cookbooks/asdf/default.rb b/cookbooks/asdf/default.rb
index abc1234..def5678 100644
--- a/cookbooks/asdf/default.rb
+++ b/cookbooks/asdf/default.rb
@@ -1,7 +1,7 @@ define :asdf_plugin, git: nil do
git_url = params[:git] ? ' ' + params[:git] : nil
- execute "asdf plugin-add #{params[:name]}#{git_url}" do
+ execute "~/.asdf/bin/asdf plugin-add #{params[:name]}#{git_url}" do
user node[:user]
not_if "test -d ~/.asdf/plugins/#{params[:name]}"
notifies :run, 'execute[import-release-team-keyring]'
@@ -14,7 +14,7 @@ only_if { params[:name] == 'nodejs' }
end
- execute "asdf global #{params[:name]} system" do
+ execute "~/.asdf/bin/asdf global #{params[:name]} system" do
user node[:user]
not_if "grep '#{params[:name]} system' ~/.tool-versions"
end
|
Use absolute path for asdf
|
diff --git a/rufus-lua.gemspec b/rufus-lua.gemspec
index abc1234..def5678 100644
--- a/rufus-lua.gemspec
+++ b/rufus-lua.gemspec
@@ -11,7 +11,6 @@ s.authors = [ 'John Mettraux', 'Alain Hoang', 'Scott Persinger' ]
s.email = [ 'jmettraux@gmail.com' ]
s.homepage = 'https://github.com/jmettraux/rufus-lua'
- s.rubyforge_project = 'rufus'
s.license = 'MIT'
s.summary = 'ruby-ffi based bridge from Ruby to Lua'
|
Drop the rubyforge entry from the gemspec
|
diff --git a/test/integration/local_transaction_api_test.rb b/test/integration/local_transaction_api_test.rb
index abc1234..def5678 100644
--- a/test/integration/local_transaction_api_test.rb
+++ b/test/integration/local_transaction_api_test.rb
@@ -0,0 +1,48 @@+require 'integration_test_helper'
+
+class LocalTransactionApiTest < ActionDispatch::IntegrationTest
+ setup do
+ authority = FactoryGirl.create(:local_authority_with_contact,
+ snac: "AA00",
+ contact_address: ["Line 1", "line 2"],
+ contact_url: "http://some.council.gov.uk/contact",
+ contact_phone: "0000000000",
+ contact_email: "contact@some.council.gov.uk"
+ )
+ interaction = FactoryGirl.create(:local_interaction,
+ local_authority: authority,
+ url: "http://some.council.gov.uk/do.html"
+ )
+ service = FactoryGirl.create(:local_service, lgsl_code: interaction.lgsl_code)
+ edition = FactoryGirl.create(:local_transaction_edition,
+ title: "Some Edition",
+ slug: "some-edition",
+ state: "published",
+ lgsl_code: interaction.lgsl_code
+ )
+
+ Capybara.current_driver = :rack_test
+ end
+
+ test "basic edition information but no interaction is returned when no snac is provided" do
+ visit "/publications/some-edition.json"
+ assert_equal 200, page.status_code
+ response = JSON.parse(page.source)
+ assert_equal "Some Edition", response['title']
+ assert_false response.has_key? "interaction"
+ end
+
+ test "basic edition information and interaction is returned when there is an interaction for the provided snac" do
+ visit "/publications/some-edition.json?snac=AA00"
+ assert_equal 200, page.status_code
+ response = JSON.parse(page.source)
+ assert_equal "Some Edition", response['title']
+ assert_true response.has_key? "interaction"
+ assert_equal "http://some.council.gov.uk/do.html", response['interaction']['url']
+ authority = response['interaction']['authority']
+ assert_equal ['Line 1', 'line 2'], authority['contact_address']
+ assert_equal "http://some.council.gov.uk/contact", authority['contact_url']
+ assert_equal "0000000000", authority['contact_phone']
+ assert_equal "contact@some.council.gov.uk", authority['contact_email']
+ end
+end
|
Add Local Transaction integration test.
|
diff --git a/test/models/concerns/represented_model_test.rb b/test/models/concerns/represented_model_test.rb
index abc1234..def5678 100644
--- a/test/models/concerns/represented_model_test.rb
+++ b/test/models/concerns/represented_model_test.rb
@@ -0,0 +1,26 @@+# encoding: utf-8
+
+require 'test_helper'
+
+class TestRepresentedModel
+ include RepresentedModel
+end
+
+describe RepresentedModel do
+ let(:represented) { TestRepresentedModel.new.tap { |m| m.is_root_resource = true } }
+
+ it 'add naming' do
+ represented.model_name.wont_be_nil
+ end
+
+ it 'sets root resource' do
+ represented.must_be :is_root_resource
+
+ represented.is_root_resource = false
+ represented.wont_be :is_root_resource
+ end
+
+ it 'returns if curies should be added' do
+ represented.must_be :show_curies
+ end
+end
|
Add missing test class for represented_model concern
|
diff --git a/app/controllers/api/docs/changelogs.rb b/app/controllers/api/docs/changelogs.rb
index abc1234..def5678 100644
--- a/app/controllers/api/docs/changelogs.rb
+++ b/app/controllers/api/docs/changelogs.rb
@@ -3,6 +3,45 @@ class Changelogs
# :nocov:
include Swagger::Blocks
+
+ swagger_schema :Changelog do
+ key :required, [:id, :srpm_id, :changelogtime, :changelogname,
+ :changelogext, :created_at, :updated_at]
+ property :id do
+ key :type, :integer
+ key :format, :int64
+ key :description, 'Changelog ID.'
+ end
+ property :srpm_id do
+ key :type, :integer
+ key :format, :int64
+ key :description, 'Srpm ID.'
+ end
+ property :changelogtime do
+ key :type, :string
+ key :description, 'Changelog time'
+ end
+ property :changelogname do
+ key :type, :string
+ key :format, :binary
+ key :description, 'Changelog name'
+ end
+ property :changelogext do
+ key :type, :string
+ key :format, :binary
+ key :description, 'Changelog text'
+ end
+ property :created_at do
+ key :type, :string
+ key :format, :'date-time'
+ key :description, 'Created at in ISO8601 format'
+ end
+ property :updated_at do
+ key :type, :string
+ key :format, :'date-time'
+ key :description, 'Updated at in ISO8601 format'
+ end
+ end
swagger_path '/srpms/{name}/changelogs' do
operation :get do
|
Add swagger schema for Changelog
|
diff --git a/app/controllers/callback_controller.rb b/app/controllers/callback_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/callback_controller.rb
+++ b/app/controllers/callback_controller.rb
@@ -3,8 +3,8 @@ def reload_slug
if params["slug"].nil?
render status: 422, json: {"errors" => ["missing slug parameter"]}
- elsif params["user_id"].nil?
- render status: 422, json: {"errors" => ["missing user_id parameter"]}
+ elsif params["username"].nil?
+ render status: 422, json: {"errors" => ["missing username parameter"]}
elsif (goal = find_by_slug(params)).nil?
render status: 404, json: {"errors" => ["goal not found"]}
else
@@ -14,6 +14,6 @@ end
def find_by_slug(params)
- Goal.joins(:credential).find_by(slug: params["slug"], credentials: {beeminder_user_id: params["user_id"]})
+ Goal.joins(:credential).find_by(slug: params["slug"], credentials: {beeminder_user_id: params["username"]})
end
end
|
Rename callback user_id to username
|
diff --git a/app/controllers/features_controller.rb b/app/controllers/features_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/features_controller.rb
+++ b/app/controllers/features_controller.rb
@@ -33,7 +33,6 @@ end
def destroy
- redirect_to products_path and return unless product_valid?
@feature.destroy
flash[:notice] = "Feature deleted."
redirect_to edit_product_path(@feature.product)
@@ -43,6 +42,7 @@
def find_feature
@feature = Feature.find(params[:id])
+ redirect_to products_path and return unless product_valid?
end
def product_valid?
|
Refactor product validity check for destroying features
|
diff --git a/db/data_migration/20130429203445_fix_william_pitt_slug.rb b/db/data_migration/20130429203445_fix_william_pitt_slug.rb
index abc1234..def5678 100644
--- a/db/data_migration/20130429203445_fix_william_pitt_slug.rb
+++ b/db/data_migration/20130429203445_fix_william_pitt_slug.rb
@@ -0,0 +1,4 @@+if william_pitt = Person.find_by_slug('william-lamb-pitt')
+ william_pitt.update_column(:slug, 'william-pitt')
+ puts "Changed William Pitt's slug"
+end
|
Migrate William Pitt to correct name
https://www.pivotaltracker.com/story/show/48923019
|
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -1,6 +1,7 @@ class HomeController < ApplicationController
def show
offset = (Asciicast.featured.count * rand).to_i
- @asciicast = Asciicast.featured.offset(offset).first || @asciicasts.first
+ asciicast = Asciicast.featured.offset(offset).first || @asciicasts.first
+ @asciicast = AsciicastDecorator.new(asciicast)
end
end
|
Use decorator for asciicast on homepage
|
diff --git a/lib/sourcify.rb b/lib/sourcify.rb
index abc1234..def5678 100644
--- a/lib/sourcify.rb
+++ b/lib/sourcify.rb
@@ -5,6 +5,7 @@ require 'parse_tree'
require 'parse_tree_extensions'
rescue LoadError
+ raise if RUBY_VERSION == '1.8.6' # support for code scanner in 1.8.6 is too tedious
require 'ruby_parser'
require 'sexp_processor'
require 'file/tail'
|
Enforce ParseTree mode for 1.8.6.
|
diff --git a/Formula/helium-script.rb b/Formula/helium-script.rb
index abc1234..def5678 100644
--- a/Formula/helium-script.rb
+++ b/Formula/helium-script.rb
@@ -4,7 +4,7 @@ desc "A command line interface to Helium Script."
homepage 'https://dev.helium.com/downloads'
version '0.1.0'
- url 'http://helium-public.s3.amazonaws.com/homebrew/bottle/helium-script-0.1.0.tar.gz'
+ url 'https://helium-public.s3.amazonaws.com/homebrew/bottle/helium-script-0.1.0.tar.gz'
sha256 '8c377413d88ed29b658357cb17fb1ae7b269e0fd61fd19a30972beef0ce66dc8'
def install
@@ -12,4 +12,3 @@ system 'cp', '-r', 'bin', "#{prefix}/"
end
end
-
|
Fix up to use TLS for s3
|
diff --git a/app/mailers/report_email_sender.rb b/app/mailers/report_email_sender.rb
index abc1234..def5678 100644
--- a/app/mailers/report_email_sender.rb
+++ b/app/mailers/report_email_sender.rb
@@ -1,4 +1,6 @@ class ReportEmailSender
+ include ApplicationHelper
+
def initialize(report)
@report = report
end
|
Include view helpers for email generation
|
diff --git a/app/models/capital_project_type.rb b/app/models/capital_project_type.rb
index abc1234..def5678 100644
--- a/app/models/capital_project_type.rb
+++ b/app/models/capital_project_type.rb
@@ -1,7 +1,7 @@ class CapitalProjectType < ActiveRecord::Base
- # Active scope -- always use this scope in forms
- scope :active, -> { where(active: true) }
+ # All types that are available
+ scope :active, -> { where(:active => true) }
def to_s
name
|
Fix lookup tables to not use a default scope
|
diff --git a/app/models/spree/product_export.rb b/app/models/spree/product_export.rb
index abc1234..def5678 100644
--- a/app/models/spree/product_export.rb
+++ b/app/models/spree/product_export.rb
@@ -2,7 +2,7 @@ class ProductExport < ActiveRecord::Base
has_attached_file :attachment
validates_attachment :attachment, content_type: { content_type: "text/csv" }
- after_commit :run_export
+ after_commit :run_export, on: :create
def finished?
total_rows == processed_rows
|
Fix commit issue for run process
|
diff --git a/app/services/submission_creator.rb b/app/services/submission_creator.rb
index abc1234..def5678 100644
--- a/app/services/submission_creator.rb
+++ b/app/services/submission_creator.rb
@@ -15,7 +15,7 @@ def call
submission_rejector.reject_if_any_rules_broken(submission)
- if submission.valid? && answers.all?(&:valid?)
+ if submission_and_answers_are_valid
save(submission, answers)
result_value = true
else
@@ -37,4 +37,11 @@ a.save
end
end
+
+ def submission_and_answers_are_valid
+ # so that it runs :valid? on all of the objects and sets errors if necessary
+ submission_is_valid = submission.valid?
+ answers_are_valid = answers.map(&:valid?).all?
+ submission_is_valid && answers_are_valid
+ end
end
|
[141] Validate all objects before returnig from the SubmissionCreator
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.