diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
---|---|
diff --git a/array_shuffle.rb b/array_shuffle.rb
index abc1234..def5678 100644
--- a/array_shuffle.rb
+++ b/array_shuffle.rb
@@ -0,0 +1,29 @@+# Cannot create a temporary array or make copies of the input array
+# Must move the elements in place
+# Two elements may swap places
+# Shouldn't be able to predict what the shuffled array looks like
+# The shuffled array could look the same as the input array
+# The larger the input array the higher the likelihood you will get a different array
+
+# Modern Fisher-Yates Shuffle Algorithm (Richard Durstenfeld's version)
+
+class ArrayShuffle
+ def shuffle(list)
+ n = list.length
+ n.downto(1) do |i|
+ p i
+ b = list[i..-1]
+ i -= 1
+ a = list[0..i]
+ print a, b
+ j = rand(0..i)
+ p j + 1
+ if list[0..i].include?(j + 1)
+ list[j], list[i] = list[i], list[j]
+ else
+ next
+ end
+ end
+ list
+ end
+end
|
Test version of Fisher-Yate's array shuffle
|
diff --git a/app/page_freshness.rb b/app/page_freshness.rb
index abc1234..def5678 100644
--- a/app/page_freshness.rb
+++ b/app/page_freshness.rb
@@ -11,7 +11,7 @@
def expired_pages
sitemap.resources.select do |page|
- PageReview.new(page).expired? && page.data.section != Manual::ICINGA_ALERTS
+ PageReview.new(page).expired?
end
end
|
Include Icinga alerts in Slack message again
Now that we're timing the Icinga alerts to be every 6 months, we can
include it again to make sure we actually review the pages.
|
diff --git a/bumpspark.gemspec b/bumpspark.gemspec
index abc1234..def5678 100644
--- a/bumpspark.gemspec
+++ b/bumpspark.gemspec
@@ -13,6 +13,7 @@ gem.homepage = ""
gem.files = `git ls-files`.split($/)
+ gem.bindir = 'exe'
gem.executables = gem.files.grep(%r{^exe/}).map{ |f| File.basename(f) }
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ["lib"]
|
Set bindir correctly in gemspec
|
diff --git a/castle-rb.gemspec b/castle-rb.gemspec
index abc1234..def5678 100644
--- a/castle-rb.gemspec
+++ b/castle-rb.gemspec
@@ -16,16 +16,16 @@ s.test_files = Dir["spec/**/*"]
s.require_paths = ['lib']
- s.add_dependency "her", "~> 0.7.6"
- s.add_dependency "faraday_middleware", "~> 0.9.1"
- s.add_dependency "multi_json", "~> 1.0"
- s.add_dependency "request_store", "~> 1.1"
- s.add_dependency "activesupport", '~> 3'
+ s.add_dependency "her"
+ s.add_dependency "faraday_middleware"
+ s.add_dependency "multi_json"
+ s.add_dependency "request_store"
+ s.add_dependency "activesupport"
- s.add_development_dependency "rspec", '~> 0'
- s.add_development_dependency "rack", '~> 0'
- s.add_development_dependency "webmock", '~> 0'
- s.add_development_dependency "vcr", '~> 0'
- s.add_development_dependency "timecop", '~> 0'
- s.add_development_dependency "coveralls", "~> 0.7.2"
+ s.add_development_dependency "rspec"
+ s.add_development_dependency "rack"
+ s.add_development_dependency "webmock"
+ s.add_development_dependency "vcr"
+ s.add_development_dependency "timecop"
+ s.add_development_dependency "coveralls"
end
|
Update all gems to latest versions
|
diff --git a/attributes/default.rb b/attributes/default.rb
index abc1234..def5678 100644
--- a/attributes/default.rb
+++ b/attributes/default.rb
@@ -7,5 +7,12 @@ # MIT License
#
+distro_name = case node['platform_version']
+when '14.04'
+ 'trusty'
+when '16.04'
+ 'xenial'
+end
+
default['dev_box']['user'] = 'jason'
-default['dev_box']['platform']['distro'] = 'xenial'
+default['dev_box']['platform']['distro'] = distro_name
|
Update distro attribute to be dynamic
|
diff --git a/attributes/default.rb b/attributes/default.rb
index abc1234..def5678 100644
--- a/attributes/default.rb
+++ b/attributes/default.rb
@@ -17,5 +17,5 @@ # limitations under the License.
#
-default[:pacman][:build_dir] = "#{Chef::Config[:file_cache_path]}/builds"
-default[:pacman][:build_user] = "nobody"
+default['pacman']['build_dir'] = "#{Chef::Config[:file_cache_path]}/builds"
+default['pacman']['build_user'] = 'nobody'
|
FC001: Use strings in preference to symbols to access node attributes
|
diff --git a/lib/gmail/gmindex.rb b/lib/gmail/gmindex.rb
index abc1234..def5678 100644
--- a/lib/gmail/gmindex.rb
+++ b/lib/gmail/gmindex.rb
@@ -2,14 +2,14 @@ #
# @author Ollivier Robert <[email protected]>
-VCS_GMI_ID = "$Id: gmindex.rb,v f3a4da3ed2d3 2012/09/12 14:13:00 roberto $"
+VCS_GMI_ID = "$Id: gmindex.rb,v a31bbe7943fe 2012/09/13 15:46:20 roberto $"
require "rufus/tokyo"
# Manages a database of message-id from mail converted from gmvault into Maildir
#
class GmIndex
- attr_reader :path
+ attr_reader :path, :db
def initialize(path)
if File.exists?("#{path}/cur") and File.exists?("#{path}/new")
|
Handle to the TC db.
|
diff --git a/Library/Formula/gnupg.rb b/Library/Formula/gnupg.rb
index abc1234..def5678 100644
--- a/Library/Formula/gnupg.rb
+++ b/Library/Formula/gnupg.rb
@@ -1,12 +1,12 @@ require 'brewkit'
class Gnupg <Formula
- @url='ftp://ftp.gnupg.org/gcrypt/gnupg/gnupg-1.4.9.tar.bz2'
+ @url='ftp://ftp.gnupg.org/gcrypt/gnupg/gnupg-1.4.10.tar.bz2'
@homepage='http://www.gnupg.org/'
- @sha1='826f4bef1effce61c3799c8f7d3cc8313b340b55'
+ @sha1='fd1b6a5f3b2dd836b598a1123ac257b8f105615d'
def install
- system "./configure", "--prefix=#{prefix}", "--disable-debug", "--disable-dependency-tracking"
+ system "./configure", "--prefix=#{prefix}", "--disable-debug", "--disable-dependency-tracking", "--disable-asm"
system "make"
system "make check"
|
Update GnuPG formula to 1.4.10 and include --disable-asm to prevent breakage
|
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index abc1234..def5678 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -2,7 +2,7 @@
Rails.application.config.session_store(
:redis_store,
- expire_after: 30.days,
+ expire_after: 30.minutes,
key: '_cms_session',
redis_server: Rails.application.secrets.redis_url
)
|
Expire sessions after 30 minutes
|
diff --git a/lib/appointment_ticket.rb b/lib/appointment_ticket.rb
index abc1234..def5678 100644
--- a/lib/appointment_ticket.rb
+++ b/lib/appointment_ticket.rb
@@ -52,8 +52,6 @@
Email:
#{@appointment.email}
-
- Please confirm the appointment with the customer
TEXT
end
|
Remove internal note from appointment ticket
|
diff --git a/lib/fabrication/config.rb b/lib/fabrication/config.rb
index abc1234..def5678 100644
--- a/lib/fabrication/config.rb
+++ b/lib/fabrication/config.rb
@@ -2,51 +2,32 @@ module Config
extend self
- def configure
- yield self
+ def configure; yield self end
+
+ def reset_defaults
+ @fabricator_path = @path_prefix = @active_support = nil
end
def fabricator_path
- OPTIONS[:fabricator_path]
+ @fabricator_path ||= ['test/fabricators', 'spec/fabricators']
end
alias fabricator_dir fabricator_path
def fabricator_path=(folders)
- OPTIONS[:fabricator_path] = (Array.new << folders).flatten
+ @fabricator_path = (Array.new << folders).flatten
end
alias fabricator_dir= fabricator_path=
+ attr_writer :path_prefix
def path_prefix
- OPTIONS[:path_prefix]
- end
-
- def path_prefix=(prefix)
- OPTIONS[:path_prefix] = prefix
- end
-
- def reset_defaults
- OPTIONS.replace(DEFAULTS)
+ @path_prefix ||= defined?(Rails) ? Rails.root : "."
end
def active_support?
@active_support ||= defined?(ActiveSupport)
end
- def register_with_steps?
- OPTIONS[:register_with_steps]
- end
-
- def register_with_steps=(register)
- OPTIONS[:register_with_steps] = register
- end
-
- private
-
- DEFAULTS = {
- fabricator_path: ['test/fabricators', 'spec/fabricators'],
- register_with_steps: false,
- path_prefix: defined?(Rails) ? Rails.root : "."
- }
- OPTIONS = {}.merge!(DEFAULTS)
+ attr_writer :register_with_steps
+ def register_with_steps?; @register_with_steps end
end
end
|
Replace options hash with memoized instance vars
|
diff --git a/lib/ffi-glib/main_loop.rb b/lib/ffi-glib/main_loop.rb
index abc1234..def5678 100644
--- a/lib/ffi-glib/main_loop.rb
+++ b/lib/ffi-glib/main_loop.rb
@@ -15,7 +15,11 @@
def initialize timeout = DEFAULT_TIMEOUT
@timeout = timeout
- @handler = proc { Thread.pass; true }
+ @handler = if RUBY_VERSION == "1.9.2"
+ proc { sleep 0.0001; Thread.pass; true }
+ else
+ proc { Thread.pass; true }
+ end
end
def setup_idle_handler
|
Add tiny sleep to make idle handler work on MRI 1.9.2
|
diff --git a/lib/gecko/record/order.rb b/lib/gecko/record/order.rb
index abc1234..def5678 100644
--- a/lib/gecko/record/order.rb
+++ b/lib/gecko/record/order.rb
@@ -7,8 +7,8 @@ has_many :invoices
has_many :order_line_items
belongs_to :company
- belongs_to :shipping_address
- belongs_to :billing_address
+ belongs_to :shipping_address, class_name: "Address"
+ belongs_to :billing_address, class_name: "Address"
belongs_to :user
belongs_to :assignee, class_name: "User"
belongs_to :stock_location, class_name: "Location"
|
Set class_name for Order addresses
|
diff --git a/spec/dummy/config/application.rb b/spec/dummy/config/application.rb
index abc1234..def5678 100644
--- a/spec/dummy/config/application.rb
+++ b/spec/dummy/config/application.rb
@@ -5,7 +5,7 @@ require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
-# require "sprockets/railtie"
+require "sprockets/railtie"
# require "rails/test_unit/railtie"
Bundler.require(*Rails.groups)
|
Make dummy app's asset pipeline work
|
diff --git a/spec/features/index_view_spec.rb b/spec/features/index_view_spec.rb
index abc1234..def5678 100644
--- a/spec/features/index_view_spec.rb
+++ b/spec/features/index_view_spec.rb
@@ -0,0 +1,18 @@+require 'spec_helper'
+
+describe "index page" do
+ it "has Highest-Rated games" do
+ visit('/')
+ expect(page).to have_content("Highest-Rated")
+ end
+
+ it "has Recently Added games" do
+ visit('/')
+ expect(page).to have_content("Recently Added")
+ end
+
+ it "has Recently Added games" do
+ visit('/')
+ expect(page).to have_css('ul')
+ end
+end
|
Add a couple of features tests
|
diff --git a/lib/lita/handlers/snoo.rb b/lib/lita/handlers/snoo.rb
index abc1234..def5678 100644
--- a/lib/lita/handlers/snoo.rb
+++ b/lib/lita/handlers/snoo.rb
@@ -1,6 +1,65 @@+require 'uri'
+
module Lita
module Handlers
class Snoo < Handler
+ config :domains, type: Array, default: ["imgur.com"]
+
+ route(/(#{URI.regexp})/, :url_search, command: false)
+ route(/^(?:reddit|snoo)\s+(#{URI.regexp})/i, :url_search, command: true,
+ help: {t("help.snoo_url_key") => t("help.snoo_url_value")})
+ route(/^\/?r\/(\S+)\s*(.*)/i, :subreddit, command: true,
+ help: {t("help.snoo_sub_key") => t("snoo_sub_value")})
+
+ def url_search(response)
+ domains = /#{config.domains.map {|d| Regexp.escape(d)}.join("|")}/
+ url = response.matches.first.first.split("#").first
+ # Lita::Message#command?
+ if response.message.command?
+ response.reply api_search(url, true)
+ elsif domains =~ url
+ post = api_search(url)
+ response.reply post if post
+ end
+ end
+
+ def subreddit(response)
+ end
+
+ private
+ def api_search(url, command=false)
+ http_response = http.get(
+ "https://www.reddit.com/search.json",
+ q: "url:'#{url}'",
+ sort: "top",
+ t: "all"
+ )
+ posts = MultiJson.load(http_response.body)["data"]["children"]
+ if posts.empty?
+ if command
+ return "No reddit posts found for #{url}"
+ else
+ return nil
+ end
+ end
+ format_post(posts.first)
+ end
+
+ private
+ def format_post(post)
+ title = post["data"]["title"]
+ author = post["data"]["author"]
+ subreddit = post["data"]["subreddit"]
+ date = Time.at(post["data"]["created"]).to_datetime.strftime("%F")
+ score = post["data"]["score"].to_s.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse
+ ups = post["data"]["ups"].to_f
+ downs = post["data"]["downs"].to_f
+ percent = "%.f" % (ups / (ups + downs) * 100)
+ id = post["data"]["id"]
+ nsfw = post["data"]["over_18"] ? "[NSFW] " : ""
+ "#{nsfw}#{title} - #{author} on /r/#{subreddit}, #{date} (#{score} points, #{percent}% upvoted) http://redd.it/#{id}"
+ end
+
end
Lita.register_handler(Snoo)
|
lib: Write routes and basic url_search functionality
|
diff --git a/lib/rails_admin_charts.rb b/lib/rails_admin_charts.rb
index abc1234..def5678 100644
--- a/lib/rails_admin_charts.rb
+++ b/lib/rails_admin_charts.rb
@@ -20,7 +20,7 @@ def graph_data since=30.days.ago
[
{
- name: model_name.pluralize,
+ name: model_name.plural,
pointInterval: 1.day * 1000,
pointStart: since.to_i * 1000,
data: self.total_records_since(since)
@@ -30,4 +30,4 @@ end
end
-require 'rails_admin_charts/rails_admin/config/actions/charts'+require 'rails_admin_charts/rails_admin/config/actions/charts'
|
Use `plural` instead of `pluralize` with ModelName instance in `graph_data`
Fixes Rails 4, rails_admin 0.5.0 'undefined method `pluralize' for #<ActiveModel::Name:0x007f93a0175990>'
|
diff --git a/lib/sprockets/browserify.rb b/lib/sprockets/browserify.rb
index abc1234..def5678 100644
--- a/lib/sprockets/browserify.rb
+++ b/lib/sprockets/browserify.rb
@@ -15,13 +15,21 @@ def evaluate(scope, locals, &block)
if (scope.pathname.dirname+'package.json').exist?
deps = `#{browserify_executable} --list #{scope.pathname}`
- raise "Error finding dependencies" unless $?.success?
+ unless $?.success?
+ puts deps
+ raise "Error finding dependencies"
+
+ end
deps.lines.drop(1).each{|path| scope.depend_on path.strip}
- @output ||= `#{browserify_executable} -d #{scope.pathname}`
- raise "Error compiling dependencies" unless $?.success?
- @output
+ output ||= `#{browserify_executable} -d #{scope.pathname}`
+ unless $?.success?
+ puts output
+ raise "Error compiling dependencies"
+ end
+
+ output
else
data
end
|
Add more error information in case of failure
|
diff --git a/lib/stradivari/generator.rb b/lib/stradivari/generator.rb
index abc1234..def5678 100644
--- a/lib/stradivari/generator.rb
+++ b/lib/stradivari/generator.rb
@@ -26,7 +26,7 @@ def title
case t = opts[:title]
when nil
- klass.human_attribute_name(name)
+ human_attribute_name
when Proc
view.instance_eval(&t)
when false
@@ -37,6 +37,14 @@ end
protected
+ def human_attribute_name
+ if klass.respond_to?(:human_attribute_name)
+ klass.human_attribute_name(name)
+ else
+ name.titleize
+ end
+ end
+
def force_presence(value)
if @opts.fetch(:present, nil)
value.presence || t(:empty).html_safe
|
Use human_attribute_name only if available on the model
|
diff --git a/backend/spec/views/comable/admin/orders/edit.slim_spec.rb b/backend/spec/views/comable/admin/orders/edit.slim_spec.rb
index abc1234..def5678 100644
--- a/backend/spec/views/comable/admin/orders/edit.slim_spec.rb
+++ b/backend/spec/views/comable/admin/orders/edit.slim_spec.rb
@@ -0,0 +1,27 @@+describe 'comable/admin/orders/edit' do
+ let(:order) { create(:order, :completed) }
+
+ before { assign(:order, order) }
+
+ it 'renders the edit product form' do
+ render
+ assert_select 'form[action=?]', comable.admin_order_path(order)
+ assert_select 'input[name=_method][value=?]', (Rails::VERSION::MAJOR == 3) ? 'put' : 'patch'
+ end
+
+ pending 'with #order_items' do
+ let(:order_item) { build(:order_item) }
+
+ before { order.order_items << order_item }
+
+ it 'renders the fields for OrderItem' do
+ render
+ assert_select 'form input' do
+ assert_select ':match("id", ?)', /order_order_items_attributes_\d_id/ do
+ assert_select '[type=hidden]'
+ assert_select '[value=?]', order_item.id.to_s
+ end
+ end
+ end
+ end
+end
|
Add the test cases for orders/edit.slim
|
diff --git a/libraries/tar_commands.rb b/libraries/tar_commands.rb
index abc1234..def5678 100644
--- a/libraries/tar_commands.rb
+++ b/libraries/tar_commands.rb
@@ -1,3 +1,45 @@+
+class TarCommandBuilder
+
+ def unpack
+ "#{tar_binary} #{args} #{resource.release_file} #{strip_args}"
+ end
+
+ def dump
+ "tar -mxf \"#{resource.release_file}\" -C \"#{resource.path}\""
+ end
+
+ def cherry_pick
+ "#{tar_binary} #{args} #{resource.release_file} -C #{resource.path} #{resource.creates}#{strip_args}"
+ end
+
+ def initialize(resource, options = {})
+ @resource = resource
+ @options = options
+ end
+
+ private
+
+ attr_reader :resource, :options
+
+ def node
+ resource.run_context.node
+ end
+
+ def tar_binary
+ resource.run_context.node['ark']['tar']
+ end
+
+ def args
+ options[:flags]
+ end
+
+ def strip_args
+ resource.strip_components > 0 ? " --strip-components=#{resource.strip_components}" : ""
+ end
+
+end
+
class TarUnpacker
def initialize(resource,options = {})
@@ -8,24 +50,9 @@ attr_reader :resource, :options
def command
- tar_command(options[:flags])
+ TarCommandBuilder.new(resource,options).unpack
end
- def node
- resource.run_context.node
- end
-
- def tar_command(tar_args)
- cmd = node['ark']['tar']
- cmd += " #{tar_args} "
- cmd += resource.release_file
- cmd += tar_strip_args
- cmd
- end
-
- def tar_strip_args
- resource.strip_components > 0 ? " --strip-components=#{resource.strip_components}" : ""
- end
end
class TarDumper
@@ -36,7 +63,7 @@ attr_reader :resource
def command
- "tar -mxf \"#{resource.release_file}\" -C \"#{resource.path}\""
+ TarCommandBuilder.new(resource).dump
end
end
@@ -49,27 +76,7 @@ attr_reader :resource, :options
def command
- cherry_pick_tar_command(options[:flags])
- end
-
- def node
- resource.run_context.node
- end
-
- def cherry_pick_tar_command(tar_args)
- cmd = node['ark']['tar']
- cmd += " #{tar_args}"
- cmd += " #{resource.release_file}"
- cmd += " -C"
- cmd += " #{resource.path}"
- cmd += " #{resource.creates}"
- cmd += tar_strip_args
- cmd
- end
-
- # private
- def tar_strip_args
- resource.strip_components > 0 ? " --strip-components=#{resource.strip_components}" : ""
+ TarCommandBuilder.new(resource,options).cherry_pick
end
end
|
Refactor individual tar command classes into a single class
Turned the commands into shim layer -- they will be removed in the libraries/default
|
diff --git a/lib/zombie_scout/mission.rb b/lib/zombie_scout/mission.rb
index abc1234..def5678 100644
--- a/lib/zombie_scout/mission.rb
+++ b/lib/zombie_scout/mission.rb
@@ -10,11 +10,14 @@ end
def scout
+ start_time = Time.now
zombies.each do |zombie|
puts [zombie.location, zombie.name] * "\t"
end
+ duration = Time.now - start_time
- puts "Scouted #{methods.size} methods in #{sources.size} files. Found #{zombies.size} potential zombies."
+ puts "Scouted #{methods.size} methods in #{sources.size} files, in #{duration}."
+ puts "Found #{zombies.size} potential zombies."
end
private
|
Add timing info to default output
|
diff --git a/config.rb b/config.rb
index abc1234..def5678 100644
--- a/config.rb
+++ b/config.rb
@@ -4,9 +4,9 @@ @debug = ""
@devops_bucket = ""
@cloud = 'aws'
-@availability_zone = ""
+@availability_zone = "us-west-2a"
@key_name = ""
-@image_id = "ami-5c120b19"
+@image_id = "ami-57e8d767"
@knife_config = ""
@berks_config = ""
@aws_access_key_id = ""
|
Use the latest Ubuntu AMI
|
diff --git a/config.ru b/config.ru
index abc1234..def5678 100644
--- a/config.ru
+++ b/config.ru
@@ -1,6 +1,11 @@ # For hosting on Heroku
require 'rack'
require 'rack/contrib/try_static'
+
+# "restrict" access for now
+use Rack::Auth::Basic, "Restricted Area" do |username, password|
+ [username, password] == [ENV['AUTH_USERNAME'], ENV['AUTH_PASSWORD']]
+end
# Serve files from the build directory
use Rack::TryStatic,
|
Use HTTP auth to restrict access
We need this because we can't use the font & crown on non-gov.uk pages.
The username/password are the default pseudo-secret
GDS-username/password combo.
|
diff --git a/config.ru b/config.ru
index abc1234..def5678 100644
--- a/config.ru
+++ b/config.ru
@@ -1,7 +1,4 @@ # This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
-
-map (ENV['RAILS_RELATIVE_URL_ROOT'] || '/') do
- run Rails.application
-end
+run Rails.application
|
Revert "run app in subdirectory"
This reverts commit e896b7241f498d172235e56c1e197cb36e7a7e46.
|
diff --git a/plugins/elasticsearch/check-es-cluster-status.rb b/plugins/elasticsearch/check-es-cluster-status.rb
index abc1234..def5678 100644
--- a/plugins/elasticsearch/check-es-cluster-status.rb
+++ b/plugins/elasticsearch/check-es-cluster-status.rb
@@ -0,0 +1,87 @@+#!/usr/bin/env ruby
+#
+# Checks ElasticSearch cluster status
+# ===
+#
+# DESCRIPTION:
+# This plugin checks the ElasticSearch cluster status, using its API.
+# This plugin is designed towards the Elasticsearch API Version 1.x
+#
+# OUTPUT:
+# plain-text
+#
+# PLATFORMS:
+# all
+#
+# DEPENDENCIES:
+# sensu-plugin Ruby gem
+# rest-client Ruby gem
+#
+# Copyright 2012 Sonian, Inc <[email protected]>
+# Copyright 2014 Yieldbot, Inc <[email protected]>
+#
+# Released under the same terms as Sensu (the MIT license); see LICENSE
+# for details.
+
+require 'rubygems' if RUBY_VERSION < '1.9.0'
+require 'sensu-plugin/check/cli'
+require 'rest-client'
+require 'json'
+
+class ESClusterStatus < Sensu::Plugin::Check::CLI
+
+ option :scheme,
+ :description => 'URI scheme',
+ :long => '--scheme SCHEME',
+ :default => 'http'
+
+ option :server,
+ :description => 'Elasticsearch server',
+ :short => '-s SERVER',
+ :long => '--server SERVER',
+ :default => 'localhost'
+
+ option :port,
+ :description => 'Port',
+ :short => '-p PORT',
+ :long => '--port PORT',
+ :default => '9200'
+
+ def get_es_resource(resource)
+ begin
+ r = RestClient::Resource.new("#{config[:scheme]}://#{config[:server]}:#{config[:port]}/#{resource}", :timeout => 45)
+ JSON.parse(r.get)
+ rescue Errno::ECONNREFUSED
+ warning 'Connection refused'
+ rescue RestClient::RequestTimeout
+ warning 'Connection timed out'
+ end
+ end
+
+ def is_master
+ state = get_es_resource('/_cluster/state?filter_routing_table=true&filter_metadata=true&filter_indices=true&filter_blocks=true&filter_nodes=true')
+ local = get_es_resource('/_nodes/_local')
+ local['nodes'].keys.first == state['master_node']
+ end
+
+ def get_status
+ health = get_es_resource('/_cluster/health')
+ health['status'].downcase
+ end
+
+ def run
+ if is_master
+ case get_status
+ when 'green'
+ ok "Cluster is green"
+ when 'yellow'
+ warning "Cluster is yellow"
+ when 'red'
+ critical "Cluster is red"
+ end
+ else
+ ok 'Not the master'
+ end
+ end
+
+end
|
Extend the configuration options for the check.
Make the check 1.x compliant
|
diff --git a/boundary_days.gemspec b/boundary_days.gemspec
index abc1234..def5678 100644
--- a/boundary_days.gemspec
+++ b/boundary_days.gemspec
@@ -20,6 +20,6 @@ spec.require_paths = ['lib']
spec.add_development_dependency 'bundler', '~> 2.0'
- spec.add_development_dependency 'rake', '~> 12.0'
+ spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rspec', '~> 3.0'
end
|
Update rake requirement from ~> 12.0 to ~> 13.0
Updates the requirements on [rake](https://github.com/ruby/rake) to permit the latest version.
- [Release notes](https://github.com/ruby/rake/releases)
- [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc)
- [Commits](https://github.com/ruby/rake/compare/v12.0.0...v13.0.3)
Signed-off-by: dependabot[bot] <[email protected]>
|
diff --git a/revuelog.rb b/revuelog.rb
index abc1234..def5678 100644
--- a/revuelog.rb
+++ b/revuelog.rb
@@ -8,10 +8,7 @@ end
def to_hash
- revuehash = Revuelog.new(@time,@nick,@message)
- hash = {}
- revuehash.instance_variables.each {|var| hash[var.to_s.delete("@")] = revuehash.instance_variable_get(var) }
- p hash
+ {"time" => @time, "nick" => @nick, "message" => @message}
end
end
|
Update hash creation with very simple stuff
|
diff --git a/test/fixtures/policies/_base.rb b/test/fixtures/policies/_base.rb
index abc1234..def5678 100644
--- a/test/fixtures/policies/_base.rb
+++ b/test/fixtures/policies/_base.rb
@@ -1,7 +1,7 @@ default_source :community
default_source :chef_repo, '..'
cookbook 'consul', path: '../../..'
-run_list 'consul::default', "consul_spec::#{name}"
+run_list 'sudo::default', 'consul::default', "consul_spec::#{name}"
named_run_list :centos, 'yum::default', 'yum-centos::default', run_list
named_run_list :debian, 'apt::default', run_list
named_run_list :freebsd, 'freebsd::default', run_list
|
Add sudo default recipe to fix /etc/sudoers
|
diff --git a/test/test_buienalarm_scraper.rb b/test/test_buienalarm_scraper.rb
index abc1234..def5678 100644
--- a/test/test_buienalarm_scraper.rb
+++ b/test/test_buienalarm_scraper.rb
@@ -12,4 +12,13 @@ error.message
end
+ def test_that_scrape_returns_valid_result
+ location = "rotterdam"
+ result = Buienalarm::Scraper.scrape(location)
+ assert result.is_a? Array
+
+ # TODO: Add more assertions
+
+ end
+
end
|
Add basic success case test
|
diff --git a/app/models/manageiq/providers/lenovo/inventory/parser/component_parser/config_pattern.rb b/app/models/manageiq/providers/lenovo/inventory/parser/component_parser/config_pattern.rb
index abc1234..def5678 100644
--- a/app/models/manageiq/providers/lenovo/inventory/parser/component_parser/config_pattern.rb
+++ b/app/models/manageiq/providers/lenovo/inventory/parser/component_parser/config_pattern.rb
@@ -6,7 +6,8 @@ :name => 'name',
:description => 'description',
:user_defined => 'userDefined',
- :in_use => 'inUse'
+ :in_use => 'inUse',
+ :type => :type
}.freeze
def build(config_pattern)
@@ -26,5 +27,9 @@ def parse_config_pattern(config_pattern)
parse(config_pattern, CONFIG_PATTERNS)
end
+
+ def type(_config_pattern)
+ 'ManageIQ::Providers::Lenovo::PhysicalInfraManager::ConfigPattern'
+ end
end
end
|
Add the config pattern type for the graph refresh
|
diff --git a/carbon-router.gemspec b/carbon-router.gemspec
index abc1234..def5678 100644
--- a/carbon-router.gemspec
+++ b/carbon-router.gemspec
@@ -18,6 +18,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
+ spec.add_runtime_dependency "bunny", "0.8.0"
spec.add_development_dependency "bundler", "~> 1.6"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec"
|
Add bunny gem for MQ connection
|
diff --git a/Formula/djview4.rb b/Formula/djview4.rb
index abc1234..def5678 100644
--- a/Formula/djview4.rb
+++ b/Formula/djview4.rb
@@ -9,6 +9,8 @@ depends_on 'qt'
def install
+ # Added bug upstream to fix this:
+ # https://sourceforge.net/tracker/?func=detail&aid=3146507&group_id=32953&atid=406583
inreplace "Makefile.in" do |s|
s.gsub! '${INSTALL_PROGRAM} src/djview ${DESTDIR}${bindir}/djview4', '/bin/cp -r src/djview.app ${DESTDIR}${prefix}'
end
|
Add DjView4 upstream bug URL.
|
diff --git a/spec/opal_converter_spec.rb b/spec/opal_converter_spec.rb
index abc1234..def5678 100644
--- a/spec/opal_converter_spec.rb
+++ b/spec/opal_converter_spec.rb
@@ -16,7 +16,7 @@ end
it "matches .opal files" do
- expect(subject.matches(".opal")).to be(true)
+ expect(subject.matches(".opal")).to be_truthy
end
it "outputs .js" do
|
Use be_truthy instead of be(true) for Converter.matches
|
diff --git a/spec/storey/schemas_spec.rb b/spec/storey/schemas_spec.rb
index abc1234..def5678 100644
--- a/spec/storey/schemas_spec.rb
+++ b/spec/storey/schemas_spec.rb
@@ -36,15 +36,23 @@ end
end
- context "when :public => true" do
- it "should return an array of the schemas without the public schema" do
- Storey.schemas(:public => true).should include("public")
+ context "`:public` option" do
+ context "when `public: true`" do
+ it "returns an array of the schemas including the public schema" do
+ expect(Storey.schemas(public: true)).to include("public")
+ end
end
- end
- context "when :public => false" do
- it "should return an array of the schemas with the public schema" do
- Storey.schemas(:public => false).should_not include("public")
+ context "when `public: false`" do
+ it "returns an array of the schemas without the public schema" do
+ expect(Storey.schemas(public: false)).to_not include("public")
+ end
+ end
+
+ context "when `public` is not set" do
+ it "returns an array of the schemas including the public schema" do
+ expect(Storey.schemas).to include("public")
+ end
end
end
|
Test when `Storey.schemas` does not include `public`
Also update tests to use new RSpec syntax
|
diff --git a/ASOAnimatedButton.podspec b/ASOAnimatedButton.podspec
index abc1234..def5678 100644
--- a/ASOAnimatedButton.podspec
+++ b/ASOAnimatedButton.podspec
@@ -1,12 +1,12 @@ Pod::Spec.new do |s|
s.name = "ASOAnimatedButton"
- s.version = "0.2.0"
+ s.version = "0.3.0"
s.summary = 'An easy-to-configure animated button'
s.description = 'ASOAnimatedButton is a storyboard friendly library to animate button to have a two-state or bounce effect. One of the popular implementations of this library is to be used in developing a Tumblr-like menu button style. Refer to its project examples for its various implementations.'
s.homepage = "https://github.com/agusso/ASOAnimatedButton"
s.license = 'MIT'
s.author = { 'Agus Soedibjo' => '[email protected]' }
- s.source = { :git => 'https://github.com/agusso/ASOAnimatedButton.git', :tag => '0.2.0' }
+ s.source = { :git => 'https://github.com/agusso/ASOAnimatedButton.git', :tag => '0.3.0' }
s.platform = :ios, '7.0'
s.requires_arc = true
|
Modify podspec to refer to version 0.3.0
|
diff --git a/spec/rack_jax/app_wrapper_postprocessing_spec.rb b/spec/rack_jax/app_wrapper_postprocessing_spec.rb
index abc1234..def5678 100644
--- a/spec/rack_jax/app_wrapper_postprocessing_spec.rb
+++ b/spec/rack_jax/app_wrapper_postprocessing_spec.rb
@@ -42,7 +42,9 @@
let(:response) {wrapper.handle(request)}
- it 'response has status code' do
- expect(response.status).to eq(200)
+ context 'response has' do
+ it 'status code' do
+ expect(response.status).to eq(200)
+ end
end
end
|
Add a context block for the doc output
|
diff --git a/buildkit.gemspec b/buildkit.gemspec
index abc1234..def5678 100644
--- a/buildkit.gemspec
+++ b/buildkit.gemspec
@@ -21,6 +21,6 @@
spec.required_ruby_version = '>= 2.3'
- spec.add_dependency 'sawyer', '~> 0.6'
+ spec.add_dependency 'sawyer', '>= 0.6'
spec.add_development_dependency 'bundler'
end
|
gemspec: Allow versions of sawyer >= 0.6
|
diff --git a/business.gemspec b/business.gemspec
index abc1234..def5678 100644
--- a/business.gemspec
+++ b/business.gemspec
@@ -22,6 +22,6 @@
spec.add_development_dependency "gc_ruboconfig", "~> 2.30.0"
spec.add_development_dependency "rspec", "~> 3.1"
- spec.add_development_dependency "rspec_junit_formatter", "~> 0.4.1"
+ spec.add_development_dependency "rspec_junit_formatter", "~> 0.5.1"
spec.add_development_dependency "rubocop", "~> 1.24.1"
end
|
Update rspec_junit_formatter requirement from ~> 0.4.1 to ~> 0.5.1
Updates the requirements on [rspec_junit_formatter](https://github.com/sj26/rspec_junit_formatter) to permit the latest version.
- [Release notes](https://github.com/sj26/rspec_junit_formatter/releases)
- [Changelog](https://github.com/sj26/rspec_junit_formatter/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sj26/rspec_junit_formatter/compare/v0.4.1...v0.5.1)
---
updated-dependencies:
- dependency-name: rspec_junit_formatter
dependency-type: direct:development
...
Signed-off-by: dependabot[bot] <[email protected]>
|
diff --git a/Library/Formula/go.rb b/Library/Formula/go.rb
index abc1234..def5678 100644
--- a/Library/Formula/go.rb
+++ b/Library/Formula/go.rb
@@ -1,7 +1,7 @@ require 'formula'
class Go <Formula
- head 'https://go.googlecode.com/hg/'
+ head 'https://go.googlecode.com/hg/', :revision => 'release'
homepage 'http://golang.org'
aka 'google-go'
|
Use the release version for Go
|
diff --git a/Casks/balsamiq-mockups.rb b/Casks/balsamiq-mockups.rb
index abc1234..def5678 100644
--- a/Casks/balsamiq-mockups.rb
+++ b/Casks/balsamiq-mockups.rb
@@ -0,0 +1,7 @@+class BalsamiqMockups < Cask
+ url 'http://builds.balsamiq.com/b/mockups-desktop/MockupsForDesktop.dmg'
+ homepage 'http://balsamiq.com/'
+ version 'latest'
+ no_checksum
+ link 'Balsamiq Mockups.app'
+end
|
Add a cask for Balsamiq Mockups
Adds a cask for Balsamiq Mockups, a rapid wireframing tool.
|
diff --git a/Casks/sublime-text-dev.rb b/Casks/sublime-text-dev.rb
index abc1234..def5678 100644
--- a/Casks/sublime-text-dev.rb
+++ b/Casks/sublime-text-dev.rb
@@ -1,8 +1,8 @@ class SublimeTextDev < Cask
- version 'Build 3064'
- sha256 '727d14b2ba577c680a2d90645db16f6f736c545820fe90d44cc85ac6808c2f03'
+ version 'Build 3066'
+ sha256 '89916ed41a5de64e7257a5161d529925f3c8e2613a8e2d417111cb72740cac9c'
- url 'http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%20Build%203064.dmg'
+ url 'http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%20Build%203066.dmg'
homepage 'http://www.sublimetext.com/3dev'
license :closed
|
Upgrade Sublime Text Dev to Build 3066
|
diff --git a/config/application.rb b/config/application.rb
index abc1234..def5678 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -24,6 +24,7 @@ config.load_defaults(6.1)
config.i18n.default_locale = :'zh-TW'
+ config.i18n.fallbacks = true
config.i18n.available_locales = %i[
zh-TW
en
|
Enable i18n fallback to zh-TW
|
diff --git a/config/application.rb b/config/application.rb
index abc1234..def5678 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -20,6 +20,9 @@ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
+ # activejob queue adapter
+ config.active_job.queue_adapter = :sidekiq
+
# Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true
end
|
Set sidekiq as the activejob queue
Signed-off-by: Max Fierke <[email protected]>
|
diff --git a/config/application.rb b/config/application.rb
index abc1234..def5678 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -18,6 +18,6 @@
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
- # config.i18n.default_locale = :de
+ config.i18n.default_locale = :bg
end
end
|
Use Bulgarian as the default locale
|
diff --git a/app/classes/forest/markdown_renderer.rb b/app/classes/forest/markdown_renderer.rb
index abc1234..def5678 100644
--- a/app/classes/forest/markdown_renderer.rb
+++ b/app/classes/forest/markdown_renderer.rb
@@ -15,6 +15,12 @@ }
end
+ def header(text, header_level)
+ sanitized_name = ActionView::Base.full_sanitizer.sanitize(text).parameterize
+
+ "<h#{header_level} name=\"#{sanitized_name}\">#{text}</h#{header_level}>"
+ end
+
def postprocess(full_document)
return full_document if full_document.blank?
|
Add parameterized name attribute to markdown header tags
|
diff --git a/app/controllers/purchases_controller.rb b/app/controllers/purchases_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/purchases_controller.rb
+++ b/app/controllers/purchases_controller.rb
@@ -31,7 +31,7 @@ if @purchase.update_attributes purchases_params
redirect_to user_path(session[:user_id])
else
- flash[:error] = "Your purchase must be greater than $0."
+ flash[:error] = "Your purchase must have a name and be greater than $0."
redirect_to user_path(session[:user_id])
end
end
|
Update purchase create error message
|
diff --git a/app/controllers/questions_controller.rb b/app/controllers/questions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/questions_controller.rb
+++ b/app/controllers/questions_controller.rb
@@ -0,0 +1,49 @@+class QuestionsController < ActionController::Base
+
+ def index
+ @question = Question.all
+ end
+
+ def show
+ @question = Question.find(params[:id])
+ end
+
+ def create
+ @question = Question.new(question_params)
+ if @item.save
+ redirect_to questions_path
+ end
+
+ end
+
+ def new
+ @question = Question.new
+ end
+
+ def edit
+ @question = Question.find(params[:id])
+ end
+
+ def update
+ @question = Question.find(params[:id])
+ @question.assign_attributes(question_params)
+ if @question.save
+ redirect_to @question
+ else
+ render :edit
+ end
+
+ def destroy
+ @question = Question.find(params[:id])
+ @question.destroy
+ flash[:notice] = "Question has been deleted"
+ redirect_to questions_path
+ end
+
+ private
+
+ def question_params
+ params.require(:question).permit(:title, :body, :view_count, :user_id)
+ end
+
+end
|
Add basic CRUD to QuestionsController
|
diff --git a/app/models/enhancements/curated_list.rb b/app/models/enhancements/curated_list.rb
index abc1234..def5678 100644
--- a/app/models/enhancements/curated_list.rb
+++ b/app/models/enhancements/curated_list.rb
@@ -2,6 +2,6 @@
class CuratedList
def usable_artefacts
- artefacts.select { |a| ["draft", "live"].include?(a.state) }
+ artefacts.reject { |a| a.archived? }
end
end
|
Simplify selection of curatable artefacts
|
diff --git a/spec/models/config_builder_spec.rb b/spec/models/config_builder_spec.rb
index abc1234..def5678 100644
--- a/spec/models/config_builder_spec.rb
+++ b/spec/models/config_builder_spec.rb
@@ -1,4 +1,8 @@-require "rails_helper"
+require "spec_helper"
+require "app/models/config_builder"
+require "app/models/config/base"
+require "app/models/config/ruby"
+require "app/models/config/unsupported"
describe ConfigBuilder do
describe ".for" do
|
Reduce spec dependencies for ConfigBuilder
This test/code doesn't need the whole Rails framework.
Shave off precious time on focused spec runs :)
|
diff --git a/spec/models/transportation_spec.rb b/spec/models/transportation_spec.rb
index abc1234..def5678 100644
--- a/spec/models/transportation_spec.rb
+++ b/spec/models/transportation_spec.rb
@@ -1,5 +1,34 @@ require 'rails_helper'
-RSpec.describe Transportation, :type => :model do
- pending "add some examples to (or delete) #{__FILE__}"
+describe Transportation do
+ let(:transportation) { FactoryGirl.create(:transportation) }
+
+ context "valid transportation" do
+ it "has valid factory" do
+ expect(transportation.valid?).to be_truthy
+ end
+
+ it "has description" do
+ transportation.description = nil
+ expect(transportation.valid?).to be_falsey
+ end
+
+ it "description's length >= 10" do
+ transportation.description = 'Ten chars.'
+ expect(transportation.valid?).to be_truthy
+ end
+
+ it "has priority" do
+ transportation.priority = nil
+ expect(transportation.valid?).to be_falsey
+ end
+
+ it "accepts only integer for priority" do
+ expect(transportation.priority).to be_instance_of Fixnum
+ end
+
+ it "priority's value is natural number" do
+ expect(transportation.priority.to_i).to be > 0
+ end
+ end
end
|
Add tests for valid transportation
|
diff --git a/SPTDataLoader.podspec b/SPTDataLoader.podspec
index abc1234..def5678 100644
--- a/SPTDataLoader.podspec
+++ b/SPTDataLoader.podspec
@@ -16,9 +16,10 @@ s.tvos.deployment_target = "9.0"
s.watchos.deployment_target = "2.0"
- s.homepage = "https://github.com/spotify/SPTDataLoader"
- s.license = "Apache 2.0"
- s.author = {
+ s.homepage = "https://github.com/spotify/SPTDataLoader"
+ s.social_media_url = "https://twitter.com/spotifyeng"
+ s.license = "Apache 2.0"
+ s.author = {
"Will Sackfield" => "[email protected]"
}
|
Add social media URL to podspec
- Pointing it at our Engineering account on Twitter.
|
diff --git a/test/daimon_skycrawlers/generator/new_test.rb b/test/daimon_skycrawlers/generator/new_test.rb
index abc1234..def5678 100644
--- a/test/daimon_skycrawlers/generator/new_test.rb
+++ b/test/daimon_skycrawlers/generator/new_test.rb
@@ -0,0 +1,73 @@+require "test_helper"
+require "daimon_skycrawlers/generator/new"
+
+class GenerateNewTest < Test::Unit::TestCase
+ setup do
+ @command = DaimonSkycrawlers::Generator::New
+ @current_directory = Dir.pwd
+ @working_directory = fixture_path("tmp/new")
+ @working_directory.mkpath
+ Dir.chdir(@working_directory)
+ end
+
+ teardown do
+ FileUtils.rm_rf(@working_directory)
+ Dir.chdir(@current_directory)
+ end
+
+ test "generate new" do
+ out = capture_stdout do
+ @command.start(["sample"])
+ end
+ assert_equal(31, out.lines.size)
+ source = File.read("sample/README.md")
+ assert_equal("# sample\n", source.lines.first)
+ db_env = File.read("sample/.env.db").lines.map {|line| line.chomp.split("=") }.to_h
+ db_password = db_env.delete("DATABASE_PASSWORD")
+ expected_db_env = {
+ "POSTGRES_USER" => "postgres",
+ "POSTGRES_PASSWORD" => db_password,
+ "DATABASE_USER" => "crawler",
+ "DATABASE_PREFIX" => "sample"
+ }
+ assert_equal(expected_db_env, db_env)
+ env = File.read("sample/.env").lines.map {|line| line.chomp.split("=") }.to_h
+ expected_env = {
+ "SKYCRAWLERS_RABBITMQ_HOST" => "sample-rabbitmq",
+ "SKYCRAWLERS_RABBITMQ_PORT" => "5672",
+ "DATABASE_HOST" => "sample-db",
+ "DATABASE_PORT" => "5432",
+ "DATABASE_URL" => "postgres://crawler:#{db_password}@sample-db/sample_development"
+ }
+ assert_equal(expected_env, env)
+ docker_compose = YAML.load_file("sample/docker-compose.yml")
+ services = docker_compose["services"].keys
+ expected_services = ["sample-rabbitmq", "sample-db", "sample-common", "sample-crawler", "sample-processor"]
+ assert_equal(expected_services, services)
+ expected_migration = <<SOURCE
+class CreatePages < ActiveRecord::Migration[5.0]
+ def change
+ create_table :pages do |t|
+ t.string :key
+ t.string :url
+ t.text :headers
+ t.binary :body
+ t.datetime :last_modified_at
+ t.string :etag
+
+ t.timestamps
+
+ t.index [:key]
+ t.index [:key, :updated_at]
+ t.index [:url]
+ t.index [:url, :updated_at]
+ end
+ end
+end
+SOURCE
+ Dir.glob("sample/db/migrate/*_create_pages.rb") do |entry|
+ assert { File.file?(entry) }
+ assert_equal(expected_migration, File.read(entry))
+ end
+ end
+end
|
Add test for `daimon_skycrawlers new`
|
diff --git a/idl_iw.rb b/idl_iw.rb
index abc1234..def5678 100644
--- a/idl_iw.rb
+++ b/idl_iw.rb
@@ -15,7 +15,7 @@ # stdout, stderr
Thread.new do
o.each do |line|
- puts line
+ puts "\033[2K\r" + line
end
end
|
Add escape sequence for print stdout
|
diff --git a/app/serializers/user_serializer.rb b/app/serializers/user_serializer.rb
index abc1234..def5678 100644
--- a/app/serializers/user_serializer.rb
+++ b/app/serializers/user_serializer.rb
@@ -13,7 +13,8 @@ :profile_type,
:twitter_url,
:name,
- :image_url
+ :image_url,
+ :admin
def name
object.display_name
|
Add admin field to user serializer
|
diff --git a/lib/dotjs_sprockets/tilt_dot.rb b/lib/dotjs_sprockets/tilt_dot.rb
index abc1234..def5678 100644
--- a/lib/dotjs_sprockets/tilt_dot.rb
+++ b/lib/dotjs_sprockets/tilt_dot.rb
@@ -10,13 +10,25 @@ #
# @since 0.1.0
class TiltDot < Tilt::Template
+ # Define the mime type of the template
+ #
+ # @since 0.1.0
def self.default_mime_type
"application/javascript"
end
+ # Required method definition in order to implement the Tilt::Template
+ # interface
+ #
+ # @since 0.1.0
def prepare
end
+ # Execute the compiled template and return the result string
+ #
+ # @return [String] the compiled template
+ #
+ # @since 0.1.0
def evaluate(scope, locals, &block)
template_name = scope.pathname
DotjsSprockets::Engine.precompile(template_name)
|
Add missing documentation for the TiltDot class
|
diff --git a/lib/faraday_persistent_excon.rb b/lib/faraday_persistent_excon.rb
index abc1234..def5678 100644
--- a/lib/faraday_persistent_excon.rb
+++ b/lib/faraday_persistent_excon.rb
@@ -23,7 +23,7 @@ self.excon_options = {}
self.perform_request_class = FaradayPersistentExcon::PerformRequest
self.connection_pools = {}
- self.idempotent_methods = %w/GET HEAD PUT DELETE OPTIONS TRACE/
+ self.idempotent_methods = %w[GET HEAD PUT DELETE OPTIONS TRACE]
self.retry_idempotent_methods = true
self.retry_limit = 1
end
|
Use less confusing literal terminators
|
diff --git a/lib/orientdb-schema-migrator.rb b/lib/orientdb-schema-migrator.rb
index abc1234..def5678 100644
--- a/lib/orientdb-schema-migrator.rb
+++ b/lib/orientdb-schema-migrator.rb
@@ -32,6 +32,10 @@ end
def self.client
- Orientdb4r.client(:host => get_config["host"])
+ if defined?($client)
+ $client
+ else
+ $client = Orientdb4r.client(:host => get_config["host"])
+ end
end
end
|
Store initialized Orientdb4r client in global variable.
Reduces client initialization.
|
diff --git a/lib/redirector/tna_timestamp.rb b/lib/redirector/tna_timestamp.rb
index abc1234..def5678 100644
--- a/lib/redirector/tna_timestamp.rb
+++ b/lib/redirector/tna_timestamp.rb
@@ -3,17 +3,19 @@
module Redirector
class TNATimestamp
+ TNA_BASE_URL = "http://webarchive.nationalarchives.gov.uk"
+
def initialize(hostname)
@hostname = hostname
end
def find
begin
- response = open("http://webarchive.nationalarchives.gov.uk/*/http://#{@hostname}")
+ response = open("#{TNA_BASE_URL}/*/http://#{@hostname}")
rescue OpenURI::HTTPError
puts "Couldn't find a crawl. Trying HTTPS..."
begin
- response = open("http://webarchive.nationalarchives.gov.uk/*/https://#{@hostname}")
+ response = open("#{TNA_BASE_URL}/*/https://#{@hostname}")
rescue OpenURI::HTTPError
$stderr.puts("TNA don't appear to have crawled this (yet) #{@hostname} Try the aliases?")
return nil
|
Make the TNA base URL a constant for shorter lines
|
diff --git a/pakyow-realtime/lib/pakyow-realtime/message_handlers/call_route.rb b/pakyow-realtime/lib/pakyow-realtime/message_handlers/call_route.rb
index abc1234..def5678 100644
--- a/pakyow-realtime/lib/pakyow-realtime/message_handlers/call_route.rb
+++ b/pakyow-realtime/lib/pakyow-realtime/message_handlers/call_route.rb
@@ -3,7 +3,13 @@ Pakyow::Realtime.handler :'call-route' do |message, session, response|
path, qs = message['uri'].split('?')
path_parts = path.split('/')
- path_parts << 'index' if path_parts.count == 3
+
+ if path =~ /^https?:\/\//
+ path_parts << 'index' if path_parts.count == 3
+ else
+ path_parts << 'index' if path_parts.empty?
+ end
+
path_parts[-1] += '.json'
uri = [path_parts.join('/'), qs].join('?')
|
Fix call-route for cases where only path is passed
|
diff --git a/spec/version_bomb_spec.rb b/spec/version_bomb_spec.rb
index abc1234..def5678 100644
--- a/spec/version_bomb_spec.rb
+++ b/spec/version_bomb_spec.rb
@@ -2,7 +2,7 @@
describe VersionBomb do
describe ".bomb!" do
- it "blows up when the version matches the requirement" do
+ it "blows up when the version doesn't match the requirement" do
version = double
requirement = Gem::Requirement.new
requirement.stub(:satisfied_by?).with(version).and_return(false)
@@ -12,7 +12,7 @@ end.to raise_error VersionBomb::Bomb
end
- it "does nothing when the version doesn't match the requirement" do
+ it "does nothing when the version does match the requirement" do
version = double
requirement = Gem::Requirement.new
requirement.stub(:satisfied_by?).with(version).and_return(true)
|
Fix spec description that didn't match the code
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,5 +1,5 @@ Rails.application.routes.draw do
- root 'lists#index'
+ root 'lists#show', id: AllFoodsList::ID
resources :lists, only: [:show, :index, :edit, :update]
resources :foods, only: [:new, :create, :edit, :update, :destroy]
|
Make the All Foods list the homepage
|
diff --git a/apps.rb b/apps.rb
index abc1234..def5678 100644
--- a/apps.rb
+++ b/apps.rb
@@ -1,14 +1,26 @@-def cask(name); dep name, :template => "icelab:cask"; end # Avoid repitition below
+dep "apps" do
+ requires "mac app store apps"
+ requires "homebrew cask apps"
+end
-cask "dash"
-cask "fork"
-cask "google-chrome"
-cask "imageoptim"
-cask "iterm2"
-cask "launchbar"
-cask "licecap"
-cask "postico"
-cask "sublime-text"
-cask "virtualbox"
-cask "visual-studio-code"
-cask "vlc"
+dep "mac app store apps" do
+ requires "Pixelmator.mas"
+ requires "Ulysses.mas"
+end
+
+dep "homebrew cask apps" do
+ requires "caffeine"
+ requires "dash"
+ requires "fork"
+ requires "google-chrome"
+ requires "imageoptim"
+ requires "iterm2"
+ requires "launchbar"
+ requires "licecap"
+ requires "postico"
+ requires "sublime-text"
+ requires "virtualbox"
+ requires "visual-studio-code"
+ requires "vlc"
+end
+
|
Restructure reps and add Caffeine
|
diff --git a/bitpagos.gemspec b/bitpagos.gemspec
index abc1234..def5678 100644
--- a/bitpagos.gemspec
+++ b/bitpagos.gemspec
@@ -12,6 +12,7 @@ s.homepage = "http://github.com/ombulabs/bitpagos"
s.license = "MIT"
+ s.add_dependency("rest-client", "~> 1.8")
s.add_development_dependency("rspec", "~> 3.3")
s.add_development_dependency("rake", "~> 10.4")
s.add_development_dependency("pry-byebug", "~> 3.2")
|
Use RestClient instead of OAuth2.
|
diff --git a/lib/active_crew/concerns/lockable.rb b/lib/active_crew/concerns/lockable.rb
index abc1234..def5678 100644
--- a/lib/active_crew/concerns/lockable.rb
+++ b/lib/active_crew/concerns/lockable.rb
@@ -5,10 +5,10 @@ end
def locked?
- options = context[:locker]
+ options = context.delete :locker
return false if options.blank?
- model = deserialize_locker
+ model = deserialize_locker options
return true if model.blank?
model.locker != options[:value]
@@ -33,9 +33,8 @@ value: model.lock }
end
- def deserialize_locker
- locker = context[:locker]
- locker[:class].safe_constantize&.find locker[:id]
+ def deserialize_locker(options)
+ options[:class].safe_constantize&.find options[:id]
end
end
end
|
Remove locker after apply it
|
diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/application_controller_renderer.rb b/railties/lib/rails/generators/rails/app/templates/config/initializers/application_controller_renderer.rb
index abc1234..def5678 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/initializers/application_controller_renderer.rb
+++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/application_controller_renderer.rb
@@ -1,5 +1,5 @@-## Change renderer defaults here.
-#
+# Be sure to restart your server when you modify this file.
+
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
|
Bring comment in line with rest of initializers
|
diff --git a/lib/jekyll/converters/sass.rb b/lib/jekyll/converters/sass.rb
index abc1234..def5678 100644
--- a/lib/jekyll/converters/sass.rb
+++ b/lib/jekyll/converters/sass.rb
@@ -33,10 +33,7 @@ end
def sass_dir_relative_to_site_source
- File.join(
- @config["source"],
- File.expand_path(sass_dir, "/") # FIXME: Not windows-compatible
- )
+ Jekyll.sanitized_path(@config["source"], sass_dir)
end
def allow_caching?
|
Use the new, shiny Jekyll.sanitized_path
|
diff --git a/split-api.gemspec b/split-api.gemspec
index abc1234..def5678 100644
--- a/split-api.gemspec
+++ b/split-api.gemspec
@@ -22,5 +22,5 @@ gem.add_development_dependency 'bundler'
gem.add_development_dependency 'rspec', '~> 3.8.0'
gem.add_development_dependency 'rack-test', '~> 1.1'
- gem.add_development_dependency 'rake', '~> 12.0'
+ gem.add_development_dependency 'rake', '~> 13.0'
end
|
Update rake requirement from ~> 12.0 to ~> 13.0
Updates the requirements on [rake](https://github.com/ruby/rake) to permit the latest version.
- [Release notes](https://github.com/ruby/rake/releases)
- [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc)
- [Commits](https://github.com/ruby/rake/compare/v12.0.0...v13.0.0)
Signed-off-by: dependabot-preview[bot] <[email protected]>
|
diff --git a/heidrun/uw_qdc.rb b/heidrun/uw_qdc.rb
index abc1234..def5678 100644
--- a/heidrun/uw_qdc.rb
+++ b/heidrun/uw_qdc.rb
@@ -0,0 +1,81 @@+def uw_preview(identifier)
+ id = identifier.rpartition(':').last.split('/')
+ return nil if id.count != 2
+ 'http://cdm16786.contentdm.oclc.org/utils/getthumbnail/collection/' \
+ "#{id[0]}/id/#{id[1]}"
+end
+
+Krikri::Mapper.define(:uw_qdc,
+ :parser => Krikri::QdcParser) do
+ provider :class => DPLA::MAP::Agent do
+ uri 'http://dp.la/api/contributor/washington'
+ label 'University of Washington'
+ end
+
+ dataProvider :class => DPLA::MAP::Agent do
+ providedLabel record.field('dc:source').first_value
+ end
+
+ isShownAt :class => DPLA::MAP::WebResource do
+ uri record.field('dc:identifier').last_value
+ end
+
+ preview :class => DPLA::MAP::WebResource do
+ uri header.field('xmlns:identifier').first_value
+ .map { |i| uw_preview(i.value) }
+ end
+
+ originalRecord :class => DPLA::MAP::WebResource do
+ uri record_uri
+ end
+
+ sourceResource :class => DPLA::MAP::SourceResource do
+ collection :class => DPLA::MAP::Collection,
+ :each => record.field('dcterms:isPartOf'),
+ :as => :coll do
+ title coll
+ end
+
+ creator :class => DPLA::MAP::Agent,
+ :each => record.field('dc:creator'),
+ :as => :creator do
+ providedLabel creator
+ end
+
+ date :class => DPLA::MAP::TimeSpan,
+ :each => record.field('dc:date').first_value,
+ :as => :created do
+ providedLabel created
+ end
+
+ description record.field('dc:description')
+
+ dcformat record.field('dc:type')
+
+ identifier record.field('dc:identifier')
+
+ language :class => DPLA::MAP::Controlled::Language,
+ :each => record.field('dc:language'),
+ :as => :lang do
+ prefLabel lang
+ end
+
+ spatial :class => DPLA::MAP::Place,
+ :each => record.field('dc:coverage'),
+ :as => :place do
+ providedLabel place
+ end
+
+ rights record.field('dc:rights')
+
+ subject :class => DPLA::MAP::Concept,
+ :each => record.field('dc:subject'),
+ :as => :subject do
+ providedLabel subject
+ end
+
+ title record.field('dc:title')
+
+ dctype record.field('dc:type')
+ end
+end
|
Implement initial UW mapping for QDC
|
diff --git a/test/apis/test_api_users_validate.rb b/test/apis/test_api_users_validate.rb
index abc1234..def5678 100644
--- a/test/apis/test_api_users_validate.rb
+++ b/test/apis/test_api_users_validate.rb
@@ -0,0 +1,56 @@+require_relative "../test_helper"
+
+# Deprecated API.
+class Test::Apis::TestApiUsersValidate < Minitest::Test
+ include ApiUmbrellaTestHelpers::Setup
+
+ def setup
+ super
+ setup_server
+ ApiUser.where(:registration_source.ne => "seed").delete_all
+ end
+
+ def test_valid_api_key
+ user = FactoryBot.create(:api_user)
+ response = Typhoeus.get("https://127.0.0.1:9081/api-umbrella/api-users/#{user.api_key}/validate.json", http_options)
+ assert_response_code(200, response)
+
+ data = MultiJson.load(response.body)
+ assert_equal({
+ "status" => "valid",
+ }, data)
+ end
+
+ def test_invalid_api_key
+ user = FactoryBot.create(:api_user)
+ response = Typhoeus.get("https://127.0.0.1:9081/api-umbrella/api-users/#{user.api_key}foo/validate.json", http_options)
+ assert_response_code(200, response)
+
+ data = MultiJson.load(response.body)
+ assert_equal({
+ "status" => "invalid",
+ }, data)
+ end
+
+ def test_invalid_char_api_key
+ response = Typhoeus.get("https://127.0.0.1:9081/api-umbrella/api-users/%27/validate.json", http_options)
+ assert_response_code(200, response)
+
+ data = MultiJson.load(response.body)
+ assert_equal({
+ "status" => "invalid",
+ }, data)
+ end
+
+ def test_empty_api_key
+ response = Typhoeus.get("https://127.0.0.1:9081/api-umbrella/api-users//validate.json", http_options)
+ assert_response_code(404, response)
+ end
+
+ def test_requires_api_key
+ user = FactoryBot.create(:api_user)
+ response = Typhoeus.get("https://127.0.0.1:9081/api-umbrella/api-users/#{user.api_key}/validate.json", keyless_http_options)
+ assert_response_code(403, response)
+ assert_match("API_KEY_MISSING", response.body)
+ end
+end
|
Add test for deprecated api key validation endpoint.
Just so we have test coverage.
|
diff --git a/test/bmff/box/test_data_entry_urn.rb b/test/bmff/box/test_data_entry_urn.rb
index abc1234..def5678 100644
--- a/test/bmff/box/test_data_entry_urn.rb
+++ b/test/bmff/box/test_data_entry_urn.rb
@@ -0,0 +1,32 @@+# coding: utf-8
+# vim: set expandtab tabstop=2 shiftwidth=2 softtabstop=2 autoindent:
+
+require_relative '../../minitest_helper'
+require 'bmff/box'
+require 'stringio'
+
+class TestBMFFBoxDataEntryUrn < MiniTest::Unit::TestCase
+ def test_parse
+ io = StringIO.new("", "r+:ascii-8bit")
+ io.extend(BMFF::BinaryAccessor)
+ io.write_uint32(0)
+ io.write_ascii("urn ")
+ io.write_uint8(0) # version
+ io.write_uint24(0) # flags
+ io.write_null_terminated_string("bmff") # name
+ io.write_null_terminated_string("urn:example") # location
+ size = io.pos
+ io.pos = 0
+ io.write_uint32(size)
+ io.pos = 0
+
+ box = BMFF::Box.get_box(io, nil)
+ assert_instance_of(BMFF::Box::DataEntryUrn, box)
+ assert_equal(size, box.actual_size)
+ assert_equal("urn ", box.type)
+ assert_equal(0, box.version)
+ assert_equal(0, box.flags)
+ assert_equal("bmff", box.name)
+ assert_equal("urn:example", box.location)
+ end
+end
|
Add a test file for BMFF::Box::DataEntryUrn.
|
diff --git a/lib/scrapinghub/api_method.rb b/lib/scrapinghub/api_method.rb
index abc1234..def5678 100644
--- a/lib/scrapinghub/api_method.rb
+++ b/lib/scrapinghub/api_method.rb
@@ -1,7 +1,7 @@ module Scrapinghub
class ApiMethod
- def initialize(location, requires={})
- @location = "#{location}.json"
+ def initialize(location, requires={}, format = :json)
+ @location = "#{location}.#{format.to_s}"
@requires = requires
end
|
Add option to select response format, default json
|
diff --git a/lib/tasks/fix_dangling_comments.rake b/lib/tasks/fix_dangling_comments.rake
index abc1234..def5678 100644
--- a/lib/tasks/fix_dangling_comments.rake
+++ b/lib/tasks/fix_dangling_comments.rake
@@ -9,11 +9,13 @@
puts "[fix_dangling_comments] removing #{comments.count} orphaned comments"
- comments.each do |comment|
- begin
- comment.destroy
- rescue => e
- comment.delete
+ comments.find_in_batches(:batch_size => 100) do |comment_batch|
+ comment_batch.each do |comment|
+ begin
+ comment.destroy
+ rescue => e
+ comment.delete
+ end
end
end
end
|
Update comment clean up task to find comments in batches
|
diff --git a/Library/Homebrew/os/linux/global.rb b/Library/Homebrew/os/linux/global.rb
index abc1234..def5678 100644
--- a/Library/Homebrew/os/linux/global.rb
+++ b/Library/Homebrew/os/linux/global.rb
@@ -1,8 +1,7 @@ # frozen_string_literal: true
# enables experimental readelf.rb, patchelf support.
-HOMEBREW_PATCHELF_RB = (ENV["HOMEBREW_PATCHELF_RB"].present? ||
- (ENV["HOMEBREW_DEVELOPER"].present? && ENV["HOMEBREW_NO_PATCHELF_RB"].blank?)).freeze
+HOMEBREW_PATCHELF_RB = ENV["HOMEBREW_PATCHELF_RB"].present?.freeze
module Homebrew
DEFAULT_PREFIX ||= if Homebrew::EnvConfig.force_homebrew_on_linux?
|
Revert "Enable patchelf.rb for HOMEBREW_DEVELOPERs."
This reverts commit 6106bfc4976dff2b03cf3fadbbf92dd1fd9e0f09.
Fix the error:
brew install patchelf
==> Pouring patchelf-0.10.x86_64_linux.bottle.1.tar.gz
Error: cannot load such file -- patchelf
|
diff --git a/config/unicorn.rb b/config/unicorn.rb
index abc1234..def5678 100644
--- a/config/unicorn.rb
+++ b/config/unicorn.rb
@@ -1,14 +1,14 @@ worker_processes 4
rails_env = 'production'
-app_home = ENV['APP_HOME']
+app_home = ENV['APP_HOME'] || '/home/vagrant/pq/current'
#listen "/home/vagrant/pq/shared/unicorn.sock", :backlog => 64
listen 3000
working_directory "#{app_home}"
pid "#{app_home}/log/unicorn.pid"
stderr_path "#{app_home}/log/unicorn.stderr.log"
-stdout_path "#{app_home}/unicorn.stdout.log"
+stdout_path "#{app_home}/log/unicorn.stdout.log"
timeout 30
preload_app true
|
Make APP_HOME have default valid for vagrant
|
diff --git a/db/migrate/20140603134952_create_spree_store_credit_payment_method.rb b/db/migrate/20140603134952_create_spree_store_credit_payment_method.rb
index abc1234..def5678 100644
--- a/db/migrate/20140603134952_create_spree_store_credit_payment_method.rb
+++ b/db/migrate/20140603134952_create_spree_store_credit_payment_method.rb
@@ -1,6 +1,6 @@ class CreateSpreeStoreCreditPaymentMethod < ActiveRecord::Migration
def up
return if Spree::PaymentMethod.find_by_type("Spree::PaymentMethod::StoreCredit")
- Spree::PaymentMethod.create(type: "Spree::PaymentMethod::StoreCredit", name: "Store Credit", description: "Store credit.", active: true, environment: Rails.env)
+ Spree::PaymentMethod.create(type: "Spree::PaymentMethod::StoreCredit", name: "Store Credit", description: "Store credit.", active: true)
end
end
|
Fix migration by removing environment column from PaymentMethod.
|
diff --git a/config/config.rb b/config/config.rb
index abc1234..def5678 100644
--- a/config/config.rb
+++ b/config/config.rb
@@ -26,19 +26,6 @@ @config = HashWithIndifferentAccess.new(@config)
end
- def get(*keys)
- value = @config
- begin
- keys.each do |key|
- value = value.fetch(key)
- end
- rescue KeyError => error
- Rails.logger.error "Missing config values: #{keys.join(':')}"
- value = nil
- end
- value
- end
-
def to_hash
@config
end
@@ -53,7 +40,7 @@ elsif @config.class.method_defined? method_id
@config.send(method_id, *args, &block)
else
- super
+ nil
end
end
end
|
Return `nil` if the key doesn't exist.
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,4 +1,5 @@ Rails.application.routes.draw do
- resources :users
+ resources :users, path_names: {new: 'signup'}
+ root 'users#index'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
|
Rename users/new path as users/signup
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -8,7 +8,7 @@ resources :events, :controller => "public/events", only: [:show]
namespace :public do
- resources :events, only: [:index] do
+ resources :events, only: [] do
resources :talks, only: [:new, :create]
end
end
|
Remove vestigial route for public/events/index
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,8 +1,8 @@ if Rails::VERSION::MAJOR == 3
Rails.application.routes.draw do |map|
- map '/ops/version', :to => 'ops#version'
- map '/ops/heartbeat(/:name)', :to => 'ops#heartbeat'
- map '/ops/configuration', :to => 'ops#configuration'
+ match '/ops/version', :to => 'ops#version'
+ match '/ops/heartbeat(/:name)', :to => 'ops#heartbeat'
+ match '/ops/configuration', :to => 'ops#configuration'
end
else
ActionController::Routing::Routes.draw do |map|
|
[EP] Make routing actually compatible with Rails 3
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,5 +1,7 @@ Rails.application.routes.draw do
root 'items#index'
+
+ get '/users/new', to: 'users#new'
get '/items', to: 'items#index'
get '/items/new', to: 'items#new', as: 'new_item'
@@ -8,6 +10,5 @@ get '/items/:id/edit', to: 'items#edit', as: 'edit_item'
patch '/items/:id', to: 'items#update'
delete '/items/:id', to: 'items#destroy'
-
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
|
Create new route for new users
|
diff --git a/Casks/intellij-idea-ce-bundled-jdk.rb b/Casks/intellij-idea-ce-bundled-jdk.rb
index abc1234..def5678 100644
--- a/Casks/intellij-idea-ce-bundled-jdk.rb
+++ b/Casks/intellij-idea-ce-bundled-jdk.rb
@@ -1,17 +1,19 @@ cask :v1 => 'intellij-idea-ce-bundled-jdk' do
- version '14'
- sha256 '09bb078252e2f6af6b58605ad3a380a71c8cc53f8e697e31fe03fcadb2152b07'
+ version '14.1'
+ sha256 '62c8b150ff82c31f2b6355a6f43b8ef69913b8f387cef6ddb4659622abb59a52'
- url "http://download.jetbrains.com/idea/ideaIC-#{version}-jdk-bundled.dmg"
+ url "https://download.jetbrains.com/idea/ideaIC-#{version}-custom-jdk-bundled.dmg"
+ name 'IntelliJ IDEA'
homepage 'https://www.jetbrains.com/idea/'
- license :oss
+ license :apache
- app "IntelliJ IDEA #{version} CE.app"
-
+ app 'IntelliJ IDEA 14 CE.app'
+
zap :delete => [
- "~/Library/Application Support/IdeaIC#{version}",
- "~/Library/Preferences/IdeaIC#{version}",
- "~/Library/Caches/IdeaIC#{version}",
- "~/Library/Logs/IdeaIC#{version}",
+ '~/Library/Preferences/com.jetbrains.intellij.ce.plist',
+ '~/Library/Preferences/IdeaIC14',
+ '~/Library/Application Support/IdeaIC14',
+ '~/Library/Caches/IdeaIC14',
+ '~/Library/Logs/IdeaIC14',
]
end
|
Upgrade IntelliJ Idea CE with bundled JDK to 14.1
- Unify with other IntelliJ-based formulas (see #879)
|
diff --git a/SGHTTPRequest.podspec b/SGHTTPRequest.podspec
index abc1234..def5678 100644
--- a/SGHTTPRequest.podspec
+++ b/SGHTTPRequest.podspec
@@ -11,13 +11,14 @@ s.dependency "MGEvents", '~> 1.1'
s.default_subspecs = 'Core', 'UIKit'
s.ios.deployment_target = '7.0'
- s.watchos.deployment_target = '2.0'
-
s.subspec 'Core' do |sp|
+ sp.ios.deployment_target = '7.0'
+ sp.watchos.deployment_target = '2.0'
sp.source_files = 'SGHTTPRequest/Core/**/*.{h,m}'
end
s.subspec 'UIKit' do |sp|
+ sp.ios.deployment_target = '7.0'
sp.xcconfig = { "GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) SG_INCLUDE_UIKIT=1' }
sp.dependency 'SGHTTPRequest/Core'
sp.source_files = 'SGHTTPRequest/UI/**/*.{h,m}'
|
Fix deployment target causing trunk validation to fail
|
diff --git a/features/support/cucumber_extensions.rb b/features/support/cucumber_extensions.rb
index abc1234..def5678 100644
--- a/features/support/cucumber_extensions.rb
+++ b/features/support/cucumber_extensions.rb
@@ -0,0 +1,102 @@+module Cucumber
+ module Ast
+ class Feature # http://rubydoc.info/github/cucumber/cucumber/Cucumber/Ast/Feature
+ def accept(visitor)
+ return if Cucumber.wants_to_quit
+ visitor.visit_comment(@comment) unless @comment.empty?
+ visitor.visit_tags(@tags)
+ visitor.visit_feature_name(@keyword, indented_name)
+ visitor.visit_background(@background) if [email protected]_a?(EmptyBackground)
+ @feature_elements.each do |feature_element|
+ if with_and_without_javascript?(feature_element)
+ visit_feature_element_twice(feature_element, visitor)
+ else
+ visitor.visit_feature_element(feature_element)
+ end
+ end
+ end
+
+ private
+ def with_and_without_javascript?(feature_element)
+ source_tag_names.include?('@with_and_without_javascript') ||
+ feature_element.scenario_tags.map(&:name).include?('@with_and_without_javascript')
+ end
+
+ def visit_feature_element_twice(feature_element, visitor)
+ line = feature_element.scenario_tags.map(&:line).first
+ feature_element.scenario_tags.delete_if {|t| t.name == '@with_and_without_javascript'}
+
+ visitor.visit_feature_element(feature_element)
+
+ feature_element.scenario_tags << Gherkin::Formatter::Model::Tag.new('@javascript', line)
+ feature_element.scenario_steps.force_invoke!
+ feature_element.not_executed!
+ feature_element.force_invoke! if feature_element.respond_to?(:force_invoke!)
+
+ visitor.visit_feature_element(feature_element)
+ end
+ end
+
+ class OutlineTable
+ def force_invoke!
+ @dunit = false
+ end
+ end
+
+ class Examples
+ def force_invoke!
+ @outline_table.force_invoke!
+ end
+ end
+
+ class Scenario
+ def scenario_tags
+ @tags.tags
+ end
+
+ def not_executed!
+ @executed = false
+ end
+
+ def scenario_steps
+ steps
+ end
+ end
+
+ class ScenarioOutline
+ def scenario_tags
+ @tags.tags
+ end
+
+ def not_executed!
+ @executed = false
+ end
+
+ def scenario_steps
+ steps
+ end
+
+ def force_invoke!
+ examples_array.each { |examples| examples.force_invoke! }
+ end
+ end
+
+ class StepCollection
+ def force_invoke!
+ @steps.each{|step_invocation| step_invocation.force_invoke!}
+ end
+ end
+
+ class StepInvocation
+ def force_invoke!
+ @skip_invoke = false
+ end
+ end
+
+ class Step
+ def force_invoke!
+ @skip_invoke = false
+ end
+ end
+ end
+end
|
Extend cucumber with @with_and_without_javascript tag.
Copied from budget_planner.
|
diff --git a/web/app/controllers/application_controller.rb b/web/app/controllers/application_controller.rb
index abc1234..def5678 100644
--- a/web/app/controllers/application_controller.rb
+++ b/web/app/controllers/application_controller.rb
@@ -3,11 +3,7 @@ # For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
- before_action :set_time_zone, :set_mailer_host
-
- def set_time_zone
- Time.zone = 'Tokyo'
- end
+ before_action :set_mailer_host
def set_mailer_host
ActionMailer::Base.default_url_options = {:host => request.host_with_port}
|
Remove set_time_zone method from before_action
|
diff --git a/lib/pretty_validation/tasks/validation.rake b/lib/pretty_validation/tasks/validation.rake
index abc1234..def5678 100644
--- a/lib/pretty_validation/tasks/validation.rake
+++ b/lib/pretty_validation/tasks/validation.rake
@@ -11,6 +11,9 @@ namespace :db do
task :_dump do
original_db_dump.invoke
+ # Allow this task to be called as many times as required. An example is the
+ # migrate:redo task, which calls other two internally that depend on this one.
+ original_db_dump.reenable
PrettyValidation::Renderer.generate
end
end
|
:bug: Fix a bug that does not work in the migrate:redo
|
diff --git a/lib/vagrant-cloner/cloners/mysql_cleaner.rb b/lib/vagrant-cloner/cloners/mysql_cleaner.rb
index abc1234..def5678 100644
--- a/lib/vagrant-cloner/cloners/mysql_cleaner.rb
+++ b/lib/vagrant-cloner/cloners/mysql_cleaner.rb
@@ -34,4 +34,4 @@ end
end
-Vagrant::Provisioners::Cloner::ClonerConfig.register_cloner Etailer::MysqlCleanerCloner.instance.name
+Vagrant::Provisioners::Cloner::ClonerConfig.register_cloner Etailer::MysqlCleanerCloner.instance.name, Etailer::MysqlCleanerCloner.instance
|
Add missing argument to register_plugin.
|
diff --git a/Casks/mongo-management-studio.rb b/Casks/mongo-management-studio.rb
index abc1234..def5678 100644
--- a/Casks/mongo-management-studio.rb
+++ b/Casks/mongo-management-studio.rb
@@ -1,6 +1,6 @@ cask :v1 => 'mongo-management-studio' do
- version '1.5.0'
- sha256 'a5bfd413ed7280b21ef353314da8ef4acac78077d872b292e91d9816fdbf79c7'
+ version '1.7.0'
+ sha256 'c03b71c81e1e11b26313d0452969d5673bd9adc3b0064432af659dd1446d40ae'
url "http://packages.litixsoft.de/mms/#{version}/mms-v#{version}-community-darwin.pkg"
name 'Mongo Management Studio'
|
Upgrade Mongo Management Studio.app to v1.7.0
|
diff --git a/lib/arrthorizer/rspec/shared_examples.rb b/lib/arrthorizer/rspec/shared_examples.rb
index abc1234..def5678 100644
--- a/lib/arrthorizer/rspec/shared_examples.rb
+++ b/lib/arrthorizer/rspec/shared_examples.rb
@@ -1,4 +1,4 @@-Arrthorizer::RSpec::SharedExamples do
+module Arrthorizer::RSpec::SharedExamples
shared_examples "not persisting state in the role object" do |options = {}|
specify "no state is maintained in the role object" do
the_role = options[:role] || role
|
Fix VIM error (darn 'u' button)
|
diff --git a/lib/data_mapper/relationship/iterator.rb b/lib/data_mapper/relationship/iterator.rb
index abc1234..def5678 100644
--- a/lib/data_mapper/relationship/iterator.rb
+++ b/lib/data_mapper/relationship/iterator.rb
@@ -33,11 +33,13 @@ def each
return to_enum unless block_given?
- name = attributes.detect { |attribute|
+ attribute_set = attributes
+
+ name = attribute_set.detect { |attribute|
attribute.kind_of?(Mapper::Attribute::EmbeddedCollection)
}.name
- Tuples.prepared(name, attributes, relation) do |tuple|
+ Tuples.prepared(name, attribute_set, relation) do |tuple|
yield(load(tuple))
end
|
Use a local variable to avoid duplicate method calls
|
diff --git a/lib/mighty_grid/filters/custom_filter.rb b/lib/mighty_grid/filters/custom_filter.rb
index abc1234..def5678 100644
--- a/lib/mighty_grid/filters/custom_filter.rb
+++ b/lib/mighty_grid/filters/custom_filter.rb
@@ -4,9 +4,11 @@ attr_reader :scope
def initialize(options = {}, &block)
- self.class.default_options.merge!(scope: nil)
+ self.class.default_options.merge!(scope: nil, collection: nil)
super(options)
+
+ @collection = @options[:collection]
if block_given?
@scope = block
|
Add collection to custom filter
|
diff --git a/lib/rails_core_extensions/activatable.rb b/lib/rails_core_extensions/activatable.rb
index abc1234..def5678 100644
--- a/lib/rails_core_extensions/activatable.rb
+++ b/lib/rails_core_extensions/activatable.rb
@@ -12,18 +12,18 @@
module InstanceMethods
def activate(success_block = nil)
- current_object.active = params[:active] || false
- current_object.save!
+ resource.active = params[:active] || false
+ resource.save!
if success_block
success_block.call
else
- flash[:success] = "#{current_object} #{params[:active] ? 'activated' : 'inactivated'}"
- redirect_to(objects_path)
+ flash[:success] = "#{resource} #{params[:active] ? 'activated' : 'inactivated'}"
+ redirect_to(collection_path)
end
rescue ActiveRecord::ActiveRecordError => e
- current_object.errors.add(:base, "Failed to inactivate: " + e.message)
- flash[:error] = current_object.errors.full_messages.to_sentence
- redirect_to(objects_path)
+ resource.errors.add(:base, "Failed to inactivate: " + e.message)
+ flash[:error] = resource.errors.full_messages.to_sentence
+ redirect_to(collection_path)
end
end
|
Use inherited_resources methods instead of make_resourceful
* Works with QT4 now
* Can't update QT3 to this rails_core_extensions now
|
diff --git a/lib/specinfra/command/base/mail_alias.rb b/lib/specinfra/command/base/mail_alias.rb
index abc1234..def5678 100644
--- a/lib/specinfra/command/base/mail_alias.rb
+++ b/lib/specinfra/command/base/mail_alias.rb
@@ -1,8 +1,12 @@ class Specinfra::Command::Base::MailAlias < Specinfra::Command::Base
class << self
- def check_is_aliased_to(recipient, target)
- target = "[[:space:]]#{target}"
- "getent aliases #{escape(recipient)} | grep -- #{escape(target)}$"
+ def check_is_aliased_to(mail_alias, recipient)
+ recipient = "[[:space:]]#{recipient}"
+ "getent aliases #{escape(mail_alias)} | grep -- #{escape(recipient)}$"
+ end
+
+ def add(mail_alias, recipient)
+ "echo #{mail_alias}: #{recipient} >> /etc/aliases"
end
end
end
|
Add add method to MailAlias
|
diff --git a/lib/heroku/cli.rb b/lib/heroku/cli.rb
index abc1234..def5678 100644
--- a/lib/heroku/cli.rb
+++ b/lib/heroku/cli.rb
@@ -11,8 +11,6 @@ require('rest_client')
end
-require "multi_json"
-
class Heroku::CLI
extend Heroku::Helpers
@@ -25,7 +23,6 @@ if $stdout.isatty
$stdout.sync = true
end
- setup_multi_json
command = args.shift.strip rescue "help"
Heroku::Command.load
Heroku::Command.run(command, args)
@@ -38,13 +35,4 @@ end
end
- # we have several reports of issues with the json_common
- # adapter, just use ok_json instead of it. for more info:
- # https://github.com/heroku/heroku/issues/1019
- def self.setup_multi_json
- if MultiJson.engine == :json_common
- MultiJson.engine = :ok_json
- end
- end
-
end
|
Revert "Force ok_json instead of the json_common MultiJson adapter"
This reverts commit 6fe67aaf4380b41f14ce14576cc4dabfd0a60fd1.
|
diff --git a/spec/classes/postfix_mta_spec.rb b/spec/classes/postfix_mta_spec.rb
index abc1234..def5678 100644
--- a/spec/classes/postfix_mta_spec.rb
+++ b/spec/classes/postfix_mta_spec.rb
@@ -0,0 +1,12 @@+require 'spec_helper'
+
+describe 'postfix::mta' do
+ let (:facts) { {
+ :needs_postfix_class_with_params => true,
+ :osfamily => 'Debian',
+ } }
+
+ it { should contain_postfix__config('mydestination').with_value('bar') }
+ it { should contain_postfix__config('mynetworks').with_value('baz') }
+ it { should contain_postfix__config('relayhost').with_value('foo') }
+end
|
Add spec for postfix::mta, do not include postfix anymore
|
diff --git a/spec/cli/cmd/analyze_cmd_spec.rb b/spec/cli/cmd/analyze_cmd_spec.rb
index abc1234..def5678 100644
--- a/spec/cli/cmd/analyze_cmd_spec.rb
+++ b/spec/cli/cmd/analyze_cmd_spec.rb
@@ -14,4 +14,8 @@ it 'analyze data/sample.csv' do
run_cli(%w(analyze data/sample.csv))
end
+
+ it 'analyze --format table data/sample.csv' do
+ run_cli(%w(analyze --format table data/sample.csv))
+ end
end
|
Test analyze --format table data/sample.csv
|
diff --git a/Casks/googleappenginelauncher.rb b/Casks/googleappenginelauncher.rb
index abc1234..def5678 100644
--- a/Casks/googleappenginelauncher.rb
+++ b/Casks/googleappenginelauncher.rb
@@ -1,7 +1,7 @@ class Googleappenginelauncher < Cask
- url 'https://googleappengine.googlecode.com/files/GoogleAppEngineLauncher-1.8.8.dmg'
+ url 'https://commondatastorage.googleapis.com/appengine-sdks/featured/GoogleAppEngineLauncher-1.9.0.dmg'
homepage 'https://developers.google.com/appengine/'
- version '1.8.8'
- sha256 'c6c75e7e97b9ed1e8445aece0d336e94919e3a53b8e707ce8b93fff79159db4c'
+ version '1.9.0'
+ sha256 'bce8ccc76b7e14d97961c6bb0828ebfd623dbdf368929e7395219b47c22323bf'
link 'GoogleAppEngineLauncher.app'
end
|
Update Google App Engine Launcher from 1.8.8 to 1.9.0
|
diff --git a/config/initializers/cloudwatchlogger.rb b/config/initializers/cloudwatchlogger.rb
index abc1234..def5678 100644
--- a/config/initializers/cloudwatchlogger.rb
+++ b/config/initializers/cloudwatchlogger.rb
@@ -1,4 +1,46 @@ if ENV['CLOUDWATCH_LOG_GROUP']
- cloudwatch_logger = CloudWatchLogger.new({}, ENV['CLOUDWATCH_LOG_GROUP'])
+ # rubocop:disable Naming/ClassAndModuleCamelCase
+ # rubocop:disable Lint/SuppressedException
+ # Patch the CloudWatchLogger deliverer to not log messages about itself logging messages
+ module CloudWatchLogger
+ module Client
+ class AWS_SDK
+ class DeliveryThread < Thread
+ def connect!(opts = {})
+ # This is the only actually changed line: I added log_level: :warn
+ args = { http_open_timeout: opts[:open_timeout], http_read_timeout: opts[:read_timeout], log_level: :warn }
+ args[:region] = @opts[:region] if @opts[:region]
+ args.merge(
+ if @credentials.key?(:access_key_id)
+ { access_key_id: @credentials[:access_key_id], secret_access_key: @credentials[:secret_access_key] }
+ else
+ {}
+ end
+ )
+
+ @client = Aws::CloudWatchLogs::Client.new(args)
+ begin
+ @client.create_log_stream(log_group_name: @log_group_name, log_stream_name: @log_stream_name)
+ rescue Aws::CloudWatchLogs::Errors::ResourceNotFoundException
+ @client.create_log_group(log_group_name: @log_group_name)
+ retry
+ rescue Aws::CloudWatchLogs::Errors::ResourceAlreadyExistsException,
+ Aws::CloudWatchLogs::Errors::AccessDeniedException
+ end
+ end
+ end
+ end
+ end
+ end
+
+ # rubocop:enable Naming/ClassAndModuleCamelCase
+ # rubocop:enable Lint/SuppressedException
+
+ cloudwatch_logger =
+ CloudWatchLogger.new(
+ {},
+ ENV['CLOUDWATCH_LOG_GROUP'],
+ ENV['DYNO'] || ENV['CLOUDWATCH_LOG_STREAM_NAME'] || 'intercode'
+ )
Rails.application.config.logger.extend(ActiveSupport::Logger.broadcast(cloudwatch_logger))
end
|
Patch CloudWatchLogger to not log messages about itself logging; use dyno name as log stream name
|
diff --git a/spec/read_time_estimator_spec.rb b/spec/read_time_estimator_spec.rb
index abc1234..def5678 100644
--- a/spec/read_time_estimator_spec.rb
+++ b/spec/read_time_estimator_spec.rb
@@ -24,5 +24,17 @@ text = "word " * 15000
expect(text.read_time_words).to eql "1 hour to read"
end
+
+ it "returns the reading time in phrase form when read time include an hour, minutes, and seconds" do
+ text = "word " * 22550
+ expect(text.read_time_words).to eql "1 hour 30 minutes and 12 seconds"
+ end
+ end
+
+ describe "hours_in_words" do
+ it "correctly pluralizes 'hour' when hours to read is greater than one" do
+ text = "word " * 30000
+ expect(text.read_time_words).to eql "2 hours to read"
+ end
end
end
|
Add specs for reading time over one hour. PA-2182
|
diff --git a/cookbooks/ntp/recipes/windows_client.rb b/cookbooks/ntp/recipes/windows_client.rb
index abc1234..def5678 100644
--- a/cookbooks/ntp/recipes/windows_client.rb
+++ b/cookbooks/ntp/recipes/windows_client.rb
@@ -22,18 +22,18 @@ action :create
end
-cookbook_file "C:\NTP\ntp.ini"
+cookbook_file "C:\NTP\ntp.ini" do
source "ntp.ini"
inherits true
action :create
end
if !File.exists?("C:/NTP/bin/ntpd.exe")
- remote_file "#{Chef::Config[:file_cache_path]}/ntpd.exe" do
- source node[:ntp][:package_url]
- end
-
+ remote_file "#{Chef::Config[:file_cache_path]}/ntpd.exe" do
+ source node[:ntp][:package_url]
+ end
+
execute "ntpd_install" do
- command "ntpd.exe /USEFILE=C:\\NTP\\ntp.ini"
+ command "ntpd.exe /USEFILE=C:\\NTP\\ntp.ini"
end
end
|
Swap tabs for spaces and add a missing do
Former-commit-id: ab337109d79a480d897f4ab29e2b54bcfce8f76e [formerly e4cf84e6a326dc2429480982f6a0fef39d822d90] [formerly 3df1aeb958049434e7e85539038aa4e1760b1b63 [formerly 2c4f609998a5239f7c2647296c800bfeade5d18e]]
Former-commit-id: 89705e15c2225a2f8fdbc8a042c30903d51d9fd2 [formerly b3ee7f6284381adc2ccdbef4da3d2c937ac89b50]
Former-commit-id: e6c53f4394eaa25868f7be7503ff267b6588a480
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.