diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/semian.gemspec b/semian.gemspec
index abc1234..def5678 100644
--- a/semian.gemspec
+++ b/semian.gemspec
@@ -16,7 +16,7 @@ s.email = 'scott.francis@shopify.com'
s.license = 'MIT'
- s.files = `git ls-files`.split("\n")
+ s.files = Dir['{lib,ext}/**/**/*.{rb,h,c}']
s.extensions = ['ext/semian/extconf.rb']
s.add_development_dependency 'rake-compiler', '~> 0.9'
s.add_development_dependency 'rake', '< 11.0'
|
Use glob instead of git for gemspec file list
|
diff --git a/lib/setebos/config.rb b/lib/setebos/config.rb
index abc1234..def5678 100644
--- a/lib/setebos/config.rb
+++ b/lib/setebos/config.rb
@@ -13,7 +13,7 @@ # Config.parse(./setebos.yml)
# # => Hash
#
- # Returns an HashWithIndifferentAccess.
+ # Returns an HashWithIndifferentAccess or nil.
def self.parse(path)
config = YAML.load(
ERB.new(
@@ -22,5 +22,7 @@ )
HashWithIndifferentAccess.new(config)
+ rescue
+ nil
end
end
|
Config: Add a rescue if error.
|
diff --git a/lib/tasks/travis.rake b/lib/tasks/travis.rake
index abc1234..def5678 100644
--- a/lib/tasks/travis.rake
+++ b/lib/tasks/travis.rake
@@ -1,2 +1,11 @@-task :travis => %w[check db:drop db:migrate spec:all js:test js:lint spec:coverage:ensure]
+task :travis => %w[
+ check
+ db:drop
+ db:migrate
+ tmp:create
+ spec:all
+ js:test
+ js:lint
+ spec:coverage:ensure
+]
|
Create tmp dirs on Travis.
|
diff --git a/lib/tasks/warmup.rake b/lib/tasks/warmup.rake
index abc1234..def5678 100644
--- a/lib/tasks/warmup.rake
+++ b/lib/tasks/warmup.rake
@@ -1,11 +1,15 @@ namespace :db_memoize do
- desc "generates memoized values (pass e.g. 'class=Product methods=to_document,to_hash')"
+ desc "generates memoized values (pass e.g. 'CLASS=Product [ METHODS=to_document,to_hash ]')"
task warmup: :environment do
require 'ruby-progressbar'
- klass_name = ENV['class']
- methods = ENV['methods'].split(',')
+ klass_name = ENV['class'] || ENV['CLASS'] || raise('Missing CLASS environment value')
klass = klass_name.constantize
+
+ methods = ENV['methods'] || ENV['METHODS']
+ methods = methods.split(',') if methods
+ methods ||= klass.db_memoized_methods.map(&:to_s)
+
count = klass.count
progressbar = ProgressBar.create(
@@ -17,7 +21,8 @@ remainder_mark: '.'
)
- klass_name.constantize.find_each do |record|
+ klass.find_each do |record|
+ # calling each method will build the cached entries for these objects.
methods.each do |meth|
record.send(meth)
end
|
Adjust rake task to read UPPERCASE environment values
..since this is the default on unixes anyway. Also warms up *all*
memoized methods that are configured on that class by default.
|
diff --git a/config.rb b/config.rb
index abc1234..def5678 100644
--- a/config.rb
+++ b/config.rb
@@ -17,6 +17,7 @@ }
proxy "/faq/index.html", "faq.html"
+ignore "/test.html" if build?
(1..4).to_a.each do |i|
proxy "/examples/#{i}/index.html", "/examples/index.html", :locals => { :example => i }, ignore: true
|
Remove test suite from build
|
diff --git a/lib/vim-flavor/cli.rb b/lib/vim-flavor/cli.rb
index abc1234..def5678 100644
--- a/lib/vim-flavor/cli.rb
+++ b/lib/vim-flavor/cli.rb
@@ -35,6 +35,10 @@ ENV['HOME'].to_vimfiles_path
end
end
+
+ def self.exit_on_failure?
+ true
+ end
end
end
end
|
Exit with failure code for any error
|
diff --git a/lib/oshpark/ext.rb b/lib/oshpark/ext.rb
index abc1234..def5678 100644
--- a/lib/oshpark/ext.rb
+++ b/lib/oshpark/ext.rb
@@ -0,0 +1,121 @@+module OshparkArrayExtensions
+ def to_multipart key
+ prefix = "#{key}[]"
+ collect {|a| a.to_multipart(prefix)}.flatten.compact
+ end
+
+ def to_query key
+ prefix = "#{key}[]"
+ collect { |value| value.to_query(prefix) }.flatten.join '&'
+ end
+
+ def to_params
+ collect {|a| a.to_params }.flatten
+ end
+end
+
+module OshparkHashExtensions
+ def to_multipart key = nil
+ collect {|k, v| v.to_multipart(key ? "#{key}[#{k}]" : k)}.flatten.compact
+ end
+
+ def to_query key = nil
+ collect {|k, v| v.to_query(key ? "#{key}[#{k}]" : k)}.flatten.join '&'
+ end
+
+ def to_params
+ self
+ end
+end
+
+module OshparkStringExtensions
+ def to_multipart key
+ "Content-Disposition: form-data; name=\"#{key}\"\r\n\r\n" +
+ "#{self}\r\n"
+ end
+
+ def to_query key = nil
+ key ? URI.escape("#{key}=#{self}") : URI.escape(self)
+ end
+end
+
+module OshparkFileExtensions
+ def to_multipart key = nil
+ "Content-Disposition: form-data; name=\"#{key}\"; filename=\"#{File.basename(self.path)}\"\r\n" +
+ "Content-Transfer-Encoding: binary\r\n" +
+ "Content-Type: application/#{File.extname(self.path)}\r\n\r\n" +
+ "#{self.read}\r\n"
+ end
+end
+
+module OshparkFixnumExtensions
+ def to_query key = nil
+ key ? URI.escape("#{key}=#{self}") : URI.escape(self)
+ end
+end
+
+module OshparkFloatExtensions
+ def to_query key = nil
+ key ? URI.escape("#{key}=#{self}") : URI.escape(self)
+ end
+end
+
+module OshparkTrueClassExtensions
+ def to_multipart key
+ "Content-Disposition: form-data; name=\"#{key}\"\r\n\r\n" +
+ "1\r\n"
+ end
+end
+
+module OshparkFalseClassExtensions
+ def to_multipart key
+ "Content-Disposition: form-data; name=\"#{key}\"\r\n\r\n" +
+ "0\r\n"
+ end
+end
+
+module OshparkNilClassExtensions
+ def to_query key = nil
+ ""
+ end
+
+ def to_multipart key = nil
+ nil
+ end
+end
+
+class Array
+ include OshparkArrayExtensions
+end
+
+class Hash
+ include OshparkHashExtensions
+end
+
+class String
+ include OshparkStringExtensions
+end
+
+class File
+ include OshparkFileExtensions
+end
+
+class Fixnum
+ include OshparkFixnumExtensions
+end
+
+class Float
+ include OshparkFloatExtensions
+end
+
+class TrueClass
+ include OshparkTrueClassExtensions
+end
+
+class FalseClass
+ include OshparkFalseClassExtensions
+end
+
+class NilClass
+ include OshparkNilClassExtensions
+end
|
Add query params monkey patches.
|
diff --git a/lib/poke/window.rb b/lib/poke/window.rb
index abc1234..def5678 100644
--- a/lib/poke/window.rb
+++ b/lib/poke/window.rb
@@ -7,8 +7,8 @@ attr_accessor :paused
def initialize
- @width = WIDTH * GRID
- @height = HEIGHT * GRID
+ @width = WIDTH
+ @height = HEIGHT
super(@width, @height, false)
|
Update Window to use pixel dimensions
|
diff --git a/lib/pronto/haml.rb b/lib/pronto/haml.rb
index abc1234..def5678 100644
--- a/lib/pronto/haml.rb
+++ b/lib/pronto/haml.rb
@@ -26,7 +26,7 @@
def new_message(lint, line)
path = line.patch.delta.new_file[:path]
- Message.new(path, line, lint.severity, lint.message)
+ Message.new(path, line, lint.severity, lint.message, nil, self.class)
end
private
|
Add the runner class into the report message
|
diff --git a/lib/yarn/server.rb b/lib/yarn/server.rb
index abc1234..def5678 100644
--- a/lib/yarn/server.rb
+++ b/lib/yarn/server.rb
@@ -5,7 +5,7 @@
include Logging
- attr_accessor :host, :port, :socket
+ attr_accessor :host, :port, :socket, :workers
def initialize(app=nil,options={})
# merge given options with default values
@@ -20,13 +20,15 @@ @host, @port, @num_workers = opts[:host], opts[:port], opts[:workers]
$output, $debug = opts[:output], opts[:debug]
@socket = TCPServer.new(@host, @port)
+ @workers = []
+ trap("INT") { stop }
end
def start
log "Yarn started #{@num_workers} workers and is listening on #{@host}:#{@port}"
@num_workers.times do
- fork do
+ @workers << fork do
trap("INT") { exit }
loop do
handler ||= @app ? RackHandler.new(@app) : RequestHandler.new
@@ -38,7 +40,6 @@
# Waits here for all processes to exit
Process.waitall
- stop
end
def stop
|
Save worker pid's for better management
|
diff --git a/api/lib/spree/api/controller_setup.rb b/api/lib/spree/api/controller_setup.rb
index abc1234..def5678 100644
--- a/api/lib/spree/api/controller_setup.rb
+++ b/api/lib/spree/api/controller_setup.rb
@@ -21,9 +21,6 @@ include CanCan::ControllerAdditions
include Spree::Core::ControllerHelpers::Auth
- prepend_view_path Rails.root + "app/views"
- append_view_path File.expand_path("../../../app/views", File.dirname(__FILE__))
-
self.responder = Spree::Api::Responders::AppResponder
respond_to :json
end
|
Remove append_view_path from api ControllerSetup
That line was preventing us from overriding templates within other
application or extensions
Fixes #3450
|
diff --git a/lib/knife-cloudformation/utils/ssher.rb b/lib/knife-cloudformation/utils/ssher.rb
index abc1234..def5678 100644
--- a/lib/knife-cloudformation/utils/ssher.rb
+++ b/lib/knife-cloudformation/utils/ssher.rb
@@ -14,10 +14,13 @@ # @param ssh_opts [Hash]
# @return [String, NilClass]
def remote_file_contents(address, user, path, ssh_opts={})
+ if(path.to_s.strip.empty?)
+ raise ArgumentError.new 'No file path provided!'
+ end
require 'net/ssh'
content = ''
ssh_session = Net::SSH.start(address, user, ssh_opts)
- content = ssh.exec!("sudo cat #{path}")
+ content = ssh_session.exec!("sudo cat #{path}")
content.empty? ? nil : content
end
|
Add path check to prevent hang on cat
|
diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/welcome_controller.rb
+++ b/app/controllers/welcome_controller.rb
@@ -1,5 +1,7 @@ class WelcomeController < ApplicationController
- def index
-
+ def signin
+ if user_signed_in?
+ redirect_to home_path
+ end
end
end
|
Change method index to signin
|
diff --git a/lib/onebox/engine/github_gist_onebox.rb b/lib/onebox/engine/github_gist_onebox.rb
index abc1234..def5678 100644
--- a/lib/onebox/engine/github_gist_onebox.rb
+++ b/lib/onebox/engine/github_gist_onebox.rb
@@ -15,7 +15,7 @@ end
def to_html
- "<script src=\"http://gist.github.com/#{match[:sha]}.js\"></script>"
+ "<script src=\"//gist.github.com/#{match[:sha]}.js\"></script>"
end
private
|
Use schemaless URL for GitHub's gists
|
diff --git a/lib/rautomation/adapter/win_32/mouse.rb b/lib/rautomation/adapter/win_32/mouse.rb
index abc1234..def5678 100644
--- a/lib/rautomation/adapter/win_32/mouse.rb
+++ b/lib/rautomation/adapter/win_32/mouse.rb
@@ -25,9 +25,11 @@
def press
send_input down_event
+ send_input down_event
end
def release
+ send_input up_event
send_input up_event
end
|
Send press/release twice since the first event seems to be ignored
|
diff --git a/site-cookbooks/manchesterio/recipes/molly.rb b/site-cookbooks/manchesterio/recipes/molly.rb
index abc1234..def5678 100644
--- a/site-cookbooks/manchesterio/recipes/molly.rb
+++ b/site-cookbooks/manchesterio/recipes/molly.rb
@@ -5,6 +5,14 @@ directory "#{node.manchesterio.root}/compiled_media" do
user node.mollyproject.user
group node.mollyproject.user
+end
+
+%w(Flask-StatsD raven[flask]).each do | python_package |
+ python_pip python_package do
+ virtualenv node.mollyproject.install_root
+ user node.mollyproject.user
+ group node.mollyproject.user
+ end
end
%w(manchesterio.conf uisettings.py).each do | config_file |
|
Include additional Python dependencies for Molly
|
diff --git a/app/controllers/expenses_controller.rb b/app/controllers/expenses_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/expenses_controller.rb
+++ b/app/controllers/expenses_controller.rb
@@ -16,7 +16,8 @@
def create
find_user
- expense = @user.expenses.build(expenses_params)
+ params[:expense].each do |k, v|
+ expense = @user.expenses.build(expenses_params: v)
if !expense.save
flash[:error] = "Your expense must be greater than $0."
end
|
Change expense create method to accept multiple expenses
|
diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/messages_controller.rb
+++ b/app/controllers/messages_controller.rb
@@ -28,7 +28,7 @@ Analytics.track(user_id: current_user.id,
event: 'Sent New Message',
properties: { action: params['commit'] })
- redirect_to '/helpful', alert: "Added Response"
+ redirect_to '/helpful', alert: "Response Added"
else
Analytics.track(user_id: current_user.id, event: 'Had Message Send Problem')
redirect_to '/helpful', alert: "Problem"
|
Revert notification text change from merge
|
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
@@ -3,6 +3,7 @@ skip_before_action :authorize
def new
+ @user = current_user
end
def create
|
Make sure @user is set.
|
diff --git a/app/controllers/api/users/profile_controller.rb b/app/controllers/api/users/profile_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/users/profile_controller.rb
+++ b/app/controllers/api/users/profile_controller.rb
@@ -19,21 +19,23 @@
@profile = Profile.find_by!( user_id: params[:id].to_i )
- @profile.first_name = params[:first_name]
- @profile.last_name = params[:last_name]
- @profile.biography = params[:biography]
+ profileUpdates = params[:data][:profile]
+
+ @profile.first_name = profileUpdates[:firstName]
+ @profile.last_name = profileUpdates[:lastName]
+ @profile.biography = profileUpdates[:biography]
@profile.save
@nationality = Nationality.find_by!( profile_id: @profile.id )
- @nationality.nationality = params[:nationality]
+ @nationality.nationality = profileUpdates[:nationality]
@nationality.save
@city = City.find_by!( profile_id: @profile.id )
- @city.name = params[:city]
+ @city.name = profileUpdates[:city]
@city.save
@phone = Phone.find_by!( profile_id: @profile.id )
- @phone.number = params[:phone]
+ @phone.number = profileUpdates[:phone]
@phone.save
@jobs = Job.find_by( profile_id: @profile.id )
|
Edit de profile de user funcionando ok
|
diff --git a/test/helper.rb b/test/helper.rb
index abc1234..def5678 100644
--- a/test/helper.rb
+++ b/test/helper.rb
@@ -3,16 +3,16 @@ # Test coverage if enabled.
if ENV[ 'COVERAGE' ]
- require "simplecov"
+ require 'simplecov'
SimpleCov.start
end
begin
- require "codeclimate-test-reporter"
+ require 'codeclimate-test-reporter'
CodeClimate::TestReporter.start
- ENV[ 'COVERAGE' ] = "on"
+ ENV[ 'COVERAGE' ] = 'on'
rescue LoadError
-end
+end unless defined?( RUBY_ENGINE ) and RUBY_ENGINE == 'jruby'
# Setup helpers.
|
Disable coverage in JRuby tests.
|
diff --git a/app/helpers/s3_relay/uploads_helper.rb b/app/helpers/s3_relay/uploads_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/s3_relay/uploads_helper.rb
+++ b/app/helpers/s3_relay/uploads_helper.rb
@@ -5,7 +5,7 @@ file_field = file_field_tag(:file, opts.merge(class: "s3r-field"))
progress_table = content_tag(:table, "", class: "s3r-upload-list")
content = [file_field, progress_table].join
- parent_type = parent.class.to_s.downcase.underscore
+ parent_type = parent.class.to_s.underscore.downcase
content_tag(:div, raw(content),
{
|
Fix order of string casing.
|
diff --git a/RoundaboutKit.podspec b/RoundaboutKit.podspec
index abc1234..def5678 100644
--- a/RoundaboutKit.podspec
+++ b/RoundaboutKit.podspec
@@ -16,7 +16,7 @@ s.ios.deployment_target = '6.0'
s.osx.deployment_target = '10.8'
- s.source = { :git => "https://github.com/decarbonization/RoundaboutKit.git", :tag => version }
+ s.source = { :git => "git@github.com:TeamSidewinder/RoundaboutKit.git", :tag => version }
s.source_files = 'Classes', 'RoundaboutKit/*.{h,m}'
s.prefix_header_file = "RoundaboutKit/RoundaboutKit-Prefix.pch"
|
Update Podspec to point to LN repo
|
diff --git a/app/presenters/tree_builder_storage.rb b/app/presenters/tree_builder_storage.rb
index abc1234..def5678 100644
--- a/app/presenters/tree_builder_storage.rb
+++ b/app/presenters/tree_builder_storage.rb
@@ -24,8 +24,13 @@ end
def x_get_tree_custom_kids(object, count_only, options)
- return count_only ? 0 : [] if object[:id] != "global"
- objects = MiqSearch.where(:db => options[:leaf]).visible_to_all
+ objects = MiqSearch.where(:db => options[:leaf])
+ objects = case object[:id]
+ when "global" # Global filters
+ objects.visible_to_all
+ when "my" # My filters
+ objects.where(:search_type => "user", :search_key => User.current_user.userid)
+ end
count_only_or_objects(count_only, objects, "description")
end
end
|
Make visible My Filters in Datastores
fixing
https://bugzilla.redhat.com/show_bug.cgi?id=1398748
https://bugzilla.redhat.com/show_bug.cgi?id=1382768
Make created filters (not global) in Compute -> Infrastructure ->
-> Datastores visible under My Filters in accordion.
|
diff --git a/app/presenters/tree_builder_storage.rb b/app/presenters/tree_builder_storage.rb
index abc1234..def5678 100644
--- a/app/presenters/tree_builder_storage.rb
+++ b/app/presenters/tree_builder_storage.rb
@@ -7,7 +7,7 @@
def set_locals_for_render
locals = super
- locals.merge!(:autoload => true)
+ locals.merge!(:autoload => true, :allow_reselect => true)
end
def root_options
|
Allow reselect for nodes in TreeBuilderStorage
|
diff --git a/week-6/nested_data_solution.rb b/week-6/nested_data_solution.rb
index abc1234..def5678 100644
--- a/week-6/nested_data_solution.rb
+++ b/week-6/nested_data_solution.rb
@@ -0,0 +1,68 @@+# RELEASE 2: NESTED STRUCTURE GOLF
+# Hole 1
+# Target element: "FORE"
+
+array = [[1,2], ["inner", ["eagle", "par", ["FORE", "hook"]]]
+
+# attempts:
+# 1) array[1][2][0]
+# 2) array[1] => ["inner", ["eagle", "par", ["FORE", "hook"]]]
+#3) array[1][2] => nil
+#4) array[1][0] => "inner"
+#5) array[1][1][2] => ["FORE", "hook"]
+#6) array[1][1][2][0] => "FORE"
+
+
+# ============================================================
+
+# Hole 2
+# Target element: "congrats!"
+
+hash = {outer: {inner: {"almost" => {3 => "congrats!"}}}}
+
+# attempts:
+# 1)hash[:outer][:inner]["almost"][3] => "congrats!"
+
+
+# ============================================================
+
+
+# Hole 3
+# Target element: "finished"
+
+nested_data = {array: ["array", {hash: "finished"}]}
+
+# attempts:
+# nested_data[:array][1][:hash] => "finished"
+
+
+
+# ============================================================
+
+# RELEASE 3: ITERATE OVER NESTED STRUCTURES
+
+number_array = [5, [10, 15], [20,25,30], 35]
+
+#Base on the Ruby language, it is not a destructive way to attain it.
+modified = number_array.map {|x|
+ if x.kind_of?(Array)
+ x.map {|inner| inner += 5}
+ else
+ x += 5
+ end
+ }
+#Refractor:
+ modified = number_array.map {|x|
+ x.kind_of?(Array) ? x.map {|inner| inner += 5} : x + 5
+ }
+
+# Bonus:
+# did not work on it together
+startup_names = ["bit", ["find", "fast", ["optimize", "scope"]]]
+# Reflection:
+# • What are some general rules you can apply to nested arrays?
+# Same as the regular arrays, the difference is that you align the index for each of the nested arrays: array[1][1][2][0] will get you the value on index 0 of the 4th level, which was reached by going through the second index in the thirds level, which was reached by the first index of the second level which was reached by the first index at the first level.
+# • What are some ways you can iterate over nested arrays?
+# Using an each method and a kind_of?(Array). The latter means are you finding an array object in the each,
+# • Did you find any good new methods to implement or did you re-use one you were already familiar with? What was it and why did you decide that was a good option?
+# I wasn’t familiar with the kind_of? Method and my pair was. He took time to explain it to me. It was a good option because 1) it was given as an example, 2) it makes a lot of sense, it gets you to search for something in particular.
|
Add the Pairing exercise 6.5 bested arrays
|
diff --git a/spec/fixtures/rails_app/config/initializers/new_framework_defaults.rb b/spec/fixtures/rails_app/config/initializers/new_framework_defaults.rb
index abc1234..def5678 100644
--- a/spec/fixtures/rails_app/config/initializers/new_framework_defaults.rb
+++ b/spec/fixtures/rails_app/config/initializers/new_framework_defaults.rb
@@ -11,8 +11,5 @@ # Require `belongs_to` associations by default. Previous versions had false.
Rails.application.config.active_record.belongs_to_required_by_default = true
-# Do not halt callback chains when a callback returns false. Previous versions had true.
-ActiveSupport.halt_callback_chains_on_return_false = false
-
# Configure SSL options to enable HSTS with subdomains. Previous versions had false.
Rails.application.config.ssl_options = { hsts: { subdomains: true } }
|
Fix warning in fixture application
|
diff --git a/spec/helpers/application_helper/buttons/svc_catalog_provision_spec.rb b/spec/helpers/application_helper/buttons/svc_catalog_provision_spec.rb
index abc1234..def5678 100644
--- a/spec/helpers/application_helper/buttons/svc_catalog_provision_spec.rb
+++ b/spec/helpers/application_helper/buttons/svc_catalog_provision_spec.rb
@@ -0,0 +1,19 @@+describe ApplicationHelper::Button::SvcCatalogProvision do
+ let(:view_context) { setup_view_context_with_sandbox({}) }
+ let(:record) { FactoryGirl.create(:service_template, :resource_actions => resource_actions) }
+ let(:button) { described_class.new(view_context, {}, {'record' => record}, {}) }
+
+ describe '#calculate_properties' do
+ before { button.calculate_properties }
+
+ context 'when there is an Ordering Dialog available' do
+ let(:dialog) { FactoryGirl.create(:dialog) }
+ let(:resource_actions) { [FactoryGirl.create(:resource_action, :action => 'Provision', :dialog_id => dialog.id)] }
+ it_behaves_like 'an enabled button'
+ end
+ context 'when there is no Ordering Dialog available' do
+ let(:resource_actions) { [FactoryGirl.create(:resource_action, :action => 'OtherAction')] }
+ it_behaves_like 'a disabled button', 'No Ordering Dialog is available'
+ end
+ end
+end
|
Create spec examples for SvcCatalogProvision button class
|
diff --git a/app/models/album.rb b/app/models/album.rb
index abc1234..def5678 100644
--- a/app/models/album.rb
+++ b/app/models/album.rb
@@ -0,0 +1,20 @@+require 'pink_spider'
+class Album < Enclosure
+ def get_content
+ PinkSpider.new.fetch_album(id)
+ end
+
+ def fetch_content
+ @content = get_content
+ end
+
+ def title
+ fetch_content if @content.nil?
+ "#{@content["title"]} / #{@content["owner_name"]}"
+ end
+
+ def permalink_url provider, identifier
+ fetch_content if @content.nil?
+ @content["url"]
+ end
+end
|
Add Album model that inherits Enclosure
|
diff --git a/app/models/right.rb b/app/models/right.rb
index abc1234..def5678 100644
--- a/app/models/right.rb
+++ b/app/models/right.rb
@@ -20,13 +20,14 @@
# map all available controller actions to CRUD operations
OPERATION_MAPPINGS = {
- new: 'CREATE',
- create: 'CREATE',
- edit: 'UPDATE',
- update: 'UPDATE',
- destroy: 'DELETE',
- show: 'READ',
- index: 'READ',
- map: 'READ'
+ 'new' => 'CREATE',
+ 'create' => 'CREATE',
+ 'edit' => 'UPDATE',
+ 'update' => 'UPDATE',
+ 'destroy' => 'DELETE',
+ 'show' => 'READ',
+ 'index' => 'READ',
+ 'map' => 'READ',
+ 'home' => 'READ'
}
end
|
Use strings instead of symbols
|
diff --git a/spec/mobility/plugins/sequel_spec.rb b/spec/mobility/plugins/sequel_spec.rb
index abc1234..def5678 100644
--- a/spec/mobility/plugins/sequel_spec.rb
+++ b/spec/mobility/plugins/sequel_spec.rb
@@ -2,10 +2,10 @@
return unless defined?(Sequel)
+require "mobility/plugins/sequel"
+
describe Mobility::Plugins::Sequel, orm: :sequel, type: :plugin do
- plugins do
- sequel
- end
+ plugins :sequel
it "raises TypeError unless class is a subclass of Sequel::Model" do
klass = Class.new
|
Add missing require in sequel plugin spec
|
diff --git a/everyunicode.rb b/everyunicode.rb
index abc1234..def5678 100644
--- a/everyunicode.rb
+++ b/everyunicode.rb
@@ -13,7 +13,9 @@ every = file.read.split("\t")
# tweet next character and remove it from array
- Twitter.update(every.shift)
+ char = every.shift
+ # add zero width space character to characters that twitter will silently ignore
+ Twitter.update(char + ( char =~ /(S|D|F|M|W)/ ? "\u200b" : "") )
# erase file
file.seek 0, IO::SEEK_SET
@@ -21,4 +23,4 @@
# write array back to file
file.write every.join("\t")
-end+end
|
Fix no Tweeting of certain characters
https://dev.twitter.com/issues/137
|
diff --git a/spec/unit/ldap/filter_parser_spec.rb b/spec/unit/ldap/filter_parser_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/ldap/filter_parser_spec.rb
+++ b/spec/unit/ldap/filter_parser_spec.rb
@@ -5,7 +5,7 @@
describe "#parse" do
context "Given ASCIIs as filter string" do
- let(:filter_string) { "(&(objectCategory=person)(objectClass=user))" }
+ let(:filter_string) { "(cn=name)" }
specify "should generate filter object" do
expect(Net::LDAP::Filter::FilterParser.parse(filter_string)).to be_a Net::LDAP::Filter
end
|
Simplify an example for FilterParser
|
diff --git a/app/helpers/geo_helper.rb b/app/helpers/geo_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/geo_helper.rb
+++ b/app/helpers/geo_helper.rb
@@ -2,7 +2,7 @@ module GeoHelper
def self.get_ip_address request
- ip_address = Rails.application.secrets["debug_ip_address"] != "" ? Rails.application.secrets["debug_ip_address"] : request.remote_ip
+ ip_address = Rails.application.secrets["debug_ip_address"].presence || request.remote_ip
if request.env['HTTP_X_FORWARDED_FOR']
ip_address = request.env['HTTP_X_FORWARDED_FOR'].split(',')[0] || ip_address
end
|
Make debug_ip_address account for the nil case
Otherwise we get a nil ip address in the localhost case and the link
suggestion breaks (it shows "you're next to es/location/change2").
|
diff --git a/SPTDataLoader.podspec b/SPTDataLoader.podspec
index abc1234..def5678 100644
--- a/SPTDataLoader.podspec
+++ b/SPTDataLoader.podspec
@@ -19,6 +19,6 @@ s.source_files = "include/SPTDataLoader/*.h", "SPTDataLoader/*.{h,m}"
s.public_header_files = "include/SPTDataLoader/*.h"
s.xcconfig = { 'OTHER_LDFLAGS' => '-lObjC' }
- s.module_map = 'include/SPTDataLoader/module.modulemap'`
+ s.module_map = 'include/SPTDataLoader/module.modulemap'
end
|
Fix extra backquotes in pod spec
|
diff --git a/artifactory.gemspec b/artifactory.gemspec
index abc1234..def5678 100644
--- a/artifactory.gemspec
+++ b/artifactory.gemspec
@@ -22,4 +22,7 @@
spec.add_dependency 'httpclient', '~> 2.3'
spec.add_dependency 'i18n', '~> 0.5'
+
+ spec.add_development_dependency 'bundler'
+ spec.add_development_dependency 'rake'
end
|
Add rake and bundler to the gemspec
|
diff --git a/app/controllers/external_users/litigators/interim_claims_controller.rb b/app/controllers/external_users/litigators/interim_claims_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/external_users/litigators/interim_claims_controller.rb
+++ b/app/controllers/external_users/litigators/interim_claims_controller.rb
@@ -23,7 +23,10 @@ end
def build_nested_resources
- [:misc_fees, :disbursements].each do |association|
+ @claim.build_interim_fee if @claim.interim_fee.nil?
+ @claim.build_warrant_fee if @claim.warrant_fee.nil?
+
+ [:disbursements].each do |association|
build_nested_resource(@claim, association)
end
|
Fix building of associations on interim claims controller
|
diff --git a/app/controllers/aliases_controller.rb b/app/controllers/aliases_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/aliases_controller.rb
+++ b/app/controllers/aliases_controller.rb
@@ -1,3 +1,5 @@+# Encoding: utf-8
+# Alias Controller
class AliasesController < ApplicationController
def index
@aliases = Alias.all
|
Clean up alias controller script
|
diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/welcome_controller.rb
+++ b/app/controllers/welcome_controller.rb
@@ -6,4 +6,9 @@ def show
end
+
+ def search
+ @questions = Question.search(params[:words])
+ render 'index'
+ end
end
|
Add search method in welcome controller.
|
diff --git a/app/queries/get_content_collection.rb b/app/queries/get_content_collection.rb
index abc1234..def5678 100644
--- a/app/queries/get_content_collection.rb
+++ b/app/queries/get_content_collection.rb
@@ -12,7 +12,7 @@
content_items.map do |content_item|
hash = content_item.as_json(only: fields)
- publication_state = content_item.live_content_item.present? ? 'live' : 'draft'
+ publication_state = content_item.published? ? 'live' : 'draft'
hash['publication_state'] = publication_state
hash
end
@@ -21,10 +21,16 @@ private
def content_items
- DraftContentItem
- .includes(:live_content_item)
+ draft_items = DraftContentItem
+ .where(format: [content_format, "placeholder_#{content_format}"])
+ .select(*fields + %i[id content_id])
+
+ live_items = LiveContentItem
+ .where.not(content_id: draft_items.map(&:content_id))
.where(format: [content_format, "placeholder_#{content_format}"])
.select(*fields + %i[id])
+
+ draft_items + live_items
end
def validate_fields!
|
Make the GetContentCollection support live items without drafts…
Previously, the query made an assumption that every
live content item would have an associated draft.
This is no longer the case, so update the query
accordingly.
|
diff --git a/spec/asset_trip/compressor_spec.rb b/spec/asset_trip/compressor_spec.rb
index abc1234..def5678 100644
--- a/spec/asset_trip/compressor_spec.rb
+++ b/spec/asset_trip/compressor_spec.rb
@@ -16,7 +16,25 @@ compressor.compress("a { color: red }")
end
- it "returns the STDOUT from the java process"
+ it "sends the uncompressed contents via STDIN" do
+ stdin = stub(:close => nil)
+
+ POpen4.stub!(:popen4) do |command, block|
+ block.call(stub(:read => "STDOUT"), stub(:read => "STDERR"), stdin)
+ stub(:success? => true)
+ end
+
+ stdin.should_receive(:puts).with("a { color: red }")
+ compressor.compress("a { color: red }").should == "STDOUT"
+ end
+
+ it "returns the STDOUT from the java process" do
+ POpen4.stub!(:popen4) do |command, block|
+ block.call(stub(:read => "STDOUT"), stub(:read => "STDERR"), stub(:puts => nil, :close => nil))
+ stub(:success? => true)
+ end
+ compressor.compress("a { color: red }").should == "STDOUT"
+ end
it "raises a CompressorError if the java process is not successful" do
POpen4.stub!(:popen4 => stub(:success? => false))
|
Add missing specs for Compressor
|
diff --git a/spec/features/translations_spec.rb b/spec/features/translations_spec.rb
index abc1234..def5678 100644
--- a/spec/features/translations_spec.rb
+++ b/spec/features/translations_spec.rb
@@ -0,0 +1,31 @@+RSpec.feature "Translations" do
+ context 'product' do
+ let!(:product) do
+ create(:product, name: 'Antimatter',
+ translations: [
+ Spree::Product::Translation.new(locale: 'pt-BR',
+ name: 'Antimatéria')
+ ])
+ end
+
+ before do
+ I18n.locale = 'pt-BR'
+ Spree::Frontend::Config[:locale] = 'pt-BR'
+ end
+
+ after do
+ I18n.locale = :en
+ Spree::Frontend::Config[:locale] = :en
+ end
+
+ scenario 'displays translated product page' do
+ visit '/products/antimatter'
+ expect(page.title).to have_content('Antimatéria')
+ end
+
+ scenario 'displays translated products list' do
+ visit "/products"
+ expect(page).to have_content('Antimatéria')
+ end
+ end
+end
|
Add spec for product pages translation
|
diff --git a/spec/instrumentation/mongo_spec.rb b/spec/instrumentation/mongo_spec.rb
index abc1234..def5678 100644
--- a/spec/instrumentation/mongo_spec.rb
+++ b/spec/instrumentation/mongo_spec.rb
@@ -10,19 +10,19 @@
it 'Mongo should have oboe methods defined' do
Oboe::Inst::Mongo::DB_OPS.each do |m|
- ::Mongo::DB.method_defined?(m).should == true
+ ::Mongo::DB.method_defined?("#{m}_with_oboe").should == true
end
Oboe::Inst::Mongo::CURSOR_OPS.each do |m|
- ::Mongo::Cursor.method_defined?(m).should == true
+ ::Mongo::Cursor.method_defined?("#{m}_with_oboe").should == true
end
Oboe::Inst::Mongo::COLL_WRITE_OPS.each do |m|
- ::Mongo::Collection.method_defined?(m).should == true
+ ::Mongo::Collection.method_defined?("#{m}_with_oboe").should == true
end
Oboe::Inst::Mongo::COLL_QUERY_OPS.each do |m|
- ::Mongo::Collection.method_defined?(m).should == true
+ ::Mongo::Collection.method_defined?("#{m}_with_oboe").should == true
end
Oboe::Inst::Mongo::COLL_INDEX_OPS.each do |m|
- ::Mongo::Collection.method_defined?(m).should == true
+ ::Mongo::Collection.method_defined?("#{m}_with_oboe").should == true
end
::Mongo::Collection.method_defined?(:oboe_collect).should == true
end
|
Fix the tested method names
|
diff --git a/spec/models/group_pref_spec.rb b/spec/models/group_pref_spec.rb
index abc1234..def5678 100644
--- a/spec/models/group_pref_spec.rb
+++ b/spec/models/group_pref_spec.rb
@@ -13,5 +13,17 @@ require 'spec_helper'
describe GroupPref do
- pending "add some examples to (or delete) #{__FILE__}"
+ it { should belong_to(:group) }
+
+ describe "attributes" do
+ booleans = %w(
+ notify_membership_requests
+ )
+
+ booleans.each do |attr|
+ it "should respond to #{attr} with true or false" do
+ subject.send(attr).should_not be_nil
+ end
+ end
+ end
end
|
Add some simple tests for group prefs.
|
diff --git a/spec/watirspec/spec/spec_helper.rb b/spec/watirspec/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/watirspec/spec/spec_helper.rb
+++ b/spec/watirspec/spec/spec_helper.rb
@@ -11,7 +11,7 @@ Thread.abort_on_exception = true
require "#{File.dirname(__FILE__)}/../watirspec"
-hook = File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper")
+hook = File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper.rb")
if File.exist?(hook)
require hook
|
Use .rb since we're checking if File.exist?
|
diff --git a/url_request.rb b/url_request.rb
index abc1234..def5678 100644
--- a/url_request.rb
+++ b/url_request.rb
@@ -1,27 +1,37 @@ require 'net/http'
class UrlRequest
+
def initialize (url)
@uri = URI.parse(url)
end
def get
- Net::HTTP.get_response(@uri)
- end
-
- def is_redirected?
- get.code == "301"
+ Net::HTTP.get_response(uri)
end
def redirects_to_www?
is_redirected? && is_same_website?
end
+ def redirects_to_https?
+ is_redirected? && includes_https?
+ end
+
+ private
+
+ attr_reader :uri
+
+ def is_redirected?
+ get.code == "301"
+ end
+
def is_same_website?
- !!(get.header['Location'] =~ /https?:\/\/www.#{@uri.host}\/$/)
+ !!(get.header['Location'] =~ /https?:\/\/www.#{uri.host}\/$/)
end
def includes_https?
get.header['location'].include?("https")
end
+
end
|
Add private methods to the controller
|
diff --git a/cookbooks/travis_system_info/recipes/default.rb b/cookbooks/travis_system_info/recipes/default.rb
index abc1234..def5678 100644
--- a/cookbooks/travis_system_info/recipes/default.rb
+++ b/cookbooks/travis_system_info/recipes/default.rb
@@ -14,10 +14,7 @@ checksum node['travis_system_info']['gem_sha256sum']
end
-gem_package 'system-info' do
- gem_binary '/opt/chef/embedded/bin/gem'
- source local_gem
-end
+execute "/opt/chef/embedded/bin/gem install -b #{local_gem.inspect}"
execute "rm -rf #{node['travis_system_info']['dest_dir']}"
|
Install system-info local gem manually
as chef 12.10+ automatically adds `--local` when using `gem_package` with a
local source, which is a design decision ... that doesn't work for this case.
|
diff --git a/test/lib/typus/actions_test.rb b/test/lib/typus/actions_test.rb
index abc1234..def5678 100644
--- a/test/lib/typus/actions_test.rb
+++ b/test/lib/typus/actions_test.rb
@@ -0,0 +1,75 @@+require "test_helper"
+
+class ActionsTest < ActiveSupport::TestCase
+
+ include Typus::Actions
+
+ context "add_resource_action" do
+
+ should "work" do
+ output = add_resource_action("something")
+ expected = [["something"]]
+
+ assert_equal expected, @resource_actions
+ end
+
+ should "work when no params are set" do
+ add_resource_action()
+ assert_equal [], @resource_actions
+ end
+
+ end
+
+ context "prepend_resource_action" do
+
+ should "work without args" do
+ prepend_resource_action()
+ assert_equal [], @resource_actions
+ end
+
+ should "work with args" do
+ prepend_resource_action("something")
+ assert_equal [["something"]], @resource_actions
+ end
+
+ should "work prepending an action without args" do
+ add_resource_action("something")
+ prepend_resource_action()
+ assert_equal [["something"]], @resource_actions
+ end
+
+ should "work prepending an action with args" do
+ add_resource_action("something")
+ prepend_resource_action("something_else")
+ assert_equal [["something_else"], ["something"]], @resource_actions
+ end
+
+ end
+
+ context "append_resource_action" do
+
+ should "work without args" do
+ append_resource_action()
+ assert_equal [], @resource_actions
+ end
+
+ should "work with args" do
+ append_resource_action("something")
+ assert_equal [["something"]], @resource_actions
+ end
+
+ should "work appending an action without args" do
+ add_resource_action("something")
+ append_resource_action()
+ assert_equal [["something"]], @resource_actions
+ end
+
+ should "work appending an action with args" do
+ add_resource_action("something")
+ append_resource_action("something_else")
+ assert_equal [["something"], ["something_else"]], @resource_actions
+ end
+
+ end
+
+end
|
Test for actions stuff ...
|
diff --git a/lib/has_remote/tasks.rb b/lib/has_remote/tasks.rb
index abc1234..def5678 100644
--- a/lib/has_remote/tasks.rb
+++ b/lib/has_remote/tasks.rb
@@ -3,10 +3,7 @@ desc 'Synchronizes all attributes locally cached by has_remote'
task :sync => :environment do
models = ENV['MODELS'].nil? ? HasRemote.models : extract_models
- options = {}
- options[:limit] = ENV['LIMIT'] if ENV['LIMIT']
- options[:since] = ENV['SINCE'] if ENV['SINCE']
-
+ options = ENV['PARAMS'] ? Rack::Utils.parse_query(ENV['PARAMS']) : {}
models.each{|model| model.synchronize!(options)}
end
|
Allow any parameters to be specified via an env.variable for hr:sync rake task.
|
diff --git a/lib/apipie-rails.rb b/lib/apipie-rails.rb
index abc1234..def5678 100644
--- a/lib/apipie-rails.rb
+++ b/lib/apipie-rails.rb
@@ -21,3 +21,11 @@ if Rails.version.start_with?("3.0")
warn 'Warning: apipie-rails is not going to support Rails 3.0 anymore in future versions'
end
+
+module Apipie
+
+ def self.root
+ @root ||= Pathname.new(File.dirname(File.expand_path(File.dirname(__FILE__), '/../')))
+ end
+
+end
|
Add root path accessor to base module
|
diff --git a/lib/binco/engine.rb b/lib/binco/engine.rb
index abc1234..def5678 100644
--- a/lib/binco/engine.rb
+++ b/lib/binco/engine.rb
@@ -1,3 +1,5 @@+require 'jquery-rails'
+require 'bootstrap'
require 'select2-rails'
require 'will_paginate'
require 'bootstrap-datepicker-rails'
|
Add missing require for new depedencies
|
diff --git a/lib/rip/compiler/ast.rb b/lib/rip/compiler/ast.rb
index abc1234..def5678 100644
--- a/lib/rip/compiler/ast.rb
+++ b/lib/rip/compiler/ast.rb
@@ -4,14 +4,18 @@ class AST < Parslet::Transform
attr_reader :origin
- def initialize(origin)
+ def initialize(origin = nil, &block)
@origin = origin
+ super(&block)
end
- protected
+ def apply(tree, context = nil)
+ _context = context ? context : {}
+ super(tree, _context.merge(:origin => origin))
+ end
- def location_for(slice)
- slice.line_and_column
+ def self.location_for(origin, slice)
+ Rip::Utilities::Location.new(origin, slice.offset, *slice.line_and_column)
end
end
end
|
Change expectations to match reality
|
diff --git a/lib/dcell/server.rb b/lib/dcell/server.rb
index abc1234..def5678 100644
--- a/lib/dcell/server.rb
+++ b/lib/dcell/server.rb
@@ -20,7 +20,7 @@
# Wait for incoming 0MQ messages
def run
- while true; handle_message @socket.read; end
+ while true; handle_message! @socket.read; end
end
# Shut down the server
|
Fix "ZMQ error: got read event without associated reader"
|
diff --git a/lib/workbench/engine.rb b/lib/workbench/engine.rb
index abc1234..def5678 100644
--- a/lib/workbench/engine.rb
+++ b/lib/workbench/engine.rb
@@ -9,5 +9,10 @@ module Workbench
class Engine < ::Rails::Engine
isolate_namespace Workbench
+
+ initializer :assets do |config|
+ Rails.application.config.assets.initialize_on_precompile = true
+ Rails.application.config.assets.precompile += %w( *.js *.css *.png *.jpg *.jpeg *.gif)
+ end
end
end
|
Add asset precompilation for all assets
|
diff --git a/lib/nehm/artwork.rb b/lib/nehm/artwork.rb
index abc1234..def5678 100644
--- a/lib/nehm/artwork.rb
+++ b/lib/nehm/artwork.rb
@@ -4,7 +4,7 @@ @track = track
end
- def dl_url
+ def url
hash = @track.hash
url =
if hash['artwork_url'].nil?
|
Rename dl_url to url in Artwork
|
diff --git a/lib/setty/loader.rb b/lib/setty/loader.rb
index abc1234..def5678 100644
--- a/lib/setty/loader.rb
+++ b/lib/setty/loader.rb
@@ -1,5 +1,6 @@ require 'erb'
require 'yaml'
+require 'pathname'
require 'active_support/core_ext/hash/keys.rb'
require 'active_support/core_ext/string/inflections.rb'
@@ -8,7 +9,7 @@
class Loader
def initialize(path, enviroment)
- @base_path = path
+ @base_path = Pathname(path)
@enviroment = enviroment
end
@@ -19,15 +20,15 @@ private
def load_options(path)
- options = load_options_from_file "#{path}.yml"
+ options = load_options_from_file path.sub_ext('.yml')
find_nested_options(path).each do |sub_path|
- options[:"#{File.basename(sub_path)}"] = load_options(sub_path)
+ options[sub_path.basename.to_s.to_sym] = load_options sub_path
end
options
end
def find_nested_options(path)
- Dir.glob(File.join(path, '/*')).map { |file_path| "#{path}/#{File.basename(file_path, '.yml')}" }.uniq
+ Pathname.glob(path.join('*')).map { |file_path| path.join file_path.basename('.yml') }.uniq
end
def load_options_from_file(path)
@@ -38,10 +39,10 @@ Options[enviroment_options.symbolize_keys]
end
- def load_enviroment_options_from_file(path)
- return {} unless File.readable? path
+ def load_enviroment_options_from_file(file)
+ return {} unless file.readable?
- yaml_content = ERB.new(File.read(path)).result
+ yaml_content = ERB.new(file.read).result
options = YAML.load yaml_content
options[@enviroment.to_s]
|
Use pathname for file loading
|
diff --git a/lib/slack-notify.rb b/lib/slack-notify.rb
index abc1234..def5678 100644
--- a/lib/slack-notify.rb
+++ b/lib/slack-notify.rb
@@ -12,7 +12,7 @@ @username = options[:username] || "webhookbot"
@channel = options[:channel] || "#general"
- raise ArgumentError, "Subdomain required" if @team.nil?
+ raise ArgumentError, "Team name required" if @team.nil?
raise ArgumentError, "Token required" if @token.nil?
end
|
Change error message for missing team name
|
diff --git a/lib/temple/utils.rb b/lib/temple/utils.rb
index abc1234..def5678 100644
--- a/lib/temple/utils.rb
+++ b/lib/temple/utils.rb
@@ -16,5 +16,14 @@ # That has to be the only token.
lexer.token.nil?
end
+
+ def empty_exp?(exp)
+ case exp[0]
+ when :multi
+ exp[1..-1].all? { |e| e[0] == :newline }
+ else
+ false
+ end
+ end
end
-end+end
|
Utils: Add a method for checking if an expression is empty
|
diff --git a/mandrill_dm.gemspec b/mandrill_dm.gemspec
index abc1234..def5678 100644
--- a/mandrill_dm.gemspec
+++ b/mandrill_dm.gemspec
@@ -13,10 +13,10 @@ s.require_path = 'lib'
s.required_ruby_version = '>= 2.0'
+ s.add_dependency 'mail', '~> 2.6'
s.add_dependency 'mandrill-api', '~> 1.0.53'
s.add_development_dependency 'rspec', '~> 3.4'
- s.add_development_dependency 'mail', '~> 2.6'
s.add_development_dependency 'rake'
s.add_development_dependency 'simplecov', '~> 0.11'
s.add_development_dependency 'rubocop', '~> 0.40'
|
Move mail gem to runtime dependencies
|
diff --git a/app/models/application.rb b/app/models/application.rb
index abc1234..def5678 100644
--- a/app/models/application.rb
+++ b/app/models/application.rb
@@ -2,7 +2,7 @@ belongs_to :offer, required: true
belongs_to :candidate, required: true
has_one :company, through: :offer
- scope :unread, -> { where(read: false) }
+ scope :unread, -> { where('NOT read') }
def mark_as_read
self.update(read: true)
|
Refactor Offer unread scope to use 'NOT read'
|
diff --git a/app/models/basket_item.rb b/app/models/basket_item.rb
index abc1234..def5678 100644
--- a/app/models/basket_item.rb
+++ b/app/models/basket_item.rb
@@ -1,5 +1,5 @@ class BasketItem < ActiveRecord::Base
- validates_numericality_of :quantity, greater_than_or_equal_to: 1
+ validates_numericality_of :quantity, greater_than: 0
validates_presence_of :basket_id
belongs_to :basket, inverse_of: :basket_items, touch: true
|
Allow positive fractions less than 1
|
diff --git a/0_code_wars/which_triangle_is_that.rb b/0_code_wars/which_triangle_is_that.rb
index abc1234..def5678 100644
--- a/0_code_wars/which_triangle_is_that.rb
+++ b/0_code_wars/which_triangle_is_that.rb
@@ -0,0 +1,24 @@+# http://www.codewars.com/kata/564d398e2ecf66cec00000a9
+# --- iteration 1 ---
+def type_of_triangle(a, b, c)
+ return "Not a valid triangle" unless [a, b, c].all? { |x| x.is_a? Integer }
+ return "Not a valid triangle" unless (a + b) > c && (a + c) > b && (b + c) > a
+ return "Equilateral" if a == b && b == c
+ return "Isosceles" if [a, b, c].uniq.count == 2
+ "Scalene"
+end
+
+# --- iteration 2 ---
+def type_of_triangle(a, b, c)
+ return "Not a valid triangle" unless [a, b, c].all?{ |x| x.is_a?(Integer) }
+ return "Not a valid triangle" unless (a + b) > c && (a + c) > b && (b + c) > a
+ return "Equilateral" if a == b && b == c
+ [a,b,c].uniq.count == 2 ? "Isosceles" : "Scalene"
+end
+
+# --- iteration 3 ---
+def type_of_triangle(a, b, c)
+ return "Not a valid triangle" unless [a,b,c].all?{|x| Integer === x}
+ return "Not a valid triangle" unless (a+b)>c && (a+c)>b && (b+c)>a
+ ["Equilateral", "Isosceles", "Scalene"][ [a,b,c].uniq.size-1 ]
+end
|
Add code wars (7) - which triangle is that?
|
diff --git a/db/migrate/20120531114009_add_slug_to_people.rb b/db/migrate/20120531114009_add_slug_to_people.rb
index abc1234..def5678 100644
--- a/db/migrate/20120531114009_add_slug_to_people.rb
+++ b/db/migrate/20120531114009_add_slug_to_people.rb
@@ -4,6 +4,11 @@ add_index :people, :slug, unique: true
Person.observers.disable :all do
Person.all.each do |p|
+ class << p
+ def privy_counsellor?
+ false
+ end
+ end
# Resaving each person generates a slug
p.save
end
|
Fix migrations to run from blank database.
|
diff --git a/spec/features/signup_spec.rb b/spec/features/signup_spec.rb
index abc1234..def5678 100644
--- a/spec/features/signup_spec.rb
+++ b/spec/features/signup_spec.rb
@@ -0,0 +1,21 @@+require 'rails_helper'
+require 'capybara/rspec'
+
+RSpec.describe 'the signup process', type: :feature do
+ fixtures :users
+
+ context 'with valid information' do
+ it 'signs me up' do
+ visit new_user_registration_path
+ within('#new_user') do
+ fill_in 'user_login', with: 'test_account'
+ fill_in 'user_email', with: 'test@account.com'
+ fill_in 'user_password', with: 'test_password'
+ fill_in 'user_password_confirmation', with: 'test_password'
+ end
+ click_button 'Sign up'
+ expect(page).to have_content 'Welcome to Asq'
+ expect(page).to have_content 'test_account' # Username shown in navbar
+ end
+ end
+end
|
Add initial spec for signup workflow.
|
diff --git a/config.rb b/config.rb
index abc1234..def5678 100644
--- a/config.rb
+++ b/config.rb
@@ -6,6 +6,7 @@ css_dir = "css"
sass_dir = "scss"
images_dir = "images"
+generated_images_dir = images_dir + "/generated"
javascripts_dir = "js"
# You can select your preferred output style here (can be overridden via the command line):
|
Configure subdir for generated images.
|
diff --git a/config.rb b/config.rb
index abc1234..def5678 100644
--- a/config.rb
+++ b/config.rb
@@ -11,7 +11,7 @@ images_dir = "img"
javascripts_dir = "js"
fonts_dir = "fonts"
-
+disable_warnings = true
output_style = :compact
# To enable relative paths to assets via compass helper functions. Uncomment:
@@ -26,4 +26,4 @@ # preferred_syntax = :sass
# and then run:
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
-preferred_syntax = :scss+preferred_syntax = :scss
|
Stop wasting time with warnings in compass
|
diff --git a/app/presenters/source_suggestion_browse_row_presenter.rb b/app/presenters/source_suggestion_browse_row_presenter.rb
index abc1234..def5678 100644
--- a/app/presenters/source_suggestion_browse_row_presenter.rb
+++ b/app/presenters/source_suggestion_browse_row_presenter.rb
@@ -12,6 +12,7 @@ journal: suggestion.source.full_journal_title,
citation: suggestion.source.description,
citation_id: suggestion.source.citation_id,
+ source_type: suggestion.source.source_type,
asco_abstract_id: suggestion.source.asco_abstract_id,
publication_year: suggestion.source.publication_year,
source_url: suggestion.source.source_url,
|
Add source_type to source suggestion datatable
|
diff --git a/lib/geocoder/lookups/maxmind.rb b/lib/geocoder/lookups/maxmind.rb
index abc1234..def5678 100644
--- a/lib/geocoder/lookups/maxmind.rb
+++ b/lib/geocoder/lookups/maxmind.rb
@@ -27,11 +27,6 @@ end
def parse_raw_data(raw_data)
- # Maxmind just returns text/plain as csv format but according to documentation,
- # we get ISO-8859-1 encoded string. We need to convert it.
- if raw_data.respond_to?(:force_encoding)
- raw_data = raw_data.force_encoding("ISO-8859-1").encode("UTF-8")
- end
CSV.parse_line raw_data
end
|
Remove MaxMind character encoding conversion.
Either do it consistently across Ruby versions, or don't do it at all.
Plus, it didn't seem to work.
|
diff --git a/lib/gitlab/git/remote_mirror.rb b/lib/gitlab/git/remote_mirror.rb
index abc1234..def5678 100644
--- a/lib/gitlab/git/remote_mirror.rb
+++ b/lib/gitlab/git/remote_mirror.rb
@@ -0,0 +1,75 @@+module Gitlab
+ module Git
+ class RemoteMirror
+ def initialize(repository, ref_name)
+ @repository = repository
+ @ref_name = ref_name
+ end
+
+ def update(only_branches_matching: [], only_tags_matching: [])
+ local_branches = refs_obj(@repository.local_branches, only_refs_matching: only_branches_matching)
+ remote_branches = refs_obj(@repository.remote_branches(@ref_name), only_refs_matching: only_branches_matching)
+
+ updated_branches = changed_refs(local_branches, remote_branches)
+ push_branches(updated_branches.keys) if updated_branches.present?
+
+ delete_refs(local_branches, remote_branches)
+
+ local_tags = refs_obj(@repository.tags, only_refs_matching: only_tags_matching)
+ remote_tags = refs_obj(@repository.remote_tags(@ref_name), only_refs_matching: only_tags_matching)
+
+ updated_tags = changed_refs(local_tags, remote_tags)
+ @repository.push_remote_branches(@ref_name, updated_tags.keys) if updated_tags.present?
+
+ delete_refs(local_tags, remote_tags)
+ end
+
+ private
+
+ def refs_obj(refs, only_refs_matching: [])
+ refs.each_with_object({}) do |ref, refs|
+ next if only_refs_matching.present? && !only_refs_matching.include?(ref.name)
+
+ refs[ref.name] = ref
+ end
+ end
+
+ def changed_refs(local_refs, remote_refs)
+ local_refs.select do |ref_name, ref|
+ remote_ref = remote_refs[ref_name]
+
+ remote_ref.nil? || ref.dereferenced_target != remote_ref.dereferenced_target
+ end
+ end
+
+ def push_branches(branches)
+ default_branch, branches = branches.partition do |branch|
+ @repository.root_ref == branch
+ end
+
+ # Push the default branch first so it works fine when remote mirror is empty.
+ branches.unshift(*default_branch)
+
+ @repository.push_remote_branches(@ref_name, branches)
+ end
+
+ def delete_refs(local_refs, remote_refs)
+ refs = refs_to_delete(local_refs, remote_refs)
+
+ @repository.delete_remote_branches(@ref_name, refs.keys) if refs.present?
+ end
+
+ def refs_to_delete(local_refs, remote_refs)
+ default_branch_id = @repository.commit.id
+
+ remote_refs.select do |remote_ref_name, remote_ref|
+ next false if local_refs[remote_ref_name] # skip if branch or tag exist in local repo
+
+ remote_ref_id = remote_ref.dereferenced_target.try(:id)
+
+ remote_ref_id && @repository.rugged_is_ancestor?(remote_ref_id, default_branch_id)
+ end
+ end
+ end
+ end
+end
|
Move git operations for UpdateRemoteMirrorService into Gitlab::Git
|
diff --git a/tasks/buildr_artifact_patch.rake b/tasks/buildr_artifact_patch.rake
index abc1234..def5678 100644
--- a/tasks/buildr_artifact_patch.rake
+++ b/tasks/buildr_artifact_patch.rake
@@ -0,0 +1,46 @@+raise 'Patch already integrated into buildr code' unless Buildr::VERSION.to_s == '1.5.6'
+
+class URI::HTTP
+ private
+
+ def write_internal(options, &block)
+ options ||= {}
+ connect do |http|
+ trace "Uploading to #{path}"
+ http.read_timeout = 500
+ content = StringIO.new
+ while chunk = yield(RW_CHUNK_SIZE)
+ content << chunk
+ end
+ headers = { 'Content-MD5' => Digest::MD5.hexdigest(content.string), 'Content-Type' => 'application/octet-stream', 'User-Agent' => "Buildr-#{Buildr::VERSION}" }
+ request = Net::HTTP::Put.new(request_uri.empty? ? '/' : request_uri, headers)
+ request.basic_auth URI.decode(self.user), URI.decode(self.password) if self.user
+ response = nil
+ with_progress_bar options[:progress], path.split('/').last, content.size do |progress|
+ request.content_length = content.size
+ content.rewind
+ stream = Object.new
+ class << stream;
+ self;
+ end.send :define_method, :read do |*args|
+ bytes = content.read(*args)
+ progress << bytes if bytes
+ bytes
+ end
+ request.body_stream = stream
+ response = http.request(request)
+ end
+
+ case response
+ when Net::HTTPRedirection
+ # Try to download from the new URI, handle relative redirects.
+ trace "Redirected to #{response['Location']}"
+ content.rewind
+ return (self + URI.parse(response['location'])).write_internal(options) {|bytes| content.read(bytes)}
+ when Net::HTTPSuccess
+ else
+ raise RuntimeError, "Failed to upload #{self}: #{response.message}"
+ end
+ end
+ end
+end
|
Apply patch to work around Buildr password encoding issue
|
diff --git a/attributes/agent.rb b/attributes/agent.rb
index abc1234..def5678 100644
--- a/attributes/agent.rb
+++ b/attributes/agent.rb
@@ -8,6 +8,6 @@ default['gocd']['agent']['autoregister']['environments'] = %w()
default['gocd']['agent']['autoregister']['resources'] = %w()
default['gocd']['agent']['autoregister']['hostname'] = node['fqdn']
-default['gocd']['agent']['server_search_query'] = "chef_environment:#{node.chef_environment} AND recipes:go-server\\:\\:default"
+default['gocd']['agent']['server_search_query'] = "chef_environment:#{node.chef_environment} AND recipes:gocd\\:\\:default"
default['gocd']['agent']['workspace'] = nil # '/var/lib/go-agent' on linux
default['gocd']['agent']['count'] = 1
|
Fix the search query used to perform a search for a go server
|
diff --git a/ffxiv.gemspec b/ffxiv.gemspec
index abc1234..def5678 100644
--- a/ffxiv.gemspec
+++ b/ffxiv.gemspec
@@ -1,6 +1,6 @@ Gem::Specification.new do |s|
s.name = "ffxiv"
- s.version = "0.9.0"
+ s.version = "0.9.1"
s.date = "2014-09-29"
s.summary = "An unofficial FFXIV ARR toolkit for Ruby, featuring Lodestone scraper."
s.description = "An unofficial FFXIV ARR toolkit for Ruby, featuring Lodestone scraper."
@@ -11,6 +11,6 @@ "lib/ffxiv/lodestone/model.rb",
"lib/ffxiv/lodestone/character.rb",
"lib/ffxiv/lodestone/free-company.rb"]
- s.homepage = "http://rubygems.org/gems/ffxiv"
+ s.homepage = "https://github.com/ffxiv/ffxiv"
s.license = "MIT"
end
|
[0.9.1] Change homepage to GitHub repo
|
diff --git a/files2gist.rb b/files2gist.rb
index abc1234..def5678 100644
--- a/files2gist.rb
+++ b/files2gist.rb
@@ -27,7 +27,14 @@ end
end
-data = Hash.new
+data = {
+ 'login' => `git config --global github.user`.strip,
+ 'token' => `git config --global github.token`.strip,
+}
+if priv
+ data[ 'private' ] = 'on'
+end
+
files.each_with_index do |file,index|
i = index + 1
data[ "files[#{file}]" ] = File.read( file )
@@ -36,6 +43,9 @@ URI.parse( 'http://gist.github.com/api/v1/xml/new'),
data
)
-gist_id = res.body[ /<repo>(\d+)</m, 1 ]
+gist_id = res.body[ /<repo>(.+?)</m, 1 ]
+
+puts res.body
+puts
puts "http://gist.github.com/#{gist_id}"
|
Use github.user and github.token if available.
Use --private switch if given.
Show res.body.
|
diff --git a/test/commands/untracevar_test.rb b/test/commands/untracevar_test.rb
index abc1234..def5678 100644
--- a/test/commands/untracevar_test.rb
+++ b/test/commands/untracevar_test.rb
@@ -0,0 +1,17 @@+# frozen_string_literal: true
+
+require "test_helper"
+
+module Byebug
+ #
+ # Tests gloabal variable untracing functionality.
+ #
+ class UntracevarTest < TestCase
+ def test_untracevar_help
+ enter "help untracevar"
+ debug_code(minimal_program)
+
+ check_output_includes "Stops tracing a global variable."
+ end
+ end
+end
|
Add missing coverage to `help untracevar` command
|
diff --git a/app/controllers/api/balances_controller.rb b/app/controllers/api/balances_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/balances_controller.rb
+++ b/app/controllers/api/balances_controller.rb
@@ -5,6 +5,12 @@ def index
begin
account = Account.find(params[:account_id])
+
+ set_metadata_header(
+ date_from: date_range.first,
+ date_to: date_range.last
+ )
+
@balances = BalanceCalculator.new(
date_from: date_range.first,
date_to: date_range.last,
|
Set date range metadata for balances.
|
diff --git a/actionview/lib/action_view/buffers.rb b/actionview/lib/action_view/buffers.rb
index abc1234..def5678 100644
--- a/actionview/lib/action_view/buffers.rb
+++ b/actionview/lib/action_view/buffers.rb
@@ -13,10 +13,6 @@ end
alias :append= :<<
- def safe_concat(value)
- return self if value.nil?
- super(value.to_s)
- end
alias :safe_append= :safe_concat
end
|
Stop nil checking on safe_append=
ERB compiler guarantees safe_append= will be called with a string, so
nil checks don't make sense. Anything else calling this method should
check for nil themselves before calling
|
diff --git a/levels.rb b/levels.rb
index abc1234..def5678 100644
--- a/levels.rb
+++ b/levels.rb
@@ -1,35 +1,37 @@ require 'csv'
-class Array
- def col(name)
- offset = self.class.column(name)
- self[offset]
+
+class Levels
+ attr_accessor :levels
+
+ def initialize(file)
+ csv = CSV.open(file, 'r', "\t")
+ head = csv.shift
+ @columns = {}
+ head.each_with_index {|name, index| @columns[name] = index}
+
+ @levels = []
+ csv.reject {|row| value(row,'mon1').nil?}.each do |row|
+ levels << {
+ :name => value(row,'LevelName'),
+ :monsters => (1..8).map{|n| "mon#{n}"}.map {|col| value(row,col)}.compact,
+ :levels => %w[MonLvl1Ex MonLvl2Ex MonLvl3Ex].map {|col| value(row,col)}.compact,
+ }
+ end
+
+ csv.close
end
-
- class << self
- def columns=(colnames)
- @columns = {}
- colnames.each_with_index {|name, index| @columns[name] = index}
- nil
- end
-
- def column(name)
- @columns[name]
- end
+
+ def to_s
+ levels.map {|lev| lev.inspect}.join("\n")
+ end
+
+ private
+
+ def value(row, column_name)
+ offset = @columns[column_name]
+ row[offset]
end
end
-csv = CSV.open('data/global/excel/Levels.txt', 'r', "\t")
-head = csv.shift
-Array.columns = head
-
-levels = []
-csv.reject {|row| row.col('mon1').nil?}.each do |row|
- levels << {
- :name => row.col('LevelName'),
- :monsters => (1..8).map{|n| "mon#{n}"}.map {|col| row.col(col)}.compact,
- :levels => %w[MonLvl1Ex MonLvl2Ex MonLvl3Ex].map {|col| row.col(col)}.compact,
- }
-end
-
-csv.close
-puts levels.map {|lev| lev.inspect}.join("\n")+levels = Levels.new('data/global/excel/Levels.txt')
+puts levels
|
Put all level logic in the Levels class
|
diff --git a/examples/04_webkit.rb b/examples/04_webkit.rb
index abc1234..def5678 100644
--- a/examples/04_webkit.rb
+++ b/examples/04_webkit.rb
@@ -0,0 +1,16 @@+# Based on http://www.idle-hacking.com/2010/02/webkit-ruby-and-gtk/
+$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
+require 'gir_ffi'
+
+GirFFI.setup :Gtk
+GirFFI.setup :WebKit
+
+Gtk.init
+
+win = Gtk::Window.new :toplevel
+wv = WebKit::WebView.new
+win.add(wv)
+win.show_all
+wv.open('http://www.google.com/')
+GObject.signal_connect(win, "destroy") { Gtk.main_quit }
+Gtk.main
|
Add extremely basic WebKit example.
|
diff --git a/app/inputs/character_limited_input.rb b/app/inputs/character_limited_input.rb
index abc1234..def5678 100644
--- a/app/inputs/character_limited_input.rb
+++ b/app/inputs/character_limited_input.rb
@@ -2,4 +2,14 @@ def input_html_options
super.merge(maxlength: Student::CHARACTER_LIMIT)
end
+
+ def input(wrapper_options)
+ [super, counter].join("\n").html_safe
+ end
+
+ private
+
+ def counter
+ content_tag(:span, "0")
+ end
end
|
WIP: Add a counter DOM element
|
diff --git a/config/initializers/attachment_api.rb b/config/initializers/attachment_api.rb
index abc1234..def5678 100644
--- a/config/initializers/attachment_api.rb
+++ b/config/initializers/attachment_api.rb
@@ -1,9 +1,7 @@-# This file is overwritten on deployment. In order to authenticate in dev
-# environment with asset-manager any random string is required as bearer_token
require "gds_api/asset_manager"
require "plek"
Attachable.asset_api_client = GdsApi::AssetManager.new(
Plek.current.find("asset-manager"),
- bearer_token: "1234567890",
+ bearer_token: ENV["ASSET_MANAGER_BEARER_TOKEN"],
)
|
Use the asset manager bearer token from ENV
|
diff --git a/lib/stellae/request/import_line_list_request.rb b/lib/stellae/request/import_line_list_request.rb
index abc1234..def5678 100644
--- a/lib/stellae/request/import_line_list_request.rb
+++ b/lib/stellae/request/import_line_list_request.rb
@@ -2,7 +2,7 @@ module Request
class ImportLineListRequest
def initialize(
- line_list_rows: line_list_rows
+ line_list_rows:
)
@line_list_rows = line_list_rows
end
|
Fix argument error in request
|
diff --git a/state_machine.gemspec b/state_machine.gemspec
index abc1234..def5678 100644
--- a/state_machine.gemspec
+++ b/state_machine.gemspec
@@ -14,4 +14,6 @@ s.test_files = `git ls-files -- test/*`.split("\n")
s.rdoc_options = %w(--line-numbers --inline-source --title state_machine --main README.rdoc)
s.extra_rdoc_files = %w(README.rdoc CHANGELOG.rdoc LICENSE)
+
+ s.add_development_dependency("rake")
end
|
Add missing dependencies to gemspec
|
diff --git a/features/support/router_helper.rb b/features/support/router_helper.rb
index abc1234..def5678 100644
--- a/features/support/router_helper.rb
+++ b/features/support/router_helper.rb
@@ -0,0 +1,4 @@+require 'gds_api/router'
+# We never have to go to the Router during Feature tests. Disable.
+GdsApi::Router.any_instance.stubs(:add_route).returns true
+GdsApi::Router.any_instance.stubs(:delete_route).returns true
|
Disable the Router API client during Cucumber
|
diff --git a/db/migrate/20140520143420_add_upload_usage_data_delayed_job.rb b/db/migrate/20140520143420_add_upload_usage_data_delayed_job.rb
index abc1234..def5678 100644
--- a/db/migrate/20140520143420_add_upload_usage_data_delayed_job.rb
+++ b/db/migrate/20140520143420_add_upload_usage_data_delayed_job.rb
@@ -0,0 +1,10 @@+class AddUploadUsageDataDelayedJob < ActiveRecord::Migration
+ def up
+ Delayed::Job.enqueue UploadUsageData, { :priority => 5, :run_at => DateTime.now.tomorrow.change(:hour => 2, :min => 00) }
+ end
+
+ def down
+ stats = Delayed::Job.enqueue UploadUsageData, { :priority => 5, :run_at => DateTime.now.tomorrow.change(:hour => 2, :min => 00) }
+ stats.delete
+ end
+end
|
Add migration to set up delayed job
|
diff --git a/test/integration/multi_instance/default_spec.rb b/test/integration/multi_instance/default_spec.rb
index abc1234..def5678 100644
--- a/test/integration/multi_instance/default_spec.rb
+++ b/test/integration/multi_instance/default_spec.rb
@@ -3,16 +3,23 @@ it { should be_owned_by 'tomcat_helloworld' }
end
-describe user('tomcat_helloworld') do
- it { should exist }
+describe file('/opt/special/tomcat_docs_8_0_32/LICENSE') do
+ it { should be_file }
+ it { should be_owned_by 'tomcat_docs' }
end
-describe group('tomcat_helloworld') do
- it { should exist }
+%w(tomcat_helloworld tomcat_docs).each do |service_name|
+ describe user(service_name) do
+ it { should exist }
+ end
+
+ describe group(service_name) do
+ it { should exist }
+ end
+
+ describe service(service_name) do
+ it { should be_installed }
+ it { should be_enabled }
+ it { should be_running }
+ end
end
-
-describe service('tomcat_helloworld') do
- it { should be_installed }
- it { should be_enabled }
- it { should be_running }
-end
|
Expand tests for the tomcat_docs install
|
diff --git a/test/document_test.rb b/test/document_test.rb
index abc1234..def5678 100644
--- a/test/document_test.rb
+++ b/test/document_test.rb
@@ -12,7 +12,7 @@
def test_with_no_title
d = Asciidoctor::Document.new("Snorf")
- assert_equal '', d.title
+ assert_nil d.title
end
def test_is_section_heading
|
Fix doc_test_with_no_title to expect nil
|
diff --git a/vendor/plugins/sfu_course_copy_importer/init.rb b/vendor/plugins/sfu_course_copy_importer/init.rb
index abc1234..def5678 100644
--- a/vendor/plugins/sfu_course_copy_importer/init.rb
+++ b/vendor/plugins/sfu_course_copy_importer/init.rb
@@ -0,0 +1,20 @@+# CANVAS-240 Add WebCT wording to new Import Content page
+# This overrides Canvas' own course_copy_importer in /lib/canvas/plugins/default_plugins.rb
+Rails.configuration.to_prepare do
+ require_dependency 'canvas/migration/worker/course_copy_worker'
+ Canvas::Plugin.register 'course_copy_importer', :export_system, {
+ :name => lambda { I18n.t :course_copy_name, 'Copy Canvas/WebCT Course' },
+ :author => 'Instructure',
+ :author_website => 'http://www.instructure.com',
+ :description => lambda { I18n.t :course_copy_description, 'Migration plugin for copying Canvas or WebCT courses' },
+ :version => '1.0.0-sfu',
+ :select_text => lambda { I18n.t :course_copy_file_description, "Copy a Canvas or WebCT Course" },
+ :settings => {
+ :worker => 'CourseCopyWorker',
+ :requires_file_upload => false,
+ :skip_conversion_step => true,
+ :required_options_validator => Canvas::Migration::Validators::CourseCopyValidator,
+ :required_settings => [:source_course_id]
+ },
+ }
+end
|
Add WebCT wording to new Import Content page
CANVAS-240
|
diff --git a/railties/lib/rails/generators/rails/plugin_new/templates/%name%.gemspec b/railties/lib/rails/generators/rails/plugin_new/templates/%name%.gemspec
index abc1234..def5678 100644
--- a/railties/lib/rails/generators/rails/plugin_new/templates/%name%.gemspec
+++ b/railties/lib/rails/generators/rails/plugin_new/templates/%name%.gemspec
@@ -4,6 +4,6 @@ s.name = "<%= name %>"
s.summary = "Insert <%= camelized %> summary."
s.description = "Insert <%= camelized %> description."
- s.files = Dir["lib/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
+ s.files = Dir["{app,config,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
s.version = "0.0.1"
end
|
Add folders app and config to the engine's gemspec if they're available
|
diff --git a/app/models/competitions/blind_date_at_the_dairy_overall.rb b/app/models/competitions/blind_date_at_the_dairy_overall.rb
index abc1234..def5678 100644
--- a/app/models/competitions/blind_date_at_the_dairy_overall.rb
+++ b/app/models/competitions/blind_date_at_the_dairy_overall.rb
@@ -6,25 +6,25 @@
def category_names
[
- "Beginner Men",
- "Beginner Women",
- "Junior Men 10-13",
+ "Category 1/2 Men",
+ "Category 2/3 Men",
+ "Category 3/4 Men",
+ "Category 5 Men",
"Junior Men 14-18",
- "Junior Women 10-13",
+ "Junior Men 9-13",
"Junior Women 14-18",
- "Masters Men A 40+",
- "Masters Men B 40+",
- "Masters Men C 40+",
+ "Junior Women 9-13",
+ "Masters Men 1/2 40+",
+ "Masters Men 2/3 40+",
+ "Masters Men 3/4 40+",
"Masters Men 50+",
"Masters Men 60+",
- "Men A",
- "Men B",
- "Men C",
"Singlespeed",
"Stampede",
- "Women A",
- "Women B",
- "Women C"
+ "Women 1/2",
+ "Women 3",
+ "Women 4",
+ "Women 5",
]
end
|
Update Blind Date categories for 2016
|
diff --git a/app/admin/delivery_update.rb b/app/admin/delivery_update.rb
index abc1234..def5678 100644
--- a/app/admin/delivery_update.rb
+++ b/app/admin/delivery_update.rb
@@ -8,4 +8,15 @@ filter :study
filter :user
filter :created
+
+ index do
+ selectable_column
+ column :study
+ column :user
+ column :data_collection_status
+ column :data_analysis_status
+ column :interpretation_and_write_up_status
+ column :created_at
+ actions
+ end
end
|
Improve the columns show on delivery update admin
|
diff --git a/lib/guard/jekyll.rb b/lib/guard/jekyll.rb
index abc1234..def5678 100644
--- a/lib/guard/jekyll.rb
+++ b/lib/guard/jekyll.rb
@@ -46,11 +46,12 @@ end
def create_site
- options = {
- 'source' => @working_path,
- 'destination' => File.join(@working_path, '_site'),
- 'plugins' => File.join(@working_path, '_plugins')
- }
+ options = { 'source' => @working_path }
+
+ unless File.exists? File.join(@working_path, '_config.yml')
+ options['destination'] = File.join(@working_path, '_site')
+ options['plugins'] = File.join(@working_path, '_plugins')
+ end
config = ::Jekyll.configuration(options)
@jekyll_site = ::Jekyll::Site.new(config)
|
Allow 'destination' and 'plugins' directories to be set in _config.yml
|
diff --git a/lib/hashid/rails.rb b/lib/hashid/rails.rb
index abc1234..def5678 100644
--- a/lib/hashid/rails.rb
+++ b/lib/hashid/rails.rb
@@ -56,7 +56,7 @@ private
def model_reload?
- caller.first(3).any?{|s| s =~ /active_record\/persistence.*reload/}
+ caller.any? {|s| s =~ /active_record\/persistence.*reload/}
end
end
|
Remove model reload scope of first since persistance fell outside
|
diff --git a/spec/fc-reminder/providers/livescore_spec.rb b/spec/fc-reminder/providers/livescore_spec.rb
index abc1234..def5678 100644
--- a/spec/fc-reminder/providers/livescore_spec.rb
+++ b/spec/fc-reminder/providers/livescore_spec.rb
@@ -26,20 +26,16 @@ before { fake_page_with_match(provider.url) }
subject(:results) { provider.run(team_name) }
- it { expect(results).not_to be_empty }
+ it "returns the match details" do
+ details = {
+ :country => "Spain",
+ :league => "Liga BBVA",
+ :time => "21:00",
+ :team1 => "Athletic Bilbao",
+ :team2 => "Barcelona"
+ }
- context "has correct structure" do
- %w(country league time team1 team2).each do |attr|
- it { expect(results).to have_key(attr.to_sym) }
- end
- end
-
- context "has correct types" do
- it { expect(results).to be_an_instance_of(Hash) }
-
- %w(country league time team1 team2).each do |attr|
- it { expect(results[attr.to_sym]).to be_an_instance_of String }
- end
+ expect(results).to eq(details)
end
end
end
|
Change a day with a match LiveScore test
|
diff --git a/lib/locotimezone.rb b/lib/locotimezone.rb
index abc1234..def5678 100644
--- a/lib/locotimezone.rb
+++ b/lib/locotimezone.rb
@@ -12,7 +12,7 @@ end
def self.locotime(options = {})
- set_default_configuration if configuration.nil?
+ configure_with_defaults if configuration.nil?
Locotime.new(location: options.fetch(:location, nil),
address: options.fetch(:address, nil),
skip: options.fetch(:skip, nil)).call
@@ -26,10 +26,10 @@
def self.reset_configuration
self.configuration = Configuration.new
- set_default_configuration
+ configure_with_defaults
end
- def self.set_default_configuration
+ def self.configure_with_defaults
Locotimezone.configure { |config| config.google_api_key = '' }
end
end
|
Change name to configure_with_defaults for clarity
|
diff --git a/lib/mongodoc.rb b/lib/mongodoc.rb
index abc1234..def5678 100644
--- a/lib/mongodoc.rb
+++ b/lib/mongodoc.rb
@@ -6,7 +6,7 @@ gem 'leshill-will_paginate', '2.3.11'
require 'mongo'
-require 'activesupport'
+require 'active_support'
require 'validatable'
require 'will_paginate/collection'
|
Fix Rails 3 deprecation warning
|
diff --git a/actionmailer/lib/action_mailer/log_subscriber.rb b/actionmailer/lib/action_mailer/log_subscriber.rb
index abc1234..def5678 100644
--- a/actionmailer/lib/action_mailer/log_subscriber.rb
+++ b/actionmailer/lib/action_mailer/log_subscriber.rb
@@ -8,7 +8,7 @@ def deliver(event)
info do
recipients = Array(event.payload[:to]).join(', ')
- "\nSent mail to #{recipients} (#{event.duration.round(1)}ms)"
+ "Sent mail to #{recipients} (#{event.duration.round(1)}ms)"
end
debug { event.payload[:mail] }
@@ -16,7 +16,7 @@
# An email was received.
def receive(event)
- info { "\nReceived mail (#{event.duration.round(1)}ms)" }
+ info { "Received mail (#{event.duration.round(1)}ms)" }
debug { event.payload[:mail] }
end
@@ -25,7 +25,7 @@ debug do
mailer = event.payload[:mailer]
action = event.payload[:action]
- "\n#{mailer}##{action}: processed outbound mail in #{event.duration.round(1)}ms"
+ "#{mailer}##{action}: processed outbound mail in #{event.duration.round(1)}ms"
end
end
|
Remove newlines from start of logs
Currently if using a single line logger, this causes the time stamp and
log message to be on separate lines which is not common to how most
other logging works.
|
diff --git a/lib/tasks/brew.rake b/lib/tasks/brew.rake
index abc1234..def5678 100644
--- a/lib/tasks/brew.rake
+++ b/lib/tasks/brew.rake
@@ -14,7 +14,7 @@ def brew_outdated?
`brew update`
output = `brew outdated`
- puts "#{time}: About to upgrade: #{output}" unless output == ''
+ puts "#{time}: *** Upgrading: #{output}" unless output == ''
output != ''
end
|
Make upgrades easier to see in output.
|
diff --git a/Casks/tg-pro.rb b/Casks/tg-pro.rb
index abc1234..def5678 100644
--- a/Casks/tg-pro.rb
+++ b/Casks/tg-pro.rb
@@ -1,6 +1,6 @@ cask :v1 => 'tg-pro' do
- version '2.7.1'
- sha256 'b44547b1c76eb69441c3f41eb3975301ec59c405b645f16d835c4243b82031eb'
+ version '2.7.2'
+ sha256 '6708a9762a62d30e2e83b37cd6c7597d0650e239b5b0f104ef85e5aa25f0c880'
url "http://www.tunabellysoftware.com/resources/TGPro_#{version.gsub('.','_')}.zip"
name 'TG Pro'
|
Update TG Pro.app to v2.7.2
|
diff --git a/client/ruby/flare/app/controllers/application.rb b/client/ruby/flare/app/controllers/application.rb
index abc1234..def5678 100644
--- a/client/ruby/flare/app/controllers/application.rb
+++ b/client/ruby/flare/app/controllers/application.rb
@@ -12,7 +12,7 @@ def query
queries = session[:queries]
if queries.nil? || queries.empty?
- query = "[* TO *]"
+ query = "*:*"
else
query = session[:queries].collect{|q| "#{q[:negative] ? '-' : ''}(#{q[:query]})"}.join(' AND ')
end
|
Switch all-docs query to new *:* syntax
git-svn-id: 3b1ff1236863b4d63a22e4dae568675c2e247730@510345 13f79535-47bb-0310-9956-ffa450edef68
|
diff --git a/test/relation_test.rb b/test/relation_test.rb
index abc1234..def5678 100644
--- a/test/relation_test.rb
+++ b/test/relation_test.rb
@@ -2,7 +2,9 @@
describe ActiveRecord::Relation do
let(:relation) {
- if ActiveRecord::VERSION::MAJOR > 4
+ if ActiveRecord.gem_version >= Gem::Version.new("5.2")
+ ActiveRecord::Relation.new(klass, table: stub, predicate_builder: stub)
+ elsif ActiveRecord::VERSION::MAJOR > 4
ActiveRecord::Relation.new(klass, stub, stub)
else
ActiveRecord::Relation.new(klass, stub)
|
Support rails 5.2 relation signature
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.