diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,7 +1,7 @@ require 'yaml'
require 'rspec'
-CASSANDRA_VERSION = ENV['CASSANDRA_VERSION'] || '1.0' unless defined?(CASSANDRA_VERSION)
+CASSANDRA_VERSION = ENV['CASSANDRA_VERSION'] || '1.1' unless defined?(CASSANDRA_VERSION)
$LOAD_PATH << "#{File.expand_path(File.dirname(__FILE__))}/../lib"
require "cassandra-cql/#{CASSANDRA_VERSION}"
@@ -16,7 +16,7 @@ end
def setup_cassandra_connection
- connection = CassandraCQL::Database.new(["127.0.0.1:9160"], {}, :retries => 2, :timeout => 1)
+ connection = CassandraCQL::Database.new(["127.0.0.1:9160"], {}, :retries => 5, :timeout => 1, :connect_timeout => 5)
if !connection.keyspaces.map(&:name).include?("CassandraCQLTestKeyspace")
connection.execute("CREATE KEYSPACE CassandraCQLTestKeyspace WITH strategy_class='org.apache.cassandra.locator.SimpleStrategy' AND strategy_options:replication_factor=1")
end
|
Raise the connect_timeout and increase the default tested version to 1.1
|
diff --git a/solidus_page_objects.gemspec b/solidus_page_objects.gemspec
index abc1234..def5678 100644
--- a/solidus_page_objects.gemspec
+++ b/solidus_page_objects.gemspec
@@ -16,7 +16,7 @@ s.files = Dir["{app,config,db,lib}/**/*", 'LICENSE', 'Rakefile', 'README.md']
s.test_files = Dir['test/**/*']
- s.add_dependency 'solidus_core', '~> 1.0'
+ s.add_dependency 'solidus_core', '>= 2.1'
s.add_development_dependency 'capybara'
s.add_development_dependency 'poltergeist'
@@ -25,8 +25,8 @@ s.add_development_dependency 'database_cleaner'
s.add_development_dependency 'factory_girl'
s.add_development_dependency 'rspec-rails'
- s.add_development_dependency 'rubocop', '0.37.2'
- s.add_development_dependency 'rubocop-rspec', '1.4.0'
+ s.add_development_dependency 'rubocop', '0.47.1'
+ s.add_development_dependency 'rubocop-rspec', '1.13.0'
s.add_development_dependency 'simplecov'
s.add_development_dependency 'sqlite3'
end
|
Update gemspec with latest gem versions
|
diff --git a/lib/everything/add_pieces_to_piece_refinement.rb b/lib/everything/add_pieces_to_piece_refinement.rb
index abc1234..def5678 100644
--- a/lib/everything/add_pieces_to_piece_refinement.rb
+++ b/lib/everything/add_pieces_to_piece_refinement.rb
@@ -1,3 +1,4 @@+# TODO: Delete this class.
module Everything
module AddPiecesToPieceRefinement
refine Everything::Piece do
|
Add todo for removing a file
|
diff --git a/web/lib/soapbox_pb.rb b/web/lib/soapbox_pb.rb
index abc1234..def5678 100644
--- a/web/lib/soapbox_pb.rb
+++ b/web/lib/soapbox_pb.rb
@@ -0,0 +1,13 @@+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: soapbox.proto
+
+require 'google/protobuf'
+
+Google::Protobuf::DescriptorPool.generated_pool.build do
+ add_message "soapbox.Empty" do
+ end
+end
+
+module Soapbox
+ Empty = Google::Protobuf::DescriptorPool.generated_pool.lookup("soapbox.Empty").msgclass
+end
|
Add errant protobuf-generated Ruby file
|
diff --git a/lib/sparkle_formation/sparkle_struct.rb b/lib/sparkle_formation/sparkle_struct.rb
index abc1234..def5678 100644
--- a/lib/sparkle_formation/sparkle_struct.rb
+++ b/lib/sparkle_formation/sparkle_struct.rb
@@ -11,17 +11,17 @@ # @param inst [SparkleFormation]
# @return [SparkleFormation]
def _set_self(inst)
- unless(inst.is_a?(SparkleFormation))
- raise TypeError.new "Expecting type of `SparkleFormation` but got `#{inst.class}`"
+ unless(inst.is_a?(::SparkleFormation))
+ ::Kernel.raise ::TypeError.new "Expecting type of `SparkleFormation` but got `#{inst.class}`"
end
@self = inst
end
# @return [SparkleFormation]
- def _self
+ def _self(*_)
unless(@self)
if(_parent.nil?)
- raise 'Creator did not provide return reference!'
+ ::Kernel.raise ::ArgumentError.new 'Creator did not provide return reference!'
else
_parent._self
end
@@ -34,5 +34,6 @@ def _klass
::SparkleFormation::SparkleStruct
end
+
end
end
|
Use proper namespacing for constant access
|
diff --git a/lib/stroke_counter/typist/assessment.rb b/lib/stroke_counter/typist/assessment.rb
index abc1234..def5678 100644
--- a/lib/stroke_counter/typist/assessment.rb
+++ b/lib/stroke_counter/typist/assessment.rb
@@ -1,5 +1,5 @@ module StrokeCounter::Typist::Assessment
- def path_to_file(filename)
+ def path_to_file(filename = nil)
filename ||= 'constitution_of_japan.txt'
File.join 'lib', 'stroke_counter', 'texts', filename
end
|
Fix to accept 0 args
|
diff --git a/profile_cbc_test.rb b/profile_cbc_test.rb
index abc1234..def5678 100644
--- a/profile_cbc_test.rb
+++ b/profile_cbc_test.rb
@@ -6,7 +6,7 @@ puts "Encrypting a fairly big block of text...\n";
huge_ptext = File.open("bwulf10.txt", "r").read
-big_ptext = huge_ptext[0, 10240]
+big_ptext = huge_ptext[0, 102400]
#big_ptext="Oh, the grand old Duke of York,\nHe had ten thousand men;\nHe marched them up to the top of the hill\nAnd he marched them down again."
cipher=Crypt::Rijndael.new("1234567890abcdef")
|
Boost the number of blocks in the profile test to get better results
|
diff --git a/lib/adroll/service.rb b/lib/adroll/service.rb
index abc1234..def5678 100644
--- a/lib/adroll/service.rb
+++ b/lib/adroll/service.rb
@@ -13,7 +13,7 @@ request_uri = File.join(service_url, endpoint.to_s)
response = HTTParty.send(request_method, request_uri,
- basic_auth: basic_auth, body: query_params, debug_output: Rails.logger)
+ basic_auth: basic_auth, query: query_params, debug_output: Rails.logger)
begin
JSON.parse(response.body)
|
Use query param for requests
|
diff --git a/lib/capybara/rspec.rb b/lib/capybara/rspec.rb
index abc1234..def5678 100644
--- a/lib/capybara/rspec.rb
+++ b/lib/capybara/rspec.rb
@@ -1,7 +1,7 @@ require 'capybara'
require 'capybara/dsl'
-Rspec.configure do |config|
+RSpec.configure do |config|
config.include Capybara
config.after do
Capybara.reset_sessions!
|
Correct module name for RSpec, prevent deprecation warnings
|
diff --git a/lib/ventriloquist/cap/debian/erlang_install.rb b/lib/ventriloquist/cap/debian/erlang_install.rb
index abc1234..def5678 100644
--- a/lib/ventriloquist/cap/debian/erlang_install.rb
+++ b/lib/ventriloquist/cap/debian/erlang_install.rb
@@ -7,7 +7,7 @@
def self.erlang_install(machine)
machine.communicate.tap do |comm|
- if ! comm.test('which erlang > /dev/null')
+ if ! comm.test('which erl > /dev/null')
machine.env.ui.info('Installing Erlang')
path = download_path(comm)
|
erlang: Fix check for whether erlang is installed or not
|
diff --git a/lib/suspenders/generators/decorator_generator.rb b/lib/suspenders/generators/decorator_generator.rb
index abc1234..def5678 100644
--- a/lib/suspenders/generators/decorator_generator.rb
+++ b/lib/suspenders/generators/decorator_generator.rb
@@ -0,0 +1,19 @@+require "rails/generators"
+
+module Suspenders
+ class DraperGenerator < Rails::Generators::Base
+ source_root File.expand_path(
+ File.join("..", "..", "..", "templates"),
+ File.dirname(__FILE__),
+ )
+
+ def add_factory_bot
+ gem "draper"
+ Bundler.with_clean_env { run "bundle install" }
+ end
+
+ def configure_draper
+ bundle_command "exec rails generate draper:install"
+ end
+ end
+end
|
Add a generator for draper decoration gem
|
diff --git a/spec/masking_secrets_spec.rb b/spec/masking_secrets_spec.rb
index abc1234..def5678 100644
--- a/spec/masking_secrets_spec.rb
+++ b/spec/masking_secrets_spec.rb
@@ -0,0 +1,49 @@+require "spec_helper"
+require "breach_mitigation/masking_secrets"
+
+describe BreachMitigation::MaskingSecrets do
+ let(:masking_secrets) { BreachMitigation::MaskingSecrets }
+
+ describe ".masked_authenticity_token" do
+ it "puts :_csrf_token into the supplied session" do
+ session = {}
+ masking_secrets.masked_authenticity_token(session)
+ session[:_csrf_token].should_not be_nil
+ end
+
+ it "returns a byte string" do
+ masking_secrets.masked_authenticity_token({}).should_not be nil
+ end
+ end
+
+ describe ".valid_authenticity_token?" do
+ let(:session) do
+ # Seed a session with a :_csrf_token
+ Hash.new.tap do |session|
+ masking_secrets.masked_authenticity_token(session)
+ end
+ end
+
+ it "returns true for a valid unmasked token" do
+ valid_unmasked = session[:_csrf_token]
+ masking_secrets.valid_authenticity_token?(session, valid_unmasked).should == true
+ end
+
+ it "returns false for an invalid unmasked token" do
+ masking_secrets.valid_authenticity_token?(session, SecureRandom.base64(32)).should == false
+ end
+
+ it "returns true for a valid masked token" do
+ valid_masked = masking_secrets.masked_authenticity_token(session)
+ masking_secrets.valid_authenticity_token?(session, valid_masked).should == true
+ end
+
+ it "returns false for an invalid masked token" do
+ masking_secrets.valid_authenticity_token?(session, SecureRandom.base64(64)).should == false
+ end
+
+ it "returns false for a token of the wrong length" do
+ masking_secrets.valid_authenticity_token?(session, SecureRandom.base64(2)).should == false
+ end
+ end
+end
|
Add some specs for masking secrets
|
diff --git a/spec/models/location_spec.rb b/spec/models/location_spec.rb
index abc1234..def5678 100644
--- a/spec/models/location_spec.rb
+++ b/spec/models/location_spec.rb
@@ -24,10 +24,10 @@
it { should have_many(:natives) }
- it { should validate_presence_of(:name) }
+ xit { should validate_presence_of(:name) }
- it { should validate_presence_of(:address) }
+ xit { should validate_presence_of(:address) }
- it { should validate_presence_of(:city) }
+ xit { should validate_presence_of(:city) }
end
|
Change location validation specs to pending
|
diff --git a/lib/einhorn/client.rb b/lib/einhorn/client.rb
index abc1234..def5678 100644
--- a/lib/einhorn/client.rb
+++ b/lib/einhorn/client.rb
@@ -1,5 +1,4 @@ require 'set'
-require 'uri'
require 'yaml'
module Einhorn
@@ -22,12 +21,12 @@
def self.serialize_message(message)
serialized = YAML.dump(message)
- escaped = URI.escape(serialized, "%\n")
+ escaped = serialized.gsub(/%|\n/, '%' => '%25', "\n" => '%0A')
escaped + "\n"
end
def self.deserialize_message(line)
- serialized = URI.unescape(line)
+ serialized = line.gsub(/%(25|0A)/, '%25' => '%', '%0A' => "\n")
YAML.load(serialized)
end
end
|
Replace deprecated URI.escape / unescape methods
|
diff --git a/lib/github/markups.rb b/lib/github/markups.rb
index abc1234..def5678 100644
--- a/lib/github/markups.rb
+++ b/lib/github/markups.rb
@@ -24,7 +24,7 @@
command(:rest2html, /re?st(\.txt)?/)
-command('asciidoc -s --backend=xhtml11 -o - -', /asciidoc/)
+command('asciidoc -s --backend=xhtml11 -o - -', /asciidoc(\.txt)?|asc(\.txt)?|adoc(\.txt)?/)
# pod2html is nice enough to generate a full-on HTML document for us,
# so we return the favor by ripping out the good parts.
|
Add support for .asc and .adoc
Add support for .asciidoc.txt, .asc.txt and .adoc.txt (similar to ReSt support)
|
diff --git a/lib/noted/renderer.rb b/lib/noted/renderer.rb
index abc1234..def5678 100644
--- a/lib/noted/renderer.rb
+++ b/lib/noted/renderer.rb
@@ -26,8 +26,11 @@ end
def render_body
- @notes.group_by { |note| note.tags.first }.each do | _ , group|
- color_pair = Constants::COLOR_PAIRS.sample
+ color_pairs_count = Constants::COLOR_PAIRS.size
+ grouped = @notes.group_by { |note| note.tags.first }
+ grouped.each_pair.with_index do |(_ , group), index|
+
+ color_pair = Constants::COLOR_PAIRS[index % color_pairs_count]
group.each do |note|
note.decorate(color_pair, @measurements).print
end
|
Fix the colors sample problem by circling throught the colors
|
diff --git a/lib/rohbau/runtime.rb b/lib/rohbau/runtime.rb
index abc1234..def5678 100644
--- a/lib/rohbau/runtime.rb
+++ b/lib/rohbau/runtime.rb
@@ -2,33 +2,6 @@
module Rohbau
class Runtime
- class << self
- attr_reader :instance
-
- def start
- raise "Don't use Runtime.start, you should use a RuntimeLoader"
- set_instance = proc do |instance|
- @instance = instance
- end
-
- self.send :define_method, :initialize do |*args|
- set_instance.call(self)
- super(*args)
- end
-
- new
- end
-
- def running?
- !!@instance
- end
-
- def terminate
- @instance.terminate
- @instance = nil
- end
- end
-
def self.register(name, plugin_class)
attr_reader name
plugins[name] = plugin_class
|
Remove unneeded class methods from Runtime
|
diff --git a/lib/alf/sequel/unit_of_work/insert.rb b/lib/alf/sequel/unit_of_work/insert.rb
index abc1234..def5678 100644
--- a/lib/alf/sequel/unit_of_work/insert.rb
+++ b/lib/alf/sequel/unit_of_work/insert.rb
@@ -12,20 +12,45 @@ end
def matching_relation
- raise IllegalStateError, "Unit of work not ran" unless ran?
- pk = connection.keys(@relvar_name).first
- if pk && pk.size == 1
- Relation(pk.to_a.first => @insert_result)
- else
- raise UnsupportedError, "Composite keys insertion feedback is unsupported."
+ @matching_relation ||= begin
+ raise IllegalStateError, "Unit of work not ran" unless ran?
+ unless @insert_result
+ raise UnsupportedError, "Composite keys insertion feedback is unsupported."
+ end
+ Relation(@insert_result)
end
end
private
+ def candidate_keys
+ @candidate_keys ||= connection.keys(@relvar_name)
+ end
+
+ def primary_key
+ candidate_keys.first
+ end
+
+ def best_candidate_key
+ best = candidate_keys.to_a.find{|k| k.size == 1}
+ best || candidate_keys.first
+ end
+
def _run
connection.with_dataset(@relvar_name) do |d|
- @insert_result = @inserted.map{|t| d.insert(t.to_hash) }
+ bk = best_candidate_key
+ if bk and bk.size == 1
+ pk_field_name = bk.to_a.first
+ supported = d.supports_returning?(:insert)
+ d = d.returning(pk_field_name) if supported
+ @insert_result = @inserted.map{|t|
+ res = d.insert(t.to_hash)
+ supported ? res.first : { pk_field_name => res }
+ }
+ else
+ @inserted.each{|t| d.insert(t.to_hash) }
+ @insert_result = nil
+ end
end
end
|
Refactor UnitOfWork::Insert for making use of the best key.
|
diff --git a/lib/clio_client/api/timeline_event.rb b/lib/clio_client/api/timeline_event.rb
index abc1234..def5678 100644
--- a/lib/clio_client/api/timeline_event.rb
+++ b/lib/clio_client/api/timeline_event.rb
@@ -3,6 +3,15 @@ class TimelineEvent < Base
include ClioClient::Api::Listable
+ include ClioClient::Api::Crudable
+
+ def update
+ raise NotImplementedError
+ end
+
+ def destroy
+ raise NotImplementedError
+ end
private
|
Allow timeline events to be createable
|
diff --git a/lib/api/apps/apps.rb b/lib/api/apps/apps.rb
index abc1234..def5678 100644
--- a/lib/api/apps/apps.rb
+++ b/lib/api/apps/apps.rb
@@ -1,7 +1,7 @@ class Apps
def initialize(client)
@client = client
- @ENDPOINT = client.ENDPOINT + "/" + "apps"
+ @ENDPOINT = client.ENDPOINT + "/" + "app"
end
def list()
@@ -18,13 +18,20 @@ return self.client.request(method, endpoint)
end
- def delete_branding()
+ def delete_branding(appid)
method = "DELETE"
- return self.client.request(method, self.ENDPOINT)
+ if appid.is_a? Integer
+ raise "Non integer appid"
+ end
+ endpoint = self.ENDPOINT + "/" + appid + "/branding"
+ return self.client.request(method, endpoint)
end
- def create()
+ def create(name)
method = "POST"
- return self.client.request(method, self.ENDPOINT)
+ if appid.is_a? String
+ raise "Non string app name"
+ end
+ return self.client.request(method, self.ENDPOINT, {"name" => name})
end
end
|
Add delete and create endpoint params
|
diff --git a/lib/deba/document.rb b/lib/deba/document.rb
index abc1234..def5678 100644
--- a/lib/deba/document.rb
+++ b/lib/deba/document.rb
@@ -1,4 +1,6 @@ class Deba::Document
+ BLOCKQUOTE = "> "
+
attr_reader :content
def initialize(extractor)
@@ -22,7 +24,7 @@
@args.unshift(@segments)
block = @block_type.new(*@args).to_a
- block.unshift("> ") if @extractor.in_blockquote?
+ block.unshift(BLOCKQUOTE) if @extractor.in_blockquote?
@content << Deba::Stringifier.new(block).stringify
end
|
Move blockquote prefix into constant
|
diff --git a/lib/pacer/version.rb b/lib/pacer/version.rb
index abc1234..def5678 100644
--- a/lib/pacer/version.rb
+++ b/lib/pacer/version.rb
@@ -1,7 +1,6 @@ module Pacer
- unless const_defined? :VERSION
- VERSION = "2.0.1"
-
+ VERSION = "2.0.1"
+ unless const_defined? :START_TIME
START_TIME = Time.now
end
end
|
Allow VERSION to be reloaded
|
diff --git a/libexec/um-topics.rb b/libexec/um-topics.rb
index abc1234..def5678 100644
--- a/libexec/um-topics.rb
+++ b/libexec/um-topics.rb
@@ -9,8 +9,9 @@ end
end
+
config = UmConfig.source
-files = Dir["#{config[:pages_directory]}/*"].map { |file| File.basename(file) }
+files = Dir["#{config.pages_directory}/*"].map { |file| File.basename(file) }
output = files.join("\n")
|
Fix um topics subcommand, which wasn't using the expanded pages directory path.
|
diff --git a/db/migrate/20110302102208_add_user_id_and_deleted_at_to_addresses.rb b/db/migrate/20110302102208_add_user_id_and_deleted_at_to_addresses.rb
index abc1234..def5678 100644
--- a/db/migrate/20110302102208_add_user_id_and_deleted_at_to_addresses.rb
+++ b/db/migrate/20110302102208_add_user_id_and_deleted_at_to_addresses.rb
@@ -1,4 +1,10 @@-class AddUserIdAndDeletedAtToAddresses < ActiveRecord::Migration
+migration_superclass = if ActiveRecord::VERSION::MAJOR >= 5
+ ActiveRecord::Migration["#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}"]
+else
+ ActiveRecord::Migration
+end
+
+class AddUserIdAndDeletedAtToAddresses < migration_superclass
def self.up
change_table addresses_table_name do |t|
t.integer :user_id
|
Fix Directly inheriting from ActiveRecord::Migration is not supported
|
diff --git a/lib/vitrage/router.rb b/lib/vitrage/router.rb
index abc1234..def5678 100644
--- a/lib/vitrage/router.rb
+++ b/lib/vitrage/router.rb
@@ -2,21 +2,20 @@ module Router
def routes(rails_router, options = {})
- if options[:controller]
- cs = options[:controller].to_s
- rails_router.post '/vitrage/pieces' => "#{cs}#create", as: :vitrage_pieces
- rails_router.get '/vitrage/pieces/new' => "#{cs}#new", as: :new_vitrage_piece
- rails_router.get '/vitrage/pieces/restore_order' => "#{cs}#restore_order", as: :restore_order_vitrage_pieces
- rails_router.get '/vitrage/pieces/:id/edit' => "#{cs}#edit", as: :edit_vitrage_piece
- rails_router.get '/vitrage/pieces/:id' => "#{cs}#show", as: :vitrage_piece
- rails_router.match '/vitrage/pieces/:id' => "#{cs}#update", via: [:patch, :put]
- rails_router.delete '/vitrage/pieces/:id' => "#{cs}#destroy"
- rails_router.post '/vitrage/pieces/:id/reorder' => "#{cs}#reorder", as: :vitrage_piece_reoder
- else
- rails_router.namespace :vitrage do
- rails_router.resources :pieces, except: [:index]
- end
- end
+ cs = options[:controller] ? options[:controller].to_s : "pieces"
+
+ rails_router.post '/vitrage/pieces' => "#{cs}#create", as: :vitrage_pieces
+ rails_router.get '/vitrage/pieces/new' => "#{cs}#new", as: :new_vitrage_piece
+ rails_router.get '/vitrage/pieces/restore_order' => "#{cs}#restore_order", as: :restore_order_vitrage_pieces
+ rails_router.get '/vitrage/pieces/:id/edit' => "#{cs}#edit", as: :edit_vitrage_piece
+ rails_router.get '/vitrage/pieces/:id' => "#{cs}#show", as: :vitrage_piece
+ rails_router.match '/vitrage/pieces/:id' => "#{cs}#update", via: [:patch, :put]
+ rails_router.delete '/vitrage/pieces/:id' => "#{cs}#destroy"
+ rails_router.post '/vitrage/pieces/:id/reorder' => "#{cs}#reorder", as: :vitrage_piece_reoder
+
+ # rails_router.namespace :vitrage do
+ # rails_router.resources :pieces, except: [:index]
+ # end
end
end
|
Fix routes without custom controller
|
diff --git a/acts_as_likeable.gemspec b/acts_as_likeable.gemspec
index abc1234..def5678 100644
--- a/acts_as_likeable.gemspec
+++ b/acts_as_likeable.gemspec
@@ -9,7 +9,7 @@ spec.authors = ["Sung Won Cho"]
spec.email = ["mikeswcho@gmail.com"]
spec.summary = %q{Add like feature to any Active Record models}
- spec.homepage = ""
+ spec.homepage = "https://github.com/sungwoncho/acts_as_likeable"
spec.license = "MIT"
spec.files = `git ls-files -z`.split("\x0")
|
Add github page as homepage
|
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -22,7 +22,8 @@ if project.save
redirect_to project_path(project)
else
- redirect_to "/"
+ flash[:error] = project.errors.full_messages.join(". ")
+ redirect_to new_project_path
end
end
@@ -37,7 +38,7 @@ if project.update(project_params)
redirect_to project_path(project)
else
- redirect_to "/"
+ redirect_to root_url
end
end
|
Add create route flash message
|
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -7,6 +7,7 @@ user = User.find_by_provider_and_uid(auth["provider"], auth["uid"]) ||
User.create_with_omniauth(auth)
user.token = token
+ user.person.update_attributes(:email => auth["user_info"]["email"])
user.person.authorise! if (Settings.invitations == 'false')
user.person.reset_notification_count!
user.record_last_activity!
|
Update email information on signup
|
diff --git a/test/integration/default/serverspec/racktables_spec.rb b/test/integration/default/serverspec/racktables_spec.rb
index abc1234..def5678 100644
--- a/test/integration/default/serverspec/racktables_spec.rb
+++ b/test/integration/default/serverspec/racktables_spec.rb
@@ -0,0 +1,37 @@+# Tests for a Racktable install
+require 'serverspec'
+
+include Serverspec::Helper::Exec
+include Serverspec::Helper::DetectOS
+
+# Setup something with root user paths?
+# Not sure what is going on here, but it's in the kitchen-ci docs
+RSpec.configure do |c|
+ c.before :all do
+ c.path = '/sbin:/usr/sbin'
+ end
+end
+
+
+describe "Racktables SQL" do
+ # Check the SQL db
+ # Check the user exists
+ # Check for user access
+end
+
+describe "Racktables Server" do
+ # apache installed and running
+ # vhost exists
+ # site available through http and https
+ # logs exist
+ # mod_php5 installed
+end
+
+describe "Racktables Source" do
+ # Extract directory exists and non-empty
+end
+
+describe "Racktables Secrets" do
+ # Racktables user exists
+ # Secret file exists and is non-empty
+end
|
Add suites of empty serverspec tests.
|
diff --git a/app/models/species/documents_export.rb b/app/models/species/documents_export.rb
index abc1234..def5678 100644
--- a/app/models/species/documents_export.rb
+++ b/app/models/species/documents_export.rb
@@ -31,9 +31,7 @@ :proposal_outcome,
:review_phase,
:taxon_names,
- :taxon_concept_ids,
:geo_entity_names,
- :geo_entity_ids,
"to_char(created_at, 'DD/MM/YYYY')",
:created_by,
"to_char(updated_at, 'DD/MM/YYYY')",
@@ -56,9 +54,7 @@ 'Proposal outcome',
'Review phase',
'Taxon names',
- 'Taxon concept IDs',
'Geo entity names',
- 'Geo entity ids',
'Created at',
'Created by',
'Updated at',
|
Remove obsolete taxon_concept and geo_entity ids from export
|
diff --git a/app/parameters/live_time_parameters.rb b/app/parameters/live_time_parameters.rb
index abc1234..def5678 100644
--- a/app/parameters/live_time_parameters.rb
+++ b/app/parameters/live_time_parameters.rb
@@ -2,6 +2,6 @@
def self.permitted
[:id, :event_id, :lap, :split_id, :sub_split_kind, :bitkey, :wave, :bib_number, :absolute_time, :military_time,
- :stopped_here, :with_pacer, :remarks, :batch, :source, :event_slug, :split_slug, :split_time_id]
+ :stopped_here, :with_pacer, :remarks, :batch, :source, :event_slug, :split_slug, :split_time_id, :pulled_by]
end
end
|
Add pulled_by attribute to LiveTimeParameters.permitted.
|
diff --git a/config/software/pg-gem.rb b/config/software/pg-gem.rb
index abc1234..def5678 100644
--- a/config/software/pg-gem.rb
+++ b/config/software/pg-gem.rb
@@ -0,0 +1,30 @@+#
+# Copyright 2014 Chef Software, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+name "pg-gem"
+default_version "0.17.1"
+
+dependency "ruby"
+dependency "rubygems"
+
+build do
+ env = with_standard_compiler_flags(with_embedded_path)
+
+ gem "install pg" \
+ " --version '#{version}'" \
+ " --bindir '#{install_dir}/embedded/bin'" \
+ " --no-ri --no-rdoc", env: env
+end
|
Add definition for pg gem
|
diff --git a/app/services/load_test_data_remover.rb b/app/services/load_test_data_remover.rb
index abc1234..def5678 100644
--- a/app/services/load_test_data_remover.rb
+++ b/app/services/load_test_data_remover.rb
@@ -8,15 +8,17 @@ class << self
private
+ ASSOCIATIONS = [
+ :prisoner, :visitors, :visit_state_changes, :messages, :rejection, :cancellation
+ ]
+
def delete_load_test_data
- visits = Visit.
- joins(:visitors).
- where(visitors: { first_name: 'Load', last_name: 'Test' }
- )
-
- visits.each do |visit|
- LoadTestDataRemoverJob.perform_later(visit.prisoner)
- end
+ Visit.
+ includes(ASSOCIATIONS).
+ where(visitors: { first_name: 'Load', last_name: 'Test' }).
+ find_in_batches(batch_size: 1000) do |batch|
+ batch.each { |visit| LoadTestDataRemoverJob.perform_later(visit.prisoner) }
+ end
end
end
end
|
Delete load test data in batches, optimise sql query
|
diff --git a/spec/spec_helper/example/model/_common/instance_methods/not_being.rb b/spec/spec_helper/example/model/_common/instance_methods/not_being.rb
index abc1234..def5678 100644
--- a/spec/spec_helper/example/model/_common/instance_methods/not_being.rb
+++ b/spec/spec_helper/example/model/_common/instance_methods/not_being.rb
@@ -16,7 +16,7 @@ }
it 'should raise NoMethodError in @pseudo_object' do
- expect { subject.send(method_name) }.to \
+ expect { subject.__send__(method_name) }.to \
raise_error(::NoMethodError, regexp)
end
end
|
Fix a method in test
- Change #send to #__send__
- ::BasicObject, which is the superclass of PseudoObject::BasicObject, does not have #send
|
diff --git a/test/kitchen/cookbooks/apache2_test/files/default/tests/minitest/support/helpers.rb b/test/kitchen/cookbooks/apache2_test/files/default/tests/minitest/support/helpers.rb
index abc1234..def5678 100644
--- a/test/kitchen/cookbooks/apache2_test/files/default/tests/minitest/support/helpers.rb
+++ b/test/kitchen/cookbooks/apache2_test/files/default/tests/minitest/support/helpers.rb
@@ -0,0 +1,50 @@+module Helpers
+ module Apache
+ require 'chef/mixin/shell_out'
+ include Chef::Mixin::ShellOut
+ include MiniTest::Chef::Assertions
+ include MiniTest::Chef::Context
+ include MiniTest::Chef::Resources
+
+ def apache_config_parses?
+ acp = shell_out("#{node['apache']['binary']} -t")
+ acp.exitstatus == 0
+ end
+
+ def apache_configured_ports
+ port_config = File.read("#{node['apache']['dir']}/ports.conf")
+ port_config.scan(/^Listen ([0-9]+)/).flatten.map{|p| p.to_i}
+ end
+
+ def apache_enabled_modules
+ apache_modules = shell_out("#{node['apache']['binary']} -M")
+ apache_modules.send(
+ if node['platform_family'] == 'rhel' && node['platform_version'].to_f < 6.0
+ :stderr
+ else
+ :stdout
+ end
+ ).split.select! {|i| i =~ /_module$/}
+ end
+
+ def apache_service
+ service(case node['platform']
+ when "debian","ubuntu" then "apache2"
+ when "freebsd" then "apache22"
+ else "httpd"
+ end)
+ end
+
+ def config
+ file(case node['platform']
+ when "debian","ubuntu" then "#{node['apache']['dir']}/apache2.conf"
+ when "freebsd" then "#{node['apache']['dir']}/httpd.conf"
+ else "#{node['apache']['dir']}/conf/httpd.conf"
+ end)
+ end
+
+ def ran_recipe?(recipe)
+ node.run_state[:seen_recipes].keys.include?(recipe)
+ end
+ end
+end
|
Revert "use a symlink instead of copy of the file"
This reverts commit a9325a3180eea20cf2a9148cab84e3e9c5fcb540.
Test kitchen complains the file doesn't exist:
ERROR: Errno::ENOENT: No such file or directory - /tmp/apache2/../apache2/test/kitchen/cookbooks/apache2_test/files/default/tests/minitest/support/helpers.rb
|
diff --git a/lib/api-acl/control.rb b/lib/api-acl/control.rb
index abc1234..def5678 100644
--- a/lib/api-acl/control.rb
+++ b/lib/api-acl/control.rb
@@ -1,6 +1,23 @@ module ACL
module Control
+ def self.check_level(route,method)
+ validators_collection = Rules::Collection::ClassMethods.acl_routes_collection[route][method]
+ if validators_collection.nil? || validators_collection.empty? then
+ return 0
+ end
+ keys = validators_collection.keys.sort
+ highest_level = 0
+ keys.reverse_each do |access_level|
+ pass = ACL::Validators.run_validators(validators_collection[access_level])
+ if (pass==true)
+ highest_level = access_level
+ break
+ end
+ end
+ return highest_level
+ end
+
def self.put(variable)
controller.put(variable)
return self
|
Add code to check access level
|
diff --git a/lib/devise_auth0_jwt_strategy/railtie.rb b/lib/devise_auth0_jwt_strategy/railtie.rb
index abc1234..def5678 100644
--- a/lib/devise_auth0_jwt_strategy/railtie.rb
+++ b/lib/devise_auth0_jwt_strategy/railtie.rb
@@ -5,14 +5,8 @@ print "Wiring up Auth0 JWT Devise Strategy..."
if ENV['AUTH0_CLIENT_SECRET']
- ::Devise.setup do |config|
-
- config.warden do |manager|
- manager.strategies.add(:auth0jwt, Devise::Strategies::Auth0Jwt)
- manager.default_strategies(:scope => :user).unshift :auth0jwt
- end
-
- end
+ Warden::Strategies.add(:auth0jwt, Devise::Strategies::Auth0Jwt)
+ Devise.add_module(:auth0jwt, strategy: true, controller: :sessions)
print "done.\n"
|
Update code for wiring auth0jwt into devise.
|
diff --git a/lib/feature_flagger.rb b/lib/feature_flagger.rb
index abc1234..def5678 100644
--- a/lib/feature_flagger.rb
+++ b/lib/feature_flagger.rb
@@ -29,9 +29,5 @@ def control
@@control ||= Control.new(config.storage)
end
-
- def migrate_feature_keys
- FeatureKeysMigration.new(control).call
- end
end
end
|
Remove interface used to expose migration code
|
diff --git a/lib/libraetd/app/helpers/token_helper.rb b/lib/libraetd/app/helpers/token_helper.rb
index abc1234..def5678 100644
--- a/lib/libraetd/app/helpers/token_helper.rb
+++ b/lib/libraetd/app/helpers/token_helper.rb
@@ -16,13 +16,14 @@ if @@secret.nil?
@@secret = get_secret
end
+
begin
- decoded = JWT.decode token, @@secret, true, { algorithm: 'HS256' }
- puts decoded
+ JWT.decode token, @@secret, true, { algorithm: 'HS256' }
return true
rescue JWT::DecodeError
- return false
+ puts "ERROR: decoding JWT or expired JWT"
end
+ return false
end
|
Correct processing of auth token
|
diff --git a/lib/datastax_rails/util/solr_repair.rb b/lib/datastax_rails/util/solr_repair.rb
index abc1234..def5678 100644
--- a/lib/datastax_rails/util/solr_repair.rb
+++ b/lib/datastax_rails/util/solr_repair.rb
@@ -2,12 +2,12 @@ module SolrRepair
def repair_solr
encoded = {}
- attributes.keys.each do |column_name|
+ attribute_definitions.keys.each do |column_name|
value = read_attribute(column_name)
encoded[column_name.to_s] = self.class.column_for_attribute(column_name).type_cast_for_solr(value)
end
xml_doc = RSolr::Xml::Generator.new.add(encoded)
- self.class.solr_connection.update(data: xml_doc, params: { replacefields: false })
+ self.class.solr_connection.update(data: xml_doc)
end
end
end
|
Remove deprecated replacefields directive from repair solr
|
diff --git a/db/data_migration/20121107114150_fix_dates_of_dft_speeches_round_1.rb b/db/data_migration/20121107114150_fix_dates_of_dft_speeches_round_1.rb
index abc1234..def5678 100644
--- a/db/data_migration/20121107114150_fix_dates_of_dft_speeches_round_1.rb
+++ b/db/data_migration/20121107114150_fix_dates_of_dft_speeches_round_1.rb
@@ -0,0 +1,57 @@+require 'csv'
+
+puts ['Title', 'Latest edition ID', 'Old delivered on', 'New delivered on', 'Old first published at', 'New first published at', 'Error'].to_csv
+CSV.foreach(Rails.root.join('db/data_migration/20121012135700_upload_dft_speeches.csv'), headers: true) do |row|
+ # We weren't creating Document Sources when we first imported DFT Speeches so we have to lookup using title
+ title = row['title']
+
+ # I'm explicitly setting delivered_on as a date (to avoid the problem we encountered last time round)
+ # and setting the first_published_at to 13:00 on the same day, to avoid any ambiguity around midnight
+ # in BST (midnight BST is 23:00 the day before in UTC).
+ day, month, year = row['first published'].split "/"
+ delivered_on = Date.parse("#{year}-#{month}-#{day}")
+ first_published_at = Time.zone.parse("#{year}-#{month}-#{day} 13:00:00")
+
+ latest_edition_id, error = nil, nil
+ old_delivered_on, new_delivered_on = nil, nil
+ old_first_published_at, new_first_published_at = nil, nil
+
+ if delivered_on
+ # I think it makes sense to update editions even if they've been deleted
+ if editions = Edition.unscoped.find_all_by_title(title)
+
+ # Find the unique documents for the editions matching our title
+ documents = editions.map(&:document).uniq
+
+ # Only consider the documents that don't have an associated document source, as we know that importing these
+ # speeches didn't create document sources
+ documents_without_sources = documents.reject { |d| d.document_source.present? }
+
+ # Find the latest edition for the first document that doesn't have a source.
+ latest_editions = documents_without_sources.map(&:latest_edition).compact
+ if latest_editions.any?
+ latest_edition = latest_editions.first
+ latest_edition_id = latest_edition.id
+
+ old_delivered_on = latest_edition.delivered_on
+ old_first_published_at = latest_edition.first_published_at
+ latest_edition.delivered_on = delivered_on
+ latest_edition.first_published_at = first_published_at
+ new_delivered_on = latest_edition.delivered_on
+ new_first_published_at = latest_edition.first_published_at
+
+ unless latest_edition.save(validate: false)
+ error = "Couldn't update edition"
+ end
+ else
+ error = "Couldn't find any latest editions"
+ end
+ else
+ error = "Edition not found"
+ end
+ else
+ error = "Missing date from the CSV file"
+ end
+
+ puts [title, latest_edition_id, old_delivered_on, new_delivered_on, old_first_published_at, new_first_published_at, error].to_csv
+end
|
Fix delivered_on and first_published_at of DfT Speeches
In the original DfT speech uploads
(20121012135700_upload_dft_speeches.rb) we were parsing the date from
the CSV file as a timestamp. Any date during BST would be converted to
a timestamp at midnight (BST) on the same day, which was then converted
to 23:00 the day before (UTC) when stored as a date. The effect was
that speeches were appearing to be delivered the day before the date we
had in the CSV file.
Additionally, we weren't setting the first_published_at attribute which
resulted in it being set to the datetime that it was published in our
system. To avoid any ambiguity, I've set first_published_at to 13:00
(rather than allowing it to default to midnight) on the same date as we
now have for delivered_on.
|
diff --git a/db/migrate/20180712165829_remove_irb_evidence_type_from_agreements.rb b/db/migrate/20180712165829_remove_irb_evidence_type_from_agreements.rb
index abc1234..def5678 100644
--- a/db/migrate/20180712165829_remove_irb_evidence_type_from_agreements.rb
+++ b/db/migrate/20180712165829_remove_irb_evidence_type_from_agreements.rb
@@ -0,0 +1,5 @@+class RemoveIrbEvidenceTypeFromAgreements < ActiveRecord::Migration[5.2]
+ def change
+ remove_column :agreements, :irb_evidence_type, :string, null: false, default: "has_evidence"
+ end
+end
|
Remove deprecated column from agreements table
|
diff --git a/lib/generators/rails/post_deployment_migration/post_deployment_migration_generator.rb b/lib/generators/rails/post_deployment_migration/post_deployment_migration_generator.rb
index abc1234..def5678 100644
--- a/lib/generators/rails/post_deployment_migration/post_deployment_migration_generator.rb
+++ b/lib/generators/rails/post_deployment_migration/post_deployment_migration_generator.rb
@@ -3,7 +3,7 @@ module Rails
class PostDeploymentMigrationGenerator < Rails::Generators::NamedBase
def create_migration_file
- timestamp = Time.now.strftime('%Y%m%d%H%I%S')
+ timestamp = Time.now.strftime('%Y%m%d%H%M%S')
template "migration.rb", "db/post_migrate/#{timestamp}_#{file_name}.rb"
end
|
Fix timestamp to include %M instead of %I for post-deploy migrations.
Closes #44121.
|
diff --git a/app/controllers/admin/contests_controller.rb b/app/controllers/admin/contests_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/admin/contests_controller.rb
+++ b/app/controllers/admin/contests_controller.rb
@@ -1,5 +1,5 @@ module Admin
- class ContestsController < ApplicationController
+ class ContestsController < AdminController
def show
@contest = Contest.instance
end
|
Make contests controller an admin controller
|
diff --git a/app/controllers/koi/admin_crud_controller.rb b/app/controllers/koi/admin_crud_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/koi/admin_crud_controller.rb
+++ b/app/controllers/koi/admin_crud_controller.rb
@@ -6,6 +6,12 @@
protected
+ # Matches missing route methods of the form (action_)?koi_(controller)_path,
+ # and sends them to koi_engine instead.
+ #
+ # This is necessary because inherited_resources is resolving paths differently
+ # depending on whether they belong to the koi_engine or not.
+ #
def method_missing key, *sig, &blk
if match = /(\w+_|\b)koi_(\w+)_path$/.match(key)
prefix, suffix = match.to_a.drop 1
|
Comment for method_missing for koi routes.
|
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -2,15 +2,9 @@ before_filter :check_session, except: :destroy
def create
- submitted_username = params[:session][:username]
- submitted_password = params[:session][:password]
- user = User.find_by(username: submitted_username.downcase)
- if user && user.authenticate(submitted_password)
- log_in user
- redirect_to '/play'
- else
- render 'new'
- end
+ user = User.from_omniauth(env["omniauth.auth"])
+ log_in(user)
+ redirect_to '/play'
end
def destroy
|
Change the sessions controller to use omniauth authentication.
|
diff --git a/app/controllers/participations_controller.rb b/app/controllers/participations_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/participations_controller.rb
+++ b/app/controllers/participations_controller.rb
@@ -6,6 +6,9 @@ participation = @challenge.participations.build(user: current_user)
if participation.save
flash[:success] = "You are now attending this challenge."
+ @challenge.users.each do |user|
+ NotificationMailer.participant_list_email(user, @challenge).deliver_now
+ end
else
flash[:error] = "Failed to attend challenge. "
flash[:error] << participation.errors.full_messages.join(" ")
@@ -18,6 +21,10 @@ @challenge = Challenge.find(params[:challenge_id])
current_user.challenges.destroy(@challenge)
+ @challenge.users.each do |user|
+ NotificationMailer.participant_list_email(user, @challenge).deliver_now
+ end
+
flash[:success] = "You are no longer attending this challenge."
redirect_to @challenge
end
|
Add ghetto synchronous mail notifications
Should use queues for this tomorrow.
|
diff --git a/benchmark/library/openssl/bench_hexdigest.rb b/benchmark/library/openssl/bench_hexdigest.rb
index abc1234..def5678 100644
--- a/benchmark/library/openssl/bench_hexdigest.rb
+++ b/benchmark/library/openssl/bench_hexdigest.rb
@@ -4,7 +4,7 @@ require 'benchmark'
require 'benchmark/ips'
-input = 'hello, world!'
+input = 'hello, world!' * 100
Benchmark.ips do |bench|
bench.report 'Digest SHA1' do |times|
|
Use a larger input string for the digest benchmark
|
diff --git a/app/notifiers/course/video_notifier.rb b/app/notifiers/course/video_notifier.rb
index abc1234..def5678 100644
--- a/app/notifiers/course/video_notifier.rb
+++ b/app/notifiers/course/video_notifier.rb
@@ -6,12 +6,16 @@ end
def video_opening(user, video)
+ return unless email_enabled?(video, :video_opening)
+
create_activity(actor: user, object: video, event: :opening).
notify(video.course, :email).
save!
end
def video_closing(user, video)
+ return unless email_enabled?(video, :video_closing)
+
activity = create_activity(actor: user, object: video, event: :closing)
unattempted_users(video).each { |u| activity.notify(u, :email) }
activity.save!
@@ -19,6 +23,10 @@
private
+ def email_enabled?(video, key)
+ Course::Settings::VideosComponent.email_enabled?(video.course, key)
+ end
+
def unattempted_users(video)
students = video.course.course_users.student.includes(:user).map(&:user)
submitted = video.submissions.includes(:creator).map(&:creator)
|
Check email settings before firing email
Signed-off-by: Shen Yichen <be3bb257ef8d73236feaba36cd3e5ee9095e6819@gmail.com>
|
diff --git a/lib/polymorphic_integer_type/activerecord_5_0_0/association_query_handler_extension.rb b/lib/polymorphic_integer_type/activerecord_5_0_0/association_query_handler_extension.rb
index abc1234..def5678 100644
--- a/lib/polymorphic_integer_type/activerecord_5_0_0/association_query_handler_extension.rb
+++ b/lib/polymorphic_integer_type/activerecord_5_0_0/association_query_handler_extension.rb
@@ -14,16 +14,20 @@
protected
- def polymorphic_value_for(value)
- table = value.associated_table
+ def polymorphic_value_for(query_value)
+ table = query_value.associated_table
association = table.send(:association)
klass = association.active_record
name = association.name
if klass.respond_to?("#{name}_type_mapping")
- klass.send("#{name}_type_mapping").key(value.base_class.sti_name)
+ type_mapping = klass.send("#{name}_type_mapping")
+
+ type_mapping.key(query_value.value.class.sti_name) ||
+ type_mapping.key(query_value.base_class.to_s) ||
+ type_mapping.key(query_value.base_class.sti_name)
else
- value.base_class.name
+ query_value.base_class.name
end
end
|
Handle the presence of sti_name on class or base class
|
diff --git a/lib/active_multiple_db/table_name_prefixer.rb b/lib/active_multiple_db/table_name_prefixer.rb
index abc1234..def5678 100644
--- a/lib/active_multiple_db/table_name_prefixer.rb
+++ b/lib/active_multiple_db/table_name_prefixer.rb
@@ -8,7 +8,7 @@ def inherited(kls)
super
# and not abstruct?
- kls.set_table_name_to_db1 if (kls != ::ActiveRecord::Base) && (kls.parent != ActsAsTaggableOn)
+ kls.set_table_name_to_db1 if (kls != ::ActiveRecord::Base) && (kls.descends_from_active_record?) && (kls.parent != ActsAsTaggableOn)
end
def set_table_name_to_db1
|
Check if inherited class is `descends_from_active_record?`
|
diff --git a/lib/simply_taggable.rb b/lib/simply_taggable.rb
index abc1234..def5678 100644
--- a/lib/simply_taggable.rb
+++ b/lib/simply_taggable.rb
@@ -10,5 +10,5 @@ # Equivalent of using "unloadable" in SurveyorController (unloadable has been deprecated)
%w{models controllers}.each do |dir|
path = File.expand_path(File.join(File.dirname(__FILE__), '../app', dir))
- ActiveSupport::Dependencies.load_once_paths.delete(path)
+ ActiveSupport::Dependencies.autoload_once_paths.delete(path)
end
|
Patch to fix deprecation of load_once_paths in rails 2.3.9.
|
diff --git a/lib/tasks/release.rake b/lib/tasks/release.rake
index abc1234..def5678 100644
--- a/lib/tasks/release.rake
+++ b/lib/tasks/release.rake
@@ -1,6 +1,7 @@ namespace :release do
- task :bump, [:type] do |_, arguments|
- system "bin/semver increment #{arguments[:type]}"
+ task :bump, [:level] do |_, arguments|
+ level = arguments[:level] || 'patch'
+ system "bin/semver increment #{level}"
end
task commit: :environment do
@@ -14,9 +15,16 @@ task :push do
system 'git push && git push --tags'
end
+
+ [:major, :minor, :patch, :special].each do |level|
+ desc "Deploy and release a new #{level} version to brother.ly"
+ task level do
+ Rake::Task[:release].invoke level
+ end
+ end
end
-desc 'Deploy and release a new version of this application'
-task :release, [:type] => [
+# Deploy and release a new version of this application
+task :release, [:level] => [
'release:bump', 'release:commit', 'release:tag', 'release:push'
]
|
Add additional deploy tasks to mask rake attrs handling
|
diff --git a/lib/tinymce/railtie.rb b/lib/tinymce/railtie.rb
index abc1234..def5678 100644
--- a/lib/tinymce/railtie.rb
+++ b/lib/tinymce/railtie.rb
@@ -1,7 +1,7 @@ module TinyMCE
def self.base
[Rails.application.config.action_controller.asset_host,
- Rails.application.config.relative_url_root,
+ ActionController::Base.config.relative_url_root,
Rails.application.config.assets.prefix, "/tinymce"].compact.join
end
|
Access relative_url_root via ActionController::Base.config (for Rails 3.1 compatibility)
|
diff --git a/plugins/usd_to_cop.rb b/plugins/usd_to_cop.rb
index abc1234..def5678 100644
--- a/plugins/usd_to_cop.rb
+++ b/plugins/usd_to_cop.rb
@@ -1,9 +1,10 @@ require 'open-uri'
+require 'nokogiri'
class UsdToCopPlugin
include NinjaPlugin
- match /usd2cop (\d+)/, method: :convert
+ match /usd2cop ([-+]?[0-9]*\.?[0-9]+)/, method: :convert
match /usd2cop$/, method: :trm
def usage
@@ -12,8 +13,9 @@
def convert(m, query)
begin
- cop = open("http://usd2cop.heroku.com").read.to_i
- reply = cop * query.to_i
+ doc = Nokogiri::HTML(open("http://www.colombia.com/colombiainfo/estadisticas/dolar.asp"))
+ cop = doc.css('.trm').last.children.to_s.gsub(',','').to_f
+ reply = cop * query.to_f
rescue
reply = "Error reading exchange rate :|"
end
|
Use other source for usd to cop convertion
|
diff --git a/resources/mirror.rb b/resources/mirror.rb
index abc1234..def5678 100644
--- a/resources/mirror.rb
+++ b/resources/mirror.rb
@@ -34,7 +34,7 @@ end
ruby_block 'createrepo' do
block do
- system "createrepo #{real_local_path}"
+ system "createrepo -C #{real_local_path}"
end
end
if use_repo
|
Make createrepo skip if packages were not updated to speed up runs where packages are not updated at all.
|
diff --git a/benchmark-perf.gemspec b/benchmark-perf.gemspec
index abc1234..def5678 100644
--- a/benchmark-perf.gemspec
+++ b/benchmark-perf.gemspec
@@ -13,7 +13,7 @@ spec.license = "MIT"
spec.files = Dir['{lib,spec}/**/*.rb']
- spec.files += Dir['{tasks}/*', 'benchmark-perf.gemspec']
+ spec.files += Dir['tasks/*', 'benchmark-perf.gemspec']
spec.files += Dir['README.md', 'CHANGELOG.md', 'LICENSE.txt', 'Rakefile']
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^spec/})
|
Change to clean up syntax
|
diff --git a/spec/serverkit/resource_builder_spec.rb b/spec/serverkit/resource_builder_spec.rb
index abc1234..def5678 100644
--- a/spec/serverkit/resource_builder_spec.rb
+++ b/spec/serverkit/resource_builder_spec.rb
@@ -35,12 +35,20 @@ it { is_expected.to be_a Serverkit::Resources::Base }
end
+ context "with unknown type attribute" do
+ let(:resource_attributes) do
+ super().merge("type" => "unknown")
+ end
+
+ it { is_expected.to be_a Serverkit::Resources::Unknown }
+ end
+
context "without type attribute" do
let(:resource_attributes) do
super().except("type")
end
- it { is_expected.to be_a Serverkit::Resources::Unknown }
+ it { is_expected.to be_a Serverkit::Resources::Missing }
end
end
end
|
Fix failed spec on Serverkit::ResourceBuilder
The implementation had been changed in the previous commit.
In that change, Serverkit::Resources::Missing were added,
which is used on missing type attribute.
|
diff --git a/db/migrate/1437070556_add_transfers_index.rb b/db/migrate/1437070556_add_transfers_index.rb
index abc1234..def5678 100644
--- a/db/migrate/1437070556_add_transfers_index.rb
+++ b/db/migrate/1437070556_add_transfers_index.rb
@@ -0,0 +1,10 @@+Sequel.migration do
+
+ no_transaction
+
+ change do
+ alter_table(:transfers) do
+ add_index :group_id, name: 'active_group_transfers_idx', where: { deleted_at: nil }, concurrently: true
+ end
+ end
+end
|
Add index to help improve transfer lookups
|
diff --git a/spec/certmeister/pg/store_spec.rb b/spec/certmeister/pg/store_spec.rb
index abc1234..def5678 100644
--- a/spec/certmeister/pg/store_spec.rb
+++ b/spec/certmeister/pg/store_spec.rb
@@ -16,9 +16,17 @@ private
def pg_cleanup
- db = Sequel.connect('postgres://localhost/test')
- certs = db[:certificates]
- certs.where('cn IN ?', ["axl.starjuice.net", "axl.hetzner.africa"]).delete
+ begin
+ db = Sequel.connect('postgres://localhost/test')
+ certs = db[:certificates]
+ certs.where('cn IN ?', ["axl.starjuice.net", "axl.hetzner.africa"]).delete
+ rescue Sequel::DatabaseError => e
+ if e.message =~ /PG::UndefinedTable/
+ # Table doesn't exist the first time we test
+ else
+ raise
+ end
+ end
end
before(:each) do
|
Fix first-time test on fresh workstation
|
diff --git a/app/models/contractor.rb b/app/models/contractor.rb
index abc1234..def5678 100644
--- a/app/models/contractor.rb
+++ b/app/models/contractor.rb
@@ -26,7 +26,7 @@ end
def corporate_id
- if !acn.blank?
+ if acn.present?
acn
else
abn
|
Simplify if statement by removing ! negative (refactor only)
|
diff --git a/lib/bionya/diagram.rb b/lib/bionya/diagram.rb
index abc1234..def5678 100644
--- a/lib/bionya/diagram.rb
+++ b/lib/bionya/diagram.rb
@@ -11,7 +11,12 @@ nested = df.column(labels[2]) # 'nested_label' column from CircularPlot
raise 'received dataframe is not nested' unless nested.all? {|cell| cell.is_a? DataFrame}
max = nested.reduce(-Float::INFINITY){|memo, df| [memo, df.column(y).max].max}
- range([0, max])
+ min = nested.reduce(Float::INFINITY){|memo, df| [memo, df.column(y).min].min}
+ if min > 0
+ range([0, max])
+ else
+ range([min, max])
+ end
end
end
|
Enable arc to accept minus value
|
diff --git a/app/models/submission.rb b/app/models/submission.rb
index abc1234..def5678 100644
--- a/app/models/submission.rb
+++ b/app/models/submission.rb
@@ -5,6 +5,8 @@ validates :age, numericality: { greater_than: 0, less_than: 110 }
validates_format_of :email, with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
validates :email, uniqueness: true
+ validates :full_name, :email, :codecademy_username, length: { maximum: 50 }
+ validates :description, :goals, :problems, length: { maximum: 255 }
has_many :rates, dependent: :destroy
has_many :comments, dependent: :destroy
|
Add length validations for :full_name, :email, :codecademy_username, :description, :goals, :problems
|
diff --git a/lib/libra2/app/controllers/dashboard_controller.rb b/lib/libra2/app/controllers/dashboard_controller.rb
index abc1234..def5678 100644
--- a/lib/libra2/app/controllers/dashboard_controller.rb
+++ b/lib/libra2/app/controllers/dashboard_controller.rb
@@ -17,7 +17,8 @@ @user = current_user
(@response, @document_list) = search_results(params)
- @theses = (@response.docs.map { |x| SolrDocument.new(x) if ((!x.work_type.nil? && x.work_type[0] == "thesis") && (!x.draft.nil? && x.draft[0] == "true"))}).select { |y| !y.nil?}
+# @theses = (@response.docs.map { |x| SolrDocument.new(x) if ((!x.work_type.nil? && x.work_type[0] == "thesis") && (!x.draft.nil? && x.draft[0] == "true"))}).select { |y| !y.nil?}
+ @theses = (@response.docs.map { |x| SolrDocument.new(x) if ( x.is_thesis? && x.is_draft? )}).select { |y| !y.nil?}
@activity = current_user.all_user_activity(params[:since].blank? ? DateTime.now.to_i - Sufia.config.activity_to_show_default_seconds_since_now : params[:since].to_i)
@notifications = current_user.mailbox.inbox
|
Use helpers to cleanup logic
|
diff --git a/lib/contracts/core.rb b/lib/contracts/core.rb
index abc1234..def5678 100644
--- a/lib/contracts/core.rb
+++ b/lib/contracts/core.rb
@@ -24,7 +24,10 @@ end
end
- base.class_eval do
+ # NOTE: Workaround for `defined?(super)` bug in ruby 1.9.2
+ # source: http://stackoverflow.com/a/11181685
+ # bug: https://bugs.ruby-lang.org/issues/6644
+ base.class_eval <<-RUBY
# TODO: deprecate
# Required when contracts are included in global scope
def Contract(*args)
@@ -34,7 +37,9 @@ self.class.Contract(*args)
end
end
+ RUBY
+ base.class_eval do
def functype(funcname)
contracts = Engine.fetch_from(self.class).decorated_methods_for(:instance_methods, funcname)
if contracts.nil?
|
Fix defined?(super) for ruby 1.9.2
|
diff --git a/lib/convdayone/cli.rb b/lib/convdayone/cli.rb
index abc1234..def5678 100644
--- a/lib/convdayone/cli.rb
+++ b/lib/convdayone/cli.rb
@@ -1,3 +1,5 @@+require 'shellwords'
+
module Convdayone
OPTIONS = [:date, :starred, :photo_path, :journal_file].freeze
@@ -12,7 +14,7 @@ end
def self.escape_string(string)
- Shellword.escape(string)
+ Shellwords.escape(string)
end
def self.cli_option(options)
|
:bug: Fix issue to use Shellwords
|
diff --git a/randomizers/starting_room_randomizer.rb b/randomizers/starting_room_randomizer.rb
index abc1234..def5678 100644
--- a/randomizers/starting_room_randomizer.rb
+++ b/randomizers/starting_room_randomizer.rb
@@ -9,8 +9,15 @@ next if room.doors.length == 0
next if room.area.name.include?("Boss Rush")
+ next if room.sector.name.include?("Boss Rush")
- next if room.sector.name.include?("Boss Rush")
+ if options[:bonus_starting_items]
+ # These sectors have the largest sector overlay in their respective game.
+ # Adding new items (for the starting items) is not possible currently, so don't allow these to be the starting area.
+ next if room.sector.name == "Demon Guest House"
+ next if room.area.name == "Forgotten City" && room.sector_index == 0
+ next if room.sector.name == "Underground Labyrinth"
+ end
rooms << room
end
|
Fix free space error with both starting room+items randos
|
diff --git a/easy_logging.gemspec b/easy_logging.gemspec
index abc1234..def5678 100644
--- a/easy_logging.gemspec
+++ b/easy_logging.gemspec
@@ -23,7 +23,7 @@ spec.required_ruby_version = '>= 2.0.0'
spec.add_development_dependency "bundler", "~> 1.14"
- spec.add_development_dependency "rake", "~> 10.0"
+ spec.add_development_dependency "rake", "~> 12.3"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "coveralls"
spec.add_development_dependency "guard"
|
Upgrade rake to version 12.3.1
|
diff --git a/spec/integration/commands/servers/remove_spec.rb b/spec/integration/commands/servers/remove_spec.rb
index abc1234..def5678 100644
--- a/spec/integration/commands/servers/remove_spec.rb
+++ b/spec/integration/commands/servers/remove_spec.rb
@@ -9,25 +9,29 @@ @hp_svc = compute_connection
end
- ### Till we can get back the server id that is created, it cannot be deleted, hence marked pending
- pending "when deleting server with id" do
+ context "when deleting server with id" do
before(:all) do
- @response, @exit = run_command('servers:add fog-test-server ami-00000005').stdout_and_exit_status
- ### Need to somehow get back the server id after it is created
- #@new_server_id
+ response = @hp_svc.run_instances('ami-00000005', 1, 1, {'InstanceType' => 'm1.small'})
+ @new_server_id = response.body['instancesSet'][0]['instanceId']
+ @server = get_server(@hp_svc, @new_server_id)
end
- pending "should show success message" do
- server = get_server(@hp_svc, @new_server_id)
- server.destroy
- @response.should include("Removed server '#{@new_server_id}'.\n")
+ it "should show success message" do
+ @response, @exit = run_command("servers:remove #{@new_server_id}").stdout_and_exit_status
+ @response.should eql("Removed server '#{@new_server_id}'.\n")
+ sleep(10)
end
- its_exit_status_should_be(:success)
+ ### server deletes take time to get it off the list
pending "should not list in servers" do
servers = @hp_svc.servers.map {|s| s.id}
servers.should_not include(@new_server_id)
end
+ it "should not exist" do
+ server = get_server(@hp_svc, @new_server_id)
+ server.id.should_not eql(@new_server_id)
+ end
+
end
end
|
Fix specs for servers:remove command.
|
diff --git a/spec/repository/git_repo/test_pending_changes.rb b/spec/repository/git_repo/test_pending_changes.rb
index abc1234..def5678 100644
--- a/spec/repository/git_repo/test_pending_changes.rb
+++ b/spec/repository/git_repo/test_pending_changes.rb
@@ -8,7 +8,12 @@ `#{code}`
end
+ def reset_repo_changes(working_dir)
+ `cd #{working_dir} && git reset --hard`
+ end
+
let(:working_dir){ File.join(fixtures_folder, "gitrepo") }
+ let(:readme){ File.join(working_dir, "README.md") }
let(:repo){ Repository::GitRepo.new(working_dir) }
before(:all) {
@@ -20,6 +25,18 @@ it{ should be_false }
end
+ context "on a repository with a changed file" do
+ before{
+ File.open(readme, "w"){|f| f << "new version"}
+ }
+ it{
+ should be_true
+ }
+ after{
+ reset_repo_changes(working_dir)
+ }
+ end
+
end
end
|
Add test for pending_changes? due to update file
|
diff --git a/lib/tasks/convert_interactives.rake b/lib/tasks/convert_interactives.rake
index abc1234..def5678 100644
--- a/lib/tasks/convert_interactives.rake
+++ b/lib/tasks/convert_interactives.rake
@@ -30,5 +30,29 @@ end
end
+ desc 'migrate interactive tags to external_activities'
+ task :migrate_interactive_tags => :environment do
+
+ Interactive.includes(
+ :material_properties,
+ :grade_levels,
+ :subject_areas,
+ :sensors ).find_each(
+ :conditions => "external_activity_id IS NOT NULL") do |ia|
+
+ ea = ExternalActivity.find(ia.external_activity_id)
+
+ ea.material_property_list = ia.material_property_list
+ ea.grade_level_list = ia.grade_level_list
+ ea.subject_area_list = ia.subject_area_list
+ ea.sensor_list = ia.sensor_list
+
+ ea.projects = ia.projects
+ ea.cohorts = ia.cohorts
+
+ ea.save
+ end
+ end
+
end
end
|
Create rake task to migrate tags and associations from Interactives to ExternalActivities.
[#151758282]
|
diff --git a/config/initializers/feature_toggles.rb b/config/initializers/feature_toggles.rb
index abc1234..def5678 100644
--- a/config/initializers/feature_toggles.rb
+++ b/config/initializers/feature_toggles.rb
@@ -3,11 +3,7 @@ beta_testers = ENV['BETA_TESTERS']&.split(/[\s,]+/) || []
OpenFoodNetwork::FeatureToggle.enable(:customer_balance) do |user|
- if beta_testers == ['all']
- true
- else
- beta_testers.include?(user.email)
- end
+ !Rails.env.test?
end
OpenFoodNetwork::FeatureToggle.enable(:unit_price) do
|
Enable customer_balance to all users
This however makes the tests still pass, which rely on the off-branch
logic of the toggle. We'll work on them next.
|
diff --git a/spec/plugins/builder/mist_spec.rb b/spec/plugins/builder/mist_spec.rb
index abc1234..def5678 100644
--- a/spec/plugins/builder/mist_spec.rb
+++ b/spec/plugins/builder/mist_spec.rb
@@ -0,0 +1,74 @@+require 'spec_helper'
+
+describe Cyclid::API::Plugins::Mist do
+ # Provide some simple stub
+ module MistPlugin
+ module Test
+ class Pool
+ def acquire
+ 'test.example.com'
+ end
+
+ def release(_server)
+ true
+ end
+ end
+
+ class Client
+ def call(method, *_args)
+ case method
+ when :create
+ return { 'name' => 'test-host',
+ 'ip' => '127.0.0.1',
+ 'username' => 'test',
+ 'status' => true,
+ 'server' => 'test.example.com' }
+ when :destroy
+ return true
+ end
+ end
+ end
+ end
+ end
+
+ # Mock mist to return the stub implementations
+ before :each do
+ @pool = class_double('Mist::Pool').as_stubbed_const
+ allow(@pool).to receive(:get).and_return(MistPlugin::Test::Pool.new)
+
+ @client = class_double('Mist::Client').as_stubbed_const
+ allow(@client).to receive(:new).and_return(MistPlugin::Test::Client.new)
+ end
+
+ it 'should create a new instance' do
+ expect{ Cyclid::API::Plugins::Mist.new }.to_not raise_error
+ end
+
+ context 'obtaining a build host' do
+ before :each do
+ @mist = Cyclid::API::Plugins::Mist.new
+ end
+
+ it 'returns a host when called with default arguments' do
+ expect{ @mist.get }.to_not raise_error
+ end
+
+ it 'returns a host when pass an OS in the arguments' do
+ buildhost = nil
+ expect{ buildhost = @mist.get(os: 'example_test') }.to_not raise_error
+ expect(buildhost[:distro]).to eq('example')
+ expect(buildhost[:release]).to eq('test')
+ end
+
+ it 'returns a host with SSH as the only valid transport' do
+ buildhost = @mist.get
+ expect(buildhost.transports).to match_array(['ssh'])
+ end
+ end
+
+ it 'releases a build host' do
+ mist = Cyclid::API::Plugins::Mist.new
+ buildhost = mist.get
+ expect{ mist.release(nil, buildhost) }.to_not raise_error
+ end
+end
|
Add tests for the Mist Builder plugin
|
diff --git a/spec/processor/connection_spec.rb b/spec/processor/connection_spec.rb
index abc1234..def5678 100644
--- a/spec/processor/connection_spec.rb
+++ b/spec/processor/connection_spec.rb
@@ -3,13 +3,13 @@ describe Pupa::Processor::Connection do
describe '.new' do
it 'should use MongoDB' do
- expect(Pupa::Processor::Connection::MongoDBAdapter).to receive(:new).with('mongodb://localhost:27017/pupa').and_call_original
- Pupa::Processor::Connection.new('mongodb://localhost:27017/pupa')
+ expect(Pupa::Processor::Connection::MongoDBAdapter).to receive(:new).with('mongodb://localhost:27017/pupa_test').and_call_original
+ Pupa::Processor::Connection.new('mongodb://localhost:27017/pupa_test')
end
it 'should use PostgreSQL' do
- expect(Pupa::Processor::Connection::PostgreSQLAdapter).to receive(:new).with('postgres://localhost:5432/pupa').and_call_original
- Pupa::Processor::Connection.new('postgres://localhost:5432/pupa')
+ expect(Pupa::Processor::Connection::PostgreSQLAdapter).to receive(:new).with('postgres://localhost:5432/pupa_test').and_call_original
+ Pupa::Processor::Connection.new('postgres://localhost:5432/pupa_test')
end
end
end
|
Update test to use existing database
|
diff --git a/app/models/tuner.rb b/app/models/tuner.rb
index abc1234..def5678 100644
--- a/app/models/tuner.rb
+++ b/app/models/tuner.rb
@@ -20,7 +20,7 @@ def logs_since(time_interval)
query = RecentLog.where(:tuner_id => id)
- query = query.where('created_at > ? ', time_interval.date_range.begin.utc) unless time_interval.all_interval?
+ query = query.where('updated_at > ? ', time_interval.date_range.begin.utc) unless time_interval.all_interval?
return query
end
|
Use updated_at instead of created_at for recent logs
|
diff --git a/cookbooks/planet/attributes/default.rb b/cookbooks/planet/attributes/default.rb
index abc1234..def5678 100644
--- a/cookbooks/planet/attributes/default.rb
+++ b/cookbooks/planet/attributes/default.rb
@@ -3,6 +3,6 @@ default[:planet][:dump][:pbf_directory] = "/store/planet/pbf"
default[:planet][:dump][:pbf_history_directory] = "/store/planet/pbf/full-history"
-default[:planet][:tilelog][:source_directory] = "/home/www-data/tilelog"
+default[:planet][:tilelog][:source_directory] = "/opt/tilelog"
default[:planet][:tilelog][:input_directory] = "/store/logs/tile.openstreetmap.org"
default[:planet][:tilelog][:output_directory] = "/store/planet/tile_logs"
|
Put source directory somewhere more sensible.
|
diff --git a/lib/iridium/engine.rb b/lib/iridium/engine.rb
index abc1234..def5678 100644
--- a/lib/iridium/engine.rb
+++ b/lib/iridium/engine.rb
@@ -15,7 +15,7 @@ set[:sprites].add "app/sprites"
set[:system_initializers].add "config/initializers", :glob => "**/*.rb"
- set[:environment].add "config", :glob => "#{Iridium.env}.rb"
+ set[:environment].add "config", :glob => proc { "#{Iridium.env}.rb" }
set[:settings].add "config", :glob => "**/*.yml"
|
Use proc for env file
|
diff --git a/lib/goohub/datastore/redis_store.rb b/lib/goohub/datastore/redis_store.rb
index abc1234..def5678 100644
--- a/lib/goohub/datastore/redis_store.rb
+++ b/lib/goohub/datastore/redis_store.rb
@@ -22,8 +22,15 @@ self.glob('*')
end
- def glob(pattern)
- @redis.keys(pattern)
+ def glob(pattern, &block)
+ keys = @redis.keys(pattern)
+ if block_given?
+ keys.each do |key|
+ yield key
+ end
+ else
+ keys
+ end
end
end # class RedisStore
end # module DataStore
|
Make it possible to pass block to glob method in RedisStore
|
diff --git a/week-6/gps.rb b/week-6/gps.rb
index abc1234..def5678 100644
--- a/week-6/gps.rb
+++ b/week-6/gps.rb
@@ -0,0 +1,43 @@+# Your Names
+# 1)
+# 2)
+
+# We spent [#] hours on this challenge.
+
+# Bakery Serving Size portion calculator.
+
+def serving_size_calc(item_to_make, num_of_ingredients)
+ library = {"cookie" => 1, "cake" => 5, "pie" => 7}
+ error_counter = 3
+
+ library.each do |food|
+ if library[food] != library[item_to_make]
+ error_counter += -1
+ end
+ end
+
+ if error_counter > 0
+ raise ArgumentError.new("#{item_to_make} is not a valid input")
+ end
+
+ serving_size = library.values_at(item_to_make)[0]
+ remaining_ingredients = num_of_ingredients % serving_size
+
+ case remaining_ingredients
+ when 0
+ return "Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}"
+ else
+ return "Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients. Suggested baking items: TODO: MAKE THIS FEATURE"
+ end
+end
+
+p serving_size_calc("pie", 7)
+p serving_size_calc("pie", 8)
+p serving_size_calc("cake", 5)
+p serving_size_calc("cake", 7)
+p serving_size_calc("cookie", 1)
+p serving_size_calc("cookie", 10)
+p serving_size_calc("THIS IS AN ERROR", 5)
+
+# Reflection
+
|
Set up file for GPS 2.3
|
diff --git a/lib/tasks/sample_data/addressing.rb b/lib/tasks/sample_data/addressing.rb
index abc1234..def5678 100644
--- a/lib/tasks/sample_data/addressing.rb
+++ b/lib/tasks/sample_data/addressing.rb
@@ -15,7 +15,7 @@
def zone
zone = Spree::Zone.find_or_create_by_name!(ENV.fetch('CHECKOUT_ZONE'))
- zone.members.create!(zonable: country)
+ zone.members.create!(zoneable: country) unless zone.zoneables.include?(country)
zone
end
|
Fix typo in sample_data zone creation (zonEable) and added clause to avoid re-adding the same country to the zone
|
diff --git a/lib/undo/serializer/active_model.rb b/lib/undo/serializer/active_model.rb
index abc1234..def5678 100644
--- a/lib/undo/serializer/active_model.rb
+++ b/lib/undo/serializer/active_model.rb
@@ -1,6 +1,3 @@-require "active_support/core_ext/hash"
-require "active_support/core_ext/string"
-
module Undo
module Serializer
class ActiveModel
|
Revert "load hash and object core_ext"
This reverts commit 9ded0797e3e6eebef5adab1f4d02bf991780aa63.
|
diff --git a/lib/pronto/rubocop.rb b/lib/pronto/rubocop.rb
index abc1234..def5678 100644
--- a/lib/pronto/rubocop.rb
+++ b/lib/pronto/rubocop.rb
@@ -21,7 +21,7 @@ end
def inspect(patch)
- processed_source = ::RuboCop::ProcessedSource.from_file(patch.new_file_full_path)
+ processed_source = ::RuboCop::ProcessedSource.from_file(patch.new_file_full_path.to_s)
offences = @inspector.send(:inspect_file, processed_source).first
offences.map do |offence|
|
Convert Pathname to String when passing to ::Rubocop::ProcessedSource
Otherwise, it errors. Changed in rubocop 0.30.0
|
diff --git a/examples/find_all_posts_mentioning_github.rb b/examples/find_all_posts_mentioning_github.rb
index abc1234..def5678 100644
--- a/examples/find_all_posts_mentioning_github.rb
+++ b/examples/find_all_posts_mentioning_github.rb
@@ -11,9 +11,9 @@ query_parts = [
"sort-order:asc",
"sort:published",
+ keyword,
]
query_parts << "lang:#{language}" if language
- query_parts << keyword
query.search_query = query_parts.join(" ")
end
|
Refactor: Add keyword directly to the array
https://github.com/twingly/twingly-search-api-ruby/pull/81#discussion_r269543135
|
diff --git a/lib/shuttle/runner.rb b/lib/shuttle/runner.rb
index abc1234..def5678 100644
--- a/lib/shuttle/runner.rb
+++ b/lib/shuttle/runner.rb
@@ -36,13 +36,13 @@ if integration.respond_to?(command)
begin
if integration.deploy_running?
- raise DeployError, "Another deployment is running right now..."
+ integration.error "Another deployment is running right now..."
end
integration.write_lock
integration.send(command.to_sym)
integration.write_revision
-
+
rescue DeployError => err
exit 1
rescue Exception => err
|
Terminate deploy is another session is running
|
diff --git a/lib/stache/railtie.rb b/lib/stache/railtie.rb
index abc1234..def5678 100644
--- a/lib/stache/railtie.rb
+++ b/lib/stache/railtie.rb
@@ -1,7 +1,7 @@ module Stache
class Railtie < ::Rails::Railtie
initializer 'stache.autoload', :before => :set_autoload_paths do |app|
- app.config.autoload_paths << Rails.root + 'app/views'
+ app.config.autoload_paths << (Rails.root + 'app/views').to_s
end
config.to_prepare do
|
Change additional path from Pathname to String
Because some gems expects that autoload_paths is Array of String
|
diff --git a/lib/open_food_network/user_balance_calculator.rb b/lib/open_food_network/user_balance_calculator.rb
index abc1234..def5678 100644
--- a/lib/open_food_network/user_balance_calculator.rb
+++ b/lib/open_food_network/user_balance_calculator.rb
@@ -6,7 +6,7 @@ end
def balance
- -completed_orders.to_a.sum(&:outstanding_balance)
+ -completed_orders.to_a.sum(&:old_outstanding_balance)
end
private
|
Make BalanceCalculator use old balance calculation
This class is currently used and it gets skipped when the
:customer_balance toggle is enabled, so there's no point on abstracting
the balance with `OrderBalance`. It'll never go through its
`#new_outstanding_balance` branch and it'll be removed once we active
that toggle to everyone.
|
diff --git a/0_code_wars/find_the_smallest_power.rb b/0_code_wars/find_the_smallest_power.rb
index abc1234..def5678 100644
--- a/0_code_wars/find_the_smallest_power.rb
+++ b/0_code_wars/find_the_smallest_power.rb
@@ -0,0 +1,6 @@+# http://www.codewars.com/kata/56ba65c6a15703ac7e002075/
+# --- iteration 1 ---
+def find_next_power(val, pow)
+ lower = val ** (1.fdiv(pow))
+ ((lower.floor + 1) ** pow)
+end
|
Add conde wars (7) - find the smallest power
|
diff --git a/spec/controllers/dashboards_controller_spec.rb b/spec/controllers/dashboards_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/dashboards_controller_spec.rb
+++ b/spec/controllers/dashboards_controller_spec.rb
@@ -1,37 +1,58 @@ describe DashboardsController do
render_views
- describe "Student dashboard" do
- let(:course2) { FactoryGirl.create(:given_course)}
-
+ describe "Shared behaviour" do
before :all do
@student = FactoryGirl.create(:student_registered_for_course).student
+ @assistant = FactoryGirl.create(:assistant, user: @student.user)
@group = FactoryGirl.create(:lab_group, given_course: @student.given_courses.first)
@lab = FactoryGirl.create(:lab, given_course: @student.given_courses.first)
@group.add_student(@student)
@lab.add_group!(@group)
+ @student.given_courses.first.register_assistant(@assistant)
+ @course2 = FactoryGirl.create(:given_course)
+ @course2.register_student(@student)
end
+
+ describe "Student dashboard" do
+
+ before :each do
+ login_as(@student)
+ visit dashboard_path(role: "student")
+ end
- before :each do
- login_as(@student)
- visit dashboard_path(role: "student")
+ it "shows a particular course" do
+ page.should have_content(@lab.given_course.course.course_codes.first.code)
+ end
+
+ it "shows two courses" do
+ page.should have_content(@lab.given_course.course.course_codes.first.code)
+ page.should have_content(@course2.course.course_codes.first.code)
+ end
+
+ it "shows a lab" do
+ page.should have_content(@lab.numbered_name)
+ end
end
+
+ describe "Assistant dashboard" do
+ before :each do
+ login_as(@assistant)
+ visit dashboard_path(role: "assistant")
+ end
+
+ it "shows a particular course" do
+ page.should have_content(@lab.given_course.course.course_codes.first.code)
+ end
- it "shows a particular course" do
- page.should have_content(@lab.given_course.course.course_codes.first.code)
- end
+ it "shows two courses" do
+ page.should have_content(@lab.given_course.course.course_codes.first.code)
+ page.should have_content(@course2.course.course_codes.first.code)
+ end
- it "shows two courses" do
- course2.register_student(@student)
- page.should have_content(@lab.given_course.course.course_codes.first.code)
- page.should have_content(course2.course.course_codes.first.code)
- end
-
- it "shows a lab" do
- page.should have_content(@lab.numbered_name)
+ it "shows a lab" do
+ page.should have_content(@lab.numbered_name)
+ end
end
end
-
- describe "Assistant" do
- end
end
|
Add further dashboards controller specs
|
diff --git a/specs/ishigaki-internal/controls/tidy_files.rb b/specs/ishigaki-internal/controls/tidy_files.rb
index abc1234..def5678 100644
--- a/specs/ishigaki-internal/controls/tidy_files.rb
+++ b/specs/ishigaki-internal/controls/tidy_files.rb
@@ -37,4 +37,12 @@ its('stdout') { should eq "0" }
end
+ %w[gpg dirmngr].each do |deb| # curl unzip procps net-tools
+
+ describe package(deb) do
+ it { should_not be_installed }
+ end
+
+ end
+
end
|
Check that some packages only needed to build have been removed
|
diff --git a/spec/lib/shanty/static_file_discoverer_spec.rb b/spec/lib/shanty/static_file_discoverer_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/shanty/static_file_discoverer_spec.rb
+++ b/spec/lib/shanty/static_file_discoverer_spec.rb
@@ -0,0 +1,42 @@+require 'shanty/discoverers/shantyfile'
+
+module Shanty
+ RSpec.describe Shanty::ShantyfileDiscoverer do
+ before do
+ @project_templates = Dir.chdir('examples') do
+ Discoverer.find_all
+ end
+ project1 = 'test-static-project'
+ project2 = 'test-static-project-2'
+ project3 = 'test-static-project-3'
+ @project_names = [project1, project2, project3]
+ @project_parents = [[], [project1], [project2]]
+ @project_paths = [
+ File.join(Dir.pwd, 'examples', project1),
+ File.join(Dir.pwd, 'examples', project2),
+ File.join(Dir.pwd, 'examples', project2, project3)
+ ]
+ end
+
+ describe '#discovered' do
+ it 'should find example projects' do
+ expect(@project_templates.size).to be == 3
+ end
+
+ it "should find project templates named #{@project_names.inspect}" do
+ project_names = @project_templates.map { |project| project.name }
+ expect(project_names).to contain_exactly(*@project_names)
+ end
+
+ it "should find project templates with parents #{@project_parents.inspect}" do
+ project_parents = @project_templates.map { |project| project.parents }
+ expect(project_parents).to contain_exactly(*@project_parents)
+ end
+
+ it "should find project templates with paths #{@project_paths.inspect}" do
+ project_paths = @project_templates.map { |project| project.path }
+ expect(project_paths).to contain_exactly(*@project_paths)
+ end
+ end
+ end
+end
|
Add tests for static file discoverer
|
diff --git a/spec/mecab-dictionary/mecab_dictionary_spec.rb b/spec/mecab-dictionary/mecab_dictionary_spec.rb
index abc1234..def5678 100644
--- a/spec/mecab-dictionary/mecab_dictionary_spec.rb
+++ b/spec/mecab-dictionary/mecab_dictionary_spec.rb
@@ -4,6 +4,10 @@ it { should be_installed }
end
+describe package('mecab-ipadic'), :if => os[:family] == 'fedora' do
+ it { should be_installed }
+end
+
describe package('mecab-naist-jdic'), :if => os[:family] == 'ubuntu' do
it { should be_installed }
end
|
Add mecab-ipadic task for Fedora
|
diff --git a/test/remote_tests/remote_secure_pay_tech_test.rb b/test/remote_tests/remote_secure_pay_tech_test.rb
index abc1234..def5678 100644
--- a/test/remote_tests/remote_secure_pay_tech_test.rb
+++ b/test/remote_tests/remote_secure_pay_tech_test.rb
@@ -0,0 +1,34 @@+require File.dirname(__FILE__) + '/../test_helper'
+
+class RemoteSecurePayTechTest < Test::Unit::TestCase
+ ACCEPTED_AMOUNT = 10000
+ DECLINED_AMOUNT = 10075
+
+ def setup
+ @gateway = SecurePayTechGateway.new(fixtures(:secure_pay_tech))
+ @creditcard = credit_card('4987654321098769', :month => 5, :year => 2013)
+ @options = { :address => { :address1 => '1234 Shady Brook Lane', :zip => '90210' } }
+ end
+
+ def test_successful_purchase
+ assert response = @gateway.purchase(ACCEPTED_AMOUNT, @creditcard, @options)
+ assert_equal 'Transaction OK', response.message
+ assert_success response
+ end
+
+ def test_unsuccessful_purchase
+ assert response = @gateway.purchase(DECLINED_AMOUNT, @creditcard, @options)
+ assert_equal 'Card declined', response.message
+ assert_failure response
+ end
+
+ def test_invalid_login
+ gateway = SecurePayTechGateway.new(
+ :login => 'foo',
+ :password => 'bar'
+ )
+ assert response = gateway.purchase(ACCEPTED_AMOUNT, @creditcard, @options)
+ assert_equal 'Bad or malformed request', response.message
+ assert_failure response
+ end
+end
|
Add remote tests for SecurePayTech
git-svn-id: 15afb6ebb5ffcaa0dbaaa80925839866918ea29e@457 6513ea26-6c20-0410-8a68-89cd7235086d
|
diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb
index abc1234..def5678 100644
--- a/config/initializers/sidekiq.rb
+++ b/config/initializers/sidekiq.rb
@@ -0,0 +1,8 @@+# https://devcenter.heroku.com/articles/forked-pg-connections#sidekiq
+Sidekiq.configure_server do |config|
+ database_url = ENV['DATABASE_URL']
+ if database_url
+ ENV['DATABASE_URL'] = "#{database_url}?pool=25"
+ ActiveRecord::Base.establish_connection
+ end
+end
|
Set Sidekiq configuration per Heroku's policies
|
diff --git a/services/jaconda.rb b/services/jaconda.rb
index abc1234..def5678 100644
--- a/services/jaconda.rb
+++ b/services/jaconda.rb
@@ -2,15 +2,20 @@ string :subdomain, :room_id, :room_token
boolean :digest
- def receive_push
- raise_config_error "Missing 'subdomain'" if data['subdomain'].to_s == ''
- raise_config_error "Missing 'room_id'" if data['room_id'].to_s == ''
+ default_events :commit_comment, :download, :fork, :fork_apply, :gollum,
+ :issues, :issue_comment, :member, :public, :pull_request, :push, :watch
+
+ def receive_event
+ raise_config_error "Missing 'subdomain'" if data['subdomain'].to_s.empty?
+ raise_config_error "Missing 'room_id'" if data['room_id'].to_s.empty?
http.basic_auth data['room_token'], 'X'
res = http_post "https://#{data['subdomain']}.jaconda.im/api/v2/rooms/#{data['room_id']}/notify/github.json",
:payload => JSON.generate(payload),
- :digest => data['digest']
+ :digest => data['digest'],
+ :branch_name => branch_name,
+ :event => event
if res.status < 200 || res.status > 299
raise_config_error "#{res.status}: #{res.body}"
|
Send all events to Jaconda
|
diff --git a/Casks/qqinput.rb b/Casks/qqinput.rb
index abc1234..def5678 100644
--- a/Casks/qqinput.rb
+++ b/Casks/qqinput.rb
@@ -0,0 +1,10 @@+class Qqinput < Cask
+ version '2.8.86.400'
+ sha256 '5b90cf604230013d5afa974b5b4835c0d6faf55da932cebce4f72478b5665a4d'
+
+ url 'http://qqime.cdn.sogou.com/QQInput_Mac_Setup_2_8_86_400.dmg'
+ homepage 'http://qq.pinyin.cn/'
+
+ install '安装QQ输入法2.8.pkg'
+ uninstall :pkgutil => 'com.tencent.inputmethod.QQInput.*'
+end
|
Add QQ input method, version 2.8.86.400
|
diff --git a/benchmark-memory.gemspec b/benchmark-memory.gemspec
index abc1234..def5678 100644
--- a/benchmark-memory.gemspec
+++ b/benchmark-memory.gemspec
@@ -13,7 +13,7 @@ spec.homepage = "https://github.com/michaelherold/benchmark-memory"
spec.license = "MIT"
- spec.files = %w(CHANGELOG.md LICENSE.md README.md Rakefile)
+ spec.files = %w(CHANGELOG.md CONTRIBUTING.md LICENSE.md README.md Rakefile)
spec.files += %w(benchmark-memory.gemspec)
spec.files += Dir["lib/**/*.rb"]
spec.require_paths = ["lib"]
|
Include the contributing guide in the gem
|
diff --git a/spec/watch_tower/editor/textmate_spec.rb b/spec/watch_tower/editor/textmate_spec.rb
index abc1234..def5678 100644
--- a/spec/watch_tower/editor/textmate_spec.rb
+++ b/spec/watch_tower/editor/textmate_spec.rb
@@ -21,7 +21,7 @@ subject.is_running?.should be_true
end
- it "should return the current_path if running" do
+ it "should return the current_path if textmate running" do
::Appscript::Application.any_instance.expects(:is_running?).returns(true).once
documents = mock
document = mock
@@ -34,6 +34,12 @@ subject.current_path.should == '/path/to/file.rb'
end
+ it "should return nil if textmate ain't running" do
+ ::Appscript::Application.any_instance.expects(:is_running?).returns(false).once
+
+ subject.current_path.should be_nil
+ end
+
end
end
end
|
spec/textmate: Make sure it returns nil if the editor is not running.
|
diff --git a/spec/knapsack_pro/runners/base_runner_spec.rb b/spec/knapsack_pro/runners/base_runner_spec.rb
index abc1234..def5678 100644
--- a/spec/knapsack_pro/runners/base_runner_spec.rb
+++ b/spec/knapsack_pro/runners/base_runner_spec.rb
@@ -0,0 +1,51 @@+describe KnapsackPro::Runners::BaseRunner do
+ let(:adapter_class) { double }
+ let(:runner) do
+ described_class.new(adapter_class)
+ end
+ let(:allocator) { instance_double(KnapsackPro::Allocator) }
+ let(:allocator_builder) { instance_double(KnapsackPro::AllocatorBuilder) }
+
+ before do
+ expect(KnapsackPro::AllocatorBuilder).to receive(:new).with(adapter_class).and_return(allocator_builder)
+ expect(allocator_builder).to receive(:allocator).and_return(allocator)
+ end
+
+ describe '#test_file_paths' do
+ let(:test_file_paths) { double }
+
+ subject { runner.test_file_paths }
+
+ before do
+ expect(allocator).to receive(:test_file_paths).and_return(test_file_paths)
+ end
+
+ it { should eq test_file_paths }
+ end
+
+ describe '#stringify_test_file_paths' do
+ let(:stringify_test_file_paths) { double }
+
+ subject { runner.stringify_test_file_paths }
+
+ before do
+ test_file_paths = double
+ expect(runner).to receive(:test_file_paths).and_return(test_file_paths)
+ expect(KnapsackPro::TestFilePresenter).to receive(:stringify_paths).with(test_file_paths).and_return(stringify_test_file_paths)
+ end
+
+ it { should eq stringify_test_file_paths }
+ end
+
+ describe '#test_dir' do
+ let(:test_dir) { double }
+
+ subject { runner.test_dir }
+
+ before do
+ expect(allocator_builder).to receive(:test_dir).and_return(test_dir)
+ end
+
+ it { should eq test_dir }
+ end
+end
|
Add spec for base runner
|
diff --git a/lib/little_mapper/mapper_instance_methods.rb b/lib/little_mapper/mapper_instance_methods.rb
index abc1234..def5678 100644
--- a/lib/little_mapper/mapper_instance_methods.rb
+++ b/lib/little_mapper/mapper_instance_methods.rb
@@ -21,7 +21,7 @@ pe = to_persistent(entity)
if pe.save
entity.id = pe.id # set this only if configured
- LittleMapper::Result::RepoSuccess.new
+ LittleMapper::Result::RepoSuccess.new(pe)
else
LittleMapper::Result::RepoFailure.new(pe)
end
|
Set persistent object on repo success
|
diff --git a/Argo.podspec b/Argo.podspec
index abc1234..def5678 100644
--- a/Argo.podspec
+++ b/Argo.podspec
@@ -1,6 +1,6 @@ Pod::Spec.new do |spec|
spec.name = 'Argo'
- spec.version = '0.2'
+ spec.version = '0.2.1'
spec.summary = 'Functional JSON parsing library for Swift.'
spec.homepage = 'https://github.com/thoughtbot/Argo'
spec.license = { :type => 'MIT', :file => 'LICENSE' }
@@ -13,7 +13,7 @@ spec.source = { :git => 'https://github.com/thoughtbot/Argo.git', :tag => "v#{spec.version}" }
spec.source_files = 'Argo/**/*.{h,swift}'
spec.requires_arc = true
- spec.ios.deployment_target = '8.0'
+ spec.ios.deployment_target = '7.0'
spec.osx.deployment_target = '10.9'
end
|
Update podspec to support iOS 7 and latest version
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.