diff stringlengths 65 26.7k | message stringlengths 7 9.92k |
|---|---|
diff --git a/rom-sql.gemspec b/rom-sql.gemspec
index abc1234..def5678 100644
--- a/rom-sql.gemspec
+++ b/rom-sql.gemspec
@@ -20,7 +20,7 @@
spec.add_runtime_dependency "sequel", "~> 4.17"
spec.add_runtime_dependency "equalizer", "~> 0.0", ">= 0.0.9"
- spec.add_runtime_dependency "rom", "~> 0.4", "~> 0.4.0"
+ spec.add_runtime_dependency "rom", "~> 0.4", ">= 0.4.0"
spec.add_development_dependency "bundler"
spec.add_development_dependency "rake", "~> 10.0"
| Fix rom version in gemspec
|
diff --git a/lib/be_valid_asset/be_valid_css.rb b/lib/be_valid_asset/be_valid_css.rb
index abc1234..def5678 100644
--- a/lib/be_valid_asset/be_valid_css.rb
+++ b/lib/be_valid_asset/be_valid_css.rb
@@ -20,7 +20,7 @@ # The validator return a 500 Error if it's sent empty string
fragment = ' ' if fragment.empty?
- query_params = { :text => fragment, :profile => @profile }
+ query_params = { :text => fragment, :profile => @profile, :vextwarning => 'true' }
return validate(query_params)
end
| Add the option not to error if vendor specific extensions are used.
|
diff --git a/lib/brightbox-cli/server_groups.rb b/lib/brightbox-cli/server_groups.rb
index abc1234..def5678 100644
--- a/lib/brightbox-cli/server_groups.rb
+++ b/lib/brightbox-cli/server_groups.rb
@@ -51,7 +51,9 @@ end
def server_ids
- @server_ids ||= attributes["servers"].collect { |s| s["id"] } if attributes["servers"]
+ if attributes["servers"]
+ @server_ids ||= attributes["servers"].collect { |s| s["id"] }.join(" ")
+ end
end
end
| Join servers by whitespace rather than comma in group show
|
diff --git a/core/spec/models/user_spec.rb b/core/spec/models/user_spec.rb
index abc1234..def5678 100644
--- a/core/spec/models/user_spec.rb
+++ b/core/spec/models/user_spec.rb
@@ -1,6 +1,6 @@ require 'spec_helper'
-describe User do
+describe Spree::User do
context "validation" do
it { should have_valid_factory(:user) }
| Fix User ref in user spec
|
diff --git a/lib/etl/processor/database_join_processor.rb b/lib/etl/processor/database_join_processor.rb
index abc1234..def5678 100644
--- a/lib/etl/processor/database_join_processor.rb
+++ b/lib/etl/processor/database_join_processor.rb
@@ -0,0 +1,68 @@+module ETL
+ module Processor
+ class DatabaseJoinProcessor < ETL::Processor::RowProcessor
+ attr_reader :target
+ attr_reader :query
+ attr_reader :fields
+
+ # Initialize the procesor.
+ #
+ # Arguments:
+ # * <tt>control</tt>: The ETL::Control::Control instance
+ # * <tt>configuration</tt>: The configuration Hash
+ # * <tt>definition</tt>: The source definition
+ #
+ # Required configuration options:
+ # * <tt>:target</tt>: The target connection
+ # * <tt>:query</tt>: The join query
+ # * <tt>:fields</tt>: The fields to add to the row
+ def initialize(control, configuration)
+ super
+ @target = configuration[:target]
+ @query = configuration[:query]
+ @fields = configuration[:fields]
+ end
+
+ # Get a String identifier for the source
+ def to_s
+ "#{host}/#{database}"
+ end
+
+ def process(row)
+ return nil if row.nil?
+
+ q = @query
+ begin
+ q = eval('"' + @query + '"')
+ rescue
+ end
+
+ ETL::Engine.logger.debug("Executing select: #{q}")
+ res = connection.execute(q)
+
+ res.each_hash do |r|
+ @fields.each do |field|
+ row[field.to_sym] = r[field]
+ end
+ end
+
+ return row
+ end
+
+ private
+ # Get the database connection to use
+ def connection
+ ETL::Engine.connection(target)
+ end
+
+ # Get the host, defaults to 'localhost'
+ def host
+ ETL::Base.configurations[target.to_s]['host'] || 'localhost'
+ end
+
+ def database
+ ETL::Base.configurations[target.to_s]['database']
+ end
+ end
+ end
+end
| Add a join lookup step to get data from an another database
|
diff --git a/lib/filestore.rb b/lib/filestore.rb
index abc1234..def5678 100644
--- a/lib/filestore.rb
+++ b/lib/filestore.rb
@@ -8,6 +8,7 @@ @db.type_translation = true
@db.execute("create table if not exists sensor_reads
(sensor string, date integer, value real)")
+ @mutex = Mutex.new
end
def write(sensor, date, value)
@@ -30,6 +31,18 @@ @db.close
end
+ # Guard operations that access the database with a lock
+ [:write, :average, :close].each do |m|
+ old = instance_method(m)
+ define_method(m) do |*args|
+ ret = nil
+ @mutex.synchronize do
+ ret = old.bind(self).call(*args)
+ end
+ ret
+ end
+ end
+
# HACK: disable warnings when running any of the methods to work around
# buggy sqlite
[:initialize, :write, :average, :close].each do |m|
@@ -38,9 +51,8 @@ $-w = false
ret = old.bind(self).call(*args)
$-w = true
- return ret
+ ret
end
end
-
end
end
| Add a lock around DB operations to guard agains concurrent sqlite access.
|
diff --git a/lib/tasks/wheres-your-database-yml-dude.rake b/lib/tasks/wheres-your-database-yml-dude.rake
index abc1234..def5678 100644
--- a/lib/tasks/wheres-your-database-yml-dude.rake
+++ b/lib/tasks/wheres-your-database-yml-dude.rake
@@ -0,0 +1,11 @@+file "config/database.yml.template" do |task|
+ abort "I don't know what to tell you, dude. There's no #{task.name}. So maybe you should make one of those, and see where that gets you."
+end
+
+file "config/database.yml" => "config/database.yml.template" do |task|
+ puts "Dude! I found #{task.prerequisites.first}, so I'll make a copy of it for you."
+ cp task.prerequisites.first, task.name
+ abort "Make sure it's cromulent to your setup, then rerun the last command."
+end
+
+task :environment => "config/database.yml"
| Add warning when you have no database config
|
diff --git a/lib/fastlane/actions/clean_cocoapods_cache.rb b/lib/fastlane/actions/clean_cocoapods_cache.rb
index abc1234..def5678 100644
--- a/lib/fastlane/actions/clean_cocoapods_cache.rb
+++ b/lib/fastlane/actions/clean_cocoapods_cache.rb
@@ -0,0 +1,39 @@+module Fastlane
+ module Actions
+ class CleanCocoapodsCacheAction < Action
+ def self.run(params)
+ Actions.verify_gem!('cocoapods')
+
+ cmd = ['pod cache clean']
+
+ cmd << "#{params[:name]}" if params[:name]
+ cmd << '--all'
+ end
+
+ def self.description
+ "Remove the cache for pods"
+ end
+
+ def self.available_options
+ [
+ FastlaneCore::ConfigItem.new(key: :name,
+ env_name: "FL_CLEAN_COCOAPODS_CACHE_DEVELOPMENT",
+ description: "Pod name to be removed from cache",
+ optional: true,
+ is_string: true,
+ verify_block: proc do |value|
+ raise "You must specify pod name which should be removed from cache".red unless (value and not value.empty?)
+ end)
+ ]
+ end
+
+ def self.authors
+ ["alexmx"]
+ end
+
+ def self.is_supported?(platform)
+ [:ios, :mac].include? platform
+ end
+ end
+ end
+end
| Add new action for cocoapods cache cleanup.
|
diff --git a/lib/license_finder/package_managers/pipenv.rb b/lib/license_finder/package_managers/pipenv.rb
index abc1234..def5678 100644
--- a/lib/license_finder/package_managers/pipenv.rb
+++ b/lib/license_finder/package_managers/pipenv.rb
@@ -15,7 +15,7 @@ begin
packages = {}
each_dependency(groups: allowed_groups) do |name, data, group|
- version = canonicalize(data['version'])
+ version = canonicalize(data['version'] || 'unknown')
package = packages.fetch(key_for(name, version)) do |key|
packages[key] = build_package_for(name, version)
end
| Fix parsing Pipfile when version isn't defined
Normally this would cause `'canonicalize': undefined method 'sub' for nil:NilClass (NoMethodError)` |
diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/comments_controller.rb
+++ b/app/controllers/comments_controller.rb
@@ -16,7 +16,7 @@ post '/users/:user_id/posts/:post_id/comments' do
@post = Post.find(params[:post_id]) #define intstance variable for view
@user = User.find(params[:user_id])
- @comment = @post.comments.new(body: params[:body], user_id: @user.id) #create new comment
+ @comment = @post.comments.new(body: params[:body], user_id: current_user.id) #create new comment
if @comment.save
redirect "/users/#{@user.id}/posts/#{@post.id}"
| Fix comment error where user was @user instead of current_user
|
diff --git a/app/controllers/entities_controller.rb b/app/controllers/entities_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/entities_controller.rb
+++ b/app/controllers/entities_controller.rb
@@ -2,7 +2,7 @@ def menu_metrics
e = Entity.find(params[:id].to_i)
if e
- @graphs = e.graphs.includes(:instances)
+ @graphs = e.graphs.includes(:instances).sort_by { |g| g.title }
end
render :layout => false
end
| Fix the metrics sorting in menu
|
diff --git a/app/controllers/explorer_controller.rb b/app/controllers/explorer_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/explorer_controller.rb
+++ b/app/controllers/explorer_controller.rb
@@ -9,7 +9,7 @@
protected
def check_mongo_blacklist
- if !can_read_database?
+ if current_database_name && !can_read_database?
render "shared/blacklist"
return
end
| Fix bug for /explorer that was throwing an exception
|
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
@@ -10,7 +10,6 @@ end
def create
- raise params
if auth_hash = request.env['omniauth.auth']
if @user = User.find_by(name: auth_hash["info"]["name"])
session[:user_id] = @user.id
| Remove raise params from sessions controller doesn't display through Heroku
|
diff --git a/app/controllers/watchers_controller.rb b/app/controllers/watchers_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/watchers_controller.rb
+++ b/app/controllers/watchers_controller.rb
@@ -19,7 +19,7 @@
def require_watcher_edit_priviledges
can_edit = current_user == @watcher.user || current_user.admin?
- redirect_to(root_path) and return(false) unless can_edit
+ redirect_to(root_path) unless can_edit
end
end
| Remove return(false) from before_filter "require_watcher_edit_priviledges"
|
diff --git a/lib/google/api_client/auth/service_account.rb b/lib/google/api_client/auth/service_account.rb
index abc1234..def5678 100644
--- a/lib/google/api_client/auth/service_account.rb
+++ b/lib/google/api_client/auth/service_account.rb
@@ -27,9 +27,6 @@ }
end
credentials.reverse_merge!(options)
-
- puts credentials.to_yaml
-
@authorization = Signet::OAuth2::Client.new(credentials)
end
| Remove a silly puts line.
|
diff --git a/lib/trysail_blog_notification/last_article.rb b/lib/trysail_blog_notification/last_article.rb
index abc1234..def5678 100644
--- a/lib/trysail_blog_notification/last_article.rb
+++ b/lib/trysail_blog_notification/last_article.rb
@@ -34,6 +34,36 @@ @last_update = last_update
end
+ # Convert to Hash.
+ #
+ # @return [Hash]
+ def to_h
+ {
+ title: @title,
+ url: @url,
+ last_update: @last_update,
+ }
+ end
+
+ alias_method :to_hash, :to_h
+
+ # Get hash object
+ #
+ # @param [Object] key
+ # @return [Object]
+ def [](key)
+ case key
+ when 'title', :title
+ @title
+ when 'url', :url
+ @url
+ when 'last_update', :last_update
+ @last_update
+ else
+ nil
+ end
+ end
+
private
# Set url
| Implement "to_h" and "[]" method in TrySailBlogNotification::LastArticle
|
diff --git a/app/helpers/image_helper.rb b/app/helpers/image_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/image_helper.rb
+++ b/app/helpers/image_helper.rb
@@ -1,9 +1,11 @@ module ImageHelper
+ # TODO ENV, not raw strings
def thumbor_image_tag(source, options={})
- image_tag("https://thumbs.picyo.me/"+source, options)
+ image_tag("https://thumbs.mskog.com/"+source, options)
end
+ # TODO ENV, not raw strings
def thumbor_image_url(source)
- "https://thumbs.picyo.me/#{source}"
+ "https://thumbs.mskog.com/#{source}"
end
end
| Use new url for thumbor
|
diff --git a/app/helpers/plans_helper.rb b/app/helpers/plans_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/plans_helper.rb
+++ b/app/helpers/plans_helper.rb
@@ -6,4 +6,12 @@ plan.date.strftime("%B '%y")
end
end
+
+ def ids_of_past_plans(current_plan_id)
+ arr = current_user.past_plans.map do |plan|
+ plan.id
+ end
+ index_of_current_plan = arr.index(current_plan_id-1)
+ arr[0..index_of_current_plan]
+ end
end
| Write helper method to identity past plans from
the reference of the current plan being viewed.
|
diff --git a/rundock.gemspec b/rundock.gemspec
index abc1234..def5678 100644
--- a/rundock.gemspec
+++ b/rundock.gemspec
@@ -13,7 +13,7 @@ spec.homepage = 'https://github.com/hiracy/rundock'
spec.license = 'MIT'
- spec.files = `git ls-files -z`.split('\x0').reject { |f| f.match(%r{^(test|spec|features)/}) }
+ spec.files = `git ls-files`.split($/)
spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']
| Fix spec.executables not found \x0 separated strings.
|
diff --git a/app/mailers/admin_mailer.rb b/app/mailers/admin_mailer.rb
index abc1234..def5678 100644
--- a/app/mailers/admin_mailer.rb
+++ b/app/mailers/admin_mailer.rb
@@ -10,6 +10,11 @@ def profile_published(profile)
@profile = profile
@url = 'https://www.speakerinnen.org'
- mail(to: @profile.email, subject: I18n.t('devise.mailer.published.subject'))
+ I18n.with_locale(@profile.locale) do
+ mail(
+ to: @profile.email,
+ subject: I18n.t('devise.mailer.published.subject')
+ )
+ end
end
end
| Add the locale to the profile_published mailer
|
diff --git a/lib/monk/glue.rb b/lib/monk/glue.rb
index abc1234..def5678 100644
--- a/lib/monk/glue.rb
+++ b/lib/monk/glue.rb
@@ -26,8 +26,6 @@ set :static, true
set :views, root_path("app", "views")
- use Rack::Session::Cookie
-
configure :development do
require "monk/glue/reloader"
| Remove redundant use of Rack::Session::Cookie.
|
diff --git a/config/initializers/csp.rb b/config/initializers/csp.rb
index abc1234..def5678 100644
--- a/config/initializers/csp.rb
+++ b/config/initializers/csp.rb
@@ -1,15 +1,15 @@ SecureHeaders::Configuration.default do |config|
config.csp = {
- report_only: Rails.env.production?, # default: false
+ report_only: !Rails.env.production?, # default: false
preserve_schemes: true, # default: false.
- default_src: %w(‘none’), # nothing allowed
+ default_src: %w('none'), # nothing allowed
font_src: %w('self' fonts.gstatic.com),
script_src: %w('self'),
connect_src: %w('self'),
img_src: %w('self'),
style_src: %w('unsafe-inline' 'self' fonts.googleapis.com,),
- report_uri: ["https://payload.report-uri.io/r/default/csp/reportOnly"]
+ report_uri: ['https://payload.report-uri.io/r/default/csp/enforce']
}
end
| Update CSP, report_only is false in production, and update report_uri
|
diff --git a/lib/rich_text.rb b/lib/rich_text.rb
index abc1234..def5678 100644
--- a/lib/rich_text.rb
+++ b/lib/rich_text.rb
@@ -13,5 +13,5 @@ # end
#
require 'rich_text/engine'
-require 'app/helpers/rich_text_helper'
+require '../app/helpers/rich_text_helper'
ActionView::Base.send :include, RichTextHelper | Fix path to helper file
|
diff --git a/lib/rom/model.rb b/lib/rom/model.rb
index abc1234..def5678 100644
--- a/lib/rom/model.rb
+++ b/lib/rom/model.rb
@@ -2,6 +2,7 @@ module Model
class ValidationError < CommandError
include Charlatan.new(:errors)
+ include Equalizer.new(:errors)
end
end
end
| Add equalizer to validation error and form classes
|
diff --git a/lib/tilt/opal.rb b/lib/tilt/opal.rb
index abc1234..def5678 100644
--- a/lib/tilt/opal.rb
+++ b/lib/tilt/opal.rb
@@ -8,6 +8,10 @@ module Opal
class TiltTemplate < Tilt::Template
self.default_mime_type = 'application/javascript'
+
+ def self.inherited(subclass)
+ subclass.default_mime_type = 'application/javascript'
+ end
def self.engine_initialized?
true
| Mark all subclasses of TiltTemplate with JS Mime |
diff --git a/test/generator/files/generate_cases_test.rb b/test/generator/files/generate_cases_test.rb
index abc1234..def5678 100644
--- a/test/generator/files/generate_cases_test.rb
+++ b/test/generator/files/generate_cases_test.rb
@@ -8,6 +8,17 @@ Dir.stub :glob, %w(/alpha_cases.rb hy_phen_ated_cases.rb) do
assert_equal %w(alpha hy-phen-ated), GeneratorCases.available(track_path)
end
+ end
+
+ def test_available_calls_glob_with_the_right_arguments
+ track_path = '/track'
+ expected_glob = "#{track_path}/exercises/*/.meta/generator/*_cases.rb"
+ mock_glob_call = Minitest::Mock.new
+ mock_glob_call.expect :call, [], [expected_glob, File::FNM_DOTMATCH]
+ Dir.stub :glob, mock_glob_call do
+ GeneratorCases.available(track_path)
+ end
+ mock_glob_call.verify
end
def test_filename
| Test that glob is called with expected arguments
|
diff --git a/app/reports/progress_bar.rb b/app/reports/progress_bar.rb
index abc1234..def5678 100644
--- a/app/reports/progress_bar.rb
+++ b/app/reports/progress_bar.rb
@@ -17,10 +17,7 @@ end
def bar
- progress_bar_string = String.new
- bar_progress.times { progress_bar_string << '=' }
- bar_remainder.times { progress_bar_string << ' ' }
- "[#{progress_bar_string}]"
+ "[#{''.ljust(bar_progress, '=')}#{''.ljust(bar_remainder, ' ')}]"
end
def bar_progress
| Stop creating ProgressBar string objects
+ Lots of unnecessary memory being created at progress_bar.rb:22
+ https://github.com/studentinsights/studentinsights/issues/11#issuecomment-207132740
+ #11
|
diff --git a/library/openstruct/new_ostruct_member_spec.rb b/library/openstruct/new_ostruct_member_spec.rb
index abc1234..def5678 100644
--- a/library/openstruct/new_ostruct_member_spec.rb
+++ b/library/openstruct/new_ostruct_member_spec.rb
@@ -10,13 +10,14 @@ it "creates an attribute reader method for the passed method_name" do
@os.respond_to?(:age).should be_false
@os.new_ostruct_member(:age)
- @os.respond_to?(:age).should be_true
+ @os.method(:age).call.should == 20
end
it "creates an attribute writer method for the passed method_name" do
@os.respond_to?(:age=).should be_false
@os.new_ostruct_member(:age)
- @os.respond_to?(:age=).should be_true
+ @os.method(:age=).call(42).should == 42
+ @os.age.should == 42
end
it "does not allow overwriting existing methods" do
| OpenStruct: Improve the spec of new_ostruct_member, even though it will
most likely disappear altogether as this method should be private.
|
diff --git a/tools/extract_top_starred_nodejs_modules.rb b/tools/extract_top_starred_nodejs_modules.rb
index abc1234..def5678 100644
--- a/tools/extract_top_starred_nodejs_modules.rb
+++ b/tools/extract_top_starred_nodejs_modules.rb
@@ -0,0 +1,28 @@+
+require 'rubygems'
+require 'nokogiri'
+require 'open-uri'
+
+# USAGE:
+# ruby extract_top_starred_nodejs_modules.rb > output.txt
+#
+
+LIMIT = 50
+
+package_links = []
+
+page = Nokogiri::HTML(open("https://www.npmjs.com/browse/star"))
+
+while (package_links.size < LIMIT)
+ package_links.concat page.css('.package-details a.name').map{ |e| e.attribute("href").value }.flatten
+
+ next_page_uri = page.css('.pagination .next').attribute("href").value
+ page = Nokogiri::HTML(open("https://www.npmjs.com#{next_page_uri}"))
+end
+
+for package_link in package_links[0...LIMIT]
+ package_page = Nokogiri::HTML(open("https://www.npmjs.com#{package_link}"))
+ git_repository = package_page.css('.sidebar .box a')[1].attribute("href").value + ".git"
+
+ puts git_repository
+end | Add (ruby) script to extract top X most starred node.js modules from npmjs.com
|
diff --git a/lib/autoparts/packages/nodejs.rb b/lib/autoparts/packages/nodejs.rb
index abc1234..def5678 100644
--- a/lib/autoparts/packages/nodejs.rb
+++ b/lib/autoparts/packages/nodejs.rb
@@ -5,12 +5,12 @@ module Packages
class Nodejs < Package
name 'nodejs'
- version '0.10.33'
+ version '0.10.35'
description "Node.JS: A platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications"
category Category::PROGRAMMING_LANGUAGES
- source_url 'http://nodejs.org/dist/v0.10.33/node-v0.10.33-linux-x64.tar.gz'
- source_sha1 '4eba69caf7368d7f388700eb02996f85b06f457a'
+ source_url 'http://nodejs.org/dist/v0.10.35/node-v0.10.35-linux-x64.tar.gz'
+ source_sha1 '3a202a749492e48542d2c28220e43ef6dae084bc'
source_filetype 'tar.gz'
def install
| Update Node.JS to latest stable v0.10.35
Taken directly from http://nodejs.org/dist/v0.10.35/ |
diff --git a/lib/varnish/lib/cartodb-varnish.rb b/lib/varnish/lib/cartodb-varnish.rb
index abc1234..def5678 100644
--- a/lib/varnish/lib/cartodb-varnish.rb
+++ b/lib/varnish/lib/cartodb-varnish.rb
@@ -38,7 +38,7 @@ retry
else
if Cartodb::config[:varnish_management]["critical"] == true
- raise "Varnish error while trying to connect to #{conf[:host]}:#{conf[:port]} #{e}"
+ raise "Varnish error while trying to connect to #{conf["host"]}:#{conf["port"]} #{e}"
end
end
end
| Fix varnish connection error message from ruby
|
diff --git a/lib/ghtml2pdf/argument_parser.rb b/lib/ghtml2pdf/argument_parser.rb
index abc1234..def5678 100644
--- a/lib/ghtml2pdf/argument_parser.rb
+++ b/lib/ghtml2pdf/argument_parser.rb
@@ -3,15 +3,16 @@ class ArgumentParser
attr_reader :input, :output
+ # Error class raised for missing arguments
+ class MissingArgument < StandardError; end
+
def initialize(argv)
@input, @output, = argv
unless @input
- warn 'An input filename is required'
- exit 1
+ raise MissingArgument, 'An input filename is required'
end
unless @output
- warn 'An output filename is required'
- exit 1
+ raise MissingArgument, 'An output filename is required'
end
end
end
| Raise exception instead of exiting in ArgumentParser
|
diff --git a/lib/relix/indexes/primary_key.rb b/lib/relix/indexes/primary_key.rb
index abc1234..def5678 100644
--- a/lib/relix/indexes/primary_key.rb
+++ b/lib/relix/indexes/primary_key.rb
@@ -1,6 +1,11 @@ module Relix
class PrimaryKeyIndex < Index
include Ordering
+
+ def initialize(set, base_name, accessor, options={})
+ options[:immutable_attribute] = true unless options.has_key?(:immutable_attribute)
+ super
+ end
def watch
name
@@ -29,10 +34,6 @@ def eq(r, value, options)
[value]
end
-
- def attribute_immutable?
- true
- end
end
register_index PrimaryKeyIndex
-end+end
| Refactor the primary key immutability to use the standard index option.
This allows you to override it an set `immutable_attribute: false`. I doubt that's ever very useful (or that you should do that) but hey, this is ruby: we give you the flexibility to shoot yourself in the foot.
|
diff --git a/lib/hydra_attribute/active_record/scoping.rb b/lib/hydra_attribute/active_record/scoping.rb
index abc1234..def5678 100644
--- a/lib/hydra_attribute/active_record/scoping.rb
+++ b/lib/hydra_attribute/active_record/scoping.rb
@@ -6,7 +6,7 @@ module ClassMethods
def scoped(options = nil)
relation = super(options)
- relation.singleton_class.send :include, Relation
+ relation.singleton_class.send(:include, Relation) unless relation.is_a?(Relation)
relation
end
end
| Include HydraAttribute::ActiveRecord::Relation once per each relation object
|
diff --git a/acceptance/config/aio/options.rb b/acceptance/config/aio/options.rb
index abc1234..def5678 100644
--- a/acceptance/config/aio/options.rb
+++ b/acceptance/config/aio/options.rb
@@ -3,6 +3,5 @@ :pre_suite => [
'setup/common/pre-suite/000-delete-puppet-when-none.rb',
'setup/aio/pre-suite/010_Install.rb',
- 'setup/aio/pre-suite/020_InstallCumulusModules.rb',
],
}
| Revert "(HI-489) Add Cumulus Support"
This reverts commit d9aaa573db4a2ed70fc526299b3417d3a827885b.
|
diff --git a/Snail.podspec b/Snail.podspec
index abc1234..def5678 100644
--- a/Snail.podspec
+++ b/Snail.podspec
@@ -1,6 +1,6 @@ Pod::Spec.new do |s|
s.name = "Snail"
- s.version = "0.2.11"
+ s.version = "0.3.0"
s.summary = "An observables framework for Swift"
s.homepage = "https://github.com/UrbanCompass/Snail"
s.license = "MIT"
| Update podspec to point to most recent tag
|
diff --git a/vcs/local.rb b/vcs/local.rb
index abc1234..def5678 100644
--- a/vcs/local.rb
+++ b/vcs/local.rb
@@ -7,7 +7,7 @@
def local_commit! ( *args )
common_commit!("k2.0 <%= rev %>: <%= title %>", *args) do |subject|
- mail!(:to => %w[kernelteam@gostai.com],
+ mail!(:to => %w[kernel-patches@lists.gostai.com],
:subject => subject)
end
end
| Send the patches to the mailing list.
git-svn-id: 47ecf0eee40ae8baa1bb5e98a22c0bda2f631ce9@1530 1e37f2df-8004-0410-ba96-adcf012cb36e
|
diff --git a/overlord.gemspec b/overlord.gemspec
index abc1234..def5678 100644
--- a/overlord.gemspec
+++ b/overlord.gemspec
@@ -4,7 +4,7 @@ require 'overlord/version'
Gem::Specification.new do |spec|
- spec.name = "overlord"
+ spec.name = "daemon-overlord"
spec.version = Overlord::VERSION
spec.authors = ["Dustin Morrill"]
spec.email = ["dmorrill10@gmail.com"]
| Rename to avoid conflict in rubygems.org
|
diff --git a/test/controllers/commits_controller_test.rb b/test/controllers/commits_controller_test.rb
index abc1234..def5678 100644
--- a/test/controllers/commits_controller_test.rb
+++ b/test/controllers/commits_controller_test.rb
@@ -2,9 +2,7 @@
class CommitsControllerTest < ActionController::TestCase
before do
- goal = create :goal, points: 10
- round = create :round, :open
- user = create :user, :auth_token => 'dah123rty', goal: goal
+ user = create :user, :auth_token => 'dah123rty'
5.times.each do |i|
create :commit, user: user, commit_date: Date.today, message: "commit_#{i}"
end
| Fix test cases of commits controller
|
diff --git a/lib/presenters/series_presenter.rb b/lib/presenters/series_presenter.rb
index abc1234..def5678 100644
--- a/lib/presenters/series_presenter.rb
+++ b/lib/presenters/series_presenter.rb
@@ -4,11 +4,14 @@ presented = default
presented["contact"] = ContactPresenter.new( @model.contact ).present if @model.contact
presented["releases"] = []
- @model.releases.order_by(:slug.asc).each do |release|
+ @model.releases.where(:state=>"released").order_by(:slug.asc).each do |release|
presented["releases"] << ModelPresenter.new( release ).present
end
latest_release = @model.releases.where(:state=>"released").order_by(:slug.desc).first
presented["latest_release"] = ModelPresenter.new( latest_release ).present
+ next_release = @model.releases.where(:state=>"scheduled").order_by(:slug.desc).first
+ presented["next_release"] = ModelPresenter.new( next_release ).present
+
presented
end
end | Add next_release and filter list of releases
|
diff --git a/lib/tytus/controller_extensions.rb b/lib/tytus/controller_extensions.rb
index abc1234..def5678 100644
--- a/lib/tytus/controller_extensions.rb
+++ b/lib/tytus/controller_extensions.rb
@@ -7,6 +7,8 @@ base.extend ClassMethods
if base.respond_to? :class_inheritable_accessor
base.class_inheritable_accessor :_page_title
+ elsif base.respond_to? :class_attribute
+ base.class_attribute :_page_title
else
base.superclass_delegating_accessor :_page_title
end
| Add extra fallback as guided by specs.
|
diff --git a/app/helpers/blockchain_helper.rb b/app/helpers/blockchain_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/blockchain_helper.rb
+++ b/app/helpers/blockchain_helper.rb
@@ -1,12 +1,21 @@ module BlockChainHelper
require 'blockchain'
+
# Add shit from the gem here
def send(user, amount)
+ wallet.send(user.address, amount, from_address)
end
def receive(user, amount)
+ wallet.send(user.address, amount, from_address)
end
+
+ private
+
+ from_address = "1FeUWyhBvfjGyN4Ku4pUYSTQNw8vfRyWru"
+
+ wallet = Blockchain::Wallet.new('8316b206-1abc-4faa-8de8-6226b3ca3d10', 'Cicadas2015')
end | Add send and recieve helpers
|
diff --git a/test/helpers/test_file_helper.rb b/test/helpers/test_file_helper.rb
index abc1234..def5678 100644
--- a/test/helpers/test_file_helper.rb
+++ b/test/helpers/test_file_helper.rb
@@ -17,5 +17,14 @@ def with_file(path, type, hash)
with_files( [ {path: path, type: type} ], hash)
end
+
+ def upload_file_csv(path)
+ Rack::Test::UploadedFile.new(Rails.root.join(path))
+ end
+
+ def upload_file(path, type)
+ Rack::Test::UploadedFile.new(Rails.root.join(path), type)
+ end
+
end
end
| NEW: Add a helper to get file path from root
|
diff --git a/lib/spreedly/payment_methods/credit_card.rb b/lib/spreedly/payment_methods/credit_card.rb
index abc1234..def5678 100644
--- a/lib/spreedly/payment_methods/credit_card.rb
+++ b/lib/spreedly/payment_methods/credit_card.rb
@@ -2,7 +2,7 @@
class CreditCard < PaymentMethod
field :first_name, :last_name, :number, :last_four_digits, :card_type, :verification_value
- field :month, :year, :address1, :address2, :city, :state, :country, :phone_number
+ field :full_name, :month, :year, :address1, :address2, :city, :state, :country, :phone_number
end
| Support full_name in credit card
|
diff --git a/lib/tritium/engines/standard/scopes/node.rb b/lib/tritium/engines/standard/scopes/node.rb
index abc1234..def5678 100644
--- a/lib/tritium/engines/standard/scopes/node.rb
+++ b/lib/tritium/engines/standard/scopes/node.rb
@@ -5,8 +5,34 @@ def node_invocation(ins, ctx, pos_args, kwd_args)
case ins.name
when :select
- doc = Context[ins, ctx.value.xpath(pos_args.first)]
- run_children(ins, doc)
+ nodeset = ctx.value.xpath(pos_args.first)
+ nodeset.each do |node|
+ doc = Context[ins, node]
+ run_children(ins, doc)
+ end
+ when :inner
+ inner = Context[ins, ctx.value.inner_html]
+ run_children(ins, inner)
+ ctx.value.inner_html = inner.value
+ when :text
+ text = Context[ins, ctx.value.text]
+ run_children(ins, text)
+ ctx.value.text = text.value
+ when :remove
+ ctx.value.remove()
+ when :name
+ name = Context[ins, ctx.value.name]
+ run_children(ins, name)
+ ctx.value.name = name.value
+ when :attribute
+ name = pos_args.first
+ xml_attribute = ctx.value.attribute(name)
+ if xml_attribute.nil?
+ ctx.value[name] = ""
+ xml_attribute = ctx.value.attribute(name)
+ end
+ attribute = Context[ins, xml_attribute]
+ run_children(ins, attribute)
else
throw "Method #{ins.name} not implemented in Node scope"
end
| Implement a whole bunch of Node methods |
diff --git a/test.rb b/test.rb
index abc1234..def5678 100644
--- a/test.rb
+++ b/test.rb
@@ -0,0 +1,30 @@+require 'target/wunderboss-all.jar'
+
+# Setup logging to stdout with simple format
+logger = java.util.logging.Logger.getLogger("")
+logger.level = java.util.logging.Level::INFO
+class WunderBossFormatter < java.util.logging.Formatter
+ def format(record)
+ prefix = "#{record.level} [#{record.logger_name}]"
+ msg = "#{prefix} #{record.message}\n"
+ if record.thrown
+ msg << "#{prefix} #{record.thrown.message}\n"
+ record.thrown.stack_trace.each do |trace|
+ msg << "#{prefix} #{trace}\n"
+ end
+ end
+ msg
+ end
+end
+formatter = WunderBossFormatter.new
+logger.handlers.each do |handler|
+ handler.formatter = formatter
+end
+
+
+require 'rack'
+app, _ = Rack::Builder.parse_file "config.ru"
+
+wunderboss = Java::IoWunderboss::WunderBoss.new
+wunderboss.deploy_rack_application("/foo", app)
+wunderboss.start('localhost', 8080)
| Add Ruby script for example of embedding WunderBoss
|
diff --git a/manageiq-appliance-dependencies.rb b/manageiq-appliance-dependencies.rb
index abc1234..def5678 100644
--- a/manageiq-appliance-dependencies.rb
+++ b/manageiq-appliance-dependencies.rb
@@ -1,3 +1,3 @@ # Add gems here, in Gemfile syntax, which are dependencies of the appliance itself rather than a part of the ManageIQ application
-gem "manageiq-appliance_console", "~>1.2", ">=1.2.4", :require => false
-gem "manageiq-postgres_ha_admin", "~>1.0.0", :require => false
+gem "manageiq-appliance_console", "~>2.0", :require => false
+gem "manageiq-postgres_ha_admin", "~>1.0.0", :require => false
| Use version 2 of appliance console
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1540686
|
diff --git a/manageiq-automation_engine.gemspec b/manageiq-automation_engine.gemspec
index abc1234..def5678 100644
--- a/manageiq-automation_engine.gemspec
+++ b/manageiq-automation_engine.gemspec
@@ -15,6 +15,8 @@
s.files = Dir["{app,lib}/**/*", "LICENSE.txt", "Rakefile", "README.md"]
+ s.add_dependency "rubyzip", "~>1.2.1"
+
s.add_development_dependency "codeclimate-test-reporter", "~> 1.0.0"
s.add_development_dependency "simplecov"
end
| Add dependency on rubyzip gem
|
diff --git a/tasks/write-buildpack-pivnet-metadata/run.rb b/tasks/write-buildpack-pivnet-metadata/run.rb
index abc1234..def5678 100644
--- a/tasks/write-buildpack-pivnet-metadata/run.rb
+++ b/tasks/write-buildpack-pivnet-metadata/run.rb
@@ -13,7 +13,7 @@ buildpack_files = ''
Dir.chdir('pivotal-buildpacks-cached') do
- buildpack_files = Dir["#{buildpack}_buildpack-cached-*-v*.zip"]
+ buildpack_files = Dir["#{buildpack}_buildpack-cached*-v*.zip"]
end
if buildpack_files.count != 1
| Fix glob match for cached bp in write pivnet metadata
[#157745313]
Signed-off-by: Tyler Phelan <5713437ebd3bcae14564c2baaa7816b900ed174c@pivotal.io>
|
diff --git a/app/controllers/sessions.rb b/app/controllers/sessions.rb
index abc1234..def5678 100644
--- a/app/controllers/sessions.rb
+++ b/app/controllers/sessions.rb
@@ -4,9 +4,9 @@ end
post '/login' do
- if user = User.authenticate(params[:sessions])
+ if @user = User.authenticate(params[:sessions])
session[:user_id] = user.id
- redirect "/users/#{user.id}"
+ redirect "/users/#{@user.id}"
else
@user = User.new(params[:sessions])
@errors = ["Bad username - password combination"]
@@ -28,7 +28,7 @@ @user = User.new(params[:sessions])
if @user.save
session[:user_id] = @user.id
- redirect "/users/#{user.id}"
+ redirect "/users/#{@user.id}"
else
@errors = @user.errors.full_messages
erb :"sessions/signup_form"
| Make user instance variable in controller
|
diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb
index abc1234..def5678 100644
--- a/app/jobs/application_job.rb
+++ b/app/jobs/application_job.rb
@@ -19,6 +19,8 @@ end
def teardown_worker?
+ # For some reason, jobs might be left stranded with Heroku causing this
+ # condition to fail and not do its job. Investigate further and fix.
Delayed::Job.count == 1
end
| Document problems with Delayed::Job on Heroku.
|
diff --git a/app/helpers/items_helper.rb b/app/helpers/items_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/items_helper.rb
+++ b/app/helpers/items_helper.rb
@@ -7,5 +7,4 @@ def item_params
params.require(:item).permit(:name, :description, :image, :price, :quantity )
end
-
end
| Remove white space from ItemsHelper module
|
diff --git a/app/helpers/sufia_helper.rb b/app/helpers/sufia_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/sufia_helper.rb
+++ b/app/helpers/sufia_helper.rb
@@ -2,20 +2,4 @@ include ::BlacklightHelper
include Sufia::BlacklightOverride
include Sufia::SufiaHelperBehavior
-
- # *Sometimes* a Blacklight helper_method
- # @param [String,User,Hash{Symbol=>Array}] args if a hash, the user_key must be under :value
- # @return [ActiveSupport::SafeBuffer] the html_safe link
- def link_to_profile(args)
- user_or_key = args.is_a?(Hash) ? args[:value].first : args
- user = case user_or_key
- when User
- user_or_key
- when String
- ::User.find_by_user_key(user_or_key)
- end
- return user_or_key if user.nil?
- text = user.respond_to?(:name) ? user.name : user_or_key
- link_to text, sufia.profile_path(user)
- end
end
| Remove profile path helper override. Breaking import jobs.
|
diff --git a/app/models/post_observer.rb b/app/models/post_observer.rb
index abc1234..def5678 100644
--- a/app/models/post_observer.rb
+++ b/app/models/post_observer.rb
@@ -3,7 +3,7 @@
def clean_cache_for(record)
# Clean posts count cache
- cache_file = File.join(File.dirname(__FILE__), "../../public/cache/discussions/#{record.discussion_id}/posts/count.js")
+ cache_file = Rails.root.join("public/cache/discussions/#{record.discussion_id}/posts/count.js")
if File.exists?(cache_file)
File.unlink(cache_file)
end
| Use Rails.root for cache observer
|
diff --git a/app/models/fact_register.rb b/app/models/fact_register.rb
index abc1234..def5678 100644
--- a/app/models/fact_register.rb
+++ b/app/models/fact_register.rb
@@ -5,7 +5,7 @@ field :place_id, type: BSON::ObjectId
field :date_id, type: BSON::ObjectId
field :action_ids, type: Array
- field :passive, type: Boolean
+ field :passive, type: Boolean, default: false
field :complement_person_ids, type: Array
belongs_to :fact
| Set :passive field as false by default
|
diff --git a/app/models/spree/digital.rb b/app/models/spree/digital.rb
index abc1234..def5678 100644
--- a/app/models/spree/digital.rb
+++ b/app/models/spree/digital.rb
@@ -4,10 +4,11 @@ has_many :digital_links, :dependent => :destroy
has_attached_file :attachment, :path => ":rails_root/private/digitals/:id/:basename.:extension"
+ validates_attachment_content_type :attachment, :content_type => %w(audio/mpeg application/x-mobipocket-ebook application/epub+zip application/pdf application/zip image/jpeg)
if Paperclip::Attachment.default_options[:storage] == :s3
attachment_definitions[:attachment][:s3_permissions] = :private
attachment_definitions[:attachment][:s3_headers] = { :content_disposition => 'attachment' }
end
end
-end+end
| Validate attachment content type in accordance with Paperclip 4 security rules
|
diff --git a/lib/fog/vcloud_director/requests/compute/post_task_cancel.rb b/lib/fog/vcloud_director/requests/compute/post_task_cancel.rb
index abc1234..def5678 100644
--- a/lib/fog/vcloud_director/requests/compute/post_task_cancel.rb
+++ b/lib/fog/vcloud_director/requests/compute/post_task_cancel.rb
@@ -10,7 +10,7 @@ #
# === Returns
# * response<~Excon::Response>
- # # {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/2012-03-01/APIReference/ApiReference-query-DeleteNetworkInterface.html]
+ #
def post_task_cancel(task_id)
request(
:expects => 204,
| [vcloud_director] Fix copy & paste fail.
|
diff --git a/test/configuration_test.rb b/test/configuration_test.rb
index abc1234..def5678 100644
--- a/test/configuration_test.rb
+++ b/test/configuration_test.rb
@@ -11,6 +11,11 @@ # config.routes
# config.hostname
# config.mail.server
+
+ def initialize(*args)
+ config.load!(Pathname(__FILE__).dirname.parent + "env")
+ super
+ end
def test_container_is_present
assert_kind_of(Harbor::Configuration, config)
| Fix failing tests by ensuring default environment is loaded.
|
diff --git a/config/initializers/kaminari_config.rb b/config/initializers/kaminari_config.rb
index abc1234..def5678 100644
--- a/config/initializers/kaminari_config.rb
+++ b/config/initializers/kaminari_config.rb
@@ -1,6 +1,6 @@ # frozen_string_literal: true
Kaminari.configure do |config|
- # config.default_per_page = 25
+ config.default_per_page = 10
# config.max_per_page = nil
# config.window = 4
# config.outer_window = 0
| Change the kaminari perpage config
|
diff --git a/vcs/local.rb b/vcs/local.rb
index abc1234..def5678 100644
--- a/vcs/local.rb
+++ b/vcs/local.rb
@@ -7,7 +7,7 @@
def local_commit! ( *args )
common_commit!("k1 <%= rev %>: <%= title %>", *args) do |subject|
- mail!(:to => %w[kernel1@gostai.com],
+ mail!(:to => %w[kernel-patches@lists.gostai.com],
:subject => subject)
end
end
| Send patches to the right ML.
git-svn-id: 0d81cc62928a1fc523c5fabcfc9861aafd21798d@1532 1e37f2df-8004-0410-ba96-adcf012cb36e
|
diff --git a/async.podspec b/async.podspec
index abc1234..def5678 100644
--- a/async.podspec
+++ b/async.podspec
@@ -1,5 +1,5 @@ Pod::Spec.new do |s|
- s.name = "async"
+ s.name = "async_utility"
s.version = "1.0.0"
s.summary = "Utility framework which provides asynchronous working to help processing background tasks."
| Rename pod, name is already taken
|
diff --git a/fission.gemspec b/fission.gemspec
index abc1234..def5678 100644
--- a/fission.gemspec
+++ b/fission.gemspec
@@ -20,6 +20,6 @@ s.require_paths = ["lib"]
s.add_dependency 'CFPropertyList', '~> 2.1.1'
s.add_development_dependency 'rake'
- s.add_development_dependency 'rspec', '~> 2.8.0'
+ s.add_development_dependency 'rspec', '~> 2.14'
s.add_development_dependency 'fakefs', '~> 0.3.2'
end
| Update rspec dependency to ~> 2.14
|
diff --git a/core/app/models/spree/shipping_rate.rb b/core/app/models/spree/shipping_rate.rb
index abc1234..def5678 100644
--- a/core/app/models/spree/shipping_rate.rb
+++ b/core/app/models/spree/shipping_rate.rb
@@ -4,9 +4,15 @@ belongs_to :shipping_method, class_name: 'Spree::ShippingMethod'
scope :frontend,
- -> { includes(:shipping_method).where(ShippingMethod.on_frontend_query).references(:shipping_method) }
+ -> { includes(:shipping_method).
+ where(ShippingMethod.on_frontend_query).
+ references(:shipping_method).
+ order("cost ASC") }
scope :backend,
- -> { includes(:shipping_method).where(ShippingMethod.on_backend_query).references(:shipping_method) }
+ -> { includes(:shipping_method).
+ where(ShippingMethod.on_backend_query).
+ references(:shipping_method).
+ order("cost ASC") }
delegate :order, :currency, to: :shipment
delegate :name, to: :shipping_method
| Order shipping rates by cost ascending
This fixes a problem on the frontend that I saw where they were displaying in indeterminate ordering
|
diff --git a/app/controllers/event_receipt_controller.rb b/app/controllers/event_receipt_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/event_receipt_controller.rb
+++ b/app/controllers/event_receipt_controller.rb
@@ -5,4 +5,8 @@ def index
render layout: "table-assignment"
end
+
+ def show
+ render layout: "table-assignment"
+ end
end
| Use table-assignment layout for receipts.
|
diff --git a/app/controllers/site/comments_controller.rb b/app/controllers/site/comments_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/site/comments_controller.rb
+++ b/app/controllers/site/comments_controller.rb
@@ -14,7 +14,7 @@
if @site_comment.save
set_flash_message(:success)
- redirect_to request.referer
+ redirect_to request.referer || root_path
else
render 'new', status: :conflict
end
| Fix redirect to nil on comment creation
|
diff --git a/db/migrate/001_create_phone_numbers.rb b/db/migrate/001_create_phone_numbers.rb
index abc1234..def5678 100644
--- a/db/migrate/001_create_phone_numbers.rb
+++ b/db/migrate/001_create_phone_numbers.rb
@@ -1,14 +1,14 @@ class CreatePhoneNumbers < ActiveRecord::Migration
def self.up
create_table :phone_numbers do |t|
- t.column :phoneable_id, :integer, :null => false, :references => nil
+ t.column :phoneable_id, :integer, :null => false, :references => nil
t.column :phoneable_type, :string, :null => false
# Default is the United States
- t.column :country_code, :string, :null => false, :limit => 3, :default => 1
- t.column :number, :string, :null => false, :limit => 12
- t.column :extension, :string, :limit => 10
- t.column :created_at, :timestamp, :null => false
- t.column :updated_at, :datetime, :null => false
+ t.column :country_code, :string, :null => false, :limit => 3, :default => 1
+ t.column :number, :string, :null => false, :limit => 12
+ t.column :extension, :string, :limit => 10
+ t.column :created_at, :timestamp, :null => false
+ t.column :updated_at, :datetime, :null => false
end
end
| Update migration formats so that they're more maintainable.
|
diff --git a/lib/acts_as_archive/base/adapters/mysql.rb b/lib/acts_as_archive/base/adapters/mysql.rb
index abc1234..def5678 100644
--- a/lib/acts_as_archive/base/adapters/mysql.rb
+++ b/lib/acts_as_archive/base/adapters/mysql.rb
@@ -7,11 +7,20 @@
def archive_table_indexed_columns
index_query = "SHOW INDEX FROM archived_#{table_name}"
- indexes = connection.select_all(index_query).collect do |r|
- r["Column_name"]
+ indexes = connection.select_all(index_query)
+ final_indexes = []
+ current_index = 0
+ indexes.each do |index|
+ if index['Seq_in_index'] != '1'
+ final_indexes[current_index-1] = Array(final_indexes[current_index-1]).flatten.concat(Array(index['Column_name']))
+ else
+ final_indexes[current_index] = index['Column_name']
+ current_index += 1
+ end
end
+ return final_indexes
end
end
end
end
-end+end
| Add multi-columns indexes support for MySQL
refs #6
Acts_as_archive now fully supports the following syntax :
acts_as_archive :indexes => [ :id, [:subject_id, :subject_type],
:created_at, :deleted_at ]
for MySQL and Postgresql
|
diff --git a/contrib/homebrew/passgen.rb b/contrib/homebrew/passgen.rb
index abc1234..def5678 100644
--- a/contrib/homebrew/passgen.rb
+++ b/contrib/homebrew/passgen.rb
@@ -1,8 +1,8 @@ class Passgen < Formula
desc "A password generator"
homepage "https://github.com/nicolas-brousse/passgen"
- url "https://github.com/nicolas-brousse/passgen/archive/v1.0.1.tar.gz"
- sha256 "bdda05c98adccc5d752cb50148c5752947effbce0f7cc3277af934fe2aecb37a"
+ url "https://github.com/nicolas-brousse/passgen/archive/v1.0.2.tar.gz"
+ sha256 "edcfea0720e61bb0b08d6509f32176de71116cfd096290bdb559d7e1266efe66"
head "https://github.com/nicolas-brousse/passgen.git"
@@ -12,6 +12,6 @@
test do
output = shell_output(bin/"passgen")
- assert output.include? "Usage: passgen [-l 0-9] [-n 0-9] [-q] decent|strong|hard"
+ assert output.include? "Usage: passgen [options] decent|strong|hard"
end
end
| Update Homebrew formulae with version 1.0.2
|
diff --git a/app/controllers/admin/metrics_controller.rb b/app/controllers/admin/metrics_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/admin/metrics_controller.rb
+++ b/app/controllers/admin/metrics_controller.rb
@@ -8,11 +8,11 @@
def schedule
worker = MetricWorker.worker_class(@metric)
- job = Job.find_by(repository: @repository.id, metric: @metric)
+ job = Job.where(repository: @repository.id, metric: @metric)
id = worker.send(:perform_async, @repository.id, @metric)
- if not job.nil?
- job.update_attributes!(sidekiq_id: id)
+ if job.exists?
+ job.first.update_attributes!(sidekiq_id: id)
else
Job.create!(sidekiq_id: id, repository: @repository.id, metric: @metric)
end
| Rollback job document check at schedule command
I was mistaken: find_by is not exactly the best choice to optimistically
retrieve a document. If it cannot be found, an error will be raised.
Thus, I am back at using where.
Signed-off-by: Konrad Reiche <4ff0213f56e2082fcd8c882d04c546881c579ce4@gmail.com>
|
diff --git a/lib/expgen.rb b/lib/expgen.rb
index abc1234..def5678 100644
--- a/lib/expgen.rb
+++ b/lib/expgen.rb
@@ -5,7 +5,16 @@ require "expgen/randomizer"
module Expgen
+ def self.cache
+ @cache ||= {}
+ end
+
+ def self.clear_cache
+ @cache = nil
+ end
+
def self.gen(exp)
- Randomizer.randomize(Transform.new.apply((Parser.new.parse(exp.source))))
+ cache[exp.source] ||= Transform.new.apply((Parser.new.parse(exp.source)))
+ Randomizer.randomize(cache[exp.source])
end
end
| Add cache for crazy speed boost |
diff --git a/app/controllers/subscriptions_controller.rb b/app/controllers/subscriptions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/subscriptions_controller.rb
+++ b/app/controllers/subscriptions_controller.rb
@@ -25,7 +25,7 @@ body = request.raw_post
signature = request.env['HTTP_X_HUB_SIGNATURE']
if @subscription.verify_signature(body, signature)
- @subscription.feed.receive_raw(body)
+ @subscription.feed.receive_and_notify(body)
end
head :no_content
end
| Fix missing notification for pushed articles.
|
diff --git a/lib/email_events/railtie.rb b/lib/email_events/railtie.rb
index abc1234..def5678 100644
--- a/lib/email_events/railtie.rb
+++ b/lib/email_events/railtie.rb
@@ -13,6 +13,7 @@ # (even for non-sendgrid)
# TODO: especially if there ever gets to be > 2 adapters, each adapters should ideally be broken out into its own gem
Gridhook.config.event_receive_path = '/email_events/sendgrid'
+ Gridhook.config.event_processor = Proc.new { raise 'Sendgrid adapter not loaded' }
end
end
end
| Add better error message when Gridhook fires but sengrid adapter is not loaded.
|
diff --git a/lib/hydra_attribute/association_builder.rb b/lib/hydra_attribute/association_builder.rb
index abc1234..def5678 100644
--- a/lib/hydra_attribute/association_builder.rb
+++ b/lib/hydra_attribute/association_builder.rb
@@ -40,7 +40,7 @@ end
def association_name
- table_name.to_sym
+ "hydra_#{type}_values".to_sym
end
end
end | Rename association name to hydra values
|
diff --git a/railties/test/application/initializers/notifications_test.rb b/railties/test/application/initializers/notifications_test.rb
index abc1234..def5678 100644
--- a/railties/test/application/initializers/notifications_test.rb
+++ b/railties/test/application/initializers/notifications_test.rb
@@ -44,7 +44,7 @@ app_file 'config/initializers/foo.rb', ''
events = []
- callback = -> (*_) { events << _ }
+ callback = ->(*_) { events << _ }
ActiveSupport::Notifications.subscribed(callback, 'load_config_initializer.railties') do
app
end
| Build fix for ruby 1.9.3 syntax
|
diff --git a/lib/travis/services/github/fetch_config.rb b/lib/travis/services/github/fetch_config.rb
index abc1234..def5678 100644
--- a/lib/travis/services/github/fetch_config.rb
+++ b/lib/travis/services/github/fetch_config.rb
@@ -15,7 +15,14 @@ end
def run
- parse(fetch) || { '.result' => 'not_found' }
+ retries = 0
+ config = nil
+ until retries > 3
+ config = parse(fetch)
+ break if config
+ retries += 1
+ end
+ config
rescue GH::Error => e
if e.info[:response_status] == 404
{ '.result' => 'not_found' }
@@ -32,7 +39,11 @@ private
def fetch
- GH[config_url]['content'].to_s.unpack('m').first
+ content = GH[config_url]['content']
+ Travis.logger.info("Got empty content for #{config_url}") if content.nil?
+ content = content.to_s.unpack('m').first
+ Travis.logger.info("Got empty unpacked content for #{config_url}, content was #{content.inspect}") if content.nil?
+ content
end
def parse(yaml)
| Add retries for fetching the config.
Also, some more debugging to see what the data we receive looks like.
|
diff --git a/CCKit.podspec b/CCKit.podspec
index abc1234..def5678 100644
--- a/CCKit.podspec
+++ b/CCKit.podspec
@@ -1,13 +1,13 @@ Pod::Spec.new do |s|
s.name = "CCKit"
- s.version = "0.0.1"
+ s.version = "0.0.2"
s.summary = "Cliq Consulting reusable components for iOS."
s.description = <<-DESC
Helpers, MACROS and MVC iOS components provided by Cliq Consulting.
* Lifecycle management for network based models
- * Twitter Login Manager
+ * Common views, view controllers, collection layouts, collection cells and helpers
DESC
s.homepage = "http://cliqconsulting.com"
@@ -15,7 +15,7 @@ s.authors = { "Glenn Marcus" => "glenn@cliqconsulting.com", "Leonardo Lobato" => "leo@cliqconsulting.com" }
s.social_media_url = "http://twitter.com/cliqconsulting"
- s.platform = :ios, '6.0'
+ s.platform = :ios, '7.0'
s.source = { :git => "git@cliqconsulting.unfuddle.com:cliqconsulting/cckit.git", :tag => s.version.to_s }
s.source_files = 'CCKit/**/*.{h,m}'
| Update Podspec to version 0.0.2
- CCKit.podspec update s.version to 0.0.2
|
diff --git a/lib/arsi/relation.rb b/lib/arsi/relation.rb
index abc1234..def5678 100644
--- a/lib/arsi/relation.rb
+++ b/lib/arsi/relation.rb
@@ -22,13 +22,8 @@ with_relation_in_connection { super }
end
- def self.prepended(base)
- base.class_eval do
- alias_method :update_all_without_arsi, :update_all
- def update_all(*args)
- with_relation_in_connection { update_all_without_arsi(*args) }
- end
- end
+ def update_all(*)
+ with_relation_in_connection { super }
end
private
| Remove alias-chain necessary for Rails 4.0
The `self.prepended` / alias_method wrapper was added in
48e14c2930e4454093c6f0e31c84808929a7c63e when Rails 4.0 compatibility
was added. A PR comment (https://github.com/zendesk/arsi/pull/8)
clarifies that we cannot simply call `super` because
ends up in an infinite loop because deprecated finders also hacks the
same method
Assuming that "deprecated finders" refer to the
"activerecord-deprecated_finders" gem, then yes, the ARSI gem is no
longer compatible with it.
See https://github.com/rails/activerecord-deprecated_finders/blob/041c83c9dce8e17b8e1216adfaff48cc9debac02/lib/active_record/deprecated_finders/relation.rb#L173
|
diff --git a/lib/gem-search/executor.rb b/lib/gem-search/executor.rb
index abc1234..def5678 100644
--- a/lib/gem-search/executor.rb
+++ b/lib/gem-search/executor.rb
@@ -31,8 +31,12 @@ def search_rubygems(url)
option = {}
proxy = URI.parse(url).find_proxy
- if proxy && proxy.user && proxy.password
- option[:proxy_http_basic_authentication] = [proxy, proxy.user, proxy.password]
+ if proxy
+ if proxy.user && proxy.password
+ option[:proxy_http_basic_authentication] = [proxy, proxy.user, proxy.password]
+ else
+ option[:proxy] = proxy
+ end
end
JSON.parse(open(url, option).read)
end
| Fix proxy doesn't work by not using authentication
認証プロキシにしか対応していなかったのを修正
|
diff --git a/lib/grape/cache/patches.rb b/lib/grape/cache/patches.rb
index abc1234..def5678 100644
--- a/lib/grape/cache/patches.rb
+++ b/lib/grape/cache/patches.rb
@@ -18,7 +18,7 @@ run_filters befores
# Inject our cache check
- options[:route_options][:cache].validate_cache(self, env['grape.cache'])
+ options[:route_options][:cache] && options[:route_options][:cache].validate_cache(self, env['grape.cache'])
run_filters before_validations
| Check if cache configured for endpoint
|
diff --git a/test/integration/environment/cucumber/features/step_definitions/hem_is_ruby_environment_steps.rb b/test/integration/environment/cucumber/features/step_definitions/hem_is_ruby_environment_steps.rb
index abc1234..def5678 100644
--- a/test/integration/environment/cucumber/features/step_definitions/hem_is_ruby_environment_steps.rb
+++ b/test/integration/environment/cucumber/features/step_definitions/hem_is_ruby_environment_steps.rb
@@ -7,18 +7,19 @@ Given(/^I have set up hem to run in local mode$/) do
end
-When(/^I execute "([^"]*)" as the "([^"]*)" user I will see "([^"]*)"$/) do |command, user, expected|
+When(/^I execute "([^"]*)" as the "([^"]*)" user I will see "([^"]*)"$/) do |cmd, user, expected|
+ full_command = command_as_user(cmd, user)
+ expect(`#{full_command}`).to match(expected)
+end
+
+When(/^I execute "([^"]*)" as the "([^"]*)" user I should see "([^"]*)" being "([^"]*)"$/) do |cmd, user, var, value|
+ full_command = command_as_user(cmd, user)
+ expect(`#{full_command}`).to match("#{var}=#{value}")
+end
+
+def command_as_user(command, user)
require 'shellwords'
command = Shellwords.escape(command)
user = Shellwords.escape(user)
- full_command = "sudo su - #{user} -c #{command}"
- expect(`#{full_command}`).to match(expected)
+ "sudo su - #{user} -c #{command}"
end
-
-When(/^I execute "([^"]*)" as the "([^"]*)" user I should see "([^"]*)" being "([^"]*)"$/) do |command, user, variable, value|
- require 'shellwords'
- command = Shellwords.escape(command)
- user = Shellwords.escape(user)
- full_command = "sudo su - #{user} -c #{command}"
- expect(`#{full_command}`).to match("#{variable}=#{value}")
-end
| Fix up rubocop issues in cucumber steps.
|
diff --git a/lib/loady/memory_logger.rb b/lib/loady/memory_logger.rb
index abc1234..def5678 100644
--- a/lib/loady/memory_logger.rb
+++ b/lib/loady/memory_logger.rb
@@ -10,7 +10,7 @@ @messages << message
end
- alias_method :warn, :info
- alias_method :error, :info
+ alias warn info
+ alias error info
end
end
| Use alias instead of alias_method
|
diff --git a/blimp.gemspec b/blimp.gemspec
index abc1234..def5678 100644
--- a/blimp.gemspec
+++ b/blimp.gemspec
@@ -17,5 +17,5 @@ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ['lib']
- gem.add_development_dependency 'httparty', '~> 0.11.0'
+ gem.add_dependency 'httparty', '~> 0.11.0'
end
| Fix incorrect dependency type in gemspec for httparty
|
diff --git a/modis.gemspec b/modis.gemspec
index abc1234..def5678 100644
--- a/modis.gemspec
+++ b/modis.gemspec
@@ -10,7 +10,8 @@ gem.email = ["port001@gmail.com"]
gem.description = "ActiveModel + Redis"
gem.summary = "ActiveModel + Redis"
- gem.homepage = ""
+ gem.homepage = "https://github.com/ileitch/modis"
+ gem.license = "MIT"
gem.files = `git ls-files`.split($/)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
| Add gem homepage and license on gemspec
|
diff --git a/knife-server.gemspec b/knife-server.gemspec
index abc1234..def5678 100644
--- a/knife-server.gemspec
+++ b/knife-server.gemspec
@@ -22,4 +22,5 @@
gem.add_development_dependency "rspec", "~> 2.10"
gem.add_development_dependency "fakefs", "~> 0.4.0"
+ gem.add_development_dependency "timecop", "~> 0.3.5"
end
| Add timecop as development gem.
|
diff --git a/lib/librato/rails.rb b/lib/librato/rails.rb
index abc1234..def5678 100644
--- a/lib/librato/rails.rb
+++ b/lib/librato/rails.rb
@@ -25,20 +25,6 @@ start_worker unless forking_server?
end
- private
-
- def ruby_engine
- return RUBY_ENGINE if Object.constants.include?(:RUBY_ENGINE)
- RUBY_DESCRIPTION.split[0]
- end
-
- def user_agent
- ua_chunks = []
- ua_chunks << "librato-rails/#{Librato::Rails::VERSION}"
- ua_chunks << "(#{ruby_engine}; #{RUBY_VERSION}p#{RUBY_PATCHLEVEL}; #{RUBY_PLATFORM}; #{app_server})"
- ua_chunks.join(' ')
- end
-
end # end class << self
end
| Remove old user agent code
|
diff --git a/lib/plugins/fresh.rb b/lib/plugins/fresh.rb
index abc1234..def5678 100644
--- a/lib/plugins/fresh.rb
+++ b/lib/plugins/fresh.rb
@@ -8,7 +8,7 @@ match /(help fresh)$/, method: :help, prefix: /^(\.)/
def execute(m)
- response = HTTParty.get("http://www.reddit.com/r/hiphopheads/new/.json")
+ response = HTTParty.get("http://www.reddit.com/r/hiphopheads/.json")
fresh = {}
response['data']['children'].each do |post|
fresh[post['data']['title']] = post['data']['url'] if post['data']['title'].include? '[FRESH'
@@ -19,7 +19,7 @@ end
def help(m)
- m.reply 'returns random recent [FRESH] post from r/hiphopheads'
+ m.reply 'returns random [FRESH] post from r/hiphopheads'
end
end
| Return post from / instead of /new
|
diff --git a/spec/features/students/view_a_student_spec.rb b/spec/features/students/view_a_student_spec.rb
index abc1234..def5678 100644
--- a/spec/features/students/view_a_student_spec.rb
+++ b/spec/features/students/view_a_student_spec.rb
@@ -0,0 +1,31 @@+require 'rails_helper'
+
+RSpec.feature 'Student progress', type: :feature do
+ let(:school_class) { FactoryGirl.create :school_class }
+ let(:lesson) { FactoryGirl.create :lesson, ordinal: 1, school_class: school_class }
+ let!(:lesson_part) { FactoryGirl.create :lesson_part, lesson: lesson, ordinal: 1 }
+ let(:student) do
+ FactoryGirl.create(:student, email: 'student_one@example.com', name: 'Student One', school_class: school_class)
+ end
+
+ scenario 'add progress to a student with no progress' do
+ visit student_path(student)
+
+ expect(page).to have_content 'Student One'
+ expect(page).to have_content 'student_one@example.com'
+ expect(page).to have_content 'No progress'
+ expect(page).to have_link 'Set progress', href: new_student_completed_lesson_part_path(student_id: student)
+
+ click_link 'Set progress'
+
+ expect(page).to have_content 'Student One'
+ expect(page).to have_content 'No progress'
+
+ fill_in 'lesson_ordinal', with: 1
+ fill_in 'lesson_part_ordinal', with: 1
+ click_button 'Save'
+
+ expect(page).to have_content 'New progress saved.'
+ expect(page).to have_content 'Completed up to lesson 1, part 1'
+ end
+end
| Add feature spec for setting progress on student
|
diff --git a/spec/scanny/checks/http_request_check_spec.rb b/spec/scanny/checks/http_request_check_spec.rb
index abc1234..def5678 100644
--- a/spec/scanny/checks/http_request_check_spec.rb
+++ b/spec/scanny/checks/http_request_check_spec.rb
@@ -14,6 +14,21 @@ with_issue(@issue)
end
+ it "reports \"Net::HTTP::Get.new('http://example.com/')\" correctly" do
+ @runner.should check("Net::HTTP::Get.new('http://example.com/')").
+ with_issue(@issue)
+ end
+
+ it "reports \"Net::HTTP::Post.new('http://example.com/')\" correctly" do
+ @runner.should check("Net::HTTP::Post.new('http://example.com/')").
+ with_issue(@issue)
+ end
+
+ it "reports \"Net::HTTP::Method.new('http://example.com/')\" correctly" do
+ @runner.should check("Net::HTTP::Method.new('http://example.com/')").
+ with_issue(@issue)
+ end
+
it "reports \"Net::HTTP::Proxy('proxy.example.com', 8080)\" correctly" do
@runner.should check("Net::HTTP::Proxy('proxy.example.com', 8080)").
with_issue(@issue)
| Add specs for another Net::HTTP classes
|
diff --git a/ci_environment/docker/recipes/default.rb b/ci_environment/docker/recipes/default.rb
index abc1234..def5678 100644
--- a/ci_environment/docker/recipes/default.rb
+++ b/ci_environment/docker/recipes/default.rb
@@ -41,7 +41,7 @@ fe = Chef::Util::FileEdit.new('/etc/default/grub')
fe.search_file_replace_line(
/^GRUB_CMDLINE_LINUX=""/,
- 'GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"'
+ 'GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1 apparmor=0"'
)
fe.write_file
end
| Disable apparmor via grub args
|
diff --git a/core_gem/lib/deep_cover/builtin_takeover.rb b/core_gem/lib/deep_cover/builtin_takeover.rb
index abc1234..def5678 100644
--- a/core_gem/lib/deep_cover/builtin_takeover.rb
+++ b/core_gem/lib/deep_cover/builtin_takeover.rb
@@ -5,6 +5,8 @@ require_relative 'core_ext/coverage_replacement'
require 'coverage'
+raise "Ruby's builtin coverage is already running, cannot do a takeover" if Coverage.respond_to?(:running?) && Coverage.running?
+
BuiltinCoverage = Coverage
Object.send(:remove_const, 'Coverage')
Coverage = DeepCover::CoverageReplacement.dup
| Raise when taking over if the builtin coverage is running
|
diff --git a/app/models/manager_refresh/application_record_lite.rb b/app/models/manager_refresh/application_record_lite.rb
index abc1234..def5678 100644
--- a/app/models/manager_refresh/application_record_lite.rb
+++ b/app/models/manager_refresh/application_record_lite.rb
@@ -0,0 +1,12 @@+module ManagerRefresh
+ class ApplicationRecordLite
+ attr_reader :base_class_name, :id
+
+ # ApplicationRecord is very bloaty in memory, so this class server for storing base_class and primary key
+ # of the ApplicationRecord, which is just enough for filling up relationships
+ def initialize(base_class_name, id)
+ @base_class_name = base_class_name
+ @id = id
+ end
+ end
+end
| Add ApplicationRecordLite that is for holding is and class of AR
Add ApplicationRecordLite that is for holding is and class of AR.
ActiveRecord object are to huge and we need a query to obtain them,
in most cases we have a class and id, which is just enough
to fil la relation. No need to go to db.
|
diff --git a/config/deploy/production.rb b/config/deploy/production.rb
index abc1234..def5678 100644
--- a/config/deploy/production.rb
+++ b/config/deploy/production.rb
@@ -1,5 +1,5 @@ server 'app-01', roles: %w{app web db}, user: 'handy'
set :ssh_options,
- proxy: Net::SSH::Proxy::Command.new('ssh gateway.do-nyc3.pittcsc.org -q -W %h:%p'),
+ proxy: Net::SSH::Proxy::Command.new('ssh gateway.do-nyc3.pittcsc.org -q -W %h:%p -p 56362'),
forward_agent: true
| Use special port for gateway SSH
|
diff --git a/test/integration/relp/serverspec/relp_spec.rb b/test/integration/relp/serverspec/relp_spec.rb
index abc1234..def5678 100644
--- a/test/integration/relp/serverspec/relp_spec.rb
+++ b/test/integration/relp/serverspec/relp_spec.rb
@@ -7,3 +7,7 @@ describe package('rsyslog-relp') do
it { should be_installed }
end
+
+describe file('/etc/rsyslog.d/49-remote.conf') do
+ its(:content) { should match /'*.* :omrelp:10.0.0.45:20514\n'*.* :omrelp:10.1.1.33:20514;RSYSLOG_SyslogProtocol23Format/ }
+end
| Test relp so we don't break break it again
|
diff --git a/lib/tasks/islay_tasks.rake b/lib/tasks/islay_tasks.rake
index abc1234..def5678 100644
--- a/lib/tasks/islay_tasks.rake
+++ b/lib/tasks/islay_tasks.rake
@@ -7,6 +7,14 @@
desc "Drop and recreates the DB and seeds it with data"
task :bootstrap => :environment do
+ FileUtils.rm_rf(Rails.root + 'db/migrations')
+
+ Rake::Task['islay_engine:install:migrations'].invoke
+
+ Islay::Engine.extensions.entries.each_pair do |name, e|
+ Rake::Task["#{name}_engine:install:migrations"].invoke
+ end
+
Rake::Task['db:drop'].invoke
Rake::Task['db:create'].invoke
Rake::Task['db:migrate'].invoke
@@ -16,6 +24,12 @@ :email => 'admin@admin.com',
:password => 'password'
)
+
+ require 'islay/spec'
+
+ Islay::Engine.extensions.entries.each_pair do |name, e|
+ Rake::Task["#{name}:db:seed"].invoke
+ end
end
end
end
| Tweak bootstrap task to copy migrations and seed data.
|
diff --git a/app/controllers/checkin/groups_controller.rb b/app/controllers/checkin/groups_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/checkin/groups_controller.rb
+++ b/app/controllers/checkin/groups_controller.rb
@@ -13,7 +13,7 @@ format.json do
render :text => {
'groups' => @groups,
- 'updated_at' => GroupTime.last(:order => 'updated_at').updated_at
+ 'updated_at' => GroupTime.order('updated_at').last.updated_at
}.to_json
end
end
| Fix another old style AR query.
|
diff --git a/app/models/groups/mailman/list_membership.rb b/app/models/groups/mailman/list_membership.rb
index abc1234..def5678 100644
--- a/app/models/groups/mailman/list_membership.rb
+++ b/app/models/groups/mailman/list_membership.rb
@@ -8,14 +8,20 @@ include ActiveModel::Model
attr_accessor :id, :mailman_user, :list_id, :role
- delegate :email, to: :mailman_user
+ attr_writer :email
+
+ def email
+ mailman_user.present? ? mailman_user.email : @email
+ end
def user_remote_id
- mailman_user.remote_id
+ mailman_user&.remote_id
end
+ # We compare based on email and list_id because those are the two key pieces.
+ # user_remote_id may or may not be available depending on what this ListMembership was built from.
def ==(other)
- mailman_user == other.mailman_user && list_id == other.list_id
+ email == other.email && list_id == other.list_id
end
def eql?(other)
@@ -23,7 +29,7 @@ end
def hash
- [mailman_user, list_id].hash
+ [email, list_id].hash
end
end
end
| 717: Change ListMembership to compare on email instead of mm_user
|
diff --git a/activejob/test/support/integration/helper.rb b/activejob/test/support/integration/helper.rb
index abc1234..def5678 100644
--- a/activejob/test/support/integration/helper.rb
+++ b/activejob/test/support/integration/helper.rb
@@ -1,6 +1,6 @@ # frozen_string_literal: true
-puts "\n\n*** rake aj:integration:#{ENV['AJ_ADAPTER']} ***\n"
+puts "\n\n*** rake test:integration:#{ENV['AJ_ADAPTER']} ***\n"
ENV["RAILS_ENV"] = "test"
ActiveJob::Base.queue_name_prefix = nil
| Print correct rake command on running AJ integration tests
Currently when executing `bundle exec rake test:integration` under `activejob/`
derectory, it prints helpful info like:
```
(snip)
*** rake aj:integration:async ***
(snip)
*** rake aj:integration:delayed_job ***
(snip)
```
but there is no defined `:aj` scope in `activejob/Rakefile`,
so I think output should be like:
```
(snip)
*** rake test:integration:async ***
(snip)
*** rake test:integration:delayed_job ***
(snip)
```
By the way `rake test:integration` doesn't work if execute it without
prepending `bundle exec` to that command. It is probably what we should
fix too.
|
diff --git a/lib/flappi/config.rb b/lib/flappi/config.rb
index abc1234..def5678 100644
--- a/lib/flappi/config.rb
+++ b/lib/flappi/config.rb
@@ -3,16 +3,12 @@ module Flappi
class Config
- attr_reader :definition_paths
+ attr_accessor :definition_paths
attr_accessor :version_plan
attr_accessor :doc_target_path
attr_accessor :doc_target_paths
attr_accessor :logger_level
attr_reader :logger_target
-
- def definition_paths=(v)
- @definition_paths = v.is_a?(Array) ? v : [v]
- end
# rubocop:disable Naming/AccessorMethodName
def set_logger_target(&block)
@@ -24,6 +20,5 @@ set_logger_target {|m, l| Rails.logger.send %i[error warn info debug debug][l], m }
end
-
end
end
| Remove auto array from definition_paths setter
|
diff --git a/lib/rails-add_ons.rb b/lib/rails-add_ons.rb
index abc1234..def5678 100644
--- a/lib/rails-add_ons.rb
+++ b/lib/rails-add_ons.rb
@@ -1,9 +1,13 @@ require 'haml-rails'
require 'font-awesome-rails'
-require 'twitter_bootstrap_components_rails'
+begin
+ require 'twitter_bootstrap_components_rails'
+rescue LoadError
+ puts "[Rails AddOns]: WARNING - Could not require twitter_bootstrap_components_rails."
+end
require 'simple_form'
require 'responders' if Rails::VERSION::MAJOR > 3
require 'rails-i18n'
require 'active_model/model' if Rails::VERSION::MAJOR < 4
-require 'rails/add_ons'+require 'rails/add_ons'
| Make requirement for twitter_bootstrap_components_rails optional.
|
diff --git a/lib/tasks/polls.rake b/lib/tasks/polls.rake
index abc1234..def5678 100644
--- a/lib/tasks/polls.rake
+++ b/lib/tasks/polls.rake
@@ -0,0 +1,8 @@+namespace :poll do
+ desc "Generate slugs polls"
+ task generate_slugs: :environment do
+ Poll.find_each do |poll|
+ poll.update_columns(slug: poll.generate_slug, updated_at: Time.current) if poll.generate_slug?
+ end
+ end
+end
| Add task to generate poll slugs
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.