diff stringlengths 65 26.7k | message stringlengths 7 9.92k |
|---|---|
diff --git a/rspec_java.gemspec b/rspec_java.gemspec
index abc1234..def5678 100644
--- a/rspec_java.gemspec
+++ b/rspec_java.gemspec
@@ -1,19 +1,23 @@-$:.push File.expand_path("../lib", __FILE__)
+$:.push File.expand_path('../lib', __FILE__)
# Maintain your gem's version:
-require "rspec_java/version"
+require 'rspec_java/version'
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
- s.name = "rspec_java"
+ s.name = 'rspec_java'
s.version = RspecJava::VERSION
- s.authors = ["paresharma"]
- s.email = ["paresh.brahm@gmail.com"]
- s.homepage = "TODO"
- s.summary = "TODO: Summary of RspecJava."
- s.description = "TODO: Description of RspecJava."
- s.license = "MIT"
+ s.authors = ['paresharma']
+ s.email = ['paresh.brahm@gmail.com']
+ s.homepage = 'TODO'
+ s.summary = 'TODO: Summary of RspecJava.'
+ s.description = 'TODO: Description of RspecJava.'
+ s.license = 'MIT'
- s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
- s.test_files = Dir["test/**/*"]
+ s.files = Dir['{app,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.md']
+ s.test_files = Dir['test/**/*']
+
+ s.add_dependency 'capybara', '~> 2.5.0'
+ s.add_dependency 'poltergeist', '~> 1.7.0'
+ s.add_dependency 'rspec', '~> 3.3.0'
end
| Set up initial gem dependency
|
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -8,7 +8,7 @@
protected
- PERMITTED_USER_FIELDS = [:name, :username, :email, :password, :password_confirmation, :language, :gender, :login, :remember_me]
+ PERMITTED_USER_FIELDS = [:name, :username, :email, :password, :password_confirmation, :language, :gender, :login, :remember_me, :birthday]
def configure_permitted_parameters
devise_parameter_sanitizer.for(:account_update) do |u| u.permit PERMITTED_USER_FIELDS end
devise_parameter_sanitizer.for(:sign_up) do |u| u.permit PERMITTED_USER_FIELDS end
| Make :birthday a permitted param
|
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -5,6 +5,7 @@ class ApplicationController < ActionController::Base
protect_from_forgery
layout :layout_by_resource
+ before_filter :set_search
rescue_from Inquest::MustOwnQuestionException do
redirect_to @question, :notice => 'You must have created this question to mark an answer as accepted
@@ -12,6 +13,19 @@ end
private
+
+ # Private: Create a ransack search object every time we render the page.
+ #
+ # FIXME: Replace with something more powerful
+ #
+ # This method is a best-at-the-moment way of making sure we can have the search form in the
+ # header of the page, by creating the @search object the ransack form needs for
+ # every request.
+ #
+ # Returns a Ransack search object
+ def set_search
+ @search ||= Question.search(params[:q])
+ end
def layout_by_resource
if devise_controller?
| Set up a search object for every request - hacky, but lets us search from any page
|
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -4,11 +4,13 @@
protect_from_forgery with: :exception
+ after_filter :skip_slimmer
+
decent_configuration do
strategy DecentExposure::StrongParametersStrategy
end
def skip_slimmer
- response.headers[Slimmer::Headers::SKIP_HEADER] = "true"
+ response.headers[Slimmer::Headers::SKIP_HEADER] = "true" if params[:skip_slimmer]
end
end
| Allow skipping slimmer with ?skip_slimmer=1 param
|
diff --git a/app/controllers/contractors_controller.rb b/app/controllers/contractors_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/contractors_controller.rb
+++ b/app/controllers/contractors_controller.rb
@@ -1,5 +1,5 @@ class ContractorsController < ApplicationController
def index
- @contractors = Contractor.all
+ @contractors = Contractor.all.sort { |a, b| b.total_est_contract_value <=> a.total_est_contract_value }
end
end
| Sort contracts by highest total value
|
diff --git a/app/models/refinery/retailers/retailer.rb b/app/models/refinery/retailers/retailer.rb
index abc1234..def5678 100644
--- a/app/models/refinery/retailers/retailer.rb
+++ b/app/models/refinery/retailers/retailer.rb
@@ -2,12 +2,22 @@ module Retailers
class Retailer < Refinery::Core::BaseModel
self.table_name = 'refinery_retailers'
+
+ before_validation :smart_add_url_protocol
validates :address, :presence => true, :uniqueness => true
acts_as_indexed :fields => [:title, :contact, :address, :country_code, :state_code, :city]
scope :published, -> { where :draft => false }
+
+ protected
+
+ def smart_add_url_protocol
+ unless self.website[/\Ahttp:\/\//] || self.website[/\Ahttps:\/\//]
+ self.website = "http://#{self.website}"
+ end
+ end
end
end
end
| Add method to add http on website url
|
diff --git a/app/representers/api/paged_representer.rb b/app/representers/api/paged_representer.rb
index abc1234..def5678 100644
--- a/app/representers/api/paged_representer.rb
+++ b/app/representers/api/paged_representer.rb
@@ -3,6 +3,7 @@ property :total_count, as: :total
property :count
property :total_pages
+ property :current_page
link :self do |opts|
if represented.current_page == 1
| Add current_page to paged representers
|
diff --git a/spec/fixtures/cookbooks/oneview_test/recipes/server_profile_properties.rb b/spec/fixtures/cookbooks/oneview_test/recipes/server_profile_properties.rb
index abc1234..def5678 100644
--- a/spec/fixtures/cookbooks/oneview_test/recipes/server_profile_properties.rb
+++ b/spec/fixtures/cookbooks/oneview_test/recipes/server_profile_properties.rb
@@ -1,6 +1,6 @@ #
# Cookbook Name:: oneview_test
-# Recipe:: server_profile_delete
+# Recipe:: server_profile_properties
#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
#
| Update Server Profile test recipe name |
diff --git a/app/controllers/answers_controller.rb b/app/controllers/answers_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/answers_controller.rb
+++ b/app/controllers/answers_controller.rb
@@ -1,12 +1,21 @@ class AnswersController < ApplicationController
+ def index
+ @answers = Answer.all
+ end
+
def new
@answer = Answer.new
+ @question = Question.find(params[:question_id])
end
def create
- @answer = Answer.create(params[:id])
- @answer.question = @question
- redirect_to '/questions/'
+ @question = find_question
+ @answer = @question.answers.build(answer_params)
+ if @answer.save
+ redirect_to question_path(@question)
+ else
+ render :action => 'new'
+ end
end
def edit
@@ -17,9 +26,38 @@ @answer = Answer.find(params[:id])
end
+ def destroy
+ @answer = Answer.find(params[:id])
+ @answer.destroy
+ end
+
+ # def upvote
+ # @question = Question.find(params[:question_id])
+ # @answer = Answer.find(params[:id])
+ # @answer.upvote_from current_user
+ # redirect_to question_path(@question)
+ # end
+
+ # def downvote
+ # @question = Question.find(params[:question_id])
+ # @answer = Answer.find(params[:id])
+ # @answer.downvote_from current_user
+ # redirect_to question_path(@question)
+ # end
+
private
def answer_params
params.require(:answer).permit(:body, :question_id)
end
+
+ def find_question
+ params.each do |name, value|
+ if name =~ /(.+)_id$/
+ return $1.classify.constantize.find(value)
+ end
+ end
+ nil
+ end
+
end | Add create, index and destroy methods to answer model
|
diff --git a/app/helpers/testing_grounds_helper.rb b/app/helpers/testing_grounds_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/testing_grounds_helper.rb
+++ b/app/helpers/testing_grounds_helper.rb
@@ -15,8 +15,7 @@ def import_topology_select_tag(form)
topologies = Topology.all.reverse.map do |topo|
if testing_ground = TestingGround.where(topology_id: topo.id).first
- ["Topology from #{ testing_ground.created_at.to_formatted_s(:long) } " \
- "testing ground", topo.id]
+ [testing_ground.name, topo.id]
end
end.compact
| Use the testing ground name in the import form
|
diff --git a/spec/migrations/clean_stage_id_reference_migration_spec.rb b/spec/migrations/clean_stage_id_reference_migration_spec.rb
index abc1234..def5678 100644
--- a/spec/migrations/clean_stage_id_reference_migration_spec.rb
+++ b/spec/migrations/clean_stage_id_reference_migration_spec.rb
@@ -0,0 +1,22 @@+require 'spec_helper'
+require Rails.root.join('db', 'migrate', '20170710083355_clean_stage_id_reference_migration.rb')
+
+describe CleanStageIdReferenceMigration, :migration, :sidekiq do
+ context 'when there are enqueued background migrations' do
+ pending 'processes enqueued jobs synchronously' do
+ fail
+ end
+ end
+
+ context 'when there are scheduled background migrations' do
+ pending 'immediately processes scheduled jobs' do
+ fail
+ end
+ end
+
+ context 'when there are no background migrations pending' do
+ pending 'does nothing' do
+ fail
+ end
+ end
+end
| Add pending set of specs for stage_id cleanup migration
|
diff --git a/app/services/update_manual_service.rb b/app/services/update_manual_service.rb
index abc1234..def5678 100644
--- a/app/services/update_manual_service.rb
+++ b/app/services/update_manual_service.rb
@@ -1,9 +1,9 @@ class UpdateManualService
- def initialize(dependencies)
- @manual_repository = dependencies.fetch(:manual_repository)
- @manual_id = dependencies.fetch(:manual_id)
- @attributes = dependencies.fetch(:attributes)
- @listeners = dependencies.fetch(:listeners)
+ def initialize(manual_repository:, manual_id:, attributes:, listeners:)
+ @manual_repository = manual_repository
+ @manual_id = manual_id
+ @attributes = attributes
+ @listeners = listeners
end
def call
| Use Ruby keyword args in UpdateManualService
I think that using language features instead of custom code makes this
easier to understand.
|
diff --git a/lib/conway.rb b/lib/conway.rb
index abc1234..def5678 100644
--- a/lib/conway.rb
+++ b/lib/conway.rb
@@ -8,8 +8,7 @@
def start
number_of_living_cells = (grid.width * grid.heigth * 0.2).round
- # TODO fill closure
- number_of_living_cells.times { }
+ number_of_living_cells.times { grid.revive_at(rand(53), rand(7)) }
end
end
@@ -28,10 +27,15 @@ def each
fields.each
end
+
+ def revive_at(column_index, row_index)
+ cell = fields[column_index][row_index]
+ cell.increment if cell.dead?
+ end
end
class Cell
- attr_reader :value
+ attr_accessor :value
def initialize(n = 0)
@value = n
| Resolve todo, adding revive_ath method.
|
diff --git a/lib/globot.rb b/lib/globot.rb
index abc1234..def5678 100644
--- a/lib/globot.rb
+++ b/lib/globot.rb
@@ -1,11 +1,15 @@ require 'rubygems'
require 'tinder'
-require 'json' # TODO: Tinder needs this internally for parsing the transcript
+require 'json' # Tinder needs this internally for parsing the transcript
require 'globot/bot'
require 'globot/message'
require 'globot/plugins'
require 'globot/runner'
+# Turn SSL verification off to stop incredibly annoying "peer certificate
+# won't be verified in this SSL session" warnings.
+require 'ext/tinder/disable_ssl_verification'
+
module Globot
VERSION = "0.0.1"
end
| Stop the damn annoying "peer certificate" SSL warning. |
diff --git a/lib/chamber.rb b/lib/chamber.rb
index abc1234..def5678 100644
--- a/lib/chamber.rb
+++ b/lib/chamber.rb
@@ -17,12 +17,10 @@
protected
+ attr_accessor :instance
+
def instance
- @@instance ||= Instance.new({})
- end
-
- def instance=(new_instance)
- @@instance = new_instance
+ @instance ||= Instance.new({})
end
public
| Chore: Replace class variables with instance variables
--------------------------------------------------------------------------------
Change-Id: If2bb5abe40263b1ea5001fc3f52576f5dc602e5e
Signed-off-by: Jeff Felchner <8a84c204e2d4c387d61d20f7892a2bbbf0bc8ae8@thekompanee.com>
|
diff --git a/lib/plugin.rb b/lib/plugin.rb
index abc1234..def5678 100644
--- a/lib/plugin.rb
+++ b/lib/plugin.rb
@@ -36,7 +36,7 @@ end
def interrupted?
- @interrupted
+ @interrupted || Process.getpgid(Process.ppid) != Process.getpgrp
end
def name
| Interrupt child-processes if their group-id differs from parent's group-id
|
diff --git a/lib/routes.rb b/lib/routes.rb
index abc1234..def5678 100644
--- a/lib/routes.rb
+++ b/lib/routes.rb
@@ -17,6 +17,7 @@ mount Endpoints::Files
mount Endpoints::Grades
mount Endpoints::Login
+ mount Endpoints::Student
end
# root app; but will also handle some defaults like 404
| Add endpoint to return the student profile
|
diff --git a/Casks/battery-time-remaining.rb b/Casks/battery-time-remaining.rb
index abc1234..def5678 100644
--- a/Casks/battery-time-remaining.rb
+++ b/Casks/battery-time-remaining.rb
@@ -1,6 +1,6 @@ cask :v1 => 'battery-time-remaining' do
- version '2.0.2'
- sha256 '4975e8e293e4e6b2114cdbbf64d046b3255c62d981e25f0044229348c4f92a87'
+ version '3.0'
+ sha256 '55765d8543b23512953dc80f12f3717a9e6b2053f6097fac3d3624e72763a8d4'
url "http://yap.nu/battery-time-remaining/download/Battery%20Time%20Remaining%202-#{version}.zip"
name 'Battery Time Remaining'
| Upgrade Battery Time Remaining 2.app to 3.0
|
diff --git a/lib/alchemy/logger.rb b/lib/alchemy/logger.rb
index abc1234..def5678 100644
--- a/lib/alchemy/logger.rb
+++ b/lib/alchemy/logger.rb
@@ -1,9 +1,9 @@ module Alchemy
module Logger
- # Logs a warning to the Rails standard logger and adds some nicer formatting
+ # Logs a debug message to the Rails standard logger and adds some nicer formatting
def self.warn(message, caller_string)
- Rails.logger.warn %(\n++++ WARNING: #{message}\nCalled from: #{caller_string}\n)
+ Rails.logger.debug %(\n++++ WARNING: #{message}\nCalled from: #{caller_string}\n)
return nil
end
| Change log level of Alchemy.log_warning from warn to debug.
Log level warn is also used in production environments.
But the Alchemy warn logger is meant to only log in dev environments.
|
diff --git a/Formula/libtiff.rb b/Formula/libtiff.rb
index abc1234..def5678 100644
--- a/Formula/libtiff.rb
+++ b/Formula/libtiff.rb
@@ -6,9 +6,7 @@ @md5='fbb6f446ea4ed18955e2714934e5b698'
def install
- system "./configure", "--prefix=#{prefix}", "--disable-debug"
+ system "./configure", "--prefix=#{prefix}", "--disable-debug", "--mandir=#{prefix}/share/man"
system "make install"
-
- FileUtils.mv prefix+'man', share
end
end
| Set mandir in configure script instead of moving afterwards
|
diff --git a/lib/emcee/document.rb b/lib/emcee/document.rb
index abc1234..def5678 100644
--- a/lib/emcee/document.rb
+++ b/lib/emcee/document.rb
@@ -12,8 +12,7 @@ end
def to_s
- stringified = replace_html_with_xhtml(content, elements_with_selected)
- unescape(stringified)
+ unescape(replace_html_with_xhtml)
end
def html_imports
@@ -51,8 +50,8 @@
# Replace the html of certain nodes with their xhtml representation. This
# is to prevent 'selected' attributes from having their values removed.
- def replace_html_with_xhtml(content, nodes)
- nodes.reduce(content) do |output, node|
+ def replace_html_with_xhtml
+ elements_with_selected.reduce(content) do |output, node|
output.gsub(node.to_html, node.to_xhtml)
end
end
| Remove temp variable and method parameters
`stringified` and `replace_html_with_xhtml`
|
diff --git a/lib/i18n_dev_tools.rb b/lib/i18n_dev_tools.rb
index abc1234..def5678 100644
--- a/lib/i18n_dev_tools.rb
+++ b/lib/i18n_dev_tools.rb
@@ -19,7 +19,7 @@ if raise_error
I18n.exception_handler = RaiseAllErrors.new
else
- I18n.exception_handler = :default_exception_handler
+ I18n.exception_handler = I18n::ExceptionHandler.new
end
end
| Use the new way to set the I18n exception handler
|
diff --git a/lib/sidekiq-status.rb b/lib/sidekiq-status.rb
index abc1234..def5678 100644
--- a/lib/sidekiq-status.rb
+++ b/lib/sidekiq-status.rb
@@ -8,7 +8,7 @@ module Status
extend Storage
DEFAULT_EXPIRY = 60 * 30
- STATUS = %s(queued working complete stopped failed).map(&:to_sym).frozen
+ STATUS = %w(queued working complete stopped failed).map(&:to_sym).freeze
[:status, :num, :total, :message].each do |name|
class_eval(<<-END, __FILE__, __LINE__)
@@ -26,6 +26,7 @@ END
end
+ # TODO make #get synonym to #read_field_for_id and use #status instead of #get
# Job status by id
# @param [String] id job id returned by async_perform
# @return [String] job status, possible values are in STATUS
| Fix typo at STATUS array
|
diff --git a/lib/tasks/consul.rake b/lib/tasks/consul.rake
index abc1234..def5678 100644
--- a/lib/tasks/consul.rake
+++ b/lib/tasks/consul.rake
@@ -0,0 +1,13 @@+namespace :consul do
+ desc "Runs tasks needed to upgrade to the latest version"
+ task execute_release_tasks: "execute_release_1.0.0_tasks"
+
+ desc "Runs tasks needed to upgrade from 1.0.0-beta to 1.0.0"
+ task "execute_release_1.0.0_tasks": [
+ "poll:generate_slugs",
+ "stats_and_results:migrate_to_reports",
+ "budgets:calculate_ballot_lines",
+ "settings:remove_deprecated_settings",
+ "stats:generate"
+ ]
+end
| Add task to upgrade to version 1.0.0
It includes every task needed for the upgrade.
|
diff --git a/lib/tasks/deploy.rake b/lib/tasks/deploy.rake
index abc1234..def5678 100644
--- a/lib/tasks/deploy.rake
+++ b/lib/tasks/deploy.rake
@@ -8,7 +8,7 @@ task :bundle_gems => [:environment] do
puts "bundling..."
Dir.chdir(Rails.root)
- system("bundle")
+ system("sudo bundle --without=development --without=test")
end
task :db_migrate => [:environment] do
| Change bundle to exclude development and test
|
diff --git a/lib/wakame/trigger.rb b/lib/wakame/trigger.rb
index abc1234..def5678 100644
--- a/lib/wakame/trigger.rb
+++ b/lib/wakame/trigger.rb
@@ -13,6 +13,7 @@ def service_cluster
@rule_engine.service_cluster
end
+ alias :cluster :service_cluster
def master
@rule_engine.master
| Add attribute alias for service_cluster.
|
diff --git a/app/controllers/concerns/organizations_controller_template.rb b/app/controllers/concerns/organizations_controller_template.rb
index abc1234..def5678 100644
--- a/app/controllers/concerns/organizations_controller_template.rb
+++ b/app/controllers/concerns/organizations_controller_template.rb
@@ -26,6 +26,7 @@ .require(:organization)
.permit(:book,
:name,
+ :faqs,
*Mumuki::Domain::Organization::Profile.attributes,
*Mumuki::Domain::Organization::Theme.attributes,
*(Mumuki::Domain::Organization::Settings.attributes - [:login_methods]),
| Add faqs to organization params
|
diff --git a/app/models/components/course/duplication_ability_component.rb b/app/models/components/course/duplication_ability_component.rb
index abc1234..def5678 100644
--- a/app/models/components/course/duplication_ability_component.rb
+++ b/app/models/components/course/duplication_ability_component.rb
@@ -0,0 +1,19 @@+# frozen_string_literal: true
+module Course::DuplicationAbilityComponent
+ include AbilityHost::Component
+
+ def define_permissions
+ allow_owner_duplicate_course if user
+
+ super
+ end
+
+ private
+
+ def allow_owner_duplicate_course
+ # Actually unnecessary because course managers can :manage courses.
+ # This is for consistency if more fine grained permissions need to be defined when
+ # duplication cherry picking is supported.
+ can :duplicate, Course, course_user_hash(*CourseUser::MANAGER_ROLES.to_a)
+ end
+end
| Define duplication permissions under components.
Prepare for future fine-grained permissions.
|
diff --git a/spec/controllers/accounts_controller_spec.rb b/spec/controllers/accounts_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/accounts_controller_spec.rb
+++ b/spec/controllers/accounts_controller_spec.rb
@@ -5,12 +5,28 @@ before { sign_in user }
describe 'POST #create' do
+ before do
+ request.env['omniauth.auth'] = OmniAuth.config.mock_auth[:github]
+ end
+
it 'creates a new account for a user' do
- request.env['omniauth.auth'] = OmniAuth.config.mock_auth[:github]
-
expect do
post :create, provider: 'github'
end.to change(user.accounts, :count).by(1)
+ end
+
+ it 'redirects to the user profile on success by default' do
+ post :create, provider: 'github'
+
+ expect(response).to redirect_to(user)
+ end
+
+ it 'redirects to the stored location for the user on success if set' do
+ controller.store_location_for(user, new_icla_signature_path)
+
+ post :create, provider: 'github'
+
+ expect(response).to redirect_to(new_icla_signature_path)
end
end
| Add tests around post-account link behavior.
|
diff --git a/spec/helpers/spree/admin/base_helper_spec.rb b/spec/helpers/spree/admin/base_helper_spec.rb
index abc1234..def5678 100644
--- a/spec/helpers/spree/admin/base_helper_spec.rb
+++ b/spec/helpers/spree/admin/base_helper_spec.rb
@@ -2,7 +2,9 @@
require 'spec_helper'
-describe Spree::BaseHelper, type: :helper do
+describe Spree::Admin::BaseHelper, type: :helper do
+ helper 'spree/admin/navigation'
+
describe "#link_to_remove_fields" do
let(:name) { 'Hola' }
let(:form) { double('form_for', hidden_field: '<input type="hidden" name="_method" value="destroy">') }
| Fix base helper spec in rails 52
|
diff --git a/db/migrate/20130107090309_remove_first_published_at_data_for_some_types.rb b/db/migrate/20130107090309_remove_first_published_at_data_for_some_types.rb
index abc1234..def5678 100644
--- a/db/migrate/20130107090309_remove_first_published_at_data_for_some_types.rb
+++ b/db/migrate/20130107090309_remove_first_published_at_data_for_some_types.rb
@@ -0,0 +1,9 @@+class RemoveFirstPublishedAtDataForSomeTypes < ActiveRecord::Migration
+ def up
+ execute %{ UPDATE editions SET first_published_at = NULL WHERE type IN ('Consultation', 'Speech', 'Publication'); }
+ end
+
+ def down
+ # Only data changed so no down.
+ end
+end
| Remove first_published_at for some types
This should remove the data in `first_published_at` for consultations,
publications and speeches. It is currently populated with
`major_change_published_at` for the first major edition of the
respective document.
Having data in the column is confusing as we won't be putting data in
for new editions. For those edition types the `first_public_at` method
pulls data from different columns.
|
diff --git a/lib/jekyll-mod.rb b/lib/jekyll-mod.rb
index abc1234..def5678 100644
--- a/lib/jekyll-mod.rb
+++ b/lib/jekyll-mod.rb
@@ -0,0 +1,36 @@+module Jekyll
+ class Site
+
+ # Read all the files in <source>/<dir>/_posts and create a new Post
+ # object only for draft items
+ #
+ # dir - The String relative path of the directory to read.
+ #
+ # Returns nothing.
+ def read_drafts(dir = '')
+ if self.respond_to? 'get_entries'
+ entries = get_entries(dir, '_posts')
+ else
+ base = File.join(self.source, dir, '_posts')
+ return unless File.exists?(base)
+ entries = Dir.chdir(base) { filter_entries(Dir['**/*']) }
+ end
+
+ drafts = []
+
+ # first pass processes, but does not yet render post content
+ entries.each do |f|
+ if Post.valid?(f)
+ post = Post.new(self, self.source, dir, f)
+
+ if (not post.published )
+ drafts << post
+ end
+ end
+ end
+
+ drafts
+ end
+
+ end
+end | Add a read_drafts to jekyll. |
diff --git a/lib/leap_cases.rb b/lib/leap_cases.rb
index abc1234..def5678 100644
--- a/lib/leap_cases.rb
+++ b/lib/leap_cases.rb
@@ -10,6 +10,10 @@ def skipped?
index > 0
end
+
+ def msg
+ "Expected '#{expected}', #{input} is #{expected ? '' : 'not '}a leap year."
+ end
end
LeapCases = proc do |data|
| Add failure message to leap test generator.
There was no failure message supplied by the test case generator, so all
tests had a blank failure message.
This patch adds an informative failure message for each test based on
the test input and expected values.
|
diff --git a/lib/mutant/mutator/node/regexp/end_of_string_or_before_end_of_line_anchor.rb b/lib/mutant/mutator/node/regexp/end_of_string_or_before_end_of_line_anchor.rb
index abc1234..def5678 100644
--- a/lib/mutant/mutator/node/regexp/end_of_string_or_before_end_of_line_anchor.rb
+++ b/lib/mutant/mutator/node/regexp/end_of_string_or_before_end_of_line_anchor.rb
@@ -14,7 +14,7 @@ def dispatch
emit(s(:regexp_eos_anchor))
end
- end # EndOfLineAnchor
+ end # EndOfStringOrBeforeEndOfLineAnchor
end # Regexp
end # Node
end # Mutator
| Fix mistake in class annotation
|
diff --git a/db/migrate/20211004111501_reload_after_core_workflow_again.rb b/db/migrate/20211004111501_reload_after_core_workflow_again.rb
index abc1234..def5678 100644
--- a/db/migrate/20211004111501_reload_after_core_workflow_again.rb
+++ b/db/migrate/20211004111501_reload_after_core_workflow_again.rb
@@ -0,0 +1,11 @@+# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
+
+class ReloadAfterCoreWorkflowAgain < ActiveRecord::Migration[6.0]
+ def up
+
+ # return if it's a new setup
+ return if !Setting.exists?(name: 'system_init_done')
+
+ AppVersion.set(true, 'app_version')
+ end
+end
| Maintenance: Add another reload to setup new js for core workflow.
|
diff --git a/config/initializers/exception_notifier.rb b/config/initializers/exception_notifier.rb
index abc1234..def5678 100644
--- a/config/initializers/exception_notifier.rb
+++ b/config/initializers/exception_notifier.rb
@@ -1,10 +1,11 @@ # ExceptionNotifier::Notifier.prepend_view_path File.join(Rails.root, 'app/views')
if !Rails.env.development? && !Rails.env.test?
- require 'exception_notifier'
- Rails.application.config.middleware.use ExceptionNotifier,
+ Rails.application.config.middleware.use ExceptionNotification::Rack,
:sections => %w(user request session environment backtrace),
- :email_prefix => "[ERROR] ",
- :sender_address => %{"dreamcatcher.net" <mailer@dreamcatcher.net>},
- :exception_recipients => %w{support@dreamcatcher.net}
+ :email => {
+ :email_prefix => "[ERROR] ",
+ :sender_address => %{"dreamcatcher.net" <mailer@dreamcatcher.net>},
+ :exception_recipients => %w{support@dreamcatcher.net}
+ }
end
| Fix more exception notifier initializer stuff
|
diff --git a/authem.gemspec b/authem.gemspec
index abc1234..def5678 100644
--- a/authem.gemspec
+++ b/authem.gemspec
@@ -7,6 +7,7 @@ Gem::Specification.new do |s|
s.name = "authem"
s.version = Authem::VERSION
+ s.license = "WTFPL"
s.authors = ["Paul Elliott"]
s.description = "Authem provides a simple solution for email-based authentication."
| Add license to the gemfile
[fixes #16]
|
diff --git a/lib/solidus_subscriptions/testing_support/factories/installment_factory.rb b/lib/solidus_subscriptions/testing_support/factories/installment_factory.rb
index abc1234..def5678 100644
--- a/lib/solidus_subscriptions/testing_support/factories/installment_factory.rb
+++ b/lib/solidus_subscriptions/testing_support/factories/installment_factory.rb
@@ -9,7 +9,7 @@ end
trait :success do
- association :order, factory: :completed_order_with_totals
+ order { create :completed_order_with_totals }
details { build_list(:installment_detail, 1, :success, installment: @instance) }
end
end
| Set the Completed at time for fulfilled installments
the completed_order_with_totals factory doesnt set
the completed_at time
|
diff --git a/lib/rspec/sidekiq/matchers/have_enqueued_job.rb b/lib/rspec/sidekiq/matchers/have_enqueued_job.rb
index abc1234..def5678 100644
--- a/lib/rspec/sidekiq/matchers/have_enqueued_job.rb
+++ b/lib/rspec/sidekiq/matchers/have_enqueued_job.rb
@@ -22,7 +22,6 @@ def matches? klass
@klass = klass
@actual = klass.jobs.map { |job| job["args"] }
- puts @actual
@actual.include? @expected
end
| Remove put that slipped into matcher
|
diff --git a/metamodel.gemspec b/metamodel.gemspec
index abc1234..def5678 100644
--- a/metamodel.gemspec
+++ b/metamodel.gemspec
@@ -24,6 +24,7 @@ s.add_runtime_dependency 'xcodeproj', '~> 1.2'
s.add_runtime_dependency 'activerecord', '~> 5.0'
s.add_runtime_dependency "mustache", "~> 1.0"
+ s.add_runtime_dependency "git", "~> 1.3"
s.add_development_dependency 'bundler', '~> 1.3'
s.add_development_dependency 'rake', '~> 10.0'
| Add ruby-git dependency to gemspec
|
diff --git a/lib/crazytown/type/pathname_type.rb b/lib/crazytown/type/pathname_type.rb
index abc1234..def5678 100644
--- a/lib/crazytown/type/pathname_type.rb
+++ b/lib/crazytown/type/pathname_type.rb
@@ -0,0 +1,34 @@+require 'crazytown/type'
+require 'crazytown/simple_struct'
+require 'pathname'
+
+module Crazytown
+ module Type
+ #
+ # Type for Paths. Always stored as Pathname
+ #
+ # Can handle absolutizing relative URLs with #relative_to.
+ #
+ class PathnameType
+ extend Type
+ must_be_kind_of Pathname
+
+ class <<self
+ extend SimpleStruct
+ attribute :relative_to, coerced: "value.is_a?(String) ? Pathname.new(value) : value"
+ end
+
+ def self.coerce(parent, path)
+ if path
+ rel = relative_to(parent: parent)
+ if rel
+ path = rel + path if rel
+ else
+ path = Pathname.new(path) if path.is_a?(String)
+ end
+ end
+ super
+ end
+ end
+ end
+end
| Add the PathnameType so this works on everyone's machine :)
|
diff --git a/test/dummy/config/environments/test.rb b/test/dummy/config/environments/test.rb
index abc1234..def5678 100644
--- a/test/dummy/config/environments/test.rb
+++ b/test/dummy/config/environments/test.rb
@@ -2,7 +2,7 @@ config.cache_classes = true
config.eager_load = false
- config.serve_static_assets = true
+ config.serve_static_files = true
config.static_cache_control = 'public, max-age=3600'
config.consider_all_requests_local = true
@@ -16,4 +16,6 @@
config.active_support.deprecation = :stderr
I18n.enforce_available_locales = false
+
+ config.active_support.test_order = :sorted
end
| Remove rails 5 future warnings
|
diff --git a/lib/notifiers/deprecation_logger.rb b/lib/notifiers/deprecation_logger.rb
index abc1234..def5678 100644
--- a/lib/notifiers/deprecation_logger.rb
+++ b/lib/notifiers/deprecation_logger.rb
@@ -21,7 +21,7 @@ end
def log_deprecated_attribute_usage(klass, *attrs)
- warning_message = "WARNING: Called deprecated attribute for #{klass.name}: #{attrs.join(', ')}\n" +
+ warning_message = "WARNING: Called deprecated attribute on #{klass.name}: #{attrs.join(', ')}\n" +
backtrace.map { |trace| "\t#{trace}" }.join("\n")
if logger?
logger.warn do
| Update wording in deprecation logger
|
diff --git a/lib/nyciti_bike/models/bike_trip.rb b/lib/nyciti_bike/models/bike_trip.rb
index abc1234..def5678 100644
--- a/lib/nyciti_bike/models/bike_trip.rb
+++ b/lib/nyciti_bike/models/bike_trip.rb
@@ -11,7 +11,7 @@ class BikeTrip
DATE_FORMAT = "%D" # citibike format as of 10/24/2013
DURATION_REGEX = /(\d{1,2})m (\d{1,2})s/ # citibike format as of 10/24/2013
- SECS_PER_MIN = 60.0
+ SECS_PER_MIN = 60
attr_accessor :id, :start_location, :end_location, :date, :duration
| Fix duration precision from Float to Int
|
diff --git a/db/migrate/20170224133932_add_materialised_view_for_valid_taxon_concept_term_view.rb b/db/migrate/20170224133932_add_materialised_view_for_valid_taxon_concept_term_view.rb
index abc1234..def5678 100644
--- a/db/migrate/20170224133932_add_materialised_view_for_valid_taxon_concept_term_view.rb
+++ b/db/migrate/20170224133932_add_materialised_view_for_valid_taxon_concept_term_view.rb
@@ -0,0 +1,12 @@+class AddMaterialisedViewForValidTaxonConceptTermView < ActiveRecord::Migration
+ def up
+ execute "DROP MATERIALIZED VIEW IF EXISTS valid_taxon_concept_term_mview"
+ execute "CREATE MATERIALIZED VIEW valid_taxon_concept_term_mview AS SELECT * FROM valid_taxon_concept_term_view"
+ execute "CREATE INDEX ON valid_taxon_concept_term_mview (taxon_concept_id)"
+ execute "CREATE INDEX ON valid_taxon_concept_term_mview (term_id)"
+ end
+
+ def down
+ execute "DROP MATERIALIZED VIEW IF EXISTS valid_taxon_concept_term_mview"
+ end
+end
| Add materialized view for valid_taxon_concept_term_view
(cherry picked from commit 1f8d5e3717b2fe1751b2d5ffa34b0645464ded04)
|
diff --git a/lib/active-profiling/ruby_profiler.rb b/lib/active-profiling/ruby_profiler.rb
index abc1234..def5678 100644
--- a/lib/active-profiling/ruby_profiler.rb
+++ b/lib/active-profiling/ruby_profiler.rb
@@ -14,7 +14,7 @@ # * :disable_gc - temporarily disable the garbage collector for the
# duration of the profiling session. The default is false.
def ruby_profiler(options = {})
- return yield unless defined?(RubyProf)
+ return [ yield, nil ] unless defined?(RubyProf)
options = {
:measure_mode => RubyProf::PROCESS_TIME,
| Return an Array even when we don't have RubyProf available.
|
diff --git a/lib/oauth2/provider/models/mongoid.rb b/lib/oauth2/provider/models/mongoid.rb
index abc1234..def5678 100644
--- a/lib/oauth2/provider/models/mongoid.rb
+++ b/lib/oauth2/provider/models/mongoid.rb
@@ -4,10 +4,29 @@ autoload :AuthorizationCode, 'oauth2/provider/models/mongoid/authorization_code'
autoload :Client, 'oauth2/provider/models/mongoid/client'
+ mattr_accessor :client_collection_name
+ self.client_collection_name = 'oauth_clients'
+
+ mattr_accessor :access_token_collection_name
+ self.access_token_collection_name = 'oauth_access_tokens'
+
+ mattr_accessor :authorization_code_collection_name
+ self.authorization_code_collection_name = 'oauth_authorization_codes'
+
+ mattr_accessor :access_grant_collection_name
+ self.access_grant_collection_name = 'oauth_access_grants'
+
def self.activate(options = {})
OAuth2::Provider.client_class_name ||= "OAuth2::Provider::Models::Mongoid::Client"
OAuth2::Provider.access_token_class_name ||= "OAuth2::Provider::Models::Mongoid::AccessToken"
OAuth2::Provider.authorization_code_class_name ||= "OAuth2::Provider::Models::Mongoid::AuthorizationCode"
OAuth2::Provider.access_grant_class_name ||= "OAuth2::Provider::Models::Mongoid::AccessGrant"
+
+ p OAuth2::Provider.client_class.collection_name
+
+ OAuth2::Provider.client_class.collection_name = client_collection_name
+ OAuth2::Provider.access_token_class.collection_name = access_token_collection_name
+ OAuth2::Provider.authorization_code_class.collection_name = authorization_code_collection_name
+ OAuth2::Provider.access_grant_class.collection_name = access_grant_collection_name
end
end | Use sane mongo collection names by default
|
diff --git a/core/process/setpgid_spec.rb b/core/process/setpgid_spec.rb
index abc1234..def5678 100644
--- a/core/process/setpgid_spec.rb
+++ b/core/process/setpgid_spec.rb
@@ -1,7 +1,8 @@ require_relative '../../spec_helper'
describe "Process.setpgid" do
- with_feature :fork do
+ platform_is_not :windows do
+ # Must use fork as setpgid(2) gives EACCESS after execve()
it "sets the process group id of the specified process" do
rd, wr = IO.pipe
| Clarify why the Process.setpgid spec needs fork
|
diff --git a/rakeutils.gemspec b/rakeutils.gemspec
index abc1234..def5678 100644
--- a/rakeutils.gemspec
+++ b/rakeutils.gemspec
@@ -23,4 +23,5 @@ spec.add_development_dependency "rake"
#spec.add_runtime_dependency "win32ole"
spec.add_runtime_dependency "ktcommon"
+ spec.add_runtime_dependency "ktutils"
end
| Add ktutils to gemspec depends
|
diff --git a/tools/archive-script.rb b/tools/archive-script.rb
index abc1234..def5678 100644
--- a/tools/archive-script.rb
+++ b/tools/archive-script.rb
@@ -0,0 +1,15 @@+require 'rubygems'
+require 'mechanize'
+
+def scrape_body(page)
+ { :author => page.search("span.author_header").first.content,
+ :subject => page.search("span.subject_header").first.content,
+ :timestamp => Time.parse(page.search("span.date_header").first.content + " -0500").utc,
+ :body => page.search("div.message_text").first.content }
+end
+
+agent = Mechanize.new
+
+puts scrape_body(agent.get("http://disc.yourwebapps.com/discussion.cgi?disc=199610;article=228586;title=PPC%20Posting%20Board"))
+
+puts scrape_body(agent.get("http://disc.yourwebapps.com/discussion.cgi?disc=199610;article=228570;title=PPC%20Posting%20Board"))
| Archive scrpit can scrape post bodies
|
diff --git a/lib/stream_reader/librato_reporter.rb b/lib/stream_reader/librato_reporter.rb
index abc1234..def5678 100644
--- a/lib/stream_reader/librato_reporter.rb
+++ b/lib/stream_reader/librato_reporter.rb
@@ -6,9 +6,11 @@ @client = Librato::Metrics::Client.new
@client.authenticate(ENV['LIBRATO_USER'],
ENV['LIBRATO_TOKEN'])
- autosubmit_interval = Integer(ENV['LIBRATO_AUTOSUBMIT_INTERVAL'] || 30)
- @queue = Librato::Metrics::Queue.new(autosubmit_interval: autosubmit_interval,
- client: @client)
+ autosubmit_interval = Integer(ENV['LIBRATO_AUTOSUBMIT_INTERVAL'] || 60)
+ autosubmit_count = Integer(ENV['LIBRATO_AUTOSUBMIT_COUNT'] || 10000)
+ @aggregator = Librato::Metrics::Aggregator.new(autosubmit_interval: autosubmit_interval,
+ autosubmit_count: autosubmit_count,
+ client: @client)
add_listeners
end
@@ -16,7 +18,7 @@
def add_listeners
ActiveSupport::Notifications.subscribe('stream_reader.process_record') do |name, start, finish, id, payload|
- @queue.add "#{name}.duration": {
+ @aggregator.add "#{name}.duration": {
value: (finish - start),
source: "#{payload[:stream_name]}:#{payload[:prefix]}:#{payload[:shard_id]}" },
"#{name}.latency": {
| Switch to using a Librato aggregator instead of a queue
From their docs (https://github.com/librato/librato-metrics#aggregate-measurements)
seems like this may be more appropriate for the kind of usage we have
here.
Also enable automatic submission based on count and tune it via
`LIBRATO_AUTOSUBMIT_COUNT`.
|
diff --git a/lib/tent-validator/validators/without_authentication/relationship_validator.rb b/lib/tent-validator/validators/without_authentication/relationship_validator.rb
index abc1234..def5678 100644
--- a/lib/tent-validator/validators/without_authentication/relationship_validator.rb
+++ b/lib/tent-validator/validators/without_authentication/relationship_validator.rb
@@ -0,0 +1,91 @@+require 'tent-validator/validators/support/tent_header_expectation'
+require 'tent-validator/validators/support/post_header_expectation'
+require 'tent-validator/validators/support/tent_schemas'
+
+module TentValidator
+ module WithoutAuthentication
+
+ class RelationshipValidator < TentValidator::Spec
+
+ describe "POST /posts" do
+ context "without authentication" do
+
+ context "when relationship initialization" do
+ expect_response(:status => 204) do
+ ##
+ # Create user on local server
+ user = TentD::Model::User.generate
+
+ ##
+ # Create relationship#initial post
+ relationship_post = TentD::Model::Relationship.create_initial(user, TentValidator.remote_entity_uri.to_s)
+ relationship_data = relationship_post.as_json
+
+ ##
+ # Create credentials post which mentions relationship#initial
+ credentials_post = TentD::Model::Credentials.generate(user, relationship_post)
+
+ expect_headers(
+ 'Link' => %r{rel=['"]#{Regexp.escape("https://tent.io/rels/credentials")}['"]}
+ )
+
+ ##
+ # Start watching local requests
+ watch_local_requests(true, user.id)
+
+ ##
+ # Send relationship post to remote server
+ # - set link header pointing to one-time signed link to credentials post
+ res = clients(:no_auth, :server => :remote).post.create(relationship_data, {}, :notification => true) do |request|
+ url = TentD::Utils.expand_uri_template(
+ user.preferred_server['urls']['post'],
+ :entity => user.entity,
+ :post => credentials_post.public_id
+ )
+ link = %(<#{url}>; rel="https://tent.io/rels/credentials")
+ request.headers['Link'] ? request.headers['Link'] << ", #{link}" : request.headers['Link'] = link
+ end
+
+ ##
+ # Expect discovery
+ expect_request(
+ :method => :head,
+ :path => "/"
+ )
+ expect_request(
+ :method => :get,
+ :path => "/posts/#{URI.encode_www_form_component(user.entity)}/#{user.meta_post.public_id}",
+ :headers => {
+ "Accept" => TentD::API::POST_CONTENT_TYPE % user.meta_post.type
+ }
+ )
+
+ ##
+ # Expect credentials post to be fetched
+ expect_request(
+ :method => :get,
+ :path => "/posts/#{URI.encode_www_form_component(user.entity)}/#{credentials_post.public_id}",
+ :headers => {
+ "Accept" => TentD::API::POST_CONTENT_TYPE % credentials_post.type
+ }
+ )
+
+ ##
+ # Stop watching local requests
+ watch_local_requests(false, user.id)
+
+ ##
+ # Validate response
+ res
+ end
+ end
+
+ end
+ end
+
+ end
+
+ end
+
+ TentValidator.validators << WithoutAuthentication::RelationshipValidator
+end
| Add validation for POST new_post when initial relationship post notification
|
diff --git a/db/migrate/20190212153025_change_domain_option_id_to_bigint.rb b/db/migrate/20190212153025_change_domain_option_id_to_bigint.rb
index abc1234..def5678 100644
--- a/db/migrate/20190212153025_change_domain_option_id_to_bigint.rb
+++ b/db/migrate/20190212153025_change_domain_option_id_to_bigint.rb
@@ -0,0 +1,9 @@+class ChangeDomainOptionIdToBigint < ActiveRecord::Migration[6.0]
+ def up
+ change_column :domain_options, :id, :bigint
+ end
+
+ def down
+ change_column :domain_options, :id, :integer
+ end
+end
| Update domain_option_id primary key to bigint
|
diff --git a/Strategies/cache_wo_download.rb b/Strategies/cache_wo_download.rb
index abc1234..def5678 100644
--- a/Strategies/cache_wo_download.rb
+++ b/Strategies/cache_wo_download.rb
@@ -6,7 +6,7 @@ # visible to the download strategy. Which is why this class is kind of an
# abstract class with the `homepage` method unimplemented. Formulas using this
# strategy need to derive from this class and implement the `homepage` method.
-class CacheWoDownloadStrategy < CurlDownloadStrategy
+class CacheWoDownloadStrategy < AbstractFileDownloadStrategy
def homepage
raise ArgumentError,
"You need to override the `homepage` method to return the homepage!"
| Use the abstract download strategy directly
The CURL download strategy started doing too much. And it was pointless
anyway.
|
diff --git a/spec/vcloud/config_loader_spec.rb b/spec/vcloud/config_loader_spec.rb
index abc1234..def5678 100644
--- a/spec/vcloud/config_loader_spec.rb
+++ b/spec/vcloud/config_loader_spec.rb
@@ -0,0 +1,46 @@+require 'spec_helper'
+
+describe Vcloud::ConfigLoader do
+
+ before(:all) do
+ @valid_config = valid_config
+ end
+
+ it "should create a valid hash when input is JSON" do
+ input_file = 'spec/integration/support/working.json'
+ loader = Vcloud::ConfigLoader.new
+ actual_config = loader.load_config(input_file)
+ valid_config.should eq(actual_config)
+ end
+
+
+ def valid_config
+ {
+ :vdcs=>[{:name=>"VDC_NAME"}],
+ :vapps=>[{
+ :name=>"vapp-vcloud-tools-tests",
+ :vdc_name=>"VDC_NAME",
+ :catalog=>"CATALOG_NAME",
+ :catalog_item=>"CATALOG_ITEM",
+ :vm=>{
+ :hardware_config=>{:memory=>"4096", :cpu=>"2"},
+ :extra_disks=>[{:size=>"8192"}],
+ :network_connections=>[{
+ :name=>"Default",
+ :ip_address=>"192.168.2.10"
+ },
+ {
+ :name=>"NetworkTest2",
+ :ip_address=>"192.168.1.10"
+ }],
+ :bootstrap=>{
+ :script_path=>"spec/data/basic_preamble_test.erb",
+ :vars=>{:message=>"hello world"}
+ },
+ :metadata=>{}
+ }
+ }]
+ }
+ end
+
+end
| Add test that JSON parses correctly
|
diff --git a/app/helpers/quick_jump_targets_helper.rb b/app/helpers/quick_jump_targets_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/quick_jump_targets_helper.rb
+++ b/app/helpers/quick_jump_targets_helper.rb
@@ -1,7 +1,10 @@ module QuickJumpTargetsHelper
def default_quickjump_targets
- targets = find_last_active_contents(:limit => 8, :type => Page).map(&:holder).compact.uniq
- quick_jumpify(targets)
+ if current_project
+ quick_jumpify(current_project.pages)
+ else
+ default_quickjump_pages(8)
+ end
end
def default_quickjump_projects(_limit = 20)
@@ -21,24 +24,4 @@ end
end
- # TODO: this solution seems terrible
- def find_last_active_contents(options = {})
- limit = options.fetch(:limit, 8)
- types = [options.fetch(:type)].flatten.compact.map(&:to_s)
- chain = Activity.accessible_by(current_ability).where(:user_id => current_user.id)
- chain = chain.where("verb <> 'read'").order("created_at DESC")
- offset = 0
- contents = []
- while contents.length < limit && offset < chain.count do
- activity = chain.offset(offset).first
- content = activity.try(:content).presence
- if content.present? && !contents.include?(content)
- if !types.present? || types.include?(content.holder_type)
- contents << activity.content
- end
- end
- offset += 1
- end
- contents
- end
end
| Simplify default targets in QuickJumpHelper
|
diff --git a/app/services/aggregate_school_service.rb b/app/services/aggregate_school_service.rb
index abc1234..def5678 100644
--- a/app/services/aggregate_school_service.rb
+++ b/app/services/aggregate_school_service.rb
@@ -9,7 +9,7 @@ Rails.cache.fetch(cache_key, expires_in: 1.day) do
meter_collection = Amr::AnalyticsValidatedMeterCollectionFactory.new(@active_record_school).build
- AggregateDataService.new(meter_collection).validate_and_aggregate_meter_data
+ AggregateDataService.new(meter_collection).aggregate_heat_and_electricity_meters
meter_collection
end
| Update not to validate twice
|
diff --git a/lib/adcloud/authentication.rb b/lib/adcloud/authentication.rb
index abc1234..def5678 100644
--- a/lib/adcloud/authentication.rb
+++ b/lib/adcloud/authentication.rb
@@ -1,23 +1,23 @@ module Adcloud
class AuthenticationError < StandardError ; end
-
+
class Authentication
-
+
attr_accessor :client_id, :client_secret, :token
def initialize(attr)
@client_id = attr[:client_id]
- @client_secret = attr[:client_secret]
+ @client_secret = attr[:client_secret]
end
def authenticate!
response = Connection.new.connection(false).post "oauth/access_token", {:client_id => self.client_id, :client_secret => self.client_secret, :grant_type => "none"}
if response.success?
- @token = response.body["access_token"]
+ @token = response.body['_meta']["access_token"]
else
raise AuthenticationError.new(@client_id => "Could not authenticate")
- end
+ end
end
end
| Update access token extraction due to changes in the API
|
diff --git a/lib/git_crecord/hunks/hunk.rb b/lib/git_crecord/hunks/hunk.rb
index abc1234..def5678 100644
--- a/lib/git_crecord/hunks/hunk.rb
+++ b/lib/git_crecord/hunks/hunk.rb
@@ -26,6 +26,32 @@ def highlightable_subs
@highlightable_subs ||= @lines.select(&:highlightable?)
end
+
+ def generate_diff(out_line_offset = 0)
+ return [nil, out_line_offset] unless selected
+ header, out_line_offset = generate_header(out_line_offset)
+ content = [
+ header,
+ *subs.map(&:generate_diff).compact
+ ].join("\n")
+ [content, out_line_offset]
+ end
+
+ def generate_header(out_line_offset)
+ old_start, old_count, new_start, new_count = @head.match(
+ /@@ -(\d+),(\d+) \+(\d+),(\d+) @@/
+ )[1..4].map(&:to_i)
+ new_start += out_line_offset
+ highlightable_subs.each do |sub|
+ next if sub.selected
+ new_count -= 1 if sub.add?
+ new_count += 1 if sub.del?
+ end
+ [
+ "@@ -#{old_start},#{old_count} +#{new_start},#{new_count} @@",
+ new_start + new_count
+ ]
+ end
end
end
end
| Implement generate_diff method for Hunk
|
diff --git a/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb b/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb
index abc1234..def5678 100644
--- a/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb
+++ b/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb
@@ -27,6 +27,7 @@ post = Namespaced::Post.find_by_title( 'Great stuff', :include => :tagging )
assert_nil post.tagging
+ ActiveRecord::IdentityMap.clear
ActiveRecord::Base.store_full_sti_class = true
post = Namespaced::Post.find_by_title( 'Great stuff', :include => :tagging )
assert_instance_of Tagging, post.tagging
| Clear IdentityMap before continue this test, we can do this here because store_full_sti_class is not supposed to change during "runtime".
|
diff --git a/app/api/v1/base.rb b/app/api/v1/base.rb
index abc1234..def5678 100644
--- a/app/api/v1/base.rb
+++ b/app/api/v1/base.rb
@@ -14,7 +14,7 @@ route_param :envelope_community do
desc 'Gives general info about the community'
get do
- community = EnvelopeCommunity.find_by(
+ community = EnvelopeCommunity.find_by!(
name: params[:envelope_community].underscore
)
| Return a 404 status code if community is not found
|
diff --git a/example/config/application.rb b/example/config/application.rb
index abc1234..def5678 100644
--- a/example/config/application.rb
+++ b/example/config/application.rb
@@ -10,6 +10,11 @@ config.environment :test
config.commerce_id 597026007976
# config.commerce_key SOME_RSA_KEY
+
+ # Use official logger
+ config.webpay_logger :official do |logger|
+ logger.directory Rails.root.join('log/webpay')
+ end
end
# Configure the default encoding used in templates for Ruby 1.9.
| Set default app logger to the official logger
|
diff --git a/lib/vagrant-bindfs/vagrant/capabilities/linux/system_checks.rb b/lib/vagrant-bindfs/vagrant/capabilities/linux/system_checks.rb
index abc1234..def5678 100644
--- a/lib/vagrant-bindfs/vagrant/capabilities/linux/system_checks.rb
+++ b/lib/vagrant-bindfs/vagrant/capabilities/linux/system_checks.rb
@@ -8,14 +8,14 @@ def bindfs_exists_user(machine, user)
(
user.nil? || \
- machine.communicate.test("getent passwd #{user.shellescape}")
+ machine.communicate.test("getent passwd #{user.to_s.shellescape}")
)
end
def bindfs_exists_group(machine, group)
(
group.nil? || \
- machine.communicate.test("getent group #{group.shellescape}")
+ machine.communicate.test("getent group #{group.to_s.shellescape}")
)
end
end
| Fix when input is a symbol
I don't know if it should also be applied to other shellescape "just in case". |
diff --git a/app/models/team.rb b/app/models/team.rb
index abc1234..def5678 100644
--- a/app/models/team.rb
+++ b/app/models/team.rb
@@ -4,6 +4,6 @@
validates :name, presence: true, length: { maximum: 50 }
validates :project_desc, presence: true, length: { minimum: 50, maximum: 500 }
- validates :technologies, length: { maximum: 5 }
+ validates :technologies, length: { maximum: 10 }
validates :members_id, length: { maximum: 4 }
end
| Increase technologies limit to 10
|
diff --git a/app/actions/reindex_everything.rb b/app/actions/reindex_everything.rb
index abc1234..def5678 100644
--- a/app/actions/reindex_everything.rb
+++ b/app/actions/reindex_everything.rb
@@ -3,6 +3,7 @@ class ReindexEverything < CloudCrowd::Action
def process
+ outcomes = {:succeeded=>[], :failed => []}
docs = Document.where({:id => input}).includes(:pages, :docdata)
ids = []
docs.find_each do |document|
@@ -13,12 +14,37 @@ ids << document.id
rescue Exception => e
counter += 1
- retry if counter < 5
+ (sleep(0.25) and retry) if counter < 5
LifecycleMailer.exception_notification(e,options).deliver_now
+ outcomes[:failed].push(:id=>doc.id)
end
end
Sunspot.commit
+ outcomes
+ end
+
+ def merge
+ # Upon completion email us a manifest of success/failure
+ successes = []
+ failures = []
+ input.each do |result|
+ successes += result["succeeded"]
+ failures += result["failed"]
+ end
+
+ duplicate_projects(successes) if options['projects']
+
+ data = {:successes => successes, :failures => failures}
+ LifecycleMailer.logging_email("Reindexing batch manifest", data).deliver_now
true
end
end
+
+=begin
+
+ids = Document.pluck(:id); ids.size
+blocks = ids.each_slice(100).to_a; blocks.size
+blocks.each_slice(10){ |block| RestClient.post ProcessingJob.endpoint, { job: { action: "reindex_everything", inputs: block }.to_json } }; ""
+
+=end | Add some debugging info to reindexing everything. |
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -6,6 +6,7 @@ end
def form_errors_for(object)
+ object.photo.purge if object.photo.attached?
render partial: 'shared/form_errors', locals: { object: object }
end
| Add photo purge catch to prevent routes error if a user tries to create something with a photo and nothing else
|
diff --git a/lib/rails/generators/fabrication/cucumber_steps/cucumber_steps_generator.rb b/lib/rails/generators/fabrication/cucumber_steps/cucumber_steps_generator.rb
index abc1234..def5678 100644
--- a/lib/rails/generators/fabrication/cucumber_steps/cucumber_steps_generator.rb
+++ b/lib/rails/generators/fabrication/cucumber_steps/cucumber_steps_generator.rb
@@ -1,15 +1,16 @@ require 'rails/generators/base'
-module Fabrication::Generators
- class CucumberStepsGenerator < Rails::Generators::Base
+module Fabrication
+ module Generators
+ class CucumberStepsGenerator < Rails::Generators::Base
- def generate
- template 'fabrication_steps.rb', "features/step_definitions/fabrication_steps.rb"
+ def generate
+ template 'fabrication_steps.rb', "features/step_definitions/fabrication_steps.rb"
+ end
+
+ def self.source_root
+ @_fabrication_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
+ end
end
-
- def self.source_root
- @_fabrication_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
- end
-
end
end
| Fix module declaration for cucumber step generator
Fixes error message: "[WARNING] Could not load generator "rails/generators/fabrication/cucumber_steps/cucumber_steps_generator". Error: uninitialized constant Fabrication." when running `rails generate fabrication:cucumber_steps` on Ruby 2.0.0p195, Rails 3.2.13, OS X 10.8.4
See also: pull request #88 |
diff --git a/spec/views/projects/merge_requests/_commits.html.haml_spec.rb b/spec/views/projects/merge_requests/_commits.html.haml_spec.rb
index abc1234..def5678 100644
--- a/spec/views/projects/merge_requests/_commits.html.haml_spec.rb
+++ b/spec/views/projects/merge_requests/_commits.html.haml_spec.rb
@@ -0,0 +1,38 @@+require 'spec_helper'
+
+describe 'projects/merge_requests/show/_commits.html.haml' do
+ include Devise::Test::ControllerHelpers
+
+ let(:user) { create(:user) }
+ let(:target_project) { create(:project) }
+
+ let(:source_project) do
+ create(:project, forked_from_project: target_project)
+ end
+
+ let(:merge_request) do
+ create(:merge_request, :simple,
+ source_project: source_project,
+ target_project: target_project,
+ author: user)
+ end
+
+ before do
+ controller.prepend_view_path('app/views/projects')
+
+ assign(:merge_request, merge_request)
+ assign(:commits, merge_request.commits)
+ end
+
+ it 'shows commits from source project' do
+ render
+
+ commit = source_project.commit(merge_request.source_branch)
+ href = namespace_project_commit_path(
+ source_project.namespace,
+ source_project,
+ commit)
+
+ expect(rendered).to have_link(Commit.truncate_sha(commit.sha), href: href)
+ end
+end
| Add a view test for showing source commits
|
diff --git a/core/lib/spree/core/controller_helpers/strong_parameters.rb b/core/lib/spree/core/controller_helpers/strong_parameters.rb
index abc1234..def5678 100644
--- a/core/lib/spree/core/controller_helpers/strong_parameters.rb
+++ b/core/lib/spree/core/controller_helpers/strong_parameters.rb
@@ -13,6 +13,12 @@ def permitted_payment_attributes
permitted_attributes.payment_attributes + [
source_attributes: permitted_source_attributes
+ ]
+ end
+
+ def permitted_source_attributes
+ permitted_attributes.source_attributes + [
+ address_attributes: permitted_address_attributes,
]
end
| Add permitted attributes for payment.source.address
So that admin/frontend/api can supply this information if the store's
payment sources support it.
cherry-picked from e12be61c2365a530a451b9ace453c362b0bd57a6 in bonobos/spree
|
diff --git a/firmata.gemspec b/firmata.gemspec
index abc1234..def5678 100644
--- a/firmata.gemspec
+++ b/firmata.gemspec
@@ -20,5 +20,5 @@ gem.add_development_dependency("minitest")
gem.add_runtime_dependency("event_emitter")
- gem.add_runtime_dependency("rubyserial", "0.1.0")
+ gem.add_runtime_dependency("rubyserial")
end
| Revert "Adding specific rubyserial version dependency"
This reverts commit 0baac1beef9d62d43c1c3d44602cfca0687ac929.
|
diff --git a/db/migrate/20190927152242_add_enrollment_role_user_index.rb b/db/migrate/20190927152242_add_enrollment_role_user_index.rb
index abc1234..def5678 100644
--- a/db/migrate/20190927152242_add_enrollment_role_user_index.rb
+++ b/db/migrate/20190927152242_add_enrollment_role_user_index.rb
@@ -0,0 +1,26 @@+#
+# Copyright (C) 2019 - 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 AddEnrollmentRoleUserIndex < ActiveRecord::Migration[5.2]
+ tag :predeploy
+ disable_ddl_transaction!
+
+ def change
+ add_index :enrollments, [:role_id, :user_id], algorithm: :concurrently
+ end
+end
| Add role and user index on enrollments table
This helps speed up some `UserSearch` queries
Test Plan:
- Jenkins passes
flag = none
Change-Id: I4c94a577b363f0fcf6231b52c3283fa5de074c7e
Reviewed-on: https://gerrit.instructure.com/211264
Reviewed-by: Rob Orton <7e09c9d3e96378bf549fc283fd6e1e5b7014cc33@instructure.com>
QA-Review: Rob Orton <7e09c9d3e96378bf549fc283fd6e1e5b7014cc33@instructure.com>
Product-Review: Rob Orton <7e09c9d3e96378bf549fc283fd6e1e5b7014cc33@instructure.com>
Tested-by: Jenkins
|
diff --git a/test/integration/default/serverspec/default_spec.rb b/test/integration/default/serverspec/default_spec.rb
index abc1234..def5678 100644
--- a/test/integration/default/serverspec/default_spec.rb
+++ b/test/integration/default/serverspec/default_spec.rb
@@ -1,16 +1,15 @@ require 'serverspec'
-include Serverspec::Helper::Exec
-include Serverspec::Helper::DetectOS
+set :backend, :exec
describe 'awscreds::default' do
describe file('/root/.aws') do
it { should be_directory }
end
describe file('/root/.aws/config') do
- its(:content) {
+ its(:content) do
should eq File.read(
File.expand_path('../test-output.txt', __FILE__))
- }
+ end
end
end
| Use the new serverspec format
|
diff --git a/ra10ke.gemspec b/ra10ke.gemspec
index abc1234..def5678 100644
--- a/ra10ke.gemspec
+++ b/ra10ke.gemspec
@@ -14,7 +14,7 @@
spec.files = `git ls-files`.split($/)
spec.require_paths = ["lib"]
- spec.required_ruby_version = '>= 2.1.0'
+ spec.required_ruby_version = '>= 2.4.0'
spec.add_dependency "rake"
spec.add_dependency "puppet_forge"
| Set minimal Ruby version to 2.4.0
We test on that version since ages so we should mention it in the
gemspec
|
diff --git a/layer-identity_token.gemspec b/layer-identity_token.gemspec
index abc1234..def5678 100644
--- a/layer-identity_token.gemspec
+++ b/layer-identity_token.gemspec
@@ -22,5 +22,5 @@ spec.add_development_dependency 'rake', '~> 0'
spec.add_development_dependency 'pry', '~> 0'
- spec.add_dependency 'jwt', '~> 1.4', '>= 1.4.1'
+ spec.add_dependency 'jwt', '~> 2.2', '>= 1.4.1'
end
| Update jwt to version 2.2.1 |
diff --git a/reel.gemspec b/reel.gemspec
index abc1234..def5678 100644
--- a/reel.gemspec
+++ b/reel.gemspec
@@ -17,7 +17,7 @@
gem.add_runtime_dependency 'celluloid-io', '>= 0.8.0'
gem.add_runtime_dependency 'http', '>= 0.2.0'
- gem.add_runtime_dependency 'http_parser.rb', '>= 0.5.3'
+ gem.add_runtime_dependency 'http_parser.rb', '>= 0.6.0.beta.2'
gem.add_runtime_dependency 'websocket_parser', '>= 0.1.4'
gem.add_runtime_dependency 'rack', '>= 1.4.0'
| Use the new java port inside http_parser.rb which is jRuby compatible.
|
diff --git a/app/services/single_invite_job.rb b/app/services/single_invite_job.rb
index abc1234..def5678 100644
--- a/app/services/single_invite_job.rb
+++ b/app/services/single_invite_job.rb
@@ -9,7 +9,6 @@ def initialize(org, email)
@batch_invite = ::BatchInviteJob.new({:resend_invitation => false, :invite_list => {org.id.to_s => email}}, nil)
@org_id = org.id
- @callable_on_error = callable_on_error
@email = email
end
@@ -20,6 +19,6 @@ end
private
- attr_reader :batch_invite,:callable_on_error, :org_id, :email
+ attr_reader :batch_invite,:org_id, :email
end
| Remove extraneous reference to callable_on_error
|
diff --git a/examples/multi/width.rb b/examples/multi/width.rb
index abc1234..def5678 100644
--- a/examples/multi/width.rb
+++ b/examples/multi/width.rb
@@ -6,8 +6,8 @@ bar2 = bars.register "bar [:bar] :percent", total: 250
bar3 = bars.register "baz [:bar] :percent", total: 100
-th1 = Thread.new { 150.times { sleep(0.1); bar1.advance } }
-th2 = Thread.new { 250.times { sleep(0.1); bar2.advance } }
-th3 = Thread.new { 100.times { sleep(0.1); bar3.advance } }
+th1 = Thread.new { 15.times { sleep(0.1); bar1.advance(10) } }
+th2 = Thread.new { 50.times { sleep(0.1); bar2.advance(5)} }
+th3 = Thread.new { 50.times { sleep(0.1); bar3.advance(5) } }
[th1, th2, th3].each(&:join)
| Change individual bars step sizes
|
diff --git a/lib/solidus_subscriptions/churn_buster/subscription_customer_serializer.rb b/lib/solidus_subscriptions/churn_buster/subscription_customer_serializer.rb
index abc1234..def5678 100644
--- a/lib/solidus_subscriptions/churn_buster/subscription_customer_serializer.rb
+++ b/lib/solidus_subscriptions/churn_buster/subscription_customer_serializer.rb
@@ -9,10 +9,19 @@ source_id: object.id,
email: object.user.email,
properties: {
- first_name: object.shipping_address_to_use.firstname,
- last_name: object.shipping_address_to_use.lastname,
+ name: name
},
}
+ end
+
+ private
+
+ def name
+ if ::Spree.solidus_gem_version < Gem::Version.new('2.11.0')
+ "#{object.shipping_address_to_use.first_name} #{object.shipping_address_to_use.last_name}"
+ else
+ object.shipping_address_to_use.name
+ end
end
end
end
| Use name in customer serializer
Solidus 3.0 removes `first_name` and `last_name` from `Spree::Address`
so we should replace them with `name`. The Churn Buster documentation
would suggest it's OK to pass any customer properties we need, but I
have yet to get a developer account to verify.
|
diff --git a/spec/factories_spec.rb b/spec/factories_spec.rb
index abc1234..def5678 100644
--- a/spec/factories_spec.rb
+++ b/spec/factories_spec.rb
@@ -1,9 +1,17 @@ require 'spec_helper'
-FactoryGirl.factories.map(&:name).each do |factory_name|
- describe "#{factory_name} factory" do
- it 'should be valid' do
- expect(build(factory_name)).to be_valid
+describe 'factories' do
+ FactoryGirl.factories.each do |factory|
+ describe "#{factory.name} factory" do
+ let(:entity) { build(factory.name) }
+
+ it 'does not raise error when created 'do
+ expect { entity }.to_not raise_error
+ end
+
+ it 'should be valid', if: factory.build_class < ActiveRecord::Base do
+ expect(entity).to be_valid
+ end
end
end
end
| Add support for not Active Record based factories
|
diff --git a/flowing.gemspec b/flowing.gemspec
index abc1234..def5678 100644
--- a/flowing.gemspec
+++ b/flowing.gemspec
@@ -13,14 +13,6 @@ spec.homepage = "https://github.com/antoshalee/flowing"
spec.license = "MIT"
- # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
- # delete this section to allow pushing this gem to any host.
- if spec.respond_to?(:metadata)
- spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
- else
- raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
- end
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
| Allow to push gem on any host
|
diff --git a/features/step_definitions/viewing_calculated_stats_steps.rb b/features/step_definitions/viewing_calculated_stats_steps.rb
index abc1234..def5678 100644
--- a/features/step_definitions/viewing_calculated_stats_steps.rb
+++ b/features/step_definitions/viewing_calculated_stats_steps.rb
@@ -1,7 +1,7 @@ Given(/^that no stats exist$/) do
end
-Given(/^that some stats exist(?: for one player)$/) do
+Given(/^that some stats exist(?: for one player)?$/) do
@stats_csv = "aardsda01,2009,AL,SEA,73,0,0,0,0,0,0,0,0,0"
end
| Fix the 'some stats exist' step's regex
|
diff --git a/version_gemfile.gemspec b/version_gemfile.gemspec
index abc1234..def5678 100644
--- a/version_gemfile.gemspec
+++ b/version_gemfile.gemspec
@@ -18,5 +18,5 @@
gem.add_development_dependency("rake", "~> 13.0.6")
gem.add_development_dependency("rspec", "~> 3.11.0")
- gem.add_development_dependency("standard", "~> 1.9.0")
+ gem.add_development_dependency("standard", "~> 1.11.0")
end
| Update standard requirement from ~> 1.9.0 to ~> 1.11.0
Updates the requirements on [standard](https://github.com/testdouble/standard) to permit the latest version.
- [Release notes](https://github.com/testdouble/standard/releases)
- [Changelog](https://github.com/testdouble/standard/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testdouble/standard/compare/v1.9.0...v1.11.0)
---
updated-dependencies:
- dependency-name: standard
dependency-type: direct:development
...
Signed-off-by: dependabot[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@github.com> |
diff --git a/db/data_migration/20170607130246_remove_the_from_the_scottish_government_logo.rb b/db/data_migration/20170607130246_remove_the_from_the_scottish_government_logo.rb
index abc1234..def5678 100644
--- a/db/data_migration/20170607130246_remove_the_from_the_scottish_government_logo.rb
+++ b/db/data_migration/20170607130246_remove_the_from_the_scottish_government_logo.rb
@@ -0,0 +1,6 @@+the_scottish_government = Organisation.find_by(slug: "the-scottish-government")
+new_logo_formatted_name = "Scottish \r\nGovernment"
+
+the_scottish_government.update_attributes(
+ logo_formatted_name: new_logo_formatted_name
+)
| Remove 'The' from the Scottish Government logo
This commit removes 'The' from the `#logo_formatted_name` for 'The
Scottish Government'. This is necessary to support use by the
organisations register of the organisations API.
|
diff --git a/app/views/news/index.atom.builder b/app/views/news/index.atom.builder
index abc1234..def5678 100644
--- a/app/views/news/index.atom.builder
+++ b/app/views/news/index.atom.builder
@@ -20,6 +20,7 @@ entry.author do |author|
author.name(news.author_name)
end
+ entry.category(:term => news.section.title)
entry.wfw :commentRss, "http://#{MY_DOMAIN}/nodes/#{news.node.id}/comments.atom"
end
end
| Add category in news feed.
Signed-off-by: François de Metz <5187da0b934cc25eb2201a3ec9206c24b13cb23b@2metz.fr>
|
diff --git a/ajax_forms.gemspec b/ajax_forms.gemspec
index abc1234..def5678 100644
--- a/ajax_forms.gemspec
+++ b/ajax_forms.gemspec
@@ -9,16 +9,21 @@ s.version = AjaxForms::VERSION
s.authors = ["Guillermo Bisheimer, Christian Pfarher"]
s.email = ["gbisheimer@bys-control.com.ar, c.pfarher@gmail.com"]
- s.homepage = ""
+ s.homepage = "https://github.com/bys-control/activeadmin-ajax_forms"
s.summary = "Allow fast creation of records using ajax forms"
- s.description = "Allow fast creation of records using ajax forms"
+ s.description = "Allow fast creation of records using modal forms submitted using AJAX"
s.license = "MIT"
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
s.test_files = Dir["test/**/*"]
- s.add_dependency "rails", "~> 4.1.5"
- s.add_dependency "activeadmin", ">= 0"
+ s.add_dependency "rails", "~> 4"
+ s.add_dependency "activeadmin", "~> 0"
- s.add_development_dependency "sqlite3"
+ s.add_dependency "jquery", "~> 0"
+ s.add_dependency "select2-rails", "~> 3.5"
+ s.add_dependency "fancybox2-rails", "~> 0.2"
+ s.add_dependency "activeadmin-select2", "~> 0.1"
+
+ s.add_development_dependency "sqlite3", "~> 0"
end
| Add dependencies and fixes gemspec warnings
|
diff --git a/test/unit/workers/publishing_api_discard_draft_worker_test.rb b/test/unit/workers/publishing_api_discard_draft_worker_test.rb
index abc1234..def5678 100644
--- a/test/unit/workers/publishing_api_discard_draft_worker_test.rb
+++ b/test/unit/workers/publishing_api_discard_draft_worker_test.rb
@@ -4,30 +4,32 @@ class PublishingApDiscardDraftiWorkerTest < ActiveSupport::TestCase
include GdsApi::TestHelpers::PublishingApiV2
+ def setup
+ @edition = create(:draft_case_study)
+ WebMock.reset!
+ end
+
test "registers a draft edition with the publishing api" do
- edition = create(:draft_case_study)
- request = stub_publishing_api_discard_draft(edition.content_id)
+ request = stub_publishing_api_discard_draft(@edition.content_id)
- PublishingApiDiscardDraftWorker.new.perform(edition.content_id, 'en')
+ PublishingApiDiscardDraftWorker.new.perform(@edition.content_id, 'en')
assert_requested request
end
test "gracefully handles the deletion of an already-deleted draft edition" do
- edition = create(:draft_case_study)
request = stub_any_publishing_api_call
.to_return(status: 422)
- PublishingApiDiscardDraftWorker.new.perform(edition.content_id, 'en')
+ PublishingApiDiscardDraftWorker.new.perform(@edition.content_id, 'en')
assert_requested request
end
test "gracefully handles the deletion of a non-existant content item" do
- edition = create(:draft_case_study)
request = stub_any_publishing_api_call_to_return_not_found
- PublishingApiDiscardDraftWorker.new.perform(edition.content_id, 'en')
+ PublishingApiDiscardDraftWorker.new.perform(@edition.content_id, 'en')
assert_requested request
end
| Fix discard draft worker test
The number of publishing api requests has changed with Rails 5 since
after_commit started getting called. In this case the `Organisation`
created by the `CaseStudy` factory was adding 3 unaccounted for
requests. This commit resets WebMock after setup.
|
diff --git a/RespokeSDK.podspec b/RespokeSDK.podspec
index abc1234..def5678 100644
--- a/RespokeSDK.podspec
+++ b/RespokeSDK.podspec
@@ -1,6 +1,6 @@ Pod::Spec.new do |s|
s.name = "RespokeSDK"
- s.version = "0.0.9"
+ s.version = "1.0.2"
s.summary = "Add live voice, video, text and data features to your mobile app."
s.homepage = "https://www.respoke.io"
s.license = 'MIT'
| Update podspec version to 1.0.2
|
diff --git a/lib/bugsnag/rails/active_record_rescue.rb b/lib/bugsnag/rails/active_record_rescue.rb
index abc1234..def5678 100644
--- a/lib/bugsnag/rails/active_record_rescue.rb
+++ b/lib/bugsnag/rails/active_record_rescue.rb
@@ -3,7 +3,7 @@ KINDS = [:commit, :rollback].freeze
def run_callbacks(kind, *args, &block)
- if kinds.include?(kind)
+ if KINDS.include?(kind)
begin
super
rescue StandardError => exception
| Use the constant "KINDS" instead of undefined "kinds"
|
diff --git a/lib/motion-authentication.rb b/lib/motion-authentication.rb
index abc1234..def5678 100644
--- a/lib/motion-authentication.rb
+++ b/lib/motion-authentication.rb
@@ -4,8 +4,8 @@ raise "This file must be required within a RubyMotion project Rakefile."
end
-require 'motion-cocoapods'
-require 'motion-keychain'
+require 'motion-cocoapods' # TODO: this won't work for Android
+require 'motion-keychain' # TODO: this won't work for Android
lib_dir_path = File.dirname(File.expand_path(__FILE__))
Motion::Project::App.setup do |app|
| Add TODO notes regarding Android support.
|
diff --git a/lib/peephole/rails/routes.rb b/lib/peephole/rails/routes.rb
index abc1234..def5678 100644
--- a/lib/peephole/rails/routes.rb
+++ b/lib/peephole/rails/routes.rb
@@ -1,15 +1,17 @@ module ActionDispatch::Routing
class Mapper
- def with_tenant
- scope constraints: Peephole::TenantSubdomainConstraint.new do
+ def with_tenant *args
+ constraints = Peephole::TenantSubdomainConstraint.new *args
+ scope constraints: constraints do
yield if block_given?
end
end
alias_method :for_tenant, :with_tenant
- def without_tenant
- scope constraints: Peephole::WithoutSubdomainConstraint.new do
+ def without_tenant *args
+ constraints = Peephole::WithoutSubdomainConstraint.new *args
+ scope constraints: constraints do
yield if block_given?
end
end
| Add arguments to routing helpers
|
diff --git a/lib/tasks/bank_holidays.rake b/lib/tasks/bank_holidays.rake
index abc1234..def5678 100644
--- a/lib/tasks/bank_holidays.rake
+++ b/lib/tasks/bank_holidays.rake
@@ -5,7 +5,7 @@ task :generate_json, [:year] => :environment do |_t, args|
year = args[:year].to_i
if year != 0
- nations = %w(england-and-wales scotland northern-ireland")
+ nations = %w(england-and-wales scotland northern-ireland)
nations.each do |nation|
generator = BankHolidayGenerator.new(year, nation)
bank_holidays = generator.perform
| Fix Rake task to generate bank holidays
It was looking for `northern-ireland"` rather than `northern-ireland`.
|
diff --git a/lib/tila/resourceful_urls.rb b/lib/tila/resourceful_urls.rb
index abc1234..def5678 100644
--- a/lib/tila/resourceful_urls.rb
+++ b/lib/tila/resourceful_urls.rb
@@ -9,14 +9,22 @@
protected
+ def route_key_singular
+ model.model_name.element
+ end
+
+ def route_key_plural
+ route_key_singular.pluralize == route_key_singular ? "#{route_key_singular.pluralize}_index" : route_key_singular.pluralize
+ end
+
def object_url(object = nil, options = {})
target = object ? object : self.object
- send "#{model.model_name.route_key.singularize}_url", target, options
+ send "#{route_key_singular}_url", target, options
end
def collection_url(options = {})
- send "#{model.model_name.route_key}_url", options
+ send "#{route_key_plural}_url", options
end
end
end | Fix route keys and move the keys to seperate functions
|
diff --git a/lib/lims-laboratory-app/laboratory/tube/bulk_create_tube.rb b/lib/lims-laboratory-app/laboratory/tube/bulk_create_tube.rb
index abc1234..def5678 100644
--- a/lib/lims-laboratory-app/laboratory/tube/bulk_create_tube.rb
+++ b/lib/lims-laboratory-app/laboratory/tube/bulk_create_tube.rb
@@ -0,0 +1,25 @@+require 'lims-core/actions/action'
+require 'lims-laboratory-app/laboratory/tube'
+require 'lims-laboratory-app/laboratory/tube/create_tube_shared'
+
+module Lims::LaboratoryApp
+ module Laboratory
+ class Tube
+ class BulkCreateTube
+ include Lims::Core::Actions::Action
+ include CreateTubeShared
+
+ attribute :tubes, Array, :required => true, :writer => :private
+
+ def _call_in_session(session)
+ result = []
+ tubes.each do |parameters|
+ result << _create(parameters[:type], parameters[:max_volume], parameters[:aliquots], session)
+ end
+
+ {:tubes => result.map { |e| e[:tube] }}
+ end
+ end
+ end
+ end
+end
| Add bulk create tube action
|
diff --git a/app/models/user_mailer.rb b/app/models/user_mailer.rb
index abc1234..def5678 100644
--- a/app/models/user_mailer.rb
+++ b/app/models/user_mailer.rb
@@ -19,8 +19,8 @@ protected
def finish_email(user, subject)
- # CHECKME: is this theme stuff necessary here?
- self.theme_name = (APP_CONFIG[:theme]||'default')
+ # Need to set the theme because normally it gets set in a controller before_filter...
+ set_theme(APP_CONFIG[:theme]||'default')
mail(:to => "#{user.name} <#{user.email}>",
:subject => "[#{APP_CONFIG[:site_name]}] #{subject}",
:date => Time.now)
| Fix theming for user mailer
|
diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/events_helper.rb
+++ b/app/helpers/events_helper.rb
@@ -5,7 +5,7 @@ end
def available?(event)
- event.owner == nil && event.pending
+ event.owner == nil && event.pending && event.end_date_time > DateTime.now
end
end
| Adjust logic for showing if an event is still available
|
diff --git a/app/models/login_activity.rb b/app/models/login_activity.rb
index abc1234..def5678 100644
--- a/app/models/login_activity.rb
+++ b/app/models/login_activity.rb
@@ -1,7 +1,17 @@+# This class was added in July 2018, login activity before that date wasn't tracked.
+
+# A LoginActivity record can belong to an Educator record, using a polymorphic
+# association. (See Educator#has_many :login_activities, as: :user.)
+
+# However, because of the way Authtrail tracks users/educators, a LoginActivity
+# will only be associated with an Educator if the LoginActivity was a success.
+# See (https://github.com/ankane/authtrail/blob/master/lib/auth_trail/manager.rb#L15).
+
+# If the attempted login is a failure, it will have user_id set to nil, but the
+# email used in the attempt will be stored, so if the email matches with a valid
+# Insights educator email we can use Educator.find_by_email(email).
class LoginActivity < ApplicationRecord
belongs_to :user,
polymorphic: true,
- optional: true # Optional because an attacker might try logging
- # in with an email that doesn't belong to any educator.
- # (Or more generously, because someone might typo their email.)
+ optional: true
end
| Write more thorough comments on findings
|
diff --git a/lib/elasticsearch_update/elasticsearch.rb b/lib/elasticsearch_update/elasticsearch.rb
index abc1234..def5678 100644
--- a/lib/elasticsearch_update/elasticsearch.rb
+++ b/lib/elasticsearch_update/elasticsearch.rb
@@ -0,0 +1,44 @@+require 'logger'
+require 'json'
+require 'net/http'
+
+module ElasticsearchUpdate
+ # This class is in charge of retrieving and downloading data.
+ class Elasticsearch
+ def initialize(hash = { host: 'localhost', port: 9200 })
+ @log = Logger.new(STDOUT)
+ @log.level = Logger::INFO
+
+ @log.debug('Logger created for Elasticsearch.')
+
+ @es_host = hash[:host]
+ @es_port = hash[:port]
+ end
+
+ def disable_cluster_routing_allocation
+ @log.info('Disabling cluster routing allocation')
+
+ begin
+ req = Net::HTTP::Put.new('/_cluster/settings',
+ 'Content-Type' => 'application/javascript')
+ req.body = { transient: { 'cluster.routing.allocation.enable' => 'none' } }
+ req.body = req.body.to_json
+ response = Net::HTTP.new(@es_host, @es_port).start {|http| http.request(req) }
+ rescue Errno::ECONNREFUSED
+ puts 'Connection could not be made to Elasticsearch at'
+ puts @es_host + ':' + @es_port + '/_cluster/settings'
+ abort('Please verify that Elasticsearch is available at this address.')
+ end
+
+ response
+ end
+
+ def shutdown_local_node
+ @log.info('Shutting down local node')
+ @shutdown_uri = URI('http://' + @es_host + ':' + @es_port.to_s + '/_cluster/nodes/_local/_shutdown')
+ response = Net::HTTP.post_form(@shutdown_uri, {})
+
+ response
+ end
+ end
+end
| Add class to work with Elasticsearch
|
diff --git a/lib/flipper/api/v1/actions/groups_gate.rb b/lib/flipper/api/v1/actions/groups_gate.rb
index abc1234..def5678 100644
--- a/lib/flipper/api/v1/actions/groups_gate.rb
+++ b/lib/flipper/api/v1/actions/groups_gate.rb
@@ -28,7 +28,7 @@
def ensure_valid_params
return if allow_unregistered_groups?
- return unless Flipper.group_exists?(group_name)
+ return if Flipper.group_exists?(group_name)
json_error_response(:group_not_registered)
end
| Fix incorrect logic thanks to rubo
|
diff --git a/SwiftyDrop.podspec b/SwiftyDrop.podspec
index abc1234..def5678 100644
--- a/SwiftyDrop.podspec
+++ b/SwiftyDrop.podspec
@@ -1,6 +1,6 @@ Pod::Spec.new do |s|
s.name = "SwiftyDrop"
- s.version = "2.1.0"
+ s.version = "2.2.0"
s.summary = "SwiftyDrop is a lightweight pure Swift simple and beautiful dropdown message."
s.description = <<-DESC
| Change podspec's version to 2.2.0
|
diff --git a/lib/twitter/bootstrap/components/rails.rb b/lib/twitter/bootstrap/components/rails.rb
index abc1234..def5678 100644
--- a/lib/twitter/bootstrap/components/rails.rb
+++ b/lib/twitter/bootstrap/components/rails.rb
@@ -1,5 +1,4 @@ require 'jquery-rails'
-require 'bootstrap'
require 'haml-rails'
require "twitter/bootstrap/components/rails/engine"
| Remove hard bootstrap 4 require.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.