diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
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
@@ -4,6 +4,7 @@ has_many :user_votes
has_many :items, through: :user_votes
+ validates :email, presence: true
validates :first_name, presence: true
validates :last_name, presence: true
validates :password, length: { minimum: 8 }, unless: :allow_to_validate
|
Fix Missing Validation For Email
|
diff --git a/app/models/raid.rb b/app/models/raid.rb
index abc1234..def5678 100644
--- a/app/models/raid.rb
+++ b/app/models/raid.rb
@@ -7,8 +7,16 @@ validates :name, :presence => true
validates :date, :presence => true
validates :account, :presence => true
- validates :requiredLevel, :numericality => { :only_integer => true, :greater_than => 0 }
- validates :requiredItemLevel, :numericality => { :only_integer => true, :greater_than => 0 }
+ validates :requiredLevel, :numericality => {
+ :only_integer => true,
+ :greater_than => 0,
+ :allow_nil => true
+ }
+ validates :requiredItemLevel, :numericality => {
+ :only_integer => true,
+ :greater_than => 0,
+ :allow_nil => true
+ }
# By default only deal with raids that are in the future, or under 6 hours
# past start time.
|
Allow nil for required info
|
diff --git a/db/migrate/20130816172913_remove_not_null_constraint_from_references.rb b/db/migrate/20130816172913_remove_not_null_constraint_from_references.rb
index abc1234..def5678 100644
--- a/db/migrate/20130816172913_remove_not_null_constraint_from_references.rb
+++ b/db/migrate/20130816172913_remove_not_null_constraint_from_references.rb
@@ -0,0 +1,11 @@+class RemoveNotNullConstraintFromReferences < ActiveRecord::Migration
+ def up
+ change_column :references, :title, :text, :null => true
+ change_column :references, :citation, :text, :null => false
+ end
+
+ def down
+ change_column :references, :title, :text, :null => false
+ change_column :references, :citation, :text, :null => true
+ end
+end
|
Remove not null constraint from title and add it to citation
|
diff --git a/test/models/providers_test.rb b/test/models/providers_test.rb
index abc1234..def5678 100644
--- a/test/models/providers_test.rb
+++ b/test/models/providers_test.rb
@@ -0,0 +1,59 @@+require 'test_helper'
+
+class ProvidersTest < ActiveSupport::TestCase
+ test 'create instance with :atnd' do
+ assert_instance_of Providers::Atnd, Providers.new(:atnd)
+ end
+
+ test 'create instance with :connpass' do
+ assert_instance_of Providers::Connpass, Providers.new(:connpass)
+ end
+
+ test 'create instance with :door_keeper' do
+ assert_instance_of Providers::DoorKeeper, Providers.new(:door_keeper)
+ end
+
+ test 'create instance with :zusaar' do
+ assert_instance_of Providers::Zusaar, Providers.new(:zusaar)
+ end
+
+ test '.names valid values' do
+ assert_empty Providers.names - %w(atnd connpass door_keeper zusaar)
+ end
+
+ test '.enabled_names with `Configuration.provider`' do
+ assert_empty Providers.enabled_names - %w(connpass door_keeper zusaar)
+ end
+
+ test '.enabled_names with `.names`' do
+ raise if Configuration.respond_to?(:providers?)
+ Configuration.define_singleton_method :providers? do
+ false
+ end
+ assert_empty Providers.enabled_names - %w(atnd connpass door_keeper zusaar)
+ (class << Configuration; self; end).send(:remove_method, :providers?)
+ end
+
+ test '.[] with valid name' do
+ assert_equal Providers[:connpass], Providers::Connpass
+ assert_equal Providers[:door_keeper], Providers::DoorKeeper
+ assert_equal Providers[:zusaar], Providers::Zusaar
+ end
+
+ test '.[] with invalid name' do
+ e1 = assert_raise NameError do
+ Providers[:base]
+ end
+ assert_equal e1.message, "Disabled provider 'base'"
+ e2 = assert_raise NameError do
+ Providers[:atnd]
+ end
+ assert_equal e2.message, "Disabled provider 'atnd'"
+ end
+
+ test '.instances' do
+ Providers.stub(:enabled_names, %w(connpass zusaar)) do
+ assert_empty Providers.instances.map{|instance| instance.class } - [Providers::Connpass, Providers::Zusaar]
+ end
+ end
+end
|
Create test for `Providers` module
|
diff --git a/mobit.gemspec b/mobit.gemspec
index abc1234..def5678 100644
--- a/mobit.gemspec
+++ b/mobit.gemspec
@@ -14,7 +14,9 @@ spec.homepage = 'https://github.com/rubybeast/mobit'
spec.license = 'MIT'
- spec.files = `git ls-files -z`.split("\x0")
+ spec.files = %w(README.md Rakefile LICENSE.txt)
+ spec.files += Dir['lib/**/*.rb']
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']
|
Clear files included in this gem
|
diff --git a/VENAppSwitchSDK.podspec b/VENAppSwitchSDK.podspec
index abc1234..def5678 100644
--- a/VENAppSwitchSDK.podspec
+++ b/VENAppSwitchSDK.podspec
@@ -9,8 +9,10 @@ s.homepage = "https://github.com/venmo/VENAppSwitchSDK"
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { "Venmo" => "developers@venmo.com" }
- s.platform = :ios, '5.0'
+ s.platform = :ios, '6.0'
s.source = { :git => "https://github.com/venmo/VENAppSwitchSDK.git", :tag => "v#{s.version}" }
s.source_files = 'VENAppSwitchSDK/**/*.{h,m}'
s.requires_arc = true
+ s.social_media_url = 'https://twitter.com/venmo'
+ s.screenshot = "http://i.imgur.com/tN7mYVy.gif"
end
|
Edit podfile to bump to iOS 6, add social media URL, and add screenshot.
|
diff --git a/test/test_dtrace_multi_provider.rb b/test/test_dtrace_multi_provider.rb
index abc1234..def5678 100644
--- a/test/test_dtrace_multi_provider.rb
+++ b/test/test_dtrace_multi_provider.rb
@@ -0,0 +1,89 @@+#
+# Ruby-Dtrace
+# (c) 2008 Chris Andrews <chris@nodnol.org>
+#
+
+require 'dtrace'
+require 'dtrace/provider'
+require 'test/unit'
+
+class TestDtraceMultiProvider < Test::Unit::TestCase
+
+ def test_multiple_providers_and_list
+ Dtrace::Provider.create :multi1 do |p|
+ p.probe :test1, :integer, :integer
+ p.probe :test2, :integer, :integer
+ end
+
+ Dtrace::Provider.create :multi2 do |p|
+ p.probe :test1, :integer, :integer
+ p.probe :test2, :integer, :integer
+ end
+
+ matches = Hash.new
+ matches[:multi1] = 0
+ matches[:multi2] = 0
+
+ t = Dtrace.new
+ t.each_probe do |p|
+ if p.to_s =~ /^multi1#{$$}:ruby:/
+ matches[:multi1] += 1
+ end
+ if p.to_s =~ /^multi2#{$$}:ruby:/
+ matches[:multi2] += 1
+ end
+ end
+ assert_equal 2, matches[:multi1]
+ assert_equal 2, matches[:multi2]
+ end
+
+ def test_multiple_providers_and_fire
+ Dtrace::Provider.create :multi3 do |p|
+ p.probe :test3, :integer, :integer
+ end
+
+ Dtrace::Provider.create :multi4 do |p|
+ p.probe :test4, :integer, :integer
+ end
+
+ progtext = <<EOD
+multi3*:ruby::test3
+{
+ trace("fired 1");
+}
+
+multi4*:ruby::test4
+{
+ trace("fired 2");
+}
+EOD
+
+ t = Dtrace.new
+ t.setopt("bufsize", "4m")
+ prog = t.compile progtext
+ prog.execute
+ t.go
+ c = Dtrace::Consumer.new(t)
+
+ Dtrace::Probe::Multi3.test3 do |p|
+ p.fire(3,4)
+ end
+
+ Dtrace::Probe::Multi4.test4 do |p|
+ p.fire(4,4)
+ end
+
+ data = []
+ c.consume_once do |d|
+ data << d
+ end
+
+ p data
+
+ assert_equal 2, data.length
+ assert_equal 'fired 1', data[0].data[0].value
+ assert_equal 'fired 2', data[1].data[0].value
+ end
+
+end
+
|
Fix multiple-providers bug - class variables defining probes weren't being
stored in the correct class...
|
diff --git a/muzak.gemspec b/muzak.gemspec
index abc1234..def5678 100644
--- a/muzak.gemspec
+++ b/muzak.gemspec
@@ -13,4 +13,5 @@ s.homepage = "https://github.com/muzak-project/muzak"
s.license = "MIT"
s.add_runtime_dependency "taglib-ruby", "~> 0.7"
+ s.add_runtime_dependency "mpv", "~> 1.1.0"
end
|
gemspec: Add mpv as a runtime dependency.
|
diff --git a/test/markup_renderer_spec.rb b/test/markup_renderer_spec.rb
index abc1234..def5678 100644
--- a/test/markup_renderer_spec.rb
+++ b/test/markup_renderer_spec.rb
@@ -32,4 +32,12 @@ </code></pre>
END_OUTPUT
end
+
+ it "renders quote marks properly" do
+ subject.render(<<END_SOURCE).should == <<END_OUTPUT
+This "very" sentence's structure "isn't" necessary.
+END_SOURCE
+<p>This “very” sentence's structure “isn't” necessary.</p>
+END_OUTPUT
+ end
end
|
Add a test covering MarkupRenderer's smartyness.
|
diff --git a/tasks/asset_trip.rake b/tasks/asset_trip.rake
index abc1234..def5678 100644
--- a/tasks/asset_trip.rake
+++ b/tasks/asset_trip.rake
@@ -3,4 +3,9 @@ task :bundle => :environment do
AssetTrip.bundle!
end
+
+ desc "Prune assets"
+ task :prune => :environment do
+ AssetTrip.prune!
+ end
end
|
Add rake task for pruning assets not in the current Manifest
|
diff --git a/tasks/metrics/ci.rake b/tasks/metrics/ci.rake
index abc1234..def5678 100644
--- a/tasks/metrics/ci.rake
+++ b/tasks/metrics/ci.rake
@@ -1,7 +1,7 @@ desc 'Run metrics with Heckle'
-task :ci => [ 'ci:metrics', :heckle ]
+task :ci => %w[ ci:metrics heckle ]
namespace :ci do
desc 'Run metrics'
- task :metrics => [ :verify_measurements, :flog, :flay, :reek, :roodi, 'metrics:all' ]
+ task :metrics => %w[ verify_measurements flog flay reek roodi metrics:all ]
end
|
Change to use a quoted array for the task list
|
diff --git a/config/software/openstack-project.rb b/config/software/openstack-project.rb
index abc1234..def5678 100644
--- a/config/software/openstack-project.rb
+++ b/config/software/openstack-project.rb
@@ -32,4 +32,5 @@ "#{install_dir}/#{name}",
"--system-site-packages"].join(" "), :env => env
command "#{install_dir}/#{name}/bin/python setup.py install", :env => env
+ command "if [ -d ./etc ]; then cp -R ./etc #{install_dir}/#{name}/etc; fi"
end
|
Add configuration to the omnibus builds
Some of the configurations files that may be needed by the OpenStack
services are not always available from the various config management
solutions, therefore, pull in any configs from the repo itself.
|
diff --git a/config/initializers/alchemy.rb b/config/initializers/alchemy.rb
index abc1234..def5678 100644
--- a/config/initializers/alchemy.rb
+++ b/config/initializers/alchemy.rb
@@ -6,6 +6,7 @@ action: 'index',
name: 'Store',
image: 'alchemy/solidus/alchemy_module_icon.png',
+ data: { turbolinks: false },
sub_navigation: [
{
controller: 'spree/admin/orders',
|
Add data-turbolinks='false' to Solidus Subnav
This adds a `data` key specifying that the Solidus submenu should not
be using Turbolinks. It's harmless with Alchemy versions that don't
support it, and beneficial for ones that do.
|
diff --git a/recipes/agent_windows_install.rb b/recipes/agent_windows_install.rb
index abc1234..def5678 100644
--- a/recipes/agent_windows_install.rb
+++ b/recipes/agent_windows_install.rb
@@ -13,7 +13,7 @@ end
opts = []
-opts << "/SERVERURL=#{autoregister_values[:go_server_url]}"
+opts << "/SERVERURL='#{autoregister_values[:go_server_url]}'"
opts << "/S"
opts << '/D=C:\GoAgent'
|
Fix GO_SERVER_URL not being set correctly on windows.
|
diff --git a/spec/acceptance/relations_on_lists_spec.rb b/spec/acceptance/relations_on_lists_spec.rb
index abc1234..def5678 100644
--- a/spec/acceptance/relations_on_lists_spec.rb
+++ b/spec/acceptance/relations_on_lists_spec.rb
@@ -0,0 +1,22 @@+require 'kanren/list'
+require 'kanren/micro/goal'
+require 'kanren/micro/state'
+
+module Kanren
+ module Micro
+ RSpec.describe 'relations on lists' do
+ describe 'equality' do
+ it 'allows two lists to be unified' do
+ goal = Goal.with_variables { |x, y, z| Goal.equal(List.from_array([x, 2, z]), List.from_array([1, y, 3])) }
+ states = goal.pursue_in(State.new)
+
+ state = states.next
+ x, y, z = state.variables
+ expect(state.values).to eq x => 1, y => 2, z => 3
+
+ expect { states.next }.to raise_error StopIteration
+ end
+ end
+ end
+ end
+end
|
Add example of list equality
|
diff --git a/spec/rspec/rails/matchers/be_valid_spec.rb b/spec/rspec/rails/matchers/be_valid_spec.rb
index abc1234..def5678 100644
--- a/spec/rspec/rails/matchers/be_valid_spec.rb
+++ b/spec/rspec/rails/matchers/be_valid_spec.rb
@@ -16,11 +16,13 @@ subject.something = "something"
subject.should be_valid
+ expect(subject).to be_valid
end
it "fails the matcher when not valid" do
subject.something = nil
subject.should_not be_valid
+ expect(subject).to_not be_valid
end
end
|
Add newfangled syntax to be_valid matcher
|
diff --git a/test/scripts/run_keyed_sale.rb b/test/scripts/run_keyed_sale.rb
index abc1234..def5678 100644
--- a/test/scripts/run_keyed_sale.rb
+++ b/test/scripts/run_keyed_sale.rb
@@ -0,0 +1,37 @@+$:<< "./lib" # uncomment this to run against a Git clone instead of an installed gem
+
+require "paytrace"
+require "paytrace/debug"
+
+# see: http://help.paytrace.com/api-processing-a-check-sale
+
+# change this as needed to reflect the username, password, and test host you're testing against
+PayTrace::Debug.configure_test("demo123", "demo123", "stage.paytrace.com")
+
+
+transaction_id = nil
+
+# Debug.trace monitors requests and responses and prints some diagnostic info. You can omit this if you don't need it.
+PayTrace::Debug.trace do
+ params = {
+ # a "sandbox" credit card number
+ card_number: 4111111111111111,
+ amount: 15.99,
+ expiration_month: 10,
+ expiration_year: 24
+ }
+
+ # a keyed sale is as simple as this
+ response = PayTrace::Transaction::keyed_sale(params)
+
+ transaction_id = response.values["TRANSACTIONID"]
+end
+
+PayTrace::Debug.trace do
+ params = {
+ transaction_id: transaction_id
+ }
+
+ # and now we refund that same transaction
+ response = PayTrace::Transaction::void(params)
+end
|
Check in a simple script showing how to process a sale, and void it.
|
diff --git a/recipes/_defaults.rb b/recipes/_defaults.rb
index abc1234..def5678 100644
--- a/recipes/_defaults.rb
+++ b/recipes/_defaults.rb
@@ -4,10 +4,12 @@ #
unless broker_attribute?(:broker, :id)
+ Chef::Log.warn('Default value for `broker.id` is deprecated and will be removed in the next major version')
node.default['kafka']['broker']['broker_id'] = node['ipaddress'].delete('.').to_i % 2**31
end
unless broker_attribute?(:port)
+ Chef::Log.warn('Default value for `port` is deprecated and will be removed in the next major version')
node.default['kafka']['broker']['port'] = 6667
end
|
Add deprecation warning for default broker config.
|
diff --git a/clearwater.gemspec b/clearwater.gemspec
index abc1234..def5678 100644
--- a/clearwater.gemspec
+++ b/clearwater.gemspec
@@ -18,8 +18,8 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
- spec.add_dependency 'opal', '~> 0.7.0.beta1'
- spec.add_dependency 'opal-jquery', '~> 0.3.0.beta1'
+ spec.add_dependency 'opal', '~> 0.7.0'
+ spec.add_dependency 'opal-jquery', '~> 0.3.0'
spec.add_development_dependency "bundler", "~> 1.7"
spec.add_development_dependency "rake", "~> 10.0"
|
Use release versions of opal and opal-jquery
|
diff --git a/test/compatibility/ancestry_test.rb b/test/compatibility/ancestry_test.rb
index abc1234..def5678 100644
--- a/test/compatibility/ancestry_test.rb
+++ b/test/compatibility/ancestry_test.rb
@@ -5,7 +5,7 @@ ActiveRecord::Migration.create_table("things") do |t|
t.string :name
t.string :slug
- t.integer :ancestry
+ t.string :ancestry
end
ActiveRecord::Migration.add_index :things, :ancestry
@@ -21,17 +21,14 @@ end
class AncestryTest < MiniTest::Unit::TestCase
-
include FriendlyId::Test
test "should sequence slugs when scoped by ancestry" do
- thing1 = Thing.create! :name => "a"
- thing2 = Thing.create! :name => "b", :parent => thing1
- thing3 = Thing.create! :name => "b", :parent => thing2
-
- assert_equal "a", thing1.slug
- assert_equal "a--2", thing2.slug
- assert_equal "a--3", thing3.slug
+ 3.times.inject([]) do |memo, _|
+ memo << Thing.create!(:name => "a", :parent => memo.last)
+ end.each do |thing|
+ assert_equal "a", thing.friendly_id
+ end
end
end
|
Fix column type and assert conditions
|
diff --git a/Requirements/php-meta-requirement.rb b/Requirements/php-meta-requirement.rb
index abc1234..def5678 100644
--- a/Requirements/php-meta-requirement.rb
+++ b/Requirements/php-meta-requirement.rb
@@ -1,7 +1,11 @@ require File.join(File.dirname(__FILE__), 'homebrew-php-requirement')
class PhpMetaRequirement < HomebrewPhpRequirement
- default_formula "php56"
+ default_formula "php53" if Formula["php53"].linked_keg.exist?
+ default_formula "php54" if Formula["php54"].linked_keg.exist?
+ default_formula "php55" if Formula["php55"].linked_keg.exist?
+ default_formula "php56" if Formula["php56"].linked_keg.exist?
+ default_formula "php70" if Formula["php70"].linked_keg.exist?
def satisfied?
%w{php53 php54 php55 php56 php70}.any? do |php|
|
Fix php meta requirement to allow for non php56 installs
|
diff --git a/app/controllers/effective/datatables_controller.rb b/app/controllers/effective/datatables_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/effective/datatables_controller.rb
+++ b/app/controllers/effective/datatables_controller.rb
@@ -40,6 +40,8 @@ :data => [],
:recordsTotal => 0,
:recordsFiltered => 0,
+ :aggregates => [],
+ :charts => {}
}.to_json
end
|
Include empty aggregates and charts in error json
|
diff --git a/app/controllers/api/search_controller.rb b/app/controllers/api/search_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/search_controller.rb
+++ b/app/controllers/api/search_controller.rb
@@ -12,6 +12,6 @@ private
def search_query_params
- params.require(:query).permit(:keywords)
+ params.require(:filter).permit(:keywords)
end
end
|
Fix query parameter according to JSON API
|
diff --git a/app/controllers/spree/base_controller.rb b/app/controllers/spree/base_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/spree/base_controller.rb
+++ b/app/controllers/spree/base_controller.rb
@@ -1,7 +1,6 @@ # frozen_string_literal: true
require 'cancan'
-require_dependency 'spree/core/controller_helpers/strong_parameters'
module Spree
class BaseController < ApplicationController
@@ -9,9 +8,6 @@ include Spree::Core::ControllerHelpers::RespondWith
include Spree::Core::ControllerHelpers::SSL
include Spree::Core::ControllerHelpers::Common
- include Spree::Core::ControllerHelpers::Search
- include Spree::Core::ControllerHelpers::StrongParameters
- include Spree::Core::ControllerHelpers::Search
respond_to :html
end
|
Remove strong parameters and search helpers, they are not used in OFN
|
diff --git a/app/jobs/rails_zero/generate_site_job.rb b/app/jobs/rails_zero/generate_site_job.rb
index abc1234..def5678 100644
--- a/app/jobs/rails_zero/generate_site_job.rb
+++ b/app/jobs/rails_zero/generate_site_job.rb
@@ -2,8 +2,9 @@ class GenerateSiteJob
def run
RailsZero.pages_config.links.each do |path|
- Capybara.visit path
+ ::Capybara.visit path
end
+ ::Capybara.reset_sessions!
end
end
end
|
Fix capybara in generate site job.
|
diff --git a/app/models/notify_user/apn_connection.rb b/app/models/notify_user/apn_connection.rb
index abc1234..def5678 100644
--- a/app/models/notify_user/apn_connection.rb
+++ b/app/models/notify_user/apn_connection.rb
@@ -1,45 +1,41 @@-class APNConnection
+module NotifyUser
+ class APNConnection
- def initialize
- setup
- end
+ attr_accessor :connection
- def setup
- @uri, @certificate = if Rails.env.production? || apn_environment == :production
- [
- Houston::APPLE_PRODUCTION_GATEWAY_URI,
- File.read("#{Rails.root}/config/keys/production_push.pem")
- ]
- else
- [
- Houston::APPLE_DEVELOPMENT_GATEWAY_URI,
- File.read("#{Rails.root}/config/keys/development_push.pem")
- ]
+ def initialize
+ setup
end
- @connection = Houston::Connection.new(@uri, @certificate, nil)
- @connection.open
+ def setup
+ @uri, @certificate = if Rails.env.production? || apn_environment == :production
+ [
+ ::Houston::APPLE_PRODUCTION_GATEWAY_URI,
+ File.read("#{Rails.root}/config/keys/production_push.pem")
+ ]
+ else
+ [
+ ::Houston::APPLE_DEVELOPMENT_GATEWAY_URI,
+ File.read("#{Rails.root}/config/keys/development_push.pem")
+ ]
+ end
+
+ @connection = ::Houston::Connection.new(@uri, @certificate, nil)
+ @connection.open
+ end
+
+ def write(data)
+ raise "Connection is closed" unless @connection.open?
+ @connection.write(data)
+ end
+
+ private
+
+ def apn_environment
+ return nil unless ENV['APN_ENVIRONMENT']
+
+ ENV['APN_ENVIRONMENT'].downcase.to_sym
+ end
+
end
-
- def ssl
- @connection.ssl
- end
-
- def connection
- @connection
- end
-
- def write(data)
- raise "Connection is closed" unless @connection.open?
- @connection.write(data)
- end
-
- private
-
- def apn_environment
- return nil unless ENV['APN_ENVIRONMENT']
-
- ENV['APN_ENVIRONMENT'].downcase.to_sym
- end
-
end
|
Put the `APNConnection` class under the `NotifyUser` module.
|
diff --git a/app/serializers/herd/asset_serializer.rb b/app/serializers/herd/asset_serializer.rb
index abc1234..def5678 100644
--- a/app/serializers/herd/asset_serializer.rb
+++ b/app/serializers/herd/asset_serializer.rb
@@ -1,7 +1,7 @@ module Herd
class AssetSerializer < ActiveModel::Serializer
attributes :id
- attributes :created_at, :updated_at, :file_name, :file_size, :content_type, :type
+ attributes :created_at, :updated_at, :file_name, :file_size, :content_type, :type, :asset_class
attributes :width, :height
attributes :url
attributes :position
@@ -14,6 +14,10 @@ has_one :transform, embed: :ids, include: true, serializer: TransformSerializer
attributes :transform_name
+
+ def asset_class
+ object.class.name.demodulize.downcase
+ end
def transform_name
object.try(:transform).try(:name)
|
Add Asset Class to Serializer
|
diff --git a/app/controllers/users/invitations_controller.rb b/app/controllers/users/invitations_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/users/invitations_controller.rb
+++ b/app/controllers/users/invitations_controller.rb
@@ -1,5 +1,6 @@ class Users::InvitationsController < Devise::InvitationsController
include Controllers::EnsureProject
+ layout 'dashboard'
before_action :authenticate_user!
before_action :ensure_project_exists!, except: [:edit, :update]
|
Add sidebar to invitations controller
|
diff --git a/spec/github_authorized_keys_spec.rb b/spec/github_authorized_keys_spec.rb
index abc1234..def5678 100644
--- a/spec/github_authorized_keys_spec.rb
+++ b/spec/github_authorized_keys_spec.rb
@@ -0,0 +1,8 @@+require 'spec_helper'
+
+describe GithubAuthorizedKeys do
+ it "complains if the configuration file does not exist"
+ it "will spit out the original authorized_keys file on error"
+ it "sends a proper request to GitHub"
+ it "generates a proper authorized_keys file"
+end
|
Add in some specs, not implemented
|
diff --git a/config/cronotab.rb b/config/cronotab.rb
index abc1234..def5678 100644
--- a/config/cronotab.rb
+++ b/config/cronotab.rb
@@ -18,4 +18,4 @@ SkyHopper::Application.load_tasks
Crono.perform(Operation_worker).every 30.seconds
-Crono.perform(ServerStateWorker).every 30.seconds
+Crono.perform(ServerStateWorker).every 5.minutes
|
Set ServerStateWorker's interval to 5 mins
|
diff --git a/controller/init.rb b/controller/init.rb
index abc1234..def5678 100644
--- a/controller/init.rb
+++ b/controller/init.rb
@@ -25,8 +25,12 @@ end
realpath = File.realpath('./')
- layout_file = action.layout.to_a[1].to_s.gsub(realpath + '/themes/default/layouts/', '')
- action.view = realpath + "/themes/#{@settings[:theme]}/" + action.view.gsub(realpath + '/themes/default/', '')
+ if File.exists?(action.layout.to_a[1].to_s.gsub(realpath + '/themes/default/layouts/', ''))
+ layout_file = action.layout.to_a[1].to_s.gsub(realpath + '/themes/default/layouts/', '')
+ end
+ if File.exists?(realpath + "/themes/#{@settings[:theme]}/" + action.view.gsub(realpath + '/themes/default/', ''))
+ action.view = realpath + "/themes/#{@settings[:theme]}/" + action.view.gsub(realpath + '/themes/default/', '')
+ end
end
end
|
Make sure the layout and view file exists before setting it, allows themes to inherit from the default theme.
|
diff --git a/lib/content_dump_loader.rb b/lib/content_dump_loader.rb
index abc1234..def5678 100644
--- a/lib/content_dump_loader.rb
+++ b/lib/content_dump_loader.rb
@@ -1,3 +1,6 @@+require "csv"
+require "zlib"
+
module ContentDumpLoader
ContentItem = Struct.new(:base_path,
:content_id,
|
Add explicit requires for csv and zlib
For some reason these were not being automatically required on
integration.
|
diff --git a/cloudbit_client.gemspec b/cloudbit_client.gemspec
index abc1234..def5678 100644
--- a/cloudbit_client.gemspec
+++ b/cloudbit_client.gemspec
@@ -18,7 +18,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
- spec.add_runtime_dependency 'rest_client'
+ spec.add_runtime_dependency 'rest_client', '~> 1.8'
spec.add_development_dependency "bundler", "~> 1.5"
spec.add_development_dependency "rake"
|
Fix rest_client dependency in gemspec.
|
diff --git a/spec/em-rtmp/connect_request_spec.rb b/spec/em-rtmp/connect_request_spec.rb
index abc1234..def5678 100644
--- a/spec/em-rtmp/connect_request_spec.rb
+++ b/spec/em-rtmp/connect_request_spec.rb
@@ -15,12 +15,6 @@ request.parameters[:app].should eql "some_app"
end
- it 'should use the parameters as the value of the message' do
- request.stub(:send_chunk).and_return(0)
- request.send
- request.message.values.should eql [request.parameters]
- end
-
it 'should use the encoded message as the body' do
request.stub(:send_chunk).and_return(0)
request.send
|
Remove broken spec from adding overhead headers
|
diff --git a/spec/models/property_element_spec.rb b/spec/models/property_element_spec.rb
index abc1234..def5678 100644
--- a/spec/models/property_element_spec.rb
+++ b/spec/models/property_element_spec.rb
@@ -18,7 +18,7 @@ describe 'callbacks' do
it 'sets is_active as true' do
- image = File.new(Rails.root + 'public/system/property_elements/images/000/000/009/original/bedroom_1.jpeg')
+ image = File.new(Rails.root + 'public/bedroom_1.jpeg')
element = PropertyElement.new({ name: 'Alcoba', description: 'Alcoba principal', image: image})
element.save
expect(PropertyElement.last.is_active).to be_truthy
|
Move image file to public folder.
|
diff --git a/lib/spanx/notifier/base.rb b/lib/spanx/notifier/base.rb
index abc1234..def5678 100644
--- a/lib/spanx/notifier/base.rb
+++ b/lib/spanx/notifier/base.rb
@@ -10,18 +10,19 @@
protected
- def generate_block_ip_message(blocked_ip)
- violated_period = blocked_ip.period_check
- "#{blocked_ip.identifier} blocked @ #{Time.at(blocked_ip.timestamp)} " \
- "for #{violated_period.block_ttl/60}mins, for #{blocked_ip.sum} requests over " \
- "#{violated_period.period_seconds/60}mins, with #{violated_period.max_allowed} allowed. " \
- "Host: #{host(blocked_ip.identifier)}"
- end
+ def generate_block_ip_message(blocked_ip)
+ violated_period = blocked_ip.period_check
+ "#{blocked_ip.identifier} blocked @ #{Time.at(blocked_ip.timestamp)} " \
+ "for #{violated_period.block_ttl/60}mins, for #{blocked_ip.sum} requests over " \
+ "#{violated_period.period_seconds/60}mins, with #{violated_period.max_allowed} allowed. " \
+ "Host: #{host(blocked_ip.identifier)}"
+ end
- def host(ip)
- `host #{ip}`
- end
-
+ def host(ip)
+ %x(host #{ip})
+ rescue Errno::ENOENT
+ 'Could not find host command. Make sure it is included in your PATH.'
+ end
end
end
end
|
Return error message when `host` command is not found in PATH
|
diff --git a/lib/testjour/http_queue.rb b/lib/testjour/http_queue.rb
index abc1234..def5678 100644
--- a/lib/testjour/http_queue.rb
+++ b/lib/testjour/http_queue.rb
@@ -11,7 +11,7 @@ end
def self.redis
- @redis ||= Redis.new
+ @redis ||= Redis.new(:db => 11)
end
def redis
|
Use a different Redis DB so it's not affected by our hook to flush all our keys
|
diff --git a/cookbooks/cumulus/test/integration/default/serverspec/license_spec.rb b/cookbooks/cumulus/test/integration/default/serverspec/license_spec.rb
index abc1234..def5678 100644
--- a/cookbooks/cumulus/test/integration/default/serverspec/license_spec.rb
+++ b/cookbooks/cumulus/test/integration/default/serverspec/license_spec.rb
@@ -6,5 +6,5 @@ describe file('/etc/cumulus/.license.txt') do
it { should be_file }
its(:content) { should match(/Rocket Turtle!/) }
- its(:content) { should match(%r{/usr/cumulus/bin/cl-license -i http://localhost/test.lic}) }
+ its(:content) { should match(%r{/usr/cumulus/bin/cl-license -i file:///tmp/test.v1}) }
end
|
Update test to reflect setup changes
Fix the test to reflect the changes made to the test setup cookbook
|
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/search_controller.rb
+++ b/app/controllers/search_controller.rb
@@ -1,14 +1,21 @@ class SearchController < ApplicationController
+ TYPE_ORDER = %w[
+ issue
+ topic
+ representative
+ parliament_issue
+ proposition
+ promise
+ ]
+
def all
response = Hdo::Search::Searcher.new(params[:query]).all
@results = []
if response.success?
- @results = response.results.group_by { |e| e.type }
-
- respond_to do |format|
- format.html
- end
+ @results = response.results.
+ group_by { |e| e.type }.
+ sort_by { |t, _| TYPE_ORDER.index(t) || 10 }
else
flash.alert = t('app.errors.search')
end
|
Fix order of result groups.
|
diff --git a/app/models/restaurant/ernst_young.rb b/app/models/restaurant/ernst_young.rb
index abc1234..def5678 100644
--- a/app/models/restaurant/ernst_young.rb
+++ b/app/models/restaurant/ernst_young.rb
@@ -0,0 +1,13 @@+# frozen_string_literal: true
+
+require 'open-uri'
+
+module Restaurant
+ class ErnstYoung < BaseRestaurant
+ def get_contents(_date)
+ url = 'https://zfv.ch/de/microsites/ey-restaurant-platform/menuplan'
+
+ url
+ end
+ end
+end
|
Add Ernst & Young restaurant
|
diff --git a/app/models/spree/gateway/usa_epay.rb b/app/models/spree/gateway/usa_epay.rb
index abc1234..def5678 100644
--- a/app/models/spree/gateway/usa_epay.rb
+++ b/app/models/spree/gateway/usa_epay.rb
@@ -3,8 +3,6 @@ preference :source_key, :string
preference :pin, :string
- attr_accessible :preferred_source_key, :preferred_pin, :gateway_payment_profile_id
-
def provider_class
SpreeUsaEpay::Client
end
|
Update for Rails 4 compatibility
|
diff --git a/customerio.gemspec b/customerio.gemspec
index abc1234..def5678 100644
--- a/customerio.gemspec
+++ b/customerio.gemspec
@@ -20,7 +20,7 @@
gem.add_development_dependency('rake', '~> 10.5')
gem.add_development_dependency('rspec', '3.3.0')
- gem.add_development_dependency('webmock', '1.24.2')
+ gem.add_development_dependency('webmock', '3.6.0')
gem.add_development_dependency('addressable', '~> 2.3.6')
gem.add_development_dependency('json')
end
|
Upgrade webmock and switch cache again, this time to gemspec
|
diff --git a/spec/integration/edge_gateway/configure_edge_gateway_services_spec.rb b/spec/integration/edge_gateway/configure_edge_gateway_services_spec.rb
index abc1234..def5678 100644
--- a/spec/integration/edge_gateway/configure_edge_gateway_services_spec.rb
+++ b/spec/integration/edge_gateway/configure_edge_gateway_services_spec.rb
@@ -17,7 +17,7 @@ end
Kernel.exit(2) if error
- it "configure firewall service" do
+ it "configures a firewall service" do
configuration = {
:FirewallService =>
{
|
Improve grammar in test description
|
diff --git a/test/spec/net/authorization_spec.rb b/test/spec/net/authorization_spec.rb
index abc1234..def5678 100644
--- a/test/spec/net/authorization_spec.rb
+++ b/test/spec/net/authorization_spec.rb
@@ -1,7 +1,7 @@ describe Net::Authorization do
context "Invalid params" do
it "expects valid token or basic params" do
- Proc.new { Net::Authorization.new }.should.raise RuntimeError
+ Proc.new { Net::Authorization.new }.should.raise? RuntimeError
end
end
|
Fix Authorization specs in Android.
|
diff --git a/eway_rapid.gemspec b/eway_rapid.gemspec
index abc1234..def5678 100644
--- a/eway_rapid.gemspec
+++ b/eway_rapid.gemspec
@@ -19,8 +19,8 @@ spec.add_dependency 'json', '~> 2.1.0'
spec.add_dependency 'rest-client', '~> 2.0'
- spec.add_development_dependency 'bundler', '~> 1.17'
- spec.add_development_dependency 'rake', '~> 12.0'
+ spec.add_development_dependency 'bundler' #, '~> 1.17'
+ spec.add_development_dependency 'rake' #, '~> 12.0'
spec.add_development_dependency 'test-unit'
spec.add_development_dependency 'simplecov'
spec.add_development_dependency 'rubocop'
|
Test removing dev dependency versions
|
diff --git a/examples/config.ru b/examples/config.ru
index abc1234..def5678 100644
--- a/examples/config.ru
+++ b/examples/config.ru
@@ -22,14 +22,31 @@ get '/auth/failure' do
MultiJson.encode(request.env)
end
+
+ get '/refresh_token' do
+ client_id = ENV['CONSUMER_KEY']
+ client_secret = ENV['CONSUMER_SECRET']
+ oauth2_urls = {
+ site: 'http://localhost:3000/api/2',
+ token_url: 'http://localhost:3000/oauth2/token',
+ authorize_url: 'http://localhost:3000/oauth2/authorize'
+ }
+
+ @oauth2_client = OAuth2::Client.new(client_id, client_secret, oauth2_urls)
+ @access_token = OAuth2::AccessToken.new(@oauth2_client, params[:access_token])
+ refresh_access_token_obj = OAuth2::AccessToken.new(@oauth2_client, @access_token.token, {'refresh_token' => params[:refresh_token]})
+ @access_token = refresh_access_token_obj.refresh!
+
+ @access_token.inspect
+ end
end
use Rack::Session::Cookie, :secret => 'secret identity'
use OmniAuth::Builder do
- provider :redbooth, ENV['CONSUMER_KEY'], ENV['CONSUMER_KEY'],
+ provider :redbooth, ENV['CONSUMER_KEY'], ENV['CONSUMER_SECRET'],
client_options: {
- site: 'http://localhost:3000/api/3/',
+ site: 'http://localhost:3000/api/2',
token_url: 'http://localhost:3000/oauth2/token',
authorize_url: 'http://localhost:3000/oauth2/authorize'
}
|
Add refresh token url to example
|
diff --git a/config/initializers/connection_fix.rb b/config/initializers/connection_fix.rb
index abc1234..def5678 100644
--- a/config/initializers/connection_fix.rb
+++ b/config/initializers/connection_fix.rb
@@ -20,7 +20,7 @@ execute_without_retry(*args)
rescue ActiveRecord::StatementInvalid => e
if e.message =~ /server has gone away/i
- warn "Server timed out, retrying"
+ warn "Lost connection to MySQL server during query"
reconnect!
retry
else
|
Update warn message for MySQL fix
|
diff --git a/config/initializers/login_settings.rb b/config/initializers/login_settings.rb
index abc1234..def5678 100644
--- a/config/initializers/login_settings.rb
+++ b/config/initializers/login_settings.rb
@@ -27,7 +27,7 @@
def to_lock_json(callback_url, options={})
lock_json
- .merge(callbackURL: callback_url, authParams: {scope: 'openid profile'})
+ .merge(callbackURL: callback_url, responseType: 'code', authParams: {scope: 'openid profile'})
.merge(options)
.to_json
.html_safe
@@ -38,7 +38,6 @@ connections: lock_login_methods,
icon: '/logo-alt.png',
socialBigButtons: !many_methods?,
- responseType: 'code',
disableResetAction: false}
end
|
Remove responseType from lock_json api
|
diff --git a/config/initializers/action_mailer.rb b/config/initializers/action_mailer.rb
index abc1234..def5678 100644
--- a/config/initializers/action_mailer.rb
+++ b/config/initializers/action_mailer.rb
@@ -7,6 +7,5 @@ am_config.smtp_settings ||= {}
am_config.smtp_settings[:enable_starttls_auto] = true if am_config.smtp_settings[:enable_starttls_auto].nil?
am_config.smtp_settings[:authentication] ||= :plain
- am_config.smtp_settings[:tls] = true if am_config.smtp_settings[:tls].nil?
am_config.smtp_settings[:domain] = APP_CONFIG.domain if am_config.smtp_settings[:domain].nil?
end
|
Remove defaulting tls to true for actionmailer
|
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
@@ -1,9 +1,9 @@ # Be sure to restart your server when you modify this file.
options = if Rails.env.production?
- {domain: ['.glowfic.com', '.glowfic-staging.herokuapp.com']}
+ {domain: 'glowfic.com', tld_length: 2}
elsif Rails.env.development?
- {domain: '.localhost'}
+ {domain: 'localhost', tld_length: 2}
else
{}
end
|
Revert "Fix cookie domain problems by specifying domains manually"
This reverts commit b229309ebfe80fec0c071bdf483c2a53e4e9a4c3.
|
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
@@ -1,6 +1,9 @@ SERVICE_DOMAIN = (url = ENV['SERVICE_URL']) ? URI.parse(url).host : nil
-{key: 'pvbs', expire_after: 20.minutes, httponly: true, max_age: 20.minutes, domain: SERVICE_DOMAIN}.tap do |configuration|
- configuration[:secure] = Rails.env.production?
- PrisonVisits2::Application.config.session_store :cookie_store, configuration
-end
+PrisonVisits2::Application.config.session_store :cookie_store,
+ key: 'pvbs',
+ expire_after: 20.minutes,
+ httponly: true,
+ max_age: 20.minutes,
+ domain: SERVICE_DOMAIN,
+ secure: Rails.env.production?
|
Make session configuration look like normal code.
It was distractingly weird and almost incomprehensible.
|
diff --git a/statistics.rb b/statistics.rb
index abc1234..def5678 100644
--- a/statistics.rb
+++ b/statistics.rb
@@ -0,0 +1,37 @@+#!/usr/bin/env ruby
+
+require 'pp'
+require 'rdf/raptor'
+require 'linkeddata'
+require 'rdf'
+require 'rdf/turtle'
+require 'rdf-lemon'
+require 'nokogiri'
+require 'pry'
+
+statistics = Hash.new(0)
+
+i = 0
+
+RDF::Reader.open(ARGV.first || 'yarn.ttl') do |reader|
+ reader.each_statement do |s, p, o|
+ case p
+ when RDF::LexInfo.partOfSpeech then statistics[:postags] += 1; next
+ when RDF::SKOS.broader, RDF::SKOS.narrower, RDF::LexInfo.holonymTerm, RDF::LexInfo.meronymTerm, RDF::Lemon.subsense, RDF::SKOS.related then statistics[:relations] += 1; next
+ when RDF.type then
+ else next
+ end
+
+ case o
+ when RDF::SKOS.Concept then statistics[:concepts] += 1
+ when RDF::Lemon.LexicalEntry then statistics[:entries] += 1
+ when RDF::Lemon.LexicalSense then statistics[:senses] += 1
+ when RDF::Lemon.SenseDefinition then statistics[:definitions] += 1
+ when RDF::Lemon.UsageExample then statistics[:examples] += 1
+ end
+
+ pp [i, statistics] if (i += 1) % 500 == 0
+ end
+end
+
+pp statistics
|
Add the "Table 5" script
|
diff --git a/lib/doorkeeper/orm/active_record.rb b/lib/doorkeeper/orm/active_record.rb
index abc1234..def5678 100644
--- a/lib/doorkeeper/orm/active_record.rb
+++ b/lib/doorkeeper/orm/active_record.rb
@@ -25,11 +25,12 @@ Doorkeeper::Application.table_name
)
unless Doorkeeper::Application.new.attributes.include?("scopes")
- fail <<-MSG.squish
+ migration_path = '../../../generators/doorkeeper/templates/add_scopes_to_oauth_applications.rb'
+ puts <<-MSG.squish
[doorkeeper] Missing column: `oauth_applications.scopes`.
-Run `rails generate doorkeeper:application_scopes
-&& rake db:migrate` to add it.
+Create the following migration and run `rake db:migrate`.
MSG
+ puts File.read(File.expand_path(migration_path, __FILE__))
end
end
end
|
Check should not abort the actual migration
So we allow for the migration to run.
|
diff --git a/lib/middleman/graphviz/extension.rb b/lib/middleman/graphviz/extension.rb
index abc1234..def5678 100644
--- a/lib/middleman/graphviz/extension.rb
+++ b/lib/middleman/graphviz/extension.rb
@@ -2,7 +2,6 @@
module Middleman
module Graphviz
- cattr_accessor :options
class Extension < Middleman::Extension
def initialize( app, options_hash = {}, &block)
|
Fix middleman-graphviz on my Mac
Couldn't find any other instances of cattr_accessor :options in other middleman modules, so I commented it out and it worked OK.
|
diff --git a/lib/puppet/type/jboss_confignode.rb b/lib/puppet/type/jboss_confignode.rb
index abc1234..def5678 100644
--- a/lib/puppet/type/jboss_confignode.rb
+++ b/lib/puppet/type/jboss_confignode.rb
@@ -21,6 +21,13 @@ newproperty(:properties) do
desc "Additional properties for node"
defaultto {}
+
+ def is_to_s is
+ return is.inspect
+ end
+ def should_to_s should
+ return should.inspect
+ end
end
newparam(:profile) do
|
Fix for displaying changes with clientry
|
diff --git a/lib/recipes/deployment/migration.rb b/lib/recipes/deployment/migration.rb
index abc1234..def5678 100644
--- a/lib/recipes/deployment/migration.rb
+++ b/lib/recipes/deployment/migration.rb
@@ -27,8 +27,8 @@ else raise ArgumentError, "unknown migration target #{migrate_target.inspect}"
end
- run "cd #{directory}; #{rake} RAILS_ENV=#{rails_env} #{migrate_env} db:migrate"
+ run "cd #{directory}; bundle exec #{rake} RAILS_ENV=#{rails_env} #{migrate_env} db:migrate"
end
end #namespace
-end+end
|
Use bundle exec when running rake db:migrate
|
diff --git a/lib/relish/commands/push_command.rb b/lib/relish/commands/push_command.rb
index abc1234..def5678 100644
--- a/lib/relish/commands/push_command.rb
+++ b/lib/relish/commands/push_command.rb
@@ -20,6 +20,9 @@ resource = RestClient::Resource.new(url)
resource.post(tar_gz_data, :content_type => 'application/x-gzip')
puts "sent:\n#{files.join("\n")}"
+ rescue RestClient::ResourceNotFound => exception
+ warn exception.response
+ exit 1
rescue RestClient::BadRequest => exception
warn exception.response
exit 1
@@ -29,13 +32,13 @@ host = @options[:host]
account = @options[:account]
project = @options[:project]
- "http://#{host}/pushes?account_id=#{account}&project_id=#{project}"
+ "http://#{host}/pushes?account_id=#{account}&project_id=#{project}&api_token=#{api_token}"
end
- def options
- {}
+ def api_token
+ File.read("~/.relish/api_token")
end
-
+
def features_as_tar_gz
stream = StringIO.new
|
Read API token from disk
|
diff --git a/lib/rrj/tools/gem/janus_instance.rb b/lib/rrj/tools/gem/janus_instance.rb
index abc1234..def5678 100644
--- a/lib/rrj/tools/gem/janus_instance.rb
+++ b/lib/rrj/tools/gem/janus_instance.rb
@@ -0,0 +1,38 @@+# frozen_string_literal: true
+
+module RubyRabbitmqJanus
+ module Tools
+ # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
+ #
+ # Store instance information
+ class JanusInstance
+ include Mongoid::Document
+
+ field :instance, type: Integer
+ field :session, type: Integer
+ field :enable, type: Boolean
+
+ set_callback(:destroy, :before) do
+ options = { 'session_id' => intance.session }
+ Janus::Messages::Standard.new('base::destroy', options)
+ end
+
+ # Disable an instance
+ def self.disable(session_id)
+ Tools::Log.instance.info "Disable instance with session : #{session_id}"
+ JanusInstance.find_by(session: session_id).set(enable: false)
+ end
+
+ # Delete all instance disabled
+ def self.destroys
+ JanusInstance.where(enable: false).delete_all
+ end
+
+ def self.find_by_instance(instance_search)
+ JanusInstance.find_by(instance: instance_search)
+ rescue
+ false
+ end
+ end
+ end
+end
|
Add mongoid model for saving instance with session number
|
diff --git a/cookbooks/chef/attributes/default.rb b/cookbooks/chef/attributes/default.rb
index abc1234..def5678 100644
--- a/cookbooks/chef/attributes/default.rb
+++ b/cookbooks/chef/attributes/default.rb
@@ -5,4 +5,4 @@ default[:chef][:server][:version] = "12.0.8-1"
# Set the default client version
-default[:chef][:client][:version] = "12.8.1-1"
+default[:chef][:client][:version] = "12.9.41-1"
|
Update chef client to 12.9.41
|
diff --git a/lib/trawler/sources/json_fetcher.rb b/lib/trawler/sources/json_fetcher.rb
index abc1234..def5678 100644
--- a/lib/trawler/sources/json_fetcher.rb
+++ b/lib/trawler/sources/json_fetcher.rb
@@ -12,7 +12,7 @@ def get(url, &error_block)
error_block ||= -> r { raise "Fetch of #{url} failed. #{error_response}" }
- puts "Fetching #{url} ..."
+ puts "Fetching #{cleaned_url url} ..."
response = RestClient.get(url, { accepts: :json })
error_block.call(response) unless response.code == 200
@@ -21,6 +21,10 @@ end
memoize :get
+
+ def cleaned_url(url)
+ url.gsub /(https?:\/\/[^:]*:?)[^@]*@?(\S*)/, '\1\2'
+ end
end
end
end
|
Clean credentials in logged URL message
|
diff --git a/tty-screen.gemspec b/tty-screen.gemspec
index abc1234..def5678 100644
--- a/tty-screen.gemspec
+++ b/tty-screen.gemspec
@@ -18,6 +18,8 @@ spec.test_files = spec.files.grep(%r{^(spec)/})
spec.require_paths = ["lib"]
+ spec.required_ruby_version = '>= 2.0.0'
+
spec.add_development_dependency 'bundler', '>= 1.5.0', '< 2.0'
spec.add_development_dependency 'rake', '~> 10.0'
end
|
Change to enforce ruby 2.0
|
diff --git a/lib/github.rb b/lib/github.rb
index abc1234..def5678 100644
--- a/lib/github.rb
+++ b/lib/github.rb
@@ -0,0 +1,44 @@+require 'retries'
+require 'octokit'
+
+module Provider
+ # GitHub SSH public key provider
+ class GitHub
+ # @param [Hash] options GitHub credentials for Octokit::Client
+ # @option options [String] :access_token OAuth2 access token for
+ # authentication
+ # @option options [String] :api_endpoint Base URL for API requests.
+ # default: https://api.github.com/
+ # @see http://www.rubydoc.info/github/pengwynn/octokit/Octokit/Configurable
+ def initialize(options = {})
+ default_options = { auto_paginate: true }
+ @client = Octokit::Client.new(default_options.merge(options))
+ end
+
+ # @param [String] organization GitHub organization
+ # @return [Hash] Hash with keys by username with +SortedSet+s
+ def keys_for_whole_org(organization)
+ keys_for_members(@client.org_members(organization))
+ end
+
+ # @param (see #keys_for_whole_org)
+ # @param [String] GitHub team
+ # @return (see #keys_for_whole_org)
+ def keys_for_org_team(organization, team)
+ teams = @client.org_teams(organization).select { |t| t.name == team }
+ raise 'Incorrect team' unless teams.size == 1
+ team_id = teams.first.id
+ keys_for_members(@client.team_members(team_id))
+ end
+
+ private def keys_for_members(members)
+ credentials = {}
+ members.each do |member|
+ with_retries do
+ credentials[member.login] = SortedSet.new @client.user_keys(member.login).map(&:key)
+ end
+ end
+ credentials
+ end
+ end
+end
|
Add GitHub provider for getting SSH keys
|
diff --git a/lib/generators/link_to_action/install_generator.rb b/lib/generators/link_to_action/install_generator.rb
index abc1234..def5678 100644
--- a/lib/generators/link_to_action/install_generator.rb
+++ b/lib/generators/link_to_action/install_generator.rb
@@ -1,7 +1,7 @@ require 'rails/generators'
require 'rails/generators/named_base'
-module LinkToActions
+module LinkToAction
module Generators
class InstallGenerator < Rails::Generators::Base
desc "Copy LinkToAction configuration file"
|
Fix plural -> singular for generator.
|
diff --git a/lib/scoped_search/oracle_enhanced.rb b/lib/scoped_search/oracle_enhanced.rb
index abc1234..def5678 100644
--- a/lib/scoped_search/oracle_enhanced.rb
+++ b/lib/scoped_search/oracle_enhanced.rb
@@ -1,4 +1,5 @@ require "scoped_search"
+require "scoped_search/oracle_enhanced/version"
module ScopedSearch
|
Make sure VERSION constant is loaded
|
diff --git a/lib/smartystreets_ruby_sdk/errors.rb b/lib/smartystreets_ruby_sdk/errors.rb
index abc1234..def5678 100644
--- a/lib/smartystreets_ruby_sdk/errors.rb
+++ b/lib/smartystreets_ruby_sdk/errors.rb
@@ -11,7 +11,7 @@ REQUEST_ENTITY_TOO_LARGE = 'Request Entity Too Large: The request body has exceeded the maximum size.'.freeze
BAD_REQUEST = 'Bad Request (Malformed Payload): A GET request lacked a street field or the request body of a
- POST request contained malformed JSON, possibly because a value was submitted as a number rather than as a string.'.freeze
+ POST request contained malformed JSON.'.freeze
UNPROCESSABLE_ENTITY = 'GET request lacked required fields.'.freeze
|
Revert "Added more to the Bad Request error message to help people debug easier."
This reverts commit dffa9fb73e0cd432be8439e304b5695aae5a4ac6.
|
diff --git a/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb b/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
index abc1234..def5678 100644
--- a/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
+++ b/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
@@ -4,25 +4,25 @@ def email
@params['payer']
end
-
+
def name
[@params['first_name'], @params['middle_name'], @params['last_name']].compact.join(' ')
end
-
+
def token
@params['token']
end
-
+
def payer_id
@params['payer_id']
end
-
+
def payer_country
@params['payer_country']
end
-
+
def address
- { 'name' => @params['name'],
+ { 'name' => name,
'company' => @params['payer_business'],
'address1' => @params['street1'],
'address2' => @params['street2'],
@@ -35,4 +35,4 @@ end
end
end
-end+end
|
Use proper name in paypal express response address
|
diff --git a/features/step_definitions/setup_steps.rb b/features/step_definitions/setup_steps.rb
index abc1234..def5678 100644
--- a/features/step_definitions/setup_steps.rb
+++ b/features/step_definitions/setup_steps.rb
@@ -1,5 +1,5 @@ Given /^the application is set up$/ do
- # Using smackaho.st to give us automatic resolution to localhost
+ # Using lvh.me to give us automatic resolution to localhost
# N.B. This means some Cucumber scenarios will fail if your machine
# isn't connected to the internet. We shoud probably fix this.
#
@@ -12,8 +12,8 @@ # more complicated.
port_segment = Capybara.current_driver == :selenium ? ":#{Capybara.server_port}" : ''
- Setting[:base_domain] = "smackaho.st#{port_segment}"
- Setting[:signup_domain] = "create.smackaho.st#{port_segment}"
+ Setting[:base_domain] = "lvh.me#{port_segment}"
+ Setting[:signup_domain] = "create.lvh.me#{port_segment}"
end
When /^the domain is the signup domain$/ do
|
Use lvh.me instead of now-defunct smackaho.st.
|
diff --git a/ruby/unlucky_days.rb b/ruby/unlucky_days.rb
index abc1234..def5678 100644
--- a/ruby/unlucky_days.rb
+++ b/ruby/unlucky_days.rb
@@ -0,0 +1,24 @@+require "date"
+
+def unlucky_days(year)
+ dates = get_dates(year)
+
+ results = 0
+ dates.each do |date|
+ results += 1 if date.friday? && date.day == 13
+ end
+ results
+end
+
+def get_dates(yr)
+ start_date = Date.new(yr)
+ dates = []
+
+ until start_date.year == yr + 1
+ dates << start_date.next
+ start_date = start_date.next
+ end
+ dates
+end
+
+p unlucky_days(1001)
|
Write okay solution for unlucky days
|
diff --git a/app/controllers/books_controller.rb b/app/controllers/books_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/books_controller.rb
+++ b/app/controllers/books_controller.rb
@@ -1,5 +1,5 @@ class BooksController < ApplicationController
- before_action do
+ before_action except: [:index] do
@current_user = User.find_by id: session[:user_id]
if @current_user.blank?
redirect_to sign_in_path
|
Add log-in exception for books index
|
diff --git a/app/controllers/drops_controller.rb b/app/controllers/drops_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/drops_controller.rb
+++ b/app/controllers/drops_controller.rb
@@ -1,5 +1,9 @@
class DropsController < ApplicationController
+
+ def new
+ @drop = Drop.new
+ end
def show
drops = Drop.order("created_at DESC").limit(50).to_json
@@ -7,7 +11,6 @@ end
def create
- # needs `current_user` helper method to exist
drop = current_user.drops.new(drop_params)
if drop.save
render plain: {success: true}.to_json
|
Add new action for drop
|
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/search_controller.rb
+++ b/app/controllers/search_controller.rb
@@ -1,8 +1,12 @@ class SearchController < ApplicationController
def search
- @query = Query.new(params[:query])
+ @query = Query.new(search_params[:query])
@query.site_id = current_site.id
searcher = PostSearcher.new
- @result_set = searcher.search_with_fallback_to_first_page(@query, page: params[:page])
+ @result_set = searcher.search_with_fallback_to_first_page(@query, page: search_params[:page])
+ end
+
+ def search_params
+ params.permit(:page, query: [:keywords, :participant_id, :site_id])
end
end
|
Use strong parameters for search
|
diff --git a/app/controllers/index_controller.rb b/app/controllers/index_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/index_controller.rb
+++ b/app/controllers/index_controller.rb
@@ -8,32 +8,32 @@ response = RestClient.get("https://www.inaturalist.org/observations.json")
parsed_response = JSON.parse(response,:symbolize_names => true)
- @organisms = []
- parsed_response.each do |organism_hash|
- if organism_hash[:taxon] != nil
- if organism_hash[:iconic_taxon] != nil
- @organisms << Organism.new(organism_hash)
+ @organisms = list_organisms(parsed_response)
+ @iconic_taxon_names = sort_taxon(@organisms)
+
+ erb :index
+end
+
+private
+
+ def list_organisms(json_response)
+ organisms = []
+ json_response.each do |organism_hash|
+ if organism_hash[:taxon] != nil
+ if organism_hash[:iconic_taxon] != nil
+ organisms << Organism.new(organism_hash)
+ end
end
end
+ organisms
end
- @iconic_taxon_names = ["Plantae", "Animalia", "Mollusca", "Reptilia", "Aves", "Amphibia", "Actinopterygii", "Mammalia", "Insecta", "Arachnida", "Fungi", "Protozoa", "Chromista", "Unknown"]
+ def sort_taxon(organisms)
+ iconic_taxon_names = ["Plantae", "Animalia", "Mollusca", "Reptilia", "Aves", "Amphibia", "Actinopterygii", "Mammalia", "Insecta", "Arachnida", "Fungi", "Protozoa", "Chromista", "Unknown"]
- @iconic_taxon_names.size.times do |name|
- @iconic_taxon_names[name] = @organisms.select { |org| org.iconic_taxon_name == @iconic_taxon_names[name] }
+ iconic_taxon_names.size.times do |name|
+ iconic_taxon_names[name] = organisms.select { |org| org.iconic_taxon_name == iconic_taxon_names[name] }
+ end
+ iconic_taxon_names
end
-
- @organisms
- @iconic_taxon_names
-
-
- @iconic_taxon_names.each do |taxon|
- if !taxon.empty?
- p "*********************"
- p taxon
- end
- end
-
- erb :index
-end
|
Refactor controller to call private methods; leaner request
|
diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/pages_controller.rb
+++ b/app/controllers/pages_controller.rb
@@ -11,9 +11,11 @@ def faq
@cart = current_cart
end
+
+ def delivery
+ @cart = current_cart
+ end
-
-
def show
if valid_page?
render template: "pages/#{params[:page]}"
|
Add method for delivery page
|
diff --git a/app/models/concerns/with_metadata.rb b/app/models/concerns/with_metadata.rb
index abc1234..def5678 100644
--- a/app/models/concerns/with_metadata.rb
+++ b/app/models/concerns/with_metadata.rb
@@ -6,11 +6,7 @@
validates_presence_of :metadata
- delegate :student?, :admin?, to: :metadata
-
- def teacher?(slug) ## BIG FIX ME
- metadata.permissions('classroom').present?
- end
+ delegate :student?, :teacher?, :admin?, to: :metadata
end
-end
+end
|
Revert "Quick teacher exam fix"
This reverts commit 88a0dd8842fc4046a3b572432468737773d97b90.
|
diff --git a/app/helpers/spree/reviews_helper.rb b/app/helpers/spree/reviews_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/spree/reviews_helper.rb
+++ b/app/helpers/spree/reviews_helper.rb
@@ -1,7 +1,7 @@ module Spree::ReviewsHelper
def star(the_class)
- "<span class=\"#{the_class}\"> ✮ </span>"
+ content_tag(:span, " ✮ ".html_safe, :class => the_class)
end
def mk_stars(m)
@@ -10,7 +10,7 @@
def txt_stars(n, show_out_of = true)
res = I18n.t('star', :count => n)
- res += ' ' + t('out_of_5') if show_out_of
+ res += " #{t('out_of_5')}" if show_out_of
res
end
|
Use helpers instead of html in helper, interpolate strings instead of concat
|
diff --git a/features/support/database_cleaner.rb b/features/support/database_cleaner.rb
index abc1234..def5678 100644
--- a/features/support/database_cleaner.rb
+++ b/features/support/database_cleaner.rb
@@ -2,7 +2,7 @@ require 'database_cleaner'
require 'database_cleaner/cucumber'
-DB_URI = 'sqlite://gateway/data/test.sqlite'
+DB_URI = "sqlite://#{FigNewton.sqlite.relative_path}"
DatabaseCleaner[:sequel, {:connection => Sequel.connect(DB_URI)}].strategy = :truncation
Before do
|
Use FigNetwon for test database location
|
diff --git a/examples/multi_select_paged.rb b/examples/multi_select_paged.rb
index abc1234..def5678 100644
--- a/examples/multi_select_paged.rb
+++ b/examples/multi_select_paged.rb
@@ -0,0 +1,9 @@+# encoding: utf-8
+
+require 'tty-prompt'
+
+prompt = TTY::Prompt.new
+
+alfabet = ('A'..'Z').to_a
+
+prompt.multi_select('Which letter?', alfabet, per_page: 5)
|
Add multi select paged example.
|
diff --git a/spec/rails_app/config/initializers/secret_token.rb b/spec/rails_app/config/initializers/secret_token.rb
index abc1234..def5678 100644
--- a/spec/rails_app/config/initializers/secret_token.rb
+++ b/spec/rails_app/config/initializers/secret_token.rb
@@ -4,4 +4,9 @@ # If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
-RailsApp::Application.config.secret_token = 'fcc06e5fc19cdbf0f0db6fd634aa5160a9f28ad692528f227e14975da33b0dbd92bb8a9f15e0ef44f0664415a0f6eba003cbb088300865f0058965c104e5abd6'
+secret = 'fcc06e5fc19cdbf0f0db6fd634aa5160a9f28ad692528f227e14975da33b0dbd92bb8a9f15e0ef44f0664415a0f6eba003cbb088300865f0058965c104e5abd6'
+if Rails.version < '5.2.0'
+ RailsApp::Application.config.secret_token = secret
+else
+ RailsApp::Application.config.secret_key_base = secret
+end
|
Address Rails 5.2 deprecation warning in specs
|
diff --git a/wkhtmltopdf-old.rb b/wkhtmltopdf-old.rb
index abc1234..def5678 100644
--- a/wkhtmltopdf-old.rb
+++ b/wkhtmltopdf-old.rb
@@ -6,8 +6,6 @@ sha256 'e6311c0d398d50c757d43d34f1f63c4b33010441e97d07e92647542419ab1a8b'
depends_on 'qt'
-
- conflicts_with 'wkhtmltopdf', :because => 'Same binary'
def install
# fix that missing TEMP= include
|
Remove line that made install failing
|
diff --git a/spec/api/api_spec.rb b/spec/api/api_spec.rb
index abc1234..def5678 100644
--- a/spec/api/api_spec.rb
+++ b/spec/api/api_spec.rb
@@ -31,17 +31,17 @@ it 'posts job on queue' do
queue.stub(:push) { nil }
- post '/jobs', JSON.dump({
+ attributes = {
type: 'image',
notification_url: "http://example.com/transcoder_notification",
+ reference: {'meaning' => 42},
params: {}
- })
+ }
+
+ post '/jobs', JSON.dump(attributes)
last_response.status.should == 201
- expect(queue).to have_received(:push).with(Job.new(
- type: 'image',
- notification_url: "http://example.com/transcoder_notification",
- params: {}))
+ expect(queue).to have_received(:push).with(Job.new(attributes))
end
end
|
Extend spec to test reference support.
|
diff --git a/spec/default_spec.rb b/spec/default_spec.rb
index abc1234..def5678 100644
--- a/spec/default_spec.rb
+++ b/spec/default_spec.rb
@@ -1,10 +1,36 @@ describe 'dotnetframework::default' do
-
- let(:chef_run) do
- ChefSpec::ServerRunner.new.converge(described_recipe)
+ describe '.NET is not installed' do
+ before(:each) do
+ allow_any_instance_of(Chef::Resource)
+ .to receive(:registry_value_exists?)
+ .with('HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full',
+ { :name=>"Version", :type=>:string, :value=>"4.5.51650" }, :machine)
+ .and_return(false)
+ end
+ let(:chef_run) do
+ ChefSpec::ServerRunner.new.converge(described_recipe)
+ end
+ it 'should install .NET 4.5.2' do
+ expect(chef_run).to install_windows_package('Microsoft .NET Framework 4.5.2')
+ end
+ it 'should notify windows_reboot resource' do
+ win_pkg = chef_run.windows_package('Microsoft .NET Framework 4.5.2')
+ expect(win_pkg).to notify('windows_reboot[60]').to(:request).immediately
+ end
end
-
- it 'should install .NET 4.5.2' do
- expect(chef_run).to install_windows_package('Microsoft .NET Framework 4.5.2')
+ describe '.NET is installed' do
+ before(:each) do
+ allow_any_instance_of(Chef::Resource)
+ .to receive(:registry_value_exists?)
+ .with('HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full',
+ { :name=>"Version", :type=>:string, :value=>"4.5.51650" }, :machine)
+ .and_return(true)
+ end
+ let(:chef_run) do
+ ChefSpec::ServerRunner.new.converge(described_recipe)
+ end
+ it 'should not install .NET 4.5.2' do
+ expect(chef_run).to_not install_windows_package('Microsoft .NET Framework 4.5.2')
+ end
end
end
|
Fix ChefSpec failures from new idempotence check
- Add ChefSpec test case for .NET already being installed
- Add ChefSpec test to ensure windows_reboot is properly notified
|
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index abc1234..def5678 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -11,7 +11,7 @@ require 'capybara/rails'
WebMock.disable_net_connect!(allow_localhost: true)
-Capybara.javascript_driver = :chrome
+Capybara.javascript_driver = :headless_chrome
Capybara.register_driver :chrome do |app|
Capybara::Selenium::Driver.new(app, browser: :chrome)
|
Put it back into headless mode
|
diff --git a/spec/support/http.rb b/spec/support/http.rb
index abc1234..def5678 100644
--- a/spec/support/http.rb
+++ b/spec/support/http.rb
@@ -51,6 +51,8 @@
def try_catch
yield
+ rescue RestClient::SSLCertificateNotVerified
+ raise
rescue RestClient::Exception => e
e.response
end
|
Improve error reporting in system tests
|
diff --git a/lib/jekyll/assets/plugins/proxy/optim.rb b/lib/jekyll/assets/plugins/proxy/optim.rb
index abc1234..def5678 100644
--- a/lib/jekyll/assets/plugins/proxy/optim.rb
+++ b/lib/jekyll/assets/plugins/proxy/optim.rb
@@ -8,14 +8,8 @@ module Assets
module Plugins
class ImageOptim < Proxy
+ content_types %r!^image/(?\!x-icon$)[a-zA-Z0-9\-_\+]+$!
arg_keys :optim
- content_types "image/webp"
- content_types "image/jpeg"
- content_types "image/svg+xml"
- content_types "image/tiff"
- content_types "image/bmp"
- content_types "image/gif"
- content_types "image/png"
class UnknownPresetError < RuntimeError
def initialize(name)
|
Use a regexp for the content type.
|
diff --git a/lib/tasks/export_local_transactions.rake b/lib/tasks/export_local_transactions.rake
index abc1234..def5678 100644
--- a/lib/tasks/export_local_transactions.rake
+++ b/lib/tasks/export_local_transactions.rake
@@ -0,0 +1,15 @@+desc "Export Local Transactions' slugs, names, LGSL and optional LGIL codes as CSV"
+
+task :export_local_transactions => :environment do
+ require "csv"
+
+ csv_string = CSV.generate do |csv|
+ csv << ["slug","lgsl","lgil","title"]
+
+ Edition.where(_type: "LocalTransactionEdition").each do |lte|
+ csv << [lte.slug,lte.lgsl_code,lte.lgil_override,lte.title]
+ end
+ end
+
+ puts csv_string
+end
|
Add a rake task to generate a CSV of Local Transactions
- Generates a CSV of the form "slug","lgsl","lgil","title".
- This might need to be done again in future, and across environments,
hence the rake task.
|
diff --git a/lib/three_seventy_api/helpers/request.rb b/lib/three_seventy_api/helpers/request.rb
index abc1234..def5678 100644
--- a/lib/three_seventy_api/helpers/request.rb
+++ b/lib/three_seventy_api/helpers/request.rb
@@ -14,7 +14,7 @@ end
def put(path, payload)
begin
- response = client[path].put payload, :accept => 'application/json', :content_type => 'application/json'
+ response = client[path].put payload.to_json, :accept => 'application/json', :content_type => 'application/json'
rescue Exception => e
puts e.inspect
end
@@ -23,7 +23,7 @@
def post(path, payload)
begin
- response = client[path].post payload, :accept => 'application/json', :content_type => 'application/json'
+ response = client[path].post payload.to_json, :accept => 'application/json', :content_type => 'application/json'
rescue Exception => e
puts e.inspect
end
|
Add to_json to payload object.
|
diff --git a/Casks/wuala.rb b/Casks/wuala.rb
index abc1234..def5678 100644
--- a/Casks/wuala.rb
+++ b/Casks/wuala.rb
@@ -4,7 +4,7 @@
url 'https://cdn.wuala.com/files/WualaInstaller.dmg'
name 'Wuala'
- homepage 'http://wuala.com'
+ homepage 'https://www.wuala.com/'
license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder
app 'Wuala.app'
|
Fix homepage to use SSL in Wuala Cask
The HTTP URL is already getting redirected to HTTPS. Using the HTTPS URL directly
makes it more secure and saves a HTTP round-trip.
|
diff --git a/app/models/concerns/content_type.rb b/app/models/concerns/content_type.rb
index abc1234..def5678 100644
--- a/app/models/concerns/content_type.rb
+++ b/app/models/concerns/content_type.rb
@@ -1,6 +1,10 @@ module Concerns
module ContentType
extend ActiveSupport::Concern
+
+ included do
+ after_save -> { column.touch if column.present? }
+ end
def column
::ContentColumn.where(content_type: self.class.name, content_id: id).take
|
Make sure content types update their column.
|
diff --git a/lib/spontaneous/rack/back/changes.rb b/lib/spontaneous/rack/back/changes.rb
index abc1234..def5678 100644
--- a/lib/spontaneous/rack/back/changes.rb
+++ b/lib/spontaneous/rack/back/changes.rb
@@ -20,5 +20,10 @@ site.rerender
json({})
end
+
+ post '/rerender' do
+ site.rerender
+ json({})
+ end
end
end
|
Add a 'rerender' command to the publish dialogue
which is a developer-only feature that allows the public site to be re-rendered using the current published content to pick up any template/asset changes
|
diff --git a/lib/tasks/fix_dangling_projects.rake b/lib/tasks/fix_dangling_projects.rake
index abc1234..def5678 100644
--- a/lib/tasks/fix_dangling_projects.rake
+++ b/lib/tasks/fix_dangling_projects.rake
@@ -0,0 +1,20 @@+desc 'Removes projects with missing owners'
+task :fix_dangling_projects do
+ [User, Group].each do |owner|
+ table_name = owner.table_name.to_sym
+
+ projects = Project.unscoped.
+ joins("LEFT OUTER JOIN #{table_name} ON #{table_name}.id = projects.owner_id").
+ where(:owner_type => owner.name, table_name => { :id => nil })
+
+ Rails.logger.debug "[fix_dangling_projects] removing #{projects.count} orphaned projects"
+
+ projects.each do |project|
+ begin
+ project.destroy
+ rescue => e
+ project.delete
+ end
+ end
+ end
+end
|
Add task which fixes dangling projects
|
diff --git a/app/views/projects/show.rss.builder b/app/views/projects/show.rss.builder
index abc1234..def5678 100644
--- a/app/views/projects/show.rss.builder
+++ b/app/views/projects/show.rss.builder
@@ -1,6 +1,6 @@ xml.rss({:version => "2.0"}) do
xml.channel do
- xml.title("Square Build Server RSS Feed")
+ xml.title("Kochiku RSS Feed")
xml.link(root_url)
xml.language("en")
xml.ttl(10)
|
Remove 'Square' from the title of the RSS feed
|
diff --git a/spec/helpers/application_helper/buttons/host_introspect_provide_spec.rb b/spec/helpers/application_helper/buttons/host_introspect_provide_spec.rb
index abc1234..def5678 100644
--- a/spec/helpers/application_helper/buttons/host_introspect_provide_spec.rb
+++ b/spec/helpers/application_helper/buttons/host_introspect_provide_spec.rb
@@ -3,7 +3,7 @@ let(:record) { FactoryGirl.create(:host_openstack_infra, :with_hardware) }
let(:button) { described_class.new(setup_view_context_with_sandbox({}), {}, {'record' => record}, {}) }
- before { allow(record.hardware).to receive(:provision_state).and_return(provision_state) }
+ before { allow(record).to receive_message_chain(:hardware, :provision_state).and_return(provision_state) }
describe '#visible?' do
subject { button.visible? }
|
Fix rspec expectation set on nil warning
|
diff --git a/ffi/spec_helper.rb b/ffi/spec_helper.rb
index abc1234..def5678 100644
--- a/ffi/spec_helper.rb
+++ b/ffi/spec_helper.rb
@@ -14,8 +14,10 @@
if need_to_compile_fixtures?
puts "[!] Compiling Ruby-FFI fixtures"
- unless system("make -f #{File.join(FIXTURE_DIR, 'GNUmakefile')}")
- raise "Failed to compile Ruby-FFI fixtures"
+ Dir.chdir(File.dirname(FIXTURE_DIR)) do
+ unless system("make -f fixtures/GNUmakefile")
+ raise "Failed to compile Ruby-FFI fixtures"
+ end
end
end
end
|
Make sure the Ruby-FFI fixtures are compiled regardless of the current working directory.
|
diff --git a/app/forms/dataset_edit_form.rb b/app/forms/dataset_edit_form.rb
index abc1234..def5678 100644
--- a/app/forms/dataset_edit_form.rb
+++ b/app/forms/dataset_edit_form.rb
@@ -18,9 +18,9 @@ if valid?
previous = dataset.editable_attributes.as_json
commit = dataset.commits.build
- item = EditableAttributesCollection.item(key)
attributes.except(:country).each_pair do |key, val|
+ item = EditableAttributesCollection.item(key)
next unless val.present? && previous[key.to_s] != val && item.editable?(dataset)
commit.dataset_edits.build(key: key, value: val)
|
Fix dataset edit form by Nora
|
diff --git a/app/helpers/sessions_helper.rb b/app/helpers/sessions_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/sessions_helper.rb
+++ b/app/helpers/sessions_helper.rb
@@ -1,22 +1,14 @@ module SessionsHelper
def sign_in(user)
- remember_token = User.new_remember_token
- cookies.permanent[remember_token] = remember_token
- user.update_attribute(:remember_token, User.digest(remember_token))
- self.current_user = user
+ session[:user_id] = user.id
end
def signed_in?
!current_user.nil?
end
- def current_user=(user)
- @current_user = user
- end
-
def current_user
- remember_token = User.digest(cookies[:remember_token])
- @current_user ||= User.find_by(remember_token: remember_token)
+ @current_user ||= User.find_by(id: session[:user_id])
end
end
|
Handle sign in with the session method
The recomended in method with an authentication token did not work,
therefore I used the sign in method. I still have to check why it
wasn't working, I do not yet understand how the sign in method works.
|
diff --git a/app/controllers/region_controller.rb b/app/controllers/region_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/region_controller.rb
+++ b/app/controllers/region_controller.rb
@@ -7,6 +7,7 @@ private
def load_vars
+ params[:iso]!="GL" or raise_404
@region = Region.where(iso: params[:iso].upcase).first
@region or raise_404
@presenter = RegionPresenter.new @region
|
Revert commit to restore raise_404 if region ISO is GL
|
diff --git a/app/services/mailchimp_subscriber.rb b/app/services/mailchimp_subscriber.rb
index abc1234..def5678 100644
--- a/app/services/mailchimp_subscriber.rb
+++ b/app/services/mailchimp_subscriber.rb
@@ -7,11 +7,15 @@
def subscribe(school, user)
list = @mailchimp_api.list_with_interests
- config = mailchimp_signup_params(school, user, list)
- if list && config.valid?
- @mailchimp_api.subscribe(list.id, config)
+ if list
+ config = mailchimp_signup_params(school, user, list)
+ if config.valid?
+ @mailchimp_api.subscribe(list.id, config)
+ else
+ raise MailchimpSubscriber::Error.new('Invalid newsletter subscription parameters')
+ end
else
- raise Error.new('Mailchimp subscribe failed')
+ raise MailchimpSubscriber::Error.new('Mailchimp API failed')
end
rescue MailchimpApi::Error => e
raise MailchimpSubscriber::Error.new(e)
|
Fix error handling and update user types
|
diff --git a/spec/features/test_an_answer_spec.rb b/spec/features/test_an_answer_spec.rb
index abc1234..def5678 100644
--- a/spec/features/test_an_answer_spec.rb
+++ b/spec/features/test_an_answer_spec.rb
@@ -0,0 +1,59 @@+require 'rails_helper'
+
+describe "Test an answer", type: :feature, js: true do
+ let(:user) { create(:user, :teacher) }
+ let(:exercise) { create(:exercise, user: user) }
+ let!(:question) { create(:question, exercise: exercise) }
+
+ subject(:submit_answer) { click_on "Submeter resposta" }
+
+ before do
+ login_as user
+ visit question_path(question)
+ click_on "Testar solução"
+ end
+
+ context "when no anwer is given" do
+ before { submit_answer }
+
+ it { expect(page).to have_selector("div.alert.alert-danger") }
+ end
+
+ context "when a source code with errors is submited" do
+ before do
+ fill_in_editor_field("this doesn't compile")
+ submit_answer
+ end
+
+ it { expect(page).to have_content("Erro de compilação") }
+ end
+
+ context "when a source code without errors is submited" do
+ before do
+ fill_in_editor_field(source_code)
+ submit_answer
+ end
+
+ context "when answer is rigtht" do
+ let(:source_code) { IO.read("spec/support/files/hello_world.pas") }
+
+ before { create(:test_case, question: question, output: "Hello, world.\n") }
+
+ it "informs that the answer is right and show test cases results" do
+ expect(page).to have_content("Resposta correta")
+ expect(page).to have_selector('#test-results div.alert', count: 1)
+ end
+ end
+
+ context "when answer is wrong" do
+ let(:source_code) { IO.read("spec/support/files/hello_world.pas") }
+
+ before { create(:test_case, question: question, output: "output") }
+
+ it "informs that the answer is right and show test cases results" do
+ expect(page).to have_content("Resposta incorreta")
+ expect(page).to have_selector('#test-results div.alert', count: 1)
+ end
+ end
+ end
+end
|
Create tests to 'test an answer' feature
|
diff --git a/spec/middlewares/raise_error_spec.rb b/spec/middlewares/raise_error_spec.rb
index abc1234..def5678 100644
--- a/spec/middlewares/raise_error_spec.rb
+++ b/spec/middlewares/raise_error_spec.rb
@@ -1,14 +1,44 @@ require "spec_helper"
describe BaseCRM::Middlewares::RaiseError do
+ before { @raise_error = BaseCRM::Middlewares::RaiseError.new }
- describe "on_complete 200..300" do
- raise_error = BaseCRM::Middlewares::RaiseError.new
- it { expect( raise_error.on_complete({:status => 204})).to eql(nil) }
- end
+ describe "on_complete" do
- describe "on_complete 400 without content type" do
- raise_error = BaseCRM::Middlewares::RaiseError.new
- it { expect( raise_error.on_complete({:status => 400, :response_headers=>{}})).to raise_error(BaseCRM::RequestError) }
+ it "return nil when code 200..300" do
+ expect(@raise_error.on_complete({:status => 204})).to eql(nil)
+ end
+
+ it "raises ResourceError when code 422 and no content type" do
+ expect { @raise_error.on_complete({:status => 422, :response_headers => {}}) }.to raise_error { |error|
+ expect(error).to be_a(BaseCRM::ResourceError)
+ expect(error.code).to eql(422)
+ expect(error.message).to eql("Unknown error occurred.")
+ }
+ end
+
+ it "raises RequestError when code 400..500 and no content type" do
+ expect { @raise_error.on_complete({:status => 400, :response_headers => {}}) }.to raise_error { |error|
+ expect(error).to be_a(BaseCRM::RequestError)
+ expect(error.code).to eql(400)
+ expect(error.message).to eql("Unknown error occurred.")
+ }
+ end
+
+ it "raises ServerError when code 500..600 and no content type" do
+ expect { @raise_error.on_complete({:status => 500, :response_headers => {}}) }.to raise_error { |error|
+ expect(error).to be_a(BaseCRM::ServerError)
+ expect(error.code).to eql(500)
+ expect(error.message).to eql("Unknown error occurred.")
+ }
+ end
+
+ it "raises ResourceError when code 422 and XML (not supported) content type" do
+ expect { @raise_error.on_complete({:status => 422, :response_headers => {'content-type' => "application/xml"}}) }.to raise_error { |error|
+ expect(error).to be_a(BaseCRM::ResourceError)
+ expect(error.code).to eql(422)
+ expect(error.message).to eql("Unknown error occurred.")
+ }
+ end
end
end
|
Test for error without content or non json content
|
diff --git a/pages/lib/brightcontent/pages/methods.rb b/pages/lib/brightcontent/pages/methods.rb
index abc1234..def5678 100644
--- a/pages/lib/brightcontent/pages/methods.rb
+++ b/pages/lib/brightcontent/pages/methods.rb
@@ -2,7 +2,7 @@ module Pages
module Methods
def current_page
- @current_page ||= Page.find_by_slug(request.fullpath[1..-1])
+ @current_page ||= Page.find_by_slug!(request.fullpath[1..-1])
end
end
end
|
Raise if page not found
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.