diff stringlengths 65 26.7k | message stringlengths 7 9.92k |
|---|---|
diff --git a/spec/dummy/app/admin/categories.rb b/spec/dummy/app/admin/categories.rb
index abc1234..def5678 100644
--- a/spec/dummy/app/admin/categories.rb
+++ b/spec/dummy/app/admin/categories.rb
@@ -1,5 +1,10 @@ ActiveAdmin.register Category do
- action_item 'state_action_category', only: :show do
+ action_item_args = if ActiveAdmin::VERSION.start_with?('0.')
+ [{ only: :show }]
+ else
+ ["state_action_category", { only: :show }]
+ end
+ action_item(*action_item_args) do
link_to "Posts", admin_category_posts_path(resource)
end
end
| Fix active admin deprecated in dummy app
|
diff --git a/spec/features/create_match_spec.rb b/spec/features/create_match_spec.rb
index abc1234..def5678 100644
--- a/spec/features/create_match_spec.rb
+++ b/spec/features/create_match_spec.rb
@@ -0,0 +1,21 @@+require 'spec_helper'
+
+feature 'Create match' do
+ background do
+ @project = create(:project, state: 'online', online_date: -1.seconds.from_now)
+ login
+ end
+
+ scenario 'generate new' do
+ visit project_path(@project)
+ click_on 'Match'
+
+ fill_in 'projects_challenges_match_value', with: 2
+ fill_in 'projects_challenges_match_starts_at', with: 1.day.from_now.strftime('%m/%d/%y')
+ fill_in 'projects_challenges_match_finishes_at', with: 3.days.from_now.strftime('%m/%d/%y')
+ fill_in 'projects_challenges_match_maximum_value', with: 20_000
+ expect {
+ click_on 'Preview your match'
+ }.to change(Projects::Challenges::Match, :count).by(1)
+ end
+end
| Add acceptance spec for match creation
|
diff --git a/spec/bundler/fetcher/base_spec.rb b/spec/bundler/fetcher/base_spec.rb
index abc1234..def5678 100644
--- a/spec/bundler/fetcher/base_spec.rb
+++ b/spec/bundler/fetcher/base_spec.rb
@@ -0,0 +1,78 @@+require "spec_helper"
+
+describe Bundler::Fetcher::Base do
+ let(:downloader) { double(:downloader) }
+ let(:remote) { double(:remote) }
+ let(:display_uri) { "http://sample_uri.com" }
+
+ class TestClass < described_class; end
+
+ subject { TestClass.new(downloader, remote, display_uri) }
+
+ describe "#initialize" do
+ context "with the abstract Base class" do
+ it "should raise an error" do
+ expect { described_class.new(downloader, remote, display_uri) }.to raise_error(RuntimeError, "Abstract class")
+ end
+ end
+
+ context "with a class that inherits the Base class" do
+ it "should set the passed attributes" do
+ expect(subject.downloader).to eq(downloader)
+ expect(subject.remote).to eq(remote)
+ expect(subject.display_uri).to eq("http://sample_uri.com")
+ end
+ end
+ end
+
+ describe "#remote_uri" do
+ let(:remote_uri_obj) { double(:remote_uri_obj) }
+
+ before { allow(remote).to receive(:uri).and_return(remote_uri_obj) }
+
+ it "should return the remote's uri" do
+ expect(subject.remote_uri).to eq(remote_uri_obj)
+ end
+ end
+
+ describe "#fetch_uri" do
+ let(:remote_uri_obj) { URI("http://rubygems.org") }
+
+ before { allow(subject).to receive(:remote_uri).and_return(remote_uri_obj) }
+
+ context "when the remote uri's host is rubygems.org" do
+ it "should create a copy of the remote uri with bundler.rubygems.org as the host" do
+ fetched_uri = subject.fetch_uri
+ expect(fetched_uri.host).to eq("bundler.rubygems.org")
+ expect(fetched_uri).to_not be(remote_uri_obj)
+ end
+ end
+
+ context "when the remote uri's host is not rubygems.org" do
+ let(:remote_uri_obj) { URI("http://otherhost.org") }
+
+ it "should return the remote uri" do
+ expect(subject.fetch_uri).to eq(URI("http://otherhost.org"))
+ end
+ end
+
+ it "memoizes the fetched uri" do
+ expect(remote_uri_obj).to receive(:host).once
+ 2.times { subject.fetch_uri }
+ end
+ end
+
+ describe "#api_available?" do
+ before { allow(subject).to receive(:api_fetcher?).and_return(false) }
+
+ it "should return whether the api is available" do
+ expect(subject.api_available?).to eq(false)
+ end
+ end
+
+ describe "#api_fetcher?" do
+ it "should return false" do
+ expect(subject.api_fetcher?).to be_falsey
+ end
+ end
+end
| Add unit tests for abstract `Bundler::Fetcher::Base` class
|
diff --git a/spec/features/auth_signin_spec.rb b/spec/features/auth_signin_spec.rb
index abc1234..def5678 100644
--- a/spec/features/auth_signin_spec.rb
+++ b/spec/features/auth_signin_spec.rb
@@ -0,0 +1,8 @@+require 'spec_helper'
+RSpec.feature "User Sign Up", :type => :feature do
+ scenario "A user can access the signin page" do
+ visit signin_path
+ expect(page).to have_content("Sign In")
+ expect(page).to have_content("Name")
+ expect(page).to have_content("Password")
+ end | Add auth_signin spec to features spec folder with test for visiting signin page
|
diff --git a/spec/support/description_helper.rb b/spec/support/description_helper.rb
index abc1234..def5678 100644
--- a/spec/support/description_helper.rb
+++ b/spec/support/description_helper.rb
@@ -0,0 +1,14 @@+require 'spec_helper'
+
+def existing(key)
+ -> { instances.any key }
+end
+
+def unknown(key)
+ -> { instances.none key }
+end
+
+def apply(method_name, options = {})
+ proc = options[:to]
+ -> { proc.call.send method_name }
+end | DRY: Use more descriptive :existing, :unknown
|
diff --git a/spec/requests/healthcheck_spec.rb b/spec/requests/healthcheck_spec.rb
index abc1234..def5678 100644
--- a/spec/requests/healthcheck_spec.rb
+++ b/spec/requests/healthcheck_spec.rb
@@ -9,16 +9,16 @@ get "/healthcheck"
expect(response.status).to eq(200)
- expect(data.fetch(:status)).to eq("ok")
+ expect(data.keys).to include(:checks, :status)
end
- it "includes useful information about each check" do
+ it "includes each check" do
get "/healthcheck"
- expect(data.fetch(:checks)).to include(
- database_connectivity: { status: "ok" },
- redis_connectivity: { status: "ok" },
- sidekiq_queue_latency: hash_including(status: "ok"),
+ expect(data.fetch(:checks).keys).to include(
+ :database_connectivity,
+ :redis_connectivity,
+ :sidekiq_queue_latency
)
end
end
| Make healthcheck tests less brittle
I've encountered these tests [failing a][1] [few times][2] because the test environment
had a long sidekiq latency.
I've amended the tests so we can assert that the right tests are present, and
the right structure of data is returned.
The internals of the healthcheck is tested in the govuk_app_config gem's tests
so I'm not too worried about asserting the responses here.
[1]: https://ci.integration.publishing.service.gov.uk/job/publishing-api/job/deployed-to-production/842/console
[2]: https://ci.integration.publishing.service.gov.uk/job/publishing-api/job/deployed-to-production/836/console
|
diff --git a/spec/unit/recipes/default_spec.rb b/spec/unit/recipes/default_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/recipes/default_spec.rb
+++ b/spec/unit/recipes/default_spec.rb
@@ -7,7 +7,29 @@ end.converge('chef-grafana::default')
end
- it 'converges successfully' do
- expect { :chef_run }.to_not raise_error
+ let(:chef_run_versioned) do
+ ChefSpec::ServerRunner.new do |node|
+ node.automatic['chef-grafana']['install']['version'] = '4.5.0'
+ end.converge('chef-grafana::default')
+ end
+
+ context 'latest version' do
+ it 'converges successfully' do
+ expect { :chef_run }.to_not raise_error
+ end
+
+ it 'upgrades successfully' do
+ expect(chef_run).to upgrade_package('grafana')
+ end
+ end
+
+ context 'specific version' do
+ it 'converges successfully' do
+ expect { :chef_run_versioned }.to_not raise_error
+ end
+
+ it 'installs successfully' do
+ expect(chef_run_versioned).to install_package('grafana').with(version: '4.5.0')
+ end
end
end
| Add unit test to install a specific version.
Signed-off-by: Stefan Sundin <0e17f6afaad5343e7f7d39057fdf65e398c03ec8@outreach.io>
|
diff --git a/test/compiler_test.rb b/test/compiler_test.rb
index abc1234..def5678 100644
--- a/test/compiler_test.rb
+++ b/test/compiler_test.rb
@@ -9,9 +9,23 @@ @compiler = IronRubyInline::Compiler.new
end
- should "have temp file name for parameters output" do
+ should "have temp file name for output parameter" do
result = @compiler.parameters.output
assert_equal "temp_file_name", result
end
end
+
+ context "with output specified" do
+ setup do
+ flexmock(IronRubyInline::Path).
+ should_receive(:tmpfile).
+ never
+ @compiler = IronRubyInline::Compiler.new("output")
+ end
+
+ should "have expected output parameter" do
+ result = @compiler.parameters.output
+ assert_equal "output", result
+ end
+ end
end
| Add Compiler with output specified context.
|
diff --git a/spec/models/depot_spec.rb b/spec/models/depot_spec.rb
index abc1234..def5678 100644
--- a/spec/models/depot_spec.rb
+++ b/spec/models/depot_spec.rb
@@ -1,5 +1,10 @@ require 'spec_helper'
describe Depot do
- pending "add some examples to (or delete) #{__FILE__}"
+ before { @depot = build(:depot) }
+
+ subject { @depot }
+
+ it { should respond_to :name }
+ # it { should respond_to :location }
end
| Add a depot model spec.
|
diff --git a/serverspec/spec/consul_parameters.rb b/serverspec/spec/consul_parameters.rb
index abc1234..def5678 100644
--- a/serverspec/spec/consul_parameters.rb
+++ b/serverspec/spec/consul_parameters.rb
@@ -4,12 +4,14 @@ require 'active_support'
require 'net/http'
require 'uri'
+require 'cgi'
module ConsulParameters
def read
parameters = {}
begin
- response = Net::HTTP.get URI.parse('http://localhost:8500/v1/kv/cloudconductor/parameters')
+ consul_secret_key = ENV['CONSUL_SECRET_KEY'].nil? ? '' : CGI::escape(ENV['CONSUL_SECRET_KEY'])
+ response = Net::HTTP.get URI.parse("http://localhost:8500/v1/kv/cloudconductor/parameters?token=#{consul_secret_key}")
response_hash = JSON.parse(response, symbolize_names: true).first
parameters_json = Base64.decode64(response_hash[:Value])
parameters = JSON.parse(parameters_json, symbolize_names: true)
@@ -22,7 +24,8 @@ def read_servers
begin
servers = {}
- response = Net::HTTP.get URI.parse('http://localhost:8500/v1/kv/cloudconductor/servers?recurse')
+ consul_secret_key = ENV['CONSUL_SECRET_KEY'].nil? ? '' : CGI::escape(ENV['CONSUL_SECRET_KEY'])
+ response = Net::HTTP.get URI.parse("http://localhost:8500/v1/kv/cloudconductor/servers?recurse&token=#{consul_secret_key}")
JSON.parse(response, symbolize_names: true).each do |response_hash|
key = response_hash[:Key]
next if key == 'cloudconductor/servers'
| Modify to use CONSUL_SECRET_KEY on serverspec.
|
diff --git a/mrblib/Shapes.rb b/mrblib/Shapes.rb
index abc1234..def5678 100644
--- a/mrblib/Shapes.rb
+++ b/mrblib/Shapes.rb
@@ -5,39 +5,39 @@ class Array
def to_curve
- Build.curve self
+ Siren.curve self
end
def to_polyline
- Build.polyline self
+ Siren.polyline self
end
def to_polygon
- Build.polygon self
+ Siren.polygon self
end
def to_wire(tol = 0.001)
- Build.wire self, tol
+ Siren.wire self, tol
end
def to_loft
-
+ raise NotImplementedError
end
def to_revol
-
+ raise NotImplementedError
end
def to_shell
- Build.shell self
+ Siren.shell self
end
def to_solid
- Build.solid self.to_shell
+ Siren.solid self.to_shell
end
def to_comp
- Build.compound self
+ Siren.compound self
end
def vertices; self.map(&:vertices).flatten end
@@ -49,5 +49,9 @@ def compsolids; self.map(&:compsolids).flatten end
def compounds; self.map(&:compounds).flatten end
+ def bndbox
+ raise NotImplementedError
+ end
+
end
| Update methods to each new name in Shape array.
|
diff --git a/tasks.rb b/tasks.rb
index abc1234..def5678 100644
--- a/tasks.rb
+++ b/tasks.rb
@@ -11,8 +11,11 @@ sh "git submodule update"
end
end
- sh "./codegen.py spec #{spec} lib/amqp/protocol.rb"
- sh "ruby -c lib/amqp/protocol.rb"
+ output = "lib/amqp/protocol.rb"
+ sh "./codegen.py spec #{spec} #{output}"
+ if File.file?(output)
+ sh "ruby -c #{output}"
+ end
end
end
| Test if generated file exists before checking the syntax.
|
diff --git a/config/initializers/spree.rb b/config/initializers/spree.rb
index abc1234..def5678 100644
--- a/config/initializers/spree.rb
+++ b/config/initializers/spree.rb
@@ -17,8 +17,8 @@ config.searcher_class = OpenFoodNetwork::Searcher
# 109 should be Australia. Hardcoded for CI (Jenkins), where countries are not pre-loaded.
- config.default_country_id = Spree::Country.find_by_name('Australia').andand.id || 109
-
+ config.default_country_id = Spree::Country.table_exists? && Spree::Country.find_by_name('Australia').andand.id
+ config.default_country_id ||= 109
# -- spree_paypal_express
# Auto-capture payments. Without this option, payments must be manually captured in the paypal interface.
| Fix error when setting up a fresh db
|
diff --git a/oembed.gemspec b/oembed.gemspec
index abc1234..def5678 100644
--- a/oembed.gemspec
+++ b/oembed.gemspec
@@ -2,8 +2,8 @@ require File.expand_path('../lib/oembed/version', __FILE__)
Gem::Specification.new do |gem|
- gem.authors = ["Alex Soulim"]
- gem.email = ["soulim@gmail.com"]
+ gem.authors = ["Alex Sulim"]
+ gem.email = ["hello@sul.im"]
gem.description = %q{A slim library to work with oEmbed format.}
gem.summary = %q{A slim library to work with oEmbed format.}
gem.homepage = "http://soulim.github.com/oembed"
| Update author name and email address :)
|
diff --git a/test/integration/users_profile_test.rb b/test/integration/users_profile_test.rb
index abc1234..def5678 100644
--- a/test/integration/users_profile_test.rb
+++ b/test/integration/users_profile_test.rb
@@ -19,4 +19,16 @@ assert_match formatted_day(event.date), response.body
end
end
+
+ test "user's events display" do
+ log_in_as(@user)
+ get events_user_path(@user)
+ assert_template 'users/events'
+ @user.events.each do |event|
+ assert_select 'a[href=?]', event_path(event), text: event.name
+ assert_match event.group.name, response.body
+ assert_match formatted_day(event.date), response.body
+ assert_match event.description, response.body
+ end
+ end
end
| Include a display test for a user's events
|
diff --git a/test/ipinfodb_test.rb b/test/ipinfodb_test.rb
index abc1234..def5678 100644
--- a/test/ipinfodb_test.rb
+++ b/test/ipinfodb_test.rb
@@ -17,10 +17,21 @@
def test_valid_api_key
puts "IPINFODB_API_KEY=<your_api_key> required to run this test" unless ENV["IPINFODB_API_KEY"]
+
assert_nothing_raised do
Ipinfodb.api_key = ENV["IPINFODB_API_KEY"]
Ipinfodb.lookup("127.0.0.1")
end
end
-
+
+ def test_geolocation
+ puts "IPINFODB_API_KEY=<your_api_key> required to run this test" unless ENV["IPINFODB_API_KEY"]
+
+ Ipinfodb.api_key = ENV['IPINFODB_API_KEY']
+ response = Ipinfodb.lookup('153.19.48.1')
+
+ assert_equal 'Poland', response["CountryName"]
+ assert_equal 'PL', response["CountryCode"]
+ end
+
end
| Add integration test for actual geolocation
i.e. use some real IP address.
|
diff --git a/test/models/tutorial_enrolment_test.rb b/test/models/tutorial_enrolment_test.rb
index abc1234..def5678 100644
--- a/test/models/tutorial_enrolment_test.rb
+++ b/test/models/tutorial_enrolment_test.rb
@@ -0,0 +1,17 @@+require "test_helper"
+
+class TutorialEnrolmentTest < ActiveSupport::TestCase
+ def test_default_create
+ tutorial_enrolment = FactoryGirl.create(:tutorial_enrolment)
+ assert tutorial_enrolment.valid?
+ end
+
+ def test_specific_create
+ project = FactoryGirl.create(:project)
+ tutorial = FactoryGirl.create(:tutorial)
+ tutorial_enrolment = FactoryGirl.create(:tutorial_enrolment, project: project, tutorial: tutorial)
+ assert_equal tutorial_enrolment.project, project
+ assert_equal tutorial_enrolment.tutorial, tutorial
+ assert tutorial_enrolment.valid?
+ end
+end
| NEW: Add tutorial enrolment model test
|
diff --git a/lib/bitex_bot/models/open_sell.rb b/lib/bitex_bot/models/open_sell.rb
index abc1234..def5678 100644
--- a/lib/bitex_bot/models/open_sell.rb
+++ b/lib/bitex_bot/models/open_sell.rb
@@ -2,9 +2,11 @@ # OpenSells are open sell positions that are closed by one SellClosingFlow.
# TODO: document attributes.
#
-class BitexBot::OpenSell < ActiveRecord::Base
- belongs_to :opening_flow, class_name: 'SellOpeningFlow', foreign_key: :opening_flow_id
- belongs_to :closing_flow, class_name: 'SellClosingFlow', foreign_key: :closing_flow_id
+module BitexBot
+ class OpenSell < ActiveRecord::Base
+ belongs_to :opening_flow, class_name: 'SellOpeningFlow', foreign_key: :opening_flow_id
+ belongs_to :closing_flow, class_name: 'SellClosingFlow', foreign_key: :closing_flow_id
- scope :open, -> { where('closing_flow_id IS NULL') }
+ scope :open, -> { where('closing_flow_id IS NULL') }
+ end
end
| Use nested module/class definitions instead of compact style.
|
diff --git a/lib/bundler/vendored_molinillo.rb b/lib/bundler/vendored_molinillo.rb
index abc1234..def5678 100644
--- a/lib/bundler/vendored_molinillo.rb
+++ b/lib/bundler/vendored_molinillo.rb
@@ -1,3 +1,5 @@ vendor = File.expand_path('../vendor/Molinillo-0.1.0/lib', __FILE__)
-$:.unshift(vendor) unless $:.include?(vendor)
+loaded = $:.include?(vendor)
+$:.unshift(vendor) unless loaded
require 'molinillo'
+$:.delete(vendor) unless loaded
| [VendoredMolinillo] Remove vendor path from load path after requiring
|
diff --git a/test/test_fizzbuzz.rb b/test/test_fizzbuzz.rb
index abc1234..def5678 100644
--- a/test/test_fizzbuzz.rb
+++ b/test/test_fizzbuzz.rb
@@ -17,21 +17,9 @@
class TestFizzbuzz < Test::Unit::TestCase
- should "say 1 for 1" do
- assert_equal "1", FizzBuzz.say(1)
- end
-
- should "say 2 for 2" do
- assert_equal "2", FizzBuzz.say(2)
- end
-
should "say Fizz for multiples of 3" do
assert_equal "Fizz", FizzBuzz.say(3)
assert_equal "Fizz", FizzBuzz.say(6)
- end
-
- should "say 4 for 4" do
- assert_equal "4", FizzBuzz.say(4)
end
should "say Buzz for multiples of 5" do
@@ -39,4 +27,10 @@ assert_equal "Buzz", FizzBuzz.say(10)
end
+ should "say the number for the rest" do
+ assert_equal "1", FizzBuzz.say(1)
+ assert_equal "2", FizzBuzz.say(2)
+ assert_equal "4", FizzBuzz.say(4)
+ end
+
end
| Refactor tests to improve readability (also tests need this)
|
diff --git a/lib/kitno/cli.rb b/lib/kitno/cli.rb
index abc1234..def5678 100644
--- a/lib/kitno/cli.rb
+++ b/lib/kitno/cli.rb
@@ -7,7 +7,7 @@ long_desc <<-TRANSFORM
TRANSFORM
- option :dry, type: :boolean, default: false
+ option :dry, type: :boolean, default: false, desc: 'Performs a dry run, printing out the dependency map generated'
option :namespace, aliases: '-n', type: :string, required: true, desc: 'Base namespace to migrate from'
option :directory, aliases: '-d', type: :string, default: '.', desc: 'Directory to target for transformation'
option :output, aliases: '-o', type: :string, default: './output', desc: 'Directory to output transformed modules'
| Add a description to --dry option
|
diff --git a/lib/goban.rb b/lib/goban.rb
index abc1234..def5678 100644
--- a/lib/goban.rb
+++ b/lib/goban.rb
@@ -1,5 +1,11 @@+require "net/http"
+
module Goban
def self.create
- "http://goban.co/boards/p/269Cn0b"
+ uri = URI("http://goban.co/boards")
+ res = Net::HTTP.post_form(uri, "board[hash]" => "")
+ json = JSON.parse(res.body)
+
+ "http://goban.co/boards/p/#{json["hash"]}"
end
end
| Create a new board with each request
|
diff --git a/lib/bkwrapper/backup/compressor.rb b/lib/bkwrapper/backup/compressor.rb
index abc1234..def5678 100644
--- a/lib/bkwrapper/backup/compressor.rb
+++ b/lib/bkwrapper/backup/compressor.rb
@@ -2,7 +2,7 @@ module Backup
module Compressor
def compress_command
- "zip /var/tmp/#{compressed_filename} /var/tmp/#{backup_filename}"
+ "zip -j /var/tmp/#{compressed_filename} /var/tmp/#{backup_filename}"
end
def compressed_filename
| Store just the name of a saved file (junk the path)
By default, zip will store the full path (relative to the current path).
|
diff --git a/lib/time_warp.rb b/lib/time_warp.rb
index abc1234..def5678 100644
--- a/lib/time_warp.rb
+++ b/lib/time_warp.rb
@@ -2,28 +2,28 @@
module TimeWarpAbility
- def reset_to_real_time
- Time.testing_offset = 0
- end
+ def reset_to_real_time
+ Time.testing_offset = 0
+ end
- def pretend_now_is(*args)
- Time.testing_offset = Time.now - time_from(*args)
- if block_given?
- begin
- yield
- ensure
- reset_to_real_time
- end
+ def pretend_now_is(*args)
+ Time.testing_offset = Time.now - time_from(*args)
+ if block_given?
+ begin
+ yield
+ ensure
+ reset_to_real_time
end
end
+ end
private
- def time_from(*args)
- return args[0] if 1 == args.size && args[0].is_a?(Time)
- return args[0].to_time if 1 == args.size && args[0].respond_to?(:to_time) # For example, if it's a Date.
- Time.utc(*args)
- end
+ def time_from(*args)
+ return args[0] if 1 == args.size && args[0].is_a?(Time)
+ return args[0].to_time if 1 == args.size && args[0].respond_to?(:to_time) # For example, if it's a Date.
+ Time.utc(*args)
+ end
end
module Test # :nodoc:
| Remove extra level of indentation |
diff --git a/lib/dining-table/columns/column.rb b/lib/dining-table/columns/column.rb
index abc1234..def5678 100644
--- a/lib/dining-table/columns/column.rb
+++ b/lib/dining-table/columns/column.rb
@@ -26,7 +26,7 @@ label = determine_label(:header)
return label if label
object_class = table.collection.first.try(:class)
- object_class.human_attribute_name( name) if object_class
+ object_class.human_attribute_name( name ) if object_class && object_class.respond_to?( :human_attribute_name )
end
end
| Remove dependency on Rails' human_attribute_name (check if class responds to it)
|
diff --git a/lib/ellen/handlers/google_image.rb b/lib/ellen/handlers/google_image.rb
index abc1234..def5678 100644
--- a/lib/ellen/handlers/google_image.rb
+++ b/lib/ellen/handlers/google_image.rb
@@ -1,18 +1,18 @@ module Ellen
module Handlers
class GoogleImage < Base
- on /image (.+)/, name: "image", description: "Search image from Google"
+ on /image( me)? (.+)/, name: "image", description: "Search image from Google"
- on /animate (.+)/, name: "animate", description: "Search animation from Google"
+ on /animate( me)? (.+)/, name: "animate", description: "Search animation from Google"
def image(message)
- if url = search(message[1])
+ if url = search(message[2])
robot.say url
end
end
def animate(message)
- if url = search(message[1], animated: true)
+ if url = search(message[2], animated: true)
robot.say url
end
end
| Add optional `me`: e.g. `image me ellen`
|
diff --git a/lib/engineyard/model/deployment.rb b/lib/engineyard/model/deployment.rb
index abc1234..def5678 100644
--- a/lib/engineyard/model/deployment.rb
+++ b/lib/engineyard/model/deployment.rb
@@ -9,14 +9,14 @@ :environment => environment,
:migration_command => migration_command,
:ref => ref,
- :created_at => Time.now,
+ :created_at => Time.now.utc,
})
end
def finished(successful, output)
self.successful = successful
self.output = output
- self.finished_at = Time.now
+ self.finished_at = Time.now.utc
post_to_appcloud!
end
| Use UTC for started and finished times for deploys
|
diff --git a/lib/ephemeral_response/net_http.rb b/lib/ephemeral_response/net_http.rb
index abc1234..def5678 100644
--- a/lib/ephemeral_response/net_http.rb
+++ b/lib/ephemeral_response/net_http.rb
@@ -2,6 +2,8 @@ class HTTP
alias request_without_ephemeral_response request
alias connect_without_ephemeral_response connect
+
+ attr_accessor :uri
def connect
end
@@ -9,11 +11,13 @@
def generate_uri(request)
scheme = use_ssl? ? "https" : "http"
- URI.parse("#{scheme}://#{conn_address}:#{conn_port}#{request.path}")
+ self.uri = URI.parse("#{scheme}://#{conn_address}:#{conn_port}#{request.path}")
end
def request(request, body = nil, &block)
- EphemeralResponse::Fixture.respond_to(generate_uri(request), request.method) do
+ generate_uri(request)
+ EphemeralResponse::Fixture.respond_to(uri, request) do
+ D "EphemeralResponse: establishing connection to #{uri}"
connect_without_ephemeral_response
request_without_ephemeral_response(request, body, &block)
end
| Use Net::HTTP debugger when connection established
|
diff --git a/lib/fluent/plugin/in_named_pipe.rb b/lib/fluent/plugin/in_named_pipe.rb
index abc1234..def5678 100644
--- a/lib/fluent/plugin/in_named_pipe.rb
+++ b/lib/fluent/plugin/in_named_pipe.rb
@@ -25,7 +25,7 @@ raise ConfigError, "#{e.class}: #{e.message}"
end
- @parser = Plugin.new_parser(conf['format'])
+ @parser = Plugin.new_parser(@format)
@parser.configure(conf)
end
| Use @format instead of conf['format'] for symmetricity with formatter
|
diff --git a/storm.rb b/storm.rb
index abc1234..def5678 100644
--- a/storm.rb
+++ b/storm.rb
@@ -2,19 +2,18 @@
class Storm < Formula
homepage "http://csdms.colorado.edu/wiki/Model:STORM"
- head "https://csdms.colorado.edu/svn/storm/trunk",
- :using => UnsafeSubversionDownloadStrategy
+ head "https://github.com/csdms-contrib/storm",
+ sha1 ""
- depends_on :fortran
+ depends_on "cmake" => :build
def install
- inreplace "Makefile", /gfortran/, "\${FC}"
-
+ system "cmake", ".", *std_cmake_args
system "make"
- bin.install "storm"
+ system "make", "install"
end
test do
- system "false"
+ system "make", "test"
end
end
| Update formula for BMI version
|
diff --git a/lib/podio/models/linked_account.rb b/lib/podio/models/linked_account.rb
index abc1234..def5678 100644
--- a/lib/podio/models/linked_account.rb
+++ b/lib/podio/models/linked_account.rb
@@ -29,5 +29,12 @@ Podio.connection.delete("/linked_account/#{id}").status
end
+ def update_options(id, attributes)
+ Podio.connection.put do |req|
+ req.url "/linked_account/#{id}/options"
+ req.body = attributes
+ end
+ end
+
end
end
| Add update method for linked accounts options
|
diff --git a/lib/tasks/update_billing_plan.rake b/lib/tasks/update_billing_plan.rake
index abc1234..def5678 100644
--- a/lib/tasks/update_billing_plan.rake
+++ b/lib/tasks/update_billing_plan.rake
@@ -1,7 +1,7 @@ # Updates billing plan at Onapp for all users, as per ONAPP_BILLING_PLAN_ID env variable
task update_billing_plan: :environment do
- User.find_each do |user|
+ User.where('onapp_id IS NOT NULL').find_each do |user|
begin
p user.email
UserTasks.new.perform(:update_billing_plan, user.id)
| Check Onapp ID for updating billing plan |
diff --git a/lib/tty/tree/directory_renderer.rb b/lib/tty/tree/directory_renderer.rb
index abc1234..def5678 100644
--- a/lib/tty/tree/directory_renderer.rb
+++ b/lib/tty/tree/directory_renderer.rb
@@ -1,4 +1,3 @@-# encoding: utf-8
# frozen_string_literal: true
module TTY
| Change to remove encoding comment
|
diff --git a/test/models/audio_version_test.rb b/test/models/audio_version_test.rb
index abc1234..def5678 100644
--- a/test/models/audio_version_test.rb
+++ b/test/models/audio_version_test.rb
@@ -25,11 +25,17 @@ audio_version_with_template.audio_version_template(true).wont_be_nil
end
- it 'validates self against template before save' do
+ it 'validates self based on template' do
audio_version_with_template.update_attributes(explicit: 'explicit')
audio_version_with_template.file_errors.must_include 'must be between'
audio_version_with_template.status.must_equal 'invalid'
audio_version_with_template.wont_be(:compliant_with_template?)
+
+ audio_version_with_template.instance_variable_set('@_length', 50)
+ audio_version_with_template.update_attributes(explicit: 'explicit')
+ audio_version_with_template.file_errors.must_be_nil
+ audio_version_with_template.status.must_equal 'valid'
+ audio_version_with_template.must_be(:compliant_with_template?)
end
end
end
| Make audio version test better
|
diff --git a/vagrant_base/libxml/recipes/default.rb b/vagrant_base/libxml/recipes/default.rb
index abc1234..def5678 100644
--- a/vagrant_base/libxml/recipes/default.rb
+++ b/vagrant_base/libxml/recipes/default.rb
@@ -24,7 +24,7 @@
case node.platform
when "ubuntu", "debian" then
- %w(libssl-dev libxml2-dev libxslt1-dev zlib1g-dev).each do |pkg|
+ %w(libssl-dev libxml2-dev libxslt1-dev libxslt-dev zlib1g-dev).each do |pkg|
package pkg
end
end
| Add one more package to the libxml cookbook
|
diff --git a/lib/code_driven_development/test_component/context.rb b/lib/code_driven_development/test_component/context.rb
index abc1234..def5678 100644
--- a/lib/code_driven_development/test_component/context.rb
+++ b/lib/code_driven_development/test_component/context.rb
@@ -13,6 +13,7 @@ end
def indented_output io
+ io << ""
io << "describe #@description do"
io.indented do
if befores.any?
| Add whitespace before every describe block.
|
diff --git a/app/concerns/couriers/fusionable.rb b/app/concerns/couriers/fusionable.rb
index abc1234..def5678 100644
--- a/app/concerns/couriers/fusionable.rb
+++ b/app/concerns/couriers/fusionable.rb
@@ -37,6 +37,7 @@ notify "Adding to Fusion Tables", photo.key
table.select("ROWID", "WHERE name='#{photo.key}'").map(&:values).map(&:first).map { |id| table.delete id }
table.insert [photo.to_fusion]
+ sleep 0.6 # 5 queries per second
rescue => e
notify "Fusion Tables failed", id
end
| Allow up to 5 queries per second
|
diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/pages_controller.rb
+++ b/app/controllers/pages_controller.rb
@@ -1,6 +1,16 @@ class PagesController < HighVoltage::PagesController
def show
@user ||= User.new
+
+ KM.record('Connect') if params[:id] == 'connect'
+ KM.record('Deploy Apps') if params[:id] == 'apps'
+ KM.record('Hack Your City') if params[:id] == 'activities'
+ KM.record('Find Events') if params[:id] == 'events'
+ KM.record('Captain Brigade') if params[:id] == 'captain'
+ KM.record('Open Civic Data') if params[:id] == 'opendata'
+ KM.record('Advocate') if params[:id] == 'ogi'
+ KM.record('Commit Open Source') if params[:id] == 'opensource'
+
super
end
end
| Add KISS events to pages controller
|
diff --git a/app/models/visualization/relator.rb b/app/models/visualization/relator.rb
index abc1234..def5678 100644
--- a/app/models/visualization/relator.rb
+++ b/app/models/visualization/relator.rb
@@ -18,7 +18,7 @@ end #initialize
def overlays
- @overlas ||= Overlay::Collection.new(visualization_id: id).fetch
+ Overlay::Collection.new(visualization_id: id).fetch
end #overlays
def map
@@ -26,25 +26,25 @@ end #map
def user
- @user ||= map.user if map
+ map.user if map
end #user
def table
return nil unless defined?(::Table)
- @table ||= ::Table.where(map_id: map_id).first
+ ::Table.where(map_id: map_id).first
end #table
def related_tables
- @related_tables ||= layers(:cartodb).flat_map(&:affected_tables).uniq
+ layers(:cartodb).flat_map(&:affected_tables).uniq
end #related_tables
def layers(kind)
return [] unless map
- map.send(LAYER_SCOPES.fetch(kind))
+ return map.send(LAYER_SCOPES.fetch(kind))
end #layers
def stats
- @stats ||= Visualization::Stats.new(self).to_poro
+ Visualization::Stats.new(self).to_poro
end #stats
attr_reader :id, :map_id
| Revert "Memoize (almost) all the things related to visualizations"
This reverts commit 0ecba01487cefa7eab25994cdf7e0e4d7f035e4d.
|
diff --git a/rakelib/send_last_tweets_media.rake b/rakelib/send_last_tweets_media.rake
index abc1234..def5678 100644
--- a/rakelib/send_last_tweets_media.rake
+++ b/rakelib/send_last_tweets_media.rake
@@ -0,0 +1,17 @@+require "dotenv"
+require_relative "../lib/fortuna_luca/telegram/client"
+require_relative "../lib/fortuna_luca/twitter/client"
+
+desc "Sends tweets media to the Telegram channel"
+task :send_last_tweets_media do
+ include FortunaLuca::Telegram::Client
+ include FortunaLuca::Twitter::Client
+
+ Dotenv.load
+
+ followed_twitter_handlers.each do |handle|
+ media_for_last_minutes(handle: handle, minutes: 60).each do |media_url|
+ send_telegram_message(ENV["TELEGRAM_CHAT_ID"], media_url)
+ end
+ end
+end
| Add rake task for Twitter media
|
diff --git a/fdcollector.gemspec b/fdcollector.gemspec
index abc1234..def5678 100644
--- a/fdcollector.gemspec
+++ b/fdcollector.gemspec
@@ -1,7 +1,6 @@ Gem::Specification.new do |s|
s.name = 'fdcollector'
- s.version = '1.0'
- s.date = '2012-06-26'
+ s.version = '1.0.0'
s.summary = 'FD Collector'
s.description = 'A statsd collector for open FDs for daemontools managed apps.'
s.authors = ['Bob Micheletto']
| Change version number to a triplet (X.X.X)
Remove explicit date setting from gemspec
|
diff --git a/lib/dalli/cas/client.rb b/lib/dalli/cas/client.rb
index abc1234..def5678 100644
--- a/lib/dalli/cas/client.rb
+++ b/lib/dalli/cas/client.rb
@@ -1 +1 @@-puts "You can remove `require 'dalli/cas/client'` as this code has been rolled into the standard 'dalli/client'.
+puts "You can remove `require 'dalli/cas/client'` as this code has been rolled into the standard 'dalli/client'."
| Fix SyntaxError: unterminated string meets end of file
This is meant to be a deprecation warning, but currently any code that loads this file will raise a SyntaxError. |
diff --git a/lib/eventbrite/error.rb b/lib/eventbrite/error.rb
index abc1234..def5678 100644
--- a/lib/eventbrite/error.rb
+++ b/lib/eventbrite/error.rb
@@ -1,33 +1,48 @@ module Eventbrite
class Error < StandardError
- attr_reader :type, :message
+ attr_reader :message, :description, :code
- def self.from_response(response)
- error_type, error_message = parse_error(response.body)
- new(error_type, error_message)
+ class << self
+ def from_response(response)
+ message, description, code = parse_error(response.body)
+ new(message, description, code)
+ end
+
+ def errors
+ @errors ||= {
+ 401 => Eventbrite::Error::Unauthorized
+ }
+
+ end
+
+ private
+ def parse_error(body)
+ if body.nil?
+ ['', '', nil]
+ else
+ [
+ body[:error],
+ body[:error_description],
+ body[:error]
+ ]
+ end
+ end
+
end
- def self.parse_error(body)
- error = body[:error]
+ def initialize(message = '', description = '', code = nil)
+ super(description)
- if error.nil?
- ['', nil]
- elsif String === error
- ['', error]
- else
- [error[:error_type], error[:error_message]]
- end
+ @message = message
+ @description = description
+ @code = code
end
- def initialize(type, message)
- @type = type
- @message = message
- end
+ # Raised when Eventbrite returns a 4xx HTTP status code
+ class ClientError < self; end
- def inspect
- vars = self.instance_variables.
- map{|v| "#{v}=#{instance_variable_get(v).inspect}"}.join(", ")
- "<#{self.class}: #{vars}>"
- end
+ # Raised when Twitter returns the HTTP status code 401
+ class Unauthorized < ClientError; end
+
end
end
| Refactor Error to mirror Twitter::Error
|
diff --git a/lib/mercenary/option.rb b/lib/mercenary/option.rb
index abc1234..def5678 100644
--- a/lib/mercenary/option.rb
+++ b/lib/mercenary/option.rb
@@ -31,9 +31,9 @@
def eql?(other)
return false unless self.class.eql?(other.class)
- instance_variables.each do |var|
+ instance_variables.map do |var|
instance_variable_get(var).eql?(other.instance_variable_get(var))
- end
+ end.all?
end
private
| Check that all instance variables equal other instance variables
|
diff --git a/lib/metasploit/model.rb b/lib/metasploit/model.rb
index abc1234..def5678 100644
--- a/lib/metasploit/model.rb
+++ b/lib/metasploit/model.rb
@@ -9,13 +9,9 @@ #
# Project
#
+
+require 'metasploit/model/engine'
require 'metasploit/model/version'
-
-# Only include the Rails engine when using Rails. This allows the non-Rails projects, like metasploit-framework to use
-# the validators by calling Metasploit::Model.require_validators.
-if defined? Rails
- require 'metasploit/model/engine'
-end
# Top-level namespace shared between metasploit-model, metasploit-framework, and Pro.
module Metasploit
| Remove if defined? Rails check for requiring engine
MSP-11359
|
diff --git a/lib/rack_dav/handler.rb b/lib/rack_dav/handler.rb
index abc1234..def5678 100644
--- a/lib/rack_dav/handler.rb
+++ b/lib/rack_dav/handler.rb
@@ -14,13 +14,12 @@ def call(env)
request = Rack::Request.new(env)
- pp request
response = Rack::Response.new
-
+
begin
controller = Controller.new(request, response, @options.dup)
res = controller.send(request.request_method.downcase)
- response.status = res.code if res.is_a?(HTTPStatus::Status)
+ response.status = res.code if res.respond_to?(:code)
rescue HTTPStatus::Status => status
response.status = status.code
end
@@ -30,8 +29,13 @@
response.body = [response.body] if not response.body.respond_to? :each
response.status = response.status ? response.status.to_i : 200
+ response['Content-Length'] = response.body.to_s.length unless response['Content-Length']
+ response.headers.each_pair{|k,v| response[k] = v.to_s}
+
+ # Apache wants the body dealt with, so just read it and junk it
+ buf = true
+ buf = request.body.read(8192) while buf
- puts response.body
response.finish
end
| Set status code if available. Force all header values to strings.
|
diff --git a/lib/tasks/fix_utf8.rake b/lib/tasks/fix_utf8.rake
index abc1234..def5678 100644
--- a/lib/tasks/fix_utf8.rake
+++ b/lib/tasks/fix_utf8.rake
@@ -0,0 +1,51 @@+# credit: http://markmcb.com/2011/11/07/replacing-ae%E2%80%9C-ae%E2%84%A2-aeoe-etc-with-utf-8-characters-in-ruby-on-rails/
+
+namespace :onebody do
+ desc 'Fix utf8 encoding errors in text.'
+ task :fix_utf8 => :environment do
+ replacements = [
+ ['…', '…'], # elipsis
+ ['–', '–'], # long hyphen
+ ['—', '–'], # long hyphen
+ ['’', '’'], # curly apostrophe
+ ['‘', "'"], # straight apostrophe
+ ['“', '“'], # curly open quote
+ [/â€[[:cntrl:]]/, '”'] # curly close quote
+ ]
+ klasses = {
+ 'Album' => %w(description),
+ 'Comment' => %w(text),
+ 'Message' => %w(body html_body),
+ 'NewsItem' => %w(body),
+ 'Note' => %w(body),
+ 'Page' => %w(body),
+ 'Person' => %w(about testimony business_description),
+ 'PrayerRequest' => %w(request answer),
+ 'StreamItem' => %w(body),
+ 'Verse' => %w(text)
+ }
+
+ Site.each do |site|
+ puts "Site #{site.name}"
+ klasses.each do |klass, attributes|
+ index = 0
+ count = Kernel.const_get(klass).count
+ print " #{klass} 0 of #{count}\r"
+ Kernel.const_get(klass).find_each do |obj|
+ index += 1
+ print " #{klass} #{index} of #{count}\r"
+ attributes.each do |attribute|
+ next unless obj[attribute]
+ replacements.each do |set|
+ obj[attribute] = obj[attribute].gsub(set[0], set[1])
+ end
+ end
+ if obj.changed?
+ obj.save(validate: false)
+ end
+ end
+ puts
+ end
+ end
+ end
+end
| Add rake task to correct UTF-8 encoding errors in old data.
Cedar Ridge has the oldest data and was migrated many times.
If you're seeing stuff like — in your news items, comments, notes,
etc., then run `rake onebody:fix_utf8` and see if that fixes the issue.
Worked for us.
|
diff --git a/capistrano-offroad.gemspec b/capistrano-offroad.gemspec
index abc1234..def5678 100644
--- a/capistrano-offroad.gemspec
+++ b/capistrano-offroad.gemspec
@@ -13,9 +13,12 @@ s.version = CapistranoOffroad::VERSION::STRING
s.summary = "Capistrano add-ons and recipes for non-rails projects"
s.description = "Capistrano add-ons and recipes for non-rails projects" # FIXME
+
s.authors = ["Maciej Pasternacki"]
s.email = "maciej@pasternacki.net"
s.homepage = "http://github.com/mpasternacki/capistrano-offroad"
+
+ s.add_dependency "capistrano", ">= 2.5.8"
s.required_rubygems_version = ">= 1.3.6"
s.files = Dir.glob("lib/**/*.rb") + %w(README LICENSE)
| Add Capistrano dependency to gemspec.
|
diff --git a/middleman-bootstrap-navbar.gemspec b/middleman-bootstrap-navbar.gemspec
index abc1234..def5678 100644
--- a/middleman-bootstrap-navbar.gemspec
+++ b/middleman-bootstrap-navbar.gemspec
@@ -9,7 +9,7 @@ gem.name = 'middleman-bootstrap-navbar'
gem.version = Middleman::BootstrapNavbar::VERSION
gem.platform = Gem::Platform::RUBY
- gem.authors = ['Manuel Meurer']
+ gem.author = 'Manuel Meurer'
gem.email = 'manuel@krautcomputing.com'
gem.summary = 'Middleman extension to easily generate a Twitter Bootstrap style navbar'
gem.description = 'Middleman extension to easily generate a Twitter Bootstrap style navbar'
@@ -21,7 +21,7 @@ gem.test_files = gem.files.grep(%r(^(test|spec|features)/))
gem.require_paths = ['lib']
- gem.add_development_dependency 'rake', '>= 10.0.0'
+ gem.add_development_dependency 'rake'
gem.add_development_dependency 'rspec', '~> 2.13'
gem.add_development_dependency 'guard-rspec', '~> 3.0'
| Change authors to author in gemspec, remove Rake version constraint
|
diff --git a/lib/appsignal/hooks/net_http.rb b/lib/appsignal/hooks/net_http.rb
index abc1234..def5678 100644
--- a/lib/appsignal/hooks/net_http.rb
+++ b/lib/appsignal/hooks/net_http.rb
@@ -6,7 +6,7 @@ register :net_http
def dependencies_present?
- Appsignal.config[:instrument_net_http]
+ Appsignal.config && Appsignal.config[:instrument_net_http]
end
def install
| Make net http dependencies checker more robust
|
diff --git a/app/models/comment.rb b/app/models/comment.rb
index abc1234..def5678 100644
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -1,8 +1,8 @@ class Comment < ActiveRecord::Base
validates :body, :presence => true
- validates :asciicast_id, :presence => true
- validates :user_id, :presence => true
+ validates :asciicast, :presence => true
+ validates :user, :presence => true
belongs_to :user
belongs_to :asciicast, :counter_cache => true
| Validate presence of a model, not id
|
diff --git a/app/models/project.rb b/app/models/project.rb
index abc1234..def5678 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1,7 +1,9 @@ class Project < ActiveRecord::Base
belongs_to :client
before_save :default_values
+
has_one :client
+ has_many :issues
validates :name, presence: true, length: { minimum: 4 }
validates :short_code, uniqueness: true, length: { maximum: 4 }, allow_blank: true
| Add has_many :issues to Project
|
diff --git a/db/migrate/20121005142110_regenerate_err_fingerprints.rb b/db/migrate/20121005142110_regenerate_err_fingerprints.rb
index abc1234..def5678 100644
--- a/db/migrate/20121005142110_regenerate_err_fingerprints.rb
+++ b/db/migrate/20121005142110_regenerate_err_fingerprints.rb
@@ -4,7 +4,7 @@ if err.notices.any? && err.problem
err.update_attribute(
:fingerprint,
- Fingerprint.generate(err.notices.first, err.app.api_key)
+ Fingerprint::Sha1.generate(err.notices.first, err.app.api_key)
)
end
end
| Fix fingerprinting migration as it is refactored
Commit https://github.com/pinglamb/errbit/commit/da3946bef7921e5a6df0d55fc2f556b641884ada refactored fingerprinting into a Fingerprint module, updated the migration for that |
diff --git a/montrose.gemspec b/montrose.gemspec
index abc1234..def5678 100644
--- a/montrose.gemspec
+++ b/montrose.gemspec
@@ -27,7 +27,7 @@ spec.add_development_dependency "appraisal"
spec.add_development_dependency "m"
spec.add_development_dependency "minitest"
- spec.add_development_dependency "rake"
+ spec.add_development_dependency "rake", ">= 12.3.3"
spec.add_development_dependency "standard"
spec.add_development_dependency "timecop"
end
| Address security vulnerability in rake
https://github.com/advisories/GHSA-jppv-gw3r-w3q8
|
diff --git a/action_cable.gemspec b/action_cable.gemspec
index abc1234..def5678 100644
--- a/action_cable.gemspec
+++ b/action_cable.gemspec
@@ -5,8 +5,8 @@ s.summary = 'Framework for websockets.'
s.description = 'Action Cable is a framework for realtime communication over websockets.'
- s.author = ['Pratik Naik']
- s.email = ['pratiknaik@gmail.com']
+ s.author = ['Pratik Naik', 'David Heinemeier Hansson']
+ s.email = ['pratiknaik@gmail.com', 'david@heinemeierhansson.com']
s.homepage = 'http://basecamp.com'
s.add_dependency('activesupport', '>= 4.2.0')
| Expand authors given recent work
|
diff --git a/lib/executor.rb b/lib/executor.rb
index abc1234..def5678 100644
--- a/lib/executor.rb
+++ b/lib/executor.rb
@@ -2,10 +2,9 @@
# executes packer commands against template files
class SingelExecutor
- def initialize(filename)
- @filename = filename
- @packer_dir = File.absolute_path(File.join(File.dirname($PROGRAM_NAME), 'packer'))
- @file_path = File.join(@packer_dir, filename)
+ def initialize(template)
+ @file_path = template
+ @packer_dir = File.dirname(template)
@builders = {}
end
@@ -28,7 +27,7 @@
# print out the builders for this template
def list
- puts @filename.gsub('.json', '') + ':'
+ puts File.basename(@file_path, '.json') + ':'
parse_builders
if @builders.empty?
puts '- No builders found'.indent.to_red
| Handle packer templates outside the working dir
|
diff --git a/lib/git/gsub.rb b/lib/git/gsub.rb
index abc1234..def5678 100644
--- a/lib/git/gsub.rb
+++ b/lib/git/gsub.rb
@@ -28,7 +28,7 @@ target_files = (`git grep -l #{from} #{path}`).each_line.map(&:chomp).join ' '
if system_support_gsed?
- system %|gsed -i "" s/#{from}/#{to}/g #{target_files}|
+ system %|gsed -i s/#{from}/#{to}/g #{target_files}|
else
system %|sed -i "" -e s/#{from}/#{to}/g #{target_files}|
end
| Fix option for gnu sed
|
diff --git a/core/lib/spree/testing_support/common_rake.rb b/core/lib/spree/testing_support/common_rake.rb
index abc1234..def5678 100644
--- a/core/lib/spree/testing_support/common_rake.rb
+++ b/core/lib/spree/testing_support/common_rake.rb
@@ -14,7 +14,7 @@ Spree::InstallGenerator.start ["--lib_name=#{ENV['LIB_NAME']}", "--auto-accept", "--migrate=false", "--seed=false", "--sample=false", "--quiet", "--user_class=#{args[:user_class]}"]
puts "Setting up dummy database..."
- cmd = "bundle exec rake db:drop db:create db:migrate db:test:prepare --trace"
+ cmd = "bundle exec rake db:drop db:create db:migrate db:test:prepare"
if RUBY_PLATFORM =~ /mswin/ #windows
cmd += " >nul"
| Remove trace from common rake
|
diff --git a/base/lib/paperclip/social_stream.rb b/base/lib/paperclip/social_stream.rb
index abc1234..def5678 100644
--- a/base/lib/paperclip/social_stream.rb
+++ b/base/lib/paperclip/social_stream.rb
@@ -1,6 +1,6 @@ # Create new Paperclip::Interpolations method for subtype class
module Paperclip::Interpolations #:nodoc:
def subtype_class attachment, style_name
- attachment.instance.actor.subject_type.to_s.underscore
+ attachment.instance.actor!.subject_type.to_s.underscore
end
end
| Fix paperclip interpolation in subjects without actor
|
diff --git a/lib/poke/map.rb b/lib/poke/map.rb
index abc1234..def5678 100644
--- a/lib/poke/map.rb
+++ b/lib/poke/map.rb
@@ -1,6 +1,8 @@ require 'rmagick'
module Poke
+ # Map reads an ASCII file and coverts it to an object that can be read and
+ # manipulated by other program objects.
class Map
include Poke::ReadMap
| Add class doc for Map
|
diff --git a/benchmarks/mab2_document_parsing.rb b/benchmarks/mab2_document_parsing.rb
index abc1234..def5678 100644
--- a/benchmarks/mab2_document_parsing.rb
+++ b/benchmarks/mab2_document_parsing.rb
@@ -0,0 +1,14 @@+require "metacrunch/mab2"
+require "benchmark/ips"
+
+Benchmark.ips do |x|
+ x.config(time: 5, warmup: 2)
+
+ @xml = File.read(File.join(Pathname.new(__dir__), "..", "spec", "assets", "aleph_mab_xml", "file1.xml"))
+
+ x.report("implementation") do
+ @document = Metacrunch::Mab2::Document.from_aleph_mab_xml(@xml)
+ end
+
+ x.compare!
+end
| Add benchmark for document parsing.
|
diff --git a/attributes/default.rb b/attributes/default.rb
index abc1234..def5678 100644
--- a/attributes/default.rb
+++ b/attributes/default.rb
@@ -14,10 +14,8 @@ # limitations under the License.
#
-default["logstash"]["package_url"] = "http://semicomplete.com/files/logstash/logstash-1.1.0-monolithic.jar"
-# default["logstash"]["package_checksum"] = "357c01ae09aa4611e31347238d762729" MD5?
-default["logstash"]["package_checksum"] = "6c9f491865b5eed569e029f6ad9f3343f346cfa04d04314e7aadea7b9578490f" # SHA256
-
-default['logstash']['install_path'] = "/usr/local/logstash"
-default['logstash']['config_path'] = "/etc/logstash"
-default['logstash']['log_path'] = "/var/log/logstash"
+default['logstash']['package_url'] = 'http://semicomplete.com/files/logstash/logstash-1.1.0-monolithic.jar'
+default['logstash']['package_checksum'] = '6c9f491865b5eed569e029f6ad9f3343f346cfa04d04314e7aadea7b9578490f' # SHA256
+default['logstash']['install_path'] = '/usr/local/logstash'
+default['logstash']['config_path'] = '/etc/logstash'
+default['logstash']['log_path'] = '/var/log/logstash'
| Use string literals where possible
|
diff --git a/MetalBender.podspec b/MetalBender.podspec
index abc1234..def5678 100644
--- a/MetalBender.podspec
+++ b/MetalBender.podspec
@@ -10,6 +10,6 @@ s.ios.deployment_target = '10.0'
s.requires_arc = true
s.ios.source_files = 'Sources/**/*.{swift,metal}'
- s.dependency 'SwiftProtobuf', :git => 'https://github.com/apple/swift-protobuf', :tag => '0.9.904'
+ s.dependency 'SwiftProtobuf', '0.9.903'
s.dependency 'MetalPerformanceShadersProxy', '0.1.2'
end
| Set SwiftProtobuf pod version to 0.9.903
|
diff --git a/app/controllers/api/repository_controller.rb b/app/controllers/api/repository_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/repository_controller.rb
+++ b/app/controllers/api/repository_controller.rb
@@ -2,7 +2,7 @@ skip_before_filter :verify_authenticity_token
def create
- model = RepoMessage.new(action: 'Test', body: params.to_s)
+ model = RepoMessage.new(action: request.headers['HTTP_X_GitHub_Event'], body: params.to_s)
model.save!
render text: 'OK'
end
| Add GitHub event to repository save
|
diff --git a/webapp/lib/trisano.rb b/webapp/lib/trisano.rb
index abc1234..def5678 100644
--- a/webapp/lib/trisano.rb
+++ b/webapp/lib/trisano.rb
@@ -1,5 +1,5 @@ module Trisano
- VERSION = %w(3 5 4).freeze
+ VERSION = %w(3 5 5).freeze
end
require 'trisano/application'
| Set TriSano version to 3.5.5
|
diff --git a/lib/file.rb b/lib/file.rb
index abc1234..def5678 100644
--- a/lib/file.rb
+++ b/lib/file.rb
@@ -5,7 +5,7 @@ def chunk
@chunks = Array.new
self.rewind
- while (content = self.read(512))
+ while (content = self.read(102400))
@chunks << Tornado::Chunk.new(content)
end
@chunks
| Improve chunking a lot. Chunks of 100KB seems pretty reasonable.
|
diff --git a/spec/runtime/environment_rb_spec.rb b/spec/runtime/environment_rb_spec.rb
index abc1234..def5678 100644
--- a/spec/runtime/environment_rb_spec.rb
+++ b/spec/runtime/environment_rb_spec.rb
@@ -3,14 +3,25 @@ describe "environment.rb file" do
before :each do
system_gems "rack-1.0.0"
+ build_git "no-gemspec", :gemspec => false
install_gemfile <<-G
source "file://#{gem_repo1}"
gem "activesupport", "2.3.5"
+ gem "no-gemspec", '1.0', :git => "#{lib_path('no-gemspec-1.0')}"
G
bundle :lock
+ end
+
+ it "works with gems from git that don't have gemspecs" do
+ run <<-R, :lite_runtime => true
+ require 'no-gemspec'
+ puts NOGEMSPEC
+ R
+
+ out.should == "1.0"
end
it "does not pull in system gems" do
@@ -48,4 +59,5 @@
out.should == "rack is not part of the bundle. Add it to Gemfile."
end
+
end
| Add a failing test for a locked git-based gem without a gemspec. |
diff --git a/app/models/answer.rb b/app/models/answer.rb
index abc1234..def5678 100644
--- a/app/models/answer.rb
+++ b/app/models/answer.rb
@@ -7,4 +7,9 @@ has_many :votes, :as => :voteable
validates :body, presence: true
+
+ def time_since_creation
+ hours_number = ((Time.now - created_at) / 3600).round
+ "#{hours_number} hours ago"
+ end
end
| Add time_since_creation method to Answer model
|
diff --git a/app/models/answer.rb b/app/models/answer.rb
index abc1234..def5678 100644
--- a/app/models/answer.rb
+++ b/app/models/answer.rb
@@ -6,5 +6,11 @@
validates_presence_of :content, :question_id, :user_id
-
+ def score
+ count = 0
+ self.votes.each do |vote|
+ count = count + vote.status
+ end
+ count
+ end
end
| Add score method to Answer model
|
diff --git a/app/controllers/seats_controller.rb b/app/controllers/seats_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/seats_controller.rb
+++ b/app/controllers/seats_controller.rb
@@ -1,2 +1,47 @@ class SeatsController < ApplicationController
+ # Including these in case, well, they could cram in more seats, or remove seats for wheelchair, or rearrange seats to add more space... or make room for a meeting, or a party. Or maybe they start assigning seats.
+ def index
+ @seats = Seat.all
+ end
+
+ def new
+ @seat = Seat.new
+ end
+
+ def create
+ @seat = Seat.new(
+ auditorium_id: params[:auditorium_id]
+ )
+ if @seat.save
+ flash[:success] = "You added another seat to the auditorium!"
+ redirect_to "/"
+ else
+ @seat.errors.full_messages
+ render 'new.html.erb'
+ end
+ end
+
+ def show
+ @seat = Seat.find_by(id: params[:id])
+ end
+
+ def edit
+ @seat = Seat.find_by(id: params[:id])
+ end
+
+ def update
+ @seat = Seat.find_by(id: params[:id])
+ @seat.update(
+ seat: params[:seat])
+ flash[:success] = "The seat information has been updated."
+ redirect_to "/"
+ end
+
+ def destroy
+ @seat = Seat.find_by(id: params[:id])
+ @seat.destroy
+
+ flash[:success] = "The seat was removed from the auditorium. :("
+ redirect_to '/'
+ end
end
| Add seat actions in controller.
|
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -1,5 +1,5 @@ class UsersController < ApplicationController
- before_filter :set_access_control_headers, only: :present
+ before_action :set_access_control_headers, only: :present
def present
@users = Arp.present_users
| Use before_action instead of before_filter
|
diff --git a/app/models/champs/checkbox_champ.rb b/app/models/champs/checkbox_champ.rb
index abc1234..def5678 100644
--- a/app/models/champs/checkbox_champ.rb
+++ b/app/models/champs/checkbox_champ.rb
@@ -8,4 +8,8 @@ def to_s
value == 'on' ? 'oui' : 'non'
end
+
+ def for_export
+ value == 'on' ? 'on' : 'off'
+ end
end
| Make the CheckboxChamp export similar to YesNoChamp
Previously, nil values would be returned as nil
and not as off |
diff --git a/app/models/concerns/search_cache.rb b/app/models/concerns/search_cache.rb
index abc1234..def5678 100644
--- a/app/models/concerns/search_cache.rb
+++ b/app/models/concerns/search_cache.rb
@@ -7,7 +7,7 @@
def calculate_tsvector
ActiveRecord::Base.connection.execute("
- UPDATE proposals SET tsv = (#{searchable_values_sql}) WHERE id = #{self.id}")
+ UPDATE #{self.class.table_name} SET tsv = (#{searchable_values_sql}) WHERE id = #{self.id}")
end
private
| Use model table name instead of hardcoding it
|
diff --git a/app/models/spree/order_decorator.rb b/app/models/spree/order_decorator.rb
index abc1234..def5678 100644
--- a/app/models/spree/order_decorator.rb
+++ b/app/models/spree/order_decorator.rb
@@ -1,18 +1,24 @@ module Spree
Order.class_eval do
- # TODO: fix the cart error populating and make it work with the framekwork version of this method
- # Undo d08be0fc90cb1a7dbb286eb214de6b24f4b46635
def add_variant(variant, quantity = 1)
current_item = contains?(variant)
if current_item
current_item.quantity += quantity
current_item.save
else
- current_item = LineItem.new(:quantity => 1)
+ current_item = LineItem.new
current_item.variant = variant
current_item.price = variant.price
- self.line_items << current_item
- current_item.quantity += quantity - 1 if quantity > 1
+
+ # Add OH qty if there are not enough available then add the rest of the qty to present an error message
+ if quantity > variant.on_hand
+ current_item.quantity = variant.on_hand
+ self.line_items << current_item
+ current_item.quantity += quantity - variant.on_hand
+ else
+ current_item.quantity = quantity
+ self.line_items << current_item
+ end
end
# populate line_items attributes for additional_fields entries
@@ -28,6 +34,9 @@ current_item.update_attribute(field[:name].gsub(' ', '_').downcase, value)
end
+ # NOTE: This line was commented out from the original method
+ # undoing d08be0fc90cb1a7dbb286eb214de6b24f4b46635
+ # self.reload
current_item
end
end
| Change the way shortages are added to line items
|
diff --git a/app/policies/ezborrow_authorizer.rb b/app/policies/ezborrow_authorizer.rb
index abc1234..def5678 100644
--- a/app/policies/ezborrow_authorizer.rb
+++ b/app/policies/ezborrow_authorizer.rb
@@ -1,6 +1,6 @@ class EZBorrowAuthorizer < PatronStatusAuthorizer
def initialize(user)
super(user)
- @authorized_bor_statuses = %w{20 21 22 23 50 51 52 53 54 55 56 57 58 60 61 62 63 65 66 80 81 82}
+ @authorized_bor_statuses = %w{20 21 22 23 50 51 52 53 54 55 56 57 58 60 61 62 63 65 66 80 81 82 30 31 32 33 34 35 36 37 38 39 40 41}
end
end
| Add TNS patron statuses to EZBorrow authorizer
|
diff --git a/db/migrate/20110618232719_add_version_reverted_from.rb b/db/migrate/20110618232719_add_version_reverted_from.rb
index abc1234..def5678 100644
--- a/db/migrate/20110618232719_add_version_reverted_from.rb
+++ b/db/migrate/20110618232719_add_version_reverted_from.rb
@@ -0,0 +1,13 @@+class AddVersionRevertedFrom < ActiveRecord::Migration
+ def self.up
+ change_table :versions do |t|
+ t.integer :reverted_from
+ end
+ end
+
+ def self.down
+ change_table :versions do |t|
+ t.drop :reverted_from
+ end
+ end
+end | Add reverted_from column for vestal_version
|
diff --git a/base/app/controllers/followers_controller.rb b/base/app/controllers/followers_controller.rb
index abc1234..def5678 100644
--- a/base/app/controllers/followers_controller.rb
+++ b/base/app/controllers/followers_controller.rb
@@ -4,19 +4,11 @@ respond_to :html, :js
def index
- @followers =
- case params[:direction]
- when 'sent'
- current_subject.followings
- when 'received'
- current_subject.followers
- else
- raise ActiveRecord::RecordNotFound
- end
+ @followings = current_subject.followings
+ @followers = current_subject.followers
respond_to do |format|
- format.html { @followers = @followers.page(params[:page]).per(20) }
- format.js { @followers = @followers.page(params[:page]).per(20) }
+ format.html
format.json { render :text => to_json(@followers) }
end
end
| Update followers controller to new ViSH view
|
diff --git a/omniauth.gemspec b/omniauth.gemspec
index abc1234..def5678 100644
--- a/omniauth.gemspec
+++ b/omniauth.gemspec
@@ -5,7 +5,7 @@
Gem::Specification.new do |spec|
spec.add_dependency 'hashie', ['>= 1.2', '< 4']
- spec.add_dependency 'rack', ['>= 1.0', '< 2.0']
+ spec.add_dependency 'rack', ['>= 1.0', '< 3']
spec.add_development_dependency 'bundler', '~> 1.0'
spec.authors = ['Michael Bleigh', 'Erik Michaels-Ober', 'Tom Milewski']
spec.description = 'A generalized Rack framework for multiple-provider authentication.'
| Update rack dependency to <3 :heart:
|
diff --git a/spec/cc/yaml/nodes/ratings_spec.rb b/spec/cc/yaml/nodes/ratings_spec.rb
index abc1234..def5678 100644
--- a/spec/cc/yaml/nodes/ratings_spec.rb
+++ b/spec/cc/yaml/nodes/ratings_spec.rb
@@ -0,0 +1,18 @@+require "spec_helper"
+
+describe CC::Yaml::Nodes::Ratings do
+ specify "with an invalid path, it drops nil values with a warning" do
+ config = CC::Yaml.parse <<-YAML
+ ratings:
+ paths:
+ - []
+ - wut/*
+ YAML
+
+ config.ratings.paths.must_equal(["wut/*"])
+ config.nested_warnings.first.must_equal([
+ ["ratings", "paths"],
+ "Discarding invalid value for CC::Yaml::Nodes::GlobList: nil",
+ ])
+ end
+end
| Add spec for invalid ratings.paths elements
|
diff --git a/metadata.rb b/metadata.rb
index abc1234..def5678 100644
--- a/metadata.rb
+++ b/metadata.rb
@@ -5,6 +5,5 @@ description 'Installs/Configures java_wrapper'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0'
-depends 'ark'
recipe "java_wrapper", "Wrap a java application"
| Revert "added missing dependency to ark"
This reverts commit 1f6bd3e2032e31e02959cc41ec81aa087711561e.
|
diff --git a/metadata.rb b/metadata.rb
index abc1234..def5678 100644
--- a/metadata.rb
+++ b/metadata.rb
@@ -18,6 +18,6 @@ depends "yum"
depends "postgresql"
depends "php-fpm"
-depends "nginx", "~> 1.0.0"
+depends "nginx", ">= 1.0.0"
depends "ark"
depends "chocolatey"
| Change test sign
It has breaking my prod platform
|
diff --git a/spec/ruby/core/symbol/size_spec.rb b/spec/ruby/core/symbol/size_spec.rb
index abc1234..def5678 100644
--- a/spec/ruby/core/symbol/size_spec.rb
+++ b/spec/ruby/core/symbol/size_spec.rb
@@ -1,4 +1,5 @@ require File.expand_path('../../../spec_helper', __FILE__)
+require File.expand_path('../shared/length', __FILE__)
ruby_version_is "1.9" do
describe "Symbol#size" do
| Add missing 'require' for shared spec.
|
diff --git a/spec/rx-rspec/async_runner_spec.rb b/spec/rx-rspec/async_runner_spec.rb
index abc1234..def5678 100644
--- a/spec/rx-rspec/async_runner_spec.rb
+++ b/spec/rx-rspec/async_runner_spec.rb
@@ -29,7 +29,6 @@ runner.await_done {|_| }
end.to fail_with(/timeout/i)
expect(Time.now - start).to be >= 0.2
- expect(Time.now - start).to be < 0.3
end
it 'propagates exceptions from within the block' do
| Remove async runner assert that timeout is not too late. Travis is just too irregular. |
diff --git a/spec/sse/open-world/date-1_spec.rb b/spec/sse/open-world/date-1_spec.rb
index abc1234..def5678 100644
--- a/spec/sse/open-world/date-1_spec.rb
+++ b/spec/sse/open-world/date-1_spec.rb
@@ -0,0 +1,66 @@+# coding: utf-8
+#
+require 'spec_helper'
+
+# Auto-generated by build_w3c_tests.rb
+#
+# date-1
+# Added type : xsd:date '='
+# /Users/ben/repos/datagraph/tests/tests/data-r2/open-world/date-1.rq
+#
+# This is a W3C test from the DAWG test suite:
+# http://www.w3.org/2001/sw/DataAccess/tests/r2#date-1
+#
+# This test is approved:
+# http://lists.w3.org/Archives/Public/public-rdf-dawg/2007AprJun/att-0082/2007-06-12-dawg-minutes.html
+#
+describe "W3C test" do
+ context "open-world" do
+ before :all do
+ @data = %q{
+@prefix : <http://example/> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+:dt1 :r "2006-08-23T09:00:00+01:00"^^xsd:dateTime .
+
+:d1 :r "2006-08-23"^^xsd:date .
+:d2 :r "2006-08-23Z"^^xsd:date .
+:d3 :r "2006-08-23+00:00"^^xsd:date .
+
+:d4 :r "2001-01-01"^^xsd:date .
+:d5 :r "2001-01-01Z"^^xsd:date .
+
+:d6 :s "2006-08-23"^^xsd:date .
+:d7 :s "2006-08-24Z"^^xsd:date .
+:d8 :s "2000-01-01"^^xsd:date .
+
+}
+ @query = %q{
+ (prefix ((xsd: <http://www.w3.org/2001/XMLSchema#>)
+ (: <http://example/>))
+ (filter (= ?v "2006-08-23"^^xsd:date)
+ (bgp (triple ?x :r ?v))))
+}
+ end
+
+ example "date-1" do
+
+ graphs = {}
+ graphs[:default] = { :data => @data, :format => :ttl}
+
+
+ repository = 'open-world-date-2'
+ expected = [
+ {
+ :v => RDF::Literal.new('2006-08-23' , :datatype => RDF::URI('http://www.w3.org/2001/XMLSchema#date')),
+ :x => RDF::URI('http://example/d1'),
+ },
+ ]
+
+ pending("Not Approved, and RDF.rb does object matching, not lexical matching") do
+ sparql_query(:graphs => graphs, :query => @query, # unordered comparison in rspec is =~
+ :repository => repository, :form => :select).should =~ expected
+ end
+ end
+ end
+end
| Add date-1 spec, which is pending as RDF.rb does more xsd:date comparisons.
|
diff --git a/config/initializers/rack_patches.rb b/config/initializers/rack_patches.rb
index abc1234..def5678 100644
--- a/config/initializers/rack_patches.rb
+++ b/config/initializers/rack_patches.rb
@@ -0,0 +1,6 @@+# Workaround for incorrect counting of the keyspace in nested params in rack
+# https://github.com/rack/rack/pull/321
+# https://github.com/rack/rack/issues/318
+if Rack::Utils.respond_to?("key_space_limit=")
+ Rack::Utils.key_space_limit = 2622144
+end
| Add workaround for poor query key counting in Rack 1.1.6
Otherwise queries with lots of nested params, such as route updates, produce 'exceeded available parameter key space' errors.
|
diff --git a/config/software/loom-provisioner.rb b/config/software/loom-provisioner.rb
index abc1234..def5678 100644
--- a/config/software/loom-provisioner.rb
+++ b/config/software/loom-provisioner.rb
@@ -1,4 +1,4 @@-name 'loom-provisioner'
+name project
default_version 'develop'
dependency 'ruby'
@@ -13,15 +13,11 @@ gem 'install sinatra --no-rdoc --no-ri --version 1.4.5'
gem 'install thin --no-rdoc --no-ri --version 1.6.2'
gem 'install rest_client --no-rdoc --no-ri --version 1.7.3'
- command "mkdir -p #{install_dir}/provisioner/bin"
- command "sed -e 's:provisioner/embedded/bin:embedded/bin:g' bin/loom-provisioner.sh > #{install_dir}/provisioner/bin/loom-provisioner.sh"
command "cp -fpPR provisioner #{install_dir}"
- command "sed -e 's/APP_NAME/loom-provisioner/g' -e 's/SVC_NAME/provisioner/g' bin/loom-service > #{install_dir}/provisioner/bin/init-loom-provisioner"
+ command "sed -e 's/APP_NAME/#{project}/g' -e 's/SVC_NAME/provisioner/g' bin/loom-service > #{install_dir}/provisioner/bin/init-#{project}"
command "chmod +x #{install_dir}/provisioner/bin/*"
- command "mkdir -p #{install_dir}/provisioner/etc/logrotate.d"
- command "cp -f provisioner/distribution/etc/logrotate.d/loom-provisioner #{install_dir}/provisioner/etc/logrotate.d"
+ mkdir "#{install_dir}/provisioner/etc/logrotate.d"
+ copy "#{project_dir}/provisioner/distribution/etc/logrotate.d/#{project}", "#{install_dir}/provisioner/etc/logrotate.d"
command "find #{install_dir} -type f -name .gitkeep | xargs rm -f"
- # Joyent ships with bad permissions, allow everyone to read everything
- command "chmod ugo+r #{install_dir}/embedded"
gem 'uninstall -Ix rdoc'
end
| Use copy/mkdir builtin Builder methods
|
diff --git a/config/setup_load_paths.rb b/config/setup_load_paths.rb
index abc1234..def5678 100644
--- a/config/setup_load_paths.rb
+++ b/config/setup_load_paths.rb
@@ -0,0 +1,16 @@+if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
+ begin
+ rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME']))
+ rvm_lib_path = File.join(rvm_path, 'lib')
+ $LOAD_PATH.unshift rvm_lib_path
+ require 'rvm'
+ RVM.use_from_path! File.dirname(File.dirname(__FILE__))
+ rescue LoadError
+ # RVM is unavailable at this point.
+ raise "RVM ruby lib is currently unavailable."
+ end
+end
+
+ENV['BUNDLE_GEMFILE'] = File.expand_path('../Gemfile', File.dirname(__FILE__))
+require 'bundler/setup'
+
| Add setup file for RVM + Passenger integration across restarts (thanks @raquelgb for the link)
|
diff --git a/cookbooks/rs_utils/recipes/setup_timezone.rb b/cookbooks/rs_utils/recipes/setup_timezone.rb
index abc1234..def5678 100644
--- a/cookbooks/rs_utils/recipes/setup_timezone.rb
+++ b/cookbooks/rs_utils/recipes/setup_timezone.rb
@@ -23,7 +23,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# Set the Timezone
-if node.rs_utils.timezone != ""
+unless node.rs_utils.timezone.nil? || node.rs_utils.timezone == ''
link "/etc/localtime" do
to "/usr/share/zoneinfo/#{node[:rs_utils][:timezone]}"
@@ -36,5 +36,4 @@ # If this attribute is not set leave unchanged and use localtime
log "rs_utils/timezone set to localtime. Not changing /etc/localtime..."
-end
-
+end | Test using unless for logic.
|
diff --git a/features/support/env.rb b/features/support/env.rb
index abc1234..def5678 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -1,6 +1,6 @@ gem 'cucumber'
require 'cucumber'
-gem 'rspec'
+gem 'rspec', '~> 1.3'
require 'spec'
require File.dirname(__FILE__) + "/../../lib/rubigen"
| Fix features when RSpec 2.x is also present on the system
|
diff --git a/Library/Formula/stanford-parser.rb b/Library/Formula/stanford-parser.rb
index abc1234..def5678 100644
--- a/Library/Formula/stanford-parser.rb
+++ b/Library/Formula/stanford-parser.rb
@@ -0,0 +1,27 @@+require 'formula'
+
+class StanfordParser <Formula
+ url 'http://nlp.stanford.edu/software/stanford-parser-2010-02-26.tgz'
+ homepage 'http://nlp.stanford.edu/software/lex-parser.shtml'
+ md5 '25e26c79d221685956d2442592321027'
+ version '1.6.2'
+
+ def shim_script target_script
+ <<-EOS
+#!/bin/bash
+exec "#{libexec}/#{target_script}" $@
+EOS
+ end
+
+ def install
+ libexec.install Dir['*']
+ Dir["#{libexec}/*.csh"].each do |f|
+ f = File.basename(f)
+ (bin+f).write shim_script(f)
+ end
+ end
+
+ def test
+ system "lexparser.csh", "#{libexec}/testsent.txt"
+ end
+end
| Add formula for the Stanford Parser
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
* Install privately to libexec
* Link .csh scripts into bin
* Includes a smoke test
|
diff --git a/config/initializers/redis.rb b/config/initializers/redis.rb
index abc1234..def5678 100644
--- a/config/initializers/redis.rb
+++ b/config/initializers/redis.rb
@@ -4,6 +4,14 @@ # else
# Redis.new :thread_safe => true
# end
-$redis = Redis.connect :thread_safe => true, :url => ENV['REDISTOGO_URL']
+redis_options = { :thread_safe => true }
+
+if Rails.env.production?
+ uri = URI.parse(ENV["REDISTOGO_URL"])
+ redis_options.merge!({ :host => uri.host, :port => uri.port, :password => uri.password })
+end
+
+$redis = Redis.new(redis_options)
+
Minegems::Rack::SubdomainRouter.ensure_consistent_lookup!
Minegems::Rack::SubdomainRouter.ensure_consistent_access! | Use proper Redis configuration for production env
|
diff --git a/no-style-please.gemspec b/no-style-please.gemspec
index abc1234..def5678 100644
--- a/no-style-please.gemspec
+++ b/no-style-please.gemspec
@@ -2,7 +2,7 @@
Gem::Specification.new do |spec|
spec.name = "no-style-please"
- spec.version = "0.1.5"
+ spec.version = "0.1.6"
spec.authors = ["Riccardo Graziosi"]
spec.email = ["riccardo.graziosi97@gmail.com"]
| Update gem version in gemspec
|
diff --git a/lib/selenium/webdriver/common/element_mini.rb b/lib/selenium/webdriver/common/element_mini.rb
index abc1234..def5678 100644
--- a/lib/selenium/webdriver/common/element_mini.rb
+++ b/lib/selenium/webdriver/common/element_mini.rb
@@ -6,13 +6,13 @@ class Element
# Click in a way that is reliable for IE and works for other browsers as well
- def ie_safe_click
+ def browser_safe_click
bridge.browser == :internet_explorer ? send_keys(:enter) : click
end
- # Click in a way that is reliable for IE and works for other browsers as well
- def ie_safe_checkbox_click
- bridge.browser == :internet_explorer ? send_keys(:space) : click
+ # Click in a way that is reliable for IE and Firefox and works for other browsers as well
+ def browser_safe_checkbox_click
+ (bridge.browser == :internet_explorer || bridge.browser == :firefox) ? send_keys(:space) : click
end
end
| [JT][111704448] Rename monkey patch methods, add firefox to checkbox click method
|
diff --git a/test/session_test/activation_test.rb b/test/session_test/activation_test.rb
index abc1234..def5678 100644
--- a/test/session_test/activation_test.rb
+++ b/test/session_test/activation_test.rb
@@ -7,7 +7,6 @@ assert UserSession.activated?
Authlogic::Session::Base.controller = nil
assert !UserSession.activated?
- debugger
end
def test_controller
| Remove debugger call in test
|
diff --git a/CDYObjectModel.podspec b/CDYObjectModel.podspec
index abc1234..def5678 100644
--- a/CDYObjectModel.podspec
+++ b/CDYObjectModel.podspec
@@ -10,6 +10,6 @@
spec.subspec 'Core' do |ss|
ss.platform = :ios, '6.0'
- ss.source_files = 'CDYObjectModel/Core/*.{h,m}'
+ ss.source_files = 'Core/*.{h,m}'
end
end | Correct files location in spec
|
diff --git a/spec/routing/users_routing_spec.rb b/spec/routing/users_routing_spec.rb
index abc1234..def5678 100644
--- a/spec/routing/users_routing_spec.rb
+++ b/spec/routing/users_routing_spec.rb
@@ -27,6 +27,10 @@ expect(:post => "/login").to route_to("users#login")
end
+ it "routes to #signup" do
+ expect(:post => "/signup").to route_to("users#signup")
+ end
+
it "routes to #logout" do
expect(:post => "/logout").to route_to("users#logout")
end
| Add route test for signup.
|
diff --git a/prefnerd.gemspec b/prefnerd.gemspec
index abc1234..def5678 100644
--- a/prefnerd.gemspec
+++ b/prefnerd.gemspec
@@ -1,13 +1,18 @@-# coding: utf-8
-
Gem::Specification.new do |spec|
spec.name = 'prefnerd'
spec.version = '0.1'
spec.authors = ['Greg Hurrell']
spec.email = ['greg@hurrell.net']
- spec.summary = %q{TODO: Write a short summary. Required.}
- spec.description = %q{}
+ spec.summary = %q{Monitors the OS X defaults database for changes}
+ spec.description = %q{
+ Are you an OS X prefnerd? Do you keep a base set of OS X preferences in
+ version control to make it easier to set up new machines? Do you want to
+ know which items are being changed, and to what values, whenever you alter a
+ setting on OS X? The prefnerd gem contains a simple executable that watches
+ the defaults database for changes and prints them to your terminal.
+ }
spec.license = 'MIT'
+ spec.requirements = ['The fswatch executable']
spec.files = Dir['bin/*']
spec.executables = ['pn']
| Add summary and description to gemspec
|
diff --git a/app/helpers/alexa_utterance_helper.rb b/app/helpers/alexa_utterance_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/alexa_utterance_helper.rb
+++ b/app/helpers/alexa_utterance_helper.rb
@@ -0,0 +1,24 @@+module AlexaUtteranceHelper
+
+ def random_utterance
+ @sample_utterances = [
+ "Alexa, ask Wing It for something to do",
+ "Alexa, ask Wing It what is going on tonight",
+ "Alexa, I want to do something with Wing It",
+ "Alexa, Wing It",
+ "Alexa, run Wing It",
+ "Alexa, let's Wing It.",
+ "Alexa, I want to Wing It",
+ "Alexa, Wing It with me"
+ ]
+ @sample_utterances.sample
+ end
+
+ # builds response & speech for when user asks for help
+ def ask_help
+ response = AlexaRubykit::Response.new
+ response.add_speech("Try asking: #{random_utterance}")
+ response.build_response
+ end
+
+end | Add helper method with a response when user asks for help
|
diff --git a/app/controllers/callbacks_controller.rb b/app/controllers/callbacks_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/callbacks_controller.rb
+++ b/app/controllers/callbacks_controller.rb
@@ -1,6 +1,16 @@ # frozen_string_literal: true
class CallbacksController < Devise::OmniauthCallbacksController
def facebook
+ handle_oauth_callback
+ end
+
+ def google_oauth2
+ handle_oauth_callback
+ end
+
+ private
+
+ def handle_oauth_callback
if oauth_user.valid?
sign_in_and_redirect
else
@@ -8,12 +18,6 @@ redirect_to new_user_registration_path, alert: flash_message
end
end
-
- def google_oauth2
- sign_in_and_redirect
- end
-
- private
def flash_message
if oauth_user.errors.keys.include?(:email)
| Add missing logic to google_oauth2 callback
|
diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/dashboard_controller.rb
+++ b/app/controllers/dashboard_controller.rb
@@ -3,9 +3,7 @@ def index
return unless current_user
gon_user
- gon.push(users_for_select: users_for_select,
- notice: flash[:notice],
- alert: flash[:alert])
+ gon.push(users_for_select: users_for_select)
end
private
| Remove notice and alert from `gon`
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.