diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
---|---|
diff --git a/core/db/default/spree/zones.rb b/core/db/default/spree/zones.rb
index abc1234..def5678 100644
--- a/core/db/default/spree/zones.rb
+++ b/core/db/default/spree/zones.rb
@@ -1,7 +1,7 @@ eu_vat = Spree::Zone.find_or_create_by!(name: "EU_VAT", description: "Countries that make up the EU VAT zone.")
north_america = Spree::Zone.find_or_create_by!(name: "North America", description: "USA + Canada")
-%w(PL FI PT RO DE FR SK HU SI IE AT ES IT BE SE LV BG GB LT CY LU MT DK NL EE).
+%w(PL FI PT RO DE FR SK HU SI IE AT ES IT BE SE LV BG GB LT CY LU MT DK NL EE HR CZ GR).
each do |symbol|
eu_vat.zone_members.create!(zoneable: Spree::Country.find_by!(iso: symbol))
end
|
Add Croatia, Czech Republic and Greece to EU_VAT
This change was already merged on Sep 17, 2015:
e645b8c6d318b639bb3bbc5d507c6212565fb1a
But was overwritten/lost by commit on Dec 3, 2015:
b08f40eefe670ad07dc0019f8ba7c49d6ab4dcc4
|
diff --git a/ffi-proj4.gemspec b/ffi-proj4.gemspec
index abc1234..def5678 100644
--- a/ffi-proj4.gemspec
+++ b/ffi-proj4.gemspec
@@ -18,7 +18,7 @@ s.require_paths = ["lib"]
s.add_dependency("ffi", [">= 1.0.0"])
- s.add_dependency("rdoc")
- s.add_dependency("rake", ["~> 0.9"])
+ s.add_development_dependency("rdoc")
+ s.add_development_dependency("rake", ["~> 0.9"])
end
|
Make these gems into development dependencies.
|
diff --git a/app/controllers/api/jwts_controller.rb b/app/controllers/api/jwts_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/jwts_controller.rb
+++ b/app/controllers/api/jwts_controller.rb
@@ -1,7 +1,8 @@ class Api::JwtsController < Api::ApiApplicationController
def show
- token = AuthToken.issue_token({ user_id: current_user.id })
+ old_token_attrs = decoded_jwt_token(request)&.except("iat", "exp", "aud")
+ token = AuthToken.issue_token(old_token_attrs)
respond_to do |format|
format.json { render json: { jwt: token } }
end
|
Refresh JWT with existing jwt data
When a JWT is refreshed, we currently loose all the custom data that was added to it.
This fixes it so all existing data is kept in the refreshed JWT.
|
diff --git a/db/migrate/20120524151543_ensure_documents_can_only_belong_to_a_single_organisation.rb b/db/migrate/20120524151543_ensure_documents_can_only_belong_to_a_single_organisation.rb
index abc1234..def5678 100644
--- a/db/migrate/20120524151543_ensure_documents_can_only_belong_to_a_single_organisation.rb
+++ b/db/migrate/20120524151543_ensure_documents_can_only_belong_to_a_single_organisation.rb
@@ -9,9 +9,11 @@ AND duplicates.id < document_organisations.id)
}).collect {|x| x["id"]}
- execute %{
- DELETE FROM document_organisations WHERE id IN (#{ids.join(", ")})
- }
+ unless ids.empty?
+ execute %{
+ DELETE FROM document_organisations WHERE id IN (#{ids.join(", ")})
+ }
+ end
# Prevent future duplicates
remove_index :document_organisations, :document_id
|
Fix data-correction migration to work where no data needs fixing.
|
diff --git a/app/models/member.rb b/app/models/member.rb
index abc1234..def5678 100644
--- a/app/models/member.rb
+++ b/app/models/member.rb
@@ -23,8 +23,8 @@ # TODO: only required for ISIC
validates :phone, :presence => true
- def serializable_hash(options = {})
- super(options.merge({
+ def serializable_hash(options = nil)
+ super((options || {}).merge({
:except => [:club_id]
}))
end
|
Revert "this code makes more sense imo"
This reverts commit bbf58114408dc5d9c6c0e2a92b7464cfdb7d2353.
|
diff --git a/app/inputs/rich_picker_input.rb b/app/inputs/rich_picker_input.rb
index abc1234..def5678 100644
--- a/app/inputs/rich_picker_input.rb
+++ b/app/inputs/rich_picker_input.rb
@@ -15,7 +15,13 @@ input_wrapping do
label_html <<
- builder.text_field(method, local_input_options.merge(input_html_options)) <<
+ if editor_options[:hidden_input]
+ field = builder.hidden_field(method, local_input_options.merge(input_html_options))
+ else
+ field = builder.hidden_field(method, local_input_options.merge(input_html_options))
+ end
+
+ field <<
" <a href='#{Rich.editor[:richBrowserUrl]}' class='button'>#{I18n.t('picker_browse')}</a>".html_safe <<
"</br></br><img class='rich-image-preview' src='#{@object.send(method)}' style='height: 100px' />".html_safe <<
"<script>$(function(){$('##{input_html_options[:id]}_input a').click(function(e){ e.preventDefault(); assetPicker.showFinder('##{input_html_options[:id]}', #{editor_options.to_json.html_safe})})})</script>".html_safe
|
Add :hidden_field config option for the input to use a hidden field instead of text_field
|
diff --git a/config/deploy.rb b/config/deploy.rb
index abc1234..def5678 100644
--- a/config/deploy.rb
+++ b/config/deploy.rb
@@ -5,7 +5,7 @@ set :host, "wompt.com"
set :scm, :git
-set :repository, "[email protected]:abtinf/wompt.git"
+set :repository, "[email protected]:Wompt/wompt.com.git"
set :git_enable_submodules, true
set :deploy_via, :remote_cache
|
Change git repo to wompt/wompt.com
|
diff --git a/config/deploy.rb b/config/deploy.rb
index abc1234..def5678 100644
--- a/config/deploy.rb
+++ b/config/deploy.rb
@@ -23,6 +23,7 @@ end
end
+set :deploy_via, :export
namespace :rake do
desc "Generate a sitemap on a remote server."
|
Make Capistrano take longer, by doing an export
Former-commit-id: ad47e44e2e7b57de2900fd01bf33b69e5598c2b8
|
diff --git a/app/graphql/types/query_type.rb b/app/graphql/types/query_type.rb
index abc1234..def5678 100644
--- a/app/graphql/types/query_type.rb
+++ b/app/graphql/types/query_type.rb
@@ -3,19 +3,13 @@ # Add root-level fields here.
# They will be entry points for queries on your schema.
- field :lives, LiveType.connection_type, null: false, max_page_size: 30do
- argument :year, Int, required: false, description: 'Returns lives that held in the year'
- end
+ field :lives, LiveType.connection_type, null: false, max_page_size: 30
field :live, LiveType, null: false do
argument :id, ID, required: true
end
- def lives(year: nil)
- if year
- Live.published.nendo(year).newest_order
- else
- Live.published.newest_order
- end
+ def lives
+ Live.published.newest_order
end
def live(id:)
|
Remove arg `year` from graphql `lives` query
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,7 +1,11 @@ Rails.application.routes.draw do
- devise_for :users, path: 'user'
+ devise_for :users, path: 'user', :skip => [:registrations]
+ as :user do
+ get 'users/edit' => 'devise/registrations#edit', :as => 'edit_user_registration'
+ put 'users' => 'devise/registrations#update', :as => 'user_registration'
+ end
get 'dashboard' => 'dashboard#show', as: :dashboard
resources :keywords
|
Add back some registrations paths to allow users to update themselves
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -20,7 +20,7 @@ get :search_relatable_items, constraints: { format: :json }
end
end
-
+
resources :tags do
member do
put :publish
@@ -28,4 +28,6 @@ end
root :to => redirect("/artefacts")
+
+ mount GovukAdminTemplate::Engine, at: "/style-guide"
end
|
Include admin template style guide
* Keep a reference to admin design patterns
* Show how local styles may have affected those patterns
|
diff --git a/Casks/acorn3.rb b/Casks/acorn3.rb
index abc1234..def5678 100644
--- a/Casks/acorn3.rb
+++ b/Casks/acorn3.rb
@@ -2,8 +2,8 @@ version '3.5.2'
sha256 'ffc4cd551b9eb2ebadfe8e59c95e84b1f59538d7915eff63dd6c3efdca7858e6'
- url "http://flyingmeat.com/download/Acorn-#{version}.zip"
- homepage 'http://flyingmeat.com/acorn/'
+ url "https://secure.flyingmeat.com/download/Acorn-#{version}.zip"
+ homepage 'https://secure.flyingmeat.com/acorn/'
license :closed
app 'Acorn.app'
|
Update Acorn3 URL and hompage
|
diff --git a/Casks/bitpim.rb b/Casks/bitpim.rb
index abc1234..def5678 100644
--- a/Casks/bitpim.rb
+++ b/Casks/bitpim.rb
@@ -2,6 +2,7 @@ version '1.0.7'
sha256 '567d41ececc8c416746c3aa9365182797b339001d255dc4da7acc285bb289880'
+ # sourceforge.net/project/bitpim was verified as official when first introduced to the cask
url "http://downloads.sourceforge.net/project/bitpim/bitpim/#{version}/LEOPARD-bitpim-#{version}.dmg"
name 'BitPim'
homepage 'http://www.bitpim.org/'
|
Fix `url` stanza comment for BitPim.
|
diff --git a/Casks/marked.rb b/Casks/marked.rb
index abc1234..def5678 100644
--- a/Casks/marked.rb
+++ b/Casks/marked.rb
@@ -9,5 +9,7 @@ homepage 'http://marked2app.com'
license :commercial
+ auto_updates true
+
app 'Marked 2.app'
end
|
Add auto_updates flag to Marked
|
diff --git a/plugins/docker/check-container.rb b/plugins/docker/check-container.rb
index abc1234..def5678 100644
--- a/plugins/docker/check-container.rb
+++ b/plugins/docker/check-container.rb
@@ -0,0 +1,59 @@+#!/usr/bin/env ruby
+#
+# Checks that a given Docker container is running
+# ===
+#
+# This is a simple check script for Sensu to check that a Docker container is
+# running. You can pass in either a container id or a container name.
+#
+# EXAMPLES:
+#
+# check-docker-container.rb c92d402a5d14
+# CheckDockerContainer OK
+#
+# check-docker-container.rb circle_burglar
+# CheckDockerContainer CRITICAL: circle_burglar is not running on the host
+#
+# OUTPUT:
+# plain-text
+#
+# => State.running == true -> OK
+# => State.running == false -> CRITICAL
+# => Not Found -> CRITICAL
+# => Can't connect to Docker -> WARNING
+# => Other exception -> WARNING
+#
+# DEPENDENCIES:
+# sensu-plugin Ruby gem
+# docker-api Ruby gem
+#
+
+require 'rubygems' if RUBY_VERSION < '1.9.0'
+require 'sensu-plugin/check/cli'
+require 'docker'
+
+class CheckDockerContainer < Sensu::Plugin::Check::CLI
+ option :url,
+ short: '-u DOCKER_HOST',
+ long: '--host DOCKER_HOST',
+ default: "tcp://127.0.0.1:4243/"
+
+ def run
+ Docker.url = "#{config[:url]}"
+
+ id = argv.first
+ container = Docker::Container.get(id)
+
+ if container.info["State"]["Running"]
+ ok
+ else
+ critical "#{id} is not running"
+ end
+ rescue Docker::Error::NotFoundError
+ critical "#{id} is not running on the host"
+ rescue Excon::Errors::SocketError
+ warning "unable to connect to Docker"
+ rescue => e
+ warning "unknown error #{e.inspect}"
+ end
+end
|
Add a check to verify a Docker container is running
|
diff --git a/plugins/interview_gear_scanner.rb b/plugins/interview_gear_scanner.rb
index abc1234..def5678 100644
--- a/plugins/interview_gear_scanner.rb
+++ b/plugins/interview_gear_scanner.rb
@@ -18,7 +18,7 @@ [:before_post_write]
end
- def process(event, interview, &block)
+ def process(event, interview)
case event
when :before_post_write
links = ''
|
Remove the block from the process method
|
diff --git a/db/migrate/20190212150445_change_agreement_transaction_id_to_bigint.rb b/db/migrate/20190212150445_change_agreement_transaction_id_to_bigint.rb
index abc1234..def5678 100644
--- a/db/migrate/20190212150445_change_agreement_transaction_id_to_bigint.rb
+++ b/db/migrate/20190212150445_change_agreement_transaction_id_to_bigint.rb
@@ -0,0 +1,13 @@+class ChangeAgreementTransactionIdToBigint < ActiveRecord::Migration[6.0]
+ def up
+ change_column :agreement_transactions, :id, :bigint
+
+ change_column :agreement_transaction_audits, :agreement_transaction_id, :bigint
+ end
+
+ def down
+ change_column :agreement_transactions, :id, :integer
+
+ change_column :agreement_transaction_audits, :agreement_transaction_id, :integer
+ end
+end
|
Update agreement_transaction_id primary and foreign keys to bigint
|
diff --git a/spec/unit/client_spec.rb b/spec/unit/client_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/client_spec.rb
+++ b/spec/unit/client_spec.rb
@@ -0,0 +1,78 @@+require "spec_helper"
+
+module Vault
+ describe Client do
+ let(:client) { subject }
+
+ context "configuration" do
+ it "is a configurable object" do
+ expect(client).to be_a(Configurable)
+ end
+
+ it "users the default configuration" do
+ Defaults.options.each do |key, value|
+ expect(client.send(key)).to eq(value)
+ end
+ end
+
+ it "uses the values in the initializer" do
+ client = described_class.new(address: "http://new.address")
+ expect(client.address).to eq("http://new.address")
+ end
+
+ it "can be modified after initialization" do
+ expect(client.address).to eq(Defaults.address)
+ client.address = "http://new.address"
+ expect(client.address).to eq("http://new.address")
+ end
+ end
+
+ describe "#get" do
+ it "delegates to the #request method" do
+ expect(subject).to receive(:request).with(:get, "/foo", {}, {})
+ subject.get("/foo")
+ end
+ end
+
+ describe "#post" do
+ let(:data) { double }
+
+ it "delegates to the #request method" do
+ expect(subject).to receive(:request).with(:post, "/foo", data, {})
+ subject.post("/foo", data)
+ end
+ end
+
+ describe "#put" do
+ let(:data) { double }
+
+ it "delegates to the #request method" do
+ expect(subject).to receive(:request).with(:put, "/foo", data, {})
+ subject.put("/foo", data)
+ end
+ end
+
+ describe "#patch" do
+ let(:data) { double }
+
+ it "delegates to the #request method" do
+ expect(subject).to receive(:request).with(:patch, "/foo", data, {})
+ subject.patch("/foo", data)
+ end
+ end
+
+ describe "#delete" do
+ it "delegates to the #request method" do
+ expect(subject).to receive(:request).with(:delete, "/foo", {}, {})
+ subject.delete("/foo")
+ end
+ end
+
+ describe "#to_query_string" do
+ it "converts spaces to + characters" do
+ params = { emoji: "sad panda" }
+ expect(subject.to_query_string(params)).to eq("emoji=sad+panda")
+ end
+ end
+ end
+end
|
Add unit tests for client
|
diff --git a/business.gemspec b/business.gemspec
index abc1234..def5678 100644
--- a/business.gemspec
+++ b/business.gemspec
@@ -23,5 +23,5 @@ spec.add_development_dependency "gc_ruboconfig", "~> 2.23.0"
spec.add_development_dependency "rspec", "~> 3.1"
spec.add_development_dependency "rspec_junit_formatter", "~> 0.4.1"
- spec.add_development_dependency "rubocop", "~> 1.8.0"
+ spec.add_development_dependency "rubocop", "~> 1.9.1"
end
|
Update rubocop requirement from ~> 1.8.0 to ~> 1.9.1
Updates the requirements on [rubocop](https://github.com/rubocop-hq/rubocop) to permit the latest version.
- [Release notes](https://github.com/rubocop-hq/rubocop/releases)
- [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop-hq/rubocop/compare/v1.8.0...v1.9.1)
Signed-off-by: dependabot-preview[bot] <[email protected]>
|
diff --git a/test/fixtures/cookbooks/selenium_test/recipes/node.rb b/test/fixtures/cookbooks/selenium_test/recipes/node.rb
index abc1234..def5678 100644
--- a/test/fixtures/cookbooks/selenium_test/recipes/node.rb
+++ b/test/fixtures/cookbooks/selenium_test/recipes/node.rb
@@ -4,15 +4,14 @@
capabilities = []
-unless platform?('debian')
- include_recipe 'mozilla_firefox'
- capabilities << {
- browserName: 'firefox',
- maxInstances: 5,
- version: firefox_version,
- seleniumProtocol: 'WebDriver'
- }
-end
+include_recipe 'mozilla_firefox'
+
+capabilities << {
+ browserName: 'firefox',
+ maxInstances: 5,
+ version: firefox_version,
+ seleniumProtocol: 'WebDriver'
+}
node.override['selenium']['node']['capabilities'] = capabilities
node.override['selenium']['node']['username'] = node['selenium_test']['username']
|
Allow firefox install on debian platform
|
diff --git a/event_store-messaging.gemspec b/event_store-messaging.gemspec
index abc1234..def5678 100644
--- a/event_store-messaging.gemspec
+++ b/event_store-messaging.gemspec
@@ -2,7 +2,7 @@ Gem::Specification.new do |s|
s.name = 'event_store-messaging'
s.summary = 'Messaging primitives for EventStore using the EventStore Client HTTP library'
- s.version = '0.1.17'
+ s.version = '0.1.18'
s.authors = ['']
s.require_paths = ['lib']
s.files = Dir.glob('{lib}/**/*')
|
Package version is increased from 0.1.17 to 0.1.18
|
diff --git a/lita-hipchat.gemspec b/lita-hipchat.gemspec
index abc1234..def5678 100644
--- a/lita-hipchat.gemspec
+++ b/lita-hipchat.gemspec
@@ -13,7 +13,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
- spec.add_runtime_dependency "lita", "~> 2.0"
+ spec.add_runtime_dependency "lita", ">=2.0"
spec.add_runtime_dependency "xmpp4r", "~> 0.5"
spec.add_development_dependency "bundler", "~> 1.3"
|
Support newer versions of lita
|
diff --git a/test/retry_queue_test.rb b/test/retry_queue_test.rb
index abc1234..def5678 100644
--- a/test/retry_queue_test.rb
+++ b/test/retry_queue_test.rb
@@ -13,4 +13,13 @@
perform_next_job(@worker)
end
+
+ def test_retry_delayed_failed_jobs_in_dynamic_queue
+ queue_name = "dynamic_queue_#{Time.now.to_i}"
+
+ Resque.enqueue(JobWithDynamicRetryQueue, queue_name)
+ Resque.expects(:enqueue_in_with_queue).with(queue_name, 1, JobWithDynamicRetryQueue, queue_name)
+
+ perform_next_job(@worker)
+ end
end
|
Test for specifying retry queue dynamically
|
diff --git a/Casks/appium.rb b/Casks/appium.rb
index abc1234..def5678 100644
--- a/Casks/appium.rb
+++ b/Casks/appium.rb
@@ -1,6 +1,6 @@ cask :v1 => 'appium' do
- version '1.3.5'
- sha256 '88fb3d798e3a28452d8477f78d182b035116dcd1569e444bdf08603c927b73d7'
+ version '1.3.6'
+ sha256 '76bc810e07aa629f4dbf07c37d46e7a94b61fa7ab128f8c9e763ad0d8e19e62b'
# bitbucket.org is the official download host per the vendor homepage
url "https://bitbucket.org/appium/appium.app/downloads/appium-#{version}.dmg"
|
Update Appium version to 1.3.6
This commit updates the version variable and the download SHA
|
diff --git a/Casks/openlp.rb b/Casks/openlp.rb
index abc1234..def5678 100644
--- a/Casks/openlp.rb
+++ b/Casks/openlp.rb
@@ -1,10 +1,11 @@ class Openlp < Cask
- version '2.0.4'
- sha256 '24850da1e2d75b17d76cf102721d4c5e56d8faaa97ce1194577264c8edc6cc70'
+ version '2.0.5'
+ sha256 '0ba5a37c359394c277e221f8ca74191d3425cf3cfbd70699d81346c77c93d746'
- url "http://builds.openlp.org/OpenLP-#{version}.dmg"
+ # sourceforge is the official download host per the vendor homepage
+ url "http://downloads.sourceforge.net/project/openlp/openlp/#{version}/OpenLP-#{version}.dmg"
homepage 'http://openlp.org'
- license :unknown
+ license :gpl
app 'OpenLP.app'
end
|
Fix OpenLP.app & upgrade to 2.0.5
Closes #7310.
|
diff --git a/Casks/vienna.rb b/Casks/vienna.rb
index abc1234..def5678 100644
--- a/Casks/vienna.rb
+++ b/Casks/vienna.rb
@@ -1,12 +1,18 @@ cask :v1 => 'vienna' do
- version '3.0.0'
- sha256 'e61f44b7be0f1f49cf6c735d8e03071141ddaca1d5ff65db29f786ee3dfeded3'
+ version '3.0.1'
+ sha256 'f6f89ebdf76b120fea7fa4b18ce26f2d79fd789492c98452ab3b6ab0f7939a19'
url "https://downloads.sourceforge.net/vienna-rss/Vienna#{version}.tgz"
- appcast 'http://vienna-rss.org/changelog_beta.xml',
- :sha256 => '20ae887cd3d0f8b97cd133cd32454fdb8796e72f2de2a0e12fe288c7358f7e31'
+ appcast 'http://vienna-rss.org/changelog.xml',
+ :sha256 => 'e0b95e383d348a15e4e5fe806c99188983acd9bb92566f0b6277789fec7579b9'
homepage 'http://www.vienna-rss.org'
- license :oss
+ license :apache
app 'Vienna.app'
+
+ zap :delete => [
+ '~/Library/Application Support/Vienna',
+ '~/Library/Caches/uk.co.opencommunity.vienna2',
+ '~/Library/Preferences/uk.co.opencommunity.vienna2.plist',
+ ]
end
|
Upgrade Vienna.app to v3.0.1 and add zap support
|
diff --git a/bots/digg_scraper.rb b/bots/digg_scraper.rb
index abc1234..def5678 100644
--- a/bots/digg_scraper.rb
+++ b/bots/digg_scraper.rb
@@ -0,0 +1,46 @@+#!/usr/bin/ruby
+
+require 'rubygems'
+require 'open-uri'
+require 'hpricot'
+
+def BuildURL(query, pagenumber)
+ return "http://digg.com/search/page" + pagenumber.to_s() + "?s=" + query + "&area=promoted&type=both&search-buried=0&sort=score§ion=all"
+end
+
+def GetURLS(query)
+ maxPage = 0
+ url = BuildURL(query, 1)
+ response = open(url, "User-Agent" => "Ruby/#[RUBY_VERSION]")
+ doc = Hpricot( response )
+ (doc/"a").each do |x|
+ if x['href="search']
+ puts x
+ end
+ end
+
+ # Now we create an array of urls we need to gather
+ urls = Array.new
+ for i in 1..maxPage
+ urls << BuildURL(i)
+ end
+
+ return urls
+end
+
+def GetArticles(url)
+ html = Hpricot(Request(url))
+ html.search("//a").each do |article|
+ if(article['rel'] == "dc:source")
+ url = item['href']
+ title = item.inner_text.gsub(/view!|watch!/, '').strip # Removes "view!" and "watch!" from the end of image/video titles and remove whitespace either side of title
+ puts "%s\n%s\n----------" % [name, url] # Print out what we found neatly
+ end
+ end
+end
+
+urls = GetURLS("penguin")
+urls.each do |url|
+ GetArticles(url)
+end
+
|
Add a digg scraping tool. WARNING: Currently does not work!
|
diff --git a/core/app/helpers/form_helper.rb b/core/app/helpers/form_helper.rb
index abc1234..def5678 100644
--- a/core/app/helpers/form_helper.rb
+++ b/core/app/helpers/form_helper.rb
@@ -1,7 +1,7 @@ module FormHelper
def possible_error_for_field(resource, fieldname)
if resource.errors[fieldname].any?
- content = resource.errors[fieldname].join(", ")
+ content = resource.errors[fieldname].join("; ")
content_tag :div, content, class: 'text-error'
end
|
Use semicolon to separate error messages.
|
diff --git a/core/string/try_convert_spec.rb b/core/string/try_convert_spec.rb
index abc1234..def5678 100644
--- a/core/string/try_convert_spec.rb
+++ b/core/string/try_convert_spec.rb
@@ -15,7 +15,7 @@ String.try_convert(obj).should equal(str)
end
- it "returns nil when there is no :to_ary" do
+ it "returns nil when there is no :to_str" do
String.try_convert(-1).should be_nil
end
@@ -33,4 +33,4 @@ }.should raise_error(TypeError)
end
end
-end+end
|
String.try_convert: Fix typo: :to_ary -> :to_str
|
diff --git a/main.rb b/main.rb
index abc1234..def5678 100644
--- a/main.rb
+++ b/main.rb
@@ -21,17 +21,23 @@ svs = MultiJson.load(ENV["VCAP_SERVICES"])
uri = svs["rabbitmq-1.0"].first["credentials"]["uri"]
conn = Bunny.new(uri)
- conn.start
+ begin
+ conn.start
- ch = conn.create_channel
- q = ch.queue("", :exclusive => true)
+ ch = conn.create_channel
+ q = ch.queue("", :exclusive => true)
- erb :rabbitmq_service, :locals => {
- :healthy => true,
- :connection => conn,
- :channel => ch,
- :queue => q
- }
+ erb :rabbitmq_service, :locals => {
+ :healthy => true,
+ :connection => conn,
+ :channel => ch,
+ :queue => q
+ }
+ rescue Bunny::PossibleAuthenticationFailureError => e
+ erb :rabbitmq_service, :locals => {
+ :healthy => false
+ }
+ end
else
erb :rabbitmq_service, :locals => {
:healthy => false
|
Handle authentication failures more gracefully
|
diff --git a/samples/contrib/collections_demo.rb b/samples/contrib/collections_demo.rb
index abc1234..def5678 100644
--- a/samples/contrib/collections_demo.rb
+++ b/samples/contrib/collections_demo.rb
@@ -0,0 +1,61 @@+#!/usr/bin/env jruby
+=begin
+Original Java source from: http://docs.oracle.com/javafx/2/collections/jfxpub-collections.htm
+/*
+ * Copyright (c) 2011, 2012 Oracle and/or its affiliates.
+ * All rights reserved. Use is subject to license terms.
+ *
+ * This file is available and licensed under the following license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the distribution.
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+=end
+
+require 'jrubyfx'
+
+# Example for an ObservableList
+list = []
+observable_list = FXCollections.observable_list(list)
+observable_list.add_change_listener do
+ puts "Detected a change!"
+end
+
+observable_list << "item one"
+list << "item two"
+
+puts "Size: #{observable_list.size}"
+
+# Example for an ObservableMap
+my_map = java.util.HashMap.new
+ob_map = FXCollections.observable_map(my_map)
+ob_map.add_change_listener do
+ puts "Detected a change!"
+end
+
+ob_map[:key_1] = "value 1"
+my_map[:key_2] = "value 2"
+
+puts "Size: #{ob_map.size}"
|
Add of JavaFX Collections example
|
diff --git a/spec/tag_spec.rb b/spec/tag_spec.rb
index abc1234..def5678 100644
--- a/spec/tag_spec.rb
+++ b/spec/tag_spec.rb
@@ -0,0 +1,47 @@+require "rspec"
+require "gmail/tag"
+
+class DataError < Exception; end
+
+describe Tag do
+
+ before(:all) do
+ @tags = [ "Perso", "Perso/Foo" ]
+ @tag1 = Tag.new(@tags[0])
+ @tag2 = Tag.new(@tags[1])
+ end
+
+ describe "#initialize" do
+
+ it "should raise an exception if @tag is nil" do
+ expect{@tag = Tag.new}.to raise_error(ArgumentError)
+ end
+
+ it "should create a @tag object" do
+ @tag1.should_not be_nil
+ @tag2.should_not be_nil
+ @tag1.should be_an_instance_of(Tag)
+ @tag2.should be_an_instance_of(Tag)
+ end
+
+ it "should have a label member" do
+ @tag1.label.should be_instance_of(String)
+ @tag2.label.should be_instance_of(String)
+ end
+
+ it "should have the right label value" do
+ @tag1.label.should == "Perso"
+ @tag2.label.should == "Perso/Foo"
+ end
+ end
+
+ describe "#normalize" do
+ it "should keep the right value if no '/'" do
+ @tag1.normalize.should == "Perso"
+ end
+
+ it "should convert '/' into '-'" do
+ @tag2.normalize.should == "Perso-Foo"
+ end
+ end
+end
|
Add specs for class Tag.
|
diff --git a/rails-embryo.gemspec b/rails-embryo.gemspec
index abc1234..def5678 100644
--- a/rails-embryo.gemspec
+++ b/rails-embryo.gemspec
@@ -12,7 +12,7 @@ s.required_rubygems_version = ">= 1.3.6"
s.files = Dir.glob("lib/**/*") + ["README.md", "History.md", "License.txt"]
s.require_path = "lib"
- s.add_dependency "rails", "4.1.1"
+ s.add_dependency "rails", ">= 4.1.1"
s.add_development_dependency "rspec", "~> 3.0.0"
s.add_development_dependency "rake", "~> 0"
end
|
Make Rails version dependency open-ended
|
diff --git a/rakelib/metrics.rake b/rakelib/metrics.rake
index abc1234..def5678 100644
--- a/rakelib/metrics.rake
+++ b/rakelib/metrics.rake
@@ -1,7 +1,8 @@ METRICS_FILES = FileList['lib/**/*.rb']
-task :flog do
- sh "flog #{METRICS_FILES}"
+task :flog, [:all] do |t, args|
+ flags = args.all ? "--all" : ""
+ sh "flog #{flags} #{METRICS_FILES}"
end
task :flay do
|
Add optional all flag to flog task.
|
diff --git a/config/initializers/need_api.rb b/config/initializers/need_api.rb
index abc1234..def5678 100644
--- a/config/initializers/need_api.rb
+++ b/config/initializers/need_api.rb
@@ -1,4 +1,4 @@ require 'gds_api/need_api'
Whitehall.need_api = GdsApi::NeedApi.new(Plek.current.find('need-api'),
- token: "XXXXXXXXXX")
+ bearer_token: "XXXXXXXXXX")
|
Fix to the Need API client config
|
diff --git a/plot.rb b/plot.rb
index abc1234..def5678 100644
--- a/plot.rb
+++ b/plot.rb
@@ -0,0 +1,49 @@+require "pry"
+require "json"
+
+def sorted_dup_hash(array)
+ Hash[*array.inject(Hash.new(0)) { |h,e| h[e] += 1; h }.
+ select { |k,v| v > 1 }.inject({}) { |r, e| r[e.first] = e.last; r }.
+ sort_by {|_,v| v}.reverse.flatten]
+end
+
+data = JSON.parse(File.open("summary.json").read.downcase).take(20)
+patterns = data.map { |x| x["pattern"].split(" ").map{|x|x.split(".").first }}
+
+words = []
+data.each do |point|
+ point["count"].times do
+ words += point["pattern"].split(" ").map{|x|x.split(".").first }
+ end
+end
+
+#words = Hash[*sorted_dup_hash(words).map { |k, v| [k, Math::log(v).round(2)] }.flatten]
+words = Hash[*sorted_dup_hash(words).map { |k, v| [k, v] }.flatten]
+nodes = words.map { |k, v| { id: k, value: k, weight: v } }
+
+edges = []
+patterns.each do |pattern|
+ if pattern.size == 2
+ edges << { source: pattern.first, target: pattern.last, label: ""}
+ elsif pattern.size == 3
+ edges << { source: pattern.first, target: pattern.last, label: pattern[1].split(".").first}
+ elsif pattern.size == 4
+ edges << { source: pattern.first, target: pattern[1], label: ""}
+ edges << { source: pattern[1], target: pattern[3], label: pattern[2].split(".").first}
+ elsif pattern.size == 5
+ edges << { source: pattern.first, target: pattern[2], label: pattern[1].split(".").first}
+ edges << { source: pattern[2], target: pattern[4], label: pattern[3].split(".").first}
+ end
+end
+edges.uniq!
+
+in_relationship = []
+edges.each do |e|
+ in_relationship += [e[:source], e[:target]]
+end
+
+nodes.select! { |n| in_relationship.include?(n[:id]) }
+
+nodes.map! { |e| { data: e } }
+edges.map! { |e| { data: e } }
+puts Hash[:elements, { nodes: nodes, edges: edges }].to_json[1..-2]
|
Create simple cytoscape graph processing script
Motivation:
-wanted to view the results visually
Change Explanation:
-format a list of points into data for a http://www.cytoscape.org/
graph
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -12,4 +12,4 @@ resources :public_keys, :controller => 'gitolite_public_keys'
end
-get "gitolite_hook" => "gitolite_hook#index"
+post "gitolite_hook", :to => "gitolite_hook#index"
|
[ROUTES] Use POST method for hook
|
diff --git a/contrib/requirements-warning.rb b/contrib/requirements-warning.rb
index abc1234..def5678 100644
--- a/contrib/requirements-warning.rb
+++ b/contrib/requirements-warning.rb
@@ -1,24 +1,19 @@-DEBUG = false
-
# Get the commits before the merge
# ex. heads = ["<latest commit of master>", "<previous commit of master>", ...]
heads = `git reflog -n 2 | awk '{ print $1 }'`.split
# Make sure our revision history has at least 2 entries
if heads.length < 2
- exit 0
+ exit 0
end
-files = `git diff --name-only #{heads[1]} #{heads[0]} | grep requirements.txt`
-diffFiles = `git diff --name-only #{heads[1]} #{heads[0]} | grep requirements.txt | tr "\n" " "`
-if diffFiles then
+# Get all files that changed
+files = `git diff --name-only #{heads[1]} #{heads[0]}`
+
+# If (dev_)requrements.txt changed, alert the user!
+if /requirements.txt/.match files then
default = "\e[0m"
- red = "\e[31m"
+ red = "\e[31m"
puts "[#{red}requirements-warning.rb hook#{default}]: New python requirements."
- puts "pip install #{diffFiles}"
-
- if DEBUG then
- # Print the diff with 0 lines of context
- puts `git diff -U0 #{heads[1]} #{heads[0]} -- #{diffFiles}`
- end
+ puts "pip install *requirements.txt"
end
|
Fix requirements hook falsy test
|
diff --git a/lib/a_b_plugin/helper.rb b/lib/a_b_plugin/helper.rb
index abc1234..def5678 100644
--- a/lib/a_b_plugin/helper.rb
+++ b/lib/a_b_plugin/helper.rb
@@ -9,7 +9,7 @@ if category || test || extra
Test.new(category, test, extra)
- elsif ABPlugin.tests && Config.url
+ elsif ABPlugin.categories && Config.url
"a_b_setup(#{{
:categories => ABPlugin.categories,
:site => Config.site,
|
Check for ABPlugin.categories instead of tests in Helper
|
diff --git a/search_amazon.rb b/search_amazon.rb
index abc1234..def5678 100644
--- a/search_amazon.rb
+++ b/search_amazon.rb
@@ -15,6 +15,17 @@
def search(key_word)
@search_result = @mechanize.get("#{SEARCH_URL}#{URI.escape(key_word)}"))
+
+ @search_result = @limit.map do |i|
+ product = search_result.css("li#result_#{i}")
+
+ {
+ title: title(product),
+ price: price(product),
+ href: href(product)
+ }
+ end
+ end
private
|
Add scrape from search result
and regained an end
|
diff --git a/lib/crawler_detection.rb b/lib/crawler_detection.rb
index abc1234..def5678 100644
--- a/lib/crawler_detection.rb
+++ b/lib/crawler_detection.rb
@@ -1,5 +1,5 @@ module CrawlerDetection
def self.crawler?(user_agent)
- !/Googlebot|Mediapartners|AdsBot|curl|Twitterbot|facebookexternalhit|bingbot|Baiduspider/.match(user_agent).nil?
+ !/Googlebot|Mediapartners|AdsBot|curl|Twitterbot|facebookexternalhit|bingbot|Baiduspider|ia_archiver/.match(user_agent).nil?
end
end
|
Add archive.org to crawler list to serve no-js to
|
diff --git a/spec/acceptance/acceptance_helper.rb b/spec/acceptance/acceptance_helper.rb
index abc1234..def5678 100644
--- a/spec/acceptance/acceptance_helper.rb
+++ b/spec/acceptance/acceptance_helper.rb
@@ -9,13 +9,14 @@
Capybara.default_driver = :selenium
Capybara.default_wait_time = 10
-Capybara.default_host = APP_CONFIG[:app_host]
-Capybara.app_host = APP_CONFIG[:app_host]
-Capybara.server_port = 53716
-
+Capybara.default_host = APP_CONFIG[:app_host]
+Capybara.app_host = APP_CONFIG[:app_host]
+Capybara.server_port = 53716
+Capybara.register_driver :selenium do |app|
+ Capybara::Driver::Selenium.new(app, :browser => :chrome)
+end
RSpec.configure do |config|
-
config.include Warden::Test::Helpers
config.include Capybara, :type => :acceptance
@@ -27,12 +28,9 @@ case page.driver.class
when Capybara::Driver::RackTest
page.driver.rack_mock_session.clear_cookies
- when Capybara::Driver::Culerity
- page.driver.browser.clear_cookies
when Capybara::Driver::Selenium
page.driver.cleanup!
end
Capybara.use_default_driver
end
-
end
|
Use Chrome as browser in acceptance specs
|
diff --git a/spec/requests/authentication_spec.rb b/spec/requests/authentication_spec.rb
index abc1234..def5678 100644
--- a/spec/requests/authentication_spec.rb
+++ b/spec/requests/authentication_spec.rb
@@ -1,22 +1,9 @@ require "spec_helper"
RSpec.describe "POST /users/sign_in" do
- let(:user) {
- User.create!(
- email: "[email protected]",
- password: "password",
- password_confirmation: "password",
- provider: "email",
- confirmed_at: DateTime.now
- )
- }
+ let(:user) { Factory.create_user }
let(:url) { new_user_session_path }
- let(:headers) {
- {
- "ACCEPT" => "application/json",
- "CONTENT_TYPE" => "application/json",
- }
- }
+ let(:headers) { RequestHelper.json_headers }
let(:params) {
{
user: {
@@ -39,6 +26,7 @@
RSpec.describe "DELETE /users/sign_out", type: :request do
let(:url) { destroy_user_session_path }
+ let(:headers) { RequestHelper.json_headers }
it "returns 204, no content" do
delete(url, headers: headers)
|
Use new helpers in other specs
|
diff --git a/spec/bundler/path_preserver_spec.rb b/spec/bundler/path_preserver_spec.rb
index abc1234..def5678 100644
--- a/spec/bundler/path_preserver_spec.rb
+++ b/spec/bundler/path_preserver_spec.rb
@@ -0,0 +1,54 @@+# frozen_string_literal: true
+require "spec_helper"
+
+describe Bundler::PathPreserver do
+ describe "#preserve_path_in_environment" do
+ subject { described_class.preserve_path_in_environment(env_var, env) }
+
+ context "env_var is PATH" do
+ let(:env_var) { "PATH" }
+ let(:path) { "/path/here" }
+ let(:original_path) { "/original/path/here" }
+
+ context "when _ORIGINAL_PATH in env is nil" do
+ let(:env) { { "ORIGINAL_PATH" => nil, "PATH" => path } }
+
+ it "should set _ORIGINAL_PATH of env to value of PATH from env" do
+ expect(env["_ORIGINAL_PATH"]).to be_nil
+ subject
+ expect(env["_ORIGINAL_PATH"]).to eq("/path/here")
+ end
+ end
+
+ context "when original_path in env is empty" do
+ let(:env) { { "_ORIGINAL_PATH" => "", "PATH" => path } }
+
+ it "should set _ORIGINAL_PATH of env to value of PATH from env" do
+ expect(env["_ORIGINAL_PATH"]).to be_empty
+ subject
+ expect(env["_ORIGINAL_PATH"]).to eq("/path/here")
+ end
+ end
+
+ context "when path in env is nil" do
+ let(:env) { { "_ORIGINAL_PATH" => original_path, "PATH" => nil } }
+
+ it "should set PATH of env to value of _ORIGINAL_PATH from env" do
+ expect(env["PATH"]).to be_nil
+ subject
+ expect(env["PATH"]).to eq("/original/path/here")
+ end
+ end
+
+ context "when path in env is empty" do
+ let(:env) { { "_ORIGINAL_PATH" => original_path, "PATH" => "" } }
+
+ it "should set PATH of env to value of _ORIGINAL_PATH from env" do
+ expect(env["PATH"]).to be_empty
+ subject
+ expect(env["PATH"]).to eq("/original/path/here")
+ end
+ end
+ end
+ end
+end
|
Add unit tests for `Bundler::PathPreserver` module
|
diff --git a/spec/models/section_edition_spec.rb b/spec/models/section_edition_spec.rb
index abc1234..def5678 100644
--- a/spec/models/section_edition_spec.rb
+++ b/spec/models/section_edition_spec.rb
@@ -6,4 +6,24 @@ it 'stores data in the manual_section_editions collection' do
expect(subject.collection.name).to eq('manual_section_editions')
end
+
+ describe 'validation' do
+ it 'is valid if section_id and slug are present' do
+ subject.section_id = 'section-id'
+ subject.slug = 'section-slug'
+ expect(subject).to be_valid
+ end
+
+ it 'is invalid if section_id is missing' do
+ subject.section_id = nil
+ expect(subject).not_to be_valid
+ expect(subject.errors[:section_id]).to include("can't be blank")
+ end
+
+ it 'is invalid if slug is missing' do
+ subject.slug = nil
+ expect(subject).not_to be_valid
+ expect(subject.errors[:slug]).to include("can't be blank")
+ end
+ end
end
|
Add tests for SectionEdition validation
To give me some additional confidence when I come to rename
`SectionEdition#section_id`.
|
diff --git a/exceptions_to_hipchat.gemspec b/exceptions_to_hipchat.gemspec
index abc1234..def5678 100644
--- a/exceptions_to_hipchat.gemspec
+++ b/exceptions_to_hipchat.gemspec
@@ -14,5 +14,5 @@ gem.require_paths = ["lib"]
gem.version = ExceptionsToHipchat::VERSION
- gem.add_dependency("hipchat", "~> 0.4.1")
+ gem.add_dependency("hipchat", "~> 0.8")
end
|
Upgrade hipchat dependency to ~> 0.8
|
diff --git a/db/seeds/routes_from_varnish.rb b/db/seeds/routes_from_varnish.rb
index abc1234..def5678 100644
--- a/db/seeds/routes_from_varnish.rb
+++ b/db/seeds/routes_from_varnish.rb
@@ -12,7 +12,6 @@ backends = {
'canary-frontend' => {'tls' => false},
'licensify' => {'tls' => true},
- 'tariff' => {'tls' => false},
}
backends.each do |name, properties|
@@ -30,9 +29,6 @@
routes = [
%w(/apply-for-a-licence prefix licensify),
-
- %w(/trade-tariff prefix tariff),
-
%w(/__canary__ exact canary-frontend),
]
|
Remove the trade tariff prefix route registration.
This is now handled via trade tariff frontend:
https://github.com/alphagov/trade-tariff-frontend/pull/189
|
diff --git a/turbo-sprockets-rails4.gemspec b/turbo-sprockets-rails4.gemspec
index abc1234..def5678 100644
--- a/turbo-sprockets-rails4.gemspec
+++ b/turbo-sprockets-rails4.gemspec
@@ -7,6 +7,7 @@ s.authors = ['Cameron Dutro']
s.email = ['[email protected]']
s.homepage = 'http://github.com/camertron/turbo-sprockets-rails4'
+ s.license = "MIT"
s.description = s.summary = 'Speed up asset precompliation by compiling assets in parallel.'
|
Add licence declaration to gemspec.
|
diff --git a/lib/rom/http/handlers.rb b/lib/rom/http/handlers.rb
index abc1234..def5678 100644
--- a/lib/rom/http/handlers.rb
+++ b/lib/rom/http/handlers.rb
@@ -1,3 +1,5 @@+# frozen_string_literal: true
+
require "rom/http/handlers/json"
module ROM
|
Add missing frozen-string literal comment
|
diff --git a/lib/tasks/downloads.rake b/lib/tasks/downloads.rake
index abc1234..def5678 100644
--- a/lib/tasks/downloads.rake
+++ b/lib/tasks/downloads.rake
@@ -14,7 +14,6 @@ .exclude_unregistered_packages
.active_batch_scope
.order(:name)
- .select(package_attributes)
package_list.each_with_index do |package, index|
categories = package.categories.map(&:name).inspect
|
Remove download select b/c it was causing a bug
|
diff --git a/app/models/asset_file.rb b/app/models/asset_file.rb
index abc1234..def5678 100644
--- a/app/models/asset_file.rb
+++ b/app/models/asset_file.rb
@@ -8,6 +8,7 @@ # It is used much like an active record model.
#
class AssetFile < FlexCommerceApi::ApiBase
+ has_one :asset_folder
def self.path(params, resource)
internal_params = params.with_indifferent_access
if !internal_params.key?("asset_folder_id") && !internal_params.key?("path") && resource
|
Update `asset_folder` association to `has_one`
|
diff --git a/app/models/forem/post.rb b/app/models/forem/post.rb
index abc1234..def5678 100644
--- a/app/models/forem/post.rb
+++ b/app/models/forem/post.rb
@@ -25,11 +25,7 @@ self.user == other_user || other_user.forem_admin?
end
- private
-
- def subscribe_replier
- topic.subscribe_user(user.id)
- end
+ protected
def email_topic_subscribers
topic.subscriptions.includes(:subscriber).find_each do |subscription|
@@ -39,6 +35,10 @@ end
end
+ def subscribe_replier
+ topic.subscribe_user(user.id)
+ end
+
def set_topic_last_post_at
self.topic.last_post_at = self.created_at
end
|
Use protected, not private keyword in Post model
|
diff --git a/app/decorators/controllers/action_controller_base_decorator.rb b/app/decorators/controllers/action_controller_base_decorator.rb
index abc1234..def5678 100644
--- a/app/decorators/controllers/action_controller_base_decorator.rb
+++ b/app/decorators/controllers/action_controller_base_decorator.rb
@@ -26,16 +26,28 @@ current_account.owner == current_refinery_user unless Refinery::Multisites.single_tenant_mode?
end
- def current_account
- @current_account ||= Refinery::Multisites::Account.find_by(subdomain: request.subdomain)
+ def current_account(subdomain = request.subdomain)
+ @current_account ||= Refinery::Multisites::Account.find_by(subdomain: subdomain)
end
def load_schema
- if request.subdomain.present?
- if current_account
- Apartment::Tenant.switch!(request.subdomain)
+ subdomains = request.subdomains
+
+ if subdomains.present?
+ tenant = subdomains.first
+
+ if current_account(tenant)
+ Apartment::Tenant.switch!(tenant)
else
- redirect_to refinery.root_path(subdomain: false)
+ if Apartment.tld_length >= 2
+ if subdomains.many?
+ redirect_to refinery.root_path(subdomain: subdomains.last)
+ else
+ Apartment::Tenant.switch!("public")
+ end
+ else
+ redirect_to refinery.root_path(subdomain: false)
+ end
end
else
Apartment::Tenant.switch!("public")
|
Refactor load_schema to support multiple tld_length
|
diff --git a/lib/trlo/models/board.rb b/lib/trlo/models/board.rb
index abc1234..def5678 100644
--- a/lib/trlo/models/board.rb
+++ b/lib/trlo/models/board.rb
@@ -3,7 +3,7 @@ include DataMapper::Resource
property :id, Serial
- property :name, String
+ property :name, Text
property :current, Boolean, default: false
property :closed, Boolean, default: false
property :external_board_id, String
|
Fix titles that are longer than 50 characters.
|
diff --git a/lib/walmart_open/item.rb b/lib/walmart_open/item.rb
index abc1234..def5678 100644
--- a/lib/walmart_open/item.rb
+++ b/lib/walmart_open/item.rb
@@ -16,7 +16,7 @@ "productUrl" => "url"
}
- API_ATTRIBUTES_MAPPING.each_key do |attr_name|
+ API_ATTRIBUTES_MAPPING.each_value do |attr_name|
attr_reader attr_name
end
|
Use the values, not the keys
|
diff --git a/test/cookbooks/test/metadata.rb b/test/cookbooks/test/metadata.rb
index abc1234..def5678 100644
--- a/test/cookbooks/test/metadata.rb
+++ b/test/cookbooks/test/metadata.rb
@@ -1,7 +1,7 @@ name 'test'
maintainer 'Chef Software, Inc.'
maintainer_email '[email protected]'
-license 'Apache 2.0'
+license 'Apache-2.0'
version '1.0.0'
depends 'tomcat'
|
Use a SPDX standard license string
Signed-off-by: Tim Smith <[email protected]>
|
diff --git a/lib/xpathquery/engine.rb b/lib/xpathquery/engine.rb
index abc1234..def5678 100644
--- a/lib/xpathquery/engine.rb
+++ b/lib/xpathquery/engine.rb
@@ -23,7 +23,7 @@
begin
results = perform_query(q, ns)
- rescue Exception
+ rescue Exception => ex
raise XPathQuery::Error.new(@db_url, q)
end
|
Save exception in local variable
|
diff --git a/app/controllers/forem/application_controller.rb b/app/controllers/forem/application_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/forem/application_controller.rb
+++ b/app/controllers/forem/application_controller.rb
@@ -4,7 +4,7 @@
def authenticate_forem_user
if !forem_user
- session[:return_to] = request.fullpath
+ session["user_return_to"] = request.fullpath
flash.alert = t("forem.errors.not_signed_in")
redirect_to main_app.sign_in_path
end
|
Use user_return_to rather than just 'return_to'
Devise now requires the scope to be prefixed to the return_to session variable when using it as a location store
Fixes #58
|
diff --git a/lib/gimli/path.rb b/lib/gimli/path.rb
index abc1234..def5678 100644
--- a/lib/gimli/path.rb
+++ b/lib/gimli/path.rb
@@ -21,10 +21,8 @@ target = File.join(target, '*')
end
end
- files = Dir.glob(target).keep_if { |file| MarkupFile.new(file).valid? }
- files = [files] unless files.is_a? Array
- files
+ Dir.glob(target).keep_if { |file| MarkupFile.new(file).valid? }
end
end
end
|
Remove unnecessary check for array
|
diff --git a/test/unit/lib/rake_task_test.rb b/test/unit/lib/rake_task_test.rb
index abc1234..def5678 100644
--- a/test/unit/lib/rake_task_test.rb
+++ b/test/unit/lib/rake_task_test.rb
@@ -1,7 +1,22 @@ # frozen_string_literal: true
require 'test_helper'
+require 'database_cleaner'
+DatabaseCleaner.strategy = :transaction
class RakeTaskTest < ActiveSupport::TestCase
+ # When using DatabaseCleaner, transactional fixtures must be off.
+ self.use_transactional_tests = false
+
+ setup do
+ # Start DatabaseCleaner before each test.
+ DatabaseCleaner.start
+ end
+
+ teardown do
+ # Clean up the database with DatabaseCleaner after each test.
+ DatabaseCleaner.clean
+ end
+
test 'regression test for rake reminders' do
assert_equal 1, Project.projects_to_remind.size
result = system 'rake reminders >/dev/null'
|
Fix seed issue with rakeTaskTest regression test
Signed-off-by: Jason Dossett <[email protected]>
|
diff --git a/app/overrides/layouts_admin_print_buttons_decorator.rb b/app/overrides/layouts_admin_print_buttons_decorator.rb
index abc1234..def5678 100644
--- a/app/overrides/layouts_admin_print_buttons_decorator.rb
+++ b/app/overrides/layouts_admin_print_buttons_decorator.rb
@@ -1,4 +1,4 @@-Deface::Override.new(:virtual_path => "spree/layouts/admin",
+Deface::Override.new(:virtual_path => "spree/admin/shared/_content_header",
:name => "print_buttons",
:insert_top => "[data-hook='toolbar']>ul",
:partial => "spree/admin/orders/print_buttons",
|
Correct virtual_path for print buttons override
Fixes #34
|
diff --git a/lib/phpcop/cli.rb b/lib/phpcop/cli.rb
index abc1234..def5678 100644
--- a/lib/phpcop/cli.rb
+++ b/lib/phpcop/cli.rb
@@ -7,7 +7,7 @@ class CLI
attr_reader :config_store
- MSG_END = '%s fichier traité. %s erreurs.'
+ MSG_END = '%s fichiers traités. %s erreurs.'
def initialize
@config_store = ConfigStore.new
@@ -16,7 +16,27 @@ # Run all files
def run(_args = ARGV)
runner = PhpCop::Runner.new(@config_store)
- puts format(MSG_END, runner.count_files, runner.count_errors)
+ puts format(MSG_END,
+ format_count(runner.count_files),
+ format_count(runner.count_errors))
+ end
+
+ private
+
+ def format_count(count)
+ i = 0
+ f = []
+ count.to_s.reverse.split('').each do |letter|
+ i += 1
+ f.push(letter)
+ i = add_space(f) if i == 3
+ end
+ f.join.to_s.reverse
+ end
+
+ def add_space(f)
+ f.push(' ')
+ 0
end
end
end
|
Add space to result if number of file and error is big
|
diff --git a/spec/unit/stash/harvester_spec.rb b/spec/unit/stash/harvester_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/stash/harvester_spec.rb
+++ b/spec/unit/stash/harvester_spec.rb
@@ -13,7 +13,7 @@ expect(logged).to include(msg)
timestamp_str = logged.split[0]
timestamp = DateTime.parse(timestamp_str)
- expect(timestamp.to_date).to eq(Date.today)
+ expect(timestamp.to_date).to eq(Time.now.utc.to_date)
ensure
Harvester.log_device = $stdout
end
|
Make sure we're comparing UTC with UTC
|
diff --git a/lib/slatan/ear.rb b/lib/slatan/ear.rb
index abc1234..def5678 100644
--- a/lib/slatan/ear.rb
+++ b/lib/slatan/ear.rb
@@ -8,16 +8,15 @@ class << self
## register subscriber
# @param concern subscriber
- # @param options option
- # cond: <Kernel.#lambda> call hear method of concern if cond.call(msg) is true
- def register(concern, options={})
- @concerns << [concern, options[:cond]]
+ # @param block<option> condition for dispatching event
+ def register(concern, &block)
+ @concerns << [concern, block]
end
## publish to subscribers
def hear(msg)
- @concerns.each do |concern, cond|
- if cond.blank? || cond.call(msg)
+ @concerns.each do |concern, block|
+ if block.blank? || block.call(msg)
concern.hear(msg)
end
end
|
Change arg from Karnel.lambda to block of Slatan::Ear.register
|
diff --git a/db/migrate/20130918163100_create_open_id_authentications_from_existing_users.rb b/db/migrate/20130918163100_create_open_id_authentications_from_existing_users.rb
index abc1234..def5678 100644
--- a/db/migrate/20130918163100_create_open_id_authentications_from_existing_users.rb
+++ b/db/migrate/20130918163100_create_open_id_authentications_from_existing_users.rb
@@ -0,0 +1,14 @@+class CreateOpenIdAuthenticationsFromExistingUsers < ActiveRecord::Migration
+ def up
+ say_with_time "Creating OpenID authentications for existing OpenID users" do
+ User.where(:using_openid => true).find_each do |user|
+ user.authentications.create(
+ :uid => user.login,
+ :provider => 'open_id',
+ :name => user.fullname,
+ :email => user.email
+ )
+ end
+ end
+ end
+end
|
[migration] Create OpenID authentications from existing users
|
diff --git a/config/sitemap.rb b/config/sitemap.rb
index abc1234..def5678 100644
--- a/config/sitemap.rb
+++ b/config/sitemap.rb
@@ -18,10 +18,10 @@
SitemapGenerator::Sitemap.create do
site.posts.find_each do |post|
- add post_url(post), changefreq: 'weekly', priority: 0.8
+ add post_path(post), changefreq: 'weekly', priority: 0.8
end
site.categories.find_each do |category|
- add category_url(category.slug), changefreq: 'daily', priority: 0.6
+ add category_path(category.slug), changefreq: 'daily', priority: 0.6
end
end
|
Use `xxx_path` instead of `xxx_url`
In `config/sitemap.rb`, it is enough only path.
The host is filled by sitemap_generator.
|
diff --git a/contracts.gemspec b/contracts.gemspec
index abc1234..def5678 100644
--- a/contracts.gemspec
+++ b/contracts.gemspec
@@ -3,7 +3,6 @@ Gem::Specification.new do |s|
s.name = "contracts"
s.version = Contracts::VERSION
- s.date = "2014-05-08"
s.summary = "Contracts for Ruby."
s.description = "This library provides contracts for Ruby. Contracts let you clearly express how your code behaves, and free you from writing tons of boilerplate, defensive code."
s.author = "Aditya Bhargava"
|
Remove explicit date from gemspec
It creates very weird history on rubygems if one forget to update it when releasing new version, like this: https://rubygems.org/gems/contracts
```
0.5 - May 8, 2014 (24.5 KB)
```
even so, it was released recently.
Removing this field from gemspec allows rubygems to automatically set it to current day when releasing.
|
diff --git a/lib/coresys/commands/edit.rb b/lib/coresys/commands/edit.rb
index abc1234..def5678 100644
--- a/lib/coresys/commands/edit.rb
+++ b/lib/coresys/commands/edit.rb
@@ -1,4 +1,3 @@-formula = Coresys::Formula.find(ARGV[0])
error!("EDITOR environment variable is not set") unless ENV['EDITOR']
-file = (Coresys.formula + formula.file_name).to_s + '.rb'
+file = Coresys.formula + "#{ARGV[0].downcase}.rb"
exec ENV['SHELL'], '-c', ENV['EDITOR'] + ' "$@"', '--', file
|
Edit shouldn't require formula to be valid
|
diff --git a/lita-xkcd.gemspec b/lita-xkcd.gemspec
index abc1234..def5678 100644
--- a/lita-xkcd.gemspec
+++ b/lita-xkcd.gemspec
@@ -1,6 +1,6 @@ Gem::Specification.new do |spec|
spec.name = "lita-xkcd"
- spec.version = "0.0.4"
+ spec.version = "0.0.5"
spec.authors = ["Mitch Dempsey"]
spec.email = ["[email protected]"]
spec.description = %q{Adds a Lita handler to provide access to xkcd comics.}
@@ -13,12 +13,11 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
- spec.add_runtime_dependency "lita", "~> 2.2"
+ spec.add_runtime_dependency "lita", ">= 2.2"
spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake"
- spec.add_development_dependency "rspec", ">= 2.14"
-
+ spec.add_development_dependency "rspec", ">= 3.0.0.beta2"
spec.add_development_dependency "simplecov"
spec.add_development_dependency "coveralls"
|
Update gemspec for Lita 3.0 compatibility.
|
diff --git a/stash_datacite/app/controllers/stash_datacite/application_controller.rb b/stash_datacite/app/controllers/stash_datacite/application_controller.rb
index abc1234..def5678 100644
--- a/stash_datacite/app/controllers/stash_datacite/application_controller.rb
+++ b/stash_datacite/app/controllers/stash_datacite/application_controller.rb
@@ -1,11 +1,7 @@-require 'error/error_handler'
-
module StashDatacite
class ApplicationController < ::ApplicationController
helper StashEngine::ApplicationHelper
include StashEngine::SharedController
-
- include Error::ErrorHandler
end
end
|
Revert "trying to add catching of annoying Bing js error" We will need to use Rack or HoneyBader to do this.
This reverts commit 63ea5fd7c7840db3119e7f97a3c0bc02c1189d77.
|
diff --git a/src/spec/factories/metadata_object.rb b/src/spec/factories/metadata_object.rb
index abc1234..def5678 100644
--- a/src/spec/factories/metadata_object.rb
+++ b/src/spec/factories/metadata_object.rb
@@ -6,6 +6,6 @@
Factory.define :default_zone_metadata, :parent => :metadata_object do |o|
o.key 'default_zone'
- o.value Factory.create(:zone).id
+ o.value {Factory.create(:zone).id}
o.object_type 'Zone'
end
|
Fix metadata object factory so it doesnt load zone before it exists.
|
diff --git a/test/factories/cms_graphql_queries.rb b/test/factories/cms_graphql_queries.rb
index abc1234..def5678 100644
--- a/test/factories/cms_graphql_queries.rb
+++ b/test/factories/cms_graphql_queries.rb
@@ -21,7 +21,7 @@ FactoryBot.define do
factory :cms_graphql_query do
sequence(:identifier) { |n| "graphql_query_#{n}" }
- query { 'query { convention { id } }' }
+ query { 'query { convention: conventionByRequestHost { id } }' }
association :parent, factory: :convention
end
end
|
Update query used in test case
|
diff --git a/test/features/can_access_home_test.rb b/test/features/can_access_home_test.rb
index abc1234..def5678 100644
--- a/test/features/can_access_home_test.rb
+++ b/test/features/can_access_home_test.rb
@@ -23,7 +23,7 @@ fill_in 'Password', :with => "password"
click_button 'Sign in'
- page.must_have_content "Signed in successfully."
+ page.must_have_content I18n.t('devise.sessions.signed_in')
end
scenario "user can log out" do
|
Make can access home page test more robust by referring to devise internationalization
|
diff --git a/lib/figaro/cli/heroku_set.rb b/lib/figaro/cli/heroku_set.rb
index abc1234..def5678 100644
--- a/lib/figaro/cli/heroku_set.rb
+++ b/lib/figaro/cli/heroku_set.rb
@@ -10,7 +10,7 @@ private
def command
- "heroku config:set #{for_app} #{vars}"
+ "heroku config:set #{vars} #{for_app}"
end
def for_app
|
Switch the order of "heroku config:set" arguments to read better
|
diff --git a/lib/heroku/kensa/manifest.rb b/lib/heroku/kensa/manifest.rb
index abc1234..def5678 100644
--- a/lib/heroku/kensa/manifest.rb
+++ b/lib/heroku/kensa/manifest.rb
@@ -7,34 +7,25 @@ end
def self.skeleton
- Yajl::Parser.parse(skeleton_str)
+ { 'id' => 'myaddon',
+ 'name' => 'My Addon',
+ 'plans' => [{
+ 'id' => 'basic',
+ 'name' => 'Basic',
+ 'price' => '0',
+ 'price_unit' => 'month' }],
+ 'api' => {
+ 'config_vars' => [ 'MYADDON_URL' ],
+ 'production' => 'https://yourapp.com/',
+ 'test' => 'http://localhost:4567/',
+ 'username' => 'heroku',
+ 'password' => generate_password(16),
+ 'sso_salt' => generate_password(16) }
+ }
end
def self.skeleton_str
- return <<EOJSON
-{
- "id": "myaddon",
- "name": "My Addon",
- "plans": [
- {
- "id": "basic",
- "name": "Basic",
- "price": "0",
- "price_unit": "month"
- }
- ],
- "api": {
- "config_vars": [
- "MYADDON_URL"
- ],
- "production": "https://yourapp.com/",
- "test": "http://localhost:4567/",
- "username": "heroku",
- "password": "#{generate_password(16)}",
- "sso_salt": "#{generate_password(16)}"
- }
-}
-EOJSON
+ Yajl::Encoder.encode skeleton
end
PasswordChars = chars = ['a'..'z', 'A'..'Z', '0'..'9'].map { |r| r.to_a }.flatten
|
Refactor Manifest.skeleton to use a hash.
|
diff --git a/lib/htty/cli/input_device.rb b/lib/htty/cli/input_device.rb
index abc1234..def5678 100644
--- a/lib/htty/cli/input_device.rb
+++ b/lib/htty/cli/input_device.rb
@@ -2,7 +2,27 @@
module HTTY::CLI::InputDevice
def self.new(display)
- TTY.new(display)
+ if STDIN.tty?
+ TTY.new(display)
+ else
+ Pipe.new(display)
+ end
+ end
+
+ class Pipe
+ def initialize(display)
+ @display = display
+ end
+
+ def commands
+ STDIN.each_line do |command_line|
+ command_line.chomp!
+ command_line.strip!
+ next if command_line.empty?
+ @display.print_prompt(command_line + "\n")
+ yield command_line
+ end
+ end
end
class TTY
|
Support for input from pipe
|
diff --git a/agharta.gemspec b/agharta.gemspec
index abc1234..def5678 100644
--- a/agharta.gemspec
+++ b/agharta.gemspec
@@ -13,6 +13,8 @@ gem.homepage = ""
gem.add_runtime_dependency 'thor', '~> 0.16'
+ gem.add_runtime_dependency 'oauth', '~> 0.4'
+ gem.add_runtime_dependency 'twitter', '~> 4.4'
gem.add_runtime_dependency 'tweetstream', '~> 2.4'
gem.add_development_dependency 'rspec'
|
Add oauth & twitter to dependency.
|
diff --git a/lib/schema/data_structure.rb b/lib/schema/data_structure.rb
index abc1234..def5678 100644
--- a/lib/schema/data_structure.rb
+++ b/lib/schema/data_structure.rb
@@ -6,6 +6,7 @@ extend Build
extend Virtual::Macro
virtual :configure_dependencies
+ alias :configure :configure_dependencies
end
end
|
Configure is an alias for configure_dependencies
|
diff --git a/app/services/organisational_manual_document_service_registry.rb b/app/services/organisational_manual_document_service_registry.rb
index abc1234..def5678 100644
--- a/app/services/organisational_manual_document_service_registry.rb
+++ b/app/services/organisational_manual_document_service_registry.rb
@@ -1,6 +1,6 @@ class OrganisationalManualDocumentServiceRegistry < AbstractManualDocumentServiceRegistry
- def initialize(dependencies)
- @organisation_slug = dependencies.fetch(:organisation_slug)
+ def initialize(organisation_slug:)
+ @organisation_slug = organisation_slug
end
private
|
Use Ruby keyword args in OrganisationalManualDocumentServiceRegistry
I think that using language features instead of custom code makes this
easier to understand.
|
diff --git a/lib/spring/commands/rspec.rb b/lib/spring/commands/rspec.rb
index abc1234..def5678 100644
--- a/lib/spring/commands/rspec.rb
+++ b/lib/spring/commands/rspec.rb
@@ -14,7 +14,7 @@ end
def call
- ::RSpec.configuration.start_time = Time.now if defined?(::RSpec.configuration)
+ ::RSpec.configuration.start_time = Time.now if defined?(::RSpec.configuration) && ::RSpec.configuration.respond_to?(:start_time=)
load Gem.bin_path(gem_name, exec_name)
end
end
|
Fix compatibility with RSpec 2.x
::RSpec.configuration.start_time= was added in RSpec 3.0.0.
This method doesn't exist in RSpec 2.x, so the binstub fails with `spring-commands-rspec-1.0.3/lib/spring/commands/rspec.rb:17:in `call': undefined method `start_time=' for #<RSpec::Core::Configuration:0x007f6d388dcf00> (NoMethodError)`
Check if the start_time= method exists before calling it.
|
diff --git a/lib/byebug/commands/display.rb b/lib/byebug/commands/display.rb
index abc1234..def5678 100644
--- a/lib/byebug/commands/display.rb
+++ b/lib/byebug/commands/display.rb
@@ -9,10 +9,7 @@ include Helpers::EvalHelper
self.allow_in_post_mortem = false
-
- def self.always_run
- 2
- end
+ self.always_run = 2
def regexp
/^\s* disp(?:lay)? (?:\s+ (.+))? \s*$/x
|
Use attribute writer instead of redefining it
|
diff --git a/lib/facter/interface_driver.rb b/lib/facter/interface_driver.rb
index abc1234..def5678 100644
--- a/lib/facter/interface_driver.rb
+++ b/lib/facter/interface_driver.rb
@@ -0,0 +1,30 @@+require 'facter'
+require 'facter/util/ip'
+require 'json'
+Facter::Util::IP.get_interfaces.each do |interface|
+ next if interface.start_with?('veth')
+ Facter.debug("Running ethtool on interface #{interface}")
+ data = {}
+ Facter::Util::Resolution.exec("ethtool -i #{interface} 2>/dev/null").split("\n").each do |line|
+ k, v = line.split(': ')
+ if v
+ data[k]=v
+ end
+ end
+ if data['driver']
+ Facter.add('driver_' + Facter::Util::IP.alphafy(interface)) do
+ confine :kernel => "Linux"
+ setcode do
+ data['driver']
+ end
+ end
+ end
+ if data['version']
+ Facter.add('driver_version' + Facter::Util::IP.alphafy(interface)) do
+ confine :kernel => "Linux"
+ setcode do
+ data['version']
+ end
+ end
+ end
+end
|
Add custom facts enabling finding the driver version
|
diff --git a/lib/i18n_alchemy/attributes.rb b/lib/i18n_alchemy/attributes.rb
index abc1234..def5678 100644
--- a/lib/i18n_alchemy/attributes.rb
+++ b/lib/i18n_alchemy/attributes.rb
@@ -34,6 +34,7 @@ raise(::ActiveRecord::UnknownAttributeError, "unknown attribute: #{key}")
end
end
+ self
end
end
end
|
Return self instead a Hash
Signed-off-by: Tomas D'Stefano <[email protected]>
|
diff --git a/libraries/nodejs_helper.rb b/libraries/nodejs_helper.rb
index abc1234..def5678 100644
--- a/libraries/nodejs_helper.rb
+++ b/libraries/nodejs_helper.rb
@@ -35,7 +35,7 @@ def npm_package_installed?(package, version = nil, path = nil)
list = npm_list(path)['dependencies']
# Return true if package installed and installed to good version
- (!list.nil?) && list.key?(package) && version_valid?(package, list, version) && url_valid?(list, package)
+ (!list.nil?) && list.key?(package) && version_valid?(list, package, version) && url_valid?(list, package)
end
end
end
|
Correct order of arguments when detecting installed packages
|
diff --git a/lib/tasks/search_analyzer.rake b/lib/tasks/search_analyzer.rake
index abc1234..def5678 100644
--- a/lib/tasks/search_analyzer.rake
+++ b/lib/tasks/search_analyzer.rake
@@ -1,6 +1,7 @@ namespace :search_analyzer do
desc 'Determine failed searches from Google Analytics CSV and output to new CSV'
task failed_searches: %w[environment] do
+ p 'To run this task you will need to export a CSV report of search terms from the Trade Tariff Google Analytics'
p 'Enter the filename and location of the analytics CSV'
p 'Format should be: /path/to/file.csv'
filename = STDIN.gets.chomp
|
Add where to find search data
|
diff --git a/test/test_css.rb b/test/test_css.rb
index abc1234..def5678 100644
--- a/test/test_css.rb
+++ b/test/test_css.rb
@@ -12,21 +12,28 @@ App.new
end
+ def assert_css(css)
+ left = last_response.body.gsub(/[ \r\n\t]+/m, '')
+ right = css.gsub(/[ \r\n\t]+/m, '')
+
+ assert_equal left, right
+
+ end
test "sass" do
get '/css/style-sass.css'
- assert_equal "body, #sass {\n color: #333333; }\n", last_response.body
+ assert_css "body, #sass {\n color: #333333; }\n"
end
test "scss" do
get '/css/style-scss.css'
- assert_equal "body, #scss {\n color: #333333; }\n", last_response.body
+ assert_css "body, #scss {\n color: #333333; }\n"
end
test "less" do
get '/css/style-less.css'
- assert_equal "body, #less { color: #333333; }\n", last_response.body
+ assert_css "body, #less { color: #333333; }\n"
end
end
|
Update the CSS test to be more robust.
|
diff --git a/diff_set.gemspec b/diff_set.gemspec
index abc1234..def5678 100644
--- a/diff_set.gemspec
+++ b/diff_set.gemspec
@@ -24,5 +24,5 @@ spec.add_development_dependency 'rake-compiler', '~> 0.9.2'
spec.add_development_dependency 'rspec'
spec.add_development_dependency 'pry'
- spec.add_runtime_dependency 'rice', '~> 1.6'
+ spec.add_runtime_dependency 'rice', '~> 1.7'
end
|
Update to use ruby 2.2.0 compatible rice
|
diff --git a/test/lib/howell/notice_test.rb b/test/lib/howell/notice_test.rb
index abc1234..def5678 100644
--- a/test/lib/howell/notice_test.rb
+++ b/test/lib/howell/notice_test.rb
@@ -1,5 +1,7 @@ require 'test_helper'
+# TODO:
+# * Add a test to check the content of what is being sent in a notice
class HowellNoticeTest < MiniTest::Unit::TestCase
def setup
howell_config
|
TODO: Add test for Howell::Notice that checks the content being sent in a notice
|
diff --git a/Casks/pycharm-ce-bundled-jdk.rb b/Casks/pycharm-ce-bundled-jdk.rb
index abc1234..def5678 100644
--- a/Casks/pycharm-ce-bundled-jdk.rb
+++ b/Casks/pycharm-ce-bundled-jdk.rb
@@ -0,0 +1,22 @@+cask :v1 => 'pycharm-ce-bundled-jdk' do
+ version '4.5.1'
+ sha256 '8929fa6e995a895244731a1ac2ab888593decb7d0592ba560280e845ee4ebe31'
+
+ url "https://download.jetbrains.com/python/pycharm-community-#{version}-jdk-bundled.dmg"
+ name 'PyCharm Community Edition'
+ homepage 'https://www.jetbrains.com/pycharm/'
+ license :apache
+
+ app 'PyCharm CE.app'
+
+ zap :delete => [
+ '~/Library/Preferences/com.jetbrains.pycharm.plist',
+ '~/Library/Preferences/PyCharm40',
+ '~/Library/Application Support/PyCharm40',
+ '~/Library/Caches/PyCharm40',
+ '~/Library/Logs/PyCharm40',
+ '/usr/local/bin/charm',
+ ]
+
+ conflicts_with :cask => 'pycharm-ce'
+end
|
Add PyCharm Community Edition 4.5.1 with bundled JDK 1.8
|
diff --git a/mrblib/rack_r3.rb b/mrblib/rack_r3.rb
index abc1234..def5678 100644
--- a/mrblib/rack_r3.rb
+++ b/mrblib/rack_r3.rb
@@ -1,13 +1,13 @@ module Rack
module R3
METHODS = {
- get: ::R3::Method::GET,
- post: ::R3::Method::POST,
- put: ::R3::Method::PUT,
- delete: ::R3::Method::DELETE,
- patch: ::R3::Method::PATCH,
- head: ::R3::Method::HEAD,
- options: ::R3::Method::OPTIONS,
+ GET: ::R3::Method::GET,
+ POST: ::R3::Method::POST,
+ PUT: ::R3::Method::PUT,
+ DELETE: ::R3::Method::DELETE,
+ PATCH: ::R3::Method::PATCH,
+ HEAD: ::R3::Method::HEAD,
+ OPTIONS: ::R3::Method::OPTIONS,
}
def self.included(base)
@@ -19,7 +19,7 @@ end
METHODS.each do |sym, int|
- self.define_singleton_method(sym) do |path, &block|
+ self.define_singleton_method(sym.downcase) do |path, &block|
@@routes.push({method: int, path: path, block: block})
end
end
@@ -37,18 +37,18 @@
def call(env)
@env = env
- method = METHODS[env['REQUEST_METHOD'].downcase.to_sym]
+ method = METHODS[env['REQUEST_METHOD'].intern]
match = @tree.match(method, env['PATH_INFO'])
block = match[:data]
return instance_exec(*match[:params], &block) if block
- not_found(env)
+ not_found
end
- def not_found(env)
+ def not_found
[404,
{'content-type' => 'text/plain; charset=utf-8'},
["Not Found"]
- ];
+ ]
end
end
end
|
Use capitalized symbol for keys of METHODS
|
diff --git a/core/lib/generators/spree/install/templates/config/initializers/spree.rb b/core/lib/generators/spree/install/templates/config/initializers/spree.rb
index abc1234..def5678 100644
--- a/core/lib/generators/spree/install/templates/config/initializers/spree.rb
+++ b/core/lib/generators/spree/install/templates/config/initializers/spree.rb
@@ -36,6 +36,18 @@
# Custom logo for the admin
# config.admin_interface_logo = "logo/solidus_logo.png"
+
+ # Gateway credentials can be configured statically here and referenced from
+ # the admin. They can also be fully configured from the admin.
+ #
+ # config.static_model_preferences.add(
+ # Spree::Gateway::StripeGateway,
+ # 'stripe_env_credentials',
+ # secret_key: ENV['STRIPE_SECRET_KEY'],
+ # publishable_key: ENV['STRIPE_PUBLISHABLE_KEY'],
+ # server: Rails.env.production? ? 'production' : 'test',
+ # test: !Rails.env.production?
+ # )
end
Spree.user_class = <%= (options[:user_class].blank? ? "Spree::LegacyUser" : options[:user_class]).inspect %>
|
Add static gateway example to config initializer
|
diff --git a/lib/webmock/http_lib_adapters/http_rb/client.rb b/lib/webmock/http_lib_adapters/http_rb/client.rb
index abc1234..def5678 100644
--- a/lib/webmock/http_lib_adapters/http_rb/client.rb
+++ b/lib/webmock/http_lib_adapters/http_rb/client.rb
@@ -4,7 +4,11 @@
def perform(request, options)
return __perform__(request, options) unless webmock_enabled?
- WebMockPerform.new(request) { __perform__(request, options) }.exec
+
+ response = options.features.inject(response) do |response, (_name, feature)|
+ feature.wrap_response(response)
+ end
+ response
end
def webmock_enabled?
|
Adjust `perform` override and call HTTP features wrapping request/response pairs.
The change helps reduce differences between mocking and not mocking to successfully test e.g. instrumentation which the `http` gem exposes through said features.
|
diff --git a/app/api/news.rb b/app/api/news.rb
index abc1234..def5678 100644
--- a/app/api/news.rb
+++ b/app/api/news.rb
@@ -1,6 +1,7 @@ module News
class API < Grape::API
prefix 'api'
+ format :json
resource :links do
get do
|
Set JSON as default format
|
diff --git a/examples/ring.rb b/examples/ring.rb
index abc1234..def5678 100644
--- a/examples/ring.rb
+++ b/examples/ring.rb
@@ -2,6 +2,7 @@ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'minx'
+require 'benchmark'
# Number of rounds.
M = ARGV[0] ? Integer(ARGV[0]) : 1000
@@ -18,12 +19,15 @@ end
FIRST = Minx.channel
+
LAST = (0...N).inject(FIRST) {|chan, id| node(chan, id) }
-i = 0
-M.times do
- FIRST.write(i)
- i = LAST.read
+Benchmark.bm do |bm|
+ bm.report("RING") do
+ i = 0
+ M.times do
+ FIRST.write(i)
+ i = LAST.read
+ end
+ end
end
-
-puts "Result: #{i}"
|
Add more granular Ring benchmark
|
diff --git a/Library/Homebrew/cask/lib/hbc/container/cab.rb b/Library/Homebrew/cask/lib/hbc/container/cab.rb
index abc1234..def5678 100644
--- a/Library/Homebrew/cask/lib/hbc/container/cab.rb
+++ b/Library/Homebrew/cask/lib/hbc/container/cab.rb
@@ -8,7 +8,7 @@ def self.me?(criteria)
cabextract = which("cabextract")
- criteria.magic_number(/^MSCF/n) &&
+ criteria.magic_number(/^(MSCF|MZ)/n) &&
!cabextract.nil? &&
criteria.command.run(cabextract, args: ["-t", "--", criteria.path.to_s]).stderr.empty?
end
|
Fix detection of self-extracting `.exe` files.
|
diff --git a/test/test_chinese_faker_address.rb b/test/test_chinese_faker_address.rb
index abc1234..def5678 100644
--- a/test/test_chinese_faker_address.rb
+++ b/test/test_chinese_faker_address.rb
@@ -0,0 +1,24 @@+# encoding: utf-8
+require 'test_helper'
+
+class TestChineseFakerAddress < Test::Unit::TestCase
+ def setup
+ @tester = ChineseFaker::Address
+ @translations = YAML.load_file(File.expand_path('lib/locales/zh-tw.yml'))
+ end
+
+ def test_address_district
+ districts = @translations['zh-tw']['chinese_faker']['address']['district'][0].split
+ assert districts.include?(@tester.district)
+ end
+
+ def test_address_city
+ cities = @translations['zh-tw']['chinese_faker']['address']['city'][0].split
+ assert cities.include?(@tester.city)
+ end
+
+ def test_address_county
+ counties = @translations['zh-tw']['chinese_faker']['address']['county'][0].split
+ assert counties.include?(@tester.county)
+ end
+end
|
Add test suite for address
|
diff --git a/lib/action_cost/middleware.rb b/lib/action_cost/middleware.rb
index abc1234..def5678 100644
--- a/lib/action_cost/middleware.rb
+++ b/lib/action_cost/middleware.rb
@@ -2,6 +2,7 @@ class Middleware
attr_reader :request_stats, :stats_collector
+ cattr_accessor :singleton
def initialize(app)
@app = app
@@ -29,14 +30,14 @@ @request_stats = nil
end
- def self.push_sql_parser(sql_parser)
- return unless @@singleton.request_stats
- @@singleton.request_stats.push(sql_parser)
+ def self.push_sql_parser(parser)
+ return unless singleton.request_stats
+ singleton.request_stats.push(parser)
end
def self.accumulated_stats
- return unless @@singleton.stats_collector
- @@singleton.stats_collector.data
+ return unless singleton.stats_collector
+ singleton.stats_collector.data
end
end
end
|
Use cattr_accessor for @@singleton class variable
|
diff --git a/betamax.gemspec b/betamax.gemspec
index abc1234..def5678 100644
--- a/betamax.gemspec
+++ b/betamax.gemspec
@@ -16,5 +16,6 @@ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
+ s.add_development_dependency "rake"
s.add_development_dependency "rspec"
end
|
Add Rake as a dependency
|
diff --git a/Casks/netbeans-php-beta8.rb b/Casks/netbeans-php-beta8.rb
index abc1234..def5678 100644
--- a/Casks/netbeans-php-beta8.rb
+++ b/Casks/netbeans-php-beta8.rb
@@ -0,0 +1,13 @@+class NetbeansPhpBeta8 < Cask
+ url 'http://dlc.sun.com.edgesuite.net/netbeans/8.0/beta/bundles/netbeans-8.0beta-php-macosx.dmg'
+ homepage 'http://dlc.sun.com.edgesuite.net/netbeans/8.0/beta/'
+ version '8.0 Beta'
+ sha1 '74d92f8a954026f767d98427dda2801d8e4dd31a'
+ install 'NetBeans 8.0 Beta.mpkg'
+
+ # Following example of the stable netbeans-php
+ uninstall(
+ :pkgutil => 'org.netbeans.ide.*|glassfish-.*',
+ :files => '/Applications/NetBeans'
+ )
+end
|
Add NetBeans PHP Beta 8.0
|
diff --git a/lib/fog/vcloud_director/models/compute/disks.rb b/lib/fog/vcloud_director/models/compute/disks.rb
index abc1234..def5678 100644
--- a/lib/fog/vcloud_director/models/compute/disks.rb
+++ b/lib/fog/vcloud_director/models/compute/disks.rb
@@ -33,7 +33,8 @@ items
end
- # Filters out all the controllers (returns only resource_type == 17)
+ # Returns only disk drives (OVF resource type 17) and not controllers,
+ # etc. See <https://blogs.vmware.com/vapp/2009/11/virtual-hardware-in-ovf-part-1.html>
def storage_only
select {|d| d.resource_type == 17}
end
|
Make comment more explicit about OVF
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.