diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/config/initializers/rubydora_monkey_patch.rb b/config/initializers/rubydora_monkey_patch.rb
index abc1234..def5678 100644
--- a/config/initializers/rubydora_monkey_patch.rb
+++ b/config/initializers/rubydora_monkey_patch.rb
@@ -0,0 +1,11 @@+module Rubydora
+ class Datastream
+ def entity_size(response)
+ if content_length = response["content-length"]
+ content_length.to_i
+ else
+ response.body.length
+ end
+ end
+ end
+end
|
Patch Rubydora to deal with external datastream content.
|
diff --git a/spec/controllers/api/users/verification_spec.rb b/spec/controllers/api/users/verification_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/api/users/verification_spec.rb
+++ b/spec/controllers/api/users/verification_spec.rb
@@ -9,8 +9,8 @@ expect(user.verified_at).to eq(nil)
put :verify, params: params
user.reload
- expect(user.verification_token).to eq("")
+ expect(user.verification_token).to eq(params[:token])
expect(user.verified_at).to be
- expect(user.verified_at - Time.now).to be < 3
+ expect(user.verified_at - Time.now).to be < 3
end
end
|
Update tests to reflect changes to user verification
|
diff --git a/Dip.podspec b/Dip.podspec
index abc1234..def5678 100644
--- a/Dip.podspec
+++ b/Dip.podspec
@@ -19,7 +19,7 @@
s.homepage = "https://github.com/AliSoftware/Dip"
s.license = 'MIT'
- s.author = { "Olivier Halligon" => "olivier@halligon.net" }
+ s.authors = { "Olivier Halligon" => "olivier@halligon.net", "Ilya Puchka" => "ilya@puchka.me" }
s.source = { :git => "https://github.com/AliSoftware/Dip.git", :tag => s.version.to_s }
s.social_media_url = 'https://twitter.com/aligatr'
|
Add @ilyapuchka as author in the Podspec
|
diff --git a/lib/yard.rb b/lib/yard.rb
index abc1234..def5678 100644
--- a/lib/yard.rb
+++ b/lib/yard.rb
@@ -1,4 +1,7 @@-$LOAD_PATH.unshift File.join(File.dirname(__FILE__), 'yard')
+YARD_ROOT = File.join(File.dirname(__FILE__), 'yard')
+YARD_TEMPLATE_ROOT = File.join(File.dirname(__FILE__), '..', 'templates')
+
+$LOAD_PATH.unshift(YARD_ROOT)
['logger'].each do |file|
require File.join(File.dirname(__FILE__), 'yard', file)
|
Add YARD_ROOT and YARD_TEMPLATE_ROOT constants for later
|
diff --git a/lib/scss_lint/linter/placeholder_in_extend.rb b/lib/scss_lint/linter/placeholder_in_extend.rb
index abc1234..def5678 100644
--- a/lib/scss_lint/linter/placeholder_in_extend.rb
+++ b/lib/scss_lint/linter/placeholder_in_extend.rb
@@ -8,11 +8,10 @@ # every word boundary (so %placeholder becomes ['%', 'placeholder']).
selector = node.selector.join
- add_lint(node) unless selector.start_with?('%')
- end
-
- def description
- 'Always use placeholder selectors (e.g. %some-placeholder) with @extend'
+ unless selector.start_with?('%')
+ add_lint(node,
+ 'Prefer using placeholder selectors (e.g. %some-placeholder) with @extend')
+ end
end
end
end
|
Remove description method from PlaceholderInExtend
The `description` method is being deprecated.
Change-Id: I755e28a599f1cccdd38dafec1bf549e3f6b7e664
Reviewed-on: http://gerrit.causes.com/36723
Tested-by: jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@causes.com>
Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com>
|
diff --git a/lib/cardgate/gateway.rb b/lib/cardgate/gateway.rb
index abc1234..def5678 100644
--- a/lib/cardgate/gateway.rb
+++ b/lib/cardgate/gateway.rb
@@ -13,7 +13,7 @@ end
def self.is_test_environment?
- environment.to_sym == :test
+ self.environment == :test
end
def self.request_url
|
Use attribute accessor for checking for test environment
|
diff --git a/lib/cloudkit/command.rb b/lib/cloudkit/command.rb
index abc1234..def5678 100644
--- a/lib/cloudkit/command.rb
+++ b/lib/cloudkit/command.rb
@@ -23,6 +23,12 @@ end
def run_app
+ unless File.exist?('.bundle')
+ Formatador.display_line("[yellow][bold]No gem bundle found.[/]")
+ Formatador.display_line("[green]Bundling...[/]")
+ `bundle install`
+ end
+ Formatador.display_line("[green][bold]Starting app...[/]")
`rackup config.ru`
end
|
Add naive bundler support to app runner
|
diff --git a/lib/dry/types/result.rb b/lib/dry/types/result.rb
index abc1234..def5678 100644
--- a/lib/dry/types/result.rb
+++ b/lib/dry/types/result.rb
@@ -1,7 +1,17 @@+require 'dry/equalizer'
+
module Dry
module Types
- module Result
- class Success < ::Struct.new(:input)
+ class Result
+ include Dry::Equalizer(:input)
+
+ attr_reader :input
+
+ def initialize(input)
+ @input = input
+ end
+
+ class Success < Result
def success?
true
end
@@ -11,7 +21,16 @@ end
end
- class Failure < ::Struct.new(:input, :error)
+ class Failure < Result
+ include Dry::Equalizer(:input, :error)
+
+ attr_reader :error
+
+ def initialize(input, error)
+ super(input)
+ @error = error
+ end
+
def success?
false
end
|
Refactor Result to use a custom base class (stdlib Struct is SLOW)
|
diff --git a/lib/haml_lint/logger.rb b/lib/haml_lint/logger.rb
index abc1234..def5678 100644
--- a/lib/haml_lint/logger.rb
+++ b/lib/haml_lint/logger.rb
@@ -0,0 +1,99 @@+module HamlLint
+ # Encapsulates all communication to an output source.
+ class Logger
+ # Whether colored output via ANSI escape sequences is enabled.
+ # @return [true,false]
+ attr_accessor :color_enabled
+
+ # Creates a logger which outputs nothing.
+ # @return [HamlLint::Logger]
+ def self.silent
+ new(File.open('/dev/null', 'w'))
+ end
+
+ # Creates a new {HamlLint::Logger} instance.
+ #
+ # @param out [IO] the output destination.
+ def initialize(out)
+ @out = out
+ end
+
+ # Print the specified output.
+ #
+ # @param output [String] the output to send
+ # @param newline [true,false] whether to append a newline
+ def log(output, newline = true)
+ @out.print(output)
+ @out.print("\n") if newline
+ end
+
+ # Print the specified output in bold face.
+ # If output destination is not a TTY, behaves the same as {#log}.
+ #
+ # @param args [Array<String>]
+ def bold(*args)
+ color('1', *args)
+ end
+
+ # Print the specified output in a color indicative of error.
+ # If output destination is not a TTY, behaves the same as {#log}.
+ #
+ # @param args [Array<String>]
+ def error(*args)
+ color(31, *args)
+ end
+
+ # Print the specified output in a bold face and color indicative of error.
+ # If output destination is not a TTY, behaves the same as {#log}.
+ #
+ # @param args [Array<String>]
+ def bold_error(*args)
+ color('1;31', *args)
+ end
+
+ # Print the specified output in a color indicative of success.
+ # If output destination is not a TTY, behaves the same as {#log}.
+ #
+ # @param args [Array<String>]
+ def success(*args)
+ color(32, *args)
+ end
+
+ # Print the specified output in a color indicative of a warning.
+ # If output destination is not a TTY, behaves the same as {#log}.
+ #
+ # @param args [Array<String>]
+ def warning(*args)
+ color(33, *args)
+ end
+
+ # Print specified output in bold face in a color indicative of a warning.
+ # If output destination is not a TTY, behaves the same as {#log}.
+ #
+ # @param args [Array<String>]
+ def bold_warning(*args)
+ color('1;33', *args)
+ end
+
+ # Print the specified output in a color indicating information.
+ # If output destination is not a TTY, behaves the same as {#log}.
+ #
+ # @param args [Array<String>]
+ def info(*args)
+ color(36, *args)
+ end
+
+ # Whether this logger is outputting to a TTY.
+ #
+ # @return [true,false]
+ def tty?
+ @out.respond_to?(:tty?) && @out.tty?
+ end
+
+ private
+
+ def color(code, output, newline = true)
+ log(color_enabled ? "\033[#{code}m#{output}\033[0m" : output, newline)
+ end
+ end
+end
|
Remove unnecessary documentation for void return values
These aren't necessary when the return value isn't intended to be used.
|
diff --git a/spec/unit/aequitas/class_methods/inherited_spec.rb b/spec/unit/aequitas/class_methods/inherited_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/aequitas/class_methods/inherited_spec.rb
+++ b/spec/unit/aequitas/class_methods/inherited_spec.rb
@@ -0,0 +1,28 @@+require_relative '../../../spec_helper'
+require 'aequitas/class_methods'
+
+
+describe Aequitas::ClassMethods, '#inherited' do
+ subject { descendant_class }
+
+ let(:base_class) { Class.new { extend Aequitas::ClassMethods } }
+ let(:descendant_class) { Class.new(base_class) }
+
+ let(:rule_class) { Aequitas::Rule::Presence }
+ let(:attribute_name) { :foo }
+ let(:expected_rule) { rule_class.new(attribute_name) }
+
+ it "copies the parent's existing validation rules to the descendant" do
+ base_class.validation_rules.add(rule_class, [attribute_name])
+ assert_includes subject.validation_rules[attribute_name], expected_rule
+ end
+
+ it "the descendant has access to validation rules added to the parent after inheritance" do
+ skip 'implement inheritance references instead of statically copying (ala Virtus::AttributeSet)'
+ assert_predicate descendant_class.validation_rules[:default], :empty?
+ base_class.validation_rules.add(rule_class, [attribute_name])
+ other_expected_rule = rule_class.new(attribute_name)
+ assert_includes subject.validation_rules[attribute_name], other_expected_rule
+ end
+
+end
|
Add spec coverage for class inheritance propagating rules.
This occurs at inheritance time, so descendants do not automatically receive rules declared in ancestors after inheritance occurs.
Related to #2 and #3.
|
diff --git a/lib/kanaveral/output.rb b/lib/kanaveral/output.rb
index abc1234..def5678 100644
--- a/lib/kanaveral/output.rb
+++ b/lib/kanaveral/output.rb
@@ -11,7 +11,6 @@ def self.cmd_output text
text ||= ''
cr
- text = ' '.freeze + text
print Rainbow(text).cyan
cr
end
|
Remove leading space of command stdout
|
diff --git a/app/models/notification.rb b/app/models/notification.rb
index abc1234..def5678 100644
--- a/app/models/notification.rb
+++ b/app/models/notification.rb
@@ -2,7 +2,6 @@
def generate
- latestNotification = Notification.last(1).first
require 'open-uri'
require 'twilio-ruby'
output = ''
@@ -10,42 +9,36 @@
doc = Nokogiri::HTML(open(RssToSms.config.rss_url))
- # returns true when, working our way from the bottom of the feed,
- # we encounter the message we last notified about. Anything
- # after that is gravy and needs to be sent.
- latest_sent_found = false
+ client = Twilio::REST::Client.new RssToSms.config.twilio_account_sid, RssToSms.config.twilio_auth_token
+ notifications = Array.new;
- client = Twilio::REST::Client.new RssToSms.config.twilio_account_sid, RssToSms.config.twilio_auth_token
-
- doc.xpath('//entry').reverse_each do |item|
+ doc.xpath('//entry').each do |item|
link = item.xpath('link')[1].attr('href')
title = item.xpath('title')[0].content
- if ( latest_sent_found )
- # SMS limit is 140 and subtract additional for white space
- max_title = 140 - link.length - 1
- message = title[0..max_title] + " " + link
- # send SMS
- response = client.messages.create({
- :from => RssToSms.config.from_phone,
- :to => RssToSms.config.to_phone,
- :body => message
- })
- output += message
- Notification.new({guid: link}).save
- end
+ break if Notification.exists?(guid: link)
- if ( latestNotification and latestNotification.guid == link )
- latest_sent_found = true
- end
+ # SMS limit is 140 and subtract additional for white space
+ max_title = 140 - link.length - 1
+ message = title[0..max_title] + " " + link
+ notifications << {message: message, link: link}
+
end
- # if begin_sending was never set, that either means our DB is empty
- # or it means that more than a full page of RSS items has run since
- # the last time this code ran. In either case let's grab the latest
- # post and insert it and then move on
- if ( not latest_sent_found )
- Notification.new({guid: link}).save
+ puts notifications.inspect
+
+ notifications.reverse_each do |notification|
+
+ Notification.new({guid: notification[:link]}).save
+
+ # send SMS
+ response = client.messages.create({
+ :from => RssToSms.config.from_phone,
+ :to => RssToSms.config.to_phone,
+ :body => message
+ })
+ output += notification[:message]
+
end
return output
|
Fix the issue with reordeing RSS items
|
diff --git a/app/models/professional.rb b/app/models/professional.rb
index abc1234..def5678 100644
--- a/app/models/professional.rb
+++ b/app/models/professional.rb
@@ -5,5 +5,9 @@ has_many :students, :through => :mentorships
has_many :mentorships
- attr_accessible :email, :name, :phone_number
+ attr_accessible :email, :name, :phone_number, :employments_attributes
+
+ accepts_nested_attributes_for :employments
+
+ validates :email, :name, presence: true
end
|
Add validations and nested attributes writer
|
diff --git a/ci_environment/haskell/attributes/multi.rb b/ci_environment/haskell/attributes/multi.rb
index abc1234..def5678 100644
--- a/ci_environment/haskell/attributes/multi.rb
+++ b/ci_environment/haskell/attributes/multi.rb
@@ -1,4 +1,4 @@ default[:haskell][:multi] = {
- :ghcs => ["7.8.3","7.6.3","7.4.2","7.0.4"],
+ :ghcs => ["7.8.4","7.6.3","7.4.2","7.0.4"],
:default => "7.6.3"
}
|
Move from 7.8.3 to 7.8.4 version of ghc
|
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/application_controller_spec.rb
+++ b/spec/controllers/application_controller_spec.rb
@@ -0,0 +1,35 @@+require 'rails_helper'
+
+describe ApplicationController, type: :controller do
+ describe 'authentication methods' do
+ let(:classroom) { create(:classroom, :with_coteacher) }
+ let(:coteacher) { classroom.coteachers.first }
+ let(:owner) { classroom.owner }
+
+ describe '#classroom_owner' do
+ it 'should return nil if current_user is owner of the classroom' do
+ session[:user_id] = owner.id
+ expect(controller.classroom_owner!(classroom)).to eq(nil)
+ end
+
+ it 'should redirect if current_user is not owner of the classroom' do
+ session[:user_id] = coteacher.id
+ expect(controller).to receive(:auth_failed)
+ controller.classroom_owner!(classroom)
+ end
+ end
+
+ describe '#classroom_coteacher' do
+ it 'should return nil if current_user is coteacher of the classroom' do
+ session[:user_id] = coteacher.id
+ expect(controller.classroom_coteacher!(classroom)).to eq(nil)
+ end
+
+ it 'should redirect if current_user is not coteacher of the classroom' do
+ session[:user_id] = owner.id
+ expect(controller).to receive(:auth_failed)
+ controller.classroom_coteacher!(classroom)
+ end
+ end
+ end
+end
|
Create application controller spec, add tests for new authentication methods
|
diff --git a/rspec-pdf_diff.gemspec b/rspec-pdf_diff.gemspec
index abc1234..def5678 100644
--- a/rspec-pdf_diff.gemspec
+++ b/rspec-pdf_diff.gemspec
@@ -20,7 +20,6 @@
spec.add_dependency "cocaine", "~> 0.5"
- spec.add_development_dependency "bundler", "~> 1.7"
spec.add_development_dependency "prawn", "~> 1.3.0"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec"
|
Stop depending on bundler for development
Not sure that's a common practice? It was way outdated anyway.
|
diff --git a/spec/versioneye/crawlers/github_crawler_spec.rb b/spec/versioneye/crawlers/github_crawler_spec.rb
index abc1234..def5678 100644
--- a/spec/versioneye/crawlers/github_crawler_spec.rb
+++ b/spec/versioneye/crawlers/github_crawler_spec.rb
@@ -0,0 +1,23 @@+require 'spec_helper'
+
+describe GithubCrawler do
+
+
+ describe 'crawl' do
+ it 'crawles cakephp and skips all branches' do
+ Product.delete_all
+ expect( License.count ).to eq(0)
+ expect( Product.count ).to eq(0)
+ pr = ProductResource.new({url: "https://api.github.com/repos/nginx/nginx", name: "nginx/nginx", resource_type: "GitHub"})
+ expect( pr.save ).to be_truthy
+ GithubCrawler.crawl
+ expect( Product.count ).to eq(1)
+ product = Product.first
+ expect( product.versions.count ).to eq(30)
+ expect( product.dependencies.count ).to eq(0)
+ expect( product.language ).to eq("C")
+ expect( product.name ).to eq('nginx')
+ end
+ end
+
+end
|
Add test for github crawler.
|
diff --git a/app/services/activation.rb b/app/services/activation.rb
index abc1234..def5678 100644
--- a/app/services/activation.rb
+++ b/app/services/activation.rb
@@ -12,12 +12,12 @@ end
def self.user_activates_device( user, activation_token )
- raise 'Invalid user specified' if user.blank?
+ raise 'Invalid user specified' if user.blank? || user.nil?
raise 'Invalid activation token specified' if activation_token.blank?
device = Device.find_by activation_token: activation_token
raise 'A device with that activation token could not be found.' if !device
- raise 'That device is already activated.' if device.user
+ raise 'That device is already activated.' if device.user != user
begin
device.name = 'Model-T'
|
Allow devices to be reactivated on the same account.
|
diff --git a/podspec/1.0.2/OBShapedButton.podspec b/podspec/1.0.2/OBShapedButton.podspec
index abc1234..def5678 100644
--- a/podspec/1.0.2/OBShapedButton.podspec
+++ b/podspec/1.0.2/OBShapedButton.podspec
@@ -0,0 +1,13 @@+Pod::Spec.new do |s|
+ s.name = 'OBShapedButton'
+ s.version = '1.0.2'
+ s.license = 'MIT'
+ s.summary = 'A UIButton subclass that works with non-rectangular button shapes.'
+ s.homepage = 'https://github.com/ole/OBShapedButton'
+ s.author = { 'Ole Begemann' => 'ole@oleb.net' }
+ s.source = { :git => 'https://github.com/ole/OBShapedButton.git', :tag => '1.0.2' }
+ s.description = 'Instances of OBShapedButton respond to touches only in areas where the image that is assigned to the button for UIControlStateNormal is non-transparent.'
+ s.platform = :ios
+ s.source_files = 'OBShapedButton/**/*.{h,m}', 'UIImage+ColorAtPixel/**/*.{h,m}'
+ s.requires_arc = true
+end
|
Add CocoaPods podspec for v1.0.2
|
diff --git a/metadata.rb b/metadata.rb
index abc1234..def5678 100644
--- a/metadata.rb
+++ b/metadata.rb
@@ -8,10 +8,10 @@
supports "ubuntu"
-depends "python"
-depends "apache2"
+depends "python"
+depends "apache2"
+depends "runit"
-suggests "runit"
suggests "systemd"
suggests "s6"
suggests "graphiti"
|
Make runit a dependency since out of the box it's needed
|
diff --git a/metadata.rb b/metadata.rb
index abc1234..def5678 100644
--- a/metadata.rb
+++ b/metadata.rb
@@ -1,3 +1,4 @@+name "minitest-handler"
maintainer "Bryan Berry"
maintainer_email "bryan.berry@gmail.com"
license "Apache 2.0"
|
Add explicit name to cookbook
Better than relying on cookbook directory and plays better with Berkshelf.
|
diff --git a/spec/models/vote_spec.rb b/spec/models/vote_spec.rb
index abc1234..def5678 100644
--- a/spec/models/vote_spec.rb
+++ b/spec/models/vote_spec.rb
@@ -13,7 +13,16 @@ end
end
+ describe "validations" do
+ describe "requireds" do
+ it { should validate_presence_of(:direction) }
+ end
+
+ describe "proposal_id" do
+ it { should validate_uniqueness_of(:proposal_id).scoped_to(:user_id) }
+ end
+ end
describe ".like!" do
it "should generate a vote for the specified proposal and user" do
|
Add validations spec to Vote
|
diff --git a/spec/unit/mutant_spec.rb b/spec/unit/mutant_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/mutant_spec.rb
+++ b/spec/unit/mutant_spec.rb
@@ -1,9 +1,18 @@ require 'spec_helper'
describe Mutant do
+ let(:object) { described_class }
+
+ describe '.zombify' do
+ subject { object.zombify }
+
+ it 'calls the zombifier' do
+ expect(Mutant::Zombifier).to receive(:run).with('mutant', :Zombie)
+ subject
+ end
+ end
+
describe '.singleton_subclass_instance' do
- let(:object) { described_class }
-
subject { object.singleton_subclass_instance(name, superclass, &block) }
before { subject }
|
Add minimal specs for Mutant.zombify
|
diff --git a/spec/custom_matchers.rb b/spec/custom_matchers.rb
index abc1234..def5678 100644
--- a/spec/custom_matchers.rb
+++ b/spec/custom_matchers.rb
@@ -5,3 +5,9 @@ actual == expected
end
end
+
+RSpec::Matchers.define :have_format do |expected|
+ match do |actual|
+ actual.format == expected
+ end
+end
|
Add custom rspec matcher have_format
|
diff --git a/script/cruise_build.rb b/script/cruise_build.rb
index abc1234..def5678 100644
--- a/script/cruise_build.rb
+++ b/script/cruise_build.rb
@@ -1,3 +1,14 @@ #!/usr/bin/env ruby
-p "My project name is: #{ARGV.inspect}"
+project_name = ARGV.first
+
+case project_name
+when "racing_on_rails"
+ # Nothing else to get
+when "atra"
+ exec("svn co svn+ssh://butlerpress.com/var/repos/atra/trunk local")
+else
+ raise "Don't know how to build project named: '#{project_name}'"
+end
+
+exec("rake cruise")
|
Add ATRA in as a test
git-svn-id: 96bd6241e080dd4199045f7177cf3384e2eaed71@1422 2d86388d-c40f-0410-ad6a-a69da6a65d20
|
diff --git a/nested_sortable-rails.gemspec b/nested_sortable-rails.gemspec
index abc1234..def5678 100644
--- a/nested_sortable-rails.gemspec
+++ b/nested_sortable-rails.gemspec
@@ -7,11 +7,11 @@ Gem::Specification.new do |s|
s.name = "nested_sortable-rails"
s.version = NestedSortableRails::VERSION
- s.authors = ["TODO: Your name"]
- s.email = ["TODO: Your email"]
- s.homepage = "TODO"
- s.summary = "TODO: Summary of NestedSortableRails."
- s.description = "TODO: Description of NestedSortableRails."
+ s.authors = ["ohcibi"]
+ s.email = ["ich@dwgadf.de"]
+ s.homepage = "https://github.com/ohcibi/nested_sortable-rails"
+ s.summary = "Packages the nestedSortable-jquery-ui extension"
+ s.description = "Packages the nestedSortable extension from Manuele J Sarfatti (https://github.com/mjsarfatti/nestedSortable). Check out his page on github to learn more."
s.files = Dir["{app,config,db,lib,vendor}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
|
Add gem description and author details to gemspec
|
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index abc1234..def5678 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -16,6 +16,7 @@
require "kitchen/terraform/error"
+# This module comprises miscellaneous helper methods to be used by examples.
module Helpers
def fail_after(action:, message:)
action
|
Add a description to the spec Helper module
|
diff --git a/lib/sass/script/bool.rb b/lib/sass/script/bool.rb
index abc1234..def5678 100644
--- a/lib/sass/script/bool.rb
+++ b/lib/sass/script/bool.rb
@@ -1,13 +1,17 @@ require 'sass/script/literal'
module Sass::Script
- class Bool < Literal # :nodoc:
+ # A SassScript object representing a boolean (true or false) value.
+ class Bool < Literal
+ # The Ruby value of the boolean.
+ #
+ # @return [Boolean]
+ attr_reader :value
+ alias_method :to_bool, :value
+
+ # @return [String] "true" or "false"
def to_s
@value.to_s
end
-
- def to_bool
- @value
- end
end
end
|
[Sass] Convert Sass::Script::Bool docs to YARD.
|
diff --git a/app/controllers/doorkeeper/application_controller.rb b/app/controllers/doorkeeper/application_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/doorkeeper/application_controller.rb
+++ b/app/controllers/doorkeeper/application_controller.rb
@@ -15,5 +15,13 @@ instance_eval(&block)
end
end
+
+ def method_missing(method, *args, &block)
+ if method =~ /_(url|path)$/
+ raise "Your path has not been found. Didn't you mean to call main_app.#{method} in doorkeeper configuration block?"
+ else
+ super
+ end
+ end
end
end
|
Add method missing to application controller
It notifies users that they should use main_app object if they
want to access their named routes.
|
diff --git a/db/migrate/20151107105747_create_trends.rb b/db/migrate/20151107105747_create_trends.rb
index abc1234..def5678 100644
--- a/db/migrate/20151107105747_create_trends.rb
+++ b/db/migrate/20151107105747_create_trends.rb
@@ -4,6 +4,7 @@ t.string :description
t.string :links # link of the feed itself
t.string :titles
+ t.string :categories
t.string :authors
t.string :dates # edited date of the feeed
t.text :contents
|
Add new column "categories" in db
|
diff --git a/db/migrate/20140412005454_load_shapefile.rb b/db/migrate/20140412005454_load_shapefile.rb
index abc1234..def5678 100644
--- a/db/migrate/20140412005454_load_shapefile.rb
+++ b/db/migrate/20140412005454_load_shapefile.rb
@@ -0,0 +1,43 @@+class LoadShapefile < ActiveRecord::Migration
+
+ SHAPEFILE = Rails.root.join('vendor', 'opendata', 'CENTRELINE_BIKEWAY_OD')
+
+ def up
+ BikewaySegment.delete_all
+
+ factory = RGeo::Geographic.spherical_factory(:srid => 2019)
+ RGeo::Shapefile::Reader.open('vendor/opendata/CENTRELINE_BIKEWAY_OD', :factory => factory) do |file|
+ index = 0
+ file.each do |record|
+ index += 1
+ puts "#{index} records scanned" if index % 1000 == 0
+
+ if record["CP_TYPE"].empty?
+ next
+ end
+
+ BikewaySegment.create do |s|
+ s.city_rid = record["RID"]
+ s.city_geo_id = record["GEO_ID"]
+ s.city_linear_feature_name_id = record["LF_NAME_ID"]
+ s.city_object_id = record["OBJECTID"]
+ s.full_street_name = record["LF_NAME"]
+ s.address_left = record["ADDRESS_L"]
+ s.address_right = record["ADDRESS_R"]
+ s.odd_even_flag_left = record["OE_FLAG_L"]
+ s.odd_even_flag_right = record["OE_FLAG_R"]
+ s.lowest_address_left = record["LONUML"]
+ s.lowest_address_right = record["LONUMR"]
+ s.highest_address_left = record["HINUML"]
+ s.highest_address_right = record["HINUMR"]
+ s.from_intersection_id = record["FNODE"]
+ s.to_intersection_id = record["TNODE"]
+ s.street_classification = record["FCODE_DESC"]
+ s.bikeway_type = record["CP_TYPE"]
+
+ s.geom = record.geometry
+ end
+ end
+ end
+ end
+end
|
Add migration to load shapefile into bikeway_segments table
|
diff --git a/lib/opscode/models/opc_customer.rb b/lib/opscode/models/opc_customer.rb
index abc1234..def5678 100644
--- a/lib/opscode/models/opc_customer.rb
+++ b/lib/opscode/models/opc_customer.rb
@@ -15,6 +15,10 @@
rw_attribute :display_name
rw_attribute :contact
+ rw_attribute :osc_customer
+ rw_attribute :ohc_customer
+ rw_attribute :opc_customer
+ rw_attribute :support_plan
protected_attribute :created_at #custom reader method
protected_attribute :updated_at #custom reader method
|
Add the 4 new fields to the increasingly misnamed OpcCustomer.
|
diff --git a/lib/puppet/type/xtreemfs_volume.rb b/lib/puppet/type/xtreemfs_volume.rb
index abc1234..def5678 100644
--- a/lib/puppet/type/xtreemfs_volume.rb
+++ b/lib/puppet/type/xtreemfs_volume.rb
@@ -27,6 +27,7 @@ newparam(:host) do
desc 'A host of volume, pass an directory service host here'
fqdn = Facter.value(:fqdn)
+ fqdn = Facter.value(:hostname) if fqdn.nil?
defaultto fqdn
end
|
Fix for Travis box without hostname
|
diff --git a/lib/tasks/editions.rake b/lib/tasks/editions.rake
index abc1234..def5678 100644
--- a/lib/tasks/editions.rake
+++ b/lib/tasks/editions.rake
@@ -31,4 +31,22 @@ end
end
end
+
+ desc "cache latest version number against editions"
+ task :cache_version_numbers => :environment do
+ WholeEdition.all.each do |edition|
+ begin
+ puts "Processing #{edition.class} #{edition.id}"
+ if edition.subsequent_siblings.any?
+ edition.latest_version_number = edition.subsequent_siblings.sort_by(&:version_number).last.version_number
+ else
+ edition.latest_version_number = edition.version_number
+ end
+ edition.save
+ puts " Done!"
+ rescue Exception => e
+ puts " [Err] Could not denormalise edition: #{e}"
+ end
+ end
+ end
end
|
Add rake task to cache version numbers in the right places
|
diff --git a/lib/stagehand/schema/statements.rb b/lib/stagehand/schema/statements.rb
index abc1234..def5678 100644
--- a/lib/stagehand/schema/statements.rb
+++ b/lib/stagehand/schema/statements.rb
@@ -7,7 +7,7 @@
return if options.symbolize_keys[:stagehand] == false
return if UNTRACKED_TABLES.include?(table_name)
- return if Database.connected_to_production?
+ return if Database.connected_to_production? && !Stagehand::Configuration.single_connection?
Schema.add_stagehand! :only => table_name
end
|
Fix rake not creating triggers
If the test environment used only a single connection, and the rake task was run in that environment, the extended version of create_table would not create triggers because it found that it was migrating the production database (which was also the staging database). Now if there is a single connection, we ignore the fact that we're in the production database and still create triggers.
|
diff --git a/lib/tic_tac_toe/game.rb b/lib/tic_tac_toe/game.rb
index abc1234..def5678 100644
--- a/lib/tic_tac_toe/game.rb
+++ b/lib/tic_tac_toe/game.rb
@@ -1,14 +1,19 @@ module TicTacToe
class Game
+ attr_reader :to_play
def initialize display
@display = display
+ @to_play = "X"
end
def start
@display.printf "Welcome to Tic Tac Toe"
end
+ def do_turn
+ @to_play = "O"
+ end
end
end
|
Write a very basic do_turn method
|
diff --git a/lib/tod/mongoization.rb b/lib/tod/mongoization.rb
index abc1234..def5678 100644
--- a/lib/tod/mongoization.rb
+++ b/lib/tod/mongoization.rb
@@ -11,7 +11,7 @@ # Get the object as it was stored in the database, and instantiate
# this custom class from it.
def demongoize(object)
- Tod::TimeOfDay.parse(object)
+ Tod::TimeOfDay.parse(object) if object
end
# Takes any possible object and converts it to how it would be
@@ -19,7 +19,7 @@ def mongoize(object)
case object
when TimeOfDay then object.mongoize
- else TimeOfDay(object).mongoize
+ else object
end
end
|
Fix error on mongoid load when object is nil
|
diff --git a/app/models/renalware/clinics/visit_query.rb b/app/models/renalware/clinics/visit_query.rb
index abc1234..def5678 100644
--- a/app/models/renalware/clinics/visit_query.rb
+++ b/app/models/renalware/clinics/visit_query.rb
@@ -7,7 +7,7 @@
def initialize(q = {})
@q = q
- @q[:s] = "date ASC" unless @q[:s].present?
+ @q[:s] = "date DESC" unless @q[:s].present?
end
def call
|
Sort visits in reverse date order
|
diff --git a/lib/ws_light/set/strawberry_set.rb b/lib/ws_light/set/strawberry_set.rb
index abc1234..def5678 100644
--- a/lib/ws_light/set/strawberry_set.rb
+++ b/lib/ws_light/set/strawberry_set.rb
@@ -26,7 +26,7 @@
set = sprinkle_nuts(set)
- set
+ type == :double ? set + set.reverse : set
end
def sprinkle_nuts(set)
@@ -36,10 +36,11 @@ distance += 15 + rand(5)
set[distance] = COLOR_NUT
end
+
set
end
- def pixel(number, _frame = 0)
+ def pixel(number)
frame[number]
end
end
|
[BUGFIX] Extend strawberry to second strip
|
diff --git a/app/controllers/concerns/workouts_checker.rb b/app/controllers/concerns/workouts_checker.rb
index abc1234..def5678 100644
--- a/app/controllers/concerns/workouts_checker.rb
+++ b/app/controllers/concerns/workouts_checker.rb
@@ -0,0 +1,15 @@+module WorkoutsChecker
+ extend ActiveSupport::Concern
+
+ included do
+ private
+
+ # before_action
+ def check_if_workout_is_async_updating
+ redirect_to(workout_path(@workout), alert: t('workout_shares.new.async_updating')) if @workout.async_updating?
+ false
+ end
+
+ end
+
+end
|
Check if wotkout is being async updated before changes.
|
diff --git a/app/controllers/embedded_tools_controller.rb b/app/controllers/embedded_tools_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/embedded_tools_controller.rb
+++ b/app/controllers/embedded_tools_controller.rb
@@ -1,4 +1,9 @@ class EmbeddedToolsController < ApplicationController
+
+ # Prevent repeating of locale param in query string
+ Rails::Engine.subclasses.collect(&:instance).each do |engine|
+ engine.routes.routes.each { |r| r.required_parts << :locale }
+ end
def parent_template
'layouts/engine'
|
Apply fix for locale param being repeated in engines.
|
diff --git a/app/controllers/errata_reports_controller.rb b/app/controllers/errata_reports_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/errata_reports_controller.rb
+++ b/app/controllers/errata_reports_controller.rb
@@ -11,7 +11,7 @@ if display_flag_version?(bz, params["flag_version"])
entry = BugEntry.new(bz)
- if entry.has_all_acks?
+ if entry.all_acks?
@have_acks << entry
else
@need_acks << entry
|
Change method name to all_acks? to pass rubocop coding style evaluation.
|
diff --git a/example/config/initializers/shopify_app.rb b/example/config/initializers/shopify_app.rb
index abc1234..def5678 100644
--- a/example/config/initializers/shopify_app.rb
+++ b/example/config/initializers/shopify_app.rb
@@ -5,4 +5,5 @@ config.scope = 'read_customers, write_products'
config.embedded_app = true
config.session_repository = Shop
+ config.api_version = :unstable
end
|
Add version to example app.
|
diff --git a/lib/haml/template.rb b/lib/haml/template.rb
index abc1234..def5678 100644
--- a/lib/haml/template.rb
+++ b/lib/haml/template.rb
@@ -25,8 +25,8 @@ end
-Haml::Template.options[:ugly] ||= Rails.env.development?
+Haml::Template.options[:ugly] = !Rails.env.development?
Haml::Template.options[:escape_html] = true
-Haml::Template.options[:format] ||= :html5
+Haml::Template.options[:format] = :html5
require 'haml/template/plugin'
|
Fix ugly option being set being set incorrectly
|
diff --git a/ci_environment/leiningen/attributes/default.rb b/ci_environment/leiningen/attributes/default.rb
index abc1234..def5678 100644
--- a/ci_environment/leiningen/attributes/default.rb
+++ b/ci_environment/leiningen/attributes/default.rb
@@ -2,4 +2,4 @@ default[:leiningen][:lein1][:install_script] = "https://github.com/technomancy/leiningen/raw/#{leiningen[:lein1][:version]}/bin/lein"
default[:leiningen][:lein2][:version] = "2.0.0-preview8"
-default[:leiningen][:lein2][:install_script] = "https://raw.github.com/technomancy/leiningen/preview/bin/lein"
+default[:leiningen][:lein2][:install_script] = "https://github.com/technomancy/leiningen/raw/#{leiningen[:lein2][:version]}/bin/lein"
|
Make sure we download lein2 w.r.t. the version we want
|
diff --git a/spec/mr_version_spec.rb b/spec/mr_version_spec.rb
index abc1234..def5678 100644
--- a/spec/mr_version_spec.rb
+++ b/spec/mr_version_spec.rb
@@ -4,25 +4,25 @@
describe MrVersion do
- it 'should have a version number' do
+ it 'has a library version' do
MrVersion::VERSION.should.match /[0-9]+\.[0-9]+\.[0-9]+/
end
- describe 'instances' do
+ describe 'instantiated with "1.2.3"' do
before do
@version = MrVersion::Version.new '1.2.3'
end
- it 'should have a major number' do
+ it 'has a major number of "1"' do
@version.major.should.equal MrVersion::Number.new(1)
end
- it 'should have a minor number' do
+ it 'has a minor number of "2"' do
@version.minor.should.equal MrVersion::Number.new(2)
end
- it 'should have a patch number' do
+ it 'has a patch number of "3"' do
@version.patch.should.equal MrVersion::Number.new(3)
end
|
Modify spec descriptions to read better
|
diff --git a/spec/xml/parser_spec.rb b/spec/xml/parser_spec.rb
index abc1234..def5678 100644
--- a/spec/xml/parser_spec.rb
+++ b/spec/xml/parser_spec.rb
@@ -1,12 +1,6 @@ require_relative './../spec_helper.rb'
describe ROXML::XML do
- it "should raise on malformed xml" do
- if ROXML::XML_PARSER == 'libxml' # nokogiri is less strict and auto-closes for some reason
- proc { Book.from_xml(fixture(:book_malformed)) }.should raise_error(LibXML::XML::Error)
- end
- end
-
it "should escape invalid characters on output to text node" do
node = ROXML::XML.new_node("entities")
ROXML::XML.set_content(node, " < > ' \" & ")
|
Remove the malformed xml spec, which after all tests the parser rather than roxml
|
diff --git a/chart-js-rails.gemspec b/chart-js-rails.gemspec
index abc1234..def5678 100644
--- a/chart-js-rails.gemspec
+++ b/chart-js-rails.gemspec
@@ -15,5 +15,5 @@ gem.require_paths = ["lib"]
gem.version = Chart::Js::Rails::VERSION
- gem.add_dependency "railties", "~> 3.1"
+ gem.add_dependency "railties", "> 3.1"
end
|
Update railties dependency to > 3.1
Depending on ~> 3.1 prevents this gem from being used with Rails 4 for
no good reason.
|
diff --git a/files/default/ohai_plugins/local_passwd.rb b/files/default/ohai_plugins/local_passwd.rb
index abc1234..def5678 100644
--- a/files/default/ohai_plugins/local_passwd.rb
+++ b/files/default/ohai_plugins/local_passwd.rb
@@ -0,0 +1,27 @@+provides 'etc', 'current_user'
+
+require 'etc'
+
+unless etc
+ etc Mash.new
+
+ etc[:passwd] = Mash.new
+ etc[:group] = Mash.new
+
+ File.readlines("/etc/passwd").each do |line|
+ splitline = line.chomp.split(":")
+ etc[:passwd][splitline[0]] = Mash.new(:dir => splitline[5], :uid => splitline[2].to_i, :gid => splitline[3].to_i, :shell => splitline[6], :gecos => splitline[4])
+ end
+
+ File.readlines("/etc/group").each do |line|
+ splitline = line.chomp.split(":")
+ g_members = []
+ splitline[3].split(",").each{ |mem| g_members << mem }
+ etc[:group][splitline[0]] = Mash.new(:gid => splitline[2].to_i, :members => g_members)
+ end
+
+end
+
+unless current_user
+ current_user Etc.getlogin
+end
|
Add ohai plugin for local passwords
|
diff --git a/wowfoot-webrick/tdb.rb b/wowfoot-webrick/tdb.rb
index abc1234..def5678 100644
--- a/wowfoot-webrick/tdb.rb
+++ b/wowfoot-webrick/tdb.rb
@@ -0,0 +1,45 @@+#!/usr/bin/ruby
+# open mysql connection to TDB
+require 'rubygems' # 1.8 bug workaround
+
+require 'dbi'
+require '../wowfoot-ex/output/WorldMapArea.rb'
+
+#p DBI::available_drivers
+
+dbc = DBI::connect('dbi:Mysql:world', 'trinity', 'trinity')
+
+#query = 'SELECT entry, ZoneOrSort, RequiredRaces, MinLevel, title from quest_template LIMIT 0,100;'
+#results = dbc.execute(query)
+
+area = WORLD_MAP_AREA[14] # Durotar, for starters
+map = area[:map]
+xMax = area[:a][:x]
+yMax = area[:a][:y]
+xMin = area[:b][:x]
+yMin = area[:b][:y]
+
+query = "SELECT id, position_x, position_y, position_z FROM creature WHERE map = #{map}"+
+ " AND position_x >= #{xMin} AND position_x <= #{xMax}"+
+ " AND position_y >= #{yMin} AND position_y <= #{yMax}"
+
+xDiff = xMax - xMin
+yDiff = yMax - yMin
+
+stmt = dbc.prepare(query)
+stmt.execute
+count = 0
+stmt.fetch do |row|
+ #p row
+
+ # values between 0 and 1.
+ x = (row[:position_x] - xMin) / xDiff
+ y = (row[:position_y] - yMin) / yDiff
+
+ # write some sort of overlay image.
+ width = 1024
+ height = 768
+ #puts "<whatev src=\"dot.png\" x=#{x*width} y=#{y*height}>"
+ count += 1
+end
+puts "Got #{count} rows."
|
Test code for accessing the Trinity DB.
|
diff --git a/test/integration/search_with_trait_sets_test.rb b/test/integration/search_with_trait_sets_test.rb
index abc1234..def5678 100644
--- a/test/integration/search_with_trait_sets_test.rb
+++ b/test/integration/search_with_trait_sets_test.rb
@@ -4,6 +4,7 @@ fixtures :projects, :taxa, :trait_sets, :categorical_traits
setup do
Capybara.current_driver = Capybara.javascript_driver
+ Capybara.default_wait_time = 5
end
test 'can select trait sets' do
visit '/'
|
Set capybara default wait time to 5
|
diff --git a/language/module_spec.rb b/language/module_spec.rb
index abc1234..def5678 100644
--- a/language/module_spec.rb
+++ b/language/module_spec.rb
@@ -16,6 +16,24 @@ LangModuleSpec::Anon = Module.new
LangModuleSpec::Anon.name.should == "LangModuleSpec::Anon"
end
+
+ it "raises a TypeError if the constant is a class" do
+ class LangModuleSpec::C1; end
+
+ lambda {
+ module LangModuleSpec::C1; end
+ }.should raise_error(TypeError)
+ end
+
+ it "raises a TypeError if the constant is not a module" do
+ module LangModuleSpec
+ C2 = 2
+ end
+
+ lambda {
+ module LangModuleSpec::C2; end
+ }.should raise_error(TypeError)
+ end
end
describe "An anonymous module" do
|
Add spec for module trying to reopen a class
|
diff --git a/deathbycaptcha.gemspec b/deathbycaptcha.gemspec
index abc1234..def5678 100644
--- a/deathbycaptcha.gemspec
+++ b/deathbycaptcha.gemspec
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
spec.name = "deathbycaptcha"
spec.version = DeathByCaptcha::VERSION
- spec.authors = ["Débora Setton Fernandes, Rafael Barbolo, Rafael Ivan Garcia"]
+ spec.authors = ["Débora Setton Fernandes, Marcelo Mita, Rafael Barbolo, Rafael Ivan Garcia"]
spec.email = ["team@infosimples.com.br"]
spec.summary = %q{Ruby API for DeathByCaptcha (Captcha Solver as a Service)}
spec.description = %q{DeathByCaptcha allows you to solve captchas with manual labor}
|
Add Marcelo Mita in the list of authors in gemspec
|
diff --git a/math24cli.rb b/math24cli.rb
index abc1234..def5678 100644
--- a/math24cli.rb
+++ b/math24cli.rb
@@ -4,4 +4,4 @@ operators = ["+", "-", "*", "/"]
solver = Math24.new(operators)
solver.numbers = numbers
-solver.solve()+puts solver.solve()
|
Make CLI responsible for printing the result
|
diff --git a/spec/attr_deprected_active_record_spec.rb b/spec/attr_deprected_active_record_spec.rb
index abc1234..def5678 100644
--- a/spec/attr_deprected_active_record_spec.rb
+++ b/spec/attr_deprected_active_record_spec.rb
@@ -0,0 +1,22 @@+require 'spec_helper'
+
+class User < ActiveRecord::Base
+ include AttrDeprecated
+
+ attr_deprecated :a_deprecated_attribute
+end
+
+describe "Integration with ActiveRecord" do
+ let(:user) { User.new(name: "rspec") }
+
+ it "ensures we've initialized ActiveRecord correctly for our test suite" do
+ user.save!
+
+ expect(user.persisted?).to be_true
+ expect(user.a_deprecated_attribute).to be_blank
+ end
+
+ it "has one deprecated attribute" do
+ expect(User.deprecated_attributes).to eq([])
+ end
+end
|
Add spec for ActiveRecord integration
|
diff --git a/spec/controllers/clubs_controller_spec.rb b/spec/controllers/clubs_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/clubs_controller_spec.rb
+++ b/spec/controllers/clubs_controller_spec.rb
@@ -0,0 +1,58 @@+require 'spec_helper'
+
+describe ClubsController do
+ let(:user) { FactoryGirl.create :user }
+
+ describe "GET 'edit'" do
+ describe "for a non signed-in user" do
+ describe "for a club not belonging to user" do
+ it "should redirect for user sign in" do
+ get 'edit', :id => FactoryGirl.create(:club).id
+
+ response.should be_redirect
+ response.should redirect_to new_user_session_path
+ end
+ end
+
+ describe "for a club belonging to user" do
+ it "should redirect for user sign in" do
+ get 'edit', :id => user.club.id
+
+ response.should be_redirect
+ response.should redirect_to new_user_session_path
+ end
+ end
+ end
+
+ describe "for a signed in user" do
+ before :each do
+ @request.env["devise.mapping"] = Devise.mappings[:users]
+ sign_in user
+ end
+
+ describe "for club not belonging to user" do
+ before :each do
+ get 'edit', :id => FactoryGirl.create(:club).id
+ end
+
+ it "returns 403 unauthorized forbidden code" do
+ response.response_code.should == 403
+ end
+ end
+
+ describe "for club belonging to user" do
+ before :each do
+ get 'edit', :id => user.club.id
+ end
+
+ it "returns http success" do
+ response.should be_success
+ end
+
+ it "returns the club" do
+ assigns(:club).should_not be_nil
+ end
+ end
+ end
+ end
+end
|
Add Clubs Controller Spec for Edit Action
Add a spec to test the Clubs controller edit action.
|
diff --git a/spec/controllers/pages_controller_spec.rb b/spec/controllers/pages_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/pages_controller_spec.rb
+++ b/spec/controllers/pages_controller_spec.rb
@@ -0,0 +1,18 @@+require 'spec_helper'
+
+describe HighVoltage::PagesController, '#show' do
+ render_views
+
+ %w(about_us faq).each do |page|
+ %w(en fr pt ru).each do |locale|
+ context "on GET to /#{locale}/#{page}" do
+ before do
+ get :show, id: page, locale: locale
+ end
+
+ it { should respond_with(:success) }
+ it { should render_template(page) }
+ end
+ end
+ end
+end
|
Add spec to ensure about_us and faq pages render properly
|
diff --git a/lib/fb_graph/connections/userpermissions.rb b/lib/fb_graph/connections/userpermissions.rb
index abc1234..def5678 100644
--- a/lib/fb_graph/connections/userpermissions.rb
+++ b/lib/fb_graph/connections/userpermissions.rb
@@ -2,7 +2,7 @@ module Connections
module UserPermissions
def userpermissions(options = {})
- self.connection(:userpermissions, options).first
+ self.connection(:userpermissions, options)
end
def userpermissions!(options = {})
|
Return all permissions for ad accounts from Business Manager
|
diff --git a/mixlib-shellout.gemspec b/mixlib-shellout.gemspec
index abc1234..def5678 100644
--- a/mixlib-shellout.gemspec
+++ b/mixlib-shellout.gemspec
@@ -19,5 +19,6 @@ s.bindir = "bin"
s.executables = []
s.require_path = 'lib'
- s.files = %w(Gemfile Rakefile LICENSE README.md) + Dir.glob("lib/**/*")
+ s.files = %w(Gemfile Rakefile LICENSE README.md) + Dir.glob("*.gemspec") +
+ Dir.glob("lib/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }
end
|
Add gemspec files to allow bundler to run from the gem
|
diff --git a/spec/dummy/db/seeds.rb b/spec/dummy/db/seeds.rb
index abc1234..def5678 100644
--- a/spec/dummy/db/seeds.rb
+++ b/spec/dummy/db/seeds.rb
@@ -0,0 +1,25 @@+# setup a simple, one-page activity
+act = Lightweight::LightweightActivity.create!(:name => "Test activity")
+page = act.pages.create!(:name => "Page 1", :text => "This is the main activity text.")
+interactive = Lightweight::MWInteractive.create!(:name => "MW model", :url => "http://lab.dev.concord.org/examples/interactives/embeddable.html#interactives/oil-and-water-shake.json")
+Lightweight::InteractiveItem.create!(:interactive_page => page, :interactive => interactive)
+
+# Add questions
+or1 = Embeddable::OpenResponse.create!(:name => "Open Response 1", :prompt => "Why do you think this model is cool?")
+or2 = Embeddable::OpenResponse.create!(:name => "Open Response 2", :prompt => "What would you add to it?")
+
+mc1 = Embeddable::MultipleChoice.create!(:name => "Multiple choice 1", :prompt => "What color is chlorophyll?")
+Embeddable::MultipleChoiceChoice.create(:choice => 'Red', :multiple_choice => mc1)
+Embeddable::MultipleChoiceChoice.create(:choice => 'Green', :multiple_choice => mc1)
+Embeddable::MultipleChoiceChoice.create(:choice => 'Blue', :multiple_choice => mc1)
+
+mc2 = Embeddable::MultipleChoice.create!(:name => "Multiple choice 2", :prompt => "How many protons does Helium have?")
+Embeddable::MultipleChoiceChoice.create(:choice => '1', :multiple_choice => mc2)
+Embeddable::MultipleChoiceChoice.create(:choice => '2', :multiple_choice => mc2)
+Embeddable::MultipleChoiceChoice.create(:choice => '4', :multiple_choice => mc2)
+Embeddable::MultipleChoiceChoice.create(:choice => '7', :multiple_choice => mc2)
+
+Lightweight::QuestionItem.create!(:interactive_page => page, :question => mc1)
+Lightweight::QuestionItem.create!(:interactive_page => page, :question => or1)
+Lightweight::QuestionItem.create!(:interactive_page => page, :question => or2)
+Lightweight::QuestionItem.create!(:interactive_page => page, :question => mc2)
|
Add a basic activity as seed data
|
diff --git a/spec/postfix-filter.rb b/spec/postfix-filter.rb
index abc1234..def5678 100644
--- a/spec/postfix-filter.rb
+++ b/spec/postfix-filter.rb
@@ -0,0 +1,32 @@+#!/usr/bin/ruby
+# encoding: UTF-8
+
+$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
+$:.unshift File.join(File.dirname(__FILE__), '..', 'processors')
+
+require 'extruder'
+require 'generators/postfix-filter'
+
+describe Extruder::Generator::PostfixFilterProcessor do
+ it "has the correct type" do
+ expect(Extruder::Generator::PostfixFilterProcessor.type).to eq :generator
+ end
+
+ it "can postprocess" do
+ p = Extruder::Generator::PostfixFilterProcessor.new({})
+ expect(p).to respond_to(:postprocess).with(2).arguments
+ end
+
+ it "cannot process" do
+ p = Extruder::Generator::PostfixFilterProcessor.new({})
+ expect(p).not_to respond_to(:process)
+ end
+
+ it "can compute CIDR notation correctly" do
+ p = Extruder::Generator::PostfixFilterProcessor.new({})
+ (0..32).each do |n|
+ x = (0xffffffff << n) & 0xffffffff
+ expect(p.send(:compute_prefix, x)).to eq (32 - n)
+ end
+ end
+end
|
Add basic tests for Postfix filter processor.
Signed-off-by: brian m. carlson <738bdd359be778fee9f0fc4e2934ad72f436ceda@crustytoothpaste.net>
|
diff --git a/app/controllers/community/forums_controller.rb b/app/controllers/community/forums_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/community/forums_controller.rb
+++ b/app/controllers/community/forums_controller.rb
@@ -8,6 +8,7 @@
def show
@forum = Community::Forum.where(slug: params[:id]).first
+ raise ActionController::RoutingError.new('Not Found') if @forum.nil?
@topics = @forum.topics.by_pinned_or_most_recent_post.page(params[:page]).per(20)
end
end
|
Fix undefined method `topics' for nil:NilClass.
|
diff --git a/app/controllers/related_contents_controller.rb b/app/controllers/related_contents_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/related_contents_controller.rb
+++ b/app/controllers/related_contents_controller.rb
@@ -7,7 +7,7 @@
def create
if relationable_object && related_object
- RelatedContent.create(parent_relationable: @relationable, child_relationable: @related)
+ RelatedContent.create(parent_relationable: @relationable, child_relationable: @related, author: current_user)
flash[:success] = t('related_content.success')
else
@@ -28,7 +28,8 @@ private
def score(value)
- RelatedContent.find_by(id: params[:id]).score(value, current_user)
+ @related = RelatedContent.find_by(id: params[:id])
+ @related.score(value, current_user)
render template: 'relationable/_refresh_score_actions'
end
|
Fix relatedcontent creation and scoring on related content controller
|
diff --git a/lib/versioneye/mailers/newsletter_mailer.rb b/lib/versioneye/mailers/newsletter_mailer.rb
index abc1234..def5678 100644
--- a/lib/versioneye/mailers/newsletter_mailer.rb
+++ b/lib/versioneye/mailers/newsletter_mailer.rb
@@ -8,7 +8,7 @@ def newsletter_new_features_email( user )
@user = user
@newsletter = "newsletter_features"
- mail(:to => @user.email, :subject => 'VersionEye Enterprise!') do |format|
+ mail(:to => @user.email, :subject => 'Biicode Integration') do |format|
format.html{ render layout: 'email_html_layout' }
end
end
|
Update subject of newsletter email
|
diff --git a/app/controllers/newsletter_subscriptions_controller.rb b/app/controllers/newsletter_subscriptions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/newsletter_subscriptions_controller.rb
+++ b/app/controllers/newsletter_subscriptions_controller.rb
@@ -8,7 +8,7 @@ end
respond_to do |format|
- format.js { render :show }
+ format.js { flash.discard and render :show }
format.html { redirect_to :back }
end
end
|
Discard the flash at the end of the current action when rendering js.
This prevents success / error messages from appearing on the next request.
@amansinghb small and subtle. thanks
|
diff --git a/app/models/time_span.rb b/app/models/time_span.rb
index abc1234..def5678 100644
--- a/app/models/time_span.rb
+++ b/app/models/time_span.rb
@@ -23,6 +23,9 @@
attr_accessible :date, :duration, :duration_bonus, :duration_days
+ validates_presence_of :date, :duration, :duration_in_work_days,
+ :user_id, :time_type_id, :time_spanable_id, :time_spanable_type
+
def duration=(value)
write_attribute :duration_in_work_days, value.to_work_days
super
|
Validate that all the needed fields are present for a TimeSpan
|
diff --git a/lib/cancan_namespace/rule.rb b/lib/cancan_namespace/rule.rb
index abc1234..def5678 100644
--- a/lib/cancan_namespace/rule.rb
+++ b/lib/cancan_namespace/rule.rb
@@ -9,7 +9,7 @@ # of conditions and the last one is the block passed to the "can" call.
def initialize(base_behavior, action, subject, conditions, block)
super
- @contexts = [@conditions.delete(:context)].flatten.map(&:to_s)
+ @contexts = @conditions.has_key?(:context) ? [@conditions.delete(:context)].flatten.map(&:to_s) : []
end
# Matches both the subject and action, not necessarily the conditions
|
Fix extract contexts from options
|
diff --git a/lib/capistrano/rightscale.rb b/lib/capistrano/rightscale.rb
index abc1234..def5678 100644
--- a/lib/capistrano/rightscale.rb
+++ b/lib/capistrano/rightscale.rb
@@ -9,23 +9,29 @@ # tag "x99:role=app", :app, :deployment => 45678
def tag(which, *args)
@rightscale ||= RightScale::Client.new(fetch(:rightscale_account), fetch(:rightscale_username), fetch(:rightscale_password))
+ @deployments ||= @rightscale.deployments
+ @servers ||= @rightscale.servers
- base_url = "https://my.rightscale.com/api/acct/%d" % fetch(:rightscale_account)
- deployment_url = base_url + "/deployments/%d" % args[1][:deployment]
+ logger.info "querying rightscale for deployment %s" % args[1][:deployment]
+ deployment = @deployments.index.find { |d| d['href'] == rightscale_url("/deployments/%d" % args[1][:deployment]) }
- # find servers with the right tag
- tagged_servers = @rightscale.get(base_url + "/tags/search.js?resource_type=server&tags[]=%s" % which)
- tagged_servers.each {|server|
-
- if server['state'] == 'operational' && server['deployment_href'] == deployment_url
- settings = @rightscale.servers.settings(server['href'])
- pp settings['dns_name']
- pp server['tags']
- pp server['nickname']
- pp server['deployment_href']
+ deployment['servers'].each do |server|
+ if server['state'] == 'operational' && tags_for_server(server).include?(which)
+ settings = @servers.settings(server['href'])
+ logger.info "found server %s (%s) with tag %s" % [ settings['dns_name'], server['nickname'], which ]
server(settings['dns_name'], *args)
end
- }
+ end
+ end
+
+ def tags_for_server(server)
+ instance_id = server["current_instance_href"].split('/').last
+ tags = @rightscale.get(rightscale_url("/tags/search.js?resource_href=/ec2_instances/%d" % instance_id))
+ tags.collect { |x| x["name"] }
+ end
+
+ def rightscale_url(path)
+ "https://my.rightscale.com/api/acct/%d%s" % [ fetch(:rightscale_account), path ]
end
end
|
Check all servers for tags now, tag search seems limited.
|
diff --git a/app/services/create_salesforce_media_record.rb b/app/services/create_salesforce_media_record.rb
index abc1234..def5678 100644
--- a/app/services/create_salesforce_media_record.rb
+++ b/app/services/create_salesforce_media_record.rb
@@ -28,7 +28,7 @@ def salesforce_media_fields
{
Title__c: @article.full_title,
- Engagement_Format__c: 'Wiki Contribution',
+ Engagement_Format__c: 'Wiki contribution',
Author_Wiki_Username_Optional__c: @user.username,
Primary_Course__c: @salesforce_course_id,
Link__c: @article.url,
|
Fix engagement type for Salesforce record creation
|
diff --git a/test/form/simple_form.rb b/test/form/simple_form.rb
index abc1234..def5678 100644
--- a/test/form/simple_form.rb
+++ b/test/form/simple_form.rb
@@ -17,13 +17,15 @@
form.handle_input
-
+ { first_name: first_name.value, last_name: last_name.value, form_submitted: form.submitted?}
end
+
screen = PPCurses::Screen.new
-screen.run { display_form }
+form_response = screen.run { display_form }
+puts 'Form response data: '
+puts form_response
-
|
Access form information after curses screen.
|
diff --git a/spec/fake_app/mongo_mapper/config.rb b/spec/fake_app/mongo_mapper/config.rb
index abc1234..def5678 100644
--- a/spec/fake_app/mongo_mapper/config.rb
+++ b/spec/fake_app/mongo_mapper/config.rb
@@ -1,2 +1,2 @@-MongoMapper.connection = Mongo::Connection.new 'localhost', 27017
+MongoMapper.connection = Mongo::Connection.new '0.0.0.0', 27017
MongoMapper.database = 'kaminari_test'
|
Fix mongo mapper test suite
https://travis-ci.org/amatsuda/kaminari/jobs/41827391#L98
|
diff --git a/spec/libraries/borrow_direct_spec.rb b/spec/libraries/borrow_direct_spec.rb
index abc1234..def5678 100644
--- a/spec/libraries/borrow_direct_spec.rb
+++ b/spec/libraries/borrow_direct_spec.rb
@@ -0,0 +1,12 @@+require 'spec_helper'
+require 'blacklight_cornell_requests/borrow_direct'
+
+describe BlacklightCornellRequests::BorrowDirect do
+
+ describe "Primary availability function" do
+
+ it ""
+
+ end
+
+end
|
Add tests for borrow direct library.
|
diff --git a/news.gemspec b/news.gemspec
index abc1234..def5678 100644
--- a/news.gemspec
+++ b/news.gemspec
@@ -17,7 +17,7 @@ s.test_files = Dir["test/**/*"]
s.add_dependency "rails", "~> 3.2.11"
- s.add_dependency "paperclip", "~> 3.5.2"
+ s.add_dependency "paperclip", "~> 3.0"
s.add_dependency "stringex", "~> 1.5.1"
s.add_dependency "kaminari"
end
|
Reduce paperclip version dependancy to fix identify issue with ImageMagick
|
diff --git a/lib/cocoapods/search/command.rb b/lib/cocoapods/search/command.rb
index abc1234..def5678 100644
--- a/lib/cocoapods/search/command.rb
+++ b/lib/cocoapods/search/command.rb
@@ -28,6 +28,9 @@ abort
rescue PodError => e
say e.message
+ if e.message =~ /rbenv: pod: command not found/
+ say "Plz install and setup cocoapods.\n gem install cocoapods\n pod setup"
+ end
abort
end
@@ -36,4 +39,4 @@ Command.start ['search', name.to_s]
end
end
-end+end
|
Add displaying message if cocoapods is not installed
|
diff --git a/spec/lib/knowledge_base/configuration_spec.rb b/spec/lib/knowledge_base/configuration_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/knowledge_base/configuration_spec.rb
+++ b/spec/lib/knowledge_base/configuration_spec.rb
@@ -27,4 +27,28 @@ expect(subject.section_styles).to eq({ })
end
end
+
+ describe '#text_image_uploader' do
+ it 'should default to the KB uploader' do
+ expect(subject.text_image_uploader).to eq KnowledgeBase::ImageUploader
+ end
+ end
+
+ describe '#image_image_uploader' do
+ it 'should default to the KB uploader' do
+ expect(subject.image_image_uploader).to eq KnowledgeBase::ImageUploader
+ end
+ end
+
+ describe '#gallery_image_uploader' do
+ it 'should default to the KB uploader' do
+ expect(subject.gallery_image_uploader).to eq KnowledgeBase::ImageUploader
+ end
+ end
+
+ describe '#list_image_uploader' do
+ it 'should default to the KB uploader' do
+ expect(subject.list_image_uploader).to eq KnowledgeBase::ImageUploader
+ end
+ end
end
|
Add spec for default uploaders
|
diff --git a/lib/woocommerce_api/resources/coupon_line.rb b/lib/woocommerce_api/resources/coupon_line.rb
index abc1234..def5678 100644
--- a/lib/woocommerce_api/resources/coupon_line.rb
+++ b/lib/woocommerce_api/resources/coupon_line.rb
@@ -3,5 +3,9 @@ attribute :id, Integer
attribute :code
attribute :amount, Decimal
+
+ def coupon
+ Coupon.find_by_code(code)
+ end
end
end
|
Add instance method for coupon
|
diff --git a/lib/smart_answer/calculators/paternity_adoption_pay_calculator.rb b/lib/smart_answer/calculators/paternity_adoption_pay_calculator.rb
index abc1234..def5678 100644
--- a/lib/smart_answer/calculators/paternity_adoption_pay_calculator.rb
+++ b/lib/smart_answer/calculators/paternity_adoption_pay_calculator.rb
@@ -0,0 +1,18 @@+module SmartAnswer::Calculators
+ class PaternityAdoptionPayCalculator < PaternityPayCalculator
+ extend Forwardable
+
+ def_delegators :@adoption_calculator,
+ :adoption_qualifying_start, :a_notice_leave,
+ :matched_week, :a_employment_start
+
+ attr_reader :match_date
+
+ def initialize(match_date)
+ @match_date = match_date
+ @adoption_calculator = AdoptionPayCalculator.new(match_date)
+
+ super(match_date, 'paternity_adoption')
+ end
+ end
+end
|
Add paternity adoption pay calculator
Almost the same logic as paternity pay but delegates to adoption
pay calculator for certain operations.
|
diff --git a/lib/hey/pubsub/event.rb b/lib/hey/pubsub/event.rb
index abc1234..def5678 100644
--- a/lib/hey/pubsub/event.rb
+++ b/lib/hey/pubsub/event.rb
@@ -28,6 +28,8 @@
def metadata
merged_data = Hey::ThreadCargo.to_hash.merge(@metadata)
+ merged_data.delete(:uuid)
+ merged_data.delete(Hey::ThreadCargo::SANITIZABLE_VALUES_KEY)
Hey::SanitizedHash.new(merged_data).to_h
end
|
Remove values from returned hash.
|
diff --git a/lib/rspec/rake/example_group.rb b/lib/rspec/rake/example_group.rb
index abc1234..def5678 100644
--- a/lib/rspec/rake/example_group.rb
+++ b/lib/rspec/rake/example_group.rb
@@ -13,7 +13,7 @@
subject(:task) { Rake.application[self.class.top_level_description] }
- before(:all) do
+ before(:each) do
metadata = self.class.metadata
task_name = self.class.top_level_description
|
Use before `each` hook instead of `all`.
|
diff --git a/lib/shutterstock-ruby/videos.rb b/lib/shutterstock-ruby/videos.rb
index abc1234..def5678 100644
--- a/lib/shutterstock-ruby/videos.rb
+++ b/lib/shutterstock-ruby/videos.rb
@@ -23,6 +23,10 @@ JSON.parse(get("/videos/licenses", params.merge(options)))
end
+ def download(licence)
+ JSON.parse(post("/videos/licenses/#{licence}/downloads", {}.to_json))
+ end
+
class << self
def search(query, options = {})
client.search(query, options)
|
Allow purchased content to be downloaded again
|
diff --git a/lib/multiplay/was_changed.rb b/lib/multiplay/was_changed.rb
index abc1234..def5678 100644
--- a/lib/multiplay/was_changed.rb
+++ b/lib/multiplay/was_changed.rb
@@ -7,7 +7,7 @@ end
def store_changes
- @was_changed_attributes = @changed_attributes.clone
+ @was_changed_attributes = @changed_attributes.nil? ? {} : @changed_attributes.clone
end
def was_changed?
|
Fix being able to saved cloned Objects
|
diff --git a/lib/tasks/octopress_import.rake b/lib/tasks/octopress_import.rake
index abc1234..def5678 100644
--- a/lib/tasks/octopress_import.rake
+++ b/lib/tasks/octopress_import.rake
@@ -26,7 +26,7 @@ album_data = YAML.load_file(File.join(root_path, name, index_filename))
photo = Photo.where(path: name, filename: album_data['cover']).first
raise "can't find photo #{name}/#{album_data['cover']}" unless photo
- album = Album.where(title: album_data['title']).first_or_create
+ album = Album.where(title: album_data['title'].titleize).first_or_create
album.update_attributes(cover_photo: photo)
end
end
|
Fix album import title casing
|
diff --git a/grack.gemspec b/grack.gemspec
index abc1234..def5678 100644
--- a/grack.gemspec
+++ b/grack.gemspec
@@ -16,8 +16,8 @@ lib/grack/app.rb
lib/grack/file_streamer.rb
lib/grack/git_adapter.rb
+ lib/grack/git_adapter_factory.rb
lib/grack/io_streamer.rb
- lib/grack/request_handler.rb
}
s.homepage = "http://github.com/schacon/grack"
s.license = 'MIT'
|
Update the list of files in the gemspec
|
diff --git a/lib/s3_multipart/uploader.rb b/lib/s3_multipart/uploader.rb
index abc1234..def5678 100644
--- a/lib/s3_multipart/uploader.rb
+++ b/lib/s3_multipart/uploader.rb
@@ -34,11 +34,11 @@ end
def attach(model, options = {})
- self.mount_point = options[:using] if options.key?(:using)
+ self.mount_point = options.delete(:using)
self.model = model
S3Multipart::Upload.class_eval do
- has_one(model)
+ has_one(model, options)
end
end
|
Allow association options for uploads
|
diff --git a/lib/sass/script/operation.rb b/lib/sass/script/operation.rb
index abc1234..def5678 100644
--- a/lib/sass/script/operation.rb
+++ b/lib/sass/script/operation.rb
@@ -1,3 +1,4 @@+require 'set'
require 'sass/script/string'
require 'sass/script/number'
require 'sass/script/color'
@@ -5,17 +6,29 @@ require 'sass/script/unary_operation'
module Sass::Script
- class Operation # :nodoc:
+ # A SassScript node representing a binary operation,
+ # such as `!a + !b` or `"foo" + 1`.
+ class Operation
+ # @param operand1 [#perform(Sass::Environment)] A script node
+ # @param operand2 [#perform(Sass::Environment)] A script node
+ # @param operator [Symbol] The operator to perform.
+ # This should be one of the binary operator names in {Lexer::OPERATORS}
def initialize(operand1, operand2, operator)
@operand1 = operand1
@operand2 = operand2
@operator = operator
end
+ # @return [String] A human-readable s-expression representation of the operation
def inspect
"(#{@operator.inspect} #{@operand1.inspect} #{@operand2.inspect})"
end
+ # Evaluates the operation.
+ #
+ # @param environment [Sass::Environment] The environment in which to evaluate the SassScript
+ # @return [Literal] The SassScript object that is the value of the operation
+ # @raise [Sass::SyntaxError] if the operation is undefined for the operands
def perform(environment)
literal1 = @operand1.perform(environment)
literal2 = @operand2.perform(environment)
|
[Sass] Convert Sass::Script::Operation docs to YARD.
|
diff --git a/lib/songkick/oauth2/model.rb b/lib/songkick/oauth2/model.rb
index abc1234..def5678 100644
--- a/lib/songkick/oauth2/model.rb
+++ b/lib/songkick/oauth2/model.rb
@@ -12,7 +12,8 @@ Schema = Songkick::OAuth2::Schema
DUPLICATE_RECORD_ERRORS = [
- /^Mysql::Error: Duplicate entry\b/,
+ /^Mysql::Error:\s+Duplicate\s+entry\b/,
+ /^PG::Error:\s+ERROR:\s+duplicate\s+key\b/,
/\bConstraintException\b/
]
@@ -21,7 +22,7 @@ # error strings should match MySQL and SQLite errors on Rails 2. If you're
# running a different adapter, add a suitable regex to the list:
#
- # Songkick::OAuth2::Model::DUPLICATE_RECORD_ERRORS << /Postgres found a dup/
+ # Songkick::OAuth2::Model::DUPLICATE_RECORD_ERRORS << /DB2 found a dup/
#
def self.duplicate_record_error?(error)
error.class.name == 'ActiveRecord::RecordNotUnique' or
|
Add error string for duplicate key records on Postgres.
|
diff --git a/lib/tasks/message_queue.rake b/lib/tasks/message_queue.rake
index abc1234..def5678 100644
--- a/lib/tasks/message_queue.rake
+++ b/lib/tasks/message_queue.rake
@@ -7,6 +7,10 @@ # Note: this output is used in the test helpers to detect when this has started.
puts "Starting message consumer"
$stdout.flush
- MessageQueueConsumer.run
+ begin
+ MessageQueueConsumer.run
+ rescue SignalException => e
+ puts "Received #{e}: exiting..."
+ end
end
end
|
Handle signals in consumer rake task.
When upstart stops the worker, it sends a SIGTERM to the process. This
is manifested in ruby as a SignalException. Unless handled, this
exception bubbles all the way up, and it intercepted by the airbrake
handler, resulting in noise in Errbit.
Handling this exception in the rake task prevents these spurious
exception reports in Errbit every time the workers are restarted.
|
diff --git a/lib/ubuntu_unused_kernels.rb b/lib/ubuntu_unused_kernels.rb
index abc1234..def5678 100644
--- a/lib/ubuntu_unused_kernels.rb
+++ b/lib/ubuntu_unused_kernels.rb
@@ -23,8 +23,11 @@ end
def get_current
- uname = Open3.capture2('uname', '-r').first.chomp
- match = uname.match(/^(#{KERNEL_VERSION})-([[:alpha:]]+)$/)
+ uname = Open3.capture2('uname', '-r')
+ raise "Unable to determine current kernel" unless uname.last.success?
+
+ match = uname.first.chomp.match(/^(#{KERNEL_VERSION})-([[:alpha:]]+)$/)
+ raise "Unable to determine current kernel" unless match
return match[1], match[2]
end
|
Implement error handling in get_current.
|
diff --git a/cookbooks/elasticsearch/recipes/az_aware.rb b/cookbooks/elasticsearch/recipes/az_aware.rb
index abc1234..def5678 100644
--- a/cookbooks/elasticsearch/recipes/az_aware.rb
+++ b/cookbooks/elasticsearch/recipes/az_aware.rb
@@ -1,2 +1,8 @@ # Add this recipe to the run list to make this node AZ aware
-node.default[:elasticsearch][:custom_config] = {'node.rack_id' => "#{node[:ec2][:placement_availability_zone]}"}
+node.default[:elasticsearch][:custom_config] = {
+ # Set the rack_id to the availability zone
+ 'node.rack_id' => "#{node[:ec2][:placement_availability_zone]}"
+
+ # Tell the awareness subsystem to utilize the rack_id attribute
+ 'cluster.routing.allocation.awareness.attributes' => 'rack_id'
+}
|
Expand AZ awareness to explicitly set the rack_id as an awareness attribute
|
diff --git a/lib/link_expansion/edition_diff.rb b/lib/link_expansion/edition_diff.rb
index abc1234..def5678 100644
--- a/lib/link_expansion/edition_diff.rb
+++ b/lib/link_expansion/edition_diff.rb
@@ -28,7 +28,7 @@ )
end
- def hash_diff(a, b) # rubocop:disable Naming/UncommunicativeMethodParamName
+ def hash_diff(a, b) # rubocop:disable Naming/MethodParameterName
a.size > b.size ? a.to_a - b.to_a : b.to_a - a.to_a
end
|
Fix name of cop in disable directive
|
diff --git a/motion/joybox-osx/configuration/gl_view.rb b/motion/joybox-osx/configuration/gl_view.rb
index abc1234..def5678 100644
--- a/motion/joybox-osx/configuration/gl_view.rb
+++ b/motion/joybox-osx/configuration/gl_view.rb
@@ -14,11 +14,8 @@
def self.new(options)
-
- bounds_provided = options.include?(:bounds) unless options.nil?
-
+ bounds_provided = options != nil and options.include?(:bounds)
options = options.nil? ? defaults : defaults.merge!(options)
-
bounds = options[:bounds]
if bounds.class == Hash
@@ -28,7 +25,7 @@
opengl_view = self.alloc.initWithFrame(bounds)
opengl_view.setAutoresizingMask(options[:auto_resize_mask])
- opengl_view.resize_to_superview = bounds_provided
+ opengl_view.resize_to_superview = !bounds_provided
opengl_view
end
@@ -42,11 +39,9 @@ # => In the case the user provides the bounds in the setup, it will honor
# it.
def viewDidMoveToSuperview
-
- unless @resize_to_superview and superview.nil?
- self.frame = superview.bounds
+ if @resize_to_superview
+ self.frame = superview.bounds unless superview.nil?
Joybox.director.originalWinSize = self.frame.size
-
@resize_to_superview = false
end
end
|
Fix
=> Exception on window close
|
diff --git a/lib/core_ext/time.rb b/lib/core_ext/time.rb
index abc1234..def5678 100644
--- a/lib/core_ext/time.rb
+++ b/lib/core_ext/time.rb
@@ -11,7 +11,7 @@
def self.json_create string
return nil if string.nil?
- d = DateTime.parse(string).new_offset
+ d = DateTime.parse(string.to_s).new_offset
self.utc(d.year, d.month, d.day, d.hour, d.min, d.sec).in_time_zone
end
end
|
Make sure we pass a string to DateTime.parse.
This unbreaks type casting with time zone objects.
|
diff --git a/lib/danger/runner.rb b/lib/danger/runner.rb
index abc1234..def5678 100644
--- a/lib/danger/runner.rb
+++ b/lib/danger/runner.rb
@@ -5,6 +5,8 @@
def initialize(argv)
@dangerfile_path = "Dangerfile" if File.exist? "Dangerfile"
+ @base = argv.option('base')
+ @head = argv.option('head')
super
end
@@ -15,13 +17,26 @@ end
end
+
+ def self.options
+ [
+ ['--base=[master|dev|stable]', 'A branch/tag/commit to use as the base of the diff'],
+ ['--head=[master|dev|stable]', 'A branch/tag/commit to use as the head'],
+ ].concat(super)
+ end
+
+
def run
# The order of the following commands is *really* important
dm = Dangerfile.new
dm.env = EnvironmentManager.new(ENV)
return unless dm.env.ci_source # if it's not a PR
dm.env.fill_environment_vars
- dm.env.scm.diff_for_folder(".", dm.env.ci_source.base_commit, dm.env.ci_source.head_commit)
+
+ ci_base = @base || dm.env.ci_source.base_commit
+ ci_head = @head || dm.env.ci_source.head_commit
+
+ dm.env.scm.diff_for_folder(".", ci_base, ci_head)
dm.parse Pathname.new(@dangerfile_path)
post_results(dm)
|
Support options on danger run for specifying the head / base commit
|
diff --git a/lib/flakey/buffer.rb b/lib/flakey/buffer.rb
index abc1234..def5678 100644
--- a/lib/flakey/buffer.rb
+++ b/lib/flakey/buffer.rb
@@ -4,7 +4,7 @@
SHARE_URL = "https://bufferapp.com/add"
- def buffer_button(options = {})
+ def buffer_button(options = {}, &block)
defaults = {
url: default_url,
label: "Buffer",
|
Facilitate passing blocks into Buffer
|
diff --git a/lib/spree_paypal_express/engine.rb b/lib/spree_paypal_express/engine.rb
index abc1234..def5678 100644
--- a/lib/spree_paypal_express/engine.rb
+++ b/lib/spree_paypal_express/engine.rb
@@ -10,7 +10,7 @@ end
def self.activate
- Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
+ Dir.glob(File.join(File.dirname(__FILE__), "../../app/**/*_decorator*.rb")) do |c|
Rails.env.production? ? require(c) : load(c)
end
end
|
Make sure decorators are being loaded
|
diff --git a/lib/job/db_backup.rb b/lib/job/db_backup.rb
index abc1234..def5678 100644
--- a/lib/job/db_backup.rb
+++ b/lib/job/db_backup.rb
@@ -8,38 +8,44 @@ MESSAGE = ENV['NVST_DB_BACKUP_MSG']
def self.perform
- db = Nvst::Application.config.database_configuration['default']
+ db_dump!(Nvst::Application.config.database_configuration['default'] , TMP)
+ if TARGET.present?
+ FileUtils.mv TMP, TARGET
+ end
+
+ if MESSAGE
+ commit!(TARGET, MESSAGE)
+ end
+ end
+
+ def self.db_dump!(config, filename)
system <<-CMD.gsub(/\s+/, ' ')
- PGPASSWORD="#{db['password']}"
+ PGPASSWORD="#{config['password']}"
pg_dump
--data-only
--no-owner
--exclude-table=investment_*
--exclude-table=schema_migrations
- --username='#{db['username']}'
- --host='#{db['host']}'
- --port='#{db['port']}'
- '#{db['database']}'
+ --username='#{config['username']}'
+ --host='#{config['host']}'
+ --port='#{config['port']}'
+ '#{config['database']}'
|
sed
-e 's/^--.*//'
-e '/^ *$/d'
- > "#{TMP}"
+ > "#{filename}"
CMD
+ end
- if TARGET.present?
- FileUtils.mv 'tmp/db-backup.sql', TARGET
- end
+ def self.commit!(filename, message)
+ dirname, filename = File.split(filename)
- if MESSAGE
- dirname, filename = File.split(TARGET)
-
- git = Git.open(dirname)
- git.add(filename)
- if %w[M A].include?(git.status[filename].type)
- puts git.commit(MESSAGE)
- end
+ git = Git.open(dirname)
+ git.add(filename)
+ if %w[M A].include?(git.status[filename].type)
+ puts git.commit(message)
end
end
end
|
Split DbBackup to smaller chunks
|
diff --git a/lib/ghtorrent/migrations/020_add_deleted_to_users.rb b/lib/ghtorrent/migrations/020_add_deleted_to_users.rb
index abc1234..def5678 100644
--- a/lib/ghtorrent/migrations/020_add_deleted_to_users.rb
+++ b/lib/ghtorrent/migrations/020_add_deleted_to_users.rb
@@ -6,28 +6,14 @@ Sequel.migration do
up do
- puts 'Add column fake to users'
- add_column :users, :fake, TrueClass, :null => false, :default => false
-
- if self.database_type == :mysql
- self.transaction(:rollback => :reraise, :isolation => :committed) do
- self << "update users
- set fake = '1'
- where CAST(users.login AS BINARY) regexp '[A-Z]{8}'
- and not exists (select * from pull_request_history where users.id = actor_id)
- and not exists (select * from issue_events where actor_id = users.id)
- and not exists (select * from project_members where users.id = user_id)
- and not exists (select * from issues where reporter_id=users.id )
- and not exists (select * from issues where assignee_id=users.id )
- a nd not exists (select * from organization_members where user_id = users.id);"
- end
- end
+ puts 'Add column deleted to users'
+ add_column :users, :deleted, TrueClass, :null => false, :default => false
end
down do
puts 'Drop column fake from users'
alter_table :users do
- drop_column :fake
+ drop_column :deleted
end
end
end
|
Fix migration to actually add the deleted field
|
diff --git a/lib/raml/resource.rb b/lib/raml/resource.rb
index abc1234..def5678 100644
--- a/lib/raml/resource.rb
+++ b/lib/raml/resource.rb
@@ -1,5 +1,3 @@-require 'uri'
-
module Raml
class Resource
ATTRIBUTES = []
@@ -13,7 +11,7 @@ end
def url
- URI.join(parent.uri, uri_partial)
+ File.join(parent.uri, uri_partial)
end
end
|
Use File.join, URI.join does validation and {} is not valid
|
diff --git a/lib/relax/helpers.rb b/lib/relax/helpers.rb
index abc1234..def5678 100644
--- a/lib/relax/helpers.rb
+++ b/lib/relax/helpers.rb
@@ -8,7 +8,8 @@
def relax_snippet
if defined?(@relax) && @relax
- "Relax.replace(#{@relax});".html_safe
+ snippet = @relax.gsub(/\;$/, '')
+ "Relax.replace(#{snippet});".html_safe
end
end
|
Fix ie11 can't have semicolons inside parenthesis
|
diff --git a/lib/pier.rb b/lib/pier.rb
index abc1234..def5678 100644
--- a/lib/pier.rb
+++ b/lib/pier.rb
@@ -4,16 +4,7 @@
module Pier
def runShellProc(command)
- begin
- IO.popen(command, :err=>[:child, :out]) do |io|
- while (output = io.getc) do
- print output
- $stdout.flush
- end
- end
- rescue Interrupt
- end
-
+ system(command)
$?
end
|
Switch to using `system` for running commands
Using `IO.popen()` does not forward the TTY, which prevents commands
like `psql` from using readline (e.g. ctrl+r). Using `system` allows
for readline to work without causing any other known issues.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.