diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/spec/controllers/course/video/submission/submissions_controller_spec.rb b/spec/controllers/course/video/submission/submissions_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/course/video/submission/submissions_controller_spec.rb
+++ b/spec/controllers/course/video/submission/submissions_controller_spec.rb
@@ -34,5 +34,21 @@ end
end
end
+
+ describe '#edit' do
+ subject do
+ get :edit, params: { course_id: course, video_id: video, id: submission }
+ end
+
+ context "when student accesses another student's submission" do
+ let(:student1) { create(:course_student, course: course) }
+ let(:student2) { create(:course_student, course: course) }
+ let(:submission) { create(:video_submission, video: video, creator: student2.user) }
+
+ before { sign_in(student1.user) }
+
+ it { is_expected.to redirect_to(course_video_path(course, video)) }
+ end
+ end
end
end
|
Add specs for Submission redirect
Signed-off-by: Shen Yichen <be3bb257ef8d73236feaba36cd3e5ee9095e6819@gmail.com>
|
diff --git a/spec/controllers/ajax/anonymous_block_controller_spec.rb b/spec/controllers/ajax/anonymous_block_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/ajax/anonymous_block_controller_spec.rb
+++ b/spec/controllers/ajax/anonymous_block_controller_spec.rb
@@ -0,0 +1,59 @@+# frozen_string_literal: true
+require "rails_helper"
+
+describe Ajax::AnonymousBlockController, :ajax_controller, type: :controller do
+ describe "#create" do
+ subject { post(:create, params: params) }
+
+ context "user signed in" do
+ let(:user) { FactoryBot.create(:user) }
+
+ before do
+ sign_in(user)
+ end
+
+ context "when all parameters are given" do
+ let(:question) { FactoryBot.create(:question, author_identifier: "someidentifier") }
+ let!(:inbox) { FactoryBot.create(:inbox, user: user, question: question) }
+ let(:params) do
+ { question: question.id }
+ end
+
+ let(:expected_response) do
+ {
+ "success" => true,
+ "status" => "okay",
+ "message" => anything
+ }
+ end
+
+ it "creates an anonymous block" do
+ expect { subject }.to(change { AnonymousBlock.count }.by(1))
+ end
+
+ include_examples "returns the expected response"
+ end
+
+ context "when parameters are missing" do
+ let(:params) { {} }
+ let(:expected_response) do
+ {
+ "success" => false,
+ "status" => "parameter_error",
+ "message" => anything
+ }
+ end
+
+ it "does not create an anonymous block" do
+ expect { subject }.not_to(change { AnonymousBlock.count })
+ end
+
+ include_examples "returns the expected response"
+ end
+ end
+ end
+
+ describe "#destroy" do
+ pending
+ end
+end
|
Add test for creating anonymous blocks
|
diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/courses_helper.rb
+++ b/app/helpers/courses_helper.rb
@@ -8,7 +8,7 @@ end
def bust_course_list_cache(user)
- #Rails.cache.delete_matched "#{:current_user_current_courses}*"
- #Rails.cache.delete_matched "#{:current_user_archived_courses}*"
+ expire_fragment current_courses_cache_key(user)
+ expire_fragment archived_courses_cache_key(user)
end
end
|
Expire the fragment cache keys instead of manually deleting the cache
|
diff --git a/app/controllers/admin/banners_controller.rb b/app/controllers/admin/banners_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/admin/banners_controller.rb
+++ b/app/controllers/admin/banners_controller.rb
@@ -2,7 +2,6 @@
has_filters %w{all with_active with_inactive}, only: :index
- before_action :find_banner, only: [:edit, :update, :destroy]
before_action :banner_styles, only: [:edit, :new, :create, :update]
before_action :banner_imgs, only: [:edit, :new, :create, :update]
@@ -24,7 +23,6 @@ end
def update
- @banner.assign_attributes(banner_params)
if @banner.update(banner_params)
redirect_to admin_banners_path
else
@@ -43,10 +41,6 @@ params.require(:banner).permit(:title, :description, :target_url, :style, :image, :post_started_at, :post_ended_at)
end
- def find_banner
- @banner = Banner.find(params[:id])
- end
-
def banner_styles
@banner_styles = Setting.all.banner_style.map { |banner_style| [banner_style.value, banner_style.key.split('.')[1]] }
end
|
Remove duplicated code in Admin::BannersController
|
diff --git a/app/prawn/payslip_document.rb b/app/prawn/payslip_document.rb
index abc1234..def5678 100644
--- a/app/prawn/payslip_document.rb
+++ b/app/prawn/payslip_document.rb
@@ -1,25 +1,15 @@ class PayslipDocument < LetterDocument
def salary_table(salary)
- head = [
- t_attr(:code, LineItem),
- t_attr(:title, LineItem),
- t_attr(:times, LineItem),
- t_attr(:price, LineItem),
- t_attr(:accounted_amount, LineItem)
- ]
-
rows = []
saldo_rows = []
salary.line_items.each_with_index do |item, index|
if item.quantity == "saldo_of"
- saldo_rows << index + 1
- rows << [item.code, item.title, nil, nil, currency_fmt(item.price)]
+ saldo_rows << index
+ rows << [item.title, nil, nil, currency_fmt(item.price)]
else
- rows << [item.code, item.title, item.times_to_s, currency_fmt(item.price), currency_fmt(item.accounted_amount)]
+ rows << [item.title, item.times_to_s, currency_fmt(item.price), currency_fmt(item.accounted_amount)]
end
end
-
- rows = [head] + rows
table(rows, :width => bounds.width) do
# General cell styling
@@ -30,16 +20,13 @@ columns(0).padding_left = 0
# Columns
- columns(2..4).align = :right
+ columns(1..3).align = :right
# Saldo styling
saldo_rows.each do |index|
row(index).font_style = :bold
row(index).padding_bottom = 10
end
-
- # Header styling
- row(0).font_style = :bold
end
end
end
|
Drop heading and code from payslip.
|
diff --git a/app/controllers/user_sessions_controller.rb b/app/controllers/user_sessions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/user_sessions_controller.rb
+++ b/app/controllers/user_sessions_controller.rb
@@ -18,7 +18,7 @@ def create
redirect_to root_url and return if current_user.present?
- @user_session = UserSession.new(user_session_param)
+ @user_session = UserSession.new(user_session_param.to_h)
@user_session.save do |result|
if result
redirect_back_or_default "/"
|
Add .to_h to suppress deprecation warning
|
diff --git a/app/graphql/mutations/create_team_member.rb b/app/graphql/mutations/create_team_member.rb
index abc1234..def5678 100644
--- a/app/graphql/mutations/create_team_member.rb
+++ b/app/graphql/mutations/create_team_member.rb
@@ -2,7 +2,7 @@ field :team_member, Types::TeamMemberType, null: false
field :ticket, Types::TicketType, null: true
field :converted_signups, [Types::SignupType], null: false
- field :moved_signups, [Types::SignupMoveResultType], null: false
+ field :move_results, [Types::SignupMoveResultType], null: false
argument :event_id, Integer, required: true, camelize: false
argument :user_con_profile_id, Integer, required: true, camelize: false
@@ -23,7 +23,7 @@ team_member: result.team_member,
ticket: result.ticket,
converted_signups: result.converted_signups,
- moved_signups: result.moved_signups
+ move_results: result.move_results
}
end
end
|
Use the right field name
|
diff --git a/lib/bundle/cask_dumper.rb b/lib/bundle/cask_dumper.rb
index abc1234..def5678 100644
--- a/lib/bundle/cask_dumper.rb
+++ b/lib/bundle/cask_dumper.rb
@@ -11,7 +11,7 @@ def casks
return [] unless Bundle.cask_installed?
- @casks ||= `brew list --cask 2>/dev/null`.split("\n")
+ @casks ||= Cask::Caskroom.casks.map(&:full_name).sort(&tap_and_name_comparison)
@casks.map { |cask| cask.chomp " (!)" }
.uniq
end
|
Switch to getting cask names from Cask module
Originally the cask names were obtained by running `brew list --cask` and parsing the output. Now we're getting the cask with the `Cask::Caskroom.casks` method and stripping out the name.
|
diff --git a/pg_examiner.gemspec b/pg_examiner.gemspec
index abc1234..def5678 100644
--- a/pg_examiner.gemspec
+++ b/pg_examiner.gemspec
@@ -18,6 +18,8 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']
+ spec.add_dependency 'pg'
+
spec.add_development_dependency 'bundler', '~> 1.6'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'rspec'
|
Add pg as a dependency.
|
diff --git a/lib/vagrant-hostsupdater/Action/RemoveHosts.rb b/lib/vagrant-hostsupdater/Action/RemoveHosts.rb
index abc1234..def5678 100644
--- a/lib/vagrant-hostsupdater/Action/RemoveHosts.rb
+++ b/lib/vagrant-hostsupdater/Action/RemoveHosts.rb
@@ -5,15 +5,16 @@
def run(env)
machine_action = env[:machine_action]
- if machine_action != :destroy || !@machine.id
- if machine_action != :suspend || false != @machine.config.hostsupdater.remove_on_suspend
- if machine_action != :halt || false != @machine.config.hostsupdater.remove_on_suspend
- @ui.info "[vagrant-hostsupdater] Removing hosts"
- removeHostEntries
- else
- @ui.info "[vagrant-hostsupdater] Removing hosts on suspend disabled"
- end
+ if [:suspend, :halt].include? machine_action
+ if @machine.config.hostsupdater.remove_on_suspend == false
+ @ui.info "[vagrant-hostsupdater] Not removing hosts (remove_on_suspend false)"
+ else
+ @ui.info "[vagrant-hostsupdater] Removing hosts on suspend"
+ removeHostEntries
end
+ else
+ @ui.info "[vagrant-hostsupdater] Removing hosts"
+ removeHostEntries
end
end
|
Clean this up now that it will only be run once
This seemed to be coded in a format to accommodate it being called many times.. now we will only call it once by design so clean it up.
|
diff --git a/db/migrate/20171130201127_assign_default_value_to_playlist_tags.rb b/db/migrate/20171130201127_assign_default_value_to_playlist_tags.rb
index abc1234..def5678 100644
--- a/db/migrate/20171130201127_assign_default_value_to_playlist_tags.rb
+++ b/db/migrate/20171130201127_assign_default_value_to_playlist_tags.rb
@@ -0,0 +1,6 @@+class AssignDefaultValueToPlaylistTags < ActiveRecord::Migration
+ def change
+ # Default value of [] for tags is being set by an after_initialize callback
+ Playlist.where(tags: nil).each {|p| p.save!(validate: false) }
+ end
+end
|
Migrate old playlists so they sort properly on the tags field
|
diff --git a/app/workers/pubsubhubbub/delivery_worker.rb b/app/workers/pubsubhubbub/delivery_worker.rb
index abc1234..def5678 100644
--- a/app/workers/pubsubhubbub/delivery_worker.rb
+++ b/app/workers/pubsubhubbub/delivery_worker.rb
@@ -22,6 +22,7 @@ .headers(headers)
.post(subscription.callback_url, body: payload)
+ return subscription.destroy! if response.code > 299 && response.code < 500 && response.code != 429 # HTTP 4xx means error is not temporary, except for 429 (throttling)
raise "Delivery failed for #{subscription.callback_url}: HTTP #{response.code}" unless response.code > 199 && response.code < 300
subscription.touch(:last_successful_delivery_at)
|
Remove PuSH subscriptions when delivery is answered with a 4xx error
|
diff --git a/lib/filterrific/engine.rb b/lib/filterrific/engine.rb
index abc1234..def5678 100644
--- a/lib/filterrific/engine.rb
+++ b/lib/filterrific/engine.rb
@@ -1,3 +1,7 @@+require 'filterrific/param_set'
+require 'filterrific/action_view_extension'
+require 'filterrific/active_record_extension'
+
module Filterrific
class Engine < ::Rails::Engine
@@ -6,26 +10,16 @@
isolate_namespace Filterrific
- require 'filterrific/param_set'
+ ActiveSupport.on_load :active_record do
+ extend Filterrific::ActiveRecordExtension
+ end
+
+ ActiveSupport.on_load :action_view do
+ include Filterrific::ActionViewExtension
+ end
initializer "filterrific" do |app|
-
- ActiveSupport.on_load :active_record do
- require 'filterrific/active_record_extension'
- class ::ActiveRecord::Base
- extend Filterrific::ActiveRecordExtension::ClassMethods
- end
- end
-
- ActiveSupport.on_load :action_view do
- require 'filterrific/action_view_extension'
- class ::ActionView::Base
- include Filterrific::ActionViewExtension
- end
- end
-
app.config.assets.precompile += %w(filterrific-spinner.gif)
-
end
end
|
Change how we load code: Need to extend ActiveRecord outside of initializer block.
Otherwise we get exceptions when another library tries to load a class that uses filterrific. `filterrific` won't be known yet and raises an exception.
|
diff --git a/hyperfeed.gemspec b/hyperfeed.gemspec
index abc1234..def5678 100644
--- a/hyperfeed.gemspec
+++ b/hyperfeed.gemspec
@@ -10,7 +10,7 @@ gem.email = ["guilherme.kato@abril.com.br"]
gem.description = %q{An adapter to plug feeds content on hypermedia engines}
gem.summary = %q{An adapter to plug feeds content on hypermedia engines}
- gem.homepage = ""
+ gem.homepage = "https://github.com/gkato/hyperfeed"
gem.files = `git ls-files`.split($/)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
Add homepage to show on rubygems
|
diff --git a/lib/metybur/collection.rb b/lib/metybur/collection.rb
index abc1234..def5678 100644
--- a/lib/metybur/collection.rb
+++ b/lib/metybur/collection.rb
@@ -9,7 +9,7 @@ end
def on(event, &block)
- callback_for(event: event) << block
+ callbacks_for(event) << block
self
end
@@ -18,10 +18,10 @@ def handle_message(attributes)
event = attributes[:msg].to_sym
arguments = attributes.slice(:id, :fields, :cleared).values
- callback_for(event: event).each { |callback| callback.call(*arguments) }
+ callbacks_for(event).each { |callback| callback.call(*arguments) }
end
- def callback_for(event:)
+ def callbacks_for(event)
@callbacks[event] ||= []
end
end
|
Fix for Ruby < 2.1.0.
|
diff --git a/lib/tasks/shellcheck.rake b/lib/tasks/shellcheck.rake
index abc1234..def5678 100644
--- a/lib/tasks/shellcheck.rake
+++ b/lib/tasks/shellcheck.rake
@@ -0,0 +1,28 @@+namespace :shell do
+ desc "Run Shellcheck against shell scripts; optional commit range confines checks to scripts that have changed."
+
+ task :shellcheck, [:commit1, :commit2] do |task, args|
+ if args[:commit1] and args[:commit2]
+ out, status = Open3.capture2('git', 'diff', '--name-status', args[:commit1], args[:commit2], '--', '**/*.sh')
+ if status.success?
+ files = []
+ out.split("\n").each do |line|
+ status, filename = line.split("\t")
+ if ['M','A'].include?(status) then
+ files << filename
+ end
+ end
+ else
+ fail "git diff exited with status #{status}. Output:\n\n#{out}"
+ end
+
+ else
+ files = FileList.new('**/*.sh').to_ary
+ end
+
+ if files.length > 0 then
+ shellcheck_cmd = ['shellcheck', files].flatten
+ fail if not system(*shellcheck_cmd)
+ end
+ end
+end
|
Add Rake task to run Shellcheck
Only consider added or modified scripts by using `git diff
--name-status` and selecting files with status A or M. This avoids
trying to run shellcheck on a file that's been deleted.
Skip running shellcheck if no files are matched.
|
diff --git a/spec/support/helpers/general_system_spec_helpers.rb b/spec/support/helpers/general_system_spec_helpers.rb
index abc1234..def5678 100644
--- a/spec/support/helpers/general_system_spec_helpers.rb
+++ b/spec/support/helpers/general_system_spec_helpers.rb
@@ -2,18 +2,16 @@
module GeneralSystemSpecHelpers
def register_a_new_account
- I18n.with_locale(:bg) do
- visit root_path
- click_on 'Вход'
- click_on 'Регистрация'
- fill_in 'Потребителско име', with: 'foo'
- fill_in 'Име', with: 'foo', match: :first
- fill_in 'Имейл', with: 'foo@example.com'
- fill_in 'Парола', with: '123qweASD'
- fill_in 'Потвърждение на парола', with: '123qweASD'
- click_on "Регистрирай ме"
- visit user_confirmation_path(confirmation_token: User.first.confirmation_token)
- end
+ visit root_path
+ click_on 'Вход'
+ click_on 'Регистрация'
+ fill_in 'Потребителско име', with: 'foo'
+ fill_in 'Име', with: 'foo', match: :first
+ fill_in 'Имейл', with: 'foo@example.com'
+ fill_in 'Парола', with: '123qweASD'
+ fill_in 'Потвърждение на парола', with: '123qweASD'
+ click_on "Регистрирай ме"
+ visit user_confirmation_path(confirmation_token: User.first.confirmation_token)
end
def sign_in_with_the_new_account
|
Revert "Specify locale when registering a user"
This reverts commit 5ee41eabf8c991ad76f34a14cc97aeea876250c9.
|
diff --git a/Casks/truecrypt.rb b/Casks/truecrypt.rb
index abc1234..def5678 100644
--- a/Casks/truecrypt.rb
+++ b/Casks/truecrypt.rb
@@ -11,4 +11,5 @@ http://truecrypt.sourceforge.net/
EOS
end
+ uninstall :pkgutil => 'org.TrueCryptFoundation.TrueCrypt'
end
|
Add uninstall stanza for TrueCrypt
|
diff --git a/lib/almanack/version.rb b/lib/almanack/version.rb
index abc1234..def5678 100644
--- a/lib/almanack/version.rb
+++ b/lib/almanack/version.rb
@@ -1,6 +1,6 @@ module Almanack
CODENAME = "Garlick"
- VERSION = "1.0.4"
- HOMEPAGE = "https://github.com/Aupajo/sinatra-gcal"
- ISSUES = "https://github.com/Aupajo/sinatra-gcal/issues"
+ VERSION = "1.0.5"
+ HOMEPAGE = "https://github.com/Aupajo/almanack"
+ ISSUES = "https://github.com/Aupajo/almanack/issues"
end
|
Update homepage and issues URLs
|
diff --git a/lib/client_data/builder.rb b/lib/client_data/builder.rb
index abc1234..def5678 100644
--- a/lib/client_data/builder.rb
+++ b/lib/client_data/builder.rb
@@ -16,7 +16,7 @@
def self.property(prop)
define_method(prop) do
- if controller.respond_to?(prop)
+ if controller.respond_to?(prop, true)
controller.send(prop)
else
controller.instance_variable_get(:"@#{prop}")
|
Check if property responds to protected methods
|
diff --git a/lib/last_modified_at.rb b/lib/last_modified_at.rb
index abc1234..def5678 100644
--- a/lib/last_modified_at.rb
+++ b/lib/last_modified_at.rb
@@ -2,8 +2,8 @@ class LastModifiedAtTag < Liquid::Tag
def render(context)
article_file = context.environments.first["page"]["path"]
- article_file_path = File.join(context.registers[:site].source, article_file)
- last_commit_date = `git log --format="%ct" -- .#{article_file_path}`.strip
+ article_file_path = File.expand_path(article_file, context.registers[:site].source)
+ last_commit_date = `git log --format="%ct" -- #{article_file_path}`.strip
last_modified_time = !last_commit_date.empty? ? last_commit_date : File.mtime(article_file_path)
Time.at(last_modified_time.to_i).strftime("%d-%b-%y")
end
|
Fix article_file_path lookup and git invocation
|
diff --git a/lib/hlspider/downloader.rb b/lib/hlspider/downloader.rb
index abc1234..def5678 100644
--- a/lib/hlspider/downloader.rb
+++ b/lib/hlspider/downloader.rb
@@ -43,7 +43,7 @@ if responses[:callback].size == urls.size
responses[:callback].collect { |k,v| v }
else
- raise ConnectionError, "No all urls returned responses."
+ raise ConnectionError, "Not able to download all playlsts."
end
end
end
|
Fix wording on connection error
|
diff --git a/Framezilla.podspec b/Framezilla.podspec
index abc1234..def5678 100644
--- a/Framezilla.podspec
+++ b/Framezilla.podspec
@@ -1,6 +1,6 @@ Pod::Spec.new do |spec|
spec.name = "Framezilla"
- spec.version = "2.2.0"
+ spec.version = "2.2.1"
spec.summary = "Comfortable syntax for working with frames."
spec.homepage = "https://github.com/Otbivnoe/Framezilla"
|
Change podspec version -> 2.2.1
|
diff --git a/lib/regexpert/generator.rb b/lib/regexpert/generator.rb
index abc1234..def5678 100644
--- a/lib/regexpert/generator.rb
+++ b/lib/regexpert/generator.rb
@@ -10,8 +10,12 @@ expression = regex.to_s
str = ""
- str << regex.split.each do |el|
- expr = Regexpert::Regex.matchers.find {|exp, val| el.match(exp) } ? expr.last : el
+ regex.split.each do |el|
+ if expr = Regexpert::Regex.matchers.find {|exp, val| el.match(exp) }
+ str << expr.last
+ else
+ str << el
+ end
end
str
|
Revert accidental commit that broke stuff
This reverts commit dd5736802eadca86537734f4f63dc17dc4e2cf95.
|
diff --git a/lib/walmart_open/client.rb b/lib/walmart_open/client.rb
index abc1234..def5678 100644
--- a/lib/walmart_open/client.rb
+++ b/lib/walmart_open/client.rb
@@ -10,12 +10,11 @@ class Client
attr_reader :connection
attr_reader :config
+ attr_reader :auth_token
def initialize(config_attrs = {})
@config = Config.new(config_attrs)
@connection = ConnectionManager.new(self)
-
- @auth_token = nil
yield config if block_given?
end
@@ -33,11 +32,17 @@ end
def order(item_id)
- if !@auth_token|| @auth_token.expired?
- @auth_token = connection.request(Requests::Token.new)
- end
+ authenticate!
#connection.request(Requests::Order.new(item_id, @auth_token))
end
+
+ private
+
+ def authenticate!
+ if !@auth_token || @auth_token.expired?
+ @auth_token = connection.request(Requests::Token.new)
+ end
+ end
end
end
|
Move authentication into its own method
|
diff --git a/test/integration/default/serverspec/spec_helper.rb b/test/integration/default/serverspec/spec_helper.rb
index abc1234..def5678 100644
--- a/test/integration/default/serverspec/spec_helper.rb
+++ b/test/integration/default/serverspec/spec_helper.rb
@@ -5,7 +5,6 @@
RSpec.configure do |c|
c.before :all do
- c.os = backend(Serverspec::Commands::Base).check_os
c.path = "/sbin:/usr/sbin"
end
end
|
Remove superfluous line from serverspec spec helper
|
diff --git a/lib/heroku_rails_deflate/railtie.rb b/lib/heroku_rails_deflate/railtie.rb
index abc1234..def5678 100644
--- a/lib/heroku_rails_deflate/railtie.rb
+++ b/lib/heroku_rails_deflate/railtie.rb
@@ -3,16 +3,17 @@
module HerokuRailsDeflate
class Railtie < Rails::Railtie
- initializer "heroku_rails_deflate.middleware_initialization" do |app|
+ # Use after_initialize to ensure that all other middleware is already loaded
+ initializer "heroku_rails_deflate.middleware_initialization", :after => :load_config_initializers do |app|
# Put Rack::Deflater in the right place
- if app.config.action_controller.perform_caching
- app.middleware.insert_after Rack::Cache, Rack::Deflater
+ if app.config.action_controller.perform_caching && app.config.action_dispatch.rack_cache
+ app.config.middleware.insert_after 'Rack::Cache', 'Rack::Deflater'
else
- app.middleware.insert_before ActionDispatch::Static, Rack::Deflater
+ app.config.middleware.insert_before 'ActionDispatch::Static', 'Rack::Deflater'
end
# Insert our custom middleware for serving gzipped static assets
- app.middleware.insert_before ActionDispatch::Static, HerokuRailsDeflate::ServeZippedAssets, app.paths["public"].first, app.config.assets.prefix, app.config.static_cache_control
+ app.config.middleware.insert_after 'Rack::Deflater', 'HerokuRailsDeflate::ServeZippedAssets', app.paths["public"].first, app.config.assets.prefix, app.config.static_cache_control
end
# Set default Cache-Control headers to 365 days. Override in config/application.rb.
|
Make sure deflater is inserted into the right place
|
diff --git a/lib/reek/ast/reference_collector.rb b/lib/reek/ast/reference_collector.rb
index abc1234..def5678 100644
--- a/lib/reek/ast/reference_collector.rb
+++ b/lib/reek/ast/reference_collector.rb
@@ -6,8 +6,6 @@ # of an abstract syntax tree.
#
class ReferenceCollector
- STOP_NODES = [:class, :module, :def, :defs].freeze
-
def initialize(ast)
@ast = ast
end
@@ -22,12 +20,12 @@
def explicit_self_calls
[:self, :super, :zsuper, :ivar, :ivasgn].flat_map do |node_type|
- ast.each_node(node_type, STOP_NODES)
+ ast.each_node(node_type)
end
end
def implicit_self_calls
- ast.each_node(:send, STOP_NODES).reject(&:receiver)
+ ast.each_node(:send).reject(&:receiver)
end
end
end
|
Remove completely untested stop nodes list
|
diff --git a/rack-honeytoken.gemspec b/rack-honeytoken.gemspec
index abc1234..def5678 100644
--- a/rack-honeytoken.gemspec
+++ b/rack-honeytoken.gemspec
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
spec.name = "rack-honeytoken"
spec.version = Rack::Honeytoken::VERSION
- spec.license = ["BSD-2-Clause"]
+ spec.license = "BSD-2-Clause"
spec.authors = ["Matthew Closson"]
spec.email = ["matthew.closson@gmail.com"]
|
Fix license statement for single license only
|
diff --git a/rails-footnotes.gemspec b/rails-footnotes.gemspec
index abc1234..def5678 100644
--- a/rails-footnotes.gemspec
+++ b/rails-footnotes.gemspec
@@ -18,7 +18,6 @@
s.add_development_dependency "rspec-rails"
s.add_development_dependency "capybara"
- s.add_development_dependency "pry-byebug"
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
Remove pry-byebug from gemspec since it's not compatible with all rubies
|
diff --git a/db/migrate/20180728095650_drop_issues_and_scopes.rb b/db/migrate/20180728095650_drop_issues_and_scopes.rb
index abc1234..def5678 100644
--- a/db/migrate/20180728095650_drop_issues_and_scopes.rb
+++ b/db/migrate/20180728095650_drop_issues_and_scopes.rb
@@ -0,0 +1,23 @@+# frozen_string_literal: true
+
+class DropIssuesAndScopes < ActiveRecord::Migration[5.2]
+ def up
+ [:issues, :scopes].each do |table|
+ drop_table table
+ end
+ end
+
+ def down
+ [:issues, :scopes].each do |table|
+ create_table table do |t|
+ t.references :site
+ t.jsonb :name_translations
+ t.jsonb :description_translations
+ t.integer :position, default: 0, null: false
+ t.string :slug, default: "", null: false
+
+ t.timestamps
+ end
+ end
+ end
+end
|
Add migration to drop issues and scopes tables
|
diff --git a/db/migrate/20220407162133_add_secret_to_settings.rb b/db/migrate/20220407162133_add_secret_to_settings.rb
index abc1234..def5678 100644
--- a/db/migrate/20220407162133_add_secret_to_settings.rb
+++ b/db/migrate/20220407162133_add_secret_to_settings.rb
@@ -0,0 +1,27 @@+# frozen_string_literal: true
+
+#
+# Copyright (C) 2022 - present Instructure, Inc.
+#
+# This file is part of Canvas.
+#
+# Canvas is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Affero General Public License as published by the Free
+# Software Foundation, version 3 of the License.
+#
+# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Affero General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+class AddSecretToSettings < ActiveRecord::Migration[6.0]
+ tag :predeploy
+
+ def change
+ add_column :settings, :secret, :boolean, default: false, null: false, if_not_exists: true
+ end
+end
|
Add `secret` column to Settings
In a subsequent commit, this will allow a setting to be marked as
"secret", and its value redacted in the forthcoming Settings UI.
refs DE-1138
flag=none
test plan:
- verify the column is added, and `setting=` is successful
Change-Id: I0dfad0ea584e199828ff04fabe91964069d3e676
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/289857
Reviewed-by: Jeremy Stanley <b3f594e10a9edcf5413cf1190121d45078c62290@instructure.com>
Migration-Review: Jeremy Stanley <b3f594e10a9edcf5413cf1190121d45078c62290@instructure.com>
Tested-by: Service Cloud Jenkins <9144042a601061f88f1e1d7a1753ea3e2972119d@instructure.com>
QA-Review: Isaac Moore <258108225390078ef47d1319acab49ad7948abf1@instructure.com>
Product-Review: Isaac Moore <258108225390078ef47d1319acab49ad7948abf1@instructure.com>
|
diff --git a/lib/flipper/feature_check_context.rb b/lib/flipper/feature_check_context.rb
index abc1234..def5678 100644
--- a/lib/flipper/feature_check_context.rb
+++ b/lib/flipper/feature_check_context.rb
@@ -1,6 +1,10 @@ module Flipper
class FeatureCheckContext
+ # Public: The name of the feature.
attr_reader :feature_name
+
+ # Public: The GateValues instance that keeps track of the values for the
+ # gates for the feature.
attr_reader :values
def initialize(feature_name:, values:)
|
Add docs for feature check context methods
|
diff --git a/lib/git_time_machine/time_machine.rb b/lib/git_time_machine/time_machine.rb
index abc1234..def5678 100644
--- a/lib/git_time_machine/time_machine.rb
+++ b/lib/git_time_machine/time_machine.rb
@@ -18,12 +18,21 @@ delorean.accelerate(88)
end
- def back_to(time_string)
- raise "BOOM"
+ def flux_capacitated?
+ flux_capacitor.capacitated?
end
- def flux_capacitated?
- flux_capacitor.capacitated?
+ def back_to(year_string)
+ year = year_string.to_i
+ now = Time.now
+ new_time_space_continuum = Time.new(
+ year, now.month, now.day, now.hour, now.min, now.sec
+ )
+
+ puts "*********************************************"
+ puts "Time Travel Succeeded"
+ puts "*********************************************"
+ puts "The Time Now is: #{new_time_space_continuum.strftime("%I:%M%p on %A %d %B %Y")}"
end
private
|
Implement the back_to method for full time travel experience
|
diff --git a/db/migrate/20160112153334_change_community_center_to_community_centre.rb b/db/migrate/20160112153334_change_community_center_to_community_centre.rb
index abc1234..def5678 100644
--- a/db/migrate/20160112153334_change_community_center_to_community_centre.rb
+++ b/db/migrate/20160112153334_change_community_center_to_community_centre.rb
@@ -1,6 +1,11 @@ class ChangeCommunityCenterToCommunityCentre < ActiveRecord::Migration
+ class LocalNodeType < ActiveRecord::Base
+ self.table_name = 'node_types'
+
+ validates :identifier, :osm_value, :presence => true
+ end
def up
- node_type = NodeType.find_by_identifier('community_center')
+ node_type = LocalNodeType.find_by_identifier('community_center')
if node_type.nil?
return
else
@@ -11,7 +16,7 @@ end
def down
- node_type = NodeType.find_by_identifier('community_centre')
+ node_type = LocalNodeType.find_by_identifier('community_centre')
if node_type.nil?
return
else
|
Use temporary model in migration
|
diff --git a/cookbooks/cumulus/test/cookbooks/cumulus-test/recipes/default.rb b/cookbooks/cumulus/test/cookbooks/cumulus-test/recipes/default.rb
index abc1234..def5678 100644
--- a/cookbooks/cumulus/test/cookbooks/cumulus-test/recipes/default.rb
+++ b/cookbooks/cumulus/test/cookbooks/cumulus-test/recipes/default.rb
@@ -8,11 +8,10 @@ #
# Setup a skeleton fake Cumulus Linux environment
-directory '/usr/cumulus/bin' do
- recursive true
-end
-
-directory '/etc/cumulus' do
+%w( /etc/cumulus /usr/cumulus/bin /etc/network/ifupdown2/templates ).each do |cldir|
+ directory cldir do
+ recursive true
+ end
end
file '/usr/cumulus/bin/cl-license' do
@@ -21,6 +20,24 @@ mode '0755'
end
+# Setup the Cumulus repository and install ifupdown2
+execute 'apt-update' do
+ command 'apt-get update'
+ action :nothing
+end
+
+file '/etc/apt/sources.list.d/cumulus.list' do
+ content 'deb [ arch=amd64 ] http://repo.cumulusnetworks.com CumulusLinux-2.5 main'
+ notifies :run, 'execute[apt-update]', :immediately
+end
+
+%w( python-ifupdown2 python-argcomplete python-ipaddr ).each do |pkg|
+ apt_package pkg do
+ options '--force-yes'
+ end
+end
+
include_recipe "cumulus-test::ports"
include_recipe "cumulus-test::license"
include_recipe "cumulus-test::interface_policy"
+include_recipe "cumulus-test::bonds"
|
Install ifupdown2 inside the test instance
|
diff --git a/spec/lib/utusemi/configuration_spec.rb b/spec/lib/utusemi/configuration_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/utusemi/configuration_spec.rb
+++ b/spec/lib/utusemi/configuration_spec.rb
@@ -1,23 +1,27 @@ describe Utusemi::Configuration do
+ let(:product) { FactoryGirl.build(:product) }
+
before do
Utusemi.configure do
- map :sample do
+ map :sample do |options|
name :title
+ caption options[:caption] || :none
end
end
class Product < ActiveRecord::Base; end
end
subject { Product }
-
it { should respond_to(:utusemi) }
context 'ActiveRecord::Base#utusemi' do
- let(:product) { FactoryGirl.build(:product) }
-
subject { product.utusemi(:sample) }
-
it { should respond_to(:title) }
it { should respond_to(:name) }
end
+
+ context 'ActiveRecord::Base#utusemi with options' do
+ subject { product.utusemi(:sample, caption: :title) }
+ it { expect(subject.caption).to eq(subject.title) }
+ end
end
|
Add a test for options argument
|
diff --git a/spec/scss_lint/linter_registry_spec.rb b/spec/scss_lint/linter_registry_spec.rb
index abc1234..def5678 100644
--- a/spec/scss_lint/linter_registry_spec.rb
+++ b/spec/scss_lint/linter_registry_spec.rb
@@ -2,22 +2,31 @@
describe SCSSLint::LinterRegistry do
context 'when including the LinterRegistry module' do
+ after do
+ described_class.linters.delete(FakeLinter)
+ end
+
it 'adds the linter to the set of registered linters' do
expect do
class FakeLinter < SCSSLint::Linter
include SCSSLint::LinterRegistry
end
- end.to change { SCSSLint::LinterRegistry.linters.count }.by(1)
+ end.to change { described_class.linters.count }.by(1)
end
end
describe '.extract_linters_from' do
module SCSSLint
- class Linter::SomeLinter < Linter; include LinterRegistry; end
- class Linter::SomeOtherLinter < Linter::SomeLinter; end
+ class Linter::SomeLinter < Linter; end
+ class Linter::SomeOtherLinter < Linter; end
end
+
let(:linters) do
[SCSSLint::Linter::SomeLinter, SCSSLint::Linter::SomeOtherLinter]
+ end
+
+ before do
+ described_class.stub(:linters).and_return(linters)
end
context 'when the linters exist' do
|
Fix LinterRegistry specs to not pollute actual registry
In the process of writing some other specs, there was a problem where
the linters inserted into the registry by this spec were breaking other
specs.
Fix by modifying the specs to not modify the global linter registry.
Change-Id: I22c0e282003da4f6ebc8f52758654f338e64bd5f
Reviewed-on: https://gerrit.causes.com/30918
Tested-by: jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@causes.com>
Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com>
|
diff --git a/spec/views/batch/edit.html.erb_spec.rb b/spec/views/batch/edit.html.erb_spec.rb
index abc1234..def5678 100644
--- a/spec/views/batch/edit.html.erb_spec.rb
+++ b/spec/views/batch/edit.html.erb_spec.rb
@@ -1,8 +1,12 @@ require 'spec_helper'
describe 'batch/edit.html.erb' do
- let(:batch) { stub_model(Batch, id: '123') }
- let(:generic_file) { stub_model(GenericFile, id: nil, depositor: 'bob', rights: ['']) }
+ let(:batch) { Batch.create }
+ let(:generic_file) do
+ GenericFile.new(title: ['some title']).tap do |f|
+ f.apply_depositor_metadata("bob")
+ end
+ end
let(:form) { Sufia::Forms::BatchEditForm.new(generic_file) }
before do
|
Use real objects for view test
|
diff --git a/db/migrate/096_create_translation_tables.rb b/db/migrate/096_create_translation_tables.rb
index abc1234..def5678 100644
--- a/db/migrate/096_create_translation_tables.rb
+++ b/db/migrate/096_create_translation_tables.rb
@@ -14,10 +14,11 @@ publicbody.translated_attributes.each do |a, default|
value = publicbody.read_attribute(a)
unless value.nil?
- publicbody.send(:"#{a}=", publicbody.read_attribute(a))
+ publicbody.send(:"#{a}=", value)
end
end
- end
+ publicbody.save!
+ end
end
|
Save the default translated values for publicbody entities.
|
diff --git a/ext/hiredis_ext/extconf.rb b/ext/hiredis_ext/extconf.rb
index abc1234..def5678 100644
--- a/ext/hiredis_ext/extconf.rb
+++ b/ext/hiredis_ext/extconf.rb
@@ -10,8 +10,13 @@
RbConfig::CONFIG['configure_args'] =~ /with-make-prog\=(\w+)/
make_program = $1 || ENV['make']
-unless make_program then
- make_program = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
+make_program ||= case RUBY_PLATFORM
+when /mswin/
+ 'nmake'
+when /(bsd|solaris)/
+ 'gmake'
+else
+ 'make'
end
# Make sure hiredis is built...
|
Add default for BSD and Solaris to gmake
|
diff --git a/tasks/valgrind.rake b/tasks/valgrind.rake
index abc1234..def5678 100644
--- a/tasks/valgrind.rake
+++ b/tasks/valgrind.rake
@@ -0,0 +1,3 @@+task :valgrind do
+ `valgrind --suppressions=gir_ffi-ruby1.9.1.supp --leak-check=full ruby1.9.1 -Ilib -e "require 'ffi-gobject_introspection'"`
+end
|
Add task to simplify Valgrind run.
|
diff --git a/httparty.gemspec b/httparty.gemspec
index abc1234..def5678 100644
--- a/httparty.gemspec
+++ b/httparty.gemspec
@@ -19,7 +19,7 @@ s.add_dependency 'multi_xml', ">= 0.5.2"
# If this line is removed, all hard partying will cease.
- s.post_install_message = "When you HTTParty, you must party hard! 🎉"
+ s.post_install_message = "When you HTTParty, you must party hard!"
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
Remove high-byte emoji from post-install message
Since @jnunemaker will never remove the message (even though he never sees it because he runs with `--quiet`), at least make it so that the regular output is ASCII.
|
diff --git a/app/controllers/casts_controller.rb b/app/controllers/casts_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/casts_controller.rb
+++ b/app/controllers/casts_controller.rb
@@ -2,10 +2,10 @@ def index
@anime = Anime.find(params[:anime_id])
@casting = @anime.castings.includes(:character)
- respond_to do |f|
- f.json do
+ respond_to do |format|
+ format.json do
if params[:type] == "character_names"
- render :json => @casting.select {|x| x.character_id }.map {|x| x.character.name }
+ render :json => @casting.where(featured: false).select {|x| x.character_id }.map {|x| x.character.name.strip }.uniq
end
end
end
|
Fix duplicate suggestions in the character name typeahead.
|
diff --git a/app/controllers/items_controller.rb b/app/controllers/items_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/items_controller.rb
+++ b/app/controllers/items_controller.rb
@@ -2,7 +2,7 @@ helper_method :display_user_votes_for, :new_item_for_current_user
def index
- @items = Item.all.page params[:page]
+ @items = Item.all.includes(:user_votes).page params[:page]
end
def show
|
Add Includes User Votes When Getting Items
|
diff --git a/rails_event_store-rspec/rails_event_store-rspec.gemspec b/rails_event_store-rspec/rails_event_store-rspec.gemspec
index abc1234..def5678 100644
--- a/rails_event_store-rspec/rails_event_store-rspec.gemspec
+++ b/rails_event_store-rspec/rails_event_store-rspec.gemspec
@@ -25,4 +25,6 @@ spec.add_development_dependency 'mutant-rspec', '~> 0.8.14'
spec.add_development_dependency 'rails', '~> 5.1'
spec.add_development_dependency 'rails_event_store', '= 0.25.2'
+
+ spec.add_runtime_dependency 'rspec', '~> 3.0'
end
|
Revert rspec as runtime dependency
Without rspec gem tests are failing with LoadError:
cannot load such file -- rspec
Regression fix #115
|
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -10,11 +10,21 @@ @user = User.find_or_create_by(email: user_params[:email])
if @user.update(user_params)
@user.active = true; @user.save
- session[:user_id] = @user.id
- redirect_to user_path(@user)
+ respond_to do |format|
+ format.json { render nothing: true, status:200, location: @user}
+ format.html {
+ redirect_to user_path(@user)
+ session[:user_id] = @user.id
+ }
+ end
else
- flash[:failure] = "Signup failed."
- render :new
+ respond_to do |format|
+ format.json { render nothing: true, status:400 }
+ format.html {
+ render :new
+ flash[:failure] = "Signup failed."
+ }
+ end
end
end
@@ -51,7 +61,11 @@ end
def user_params
- params.require(:user).permit(:username, :email, :phone, :password)
+ if params[:user]
+ params.require(:user).permit(:username, :email, :phone, :password)
+ else
+ params.permit(:username, :email, :phone, :password)
+ end
end
end
|
Add initial Api handling with respond_to
|
diff --git a/GrowthPush.podspec b/GrowthPush.podspec
index abc1234..def5678 100644
--- a/GrowthPush.podspec
+++ b/GrowthPush.podspec
@@ -12,7 +12,7 @@ s.author = { "SIROK, Inc." => "support@growthpush.com" }
s.source = { :git => "https://github.com/SIROK/growthpush-ios.git", :tag => "#{s.version}" }
- s.source_files = 'GrowthPush/*.{h,m}'
+ s.source_files = 'source/GrowthPush/*.{h,m}'
s.preserve_paths = "README.*", "THIRD_PARTY_ LICENSES"
s.platform = :ios, '5.1.1'
|
Modify podspec file to pass lint.
|
diff --git a/app/helpers/forums/forums_helper.rb b/app/helpers/forums/forums_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/forums/forums_helper.rb
+++ b/app/helpers/forums/forums_helper.rb
@@ -7,7 +7,7 @@ # @param title The title to make into a reply.
# @returns string
def replize_title(title)
- if /^re:/ =~ title
+ if /^re:/i =~ title
title
else
'RE: ' + title
|
Fix case insensitive match for reply detection.
|
diff --git a/app/models/archived_pull_request.rb b/app/models/archived_pull_request.rb
index abc1234..def5678 100644
--- a/app/models/archived_pull_request.rb
+++ b/app/models/archived_pull_request.rb
@@ -1,5 +1,5 @@ class ArchivedPullRequest < ApplicationRecord
- PAST_YEARS = [2014, 2013, 2012]
+ PAST_YEARS = [2015, 2014, 2013, 2012]
belongs_to :user
scope :year, -> (year) { where('EXTRACT(year FROM "created_at") = ?', year) }
|
Add 2015 to previous archived years
|
diff --git a/lib/config/wdtk-routes.rb b/lib/config/wdtk-routes.rb
index abc1234..def5678 100644
--- a/lib/config/wdtk-routes.rb
+++ b/lib/config/wdtk-routes.rb
@@ -7,7 +7,7 @@ get '/reset' => 'user#survey_reset', :as => :survey_reset
end
- get "/help/ico-guidance-for-authorities" => redirect("https://ico.org.uk/media/for-organisations/documents/how-to-disclose-information-safely-removing-personal-data-from-information-requests-and-datasets/1432979/how-to-disclose-information-safely.pdf
+ get "/help/ico-guidance-for-authorities" => redirect("https://ico.org.uk/media/for-organisations/documents/how-to-disclose-information-safely-removing-personal-data-from-information-requests-and-datasets/2013958/how-to-disclose-information-safely.pdf
"),
:as => :ico_guidance
end
|
Update ico-guidance-for-authorities link to point to new pdf
|
diff --git a/capistrano-jenkins.gemspec b/capistrano-jenkins.gemspec
index abc1234..def5678 100644
--- a/capistrano-jenkins.gemspec
+++ b/capistrano-jenkins.gemspec
@@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "capistrano-jenkins"
- s.version = "0.1.3"
+ s.version = "0.1.4"
s.authors = ["Martin Jonsson"]
s.email = ["martin.jonsson@gmail.com"]
s.homepage = "http://github.com/martinj/capistrano-jenkins"
@@ -9,4 +9,5 @@ s.description = "Capistrano recipe to validate the build on jenkins status before deploying"
s.files = `git ls-files`.split("\n")
s.require_paths = ["lib"]
+ s.license = 'MIT'
end
|
Add license to gemspec and bump version.
|
diff --git a/lib/oauth2/provider/rack/authentication_mediator.rb b/lib/oauth2/provider/rack/authentication_mediator.rb
index abc1234..def5678 100644
--- a/lib/oauth2/provider/rack/authentication_mediator.rb
+++ b/lib/oauth2/provider/rack/authentication_mediator.rb
@@ -1,6 +1,5 @@ module OAuth2::Provider::Rack
class AuthenticationMediator
- attr_reader :response
attr_accessor :authorization
delegate :has_scope?, :to => :authorization
|
Remove unused accessor from the AuthenticationMediator
|
diff --git a/test/test_helper.rb b/test/test_helper.rb
index abc1234..def5678 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -4,6 +4,7 @@ require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)]
require "rails/test_help"
+require 'minitest/pride'
# Filter out Minitest backtrace while allowing backtrace from other libraries
# to be shown.
|
Add a minitest fun colors
|
diff --git a/app/workers/scheduled_machine_update_worker.rb b/app/workers/scheduled_machine_update_worker.rb
index abc1234..def5678 100644
--- a/app/workers/scheduled_machine_update_worker.rb
+++ b/app/workers/scheduled_machine_update_worker.rb
@@ -2,33 +2,20 @@ include Sidekiq::Worker
def perform
- if IDB.config.puppetdb
- IDB.config.puppetdb.api_urls.each do |url|
- api = Puppetdb::Api.new(url["url"], IDB.config.puppetdb.ssl_verify)
- namefield = "name"
+ IDB.config.puppetdb.api_urls.each do |url|
+ api = Puppetdb::Api.new(url["url"], IDB.config.puppetdb.ssl_verify)
+ namefield = "name"
- if url["version"] == "v3"
- nodes = api.get("/v3/nodes").data
- elsif url["version"] == "v4"
- nodes = api.get("/pdb/query/v4/nodes").data
- namefield = "certname"
- end
-
- if nodes
- nodes.each do |node|
- MachineUpdateWorker.perform_async(node[namefield], url["url"], url["version"])
- end
- end
+ if url["version"] == "v3"
+ nodes = api.get("/v3/nodes").data
+ elsif url["version"] == "v4"
+ nodes = api.get("/pdb/query/v4/nodes").data
+ namefield = "certname"
end
- end
-
- if IDB.config.oxidized
- oxidized_urls = IDB.config.oxidized.api_urls.map { |u| [u["url"]] }.flatten.compact
- nodes = Oxidized::Nodes.new(oxidized_urls).all
if nodes
nodes.each do |node|
- MachineUpdateWorker.perform_async(node["name"], nil, "oxidized")
+ MachineUpdateWorker.perform_async(node[namefield], url["url"], url["version"])
end
end
end
|
Revert "also query oxidized when updating"
This reverts commit 89e9cf6e9aaa0f9cde58ffbdfc1caadaafa94032.
|
diff --git a/lib/arel-ltree/ltree/predications.rb b/lib/arel-ltree/ltree/predications.rb
index abc1234..def5678 100644
--- a/lib/arel-ltree/ltree/predications.rb
+++ b/lib/arel-ltree/ltree/predications.rb
@@ -9,10 +9,14 @@ Arel::Ltree::Nodes::DescendantOf.new(self, other)
end
- def matches(*args)
- case args[0]
+ def matches(other = nil)
+ case other
+ when Attributes::Ltxtquery
+ Arel::Ltree::Nodes::Matches.new(self).ltxtquery(other)
+ when Attributes::Lquery
+ Arel::Ltree::Nodes::Matches.new(self).lquery(other)
when Attributes::Ltree
- Arel::Ltree::Nodes::Matches.new(self, args[0])
+ Arel::Ltree::Nodes::Matches.new(self).ltree(other)
when nil
Arel::Ltree::Nodes::Matches.new(self)
else
|
Allow use array as an argument of .matches method
|
diff --git a/lib/conjur/appliance/logging/railtie.rb b/lib/conjur/appliance/logging/railtie.rb
index abc1234..def5678 100644
--- a/lib/conjur/appliance/logging/railtie.rb
+++ b/lib/conjur/appliance/logging/railtie.rb
@@ -1,11 +1,26 @@ module Conjur
module Appliance
module Logging
+
+ # The current version of Rack used by the Conjur services has a
+ # CommonLogger that expects the logger passed to it to implement
+ # #write. ::Logger doesn't, so implement it here. (Later
+ # versions check for #write, and if it's not implemented, call
+ # << instead.)
+ class Logger < ::Logger
+ def write(msg)
+ self << msg
+ end
+ end
+
class Railtie < Rails::Railtie
# This initializer needs to run before anybody else has
# initialized the logger.
initializer "conjur.appliance.logging.initializer", :before => :initialize_logger do |app|
if Rails.env.to_sym == :appliance
+
+ app.middleware.swap ::Rails::Rack::Logger, ::Rack::CommonLogger, Logger.new(STDOUT)
+
app.config.log_level = Logging::RAILS_LOG_LEVEL
major = Rails.version.split('.').first.to_i
|
Add Rack::CommonLogger to the app's middleware
|
diff --git a/lib/lita/handlers/wotd.rb b/lib/lita/handlers/wotd.rb
index abc1234..def5678 100644
--- a/lib/lita/handlers/wotd.rb
+++ b/lib/lita/handlers/wotd.rb
@@ -1,10 +1,6 @@ require 'net/http'
require 'uri'
-require 'pry'
require 'rexml/document'
-require 'json'
-
-
module Lita
module Handlers
|
Remove cruft from initial development
|
diff --git a/lib/media_magick/model.rb b/lib/media_magick/model.rb
index abc1234..def5678 100644
--- a/lib/media_magick/model.rb
+++ b/lib/media_magick/model.rb
@@ -2,6 +2,28 @@ require 'carrierwave/mongoid'
require 'media_magick/attachment_uploader'
require 'mongoid'
+
+module CarrierWave
+ module Uploader
+ module Url
+ extend ActiveSupport::Concern
+ include CarrierWave::Uploader::Configuration
+
+ ##
+ # === Returns
+ #
+ # [String] the location where this file is accessible via a url
+ #
+ def url
+ if file.respond_to?(:url) and not file.url.blank?
+ file.url
+ elsif current_path
+ (base_path || "") + File.expand_path(current_path).gsub(File.expand_path(CarrierWave.root), '')
+ end
+ end
+ end
+ end
+end
module MediaMagick
module Model
|
Fix a CarrierWave 0.5.8 problem.
|
diff --git a/lib/sass/script/string_interpolation.rb b/lib/sass/script/string_interpolation.rb
index abc1234..def5678 100644
--- a/lib/sass/script/string_interpolation.rb
+++ b/lib/sass/script/string_interpolation.rb
@@ -0,0 +1,36 @@+module Sass::Script
+ class StringInterpolation < Node
+ def initialize(before, mid, after)
+ @before = before
+ @mid = mid
+ @after = after
+ end
+
+ def inspect
+ "(string_interpolation #{@before.inspect} #{@mid.inspect} #{@after.inspect})"
+ end
+
+ def to_sass(opts = {})
+ res = ""
+ res << @before.to_sass(opts)[0...-1]
+ res << '#{' << @mid.to_sass(opts) << '}'
+ res << @after.to_sass(opts)[1..-1]
+ res
+ end
+
+ def children
+ [@before, @mid, @after].compact
+ end
+
+ protected
+
+ def _perform(environment)
+ res = ""
+ res << @before.perform(environment).value
+ val = @mid.perform(environment)
+ res << (val.is_a?(Sass::Script::String) ? val.value : val.to_s)
+ res << @after.perform(environment).value
+ Sass::Script::String.new(res, :string)
+ end
+ end
+end
|
[Sass] Add the StringInterpolation file. Blah.
|
diff --git a/timeline_fu.gemspec b/timeline_fu.gemspec
index abc1234..def5678 100644
--- a/timeline_fu.gemspec
+++ b/timeline_fu.gemspec
@@ -7,7 +7,7 @@ s.version = TimelineFu::VERSION
s.authors = ["James Golick", "Mathieu Martin", "Francois Beausoleil"]
s.email = "james@giraffesoft.ca"
- s.homepage = "http://github.com/giraffesoft/timeline_fu"
+ s.homepage = "https://github.com/jamesgolick/timeline_fu"
s.summary = "Easily build timelines, much like GitHub's news feed"
s.description = "Easily build timelines, much like GitHub's news feed"
|
Change homepage to correct one.
|
diff --git a/app/models/five_colors_data.rb b/app/models/five_colors_data.rb
index abc1234..def5678 100644
--- a/app/models/five_colors_data.rb
+++ b/app/models/five_colors_data.rb
@@ -0,0 +1,7 @@+module FiveColors
+ YELLOW = [2, 7, 10, 18, 32, 33, 37, 39, 46, 47, 55, 60, 78, 79, 81, 85, 87, 89, 94, 96]
+ PINK = [1, 4, 13, 16, 22, 28, 34, 40, 48, 51, 58, 65, 66, 72, 73, 80, 83, 84, 86, 97]
+ ORANGE = [19, 21, 25, 27, 43, 44, 45, 49, 52, 53, 56, 63, 64, 67, 77, 88, 90, 95, 98, 99]
+ BLUE = [3, 5, 6, 12, 14, 24, 30, 31, 50, 57, 61, 62, 69, 70, 74, 75, 76, 82, 91, 100]
+ GREEN = [8, 9, 11, 15, 17, 20, 23, 26, 29, 35, 36, 38, 41, 42, 54, 59, 68, 71, 92, 93]
+end
|
Add module FiveColors for 五色百人一首
|
diff --git a/app/reports/integrity_check.rb b/app/reports/integrity_check.rb
index abc1234..def5678 100644
--- a/app/reports/integrity_check.rb
+++ b/app/reports/integrity_check.rb
@@ -16,12 +16,15 @@ raise "no educators" unless Educator.count > 0
end
+ def models_to_check
+ [StudentAssessment, Assessment, Educator, Student, StudentSchoolYear]
+ end
+
def has_valid_data?
- StudentAssessment.find_each(&:save!)
- Assessment.find_each(&:save!)
- Educator.find_each(&:save!)
- Student.find_each(&:save!)
- StudentSchoolYear.find_each(&:save!)
+ models_to_check.each do |model|
+ puts "Validating #{model.to_s.pluralize}..."
+ model.find_each(&:save!)
+ end
end
end
|
Make data integrity check more verbose
+ We get a stack trace and error message if there's a data problem ...
+ ... but we also need some output if there are no errors
|
diff --git a/lib/matron/git.rb b/lib/matron/git.rb
index abc1234..def5678 100644
--- a/lib/matron/git.rb
+++ b/lib/matron/git.rb
@@ -3,17 +3,19 @@ module Matron
class Git
attr_reader :repo
+ attr_accessor :diff_against
def self.from_path( path )
new Grit::Repo.new( path )
end
- def initialize( repository )
+ def initialize( repository, diff_against="HEAD" )
@repo = repository
+ @diff_against = diff_against
end
def diff()
- diffs = repo.git.diff_index( { p: true }, "HEAD" ).
+ diffs = repo.git.diff_index( { p: true }, diff_against ).
split( /^diff --git .* b(.*)$/ )
as_hash diffs
|
Allow diff version to be customized
|
diff --git a/abfab.gemspec b/abfab.gemspec
index abc1234..def5678 100644
--- a/abfab.gemspec
+++ b/abfab.gemspec
@@ -14,4 +14,8 @@ gem.name = "abfab"
gem.require_paths = ["lib"]
gem.version = ABFab::VERSION
+
+ gem.add_dependency "redis", "~> 2.2.2"
+
+ gem.add_development_dependency "rspec", "~> 2.10.0"
end
|
Add redis and rspec gems as dependencies.
|
diff --git a/lib/origami/s3_package.rb b/lib/origami/s3_package.rb
index abc1234..def5678 100644
--- a/lib/origami/s3_package.rb
+++ b/lib/origami/s3_package.rb
@@ -25,7 +25,7 @@ protected
def package_key
- "#{version}/#{version}.apk"
+ "#{version}/Kickstarter-#{version}.apk"
end
end
end
|
Append "Kickstarter-" to package name
Friendlier than just the number jumble
|
diff --git a/lib/dcenv/cli.rb b/lib/dcenv/cli.rb
index abc1234..def5678 100644
--- a/lib/dcenv/cli.rb
+++ b/lib/dcenv/cli.rb
@@ -11,11 +11,15 @@
desc "install", "Install container"
def install(*args)
- name = args[0]
- cname = to_cname(name)
+ if args.length >= 2
+ cname = to_cname(args[0])
+ iname = args[1]
+ else
+ cname = to_cname(args[0])
+ iname = args[0]
+ end
- # Support "dcenv install rust schickling/rust"
- system("docker", "run", "--name", cname, "-v", "#{Dir.home}:/root", "-dit", name)
+ system("docker", "run", "--name", cname, "-v", "#{Dir.home}:/root", "-dit", iname)
end
desc "uninstall", "Uninstall container"
|
Support second argument of install command
$ dcenv install rust schickling/rust
|
diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake
index abc1234..def5678 100644
--- a/lib/tasks/db.rake
+++ b/lib/tasks/db.rake
@@ -2,7 +2,7 @@ module RakeHelpers
def self.db_config
- @config ||= YAML.load_file("config/database.yml")[ENV['RAILS_ENV'] || 'development'] || {}
+ @config ||= db_config_file_data[ENV['RAILS_ENV'] || 'development'] || {}
end
def self.db_cmd_with_password(cmd, pw)
@@ -21,6 +21,12 @@ db_config["adapter"] == "mysql"
end
+ def self.db_config_file_data
+ YAML.load_file("config/database.yml")
+ rescue SystemCallError
+ {}
+ end
+
end
end
|
Fix bug causing Rake task failure when no DB config
The entire `rake` command should not fail because some introspection
failed due to a missing file. This was a pretty glaring bug.
|
diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake
index abc1234..def5678 100644
--- a/lib/tasks/db.rake
+++ b/lib/tasks/db.rake
@@ -12,6 +12,8 @@ 'wb_indc:import',
'adaptation:import',
'wri_metadata:import'
+ 'adaptation:import',
+ 'wb_extra:import'
]
desc 'Imports all data in correct order, replaces all data'
|
Add wb_extra import task to the main import task
|
diff --git a/lib/simple-conf/loader.rb b/lib/simple-conf/loader.rb
index abc1234..def5678 100644
--- a/lib/simple-conf/loader.rb
+++ b/lib/simple-conf/loader.rb
@@ -1,4 +1,5 @@ require 'ostruct'
+require 'yaml'
module SimpleConf
class Loader
|
Add require yaml library for parsing configuration files
|
diff --git a/lib/snapme/cli/options.rb b/lib/snapme/cli/options.rb
index abc1234..def5678 100644
--- a/lib/snapme/cli/options.rb
+++ b/lib/snapme/cli/options.rb
@@ -6,12 +6,13 @@ DEFAULT_HOST = 'http://snapme.herokuapp.com'
DEFAULT_INTERVAL = 30 #seconds
- attr_reader :daemon, :host, :interval
+ attr_reader :daemon, :host, :interval, :show_version
- def initialize(daemon: true, host: DEFAULT_HOST, interval: DEFAULT_INTERVAL)
+ def initialize(daemon: true, host: DEFAULT_HOST, interval: DEFAULT_INTERVAL, show_version: false)
@daemon = !!(daemon)
@host = host
@interval = interval.to_i
+ @show_version = show_version
end
def self.parse(args)
@@ -36,6 +37,10 @@ opts.on('-i', '--interval [SECONDS]', 'Snapshot interval') do |seconds|
options[:interval] = seconds
end
+
+ opts.on('-v', '--version', 'Print snapme version') do
+ options[:show_version] = true
+ end
end.parse!(args)
new(options)
|
Add --version option to cli
|
diff --git a/lib/table_data_service.rb b/lib/table_data_service.rb
index abc1234..def5678 100644
--- a/lib/table_data_service.rb
+++ b/lib/table_data_service.rb
@@ -42,6 +42,6 @@ end
def self.transaction_is_income?(transaction)
- transaction.metadata['is_topup'] == 'true'
+ transaction.amount.positive?
end
end
|
Fix bug in defining income vs expenditure
|
diff --git a/lib/timetress.rb b/lib/timetress.rb
index abc1234..def5678 100644
--- a/lib/timetress.rb
+++ b/lib/timetress.rb
@@ -6,6 +6,7 @@
require 'timetress/norway'
require 'timetress/usa'
+require 'timetress/scotland'
module Timetress
class BeMoreSpecific < RuntimeError; end
|
Include the Scotland module in the gem entry point.
|
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
index abc1234..def5678 100644
--- a/config/initializers/devise.rb
+++ b/config/initializers/devise.rb
@@ -6,8 +6,13 @@ OmniAuth.logger.progname = 'omniauth'
OmniAuth.config.on_failure = proc do |env|
- env['devise.mapping'] = Devise.mappings[Spree.user_class.table_name.singularize.to_sym]
- controller_name = ActiveSupport::Inflector.camelize(env['devise.mapping'].controllers[:omniauth_callbacks])
- controller_klass = ActiveSupport::Inflector.constantize("#{controller_name}Controller")
- controller_klass.action(:failure).call(env)
+ devise_scope = Spree.user_class.table_name.split('.').last.singularize.to_sym
+ env['devise.mapping'] = Devise.mappings.fetch(devise_scope)
+ controller_name = ActiveSupport::Inflector.camelize(
+ env['devise.mapping'].controllers[:omniauth_callbacks]
+ )
+ controller_class = ActiveSupport::Inflector.constantize(
+ "#{controller_name}Controller"
+ )
+ controller_class.action(:failure).call(env)
end
|
Fix OmniAuth auth failure proc
Currently we configure OmniAuth so that if the authorization step fails,
the `failure` action in Spree::OmniauthCallbacksController is called.
This controller is obtained by taking the configured Spree user class
(Spree::User), asking for its table name (`spree_users`), then looking
up the singular version of that table name (`:spree_user`) in the
`Devise.mappings` hash.
The problem is, since we've reconfigured Postgres to use multiple
tenants, the result of asking for the table name of any model is going
to start with `public.` (or whatever the tenant is, plus `.`).
So the key we look up might be `:'public.spree_user'`, not
`:spree_user`.
Fix this by essentially taking away the tenant name before looking it up
in `Devise.mappings`. Also, use `fetch` to look up the key, so if it
doesn't exist, we get a more informative error immediately.
|
diff --git a/spec/factories/posts.rb b/spec/factories/posts.rb
index abc1234..def5678 100644
--- a/spec/factories/posts.rb
+++ b/spec/factories/posts.rb
@@ -1,5 +1,5 @@ FactoryGirl.define do
factory :post do
- title { Faker::Lorem.sentence(2) }
+ title { Faker::Lorem.sentence(2)[0..60] }
end
end
|
Add length constraints to title in Post model factory
Signed-off-by: Max Fierke <0706025b2bbcec1ed8d64822f4eccd96314938d0@maxfierke.com>
|
diff --git a/lib/acts_as_flying_saucer_view.rb b/lib/acts_as_flying_saucer_view.rb
index abc1234..def5678 100644
--- a/lib/acts_as_flying_saucer_view.rb
+++ b/lib/acts_as_flying_saucer_view.rb
@@ -5,7 +5,7 @@
alias_method :old_stylesheet_link_tag, :stylesheet_link_tag
- def stylesheet_link_tag(*sources)
+ def print_stylesheet_link_tag(*sources)
options = sources.extract_options!.stringify_keys
options[:media] = 'print' if options[:media].blank?
old_stylesheet_link_tag(sources, options)
@@ -13,4 +13,4 @@
end # AssetTagHelper
end # Helpers
-end # ActionView+end # ActionView
|
Rename ActionView::Helpers::AssetTagHelper.stylesheet_link_tag to print_stylesheet_link_tag (stringify_keys doesn't work for rails3)
|
diff --git a/lib/autoprefixer-rails/railtie.rb b/lib/autoprefixer-rails/railtie.rb
index abc1234..def5678 100644
--- a/lib/autoprefixer-rails/railtie.rb
+++ b/lib/autoprefixer-rails/railtie.rb
@@ -5,29 +5,42 @@ class Railtie < ::Rails::Railtie
rake_tasks do |app|
require 'rake/autoprefixer_tasks'
- Rake::AutoprefixerTasks.new( config(app.root) ) if defined? app.assets
+ Rake::AutoprefixerTasks.new( config ) if defined? app.assets
end
if config.respond_to?(:assets) and not config.assets.nil?
config.assets.configure do |env|
- AutoprefixerRails.install(env, config(env.root))
+ AutoprefixerRails.install(env, config)
end
else
initializer :setup_autoprefixer, group: :all do |app|
if defined? app.assets and not app.assets.nil?
- AutoprefixerRails.install(app.assets, config(app.root))
+ AutoprefixerRails.install(app.assets, config)
end
end
end
- # Read browsers requirements from application config
- def config(root)
- file = File.join(root, 'config/autoprefixer.yml')
- params = ::YAML.load_file(file) if File.exist?(file)
- params ||= {}
+ # Read browsers requirements from application or engine config
+ def config
+ params = {}
+
+ roots.each do |root|
+ file = File.join(root, 'config/autoprefixer.yml')
+
+ if File.exist?(file)
+ params = ::YAML.load_file(file)
+
+ break
+ end
+ end
+
params = params.symbolize_keys
params[:env] ||= Rails.env.to_s
params
+ end
+
+ def roots
+ [Rails.application.root] + Rails::Engine.subclasses.map(&:root)
end
end
end
|
Support autoprefixer.yml's provided by engines
|
diff --git a/lib/azure/profile/subscription.rb b/lib/azure/profile/subscription.rb
index abc1234..def5678 100644
--- a/lib/azure/profile/subscription.rb
+++ b/lib/azure/profile/subscription.rb
@@ -12,5 +12,6 @@
def initialize
yield self if block_given?
+ @management_endpoint ||= DEFAULT_MANAGEMENT_ENDPOINT
end
end
|
Set a default endpoint in the constructor if one isn't set.
|
diff --git a/lib/bunny/concurrent/condition.rb b/lib/bunny/concurrent/condition.rb
index abc1234..def5678 100644
--- a/lib/bunny/concurrent/condition.rb
+++ b/lib/bunny/concurrent/condition.rb
@@ -5,13 +5,16 @@ # Akin to java.util.concurrent.Condition and intrinsic object monitors (Object#wait, Object#notify, Object#notifyAll) in Java:
# threads can wait (block until notified) on a condition other threads notify them about.
# Unlike the j.u.c. version, this one has a single waiting set.
+ #
+ # Conditions can optionally be annotated with a description string for ease of debugging.
class Condition
- attr_reader :waiting_threads
+ attr_reader :waiting_threads, :description
- def initialize
+ def initialize(description = nil)
@mutex = Mutex.new
@waiting_threads = []
+ @description = description
end
def wait
|
Make it possible to [optionally] annotate Bunny::Concurrent::Condition for ease of debugging
|
diff --git a/libPusher.podspec b/libPusher.podspec
index abc1234..def5678 100644
--- a/libPusher.podspec
+++ b/libPusher.podspec
@@ -5,7 +5,7 @@ s.summary = 'An Objective-C client for the Pusher.com service'
s.homepage = 'https://github.com/lukeredpath/libPusher'
s.author = 'Luke Redpath'
- s.source = { :git => 'https://github.com/lukeredpath/libPusher.git', :tag => 'v1.6' }
+ s.source = { :git => 'https://github.com/lukeredpath/libPusher.git', :tag => 'v1.6.1' }
s.requires_arc = true
s.header_dir = 'Pusher'
s.default_subspec = 'Core'
|
Update git tag in podspec
|
diff --git a/lib/jrb/rails/template_handler.rb b/lib/jrb/rails/template_handler.rb
index abc1234..def5678 100644
--- a/lib/jrb/rails/template_handler.rb
+++ b/lib/jrb/rails/template_handler.rb
@@ -7,7 +7,10 @@
[ "class_eval { def <<(out); @output_buffer << out; end; alias_method :write, :<< }",
"@output_buffer = ActiveSupport::SafeBuffer.new",
+ "result = begin",
template.source,
+ "end",
+ "@output_buffer << result unless result == @output_buffer",
"@output_buffer.to_s" ].join(";")
end
end
|
Write last result of template.
|
diff --git a/lib/log_memory_consumption_job.rb b/lib/log_memory_consumption_job.rb
index abc1234..def5678 100644
--- a/lib/log_memory_consumption_job.rb
+++ b/lib/log_memory_consumption_job.rb
@@ -1,8 +1,6 @@ class LogMemoryConsumptionJob < Struct.new(:last_stat)
# Number of entries do display
N = 20
- # In seconds
- PERIOD = 10
def perform
logpath = File.join(Rails.root, 'log', "#{ENV['RAILS_ENV']}_memory_consumption.log")
@@ -20,7 +18,5 @@ i += 1
end
logger << "\n"
-
- Delayed::Job.enqueue(LogMemoryConsumptionJob.new(stats), 0, PERIOD.seconds.from_now)
end
end
|
Remove peridicity on log_memory_consumption job
|
diff --git a/lib/metal_archives/cache/redis.rb b/lib/metal_archives/cache/redis.rb
index abc1234..def5678 100644
--- a/lib/metal_archives/cache/redis.rb
+++ b/lib/metal_archives/cache/redis.rb
@@ -28,11 +28,11 @@ end
def include?(key)
- redis.exists? key
+ redis.exists? cache_key_for(key)
end
def delete(key)
- redis.del key
+ redis.del cache_key_for(key)
end
private
|
Fix cache key not called
|
diff --git a/lib/rest-core/client/yahoo_buy.rb b/lib/rest-core/client/yahoo_buy.rb
index abc1234..def5678 100644
--- a/lib/rest-core/client/yahoo_buy.rb
+++ b/lib/rest-core/client/yahoo_buy.rb
@@ -7,6 +7,7 @@ Client = Builder.client(:api_key) do
use Timeout , 10
+ use DefaultQuery
use Signature, nil
use DefaultSite , 'http://tw.partner.buy.yahoo.com/api/v1/'
@@ -20,6 +21,12 @@ end
end
+ class Client
+ def default_query
+ {:pkey => api_key, :ts => Time.now.to_i}
+ end
+ end
+
def self.new *args, &block
Client.new *args, &block
end
|
Add default query (api key and timestamp) to yahoo buy
|
diff --git a/libraries/provider_cpan_module.rb b/libraries/provider_cpan_module.rb
index abc1234..def5678 100644
--- a/libraries/provider_cpan_module.rb
+++ b/libraries/provider_cpan_module.rb
@@ -5,6 +5,8 @@ class Provider
# Provider for cpan_module lwrp
class CpanModule < Chef::Provider::LWRPBase
+ provides(:cpan_module) if defined?(provides)
+
use_inline_resources
def whyrun_supported?
|
Resolve Chef 13 deprecation warning
|
diff --git a/sprockets-rails.gemspec b/sprockets-rails.gemspec
index abc1234..def5678 100644
--- a/sprockets-rails.gemspec
+++ b/sprockets-rails.gemspec
@@ -9,7 +9,7 @@ s.summary = "Sprockets Rails integration"
s.license = "MIT"
- s.files = Dir["README.md", "lib/**/*.rb", "LICENSE"]
+ s.files = Dir["README.md", "lib/**/*.rb", "MIT-LICENSE"]
s.required_ruby_version = '>= 1.9.3'
|
Fix the name of the license file
Closes #296
|
diff --git a/lib/avalon/workflow/workflow_model_mixin.rb b/lib/avalon/workflow/workflow_model_mixin.rb
index abc1234..def5678 100644
--- a/lib/avalon/workflow/workflow_model_mixin.rb
+++ b/lib/avalon/workflow/workflow_model_mixin.rb
@@ -18,7 +18,7 @@ module Avalon::Workflow
module WorkflowModelMixin
def self.included(klazz)
- klazz.has_metadata name: 'workflow', type: WorkflowDatastream
+ klazz.has_subresource 'workflow', class_name: 'WorkflowDatastream'
end
end
end
|
Use Hydra 10 style datastream declaration
|
diff --git a/lib/captain_hook/dsl/handle_post_receive.rb b/lib/captain_hook/dsl/handle_post_receive.rb
index abc1234..def5678 100644
--- a/lib/captain_hook/dsl/handle_post_receive.rb
+++ b/lib/captain_hook/dsl/handle_post_receive.rb
@@ -6,7 +6,6 @@ end
def message
- puts "post-receive: #{@post_receive_event.message}"
@post_receive_event.message
end
|
Remove debug puts for post-receive.
|
diff --git a/lib/perus/pinger/commands/chrome_execute.rb b/lib/perus/pinger/commands/chrome_execute.rb
index abc1234..def5678 100644
--- a/lib/perus/pinger/commands/chrome_execute.rb
+++ b/lib/perus/pinger/commands/chrome_execute.rb
@@ -17,6 +17,9 @@ else
result = false
end
+
+ # clean up any memory used by the executed command
+ send_command('{"id":2,"method":"Runtime.releaseObjectGroup","params":{"objectGroup":"perus"}}')
end
end
|
Clean up memory used during chrome js executions
|
diff --git a/lib/suspenders/generators/lint_generator.rb b/lib/suspenders/generators/lint_generator.rb
index abc1234..def5678 100644
--- a/lib/suspenders/generators/lint_generator.rb
+++ b/lib/suspenders/generators/lint_generator.rb
@@ -8,9 +8,12 @@ gem 'rubocop-rails', require: false, group: :development
gem 'rubocop-rspec', require: false, group: :development
gem 'slim_lint', require: false, group: :development
- gem 'overcommit', require: false, group: :development
+ gem 'overcommit', '>= 0.48.1', require: false, group: :development
gem 'rubycritic', require: false, group: :development
- Bundler.with_clean_env { run "bundle install" }
+
+ # FIXME: switch back to bundle install once https://github.com/sds/overcommit/pull/649
+ # will be merged
+ Bundler.with_clean_env { run "bundle update" }
end
def setup_rubocop
|
Use a recent version of overcommit, otherwise --sign is broken
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -4,8 +4,8 @@ require 'vcr'
require 'pry'
require 'byebug'
+require 'simplecov'
-require 'simplecov'
SimpleCov.start do
add_group 'API', 'lib/evertrue/api'
end
@@ -25,9 +25,3 @@ LinkedIn::Client.configure do |config|
config.access_token = 'AQUJwEF40pJUbVxsW_mujQ3QCiXvlTnMFk55SlfVPYRcAPdsn1oE1Hm8Ldlc61o57k96i04ufG81KFdPJIOSJswXsGyZ0tk9IMZea8sfNXMGMnZgikQJUQPkmRVYVw9BP1qH9tp7hJF32DQtzkBB_NE8xPASPVgXVWbbntChGyYqqDvF1p8'
end
-
-def stub_client_adapter(client)
- adapter = Faraday::Adapter::Test::Stubs.new
- client.connection.connection.adapter :test, adapter
- adapter
-end
|
Remove unused Faraday stubbing method
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,7 +1,10 @@ # coding: utf-8
-require 'coveralls'
-Coveralls.wear!
+# Disable code coverage for JRuby because it always reports 0% coverage.
+if RUBY_ENGINE != 'jruby'
+ require 'coveralls'
+ Coveralls.wear!
+end
require 'i18n'
if I18n.config.respond_to?(:enforce_available_locales)
|
Disable code coverage for JRuby
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,3 +1,12 @@ # encoding: utf-8
-require 'jara'+require 'jara'
+
+RSpec.configure do |config|
+ config.expect_with :rspec do |c|
+ c.syntax = [:should, :expect]
+ end
+ config.mock_with :rspec do |c|
+ c.syntax = [:should, :expect]
+ end
+end
|
Configure RSpec 3.x to support the old RSpec syntax
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -33,6 +33,10 @@ end
end
+def T(*args)
+ ROM::Processor::Transproc::Functions[*args]
+end
+
RSpec.configure do |config|
config.after do
Test.remove_constants
|
[WIP] Update to new transproc API
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,6 +1,8 @@ require 'rubygems'
require 'rspec'
require 'active_zuora'
+
+I18n.enforce_available_locales = true
ActiveZuora.configure(
:log => ENV['DEBUG'],
|
Enforce locale to get rid of deprecation warning
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -17,6 +17,35 @@ File.should_receive(:readable?).at_least(:once).with(dotfile).and_return(false)
end
-# Infinity Test runs tests as subprocesses, which sets STDOUT.tty? to false and
-# would otherwise prematurely disallow colors. We'll test the defaults later.
+# The following is needed for the Infinity Test. It runs tests as subprocesses,
+# which sets STDOUT.tty? to false and would otherwise prematurely disallow colors.
AwesomePrint.force_colors!
+
+# Ruby 1.8.6 only: define missing String methods that are needed for the specs to pass.
+if RUBY_VERSION < '1.8.7'
+ class String
+ def shellescape # Taken from Ruby 1.9.2 standard library, see lib/shellwords.rb.
+ return "''" if self.empty?
+ str = self.dup
+ str.gsub!(/([^A-Za-z0-9_\-.,:\/@\n])/n, "\\\\\\1")
+ str.gsub!(/\n/, "'\n'")
+ str
+ end
+
+ def start_with?(*prefixes)
+ prefixes.each do |prefix|
+ prefix = prefix.to_s
+ return true if prefix == self[0, prefix.size]
+ end
+ false
+ end
+
+ def end_with?(*suffixes)
+ suffixes.each do |suffix|
+ suffix = suffix.to_s
+ return true if suffix == self[-suffix.size, suffix.size]
+ end
+ false
+ end
+ end
+end
|
Add missing String methods to make all specs pass with Ruby 1.8.6
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -0,0 +1,6 @@+$:.unshift File.expand_path('..', __FILE__)
+$:.unshift File.expand_path('../../lib', __FILE__)
+require 'coveralls'
+Coveralls.wear!
+require 'rspec'
+require 'pry'
|
Add the spec helper file
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -26,11 +26,26 @@ example.run
}
end
+
+ # Remove all indexes setup in this run in local or CI
+ c.after(:suite) do
+ safe_index_list.each do |index|
+ Algolia.client.delete_index!(index['name'])
+ end
+ end
end
-# avoid concurrent access to the same index
+# A unique prefix for your test run in local or CI
+SAFE_INDEX_PREFIX = "rails_#{SecureRandom.hex(8)}".freeze
+
+# avoid concurrent access to the same index in local or CI
def safe_index_name(name)
- return name if ENV['TRAVIS'].to_s != "true"
- id = ENV['TRAVIS_JOB_NUMBER']
- "TRAVIS_RAILS_#{name}_#{id}"
+ "#{SAFE_INDEX_PREFIX}_#{name}"
end
+
+# get a list of safe indexes in local or CI
+def safe_index_list
+ Algolia.client.list_indexes()['items']
+ .select { |index| index["name"].include?(SAFE_INDEX_PREFIX) }
+ .sort_by { |index| index["primary"] || "" }
+end
|
Add safe index name prefix and after suite index deletion
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,8 +1,10 @@+
# Configure Rails Envinronment
ENV["RAILS_ENV"] = "test"
require File.expand_path("../dummy/config/environment.rb", __FILE__)
require 'rspec/rails'
+
ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../')
@@ -16,7 +18,7 @@ Disclosure.configuration.owner_class = "User"
end
- config.before(:all) do
+ config.before(:each) do
class Disclosure::Issue
def self.notifiable_actions
["created", "closed"]
@@ -40,8 +42,8 @@ end
class Disclosure::TestReactor; end
- Disclosure.configuration.notifier_classes << Disclosure::Issue
- Disclosure.configuration.reactor_classes << Disclosure::TestReactor
+ Disclosure.configuration.notifier_classes = [Disclosure::Issue]
+ Disclosure.configuration.reactor_classes = [Disclosure::TestReactor]
Disclosure.bootstrap!
end
end
|
Set up test class on every spec run to ensure clean slate
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,2 +1,7 @@ require 'minitest/autorun'
require 'minitest/pride'
+
+# For my rspec poisoned brain. ;)
+module Kernel
+ alias_method :context, :describe
+end
|
Add context alias for describe.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.