diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/app/controllers/users/private_message_threads_controller.rb b/app/controllers/users/private_message_threads_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/users/private_message_threads_controller.rb
+++ b/app/controllers/users/private_message_threads_controller.rb
@@ -18,7 +18,7 @@ end
def index
- threads = MessageThread.private_for(current_user).order(created_at: :desc).to_a
+ threads = MessageThread.private_for(current_user).order_by_latest_message.to_a
@private_threads = PrivateMessageDecorator.decorate_collection(threads)
@unviewed_thread_ids = MessageThread.unviewed_thread_ids(user: current_user, threads: threads)
end
|
Order private messages by last activity
Fixes #648
|
diff --git a/lib/rubocop/ast_node/builder.rb b/lib/rubocop/ast_node/builder.rb
index abc1234..def5678 100644
--- a/lib/rubocop/ast_node/builder.rb
+++ b/lib/rubocop/ast_node/builder.rb
@@ -20,6 +20,12 @@ def n(type, children, source_map)
Node.new(type, children, location: source_map)
end
+
+ # TODO: Figure out what to do about literal encoding handling...
+ # More details here https://github.com/whitequark/parser/issues/283
+ def string_value(token)
+ value(token)
+ end
end
end
end
|
Fix the breakage introduced by parser 2.3.0.7
See https://github.com/whitequark/parser/issues/283 for details.
Probably the proper long-term solution would be to adjust our specs.
|
diff --git a/attributes/default.rb b/attributes/default.rb
index abc1234..def5678 100644
--- a/attributes/default.rb
+++ b/attributes/default.rb
@@ -1,6 +1,6 @@ default['selenium']['server_version'] = '2.45.0'
default['selenium']['iedriver_version'] = '2.45.0'
-default['selenium']['chromedriver_version'] = '2.14'
+default['selenium']['chromedriver_version'] = '2.15'
default['selenium']['release_url'] = 'https://selenium-release.storage.googleapis.com'
default['selenium']['chromedriver_url'] = 'https://chromedriver.storage.googleapis.com'
|
Update ChromeDriver from 2.14 to 2.15
|
diff --git a/lib/smartsheet/api/file_spec.rb b/lib/smartsheet/api/file_spec.rb
index abc1234..def5678 100644
--- a/lib/smartsheet/api/file_spec.rb
+++ b/lib/smartsheet/api/file_spec.rb
@@ -27,5 +27,29 @@ @content_type = content_type
end
end
+
+ # Specification for file sheet import by path and MIME content type
+ class ImportPathFileSpec
+ attr_reader :upload_io, :filename, :content_type, :file_length
+
+ def initialize(path, content_type)
+ @file_length = File.size(path)
+ @filename = nil
+ @upload_io = Faraday::UploadIO.new(path, content_type)
+ @content_type = content_type
+ end
+ end
+
+ # Specification for file sheet import by {::File}, file length, and MIME content type
+ class ImportObjectFileSpec
+ attr_reader :upload_io, :filename, :content_type, :file_length
+
+ def initialize(file, file_length, content_type)
+ @file_length = file_length
+ @filename = nil
+ @upload_io = Faraday::UploadIO.new(file, content_type)
+ @content_type = content_type
+ end
+ end
end
end
|
Add new file specifications for sheet importing.
|
diff --git a/lib/sub_diff/core_ext/string.rb b/lib/sub_diff/core_ext/string.rb
index abc1234..def5678 100644
--- a/lib/sub_diff/core_ext/string.rb
+++ b/lib/sub_diff/core_ext/string.rb
@@ -1,10 +1,18 @@ module SubDiff
module CoreExt
module String
+ # Behaves just like {String#sub} but wraps the returned replacement
+ # string in an enumerable {Collection} of {Diff} objects.
+ #
+ # See http://ruby-doc.org/core-2.2.0/String.html#method-i-sub
def sub_diff(*args, &block)
Builder.new(self, :sub).diff(*args, &block)
end
+ # Behaves just like {String#gsub} but wraps the returned replacement
+ # string in an enumerable {Collection} of {Diff} objects.
+ #
+ # See http://ruby-doc.org/core-2.2.0/String.html#method-i-gsub
def gsub_diff(*args, &block)
Builder.new(self, :gsub).diff(*args, &block)
end
|
Add inline documentation for sub_diff and gsub_diff
|
diff --git a/lib/tanuki/extensions/module.rb b/lib/tanuki/extensions/module.rb
index abc1234..def5678 100644
--- a/lib/tanuki/extensions/module.rb
+++ b/lib/tanuki/extensions/module.rb
@@ -1,13 +1,17 @@ class Module
# Runs Tanuki::Loader for every missing constant in any namespace.
- def const_missing_with_tanuki(const)
- paths = Dir.glob(Tanuki::Loader.combined_class_path(sym))
- unless paths.empty?
+ def const_missing_with_tanuki(sym)
+ klass = "#{name + '::' if name != 'Object'}#{sym}"
+ paths = Dir.glob(Tanuki::Loader.combined_class_path(klass))
+ if paths.empty?
+ puts "Creating: #{klass}"
+ const_set(sym, Class.new)
+ else
+ puts "Loading: #{klass}"
paths.reverse_each {|path| require path }
- return const_defined?(const) ? const_get(const) : super
+ const_defined?(sym) ? const_get(sym) : super
end
- super
end
alias_method_chain :const_missing, :tanuki
|
Create empty classes for missing constants
|
diff --git a/lab.gemspec b/lab.gemspec
index abc1234..def5678 100644
--- a/lab.gemspec
+++ b/lab.gemspec
@@ -23,5 +23,6 @@
spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake"
+ spec.add_development_dependency "rspec"
spec.add_development_dependency "mocha"
end
|
Add rspec to development dependencies
|
diff --git a/log.gemspec b/log.gemspec
index abc1234..def5678 100644
--- a/log.gemspec
+++ b/log.gemspec
@@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'evt-log'
- s.version = '0.6.0.1'
+ s.version = '1.0.0.0'
s.summary = 'Logging to STD IO with levels, tagging, and coloring'
s.description = ' '
|
Package version is increased from 0.6.0.1 to 1.0.0.0
|
diff --git a/lib/geocoder/ip_address.rb b/lib/geocoder/ip_address.rb
index abc1234..def5678 100644
--- a/lib/geocoder/ip_address.rb
+++ b/lib/geocoder/ip_address.rb
@@ -3,7 +3,7 @@ class IpAddress < String
def loopback?
- valid? and (self == "0.0.0.0" or self.match(/\A127\./) or self == "::1")
+ valid? and !!(self == "0.0.0.0" or self.match(/\A127\./) or self == "::1")
end
def valid?
|
Return strict boolean, for clarity.
|
diff --git a/core/kernel/at_exit_spec.rb b/core/kernel/at_exit_spec.rb
index abc1234..def5678 100644
--- a/core/kernel/at_exit_spec.rb
+++ b/core/kernel/at_exit_spec.rb
@@ -14,6 +14,12 @@ code = "at_exit {print 4};at_exit {print 5}; print 6; at_exit {print 7}"
ruby_exe(code).should == "6754"
end
+
+ it "allows calling exit inside at_exit handler" do
+ code = "at_exit {print 3}; at_exit {print 4; exit; print 5}; at_exit {print 6}"
+ ruby_exe(code).should == "643"
+ end
+
end
describe "Kernel#at_exit" do
|
Add spec for calling exit inside at_exit handler
|
diff --git a/lib/cogwheels.rb b/lib/cogwheels.rb
index abc1234..def5678 100644
--- a/lib/cogwheels.rb
+++ b/lib/cogwheels.rb
@@ -30,4 +30,10 @@ module Cogwheels
autoload :Configuration, 'cogwheels/configuration'
autoload :Loader, 'cogwheels/loader'
+
+ module_function
+
+ def load(src, mutable = true)
+ Cogwheels::Loader.load(src, mutable)
+ end
end
|
Add wrapper method to module
|
diff --git a/lib/scanny/checks/check.rb b/lib/scanny/checks/check.rb
index abc1234..def5678 100644
--- a/lib/scanny/checks/check.rb
+++ b/lib/scanny/checks/check.rb
@@ -11,6 +11,12 @@ @issues
end
+ # @return [String] pattern used to find relevant nodes. It must respect Machete's syntax.
+ def pattern
+ raise "The Check class requires its childrens to provide an "\
+ "implementation of the 'pattern' method."
+ end
+
def issue(impact, message, options = {})
@issues << Issue.new(@file, @line, impact, message, options[:cwe])
end
|
Define pattern method inside of Check
Make easier to understand how to write custom checks.
|
diff --git a/lib/stream_service/item.rb b/lib/stream_service/item.rb
index abc1234..def5678 100644
--- a/lib/stream_service/item.rb
+++ b/lib/stream_service/item.rb
@@ -3,7 +3,7 @@ require 'active_support/core_ext/hash'
module StreamService
- TIME_STAMP_FORMAT = '%Y-%m-%dT%H:%M:%S.%N%:z'
+ TIME_STAMP_FORMAT = '%Y-%m-%dT%H:%M:%S.%6N%:z'
class Item
|
Reduce precision sent to roshi to match db.
This ensures that roshi only cares about microseconds and nanoseconds
are discarded. This is important because postgres only stores
microsecond precision. In cases where we write to the stream from an
object recently created in ruby memory we have nanosecond precision.
Due to the nature of roshi adding/removal of items from streams has a
"highest score wins" approach. In our case ts is our score.
This fix ensures that all writes to streams can be removed, as both
addition and removal will be the same timestamp.
|
diff --git a/lib/githubber.rb b/lib/githubber.rb
index abc1234..def5678 100644
--- a/lib/githubber.rb
+++ b/lib/githubber.rb
@@ -5,8 +5,38 @@ require "githubber/pull_requests"
require "githubber/issues"
require "githubber/search"
+require "githubber/teams"
module Githubber
# Your code goes here...
- binding.pry
+ class App
+
+ def initialize
+ puts "What is your auth token?"
+ token = gets.chomp
+ @teams = Teams.new(token)
+ @issues = Issues.new(token)
+ end
+
+ def assign_hw(gist_id, org, repo, team, title)
+ all_teams = @teams.get_teams(org)
+ team_id = nil
+ all_teams.each do |x|
+ team_id = x["id"] if x["slug"] == team
+ end
+
+ members = @teams.get_members(team_id)
+
+ body = @teams.get_gist_content(gist_id)
+
+ members.each do |member|
+ @issues.add_issue(member["login"], body, org, repo, title)
+ end
+
+ end
+
+ end
+
+ app = App.new
+binding.pry
end
|
Initialize classes and create assign_hw method
|
diff --git a/lib/approvals/reporters/filelauncher_reporter.rb b/lib/approvals/reporters/filelauncher_reporter.rb
index abc1234..def5678 100644
--- a/lib/approvals/reporters/filelauncher_reporter.rb
+++ b/lib/approvals/reporters/filelauncher_reporter.rb
@@ -4,7 +4,7 @@ include Singleton
class << self
- def report(received, approved)
+ def report(received, approved = nil)
self.instance.report(received, approved)
end
end
|
Make the ignored argument optional in file launcher
|
diff --git a/lib/overcommit/plugins/pre_commit/haml_syntax.rb b/lib/overcommit/plugins/pre_commit/haml_syntax.rb
index abc1234..def5678 100644
--- a/lib/overcommit/plugins/pre_commit/haml_syntax.rb
+++ b/lib/overcommit/plugins/pre_commit/haml_syntax.rb
@@ -1,21 +1,15 @@-begin
- require 'haml'
-rescue LoadError => e
- puts "'haml' gem not available"
-end
-
module Overcommit::GitHook
class HamlSyntax < HookSpecificCheck
include HookRegistry
file_type :haml
- def skip?
- unless defined? Haml
- return :warn, "Can't find Haml gem"
+ def run_check
+ begin
+ require 'haml'
+ rescue LoadError
+ return :warn, "'haml' gem not installed -- run `gem install haml`"
end
- end
- def run_check
staged.each do |path|
begin
Haml::Engine.new(File.read(path), :check_syntax => true)
|
Make Haml syntax checker lazy-load haml gem
Similar to scss-lint, only load the gem if the repo contains modified
'.haml' files. This makes it so that people can leave this hook
installed but dormant unless they're actually working on Haml files.
Prior to this commit, they'd get a warning about the gem not being
installed.
Change-Id: I3fd7e1a7769983deda1872c8104c6505e4df3014
Reviewed-on: https://gerrit.causes.com/22714
Tested-by: Aiden Scandella <1faf1e8390cdac9204f160c35828cc423b7acd7b@causes.com>
Reviewed-by: Greg Hurrell <79e2475f81a6317276bf7cbb3958b20d289b78df@causes.com>
Reviewed-by: Joe Lencioni <1dd72cf724deaab5db236f616560fc7067b734e1@causes.com>
|
diff --git a/metadata.rb b/metadata.rb
index abc1234..def5678 100644
--- a/metadata.rb
+++ b/metadata.rb
@@ -3,10 +3,10 @@ maintainer_email "steffen.gebert@typo3.org"
license "Apache 2.0"
description "Installs/configures something"
-version "0.1.22"
+version "0.1.23"
depends "ssh", "= 0.6.6"
depends "ssl_certificates", "= 1.1.3"
-depends "t3-gerrit", "= 0.4.19"
+depends "t3-gerrit", "= 0.4.20"
depends "gerrit", "= 0.4.5"
depends "t3-chef-vault", "= 1.0.1"
|
Update upstream t3-gerrit to 0.4.20
|
diff --git a/metadata.rb b/metadata.rb
index abc1234..def5678 100644
--- a/metadata.rb
+++ b/metadata.rb
@@ -11,4 +11,4 @@ supports "debian"
depends "build-essential"
-depends "git", "1.0.0"
+depends "git"
|
Remove version constraint from git cookbook
|
diff --git a/metadata.rb b/metadata.rb
index abc1234..def5678 100644
--- a/metadata.rb
+++ b/metadata.rb
@@ -20,4 +20,4 @@ depends 'zookeeper', '~> 8.0'
depends 'magic', '~> 1.5'
depends 'et_gradle', '~> 2.0'
-depends 'maven', '~> 4.0'
+depends 'maven', '~> 5.0'
|
Upgrade maven dependency to 5.x
https://supermarket.chef.io/cookbooks/maven#changelog
|
diff --git a/moa.podspec b/moa.podspec
index abc1234..def5678 100644
--- a/moa.podspec
+++ b/moa.podspec
@@ -20,5 +20,5 @@ s.screenshots = "https://raw.githubusercontent.com/evgenyneu/moa/master/Graphics/Hunting_Moa.jpg"
s.source_files = "Moa/**/*.swift"
s.ios.deployment_target = "8.0"
- s.osx.deployment_target = "10.10"
+ s.osx.deployment_target = "10.9"
end
|
Decrease osx version in podpsec
|
diff --git a/ring_sig.gemspec b/ring_sig.gemspec
index abc1234..def5678 100644
--- a/ring_sig.gemspec
+++ b/ring_sig.gemspec
@@ -6,6 +6,7 @@ s.authors = ['Stephen McCarthy']
s.email = 'sjmccarthy@gmail.com'
s.summary = 'This gem implements ring signatures, built on top of ECDSA, as specified by CryptoNote'
+ s.description = 'Ring Signatures allow someone to non-interactively sign a message which can be verified against a set of chosen public keys.'
s.homepage = 'https://github.com/jamoes/ring_sig'
s.license = 'MIT'
@@ -14,12 +15,12 @@ s.test_files = s.files.grep(%r{^(test|spec|features)/})
s.add_development_dependency 'bundler', '~> 1.3'
- s.add_development_dependency 'rake'
+ s.add_development_dependency 'rake', '~> 0'
s.add_development_dependency 'rspec', '~> 3.0'
- s.add_development_dependency 'simplecov'
- s.add_development_dependency 'yard'
- s.add_development_dependency 'markdown'
- s.add_development_dependency 'redcarpet'
+ s.add_development_dependency 'simplecov', '~> 0'
+ s.add_development_dependency 'yard', '~> 0'
+ s.add_development_dependency 'markdown', '~> 0'
+ s.add_development_dependency 'redcarpet', '~> 0'
s.add_runtime_dependency 'ecdsa', '~> 1.1'
end
|
Remove warnings generated from gemspec
|
diff --git a/spec/data_set_spec.rb b/spec/data_set_spec.rb
index abc1234..def5678 100644
--- a/spec/data_set_spec.rb
+++ b/spec/data_set_spec.rb
@@ -7,17 +7,29 @@ context 'when all required sheets and headers are present' do
context 'when columns match data format correctly' do
+
+ well_formatted_excel_path = "./SampleData/SampleData.xlsx"
+
end
context 'when columns mismatch data format' do
+
+ format_mismatch_excel_path = "./SampleData/SampleData_formats_wrong.xlsx"
+
end
end
context 'when required sheets are missing' do
+
+ missing_sheet_excel_path = "./SampleData/SampleData_sheets_missing.xlsx"
+
end
context 'when required columns are missing' do
+
+ missing_columns_excel_path = "./SampleData/SampleData_columns_missing.xlsx"
+
end
end
|
Add paths to sample data for testing
|
diff --git a/goldfinger.gemspec b/goldfinger.gemspec
index abc1234..def5678 100644
--- a/goldfinger.gemspec
+++ b/goldfinger.gemspec
@@ -1,6 +1,6 @@ Gem::Specification.new do |s|
s.name = 'goldfinger'
- s.version = '1.2.0'
+ s.version = '1.2.1'
s.platform = Gem::Platform::RUBY
s.required_ruby_version = '>= 2.0.0'
s.date = '2016-02-17'
@@ -12,9 +12,9 @@ s.homepage = 'https://github.com/Gargron/goldfinger'
s.licenses = ['MIT']
- s.add_dependency('http', '~> 2.0')
- s.add_dependency('addressable', '~> 2.4')
- s.add_dependency('nokogiri', '~> 1.6')
+ s.add_dependency('http', '~> 2.2')
+ s.add_dependency('addressable', '~> 2.5')
+ s.add_dependency('nokogiri', '~> 1.7')
s.add_development_dependency('bundler', '~> 1.3')
end
|
Update dependencies and bump to 1.2.1
|
diff --git a/activesupport/activesupport.gemspec b/activesupport/activesupport.gemspec
index abc1234..def5678 100644
--- a/activesupport/activesupport.gemspec
+++ b/activesupport/activesupport.gemspec
@@ -22,5 +22,5 @@ s.add_dependency('i18n', '~> 0.6')
s.add_dependency('multi_json', '~> 1.3')
s.add_dependency('tzinfo', '~> 0.3.33')
- s.add_dependency('minitest', '~> 3.2')
+ s.add_dependency('minitest', '~> 4.0')
end
|
Update minitest dependency to ~> 4.0
|
diff --git a/spec/controllers/sessions_controller_spec.rb b/spec/controllers/sessions_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/sessions_controller_spec.rb
+++ b/spec/controllers/sessions_controller_spec.rb
@@ -17,7 +17,7 @@ end
it 'loads or creates the user from the OAuth hash' do
- expect(User).to receive(:from_oauth).with(auth_hash)
+ expect(User).to receive(:from_oauth).with(auth_hash, nil)
post :create, provider: 'default'
end
|
Fix failing session controller spec
|
diff --git a/spec/models/album_spec.rb b/spec/models/album_spec.rb
index abc1234..def5678 100644
--- a/spec/models/album_spec.rb
+++ b/spec/models/album_spec.rb
@@ -1,9 +1,7 @@ require 'spec_helper'
describe Album do
- it 'must belong to a user' do
- pending 'test user association'
- end
+ it { should validate_presence_of :user_id }
it 'must be deleted if the user is deleted' do
pending 'test that album is gone if user is deleted'
|
Test the validation of user_id on Album model
|
diff --git a/spec/models/email_spec.rb b/spec/models/email_spec.rb
index abc1234..def5678 100644
--- a/spec/models/email_spec.rb
+++ b/spec/models/email_spec.rb
@@ -15,7 +15,9 @@
describe ".to" do
it "should return an array for all the email addresses" do
- email = Email.create!(:to => "mlandauer@foo.org, matthew@bar.com")
+ Email.create!(:to => "mlandauer@foo.org, matthew@bar.com")
+
+ email = Email.find_by_to("mlandauer@foo.org, matthew@bar.com")
email.to.should == ["mlandauer@foo.org", "matthew@bar.com"]
end
end
|
Make test a little more specific about how the to addresses are stored
|
diff --git a/mishmesh.podspec b/mishmesh.podspec
index abc1234..def5678 100644
--- a/mishmesh.podspec
+++ b/mishmesh.podspec
@@ -8,7 +8,7 @@ s.homepage = "https://github.com/vovagalchenko/mishmesh"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = "Vova Galchenko"
-s.source = { :git => "https://github.com/vovagalchenko/mishmesh", :tag => "v#{s.version}" }
+s.source = { :git => "https://github.com/vovagalchenko/mishmesh.git", :tag => "v#{s.version}" }
# Platform
|
Update podspec after pod spec lint
|
diff --git a/casino-ldap_authenticator.gemspec b/casino-ldap_authenticator.gemspec
index abc1234..def5678 100644
--- a/casino-ldap_authenticator.gemspec
+++ b/casino-ldap_authenticator.gemspec
@@ -23,5 +23,5 @@ s.add_development_dependency 'coveralls'
s.add_runtime_dependency 'net-ldap', '~> 0.3'
- s.add_runtime_dependency 'casino', '~> 3.0.0.pre.1'
+ s.add_runtime_dependency 'casino', '~> 3.0.0'
end
|
Update for final version of CASino 3.0
|
diff --git a/nap.gemspec b/nap.gemspec
index abc1234..def5678 100644
--- a/nap.gemspec
+++ b/nap.gemspec
@@ -1,15 +1,16 @@ Gem::Specification.new do |spec|
spec.name = 'nap'
spec.version = '0.4'
-
+
spec.author = "Manfred Stienstra"
spec.email = "manfred@fngtps.com"
spec.description = <<-EOF
- Nap is a really simple REST API.
+ Nap is a really simple REST library. It allows you to perform HTTP requests
+ with minimal amounts of code.
EOF
spec.summary = <<-EOF
- Nap is a really simple REST API.
+ Nap is a really simple REST library.
EOF
spec.files = ['lib/rest.rb', 'lib/rest/request.rb', 'lib/rest/response.rb', 'support/cacert.pem']
@@ -17,4 +18,7 @@ spec.has_rdoc = true
spec.extra_rdoc_files = ['README', 'LICENSE']
spec.rdoc_options << "--charset=utf-8"
+
+ spec.add_development_dependency('test-spec')
+ spec.add_development_dependency('mocha')
end
|
Fix the gem description in the gemspec. Add development dependencies.
|
diff --git a/webadmin/start.rb b/webadmin/start.rb
index abc1234..def5678 100644
--- a/webadmin/start.rb
+++ b/webadmin/start.rb
@@ -20,12 +20,12 @@ revision = params[:revision].ergo.to_s[/(\w+)/, 1]
@command = nil
- common_restart = %{rake RAILS_ENV=production clear && touch #{RESTART_TXT}}
+ common_restart = %{rake RAILS_ENV=production clear && bundle update --local && touch #{RESTART_TXT}}
common_deploy = %{rake RAILS_ENV=production db:migrate && #{common_restart}}
case action
when "deploy_and_migrate_via_update"
if revision
- @command = %{git pull && git checkout #{revision} && #{common_deploy}}
+ @command = %{git pull --rebase && git checkout #{revision} && #{common_deploy}}
else
@message = "ERROR: must specify revision to deploy via update"
end
|
Update webadmin to use bundler.
|
diff --git a/lib/dragonfly/config/r_magick_images.rb b/lib/dragonfly/config/r_magick_images.rb
index abc1234..def5678 100644
--- a/lib/dragonfly/config/r_magick_images.rb
+++ b/lib/dragonfly/config/r_magick_images.rb
@@ -20,6 +20,15 @@ process :thumb, geometry
encode format if format
end
+ c.job :gif do
+ encode :gif
+ end
+ c.job :jpg do
+ encode :jpg
+ end
+ c.job :png do
+ encode :png
+ end
end
end
|
Add some cool shortcuts for encoding
|
diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/games_controller.rb
+++ b/app/controllers/games_controller.rb
@@ -1,5 +1,9 @@ class GamesController < ApplicationController
before_filter :lookup_user
+
+ def new
+ redirect_to Game.create!
+ end
def index
@games = Game.where(pending: true)
@@ -8,10 +12,6 @@ def show
@game = game
@player = player
- end
-
- def new
- redirect_to Game.create!
end
private
|
Refactor ordering of GameController methods to be lifecycle order
|
diff --git a/app/controllers/rates_controller.rb b/app/controllers/rates_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/rates_controller.rb
+++ b/app/controllers/rates_controller.rb
@@ -8,8 +8,9 @@ rate_creator.call
if !rate_creator.success?
flash[:error] = rate_creator.errors
+ redirect_to :back
+ else
+ redirect_to :back, notice: 'Rate was successfully created.'
end
-
- redirect_to :back
end
end
|
Add notice that rate was succesfully created
|
diff --git a/descendants_tracker.gemspec b/descendants_tracker.gemspec
index abc1234..def5678 100644
--- a/descendants_tracker.gemspec
+++ b/descendants_tracker.gemspec
@@ -13,7 +13,7 @@
gem.require_paths = %w[lib]
gem.files = `git ls-files`.split($/)
- gem.test_files = `git ls-files -- {spec}/*`.split($/)
+ gem.test_files = `git ls-files -- spec/unit`.split($/)
gem.extra_rdoc_files = %w[LICENSE README.md TODO]
gem.add_development_dependency('rake', '~> 10.0.3')
|
Change test_files specification to be more precise
|
diff --git a/app/controllers/votes_controller.rb b/app/controllers/votes_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/votes_controller.rb
+++ b/app/controllers/votes_controller.rb
@@ -1,9 +1,20 @@ class VotesController < ApplicationController
def create
+ if logged_in
+ @vote = Vote.where(user_id: session[:user_id]).find_or_initialize_by(vote_params)
+ set_vote
+ save_vote
+ else
+ render json: nil
+ end
end
def update
+ if logged_in
+ set_vote
+ save_vote
+ end
end
def index
@@ -15,7 +26,31 @@ end
private
+
+ def set_vote
+ @vote ||= Vote.find(params[:id])
+ p upvote_param
+ if @vote.is_upvote == upvote_param[:is_upvote]
+ @vote.is_upvote = nil
+ else
+ @vote.is_upvote = upvote_param[:is_upvote]
+ end
+ end
+
+ def save_vote
+ if @vote.save
+ render json: @vote.to_json
+ else
+ render json: nil
+ end
+ end
+
+
def vote_params
- params.require(:vote).permit!
+ params.require(:vote).permit(:votable_type, :votable_id)
+ end
+
+ def upvote_param
+ params.require(:vote).permit(:is_upvote)
end
end
|
Reconfigure Vote controller to be DRY and accept JSON Requests from Vote Backbone model
-Rewrite vote_params method to exclude is_upvote (allows for searching if incoming vote already exists without id)
-Add upvote_param method that allows for setting of solely the is_upvote attribute
-Create a private save_vote method
-Create a private set_vote method that will set is_upvote attribute properly
-Use save_vote and set_vote method in the update method if logged in
-Use set_vote and save_vote method in create method if logged_in after checking if vote by user already exists
|
diff --git a/app/controllers/channels/adm/projects_controller.rb b/app/controllers/channels/adm/projects_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/channels/adm/projects_controller.rb
+++ b/app/controllers/channels/adm/projects_controller.rb
@@ -11,8 +11,8 @@
before_filter do
- @channel = current_user.channels.first
- @total_projects = @channel.projects.size
+ @channel = Channel.find_by_permalink!(request.subdomain.to_s)
+ @total_projects = @channel.projects.size
end
[:approve, :reject, :push_to_draft].each do |name|
|
Remove current_user trustee constraint from channels administration.
|
diff --git a/app/models/effective/style_guide.rb b/app/models/effective/style_guide.rb
index abc1234..def5678 100644
--- a/app/models/effective/style_guide.rb
+++ b/app/models/effective/style_guide.rb
@@ -1,38 +1,34 @@ module Effective
- class StyleGuide < ActiveRecord::Base
- acts_as_asset_box :files => 1..6 if defined?(EffectiveAssets)
+ class StyleGuide
+ include ActiveModel::Model
- def self.columns
- @columns ||= []
+ if defined?(EffectiveAssets)
+ acts_as_asset_box files: 1..6
end
- def self.column(name, sql_type = nil, default = nil, null = true)
- if Rails.version >= '4.2.0'
- cast_type = "ActiveRecord::Type::#{sql_type.to_s.titleize.sub('Datetime', 'DateTime')}".constantize.new()
- columns << ::ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, cast_type, sql_type.to_s, null)
- else
- columns << ::ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, sql_type.to_s, null)
- end
- end
+ attr_accessor :id, :title, :email, :password, :number, :range, :category, :content
+ attr_accessor :archived, :drink, :food, :price, :updated_at, :publish_on, :static_text
- column :id, :integer
- column :title, :string
- column :email, :string
- column :password, :string
- column :number, :integer
- column :range, :integer
- column :category, :string
- column :content, :text
- column :archived, :boolean
- column :drink, :string
- column :food, :string
- column :price, :integer
- column :updated_at, :datetime
- column :publish_on, :date
- column :static_text, :string
+ # column :id, :integer
- validates_presence_of :id, :title, :email, :password, :number, :range, :category, :content, :archived, :drink, :food, :price, :updated_at, :publish_on, :static_text
+ # column :title, :string
+ # column :email, :string
+ # column :password, :string
+ # column :number, :integer
+ # column :range, :integer
+ # column :category, :string
+ # column :content, :text
+ # column :archived, :boolean
+ # column :drink, :string
+ # column :food, :string
+ # column :price, :integer
+ # column :updated_at, :datetime
+ # column :publish_on, :date
+ # column :static_text, :string
+
+ validates :id, :title, :email, :password, :number, :range, :category, :content, presence: true
+ validates :archived, :drink, :food, :price, :updated_at, :publish_on, :static_text, presence: true
def static_text
'some static text'
|
Rework model to use ActiveModel::Model instead of hacks
|
diff --git a/lib/sepa_clearer/deutsche_bundesbank.rb b/lib/sepa_clearer/deutsche_bundesbank.rb
index abc1234..def5678 100644
--- a/lib/sepa_clearer/deutsche_bundesbank.rb
+++ b/lib/sepa_clearer/deutsche_bundesbank.rb
@@ -9,10 +9,10 @@ service_b2b: :b2b
}
- def data(file = 'data/deutsche_bundesbank.csv')
+ def data(file = nil)
@data ||= begin
[].tap do |data|
- CSV.foreach(file, { headers: true, col_sep: ';', header_converters: :symbol }) do |row|
+ CSV.foreach(file || default_data_file, { headers: true, col_sep: ';', header_converters: :symbol }) do |row|
data.push PaymentProvider.new(*parse_raw_data(row))
end
end
@@ -26,5 +26,9 @@ CAPABILITIES_MAPPING.map { |key, service| data[key] == '1' ? service : nil }.compact
]
end
+
+ def default_data_file
+ File.join(File.dirname(__FILE__), '../..', 'data/deutsche_bundesbank.csv')
+ end
end
end
|
Use relative path to determine location of data file
|
diff --git a/iban-tools.gemspec b/iban-tools.gemspec
index abc1234..def5678 100644
--- a/iban-tools.gemspec
+++ b/iban-tools.gemspec
@@ -3,9 +3,10 @@ s.summary = "IBAN validator"
s.name = 'iban-tools'
s.version = '0.0.1.1'
+ s.authors = ["Iulian Dogariu"]
+ s.email = ["code@iuliandogariu.com"]
s.requirements << 'none'
s.require_path = 'lib'
- s.autorequire = 'iban-tools.rb'
s.files = [ "README",
"lib/iban-tools.rb",
"lib/iban-tools/iban.rb"
|
Fix some gem build warnings: add author and email, rm autorequire
|
diff --git a/server/app/controllers/application_controller.rb b/server/app/controllers/application_controller.rb
index abc1234..def5678 100644
--- a/server/app/controllers/application_controller.rb
+++ b/server/app/controllers/application_controller.rb
@@ -3,7 +3,6 @@
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
- protect_from_forgery # See ActionController::RequestForgeryProtection for details
# Scrub sensitive parameters from your log
# filter_parameter_logging :password
|
Remove protect_from_forgery setting since our POSTs generally won't come
from web forms.
|
diff --git a/examples/active_record/server.rb b/examples/active_record/server.rb
index abc1234..def5678 100644
--- a/examples/active_record/server.rb
+++ b/examples/active_record/server.rb
@@ -20,7 +20,7 @@ end
post '/shouts' do
- Shout.create :body => params['body']
+ Shout.create :body => params[:body]
redirect_to '/'
end
end
|
Change the activerecord example to use indifferent feature
|
diff --git a/plugins/chef/chef_client.rb b/plugins/chef/chef_client.rb
index abc1234..def5678 100644
--- a/plugins/chef/chef_client.rb
+++ b/plugins/chef/chef_client.rb
@@ -10,21 +10,29 @@ # Released under the same terms as Sensu (the MIT license); see LICENSE
# for details.
-`which tasklist`
-case
-when $? == 0
- procs = `tasklist`
-else
- procs = `ps aux`
+require 'sensu/plugin/check/cli'
+
+class ChefClient < Sensu::Plugin::Check::CLI
+
+ check_name 'chef-client'
+
+ def run
+ `which tasklist`
+ case
+ when $? == 0
+ procs = `tasklist`
+ else
+ procs = `ps aux`
+ end
+ running = false
+ procs.each_line do |proc|
+ running = true if proc.include?('chef-client')
+ end
+ if running
+ ok 'Chef client daemon is running'
+ else
+ warning 'Chef client daemon is NOT running'
+ end
+ end
+
end
-running = false
-procs.each_line do |proc|
- running = true if proc.include?('chef-client')
-end
-if running
- puts 'CHEF CLIENT - OK - Chef client daemon is running'
- exit 0
-else
- puts 'CHEF CLIENT - WARNING - Chef client daemon is NOT running'
- exit 1
-end
|
Use CLI framework in the chef-client check
|
diff --git a/app/controllers/life_highlights_controller.rb b/app/controllers/life_highlights_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/life_highlights_controller.rb
+++ b/app/controllers/life_highlights_controller.rb
@@ -1,11 +1,19 @@ class LifeHighlightsController < MyplaceonlineController
+ def use_bubble?
+ true
+ end
+
+ def bubble_text(obj)
+ Myp.display_date_month_year(obj.life_highlight_time, User.current_user)
+ end
+
protected
def insecure
true
end
def sorts
- ["lower(life_highlights.life_highlight_name) ASC"]
+ ["life_highlights.life_highlight_time DESC", "lower(life_highlights.life_highlight_name) ASC"]
end
def obj_params
|
Sort life highlights by time and show time in bubble
|
diff --git a/test/exception_test.rb b/test/exception_test.rb
index abc1234..def5678 100644
--- a/test/exception_test.rb
+++ b/test/exception_test.rb
@@ -13,13 +13,13 @@ assert_equal 5, exc.bindings.first.source_location.last
end
- test 'bindings goes down the_stack' do
+ test 'bindings goes down the stack' do
exc = BasicNestedFixture.new.call
assert_equal 11, exc.bindings.first.source_location.last
end
- test 'bindings inside_of_an_eval' do
+ test 'bindings inside of an eval' do
exc = EvalNestedFixture.new.call
assert_equal 11, exc.bindings.first.source_location.last
@@ -31,13 +31,13 @@ assert_equal 3, exc.bindings.first.source_location.last
end
- test 'bindings is_empty_when_exception_is_still_not_raised' do
+ test 'bindings is empty when exception is still not raised' do
exc = RuntimeError.new
assert_equal [], exc.bindings
end
- test 'bindings is_empty_when_set_backtrace_is_badly_called' do
+ test 'bindings is empty when set backtrace is badly called' do
exc = RuntimeError.new
# Exception#set_backtrace expects a string or array of strings. If the
|
Fix a few test names in ExceptionTest
|
diff --git a/lib/artery/config.rb b/lib/artery/config.rb
index abc1234..def5678 100644
--- a/lib/artery/config.rb
+++ b/lib/artery/config.rb
@@ -8,11 +8,11 @@
# Ability to redefine message class (for example, for non-activerecord applications)
def message_class
- @message_class || Message
+ @message_class || Artery::Message
end
def last_model_update_class
- @last_model_update_class || LastModelUpdate
+ @last_model_update_class || Artery::LastModelUpdate
end
def service_name
|
Fix strange problems with class discovering
|
diff --git a/lib/bandicoot/dsl.rb b/lib/bandicoot/dsl.rb
index abc1234..def5678 100644
--- a/lib/bandicoot/dsl.rb
+++ b/lib/bandicoot/dsl.rb
@@ -11,7 +11,7 @@ end
def paginate_url(url, next_page_css_path:)
- self.next_page_path = next_page_path
+ self.next_page_css_path = next_page_css_path
self.url = url
end
|
Rename next page css path
|
diff --git a/coderwall_api.gemspec b/coderwall_api.gemspec
index abc1234..def5678 100644
--- a/coderwall_api.gemspec
+++ b/coderwall_api.gemspec
@@ -6,6 +6,7 @@ gem.name = 'coderwall_api'
gem.version = Coderwall::VERSION.dup
gem.authors = ['Kenichi Kamiya']
+ gem.licenses = ['MIT']
gem.email = ['kachick1+ruby@gmail.com']
gem.summary = 'An API wrapper for the coderwall.com'
gem.description = gem.summary.dup
|
Add licenses into gemspec. For new UI of rubygems.org
|
diff --git a/lib/core_ext/file.rb b/lib/core_ext/file.rb
index abc1234..def5678 100644
--- a/lib/core_ext/file.rb
+++ b/lib/core_ext/file.rb
@@ -0,0 +1,17 @@+# encoding: utf-8
+
+class File
+ # determine whether a String path is absolute.
+ # @example
+ # File.absolute_path?('foo') #=> false
+ # File.absolute_path?('/foo') #=> true
+ # File.absolute_path?('foo/bar') #=> false
+ # File.absolute_path?('/foo/bar') #=> true
+ # File.absolute_path?('C:foo/bar') #=> false
+ # File.absolute_path?('C:/foo/bar') #=> true
+ # @param [String] - a pathname
+ # @return [Boolean]
+ def self.absolute_path?(path)
+ false | File.dirname(path)[/\A([A-Z]:)?#{Regexp.escape(File::SEPARATOR)}/i]
+ end
+end
|
Add File::absolute_path? as a core_ext
|
diff --git a/lib/cxml/item_out.rb b/lib/cxml/item_out.rb
index abc1234..def5678 100644
--- a/lib/cxml/item_out.rb
+++ b/lib/cxml/item_out.rb
@@ -11,7 +11,7 @@ @unit_price = @item_detail['UnitPrice']
@unit_of_measure = @item_detail['UnitOfMeasure']
- @shipping = data['Shipping']
+ @shipping = data['Shipping'] if data['Shipping']
end
end
@@ -26,8 +26,10 @@ p.text @unit_of_measure['content']
end
end
- t.Shipping do |o|
- o.Money { |p| CXML::Money.new(@shipping['Money']).render(p) }
+ if @shipping
+ t.Shipping do |o|
+ o.Money { |p| CXML::Money.new(@shipping['Money']).render(p) }
+ end
end
end
end
|
Make Shipping optional in ItemOut
|
diff --git a/railseventstore.org/config.rb b/railseventstore.org/config.rb
index abc1234..def5678 100644
--- a/railseventstore.org/config.rb
+++ b/railseventstore.org/config.rb
@@ -8,5 +8,21 @@ set :markdown_engine, :redcarpet
set :res_version, File.read('../RES_VERSION')
+helpers do
+ def version_above(version_string)
+ given_version = Gem::Version.new(version_string)
+ current_version = Gem::Version.new(config[:res_version])
+ current_version > given_version
+ end
+
+ def in_version_above(version_string, &block)
+ block.call if version_above(version_string)
+ end
+
+ def in_version_at_most(version_string, &block)
+ block.call unless version_above(version_string)
+ end
+end
+
page "/", layout: "landing"
page "/docs/*", layout: "documentation"
|
Set of documentation helpers regarding applicable version.
Use as follows:
- rename page from page.html.md to page.html.md.erb
- enclose paragraph in <% in_version_above('0.28.0') do %> ... <% end %>
block
Also possible to use <% in_version_at_most('0.28.0') do %> or conditional
in <% if version_above('0.28.0') %> ... <% else %> ... <% end %>
|
diff --git a/spec/features/bootstrap_in_azure_feature_spec.rb b/spec/features/bootstrap_in_azure_feature_spec.rb
index abc1234..def5678 100644
--- a/spec/features/bootstrap_in_azure_feature_spec.rb
+++ b/spec/features/bootstrap_in_azure_feature_spec.rb
@@ -0,0 +1,32 @@+require "rails_helper"
+require "velum/instance_type"
+
+describe "Feature: Bootstrap a cluster in Azure" do
+ let(:user) { create(:user) }
+ let(:instance_types) { Velum::InstanceType.for("azure") }
+ let(:custom_instance_type) { OpenStruct.new(key: "CUSTOM") }
+
+ before do
+ login_as user, scope: :user
+ create(:azure_pillar)
+ visit setup_worker_bootstrap_path
+ end
+
+ it "refers to Azure in the heading" do
+ expect(page).to have_css("h1", text: "Microsoft Azure")
+ end
+
+ it "allows selection of an instance type" do
+ instance_types.each do |instance_type|
+ expect(page).to have_css(instance_type_radio_finder(instance_type))
+ end
+ end
+
+ it "displays the category of the selected instance type", js: true do
+ instance_types.each do |instance_type|
+ click_instance_type_radio(instance_type)
+ expect(page).to have_text(:visible, instance_type.category.name)
+ expect(page).to have_text(:visible, instance_type.category.description)
+ end
+ end
+end
|
Add a feature spec for building cluster in Azure
Most of the content is covered in the cloud_cluster model, but there
are a few differentiators that should be checked.
|
diff --git a/spec/lib/bidu/house/report/report_config_spec.rb b/spec/lib/bidu/house/report/report_config_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/bidu/house/report/report_config_spec.rb
+++ b/spec/lib/bidu/house/report/report_config_spec.rb
@@ -9,5 +9,13 @@ expect(subject.build(parameters)).to be_a(Bidu::House::Report::Error)
end
end
+
+ context 'when a dummy type is given' do
+ let(:config) { { type: :dummy } }
+
+ it do
+ expect(subject.build(parameters)).to be_a(Bidu::House::Report::Dummy)
+ end
+ end
end
end
|
Add spec over new report type
|
diff --git a/spec/views/layouts/application.html.haml_spec.rb b/spec/views/layouts/application.html.haml_spec.rb
index abc1234..def5678 100644
--- a/spec/views/layouts/application.html.haml_spec.rb
+++ b/spec/views/layouts/application.html.haml_spec.rb
@@ -1,6 +1,6 @@ require 'spec_helper'
describe "layouts/application" do
- before { pending; allow(view).to receive(:current_user).and_return(current_user) }
+ before { allow(view).to receive(:current_user).and_return(current_user) }
let(:admin) { false }
let(:current_user) { mock_model User, admin?: admin, full_name: "Batman", image_url: "none" }
@@ -8,7 +8,7 @@ subject { render; Capybara.string(rendered) }
it { is_expected.to_not have_link 'Admin' }
- it { is_expected.to have_link 'Sign out' }
+ it { pending; is_expected.to have_link 'Sign out' }
context "when the user is not signed in" do
let(:current_user) { nil }
@@ -17,6 +17,6 @@
context "when the user is an admin" do
let(:admin) { true }
- it { is_expected.to have_link 'Admin' }
+ it { pending; is_expected.to have_link 'Admin' }
end
end
|
Reduce number of pending specs
|
diff --git a/bosh-dev/lib/bosh/dev/bat_helper.rb b/bosh-dev/lib/bosh/dev/bat_helper.rb
index abc1234..def5678 100644
--- a/bosh-dev/lib/bosh/dev/bat_helper.rb
+++ b/bosh-dev/lib/bosh/dev/bat_helper.rb
@@ -37,10 +37,6 @@
prepare_directories
- sanitize_directories
-
- prepare_directories
-
pipeline.fetch_stemcells(infrastructure, artifacts_dir)
infrastructure.run_system_micro_tests
|
Remove duplicate method calls, probably from a bad merge
|
diff --git a/lib/gitlab/logger.rb b/lib/gitlab/logger.rb
index abc1234..def5678 100644
--- a/lib/gitlab/logger.rb
+++ b/lib/gitlab/logger.rb
@@ -14,13 +14,9 @@
def self.read_latest
path = Rails.root.join("log", file_name)
- self.build unless File.exist?(path)
- tail_output, _ = Gitlab::Popen.popen(%W(tail -n 2000 #{path}))
- tail_output.split("\n")
- end
- def self.read_latest_for(filename)
- path = Rails.root.join("log", filename)
+ return [] unless File.readable?(path)
+
tail_output, _ = Gitlab::Popen.popen(%W(tail -n 2000 #{path}))
tail_output.split("\n")
end
|
Fix a potential timeout in `Gitlab::Logger.read_latest`
If this method was called for a file that didn't exist, we attempted to
first `build` it. But if the file wasn't writeable, such as a symlink
pointing to an unmounted filesystem, the method would just hang and
eventually timeout.
Further, this was entirely pointless since we were creating a file and
then shelling out to `tail`, eventually returning an empty Array. Now we
just skip building it and return the empty Array straight away.
|
diff --git a/lib/imminence_api.rb b/lib/imminence_api.rb
index abc1234..def5678 100644
--- a/lib/imminence_api.rb
+++ b/lib/imminence_api.rb
@@ -1,13 +1,6 @@-require 'json_utils'
+require 'gds_api'
-class ImminenceApi
-
- include JsonUtils
-
- def initialize(endpoint)
- @endpoint = endpoint
- end
-
+class ImminenceApi < GdsApi
def api_url(type,lat,lon,limit=5)
"#{@endpoint}/places/#{type}.json?limit=#{limit}&lat=#{lat}&lng=#{lon}"
end
|
Update imminence API to use GdsApi
|
diff --git a/lib/ls_stash/rest.rb b/lib/ls_stash/rest.rb
index abc1234..def5678 100644
--- a/lib/ls_stash/rest.rb
+++ b/lib/ls_stash/rest.rb
@@ -11,8 +11,8 @@ request = Net::HTTP::Get.new(uri.request_uri)
request.basic_auth(options[:user], options[:password])
if options[:prettify]
+ JSON.pretty_generate(JSON.parse(http.request(request).body))
+ else
JSON.parse(http.request(request).body)
- else
- JSON.pretty_generate(JSON.parse(http.request(request).body))
end
end
|
Fix conditions in if statement for prettify option.
|
diff --git a/lib/apple-news/article.rb b/lib/apple-news/article.rb
index abc1234..def5678 100644
--- a/lib/apple-news/article.rb
+++ b/lib/apple-news/article.rb
@@ -13,7 +13,7 @@ optional_properties :is_sponsored, :is_preview, :accessory_text, :revision
optional_property :links, {}
- attr_reader :id
+ attr_reader :id, :share_url, :state
attr_accessor :document
def_delegator :@document, :title
@@ -38,7 +38,12 @@
def hydrate!
data = fetch_data['data']
+
+ # Some special properties that need to be manually set.
@document = Document.new(data.delete('document'))
+ @share_url = data.delete('share_url')
+ @state = data.delete('state')
+
load_properties(data)
end
end
|
Set state and share URL
|
diff --git a/lib/attr_cleaner/model.rb b/lib/attr_cleaner/model.rb
index abc1234..def5678 100644
--- a/lib/attr_cleaner/model.rb
+++ b/lib/attr_cleaner/model.rb
@@ -1,24 +1,23 @@ module AttrCleaner
module Model
extend ActiveSupport::Concern
-
- included do
- alias_method_chain :write_attribute, :cleaner
- class_attribute :attr_cleaners
- end
-
- def write_attribute_with_cleaner(attr_name, value)
- if Array(attr_cleaners).include?(attr_name.to_sym) && value.is_a?(String)
- value = value.strip
- value = nil if value.empty?
+
+ module ClassMethods
+ def attr_cleaner(*columns)
+ columns.each do |column|
+ define_attr_cleaner(column)
+ end
end
- write_attribute_without_cleaner(attr_name, value)
- end
+ def define_attr_cleaner(column)
+ define_method "#{column}=" do |value|
+ if value.is_a?(String)
+ value = value.strip
+ value = nil if value.empty?
+ end
- module ClassMethods
- def attr_cleaner(*columns)
- self.attr_cleaners = columns
+ super(value)
+ end
end
end
end
|
Change implementation to avoid alias_method_chain
|
diff --git a/lib/ruby_cue_lang.rb b/lib/ruby_cue_lang.rb
index abc1234..def5678 100644
--- a/lib/ruby_cue_lang.rb
+++ b/lib/ruby_cue_lang.rb
@@ -7,15 +7,8 @@
module Cue
- # This lets us reference cue classes as cue.lang.SentenceIterator,
- # rather than Java::CueLang::SentenceIterator.
- def cue
- Java::Cue
- end
- private :cue
-
def self.each_word(string)
- iter = cue.lang.WordIterator.new(string)
+ iter = Java::CueLang::WordIterator.new(string)
while iter.has_next do
yield iter.next
@@ -23,19 +16,22 @@ end
def self.each_sentence(string)
- iter = cue.lang.SentenceIterator.new(string)
+ iter = Java::CueLang::SentenceIterator.new(string)
while iter.has_next do
yield iter.next
end
end
+ # TODO allow for Locale, and custom StopWords
def self.each_ngram(string, n)
- iter = cue.lang.NGramIterator.new(n, string)
+ iter = Java::CueLang::NGramIterator.new(n, string)
while iter.has_next do
yield iter.next
end
end
+ # TODO add StopWords.guess()
+
end
|
Use explicit Java modules, to simplify accessing cue packages from both Module-level and instance-level methods; added TODOs
|
diff --git a/lib/cookie_monster/jar.rb b/lib/cookie_monster/jar.rb
index abc1234..def5678 100644
--- a/lib/cookie_monster/jar.rb
+++ b/lib/cookie_monster/jar.rb
@@ -9,6 +9,8 @@ end
def [](key)
+ key = key.to_s
+
if @response.cookies[key]
cookie = @response.cookies[key]
elsif @request.cookies[key]
|
Call `to_s` on key before looking for it in cookies hashes.
|
diff --git a/lib/tabnav/navbar.rb b/lib/tabnav/navbar.rb
index abc1234..def5678 100644
--- a/lib/tabnav/navbar.rb
+++ b/lib/tabnav/navbar.rb
@@ -29,7 +29,7 @@ @tabs.each do |tab|
contents += tab.render
end
- contents
+ contents.html_safe
end
end
end
|
Use html_safe to make tabnav work with Rails3.
|
diff --git a/lib/gnip-stream/stream.rb b/lib/gnip-stream/stream.rb
index abc1234..def5678 100644
--- a/lib/gnip-stream/stream.rb
+++ b/lib/gnip-stream/stream.rb
@@ -26,7 +26,6 @@
def connect
EM.run do
- EM.threadpool_size = 5
http = EM::HttpRequest.new(@url, :inactivity_timeout => 0).get(:head => @headers)
http.stream { |chunk| process_chunk(chunk) }
http.callback {
|
Revert "limit the size of the EM threadpool."
This reverts commit 85adceda36f8a68b3fc9a9aa0efb419a8a595812.
|
diff --git a/Library/Formula/weechat.rb b/Library/Formula/weechat.rb
index abc1234..def5678 100644
--- a/Library/Formula/weechat.rb
+++ b/Library/Formula/weechat.rb
@@ -11,7 +11,10 @@ def install
#FIXME: Compiling perl module doesn't work
#FIXME: GnuTLS support isn't detected
- system "cmake", "-DDISABLE_PERL=ON", std_cmake_parameters, "."
+ #NOTE: -DPREFIX has to be specified because weechat devs enjoy being non-standard
+ system "cmake", "-DPREFIX=#{prefix}",
+ "-DDISABLE_PERL=ON",
+ std_cmake_parameters, "."
system "make install"
end
end
|
Fix Weechat always installing to /usr/local
The WeeChat devs don't know about CMAKE_INSTALL_PREFIX apparently, someone
should tell them. I won't. I plan on just sitting back and shacking my head
side-to-side instead.
|
diff --git a/lib/liquid/tags/assign.rb b/lib/liquid/tags/assign.rb
index abc1234..def5678 100644
--- a/lib/liquid/tags/assign.rb
+++ b/lib/liquid/tags/assign.rb
@@ -12,10 +12,6 @@ class Assign < Tag
Syntax = /(#{VariableSignature}+)\s*=\s*(.*)\s*/om
- def self.syntax_error_translation_key
- "errors.syntax.assign"
- end
-
attr_reader :to, :from
def initialize(tag_name, markup, options)
@@ -24,7 +20,7 @@ @to = Regexp.last_match(1)
@from = Variable.new(Regexp.last_match(2), options)
else
- raise SyntaxError, options[:locale].t(self.class.syntax_error_translation_key)
+ raise SyntaxError, options[:locale].t('errors.syntax.assign')
end
end
|
Use String literal instead of using a class method
The class method string definition is not needed here, so it can be removed.
|
diff --git a/lib/spontaneous/sequel.rb b/lib/spontaneous/sequel.rb
index abc1234..def5678 100644
--- a/lib/spontaneous/sequel.rb
+++ b/lib/spontaneous/sequel.rb
@@ -1,6 +1,17 @@ require "sequel"
Sequel.extension :inflector
+
+# See http://sequel.jeremyevans.net/rdoc/classes/Sequel/Timezones.html
+# UTC is more performant than :local (or 'nil' which just fallsback to :local)
+# A basic profiling run gives a 2 x performance improvement of :utc over :local
+# With ~240 rows, timing ::Content.all gives:
+#
+# :utc ~0.04s
+# :local ~0.08s
+#
+# DB timestamps are only shown in the editing UI & could be localized there per-user
+Sequel.default_timezone = :utc
require 'sequel/plugins/serialization'
|
Set Sequel's timezones to UTC
|
diff --git a/lib/spork/run_strategy.rb b/lib/spork/run_strategy.rb
index abc1234..def5678 100644
--- a/lib/spork/run_strategy.rb
+++ b/lib/spork/run_strategy.rb
@@ -28,7 +28,11 @@
protected
def self.factory(test_framework)
- Spork::RunStrategy::Forking.new(test_framework)
+ if Spork::RunStrategy::Forking.available?
+ Spork::RunStrategy::Forking.new(test_framework)
+ else
+ Spork::RunStrategy::Magazine.new(test_framework)
+ end
end
def self.inherited(subclass)
|
Use magazine strategy if forking not available.
TODO: add check for JRuby. It will NOT work with magazine.
|
diff --git a/test/integration/api_operations/list_test.rb b/test/integration/api_operations/list_test.rb
index abc1234..def5678 100644
--- a/test/integration/api_operations/list_test.rb
+++ b/test/integration/api_operations/list_test.rb
@@ -7,19 +7,19 @@
should "retrieve districts" do
VCR.use_cassette("districts") do
- Clever::District.all()
+ Clever::District.all
end
end
should "retrieve schools" do
VCR.use_cassette("schools") do
- Clever::School.all()
+ Clever::School.all
end
end
should "retrieve students" do
VCR.use_cassette("students") do
- @students = Clever::Student.all()
+ @students = Clever::Student.all
end
student = @students[0]
@@ -27,15 +27,15 @@
should "retrieve sections" do
VCR.use_cassette("sections") do
- Clever::Section.all()
+ Clever::Section.all
end
end
should "retrieve teachers" do
VCR.use_cassette("teachers") do
- @teachers = Clever::Teacher.all()
+ @teachers = Clever::Teacher.all
- for teacher in @teachers
+ @teachers.each do |teacher|
teacher_obj = Clever::Teacher.retrieve teacher.id
assert_instance_of(Clever::Teacher, teacher)
assert_instance_of(Clever::Teacher, teacher_obj)
|
Make the list test idiomatic ruby
Use .each instead of for...in; don't use parentheses at the end of method calls that don't have arguments
|
diff --git a/app/models/commit.rb b/app/models/commit.rb
index abc1234..def5678 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -9,7 +9,7 @@ end
def repository_dir
- "/home/todd/arb/arb"
+ "/files/git/repos/review/arb"
end
def in_repo
|
Change repos dir to arb review dir on filer
|
diff --git a/lib/clio_client/models/activity.rb b/lib/clio_client/models/activity.rb
index abc1234..def5678 100644
--- a/lib/clio_client/models/activity.rb
+++ b/lib/clio_client/models/activity.rb
@@ -17,6 +17,7 @@
has_association :user, ClioClient::User
+ has_association :bill, ClioClient::Bill
has_association :matter, ClioClient::Matter
has_association :activity_description, ClioClient::ActivityDescription
has_association :communication, ClioClient::Communication
|
Add bill association to activities
|
diff --git a/app/models/toilet.rb b/app/models/toilet.rb
index abc1234..def5678 100644
--- a/app/models/toilet.rb
+++ b/app/models/toilet.rb
@@ -11,6 +11,7 @@
validates :building, presence: true
validates :floor, presence: true
+ validate :floor_belongs_to_building
belongs_to :building
belongs_to :floor
@@ -34,4 +35,10 @@ end
span.html_safe
end
+
+ def floor_belongs_to_building
+ unless floor.building_id == building.id
+ errors.add(:floor, "is in the wrong building")
+ end
+ end
end
|
Validate that the restroom's floor and building match up.
|
diff --git a/FileKit.podspec b/FileKit.podspec
index abc1234..def5678 100644
--- a/FileKit.podspec
+++ b/FileKit.podspec
@@ -1,12 +1,13 @@ Pod::Spec.new do |s|
- s.name = "FileKit"
- s.version = "1.5.0"
- s.summary = "Simple and expressive file management in Swift."
- s.homepage = "https://github.com/nvzqz/FileKit"
- s.license = { :type => "MIT", :file => "LICENSE.md" }
- s.author = "Nikolai Vazquez"
- s.ios.deployment_target = "8.0"
- s.osx.deployment_target = "10.9"
- s.source = { :git => "https://github.com/nvzqz/FileKit.git", :tag => "v1.5.0" }
- s.source_files = "FileKit/*/*.swift"
+ s.name = "FileKit"
+ s.version = "1.5.0"
+ s.summary = "Simple and expressive file management in Swift."
+ s.homepage = "https://github.com/nvzqz/FileKit"
+ s.license = { :type => "MIT", :file => "LICENSE.md" }
+ s.author = "Nikolai Vazquez"
+ s.ios.deployment_target = "8.0"
+ s.osx.deployment_target = "10.9"
+ s.watchos.deployment_target = '2.0'
+ s.source = { :git => "https://github.com/nvzqz/FileKit.git", :tag => "v1.5.0" }
+ s.source_files = "FileKit/*/*.swift"
end
|
Set watchOS deployment target in podspec
|
diff --git a/lib/stripmem/websocket.rb b/lib/stripmem/websocket.rb
index abc1234..def5678 100644
--- a/lib/stripmem/websocket.rb
+++ b/lib/stripmem/websocket.rb
@@ -5,11 +5,14 @@ class WebSocket
def initialize(channel)
@channel = channel
+ @data = []
+ @channel.subscribe { |msg| @data << msg }
end
def run!
EventMachine::WebSocket.start(:host => 'localhost', :port => 9998) do |ws|
ws.onopen do
+ @data.each { |msg| ws.send(JSON.generate(msg)) }
sid = @channel.subscribe { |msg| ws.send(JSON.generate(msg)) }
ws.onclose { @channel.unsubscribe(sid) }
end
|
Send all data on client connection.
|
diff --git a/config/application.rb b/config/application.rb
index abc1234..def5678 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -2,13 +2,13 @@
require 'rails/all'
+require 'figs'
+# Don't run this initializer on travis.
+Figs.load(stage: Rails.env) unless ENV['TRAVIS']
+
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
-
-require 'figs'
-# Don't run this initializer on travis.
-Figs.load(stage: Rails.env) unless ENV['TRAVIS']
module PrivilegesGuide
LOCAL_CREATION_PREFIX = 'nyu_ag_noaleph_'
|
Load env vars before bundle
|
diff --git a/lib/tasks/assignment.rake b/lib/tasks/assignment.rake
index abc1234..def5678 100644
--- a/lib/tasks/assignment.rake
+++ b/lib/tasks/assignment.rake
@@ -0,0 +1,30 @@+# frozen_string_literal: true
+
+def generate_generic_sandbox_url(assignment)
+ # If there's already a sandbox_url, do nothing
+ return false if assignment.sandbox_url
+
+ wiki = assignment.wiki
+ user = assignment.user
+
+ # If the assignment doesn't have a user or wiki, do nothing
+ return false unless wiki && user
+
+ language = wiki.language || 'en'
+ base_url = "https://#{language}.#{wiki.project}.org/wiki"
+ "#{base_url}/User:#{user.username}/sandbox"
+end
+
+namespace :assignment do
+ # This task will assign sandbox_urls to all valid assignments
+ # that were created before August 2019
+ desc 'Give assignments default sandbox_url'
+ task set_sandbox_url: :environment do
+ Rails.logger.debug 'Setting sandbox_url for all assignments'
+ Assignment.where(created_at: '2019-08-01'.to_date).each do |assignment|
+ url = generate_generic_sandbox_url(assignment)
+ # update_columns will skip the callbacks on assignment
+ assignment.update_columns(sandbox_url: url) if url
+ end
+ end
+end
|
Add rake task to backfill sandbox_urls
|
diff --git a/lib/image_optim/worker/gifsicle.rb b/lib/image_optim/worker/gifsicle.rb
index abc1234..def5678 100644
--- a/lib/image_optim/worker/gifsicle.rb
+++ b/lib/image_optim/worker/gifsicle.rb
@@ -32,7 +32,7 @@
args.unshift('--interlace') if interlace
args.unshift('--careful') if careful
- args.unshift('--optimize=#{level}') if level
+ args.unshift("--optimize=#{level}") if level
execute(:gifsicle, *args) && optimized?(src, dst)
end
end
|
Use interpolation with the --optimize argument
|
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -18,6 +18,8 @@ end
def markdown(text)
+ return text if text.blank?
+
# See https://github.com/vmg/redcarpet for options
render_options = {
filter_html: false,
|
Make markdown helper safer to use
Avoid exception if text is nil
|
diff --git a/lib/veritas/support/optimizable.rb b/lib/veritas/support/optimizable.rb
index abc1234..def5678 100644
--- a/lib/veritas/support/optimizable.rb
+++ b/lib/veritas/support/optimizable.rb
@@ -4,6 +4,14 @@ module Optimizable
include Immutable
+ # Hook called when module is included
+ #
+ # @param [Module] descendant
+ # the module or class including Optimizable
+ #
+ # @return [self]
+ #
+ # @api private
def self.included(descendant)
descendant.extend ClassMethods
self
|
Make sure that Optimizable.included is documented
|
diff --git a/app/models/appendable/reaction.rb b/app/models/appendable/reaction.rb
index abc1234..def5678 100644
--- a/app/models/appendable/reaction.rb
+++ b/app/models/appendable/reaction.rb
@@ -16,7 +16,8 @@ # rubocop:enable Rails/SkipsModelValidations
def notification_type(*_args)
- Notification::CommentSmiled if parent.instance_of?(Comment)
+ return Notification::CommentSmiled if parent.instance_of?(Comment)
+
Notification::Smiled
end
end
|
Fix `CommentSmile` notification type not being returned
|
diff --git a/test/unit/stamp_file_test.rb b/test/unit/stamp_file_test.rb
index abc1234..def5678 100644
--- a/test/unit/stamp_file_test.rb
+++ b/test/unit/stamp_file_test.rb
@@ -0,0 +1,42 @@+require 'support/test_case'
+require 'support/fixture_config'
+require 'jekyll/minibundle/stamp_file'
+
+module Jekyll::Minibundle::Test
+ class StampFileTest < TestCase
+ include FixtureConfig
+
+ def test_consistent_fingerprint_in_file_and_markup
+ with_site do
+ basenamer = ->(base, ext, stamper) { "#{base}-#{stamper.call}#{ext}" }
+ stamp_file = StampFile.new(STAMP_SOURCE_PATH, STAMP_DESTINATION_PATH, &basenamer)
+
+ source = source_path STAMP_SOURCE_PATH
+ old_destination = destination_path STAMP_DESTINATION_FINGERPRINT_PATH
+
+ org_markup = stamp_file.markup
+ stamp_file.write '_site'
+ org_mtime = mtime_of old_destination
+
+ last_markup = stamp_file.markup
+ ensure_file_mtime_changes { File.write source, 'h1 {}' }
+ stamp_file.write '_site'
+
+ # preserve fingerprint and content seen in last markup phase
+ assert_equal org_markup, last_markup
+ assert_equal org_mtime, mtime_of(old_destination)
+ assert_equal File.read(site_fixture_path(STAMP_SOURCE_PATH)), File.read(old_destination)
+
+ last_markup = stamp_file.markup
+ stamp_file.write '_site'
+
+ new_destination = destination_path 'assets/screen-0f5dbd1e527a2bee267e85007b08d2a5.css'
+
+ # see updated fingerprint in the next round
+ refute_equal org_markup, last_markup
+ assert_operator mtime_of(new_destination), :>, org_mtime
+ assert_equal File.read(source), File.read(new_destination)
+ end
+ end
+ end
+end
|
Add test for StampFile's behavior in markup and write phases
|
diff --git a/guides/lib/filters/info_boxes.rb b/guides/lib/filters/info_boxes.rb
index abc1234..def5678 100644
--- a/guides/lib/filters/info_boxes.rb
+++ b/guides/lib/filters/info_boxes.rb
@@ -13,7 +13,11 @@
content = content.gsub(/^\$\$\$\n(.*?)\$\$\$/m) do
"<p>**************** TODO ****************</p>" + $1 + "<p>**************************************</p>"
- #generate_div("todo", $1)
+ end
+
+ # add filename headers to code blocks
+ content = content.gsub(/^---(.*?)---/m) do
+ "<pre class='headers'><code>" + $1 + "</code></pre>"
end
content
|
Add --- filter for adding filenames to code examples
|
diff --git a/lib/blog/engine.rb b/lib/blog/engine.rb
index abc1234..def5678 100644
--- a/lib/blog/engine.rb
+++ b/lib/blog/engine.rb
@@ -1,5 +1,12 @@ module Blog
class Engine < ::Rails::Engine
isolate_namespace Blog
+
+ require 'rubygems'
+ require 'kaminari'
+
+ if !Rails.env.production?
+ require 'pry'
+ end
end
end
|
Add some libs: pry, kaminari, sass-rails
Adds sass-rails since it was needed to run tests, and pry for
development/debugging purposes.
|
diff --git a/spec/defines/splunk_conf_spec.rb b/spec/defines/splunk_conf_spec.rb
index abc1234..def5678 100644
--- a/spec/defines/splunk_conf_spec.rb
+++ b/spec/defines/splunk_conf_spec.rb
@@ -1,47 +1,49 @@ require 'spec_helper'
describe 'splunk_conf' do
+ stanza = 'monitor:///foo/bar/baz.log'
- context 'basic test' do
- stanza = 'monitor:///foo/bar/baz.log'
- let(:title) { stanza }
- let(:params) do {
- :config_file => 'test-splunk-config.conf',
- :set => {
- 'index' => 'index_foo',
- 'sourcetype' => 'sourcetype_bar',
- },
- :rm => [ 'rmattr1', 'rmattr2' ],
- }
+ context 'puppet catalog' do
+ context 'sets and rms' do
+ let(:title) { stanza }
+ let(:params) do {
+ :config_file => 'test-splunk-config.conf',
+ :set => {
+ 'index' => 'index_foo',
+ 'sourcetype' => 'sourcetype_bar',
+ },
+ :rm => [ 'rmattr1', 'rmattr2' ],
+ }
+ end
+
+ it 'has an augeas type with sets and rms' do
+ should contain_augeas("splunk_conf-#{stanza}").with({
+ :changes => [
+ "defnode target target[. = '#{stanza}'] #{stanza}",
+ "set $target/index index_foo",
+ "set $target/sourcetype sourcetype_bar",
+ "rm $target/rmattr1",
+ "rm $target/rmattr2",
+ ],
+ :incl => 'test-splunk-config.conf',
+ })
+ end
end
- it { should contain_augeas("splunk_conf-#{stanza}").with({
- :changes => [
- "defnode target target[. = '#{stanza}'] #{stanza}",
- "set $target/index index_foo",
- "set $target/sourcetype sourcetype_bar",
- "rm $target/rmattr1",
- "rm $target/rmattr2",
- ],
- :incl => 'test-splunk-config.conf',
- })
- }
- end
+ context 'ensure => absent' do
+ let(:title) { stanza }
+ let(:params) do {
+ :config_file => 'test-splunk-config.conf',
+ :ensure => 'absent',
+ }
+ end
-
- context 'remove stanza' do
- stanza = 'monitor:///foo/bar/baz.log2'
- let(:title) { stanza }
- let(:params) do {
- :config_file => 'test-splunk-config.conf',
- :ensure => 'absent',
- }
+ it 'has an augeas type that removes target' do
+ should contain_augeas("splunk_conf-#{stanza}").with({
+ :changes => "rm target[. = '#{stanza}']",
+ :incl => 'test-splunk-config.conf',
+ })
+ end
end
-
- it { should contain_augeas("splunk_conf-#{stanza}").with({
- :changes => "rm target[. = '#{stanza}']",
- :incl => 'test-splunk-config.conf',
- })
- }
end
end
|
Refactor specs to make better spec output
|
diff --git a/spec/integration/metrics_spec.rb b/spec/integration/metrics_spec.rb
index abc1234..def5678 100644
--- a/spec/integration/metrics_spec.rb
+++ b/spec/integration/metrics_spec.rb
@@ -0,0 +1,35 @@+require 'spec_helper'
+
+module Librato
+ describe Metrics do
+ before(:all) { prep_integration_tests }
+
+ describe "#list" do
+
+ before(:all) do
+ delete_all_metrics
+ Librato::Metrics.submit :foo => 123, :bar => 345, :baz => 678, :foo_2 => 901
+ end
+
+ context "without arguments" do
+
+ it "should list all metrics" do
+ metric_names = Metrics.list.map { |metric| metric['name'] }
+ metric_names.sort.should == %w{foo bar baz foo_2}.sort
+ end
+
+ end
+
+ context "with a name argument" do
+
+ it "should list metrics that match" do
+ metric_names = Metrics.list(:name => 'foo').map { |metric| metric['name'] }
+ metric_names.sort.should == %w{foo foo_2}.sort
+ end
+
+ end
+
+ end
+
+ end
+end
|
Add integration tests for metric listing.
|
diff --git a/spec/pontifex/key_stream_spec.rb b/spec/pontifex/key_stream_spec.rb
index abc1234..def5678 100644
--- a/spec/pontifex/key_stream_spec.rb
+++ b/spec/pontifex/key_stream_spec.rb
@@ -0,0 +1,21 @@+require 'spec_helper'
+
+module Pontifex
+ describe KeyStream do
+ describe "#new" do
+ let(:key_stream) { KeyStream.new }
+ it "creates a representation of a deck of cards implemented with an Array" do
+ key_stream.deck.should be_an_instance_of(Array)
+ end
+
+ it "should have 54 'cards' in it" do
+ key_stream.deck.count.should == 54
+ end
+
+ it "should contain nothing but Card instances" do
+ expected_count = key_stream.deck.count
+ key_stream.deck.select { |c| c.instance_of?(Card) }.count.should == expected_count
+ end
+ end
+ end
+end
|
Add some failing tests for the KeyStream class
|
diff --git a/recipes/zookeeper_status.rb b/recipes/zookeeper_status.rb
index abc1234..def5678 100644
--- a/recipes/zookeeper_status.rb
+++ b/recipes/zookeeper_status.rb
@@ -2,9 +2,19 @@ # Cookbook Name:: cerner_kafka
# Recipe:: zookeeper_status
-
+<<-comment
execute 'check zookeeper' do
action :run
command " nc -z #{node["kafka"]["zookeepers"].first} 2181 "
returns [0]
end
+comment
+
+
+
+ruby_block "Zookeeper Status Check" do
+ block do
+ fail "Zookeeper not Running"
+ end
+ not_if "nc -z #{node['kafka']['zookeepers'].first} 2181"
+end
|
Change way to check Zookeeper service
|
diff --git a/lib/hashie/hash.rb b/lib/hashie/hash.rb
index abc1234..def5678 100644
--- a/lib/hashie/hash.rb
+++ b/lib/hashie/hash.rb
@@ -4,7 +4,7 @@ # A Hashie Hash is simply a Hash that has convenience
# functions baked in such as stringify_keys that may
# not be available in all libraries.
- class Hash < Hash
+ class Hash < ::Hash
include Hashie::HashExtensions
# Converts a mash back to a hash (with stringified keys)
|
Make explicit the reference to standard Hash
|
diff --git a/Formula/akonadi.rb b/Formula/akonadi.rb
index abc1234..def5678 100644
--- a/Formula/akonadi.rb
+++ b/Formula/akonadi.rb
@@ -1,9 +1,9 @@ require 'formula'
class Akonadi <Formula
- url 'http://download.akonadi-project.org/akonadi-1.2.1.tar.bz2'
+ url 'http://download.akonadi-project.org/akonadi-1.3.0.tar.bz2'
homepage 'http://pim.kde.org/akonadi/'
- md5 'f9c1d000844f31c67360078ddf60bec2'
+ md5 '45fe59bd301268149cb0313d54a98520'
depends_on 'cmake'
depends_on 'shared-mime-info'
|
Update Akonadi formula to 1.3.0.
|
diff --git a/lib/playa/track.rb b/lib/playa/track.rb
index abc1234..def5678 100644
--- a/lib/playa/track.rb
+++ b/lib/playa/track.rb
@@ -23,7 +23,7 @@ end
def title
- id_tags.tag.title || ''
+ id_tags.tag.title || filename
end
def artist
|
Return the filename if the ID3 tags have no title.
|
diff --git a/app/uploaders/outcome_uploader.rb b/app/uploaders/outcome_uploader.rb
index abc1234..def5678 100644
--- a/app/uploaders/outcome_uploader.rb
+++ b/app/uploaders/outcome_uploader.rb
@@ -1,5 +1,6 @@ class OutcomeUploader < Shrine
plugin :delete_promoted
+ plugin :determine_mime_type
plugin :validation_helpers
Attacher.validate do
|
:wrench: Determine MIME type from file content by determine_mime_type
Fix for shrine gem warning
|
diff --git a/lib/generators/redactor/templates/mongoid/carrierwave/redactor/document.rb b/lib/generators/redactor/templates/mongoid/carrierwave/redactor/document.rb
index abc1234..def5678 100644
--- a/lib/generators/redactor/templates/mongoid/carrierwave/redactor/document.rb
+++ b/lib/generators/redactor/templates/mongoid/carrierwave/redactor/document.rb
@@ -4,4 +4,11 @@ def url_content
url(:content)
end
+
+ def thumb
+ # Could theoretically provide an icon set here
+ # to match against the extensions
+ # but for now it's nil to address the bug
+ nil
+ end
end
|
Address a bug where as_json triggered thumb, url(:thumb) on Document
|
diff --git a/test/unit/services/service_listeners/attachment_replacement_id_updater_test.rb b/test/unit/services/service_listeners/attachment_replacement_id_updater_test.rb
index abc1234..def5678 100644
--- a/test/unit/services/service_listeners/attachment_replacement_id_updater_test.rb
+++ b/test/unit/services/service_listeners/attachment_replacement_id_updater_test.rb
@@ -5,12 +5,37 @@ extend Minitest::Spec::DSL
let(:updater) { AttachmentReplacementIdUpdater.new(attachment_data) }
+ let(:worker) { mock('worker') }
+
+ setup do
+ AssetManagerAttachmentReplacementIdUpdateWorker.stubs(:new).returns(worker)
+ end
+
+ context 'when attachment data has a replacement' do
+ let(:attachment_data) { mock('attachment_data', replaced_by: mock('replacement')) }
+
+ it 'updates replacement ID of any assets' do
+ worker.expects(:perform).with(attachment_data, nil)
+
+ updater.update!
+ end
+ end
context 'when attachment data is nil' do
let(:attachment_data) { nil }
it 'does not update replacement ID of any assets' do
- AssetManagerUpdateAssetWorker.expects(:perform_async).never
+ worker.expects(:perform).never
+
+ updater.update!
+ end
+ end
+
+ context 'when attachment data has not been replaced' do
+ let(:attachment_data) { mock('attachment_data', replaced_by: nil) }
+
+ it 'does not update replacement ID of any assets' do
+ worker.expects(:perform).never
updater.update!
end
|
Update AttachmentReplacementIdUpdaterTest to stub worker
We've extracted the logic of this service listener into the
AssetManagerAttachmentReplacementIdUpdateWorker. Update the tests so
that we simply assert that the worker has been called if the
conditions are met.
|
diff --git a/app/controllers/api/internal/activities_controller.rb b/app/controllers/api/internal/activities_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/internal/activities_controller.rb
+++ b/app/controllers/api/internal/activities_controller.rb
@@ -9,7 +9,7 @@ activities = if username.blank?
current_user.following_activities
else
- User.find_by(username: username).activities
+ User.where(username: username).first&.activities.presence || Activity.none
end
@activities = activities.
|
Return Activity.none when user is not found
|
diff --git a/mgit.gemspec b/mgit.gemspec
index abc1234..def5678 100644
--- a/mgit.gemspec
+++ b/mgit.gemspec
@@ -18,9 +18,9 @@
s.required_ruby_version = '>= 1.9.3'
- s.add_dependency 'colorize', '~> 0.7.1'
- s.add_dependency 'highline', '~> 1.6.21'
- s.add_dependency 'xdg', '~> 2.2.3'
+ s.add_dependency 'colorize', '~> 0.7'
+ s.add_dependency 'highline', '~> 1.6'
+ s.add_dependency 'xdg', '~> 2.2'
- s.add_development_dependency 'rspec', '~> 2.14.1'
+ s.add_development_dependency 'rspec', '~> 2.14'
end
|
Fix warnings about overly strict dependencies now.
|
diff --git a/test/controllers/static_pages_controller_test.rb b/test/controllers/static_pages_controller_test.rb
index abc1234..def5678 100644
--- a/test/controllers/static_pages_controller_test.rb
+++ b/test/controllers/static_pages_controller_test.rb
@@ -3,6 +3,11 @@ class StaticPagesControllerTest < ActionDispatch::IntegrationTest
def setup
@base_title = 'Ruby on Rails Tutorial Sample App'
+ end
+
+ test "should get root" do
+ get root_url
+ assert_response :success
end
test "should get home" do
|
Add the routing test for root path
|
diff --git a/lib/rubygems/tasks/build/gem.rb b/lib/rubygems/tasks/build/gem.rb
index abc1234..def5678 100644
--- a/lib/rubygems/tasks/build/gem.rb
+++ b/lib/rubygems/tasks/build/gem.rb
@@ -51,7 +51,7 @@ def build(path,gemspec)
builder = ::Gem::Builder.new(gemspec)
- FileUtils.mv builder.build, Project::PKG_DIR
+ mv builder.build, Project::PKG_DIR
end
end
|
Use the Rake FileUtils methods, now that we're hooking the verbose output.
|
diff --git a/middleman-core/lib/middleman-core/extensions/relative_assets.rb b/middleman-core/lib/middleman-core/extensions/relative_assets.rb
index abc1234..def5678 100644
--- a/middleman-core/lib/middleman-core/extensions/relative_assets.rb
+++ b/middleman-core/lib/middleman-core/extensions/relative_assets.rb
@@ -1,6 +1,6 @@ # Relative Assets extension
class Middleman::Extensions::RelativeAssets < ::Middleman::Extension
- option :exts, %w(.css .png .jpg .jpeg .webp .svg .svgz .js .gif .ttf .otf .woff), 'List of extensions that get cache busters strings appended to them.'
+ option :exts, %w(.css .png .jpg .jpeg .webp .svg .svgz .js .gif .ttf .otf .woff .woff2), 'List of extensions that get cache busters strings appended to them.'
option :sources, %w(.htm .html .css), 'List of extensions that are searched for relative assets.'
option :ignore, [], 'Regexes of filenames to skip adding query strings to'
|
Add Woff2 to relative assets extension
|
diff --git a/lib/travis/services/find_log.rb b/lib/travis/services/find_log.rb
index abc1234..def5678 100644
--- a/lib/travis/services/find_log.rb
+++ b/lib/travis/services/find_log.rb
@@ -31,7 +31,7 @@ private def logs_api
@logs_api ||= Travis::LogsApi.new(
url: Travis.config.logs_api.url,
- auth_token: Travis.config.logs_api.auth_token
+ token: Travis.config.logs_api.token
)
end
end
|
Rename straggling logs API config key
|
diff --git a/lib/patches/controller/projects_controller_patch.rb b/lib/patches/controller/projects_controller_patch.rb
index abc1234..def5678 100644
--- a/lib/patches/controller/projects_controller_patch.rb
+++ b/lib/patches/controller/projects_controller_patch.rb
@@ -3,7 +3,7 @@
included do
before_render :load_wiki_format, only: [:edit, :settings, :show]
- before_render :reserve_format, only: [:edit, :settings, :show]
+ before_render :reserve_format, only: [:edit, :settings]
end
private
|
Remove unnecessary only condition of ProjectsControllerPatch
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.