diff stringlengths 65 26.7k | message stringlengths 7 9.92k |
|---|---|
diff --git a/lib/mako/view_helpers.rb b/lib/mako/view_helpers.rb
index abc1234..def5678 100644
--- a/lib/mako/view_helpers.rb
+++ b/lib/mako/view_helpers.rb
@@ -0,0 +1,15 @@+module ViewHelpers
+ # Returns today's date in Day, Date Month Year format
+ #
+ # @return [String]
+ def today
+ Time.now.strftime('%A, %d %B %Y')
+ end
+
+ # Returns the current time in month day year hour:minute:second format
+ #
+ # @return [String]
+ def last_updated
+ Time.now.strftime('%m %b %Y %H:%M:%S')
+ end
+end
| Add some helpers for the rendered HTML documents
|
diff --git a/lib/morph/line_buffer.rb b/lib/morph/line_buffer.rb
index abc1234..def5678 100644
--- a/lib/morph/line_buffer.rb
+++ b/lib/morph/line_buffer.rb
@@ -1,4 +1,6 @@ module Morph
+ # Line-oriented buffer. Send data to the buffer. Extract lines once they
+ # are completed with newlines
class LineBuffer
def initialize
@buffer = ''
| Add comment explaining what LineBuffer class does
|
diff --git a/smiling.gemspec b/smiling.gemspec
index abc1234..def5678 100644
--- a/smiling.gemspec
+++ b/smiling.gemspec
@@ -23,6 +23,5 @@
gem.add_dependency 'nokogiri', '~> 1.5.0'
gem.add_dependency 'httparty', '~> 0.8.0'
+ gem.add_dependency('jruby-openssl') if RUBY_PLATFORM == 'java'
end
-
-
| Add jruby-openssl to dependencies when using JRuby
|
diff --git a/lib/ry_safe/safe/node.rb b/lib/ry_safe/safe/node.rb
index abc1234..def5678 100644
--- a/lib/ry_safe/safe/node.rb
+++ b/lib/ry_safe/safe/node.rb
@@ -6,7 +6,7 @@ include Util::Dates
include Util::Hashable
- SEPARATOR = '/'
+ SEPARATOR = File::SEPARATOR
attr_accessor :name, :parent
| Use File separator instead of slash
|
diff --git a/lib/tasks/test_jobs.rake b/lib/tasks/test_jobs.rake
index abc1234..def5678 100644
--- a/lib/tasks/test_jobs.rake
+++ b/lib/tasks/test_jobs.rake
@@ -1,5 +1,5 @@ namespace :test_jobs do
- task :notify_admins_on_inconsistent_states do
+ task notify_admins_on_inconsistent_states: :environment do
if TestJob.joins(:test_run).
where("test_runs.status NOT IN (?)", [TestStatus::RUNNING, TestStatus::QUEUED]).
where(status: [TestStatus::RUNNING,TestStatus::QUEUED]).exists?
| Add ":environment" dependency to rake task
or the task will raise with "NameError: uninitialized constant TestJob"
|
diff --git a/lib/symmetric_encryption.rb b/lib/symmetric_encryption.rb
index abc1234..def5678 100644
--- a/lib/symmetric_encryption.rb
+++ b/lib/symmetric_encryption.rb
@@ -1,9 +1,12 @@+require 'zlib'
require 'symmetric_encryption/version'
require 'symmetric_encryption/cipher'
require 'symmetric_encryption/symmetric_encryption'
-require 'symmetric_encryption/reader'
-require 'symmetric_encryption/writer'
-require 'zlib'
+
+module SymmetricEncryption
+ autoload :Reader, 'symmetric_encryption/reader'
+ autoload :Writer, 'symmetric_encryption/writer'
+end
if defined?(Rails)
require 'symmetric_encryption/railtie'
end
| Make Reader and Writer load on demand |
diff --git a/lib/tty/table/operations.rb b/lib/tty/table/operations.rb
index abc1234..def5678 100644
--- a/lib/tty/table/operations.rb
+++ b/lib/tty/table/operations.rb
@@ -58,9 +58,11 @@ # @api public
def run_operations(*args)
operation_types = args
- table.each_with_index do |val, row, col|
- operation_types.each do |type|
- operations[type].each { |op| op.call(val, row, col) }
+ table.data.each_with_index do |row, row_i|
+ row.fields.each_with_index do |val, col_i|
+ operation_types.each do |type|
+ operations[type].each { |op| op.call(val, row_i, col_i) }
+ end
end
end
end
| Fix to work on actual internal data.
|
diff --git a/db/migrate/003_rename_user_to_username.rb b/db/migrate/003_rename_user_to_username.rb
index abc1234..def5678 100644
--- a/db/migrate/003_rename_user_to_username.rb
+++ b/db/migrate/003_rename_user_to_username.rb
@@ -0,0 +1,9 @@+class RenameUserToUsername < ActiveRecord::Migration
+ def self.up
+ rename_column :pureftpd_users, :user, :username
+ end
+
+ def self.down
+ rename_column :pureftpd_users, :username, :user
+ end
+end
| Rename the user column to users.
|
diff --git a/lib/ultracart_xml_parser.rb b/lib/ultracart_xml_parser.rb
index abc1234..def5678 100644
--- a/lib/ultracart_xml_parser.rb
+++ b/lib/ultracart_xml_parser.rb
@@ -11,11 +11,15 @@
module UltraCartXMLParser
def self.parse(io)
- document = Nokogiri::XML(io) do |config|
+ document = Nokogiri::XML::Reader(io) do |config|
config.options = Nokogiri::XML::ParseOptions::STRICT | Nokogiri::XML::ParseOptions::NONET
end
- document.xpath('/export/order').map do |order|
- Order.new(order)
+ orders = []
+ document.each do |node|
+ if node.name == 'order' && node.node_type == Nokogiri::XML::Reader::TYPE_ELEMENT
+ orders << Order.new(Nokogiri::XML(node.outer_xml).at('./order'))
+ end
end
+ orders
end
end
| Switch to Nokogiri::XML::Reader to enable parsing large XML files
|
diff --git a/lib/xcode/install/cli.rb b/lib/xcode/install/cli.rb
index abc1234..def5678 100644
--- a/lib/xcode/install/cli.rb
+++ b/lib/xcode/install/cli.rb
@@ -10,8 +10,7 @@ end
def installed?
- `xcode-select -p`
- $?.success?
+ File.exist?('/Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib')
end
def install
| Check CLI tools installed by libxcrun.dylib instead of `xcode-select -p`
- Success of `xcode-select -p` command will be true if any Xcode.app
is installed, or an alternate Xcode.app version has been selected,
even if CLI tools have never been installed
- More details:
https://macops.ca/developer-binaries-on-os-x-xcode-select-and-xcrun
|
diff --git a/sambao21_workstation/attributes/global_npm_packages.rb b/sambao21_workstation/attributes/global_npm_packages.rb
index abc1234..def5678 100644
--- a/sambao21_workstation/attributes/global_npm_packages.rb
+++ b/sambao21_workstation/attributes/global_npm_packages.rb
@@ -1,5 +1,7 @@ node.default["global_npm_packages"]= [
"jshint",
"less",
- "autoless"
+ "autoless",
+ "coffee-script",
+ "hubot"
]
| Add hubot and coffee-script to global npm
|
diff --git a/spec/factories/products.rb b/spec/factories/products.rb
index abc1234..def5678 100644
--- a/spec/factories/products.rb
+++ b/spec/factories/products.rb
@@ -12,7 +12,8 @@
after(:create) do |product, evaluator|
create(:primary_picture, :sparkfun_pic, product: product)
- create_list(:product, evaluator.pictures_count - 1, product: product)
+ create_list(:product_picture, evaluator.pictures_count - 1,
+ product: product)
end
end
end
| Fix error when creating product from factory with multiple pictures
|
diff --git a/config/environments/production.rb b/config/environments/production.rb
index abc1234..def5678 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -24,7 +24,7 @@ # Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
config.action_mailer.delivery_method = :smtp
-mail_settings = YAML.load_file("../mail_settings.yml")
+mail_settings = YAML.load_file(Rails.root.to_s + "/config/mail_settings.yml")
s = mail_settings["production"]
config.action_mailer.smtp_settings = {
:address => s["address"],
| Fix path to mailer config. [Story1932717] |
diff --git a/tasks/extension.rake b/tasks/extension.rake
index abc1234..def5678 100644
--- a/tasks/extension.rake
+++ b/tasks/extension.rake
@@ -23,9 +23,9 @@ ext.lib_dir = File.join( 'lib', This.name )
ext.gem_spec = This.ruby_gemspec
- ext.cross_compile = true # enable cross compilation (requires cross compile toolchain)
- ext.cross_platform = 'i386-mingw32' # forces the Windows platform instead of the default one
- # configure options only for cross compile
+ ext.cross_compile = true # enable cross compilation (requires cross compile toolchain)
+ ext.cross_platform = %w[x86-mingw32 x64-mingw32] # forces the Windows platform instead of the default one
+ # configure options only for cross compile
end
end
| Add x64 architecture to Windows cross-compilation targets
|
diff --git a/embulk-input-bigquery.gemspec b/embulk-input-bigquery.gemspec
index abc1234..def5678 100644
--- a/embulk-input-bigquery.gemspec
+++ b/embulk-input-bigquery.gemspec
@@ -18,7 +18,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']
- spec.add_dependency 'google-cloud-bigquery', ['>= 0.24', '< 1.12']
+ spec.add_dependency 'google-cloud-bigquery', ['>= 1.2', '< 1.12']
spec.add_development_dependency 'bundler', '~> 1.3'
spec.add_development_dependency 'rake'
end
| Change google-cloud-bigquery dependency to 1.2 or higher.
|
diff --git a/lib/kramdown/converter/latex_repositext/render_record_marks_mixin.rb b/lib/kramdown/converter/latex_repositext/render_record_marks_mixin.rb
index abc1234..def5678 100644
--- a/lib/kramdown/converter/latex_repositext/render_record_marks_mixin.rb
+++ b/lib/kramdown/converter/latex_repositext/render_record_marks_mixin.rb
@@ -5,14 +5,12 @@ module RenderRecordMarksMixin
def convert_record_mark(el, opts)
- r = break_out_of_song(@inside_song)
if @options[:disable_record_mark]
- r << inner(el, opts)
+ inner(el, opts)
else
meta = %( id: #{ el.attr['id'] })
- r << "\\RtRecordMark{#{ meta }}#{ inner(el, opts) }"
+ "\\RtRecordMark{#{ meta }}#{ inner(el, opts) }"
end
- r
end
end
| Remove another instance of break_out_of_song (not needed any more) |
diff --git a/capistrano-graphite.gemspec b/capistrano-graphite.gemspec
index abc1234..def5678 100644
--- a/capistrano-graphite.gemspec
+++ b/capistrano-graphite.gemspec
@@ -22,4 +22,5 @@
spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake"
+ spec.add_development_dependency "rspec"
end
| Add rspec for basic rake test
|
diff --git a/spec/cmd_init_spec.rb b/spec/cmd_init_spec.rb
index abc1234..def5678 100644
--- a/spec/cmd_init_spec.rb
+++ b/spec/cmd_init_spec.rb
@@ -19,7 +19,7 @@ it "Asks to import if Solutionfile exists" do
FileUtils.touch('Solutionfile.json')
out, err, status = Open3.capture3(capcmd('murano', 'init', '--trace'), :stdin_data=>'y')
- expect(out).to eq("\nA Solutionfile.json exists, Do you want exit and run `mr config import` instead? [yN]\n")
+ expect(out).to eq("\nA Solutionfile.json exists, Do you want exit and run `murano config import` instead? [yN]\n")
expect(err).to eq("")
expect(status.exitstatus).to eq(0)
end
| Update test with mr->murano change.
|
diff --git a/bin/hosts.rb b/bin/hosts.rb
index abc1234..def5678 100644
--- a/bin/hosts.rb
+++ b/bin/hosts.rb
@@ -0,0 +1,44 @@+#!/usr/bin/env ruby
+#
+# Generate Nagios hosts files from unix hosts file
+#
+# e.g.
+# 10.1.1.1 gw.failmode.com
+# 10.1.1.5 mail.failmode.com
+
+require 'erb'
+
+hosts_file = ARGV[0] || '/etc/hosts'
+
+template = ERB.new <<-EOF
+define host{
+ use generic-host
+ hostgroups linux-servers
+ host_name <%= host_name %>
+ address <%= ip %>
+}
+EOF
+
+ValidIpAddressRegex = /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/;
+
+ValidHostnameRegex = /^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$/;
+
+# XXX Add hostgroups to hosts
+# HOSTGROUPS = 'linux-servers', 'windows-servers', 'debian-servers', 'vmware-hosts'
+
+open(hosts_file).each do |line|
+ ip, host_name = line.sub(/#.*/,'').split[0,2]
+ hostgroups = []
+
+
+ if ip =~ ValidIpAddressRegex and host_name =~ ValidHostnameRegex
+ filename = host_name + '.cfg'
+ File.open(filename, 'w') do |file|
+ file.write template.result(binding)
+ puts "writing #{filename}"
+ end
+ else
+ puts "not writing anything for '#{line}'"
+ end
+
+end
| Move this into Nagios tasks
|
diff --git a/hologram.gemspec b/hologram.gemspec
index abc1234..def5678 100644
--- a/hologram.gemspec
+++ b/hologram.gemspec
@@ -6,12 +6,15 @@ Gem::Specification.new do |spec|
spec.name = "hologram"
spec.version = Hologram::VERSION
- spec.authors = ["JD Cantrell"]
- spec.email = ["jcantrell@trulia.com"]
+ spec.authors = ["JD Cantrell", "August Flanagan"]
+ spec.email = ["jdcantrell@gmail.com"]
spec.description = %q{TODO: Write a gem description}
spec.summary = %q{TODO: Write a gem summary}
spec.homepage = ""
- spec.license = "MIT"
+ spec.license = "TODO"
+
+ spec.add_dependency "redcarpet", "~> 2.2.2"
+ spec.add_dependency "sass", "~> 3.2.7"
spec.files = `git ls-files`.split($/)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
| Add dependencies and an author
|
diff --git a/spec/timezone_spec.rb b/spec/timezone_spec.rb
index abc1234..def5678 100644
--- a/spec/timezone_spec.rb
+++ b/spec/timezone_spec.rb
@@ -3,11 +3,3 @@ describe command('date') do
its(:stdout) { should match /JST/ }
end
-
-describe command('strings /etc/localtime') do
- its(:stdout) { should match /JST-9/ }
-end
-
-describe file('/etc/timezone') do
- its(:content) { should match /Asia\/Tokyo/ }
-end
| Fix redundancy test to timezone spec
|
diff --git a/app/helpers/reports_helper.rb b/app/helpers/reports_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/reports_helper.rb
+++ b/app/helpers/reports_helper.rb
@@ -22,7 +22,16 @@
def ordered_pickup_and_dropoff_addresses(trips)
trips.collect do |trip|
- [{time: trip.pickup_time, address: trip.pickup_address}, {time: trip.appointment_time, address: trip.dropoff_address}]
- end.flatten.sort_by{ |trip_info| trip_info[:time] }.collect{ |trip_info| trip_info[:address] }
+ [{
+ sort_time: trip.pickup_time,
+ time: trip.pickup_time,
+ address: trip.pickup_address
+ },
+ {
+ sort_time: trip.appointment_time || trip.pickup_time,
+ time: trip.appointment_time,
+ address: trip.dropoff_address
+ }]
+ end.flatten.sort_by{ |trip_info| trip_info[:sort_time] }.collect{ |trip_info| trip_info[:address] }
end
end
| Sort trip properly regardless appointment_time presence
|
diff --git a/lib/generators/thincloud/postmark/templates/thincloud_postmark.rb b/lib/generators/thincloud/postmark/templates/thincloud_postmark.rb
index abc1234..def5678 100644
--- a/lib/generators/thincloud/postmark/templates/thincloud_postmark.rb
+++ b/lib/generators/thincloud/postmark/templates/thincloud_postmark.rb
@@ -1,3 +1,3 @@ Thincloud::Postmark.configure do |config|
- config.api_key = "POSTMARK_API_TEST"
+ config.api_key = ENV["POSTMARK_API_KEY"]
end
| Use convention in postmark initializer template |
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,4 +1,6 @@ Rails.application.routes.draw do
+ root to: redirect('/imports')
+
require 'sidekiq/web'
# see config/initializers/sidekiq.rb for security details
mount Sidekiq::Web, at: '/sidekiq'
| Send homepage to imports list
Seems as good a place as any for now, but might end up somewhere else
once we have other pages. Mostly I just wanted something that wouldn't
error!
|
diff --git a/lib/rutabaga.rb b/lib/rutabaga.rb
index abc1234..def5678 100644
--- a/lib/rutabaga.rb
+++ b/lib/rutabaga.rb
@@ -1,3 +1,22 @@+# speed up rspec under ruby 1.9 because it doesn't work otherwise
+if RUBY_VERSION > '1.9.2'
+ class Object
+ def to_ary
+ nil
+ end
+
+ def to_hash
+ nil
+ end
+ end
+
+ class String
+ def to_path
+ self
+ end
+ end
+end
+
require 'rutabaga/version'
require 'turnip'
require 'rutabaga/feature'
| Put in monkey patch to speed up rspec tests
Due to method_missing being called constantly in rspec, this patches
the major call categories.
|
diff --git a/lib/klarna_gateway/controllers/admin/orders_controller.rb b/lib/klarna_gateway/controllers/admin/orders_controller.rb
index abc1234..def5678 100644
--- a/lib/klarna_gateway/controllers/admin/orders_controller.rb
+++ b/lib/klarna_gateway/controllers/admin/orders_controller.rb
@@ -8,7 +8,7 @@ private
def check_klarna_payment_cancel
- if @order.has_klarna_payments? && @order.can_be_cancelled_from_klarna?
+ if @order.has_klarna_payments? && !@order.can_be_cancelled_from_klarna?
flash[:error] = "Please cancel all Klarna payments before canceling this order."
redirect_to(spree.admin_order_payments_path(@order))
end
| Fix bug in cancelling orders |
diff --git a/lib/autobahn/concurrency.rb b/lib/autobahn/concurrency.rb
index abc1234..def5678 100644
--- a/lib/autobahn/concurrency.rb
+++ b/lib/autobahn/concurrency.rb
@@ -7,19 +7,12 @@ module Concurrency
java_import 'java.lang.Thread'
java_import 'java.lang.InterruptedException'
- java_import 'java.util.concurrent.atomic.AtomicInteger'
- java_import 'java.util.concurrent.atomic.AtomicBoolean'
- java_import 'java.util.concurrent.ThreadFactory'
- java_import 'java.util.concurrent.Executors'
- java_import 'java.util.concurrent.LinkedBlockingQueue'
- java_import 'java.util.concurrent.LinkedBlockingDeque'
- java_import 'java.util.concurrent.ArrayBlockingQueue'
- java_import 'java.util.concurrent.TimeUnit'
- java_import 'java.util.concurrent.CountDownLatch'
- java_import 'java.util.concurrent.locks.ReentrantLock'
+ include_package 'java.util.concurrent'
+ include_package 'java.util.concurrent.atomic'
+ include_package 'java.util.concurrent.locks'
class NamingDaemonThreadFactory
- include ThreadFactory
+ include Concurrency::ThreadFactory
def self.next_id
@id ||= Concurrency::AtomicInteger.new
@@ -40,7 +33,7 @@
class Lock
def initialize
- @lock = ReentrantLock.new
+ @lock = Concurrency::ReentrantLock.new
end
def lock
| Use include_package instead of individual imports in Concurrency |
diff --git a/lib/docu_sign/anchor_tab.rb b/lib/docu_sign/anchor_tab.rb
index abc1234..def5678 100644
--- a/lib/docu_sign/anchor_tab.rb
+++ b/lib/docu_sign/anchor_tab.rb
@@ -23,7 +23,7 @@ "YOffset" => self.y_offset,
"Unit" => self.unit,
"IgnoreIfNotPresent" => self.ignore_if_not_present?
- }
+ }.delete_if{|key, value| value.nil?}
end
end
end | Remove unassigned attributes in anchor tabs.
|
diff --git a/lib/gitlab/plugin_logger.rb b/lib/gitlab/plugin_logger.rb
index abc1234..def5678 100644
--- a/lib/gitlab/plugin_logger.rb
+++ b/lib/gitlab/plugin_logger.rb
@@ -5,4 +5,3 @@ end
end
end
-
| Remove trailing line from plugin logger
Signed-off-by: Dmitriy Zaporozhets <be23d75b156792e5acab51b196a2deb155d35d6a@gmail.com>
|
diff --git a/lib/remotely_exceptional.rb b/lib/remotely_exceptional.rb
index abc1234..def5678 100644
--- a/lib/remotely_exceptional.rb
+++ b/lib/remotely_exceptional.rb
@@ -6,7 +6,4 @@
# The namespace for the RemotelyExceptional gem.
module RemotelyExceptional
- # The namespace that specialized handlers live in.
- module Handlers
- end
end
| Remove duplicate Handlers module definition
|
diff --git a/app/models/email_processor.rb b/app/models/email_processor.rb
index abc1234..def5678 100644
--- a/app/models/email_processor.rb
+++ b/app/models/email_processor.rb
@@ -4,11 +4,19 @@ end
def process
- # all of your application-specific code here - creating models,
- # processing reports, etc
-
- # here's an example of model creation
newsletter = Newsletter.find_by_email(@email.from[:email])
-
+ Email.create(
+ newsletter_id: newsletter.id,
+ to: to,
+ from: from,
+ subject: subject,
+ body: body,
+ raw_text: raw_text,
+ raw_html: raw_html,
+ raw_body: raw_body,
+ attachments: attachments,
+ headers: headers,
+ raw_headers: raw_headers
+ )
end
end
| Save the running of email creator
|
diff --git a/lib/settled/settings.rb b/lib/settled/settings.rb
index abc1234..def5678 100644
--- a/lib/settled/settings.rb
+++ b/lib/settled/settings.rb
@@ -9,6 +9,7 @@
def initialize( &block )
@configuration = {}
+ @files = []
@instance_strategies = []
if block_given?
@@ -26,8 +27,12 @@ @container = Dsl::Container.new( klass )
end
- def file( format, path )
- @configuration = _container.instance( Dsl::File.new( format, path, configuration ).build )
+ def file( format, paths )
+ @files << [format, Array(paths)]
+ end
+
+ def files( format, paths )
+ file( format, paths )
end
def instance( *args )
@@ -37,11 +42,23 @@ private
def finish_setup
- Settled.configuration = configuration
+ config_hash = read_files
+
+ Settled.configuration = @configuration = _container.instance( config_hash )
instance_strategies.each do |strategy|
apply_instance_strategy( strategy )
end
+ end
+
+ def read_files
+ config_hash = {}
+ @files.each do |format, paths|
+ paths.each do |path|
+ config_hash = Dsl::File.new( format, path, config_hash ).build
+ end
+ end
+ config_hash
end
def apply_instance_strategy( strategy )
| Refactor to lazily evaluate when using file(s) DSL method.
|
diff --git a/lib/tarquinn/handler.rb b/lib/tarquinn/handler.rb
index abc1234..def5678 100644
--- a/lib/tarquinn/handler.rb
+++ b/lib/tarquinn/handler.rb
@@ -9,8 +9,8 @@ end
def perform_redirect?
- @perform_redirect = is_redirect? if @perform_redirect.nil?
- @perform_redirect
+ return @perform_redirect unless @perform_redirect.nil?
+ @perform_redirect = is_redirect?
end
def redirect
| Use more direct cached getter
|
diff --git a/lib/tasks/accounts.rake b/lib/tasks/accounts.rake
index abc1234..def5678 100644
--- a/lib/tasks/accounts.rake
+++ b/lib/tasks/accounts.rake
@@ -3,7 +3,7 @@ task :fund=>:environment do
if Date.today.day == 1 || Date.today.day == 15
Household.all.each do |household|
- household.accounts.deferred.all.each(&:fund)
+ household.accounts.asset.where('budget > 0').each(&:fund)
end
end
end
| Fix saving funding rake task.
|
diff --git a/db/migrate/20161023220641_create_elastic_product_state.rb b/db/migrate/20161023220641_create_elastic_product_state.rb
index abc1234..def5678 100644
--- a/db/migrate/20161023220641_create_elastic_product_state.rb
+++ b/db/migrate/20161023220641_create_elastic_product_state.rb
@@ -11,8 +11,10 @@ t.index :json, where: 'json is null'
end
- # to get out of a transaction
- execute("commit;")
+ # Run Insert outside of a transaction for Postgres
+ if connection.adapter_name =~ /postgres/i
+ execute("commit;")
+ end
execute "INSERT INTO #{Solidus::ElasticProduct::State.table_name} (product_id) SELECT id FROM #{Spree::Product.table_name}"
end
| Correct migration to apply Postgres specific instructions
.. only for Postgres
Fixes #2
|
diff --git a/lib/vimentor/rclient.rb b/lib/vimentor/rclient.rb
index abc1234..def5678 100644
--- a/lib/vimentor/rclient.rb
+++ b/lib/vimentor/rclient.rb
@@ -3,6 +3,13 @@
def initialize()
@connection = Rserve::Connection.new
+ r_init()
+ end
+
+ def r_init()
+ @connection.eval("library(Matrix)")
+ @connection.eval("library(arules)")
+ @connection.eval("library(arulesSequences)")
end
def version()
| Create r_init function and load libs for sequential mining
|
diff --git a/ext/rkerberos/extconf.rb b/ext/rkerberos/extconf.rb
index abc1234..def5678 100644
--- a/ext/rkerberos/extconf.rb
+++ b/ext/rkerberos/extconf.rb
@@ -21,5 +21,5 @@ raise 'kdb5 library not found'
end
-$CFLAGS << '-std=c99'
+$CFLAGS << '-std=c99 -Wall -pedantic'
create_makefile('rkerberos')
| Raise warning level to pedantic
This allows us to see possible mistakes earlier, allowing for a stricter
adherance to the C standard
|
diff --git a/models/survey_submission.rb b/models/survey_submission.rb
index abc1234..def5678 100644
--- a/models/survey_submission.rb
+++ b/models/survey_submission.rb
@@ -23,4 +23,10 @@ def restart_todo
end
end
+
+ ::Course::Survey::Response.class_eval do
+ def attempting?
+ !submitted?
+ end
+ end
end
| Add attempting? to survey submission
|
diff --git a/examples/abandoned_transactions.rb b/examples/abandoned_transactions.rb
index abc1234..def5678 100644
--- a/examples/abandoned_transactions.rb
+++ b/examples/abandoned_transactions.rb
@@ -8,7 +8,7 @@ # You can pass the credentials parameters to PagSeguro::Transaction#find_abandoned
options = {
- credentials: PagSeguro::ApplicationCredentials.new('EMAIL', 'TOKEN')
+ credentials: PagSeguro::AccountCredentials.new('EMAIL', 'TOKEN')
# You can pass more arguments by params, look (/lib/pagseguro/transaction.rb)
}
| Fix class name to PagSeguro::AccountCredentials
|
diff --git a/app/models/game.rb b/app/models/game.rb
index abc1234..def5678 100644
--- a/app/models/game.rb
+++ b/app/models/game.rb
@@ -5,7 +5,7 @@ has_many :rounds, dependent: :destroy
def finished?
- odd_team_score.abs >= 500 || even_team_score >= 500
+ odd_team_score.abs >= 500 || even_team_score.abs >= 500
end
# TODO players would be nicer than 'team'
| Fix bug where abs wasn't applied to both scores
|
diff --git a/app/models/game.rb b/app/models/game.rb
index abc1234..def5678 100644
--- a/app/models/game.rb
+++ b/app/models/game.rb
@@ -1,3 +1,8 @@ class Game < ActiveRecord::Base
mount_uploader :image, ImageUploader
+
+ validates :name, presence: true
+
+ # TODO: Remove this and create the default image
+ validates :image, presence: true
end
| Add validations to the Game
|
diff --git a/app/models/item.rb b/app/models/item.rb
index abc1234..def5678 100644
--- a/app/models/item.rb
+++ b/app/models/item.rb
@@ -23,11 +23,6 @@ belongs_to :raid#, :counter_cache => true
alias_method :buyer, :member
- # Class Methods -------------------------------------------------------------
- def self.from_attendance_output(line)
-
- end
-
# Instance Methods ----------------------------------------------------------
def affects_loot_factor?
self.raid.date >= 8.weeks.until(Date.today) if self.raid
@@ -36,13 +31,4 @@ def adjusted_price
( self.rot? ) ? 0.50 : self.price
end
-
- def determine_item_price
- ItemPrice.new.price(ItemStat.lookup_by_name(self.name), buyer_is_hunter?)
- end
-
- private
- def buyer_is_hunter?
- self.buyer and self.buyer.wow_class == 'Hunter'
- end
end
| Clean leftover junk out of Item
|
diff --git a/app/models/plan.rb b/app/models/plan.rb
index abc1234..def5678 100644
--- a/app/models/plan.rb
+++ b/app/models/plan.rb
@@ -1,5 +1,5 @@ class Plan < ApplicationRecord
belongs_to :user
- has_many :recipes
+ has_many :recipes, dependent: :destroy
end | Add dependent destroy option to has_many ingredients relationship
|
diff --git a/pipeline/db/migrate/20160203175157_devise_create_users.rb b/pipeline/db/migrate/20160203175157_devise_create_users.rb
index abc1234..def5678 100644
--- a/pipeline/db/migrate/20160203175157_devise_create_users.rb
+++ b/pipeline/db/migrate/20160203175157_devise_create_users.rb
@@ -30,6 +30,9 @@ # t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at
+ t.string :first_name
+ t.string :last_name
+ t.integer :score
t.timestamps null: false
end
| Add extra fields to user table
|
diff --git a/week-9/ruby-review-1/ruby-review-1.rb b/week-9/ruby-review-1/ruby-review-1.rb
index abc1234..def5678 100644
--- a/week-9/ruby-review-1/ruby-review-1.rb
+++ b/week-9/ruby-review-1/ruby-review-1.rb
@@ -0,0 +1,61 @@+# U2.W6: Testing Assert Statements
+
+# I worked on this challenge with: Coline Forde
+
+
+# 2. Review the simple assert statement
+
+def assert
+ raise "Assertion failed!" unless yield
+end
+
+# name = "bettysue"
+# assert { name == "bettysue" }
+# assert { name == "billybob" }
+
+# 2. Pseudocode what happens when the code above runs
+#The code runs to see if the names match the name on line 12. If it returns true, there is no error. If it returns false, the assert error raises and you'll see the message "Assertion failed!".
+
+
+# 3. Copy your selected challenge here
+def add(num_1, num_2)
+ return num_1 + num_2
+end
+
+def subtract(num_1, num_2)
+ return num_1 - num_2
+end
+
+def multiply(num_1, num_2)
+ return num_1 * num_2
+end
+
+def divide(num_1, num_2)
+ return num_1 / num_2.to_f
+end
+
+
+# 4. Convert your driver test code from that challenge into Assert Statements
+
+
+sum = add(1,2)
+assert {sum == 5}
+assert {sum == 3}
+
+minus = subtract(7,5)
+assert { minus == 2 }
+assert {minus == 10}
+
+times = multiply(2,4)
+assert { times == 8 }
+assert { times == 42 }
+
+div = divide(10,2)
+assert {div == 5}
+assert {div == 3}
+
+
+
+
+
+# 5. Reflection | Add ruby review 1 challenge
|
diff --git a/lib/be_gateway/client.rb b/lib/be_gateway/client.rb
index abc1234..def5678 100644
--- a/lib/be_gateway/client.rb
+++ b/lib/be_gateway/client.rb
@@ -3,7 +3,6 @@
module BeGateway
class Client
- cattr_accessor :rack_app
cattr_accessor :rack_app, :stub_app
def initialize(params)
@@ -57,6 +56,9 @@
conn.adapter :test, stub_app if stub_app
conn.adapter :rack, rack_app.new if rack_app
+ if !stub_app && !rack_app
+ conn.adapter Faraday.default_adapter
+ end
end
end
end
| Add default adapter to faraday for real http requests
|
diff --git a/lib/hbc/container/air.rb b/lib/hbc/container/air.rb
index abc1234..def5678 100644
--- a/lib/hbc/container/air.rb
+++ b/lib/hbc/container/air.rb
@@ -25,7 +25,11 @@ end
def extract
- @command.run!(self.class.installer_cmd,
- :args => ['-silent', '-location', @cask.staged_path, Pathname.new(@path).realpath])
+ install = @command.run(self.class.installer_cmd,
+ :args => ['-silent', '-location', @cask.staged_path, Pathname.new(@path).realpath])
+
+ if install.exit_status == 9 then
+ raise Hbc::CaskError.new "Adobe AIR application #{@cask} already exists on the system, and cannot be reinstalled."
+ end
end
end
| Improve error message for AIR app reinstallation
Adobe AIR Installer forbids the silent reinstallation of existing AIR
apps; any attempt fails with exit code 9.
In the absence of known workarounds, we merely wrap the failure in a
clearer error message.
|
diff --git a/haxby.rb b/haxby.rb
index abc1234..def5678 100644
--- a/haxby.rb
+++ b/haxby.rb
@@ -3,6 +3,7 @@ class Haxby < Formula
homepage 'https://github.com/tabletcorry/haxby'
url "https://github.com/tabletcorry/haxby/tarball/haxby-0.1"
+ head "git://github.com/tabletcorry/haxby.git"
sha256 "68671482d9b4b71b62e15e2335849aa4e48433ccf15a78c875daac983565e8ef"
depends_on 'coreutils' # Specifically greadlink
| Add a HEAD config line to formula
Allows you to build the formula from the set version or HEAD, if
desired.
|
diff --git a/spec/intergration/lib/poro_validator/validators/format_validator_spec.rb b/spec/intergration/lib/poro_validator/validators/format_validator_spec.rb
index abc1234..def5678 100644
--- a/spec/intergration/lib/poro_validator/validators/format_validator_spec.rb
+++ b/spec/intergration/lib/poro_validator/validators/format_validator_spec.rb
@@ -11,6 +11,7 @@ let(:condition) { true }
let(:conditions) { { if: proc { condition } } }
+ # TODO: Create this customer validator macro/matcher
# test_validator(
# validator, entity
# ).expect_to_pass(condition: true, value: values[:valid])
| Add reminder to create better macro/matcher
|
diff --git a/spec/lib/regxing/generator/less_simple_expression_spec.rb b/spec/lib/regxing/generator/less_simple_expression_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/regxing/generator/less_simple_expression_spec.rb
+++ b/spec/lib/regxing/generator/less_simple_expression_spec.rb
@@ -9,5 +9,10 @@ let(:expression) { /^\d{3}$/ }
it_behaves_like "a matching string generator"
end
+
+ describe "or operators" do
+ let(:expression) { /a|b/ }
+ it_behaves_like "a matching string generator"
+ end
end
end
| Test for accepting the or operator
|
diff --git a/spec/controllers/social_networking/shared_item_controller_spec.rb b/spec/controllers/social_networking/shared_item_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/social_networking/shared_item_controller_spec.rb
+++ b/spec/controllers/social_networking/shared_item_controller_spec.rb
@@ -0,0 +1,68 @@+require "spec_helper"
+
+module SocialNetworking
+ describe SharedItemController, type: :controller do
+ let(:participant) do
+ double("participant",
+ id: 987,
+ active_group: double("group", id: 123)
+ )
+ end
+
+ before :each do
+ @routes = Engine.routes
+ end
+
+ describe "POST hide" do
+ let(:shared_item) do
+ double("shared item")
+ end
+
+ context "when the participant is authenticated" do
+ it "should hide a feed item" do
+ expect(SharedItem).to receive(:find_by_id) { shared_item }
+ expect(controller).to receive(:current_participant) { participant }
+ expect(shared_item)
+ .to receive_message_chain(:item, :participant, :id) { 987 }
+ expect(shared_item).to receive(:update_attribute) { true }
+
+ post :hide,
+ id: 123
+
+ expect(response.status).to eq(202)
+ end
+ end
+ end
+
+ describe "GET page" do
+ context "when the participant is authenticated" do
+ it "should return a json representation of feed items" do
+ allow(controller).to receive(:authenticate_participant!)
+ allow(controller).to receive(:current_participant) { participant }
+ allow(Participant).to receive(:find) { participant }
+
+ on_the_mind_statement_mock = { createdAtRaw: 1 }
+ nudge_mock = { createdAtRaw: 2 }
+ shared_item_mock = { createdAtRaw: 3 }
+
+ expect(OnTheMindStatement)
+ .to receive_message_chain(:joins, :where, :includes)
+ expect(Nudge).to receive_message_chain(:joins, :where, :includes)
+ expect(SharedItem)
+ .to receive_message_chain(:includes, :all, :select)
+ expect(Serializers::OnTheMindStatementSerializer)
+ .to receive(:from_collection) { [on_the_mind_statement_mock] }
+ expect(Serializers::NudgeSerializer)
+ .to receive(:from_collection) { [nudge_mock] }
+ expect(Serializers::SharedItemSerializer)
+ .to receive(:from_collection) { [shared_item_mock] }
+
+ get :page,
+ page: 0,
+ participant_id: 987
+ expect(response.body).to include("feedItems")
+ end
+ end
+ end
+ end
+end
| Add test cases for shared item controller.
* Added spec for hide action.
* Added spec for page action.
[#90191168]
|
diff --git a/multilateration.gemspec b/multilateration.gemspec
index abc1234..def5678 100644
--- a/multilateration.gemspec
+++ b/multilateration.gemspec
@@ -20,4 +20,5 @@
spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake"
+ spec.add_development_dependency "rspec"
end
| Add rspec gem as a development dependency
|
diff --git a/db/migrate/20160913195129_move_repo_data_from_database_to_settings.rb b/db/migrate/20160913195129_move_repo_data_from_database_to_settings.rb
index abc1234..def5678 100644
--- a/db/migrate/20160913195129_move_repo_data_from_database_to_settings.rb
+++ b/db/migrate/20160913195129_move_repo_data_from_database_to_settings.rb
@@ -30,7 +30,7 @@ end
def my_region
- MiqRegion.find_by_region(ArRegion.anonymous_class_with_ar_region.my_region_number)
+ MiqRegion.find_by(:region => ArRegion.anonymous_class_with_ar_region.my_region_number)
end
def settings_hash
| Use find_by instead of dynamic find_by_region
|
diff --git a/lib/spree_auth_devise.rb b/lib/spree_auth_devise.rb
index abc1234..def5678 100644
--- a/lib/spree_auth_devise.rb
+++ b/lib/spree_auth_devise.rb
@@ -1,4 +1,3 @@ require 'spree_core'
require 'spree/auth/devise'
require 'spree/authentication_helpers'
-require 'coffee_script'
| Remove loose require for coffee_script
Fixes #176
|
diff --git a/lib/tasks/data_loader.rb b/lib/tasks/data_loader.rb
index abc1234..def5678 100644
--- a/lib/tasks/data_loader.rb
+++ b/lib/tasks/data_loader.rb
@@ -1,6 +1,6 @@ module DataLoader
- def check_for_file taskname
+ def check_for_file
unless ENV['FILE']
puts ''
puts "usage: This task requires FILE=filename"
@@ -9,8 +9,17 @@ end
end
+ def check_for_dir
+ unless ENV['DIR']
+ puts ''
+ puts "usage: This task requires DIR=dirname"
+ puts ''
+ exit 0
+ end
+ end
+
def parse(model, parser_class, skip_invalid=true)
- check_for_file model
+ check_for_file
puts "Loading #{model} from #{ENV['FILE']}..."
parser = parser_class.new
parser.send("parse_#{model}".to_sym, ENV['FILE']) do |model|
| Add function to check for dir
|
diff --git a/lib/tasks/emergency.rake b/lib/tasks/emergency.rake
index abc1234..def5678 100644
--- a/lib/tasks/emergency.rake
+++ b/lib/tasks/emergency.rake
@@ -26,5 +26,15 @@ user.reset_authorization!
end
end
+
+ desc "Get meta info for all domains in the connection logs"
+ task :get_all_meta_info_for_connection_logs => :environment do
+ domains = ConnectionLog.group(:host).pluck(:host)
+ total = domains.count
+ domains.each_with_index do |domain, index|
+ puts "#{index + 1}/#{total} #{domain}"
+ Domain.lookup_meta(domain)
+ end
+ end
end
end
| Add a rake task to go through all the collected domains in the connection logs
|
diff --git a/lib/tasks/haml-lint.rake b/lib/tasks/haml-lint.rake
index abc1234..def5678 100644
--- a/lib/tasks/haml-lint.rake
+++ b/lib/tasks/haml-lint.rake
@@ -2,5 +2,14 @@ require 'haml_lint/rake_task'
require 'haml_lint/inline_javascript'
+ # Workaround for warnings from parser/current
+ # TODO: Remove this after we update parser gem
+ task :haml_lint do
+ require 'parser'
+ def Parser.warn(*args)
+ puts(*args) # static-analysis ignores stdout if status is 0
+ end
+ end
+
HamlLint::RakeTask.new
end
| Convert parser warnings to stdout in haml_lint
So we ignore it in static-analysis when status is 0,
yet still report it if it's not.
|
diff --git a/app/models/gobierto_people.rb b/app/models/gobierto_people.rb
index abc1234..def5678 100644
--- a/app/models/gobierto_people.rb
+++ b/app/models/gobierto_people.rb
@@ -4,6 +4,10 @@ end
def self.classes_with_vocabularies
+ [GobiertoPeople::Person]
+ end
+
+ def self.classes_with_custom_fields
[GobiertoPeople::Person]
end
| Add GobiertoPeople::Person to classes with custom fields enabled
|
diff --git a/app/models/helpdesk_ticket.rb b/app/models/helpdesk_ticket.rb
index abc1234..def5678 100644
--- a/app/models/helpdesk_ticket.rb
+++ b/app/models/helpdesk_ticket.rb
@@ -8,6 +8,44 @@
# Model constratins/validation
validates :project, presence: true # Must always be associated to a project
+
+ #
+ # Permissions around group data
+ #
+ def self.permissions
+ # What can students do with all tickets?
+ student_role_permissions = [
+ ]
+ # What can tutors do with all tickets?
+ tutor_role_permissions = [
+ :get_tickets
+ ]
+ # What can convenors do with all tickets?
+ convenor_role_permissions = [
+ :get_tickets
+ ]
+ # What can admins do with all tickets?
+ admin_role_permissions = [
+ :get_tickets
+ ]
+ # What can nil users do with all tickets?
+ nil_role_permissions = [
+
+ ]
+
+ # Return permissions hash
+ {
+ :admin => admin_role_permissions,
+ :convenor => convenor_role_permissions,
+ :tutor => tutor_role_permissions,
+ :student => student_role_permissions,
+ :nil => nil_role_permissions
+ }
+ end
+
+ def self.role_for(user)
+ user.role
+ end
# Returns back all unresolved tickets
def self.all_unresolved
@@ -35,7 +73,7 @@ project.student
end
- # Returns true iff ticket is associated with a task
+ # Returns true if ticket is associated with a task
def has_task?
!task.nil?
end
| FIX: Add missing permissions to helpdesk ticket
|
diff --git a/app/services/search_orders.rb b/app/services/search_orders.rb
index abc1234..def5678 100644
--- a/app/services/search_orders.rb
+++ b/app/services/search_orders.rb
@@ -26,11 +26,11 @@ @search = OpenFoodNetwork::Permissions.new(current_user).editable_orders.ransack(params[:q])
return paginated_results if using_pagination?
- @search.result
+ @search.result(distinct: true)
end
def paginated_results
- @search.result
+ @search.result(distinct: true)
.page(params[:page])
.per(params[:per_page])
end
| Fix multiple results with 'inventory_items_shipment_id_null' ransack query
The q['inventory_items_shipment_id_null'] search element was generating duplicates where there were multiple line items on an order that were ready to be shipped, with id = null
|
diff --git a/lesson04/basic_musical_notation.rb b/lesson04/basic_musical_notation.rb
index abc1234..def5678 100644
--- a/lesson04/basic_musical_notation.rb
+++ b/lesson04/basic_musical_notation.rb
@@ -7,15 +7,18 @@ # LEFT HAND SPACES A C E Garage
use_synth :piano
+# Just Like Reading a Book
play :E3
play chord(:E4)
sleep 0.5
+
play :F4
sleep 0.5
+
play :A4
sleep 0.5
-play [:C3, :C4]
+play [:C4, :C3]
sleep 1
# Bars and Beats
| Add comment as to where first set of notes came from in the text
|
diff --git a/hero_spec.rb b/hero_spec.rb
index abc1234..def5678 100644
--- a/hero_spec.rb
+++ b/hero_spec.rb
@@ -1,5 +1,9 @@ require './hero'
describe Hero do
-
+ it "has a capitalized name" do
+ hero = Hero.new 'mike'
+
+ expect(hero.name).to eq 'Mike' # это hero.name == 'Mike'
+ end
end | Add test for capitalized letter
|
diff --git a/lib/lims-laboratory-app/laboratory/tube/bulk_create_tube.rb b/lib/lims-laboratory-app/laboratory/tube/bulk_create_tube.rb
index abc1234..def5678 100644
--- a/lib/lims-laboratory-app/laboratory/tube/bulk_create_tube.rb
+++ b/lib/lims-laboratory-app/laboratory/tube/bulk_create_tube.rb
@@ -14,7 +14,7 @@ def _call_in_session(session)
result = []
tubes.each do |parameters|
- result << _create(parameters[:type], parameters[:max_volume], parameters[:aliquots], session)
+ result << _create(parameters["type"], parameters["max_volume"], parameters["aliquots"], session)
end
{:tubes => result.map { |e| e[:tube] }}
| Use string instead of symbols
|
diff --git a/lib/devise_kerberos_authenticatable/kerberos_adapter.rb b/lib/devise_kerberos_authenticatable/kerberos_adapter.rb
index abc1234..def5678 100644
--- a/lib/devise_kerberos_authenticatable/kerberos_adapter.rb
+++ b/lib/devise_kerberos_authenticatable/kerberos_adapter.rb
@@ -5,7 +5,7 @@ module KerberosAdapter
def self.valid_credentials?(username, password)
if Rails.env.test? && username == 'test' && password == 'test' then
- true
+ return true
end
krb5 = Krb5.new
| Allow credentials in test env
|
diff --git a/lib/yandex/pdd/client.rb b/lib/yandex/pdd/client.rb
index abc1234..def5678 100644
--- a/lib/yandex/pdd/client.rb
+++ b/lib/yandex/pdd/client.rb
@@ -2,6 +2,8 @@
require 'yandex/pdd/client/domains'
require 'yandex/pdd/client/mailboxes'
+require 'yandex/pdd/client/maillists'
+require 'yandex/pdd/client/subscriptions'
module Yandex
module Pdd
@@ -10,6 +12,8 @@ include Yandex::Pdd::Client::Connection
include Yandex::Pdd::Client::Domains
include Yandex::Pdd::Client::Mailboxes
+ include Yandex::Pdd::Client::Maillists
+ include Yandex::Pdd::Client::Subscriptions
base_uri 'https://pddimp.yandex.ru'
format :json
| Support for maillists and subscription was enabled
|
diff --git a/backend/spree_backend.gemspec b/backend/spree_backend.gemspec
index abc1234..def5678 100644
--- a/backend/spree_backend.gemspec
+++ b/backend/spree_backend.gemspec
@@ -23,8 +23,7 @@
s.add_dependency 'jquery-rails', '~> 3.0.0'
s.add_dependency 'jquery-ui-rails', '~> 4.0.0'
- # Set to 3.4.5 until https://github.com/argerim/select2-rails/pull/51 is merged.
- s.add_dependency 'select2-rails', '= 3.4.5'
+ s.add_dependency 'select2-rails', '~> 3.4.7'
s.add_development_dependency 'email_spec', '~> 1.2.1'
end
| Update select2-rails now that it has been fixed.
|
diff --git a/db/data_migrations/20200204184925_update_geographical_area_description.rb b/db/data_migrations/20200204184925_update_geographical_area_description.rb
index abc1234..def5678 100644
--- a/db/data_migrations/20200204184925_update_geographical_area_description.rb
+++ b/db/data_migrations/20200204184925_update_geographical_area_description.rb
@@ -0,0 +1,23 @@+TradeTariffBackend::DataMigrator.migration do
+ name "Manual update of the description of the geographical area F006"
+
+ GEOGRAPHICAL_AREA_ID = "F006"
+ OLD_DESCRIPTION = nil
+ NEW_DESCRIPTION = "Common Agricultural Policy and Rural Payments Agency"
+
+ up do
+ applicable {
+ GeographicalAreaDescription.where(geographical_area_id: GEOGRAPHICAL_AREA_ID, description: OLD_DESCRIPTION).any?
+ }
+
+ apply {
+ description = GeographicalAreaDescription.where(geographical_area_id: GEOGRAPHICAL_AREA_ID, description: OLD_DESCRIPTION).last
+ description.update(description: NEW_DESCRIPTION)
+ }
+ end
+
+ down do
+ applicable { false }
+ apply { }
+ end
+end
| Add data migration to fix F006 geographical area description
|
diff --git a/lib/cloudflare.rb b/lib/cloudflare.rb
index abc1234..def5678 100644
--- a/lib/cloudflare.rb
+++ b/lib/cloudflare.rb
@@ -22,6 +22,6 @@
module CloudFlare
def self.connection(api_key, email = nil)
- Connection.new(api_key, email = nil)
+ Connection.new(api_key, email)
end
end
| Fix CloudFlare.connection to pass in email address
CloudFlare.connection would nil out the email address, even if
it was passed in. This commit fixes that behavior.
|
diff --git a/lib/guard/ronn.rb b/lib/guard/ronn.rb
index abc1234..def5678 100644
--- a/lib/guard/ronn.rb
+++ b/lib/guard/ronn.rb
@@ -3,14 +3,14 @@ require 'ronn'
module Guard
- class Ronn < Guard
+ class Ronn < Plugin
require 'guard/ronn/runner'
require 'guard/ronn/inspector'
require 'guard/ronn/notifier'
attr_reader :runner
- def initialize(watchers = [], options = {})
+ def initialize(options = {})
super
@runner = Runner.new(@options)
end
| Update plugin to match Guard 2.0.0 changes
|
diff --git a/lib/jade-rails.rb b/lib/jade-rails.rb
index abc1234..def5678 100644
--- a/lib/jade-rails.rb
+++ b/lib/jade-rails.rb
@@ -7,14 +7,16 @@ class << self
def compile(source, options = {})
- jade_js = File.read(File.expand_path('../../vendor/assets/javascripts/jade/jade.js', __FILE__))
- context = ExecJS.compile <<-JS
- var window = {};
- #{jade_js}
- var jade = window.jade;
- JS
+ @@context ||= begin
+ jade_js = File.read(File.expand_path('../../vendor/assets/javascripts/jade/jade.js', __FILE__))
+ ExecJS.compile <<-JS
+ var window = {};
+ #{jade_js}
+ var jade = window.jade;
+ JS
+ end
source = source.read if source.respond_to?(:read)
- context.eval("jade.compileClient(#{source.to_json}, #{options.to_json})")
+ @@context.eval("jade.compileClient(#{source.to_json}, #{options.to_json})")
end
end
| Jade.compile: Improve performance by memoizing context.
|
diff --git a/lib/mult_table.rb b/lib/mult_table.rb
index abc1234..def5678 100644
--- a/lib/mult_table.rb
+++ b/lib/mult_table.rb
@@ -24,15 +24,18 @@ end
end
- # @return #line(0)
+ # Same as calling #line(0)
+ #
+ # @return [Array<Integer>]
def header_line
self.line(0)
end
# Generate all lines in the multiplication table (except for the header)
#
- # @return [Array<Integer, Array<Integer>] an array of lines, each line
- # consisting of the multiplier and an array of products of that multiplier
+ # @return [Array<Integer, Array<Integer>>] an array of lines, each line
+ # consisting of the multiplier and an array of products of that
+ # multiplier
def lines
1.upto(multipliers.length).collect do |i|
[self.multipliers[i - 1], self.line(i)]
@@ -40,7 +43,7 @@ end
# @return [Integer] the largest product in the table, i.e. the square of
- # the last (therefore largest) multiplier
+ # the last (therefore largest) multiplier
def largest_product
self.multipliers.last ** 2
end
| Fix documentation glitches in MultTable
|
diff --git a/db/migrate/20090517111301_update_text_columns_to_medium_text.rb b/db/migrate/20090517111301_update_text_columns_to_medium_text.rb
index abc1234..def5678 100644
--- a/db/migrate/20090517111301_update_text_columns_to_medium_text.rb
+++ b/db/migrate/20090517111301_update_text_columns_to_medium_text.rb
@@ -0,0 +1,9 @@+class UpdateTextColumnsToMediumText < ActiveRecord::Migration
+ def self.up
+ execute "ALTER TABLE tickets MODIFY data MEDIUMTEXT"
+ end
+
+ def self.down
+ execute "ALTER TABLE tickets MODIFY data TEXT"
+ end
+end
| Increase the blob size, since some tickets get really big...
|
diff --git a/db/migrate/20150212232559_add_accepted_terms_of_use_to_users.rb b/db/migrate/20150212232559_add_accepted_terms_of_use_to_users.rb
index abc1234..def5678 100644
--- a/db/migrate/20150212232559_add_accepted_terms_of_use_to_users.rb
+++ b/db/migrate/20150212232559_add_accepted_terms_of_use_to_users.rb
@@ -1,5 +1,5 @@ class AddAcceptedTermsOfUseToUsers < ActiveRecord::Migration
def change
- add_column :users, :country, :string
+ add_column :users, :accepted_terms_of_use, :boolean
end
end
| Use the correct field in the migration
|
diff --git a/db/migrate/20220311192934_change_content_shares_name_to_text.rb b/db/migrate/20220311192934_change_content_shares_name_to_text.rb
index abc1234..def5678 100644
--- a/db/migrate/20220311192934_change_content_shares_name_to_text.rb
+++ b/db/migrate/20220311192934_change_content_shares_name_to_text.rb
@@ -0,0 +1,27 @@+# frozen_string_literal: true
+
+#
+# Copyright (C) 2022 - present Instructure, Inc.
+#
+# This file is part of Canvas.
+#
+# Canvas is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Affero General Public License as published by the Free
+# Software Foundation, version 3 of the License.
+#
+# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Affero General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+class ChangeContentSharesNameToText < ActiveRecord::Migration[6.0]
+ tag :predeploy
+
+ def change
+ change_column :content_shares, :name, :text
+ end
+end
| Change type of content_shares.name to text
closes LS-3036
flag = none
Change-Id: Idf26d753b0bced34f33dc0619b693a93df8e6dd7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/286935
Tested-by: Service Cloud Jenkins <9144042a601061f88f1e1d7a1753ea3e2972119d@instructure.com>
Reviewed-by: Isaac Moore <258108225390078ef47d1319acab49ad7948abf1@instructure.com>
Reviewed-by: Robin Kuss <0b206b54367b2de0334896ea45826f0e3194bd35@instructure.com>
QA-Review: Robin Kuss <0b206b54367b2de0334896ea45826f0e3194bd35@instructure.com>
Migration-Review: Jeremy Stanley <b3f594e10a9edcf5413cf1190121d45078c62290@instructure.com>
Product-Review: Jackson Howe <318c10a818c1b1f2ec50cdcb1827b2c6c5ebd7dc@instructure.com>
|
diff --git a/messaging.gemspec b/messaging.gemspec
index abc1234..def5678 100644
--- a/messaging.gemspec
+++ b/messaging.gemspec
@@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'evt-messaging'
- s.version = '0.29.0.5'
+ s.version = '0.29.0.6'
s.summary = 'Common primitives for platform-specific messaging implementations for Eventide'
s.description = ' '
| Package version is increased from 0.29.0.5 to 0.29.0.6
|
diff --git a/lib/licence_location_identifier.rb b/lib/licence_location_identifier.rb
index abc1234..def5678 100644
--- a/lib/licence_location_identifier.rb
+++ b/lib/licence_location_identifier.rb
@@ -8,6 +8,6 @@ end
def self.authority_types
- ["DIS","LBO","UTA","CTY","LGD"]
+ ["DIS","LBO","UTA","CTY","LGD","MTD"]
end
end
| Add MTD to supported licence authority types
|
diff --git a/src/cookbooks/resource_container_host_linux/spec/firewall_spec.rb b/src/cookbooks/resource_container_host_linux/spec/firewall_spec.rb
index abc1234..def5678 100644
--- a/src/cookbooks/resource_container_host_linux/spec/firewall_spec.rb
+++ b/src/cookbooks/resource_container_host_linux/spec/firewall_spec.rb
@@ -9,5 +9,14 @@ it 'installs the default firewall' do
expect(chef_run).to install_firewall('default')
end
+
+ it 'opens the SSH TCP port' do
+ expect(chef_run).to create_firewall_rule('ssh').with(
+ command: :allow,
+ dest_port: 22,
+ direction: :in,
+ protocol: :tcp
+ )
+ end
end
end
| Verify that the SSH port is open by default
references #2
|
diff --git a/lib/pling/gateway/action_mailer.rb b/lib/pling/gateway/action_mailer.rb
index abc1234..def5678 100644
--- a/lib/pling/gateway/action_mailer.rb
+++ b/lib/pling/gateway/action_mailer.rb
@@ -37,10 +37,10 @@ private
def default_configuration
- {
+ super.merge({
:html => true,
:text => true
- }
+ })
end
end
| Include default configuration values from Pling::Gateway::Base
|
diff --git a/spec/defines/volume_spec.rb b/spec/defines/volume_spec.rb
index abc1234..def5678 100644
--- a/spec/defines/volume_spec.rb
+++ b/spec/defines/volume_spec.rb
@@ -0,0 +1,56 @@+require 'spec_helper'
+
+describe 'gluster::volume', type: :define do
+ let(:title) { 'storage1' }
+ let(:params) do
+ {
+ replica: 2,
+ bricks: [
+ 'srv1.local:/export/brick1/brick',
+ 'srv2.local:/export/brick1/brick',
+ 'srv1.local:/export/brick2/brick',
+ 'srv2.local:/export/brick2/brick'
+ ],
+ options: [
+ 'server.allow-insecure: on',
+ 'nfs.ports-insecure: on'
+ ]
+ }
+ end
+
+ describe 'strict variables tests' do
+ describe 'missing gluster_binary fact' do
+ it { is_expected.to compile }
+ end
+
+ describe 'missing gluster_peer_list fact' do
+ let(:facts) do
+ {
+ gluster_binary: '/usr/sbin/gluster'
+ }
+ end
+ it { is_expected.to compile }
+ end
+
+ describe 'missing gluster_volume_list fact' do
+ let(:facts) do
+ {
+ gluster_binary: '/usr/sbin/gluster',
+ gluster_peer_list: 'peer1.example.com,peer2.example.com'
+ }
+ end
+ it { is_expected.to compile }
+ end
+
+ describe 'with all facts' do
+ let(:facts) do
+ {
+ gluster_binary: '/usr/sbin/gluster',
+ gluster_peer_list: 'peer1.example.com,peer2.example.com',
+ gluster_volume_list: 'gl1.example.com:/glusterfs/backup,gl2.example.com:/glusterfs/backup'
+ }
+ end
+ it { is_expected.to compile }
+ end
+ end
+end
| Add very basic spec test for gluster::volume
Not much to see, but better than nothing.
|
diff --git a/spec/features/login_spec.rb b/spec/features/login_spec.rb
index abc1234..def5678 100644
--- a/spec/features/login_spec.rb
+++ b/spec/features/login_spec.rb
@@ -2,6 +2,7 @@
feature 'Login page' do
scenario 'when visiting /login' do
+ pending
visit admin_login_path
expect(page).to have_content('Iniciar sesión con GitHub')
| Mark failing spec feature as pending
|
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index abc1234..def5678 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -18,10 +18,20 @@ end
describe 'when user position is not nobody' do
- let(:user) { FactoryGirl.create :user, :chief }
- let(:project_user) { FactoryGirl.build :project_user, user: user }
- it { expect(project_user.valid?).to eq(true) }
- it { expect{ project.users << user }.to change{ project.users.count } }
+ let(:users) do
+ availables = User.positions
+ availables.delete(:nobody)
+ availables.map do |position, number|
+ FactoryGirl.create(:user, position.to_sym)
+ end
+ end
+
+ it 'should be pused' do
+ users.each do |user|
+ expect(FactoryGirl.build(:project_user, user: user).valid?).to eq(true)
+ expect{ project.users << user }.to change{ project.users.count }
+ end
+ end
end
end
end
| Add testd for all postitions
|
diff --git a/spec/setup/active_record.rb b/spec/setup/active_record.rb
index abc1234..def5678 100644
--- a/spec/setup/active_record.rb
+++ b/spec/setup/active_record.rb
@@ -5,23 +5,23 @@ ActiveRecord::Migration.verbose = false
ActiveRecord::Schema.define do
-
create_table :delayed_jobs, :force => true do |table|
table.integer :priority, :default => 0
table.integer :attempts, :default => 0
table.text :handler
- table.string :last_error
+ table.text :last_error
table.datetime :run_at
table.datetime :locked_at
+ table.datetime :failed_at
table.string :locked_by
- table.datetime :failed_at
table.timestamps
end
+
+ add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority'
create_table :stories, :force => true do |table|
table.string :text
end
-
end
# Purely useful for test cases...
| Add index to AR spec setup
|
diff --git a/app/controllers/api/releases_controller.rb b/app/controllers/api/releases_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/releases_controller.rb
+++ b/app/controllers/api/releases_controller.rb
@@ -13,7 +13,7 @@ return
end
- if release.version == current_device.fbos_version
+ if release.version == current_device_version
sorry "Already on the latest version.", 422
return
end
@@ -34,5 +34,18 @@ def release
@release ||= Release.order(created_at: :desc).find_by!(show_params)
end
+
+ # current_device.fbos_version follows this format:
+ # 10.1.0.pre.RC1 10.1.2
+ #
+ # release.version follows this format:
+ # 11.0.2-rc2 12.0.0-rc4
+ #
+ # This method helps unify the two formats for easier comparison.
+ def current_device_version
+ (current_device.fbos_version || "")
+ .downcase
+ .gsub(".pre.", "-")
+ end
end
end
| Fix bug where release.version format did not match current_device.fbos_version
|
diff --git a/enom.gemspec b/enom.gemspec
index abc1234..def5678 100644
--- a/enom.gemspec
+++ b/enom.gemspec
@@ -10,6 +10,7 @@ s.has_rdoc = false
s.add_dependency "httparty", "~> 0.10.0"
s.add_dependency "public_suffix", "~> 1.2.0"
+ s.add_development_dependency "test-unit"
s.add_development_dependency "shoulda"
s.add_development_dependency "fakeweb"
s.add_development_dependency "rake", "~> 0.9"
| Add test-unit as dev dependency
|
diff --git a/data/hooks/post-receive.rb b/data/hooks/post-receive.rb
index abc1234..def5678 100644
--- a/data/hooks/post-receive.rb
+++ b/data/hooks/post-receive.rb
@@ -1,18 +1,6 @@ # A bit of ruby comments
oldrev, newrev, refname = gets.split
-
-if refname.split("/").last != "master"
- puts "You did not push to master, so water doesn't process your commits"
- exit 0
-end
-
-commits = `git rev-list #{oldrev}..#{newrev}`.split("\n")
-submit_hash = nil
-commits.each { |commit_hash|
- msg = `git show --format=format:"%s" #{commit_hash}`.split("\n").first
- submit_hash ||= commit_hash if msg.include? "#submit"
-}
# I made this banner using the unix `banner` command
puts %Q{
@@ -26,6 +14,18 @@ # # # # # ###### # #
+}
+
+if refname.split("/").last != "master"
+ puts "You did not push to master, so water doesn't process your commits"
+ exit 0
+end
+
+commits = `git rev-list #{oldrev}..#{newrev}`.split("\n")
+submit_hash = nil
+commits.each { |commit_hash|
+ msg = `git show --format=format:"%s" #{commit_hash}`.split("\n").first
+ submit_hash ||= commit_hash if msg.include? "#submit"
}
unless submit_hash
| Print water before first in git CLI
|
diff --git a/middleman-bootstrap-navbar.gemspec b/middleman-bootstrap-navbar.gemspec
index abc1234..def5678 100644
--- a/middleman-bootstrap-navbar.gemspec
+++ b/middleman-bootstrap-navbar.gemspec
@@ -21,6 +21,7 @@ gem.test_files = gem.files.grep(%r(^(test|spec|features)/))
gem.require_paths = ['lib']
+ gem.add_development_dependency 'rake', '>= 10.0.0'
gem.add_development_dependency 'rspec', '~> 2.13'
gem.add_development_dependency 'rspec-html-matchers', '~> 0.4.1'
gem.add_development_dependency 'guard-rspec', '~> 3.0'
| Add Rake as dev dependency
|
diff --git a/db/migrate/20150109162748_change_activity_log_activity_to_long_text.rb b/db/migrate/20150109162748_change_activity_log_activity_to_long_text.rb
index abc1234..def5678 100644
--- a/db/migrate/20150109162748_change_activity_log_activity_to_long_text.rb
+++ b/db/migrate/20150109162748_change_activity_log_activity_to_long_text.rb
@@ -0,0 +1,5 @@+class ChangeActivityLogActivityToLongText < ActiveRecord::Migration
+ def change
+ change_column :activity_logs, :activity, :text, :limit => 2147483647, :default => nil
+ end
+end
| Change activity_log.activity to longtext to handle long process logs. mirrors uploads table
|
diff --git a/db/migrate/20150217095648_remove_null_constraints_from_spree_tables.rb b/db/migrate/20150217095648_remove_null_constraints_from_spree_tables.rb
index abc1234..def5678 100644
--- a/db/migrate/20150217095648_remove_null_constraints_from_spree_tables.rb
+++ b/db/migrate/20150217095648_remove_null_constraints_from_spree_tables.rb
@@ -0,0 +1,13 @@+class RemoveNullConstraintsFromSpreeTables < ActiveRecord::Migration
+ def up
+ change_column :spree_properties, :presentation, :string, null: true
+ change_column :spree_taxonomies, :name, :string, null: true
+ change_column :spree_taxons, :name, :string, null: true
+ end
+
+ def down
+ change_column :spree_properties, :presentation, :string, null: false
+ change_column :spree_taxonomies, :name, :string, null: false
+ change_column :spree_taxons, :name, :string, null: false
+ end
+end
| Remove the null constraint on several spree tables
As with globalize 5.0 the original table column won't be updated
anymore (https://github.com/globalize/globalize/pull/396#issuecomment-70192861),
we need to remove the null constraints from the `spree_taxonomies.name`
`spree_taxons.name` and `spree_properties.presentation` columns.
Otherwise writing to the database fails with NOT NULL errors.
Fixes #513
|
diff --git a/lib/ditty/cli.rb b/lib/ditty/cli.rb
index abc1234..def5678 100644
--- a/lib/ditty/cli.rb
+++ b/lib/ditty/cli.rb
@@ -11,6 +11,7 @@ include Thor::Actions
desc 'server', 'Start the Ditty server'
+ require './application' if File.exists?('application.rb')
def server
# Ensure the token files are present
Rake::Task['ditty:generate_tokens'].invoke
| fix: Load the application if present
|
diff --git a/backend/app/models/article.rb b/backend/app/models/article.rb
index abc1234..def5678 100644
--- a/backend/app/models/article.rb
+++ b/backend/app/models/article.rb
@@ -1,7 +1,7 @@ class Article < ActiveRecord::Base
include Utils
- default_scope order('created_at DESC')
+ default_scope { order('created_at DESC') }
belongs_to :user
has_many :recommendations, :dependent => :destroy
| Use Default Scope with a block
|
diff --git a/lib/npmdc/cli.rb b/lib/npmdc/cli.rb
index abc1234..def5678 100644
--- a/lib/npmdc/cli.rb
+++ b/lib/npmdc/cli.rb
@@ -15,7 +15,7 @@ default: Npmdc::Config::DEPEPENDENCY_TYPES
method_option :format, aliases: [:f],
desc: 'Output format',
- enum: Npmdc::Formatter::FORMATTERS.keys
+ enum: Npmdc::Formatter::FORMATTERS.keys.map(&:to_s)
def check
Npmdc.call(options)
| Fix --format available options to be strings instead of symbols
|
diff --git a/app/controllers/alexa_interface_controller.rb b/app/controllers/alexa_interface_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/alexa_interface_controller.rb
+++ b/app/controllers/alexa_interface_controller.rb
@@ -2,14 +2,18 @@ def recommend
respond_to do |f|
f.json {
- case params["request"]["intent"]["name"]
+ if params["request"]["intent"]
+ case params["request"]["intent"]["name"]
- when "WingItIntent"
+ when "WingItIntent"
+ render json: create_response(get_location)
+ when "SetAddressIntent"
+ response = AlexaRubykit::Response.new()
+ response.add_speech("hit address intent")
+ render json: response.build_response
+ end
+ else
render json: create_response(get_location)
- when "SetAddressIntent"
- response = AlexaRubykit.new()
- response.add_speech("hit address intent")
- render json: response.build_response
end
}
end
| Add catch for no intent in request and fix syntax error in creating new request with AlexaRubykit
|
diff --git a/lib/allrecipes/page_parser.rb b/lib/allrecipes/page_parser.rb
index abc1234..def5678 100644
--- a/lib/allrecipes/page_parser.rb
+++ b/lib/allrecipes/page_parser.rb
@@ -23,7 +23,7 @@ end
def recipes_grid
- @page.search(recipes_grid_class)[1]
+ @page.search(recipes_grid_class)[-1]
end
def recipe_link(info)
| Use proper index for recipes grid.
Always choose the last one, in order to skip both collection and staff picks
|
diff --git a/refuckulate.rb b/refuckulate.rb
index abc1234..def5678 100644
--- a/refuckulate.rb
+++ b/refuckulate.rb
@@ -10,7 +10,7 @@
def log(msg)
@log_count += 1
- sleep(0.3)
+ sleep(0.7)
puts "[CMKREF #{@log_count}] #{msg}"
end
end
@@ -27,6 +27,27 @@ log "Checking to see if your project is totally fucked"
end
+def cmd(msg)
+ puts "==> #{msg}"
+ system msg
+end
+
+def throw_out(ext)
+ cmd "find . -regextype posix-egrep -regex \".*\\.(#{ext})$\" -delete"
+end
+
+
+def refuckulate
+ log "Deleting this stupid Lists.txt bullshit"
+ cmd "rm CMakeLists.txt"
+ log "What kind of fucked up bullshit did you even have in there?"
+ throw_out "c"
+ log "Those weren't gonna compile anyway"
+ throw_out "cpp"
+ log "Cory! Trevor! Get in there and throw out the rest of this shit"
+ throw_out "f|f77|F|py|pl|C|cxx|sh"
+end
+
def main
@logger = Logger.new
banner
@@ -35,6 +56,7 @@ if is_cmake?
log "Yup, found CMakeLists.txt"
log "Your project is fucked in the head."
+ refuckulate
else
log "Okay, move along. Nothing here to see."
end
| Throw away unneeded CMake artifacts
|
diff --git a/lib/sastrawi/stemmer/context/visitor/prefix_disambiguator.rb b/lib/sastrawi/stemmer/context/visitor/prefix_disambiguator.rb
index abc1234..def5678 100644
--- a/lib/sastrawi/stemmer/context/visitor/prefix_disambiguator.rb
+++ b/lib/sastrawi/stemmer/context/visitor/prefix_disambiguator.rb
@@ -17,10 +17,17 @@ @disambiguators.each do |disambiguator|
result = disambiguator.disambiguate(context.current_word)
- next if context.dictionary.include?(result)
+ break if context.dictionary.contains?(result)
end
return if result.nil?
+
+ removed_part = context.current_word.sub(result, '')
+
+ removal = Removal.new(self, context.current_word, result, removed_part, 'DP')
+
+ context.add_removal(removal)
+ context.current_word = result
end
def add_disambiguators(disambiguators)
| Fix missing part of implementation of "PrefixDisambiguator" class
|
diff --git a/lib/deep_cover/node/module.rb b/lib/deep_cover/node/module.rb
index abc1234..def5678 100644
--- a/lib/deep_cover/node/module.rb
+++ b/lib/deep_cover/node/module.rb
@@ -23,13 +23,15 @@ check_completion
has_tracker :body_entry
has_child const: {const: ModuleName}
- has_child body: [Node, nil], rewrite: '%{body_entry_tracker};%{node}',
+ has_child body: Node,
+ can_be_empty: -> { base_node.loc.end.begin },
+ rewrite: '%{body_entry_tracker};nil;%{node}',
is_statement: true,
flow_entry_count: :body_entry_tracker_hits
executed_loc_keys :keyword, :end
def execution_count
- body ? body_entry_tracker_hits : flow_completion_count
+ body_entry_tracker_hits
end
end
@@ -38,20 +40,23 @@ has_tracker :body_entry
has_child const: {const: ModuleName}
has_child inherit: [Node, nil] # TODO
- has_child body: [Node, nil], rewrite: '%{body_entry_tracker};%{node}',
+ has_child body: Node,
+ can_be_empty: -> { base_node.loc.end.begin },
+ rewrite: '%{body_entry_tracker};%{node}',
is_statement: true,
flow_entry_count: :body_entry_tracker_hits
executed_loc_keys :keyword, :end
def execution_count
- body ? body_entry_tracker_hits : flow_completion_count
+ body_entry_tracker_hits
end
end
# class << foo
class Sclass < Node
has_child object: Node
- has_child body: [Node, nil],
+ has_child body: Node,
+ can_be_empty: -> { base_node.loc.end.begin },
is_statement: true
# TODO
end
| Use can_be_empty for Module and Class
|
diff --git a/definitions/bundle_config.rb b/definitions/bundle_config.rb
index abc1234..def5678 100644
--- a/definitions/bundle_config.rb
+++ b/definitions/bundle_config.rb
@@ -1,5 +1,8 @@ define :bundle_config do
execute "bundle config #{params[:name]}" do
user node['current_user']
+ environment({
+ 'PATH' => "#{node['etc']['passwd'][node['current_user']]['dir']}/.rbenv/shims"
+ })
end
end
| Use bundle from user's rbenv
|
diff --git a/dayoneme.gemspec b/dayoneme.gemspec
index abc1234..def5678 100644
--- a/dayoneme.gemspec
+++ b/dayoneme.gemspec
@@ -18,7 +18,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
- spec.add_development_dependency "bundler", "~> 1.6"
+ spec.add_development_dependency "bundler", "1.6.0.rc2"
spec.add_development_dependency "rake"
- spec.add_development_dependency "rspec"
+ spec.add_development_dependency "rspec", '3.0.0.beta2'
end
| Use latest bundler and rspec gems
|
diff --git a/tasks/java.rake b/tasks/java.rake
index abc1234..def5678 100644
--- a/tasks/java.rake
+++ b/tasks/java.rake
@@ -2,15 +2,28 @@
desc "Create the java installation package"
task :java do
- pkg_name = "rubyrep-#{RR::VERSION::STRING}"
+ jruby_version='9.1.10.0'
+ pkg_name = "rubyrep-#{RR::VERSION}"
system "rm -rf /tmp/#{pkg_name}"
system "mkdir /tmp/#{pkg_name}"
system "git archive master |tar -x -C /tmp/#{pkg_name}"
- system "mkdir -p /tmp/#{pkg_name}/jruby"
- system "cp -r #{JRUBY_HOME}/* /tmp/#{pkg_name}/jruby/"
- system "cd /tmp/#{pkg_name}/jruby; rm -rf samples share/ri lib/ruby/gems/1.8/doc"
- system "chmod a+x /tmp/#{pkg_name}/rubyrep"
+ system "curl -o /tmp/#{pkg_name}/jruby.tar.gz https://s3.amazonaws.com/jruby.org/downloads/#{jruby_version}/jruby-bin-#{jruby_version}.tar.gz"
+ system "tar -C /tmp/#{pkg_name} -xzf /tmp/#{pkg_name}/jruby.tar.gz"
+ system "mv /tmp/#{pkg_name}/jruby-#{jruby_version} /tmp/#{pkg_name}/jruby"
+ system "rm /tmp/#{pkg_name}/jruby.tar.gz"
+ system %[
+ cd /tmp/#{pkg_name}
+ export PATH=`pwd`/jruby/bin:$PATH
+ unset GEM_HOME
+ unset GEM_PATH
+ gem install activerecord -v 4.2.8
+ gem install jdbc-mysql -v 5.1.42
+ gem install jdbc-postgres -v 9.4.1206
+ gem install activerecord-jdbcmysql-adapter -v 1.3.23
+ gem install activerecord-jdbcpostgresql-adapter -v 1.3.23
+ gem install awesome_print -v 1.7.0
+ ]
system "cd /tmp; rm -f #{pkg_name}.zip; zip -r #{pkg_name}.zip #{pkg_name} >/dev/null"
system "mkdir -p pkg"
system "cp /tmp/#{pkg_name}.zip pkg"
| Update the jruby installation package generator
Updates:
* works with current version of rubyrep
* adds isolation from existing ruby installations
* builds the jruby installation package from scratch including
jruby download & gem installation
|
diff --git a/sorting.rb b/sorting.rb
index abc1234..def5678 100644
--- a/sorting.rb
+++ b/sorting.rb
@@ -1,4 +1,4 @@-class Array
+module Enumerable
def quicksort
return self if self.size <= 1
pivot = self.shift
| Extend Enumerable instead of Array
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.