diff stringlengths 65 26.7k | message stringlengths 7 9.92k |
|---|---|
diff --git a/app/helpers/page_helper.rb b/app/helpers/page_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/page_helper.rb
+++ b/app/helpers/page_helper.rb
@@ -1,6 +1,7 @@ module PageHelper
def project_versions(project)
versions = Services::Projects::ConvertTagsToVersions.call(project.tags)
+ versions.reject! { |k, v| v.nil? }
Hash[*versions.sort_by(&:last).reverse.flatten]
end
end
| Fix showing versions for a project
|
diff --git a/db/migrate/20180423091042_create_intervention_proposal_parameters.planning_engine.rb b/db/migrate/20180423091042_create_intervention_proposal_parameters.planning_engine.rb
index abc1234..def5678 100644
--- a/db/migrate/20180423091042_create_intervention_proposal_parameters.planning_engine.rb
+++ b/db/migrate/20180423091042_create_intervention_proposal_parameters.planning_engine.rb
@@ -6,8 +6,6 @@ t.references :product, index: true, foreign_key: true
t.references :product_nature_variant, index: { name: :intervention_product_nature_variant_id }, foreign_key: true
t.string :product_type
- t.decimal :quantity
- t.string :unit
t.timestamps null: false
end
end
| Remove quantity and unit columns for migration after
|
diff --git a/spec/classes/java_spec.rb b/spec/classes/java_spec.rb
index abc1234..def5678 100644
--- a/spec/classes/java_spec.rb
+++ b/spec/classes/java_spec.rb
@@ -4,8 +4,8 @@ let(:facts) { default_test_facts }
let(:params) {
{
- update_version: '42',
- base_download_url: 'https://downloads.test/java'
+ :update_version => '42',
+ :base_download_url => 'https://downloads.test/java'
}
}
| Drop Ruby 1.9 hash syntax
|
diff --git a/config/puma.rb b/config/puma.rb
index abc1234..def5678 100644
--- a/config/puma.rb
+++ b/config/puma.rb
@@ -5,7 +5,7 @@ end
port ENV['PORT']
-environment ENV['RACK_ENV']
+environment ENV['RAILS_ENV']
preload_app!
| Use RAILS_ENV instead of RACK_ENV
|
diff --git a/spec/requests/api_spec.rb b/spec/requests/api_spec.rb
index abc1234..def5678 100644
--- a/spec/requests/api_spec.rb
+++ b/spec/requests/api_spec.rb
@@ -11,96 +11,4 @@ expect(response.status).to eq(400)
end
end
-
- describe 'POST /api/v1/login/call_back/' do
- before do
- post '/api/v1/login/call_back/'
- end
-
- it 'return 200 OK?' do
- expect(response).to be_success
- expect(response.status).to eq(200)
- end
- end
-
- describe 'GET /api/v1/requests/' do
- before do
- get '/api/v1/requests/'
- end
-
- it 'return 200 OK?' do
- expect(response).to be_success
- expect(response.status).to eq(200)
- end
- end
-
-
- describe 'GET /api/v1/dash_board/' do
- before do
- get '/api/v1/dash_board/'
- end
-
- it 'return 200 OK?' do
- expect(response).to be_success
- expect(response.status).to eq(200)
- end
- end
-
- describe 'GET /api/v1/projects/' do
- before do
- get '/api/v1/projects/'
- end
-
- it 'return 200 OK?' do
- expect(response).to be_success
- expect(response.status).to eq(200)
- end
- end
-
- describe 'GET /api/v1/projects/:id.json' do
- before do
- test_id = "hoge"
- get "/api/v1/projects/#{test_id}.json"
- end
-
- it 'return 200 OK?' do
- expect(response).to be_success
- expect(response.status).to eq(200)
- end
- end
-
- describe 'POST /api/v1/projects/' do
- before do
- post '/api/v1/projects/', name: 'name'
- end
-
- it 'return 200 OK?' do
- expect(response).to be_success
- expect(response.status).to eq(200)
- end
- end
-
- describe 'GET /api/v1/accounts/' do
- before do
- get '/api/v1/accounts/'
- end
-
- it 'return 200 OK?' do
- expect(response).to be_success
- expect(response.status).to eq(200)
- end
- end
-
- describe 'GET /api/v1/accounts/:id.json' do
- before do
- test_id = "hoge"
- get "/api/v1/accounts/#{test_id}.json"
- end
-
- it 'return 200 OK?' do
- pending 'Devise のcolumn作るのやだ'
- expect(response).to be_success
- expect(response.status).to eq(200)
- end
- end
end
| Delete to not use specs
|
diff --git a/spec/sub_diff/sub_spec.rb b/spec/sub_diff/sub_spec.rb
index abc1234..def5678 100644
--- a/spec/sub_diff/sub_spec.rb
+++ b/spec/sub_diff/sub_spec.rb
@@ -0,0 +1,53 @@+require_relative '../../lib/sub_diff/sub'
+
+RSpec.describe SubDiff::Sub do
+ subject { described_class.new diffable }
+
+ let(:diffable) { 'this is a simple test' }
+
+ describe '#diff' do
+ context 'with a string' do
+ it 'should process arguments correctly' do
+ result = subject.diff('simple', 'very simple')
+ expect(result.to_s).to eq 'this is a very simple test'
+ expect(result.size).to eq 3
+ end
+
+ it 'should handle no matches correctly' do
+ result = subject.diff('no-match', 'test')
+ expect(result.to_s).to eq diffable
+ expect(result.size).to eq 1
+ end
+ end
+
+ context 'with a regex' do
+ it 'should process arguments correctly' do
+ result = subject.diff(/a \S+/, 'an easy')
+ expect(result.to_s).to eq 'this is an easy test'
+ expect(result.size).to eq 3
+ end
+
+ it 'should handle captures correctly' do
+ result = subject.diff(/a (\S+)/, 'a very \1')
+ expect(result.to_s).to eq 'this is a very simple test'
+ expect(result.size).to eq 3
+ end
+ end
+
+ context 'with a hash' do
+ it 'should process arguments correctly' do
+ result = subject.diff(/simple/, 'simple' => 'harder')
+ expect(result.to_s).to eq 'this is a harder test'
+ expect(result.size).to eq 3
+ end
+ end
+
+ context 'with a block' do
+ it 'should process arguments correctly' do
+ result = subject.diff('simple') { |match| 'block' }
+ expect(result.to_s).to eq 'this is a block test'
+ expect(result.size).to eq 3
+ end
+ end
+ end
+end
| Add spec for `Sub` class
|
diff --git a/htty.gemspec b/htty.gemspec
index abc1234..def5678 100644
--- a/htty.gemspec
+++ b/htty.gemspec
@@ -2,9 +2,9 @@ s.name = 'htty'
s.version = File.read('VERSION').chomp
s.summary = 'The HTTP TTY'
- s.description = 'htty is a console application for interacting with HTTP ' +
- 'servers. It is something of a cross between curl and the ' +
- 'Lynx browser.'
+ s.description = 'htty is a console application for interacting with HTTP ' +
+ 'servers. It is something of a cross between cURL and a ' +
+ 'browser.'
s.files = %w(README.markdown
History.markdown
MIT-LICENSE.markdown
| Tweak the RubyGems project description |
diff --git a/bosh_openstack_cpi.gemspec b/bosh_openstack_cpi.gemspec
index abc1234..def5678 100644
--- a/bosh_openstack_cpi.gemspec
+++ b/bosh_openstack_cpi.gemspec
@@ -20,7 +20,7 @@ s.bindir = "bin"
s.executables = %w(bosh_openstack_console)
- s.add_dependency "fog", "~>1.10.1"
+ s.add_dependency "fog", "~>1.11.1"
s.add_dependency "bosh_common", "~>#{version}"
s.add_dependency "bosh_cpi", "~>#{version}"
s.add_dependency "httpclient", "=2.2.4"
| Upgrade fog gem to v1.11.1
|
diff --git a/spec/features/users/form_answers/letters_of_support_spec.rb b/spec/features/users/form_answers/letters_of_support_spec.rb
index abc1234..def5678 100644
--- a/spec/features/users/form_answers/letters_of_support_spec.rb
+++ b/spec/features/users/form_answers/letters_of_support_spec.rb
@@ -23,19 +23,19 @@ end
describe "Support Letters" do
+ require "virus_scanner"
before do
- allow_any_instance_of(Scan).to receive(:status).and_return("clean")
+ response = { "id" => "123", "status" => "clean" }
+ allow(::VirusScanner::File).to receive(:scan_url).and_return(response)
end
it "should be able to upload support letter" do
click_link "+ Add another support letter"
-
fill_in "First name", with: "Jack"
fill_in "Last name", with: "Lee"
fill_in "Relationship to nominee", with: "Brother"
attach_file "Attachment", Rails.root.join("spec/fixtures/cat.jpg")
click_button "Submit letter of support"
-
expect(page).to have_link("cat.jpg")
end
end
| Update spec, stub virus scanner
|
diff --git a/cutcut.gemspec b/cutcut.gemspec
index abc1234..def5678 100644
--- a/cutcut.gemspec
+++ b/cutcut.gemspec
@@ -5,7 +5,7 @@ s.homepage = 'http://github.com/stjhimy/cutcut'
s.license = 'MIT'
s.summary = 'Trim/Cut/Screenshot videos'
- s.description = 'CLI for Trim/Cut/Screenshot videos'
+ s.description = 'CLI for working with videos'
s.version = '1.1.0'
s.executables = ['cutcut']
| Update description and release to rubygems
|
diff --git a/infopen-docker.gemspec b/infopen-docker.gemspec
index abc1234..def5678 100644
--- a/infopen-docker.gemspec
+++ b/infopen-docker.gemspec
@@ -2,8 +2,8 @@
# Common informations
spec.name = 'infopen-docker'
- spec.version = '0.0.0'
- spec.date = '2015-12-05'
+ spec.version = '0.1.0'
+ spec.date = '2015-12-06'
spec.summary = 'Docker common functions'
spec.description = 'Used to add common functions for Dockerfile tests'
spec.authors = [ 'Alexandre Chaussier' ]
| Set first version of gem
|
diff --git a/reru.gemspec b/reru.gemspec
index abc1234..def5678 100644
--- a/reru.gemspec
+++ b/reru.gemspec
@@ -20,6 +20,7 @@
spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake"
+ spec.add_development_dependency "travis-lint"
spec.add_runtime_dependency "activesupport", "~> 4.0.0rc1"
end
| Add travis-lint to development dependencies
|
diff --git a/lib/schema_plus/pg_types/active_record/connection_adapters/postgresql/oid/interval.rb b/lib/schema_plus/pg_types/active_record/connection_adapters/postgresql/oid/interval.rb
index abc1234..def5678 100644
--- a/lib/schema_plus/pg_types/active_record/connection_adapters/postgresql/oid/interval.rb
+++ b/lib/schema_plus/pg_types/active_record/connection_adapters/postgresql/oid/interval.rb
@@ -33,7 +33,7 @@ when ::Numeric
# Sometimes operations on Times returns just float number of seconds so we need to handle that.
# Example: Time.current - (Time.current + 1.hour) # => -3600.000001776 (Float)
- duration = ::ActiveSupport::Duration.new(value._to_i, seconds: value)
+ duration = ::ActiveSupport::Duration.new(value.to_i, seconds: value.to_i)
duration.iso8601(precision: self.precision)
else
super
| Fix typo in method name (_to_i)
|
diff --git a/taskhandler.rb b/taskhandler.rb
index abc1234..def5678 100644
--- a/taskhandler.rb
+++ b/taskhandler.rb
@@ -22,7 +22,8 @@ "tasks" => [
{
"task" => arg_task,
- "due_date" => Date.parse(arg_duedate)
+ "due_date" => Date.parse(arg_duedate),
+ "status" => "open"
}
]
}
| Add status when the task is added
|
diff --git a/config/initializers/01_app_config.rb b/config/initializers/01_app_config.rb
index abc1234..def5678 100644
--- a/config/initializers/01_app_config.rb
+++ b/config/initializers/01_app_config.rb
@@ -13,7 +13,9 @@ raise "Can't find App configuration for #{Rails.env} environment on config/app_config.yml"
end
- unless @config[:mandatory_keys].present? && (@config[:mandatory_keys].map(&:to_sym) - @config.keys).blank?
+ # Check if we have all the important keys on config/app_config.yml
+ raise "Missing mandatory_keys key on config/app_config.yml" unless @config[:mandatory_keys].present?
+ unless(@config[:mandatory_keys].map(&:to_sym) - @config.keys).blank?
raise "Missing the following config keys on config/app_config.yml: #{(@config[:mandatory_keys].map(&:to_sym) - @config.keys).join(', ')}"
end
end
@@ -24,9 +26,3 @@ @error_codes ||= file_hash["cartodb_errors"].try(:to_options!)
end
end
-
-#raw_config = YAML.load_file("#{Rails.root}/config/app_config.yml")[Rails.env]
-#APP_CONFIG = raw_config.to_options! unless raw_config.nil?
-
-#raw_errors = YAML.load_file("#{Rails.root}/config/error_codes.yml")["cartodb_errors"]
-#Cartodb.error_codes = raw_errors.to_options! unless raw_errors.nil?
| Check if mandatory_key key is present on app_config
|
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,3 +1,3 @@ # Be sure to restart your server when you modify this file.
-NoMoreIdeas::Application.config.session_store :cookie_store, key: '_no-more-ideas_session'
+NoMoreIdeas::Application.config.session_store :cookie_store, key: '_no_more_ideas_session'
| Update configuration for new Rails update
|
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,8 +1,13 @@ # Be sure to restart your server when you modify this file.
# Rails.application.config.session_store :cookie_store, key: '_opentie-app_session'
+
Rails.application.config.session_store(
- :redis_store,
- :servers => "redis://localhost:6379/1",
- :expire_after => 30.minutes
+ :cookie_store,
+ key: '_opentie-app_session'
)
+#Rails.application.config.session_store(
+# :redis_store,
+# :servers => "redis://localhost:6379/1",
+# :expire_after => 30.minutes
+#)
| Change session store from redis to cookie
|
diff --git a/cookbooks/windows/recipes/default.rb b/cookbooks/windows/recipes/default.rb
index abc1234..def5678 100644
--- a/cookbooks/windows/recipes/default.rb
+++ b/cookbooks/windows/recipes/default.rb
@@ -33,27 +33,4 @@ end
end
-# Webtrends System Setup
-#Install SNMP feature
-windows_feature "SNMP-Service"
- action :install
-end
-
-#Install Powershell feature
-windows_feature "PowerShell-ISE"
- action :install
-end
-
-#Install .NET 3.5.1
-windows_feature "NET-Framework-Core"
- action :install
-end
-
-
-#Install MSMQ
-windows_feature "MSMQ-Server"
- action :install
-end
-
-
| Remove Webtrends server config out of the Windows cookbook
Former-commit-id: 1415fd5f056aaf5e0d08a2754495602e135135df |
diff --git a/lib/myaso.rb b/lib/myaso.rb
index abc1234..def5678 100644
--- a/lib/myaso.rb
+++ b/lib/myaso.rb
@@ -11,13 +11,13 @@ class << self
# Return the root path of the <tt>Myaso</tt> gem.
def root
- @myaso_root ||= File.expand_path('../../', __FILE__)
+ @@myaso_root ||= File.expand_path('../../', __FILE__)
end
# Return the <tt>Myaso</tt> version according to
# jeweler-defined <tt>VERSION</tt> file.
def version
- @version ||= File.read(File.join(Myaso.root, 'VERSION')).chomp
+ @@version ||= File.read(File.join(Myaso.root, 'VERSION')).chomp
end
end
| Use cvar instead of ivar in Myaso class
|
diff --git a/config/initializers/exlibris_aleph.rb b/config/initializers/exlibris_aleph.rb
index abc1234..def5678 100644
--- a/config/initializers/exlibris_aleph.rb
+++ b/config/initializers/exlibris_aleph.rb
@@ -4,5 +4,7 @@ # Load all the item circulation policies when the application starts
Exlibris::Aleph::TablesManager.instance.item_circulation_policies.all
rescue Errno::ENOENT => e
- Rails.logger.warn("Skipping Exlibris::Aleph initialization since \"#{e.message}\"")
+ message = "Skipping Exlibris::Aleph initialization since \"#{e.message}\""
+ p message
+ Rails.logger.warn(message)
end
| Print the exlibris-aleph initializer error message to standard output
|
diff --git a/db/migrate/20170204203531_create_pin_tag_votes.rb b/db/migrate/20170204203531_create_pin_tag_votes.rb
index abc1234..def5678 100644
--- a/db/migrate/20170204203531_create_pin_tag_votes.rb
+++ b/db/migrate/20170204203531_create_pin_tag_votes.rb
@@ -0,0 +1,9 @@+class CreatePinTagVotes < ActiveRecord::Migration[5.0]
+ def change
+ create_table :pin_tag_votes do |t|
+ t.integer pintag_id
+ t.integer user_id
+ t.timestamps
+ end
+ end
+end
| Create migrate for pintagvotes table with pintagid and userid
|
diff --git a/image_data_processor/parser/xml_to_hash.rb b/image_data_processor/parser/xml_to_hash.rb
index abc1234..def5678 100644
--- a/image_data_processor/parser/xml_to_hash.rb
+++ b/image_data_processor/parser/xml_to_hash.rb
@@ -6,6 +6,8 @@ module Parser::XmlToHash
class << self
+ # TODO: Load the paths and attributes from
+ # somewhere so its not so inflexible.
def to_hash(xml)
{
id: image_data(xml, ".//id"),
| Add TODO comment for loading paths from a config file or something.
|
diff --git a/lib/casa/receiver/strategy/adj_in_filter.rb b/lib/casa/receiver/strategy/adj_in_filter.rb
index abc1234..def5678 100644
--- a/lib/casa/receiver/strategy/adj_in_filter.rb
+++ b/lib/casa/receiver/strategy/adj_in_filter.rb
@@ -17,7 +17,7 @@
allows = true
@attributes.each do |attribute_name, attribute|
- if attribute.respond_to? :filter
+ if attribute.respond_to? :in_filter
unless attribute.in_filter payload_hash
allows = false
break
| Fix respond_to? check for in_filter
|
diff --git a/capybara_wysihtml5.gemspec b/capybara_wysihtml5.gemspec
index abc1234..def5678 100644
--- a/capybara_wysihtml5.gemspec
+++ b/capybara_wysihtml5.gemspec
@@ -8,8 +8,8 @@ spec.version = CapybaraWysihtml5::VERSION
spec.authors = ["Miles Z. Sterrett"]
spec.email = ["miles@mileszs.com"]
- spec.description = %q{TODO: Write a gem description}
- spec.summary = %q{TODO: Write a gem summary}
+ spec.description = %q{Interact with wysihtml5 text areas with capyabara}
+ spec.summary = %q{Interact with wysihtml5 text areas with capyabara}
spec.homepage = ""
spec.license = "MIT"
| Add description and summary to gemspec
|
diff --git a/lib/duby/jvm/source_generator/precompile.rb b/lib/duby/jvm/source_generator/precompile.rb
index abc1234..def5678 100644
--- a/lib/duby/jvm/source_generator/precompile.rb
+++ b/lib/duby/jvm/source_generator/precompile.rb
@@ -0,0 +1,124 @@+require 'duby/ast'
+
+module Duby::AST
+ class TempValue
+ def initialize(node, compiler=nil, value=nil)
+ if compiler.nil?
+ @tempname = node
+ else
+ @tempname = compiler.temp(node, value)
+ @tempvalue = value || node
+ end
+ end
+
+ def compile(compiler, expression)
+ if expression
+ compiler.method.print @tempname
+ end
+ end
+
+ def reload(compiler)
+ compiler.assign(@tempname, @tempvalue)
+ end
+ end
+
+ class Node
+ def expr?(compiler)
+ true
+ end
+
+ def precompile(compiler)
+ if expr?(compiler)
+ self
+ else
+ temp(compiler)
+ end
+ end
+
+ def temp(compiler, value=nil)
+ TempValue.new(self, compiler, value)
+ end
+ end
+
+ class Body
+ def expr?(compiler)
+ false
+ end
+ end
+
+ class If
+ def expr?(compiler)
+ return false unless condition.predicate.expr?(compiler)
+ return false unless body.nil? || body.expr?(compiler)
+ return false unless self.else.nil? || self.else.expr?(compiler)
+ true
+ end
+ end
+
+ class Loop
+ def expr?(compiler)
+ false
+ end
+
+ def precompile(compiler)
+ compile(compiler, false)
+ temp(compiler, 'null')
+ end
+ end
+
+ class Call
+ def method(compiler=nil)
+ @method ||= begin
+ arg_types = parameters.map {|p| p.inferred_type}
+ target.inferred_type.get_method(name, arg_types)
+ end
+ end
+
+ def expr?(compiler)
+ target.expr?(compiler) &&
+ parameters.all? {|p| p.expr?(compiler)} &&
+ !method.actual_return_type.void?
+ end
+ end
+
+ class FunctionalCall
+ def method(compiler)
+ @method ||= begin
+ arg_types = parameters.map {|p| p.inferred_type}
+ compiler.self_type.get_method(name, arg_types)
+ end
+ end
+
+ def expr?(compiler)
+ parameters.all? {|p| p.expr?(compiler)} &&
+ !method(compiler).actual_return_type.void?
+ end
+ end
+
+ class EmtpyArray
+ def expr?(compiler)
+ size.expr?(compiler)
+ end
+ end
+
+ class LocalAssignment
+ def expr?(compiler)
+ compiler.method.local?(name) && value.expr?(compiler)
+ end
+
+ def precompile(compiler)
+ if expr?(compiler)
+ self
+ else
+ compile(compiler, false)
+ TempValue.new(name)
+ end
+ end
+ end
+
+ class Return
+ def expr?(compiler)
+ false
+ end
+ end
+end | Add file missing from .java cleanup.
|
diff --git a/utility/android_studio.rb b/utility/android_studio.rb
index abc1234..def5678 100644
--- a/utility/android_studio.rb
+++ b/utility/android_studio.rb
@@ -11,9 +11,9 @@ end
if manifest.length > 0
- dir = File.dirname(__FILE__)
+ dir = `pwd`
puts "open -a Android\ Studio #{dir}"
- `open -a Android\\ Studio $PWD`
+ `open -a Android\\ Studio #{dir}`
else
puts "No AndroidManifest.xml file found"
end
| Fix Android Studio Open ShortCut Bug
|
diff --git a/handlebars_assets.gemspec b/handlebars_assets.gemspec
index abc1234..def5678 100644
--- a/handlebars_assets.gemspec
+++ b/handlebars_assets.gemspec
@@ -6,8 +6,9 @@ s.name = "handlebars_assets"
s.version = HandlebarsAssets::VERSION
s.authors = ["Les Hill"]
+ s.licenses = ["MIT"]
s.email = ["leshill@gmail.com"]
- s.homepage = ""
+ s.homepage = "https://github.com/leshill/handlebars_assets"
s.summary = "Compile Handlebars templates in the Rails asset pipeline."
s.description = "Compile Handlebars templates in the Rails asset pipeline."
| Add Licenses and Homepage to gemspec.
|
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, { token_url: "/oauth/request_token", access_url: "/oauth/request_access" }
+ option :client_options, { token_url: "/oauth/token", access_url: "/oauth/authorize" }
# These are called after authentication has succeeded. If
| Update endpoints used by WP OAuth Server 3.1.3
|
diff --git a/lib/reports/published_attachments_report.rb b/lib/reports/published_attachments_report.rb
index abc1234..def5678 100644
--- a/lib/reports/published_attachments_report.rb
+++ b/lib/reports/published_attachments_report.rb
@@ -28,7 +28,7 @@ attachment.attachable.organisations.map(&:name).join("; "),
attachment.url,
attachment.content_type,
- attachment.attachable.first_published_at,
+ attachment.updated_at,
]
print(".")
end
| Switch published attachment report to use attachment date
The Data Standards Authority have asked us to change the date included
in the published attachments report (introduced in
https://github.com/alphagov/whitehall/pull/6148) to be the attachment
update date, rather than the date the edition was first published.
|
diff --git a/lib/childprocess/abstract_io.rb b/lib/childprocess/abstract_io.rb
index abc1234..def5678 100644
--- a/lib/childprocess/abstract_io.rb
+++ b/lib/childprocess/abstract_io.rb
@@ -1,6 +1,11 @@ module ChildProcess
class AbstractIO
attr_reader :stderr, :stdout
+
+ def inherit!
+ @stdout = STDOUT
+ @stderr = STDERR
+ end
def stderr=(io)
check_type io
| Add a simple way to inherit the parent's output streams.
|
diff --git a/lib/danger/ci_source/bitrise.rb b/lib/danger/ci_source/bitrise.rb
index abc1234..def5678 100644
--- a/lib/danger/ci_source/bitrise.rb
+++ b/lib/danger/ci_source/bitrise.rb
@@ -29,7 +29,11 @@ end
def supported_request_sources
- @supported_request_sources ||= [Danger::RequestSources::GitHub, Danger::RequestSources::GitLab]
+ @supported_request_sources ||= [
+ Danger::RequestSources::GitHub,
+ Danger::RequestSources::GitLab,
+ Danger::RequestSources::BitbucketServer
+ ]
end
def initialize(env)
| Enable Bitbucket Server support for Bitrise CI
|
diff --git a/lib/gutenberg/book/paragraph.rb b/lib/gutenberg/book/paragraph.rb
index abc1234..def5678 100644
--- a/lib/gutenberg/book/paragraph.rb
+++ b/lib/gutenberg/book/paragraph.rb
@@ -1,5 +1,6 @@-class Paragraph
+class Paragraph < String
def initialize string
+ super string
@paragraph = string
end
| Make Paragraph to be a subclass of String
|
diff --git a/lib/apns-s3.rb b/lib/apns-s3.rb
index abc1234..def5678 100644
--- a/lib/apns-s3.rb
+++ b/lib/apns-s3.rb
@@ -5,28 +5,30 @@ module ApnsS3
# Set PEM file to APNS module
#
+ # @param [String] region
+ # One of ap-northeast-1, ap-southeast-1, ap-southeast-2, eu-central-1,
+ # eu-west-1, sa-east-1, us-east-1, us-west-1 and us-west-2.
+ #
+ # All regions are listed here: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html
+ #
# @param [String] aws_access_key_id
# @param [String] aws_secret_access_key
# @param [String] bucketname
# @param [String] filename PEM filename
def self.set_pemfile(
+ region: nil,
aws_access_key_id: nil,
aws_secret_access_key: nil,
bucketname: nil,
filename: nil
)
unless File.exists? filename
- s3 = AWS::S3.new(
- access_key_id: aws_access_key_id,
- secret_access_key: aws_secret_access_key
+ credentials = Aws::Credentials.new(
+ aws_access_key_id, aws_secret_access_key
)
- bucket = s3.buckets[bucketname]
- object = bucket.objects[filename]
- File.open filename, 'wb' do |file|
- object.read do |chunk|
- file.write(chunk)
- end
- end
+ Aws.config.update region: region, credentials: credentials
+ s3 = Aws::S3::Client.new
+ s3.get_object response_target: filename, bucket: bucketname, key: filename
end
APNS.pem = filename
end
| Fix for AWS SDK 2
|
diff --git a/lib/active_storage/service/gcs_service.rb b/lib/active_storage/service/gcs_service.rb
index abc1234..def5678 100644
--- a/lib/active_storage/service/gcs_service.rb
+++ b/lib/active_storage/service/gcs_service.rb
@@ -36,14 +36,20 @@
def exist?(key)
instrument :exist, key do |payload|
- payload[:exist] = file_for(key).present?
+ answer = file_for(key).present?
+ payload[:exist] = answer
+ answer
end
end
def url(key, expires_in:, disposition:, filename:)
instrument :url, key do |payload|
query = { "response-content-disposition" => "#{disposition}; filename=\"#{filename}\"" }
- payload[:url] = file_for(key).signed_url(expires: expires_in, query: query)
+ generated_url = file_for(key).signed_url(expires: expires_in, query: query)
+
+ payload[:url] = generated_url
+
+ generated_url
end
end
| Revert back to the original implementaion with varaibles
Revert `exist? and url` to the original implementation.
Since the new one doesn't provide any benefits and makes implementation
harder to follow.
|
diff --git a/lib/bebox/server.rb b/lib/bebox/server.rb
index abc1234..def5678 100644
--- a/lib/bebox/server.rb
+++ b/lib/bebox/server.rb
@@ -10,27 +10,14 @@ I18n.enforce_available_locales = false
def ip_free?
- pattern = Regexp.new("Destination Host Unreachable")
- ip_is_available =false
- `ping #{ip} -c 1 >> 'tmp/#{ip}_ping.log'`
- file = File.read("tmp/#{ip}_ping.log")
- file.each_line do |line|
- if line.match(pattern)
- ip_is_available = true
- break
- end
- end
+ `ping -q -c 1 #{ip}`
+ ip_is_available = ($?.exitstatus == 0) ? false : true
errors.add(:ip, 'is already taken!') unless ip_is_available
- remove_logs
ip_is_available
end
def valid?
ip_free? && valid_hostname?
- end
-
- def remove_logs
- `rm tmp/*_ping.log`
end
def valid_hostname?
| Change ip_free? method to work in multiple OS
|
diff --git a/lib/cognizant/util/symbolize_hash_keys.rb b/lib/cognizant/util/symbolize_hash_keys.rb
index abc1234..def5678 100644
--- a/lib/cognizant/util/symbolize_hash_keys.rb
+++ b/lib/cognizant/util/symbolize_hash_keys.rb
@@ -0,0 +1,19 @@+class Hash
+ # Destructively convert all keys by using the block operation.
+ # This includes the keys from the root hash and from all
+ # nested hashes.
+ def deep_transform_keys!(&block)
+ keys.each do |key|
+ value = delete(key)
+ self[yield(key)] = value.is_a?(Hash) ? value.deep_transform_keys!(&block) : value
+ end
+ self
+ end
+
+ # Destructively convert all keys to symbols, as long as they respond
+ # to +to_sym+. This includes the keys from the root hash and from all
+ # nested hashes.
+ def deep_symbolize_keys!
+ deep_transform_keys!{ |key| key.to_sym rescue key }
+ end
+end
| Add deep symbolizing util for Hash.
|
diff --git a/lib/csvable.rb b/lib/csvable.rb
index abc1234..def5678 100644
--- a/lib/csvable.rb
+++ b/lib/csvable.rb
@@ -1,7 +1,12 @@+# frozen_string_literal: true
+
module Csvable
+
+ require "csv"
+
class << self
def from_array_of_hashes(data = [])
- return '' unless data.first&.keys
+ return "" unless data.first&.keys
headers = data.first.keys
.map(&:to_s)
.map(&:humanize)
@@ -13,4 +18,5 @@ end
end
end
+
end
| Fix missing CSV requirement from Csvable module
|
diff --git a/lib/paypal_adaptive/response.rb b/lib/paypal_adaptive/response.rb
index abc1234..def5678 100644
--- a/lib/paypal_adaptive/response.rb
+++ b/lib/paypal_adaptive/response.rb
@@ -1,7 +1,7 @@ module PaypalAdaptive
class Response < Hash
def initialize(response, env=nil)
- config = PaypalAdaptive::Config.new(env)
+ config = PaypalAdaptive.config(env)
@paypal_base_url = config.paypal_base_url
self.merge!(response)
| Fix to use Rails config file for Responses as well as Requests
|
diff --git a/lib/vagrant-rekey-ssh/actions/ssh_info.rb b/lib/vagrant-rekey-ssh/actions/ssh_info.rb
index abc1234..def5678 100644
--- a/lib/vagrant-rekey-ssh/actions/ssh_info.rb
+++ b/lib/vagrant-rekey-ssh/actions/ssh_info.rb
@@ -31,7 +31,7 @@ if Vagrant::VERSION < "1.4.0"
@machine.config.ssh.private_key_path = ssh_key_path
else
- @machine.config.ssh.private_key_path = [ssh_key_path]
+ @machine.config.ssh.private_key_path = [ssh_key_path, @machine.env.default_private_key_path]
end
end
| Fix problems transitioning from insecure_private_key to less_insecure_private_key (Vagrant >= 1.4.0)
This doesn't fix Vagrant < 1.4.0.
Without this, `vagrant reload` after installing the plugin just hangs
forever waiting for the VM to boot, with output similar to the
following:
==> default: Less insecure SSH key not found, generating key
==> default: Less insecure SSH key generated and stored at /Users/dlitz/.vagrant.d/less_insecure_private_key
==> default: Attempting graceful shutdown of VM...
default: Guest communication could not be established! This is usually because
default: SSH is not running, the authentication information was changed,
default: or some other networking issue. Vagrant will force halt, if
default: capable.
==> default: Stopping the VMware VM...
==> default: Verifying vmnet devices are healthy...
==> default: Preparing network adapters...
==> default: Starting the VMware VM...
==> default: Waiting for the VM to finish booting...
|
diff --git a/rails/app/controllers/auth_controller.rb b/rails/app/controllers/auth_controller.rb
index abc1234..def5678 100644
--- a/rails/app/controllers/auth_controller.rb
+++ b/rails/app/controllers/auth_controller.rb
@@ -20,24 +20,26 @@ end
def callback
- code = params[:code]
+ token = Octokit.exchange_code_for_token(
+ params[:code],
+ client_id,
+ client_secret
+ ).access_token
- secrets = Rails.application.secrets
- client_id = secrets.github_client_id
- client_secret = secrets.github_client_secret
- response = Octokit.exchange_code_for_token code, client_id, client_secret
- token = response.access_token
+ username = Octokit::Client.new(access_token: token).user.login
+ user = User.where username: username
- remote = Octokit::Client.new access_token: token
- user = User.where(username: remote.user.login).first_or_create
- user.token = token
-
- remote.repositories.each do |repo|
- if repo.permissions.admin
- r = Repo.where(owner: repo.owner.login, name: repo.name).first_or_create
- r.user_id = user.id
- r.save
- end
+ if user.present?
+ user.update token: token
+ else
+ user = User.create(username: username, token: token)
+ user.remote.repositories
+ .select { |r| r.permissions.admin }
+ .each do |r|
+ Repo.where(owner: r.owner.login, name: r.name)
+ .first_or_create
+ .update user_id: user.id
+ end
end
sign_in user: user
| Tidy up the auth controller a bit
|
diff --git a/lib/selectivizr/rails/engine.rb b/lib/selectivizr/rails/engine.rb
index abc1234..def5678 100644
--- a/lib/selectivizr/rails/engine.rb
+++ b/lib/selectivizr/rails/engine.rb
@@ -2,7 +2,7 @@ module Rails
class Engine < ::Rails::Engine
initializer 'Selectivizr precompile hook', :group => :all do |app|
- app.config.assets.precompile += ['modernizr.js']
+ app.config.assets.precompile += ['selectivizr.js']
end
end
end
| Fix a huge, glaring error thanks to @graff
|
diff --git a/lib/haml/railtie.rb b/lib/haml/railtie.rb
index abc1234..def5678 100644
--- a/lib/haml/railtie.rb
+++ b/lib/haml/railtie.rb
@@ -26,7 +26,7 @@ require "haml/sass_rails_filter"
end
- if defined?(::Erubi) && const_defined?('ActionView::Template::Handlers::ERB::Erubi')
+ if const_defined?('ActionView::Template::Handlers::ERB::Erubi')
require "haml/helpers/safe_erubi_template"
Haml::Filters::RailsErb.template_class = Haml::SafeErubiTemplate
else
| Remove extraneous condition for Erubi |
diff --git a/lib/sub_diff/diff_collection.rb b/lib/sub_diff/diff_collection.rb
index abc1234..def5678 100644
--- a/lib/sub_diff/diff_collection.rb
+++ b/lib/sub_diff/diff_collection.rb
@@ -14,6 +14,7 @@ def initialize(diffable)
@diffable = diffable
@diffs = []
+ super(diffable)
end
def changed?
@@ -30,19 +31,12 @@ end
alias_method :<<, :push
- def __getobj__
- if diffs.any?
- diffs.join
- else
- diffable
- end
- end
-
private
def append(diff)
unless diff.empty?
@diffs << diff
+ __setobj__(diffs.join)
end
end
end
| Use __setobj__ instead of overwriting __getobj__
|
diff --git a/lib/zlown/cli/cmd/script_cmd.rb b/lib/zlown/cli/cmd/script_cmd.rb
index abc1234..def5678 100644
--- a/lib/zlown/cli/cmd/script_cmd.rb
+++ b/lib/zlown/cli/cmd/script_cmd.rb
@@ -15,7 +15,7 @@ end
cmd.desc 'Stop httpry'
- cmd.command 'start' do |script_cmd|
+ cmd.command 'stop' do |script_cmd|
script_cmd.action do |global_options, options, args|
Zlown::Script.httpry_stop(args, options)
end
| Fix typo 'start' -> 'stop'
|
diff --git a/lib/mytime/setup.rb b/lib/mytime/setup.rb
index abc1234..def5678 100644
--- a/lib/mytime/setup.rb
+++ b/lib/mytime/setup.rb
@@ -0,0 +1,36 @@+module Mytime
+ extend self
+
+ # Create .mytime file in the profile directory
+ # and insert the user account and Freshbooks token
+ #
+ def init
+ puts "What is your Freshbooks account url?"
+ account = STDIN.gets.chomp
+ puts "What is your Freshbooks token?"
+ token = STDIN.gets.chomp
+ contents = ["account" => account, "token" => token]
+ self.save(contents)
+ end
+
+ # Set configuration variables to values passed in the command line options
+ #
+ def parse_options(*args)
+ options = OptionParser.new do |opts|
+ opts.banner = "\nUsage: mytime [options] [command]"
+ opts.separator "mytime uses git to log your time\n\n"
+ opts.separator "Commands:"
+ opts.separator " list Prints all items"
+ opts.separator " init Bootstraps tacos in this directory"
+ opts.separator ""
+ opts.separator "Options:"
+ opts.on('-h', '--help', 'Display this screen') { puts opts; exit }
+ opts.on('-v', '--version', 'Display the current version') do
+ puts Mytime::VERSION
+ exit
+ end
+ end
+ options.parse!(args)
+ options
+ end
+end | Add methods responsible for initializing mytime
|
diff --git a/lib/patches/tire.rb b/lib/patches/tire.rb
index abc1234..def5678 100644
--- a/lib/patches/tire.rb
+++ b/lib/patches/tire.rb
@@ -2,6 +2,8 @@ module Results
class Item
+
+ attr_reader :attributes
def class
defined?(::Padrino) && @attributes[:_type] ? @attributes[:_type].camelize.constantize : super
@@ -10,22 +12,26 @@ end
end
+ end
+end
+module Tire
+ module Search
+
+ class Search
+
+ def min_score(value)
+ @min_score = value
+ self
+ end
+
+ end
end
-
end
module Tire
module Model
- # Main module containing the infrastructure for automatic updating
- # of the _ElasticSearch_ index on model instance create, update or delete.
- #
- # Include it in your model: `include Tire::Model::Callbacks`
- #
- # The model must respond to `after_save` and `after_destroy` callbacks
- # (ActiveModel and ActiveRecord models do so, by default).
- #
module Callbacks2
extend ActiveSupport::Concern
| Fix more methods in Tire
|
diff --git a/lib/onionjs.rb b/lib/onionjs.rb
index abc1234..def5678 100644
--- a/lib/onionjs.rb
+++ b/lib/onionjs.rb
@@ -0,0 +1,15 @@+module Onionjs
+ class Engine < Rails::Engine
+
+ initializer "onionjs" do |app|
+ app.assets.paths << app.root.join('app/assets/modules')
+
+ # If requirejs-rails is present, include mustache files in
+ # rake assets:precompile task (which uses r.js)
+ if app.config.respond_to?(:requirejs)
+ app.config.requirejs.logical_asset_filter += [/\.mustache$/]
+ end
+ end
+
+ end
+end
| Make it a (requirejs-rails - friendly) Rails Engine |
diff --git a/lib/tasks/sync.rake b/lib/tasks/sync.rake
index abc1234..def5678 100644
--- a/lib/tasks/sync.rake
+++ b/lib/tasks/sync.rake
@@ -1,11 +1,9 @@ namespace :sync do
desc "Broadcast all current publications states"
task :broadcast => :environment do
- Publication.all.each do |pub|
- if pub.has_published?
- print '.'
- Messenger.instance.published pub
- end
+ Publication.published.each do |pub|
+ print '.'
+ Messenger.instance.published pub
end
end
| Use the Publication.published scope to more efficiently pull out published stuff
|
diff --git a/lib/xhive/engine.rb b/lib/xhive/engine.rb
index abc1234..def5678 100644
--- a/lib/xhive/engine.rb
+++ b/lib/xhive/engine.rb
@@ -1,5 +1,18 @@+require "cells"
+
module Xhive
class Engine < ::Rails::Engine
isolate_namespace Xhive
+ ::Cell::Base.prepend_view_path('app/cells')
+ initializer "xhive.extend_application_controller" do
+ ActiveSupport.on_load(:action_controller) do
+ extend Xhive::Widgify
+ end
+ end
+ initializer "xhive.load_all_controller_classes" do
+ ActiveSupport.on_load(:action_controller) do
+ Dir[Rails.root.join("app/controllers/**/*.rb")].each {|f| require f}
+ end
+ end
end
end
| Load all controllers on initialization
|
diff --git a/SwiftyUserDefaults.podspec b/SwiftyUserDefaults.podspec
index abc1234..def5678 100644
--- a/SwiftyUserDefaults.podspec
+++ b/SwiftyUserDefaults.podspec
@@ -1,10 +1,10 @@ Pod::Spec.new do |s|
s.name = 'SwiftyUserDefaults'
- s.version = '3.0.1'
+ s.version = '4.0.0-alpha.1'
s.license = 'MIT'
s.summary = 'Swifty API for NSUserDefaults'
s.homepage = 'https://github.com/radex/SwiftyUserDefaults'
- s.authors = { 'Radek Pietruszewski' => 'this.is@radex.io' }
+ s.authors = { 'Radek Pietruszewski' => 'this.is@radex.io', 'Łukasz Mróz' => 'thesunshinejr@gmail.com' }
s.source = { :git => 'https://github.com/radex/SwiftyUserDefaults.git', :tag => s.version }
s.requires_arc = true
| Prepare podspec for version 4.0.0-alpha.1
|
diff --git a/lib/arrthorizer/rails/controller_action.rb b/lib/arrthorizer/rails/controller_action.rb
index abc1234..def5678 100644
--- a/lib/arrthorizer/rails/controller_action.rb
+++ b/lib/arrthorizer/rails/controller_action.rb
@@ -26,8 +26,8 @@ private
attr_writer :controller_path, :action_name
- def self.key_for(controller)
- "#{controller.controller_path}##{controller.action_name}"
+ def self.key_for(current)
+ "#{current.controller_path}##{current.action_name}"
end
def self.fetch(key)
| Improve variable naming in the key_for method
This eliminates doubt about whether this is a controller instance or a
controller class - it is just the current controller, executing the
current action.
|
diff --git a/lib/flying_sphinx/configuration_options.rb b/lib/flying_sphinx/configuration_options.rb
index abc1234..def5678 100644
--- a/lib/flying_sphinx/configuration_options.rb
+++ b/lib/flying_sphinx/configuration_options.rb
@@ -3,7 +3,7 @@
def initialize(raw = nil, version = nil)
@raw = raw || configuration.render
- @version = version || '2.2.3'
+ @version = version || '2.2.11'
end
def settings
| Use Sphinx 2.2.11 by default.
|
diff --git a/lib/generators/npush/toheroku_generator.rb b/lib/generators/npush/toheroku_generator.rb
index abc1234..def5678 100644
--- a/lib/generators/npush/toheroku_generator.rb
+++ b/lib/generators/npush/toheroku_generator.rb
@@ -35,7 +35,7 @@ end
end
- append_file 'app/assets/javascripts/application.js', '//= require socket.io.min.js'
+ prepend_file 'app/assets/javascripts/application.js', '//= require socket.io.min.js'
end
end
end
| Prepend requires instead of appending them + add semicolon at the end of client js initializer
|
diff --git a/lib/specinfra/command/smartos/base/file.rb b/lib/specinfra/command/smartos/base/file.rb
index abc1234..def5678 100644
--- a/lib/specinfra/command/smartos/base/file.rb
+++ b/lib/specinfra/command/smartos/base/file.rb
@@ -1,11 +1,11 @@ class Specinfra::Command::Smartos::Base::File < Specinfra::Command::Solaris::Base::File
class << self
def get_md5sum(file)
- "digest -a md5 -v #{escape(file)} | cut -d '=' -f 2 | cut -c 2-"
+ "/usr/bin/digest -a md5 -v #{escape(file)} | cut -d '=' -f 2 | cut -c 2-"
end
def get_sha256sum(file)
- "digest -a sha256 -v #{escape(file)} | cut -d '=' -f 2 | cut -c 2-"
+ "/usr/bin/digest -a sha256 -v #{escape(file)} | cut -d '=' -f 2 | cut -c 2-"
end
end
end
| Use full path to digest
This way we don't accidentally use the pkgsrc version
|
diff --git a/activesupport/lib/active_support/configuration_file.rb b/activesupport/lib/active_support/configuration_file.rb
index abc1234..def5678 100644
--- a/activesupport/lib/active_support/configuration_file.rb
+++ b/activesupport/lib/active_support/configuration_file.rb
@@ -33,7 +33,7 @@
File.read(content_path).tap do |content|
if content.include?("\u00A0")
- warn "File contains invisible non-breaking spaces, you may want to remove those"
+ warn "#{content_path} contains invisible non-breaking spaces, you may want to remove those"
end
end
end
| Include file path in invisible space warning
While the warning is useful in itself, it doesn't tell you what file is
specifically causing the issue which can make resolving it harder than
it should be. As we've got the path already, we can simply include the
location of the problematic file in the warning message.
|
diff --git a/lib/qbwc_requests/item_service/v07/mod.rb b/lib/qbwc_requests/item_service/v07/mod.rb
index abc1234..def5678 100644
--- a/lib/qbwc_requests/item_service/v07/mod.rb
+++ b/lib/qbwc_requests/item_service/v07/mod.rb
@@ -0,0 +1,19 @@+module QbwcRequests
+ module ItemService
+ module V07
+ class Mod < QbwcRequests::Base
+
+ field :list_id
+ field :edit_sequence
+ field :name
+ field :is_active
+ ref_to :parent, 31
+ ref_to :unit_of_measure_set, 31
+ ref_to :sales_tax_code, 3
+ field :sales_or_purchase_mod
+ field :sales_and_purchase_mod
+
+ end
+ end
+ end
+end
| Allow service items to be updated
|
diff --git a/recipes/default.rb b/recipes/default.rb
index abc1234..def5678 100644
--- a/recipes/default.rb
+++ b/recipes/default.rb
@@ -0,0 +1,27 @@+#
+# Author:: Joshua Timberman (<joshua@opscode.com>)
+# Cookbook Name:: apparmor
+# Recipe:: default
+#
+# Copyright 2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+case node[:platform]
+when "ubuntu"
+ service "apparmor" do
+ action :stop
+ end
+end
+ | Add apparmor recipe (ubuntu only)
|
diff --git a/config/initializers/unlimited_strength_cryptography.rb b/config/initializers/unlimited_strength_cryptography.rb
index abc1234..def5678 100644
--- a/config/initializers/unlimited_strength_cryptography.rb
+++ b/config/initializers/unlimited_strength_cryptography.rb
@@ -2,4 +2,15 @@ begin
java.lang.Class.for_name('javax.crypto.JceSecurity').get_declared_field('isRestricted').tap{|f| f.accessible = true; f.set nil, false}
rescue
+ Rails.logger.warn <<-EOF
+
+ You may not have unlimited strength cryptography installed. There's a
+ known issue with Rails 4.0, jruby, and cryptography in the JVM. Please visit
+ https://github.com/jruby/jruby/wiki/UnlimitedStrengthCrypto if you encounter
+ failures during startup. If things are running fine you can ignore this message
+ and remove the intializer.
+
+ Exception: #{$!}
+ Trace: #{$@.join("\n")}
+ EOF
end
| Add some logging for the cursed crytography issue with rails and jruby
|
diff --git a/lib/possibly.rb b/lib/possibly.rb
index abc1234..def5678 100644
--- a/lib/possibly.rb
+++ b/lib/possibly.rb
@@ -3,7 +3,7 @@ ([:each] + Enumerable.instance_methods).each do |enumerable_method|
define_method(enumerable_method) { |*args, &block|
res = __enumerable_value.send(enumerable_method, *args, &block)
- if res.respond_to?(:each) then Maybe(res[0]) else res end
+ if res.respond_to?(:each) then Maybe(res.first) else res end
}
end
end
| Use first instead of accessing by id
|
diff --git a/lib/conceptql/nodes/drug_type_concept.rb b/lib/conceptql/nodes/drug_type_concept.rb
index abc1234..def5678 100644
--- a/lib/conceptql/nodes/drug_type_concept.rb
+++ b/lib/conceptql/nodes/drug_type_concept.rb
@@ -0,0 +1,18 @@+require_relative 'node'
+
+module ConceptQL
+ module Nodes
+ class DrugTypeConcept < Node
+ def type
+ :drug_exposure
+ end
+
+ def query(db)
+ db.from(:drug_exposure)
+ .where(drug_type_concept_id: arguments)
+ end
+ end
+ end
+end
+
+
| DrugConceptType: Add a prototype for this criterion node
|
diff --git a/lib/miq_pglogical/connection_handling.rb b/lib/miq_pglogical/connection_handling.rb
index abc1234..def5678 100644
--- a/lib/miq_pglogical/connection_handling.rb
+++ b/lib/miq_pglogical/connection_handling.rb
@@ -15,8 +15,15 @@ end
def pglogical(refresh = false)
- @pglogical = nil if refresh
- @pglogical ||= PG::LogicalReplication::Client.new(pg_connection)
+ # TODO: Review if the reasons behind the previous caching / refreshing
+ # of the PG::LogicalReplication::Client
+ #
+ # @pglogical = nil if refresh
+ # @pglogical ||= PG::LogicalReplication::Client.new(pg_connection)
+ #
+ # is still relevant as it caused segfaults with rails 6 when the
+ # caching was in place.
+ PG::LogicalReplication::Client.new(pg_connection)
end
end
| Remove class cache called in threads to avoid timing issues
Fixes #20979
The first two calls of the class method pg_logical can and are often called in threads,
leading to race conditions with two threads sharing the same PG::LogicalReplication::Client
object, ultimately ending in various fatal errors including segmentation faults, bad file
descriptor, and malloc (double free for ptr) errors. This is by no means limited to two
threads, with more threads in puma, it's more likely that two threads compete and trip
each other in code that is not thread safe.
Many of the backtraces seen in #20979 show the following area of code:
```
pg-1.2.3/lib/pg/basic_type_mapping.rb:120:in `exec'
pg-1.2.3/lib/pg/basic_type_mapping.rb:120:in `build_coder_maps'
pg-1.2.3/lib/pg/basic_type_mapping.rb:402:in `initialize'
pg-logical_replication-1.0.0/lib/pg/logical_replication/client.rb:316:in `new'
```
We don't know the exact cause of the fatal errors listed above but my best guess follows.
It's important to point out that each PG::LogicalReplication::Client is initialized with a
ApplicationRecord.connection.raw_connection object called from pg_connection[1] and caching
this Client object via the pg_logical method bypasses the normal connection handler/connection
pool code which is meant to handle multiple threads.
When we remove this Client caching, each thread initializes their own Client, leading to separate
calls to ApplicationRecord.connection.raw_connection via the connection method which goes through
the connection handler/connection pool.
Ultimately, we'll need to determine if that caching was needed for performance or consistency
reasons, but we can solve that later. The initial caching was added here[2] at a time when the
cached object kept a reference to the connection, not the connection.raw_connection as it does now,
so some code around this change has moved. During the rails 6 upgrade, some of this code was moved
in two pull requests [3][4] and could be in play.
[1] https://github.com/ManageIQ/manageiq/blob/ae1b5cacb3ac65b0317fd353a11e1f217870b291/lib/miq_pglogical/connection_handling.rb#L19
[2] https://github.com/ManageIQ/manageiq/commit/733da742d4264c9068584bd0c321a3950efea8df#diff-491fdea69d5c969405eff4d87c23d1751b955161e7b888a5af038892122eba2aR92
[3] https://github.com/ManageIQ/manageiq/pull/20841
[4] https://github.com/ManageIQ/manageiq/pull/20856
|
diff --git a/lib/rock_doc/interrogation/controller.rb b/lib/rock_doc/interrogation/controller.rb
index abc1234..def5678 100644
--- a/lib/rock_doc/interrogation/controller.rb
+++ b/lib/rock_doc/interrogation/controller.rb
@@ -17,13 +17,30 @@
if configuration.controller_class.respond_to?(:permitted_params) && configuration.controller_class.permitted_params
- params_hash = configuration.controller_class.permitted_params
- params_hash[params_hash.keys.first] = params_hash[params_hash.keys.first].map do |attribute|
- type = configuration.resource_class.columns_hash[attribute].type.to_s.capitalize rescue "String"
- [attribute, type]
- end.to_h
- configuration.attributes_for_permitted_params ||= params_hash
+ params_hash = {}
+ configuration.attributes_for_permitted_params ||= attribute_set params_hash, configuration, configuration.controller_class.permitted_params
end
+ end
+
+ protected
+ def self.attribute_set memo, configuration, working_set
+ if working_set.is_a? Hash
+ working_set.keys.each do |key|
+ memo[key] = {}
+ attribute_set memo[key], configuration, working_set[key]
+ end
+ elsif working_set.is_a? Array
+ working_set.map do |k|
+ if k.is_a? Hash
+ memo = attribute_set memo, configuration, k
+ else
+ type = configuration.resource_class.columns_hash[k].type.to_s.capitalize rescue "String"
+ memo[k] = type
+ end
+ end
+ end
+
+ memo
end
end
end
| Fix a bug with permitted param hashes
|
diff --git a/lib/rubocop/cop/style/space_after_not.rb b/lib/rubocop/cop/style/space_after_not.rb
index abc1234..def5678 100644
--- a/lib/rubocop/cop/style/space_after_not.rb
+++ b/lib/rubocop/cop/style/space_after_not.rb
@@ -16,9 +16,9 @@ MSG = 'Do not leave space between `!` and its argument.'.freeze
def on_send(node)
+ return unless node.keyword_bang?
+
receiver, _method_name, *_args = *node
-
- return unless node.keyword_bang?
return unless receiver.loc.column - node.loc.column > 1
add_offense(node, :expression)
| Reorder some code to make it a bit more efficient
|
diff --git a/lib/parallelios/cli.rb b/lib/parallelios/cli.rb
index abc1234..def5678 100644
--- a/lib/parallelios/cli.rb
+++ b/lib/parallelios/cli.rb
@@ -5,6 +5,51 @@ module Parallelios
# Command-Line Interfaces of project
class CLI < Thor
+ # Command-Line Interface help.
+ #
+ # shell - String command name
+ # subcommand - Optional Boolian(defaults to false)
+ #
+ # Examples
+ #
+ # help # => Information about all command in CLI
+ #
+ # help('start') # => Information about command 'start'
+ #
+ # Returns String.
+ def self.help(shell, subcommand = false)
+ super
+ command_help(shell, default_task)
+ end
+
+ default_task :start
+
+ desc 'start', 'Start tests'
+
+ long_desc <<-LONGDESC
+ `parallelios start` run tests with options
+
+ Example:
+
+ > $ parallelios start
+
+ Tests running...
+ LONGDESC
+
+ method_option :config, type: :string, aliases: '-c', banner: 'Specify a configuration file(parallelios.yml)'
+
+ # Start tests.
+ #
+ # Examples
+ #
+ # start # => Run tests
+ #
+ # Returns Integer.
+ def start
+ puts devices
+ exit(0)
+ end
+
desc 'devices', 'show all connected devices'
long_desc <<-LONGDESC
@@ -18,13 +63,13 @@ \x5> MacBook Pro [505FA61D-D7F6-5150-8E3D-ASSFS899CBCB]
LONGDESC
- # Print connected devices
+ # Print connected devices.
#
# Examples
#
# devices # => "Known Devices:\nMacBook Pro [505FA61D-D7F6-5150-8E3D-ASSFS899CBCB]"
#
- # Returns String
+ # Returns String.
def devices
puts `instruments -s devices | grep -v '(Simulator)'`
end
| Create help and start test methods for CLI
|
diff --git a/lib/rubygems_plugin.rb b/lib/rubygems_plugin.rb
index abc1234..def5678 100644
--- a/lib/rubygems_plugin.rb
+++ b/lib/rubygems_plugin.rb
@@ -2,5 +2,5 @@
Gem::CommandManager.instance.register_command :sign
Gem::CommandManager.instance.register_command :verify
-Gem::CommandManager.instance.register_command :vinstall
-Gem::CommandManager.instance.register_command :sbuild
+#Gem::CommandManager.instance.register_command :vinstall
+#Gem::CommandManager.instance.register_command :sbuild
| Disable vinstall and sbuild totally
|
diff --git a/linked_list_reverse.rb b/linked_list_reverse.rb
index abc1234..def5678 100644
--- a/linked_list_reverse.rb
+++ b/linked_list_reverse.rb
@@ -0,0 +1,36 @@+class Node
+ attr_accessor :value, :next
+
+ def initialize(value)
+ @value = value
+ @next = nil
+ end
+
+end
+
+def reverseList(head_of_list)
+ current = head_of_list
+ previous = nil
+ next_node = nil
+
+ while current
+ next_node = current.next
+
+ current.next = previous
+
+ previous = current
+
+ current = next_node
+ end
+
+ return previous
+end
+
+a = Node.new(1)
+b = Node.new(2)
+c = Node.new(3)
+
+a.next = b
+b.next = c
+
+p reverseList(a)
| Create linked list reverse function
|
diff --git a/metadater.rb b/metadater.rb
index abc1234..def5678 100644
--- a/metadater.rb
+++ b/metadater.rb
@@ -15,7 +15,7 @@ # These are the filetypes we consider to be videos
# All others are not videos and we care nothing for them
# Note that we will also scan files with no extensions.
-@@filetypes = [ '.mov', '.avi', '.mp4', '.mts' ]
+@@filetypes = [ '.mov', '.avi', '.mp4', '.mts', '.mkv' ]
@@files = [] # Let's leave this empty for later
$metadata = [] # This too
| Add MKV to the extension whitelist
|
diff --git a/lib/rtasklib.rb b/lib/rtasklib.rb
index abc1234..def5678 100644
--- a/lib/rtasklib.rb
+++ b/lib/rtasklib.rb
@@ -10,7 +10,7 @@ module Rtasklib
class TaskWarrior
- attr_reader :version, :data_location, :taskrc, :create_new,
+ attr_reader :version, :data_location, :taskrc,
:override, :override_a, :override_str
include Controller
@@ -30,7 +30,7 @@ override_h = DEFAULTS.merge({data_location: data}).merge(opts)
@override = Taskrc.new(override_h, :hash)
@override_a = override.model_to_rc
- @config = get_rc
+ @taskrc = get_rc
# Check TaskWarrior version, and throw warning if unavailable
begin
| Use less confusing naming convention for the taskrc model
|
diff --git a/lib/bidu/house/error_report.rb b/lib/bidu/house/error_report.rb
index abc1234..def5678 100644
--- a/lib/bidu/house/error_report.rb
+++ b/lib/bidu/house/error_report.rb
@@ -36,7 +36,7 @@
def as_json
{
- ids: scoped.map(&external_key),
+ ids: scoped.pluck(external_key),
percentage: percentage
}
end
| Use pluck for better performance
|
diff --git a/examples/marketplace/classical-moip-account-flow-with-company.rb b/examples/marketplace/classical-moip-account-flow-with-company.rb
index abc1234..def5678 100644
--- a/examples/marketplace/classical-moip-account-flow-with-company.rb
+++ b/examples/marketplace/classical-moip-account-flow-with-company.rb
@@ -0,0 +1,69 @@+# Here is an example of creating an Moip account using the Moip account API
+
+auth = Moip2::Auth::OAuth.new("502f9ca0eccc451dbcf8c0b940110af1_v2")
+
+client = Moip2::Client.new(:sandbox, auth)
+
+api = Moip2::Api.new(client)
+
+account = api.accounts.create(
+ email: {
+ address: "dev.moip@labs.moip.com.br",
+ },
+ person: {
+ name: "Joaquim José",
+ lastName: "Silva Silva",
+ taxDocument: {
+ type: "CPF",
+ number: "978.443.610-85",
+ },
+ identityDocument: {
+ type: "RG",
+ number: "35.868.057-8",
+ issuer: "SSP",
+ issueDate: "2000-12-12",
+ },
+ birthDate: "1990-01-01",
+ phone: {
+ countryCode: "55",
+ areaCode: "11",
+ number: "965213244",
+ },
+ address: {
+ street: "Av. Brigadeiro Faria Lima",
+ streetNumber: "2927",
+ district: "Itaim",
+ zipCode: "01234-000",
+ city: "S\u00E3o Paulo",
+ state: "SP",
+ country: "BRA",
+ },
+ },
+ company: {
+ name: "Company Test",
+ businessName: "Razão Social Test",
+ address: {
+ street: "Av. Brigadeiro Faria Lima",
+ streetNumber: "4530",
+ district: "Itaim",
+ city: "São Paulo",
+ state: "SP",
+ country: "BRA",
+ zipCode: "01234000",
+ },
+ mainActivity: {
+ cnae: "82.91-1/00",
+ description: "Atividades de cobranças e informações cadastrais",
+ },
+ taxDocument: {
+ type: "CNPJ",
+ number: "61.148.461/0001-09",
+ },
+ phone: {
+ countryCode: "55",
+ areaCode: "11",
+ number: "975142244",
+ },
+ },
+ type: "MERCHANT",
+)
| Add example of creating moip account with company
|
diff --git a/lib/express_templates/components/forms/basic_fields.rb b/lib/express_templates/components/forms/basic_fields.rb
index abc1234..def5678 100644
--- a/lib/express_templates/components/forms/basic_fields.rb
+++ b/lib/express_templates/components/forms/basic_fields.rb
@@ -3,7 +3,7 @@ module Forms
module BasicFields
ALL = %w(email phone text password color date datetime
- datetime_local number range
+ datetime_local file number range
search telephone time url week)
ALL.each do |type|
| Add `file` type for basic field form component
- this introduce input field with file type mainly use for image uploading
|
diff --git a/week-6/validate-credit-card/my_solution.rb b/week-6/validate-credit-card/my_solution.rb
index abc1234..def5678 100644
--- a/week-6/validate-credit-card/my_solution.rb
+++ b/week-6/validate-credit-card/my_solution.rb
@@ -18,8 +18,41 @@
class CreditCard
+ def initialize(number)
+ if number.to_s.length != 16
+ raise ArgumentError.new ("Must be 16 digits")
+ else
+ @number = number
+ end
+ end
+
+ def check_card
+ new_array = @number.to_s.split("")
+ new_array.each_with_index do |item, index|
+ if index % 2 == 0
+ new_array[index] = item.to_i * 2
+ else
+ new_array[index] = item.to_i
+ end
+ end
+ new_array.each_with_index do |item, index|
+ if item >= 10
+ new_array[index] = item - 10
+ new_array.push(1)
+ end
+ end
+ if new_array.reduce(:+) % 10 == 0
+ return true
+ else
+ return false
+ end
+ end
+
end
+card = CreditCard.new(1266123412341234)
+
+p card.check_card
# Refactored Solution
| Complete pair challenge credit card
|
diff --git a/Casks/iterm2.rb b/Casks/iterm2.rb
index abc1234..def5678 100644
--- a/Casks/iterm2.rb
+++ b/Casks/iterm2.rb
@@ -11,6 +11,8 @@ license :gpl
auto_updates true
+ depends_on macos: '>= :lion'
+ depends_on arch: :intel
app 'iTerm.app'
| Update iTerm2: depends_on macos and arch
|
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
@@ -5,4 +5,15 @@ has_many :events_attended, through: :attendances, source: :event
has_many :sent_nudges, class_name: "Nudge", foreign_key: :nudger_id
has_many :recieved_nudges, class_name: "Nudge", foreign_key: :nudgee_id
+ # TODO: TOS acceptance, password strength checks
+ before_validation do
+ self.phone = self.phone.gsub(/[^\d]/, '') unless self.phone.blank?
+ end
+ validates_presence_of :email, :username, :phone, :school_id
+ validates_uniqueness_of :email, :username # :phone
+ validates :email, format: {
+ with: /\A([\w+\-].?)+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/i
+ }
+ validates :password, length: { minimum: 10 }, allow_nil: true
+ validates :phone, length: { is: 10 }
end
| Add ActiveRecord validations to model
|
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
@@ -12,7 +12,7 @@ # Setup accessible (or protected) attributes for your model
attr_accessible :email, :first_name, :last_name, :password, :password_confirmation, :remember_me
- scope :agents, where("role = ? OR ?", "agent", "admin")
+ scope :agents, where("role = ? OR role = ?", "agent", "admin")
scope :admins, where(:role => "admin")
ROLES = %w[customer agent admin]
| Fix SQL query syntax so we get agents and admins |
diff --git a/deployment_scripts/puppet/modules/contrail/lib/puppet/parser/functions/get_physdev_mtu.rb b/deployment_scripts/puppet/modules/contrail/lib/puppet/parser/functions/get_physdev_mtu.rb
index abc1234..def5678 100644
--- a/deployment_scripts/puppet/modules/contrail/lib/puppet/parser/functions/get_physdev_mtu.rb
+++ b/deployment_scripts/puppet/modules/contrail/lib/puppet/parser/functions/get_physdev_mtu.rb
@@ -11,7 +11,7 @@ interfaces = cfg[:interfaces]
transformations.each do |transform|
- if (transform[:action] == 'add-bond') && (transform[:name] == physdev)
+ if transform[:name] == physdev
mtu = transform[:mtu]
return mtu if mtu
end
| Fix function that get mtu for vhost0
On dpdk computes function get_physdev_mtu dont get right mtu
because we override action for bond0 to noop.
[DE271493]
Change-Id: I12d317df777cf503408aa28152634206d11c1e5a
|
diff --git a/app/controllers/api/v1/needs_controller.rb b/app/controllers/api/v1/needs_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/v1/needs_controller.rb
+++ b/app/controllers/api/v1/needs_controller.rb
@@ -5,15 +5,11 @@ before_filter :authenticate_user!
def create
- sparams = params['data']['attributes']
+ sparams = params['data']['attributes']
start_time = sparams['start-time']
- end_time = sparams['end-time']
- user_id = current_user.id
-
- need = Need.create!(start_time: start_time, end_time: end_time, user_id: user_id)
- need.save
-
- need_json = JSONAPI::ResourceSerializer.new(NeedResource).serialize_to_hash(NeedResource.new(need, nil))
+ end_time = sparams['end-time']
+ need = current_user.needs.create!(start_time: start_time, end_time: end_time)
+ need_json = JSONAPI::ResourceSerializer.new(NeedResource).serialize_to_hash(NeedResource.new(need, nil))
render json: need_json
end
| Clean up needs create action
|
diff --git a/app/controllers/api/version1_controller.rb b/app/controllers/api/version1_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/version1_controller.rb
+++ b/app/controllers/api/version1_controller.rb
@@ -3,13 +3,14 @@ before_filter :set_site
def get_proxy
- result = @site.select_proxy(params[:older_than])
+ older_than = (params[:older_than] || -1).to_i
+ result = @site.select_proxy(older_than)
if result == Proxy::NoProxy
- render json: Response::try_again
+ render json: Responses::try_again
elsif result.is_a? Proxy::NoColdProxy
- render json: Response::try_again(result.timeout)
+ render json: Responses::try_again(result.timeout)
else
- render json: Response::success(result)
+ render json: Responses::success(result)
end
end
@@ -24,7 +25,7 @@ rescue ActiveRecord::RecordNotFound => e
# Swallow not-found-type errors
end
- render json: Response::success
+ render json: Responses::success
end
private
| Fix NameError and parameter handling
|
diff --git a/app/controllers/leaderboards_controller.rb b/app/controllers/leaderboards_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/leaderboards_controller.rb
+++ b/app/controllers/leaderboards_controller.rb
@@ -1,23 +1,14 @@ class LeaderboardsController < ApplicationController
def data
- players = {}
+ players = Hash.new do |hash, key|
+ hash[key] = Elo::Player.new
+ end
formatted_club_name = params[:club_id].gsub(/-/, ' ')
matches = Match.joins(:club).where('lower(clubs.name) = ?', formatted_club_name).order(created_at: 'desc')
matches.each do |match|
- winner = match['winner']
- loser = match['loser']
-
- if (!players.has_key? winner)
- players[winner] = Elo::Player.new
- end
-
- if (!players.has_key? loser)
- players[loser] = Elo::Player.new
- end
-
- players[winner].wins_from(players[loser])
+ players[match.winner].wins_from(players[match.loser])
end
sorted_players = players.sort_by { |name, player| player.rating}.reverse!
| Use a hash default in calculating the leaderboard.
|
diff --git a/lib/communicator/tasks.rb b/lib/communicator/tasks.rb
index abc1234..def5678 100644
--- a/lib/communicator/tasks.rb
+++ b/lib/communicator/tasks.rb
@@ -21,12 +21,20 @@ Communicator::Client.push
rescue => err
report_exception err, "Status" => "Sync failed while trying to PUSH messages"
+ raise err
end
begin
Communicator::Client.pull
rescue => err
report_exception err, "Status" => "Sync failed while trying to PULL messages"
+ raise err
end
end
+
+ desc "Purges inbound and outbound messages - USE WITH CAUTION!!"
+ task :purge => :environment do
+ Communicator::InboundMessage.delete_all
+ Communicator::OutboundMessage.delete_all
+ end
end | Make sure captured exceptions on communication are re-raised.
Added communicator:purge rake-Task to clear message tables.
|
diff --git a/lib/cucumber/jira/soap.rb b/lib/cucumber/jira/soap.rb
index abc1234..def5678 100644
--- a/lib/cucumber/jira/soap.rb
+++ b/lib/cucumber/jira/soap.rb
@@ -16,10 +16,10 @@ Cucumber::Jira.client.login(username, password)
rescue Handsoap::Fault => e
if prompt
- puts 'Enter your username: '
- username = $stdin.gets
+ print 'Enter your username: '
+ username = $stdin.gets.chomp
- puts 'Enter your password: '
+ print 'Enter your password: '
password = $stdin.noecho(&:gets).chomp
Cucumber::Jira.client.login(username, password)
| Update the username/password prompt in Cucumber::Jira.login
|
diff --git a/lib/daemons/gpx_import.rb b/lib/daemons/gpx_import.rb
index abc1234..def5678 100644
--- a/lib/daemons/gpx_import.rb
+++ b/lib/daemons/gpx_import.rb
@@ -27,7 +27,7 @@ Notifier::deliver_gpx_failure(trace, '0 points parsed ok. Do they all have lat,lng,alt,timestamp?')
end
rescue Exception => ex
- logger.info ex
+ logger.info ex.to_s
ex.backtrace.each {|l| logger.info l }
trace.destroy
Notifier::deliver_gpx_failure(trace, ex.to_s + "\n" + ex.backtrace.join("\n"))
| Fix exception handling in GPX importer.
|
diff --git a/app/models/cfp/proposal.rb b/app/models/cfp/proposal.rb
index abc1234..def5678 100644
--- a/app/models/cfp/proposal.rb
+++ b/app/models/cfp/proposal.rb
@@ -2,7 +2,7 @@
module Cfp
class Proposal < ActiveRecord::Base
- RANK_SCALE = (0..2).to_a
+ RANK_SCALE = (0..5).to_a
TALK_LEVEL = %w(beginner intermediate advanced)
LANGUAGE = %w(English Español)
| Change evaluation range to 0..5 |
diff --git a/app/models/group_member.rb b/app/models/group_member.rb
index abc1234..def5678 100644
--- a/app/models/group_member.rb
+++ b/app/models/group_member.rb
@@ -23,7 +23,7 @@
has_many :meetings, through: :group
has_many :meeting_memberships,
- lambda(group_member) {
+ lambda { |group_member|
where(meeting_members: { userid: group_member.userid })
},
through: :meetings, source: :meeting_members
| Use correct multiline lambda syntax
|
diff --git a/app/models/hound_config.rb b/app/models/hound_config.rb
index abc1234..def5678 100644
--- a/app/models/hound_config.rb
+++ b/app/models/hound_config.rb
@@ -3,6 +3,7 @@ BETA_LANGUAGES = %w(
eslint
jscs
+ jshint
mdast
python
swift
| Mark `JsHint` as a beta language
|
diff --git a/spec/classes/trove_db_postgresql_spec.rb b/spec/classes/trove_db_postgresql_spec.rb
index abc1234..def5678 100644
--- a/spec/classes/trove_db_postgresql_spec.rb
+++ b/spec/classes/trove_db_postgresql_spec.rb
@@ -34,13 +34,14 @@ }).each do |os,facts|
context "on #{os}" do
let (:facts) do
- facts.merge(OSDefaults.get_facts())
+ facts.merge(OSDefaults.get_facts({
+ # puppet-postgresql requires the service_provider fact provided by
+ # puppetlabs-postgresql.
+ :service_provider => 'systemd'
+ }))
end
- # TODO(tkajinam): Remove this once puppet-postgresql supports CentOS 9
- unless facts[:osfamily] == 'RedHat' and facts[:operatingsystemmajrelease].to_i >= 9
- it_configures 'trove::db::postgresql'
- end
+ it_configures 'trove::db::postgresql'
end
end
| Revert "CentOS 9: Disable unit tests dependent on puppet-postgresql"
This reverts commit d07a47d2cbc51456a89936c3751013297fac96e9.
Reason for revert:
puppet-postgresql 8.1.0 was released and now the module supports RHEL 9
(and CentOS 9 effectively).
Note:
This change adds the service_provider fact in test fact data because
it is required by puppet-postgresql.
Depends-on: https://review.opendev.org/850705
Change-Id: Ib3e5b82c9685505465d19ab5b12987f020f74076
|
diff --git a/spec/classes/trove_db_postgresql_spec.rb b/spec/classes/trove_db_postgresql_spec.rb
index abc1234..def5678 100644
--- a/spec/classes/trove_db_postgresql_spec.rb
+++ b/spec/classes/trove_db_postgresql_spec.rb
@@ -2,21 +2,13 @@
describe 'trove::db::postgresql' do
- let :req_params do
- { :password => 'pw' }
- end
+ shared_examples_for 'trove::db::postgresql' do
+ let :req_params do
+ { :password => 'pw' }
+ end
- let :pre_condition do
- 'include postgresql::server'
- end
-
- context 'on a RedHat osfamily' do
- let :facts do
- @default_facts.merge({
- :osfamily => 'RedHat',
- :operatingsystemrelease => '7.0',
- :concat_basedir => '/var/lib/puppet/concat'
- })
+ let :pre_condition do
+ 'include postgresql::server'
end
context 'with only required parameters' do
@@ -32,27 +24,19 @@
end
- context 'on a Debian osfamily' do
- let :facts do
- @default_facts.merge({
- :operatingsystemrelease => '7.8',
- :operatingsystem => 'Debian',
- :osfamily => 'Debian',
- :concat_basedir => '/var/lib/puppet/concat'
- })
- end
-
- context 'with only required parameters' do
- let :params do
- req_params
+ on_supported_os({
+ :supported_os => OSDefaults.get_supported_os
+ }).each do |os,facts|
+ context "on #{os}" do
+ let (:facts) do
+ facts.merge(OSDefaults.get_facts({
+ :processorcount => 8,
+ :concat_basedir => '/var/lib/puppet/concat'
+ }))
end
- it { is_expected.to contain_postgresql__server__db('trove').with(
- :user => 'trove',
- :password => 'md5e12ef276d200761a0808f17a5b076451'
- )}
+ it_configures 'trove::db::postgresql'
end
-
end
end
| Test multiple operating systems for trove::db::postgresql
Change-Id: I93a9877415f0d7f8d48500f08ae2376c91ee3d06
|
diff --git a/spec/functional/topic_management_spec.rb b/spec/functional/topic_management_spec.rb
index abc1234..def5678 100644
--- a/spec/functional/topic_management_spec.rb
+++ b/spec/functional/topic_management_spec.rb
@@ -21,6 +21,9 @@ end
example "create partitions" do
+ unless kafka.support_api?(Kafka::Protocol::CREATE_PARTITIONS_API)
+ skip("This Kafka version not support ")
+ end
topic = generate_topic_name
kafka.create_topic(topic, num_partitions: 3)
@@ -31,6 +34,9 @@ end
example "validate partition creation" do
+ unless kafka.support_api?(Kafka::Protocol::CREATE_PARTITIONS_API)
+ skip("This Kafka version not support ")
+ end
topic = generate_topic_name
kafka.create_topic(topic, num_partitions: 3)
| Check for the API support before running tests |
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/admin/users_controller.rb
+++ b/app/controllers/admin/users_controller.rb
@@ -2,7 +2,7 @@ before_filter :load_user, only: [:show, :edit, :update]
def index
- @users = User.all(:include => {organisation: [:translations]}).sort_by { |u| u.fuzzy_last_name.downcase }
+ @users = User.all(include: {organisation: [:translations]}).sort_by { |u| u.fuzzy_last_name.downcase }
end
def show
| Fix Ruby 1.8 hash syntax
|
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -1,16 +1,26 @@ class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
- protect_from_forgery with: :exception
+ protect_from_forgery with: :null_session
- helper_method :current_user, :logged_in?
+ helper_method :current_user, :logged_in?, :authenticate!
def current_user
- @current_user ||= User.find_by_id(session[:user_id]) if session[:user_id]
+ @current_user ||= authenticate!
end
def logged_in?
current_user != nil
end
+ def authenticate!
+ begin
+ token = request.headers['Authorization'].split(' ').last
+ payload, header = AuthToken.valid?(token)
+ @current_user = User.find_by(id: payload['user_id'])
+ rescue
+ render json: { error: 'Authorization header not valid'}, status: :unauthorized
+ end
+ end
+
end
| Add authenticate helper method to application controller
|
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -15,5 +15,4 @@ devise_parameter_sanitizer.for(:sign_up) << :last_name
devise_parameter_sanitizer.for(:sign_up) << :phone
end
-
end
| Fix for rubocop in application controller
|
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -11,7 +11,7 @@ def adjust_format_for_iphone
user_agent = request.env['HTTP_USER_AGENT']
- if user_agent.present? && user_agent =~ /(AppleWebKit.+Mobile)/
+ if user_agent.present? && user_agent =~ /(iPhone)/
request.format = :iphone
end
end
| Check for iPhone instead of AppleWebKit Mobile.
|
diff --git a/app/controllers/newsletters_controller.rb b/app/controllers/newsletters_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/newsletters_controller.rb
+++ b/app/controllers/newsletters_controller.rb
@@ -44,7 +44,7 @@ end
def validate_permission
- unless current_user.permissions.include?('newsletters')
+ unless current_user.permissions.include?(:newsletters)
flash[:error] = 'You do not have permission to edit Newsletters.'
redirect_to '/admin'
end
| Fix permission check in newsletters controller
|
diff --git a/app/controllers/posts/homes_controller.rb b/app/controllers/posts/homes_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/posts/homes_controller.rb
+++ b/app/controllers/posts/homes_controller.rb
@@ -7,7 +7,7 @@ # GET /homes
# GET /homes.json
def index
- @homes = Home.online
+ @homes = Home.includes(:translations).online
seo_tag_index category
respond_to do |format|
| Improve SQL request on homepage
|
diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api_controller.rb
+++ b/app/controllers/api_controller.rb
@@ -14,13 +14,19 @@ @control_blocks = ControlBlock.find( :all,
:conditions => [ "base_station_id = ? AND deactivated_At IS NULL", @base_station.id ] )
end
+ else
+ render :nothing => true, :status => 404
end
end
def submit
@base_station = BaseStation.find_by_mac_address(params[:mac])
- @base_station.handle_submissions(request.POST)
- render :nothing => true
+ if @base_station
+ @base_station.handle_submissions(request.POST)
+ render :nothing => true
+ else
+ render :nothing => true, :status => 404
+ end
end
def test
| Return 404 on api if base station doesn't exist
|
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -4,7 +4,7 @@ IPAddr::RE_IPV6ADDRLIKE_COMPRESSED)
def apps_hosts
- hosts = %w(oregon us eu tokyo).map{|region| "ping-#{region}.herokuapp.com"}
+ hosts = %w(oregon us eu sydney tokyo).map{|region| "ping-#{region}.herokuapp.com"}
if request and not request.host.blank?
hosts.reject!{|host| host == request.host}
end
| Add host for Sydney region
|
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -22,7 +22,7 @@ reverse: true,
description: meta_description,
og: {
- image: @article.try(:eye_catching_image_url) ? @article.try(:eye_catching_image_url) : weblog.default_eye_catching_image_url,
+ image: @article.try(:eye_catching_image_url).blank? ? weblog.default_eye_catching_image_url : @article.eye_catching_image_url,
type: @article ? 'article' : 'website'
}
}
| Fix og:iamge is always empty
|
diff --git a/app/models/content_item_expanded_links.rb b/app/models/content_item_expanded_links.rb
index abc1234..def5678 100644
--- a/app/models/content_item_expanded_links.rb
+++ b/app/models/content_item_expanded_links.rb
@@ -2,22 +2,7 @@ include ActiveModel::Model
attr_accessor :content_id, :previous_version
- # Temporarily disable ordered_related_items. We can't allow users
- # to edit these in content tagger until the interface is removed from
- # panopticon, because panopticon doesn't read tags from publishing api,
- # and could overwrite them.
- #
- # We'll remove it from panopticon when the javascript is done.
- # https://github.com/alphagov/content-tagger/pull/245
- LIVE_TAG_TYPES = %i(
- taxons
- mainstream_browse_pages
- parent
- topics
- organisations
- ).freeze
-
- TEST_TAG_TYPES = %i(
+ TAG_TYPES = %i(
taxons
ordered_related_items
mainstream_browse_pages
@@ -25,8 +10,6 @@ topics
organisations
).freeze
-
- TAG_TYPES = Rails.env.production? ? LIVE_TAG_TYPES : TEST_TAG_TYPES
attr_accessor(*TAG_TYPES)
| Remove feature flag for related links tagging
We're finishing this feature now. Because of the deploy freeze this is
safe to merge now.
|
diff --git a/lib/hubs3d/model.rb b/lib/hubs3d/model.rb
index abc1234..def5678 100644
--- a/lib/hubs3d/model.rb
+++ b/lib/hubs3d/model.rb
@@ -16,7 +16,11 @@ end
def id
- @id ||= post["modelId"].to_i
+ @id ||= begin
+ result = post
+ fail "Expected #{result.inspect} to have modelId" if !result["modelId"]
+ result["modelId"].to_i
+ end
end
@@ -27,9 +31,11 @@ end
def post
- API.post("/model", file: base_64,
- fileName: name,
- attachments: attachments)
+ post = API.post("/model", file: base_64,
+ fileName: name,
+ attachments: attachments)
+ fail "Expected Hash but was #{post.inspect}" unless post.kind_of?(Hash)
+ post
end
end
end
| Add error messages to post response
|
diff --git a/lib/trash.rb b/lib/trash.rb
index abc1234..def5678 100644
--- a/lib/trash.rb
+++ b/lib/trash.rb
@@ -20,7 +20,8 @@ module ClassMethodsMixin
def deleted
- unscoped.where("#{self.table_name}.deleted_at IS NOT NULL")
+ deleted_at = Arel::Table.new(self.table_name)[:deleted_at]
+ unscoped.where(deleted_at.not_eq(nil))
end
end
| Use ARel to generate the SQL
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.