diff stringlengths 65 26.7k | message stringlengths 7 9.92k |
|---|---|
diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/welcome_controller.rb
+++ b/app/controllers/welcome_controller.rb
@@ -12,6 +12,6 @@ private
def form_params
- params.require(:rsvp_form).permit(:guest_count, :guest_names, :food_restrictions)
+ params.require(:rsvp_form).permit(:guest_count, :guest_names, :food_restrictions, :home_address, :phone)
end
end
| Add missing form parameters in welcome controller
|
diff --git a/app/helpers/georgia/sidebar_helper.rb b/app/helpers/georgia/sidebar_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/georgia/sidebar_helper.rb
+++ b/app/helpers/georgia/sidebar_helper.rb
@@ -6,8 +6,7 @@ end
def sidebar_navigation_sublink text, url, options={}
- controller = options.fetch(:controller)
- content_tag :li, link_to(sidebar_title_tag(text), url), class: "#{'active' if controller_name == controller}"
+ SidebarLinkPresenter.new(self, text, url, options).sidebar_navigation_sublink
end
end
| Fix sidebar_sublink to use presenter
|
diff --git a/benchmark-perf.gemspec b/benchmark-perf.gemspec
index abc1234..def5678 100644
--- a/benchmark-perf.gemspec
+++ b/benchmark-perf.gemspec
@@ -12,10 +12,14 @@ spec.homepage = ""
spec.license = "MIT"
- spec.files = `git ls-files -z`.split("\x0")
+ spec.files = Dir['{lib,spec}/**/*.rb']
+ spec.files += Dir['{tasks}/*', 'benchmark-perf.gemspec']
+ spec.files += Dir['README.md', 'CHANGELOG.md', 'LICENSE.txt', 'Rakefile']
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^spec/})
spec.require_paths = ["lib"]
+
+ spec.required_ruby_version = '>= 2.0.0'
spec.add_development_dependency 'bundler', '~> 1.16'
spec.add_development_dependency 'rspec', '~> 3.0'
| Change to read files and require ruby > 2.0
|
diff --git a/app/models/conversation_summarizer.rb b/app/models/conversation_summarizer.rb
index abc1234..def5678 100644
--- a/app/models/conversation_summarizer.rb
+++ b/app/models/conversation_summarizer.rb
@@ -14,7 +14,7 @@ end
def summary
- if subject
+ if subject.present?
subject
elsif first_sentence.size <= LENGTH
first_sentence
@@ -29,7 +29,7 @@
def first_sentence
sentence = first_message && first_message.partition(/\.|\?|\!|\s\-\s/)[0..1].join
- sentence.strip.chomp('-').strip
+ sentence.to_s.strip.chomp('-').strip
end
def truncated_message
| Fix weird failing test case
|
diff --git a/lib/discordrb/commands/container.rb b/lib/discordrb/commands/container.rb
index abc1234..def5678 100644
--- a/lib/discordrb/commands/container.rb
+++ b/lib/discordrb/commands/container.rb
@@ -17,5 +17,13 @@ @commands ||= {}
@commands.delete name
end
+
+ # Adds all commands from another container into this one. Existing commands will be overwritten.
+ # @param container [Module] A module that `extend`s {CommandContainer} from which the commands will be added.
+ def include!(container)
+ handlers = container.instance_variable_get '@commands'
+ @commands ||= {}
+ @commands.merge! handlers
+ end
end
end
| Add an include method to the CommandContainer, similar to the EventContainer one
|
diff --git a/lib/eventbrite/attendee_invoicer.rb b/lib/eventbrite/attendee_invoicer.rb
index abc1234..def5678 100644
--- a/lib/eventbrite/attendee_invoicer.rb
+++ b/lib/eventbrite/attendee_invoicer.rb
@@ -18,7 +18,39 @@ #
# Returns nil.
def self.perform(user_details, event_details, payment_details)
+ # Connect to Xero
+ xero ||= Xeroizer::PrivateApplication.new(
+ ENV["XERO_CONSUMER_KEY"],
+ ENV["XERO_CONSUMER_SECRET"],
+ ENV["XERO_PRIVATE_KEY_PATH"]
+ )
+ # Find appropriate contact in Xero
+ contact = xero.Contact.all(:where => %{Name == "#{contact_name(user_details)}"}).first
+ # Create contact if it doesn't exist, otherwise invoice them.
+ # Create contact will requeue this invoicing request.
+ if contact.nil?
+ create_contact(user_details, event_details, payment_details)
+ else
+ invoice_contact(user_details, event_details, payment_details)
+ end
+ end
+ def self.create_contact(user_details, event_details, payment_details)
+ contact = xero.Contact.create(
+ name: contact_name(user_details),
+ email_address: user_details[:invoice_email] || user_details[:email],
+ phones: [{type: 'DEFAULT', number: user_details[:invoice_phone] || user_details[:phone]}],
+ )
+ contact.save
+ # Requeue
+ Resque.enqueue AttendeeInvoicer, user_details, event_details, payment_details
+ end
+
+ def self.invoice_contact(user_details, event_details, payment_details)
+ end
+
+ def self.contact_name(user_details)
+ user_details[:company] || [user_details[:first_name], user_details[:last_name]].join(' ')
end
end | Create new contacts with names, emails, and phone numbers
2:00
|
diff --git a/lib/integrity/helpers/url_helper.rb b/lib/integrity/helpers/url_helper.rb
index abc1234..def5678 100644
--- a/lib/integrity/helpers/url_helper.rb
+++ b/lib/integrity/helpers/url_helper.rb
@@ -16,7 +16,7 @@ # sinatra-url-for[http://github.com/emk/sinatra-url-for] for the underlying
# library that handles getting the base URI from the http request.
def url(*path)
- url_for path.join("/")
+ url_for path.join("/"), :full
end
# For simplicity, pass a Project instance and it will write the correct URL.
| Return full urls on our url helpers
|
diff --git a/lib/rspec/core/backtrace_cleaner.rb b/lib/rspec/core/backtrace_cleaner.rb
index abc1234..def5678 100644
--- a/lib/rspec/core/backtrace_cleaner.rb
+++ b/lib/rspec/core/backtrace_cleaner.rb
@@ -11,11 +11,17 @@ end
def include?(line)
- if @include_patterns.any? {|p| line =~ p}
- return true
- else
- return not(@discard_patterns.any? {|p| line =~ p})
- end
+ matches_an_include_pattern? line or not matches_a_discard_pattern? line
+ end
+
+ private
+
+ def matches_an_include_pattern?(line)
+ @include_patterns.any? {|p| line =~ p}
+ end
+
+ def matches_a_discard_pattern?(line)
+ @discard_patterns.any? {|p| line =~ p}
end
end
end
| Refactor the backtrace cleaner for greater clarity
Signed-off-by: Sam Phippen <e5a09176608998a68778e11d5021c871e8fae93c@googlemail.com>
|
diff --git a/lib/slayer_rails/extensions/form.rb b/lib/slayer_rails/extensions/form.rb
index abc1234..def5678 100644
--- a/lib/slayer_rails/extensions/form.rb
+++ b/lib/slayer_rails/extensions/form.rb
@@ -6,7 +6,7 @@ extend ActiveSupport::Concern
included do
- include ActiveModel::Validations
+ include ActiveModel::Model
def validate!
raise Slayer::FormValidationError, errors unless valid?
@@ -39,26 +39,6 @@ def from_json(json)
from_params(JSON.parse(json))
end
-
- def set_param_key(model_name)
- @model_name = model_name.to_s.underscore.to_sym
- end
-
- def param_key
- @model_name || infer_param_key
- end
-
- def infer_param_key
- class_name = name.split('::').last
- return :form if class_name == 'Form'
- class_name.chomp('Form').underscore.to_sym
- end
-
- # Used by Rails to determine the path and param when
- # used with `form_for`
- def model_name
- ActiveModel::Name.new(self, nil, param_key.to_s.camelize)
- end
end
end
end
| Include ActiveModel::Model on Slayer Forms
|
diff --git a/cookbooks/chef/attributes/default.rb b/cookbooks/chef/attributes/default.rb
index abc1234..def5678 100644
--- a/cookbooks/chef/attributes/default.rb
+++ b/cookbooks/chef/attributes/default.rb
@@ -5,4 +5,4 @@ default[:chef][:server][:version] = "12.17.33"
# Set the default client version
-default[:chef][:client][:version] = "16.15.22"
+default[:chef][:client][:version] = "16.16.13"
| Update chef client to 16.16.13
|
diff --git a/lib/seed_migration.rb b/lib/seed_migration.rb
index abc1234..def5678 100644
--- a/lib/seed_migration.rb
+++ b/lib/seed_migration.rb
@@ -14,7 +14,7 @@ def register(model, &block)
unregister model
entry = RegisterEntry.new(model)
- entry.instance_eval &block if block_given?
+ entry.instance_eval(&block) if block_given?
self.registrar << entry
end
| Add missing parenthesis to reduce ambiguity
|
diff --git a/lib/simctl/runtime.rb b/lib/simctl/runtime.rb
index abc1234..def5678 100644
--- a/lib/simctl/runtime.rb
+++ b/lib/simctl/runtime.rb
@@ -4,6 +4,11 @@ module SimCtl
class Runtime < Object
attr_reader :availability, :buildversion, :identifier, :name, :type, :version
+
+ def initialize(args)
+ args['availability'] = args['isAvailable'] # Property was renamed on some Xcode update
+ super
+ end
def type
@type ||= name.split("\s").first.downcase.to_sym
| Fix reading new isAvailable property
|
diff --git a/lib/rail/generator.rb b/lib/rail/generator.rb
index abc1234..def5678 100644
--- a/lib/rail/generator.rb
+++ b/lib/rail/generator.rb
@@ -3,8 +3,6 @@
module Rail
class Generator < Support::Generator
- Error = Class.new(StandardError)
-
FILES = [
'app/assets/javascripts/application.js.coffee',
'app/assets/stylesheets/application.css.scss',
@@ -27,14 +25,14 @@
@locals = { class_name: class_name, project_name: project_name }
- raise Error, 'The project name is invalid.' if class_name.empty?
+ raise ArgumentError, 'The project name is invalid.' if class_name.empty?
super(destination: destination, source: source)
end
def run
if File.directory?(destination)
- raise Error, 'The directory already exists.'
+ raise ArgumentError, 'The directory already exists.'
end
process(FILES, @locals)
end
| Use ArgumentError instead of a custom one
|
diff --git a/lib/referehencible.rb b/lib/referehencible.rb
index abc1234..def5678 100644
--- a/lib/referehencible.rb
+++ b/lib/referehencible.rb
@@ -1,5 +1,31 @@ require 'referehencible/version'
module Referehencible
- # Your code goes here...
+ def self.included(base)
+ base.class_eval do
+ ###
+ # Validations
+ #
+ validates :reference_number,
+ presence: true,
+ uniqueness: true,
+ length: {
+ is: 16 }
+
+ ###
+ # Hooks
+ #
+ before_create :generate_reference_number
+
+ ###
+ # ActiveRecord Overrides
+ #
+ def reference_number; generate_reference_number; end
+ end
+ end
+
+private
+ def generate_reference_number
+ read_attribute(:reference_number) || write_attribute('reference_number', SecureRandom.hex(8))
+ end
end
| Move the ReferenceNumber code from the project
|
diff --git a/lib/spree_fishbowl.rb b/lib/spree_fishbowl.rb
index abc1234..def5678 100644
--- a/lib/spree_fishbowl.rb
+++ b/lib/spree_fishbowl.rb
@@ -10,9 +10,7 @@ end
def self.enabled?
- defined? @@enabled ?
- @@enabled :
- Spree::Config[:enable_fishbowl]
+ Spree::Config[:enable_fishbowl]
end
def self.client_from_config
| Read from Spree config to determine whether Fishbowl integration is enabled, always |
diff --git a/app/view/raw_output_view.rb b/app/view/raw_output_view.rb
index abc1234..def5678 100644
--- a/app/view/raw_output_view.rb
+++ b/app/view/raw_output_view.rb
@@ -10,7 +10,7 @@ html = '<ul class="raw_output">'
$raw_output.compact.each do |output|
html << '<li>'
- html << "<small>#{output[0].strftime("%H:%M:%S")}</small>"
+ html << "<small>#{output[0].strftime("%b %d, %H:%M:%S")}</small>"
html << '<hr>'
html << "<pre>#{output[1]}</pre>"
html << '</li>'
| Add the date to the timestamp in the log output, to add just a bit more context (helpful when you have RSpactor running for days on end).
Signed-off-by: Andreas Wolff <454a08182fae7f7960d8a9a6764ff415cde95dea@dynamicdudes.com> |
diff --git a/lib/tomcat_manager.rb b/lib/tomcat_manager.rb
index abc1234..def5678 100644
--- a/lib/tomcat_manager.rb
+++ b/lib/tomcat_manager.rb
@@ -1,3 +1,4 @@ # -*- coding: utf-8 -*-
# © 2012 Dakota Bailey
+require 'rest_client'
require 'tomcat_manager/core.rb'
| Include required gems on load.
|
diff --git a/app/workers/post_receive.rb b/app/workers/post_receive.rb
index abc1234..def5678 100644
--- a/app/workers/post_receive.rb
+++ b/app/workers/post_receive.rb
@@ -6,11 +6,15 @@ return false if project.nil?
# Ignore push from non-gitlab users
- if /^[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}$/.match(identifier)
- return false unless user = User.find_by_email(identifier)
+ user = if identifier.eql? Gitlab.config.gitolite_admin_key
+ email = project.commit(newrev).author.email
+ User.find_by_email(email)
+ elsif /^[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}$/.match(identifier)
+ User.find_by_email(identifier)
else
- return false unless user = Key.find_by_identifier(identifier).try(:user)
+ Key.find_by_identifier(identifier).try(:user)
end
+ return false unless user
project.trigger_post_receive(oldrev, newrev, ref, user)
end
| Fix hooks for merge request which were accepted by web-interface
|
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index abc1234..def5678 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -18,4 +18,7 @@ expire_after: 1.month,
secure: Rails.env.production? || Rails.env.staging?,
path: Rails.application.config.relative_url_root,
- same_site: :strict
+ # Signing in through LTI won't work with `SameSite=Strict`
+ # as the cookie is not sent when accessing the `implement` route
+ # following the LTI launch initiated by the LMS as a third party.
+ same_site: :lax
| Use SameSite=Lax for LTI login
|
diff --git a/lib/wikitext/rails.rb b/lib/wikitext/rails.rb
index abc1234..def5678 100644
--- a/lib/wikitext/rails.rb
+++ b/lib/wikitext/rails.rb
@@ -16,8 +16,7 @@
module Wikitext
class TemplateHandler
- def initialize view
- end
+ def initialize view; end
def render text, locals = {}
text.w
| Trim flab from Rails compatibility module
Lose an unneeded line.
Signed-off-by: Wincent Colaiuta <c76ac2e9cd86441713c7dfae92c451f3e6d17fdc@wincent.com>
|
diff --git a/app/controllers/user/registrations_controller.rb b/app/controllers/user/registrations_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/user/registrations_controller.rb
+++ b/app/controllers/user/registrations_controller.rb
@@ -4,7 +4,7 @@ protected
def configure_permitted_parameters
- devise_parameter_sanitizer.for(:sign_up).push(:first_namne, :last_name)
- devise_parameter_sanitizer.for(:account_update).push(:first_namne, :last_name)
+ devise_parameter_sanitizer.for(:sign_up).push(:first_name, :last_name)
+ devise_parameter_sanitizer.for(:account_update).push(:first_name, :last_name)
end
end
| Correct name of first_name in User::Reg Ctlr.
|
diff --git a/app/controllers/user_confirmations_controller.rb b/app/controllers/user_confirmations_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/user_confirmations_controller.rb
+++ b/app/controllers/user_confirmations_controller.rb
@@ -4,7 +4,7 @@
def after_confirmation_path_for(resource_name, resource)
sign_in resource
- UserMailer.delay.getting_started(resource.id).deliver
+ UserMailer.delay.getting_started(resource.id)
account_confirmation_path
end
| Fix delayed e-mail delivery bug for on boarding e-mail
|
diff --git a/app/controllers/mentors_controller.rb b/app/controllers/mentors_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/mentors_controller.rb
+++ b/app/controllers/mentors_controller.rb
@@ -1,5 +1,27 @@ class MentorsController < ApplicationController
def create
+ details = mentor_params
+ user_id = {user_id:current_user.id}
+ email = {email:current_user.email}
+ parameters = details.merge(user_id).merge(email)
+ @mentor = Mentor.new(parameters)
+ if @mentor.save
+ current_user.update(complete:true)
+ if @mentor.counry_of_origin == 1
+ @mentor.update(counry_of_origin:@mentor.current_country)
+ end
+ redirect_to edit_user_registration_path
+ else
+ flash[:error] = "An Error Occurred. Try Again."
+ redirect_to join_mentor_path
+ end
+ end
+ private
+ def mentor_params
+ params.require(:mentor).permit(:f_name,:l_name,:address_1,:address_2,
+ :city,:state_province,:zip_postal,:phone_no,:company,
+ :job_title,:industry_type,:gender,
+ :current_country,:counry_of_origin)
end
end
| Create method added to the mentors controller for when new mentors sign up.
|
diff --git a/app/controllers/project_controller.rb b/app/controllers/project_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/project_controller.rb
+++ b/app/controllers/project_controller.rb
@@ -10,4 +10,21 @@ end
end
+ def create
+ if true #current_professor
+ new_project = Project.new(title: params[:project][:title], hypothesis: params[:project][:hypothesis], summary: params[:project][:summary], time_budget: params[:project][:time_budget])
+ if new_project.save
+ p params
+ # Create a report for each new array of students.
+ # new_report = Report.new()
+ redirect_to current_professor
+ else
+ #display the error messages.
+ @errors = new_project.errors.full_messages
+ end
+ else
+ redirect_to "/"
+ end
+ end
+
end
| Create a first draft of the create controller for projects
|
diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/reports_controller.rb
+++ b/app/controllers/reports_controller.rb
@@ -22,6 +22,6 @@ private
def report_params
- params.require(:report).permit(:source, :open, :weather)
+ params.require(:report).permit(:source, :status, :weather)
end
end
| Fix report_params for new column name.
|
diff --git a/set_attributes.gemspec b/set_attributes.gemspec
index abc1234..def5678 100644
--- a/set_attributes.gemspec
+++ b/set_attributes.gemspec
@@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'set_attributes'
- s.version = '0.1.0'
+ s.version = '0.1.1'
s.summary = "Set an object's attributes"
s.description = ' '
| Package version path number is incremented from 0.1.0 to 0.1.1
|
diff --git a/config/software/python-pyopenssl.rb b/config/software/python-pyopenssl.rb
index abc1234..def5678 100644
--- a/config/software/python-pyopenssl.rb
+++ b/config/software/python-pyopenssl.rb
@@ -2,6 +2,7 @@ default_version "0.14"
dependency 'pip'
+dependency 'libffi'
pip_install = "embedded/bin/pip install -I --build #{project_dir}"
| Add missing libffi dep to pyopenssl
|
diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/pages_controller.rb
+++ b/app/controllers/pages_controller.rb
@@ -12,8 +12,11 @@
def update
authorize @page
- @page.update( page_params )
- redirect_to edit_page_path @page
+ if @page.update( page_params )
+ redirect_to edit_page_path( @page ), notice: "Page updated successfully."
+ else
+ redirect_to edit_page_path @page
+ end
end
def new
| Update Page controller with update notice.
|
diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/stats_controller.rb
+++ b/app/controllers/stats_controller.rb
@@ -1,8 +1,8 @@ class StatsController < ApplicationController
def index
- procedures = Procedure
- dossiers = Dossier
+ procedures = Procedure.where(:published => true)
+ dossiers = Dossier.where.not(:state => :draft)
@procedures_30_days_flow = thirty_days_flow_hash(procedures)
@dossiers_30_days_flow = thirty_days_flow_hash(dossiers)
| Exclude draft Dossiers and unpublished Procedures from Stats
|
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
@@ -15,7 +15,10 @@ @user.save
end
end
- redirect_to({:action => "index"}, :notice => "Users updated successfully")
+ respond_to do |format|
+ format.html { redirect_to users_path, notice: 'Users successfully updated.' }
+ format.json { head :ok }
+ end
end
def edit
@user = User.find(params[:id])
| Use respond_to block for bulk user update |
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
@@ -15,6 +15,10 @@ def leave_combat
if user_combat = UserCombat.find_by_combat_id_and_user_id(params[:combat_id], @user.id)
user_combat.delete
+
+ combat = Combat.find(params[:combat_id])
+ combat.destroy unless combat.users.any?
+
flash[:success] = 'The user left the combat.'
else
flash[:alert] = 'This user is not in the combat.'
| Destroy a combat if there are no users.
|
diff --git a/app/models/pull_request_downloader.rb b/app/models/pull_request_downloader.rb
index abc1234..def5678 100644
--- a/app/models/pull_request_downloader.rb
+++ b/app/models/pull_request_downloader.rb
@@ -16,7 +16,7 @@
def download_pull_requests
begin
- events = Octokit.user_events(login)
+ events = github_client.user_events(login)
events.select do |e|
event_date = e['created_at']
e.type == 'PullRequestEvent' &&
| Revert "Use Octokit client for now"
This reverts commit af2cc66975bc81594484d31089d392bc52b84763.
|
diff --git a/app/models/pull_request_downloader.rb b/app/models/pull_request_downloader.rb
index abc1234..def5678 100644
--- a/app/models/pull_request_downloader.rb
+++ b/app/models/pull_request_downloader.rb
@@ -16,7 +16,7 @@
def download_pull_requests
begin
- events = github_client.user_events(login)
+ events = Octokit.user_events(login)
events.select do |e|
event_date = e['created_at']
e.type == 'PullRequestEvent' &&
| Use Octokit client for now
|
diff --git a/app/serializers/event_serializer.rb b/app/serializers/event_serializer.rb
index abc1234..def5678 100644
--- a/app/serializers/event_serializer.rb
+++ b/app/serializers/event_serializer.rb
@@ -1,6 +1,6 @@ class EventSerializer < BaseSerializer
- attributes :id, :course_id, :organization_id, :name, :start_time, :concealed, :laps_required, :staging_id,
- :maximum_laps, :multi_lap, :slug, :live_entry_attributes
+ attributes :id, :course_id, :organization_id, :name, :start_time, :home_time_zone, :concealed,
+ :laps_required, :staging_id, :maximum_laps, :multi_lap, :slug, :live_entry_attributes
link(:self) { api_v1_event_path(object) }
has_many :efforts
| Add home_time_zone as an attribute to the EventSerializer.
|
diff --git a/lib/application_controller_patch.rb b/lib/application_controller_patch.rb
index abc1234..def5678 100644
--- a/lib/application_controller_patch.rb
+++ b/lib/application_controller_patch.rb
@@ -1,15 +1,21 @@-if require "application_controller"
- class ApplicationController < ActionController::Base
+module ApplicationControllerPatch
+ extend ActiveSupport::Concern
+
+ included do
if respond_to?(:before_action)
before_action :store_pwfmt_format
else
before_filter :store_pwfmt_format
end
+ end
- private
+ private
- def store_pwfmt_format
- PwfmtContext.format = params[:pwfmt][:format] if params[:pwfmt]
- end
+ def store_pwfmt_format
+ PwfmtContext.format = params[:pwfmt][:format] if params[:pwfmt]
end
end
+
+if require "application_controller"
+ ApplicationController.send(:include, ApplicationControllerPatch)
+end
| Refactor ApplicationControllerPath that uses ActiveSupport::Concern
|
diff --git a/rakelib/presentation.rake b/rakelib/presentation.rake
index abc1234..def5678 100644
--- a/rakelib/presentation.rake
+++ b/rakelib/presentation.rake
@@ -1,7 +1,12 @@+
+DIR_IMAGES_FILES = FileList["images/**/*"]
+
desc 'Build presentation'
task :presentation => [ 'slides', 'slides.html'] do
cp 'slides.html', 'slides'
cp_r REVEAL_FILES, 'slides'
+ mkdir_p 'slides/images'
+ cp_r DIR_IMAGES_FILES, 'slides/images'
line_nums = {
default_slides: {
first: 37,
| [make-an-executable] Copy over images when building slides
|
diff --git a/lib/channel9/instruction/swap.rb b/lib/channel9/instruction/swap.rb
index abc1234..def5678 100644
--- a/lib/channel9/instruction/swap.rb
+++ b/lib/channel9/instruction/swap.rb
@@ -0,0 +1,23 @@+module Channel9
+ module Instruction
+ # swap
+ # ---
+ # Switches the top two elements of the stack.
+ #
+ # Takes two input values
+ # SP -> input1 -> input2
+ # Puts them back on the stack in reverse order.
+ # SP -> input2 -> input1
+ class SWAP < Base
+ def initialize(stream)
+ super(stream, 2, 2)
+ end
+ def run(environment)
+ input1 = environment.context.pop
+ input2 = environment.context.pop
+ environment.context.push(input1)
+ environment.context.push(input2)
+ end
+ end
+ end
+end | Swap instruction switches top 2 items of stack
|
diff --git a/lib/copian/collector/hp/ports.rb b/lib/copian/collector/hp/ports.rb
index abc1234..def5678 100644
--- a/lib/copian/collector/hp/ports.rb
+++ b/lib/copian/collector/hp/ports.rb
@@ -2,7 +2,7 @@ module Collector
class HpPortsCollector < PortsCollector # :nodoc:
def collect
- oid = SNMP::ObjectId.new('1.3.6.1.2.1.17.4.3.1.2')
+ oid = SNMP::ObjectId.new('1.3.6.1.4.1.11.2.14.11.5.1.9.4.2.1.1')
results = Hash.new
manager.walk(oid) do |r|
@@ -16,6 +16,10 @@ yield if_index, addresses
end
end
+ protected
+ def suboid_to_mac(oid)
+ super(oid.to_s.gsub(/^[0-9]+\./, ''))
+ end
end
end
end
| Change the HP Ports collection ObjectID based on real world switches.
Also ensure the OID encoded MAC has the first suboid stripped as HP
place the port index into the OID returned as well as in the value.
|
diff --git a/lib/liquid/pagination_filters.rb b/lib/liquid/pagination_filters.rb
index abc1234..def5678 100644
--- a/lib/liquid/pagination_filters.rb
+++ b/lib/liquid/pagination_filters.rb
@@ -5,9 +5,9 @@ def paginate(pagination_info)
pagination_html = ""
if pagination_info.is_a? Hash
- pagination_html = "<h6>Working</h6>"
- else
- pagination_html = "<h6>Nothing to paginate</h6>"
+ if pagination_info["current_page"] && (pagination_info["current_page"].to_i > 1)
+ pagination_html += "<a href=\"?page=#{pagination_info["current_page"].to_i - 1}\" class=\"prev_page\" rel=\"prev\">« Previous</a> "
+ end
end
pagination_html
end
| Add previous page link to pagination.
|
diff --git a/lib/magnum/integration/github.rb b/lib/magnum/integration/github.rb
index abc1234..def5678 100644
--- a/lib/magnum/integration/github.rb
+++ b/lib/magnum/integration/github.rb
@@ -38,7 +38,8 @@ id: repo.id,
name: repo.name,
description: repo.description,
- source_url: repo.ssh_url
+ source_url: repo.ssh_url,
+ private: repo.private
}
end
end
| Add private flag to repo results
|
diff --git a/lib/relevancy/load_judgements.rb b/lib/relevancy/load_judgements.rb
index abc1234..def5678 100644
--- a/lib/relevancy/load_judgements.rb
+++ b/lib/relevancy/load_judgements.rb
@@ -15,7 +15,7 @@ raise "missing score for row '#{row}'" if score.nil?
raise "missing link|content_id for row '#{row}" if content_id.nil? && link.nil?
- data << { rank: score.to_i, content_id: content_id, link: link, query: query }
+ data << { score: score.to_i, content_id: content_id, link: link, query: query }
last_query = query
end
data
| Fix generating training data locally
JudgementsToSvm expects :score but gets :rank.
This class is only called when running the class
locally.
|
diff --git a/lib/rubygems-compile/analyzer.rb b/lib/rubygems-compile/analyzer.rb
index abc1234..def5678 100644
--- a/lib/rubygems-compile/analyzer.rb
+++ b/lib/rubygems-compile/analyzer.rb
@@ -15,10 +15,10 @@ # Check the given string of code for potential issues when compiled.
# Returns the analyzer instance afterwards.
- def check code
+ def self.check code
@parser ||= Gem::Analyzer.new(code)
- parser.parse
- parser
+ @parser.parse
+ @parser
end
def parse
| Fix a couple of typos |
diff --git a/lib/sequenceserver/api_errors.rb b/lib/sequenceserver/api_errors.rb
index abc1234..def5678 100644
--- a/lib/sequenceserver/api_errors.rb
+++ b/lib/sequenceserver/api_errors.rb
@@ -59,13 +59,13 @@ end
def title
- 'Job failed'
+ 'System error'
end
def message
<<MSG
-Sorry BLAST failed - please try again. If this message persists, there is a
-problem with the server. In this case, please report the bug on our
+Looks like there is a problem with the server. Try visiting the page again
+after a while. If this message persists, please report the problem on our
<a href="https://github.com/wurmlab/sequenceserver/issues" target="_blank">
issue tracker</a>.
MSG
| Update SystemError's title and message
Signed-off-by: Anurag Priyam <6e6ab5ea9cb59fe7c35d2a1fc74443577eb60635@gmail.com>
|
diff --git a/lib/starting_blocks/publisher.rb b/lib/starting_blocks/publisher.rb
index abc1234..def5678 100644
--- a/lib/starting_blocks/publisher.rb
+++ b/lib/starting_blocks/publisher.rb
@@ -27,4 +27,4 @@ end
end
StartingBlocks::Publisher.subscribers = []
-StartingBlocks::Publisher.result_parser = StartingBlocks::ResultTextParser.new
+StartingBlocks::Publisher.result_parser = StartingBlocks::ResultParser.new
| Use the new result parser. |
diff --git a/lib/video_transcoding/mplayer.rb b/lib/video_transcoding/mplayer.rb
index abc1234..def5678 100644
--- a/lib/video_transcoding/mplayer.rb
+++ b/lib/video_transcoding/mplayer.rb
@@ -12,16 +12,17 @@
def setup
Tool.provide(COMMAND_NAME, ['-version']) do |output, _, _|
- unless output =~ /^MPlayer ([0-9.]+)/
+ unless output =~ /^MPlayer .*-([0-9]+)\.([0-9]+)\.[0-9]+ /
Console.debug output
fail "#{COMMAND_NAME} version unknown"
end
- version = $1
+ major_version = $1.to_i
+ minor_version = $2.to_i
Console.info "#{$MATCH} found..."
- unless version =~ /^([0-9]+)\.([0-9]+)/ and (($1.to_i * 100) + $2.to_i) >= 101
- fail "#{COMMAND_NAME} version 1.1 or later required"
+ unless ((major_version * 100) + minor_version) >= 402
+ fail "#{COMMAND_NAME} version 4.2 or later required"
end
end
end
| Check extra version number for MPlayer to accept all builds.
|
diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/errors_controller.rb
+++ b/app/controllers/errors_controller.rb
@@ -2,6 +2,7 @@ before_action :authenticate_user!
def create
+ logger.warn "JS error for user #{current_user.id}"
logger.warn params[:stack]
head 204
end
| Add current user id to js error logging.
|
diff --git a/lib/resque/cli.rb b/lib/resque/cli.rb
index abc1234..def5678 100644
--- a/lib/resque/cli.rb
+++ b/lib/resque/cli.rb
@@ -2,19 +2,28 @@
module Resque
class CLI < Thor
+ class_option :config, :aliases => ["-c"], :required => true
desc "work QUEUE", "Start processing jobs."
method_option :pid, :aliases => ["-p"], :type => :string
method_option :interval, :aliases => ["-i"], :type => :numeric, :default => 5
method_option :deamon, :aliases => ["-d"], :type => :boolean, :default => false
method_option :timeout, :aliases => ["-t"], :type => :numeric, :default => 4.0
+ method_option :verbose, :aliases => ["-v"], :type => :boolean, :default => false
+ method_option :vverbose, :aliases => ["-vv"], :type => :boolean, :default => false
def work(queue = "*")
queues = queue.to_s.split(',')
+ load_config(options[:config])
+ worker_setup
+
worker = Resque::Worker.new(*queues)
+
worker.term_timeout = options[:timeout]
+ #worker.verbose = options[:verbose]
+ #worker.very_verbose = options[:vverbose]
- if options.has_key?(:deamon)
+ if options[:deamon]
Process.daemon(true)
end
@@ -26,5 +35,27 @@
worker.work(options[:interval]) # interval, will block
end
+
+ protected
+
+ def load_config(path)
+ load(File.expand_path(path))
+ end
+
+ def worker_setup
+ preload_rails_env
+ Resque.config.worker_setup.call
+ end
+
+ def preload_rails_env
+ if defined?(Rails) && Rails.respond_to?(:application)
+ # Rails 3
+ Rails.application.eager_load!
+ elsif defined?(Rails::Initializer)
+ # Rails 2.3
+ $rails_rake_task = false
+ Rails::Initializer.run :load_application_classes
+ end
+ end
end
end
| Add config option & handle worker setup
|
diff --git a/app/controllers/region_controller.rb b/app/controllers/region_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/region_controller.rb
+++ b/app/controllers/region_controller.rb
@@ -7,7 +7,6 @@ private
def load_vars
- params[:iso]!="GL" or raise_404
@region = Region.where(iso: params[:iso].upcase).first
@region or raise_404
@presenter = RegionPresenter.new @region
| Remove raise_404 if region iso code is GL
|
diff --git a/lib/slatan/ear.rb b/lib/slatan/ear.rb
index abc1234..def5678 100644
--- a/lib/slatan/ear.rb
+++ b/lib/slatan/ear.rb
@@ -1,3 +1,5 @@+require 'active_support/core_ext/object/blank'
+
module Slatan
## class to Event Dispatching for concerns
module Ear
@@ -5,14 +7,19 @@
class << self
## register subscriber
- def register(concern)
- @concerns << concern
+ # @param concern subscriber
+ # @param options option
+ # cond: <Kernel.#lambda> call hear method of concern if cond.call(msg) is true
+ def register(concern, options={})
+ @concerns << [concern, options[:cond]]
end
## publish to subscribers
def hear(msg)
- @concerns.each do |concern|
- concern.hear(msg)
+ @concerns.each do |concern, cond|
+ if cond.blank? || cond.call(msg)
+ concern.hear(msg)
+ end
end
end
end
| Add condtion option to publish 'message' receive event
|
diff --git a/lib/tasks/om.rake b/lib/tasks/om.rake
index abc1234..def5678 100644
--- a/lib/tasks/om.rake
+++ b/lib/tasks/om.rake
@@ -1,7 +1,7 @@ namespace :om do
desc "Fetch data for all cafeterias"
task :fetch => :environment do
- Rails.logger.info "[INFO] Fetch cafeteria data..."
+ Rails.logger.info "[#{Time.zone.now}] Fetch cafeteria data..."
date = Time.zone.now.to_date
Cafeteria.all.each do |cafeteria|
| Prepend fetch data log info with current time
|
diff --git a/test/test_file_flag.rb b/test/test_file_flag.rb
index abc1234..def5678 100644
--- a/test/test_file_flag.rb
+++ b/test/test_file_flag.rb
@@ -1,5 +1,6 @@ class TestFileFlag < Minitest::Test
def setup
+ FileUtils.mkdir_p('tmp')
@flag = RFlags::FileFlag.new('tmp/file_flag')
FileUtils.rm_f('tmp/file_flag')
end
| Add tmp directory for testing
|
diff --git a/services/stock_info.rb b/services/stock_info.rb
index abc1234..def5678 100644
--- a/services/stock_info.rb
+++ b/services/stock_info.rb
@@ -33,9 +33,8 @@ def quotes
today = Date.today
start_of_week = today - 5
- end_of_week = today - 1
- @_quotes ||= MarketBeat.quotes(symbol, start_of_week, end_of_week)
+ @_quotes ||= MarketBeat.quotes(symbol, start_of_week, today)
end
def status
| Make sure to include today in chart history
|
diff --git a/gem/lib/commands/push.rb b/gem/lib/commands/push.rb
index abc1234..def5678 100644
--- a/gem/lib/commands/push.rb
+++ b/gem/lib/commands/push.rb
@@ -27,7 +27,7 @@
name = get_one_gem_name
response = make_request(:post, "gems") do |request|
- request.body = File.open(name).read
+ request.body = File.open(name, 'rb'){|io| io.read }
request.add_field("Content-Length", request.body.size)
request.add_field("Content-Type", "application/octet-stream")
request.add_field("Authorization", api_key)
| Fix wrong Content-Length on Ruby 1.9, leading to Timeout in some cases
|
diff --git a/recipes/source_install.rb b/recipes/source_install.rb
index abc1234..def5678 100644
--- a/recipes/source_install.rb
+++ b/recipes/source_install.rb
@@ -26,7 +26,8 @@ }
ark 'consul' do
+ has_binaries ['bin/consul']
environment env
url URI.join('https://github.com/hashicorp/consul/archive/', "#{source_version}.tar.gz").to_s
- action [:install_with_make]
+ action :install
end
| Fix a few issues with source install.
|
diff --git a/constants/ooe_randomizer_constants.rb b/constants/ooe_randomizer_constants.rb
index abc1234..def5678 100644
--- a/constants/ooe_randomizer_constants.rb
+++ b/constants/ooe_randomizer_constants.rb
@@ -6,7 +6,7 @@ (0xD7..0xE4).to_a + # no-damage medals
[0xAE, 0xB6, 0xD6] # usable items with a hardcoded effect for quests
-SPAWNER_ENEMY_IDS = [0x00, 0x01, 0x03, 0x0B, 0x0F, 0x1B, 0x2B, 0x3E, 0x48, 0x60, 0x61]
+SPAWNER_ENEMY_IDS = [0x00, 0x01, 0x03, 0x0B, 0x0F, 0x1B, 0x2B, 0x3E, 0x48, 0x60, 0x61, 0x65]
RANDOMIZABLE_BOSS_IDS = BOSS_IDS -
[0x78] - # Remove the final boss, Dracula.
| Add Winged Skeleton to list of spawners
|
diff --git a/0_code_wars/7_is_this_a_triangle.rb b/0_code_wars/7_is_this_a_triangle.rb
index abc1234..def5678 100644
--- a/0_code_wars/7_is_this_a_triangle.rb
+++ b/0_code_wars/7_is_this_a_triangle.rb
@@ -0,0 +1,12 @@+# http://www.codewars.com/kata/is-this-a-triangle/
+# iteration 1
+def isTriangle(a,b,c)
+ return false if [a, b, c].any? { |x| x <= 0 }
+ (a + b) > c && (a + c) > b && (b + c) > a
+end
+
+# iteration 2
+def isTriangle(a,b,c)
+ a, b, c = [a, b, c].sort
+ a + b > c
+end
| Add code wars (7) is this a triangle
|
diff --git a/BHCDatabase/app/grids/users_grid.rb b/BHCDatabase/app/grids/users_grid.rb
index abc1234..def5678 100644
--- a/BHCDatabase/app/grids/users_grid.rb
+++ b/BHCDatabase/app/grids/users_grid.rb
@@ -10,19 +10,20 @@ #
# Filters
#
-
+
filter(:id, :string, :multiple => ',')
#filter(:name, :string, :multiple => ',')
filter(:name, :string) { |value| where('name like ? ',"%#{value}%") }
filter(:email, :string)
filter(:telephone, :integer)
+ filter(:emergency_contact, :integer)
filter(:dob, :date, :range => true)
-
+
#
# Columns
#
-
+
column(:id, :mandatory => true) do |model|
format(model.id) do |value|
@@ -36,6 +37,7 @@ end
column(:email, :mandatory => true)
column(:telephone, :mandatory => true)
+ column(:emergency_contact, :mandatory => true)
column(:dob, :mandatory => true)
column(:privilege, :mandatory => true)
| Add emergency contact to user grid.
|
diff --git a/backend/spec/features/admin/orders/return_payment_state_spec.rb b/backend/spec/features/admin/orders/return_payment_state_spec.rb
index abc1234..def5678 100644
--- a/backend/spec/features/admin/orders/return_payment_state_spec.rb
+++ b/backend/spec/features/admin/orders/return_payment_state_spec.rb
@@ -0,0 +1,60 @@+require 'spec_helper'
+
+describe "Return payment state spec" do
+ stub_authorization!
+
+ before do
+ Spree::RefundReason.create!(name: Spree::RefundReason::RETURN_PROCESSING_REASON, mutable: false)
+ end
+
+ let!(:order) { create(:shipped_order) }
+
+ # Regression test for https://github.com/spree/spree/issues/6229
+ it "refunds and has outstanding_balance of zero", js: true do
+ expect(order).to have_attributes(
+ total: 110,
+ refund_total: 0,
+ payment_total: 110,
+ outstanding_balance: 0,
+ payment_state: 'paid'
+ )
+
+ # From an order with a shipped shipment
+ visit "/admin/orders/#{order.number}/edit"
+
+ # Create a Return Authorization (select the Original Reimbursement type)
+ click_on 'RMA'
+ click_on 'New RMA'
+
+ find('.add-item').click # check first (and only) item
+ select Spree::StockLocation.first.name, from: 'return_authorization[stock_location_id]', visible: false
+ click_on 'Create'
+
+ # Create a Customer Return (select the item from 'Items in Return Authorizations')
+ click_on 'Customer Returns'
+ click_on 'New Customer Return'
+
+ find('input.add-item').click # check first (and only) item
+ select 'Received', from: 'customer_return[return_items_attributes][0][reception_status_event]', visible: false
+ select Spree::StockLocation.first.name, from: 'customer_return[stock_location_id]', visible: false
+ click_on 'Create'
+
+ # Create reimbursement
+ click_on 'Create reimbursement'
+
+ # Reimburse.
+ click_on 'Reimburse'
+
+ expect(page).to have_css('tr.reimbursement-refund')
+
+ order.reload
+
+ expect(order).to have_attributes(
+ total: 110,
+ refund_total: 10,
+ payment_total: 100,
+ outstanding_balance: 0,
+ payment_state: 'paid'
+ )
+ end
+end
| Add regression test for refund outstanding_balance
|
diff --git a/spec/exif_jpeg_spec.rb b/spec/exif_jpeg_spec.rb
index abc1234..def5678 100644
--- a/spec/exif_jpeg_spec.rb
+++ b/spec/exif_jpeg_spec.rb
@@ -0,0 +1,39 @@+require 'support/test_stream'
+require 'file_data/formats/exif/exif_jpeg'
+
+RSpec.describe FileData::ExifJpeg do
+ let(:exif_jpeg) { FileData::ExifJpeg.new(stream) }
+ let(:stream) { TestStream.get_stream(test_bytes) }
+
+ describe '#exif' do
+ let(:each_section) { jpeg.each_section }
+
+ context 'when there is no exif section' do
+ let(:test_bytes) do
+ [[255, 216], # SOI bytes
+ [255, 1, 0, 2], # Section 1
+ [255, 2, 0, 2], # Section 2
+ [255, 217]].flatten # EOI bytes
+ end
+
+ it 'returns nil' do
+ expect(exif_jpeg.exif).to be_nil
+ end
+ end
+
+ context 'when there is an exif section' do
+ let(:test_bytes) do
+ exif_marker = "Exif\0\0"
+ [[255, 216], # SOI bytes
+ [255, 1, 0, 2], # Section 1
+ [255, 225, 0, 2 + exif_marker.length], # Exif section part 1
+ exif_marker.bytes.to_a, # Exif section part 2
+ [255, 217]].flatten # EOI bytes
+ end
+
+ it 'returns an exif stream' do
+ expect(exif_jpeg.exif.pos).to eq(16)
+ end
+ end
+ end
+end
| Improve test coverage for exit_jpeg.rb
|
diff --git a/spec/file_info_spec.rb b/spec/file_info_spec.rb
index abc1234..def5678 100644
--- a/spec/file_info_spec.rb
+++ b/spec/file_info_spec.rb
@@ -2,15 +2,15 @@ require 'file_data/file_types/file_info'
require 'file_data/formats/mpeg4/mpeg4'
-RSpec.describe FileData::FileInfo do
- # context 'Given an actual file' do
- # let(:file_name) { '/home/ubuntu/code/IMG_4537.m4v' }
- # it 'Reports the creation date' do
- # date = FileData::FileInfo.origin_date(file_name)
- # puts 'Origin Year: ' + date.year.to_s
- # puts 'Origin Month: ' + date.month.to_s
- # puts 'Origin Day: ' + date.day.to_s
- # puts 'Origin Date: ' + date.to_s
- # end
- # end
-end
+# RSpec.describe FileData::FileInfo do
+# context 'Given an actual file' do
+# let(:file_name) { '/home/ubuntu/code/playground/interesting_backup_items/DYEQ9633.MOV' }
+# it 'Reports the creation date' do
+# date = FileData::FileInfo.origin_date(file_name)
+# puts 'Origin Year: ' + date.year.to_s
+# puts 'Origin Month: ' + date.month.to_s
+# puts 'Origin Day: ' + date.day.to_s
+# puts 'Origin Date: ' + date.to_s
+# end
+# end
+# end
| Comment out test that uses file from local hard drive
|
diff --git a/spec/nanoc/cli_spec.rb b/spec/nanoc/cli_spec.rb
index abc1234..def5678 100644
--- a/spec/nanoc/cli_spec.rb
+++ b/spec/nanoc/cli_spec.rb
@@ -6,7 +6,7 @@ end
let(:exceptions) do
- # FIXME: Get rid of these exceptions by Nanoc 5.0
+ # FIXME: [Nanoc 5] Get rid of these exceptions
[
['deploy', ['C']],
['help', ['v']],
| Improve formatting of Nanoc 5 FIXMEs
|
diff --git a/backend/app/controllers/comable/admin/orders_controller.rb b/backend/app/controllers/comable/admin/orders_controller.rb
index abc1234..def5678 100644
--- a/backend/app/controllers/comable/admin/orders_controller.rb
+++ b/backend/app/controllers/comable/admin/orders_controller.rb
@@ -6,7 +6,7 @@ before_filter :find_order, only: [:show, :edit, :update, :destroy]
def index
- @orders = Comable::Order.complete.page(params[:page]).order('completed_at DESC')
+ @orders = Comable::Order.complete.page(params[:page]).per(15).order('completed_at DESC')
@orders = @orders.where!('code LIKE ?', "%#{params[:search_code]}%") if params[:search_code].present?
end
| Add the per page option to orders
|
diff --git a/volunteermatch.gemspec b/volunteermatch.gemspec
index abc1234..def5678 100644
--- a/volunteermatch.gemspec
+++ b/volunteermatch.gemspec
@@ -11,7 +11,7 @@
spec.summary = %q{A Ruby wrapper for VolunteerMatch's Public-Use API.}
spec.description = %q{A lightweight Ruby wrapper that queries VolunteerMatch's Public-Use API for searching information on nonprofit organizations and active volunteering opportunities.}
- spec.homepage = "https://github.com/evanscloud/vm_public_api"
+ spec.homepage = "https://github.com/evanscloud/volunteermatch"
spec.license = "MIT"
spec.files = `git ls-files -z`.split("\x0").reject do |f|
@@ -24,5 +24,5 @@ spec.add_development_dependency "bundler", "~> 1.14"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.0"
- spec.add_development_dependency "webmock", "~> 2.3.2"
+ spec.add_development_dependency "webmock", "~> 2.3"
end
| Change homepage link in gemspec
|
diff --git a/test/integration/default/squid_spec.rb b/test/integration/default/squid_spec.rb
index abc1234..def5678 100644
--- a/test/integration/default/squid_spec.rb
+++ b/test/integration/default/squid_spec.rb
@@ -5,10 +5,11 @@ it { should be_listening }
end
-squid_syntax_check = 'sudo squid -k parse'
-squid_syntax_check = 'sudo squid3 -k parse' if os[:family] == 'debian'
-
-describe command(squid_syntax_check) do
- its('exit_status') { should eq 0 }
- its('stderr') { should_not match /WARNING/ }
-end
+# This would be great, but it needs a lot more logic to work properly
+# squid_syntax_check = 'sudo squid -k parse'
+# squid_syntax_check = 'sudo squid3 -k parse' if os[:family] == 'debian'
+#
+# describe command(squid_syntax_check) do
+# its('exit_status') { should eq 0 }
+# its('stderr') { should_not match /WARNING/ }
+# end
| Comment out the syntax test for now
This isn't going to work since there's a million binary names to work
out
Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
|
diff --git a/core/app/classes/open_graph/object.rb b/core/app/classes/open_graph/object.rb
index abc1234..def5678 100644
--- a/core/app/classes/open_graph/object.rb
+++ b/core/app/classes/open_graph/object.rb
@@ -7,6 +7,7 @@ private
def open_graph_field key, value
+ raise "Graph fied requires value" unless value
open_graph_hash[key] = value
end
| Raise when no value is supplied
|
diff --git a/core/db/default/spree/store_credit.rb b/core/db/default/spree/store_credit.rb
index abc1234..def5678 100644
--- a/core/db/default/spree/store_credit.rb
+++ b/core/db/default/spree/store_credit.rb
@@ -10,8 +10,8 @@ type: "Spree::PaymentMethod::StoreCredit"
)
-Spree::StoreCreditType.create_with(priority: 1).find_or_create_by!(name: 'Expiring')
-Spree::StoreCreditType.create_with(priority: 2).find_or_create_by!(name: 'Non-expiring')
+Spree::StoreCreditType.create_with(priority: 1).find_or_create_by!(name: Spree::StoreCreditType::EXPIRING)
+Spree::StoreCreditType.create_with(priority: 2).find_or_create_by!(name: Spree::StoreCreditType::NON_EXPIRING)
Spree::ReimbursementType.create_with(name: "Store Credit").find_or_create_by!(type: 'Spree::ReimbursementType::StoreCredit')
| Update seeding for store credits to use constants
|
diff --git a/lib/salesforce_bulk/query_result_collection.rb b/lib/salesforce_bulk/query_result_collection.rb
index abc1234..def5678 100644
--- a/lib/salesforce_bulk/query_result_collection.rb
+++ b/lib/salesforce_bulk/query_result_collection.rb
@@ -2,7 +2,6 @@ class QueryResultCollection < Array
attr_reader :client
- attr_reader :currentIndex
attr_reader :batchId
attr_reader :jobId
attr_reader :totalSize
| Remove currentIndex as its no longer needed.
|
diff --git a/lib/sitemap_generator/adapters/file_adapter.rb b/lib/sitemap_generator/adapters/file_adapter.rb
index abc1234..def5678 100644
--- a/lib/sitemap_generator/adapters/file_adapter.rb
+++ b/lib/sitemap_generator/adapters/file_adapter.rb
@@ -19,7 +19,7 @@ end
stream = open(location.path, 'wb')
- if location.path.ends_with? '.gz'
+ if location.path.to_s =~ /.gz$/
gzip(stream, raw_data)
else
plain(stream, raw_data)
| Fix the FileAdaptor
* Don't use ends_with? |
diff --git a/lib/engineyard-cloud-client/version.rb b/lib/engineyard-cloud-client/version.rb
index abc1234..def5678 100644
--- a/lib/engineyard-cloud-client/version.rb
+++ b/lib/engineyard-cloud-client/version.rb
@@ -1,7 +1,7 @@ # This file is maintained by a herd of rabid monkeys with Rakes.
module EY
class CloudClient
- VERSION = '1.0.4'
+ VERSION = '1.0.5.pre'
end
end
# Please be aware that the monkeys like tho throw poo sometimes.
| Add .pre for next release
|
diff --git a/parallel_rspec.gemspec b/parallel_rspec.gemspec
index abc1234..def5678 100644
--- a/parallel_rspec.gemspec
+++ b/parallel_rspec.gemspec
@@ -19,6 +19,7 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
+ spec.add_dependency "rake", "~> 10.0"
+ spec.add_dependency "rspec"
spec.add_development_dependency "bundler", "~> 1.10"
- spec.add_development_dependency "rake", "~> 10.0"
end
| Make rake and rspec normal dependencies, since the gem won't load successfully without them
|
diff --git a/config/initializers/decimal_to_s.rb b/config/initializers/decimal_to_s.rb
index abc1234..def5678 100644
--- a/config/initializers/decimal_to_s.rb
+++ b/config/initializers/decimal_to_s.rb
@@ -12,4 +12,11 @@ end
end
end
+
+ refine Fixnum do
+ # Same as `to_s`, since there is no fractional part to worry about.
+ def to_st
+ to_s
+ end
+ end
end
| Add `to_st` refinement to Fixnum
This way, both `Placement` and `SubPlacement` models can have `to_st`
called on them easily.
|
diff --git a/csv_to_popolo.gemspec b/csv_to_popolo.gemspec
index abc1234..def5678 100644
--- a/csv_to_popolo.gemspec
+++ b/csv_to_popolo.gemspec
@@ -27,4 +27,5 @@ spec.add_dependency 'json'
spec.add_dependency 'facebook_username_extractor'
spec.add_dependency 'twitter_username_extractor'
+ spec.add_dependency 'rcsv'
end
| Add rcsv dependency to gemspec
|
diff --git a/lib/carto/google_maps_api_signer.rb b/lib/carto/google_maps_api_signer.rb
index abc1234..def5678 100644
--- a/lib/carto/google_maps_api_signer.rb
+++ b/lib/carto/google_maps_api_signer.rb
@@ -3,42 +3,35 @@
module Carto
class GoogleMapsApiSigner
- def initialize(user)
- @user = user
- end
-
- def sign(url)
- raise 'User does not have Google configured' unless @user.google_maps_query_string.present?
- url_with_qs = "#{url}&#{@user.google_maps_query_string}"
- if @user.google_maps_client_id.present? && @user.google_maps_private_key.present?
+ def sign(user, url)
+ raise 'User does not have Google configured' unless user.google_maps_query_string.present?
+ if user.google_maps_client_id.present? && user.google_maps_private_key.present?
# Add client=xxx + signature
- cryptographically_sign_url(url_with_qs)
+ client_id_signed_url(user, url)
else
# Just add key=xxx
- url_with_qs
+ key_signed_url(user, url)
end
end
private
- def cryptographically_sign_url(url)
- binary_signature = hmac(uri_path_and_query(url))
- signature = Base64.urlsafe_encode64(binary_signature)
+ def client_id_signed_url(user, url)
+ uri = URI.parse(url)
+ payload_to_sign = uri.path + '?' + uri.query
+ signature = hmac(user.google_maps_private_key, payload_to_sign)
- "#{url}&signature=#{signature}"
+ "#{url}&#{user.google_maps_query_string}&signature=#{signature}"
end
- def uri_path_and_query(url)
- uri = URI.parse(url)
- uri.path + '?' + uri.query
+ def key_signed_url(user, url)
+ "#{url}&#{user.google_maps_query_string}"
end
- def hmac(data)
- OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha1'), binary_key, data)
- end
-
- def binary_key
- Base64.urlsafe_decode64(@user.google_maps_private_key)
+ def hmac(key, data)
+ binary_key = Base64.urlsafe_decode64(key)
+ binary_signature = OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha1'), binary_key, data)
+ Base64.urlsafe_encode64(binary_signature)
end
end
end
| Refactor Google Maps Api Signer
|
diff --git a/lib/connect/controller_additions.rb b/lib/connect/controller_additions.rb
index abc1234..def5678 100644
--- a/lib/connect/controller_additions.rb
+++ b/lib/connect/controller_additions.rb
@@ -13,12 +13,12 @@ @current_token ||= request.env[Rack::OAuth2::Server::Resource::ACCESS_TOKEN]
end
- def current_scopes
+ def current_oauth_scopes
token = current_access_token && token.scopes || []
end
- def has_scope? scope
- current_scopes.detect{|s| s.name == scope}
+ def has_oauth_scope? scope
+ current_oauth_scopes.detect{|s| s.name == scope}
end
end
| Rename current_scopes to current_oauth_scopes to avoid conflicts with has_scope gem |
diff --git a/concurrent-ruby.gemspec b/concurrent-ruby.gemspec
index abc1234..def5678 100644
--- a/concurrent-ruby.gemspec
+++ b/concurrent-ruby.gemspec
@@ -26,11 +26,6 @@ s.require_paths = ['lib']
s.required_ruby_version = '>= 1.9.2'
- s.post_install_message = <<-MSG
- future = Concurrent::Future.new{ 'Hello, world!' }
- puts future.value
- #=> Hello, world!
- MSG
s.add_development_dependency 'bundler'
end
| Remove (unnecessary) gem post-install message.
|
diff --git a/lib/coffee_filter.rb b/lib/coffee_filter.rb
index abc1234..def5678 100644
--- a/lib/coffee_filter.rb
+++ b/lib/coffee_filter.rb
@@ -1,25 +1,9 @@-require "open3"
-require "win32/open3" if RUBY_PLATFORM.match /win32/
+require "coffee_script"
class CoffeeFilter < Nanoc3::Filter
identifier :coffee
def run(content, params = {})
- output = ""
- error = ""
- command = "coffee -s -p -l"
- Open3.popen3(command) do |stdin, stdout, stderr|
- stdin.puts content
- stdin.close
- output = stdout.read.strip
- error = stderr.read.strip
- [stdout, stderr].each { |io| io.close }
- end
-
- if error.length > 0
- raise("Compilation error:\n#{error}")
- else
- output
- end
+ CoffeeScript.compile(content)
end
end | Use the coffee-script rubygem for CS compiling. |
diff --git a/lib/rack/rejector.rb b/lib/rack/rejector.rb
index abc1234..def5678 100644
--- a/lib/rack/rejector.rb
+++ b/lib/rack/rejector.rb
@@ -19,6 +19,8 @@ options = @options.clone
reject?(request, options) ? reject!(request, options) : @app.call(env)
end
+
+ private
def reject?(request, options)
@block.call(request, options)
| Move internal methods to private
|
diff --git a/smart_asana.gemspec b/smart_asana.gemspec
index abc1234..def5678 100644
--- a/smart_asana.gemspec
+++ b/smart_asana.gemspec
@@ -9,7 +9,7 @@ gem.homepage = "http://github.com/rbright/smart_asana"
gem.add_dependency 'activesupport', '~> 3.2.3'
- gem.add_dependency 'asana', '~> 0.0.2'
+ gem.add_dependency 'asana', '~> 0.0.3'
gem.files = `git ls-files`.split($\)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
| Bump asana gem version to 0.0.3
|
diff --git a/lib/wixy/vigenere.rb b/lib/wixy/vigenere.rb
index abc1234..def5678 100644
--- a/lib/wixy/vigenere.rb
+++ b/lib/wixy/vigenere.rb
@@ -3,9 +3,6 @@
module Wixy
class Vigenere
- ENCRYPT = 1
- DECRYPT = -1
-
def initialize(config = Config.new)
@config = config
@alphabet = Alphabet.new ('A'..'Z')
@@ -13,23 +10,43 @@ end
def encrypt(text)
+ shift = -> (index, offset) { index + offset }
+ solve text, shift
+ # lookup_with_shift text, shift
+ end
+
+ def decrypt(text)
+ shift = -> (index, offset) { index - offset }
+ solve text, shift
+ # lookup_with_shift text, shift
+ end
+
+ def lookup_with_shift(text, shift)
cleaned = @alphabet.sanitized_chars(text)
cleaned.each_with_index.map do |char, i|
- lookup(char, i, ENCRYPT)
+ lookup(char, i, shift)
end.compact.join
end
- def decrypt(text)
- cleaned = @alphabet.sanitized_chars(text)
- cleaned.each_with_index.map do |char, i|
- lookup(char, i, DECRYPT)
- end.compact.join
+ def solve(text, shift)
+ recurse(text.chars, 0, shift).reverse.join
end
- def lookup(char, position, direction)
+ def recurse(text, i, shift)
+ return text if text.empty?
+ char = text.shift
+ if @alphabet.index(char)
+ recurse(text, i + 1, shift) << lookup(char, i, shift)
+ else
+ recurse(text, i, shift) << char
+ end
+ end
+
+ def lookup(char, position, shift)
index = @alphabet.index(char.upcase)
- shift = @alphabet.index(@key[position % @key.length])
- @alphabet[(index + shift * direction)]
+ offset = @alphabet.index(@key[position % @key.length])
+ new_index = shift.call(index, offset)
+ @alphabet[new_index]
end
end
end
| Add recursive solver for Vigenere
|
diff --git a/lib/yle_tf/config.rb b/lib/yle_tf/config.rb
index abc1234..def5678 100644
--- a/lib/yle_tf/config.rb
+++ b/lib/yle_tf/config.rb
@@ -35,7 +35,7 @@ block ||= DEFAULT_NOT_FOUND_BLOCK
keys.inject(config) do |conf, key|
- break block.call(keys) if !conf || !conf.key?(key)
+ break block.call(keys) if conf.nil? || !conf.is_a?(Hash) || !conf.key?(key)
conf[key]
end
| Fix `Config.fetch` when a key is not a Hash
With config like:
```yaml
foo:
bar: something
```
`fetch('foo', 'bar', 'baz')` raised an exception instead of normal "key
not found" handling.
|
diff --git a/lib/sparkpost_rails/delivery_method.rb b/lib/sparkpost_rails/delivery_method.rb
index abc1234..def5678 100644
--- a/lib/sparkpost_rails/delivery_method.rb
+++ b/lib/sparkpost_rails/delivery_method.rb
@@ -19,14 +19,14 @@ :recipients => [
{
:address => {
- # :name => "",
+ :name => mail[:to].display_names.first,
:email => mail.to.first
}
}
],
:content => {
:from => {
- # :name => "",
+ :name => mail[:to].display_names.first,
:email => mail.from.first
},
:subject => mail.subject,
@@ -36,8 +36,8 @@ }
}
headers = { "Authorization" => SparkpostRails.configuration.api_key }
- self.class.post('/transmissions', { headers: headers, body: data })
- @response = false
+ r = self.class.post('/transmissions', { headers: headers, body: data })
+ @response = r.body
end
end
end
| Add in display names, return response
|
diff --git a/collector-ruby.gemspec b/collector-ruby.gemspec
index abc1234..def5678 100644
--- a/collector-ruby.gemspec
+++ b/collector-ruby.gemspec
@@ -18,7 +18,6 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
- spec.add_runtime_dependency "vanguard"
spec.add_runtime_dependency "virtus", ">= 0.5.0"
spec.add_runtime_dependency "representable"
spec.add_runtime_dependency "activesupport"
| Disable vanguard, causes dep conflicts.
* We're not actually using vanguard anyway, so let's resolve this if/when we want to do that. |
diff --git a/lib/sshkit/sudo/interaction_handler.rb b/lib/sshkit/sudo/interaction_handler.rb
index abc1234..def5678 100644
--- a/lib/sshkit/sudo/interaction_handler.rb
+++ b/lib/sshkit/sudo/interaction_handler.rb
@@ -6,6 +6,9 @@
def on_data(command, stream_name, data, channel)
if data =~ wrong_password
+ puts data if defined?(Airbrussh) and
+ Airbrussh.configuration.command_output != :stdout and
+ data !~ password_prompt
SSHKit::Sudo.password_cache[password_cache_key(command.host)] = nil
end
if data =~ password_prompt
| Fix output when using with airbrussh
|
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
@@ -14,7 +14,7 @@
def authenticate
authenticate_or_request_with_http_basic do |user_name, password|
- (user_name == 'edendevelopment' && password == 't77cn32X')
+ (user_name == ENV['BASICAUTH_USER'] && password == ENV['BASICAUTH_PASS'])
end
end
end
| Cut out my initial user/pass from code :)
|
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -11,6 +11,7 @@ if current_user.present?
return true
else
+ flash[:error] = "You need to be logged in to access that!"
redirect_to new_session_path
return false
end
| Make it so that failed auth notifies user.
I made it so that when authenticate! fails and it redirects to the login page
it flash notices an error message telling them they need to login to gain
access.
|
diff --git a/app/controllers/kaui/queues_controller.rb b/app/controllers/kaui/queues_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/kaui/queues_controller.rb
+++ b/app/controllers/kaui/queues_controller.rb
@@ -6,7 +6,7 @@ @now = Kaui::Admin.get_clock(nil, options_for_klient)['currentUtcTime'].to_datetime
rescue KillBillClient::API::NotFound
# If TestResource is not bound, then clock has not been manipulated, we can default to NOW
- @now = DateTime.now
+ @now = DateTime.now.in_time_zone("UTC")
end
min_date = params[:min_date] || '1970-01-01'
| Add UTC timezone to NOW computation in rescue block
|
diff --git a/app/overrides/add_events_to_order_tabs.rb b/app/overrides/add_events_to_order_tabs.rb
index abc1234..def5678 100644
--- a/app/overrides/add_events_to_order_tabs.rb
+++ b/app/overrides/add_events_to_order_tabs.rb
@@ -3,7 +3,7 @@ :insert_bottom => "[data-hook='admin_order_tabs']",
:text => %q{
<li<%== ' class="active"' if current == 'Events' %>>
- <%= link_to_with_icon 'icon-cogs', t(:order_events), spree.admin_order_events_url(@order) %>
+ <%= link_to_with_icon 'icon-exclamation-sign', t(:order_events), spree.admin_order_events_url(@order) %>
</li>
},
:disabled => false)
| Use exclamation sign icon for order events tab
|
diff --git a/data_objects/lib/data_objects/uri.rb b/data_objects/lib/data_objects/uri.rb
index abc1234..def5678 100644
--- a/data_objects/lib/data_objects/uri.rb
+++ b/data_objects/lib/data_objects/uri.rb
@@ -30,13 +30,5 @@ string << "##{fragment}" if fragment
string
end
-
- def eql?(other)
- to_s.eql?(other.to_s)
- end
-
- def hash
- to_s.hash
- end
end
end
| Revert "[data_objects] Made nice eql? and hash methods which work with hashes"
This reverts commit 29f8024d9a4741b7e46f28701cde24ff8e313c1c.
|
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
@@ -16,6 +16,12 @@ RSpec.configure do |config|
config.before(:all) { Hutch::Config.log_level = Logger::FATAL }
config.raise_errors_for_deprecations!
+
+ if defined?(JRUBY_VERSION)
+ config.filter_run_excluding adapter: :bunny
+ else
+ config.filter_run_excluding adapter: :march_hare
+ end
end
# Constants (classes, etc) defined within a block passed to this method
@@ -32,4 +38,3 @@ def deep_copy(obj)
Marshal.load(Marshal.dump(obj))
end
-
| Add a way to skip bunny specs under jruby and march_hare specs under mri/rubinius
|
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,13 +1,14 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'spec/gherkin'))
require 'gherkin'
require 'gherkin/sexp_recorder'
require 'spec'
require 'spec/autorun'
-require 'spec/gherkin/shared/lexer_spec'
-require 'spec/gherkin/shared/tags_spec'
-require 'spec/gherkin/shared/py_string_spec'
-require 'spec/gherkin/shared/table_spec'
+require 'shared/lexer_spec'
+require 'shared/tags_spec'
+require 'shared/py_string_spec'
+require 'shared/table_spec'
Spec::Runner.configure do |config|
end
| Fix for spec helper so specs can be run from anywhere
|
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
@@ -7,7 +7,7 @@ config.formatter = :documentation
config.color = true
config.platform = 'ubuntu'
- config.version = '14.04'
+ config.version = '18.04'
config.log_level = :fatal
end
| Set Ubuntu 18.04 for unit tests
|
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
@@ -2,3 +2,44 @@
require 'cucumber/salad'
require 'rspec/given'
+require 'sinatra/base'
+require 'capybara'
+
+class SaladApp < Sinatra::Base; end
+Capybara.app = SaladApp
+
+module WidgetSpecDSL
+ def GivenHTML(body_html, path = "/test")
+ before :all do
+ SaladApp.class_eval do
+ get path do
+ <<-HTML
+ <html>
+ <body>
+ #{body_html}
+ </body>
+ </html>
+ HTML
+ end
+ end
+ end
+
+ Given(:container_root) { find('body') }
+ Given(:container) { Container.new(root: container_root) }
+
+ Given(:path) { path }
+ Given { visit path }
+
+ after :all do
+ SaladApp.reset!
+ end
+ end
+end
+
+RSpec.configure do |config|
+ config.extend WidgetSpecDSL
+
+ config.include Capybara::DSL
+ config.include Cucumber::Salad::DSL
+
+end
| Configure rspec to allow widget tests.
|
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
@@ -21,5 +21,5 @@ end
RSpec.configure do |config|
- config.mock_with nil
+ config.mock_with :rspec
end
| Add the mock_with :rspec since newer versions of rspec apparently barf if you don't supply a mocker.
|
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
@@ -3,6 +3,9 @@ require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
+
+init = Adhearsion::Initializer.new
+init.load_lib_folder
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
| Make sure we load app libs during spec runs |
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,7 +4,10 @@ require 'pp'
Dir[File.dirname(__FILE__) + '/support/**/*.rb'].each { |f| require f }
require 'simplecov'
-SimpleCov.start
+SimpleCov.start do
+ add_filter '/spec/'
+ add_filter '/features/'
+end
require 'git_simple'
| Exclude spec and feature from code coverage
|
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
@@ -18,6 +18,8 @@ end
RSpec.configure do |config|
+ config.infer_spec_type_from_file_location!
+
config.include Rails.application.routes.url_helpers
config.include Adminable::Engine.routes.url_helpers
| Add infer_spec_type_from_file_location to rspec config
|
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
@@ -19,7 +19,6 @@
config.example_status_persistence_file_path = 'spec/examples.txt'
config.disable_monkey_patching!
- config.warnings = true
config.default_formatter = 'doc' if config.files_to_run.one?
config.order = :random
| Drop RSpec warnings due to noise
|
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
@@ -43,7 +43,6 @@ c.syntax = :expect
end
- config.before( :each ) {
- clean_current_dir
- }
+ config.include Aruba::Api
+ config.before(:each) { clean_current_dir }
end
| Make it possible to run rspec with single spec file
|
diff --git a/lib/capistrano-fastly.rb b/lib/capistrano-fastly.rb
index abc1234..def5678 100644
--- a/lib/capistrano-fastly.rb
+++ b/lib/capistrano-fastly.rb
@@ -1,14 +1,32 @@ require 'capistrano'
require 'capistrano-fastly/version'
+require 'net/https'
module Capistrano
module Fastly
def self.load_into(configuration)
configuration.load do
- desc 'Purge all Fastly cache'
+
namespace :fastly do
+ desc 'Purge entire Fastly cache'
task :purge_all do
- logger.info('Purged. Baaaaaaarf.')
+ raise(Capistrano::Error, 'Fastly configuration is not set') unless fetch(:fastly_config).kind_of?(Hash)
+
+ uri = URI.parse("https://api.fastly.com")
+ http = Net::HTTP.new(uri.host, uri.port)
+ http.use_ssl = true
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
+ request = Net::HTTP::Post.new("/service/#{fastly_config[:service_id]}/purge_all")
+ request.add_field('Content-Type', 'application/json')
+ request.add_field('X-Fastly-Key', fastly_config[:api_key])
+ request.body = ""
+ response = http.request(request)
+
+ if response.kind_of? Net::HTTPSuccess
+ logger.info('Fastly cache purge all complete.')
+ else
+ logger.info("Fastly cache purge failed: #{response.body}")
+ end
end
end
end
| Add Fastly cache purge all code
|
diff --git a/webhook.rb b/webhook.rb
index abc1234..def5678 100644
--- a/webhook.rb
+++ b/webhook.rb
@@ -8,6 +8,6 @@ end
post '/' do
- pp JSON.parse(CGI.unescape(request.body.read.sub(/^payload=/, '')))
+ pp JSON.parse(params[:payload])
'OK'
end
| Use Sinatra's params rather than parsing ourselves
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.