diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/danger_plugins/protect_files.rb b/danger_plugins/protect_files.rb
index abc1234..def5678 100644
--- a/danger_plugins/protect_files.rb
+++ b/danger_plugins/protect_files.rb
@@ -6,7 +6,7 @@ broken_rule = false
Dir.glob(path) do |current|
- broken_rule = true if self.env.scm.dsl.modified_files.include?(current)
+ broken_rule = true if modified_files.include?(current)
end
return unless broken_rule
|
Use new DSL in the plugin
|
diff --git a/gds_zendesk.gemspec b/gds_zendesk.gemspec
index abc1234..def5678 100644
--- a/gds_zendesk.gemspec
+++ b/gds_zendesk.gemspec
@@ -19,7 +19,7 @@ gem.add_dependency "null_logger", "~> 0"
gem.add_dependency "zendesk_api", "~> 1.27"
- gem.add_development_dependency "rake", "~> 13"
+ gem.add_development_dependency "rake"
gem.add_development_dependency "rspec", "~> 3"
gem.add_development_dependency "rubocop-govuk", "~> 3"
gem.add_development_dependency "webmock", ">= 2"
|
Remove gem constraint on rake
Rake is a very stable gem and it doesn't seem necessary to keep a
constraint on it as it requires frequently updating it.
|
diff --git a/db/data_migration/20130530131759_fix_detailed_guides_that_talk_about_specialist_guides.rb b/db/data_migration/20130530131759_fix_detailed_guides_that_talk_about_specialist_guides.rb
index abc1234..def5678 100644
--- a/db/data_migration/20130530131759_fix_detailed_guides_that_talk_about_specialist_guides.rb
+++ b/db/data_migration/20130530131759_fix_detailed_guides_that_talk_about_specialist_guides.rb
@@ -0,0 +1,45 @@+
+def fix_specialist_guides_reference(edition)
+ edition.body = edition.body.gsub(/\/specialist-guides\//, '/detailed-guides/')
+end
+
+all_dgs = DetailedGuide.where(state: ['published', 'draft']).includes(:document).map {|dg| dg.latest_edition }.uniq
+
+puts "Looking at #{all_dgs.count} Detailed Guides"
+
+mentioning_specialist_guides = all_dgs.select { |e| e.body =~ /\/specialist-guides\// }
+
+puts "#{mentioning_specialist_guides.count} have /specialist-guides/ in their body"
+
+by_state = mentioning_specialist_guides.group_by { |e| e.state}
+by_state['draft'] ||= []
+by_state['published'] ||= []
+
+puts "Directly fixing references in #{by_state['draft'].count} drafts"
+by_state['draft'].each do |e|
+ fix_specialist_guides_reference(e)
+ e.save(validate: false)
+end
+
+puts "Re-editioning and fixing references in #{by_state['published'].count} published editions"
+acting_as = User.find_by_name("GDS Inside Government Team")
+by_state['published'].each do |e|
+ new_draft = e.create_draft(acting_as)
+ new_draft.reload
+ fix_specialist_guides_reference(new_draft)
+ new_draft.change_note = 'Fixing references to specialist guides'
+ new_draft.save
+ new_draft.publish_as(acting_as, force: true)
+end
+
+puts "Fixed draft detailed guides:"
+by_state['draft'].each do |e|
+ puts Whitehall.url_maker.admin_detailed_guide_url(e, host: 'whitehall-admin.production.alphagov.co.uk', protocol: 'https')
+end
+
+puts "Fixed and re-published detailed guides:"
+by_state['published'].each do |e|
+ puts Whitehall.url_maker.admin_detailed_guide_url(e.latest_edition, host: 'whitehall-admin.production.alphagov.co.uk', protocol: 'https')
+end
+
+puts "Done!"
|
Fix /specialist-guides/ links in detailed guide body text
Some detailed guides have cross links to the old admin url for detailed guides /admin/specialist-guides/ and so these don't get govspokenified on frontend to refer to the public url for the latest edition of that guide.
To fix we look for all published or draft detailed guides that have /specialist-guides/ urls in their body text. We then fix them by replacing that string with /detailed-guides/. For drafts we just save it directly, but for published editions we re-edition and then publish that one.
|
diff --git a/glimpse-git.gemspec b/glimpse-git.gemspec
index abc1234..def5678 100644
--- a/glimpse-git.gemspec
+++ b/glimpse-git.gemspec
@@ -16,4 +16,6 @@ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ['lib']
+
+ gem.add_dependency 'glimpse'
end
|
Add dependency on glimpse now that it's on RubyGems
|
diff --git a/spec/mutations/releases/create_spec.rb b/spec/mutations/releases/create_spec.rb
index abc1234..def5678 100644
--- a/spec/mutations/releases/create_spec.rb
+++ b/spec/mutations/releases/create_spec.rb
@@ -1,17 +1,35 @@ require "spec_helper"
describe Releases::Create do
- it "creates a release object" do
+ it "creates a release object (Google Cloud)" do
Release.destroy_all
url = "http://foo.bar/baz"
expect(Release).to receive(:transload).with(any_args).and_return(url)
- rel = Releases::Create.run!(image_url: url,
- version: "v7.6.5-rc4",
- platform: "rpi",
- channel: "beta")
- expect(rel.channel).to eq("beta")
- expect(rel.image_url).to eq("http://foo.bar/baz")
- expect(rel.platform).to eq("rpi")
- expect(rel.version).to eq("v7.6.5-rc4")
+ ClimateControl.modify GCS_BUCKET: "whatever" do
+ rel = Releases::Create.run!(image_url: url,
+ version: "v7.6.5-rc4",
+ platform: "rpi",
+ channel: "beta")
+ expect(rel.channel).to eq("beta")
+ expect(rel.image_url).to eq("http://foo.bar/baz")
+ expect(rel.platform).to eq("rpi")
+ expect(rel.version).to eq("v7.6.5-rc4")
+ end
+ end
+
+ it "creates a release object (Google Cloud)" do
+ Release.destroy_all
+ url = "http://foo.bar/baz"
+ expect(Release).not_to receive(:transload).with(any_args) #.and_return(url)
+ ClimateControl.modify GCS_BUCKET: nil do
+ rel = Releases::Create.run!(image_url: url,
+ version: "v7.6.5-rc4",
+ platform: "rpi",
+ channel: "beta")
+ expect(rel.channel).to eq("beta")
+ expect(rel.image_url).to eq("http://foo.bar/baz")
+ expect(rel.platform).to eq("rpi")
+ expect(rel.version).to eq("v7.6.5-rc4")
+ end
end
end
|
Test updates for non-GCS releases
|
diff --git a/Casks/opera-beta.rb b/Casks/opera-beta.rb
index abc1234..def5678 100644
--- a/Casks/opera-beta.rb
+++ b/Casks/opera-beta.rb
@@ -1,6 +1,6 @@ cask :v1 => 'opera-beta' do
- version '29.0.1795.21'
- sha256 'ffcf288fbbe993c772658ea20f5230525246e046f69a162e5eeabb6de4ecd73c'
+ version '29.0.1795.26'
+ sha256 '4a62e04697b18385f8ed7dbf5bf60a253087beaca75cf47beda99ed248b37ce1'
url "http://get.geo.opera.com/pub/opera-beta/#{version}/mac/Opera_beta_#{version}_Setup.dmg"
homepage 'http://www.opera.com/computer/beta'
|
Upgrade Opera Beta.app to v29.0.1795.26
|
diff --git a/space_invaders.gemspec b/space_invaders.gemspec
index abc1234..def5678 100644
--- a/space_invaders.gemspec
+++ b/space_invaders.gemspec
@@ -19,5 +19,6 @@
spec.add_development_dependency "bundler", "~> 1.5"
spec.add_development_dependency "rake"
+ spec.add_development_dependency "pry"
spec.add_dependency "gosu"
end
|
Add pry as a development dependency, fails otherwise
|
diff --git a/app/models/identity.rb b/app/models/identity.rb
index abc1234..def5678 100644
--- a/app/models/identity.rb
+++ b/app/models/identity.rb
@@ -5,7 +5,7 @@ validates_uniqueness_of :uid, scope: :provider
def self.find_or_create(auth)
- where(auth.slice(:uid, :provider)).first_or_create
+ find_or_create_by(auth.slice(:uid, :provider))
end
end
|
Replace use of deprecated Active Record method
|
diff --git a/examples/ping_pong.rb b/examples/ping_pong.rb
index abc1234..def5678 100644
--- a/examples/ping_pong.rb
+++ b/examples/ping_pong.rb
@@ -0,0 +1,40 @@+#!/bin/env ruby
+
+require 'bundler/setup'
+require 'ffi/libevent'
+require 'socket'
+
+base = FFI::Libevent::Base.new
+trapper = FFI::Libevent::Event.new(base, "INT", FFI::Libevent::EV_SIGNAL) { base.loopbreak }
+trapper.add!
+
+pinger, ponger = UNIXSocket.pair
+
+## PINGER
+wait_for_pong = nil
+
+wait_to_ping = FFI::Libevent::Event.new(base, pinger, FFI::Libevent::EV_WRITE) do
+ pinger << "PING"
+ wait_for_pong.add!
+end
+
+wait_for_pong = FFI::Libevent::Event.new(base, pinger, FFI::Libevent::EV_READ) do
+ puts pinger.recv(4)
+ wait_to_ping.add!
+end
+
+## PONGER
+wait_for_ping = nil
+wait_to_pong = FFI::Libevent::Event.new(base, ponger, FFI::Libevent::EV_WRITE) do
+ ponger << "PONG"
+ wait_for_ping.add!
+end
+
+wait_for_ping = FFI::Libevent::Event.new(base, ponger, FFI::Libevent::EV_READ) do
+ puts ponger.recv(4)
+ wait_to_pong.add!
+end
+
+wait_to_ping.add!
+wait_for_ping.add!
+base.loop
|
Add basic ping pong example
|
diff --git a/http-server.gemspec b/http-server.gemspec
index abc1234..def5678 100644
--- a/http-server.gemspec
+++ b/http-server.gemspec
@@ -15,6 +15,7 @@ s.required_ruby_version = '>= 2.2.3'
s.add_runtime_dependency 'connection'
+ s.add_runtime_dependency 'connection-server'
s.add_runtime_dependency 'http-commands'
s.add_runtime_dependency 'http-protocol'
s.add_runtime_dependency 'settings'
|
Add connection-server as a runtime dependency
|
diff --git a/app/controllers/entries_controller.rb b/app/controllers/entries_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/entries_controller.rb
+++ b/app/controllers/entries_controller.rb
@@ -20,7 +20,7 @@ else
flash[:danger] = 'メールの送信に失敗しました'
end
- redirect_to @song.live
+ redirect_to action: :index
rescue ActiveRecord::RecordNotUnique
@song.add_error_for_duplicated_user
end
|
Change the redirect destination after entry creation
|
diff --git a/app/controllers/entries_controller.rb b/app/controllers/entries_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/entries_controller.rb
+++ b/app/controllers/entries_controller.rb
@@ -21,17 +21,12 @@
# route handlers dealing with a specific entry
-before /entries\/\d+/ do
- @entry = Entry.find_by(id: params[:id])
- halt(404, erb(:'404')) if @entry.nil?
+before '/entries/:id' do
+ find_and_ensure_entry
end
get '/entries/:id' do
erb :'entries/show'
-end
-
-get '/entries/:id/edit' do
- erb :'entries/edit'
end
put '/entries/:id' do
@@ -49,3 +44,8 @@ @entry.destroy
redirect '/entries'
end
+
+get '/entries/:id/edit' do
+ find_and_ensure_entry
+ erb :'entries/edit'
+end
|
Fix bug in before filter again
|
diff --git a/app/controllers/manuals_controller.rb b/app/controllers/manuals_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/manuals_controller.rb
+++ b/app/controllers/manuals_controller.rb
@@ -5,15 +5,13 @@
before_action :render_employment_income_manual
before_action :ensure_manual_is_found
+ before_action :ensure_document_is_found, only: :show
def index
@manual = ManualPresenter.new(manual)
end
def show
- document = fetch(params["manual_id"], params["section_id"])
- error_not_found unless document
-
@manual = ManualPresenter.new(manual)
@document = DocumentPresenter.new(document, @manual)
end
@@ -34,6 +32,10 @@ error_not_found unless manual
end
+ def ensure_document_is_found
+ error_not_found unless document
+ end
+
def error_not_found
render status: :not_found, text: "404 error not found"
end
@@ -42,6 +44,10 @@ fetch(params["manual_id"])
end
+ def document
+ fetch(params["manual_id"], params["section_id"])
+ end
+
def fetch(manual_id, section_id = nil)
path = '/' + [params[:prefix], manual_id, section_id].compact.join('/')
content_store.content_item(path)
|
Move document check to before_action filter
Handle a 404 for a non-existent document in a before filter to keep
exceptional behaviour out of the normal logic.
Also extract a `document` method to fetch the document object.
|
diff --git a/app/models/spree/variant_decorator.rb b/app/models/spree/variant_decorator.rb
index abc1234..def5678 100644
--- a/app/models/spree/variant_decorator.rb
+++ b/app/models/spree/variant_decorator.rb
@@ -1,8 +1,20 @@ Spree::Variant.class_eval do
+
has_many :digitals, :dependent => :destroy
+ after_save :destroy_digital, :if => :deleted?
# Is this variant to be downloaded by the customer?
def digital?
digitals.present?
end
+
+ private
+
+ # Spree never deleted Digitals, that's why ":dependent => :destroy" won't work on Digital.
+ # We need to delete the Digital manually here as soon as the Variant is nullified.
+ # Otherwise you'll have orphan Digitals (and their attached files!) associated with unused Variants.
+ def destroy_digital
+ digitals.map &:destroy
+ end
+
end
|
Revert "Remove delete digitals on soft delete of variant"
This reverts commit d23462fadb5ef049b9ed4f667bd405e343c654b1.
|
diff --git a/activesupport/lib/active_support/security_utils.rb b/activesupport/lib/active_support/security_utils.rb
index abc1234..def5678 100644
--- a/activesupport/lib/active_support/security_utils.rb
+++ b/activesupport/lib/active_support/security_utils.rb
@@ -19,12 +19,14 @@ end
module_function :fixed_length_secure_compare
- # Constant time string comparison, for variable length strings.
+ # Secure string comparison for strings of variable length.
#
- # The values are first processed by SHA256, so that we don't leak length info
- # via timing attacks.
+ # While a timing attack would not be able to discern the content of
+ # a secret compared via secure_compare, it is possible to determine
+ # the secret length. This should be considered when using secure_compare
+ # to compare weak, short secrets to user input.
def secure_compare(a, b)
- fixed_length_secure_compare(::Digest::SHA256.digest(a), ::Digest::SHA256.digest(b)) && a == b
+ a.length == b.length && fixed_length_secure_compare(a, b)
end
module_function :secure_compare
end
|
Remove hashing from secure_compare and clarify documentation
|
diff --git a/app/services/create_manual_service.rb b/app/services/create_manual_service.rb
index abc1234..def5678 100644
--- a/app/services/create_manual_service.rb
+++ b/app/services/create_manual_service.rb
@@ -1,9 +1,9 @@ class CreateManualService
- def initialize(dependencies)
- @manual_repository = dependencies.fetch(:manual_repository)
- @manual_builder = dependencies.fetch(:manual_builder)
- @listeners = dependencies.fetch(:listeners)
- @attributes = dependencies.fetch(:attributes)
+ def initialize(manual_repository:, manual_builder:, listeners:, attributes:)
+ @manual_repository = manual_repository
+ @manual_builder = manual_builder
+ @listeners = listeners
+ @attributes = attributes
end
def call
|
Use Ruby keyword args in CreateManualService
I think that using language features instead of custom code makes this
easier to understand.
|
diff --git a/lib/asendia/client.rb b/lib/asendia/client.rb
index abc1234..def5678 100644
--- a/lib/asendia/client.rb
+++ b/lib/asendia/client.rb
@@ -5,7 +5,7 @@ module Asendia
# Handles communication with Asendia API
class Client
- WSDL_URL = 'https://demo0884331.mockable.io/?wsdl'.freeze
+ WSDL_URL = 'https://reporting-rfc.asendia.co.uk/Heist/externalCom/webservice.cfc?wsdl'.freeze
attr_reader :username, :password, :live
@@ -33,6 +33,9 @@ end
def request(endpoint, params)
+ # ReturnType 1 is XML, i.e. we want XML to be returned.
+ params[:ReturnType] = 1
+
@client.call(endpoint, message: params).body.dig(
"#{endpoint}_response".to_sym,
"#{endpoint}_return".to_sym,
|
Update WSDL URL and start setting ReturnType
|
diff --git a/lib/authem/session.rb b/lib/authem/session.rb
index abc1234..def5678 100644
--- a/lib/authem/session.rb
+++ b/lib/authem/session.rb
@@ -5,14 +5,25 @@ self.table_name = :authem_sessions
belongs_to :subject, polymorphic: true
- scope :by_subject, ->(model){ where(subject_type: model.class.name, subject_id: model.id) }
- scope :active, ->{ where(arel_table[:expires_at].gteq(Time.zone.now)) }
- scope :expired, ->{ where(arel_table[:expires_at].lt(Time.zone.now)) }
before_create do
self.token ||= SecureRandom.hex(40)
self.ttl ||= 30.days
self.expires_at ||= ttl_from_now
+ end
+
+ class << self
+ def by_subject(record)
+ where(subject_type: record.class.name, subject_id: record.id)
+ end
+
+ def active
+ where(arel_table[:expires_at].gteq(Time.zone.now))
+ end
+
+ def expired
+ where(arel_table[:expires_at].lt(Time.zone.now))
+ end
end
def refresh
|
Define class methods instead of scopes
Maybe CodeClimate will like it more...
|
diff --git a/lib/content_dumper.rb b/lib/content_dumper.rb
index abc1234..def5678 100644
--- a/lib/content_dumper.rb
+++ b/lib/content_dumper.rb
@@ -3,6 +3,7 @@
class ContentDumper
FIELDS = %w(base_path content_id locale document_type schema_name rendering_app publishing_app updated_at).freeze
+ HASH_FIELDS = %w(details expanded_links routes redirects).freeze
def initialize(filename)
@filename = filename
@@ -11,9 +12,9 @@ def dump
Zlib::GzipWriter.open(filename) do |file|
csv = CSV.new(file)
- csv << FIELDS
- ContentItem.each do |route|
- csv << FIELDS.map { |field| route.send(field) }
+ csv << csv_field_names
+ ContentItem.each do |row|
+ csv << csv_fields(row)
end
end
end
@@ -21,4 +22,18 @@ private
attr_reader :filename
+
+ def csv_field_names
+ FIELDS + HASH_FIELDS.map { |field| "#{field}_hash".to_sym }
+ end
+
+ def csv_fields(item)
+ FIELDS.map { |field| item.send(field) } + HASH_FIELDS.map { |field| hash_field(item.send(field)) }
+ end
+
+ def hash_field(object)
+ Digest::SHA1.hexdigest(
+ JSON.generate(object)
+ )
+ end
end
|
Include hash of details and expanded_links in dump
|
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -1,14 +1,16 @@ class HomeController < ApplicationController
+
+ PER_ROW = 7
def index
if current_user
- @src_sets = SrcSet.active.most_recent(8)
- @src_images = SrcImage.without_image.includes(:src_thumb).owned_by(current_user).active.most_recent(6)
- @gend_images = GendImage.without_image.includes(:gend_thumb).owned_by(current_user).active.most_recent(6)
+ @src_sets = SrcSet.active.most_recent(PER_ROW)
+ @src_images = SrcImage.without_image.includes(:src_thumb).owned_by(current_user).active.most_recent(PER_ROW)
+ @gend_images = GendImage.without_image.includes(:gend_thumb).owned_by(current_user).active.most_recent(2 * PER_ROW)
else
- @src_sets = SrcSet.active.most_recent(16)
- @gend_images = GendImage.without_image.includes(:gend_thumb).owned_by(current_user).active.most_recent(16)
+ @src_sets = SrcSet.active.most_recent(2 * PER_ROW)
+ @gend_images = GendImage.without_image.includes(:gend_thumb).owned_by(current_user).active.most_recent(3 * PER_ROW)
end
+ end
- end
end
|
Optimize row counts for most common browser widths.
|
diff --git a/lib/same_boat/crew.rb b/lib/same_boat/crew.rb
index abc1234..def5678 100644
--- a/lib/same_boat/crew.rb
+++ b/lib/same_boat/crew.rb
@@ -11,7 +11,7 @@ private
def git_commit_hash
- `git show #{@file_path} | head -n 1 | cut -d ' ' -f2`
+ `git log #{@file_path} | head -n 1 | cut -d ' ' -f2`
end
def file_hash
@@ -19,7 +19,13 @@ end
def git?
- !!`which git`
+ self.class.git?
+ end
+
+ class << self
+ def git?
+ @_git ||= !!`which git`
+ end
end
end
end
|
Change git hash command to use log instead of show
|
diff --git a/lib/tasks/events.rake b/lib/tasks/events.rake
index abc1234..def5678 100644
--- a/lib/tasks/events.rake
+++ b/lib/tasks/events.rake
@@ -6,46 +6,48 @@ datetime = DateTime.parse(timestamp)
events = Event.where("created_at >= ?", datetime).order(:created_at)
- json_events = events.map { |e| e.as_json.except("id").to_json }
File.open("tmp/events.json", "w") do |file|
- file.puts json_events
+ events.find_each do |event|
+ file.puts event.as_json.except("id").to_json
+ end
end
end
desc "Imports events from tmp/events.json"
task import: :environment do
- json_events = File.read("tmp/events.json").split("\n")
- hash_events = json_events.map { |json| JSON.parse(json) }
+ File.open("tmp/events.json", "r") do |file|
+ file.each do |line|
+ hash = JSON.parse(line)
- hash_events.each do |hash|
- action = hash.fetch("action")
- payload = hash.fetch("payload")
+ action = hash.fetch("action")
+ payload = hash.fetch("payload")
- begin
- command = "Commands::#{action}".constantize
- rescue NameError
- command = "Commands::V2::#{action}".constantize
- end
+ begin
+ command = "Commands::#{action}".constantize
+ rescue NameError
+ command = "Commands::V2::#{action}".constantize
+ end
- begin
- response = EventLogger.log_command(command, payload) do
- command.call(payload.deep_symbolize_keys, downstream: false)
+ begin
+ response = EventLogger.log_command(command, payload) do
+ command.call(payload.deep_symbolize_keys, downstream: false)
+ end
+
+ if response.code == 200
+ print "."
+ else
+ puts
+ puts "#{command} #{response.data}"
+ end
+ rescue => e
+ puts
+ puts "#{command} raised an error: #{e.message}"
end
-
- if response.code == 200
- print "."
- else
- puts
- puts "#{command} #{response.data}"
- end
- rescue => e
- puts
- puts "#{command} raised an error: #{e.message}"
end
end
+ end
- puts
- end
+ puts
end
|
Make event export/import streaming to conserve memory
|
diff --git a/lib/tasks/export.rake b/lib/tasks/export.rake
index abc1234..def5678 100644
--- a/lib/tasks/export.rake
+++ b/lib/tasks/export.rake
@@ -0,0 +1,48 @@+class Record
+ attr_accessor :created_at, :meeting_date, :club_name, :leaders, :attendance,
+ :notes
+
+ def initialize(created_at, meeting_date, club_name, leaders, attendance,
+ notes)
+ @created_at = created_at
+ @meeting_date = meeting_date
+ @club_name = club_name
+ @leaders = leaders
+ @attendance = attendance
+ @notes = notes
+ end
+
+ # The titles of the fields that are getting put in the CSV.
+ # This should be generated at runtime.
+ def self.csv_title
+ ['created_at', 'meeting_date', 'club_name', 'leaders', 'attendance',
+ 'notes']
+ end
+
+ def csv_contents
+ [created_at, meeting_date, club_name, leaders, attendance, notes]
+ end
+end
+
+namespace :export do
+ desc 'Generate a report of all check ins'
+ task :check_ins => :environment do
+ csv_string = CSV.generate do |csv|
+ csv << Record.csv_title
+ ::CheckIn.all.each do |check_in|
+ r = Record.new(
+ check_in.created_at,
+ check_in.meeting_date,
+ check_in.club.name,
+ check_in.club.leaders.all.map { |l| l.name }.uniq,
+ check_in.attendance,
+ check_in.notes
+ )
+
+ csv << r.csv_contents
+ end
+ end
+
+ puts csv_string
+ end
+end
|
Add rake task to create CSV from check in data
Fix #52
|
diff --git a/irc-hipchat.rb b/irc-hipchat.rb
index abc1234..def5678 100644
--- a/irc-hipchat.rb
+++ b/irc-hipchat.rb
@@ -5,6 +5,7 @@ IRC_HOST = 'irc.freenode.net'
IRC_PORT = '6667'
IRC_CHANNEL = '#emacs'
+HIPCHAT_ROOM = 'IRC'
hipchat_client = HipChat::Client.new(ENV['HIPCHAT_AUTH_TOKEN'], :api_version => 'v2')
@@ -21,7 +22,7 @@ end
on(:message) do |source, target, message|
- hipchat_client['IRC'].send('IRC',
+ hipchat_client[HIPCHAT_ROOM].send('IRC',
"<strong>#{source}:</strong> #{message}",
:notify => true,
:color => 'yellow',
|
Make hipchat room name a constant
|
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -1,10 +1,10 @@ class SessionsController < ApplicationController
-
+
def create
user = User.find_by(username: params[:user][:username])
if user && user.authenticate(params[:user][:password])
session[:user_id] = user.id
- redirect_to profile_path, notice: "You are now signed in"
+ redirect_to profile_path
else
flash[:error] = "Bad username or password"
redirect_to signin_path
|
Remove flash notice after successful signin
|
diff --git a/app/helpers/landable/traffic_helper.rb b/app/helpers/landable/traffic_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/landable/traffic_helper.rb
+++ b/app/helpers/landable/traffic_helper.rb
@@ -0,0 +1,31 @@+module Landable
+ module TrafficHelper
+ def crawl_tracker
+ @tracker if @tracker.is_a? Landable::Traffic::CrawlTracker
+ end
+
+ def noop_tracker
+ @tracker if @tracker.is_a? Landable::Traffic::NoopTracker
+ end
+
+ def ping_tracker
+ @tracker if @tracker.is_a? Landable::Traffic::PingTracker
+ end
+
+ def scan_tracker
+ @tracker if @tracker.is_a? Landable::Traffic::ScanTracker
+ end
+
+ def scrape_tracker
+ @tracker if @tracker.is_a? Landable::Traffic::ScrapeTracker
+ end
+
+ def user_tracker
+ @tracker if @tracker.is_a? Landable::Traffic::UserTracker
+ end
+
+ def tracker
+ @tracker
+ end
+ end
+end
|
Create tracker object helper methods
|
diff --git a/app/models/spree/copayment_relation.rb b/app/models/spree/copayment_relation.rb
index abc1234..def5678 100644
--- a/app/models/spree/copayment_relation.rb
+++ b/app/models/spree/copayment_relation.rb
@@ -6,5 +6,7 @@ validates :relatable, :related_to, presence: true
validates :relatable_id, uniqueness: { scope: [:related_to_id] }
+
+ scope :active, -> { where(active: true)}
end
end
|
Add scope for get active copayments
|
diff --git a/app/models/spree/shipment_decorator.rb b/app/models/spree/shipment_decorator.rb
index abc1234..def5678 100644
--- a/app/models/spree/shipment_decorator.rb
+++ b/app/models/spree/shipment_decorator.rb
@@ -1,5 +1,5 @@ Spree::Shipment.class_eval do
- scope :exportable, joins(:order).where('spree_shipments.state != ?', 'pending')
+ scope :exportable, -> { joins(:order).where('spree_shipments.state != ?', 'pending') }
def self.between(from, to)
joins(:order).where('(spree_shipments.updated_at > ? AND spree_shipments.updated_at < ?) OR (spree_orders.updated_at > ? AND spree_orders.updated_at < ?)',from, to, from, to)
|
Remove scope deprecation warning sytax
|
diff --git a/config/initializers/swagger_blocks.rb b/config/initializers/swagger_blocks.rb
index abc1234..def5678 100644
--- a/config/initializers/swagger_blocks.rb
+++ b/config/initializers/swagger_blocks.rb
@@ -3,7 +3,7 @@ module ApiFlashcards
include Swagger::Blocks
host = if ENV['RAILS_ENV'] == "production"
- "https://mkdev-flashcards.herokuapp.com"
+ "mkdev-flashcards.herokuapp.com"
else
"localhost:3000"
end
|
Remove protocol prefix from hostname
|
diff --git a/app/controllers/domain_controller.rb b/app/controllers/domain_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/domain_controller.rb
+++ b/app/controllers/domain_controller.rb
@@ -12,7 +12,10 @@ search_classes.each do |model|
if model.respond_to?(:search)
arel = model.search(@filter_query)
- @results[model.to_s] = arel.accessible_by(current_ability) unless arel.blank?
+ if arel.present?
+ arel = arel.where(:domain_id => current_domain)
+ @results[model.to_s] = arel.accessible_by(current_ability)
+ end
end
end
end
|
Use domain_id in search query
|
diff --git a/lib/appsignal/integrations/sinatra.rb b/lib/appsignal/integrations/sinatra.rb
index abc1234..def5678 100644
--- a/lib/appsignal/integrations/sinatra.rb
+++ b/lib/appsignal/integrations/sinatra.rb
@@ -5,7 +5,7 @@
app_settings = ::Sinatra::Application.settings
Appsignal.config = Appsignal::Config.new(
- app_settings.root,
+ app_settings.root || Dir.pwd,
app_settings.environment
)
|
Fix AppSignal loading when using Sinatra::Base
Looks like that when using `require "sinatra/base"` instead of
`require "sinatra"` the root path is not set on the sinatra application.
The user should do this themselves, but it's not required.
https://github.com/sinatra/sinatra/blob/d51513d094d1fe01543e546d07ef48663ecc2d8f/test/settings_test.rb#L453-L466
To prevent this kind of behavior (AppSignal not working because a user
didn't specify a root path) we set a default path like AppSignal does in
https://github.com/appsignal/appsignal-ruby/blob/f9b51bdaee3402876adeab1f624f090b2786f268/lib/appsignal.rb#L42
|
diff --git a/lib/chamber.rb b/lib/chamber.rb
index abc1234..def5678 100644
--- a/lib/chamber.rb
+++ b/lib/chamber.rb
@@ -38,7 +38,10 @@ end
def load_file(file_path)
- settings.merge! YAML.load(File.read(file_path.to_s))
+ file_contents = File.read(file_path.to_s)
+ yaml_contents = YAML.load(file_contents)
+
+ settings.merge! yaml_contents
end
def settings
|
Decompress a few lines for better readability
|
diff --git a/lib/messaging/message_handlers/base_message_handler.rb b/lib/messaging/message_handlers/base_message_handler.rb
index abc1234..def5678 100644
--- a/lib/messaging/message_handlers/base_message_handler.rb
+++ b/lib/messaging/message_handlers/base_message_handler.rb
@@ -17,7 +17,7 @@ end
def send_response(producer)
- producer.produce properties[:reply_to], response, correlation_id: correlation_id
+ producer.produce properties[:reply_to].force_encoding('utf-8'), response, correlation_id: correlation_id
end
end
|
Fix invalid encoding on generated reply_to destination during responding to requests
|
diff --git a/lib/clowder/client.rb b/lib/clowder/client.rb
index abc1234..def5678 100644
--- a/lib/clowder/client.rb
+++ b/lib/clowder/client.rb
@@ -4,6 +4,7 @@ module Clowder
CLOWDER_ROOT_URL = 'http://www.clowder.io'
CLOWDER_API_URL = CLOWDER_ROOT_URL + '/api'
+ CLOWDER_DELETE_URL = CLOWDER_ROOT_URL + '/delete'
class Client
attr_reader :api_key
@@ -29,6 +30,11 @@
data[:status] = -1
+ send(data)
+ end
+
+ def delete(service_name)
+ data = {url: CLOWDER_DELETE_URL, name: service_name}
send(data)
end
|
Add Ability To Delete By Service Name
|
diff --git a/lib/git-helper/menus/settings_menu.rb b/lib/git-helper/menus/settings_menu.rb
index abc1234..def5678 100644
--- a/lib/git-helper/menus/settings_menu.rb
+++ b/lib/git-helper/menus/settings_menu.rb
@@ -11,8 +11,6 @@ cli.choose do |menu|
menu.header = "Settings"
menu.prompt = "? "
- current_git_root_directory = `pwd`.sub("\n", '/.git-helper-pref.plist')
- # Refactor into user pref manager
current_main_branch = GitHelper.settings_for(:main)
menu.choice('main_branch', text: "Set the <%= color('main branch', BOLD) %> that you base all your topic/feature branches off of (currently #{current_main_branch})") do
# Move to actions
|
Remove old settings path code from
|
diff --git a/capistrano-detect-migrations.gemspec b/capistrano-detect-migrations.gemspec
index abc1234..def5678 100644
--- a/capistrano-detect-migrations.gemspec
+++ b/capistrano-detect-migrations.gemspec
@@ -1,6 +1,6 @@ Gem::Specification.new do |s|
s.name = 'capistrano-detect-migrations'
- s.version = '0.5.1'
+ s.version = '0.6.0'
s.date = '2012-04-11'
s.summary = "Detect pending Rails migrations with Git before you deploy."
s.description = <<-EOS
|
Update gemspec for new release.
|
diff --git a/lib/ferrety_ferret.rb b/lib/ferrety_ferret.rb
index abc1234..def5678 100644
--- a/lib/ferrety_ferret.rb
+++ b/lib/ferrety_ferret.rb
@@ -1,4 +1,3 @@-require "ferrety_ferret/version"
require "httparty"
module Ferrety
@@ -7,7 +6,7 @@
def initialize(params)
clear_alerts
- params = parse(params)
+ @params = parse(params)
end
private
|
Fix scoping issue on params
|
diff --git a/lib/kuroko2/engine.rb b/lib/kuroko2/engine.rb
index abc1234..def5678 100644
--- a/lib/kuroko2/engine.rb
+++ b/lib/kuroko2/engine.rb
@@ -1,5 +1,10 @@ module Kuroko2
class Engine < ::Rails::Engine
isolate_namespace Kuroko2
+
+ config.before_configuration do
+ require 'kaminari'
+ require 'chrono'
+ end
end
end
|
Add requiring gems to before_configuration
|
diff --git a/lyricfy.gemspec b/lyricfy.gemspec
index abc1234..def5678 100644
--- a/lyricfy.gemspec
+++ b/lyricfy.gemspec
@@ -17,9 +17,9 @@ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ["lib"]
- gem.add_runtime_dependency "rake"
gem.add_runtime_dependency "nokogiri", [">= 1.3.3"]
+ gem.add_development_dependency "rake"
gem.add_development_dependency "webmock", ["1.8.0"]
gem.add_development_dependency "vcr", ["~> 2.4.0"]
end
|
Add rake as development dependency in gemspec
|
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index abc1234..def5678 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -2,4 +2,4 @@
Rails.application.config.session_store :redis_store,
servers: ENV["REDIS_URL"] + "/0/sessions",
- expires_in: 3.days
+ expires_in: 6.months
|
Increase session expiration to 6 months
|
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.
-Rails.application.config.session_store :cookie_store, key: '_marli_session'
+Rails.application.config.session_store :cookie_store, key: '_marli_session', domain: :all
|
Make session cookie domain :all for single sign out
|
diff --git a/lib/github/token.rb b/lib/github/token.rb
index abc1234..def5678 100644
--- a/lib/github/token.rb
+++ b/lib/github/token.rb
@@ -4,12 +4,12 @@ module Token
class << self
EXPANSIONS = {
- user: ["read:user", "user:email", "user:follow"],
- repo: ["repo:status", "repo_deployment", "public_repo", "repo:invite"],
- 'admin:org': ["write:org", "read:org"],
- 'admin:public_key': ["write:public_key", "read:public_key"],
- 'admin:repo_hook': ["write:repo_hook", "read:repo_hook"],
- 'admin:gpg_key': ["write:gpg_key", "read:gpg_key"]
+ "repo" => { "repo:status" => {}, "repo_deployment" => {}, "public_repo" => {}, "repo_invite" => {} },
+ "admin:org" => { "write:org" => { "read:org" => {} } },
+ "admin:public_key" => { "write:public_key" => { "read:public_key" => {} } },
+ "admin:repo_hook" => { "write:repo_hook" => { "read:repo_hook" => {} } },
+ "user" => { "read:user" => {}, "user:email" => {}, "user:follow" => {} },
+ "admin:gpg_key" => { "write:gpg_key" => { "read:gpg_key" => {} } }
}.freeze
def scopes(token, client = nil)
|
Move scopes to tree structure
|
diff --git a/spec/support/save_feature_failures.rb b/spec/support/save_feature_failures.rb
index abc1234..def5678 100644
--- a/spec/support/save_feature_failures.rb
+++ b/spec/support/save_feature_failures.rb
@@ -4,13 +4,16 @@ config.after(:each, type: :feature) do
example_filename = RSpec.current_example.full_description
example_filename = example_filename.tr(' ', '_')
+ example_filename = File.expand_path(example_filename, Capybara.save_path)
+ example_screenshotname = "#{example_filename}.png"
example_filename += '.html'
- example_filename = File.expand_path(example_filename, Capybara.save_path)
if RSpec.current_example.exception.present?
save_page(example_filename)
+ save_page(example_screenshotname)
# remove the file if the test starts working again
- elsif File.exist?(example_filename)
- File.unlink(example_filename)
+ else
+ File.unlink(example_filename) if File.exist?(example_filename)
+ File.unlink(example_screenshotname) if File.exist?(example_screenshotname)
end
end
end
|
Store screenshot when feature test fails
This is useful when debugging a failing test.
Co-authored-by: Stephan Kulow <f965a4a1b587c4e3c1892642aed563e43902502b@kulow.org>
|
diff --git a/lib/mutant/color.rb b/lib/mutant/color.rb
index abc1234..def5678 100644
--- a/lib/mutant/color.rb
+++ b/lib/mutant/color.rb
@@ -3,7 +3,7 @@ module Mutant
# Class to colorize strings
class Color
- include Adamantium::Flat, Concord.new(:color)
+ include Adamantium::Flat, Concord.new(:code)
# Format text with color
#
|
Fix ivar naming in Mutant::Color
|
diff --git a/lib/nagip/loader.rb b/lib/nagip/loader.rb
index abc1234..def5678 100644
--- a/lib/nagip/loader.rb
+++ b/lib/nagip/loader.rb
@@ -10,7 +10,34 @@ def run
instance_eval File.read(File.join(File.dirname(__FILE__), 'defaults.rb'))
instance_eval File.read 'Nagipfile'
+ load_remote_objects
end
+
+ private
+
+ def load_remote_objects
+ require 'nagip/cli/status'
+ require 'nagip/status'
+
+ # Refresh cached status.dat
+ CLI::Status.new.invoke(:fetch)
+
+ # Load status.dat
+ #
+ # @Note currently here reads all nagios servers' cache files. This
+ # means that users can not reduce nagios servers by --nagios= CLI
+ # option. Below loop may be moved into initialization phase of CLI
+ # class.
+ Configuration.env.nagios_servers.each do |nagios_server|
+ status = ::Nagip::Status.find(nagios_server.hostname)
+ status.service_items.group_by{ |section| section.host_name }.each do |host, sections|
+ services = sections.map { |s| s.service_description }
+ Configuration.env.host(host, services: services, on: nagios_server.hostname)
+ end
+ end
+
+ end
+
end
end
end
|
Load host and service object from remote status.dat on boot
|
diff --git a/lib/qmetrics/api.rb b/lib/qmetrics/api.rb
index abc1234..def5678 100644
--- a/lib/qmetrics/api.rb
+++ b/lib/qmetrics/api.rb
@@ -14,7 +14,7 @@ options.merge(@auth)))
end
- def stats(args)
+ def stats(**args)
if args.empty?
@stats
else
@@ -22,7 +22,7 @@ end
end
- def realtime(args)
+ def realtime(**args)
if args.empty?
@realtime
else
|
Set default value for args in caller instantiation on API.
|
diff --git a/netfox.podspec b/netfox.podspec
index abc1234..def5678 100644
--- a/netfox.podspec
+++ b/netfox.podspec
@@ -1,6 +1,6 @@ Pod::Spec.new do |s|
s.name = "netfox"
- s.version = "1.18.0"
+ s.version = "1.19.0"
s.summary = "A lightweight, one line setup, iOS/OSX network debugging library!"
s.description = <<-DESC
|
Update pod version to 1.19.0
|
diff --git a/lib/troy/helpers.rb b/lib/troy/helpers.rb
index abc1234..def5678 100644
--- a/lib/troy/helpers.rb
+++ b/lib/troy/helpers.rb
@@ -9,7 +9,15 @@ end
def partial(name, locals = {})
- path = site.root.join("partials/_#{name}.erb")
+ basename = File.basename(name)
+ dirname = File.dirname(name)
+
+ partial = []
+ partial << dirname unless dirname.start_with?(".")
+ partial << "_#{basename}.erb"
+ partial = partial.join("/")
+
+ path = site.root.join("partials/#{partial}")
locals = locals.merge(site: site, page: page)
EmbeddedRuby.new(path.read, locals).render
rescue Exception, StandardError => error
|
Support directories inside partials directory.
|
diff --git a/config/deploy.rb b/config/deploy.rb
index abc1234..def5678 100644
--- a/config/deploy.rb
+++ b/config/deploy.rb
@@ -35,5 +35,5 @@ end
end
- after 'deploy:updated', 'config_files:upload'
+ before 'deploy:updated', 'config_files:upload'
end
|
Copy secrets to server before db:migrate
|
diff --git a/app/models/post/vote_methods.rb b/app/models/post/vote_methods.rb
index abc1234..def5678 100644
--- a/app/models/post/vote_methods.rb
+++ b/app/models/post/vote_methods.rb
@@ -37,8 +37,12 @@ if user.is_anonymous?
return false
end
- vote = post_votes.find_or_initialize_by_user_id user.id
- vote.update_attributes(:score => score, :updated_at => Time.now)
+ if score > 0
+ vote = post_votes.find_or_initialize_by :user_id => user.id
+ vote.update :score => score
+ else
+ post_votes.where(:user_id => user.id).delete_all
+ end
recalculate_score!
|
Delete vote when it's set to less than or equal to 0.
And why is it even configurable.
|
diff --git a/app/reports/basic_report_row.rb b/app/reports/basic_report_row.rb
index abc1234..def5678 100644
--- a/app/reports/basic_report_row.rb
+++ b/app/reports/basic_report_row.rb
@@ -11,7 +11,7 @@
def add(asset)
self.count += 1
- self.replacement_cost += asset.replacement_cost
+ self.replacement_cost += asset.replacement_cost unless asset.replacement_cost.nil?
self.id_list << asset.asset_key
end
|
Fix NPR for assets that are not initialized
|
diff --git a/test/collector_test.rb b/test/collector_test.rb
index abc1234..def5678 100644
--- a/test/collector_test.rb
+++ b/test/collector_test.rb
@@ -0,0 +1,45 @@+require 'test_helper'
+
+module Schemacop
+ class CollectorTest < Minitest::Test
+ def test_no_root_node
+ s = Schema.new do
+ req :a, :string
+ end
+
+ col = s.validate(a: 0)
+ assert col.exceptions.first[:path].first !~ %r'^/root', 'Root node is present in the path.'
+ end
+
+ def test_correct_path
+ s = Schema.new do
+ req :long_symbol, :string
+ req 'long_string', :string
+ req 123456, :string
+ end
+
+ col = s.validate('long_string' => 0, long_symbol: 0, 123456 => 0)
+
+ symbol = col.exceptions[0]
+ string = col.exceptions[1]
+ number = col.exceptions[2]
+
+ assert symbol[:path].first =~ %r'^/long_symbol'
+ assert string[:path].first =~ %r'^/long_string'
+ assert number[:path].first =~ %r'^/123456'
+ end
+
+ def test_nested_paths
+ s = Schema.new do
+ req :one do
+ req :two, :string
+ end
+ req :three, :string
+ end
+
+ col = s.validate(one: { two: 0 }, three: 0)
+ assert_equal 2, col.exceptions[0][:path].length
+ assert_equal 1, col.exceptions[1][:path].length
+ end
+ end
+end
|
Add tests for Collector paths
|
diff --git a/lib/foreigner/connection_adapters/sql_2003.rb b/lib/foreigner/connection_adapters/sql_2003.rb
index abc1234..def5678 100644
--- a/lib/foreigner/connection_adapters/sql_2003.rb
+++ b/lib/foreigner/connection_adapters/sql_2003.rb
@@ -8,23 +8,18 @@ def add_foreign_key(from_table, to_table, options = {})
column = options[:column] || "#{to_table.to_s.singularize}_id"
foreign_key_name = foreign_key_name(from_table, column, options)
+ primary_key = options[:primary_key] || "id"
+ dependency = dependency_sql(options[:dependent])
sql =
"ALTER TABLE #{quote_table_name(from_table)} " +
"ADD CONSTRAINT #{quote_column_name(foreign_key_name)} " +
- foreign_key_definition(to_table, options)
+ "FOREIGN KEY (#{quote_column_name(column)}) " +
+ "REFERENCES #{quote_table_name(ActiveRecord::Migrator.proper_table_name(to_table))}(#{primary_key})"
+
+ sql << " #{dependency}" unless dependency.blank?
execute(sql)
- end
-
- def foreign_key_definition(to_table, options = {})
- column = options[:column] || "#{to_table.to_s.singularize}_id"
- primary_key = options[:primary_key] || "id"
- dependency = dependency_sql(options[:dependent])
-
- sql = "FOREIGN KEY (#{quote_column_name(column)}) REFERENCES #{quote_table_name(to_table)}(#{primary_key})"
- sql << " #{dependency}" unless dependency.blank?
- sql
end
private
|
Add support for active_record.table_name_prefix and active_record.table_name_suffix.
Thanks accy.
|
diff --git a/app/validators/url_validator.rb b/app/validators/url_validator.rb
index abc1234..def5678 100644
--- a/app/validators/url_validator.rb
+++ b/app/validators/url_validator.rb
@@ -1,5 +1,3 @@-# frozen_string_literal: true
-
class UrlValidator < ActiveModel::EachValidator
# The URL validation rules are somewhat overly strict, but should serve;
# the idea is to prevent attackers from inserting redirecting URLs
|
Remove redundant freeze (required by CircleCI)
Signed-off-by: David A. Wheeler <9ae72d22d8b894b865a7a496af4fab6320e6abb2@dwheeler.com>
|
diff --git a/XcodeEditor.podspec b/XcodeEditor.podspec
index abc1234..def5678 100644
--- a/XcodeEditor.podspec
+++ b/XcodeEditor.podspec
@@ -9,4 +9,6 @@ s.platform = :osx
s.source_files = 'Source/*.{h,m}', 'Source/Utils/*.{h,m}'
s.requires_arc = true
+ spec.ios.deployment_target = '5.0'
+ spec.osx.deployment_target = '10.7'
end
|
Add deployment targets to podspec.
|
diff --git a/spec/dynamodb_mutex_spec.rb b/spec/dynamodb_mutex_spec.rb
index abc1234..def5678 100644
--- a/spec/dynamodb_mutex_spec.rb
+++ b/spec/dynamodb_mutex_spec.rb
@@ -7,7 +7,7 @@
describe '#with_lock' do
- def run(id, seconds)
+ def run_for(seconds)
locker.with_lock(lockname) do
sleep(seconds)
end
@@ -21,27 +21,35 @@ expect(locked).to eq(true)
end
- it 'should raise error after block timeout' do
- if pid1 = fork
+ it 'should raise error after :wait_for_other timeout' do
+ begin
+ fork { run_for(2) }
+
sleep(1)
+
expect {
- locker.with_lock(lockname) { sleep(1) }
+ locker.with_lock(lockname, wait_for_other: 0.1) { return }
}.to raise_error(DynamoDBMutex::LockError)
+
+ ensure
Process.waitall
- else
- run(1, 5)
end
end
it 'should expire lock if stale' do
- if pid1 = fork
- sleep(2)
- locker.with_lock(lockname, wait_for_other: 10) do
- expect(locker).to receive(:delete).with('test.lock')
+ begin
+ fork { run_for(2) }
+
+ sleep(1)
+
+ stale_after = 1
+
+ locker.with_lock(lockname, stale_after: stale_after, wait_for_other: stale_after+1) do
+ expect(locker).to receive(:delete).with(lockname)
end
+
+ ensure
Process.waitall
- else
- run(1, 5)
end
end
|
Fix running specs multiple times.
|
diff --git a/lib/active_presenter/version.rb b/lib/active_presenter/version.rb
index abc1234..def5678 100644
--- a/lib/active_presenter/version.rb
+++ b/lib/active_presenter/version.rb
@@ -1,8 +1,8 @@ module ActivePresenter
module VERSION
- MAJOR = 0
+ MAJOR = 1
MINOR = 0
- TINY = 5
+ TINY = 0
STRING = [MAJOR, MINOR, TINY].join('.')
end
|
Make it v1.0.0, since it's production ready
|
diff --git a/lib/activerecord_requirement.rb b/lib/activerecord_requirement.rb
index abc1234..def5678 100644
--- a/lib/activerecord_requirement.rb
+++ b/lib/activerecord_requirement.rb
@@ -3,7 +3,7 @@ class ActiveRecordRequirement
attr_reader :requirements, :klass
- IGNORE_COLUMNS = %w( created_at updated_at created_on updated_on created_by updated_by )
+ IGNORE_COLUMNS = %w( id created_at updated_at created_on updated_on created_by updated_by )
def initialize(klass)
@klass = klass
@@ -38,7 +38,7 @@
# Pick out the desired content columns for this activerecord class.
def init_columns
- @klass.content_columns.each do |c|
+ @klass.columns.each do |c|
@columns << c unless IGNORE_COLUMNS.detect {|name| name == c.name }
end
end
|
Include all columns by default, not just content_columns. This is because we definitely
want to include foreign keys in the parameters to watch as well.
git-svn-id: 36d0598828eae866924735253b485a592756576c@7743 da5c320b-a5ec-0310-b7f9-e4d854caa1e2
|
diff --git a/lib/command_objects/sync_bot.rb b/lib/command_objects/sync_bot.rb
index abc1234..def5678 100644
--- a/lib/command_objects/sync_bot.rb
+++ b/lib/command_objects/sync_bot.rb
@@ -10,10 +10,15 @@ [Schedule, Sequence, Step].map(&:destroy_all)
{sequences: api.sequences.fetch.map { |s| CreateSequence.run!(s) }.count,
schedules: api.schedules.fetch.map { |s| CreateSchedule.run!(s) }.count,
- steps: Step.count }.tap { |d| puts d }
+ steps: Step.count }.tap { |d| after_sync(d) }
end
rescue FbResource::FetchError => e
add_error :web_server, :fetch_error, e.message
end
+
+ def after_sync(data)
+ bot.log(data)
+ bot.log("Sync complted at #{Time.now}")
+ end
end
end
|
Print sync completion to logs
|
diff --git a/lib/helpers/string_formatter.rb b/lib/helpers/string_formatter.rb
index abc1234..def5678 100644
--- a/lib/helpers/string_formatter.rb
+++ b/lib/helpers/string_formatter.rb
@@ -22,6 +22,14 @@ new_string << "..." if truncated
new_string
end
+
+ def pluralize(count, plural)
+ if (count == 1)
+ self
+ else
+ plural
+ end
+ end
end
class String
|
Add pluralize method to StringFormatter module
|
diff --git a/config/environments/development.rb b/config/environments/development.rb
index abc1234..def5678 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -38,4 +38,6 @@
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
+
+ config.web_console.whitelisted_ips = "192.168.33.1"
end
|
Support web console on vagrant
|
diff --git a/config/initializers/delayed_job.rb b/config/initializers/delayed_job.rb
index abc1234..def5678 100644
--- a/config/initializers/delayed_job.rb
+++ b/config/initializers/delayed_job.rb
@@ -1 +1,2 @@ Delayed::Worker.destroy_failed_jobs = false
+Delayed::Worker.logger = Logger.new(File.join(Rails.root, 'log', 'delayed_job.log'))
|
Add log file for delayed job
|
diff --git a/lib/vagrant-proxyconf/action.rb b/lib/vagrant-proxyconf/action.rb
index abc1234..def5678 100644
--- a/lib/vagrant-proxyconf/action.rb
+++ b/lib/vagrant-proxyconf/action.rb
@@ -1,17 +1,29 @@ require_relative 'action/configure_apt_proxy'
require_relative 'action/configure_chef_proxy'
require_relative 'action/configure_env_proxy'
+require_relative 'action/only_once'
module VagrantPlugins
module ProxyConf
# Middleware stack builders
class Action
# Returns an action middleware stack that configures the VM
- def self.configure
- @configure ||= Vagrant::Action::Builder.new.tap do |b|
- b.use ConfigureEnvProxy
- b.use ConfigureChefProxy
- b.use ConfigureAptProxy
+ #
+ # @param opts [Hash] the options to be passed to {OnlyOnce}
+ # @option (see OnlyOnce#initialize)
+ def self.configure(opts = {})
+ Vagrant::Action::Builder.build(OnlyOnce, opts, &config_actions)
+ end
+
+ private
+
+ # @return [Proc] the block that adds config actions to the specified
+ # middleware builder
+ def self.config_actions
+ @actions ||= Proc.new do |builder|
+ builder.use ConfigureEnvProxy
+ builder.use ConfigureChefProxy
+ builder.use ConfigureAptProxy
end
end
end
|
Use OnlyOnce to build the middleware stack
|
diff --git a/propono.gemspec b/propono.gemspec
index abc1234..def5678 100644
--- a/propono.gemspec
+++ b/propono.gemspec
@@ -18,7 +18,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
- spec.add_dependency "fog", "~> 1.15.0"
+ spec.add_dependency "fog", "~> 1.15"
spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake"
|
Allow dot releases to fog
|
diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/accounts_controller.rb
+++ b/app/controllers/accounts_controller.rb
@@ -2,17 +2,25 @@ def new
@account = Account.new
@new_account_user = User.new
+ @person = Person.new
end
def create
user_params = params.require(:user).permit(:email, :password, :password_confirmation)
account_params = params.require(:account).permit(:name)
+ person_params = params.require(:person).permit(:name)
- @new_account_user = User.new user_params
+ @new_account_user = User.new user_params
@account = Account.new account_params
+ @person = Person.new person_params
+
+ @person.email = @new_account_user.email
+
@account.new_account_user = @new_account_user
+ @new_account_user.person = @person
- if @new_account_user.valid? && @account.valid? && @account.save
+
+ if @new_account_user.valid? && @account.valid? && @person.valid? && @account.save
redirect_to root_url, notice: 'You have successfully signed up! Try logging in!'
else
render 'new'
|
Add logic to create a new person along with the account and user (and sync emails between user and person).
|
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -10,14 +10,12 @@
if user && user.authenticate(params[:password])
session[:user_id] = user.id
- # TODO: redirect to the originally requested resource if it was a GET request
if cookies[:original_request].present?
- target = url_for Marshal.load(cookies[:original_request])
cookies.delete :original_request
+ redirect_to url_for Marshal.load(cookies[:original_request])
else
- target = root_url
+ redirect_to root_url, notice: t(:hello)
end
- redirect_to target
else
flash.alert = t(:invalid_password_or_email)
redirect_to new_session_url
|
Put the notice back and removed TODO
|
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -8,21 +8,26 @@ else
user = User.find_by(handle: params[:session][:login])
end
- if user.failed_sign_in_attempts >= 5
- flash.now[:alert] = "Your account is currently locked. Please contact a site administrator to unlock it."
- render :new
- elsif user && user.authenticate(params[:session][:password])
- if !user.confirmed_at.nil?
- flash[:success] = "Signed in as #{user.handle}."
- sign_in(user)
- params[:session][:remember_me] == "1" ? remember(user) : forget(user)
- redirect_to post_auth_path
+ if user.present?
+ if user.failed_sign_in_attempts >= 5
+ flash.now[:alert] = "Your account is currently locked. Please contact a site administrator to unlock it."
+ render :new
+ elsif user.authenticate(params[:session][:password])
+ if !user.confirmed_at.nil?
+ flash[:success] = "Signed in as #{user.handle}."
+ sign_in(user)
+ params[:session][:remember_me] == "1" ? remember(user) : forget(user)
+ redirect_to post_auth_path
+ else
+ flash.now[:alert] = "You need to confirm your email address before continuing."
+ render :new
+ end
else
- flash.now[:alert] = "You need to confirm your email address before continuing."
+ user.increment! :failed_sign_in_attempts
+ flash.now[:alert] = "Invalid email/username & password combination."
render :new
end
else
- user.increment! :failed_sign_in_attempts
flash.now[:alert] = "Invalid email/username & password combination."
render :new
end
|
Fix sessions controller bug for nonexistent users.
|
diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/snippets_controller.rb
+++ b/app/controllers/snippets_controller.rb
@@ -21,6 +21,7 @@
def show
set_snippet
+ @stories = @snippet.stories
end
private
|
Add stories instance variable to show controller
|
diff --git a/user_with_email/app/forms/user_form.rb b/user_with_email/app/forms/user_form.rb
index abc1234..def5678 100644
--- a/user_with_email/app/forms/user_form.rb
+++ b/user_with_email/app/forms/user_form.rb
@@ -1,5 +1,3 @@-require "form_object"
-
class UserForm < FormObject::Base
attributes :name, :age, :gender, of: :user
attributes :address, of: :email
|
Remove redundant user of require in UserForm. The FormObject is autoloaded.
|
diff --git a/spec/integrations/fetch_image_spec.rb b/spec/integrations/fetch_image_spec.rb
index abc1234..def5678 100644
--- a/spec/integrations/fetch_image_spec.rb
+++ b/spec/integrations/fetch_image_spec.rb
@@ -0,0 +1,35 @@+require 'spec_helper'
+
+describe "Getting an image" do
+ describe "Search by target" do
+ before(:all) do
+ target_request = SkyMorph::TargetRequest.new("J99TS7A")
+ target_response = target_request.fetch
+ @parsed_table = Skymorph::ObservationTableParser.parse(target_response)
+ end
+
+ it "should find multiple rows" do
+ expect(@parsed_table.count).to be > 1
+ end
+
+ it "random row should contain key" do
+ expect(@parsed_table.sample).to include(:key)
+ end
+
+ describe "Get image from key" do
+ before(:all) do
+ key = @parsed_table.sample[:key]
+ image_request = SkyMorph::ImageRequest.new(key)
+ image_response = image_request.fetch
+ image_parser = SkyMorph::ImageParser.new
+ @image_url = image_parser.parse_html(image_response)
+ end
+
+
+ it "Should be a url to an image" do
+ expect(@image_url).to start_with("http")
+ expect(@image_url).to end_with("gif")
+ end
+ end
+ end
+end
|
Add integration test for image fetching
|
diff --git a/spec/unit/need_state_listener_spec.rb b/spec/unit/need_state_listener_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/need_state_listener_spec.rb
+++ b/spec/unit/need_state_listener_spec.rb
@@ -9,12 +9,16 @@
it 'marks a need as done and records the public url when a message received' do
need = FactoryGirl.create(:need, :indexer => NullIndexer)
- panopticon_has_metadata('id' => 12345, 'need_id' => need.id, 'slug' => 'my_slug')
+ Rails.logger.warn "NSL TEST: Created need: #{need.inspect}"
+ panopticon_url = panopticon_has_metadata('id' => 12345, 'need_id' => need.id, 'slug' => 'my_slug')
+ Rails.logger.warn "NSL TEST: Created in panopticon: #{panopticon_url}"
listener = NeedStateListener.new
listener.act_on_published({'panopticon_id' => 12345})
+ Rails.logger.warn "NSL TEST: Acted on panopticon - Need is now #{need.status}"
need.reload
+ Rails.logger.warn "NSL TEST: Reloaded need: #{need.inspect}"
need.should be_done
need.url.should =~ %r{/my_slug$}
end
|
Add extra logging to try and work out why test fails on jenkins but not locally
|
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -8,7 +8,7 @@
if user && user.authenticate(params[:password])
respond_to do |format|
- format.json { render json: 'logged in ok', status: 200}
+ format.json { render json: ActiveSupport::JSON.encode(user), status: 200}
format.html {
session[:user_id] = user.id
flash[:success] = "Welcome, #{user.username}!"
|
Add return json object to login on request .json
|
diff --git a/app/importers/iep_import/iep_storer.rb b/app/importers/iep_import/iep_storer.rb
index abc1234..def5678 100644
--- a/app/importers/iep_import/iep_storer.rb
+++ b/app/importers/iep_import/iep_storer.rb
@@ -14,9 +14,9 @@ end
def store
- student = Student.find_by_local_id(@local_id)
+ @student = Student.find_by_local_id(@local_id)
- return @logger.info("student not in db!") unless student
+ return @logger.info("student not in db!") unless @student
@logger.info("storing iep for student to db.")
|
Fix instance var/ local var mistake
|
diff --git a/app/models/hbx_enrollment_exemption.rb b/app/models/hbx_enrollment_exemption.rb
index abc1234..def5678 100644
--- a/app/models/hbx_enrollment_exemption.rb
+++ b/app/models/hbx_enrollment_exemption.rb
@@ -1,19 +1,16 @@-class EnrollmentExemption
+class HbxEnrollmentExemption
include Mongoid::Document
include Mongoid::Timestamps
- include Mongoid::Versioning
- include Mongoid::Paranoia
- # TYPES = %w[]
KINDS = %W[hardship health_care_ministry_member incarceration indian_tribe_member religious_conscience]
- auto_increment :_id
+ embedded_in :application_group
+
+ auto_increment :_id, seed: 9999
+ field :kind, type: String
field :certificate_number, type: String
- field :kind, type: String
field :start_date, type: Date
field :end_date, type: Date
-
- embedded_in :application_group
embeds_many :comments
accepts_nested_attributes_for :comments, reject_if: proc { |attribs| attribs['content'].blank? }, allow_destroy: true
|
Rename class name and fields to comply with system conventions
|
diff --git a/app/models/spree/shipment_decorator.rb b/app/models/spree/shipment_decorator.rb
index abc1234..def5678 100644
--- a/app/models/spree/shipment_decorator.rb
+++ b/app/models/spree/shipment_decorator.rb
@@ -19,17 +19,10 @@ inventory_units.group_by(&:variant).map do |variant, units|
states = {}
units.group_by(&:state).each { |state, iu| states[state] = iu.count }
+ scoper.scope(variant)
OpenStruct.new(variant: variant, quantity: units.length, states: states)
end
end
-
- # The shipment manifest is built by loading inventory units and variants from the DB
- # These variants come unscoped
- # So, we need to scope the variants just after the manifest is built
- def manifest_with_scoping
- manifest_without_scoping.each { |item| scoper.scope(item.variant) }
- end
- alias_method_chain :manifest, :scoping
def scoper
@scoper ||= OpenFoodNetwork::ScopeVariantToHub.new(order.distributor)
|
Move variant scoping from alias method into manifest method
|
diff --git a/partoo.gemspec b/partoo.gemspec
index abc1234..def5678 100644
--- a/partoo.gemspec
+++ b/partoo.gemspec
@@ -10,7 +10,7 @@ s.email = ["werekraken@gmail.com"]
s.summary = "Do cool things with par2 files."
- s.description = "Partoo parses data from par2 files allowing programatic access."
+ s.description = "Partoo parses data from par2 files allowing programmatic access."
s.homepage = "https://github.com/werekraken/partoo"
s.license = "MIT"
|
Fix typo in gemspec description.
|
diff --git a/app/views/workflows/show.json.jbuilder b/app/views/workflows/show.json.jbuilder
index abc1234..def5678 100644
--- a/app/views/workflows/show.json.jbuilder
+++ b/app/views/workflows/show.json.jbuilder
@@ -1,7 +1,9 @@ json.extract! @workflow, :name, :batch_host, :script_path, :staged_script_name, :staged_dir, :created_at, :updated_at, :status, :account
json.set! 'status_label', status_label(@workflow)
json.set! 'fs_root', Filesystem.new.fs(@workflow.staged_dir)
-json.set! 'host_title', @workflow.batch_host.titleize
+json.set! 'host_title', OODClusters[@workflow.batch_host] ?
+ OODClusters[@workflow.batch_host].metadata.title || @workflow.batch_host.titleize :
+ "Select a valid cluster in \"Job Options\""
json.folder_contents (@workflow.folder_contents) do |content|
json.set! 'path', content
json.set! 'name', Pathname(content).basename.to_s
|
Add a check in case cluster id is not valid
|
diff --git a/db/migrate/20190524142939_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb b/db/migrate/20190524142939_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb
index abc1234..def5678 100644
--- a/db/migrate/20190524142939_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb
+++ b/db/migrate/20190524142939_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb
@@ -0,0 +1,15 @@+# This migration comes from acts_as_taggable_on_engine (originally 3)
+class AddTaggingsCounterCacheToTags < ActiveRecord::Migration
+ def self.up
+ add_column :tags, :taggings_count, :integer, default: 0
+
+ ActsAsTaggableOn::Tag.reset_column_information
+ ActsAsTaggableOn::Tag.find_each do |tag|
+ ActsAsTaggableOn::Tag.reset_counters(tag.id, :taggings)
+ end
+ end
+
+ def self.down
+ remove_column :tags, :taggings_count
+ end
+end
|
Fix missing tagging_counts attribute bringing migration from gem
|
diff --git a/rainbow.gemspec b/rainbow.gemspec
index abc1234..def5678 100644
--- a/rainbow.gemspec
+++ b/rainbow.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.name = "rainbow"
spec.version = Rainbow::VERSION
- spec.authors = ["Marcin Kulik"]
+ spec.authors = ["Marcin Kulik", "Olle Jonsson"]
spec.email = ["m@ku1ik.com"]
spec.description = 'Colorize printed text on ANSI terminals'
spec.summary = 'Colorize printed text on ANSI terminals'
|
Add Olle Jonsson as author to gemspec
|
diff --git a/app/models/houston/itsm/issue.rb b/app/models/houston/itsm/issue.rb
index abc1234..def5678 100644
--- a/app/models/houston/itsm/issue.rb
+++ b/app/models/houston/itsm/issue.rb
@@ -2,7 +2,7 @@
module Houston
module Itsm
- class Issue < Struct.new(:summary, :url, :assigned_to_email, :assigned_to_user)
+ class Issue < Struct.new(:key, :summary, :url, :assigned_to_email, :assigned_to_user)
def self.open
@@ -11,8 +11,11 @@ req.ntlm_auth("Houston", "cph.pri", "gKfub6mFy9BHDs6")
response = http.request(req)
parse_issues(response.body).map do |issue|
- url = Nokogiri::HTML::fragment(issue["CallDetailLink"]).children.first[:href]
- self.new(issue["Summary"], url, issue["AssignedToEmailAddress"].try(:downcase))
+ self.new(
+ issue["SupportCallID"],
+ issue["Summary"],
+ href_of(issue["CallDetailLink"]),
+ issue["AssignedToEmailAddress"].try(:downcase))
end
end
@@ -29,6 +32,10 @@ []
end
+ def self.href_of(link)
+ Nokogiri::HTML::fragment(link).children.first[:href]
+ end
+
end
end
end
|
[refactor] Add `key` to Issue (2m)
|
diff --git a/db/migrate/20161201160452_migrate_project_statistics.rb b/db/migrate/20161201160452_migrate_project_statistics.rb
index abc1234..def5678 100644
--- a/db/migrate/20161201160452_migrate_project_statistics.rb
+++ b/db/migrate/20161201160452_migrate_project_statistics.rb
@@ -16,6 +16,7 @@ remove_column :projects, :commit_count
end
+ # rubocop: disable Migration/AddColumn
def down
add_column :projects, :repository_size, :float, default: 0.0
add_column :projects, :commit_count, :integer, default: 0
|
Disable rubocop for down method
|
diff --git a/lib/generators/rspec/controller/controller_generator.rb b/lib/generators/rspec/controller/controller_generator.rb
index abc1234..def5678 100644
--- a/lib/generators/rspec/controller/controller_generator.rb
+++ b/lib/generators/rspec/controller/controller_generator.rb
@@ -8,8 +8,6 @@ class_option :template_engine, :desc => "Template engine to generate view files"
class_option :controllers, :type => :boolean, :default => true
class_option :views, :type => :boolean, :default => true
-
- hook_for :integration_tool, :as => :integration
def create_controller_files
return unless options[:controllers]
|
Revert "Tell rails' generator to generate rspec request specs when generating a"
This reverts commit 12f0afaa0410504170fad7e5f99c75cffa0cd40d.
- Rails controller generator does not generate the routes needed for the
generated request spec. Backing this out.
|
diff --git a/Casks/android-studio.rb b/Casks/android-studio.rb
index abc1234..def5678 100644
--- a/Casks/android-studio.rb
+++ b/Casks/android-studio.rb
@@ -1,9 +1,9 @@ cask :v1 => 'android-studio' do
- version '1.4.0.10'
- sha256 '1168faf59ffbe485bfe0e95e80bd9672a3ae5599efd2b720cf4b825bd859ffa0'
+ version '1.4.1.0'
+ sha256 'b20a6a76c07bcc770b9931705fdefac144a11ba093cf9140d328bcfe4140c387'
# google.com is the official download host per the vendor homepage
- url "https://dl.google.com/dl/android/studio/ide-zips/#{version}/android-studio-ide-141.2288178-mac.zip"
+ url 'https://dl.google.com/dl/android/studio/ide-zips/1.4.1.0/android-studio-ide-141.2343393-mac.zip'
name 'Android Studio'
homepage 'https://developer.android.com/sdk/'
license :apache
|
Update Android Studio to version 1.4.1.0
Hi all,
I use static url to replaced original url with `#{version}` variable in this change,
because no only version number, but also build number are in the download url.
Maybe we can add a variable for build number to generate download url dynamically next time?
|
diff --git a/Casks/font-ahuramzda.rb b/Casks/font-ahuramzda.rb
index abc1234..def5678 100644
--- a/Casks/font-ahuramzda.rb
+++ b/Casks/font-ahuramzda.rb
@@ -2,6 +2,6 @@ url 'http://openfontlibrary.org/assets/downloads/ahuramazda/b2c0eeb9186f389749746f075b5a1abf/ahuramazda.zip'
homepage 'http://openfontlibrary.org/font/ahuramazda/'
version '1.000'
- sha1 'bc5e3a34fc4e2f7ad73a6b51c219c4dce08a9e59'
+ sha256 '5a8afb0b24ceeb98f1ef121406ceecb124f2a300c5ee7877a7ff6abdd697b160'
font 'Ahuramazda-Avestan-Font-1.0/ahuramazda.ttf'
end
|
Update Ahuramzda to sha256 checksums
|
diff --git a/lib/ljax_rails/action_view_monkey.rb b/lib/ljax_rails/action_view_monkey.rb
index abc1234..def5678 100644
--- a/lib/ljax_rails/action_view_monkey.rb
+++ b/lib/ljax_rails/action_view_monkey.rb
@@ -10,7 +10,7 @@ context.flash[id] = partial
loading = block.call if block
- %Q!<div id="#{id}" class="ljax-container" url="#{url}">#{loading}</div>!.html_safe
+ %Q!<div id="#{id}" class="ljax-container"#{ url="#{url}" if url}>#{loading}</div>!.html_safe
else
super
end
|
Append url attribute only when explicitly given
|
diff --git a/lib/redmine_git_hosting/utils/ssh.rb b/lib/redmine_git_hosting/utils/ssh.rb
index abc1234..def5678 100644
--- a/lib/redmine_git_hosting/utils/ssh.rb
+++ b/lib/redmine_git_hosting/utils/ssh.rb
@@ -9,7 +9,7 @@ file.close
begin
- output = capture('ssh-keygen', ['-l', '-f', file.path])
+ output = Utils::Exec.capture('ssh-keygen', ['-l', '-f', file.path])
rescue RedmineGitHosting::Error::GitoliteCommandException => e
raise RedmineGitHosting::Error::InvalidSshKey.new("Invalid Ssh Key : #{key}")
else
|
Fix wrong number of arguments (2 for 1)
|
diff --git a/session.gemspec b/session.gemspec
index abc1234..def5678 100644
--- a/session.gemspec
+++ b/session.gemspec
@@ -20,7 +20,7 @@ s.add_dependency('backports')
s.add_dependency('immutable', '~> 0.0.1')
- s.add_development_dependency('mapper', '~> 0.0.2')
+ #s.add_development_dependency('mapper', '~> 0.0.2')
s.add_development_dependency('rake', '~> 0.9.2')
s.add_development_dependency('rspec', '~> 1.3.2')
end
|
Disable gemspec dep on mapper
|
diff --git a/spec/dummy/config/initializers/02_omniauth.rb b/spec/dummy/config/initializers/02_omniauth.rb
index abc1234..def5678 100644
--- a/spec/dummy/config/initializers/02_omniauth.rb
+++ b/spec/dummy/config/initializers/02_omniauth.rb
@@ -6,8 +6,9 @@ # OpenID
# add 'omniauth-openid' to Gemfile and uncomment to enable OpenID
#
- #require 'openid/store/filesystem'
- #provider :openid, store: OpenID::Store::Filesystem.new(Rails.root.join('tmp'))
+ require 'omniauth-openid'
+ require 'openid/store/filesystem'
+ provider :openid, store: OpenID::Store::Filesystem.new(Rails.root.join('tmp'))
# Persona
# add 'omniauth-persona' to Gemfile and uncomment to enable Persona
|
Enable openid in the dummy app, for use in specs
|
diff --git a/app/controllers/pet/steps_controller.rb b/app/controllers/pet/steps_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/pet/steps_controller.rb
+++ b/app/controllers/pet/steps_controller.rb
@@ -3,8 +3,30 @@ steps *Pet.form_steps
def show
+ @pet = Pet.find(params[:pet_id])
+ render_wizard
end
def update
+ @pet = Pet.find(params[:pet_id])
+ @pet.update(pet_params(step))
+ render_wizard @pet
end
+
+ private
+
+ def pet_params(step)
+ permitted_attributes = case step
+ when "identity"
+ [:name, :owner_name]
+ when "characteristics"
+ [:colour, :special_characteristics]
+ when "instructions"
+ [:special_instructions]
+ end
+
+ params.require(:pet).permit(permitted_attributes).merge(form_step: step)
+ end
+
end
+
|
Implement shown and update actions for steps controller
|
diff --git a/spec/flipper/instrumentation/metriks_subscriber_spec.rb b/spec/flipper/instrumentation/metriks_subscriber_spec.rb
index abc1234..def5678 100644
--- a/spec/flipper/instrumentation/metriks_subscriber_spec.rb
+++ b/spec/flipper/instrumentation/metriks_subscriber_spec.rb
@@ -17,9 +17,9 @@ context "for enabled feature" do
it "updates feature metrics when calls happen" do
flipper[:stats].enable(user)
+ Metriks.timer("flipper.feature_operation.enable").count.should be(1)
+
flipper[:stats].enabled?(user)
-
- Metriks.timer("flipper.feature_operation.enable").count.should be(1)
Metriks.timer("flipper.feature_operation.enabled").count.should be(1)
Metriks.meter("flipper.feature.stats.enabled").count.should be(1)
end
@@ -28,9 +28,9 @@ context "for disabled feature" do
it "updates feature metrics when calls happen" do
flipper[:stats].disable(user)
+ Metriks.timer("flipper.feature_operation.disable").count.should be(1)
+
flipper[:stats].enabled?(user)
-
- Metriks.timer("flipper.feature_operation.disable").count.should be(1)
Metriks.timer("flipper.feature_operation.enabled").count.should be(1)
Metriks.meter("flipper.feature.stats.disabled").count.should be(1)
end
|
Move metriks around to directly after calls.
|
diff --git a/spec/generators/clearance/views/views_generator_spec.rb b/spec/generators/clearance/views/views_generator_spec.rb
index abc1234..def5678 100644
--- a/spec/generators/clearance/views/views_generator_spec.rb
+++ b/spec/generators/clearance/views/views_generator_spec.rb
@@ -22,7 +22,6 @@
view_files.each do |each|
expect(each).to exist
- expect(each).to have_correct_syntax
end
end
|
Remove broken ammeter helper method
|
diff --git a/config/initializers/gov_uk_delivery.rb b/config/initializers/gov_uk_delivery.rb
index abc1234..def5678 100644
--- a/config/initializers/gov_uk_delivery.rb
+++ b/config/initializers/gov_uk_delivery.rb
@@ -1,8 +1,12 @@ require 'gds_api/gov_uk_delivery'
require 'plek'
-unless ENV['USE_GOVUK_DELIVERY']
- Whitehall.govuk_delivery_client = GdsApi::GovUkDelivery.new(Plek.current.find('govuk-delivery'), {noop: true})
+unless Rails.env.production? || ENV['USE_GOVUK_DELIVERY']
+ options = {
+ noop: true,
+ stdout: Rails.env.development?
+ }
+ Whitehall.govuk_delivery_client = GdsApi::GovUkDelivery.new(Plek.current.find('govuk-delivery'), options)
else
Whitehall.govuk_delivery_client = GdsApi::GovUkDelivery.new(Plek.current.find('govuk-delivery'))
end
|
Change initialiser to log in development
Does nothing, logs requests.
|
diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb
index abc1234..def5678 100644
--- a/config/initializers/wrap_parameters.rb
+++ b/config/initializers/wrap_parameters.rb
@@ -5,10 +5,10 @@
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
- wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
+ wrap_parameters format: [:json]
end
-# To enable root element in JSON for ActiveRecord objects.
-# ActiveSupport.on_load(:active_record) do
-# self.include_root_in_json = true
-# end
+# Disable root element in JSON by default.
+ActiveSupport.on_load(:active_record) do
+ self.include_root_in_json = false
+end
|
Disable root element in JSON
|
diff --git a/test/models/address_test.rb b/test/models/address_test.rb
index abc1234..def5678 100644
--- a/test/models/address_test.rb
+++ b/test/models/address_test.rb
@@ -1,7 +1,10 @@ require 'test_helper'
class AddressTest < ActiveSupport::TestCase
- # test "the truth" do
- # assert true
- # end
+ test "Should match country name" do
+ assert_equal 'Brazil', Address.new(country: 'BR').country_name
+ assert_equal 'United States', Address.new(country: 'US').country_name
+ assert_equal 'Poland', Address.new(country: 'PL').country_name
+ assert_equal 'Germany', Address.new(country: 'DE').country_name
+ end
end
|
Add test for Address country_name method
|
diff --git a/roles/rails.rb b/roles/rails.rb
index abc1234..def5678 100644
--- a/roles/rails.rb
+++ b/roles/rails.rb
@@ -1,3 +1,3 @@ name 'rails'
description 'This role configures a Rails stack using Unicorn'
-run_list "recipe[apt]", "recipe[build-essential]", "recipe[mysql::server]", "recipe[packages]", "recipe[bundler]", "recipe[bluepill]", "recipe[nginx]", "recipe[rails]", "recipe[ruby_build]", "recipe[rbenv::user]", "recipe[rails::databases]", "recipe[git]", "recipe[ssh_deploy_keys]", "recipe[postfix]"
+run_list "recipe[apt]", "recipe[build-essential]", "recipe[mysql::server]", "recipe[packages]", "recipe[bundler]", "recipe[bluepill]", "recipe[nginx]", "recipe[rails]", "recipe[ruby_build]", "recipe[rbenv]", "recipe[rails::databases]", "recipe[git]", "recipe[ssh_deploy_keys]", "recipe[postfix]"
|
Drop rbenv::user and use new rbenv cookbook
|
diff --git a/example.rb b/example.rb
index abc1234..def5678 100644
--- a/example.rb
+++ b/example.rb
@@ -1,4 +1,8 @@ require_relative "lib/mozart"
+
+# this generates a wrapper which will delegate
+# methods to a target object, but prevents
+# public calls to anything not in the whitelist
Stack = Mozart.context(:push, :pop) do
def each
|
Add a bit more documentation
|
diff --git a/lib/aquatone/collectors/wayback.rb b/lib/aquatone/collectors/wayback.rb
index abc1234..def5678 100644
--- a/lib/aquatone/collectors/wayback.rb
+++ b/lib/aquatone/collectors/wayback.rb
@@ -0,0 +1,22 @@+require 'uri'
+
+module Aquatone
+ module Collectors
+ class Crtsh < Aquatone::Collector
+ self.meta = {
+ :name => "Wayback Machine",
+ :author => "Joel (@jolle)",
+ :description => "Uses Wayback Machine by Internet Archive to find unique hostnames"
+ }
+
+ def run
+ response = get_request("http://web.archive.org/cdx/search/cdx?url=*.#{url_escape(domain.name)}&output=json&fl=original&collapse=urlkey")
+
+ response.parsed_response do |page|
+ if page[0] != "original"
+ add_host(URI.parse(page[0]).host)
+ end
+ end
+ end
+ end
+end
|
Add Wayback Machine as a collector
|
diff --git a/lib/bitballoon/collection_proxy.rb b/lib/bitballoon/collection_proxy.rb
index abc1234..def5678 100644
--- a/lib/bitballoon/collection_proxy.rb
+++ b/lib/bitballoon/collection_proxy.rb
@@ -19,7 +19,7 @@ end
def all(options = {})
- response = client.request(:get, [prefix, path].compact.join("/"), options)
+ response = client.request(:get, [prefix, path].compact.join("/"), {:params => options})
response.parsed.map {|attributes| model.new(client, attributes) } if response.parsed
end
|
Make sure custom parameters gets passed to query for collection.all
|
diff --git a/lib/cask/artifact/caskroom_only.rb b/lib/cask/artifact/caskroom_only.rb
index abc1234..def5678 100644
--- a/lib/cask/artifact/caskroom_only.rb
+++ b/lib/cask/artifact/caskroom_only.rb
@@ -6,4 +6,8 @@ def install_phase
# do nothing
end
+
+ def uninstall_phase
+ # do nothing
+ end
end
|
Add uninstall_phase method to CaskroomOnly artifact
|
diff --git a/test/dummy/app/controllers/exception_test_controller.rb b/test/dummy/app/controllers/exception_test_controller.rb
index abc1234..def5678 100644
--- a/test/dummy/app/controllers/exception_test_controller.rb
+++ b/test/dummy/app/controllers/exception_test_controller.rb
@@ -10,6 +10,6 @@
def test_method
test2 = "Test2"
- raise StandardError
+ params.fetch(:error_in_library_code)
end
end
|
Raise inside a library code for the test controller
That way, we can see whether the evaluated binding is inside the
StrongParameters code, which it shouldn't be, as we display the first
application code on the error pages.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.