diff stringlengths 65 26.7k | message stringlengths 7 9.92k |
|---|---|
diff --git a/ruby/tree.rb b/ruby/tree.rb
index abc1234..def5678 100644
--- a/ruby/tree.rb
+++ b/ruby/tree.rb
@@ -0,0 +1,35 @@+#!/bin/env ruby
+
+class Tree
+ # Generate a class variable, an accessor and a setter for each given symbol
+ attr_accessor :children, :node_name
+
+ # Constructor
+ def initialize(name, children=[])
+ @children = children
+ @node_name = name
+ end
+
+ # A recursive method running through all Tree nodes
+ def visit_all(&block)
+ visit &block
+ children.each {|c| c.visit_all &block}
+ end
+
+ # Invokes the given block passing the current object as parameter
+ def visit(&block)
+ block.call self
+ end
+end
+
+ruby_tree = Tree.new("Ruby", [Tree.new("Reia"), Tree.new("MacRuby")])
+
+puts "Visiting a node"
+ruby_tree.visit {|node| puts node.node_name}
+# => Ruby
+
+puts "Visiting entire tree"
+ruby_tree.visit_all {|node| puts node.node_name}
+# => Ruby
+# Reia
+# MacRuby
| Add an example of ruby class
|
diff --git a/app/classes/box.rb b/app/classes/box.rb
index abc1234..def5678 100644
--- a/app/classes/box.rb
+++ b/app/classes/box.rb
@@ -13,13 +13,11 @@ end
def valid?
- args_in_bounds? &&
- south <= north &&
- ((west <= east) || straddles_180_deg?)
+ args_in_bounds? && south <= north
end
def straddles_180_deg?
- west > east && (west >= 0 && east <= 0)
+ west > east
end
# Return a new box with edges expanded by delta
| Revise BoxTest to get tests passing
|
diff --git a/lib/phone_number.rb b/lib/phone_number.rb
index abc1234..def5678 100644
--- a/lib/phone_number.rb
+++ b/lib/phone_number.rb
@@ -1,6 +1,8 @@ class PhoneNumber < ActiveRecord::Base
belongs_to :vcard, :class_name => 'Vcards::Vcard'
belongs_to :object, :polymorphic => true
+
+ validates_presence_of :number
def to_s
case phone_number_type
| Validate presence of attribute number in PhoneNumber.
|
diff --git a/itcss_cli.gemspec b/itcss_cli.gemspec
index abc1234..def5678 100644
--- a/itcss_cli.gemspec
+++ b/itcss_cli.gemspec
@@ -18,8 +18,8 @@ spec.executables = ["itcss"]
spec.require_paths = ["lib"]
- spec.add_dependency "colorize"
-
spec.add_development_dependency "bundler", "~> 1.11"
spec.add_development_dependency "rake", "~> 10.0"
+
+ spec.add_runtime_dependency "colorize", "~> 0.7.7"
end
| Add colorize as runtime_dependency w. its version
|
diff --git a/app/models/user.rb b/app/models/user.rb
index abc1234..def5678 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -15,7 +15,7 @@ # This can't really be made faster because we're storing
# permissions as a serialized string. We only really should have a maximum of
# 50 (guiders) + 3 (resource managers) in the database though.
- User.includes(:groups).all.select(&:guider?)
+ select(&:guider?)
end
def guider?
| Remove redundant call to User.all
|
diff --git a/lib/sprint/rails.rb b/lib/sprint/rails.rb
index abc1234..def5678 100644
--- a/lib/sprint/rails.rb
+++ b/lib/sprint/rails.rb
@@ -2,7 +2,7 @@
module Sprint
module Rails
- class Engine << ::Rails::Engine
+ class Engine < ::Rails::Engine
end
end
end
| Fix miss spell of extension for Engine class
|
diff --git a/spec/coverage_helper.rb b/spec/coverage_helper.rb
index abc1234..def5678 100644
--- a/spec/coverage_helper.rb
+++ b/spec/coverage_helper.rb
@@ -2,4 +2,8 @@ require 'coveralls'
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new [SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter]
-SimpleCov.start+
+SimpleCov.start do
+ add_filter 'lib/rasti/db/nql/syntax.rb'
+ add_filter 'spec/'
+end | Change to coverage helper to avoid specs and autogenerated code in metrics
|
diff --git a/spec/repository_spec.rb b/spec/repository_spec.rb
index abc1234..def5678 100644
--- a/spec/repository_spec.rb
+++ b/spec/repository_spec.rb
@@ -21,15 +21,11 @@ FakeFS::File.write('/topics/topic1/topic.yaml', YAML.dump(
{
'id' => 'topic_1',
- 'title' => 'Special topic',
- 'aliases' => ['1']
+ 'title' => 'Special topic'
}
))
repository = Topicz::Repository.new('/topics')
topic = repository.topics[0]
- puts topic.inspect
- puts topic.id
- puts topic.title
expect(topic.id).to eq 'topic_1'
expect(topic.title).to eq 'Special topic'
expect(topic.fullpath).to eq '/topics/topic1'
| Remove puts from repository spec.
|
diff --git a/spec/unit/scope_spec.rb b/spec/unit/scope_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/scope_spec.rb
+++ b/spec/unit/scope_spec.rb
@@ -26,6 +26,18 @@ scope = Scope.new(real)
scope["foo"].should == "bar"
end
+
+ it "should get calling_class and calling_module from puppet scope" do
+ real = mock
+ resource = mock
+ resource.expects(:name).returns("Foo::Bar").twice
+
+ real.expects(:resource).returns(resource).twice
+
+ scope = Scope.new(real)
+ scope["calling_class"].should == "foo::bar"
+ scope["calling_module"].should == "foo"
+ end
end
describe "#include?" do
@@ -36,6 +48,16 @@ scope = Scope.new(real)
scope.include?("foo").should == false
end
+
+ it "should always return true for calling_class and calling_module" do
+ real = mock
+ real.expects(:lookupvar).with("calling_class").never
+ real.expects(:lookupvar).with("calling_module").never
+
+ scope = Scope.new(real)
+ scope.include?("calling_class").should == true
+ scope.include?("calling_module").should == true
+ end
end
end
end
| Add tests to scope for calling_class and calling_module handling
|
diff --git a/sloc.gemspec b/sloc.gemspec
index abc1234..def5678 100644
--- a/sloc.gemspec
+++ b/sloc.gemspec
@@ -24,5 +24,6 @@ spec.require_paths = ["lib"]
spec.add_development_dependency "bundler", "~> 1.8"
+ spec.add_development_dependency "pry"
spec.add_development_dependency "rake", "~> 10.0"
end
| Add pry as development dependency
|
diff --git a/config.ru b/config.ru
index abc1234..def5678 100644
--- a/config.ru
+++ b/config.ru
@@ -22,4 +22,4 @@ run Rack::Cascade.new([
Api::App,
rails_app
-], [])
+])
| Revert "api: do not forward 404 requests to rails"
This reverts commit 49c6052bd69dfff9acb421e9158dad268bf56988.
|
diff --git a/app/models/discussion_note.rb b/app/models/discussion_note.rb
index abc1234..def5678 100644
--- a/app/models/discussion_note.rb
+++ b/app/models/discussion_note.rb
@@ -1,5 +1,5 @@ class DiscussionNote < Note
- NOTEABLE_TYPES = %w(MergeRequest).freeze
+ NOTEABLE_TYPES = %w(MergeRequest Issue Commit Snippet).freeze
validates :noteable_type, inclusion: { in: NOTEABLE_TYPES }
| Enable discussions on issues, commits and snippets
|
diff --git a/app/models/order_decorator.rb b/app/models/order_decorator.rb
index abc1234..def5678 100644
--- a/app/models/order_decorator.rb
+++ b/app/models/order_decorator.rb
@@ -10,6 +10,6 @@ end
def self.paypal_payment_method
- PaymentMethod.available(:front_end).select{ |pm| pm if pm.name.downcase =~ /paypal/}.first
+ PaymentMethod.select{ |pm| pm if pm.name.downcase =~ /paypal/}.first
end
end
| Make paypal method selectable also if display on back_end |
diff --git a/config.rb b/config.rb
index abc1234..def5678 100644
--- a/config.rb
+++ b/config.rb
@@ -8,6 +8,6 @@ threads 0, 16
workers 0
pidfile "#{app_dir}/tmp/pids/workroom.pid"
-bind "unix:///#{app_dir}/tmp/sockets/wookroom.sock"
+bind "unix:///#{app_dir}/tmp/sockets/workroom.sock"
stdout_redirect "#{app_dir}/tmp/logs/#{app_env}.log"
preload_app!
| Fix typo at socket path
|
diff --git a/config.ru b/config.ru
index abc1234..def5678 100644
--- a/config.ru
+++ b/config.ru
@@ -8,7 +8,9 @@
Assets = Sprockets::Environment.new(Root) do |env|
env.append_path "components" # bower
- env.append_path "app/assets"
+ env.append_path "app/assets/javascripts"
+ env.append_path "app/assets/stylesheets"
+ env.append_path "test"
end
map "/assets" do
| Fix asset paths in rack server
|
diff --git a/activerecord/test/cases/arel/helper.rb b/activerecord/test/cases/arel/helper.rb
index abc1234..def5678 100644
--- a/activerecord/test/cases/arel/helper.rb
+++ b/activerecord/test/cases/arel/helper.rb
@@ -24,11 +24,6 @@ Arel::Table.engine = @arel_engine if defined? @arel_engine
super
end
-
- def assert_like(expected, actual)
- assert_equal expected.gsub(/\s+/, " ").strip,
- actual.gsub(/\s+/, " ").strip
- end
end
class Spec < Minitest::Spec
| Remove unused `assert_like` from `Arel::Test`
It had been added at https://github.com/rails/arel/commit/05b5bb12270b32e094c1c879273e0978dabe5b3b
and removed at https://github.com/rails/arel/commit/db1bb4e9a728a437d16f8bdb48c3b772c3e4edb0
|
diff --git a/config.ru b/config.ru
index abc1234..def5678 100644
--- a/config.ru
+++ b/config.ru
@@ -2,6 +2,6 @@ require 'webhook'
require 'newrelic_rpm'
-NewRelic::Agent.manual_start if File.exist?('config/newrelic.yml')
+NewRelic::Agent.manual_start if File.exist?(File.expand_path('../config/newrelic.yml', __FILE__))
run Webhook::Web
| Fix path in new relic guard
|
diff --git a/config.ru b/config.ru
index abc1234..def5678 100644
--- a/config.ru
+++ b/config.ru
@@ -10,9 +10,10 @@ ".vtt" => "text/vtt",
})
+use Rack::Deflater
+
use Rack::Static, urls: ["/css", "/images", "/js", "favicon.ico"], root: "public"
require './web'
-use Rack::Deflater
run Web
| Reorder middleware to serve compressed assets
|
diff --git a/spec/dummy/config/environments/development.rb b/spec/dummy/config/environments/development.rb
index abc1234..def5678 100644
--- a/spec/dummy/config/environments/development.rb
+++ b/spec/dummy/config/environments/development.rb
@@ -38,5 +38,5 @@ config.assets.raise_runtime_errors = true
# Raises error for missing translations
- # config.action_view.raise_on_missing_translations = true
+ config.action_view.raise_on_missing_translations = true
end
| Throw errors when translations are missing.
|
diff --git a/lib/rails_development_boost/loadable_patch.rb b/lib/rails_development_boost/loadable_patch.rb
index abc1234..def5678 100644
--- a/lib/rails_development_boost/loadable_patch.rb
+++ b/lib/rails_development_boost/loadable_patch.rb
@@ -8,7 +8,7 @@ expanded_path = File.expand_path(file)
# force the manual #load calls for autoloadable files to go through the AS::Dep stack
if ActiveSupport::Dependencies.in_autoload_path?(expanded_path)
- expanded_path << '.rb' unless expanded_path =~ /\.(rb|rake)$/
+ expanded_path << '.rb' unless expanded_path =~ /\.(rb|rake)\Z/
ActiveSupport::Dependencies.load_file_from_explicit_load(expanded_path)
else
super
| Use end of string regexp token.
|
diff --git a/app/controllers/articles_controller.rb b/app/controllers/articles_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/articles_controller.rb
+++ b/app/controllers/articles_controller.rb
@@ -19,6 +19,25 @@ end
end
+ def edit
+ end
+
+ def update
+ @article = Article.find(params[:id])
+ if @article.update(article_params)
+ redirect_to @article
+ else
+ render action: 'edit'
+ end
+ end
+
+ def destroy
+ @article = Article.find(params[:id])
+ @article.destroy
+
+ redirect_to articles_path
+ end
+
private
def article_params
| Add other actions to articles controller
|
diff --git a/app/controllers/searches_controller.rb b/app/controllers/searches_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/searches_controller.rb
+++ b/app/controllers/searches_controller.rb
@@ -1,6 +1,4 @@ class SearchesController < ApplicationController
- layout 'default'
-
def index
@search = Search.new
@search.find_venue(params[:search]) if request.post?
| Use default layout in search controller.
Fixes regression introduced in d6c95f99745067790410e1e3aacffcae6828d785.
|
diff --git a/UIKitExtensions.podspec b/UIKitExtensions.podspec
index abc1234..def5678 100644
--- a/UIKitExtensions.podspec
+++ b/UIKitExtensions.podspec
@@ -24,6 +24,6 @@ s.header_mappings_dir = 'UIKitExtensions'
s.frameworks = 'UIKit'
- s.weak_frameworks = 'CoreGraphics'
+ s.weak_frameworks = 'CoreGraphics', 'QuartzCore'
s.requires_arc = true
end
| Pod: Add QuartzCore to weak frameworks
|
diff --git a/app/policies/frontpage_policy.rb b/app/policies/frontpage_policy.rb
index abc1234..def5678 100644
--- a/app/policies/frontpage_policy.rb
+++ b/app/policies/frontpage_policy.rb
@@ -1,4 +1,4 @@-class PagePolicy < ApplicationPolicy
+class FrontpagePolicy < ApplicationPolicy
def show?
super
| Rename FrontpagePolicy class to its correct name
|
diff --git a/ci_environment/cassandra/attributes/default.rb b/ci_environment/cassandra/attributes/default.rb
index abc1234..def5678 100644
--- a/ci_environment/cassandra/attributes/default.rb
+++ b/ci_environment/cassandra/attributes/default.rb
@@ -4,7 +4,7 @@ :version => cassandra_version,
:tarball => {
:url => "http://www.apache.org/dist/cassandra/#{cassandra_version}/apache-cassandra-#{cassandra_version}-bin.tar.gz",
- :md5 => "b897254c99c6ba5df0d7376571a00806"
+ :md5 => "91460be9a35d8795b6b7e54208650054"
},
:user => "cassandra",
:jvm => {
| Update md5 for Cassandra 1.2.8 |
diff --git a/ampex.gemspec b/ampex.gemspec
index abc1234..def5678 100644
--- a/ampex.gemspec
+++ b/ampex.gemspec
@@ -1,6 +1,6 @@ Gem::Specification.new do |s|
s.name = "ampex"
- s.version = "0.1"
+ s.version = "0.2.0"
s.platform = Gem::Platform::RUBY
s.author = "Conrad Irwin"
s.email = "conrad.irwin@gmail.com"
@@ -9,4 +9,5 @@ s.description = "Why would you want to write { |x| x['one'] } when you can write &X['one'], why indeed."
s.files = ["lib/ampex.rb", "README.markdown", "LICENSE.MIT"]
s.require_path = "lib"
+ s.add_dependency 'blankslate'
end
| Fix gemspec to include dependency and correctly formatted version
|
diff --git a/activerecord/test/cases/subscriber_test.rb b/activerecord/test/cases/subscriber_test.rb
index abc1234..def5678 100644
--- a/activerecord/test/cases/subscriber_test.rb
+++ b/activerecord/test/cases/subscriber_test.rb
@@ -25,7 +25,7 @@ wait
assert_equal 1, @logger.logged(:debug).size
assert_match /Developer Load/, @logger.logged(:debug).last
- assert_match /SELECT \* FROM "developers"/, @logger.logged(:debug).last
+ assert_match /SELECT .*?FROM .?developers.?/, @logger.logged(:debug).last
end
def test_cached_queries
@@ -36,7 +36,7 @@ wait
assert_equal 2, @logger.logged(:debug).size
assert_match /CACHE/, @logger.logged(:debug).last
- assert_match /SELECT \* FROM "developers"/, @logger.logged(:debug).last
+ assert_match /SELECT .*?FROM .?developers.?/, @logger.logged(:debug).last
end
class SyncSubscriberTest < ActiveSupport::TestCase
| Fix the query matching in SubscriberTest
|
diff --git a/guard.gemspec b/guard.gemspec
index abc1234..def5678 100644
--- a/guard.gemspec
+++ b/guard.gemspec
@@ -14,11 +14,13 @@ s.required_rubygems_version = '>= 1.3.6'
s.rubyforge_project = 'guard'
+ s.add_dependency 'thor', '~> 0.14.6'
+
s.add_development_dependency 'bundler'
s.add_development_dependency 'rspec', '~> 2.6.0'
s.add_development_dependency 'guard-rspec', '~> 0.3.1'
-
- s.add_dependency 'thor', '~> 0.14.6'
+ s.add_development_dependency 'yard', '~> 0.7.2'
+ s.add_development_dependency 'kramdown', '~> 0.13.3'
s.files = Dir.glob('{bin,images,lib}/**/*') + %w[CHANGELOG.md LICENSE man/guard.1 man/guard.1.html README.md]
s.executable = 'guard'
| Add yard and kramdown to development dependencies.
|
diff --git a/test/generators_test.rb b/test/generators_test.rb
index abc1234..def5678 100644
--- a/test/generators_test.rb
+++ b/test/generators_test.rb
@@ -11,7 +11,7 @@ assert Ayanami::Generator.force_reply.is_a? Hash
assert Ayanami::Generator.input_text_message_content.is_a? Hash
assert Ayanami::Generator.input_location_message_content.is_a? Hash
- assert Ayanami::Generator.input_venue_message.content.is_a? Hash
+ assert Ayanami::Generator.input_venue_message_content.is_a? Hash
assert Ayanami::Generator.input_contact_message_content.is_a? Hash
assert Ayanami::Generator.inline_keyboard_button.is_a? Hash
end
| Fix bug on unit test for generators
|
diff --git a/lib/cloudstrap.rb b/lib/cloudstrap.rb
index abc1234..def5678 100644
--- a/lib/cloudstrap.rb
+++ b/lib/cloudstrap.rb
@@ -2,3 +2,4 @@ require_relative 'cloudstrap/amazon'
require_relative 'cloudstrap/bootstrap_agent'
require_relative 'cloudstrap/config'
+require_relative 'cloudstrap/network'
| Add network to require wrapper
|
diff --git a/db/migrate/20091116182823_delete_duplicate_pages.rb b/db/migrate/20091116182823_delete_duplicate_pages.rb
index abc1234..def5678 100644
--- a/db/migrate/20091116182823_delete_duplicate_pages.rb
+++ b/db/migrate/20091116182823_delete_duplicate_pages.rb
@@ -0,0 +1,13 @@+class DeleteDuplicatePages < ActiveRecord::Migration
+ def self.up
+ Site.each do |site|
+ while page = Page.first(:conditions => "(select count(*) from pages p2 where p2.path = pages.path and p2.id != pages.id and p2.site_id = #{site.id}) > 0", :order => 'updated_at')
+ page.destroy_without_callbacks
+ end
+ end
+ end
+
+ def self.down
+ # can't put them back, but no reason to hold up a revert to previous migrations
+ end
+end
| Remove duplicate pages (don't know how that happened.)
|
diff --git a/_plugins/to_jare_cdn_url.rb b/_plugins/to_jare_cdn_url.rb
index abc1234..def5678 100644
--- a/_plugins/to_jare_cdn_url.rb
+++ b/_plugins/to_jare_cdn_url.rb
@@ -0,0 +1,27 @@+# Liquid filter plugin for converting relative resource links to
+# Jare CDN links
+#
+# A Unix time value is added at the end of the link as query param
+# in order to force CDN update upon redeployment
+#
+# Examples:
+# {{ "img.png" | hex_to_rgb }}
+# # => "https://cf.jare.io/?u=https://next.cmlteam.com/img.png?1575391869"
+#
+# {{ "css/style-all.css" | hex_to_rgb }}
+# # => "https://cf.jare.io/?u=https://next.cmlteam.com/css/style-all.css?1575391869"
+#
+# source - relative URL string for a resource present on the server
+#
+# Returns a Jare CDN proxy for a resource, respective to config
+#
+
+module Jekyll
+ module JareCdnLink
+ def to_jare_cdn_url(source)
+ "#{@context.registers[:site].config['resources_server_url']}/#{source}?#{Time.now.to_i}"
+ end
+ end
+end
+
+Liquid::Template.register_filter(Jekyll::JareCdnLink)
| CML-135: Add Jekyll filter for converting resource relative URLs to Jare URLs
|
diff --git a/spec/controllers/about_this_site_controller_spec.rb b/spec/controllers/about_this_site_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/about_this_site_controller_spec.rb
+++ b/spec/controllers/about_this_site_controller_spec.rb
@@ -0,0 +1,13 @@+# frozen_string_literal: true
+
+require 'rails_helper'
+
+describe AboutThisSiteController, type: :request do
+ describe '#private_information' do
+ it 'renders privacy-related info' do
+ get '/private_information'
+ expect(response.status).to eq(200)
+ expect(response.body).to include('Private Information')
+ end
+ end
+end
| Add basic request spec for AboutThisSiteController
|
diff --git a/app/controllers/api/v4/games_controller.rb b/app/controllers/api/v4/games_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/v4/games_controller.rb
+++ b/app/controllers/api/v4/games_controller.rb
@@ -6,7 +6,7 @@ render status: 400, json: {status: 400, message: 'You must supply a `search` term.'}
return
end
- @games = Game.search(params[:search])
+ @games = Game.search(params[:search]).includes(:categories)
render json: @games, each_serializer: Api::V4::GameSerializer
end
| Fix n+1 queries on v4 search
|
diff --git a/app/models/concerns/hyrax/work_behavior.rb b/app/models/concerns/hyrax/work_behavior.rb
index abc1234..def5678 100644
--- a/app/models/concerns/hyrax/work_behavior.rb
+++ b/app/models/concerns/hyrax/work_behavior.rb
@@ -28,7 +28,7 @@ self.indexer = WorkIndexer
end
- # TODO: Move this into ActiveFedora
+ # TODO: This can be removed when we upgrade to ActiveFedora 12.0
def etag
raise "Unable to produce an etag for a unsaved object" unless persisted?
ldp_source.head.etag
| Update TODO about etag having moved to ActiveFedora
|
diff --git a/test/manual/multiple_choice_test.rb b/test/manual/multiple_choice_test.rb
index abc1234..def5678 100644
--- a/test/manual/multiple_choice_test.rb
+++ b/test/manual/multiple_choice_test.rb
@@ -0,0 +1,6 @@+require 'pad_utils'
+
+choices = {b: "blue", r: "red", g: "green"}
+answer = PadUtils.choice_menu(question: "Which color", choices: choices, default: :r)
+
+puts "Answer is: #{answer}"
| Add a manual test for multiple_choice
|
diff --git a/lib/zoho_invoice_resource/cached_resource_patch.rb b/lib/zoho_invoice_resource/cached_resource_patch.rb
index abc1234..def5678 100644
--- a/lib/zoho_invoice_resource/cached_resource_patch.rb
+++ b/lib/zoho_invoice_resource/cached_resource_patch.rb
@@ -4,19 +4,19 @@
module ClassMethods
# override
- def cache_read(key)
- object = cached_resource.cache.read(key)
+ def cache_read(key, options = nil)
+ object = cached_resource.cache.read(key, options)
# dupしないといけないのかも
object && cached_resource.logger.info("#{CachedResource::Configuration::LOGGER_PREFIX} READ #{key}")
object
end
- def cache_delete(key)
- cached_resource.cache.delete(key)
+ def cache_delete(key, options = nil)
+ cached_resource.cache.delete(key, options)
end
- def cache_exist?(key)
- cached_resource.cache.exist?(key)
+ def cache_exist?(key, options = nil)
+ cached_resource.cache.exist?(key, options)
end
end
| Enable to apply options for cache methods
|
diff --git a/app/clipss/var/clipboard.rb b/app/clipss/var/clipboard.rb
index abc1234..def5678 100644
--- a/app/clipss/var/clipboard.rb
+++ b/app/clipss/var/clipboard.rb
@@ -8,13 +8,16 @@
@os = Clipss::Os.get
- if @os == :Linux
+ @check = case @os
+ when :Windows then true
+ when :Mac then true
+ when :Linux
if system('which xclip >/dev/null 2>&1')
- @check = true
+ true
elsif system('which xsel >/dev/null 2>&1')
- @check = true
+ true
else
- @check = false
+ false
end
end
| Fix Don't work clipbord sync on (Win|Mac)
|
diff --git a/jgrep.gemspec b/jgrep.gemspec
index abc1234..def5678 100644
--- a/jgrep.gemspec
+++ b/jgrep.gemspec
@@ -23,6 +23,4 @@ s.executables = ["jgrep"]
s.default_executable = "jgrep"
s.has_rdoc = true
-
- s.add_dependency('json')
end
| Remove json dependency as modern ruby satisfies this magically
|
diff --git a/jobs/infra.rb b/jobs/infra.rb
index abc1234..def5678 100644
--- a/jobs/infra.rb
+++ b/jobs/infra.rb
@@ -4,14 +4,9 @@ logger = Logger.new(STDOUT)
logger.level = Logger::WARN
+# Scheduler for consul Alert
SCHEDULER.every '5s' do
logger.info("Start Scheduler Consul")
-
- awsInfo = AwsInfo.new()
-
- allS3 = awsInfo.listS3
-
- numberS3 = awsInfo.getNumberBucketS3
consulInfo = ConsulInfo.new()
@@ -32,7 +27,16 @@ send_event('alerts', {title: 'Keep calm there is no alerts', items: [{label: '', value: ''}], status: 0})
end
+ logger.info("End Scheduler Consul")
+end
+
+#Scheduler for AWS Informations
+SCHEDULER.every '5m' do
+ logger.info("Start Scheduler AWS")
+
+ awsInfo = AwsInfo.new()
+
send_event('ec2number', { value: awsInfo.getNumberEc2, max: awsInfo.getEc2Limit })
- logger.info("End Scheduler Consul")
-end
+ logger.info("End Scheduler AWS")
+end | Split scheduler for AWS and Consul
|
diff --git a/modules/puppet/spec/classes/puppet__master_spec.rb b/modules/puppet/spec/classes/puppet__master_spec.rb
index abc1234..def5678 100644
--- a/modules/puppet/spec/classes/puppet__master_spec.rb
+++ b/modules/puppet/spec/classes/puppet__master_spec.rb
@@ -2,7 +2,12 @@
describe 'puppet::master', :type => :class do
# concat_basedir needed for puppetdb module (for postgresql)
- let(:facts) {{ :concat_basedir => '/var/lib/puppet/concat/'}}
+ let(:facts) {{
+ :concat_basedir => '/var/lib/puppet/concat/',
+ :id => 'root',
+ :kernel => 'Linux',
+ :path => 'concatted_file',
+ }}
it do
is_expected.to contain_file('/etc/init/puppetmaster.conf').
| Add stub values that allow concat tests to pass under strict.
|
diff --git a/app/models/product_image.rb b/app/models/product_image.rb
index abc1234..def5678 100644
--- a/app/models/product_image.rb
+++ b/app/models/product_image.rb
@@ -1,10 +1,10 @@ class ProductImage < ApplicationRecord
has_attached_file :picture,
styles: {
- thumb: "64x64#",
- small: "100x100#",
- med: "150x150>",
- large: "200x200>"
+ thumb: ["64x64#", :webp],
+ small: ["100x100#", :webp],
+ med: ["150x150>", :webp],
+ large: ["200x200>", :webp]
},
convert_options: {
thumb: '-quality 85',
| Update on Image Attachment Conversion Type
|
diff --git a/lib/abscss.rb b/lib/abscss.rb
index abc1234..def5678 100644
--- a/lib/abscss.rb
+++ b/lib/abscss.rb
@@ -21,7 +21,9 @@ end
def output
- @selectors.keys.join("\n")
+ @selectors.keys.collect do |selector|
+ selector + " {}"
+ end
end
end
-end+end
| Add empty braces to each selector.
|
diff --git a/lib/dolphy.rb b/lib/dolphy.rb
index abc1234..def5678 100644
--- a/lib/dolphy.rb
+++ b/lib/dolphy.rb
@@ -2,18 +2,6 @@ require 'dolphy/core'
class DolphyApp
-# This returns a DolphyApplication defined by what is passed in the block.
-#
-# An application could for instance be defined in this way
-#
-# DolphyApp.app do
-# DolphyApp.router do
-# get '/hello' do
-# haml :index, body: "Hello"
-# end
-# end
-# end.serve!
-#
def self.app(&block)
Dolphy::Core.new(&block)
end
| Remove app example from code.
|
diff --git a/db/migrate/20170419000002_overview_role_ids.rb b/db/migrate/20170419000002_overview_role_ids.rb
index abc1234..def5678 100644
--- a/db/migrate/20170419000002_overview_role_ids.rb
+++ b/db/migrate/20170419000002_overview_role_ids.rb
@@ -18,6 +18,8 @@ overview.save!
}
remove_column :overviews, :role_id
+
+ Cache.clear
end
end
| Delete cache for invalidate overview caches.
|
diff --git a/EPIC_SCRIPT.rb b/EPIC_SCRIPT.rb
index abc1234..def5678 100644
--- a/EPIC_SCRIPT.rb
+++ b/EPIC_SCRIPT.rb
@@ -12,7 +12,7 @@ end
elsif line.sub("print ", "").chars.first == '['
if line.sub("print ", "").chars.last == ']'
- # print every string in array on a different line
+ puts line.sub("print ", "").split(", ").join("\n")
else
puts "Error 1: print can only use a string or array"
end
| Add the ability to print arrays 2 |
diff --git a/amberbit-config.gemspec b/amberbit-config.gemspec
index abc1234..def5678 100644
--- a/amberbit-config.gemspec
+++ b/amberbit-config.gemspec
@@ -1,18 +1,18 @@ # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
- s.name = "amberbit-config"
- s.summary = "Yet Another AppConfig for Rails but not only."
- s.description = "Reads YAML files with configuration. Allows you to specify default configuration file you can store in repository and overwrite it with custom configuration file for each application instance and environment."
- s.email = "hubert.lepicki@amberbit.com"
- s.authors = ["Wojciech Piekutowski", "Hubert Lepicki", "Piotr Tynecki", "Leszek Zalewski"]
- s.homepage = "http://github.com/amberbit/amberbit-config"
- s.date = "2013-02-26"
- s.version = "1.2.0"
+ s.name = 'amberbit-config'
+ s.summary = 'Yet Another AppConfig for Rails but not only.'
+ s.description = 'Reads YAML files with configuration. Allows you to specify default configuration file you can store in repository and overwrite it with custom configuration file for each application instance and environment.'
+ s.email = 'hubert.lepicki@amberbit.com'
+ s.authors = ['Wojciech Piekutowski', 'Hubert Lepicki', 'Piotr Tynecki']
+ s.homepage = 'http://github.com/amberbit/amberbit-config'
+ s.date = '2011-08-12'
+ s.version = '1.1.0'
- s.files = Dir["lib/**/*", "config/**/*"] + ["MIT-LICENSE", "README.rdoc", "VERSION"]
- s.require_path = [".", "lib"]
+ s.files = Dir['lib/**/*'] + ['MIT-LICENSE', 'README.rdoc', 'VERSION']
+ s.require_path = ['.', 'lib']
- s.add_development_dependency "rspec"
- s.add_development_dependency "rspec-rails"
+ s.add_development_dependency 'rspec'
+ s.add_development_dependency 'rails', '3.2.0'
end
| Revert "Added Leszek to contributors, version bump"
This reverts commit 4e802022c2fb9f694863d73a952641b0fbe16339.
|
diff --git a/RZCellSizeManager.podspec b/RZCellSizeManager.podspec
index abc1234..def5678 100644
--- a/RZCellSizeManager.podspec
+++ b/RZCellSizeManager.podspec
@@ -1,6 +1,6 @@ Pod::Spec.new do |s|
s.name = "RZCellSizeManager"
- s.version = "1.0.0"
+ s.version = "1.1.1"
s.summary = "Dynamic size computation and cacheing for cells."
s.description = <<-DESC
@@ -11,7 +11,23 @@ s.license = { :type => 'MIT'}
s.author = { "Alex Rouse" => "alex.rouse@raizlabs.com" }
s.platform = :ios, '7.0'
- s.source = { :git => "https://github.com/Raizlabs/RZCellSizeManager.git", :tag => "1.0.1" }
- s.source_files = 'RZCellSizeManager/*.{h,m}'
+ s.source = { :git => "https://github.com/Raizlabs/RZCellSizeManager.git", :tag => "1.1.1" }
s.requires_arc = true
+
+ s.subspec 'Core' do |ss|
+ ss.source_files = 'RZCellSizeManager/*.{h,m}'
+ end
+
+ s.subspec 'CoreDataExtension' do |ss|
+ ss.dependency 'RZCellSizeManager/Core'
+ ss.source_files = 'RZCellSizeManagerExtensions/*+CoreData.{h,m}'
+ end
+
+ s.subspec 'RZCollectionListExtension' do |ss|
+ ss.dependency 'RZCellSizeManager/Core'
+ ss.source_files = 'RZCellSizeManagerExtensions/*+RZCollectionList.{h,m}'
+ end
+
+ s.default_subspec = 'Core'
+
end
| Update podspec in prep for release, add subspecs for extensions
|
diff --git a/HomebrewFormula/goad.rb b/HomebrewFormula/goad.rb
index abc1234..def5678 100644
--- a/HomebrewFormula/goad.rb
+++ b/HomebrewFormula/goad.rb
@@ -1,4 +1,4 @@-class Goad < Formula
+cask 'goad' do
version '1.3.0'
sha256 '62c76c90b9fd6d1a1dba9058b57a7ba3af8e09df38d3ea3dc7809422b8c7a8d3'
| Revert "a Tap is a Tap..."
This reverts commit 38799852bcddc3aa15f7c16e910f32df48af2fd3.
|
diff --git a/test/test_pedantic.rb b/test/test_pedantic.rb
index abc1234..def5678 100644
--- a/test/test_pedantic.rb
+++ b/test/test_pedantic.rb
@@ -1,57 +1,30 @@ require 'test/unit'
+require 'yaml'
class TestPedantic < Test::Unit::TestCase
- Lib = File.expand_path("../../lib/linguist", __FILE__)
-
- def file(name)
- File.read(File.join(Lib, name))
- end
+ filename = File.expand_path("../../lib/linguist/languages.yml", __FILE__)
+ LANGUAGES = YAML.load(File.read(filename))
def test_language_names_are_sorted
- languages = []
- file("languages.yml").lines.each do |line|
- if line =~ /^(\w+):$/
- languages << $1
- end
- end
- assert_sorted languages
+ assert_sorted LANGUAGES.keys
end
def test_extensions_are_sorted
- extensions = nil
- file("languages.yml").lines.each do |line|
- if line =~ /^ extensions:$/
- extensions = []
- elsif extensions && line =~ /^ - \.([\w\-\.]+)( *#.*)?$/
- extensions << $1
- else
- assert_sorted extensions[1..-1] if extensions
- extensions = nil
- end
+ LANGUAGES.each do |name, language|
+ extensions = language['extensions']
+ assert_sorted extensions[1..-1] if extensions && extensions.size > 1
end
end
def test_filenames_are_sorted
- filenames = nil
- file("languages.yml").lines.each do |line|
- if line =~ /^ filenames:$/
- filenames = []
- elsif filenames && line =~ /^ - \.(\w+)$/
- filenames << $1
- else
- assert_sorted filenames if filenames
- filenames = nil
- end
+ LANGUAGES.each do |name, language|
+ assert_sorted language['filenames'] if language['filenames']
end
end
def assert_sorted(list)
- previous = nil
- list.each do |item|
- if previous && previous > item
- flunk "#{previous} should come after #{item}"
- end
- previous = item
+ list.each_cons(2) do |previous, item|
+ flunk "#{previous} should come after #{item}" if previous > item
end
end
end
| Make pedantic test actually pedantic
What do you call someone that thinks they are pedantic but actually
aren’t? All the crazy custom parsing in this test was making so it
wasn’t actually doing anything.
|
diff --git a/messaging.gemspec b/messaging.gemspec
index abc1234..def5678 100644
--- a/messaging.gemspec
+++ b/messaging.gemspec
@@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'evt-messaging'
- s.version = '1.1.0.1'
+ s.version = '1.2.0.0'
s.summary = 'Common primitives for platform-specific messaging implementations for Eventide'
s.description = ' '
| Package version is increased from 1.1.0.1 to 1.2.0.0
|
diff --git a/messaging.gemspec b/messaging.gemspec
index abc1234..def5678 100644
--- a/messaging.gemspec
+++ b/messaging.gemspec
@@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'evt-messaging'
- s.version = '0.29.0.3'
+ s.version = '0.29.0.4'
s.summary = 'Common primitives for platform-specific messaging implementations for Eventide'
s.description = ' '
| Package version is increased from 0.29.0.3 to 0.29.0.4
|
diff --git a/recipes/default.rb b/recipes/default.rb
index abc1234..def5678 100644
--- a/recipes/default.rb
+++ b/recipes/default.rb
@@ -9,29 +9,22 @@ end
# Install Ruby and other required packages
-%w{ruby2.1 ruby2.1-dev ruby-switch curl}.each do |pkg|
+%w{ruby2.1 ruby2.1-dev curl}.each do |pkg|
package pkg do
action :install
end
end
-
-# Make Ruby 2.1 the default Ruby
-script "ruby-switch" do
- interpreter "bash"
- code "sudo ruby-switch --set ruby2.1"
-end
-
-# Install bundler
gem_package "bundler" do
gem_binary "/usr/bin/gem"
end
# Install required gems via bundler
-# store them in vendor/bundle
+# Store them in vendor/bundle
+# Need workaround with binstubs for correct shebang line
script "bundle" do
interpreter "bash"
cwd "/vagrant"
- code "bundle install --path vendor/bundle"
+ code "bundle install --path=vendor/bundle --binstubs=vendor/bundle/ruby/2.1.0/bin"
end
# Package required gems in vendor folder
| Use binstubs for correct shebang line
|
diff --git a/app/admin/image.rb b/app/admin/image.rb
index abc1234..def5678 100644
--- a/app/admin/image.rb
+++ b/app/admin/image.rb
@@ -0,0 +1,17 @@+ActiveAdmin.register Image do
+
+# See permitted parameters documentation:
+# https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
+#
+# permit_params :list, :of, :attributes, :on, :model
+#
+# or
+#
+# permit_params do
+# permitted = [:permitted, :attributes]
+# permitted << :other if params[:action] == 'create' && current_user.admin?
+# permitted
+# end
+
+
+end
| Add new model Image to Admin
|
diff --git a/app/controllers/github_repositories_controller.rb b/app/controllers/github_repositories_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/github_repositories_controller.rb
+++ b/app/controllers/github_repositories_controller.rb
@@ -1,6 +1,7 @@ class GithubRepositoriesController < ApplicationController
def show
@github_repository = GithubRepository.find_by_full_name([params[:owner], params[:name]].join('/'))
+ raise ActiveRecord::RecordNotFound if @github_repository.nil?
@contributors = @github_repository.github_contributions.order('count DESC').limit(20).includes(:github_user)
@projects = @github_repository.projects.includes(:versions)
end
| Handle missing github repos better |
diff --git a/db/migrate/20090608143621_timezones.rb b/db/migrate/20090608143621_timezones.rb
index abc1234..def5678 100644
--- a/db/migrate/20090608143621_timezones.rb
+++ b/db/migrate/20090608143621_timezones.rb
@@ -1,6 +1,6 @@ class Timezones < ActiveRecord::Migration
def self.up
- add_column :users, :timezone, :string
+ add_column :users, :timezone, :string, :default => 'UTC'
end
def self.down
| Set default timezone to UTC in the migration, forgotten at ffae80678a1
|
diff --git a/features/step_definitions/identity_steps.rb b/features/step_definitions/identity_steps.rb
index abc1234..def5678 100644
--- a/features/step_definitions/identity_steps.rb
+++ b/features/step_definitions/identity_steps.rb
@@ -1,4 +1,4 @@-Given(/^I use the account "([^"]*)"$/) do |account_id|
+Given(/^I use the account "([^"]*)"(?: with alias "([^"]*)")?$/) do |account_id, account_alias|
Aws.config[:sts] = {
stub_responses: {
get_caller_identity: {
@@ -8,4 +8,15 @@ }
}
}
+
+ if account_alias.present?
+ Aws.config[:iam] = {
+ stub_responses: {
+ list_account_aliases: {
+ account_aliases: [account_alias],
+ is_truncated: false
+ }
+ }
+ }
+ end
end
| Add support for stubbing Identity's account alias in cucumber step
|
diff --git a/features/step_definitions/screen_factory.rb b/features/step_definitions/screen_factory.rb
index abc1234..def5678 100644
--- a/features/step_definitions/screen_factory.rb
+++ b/features/step_definitions/screen_factory.rb
@@ -1,27 +1,21 @@-require_relative 'screens/android_commit_list_screen'
-require_relative 'screens/ios_commit_list_screen'
-
class ScreenFactory
def initialize platform
@platform = platform
-
- @androidScreens = {commitlist: AndroidCommitListScreen.new()}
- @iosScreens = {commitlist: IosCommitListScreen.new()}
end
def get_commit_list_screen
- get_screen_by_key :commitlist
+ get_screen_by_key "CommitListScreen"
end
- def get_screen_by_key key
+ def get_screen_by_key screen_name
case @platform
when 'android'
- @androidScreens[key]
+ Object::const_get("Android#{screen_name}").new()
when 'ios'
- @iosScreens[key]
+ Object::const_get("Ios#{screen_name}").new()
else
- raise "Unexpected platform '#{@platform}', cannot get get screen by key '#{key}'"
+ raise "Unexpected platform '#{@platform}', cannot get get screen by screen_name '#{screen_name}'"
end
end
| Create the instance of the Screen on demand rather than on init of ScreenFactory
|
diff --git a/RNI18n.podspec b/RNI18n.podspec
index abc1234..def5678 100644
--- a/RNI18n.podspec
+++ b/RNI18n.podspec
@@ -14,6 +14,4 @@ s.source = { git: "https://github.com/AlexanderZaytsev/react-native-i18n.git", tag: s.version.to_s }
s.source_files = "ios/**/*.{h,m}"
s.requires_arc = true
-
- s.dependency "React"
end
| Remove React dependency from the podspec file |
diff --git a/app/models/club.rb b/app/models/club.rb
index abc1234..def5678 100644
--- a/app/models/club.rb
+++ b/app/models/club.rb
@@ -3,8 +3,8 @@
monetize :price_cents
- validates :name, :presence => true
- validates :description, :presence => true
+ validates :name, :presence => { :message => "for club can't be blank" }
+ validates :description, :presence => { :message => "for club can't be blank" }
validates :logo, :presence => true
validates :price_cents, :presence => true
validates :user_id, :presence => true
| Update Club for Validation Messages
Update the Club model to include custom validation messages for several
attributes.
|
diff --git a/flair.gemspec b/flair.gemspec
index abc1234..def5678 100644
--- a/flair.gemspec
+++ b/flair.gemspec
@@ -7,11 +7,11 @@ Gem::Specification.new do |s|
s.name = "flair"
s.version = Flair::VERSION
- s.authors = ["TODO: Your name"]
- s.email = ["TODO: Your email"]
- s.homepage = "TODO"
- s.summary = "TODO: Summary of Flair."
- s.description = "TODO: Description of Flair."
+ s.authors = ["Terry Schmidt"]
+ s.email = ["terry.m.schmidt@gmail.com"]
+ s.homepage = "https://github.com/tschmidt/flair"
+ s.summary = "Easily add a styleguide to your rails app."
+ s.description = s.summary
s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.md"]
s.test_files = Dir["test/**/*"]
| Complete gem information in gemspec file
|
diff --git a/schema_association_inverses.gemspec b/schema_association_inverses.gemspec
index abc1234..def5678 100644
--- a/schema_association_inverses.gemspec
+++ b/schema_association_inverses.gemspec
@@ -21,7 +21,7 @@ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.require_paths = ['lib']
- spec.add_dependency 'schema_monkey'
+ spec.add_dependency 'schema_plus_core', '>= 0.2.1'
spec.add_development_dependency 'bundler', '~> 1.7'
spec.add_development_dependency 'rake', '~> 10.0'
| Use the correct dependency after refactoring.
|
diff --git a/tty-progressbar.gemspec b/tty-progressbar.gemspec
index abc1234..def5678 100644
--- a/tty-progressbar.gemspec
+++ b/tty-progressbar.gemspec
@@ -21,7 +21,7 @@ spec.required_ruby_version = '>= 2.0.0'
spec.add_dependency "tty-cursor", '~> 0.5.0'
- spec.add_dependency "tty-screen", '~> 0.6.0'
+ spec.add_dependency "tty-screen", '~> 0.5.0'
spec.add_development_dependency 'bundler', '>= 1.5.0', '< 2.0'
spec.add_development_dependency 'rspec', '~> 3.1'
| Change to revert back tty-screen
|
diff --git a/lib/cancan_namespace/controller_resource.rb b/lib/cancan_namespace/controller_resource.rb
index abc1234..def5678 100644
--- a/lib/cancan_namespace/controller_resource.rb
+++ b/lib/cancan_namespace/controller_resource.rb
@@ -28,7 +28,7 @@ def module_from_controller
modules = @params[:controller].sub("Controller", "").underscore.split('/')
if modules.size > 1
- modules.first.singularize
+ modules[0..-2].map(&:singularize).join('__')
else
return nil
end
| Use all parent modules to generate namespace name
|
diff --git a/lib/formotion/row_type/activity_view_row.rb b/lib/formotion/row_type/activity_view_row.rb
index abc1234..def5678 100644
--- a/lib/formotion/row_type/activity_view_row.rb
+++ b/lib/formotion/row_type/activity_view_row.rb
@@ -1,3 +1,5 @@+motion_require 'object_row'
+
module Formotion
module RowType
class ActivityRow < ObjectRow
| Add missing require statement to activity_row.
|
diff --git a/lib/fucking_scripts_digital_ocean/server.rb b/lib/fucking_scripts_digital_ocean/server.rb
index abc1234..def5678 100644
--- a/lib/fucking_scripts_digital_ocean/server.rb
+++ b/lib/fucking_scripts_digital_ocean/server.rb
@@ -1,3 +1,5 @@+require 'shellwords'
+
module FuckingScriptsDigitalOcean
class Server
ServerNotFound = Class.new(StandardError)
@@ -14,7 +16,20 @@ raise ServerNotFound, "Unable to find server with Droplet name #{options[:droplet_name]}." if server.nil?
FuckingScriptsDigitalOcean::SCP.new(server, options).to_server
- server.ssh(options.fetch(:scripts))
+ scripts = options.fetch(:scripts).map do |script|
+ "#{environment_exports} bash -c '#{script}'"
+ end
+ server.ssh(scripts)
+ end
+
+ def environment_exports
+ @environment_exports ||= begin
+ if options[:env].nil?
+ ""
+ else
+ options[:env].map { |k, v| [k, Shellwords.escape(v)].join("=") }.join(" ")
+ end
+ end
end
private
| Allow injection of environment variables to script |
diff --git a/lib/meetup_thingy/event_list_file_writer.rb b/lib/meetup_thingy/event_list_file_writer.rb
index abc1234..def5678 100644
--- a/lib/meetup_thingy/event_list_file_writer.rb
+++ b/lib/meetup_thingy/event_list_file_writer.rb
@@ -16,8 +16,7 @@ def extract_row(event)
start_time = time_with_offset(event['time'], event['utc_offset'])
# According to http://www.meetup.com/meetup_api/docs/2/events/,
- # if no duration is specified,
- # we can assume 3 hours.
+ # if no duration is specified, we can assume 3 hours.
# TODO: We should probably display a warning when this happens.
duration = event['duration'] || three_hours
end_time = start_time + ms_to_seconds(duration)
| Tidy up comment broken over two lines.
|
diff --git a/lib/dingtalk/api/call_back.rb b/lib/dingtalk/api/call_back.rb
index abc1234..def5678 100644
--- a/lib/dingtalk/api/call_back.rb
+++ b/lib/dingtalk/api/call_back.rb
@@ -1,17 +1,33 @@ module Dingtalk
module Api
class CallBack < Base
- def register_call_back(call_back_tag = [], url)
- params = {
- call_back_tag: call_back_tag,
- token: Dingtalk.suite_token,
- aes_key: Dingtalk.suite_aes_key,
- url: url
- }
- http_post("register_call_back?access_token=#{access_token}", params)
+ def register_call_back(call_back_tag, url)
+ http_post("register_call_back?access_token=#{access_token}", params(call_back_tag, url))
+ end
+
+ def update_call_back(call_back_tag, url)
+ http_post("update_call_back?access_token=#{access_token}", params(call_back_tag, url))
+ end
+
+ def get_call_back
+ http_get("get_call_back?access_token=#{access_token}")
+ end
+
+
+ def delete_call_back
+ http_get("delete_call_back?access_token=#{access_token}")
end
private
+ def params(call_back_tag, url)
+ {
+ call_back_tag: call_back_tag,
+ token: Dingtalk.suite_token,
+ aes_key: Dingtalk.suite_aes_key,
+ url: url
+ }
+ end
+
def base_url
'call_back'
end
| Add rest of the call back apis
|
diff --git a/spec/factories/course_experience_points_records.rb b/spec/factories/course_experience_points_records.rb
index abc1234..def5678 100644
--- a/spec/factories/course_experience_points_records.rb
+++ b/spec/factories/course_experience_points_records.rb
@@ -3,7 +3,7 @@ creator
updater
course_user
- points_awarded 100
+ points_awarded { rand(1..20) * 100 }
reason 'EXP for some event'
end
end
| Add randomisation to exp of manual_exp_record factory
|
diff --git a/lib/semlogr/properties/output_properties.rb b/lib/semlogr/properties/output_properties.rb
index abc1234..def5678 100644
--- a/lib/semlogr/properties/output_properties.rb
+++ b/lib/semlogr/properties/output_properties.rb
@@ -2,10 +2,10 @@ module Properties
class OutputProperties
def self.create(log_event)
- properties = {
+ properties = log_event.properties.merge({
timestamp: log_event.timestamp,
level: log_event.level
- }
+ })
if log_event.error
properties[:error] = log_event.error
| Support rendering of all log event properties inside the output templates
|
diff --git a/lib/acts_as_seo_friendly/datable/getters.rb b/lib/acts_as_seo_friendly/datable/getters.rb
index abc1234..def5678 100644
--- a/lib/acts_as_seo_friendly/datable/getters.rb
+++ b/lib/acts_as_seo_friendly/datable/getters.rb
@@ -4,7 +4,7 @@ ActsAsSeoFriendly::Datable::Core::SEO_ATTRIBUTES.each do |seo_attr|
define_method(seo_attr) do
if seo_datum && seo_datum.persisted?
- seo_datum.public_send(seo_attr)
+ seo_datum.public_send(seo_attr).presence || public_send("dynamic_#{seo_attr}")
else
public_send("dynamic_#{seo_attr}")
end
| Return persisted seo datum meta attributes only if they are not blank
|
diff --git a/spec/integration/multi_repo_spec.rb b/spec/integration/multi_repo_spec.rb
index abc1234..def5678 100644
--- a/spec/integration/multi_repo_spec.rb
+++ b/spec/integration/multi_repo_spec.rb
@@ -0,0 +1,61 @@+require 'spec_helper'
+
+describe 'Using in-memory adapter for cross-repo access' do
+ it 'works' do
+ setup = ROM.setup(
+ left: 'memory://localhost/users',
+ right: 'memory://localhost/tasks',
+ main: 'memory://localhost/main'
+ )
+
+ setup.schema do
+ base_relation :users do
+ repository :left
+ attribute :user_id
+ attribute :name
+ end
+
+ base_relation :tasks do
+ repository :right
+ attribute :user_id
+ attribute :title
+ end
+
+ base_relation :users_and_tasks do
+ repository :main
+
+ attribute :user
+ attribute :tasks
+ end
+ end
+
+ setup.relation(:users)
+ setup.relation(:tasks)
+
+ setup.relation(:users_and_tasks) do
+ include ROM::RA
+
+ def all
+ join(users, tasks)
+ end
+ end
+
+ setup.mappers do
+ define(:users_and_tasks) do
+ attribute :user_id
+ attribute :name
+
+ group tasks: [:title]
+ end
+ end
+
+ rom = setup.finalize
+
+ rom.left.users << { user_id: 1, name: 'Jane' }
+ rom.right.tasks << { user_id: 1, title: 'Have fun' }
+
+ expect(rom.read(:users_and_tasks).all.to_a).to eql([
+ { user_id: 1, name: 'Jane', tasks: [{ title: 'Have fun' }] }
+ ])
+ end
+end
| Add a spec with cross-repo relations
|
diff --git a/app/controllers/backend/backend_controller.rb b/app/controllers/backend/backend_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/backend/backend_controller.rb
+++ b/app/controllers/backend/backend_controller.rb
@@ -14,9 +14,9 @@ # return which club this ugent_login is allowed to manage
def club_for_ugent_login(ugent_login)
# using httparty because it is much easier to read than net/http code
- resp = HTTParty.get('http.fkgent.be/api_zeus.php',
+ resp = HTTParty.get('http://fkgent.be/api_zeus.php',
:query => {
- :k => Rails::Application.config.zeus_api_key,
+ :k => digest(ugent_login, Rails::Application.config.zeus_api_key),
:u => ugent_login
}
)
@@ -24,10 +24,14 @@ # this will only return the club name if controle hash matches
if resp.body != 'FAIL'
hash = JSON[resp.body]
- dig = Digest::SHA256.hexdigest Rails::Application.config.zeus_api_salt + '-' + ugent_login + hash['kringname']
+ dig = digest(Rails::Application.config.zeus_api_salt, ugent_login, hash['kringname'])
return hash['kringname'] if hash['controle'] == dig
end
false
end
+ def digest(*args)
+ Digest::SHA256.hexdigest args.join('-')
+ end
+
end
| Fix url and use new authentication
|
diff --git a/lib/flor/migrations/0002_cunit_and_munit.rb b/lib/flor/migrations/0002_cunit_and_munit.rb
index abc1234..def5678 100644
--- a/lib/flor/migrations/0002_cunit_and_munit.rb
+++ b/lib/flor/migrations/0002_cunit_and_munit.rb
@@ -30,6 +30,11 @@ alter_table :flor_pointers do
add_column :cunit, String
+
+ add_column :mtime, String
+ add_column :munit, String
+ #
+ # those 2 could prove useful later on
end
alter_table :flor_traces do
@@ -67,6 +72,9 @@ alter_table :flor_pointers do
drop_column :cunit
+
+ drop_column :mtime
+ drop_column :munit
end
alter_table :flor_traces do
| Add mtime and munit to flor_pointers
Although not yet in use
|
diff --git a/lib/omniauth/strategies/wordpress_hosted.rb b/lib/omniauth/strategies/wordpress_hosted.rb
index abc1234..def5678 100644
--- a/lib/omniauth/strategies/wordpress_hosted.rb
+++ b/lib/omniauth/strategies/wordpress_hosted.rb
@@ -8,7 +8,7 @@
# This is where you pass the options you would pass when
# initializing your consumer from the OAuth gem.
- option :client_options, { }
+ option :client_options, { token_url: "/oauth/token", authorize_url: "/oauth/authorize" }
# These are called after authentication has succeeded. If
@@ -32,7 +32,7 @@ end
def raw_info
- @raw_info ||= access_token.get('/me').parsed
+ @raw_info ||= access_token.get("#{options[:client_options][:site]}/me").parsed
end
end
end
| Update endpoints used by WP OAuth Server 3.1.3
|
diff --git a/spec/private/config/adapter_spec.rb b/spec/private/config/adapter_spec.rb
index abc1234..def5678 100644
--- a/spec/private/config/adapter_spec.rb
+++ b/spec/private/config/adapter_spec.rb
@@ -0,0 +1,32 @@+require File.dirname(__FILE__) + '/spec_helper'
+
+MERB_BIN = File.dirname(__FILE__) + "/../../../bin/merb"
+
+describe "Merb::Config" do
+ before do
+ ARGV.replace([])
+ Merb::Server.should_receive(:start).and_return(nil)
+ end
+
+ it "should load the runner adapter by default" do
+ Merb.start
+ Merb::Config[:adapter].should == "runner"
+ end
+
+ it "should load mongrel adapter when running `merb`" do
+ load(MERB_BIN)
+ Merb::Config[:adapter].should == "mongrel"
+ end
+
+ it "should override adapter when running `merb -a other`" do
+ ARGV.push *%w[-a other]
+ load(MERB_BIN)
+ Merb::Config[:adapter].should == "other"
+ end
+
+ it "should load irb adapter when running `merb -i`" do
+ ARGV << '-i'
+ load(MERB_BIN)
+ Merb::Config[:adapter].should == "irb"
+ end
+end | Add specs describing new adapter behaviour in Merb.start and bin/merb
|
diff --git a/lib/sastrawi/dictionary/array_dictionary.rb b/lib/sastrawi/dictionary/array_dictionary.rb
index abc1234..def5678 100644
--- a/lib/sastrawi/dictionary/array_dictionary.rb
+++ b/lib/sastrawi/dictionary/array_dictionary.rb
@@ -29,6 +29,18 @@ @words.push(word)
end
+ def add_words_from_text_file(file_path)
+ words = []
+
+ File.open(file_path, 'r') do |file|
+ file.each do |line|
+ words.push(line.chomp)
+ end
+ end
+
+ add_words(words)
+ end
+
def remove(word)
@words.delete(word)
end
| Add function to add words from a text file
|
diff --git a/lib/puppet/parser/functions/array_suffix.rb b/lib/puppet/parser/functions/array_suffix.rb
index abc1234..def5678 100644
--- a/lib/puppet/parser/functions/array_suffix.rb
+++ b/lib/puppet/parser/functions/array_suffix.rb
@@ -0,0 +1,45 @@+#
+# suffix.rb
+#
+
+module Puppet::Parser::Functions
+ newfunction(:array_suffix, :type => :rvalue, :doc => <<-EOS
+This function applies a suffix to all elements in an array.
+
+*Examples:*
+
+ array_suffix(['a','b','c'], 'p')
+
+Will return: ['ap','bp','cp']
+ EOS
+ ) do |arguments|
+
+ # Technically we support two arguments but only first is mandatory ...
+ raise(Puppet::ParseError, "array_suffix(): Wrong number of arguments " +
+ "given (#{arguments.size} for 1)") if arguments.size < 1
+
+ array = arguments[0]
+
+ unless array.is_a?(Array)
+ raise Puppet::ParseError, "array_suffix(): expected first argument to be an Array, got #{array.inspect}"
+ end
+
+ suffix = arguments[1] if arguments[1]
+
+ if suffix
+ unless suffix.is_a? String
+ raise Puppet::ParseError, "array_suffix(): expected second argument to be a String, got #{suffix.inspect}"
+ end
+ end
+
+ # Turn everything into string same as join would do ...
+ result = array.collect do |i|
+ i = i.to_s
+ suffix ? i + suffix : i
+ end
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
| Add suffix function from puppetlabs stdlib
At the moment we use stdlib 3.2.0 which doesn't have the suffix function.
Merging it in manually now in the module solves this for now.
|
diff --git a/app/helpers/scenario_helper.rb b/app/helpers/scenario_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/scenario_helper.rb
+++ b/app/helpers/scenario_helper.rb
@@ -7,6 +7,11 @@ scaled = Current.setting.scaling.present?
checked = scaled ? Current.setting.scaling[:"has_#{ name }"] : default
- check_box_tag("has_#{ name }", '1', checked, disabled: false)
+ if scaled && checked
+ check_box_tag("has_#{ name }", '1', checked, disabled: true) +
+ hidden_field_tag("has_#{ name }", '1')
+ else
+ check_box_tag("has_#{ name }", '1', checked, disabled: scaled)
+ end
end
end
| Disable sector checkboxes when rescaling scenario
Checkboxes will now be disabled to prevent further changes by the
visitor, and the correct on/off value will be sent to ETEngine.
Closes #2149.
|
diff --git a/app/models/enclosure_artist.rb b/app/models/enclosure_artist.rb
index abc1234..def5678 100644
--- a/app/models/enclosure_artist.rb
+++ b/app/models/enclosure_artist.rb
@@ -0,0 +1,32 @@+# frozen_string_literal: true
+
+class EnclosureArtist < ApplicationRecord
+ include EnclosureMark
+ belongs_to :enclosure, touch: true, polymorphic: true
+ belongs_to :artist
+
+ scope :feed, ->(feed) {
+ joins(artist: :entries).where(entries: { feed_id: feed.id })
+ }
+ scope :keyword, ->(keyword) {
+ joins(artist: { entries: :keywords })
+ .where(keywords: { id: keyword.id })
+ }
+ scope :tag, ->(tag) {
+ joins(artist: { entries: :tags }).where(tags: { id: tag.id })
+ }
+ scope :topic, ->(topic) {
+ joins(container: { entries: { feed: :topics }})
+ .where(topics: { id: topic.id })
+ }
+ scope :category, ->(category) {
+ joins(artist: { entries: { feed: { subscriptions: :categories }}})
+ .where(categories: { id: category.id })
+ }
+ scope :issue, ->(issue) {
+ joins(artist: :issues).where(issues: { id: issue.id })
+ }
+ scope :issues, ->(issues) {
+ joins(artist: :issues).where(issues: { id: issues.pluck(:id) })
+ }
+end
| Implement EnclosureArtist model class that is polymorphic association between artist and track|album
|
diff --git a/app/parsers/document_parser.rb b/app/parsers/document_parser.rb
index abc1234..def5678 100644
--- a/app/parsers/document_parser.rb
+++ b/app/parsers/document_parser.rb
@@ -7,6 +7,8 @@ AaibReport.new(document_hash)
when "cma_case"
CmaCase.new(document_hash)
+ when "contact"
+ Contact.new(document_hash)
when "international_development_fund"
InternationalDevelopmentFund.new(document_hash)
when "drug_safety_update"
| Add Contact doc format to DocumentParser
This was missed out from when it was added to lib/finder_frontend.rb:
45b11456b5f7595cbafda22d0e9dc44cb2baaf7e
|
diff --git a/config/initializers/cors.rb b/config/initializers/cors.rb
index abc1234..def5678 100644
--- a/config/initializers/cors.rb
+++ b/config/initializers/cors.rb
@@ -7,10 +7,11 @@
Rails.application.config.middleware.insert_before 0, Rack::Cors do
allow do
- origins '*'
+ origins 'tebukuro.shinosakarb.org', 'localhost:4000'
resource '*',
headers: :any,
+ credentials: true,
expose: ['access-token', 'expiry', 'token-type', 'uid', 'client'],
methods: [:get, :post, :delete, :patch]
end
| Add prod and dev domain for frontend and set credentials true
|
diff --git a/lib/hirsute_fixed.rb b/lib/hirsute_fixed.rb
index abc1234..def5678 100644
--- a/lib/hirsute_fixed.rb
+++ b/lib/hirsute_fixed.rb
@@ -7,8 +7,8 @@ # though Hirsute can use set and get within itself, set also configures attribute accessors
# for the specified field, thus allowing more user-friendly management of Hirsute objects
def set(field,value)
- set_method = (field + "=").to_sym
- m = self.method((field + "=").to_sym)
+ set_method = (field.to_s + "=").to_sym
+ m = self.method((field.to_s + "=").to_sym)
m.call value
end
| Support symbols as field names (which should be the default)
|
diff --git a/lib/m/test_method.rb b/lib/m/test_method.rb
index abc1234..def5678 100644
--- a/lib/m/test_method.rb
+++ b/lib/m/test_method.rb
@@ -1,3 +1,5 @@+require "method_source"
+
module M
### Simple data structure for what a test method contains.
#
@@ -22,7 +24,7 @@ #
# The end line should be the number of line breaks in the method source,
# added to the starting line and subtracted by one.
- require "method_source"
+
end_line = method.source.split("\n").size + start_line - 1
# Shove the given attributes into a new databag
| Move require outside of class method
Otherwise if m is installed via gem install and run in a repo that doesn't have
it inside of its Gemfile, the following error is thrown:
cannot load such file -- method_source (LoadError)
All props on solving this in light of my derping around go to @schneems. |
diff --git a/code_tools.gemspec b/code_tools.gemspec
index abc1234..def5678 100644
--- a/code_tools.gemspec
+++ b/code_tools.gemspec
@@ -14,7 +14,7 @@ "lib/vamper/default.version.config",
"lib/vamper/version_config_file.rb",
"lib/vamper/version_file.rb"]
- s.executables = ['vamper', 'spacer', 'ender', 'code_tools']
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.homepage = 'http://rubygems.org/gems/code_tools'
s.license = 'MIT'
s.required_ruby_version = '~> 2.0'
| Tweak gemspec base on RSpec settings.
|
diff --git a/lib/sinatra/auth/github/test/test_helper.rb b/lib/sinatra/auth/github/test/test_helper.rb
index abc1234..def5678 100644
--- a/lib/sinatra/auth/github/test/test_helper.rb
+++ b/lib/sinatra/auth/github/test/test_helper.rb
@@ -11,7 +11,7 @@ User.make(attrs)
end
- class User < Warden::Github::Oauth::User
+ class User < Warden::Github::User
def self.make(attrs = {})
default_attrs = {
'login' => "test_user",
| Fix warden-github's user module name. |
diff --git a/lib/tic_tac_toe/rack_shell.rb b/lib/tic_tac_toe/rack_shell.rb
index abc1234..def5678 100644
--- a/lib/tic_tac_toe/rack_shell.rb
+++ b/lib/tic_tac_toe/rack_shell.rb
@@ -11,7 +11,7 @@
def call(env)
if env["PATH_INFO"] =~ %r{^/new$}
- @game = TicTacToe::Game.new(TicTacToe::Board.empty_board)
+ @game = TicTacToe::Game.new_game(TicTacToe::Board.empty_board)
[200, {}, [TicTacToe::View::Game.new(@game).render]]
else
[404, {}, ["Not found."]]
| Correct rack shell's usage of Game class
|
diff --git a/lib/veritas/relation/empty.rb b/lib/veritas/relation/empty.rb
index abc1234..def5678 100644
--- a/lib/veritas/relation/empty.rb
+++ b/lib/veritas/relation/empty.rb
@@ -3,8 +3,10 @@ class Empty < Materialized
include Optimizable # for no-op #optimize
+ ZERO_TUPLE = [].freeze
+
def initialize(header)
- super(header, Set.new)
+ super(header, ZERO_TUPLE)
@predicate = Logic::Proposition::False.instance
end
| Use an Array to initialize an Empty relation
|
diff --git a/lib/24_seven_office/services/authentication.rb b/lib/24_seven_office/services/authentication.rb
index abc1234..def5678 100644
--- a/lib/24_seven_office/services/authentication.rb
+++ b/lib/24_seven_office/services/authentication.rb
@@ -4,6 +4,8 @@ extend Savon::Model
client wsdl: "https://webservices.24sevenoffice.com/authenticate/authenticate.asmx?wsdl"
+
+ global :convert_request_keys_to, :camelcase
operations :login
| Convert request keys to CamelCase |
diff --git a/concerning.gemspec b/concerning.gemspec
index abc1234..def5678 100644
--- a/concerning.gemspec
+++ b/concerning.gemspec
@@ -2,9 +2,9 @@ s.name = 'concerning'
s.version = '1.0.0'
s.author = 'Jeremy Kemper'
- s.email = 'jeremy@bitsweat.net'
- s.homepage = 'https://github.com/jeremy/concerning'
- s.summary = 'Bite-sized inline mixins'
+ s.email = 'jeremy@37signals.com'
+ s.homepage = 'https://github.com/37signals/concerning'
+ s.summary = 'Separating small concerns'
s.add_runtime_dependency 'activesupport', '>= 3.0.0'
s.add_development_dependency 'minitest'
| Update gemspec to reflect publishing as 37s |
diff --git a/lib/exlibris/aleph/api/client/patron/record/item.rb b/lib/exlibris/aleph/api/client/patron/record/item.rb
index abc1234..def5678 100644
--- a/lib/exlibris/aleph/api/client/patron/record/item.rb
+++ b/lib/exlibris/aleph/api/client/patron/record/item.rb
@@ -4,7 +4,7 @@ module Client
class Patron
class Record
- class Item< Base
+ class Item < Base
attr_reader :patron_id, :record_id, :id
def initialize(patron_id, record_id, id)
| Fix whitespace in Item API client
|
diff --git a/lib/salesforce_bulk/query_result_collection.rb b/lib/salesforce_bulk/query_result_collection.rb
index abc1234..def5678 100644
--- a/lib/salesforce_bulk/query_result_collection.rb
+++ b/lib/salesforce_bulk/query_result_collection.rb
@@ -2,39 +2,39 @@ class QueryResultCollection < Array
attr_reader :client
- attr_reader :batchId
- attr_reader :jobId
- attr_reader :totalSize
- attr_reader :resultId
- attr_reader :previousResultId
- attr_reader :nextResultId
+ attr_reader :batch_id
+ attr_reader :job_id
+ attr_reader :total_size
+ attr_reader :result_id
+ attr_reader :previous_result_id
+ attr_reader :next_result_id
- def initialize(client, jobId, batchId, totalSize=0, resultId=nil, previousResultId=nil, nextResultId=nil)
+ def initialize(client, job_id, batch_id, total_size=0, result_id=nil, previous_result_id=nil, next_result_id=nil)
@client = client
- @jobId = jobId
- @batchId = batchId
- @totalSize = totalSize
- @resultId = resultId
- @previousResultId = previousResultId
- @nextResultId = nextResultId
+ @job_id = job_id
+ @batch_id = batch_id
+ @total_size = total_size
+ @result_id = result_id
+ @previous_result_id = previous_result_id
+ @next_result_id = next_result_id
end
def next?
- @nextResultId.present?
+ @next_result_id.present?
end
def next
# if calls method on client to fetch data and returns new collection instance
- SalesforceBulk::QueryResultCollection.new(self.client, self.jobId, self.batchId)
+ SalesforceBulk::QueryResultCollection.new(self.client, self.job_id, self.batch_id)
end
def previous?
- @previousResultId.present?
+ @previous_result_id.present?
end
def previous
# if has previous, calls method on client to fetch data and returns new collection instance
- SalesforceBulk::QueryResultCollection.new(self.client, self.jobId, self.batchId)
+ SalesforceBulk::QueryResultCollection.new(self.client, self.job_id, self.batch_id)
end
end
| Update collection variable and method names to be underscore based and not camelCase. All tests passing.
|
diff --git a/lib/resque-statsd.rb b/lib/resque-statsd.rb
index abc1234..def5678 100644
--- a/lib/resque-statsd.rb
+++ b/lib/resque-statsd.rb
@@ -6,7 +6,7 @@
# Set up the client
$resque_statsd = Statsd.new(ENV['GRAPHITE_HOST'], 8125)
-$resque_statsd.namespace="#{ENV['APP_NAME']}_#{ENV['RAILS_ENV']}.resque"
+$resque_statsd.namespace="#{ENV['APP_NAME']}_#{ENV["STAGE"] || ENV['RAILS_ENV']}.resque"
module Resque
class << self
| Allow setting namespace with STAGE env variable
|
diff --git a/spec/controllers/exercises_controller_spec.rb b/spec/controllers/exercises_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/exercises_controller_spec.rb
+++ b/spec/controllers/exercises_controller_spec.rb
@@ -0,0 +1,32 @@+require 'spec_helper'
+
+describe ExercisesController, organization_workspace: :test do
+ let(:user) { create(:user) }
+
+ let(:problem) { create(:problem) }
+ let!(:exam) { create :exam, exercises: [problem], duration: 10, start_time: 1.hour.ago, end_time: 1.hour.since }
+
+ before { reindex_current_organization! }
+ before { set_current_user! user }
+
+
+ describe 'show' do
+ context 'when user is in the middle of an exam' do
+
+ let!(:exam_authorization) { create :exam_authorization, exam: exam, user: user, started: true, started_at: started_at }
+ before { get :show, params: { id: problem.id } }
+
+ context 'when user is not out of time yet' do
+ let(:started_at) { 5.minutes.ago }
+
+ it { expect(response.status).to eq 200 }
+ end
+
+ context 'when user is out of time' do
+ let(:started_at) { 20.minutes.ago }
+
+ it { expect(response.status).to eq 410 }
+ end
+ end
+ end
+end
| Add tests for expected behavior
|
diff --git a/app/controllers/api/repositories_controller.rb b/app/controllers/api/repositories_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/repositories_controller.rb
+++ b/app/controllers/api/repositories_controller.rb
@@ -11,7 +11,7 @@
def dependencies
repo_json = RepositorySerializer.new(@repository).as_json
- repo_json[:dependencies] = map_dependencies(@repository.repository_dependencies.includes(:projects) || [])
+ repo_json[:dependencies] = map_dependencies(@repository.repository_dependencies.includes(:project) || [])
render json: repo_json
end
| Use proper association name 'project'
|
diff --git a/spec/lib/tasks/taxonomy/health_checks_spec.rb b/spec/lib/tasks/taxonomy/health_checks_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/tasks/taxonomy/health_checks_spec.rb
+++ b/spec/lib/tasks/taxonomy/health_checks_spec.rb
@@ -1,20 +1,18 @@ require "rails_helper"
-require "gds_api/test_helpers/content_store"
RSpec.describe "taxonomy:health_checks" do
- include ::GdsApi::TestHelpers::ContentStore
- include PublishingApiHelper
- include ContentItemHelper
include RakeTaskHelper
include ActiveJob::TestHelper
it "queues the expected jobs" do
ActiveJob::Base.queue_adapter = :test
- expect {
- rake "taxonomy:health_checks"
- }.to change(TaxonomyHealth::MaximumDepthMetric.jobs, :size).by(1)
- .and change(TaxonomyHealth::ContentCountMetric.jobs, :size).by(1)
- .and change(TaxonomyHealth::ChildTaxonCountMetric.jobs, :size).by(1)
+ Sidekiq::Testing.fake! do
+ expect {
+ rake "taxonomy:health_checks"
+ }.to change(TaxonomyHealth::MaximumDepthMetric.jobs, :size).by(1)
+ .and change(TaxonomyHealth::ContentCountMetric.jobs, :size).by(1)
+ .and change(TaxonomyHealth::ChildTaxonCountMetric.jobs, :size).by(1)
+ end
end
end
| Fix sidekiq tests running inline
Occasionally (because of the random order of tests), other config which
sets Sidekiq to run inline leaks here. This causes the tests to fail because
the code is not run as a worker in test mode.
I've wrapped this test in a `fake!` block which ensures that this test
runs as we want and doesn't interfere with others.
|
diff --git a/lib/traject/queue.rb b/lib/traject/queue.rb
index abc1234..def5678 100644
--- a/lib/traject/queue.rb
+++ b/lib/traject/queue.rb
@@ -0,0 +1,62 @@+require 'thread'
+
+
+# Extend the normal queue class with some useful methods derived from
+# its java counterpart
+
+class Traject::Queue < Queue
+
+ alias_method :put, :enq
+ alias_method :take, :deq
+
+ def initialize(*args)
+ super
+ @mutex = Mutex.new
+ end
+
+
+ # Drain it to an array (or, really, anything that response to <<)
+ def drain_to(a)
+ @mutex.synchronize do
+ self.size.times do
+ a << self.pop
+ end
+ end
+ a
+ end
+
+
+ def to_a
+ a = []
+ @mutex.synchronize do
+ self.size.times do
+ elem = self.pop
+ a << elem
+ self.push elem
+ end
+ end
+ a
+ end
+ alias_method :to_array, :to_a
+
+
+
+
+ # Check out the first element. Hideously expensive
+ # because we have to drain it and then put it all
+ # back together to maintain order
+
+ def peek
+ first = nil
+ @mutex.synchronize do
+ first = self.pop
+ self.push(first)
+ (self.size - 1).times do
+ self.push self.pop
+ end
+ end
+ first
+ end
+
+
+end
| Extend Queue to provide drain_to
|
diff --git a/app/workers/run_worker.rb b/app/workers/run_worker.rb
index abc1234..def5678 100644
--- a/app/workers/run_worker.rb
+++ b/app/workers/run_worker.rb
@@ -15,6 +15,7 @@ if Morph::Runner.available_slots > 0 || runner.container_for_run
runner.synch_and_go!
else
+ # TODO: Don't throw this error if the container for this run already exists
raise NoRemainingSlotsError
end
end
| Add TODO about not always throwing NoRemainingSlotsError
|
diff --git a/db/migrate/20130107193641_create_membership.rb b/db/migrate/20130107193641_create_membership.rb
index abc1234..def5678 100644
--- a/db/migrate/20130107193641_create_membership.rb
+++ b/db/migrate/20130107193641_create_membership.rb
@@ -13,7 +13,8 @@
Account.all.each do |account|
puts account.id
- account.memberships.create(:role=>account.role, :organization_id => account.attributes['organization_id'], :default => true)
+ m = account.memberships.new(:role=>account.role, :organization_id => account.attributes['organization_id'], :default => true)
+ raise StandardError, "Unable to save membership for #{account.email}" unless m.save
end
end
| Throw an error if the data migration fails. |
diff --git a/bin/tic_tac_toe.ru b/bin/tic_tac_toe.ru
index abc1234..def5678 100644
--- a/bin/tic_tac_toe.ru
+++ b/bin/tic_tac_toe.ru
@@ -1,4 +1,10 @@ require 'tic_tac_toe'
+use Rack::Session::Cookie,
+ :key => 'tictactoe.game',
+ :domain => 'localhost',
+ :path => '/',
+ :expire_after => 1800,
+ :secret => 'my_super_secret_secret'
use Rack::Static, :urls => ["/css", "/images"], :root => "public"
run TicTacToe::RackShell.new_shell
| Add a cookie-based session middleware to the rackup config
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.