diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/spec/oauth_container_spec.rb b/spec/oauth_container_spec.rb
index abc1234..def5678 100644
--- a/spec/oauth_container_spec.rb
+++ b/spec/oauth_container_spec.rb
@@ -1,5 +1,37 @@ require 'spec_helper'
+require 'dry-monads'
RSpec.describe WebBouncer::OauthContainer do
- pending "write it"
+ include Dry::Monads::Either::Mixin
+
+ let(:container) { WebBouncer::OauthContainer }
+
+ describe 'when user rewrite container' do
+ class TestContainer < WebBouncer::OauthContainer
+ register 'oauth.base_callback' do
+ Right('changed')
+ end
+ end
+
+ class WebBouncer::OauthContainer
+ register 'oauth.facebook_callback' do
+ Right('facebook account')
+ end
+ end
+
+ it { expect(TestContainer['oauth.base_callback'].call).to eq Right('changed') }
+ it { expect(container['oauth.facebook_callback'].call).to eq Right('facebook account') }
+ end
+
+ describe 'oauth.failure container' do
+ it { expect(container['oauth.failure'].call).to eq Right(nil) }
+ end
+
+ describe 'oauth.logout container' do
+ it { expect(container['oauth.logout'].call).to eq Right(nil) }
+ end
+
+ describe 'oauth.base_callback container' do
+ it { expect(container['oauth.base_callback'].call).to eq Right('account object') }
+ end
end
|
Add simple tests for OauthContainer class
|
diff --git a/core/db/migrate/20150626200816_remove_shipping_method_id_from_spree_orders.rb b/core/db/migrate/20150626200816_remove_shipping_method_id_from_spree_orders.rb
index abc1234..def5678 100644
--- a/core/db/migrate/20150626200816_remove_shipping_method_id_from_spree_orders.rb
+++ b/core/db/migrate/20150626200816_remove_shipping_method_id_from_spree_orders.rb
@@ -0,0 +1,9 @@+class RemoveShippingMethodIdFromSpreeOrders < ActiveRecord::Migration
+ def up
+ remove_column :spree_orders, :shipping_method_id, :integer
+ end
+
+ def down
+ add_column :spree_orders, :shipping_method_id, :integer
+ end
+end
|
Remove shipping_method_id column from spree_orders
This is a relic from before spree separated shipments from orders.
|
diff --git a/lib/binman/rakefile.rb b/lib/binman/rakefile.rb
index abc1234..def5678 100644
--- a/lib/binman/rakefile.rb
+++ b/lib/binman/rakefile.rb
@@ -26,7 +26,7 @@ desc 'Build UNIX manual pages for bin/ scripts.'
task 'binman:man' => mkds do
#-----------------------------------------------------------------------------
- load 'md2man/rakefile.rb'
+ require 'md2man/rakefile'
Rake::Task['md2man:man'].invoke
end
@@ -34,6 +34,6 @@ desc 'Build HTML manual pages for bin/ scripts.'
task 'binman:web' => mkds do
#-----------------------------------------------------------------------------
- load 'md2man/rakefile.rb'
+ require 'md2man/rakefile'
Rake::Task['md2man:web'].invoke
end
|
Revert "ensure 'binman:web' task works the first time thru"
This reverts commit dd0511e78e02546cac4903b5c6de6243607a8bba,
which was causing the following error under Ruby 2.3.0p0.
% rake build
mkdir -p man/man1
rake aborted!
LoadError: cannot load such file -- md2man/rakefile.rb
./lib/binman/rakefile.rb:29:in `load'
./lib/binman/rakefile.rb:29:in `block in <top (required)>'
Tasks: TOP => build => binman => binman:man
(See full trace by running task with --trace)
exit 1
|
diff --git a/lib/creperie/loader.rb b/lib/creperie/loader.rb
index abc1234..def5678 100644
--- a/lib/creperie/loader.rb
+++ b/lib/creperie/loader.rb
@@ -6,7 +6,7 @@ # If we find a Gemfile using the method below and it contains Crepe
# as a dependency, we can safely assume we're in a Crepe application.
def crepe_app?
- gemfile =~ /gem (['"])crepe\1/
+ File.read(find_file(gemfile)) =~ /gem (['"])crepe\1/
end
def application
@@ -37,8 +37,8 @@ original_dir = Dir.pwd
loop do
- # For convenience, return the contents of the file if we find it.
- return File.read(filename) if File.file?(filename)
+ # Return the full path of the file if we find it.
+ return File.expand_path(filename) if File.file?(filename)
# If we've reached the root of the filesystem without finding the
# specified file, give up.
|
Return filepath from Loader as opposed to file contents
Signed-off-by: David Celis <b1c1d8736f20db3fb6c1c66bb1455ed43909f0d8@davidcel.is>
|
diff --git a/recipes/_god.rb b/recipes/_god.rb
index abc1234..def5678 100644
--- a/recipes/_god.rb
+++ b/recipes/_god.rb
@@ -18,6 +18,7 @@ mode "0755"
end
+# Create god config file
file "/etc/god/master.conf" do
owner "root"
group "root"
@@ -27,7 +28,7 @@ home = node["practicingruby"]["deploy"]["home_dir"]
god_file = "#{home}/current/config/delayed_job.god"
- content "God.load('#{god_file}') if File.file?('#{god_file}')"
+ content "God.load('#{god_file}') if File.file?('#{god_file}')\n"
end
# Install startup script
|
Add newline to god config file
|
diff --git a/lib/ettu/fresh_when.rb b/lib/ettu/fresh_when.rb
index abc1234..def5678 100644
--- a/lib/ettu/fresh_when.rb
+++ b/lib/ettu/fresh_when.rb
@@ -5,7 +5,7 @@ included do
alias_method :old_fresh_when, :fresh_when
- def fresh_when(record_or_options, additional_options)
+ def fresh_when(record_or_options, additional_options = {})
ettu = ettu_instance(record_or_options, additional_options, self)
ettu_params = {etag: ettu.etags, last_modified: ettu.last_modified}
|
Allow additional_options to be optional
|
diff --git a/lib/frecon/database.rb b/lib/frecon/database.rb
index abc1234..def5678 100644
--- a/lib/frecon/database.rb
+++ b/lib/frecon/database.rb
@@ -27,12 +27,29 @@ def self.setup!
Mongoid.load!(File.join(File.dirname(__FILE__), 'mongoid.yml'), FReCon::ENVIRONMENT.variable)
- if FReCon::ENVIRONMENT.console['level']
+ level = case (defined_level = FReCon::ENVIRONMENT.console['level'])
+ when /^d/i
+ ::Logger::DEBUG
+ when /^e/i
+ ::Logger::ERROR
+ when /^f/i
+ ::Logger::FATAL
+ when /^i/i
+ ::Logger::INFO
+ when /^u/i
+ ::Logger::UNKNOWN
+ when /^w/i
+ ::Logger::WARN
+ else
+ ::Logger::WARN
+ end
+
+ if !!defined_level
Mongoid.logger = Logger.new($stdout)
- Mongoid.logger.level = Logger::DEBUG
+ Mongoid.logger.level = level
Moped.logger = Logger.new($stdout)
- Moped.logger.level = Logger::DEBUG
+ Moped.logger.level = level
end
end
|
Database: Use more intelligent parsing solution for Logger.level sets
|
diff --git a/lib/lime/featurette.rb b/lib/lime/featurette.rb
index abc1234..def5678 100644
--- a/lib/lime/featurette.rb
+++ b/lib/lime/featurette.rb
@@ -0,0 +1,68 @@+module Lime
+
+ # Convenience method for creating a feature mixin.
+ #
+ # @example
+ #
+ # module MyStepDefinitions
+ # include Lime::Featurette
+ #
+ # Given "customer's name is '(((\s+)))'" do |name|
+ # @name = name
+ # end
+ # end
+ #
+ # Feature do
+ # include MyStepDefinitions
+ # end
+ #
+ module Featurette
+
+ def self.append_features(base)
+ base.extend(self)
+ base.module_eval %{
+ @_advice = Hash.new{ |h,k| h[k] = {} }
+ }
+ end
+
+ # Given ...
+ #
+ # @param [String] description
+ # A brief description of the _given_ criteria.
+ #
+ def Given(description, &procedure)
+ @_advice[:given][description] = procedure
+ end
+
+ alias :given :Given
+
+ # When ...
+ #
+ # @param [String] description
+ # A brief description of the _when_ criteria.
+ #
+ def When(description, &procedure)
+ @_advice[:when][description] = procedure
+ end
+
+ alias :wence :When
+
+ # Then ...
+ #
+ # @param [String] description
+ # A brief description of the _then_ criteria.
+ #
+ def Then(description, &procedure)
+ @_advice[:then][description] = procedure
+ end
+
+ alias :hence :Then
+
+ # Access to advice.
+ def [](key)
+ @_advice[key]
+ end
+
+ end
+
+end
|
Move Featurette class to own file.
|
diff --git a/lib/tasks/install.rake b/lib/tasks/install.rake
index abc1234..def5678 100644
--- a/lib/tasks/install.rake
+++ b/lib/tasks/install.rake
@@ -10,7 +10,7 @@ task :migrations do
source = File.join(File.dirname(__FILE__), '..', '..', 'db')
destination = File.join(Rails.root, 'db')
- Spree::FileUtilz.mirror_files(source, destination)
+ Spree::Core::FileUtilz.mirror_files(source, destination)
end
desc "Copies all assets (NOTE: This will be obsolete with Rails 3.1)"
@@ -18,7 +18,7 @@ source = File.join(File.dirname(__FILE__), '..', '..', 'public')
destination = File.join(Rails.root, 'public')
puts "INFO: Mirroring assets from #{source} to #{destination}"
- Spree::FileUtilz.mirror_files(source, destination)
+ Spree::Core::FileUtilz.mirror_files(source, destination)
end
end
|
Make FileUtilz inherit from right class, Spree => Spree::Core
|
diff --git a/lib/transproc/array.rb b/lib/transproc/array.rb
index abc1234..def5678 100644
--- a/lib/transproc/array.rb
+++ b/lib/transproc/array.rb
@@ -15,6 +15,7 @@ register(:group) do |array, key, keys|
grouped = Hash.new { |hash, key| hash[key] = [] }
array.each do |hash|
+ hash = hash.dup
child = {}
keys.each { |k| child[k] = hash.delete(k) }
grouped[hash] << child
|
Make :group not mutate input
|
diff --git a/lib/yeah-web/server.rb b/lib/yeah-web/server.rb
index abc1234..def5678 100644
--- a/lib/yeah-web/server.rb
+++ b/lib/yeah-web/server.rb
@@ -1,5 +1,6 @@ require 'rack'
require 'opal'
+require 'tilt/erb'
class Yeah::Web::Server
def initialize(port = 1234)
|
Fix cause of tilt/erb autoload warning
|
diff --git a/xcode/pbxproj_pp_uuid.rb b/xcode/pbxproj_pp_uuid.rb
index abc1234..def5678 100644
--- a/xcode/pbxproj_pp_uuid.rb
+++ b/xcode/pbxproj_pp_uuid.rb
@@ -0,0 +1,88 @@+#!/usr/bin/env ruby
+#
+# A script to get or set the provisioning profile UUID from a XCode .pbxproj files given its configuration name
+#
+require 'rubygems'
+require 'json'
+require 'logger'
+
+@log=Logger.new(STDOUT)
+@log.level = Logger::WARN
+
+
+#if ! File.exists(plutil)
+# puts "ERROR plutil not found in expected location"
+# exit
+#end
+
+def usage()
+ puts "USAGE: #{ARGV[0]} file configuration action [value]"
+ puts "\tfile: the xcode project file"
+ puts "\tconfiguration: name of the configuration e.g. 'Ad Hoc'"
+ puts "\taction: get or set"
+ puts "\tvalue: the new uuid to set (if action is 'set')"
+end
+
+def debug(msg)
+ @log.debug("DEBUG #{msg}")
+end
+
+if (ARGV.length < 3 || ARGV.length > 4)
+ puts "ERROR invalid arguments"
+ usage()
+end
+
+file=ARGV[0]
+configuration=ARGV[1]
+action=ARGV[2]
+value=ARGV[3]
+
+
+if ! File.exist?(file)
+ puts "ERROR: $#{file} file not found"
+ usage
+ exit
+end
+
+#plutil='/usr/bin/plutil'
+#wasBinary=false
+#f = File.open(file)
+#
+#begin
+# json = JSON f.read
+#rescue
+# f.close
+# wasBinary=true
+# `#{plutil} -convert json -r #{file}`
+ # TODO check result
+ f = File.open(file, "r")
+ json = JSON f.read
+#end
+
+
+# 1- find the matching build configuration
+rootObj=json['rootObject']
+debug "rootObj #{rootObj}"
+
+buildConfigurationList=json['objects'][rootObj]['buildConfigurationList']
+debug "buildConfigurationList $buildConfigurationList"
+
+buildConfigurationObjId=json['objects'][buildConfigurationList]['buildConfigurations'].find { |x| json['objects'][x]['name'] == configuration }
+debug "buildConfigurationObjId for #{configuration}: #{buildConfigurationObjId}"
+
+case action
+when 'set'
+ json['objects'][buildConfigurationObjId]['buildSettings']['PROVISIONING_PROFILE[sdk=iphoneos*]'] = value
+ f = File.open(file, "w")
+ f.write(json.to_json)
+when 'get'
+ uuid=json['objects'][buildConfigurationObjId]['buildSettings']['PROVISIONING_PROFILE[sdk=iphoneos*]']
+ puts uuid
+else
+ puts "INVALID action #{action}"
+end
+f.close
+
+#if wasBinary
+# `#{plutil} -convert binary1 -r #{file}`
+#end
|
Convert script from shell to ruby
|
diff --git a/test/alavetelitheme_test.rb b/test/alavetelitheme_test.rb
index abc1234..def5678 100644
--- a/test/alavetelitheme_test.rb
+++ b/test/alavetelitheme_test.rb
@@ -1,8 +1,8 @@-require 'test_helper'
-
+require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
class AlavetelithemeTest < ActiveSupport::TestCase
# Replace this with your real tests.
test "the truth" do
assert true
end
+
end
|
Fix require so that tests can be run from alaveteli Rails.root.
|
diff --git a/db/migrations/23_create_pact_versions_table.rb b/db/migrations/23_create_pact_versions_table.rb
index abc1234..def5678 100644
--- a/db/migrations/23_create_pact_versions_table.rb
+++ b/db/migrations/23_create_pact_versions_table.rb
@@ -1,7 +1,7 @@ require_relative 'migration_helper'
Sequel.migration do
- up do
+ change do
create_table(:pact_versions, charset: 'utf8') do
primary_key :id
foreign_key :consumer_id, :pacticipants
@@ -12,8 +12,4 @@ DateTime :created_at, null: false
end
end
-
- down do
-
- end
end
|
fix(migration): Use change instead of up/down
|
diff --git a/sphero_robot.rb b/sphero_robot.rb
index abc1234..def5678 100644
--- a/sphero_robot.rb
+++ b/sphero_robot.rb
@@ -5,17 +5,38 @@ connection :sphero, :adaptor => :sphero, :port => '127.0.0.1:4560'
device :sphero, :driver => :sphero
+ def initialize(params={})
+ @lock = Mutex.new
+ super params
+ end
+
def calibration_led(led_brightness)
- sphero.back_led_output = led_brightness
+ do_action do
+ puts "Sphero brightness #{led_brightness}"
+ sphero.back_led_output = led_brightness
+ end
end
def calibrate(heading)
- sphero.heading = heading
+ do_action do
+ puts "Sphero heading #{heading}"
+ sphero.heading = heading
+ end
end
def roll(speed, heading)
- sphero.roll(speed, heading)
+ do_action do
+ sphero.roll(speed, heading)
+ end
end
+ private
+
+ def do_action
+ if @lock.try_lock
+ yield
+ @lock.unlock
+ end
+ end
end
|
Add mutex support for commands
|
diff --git a/metadata.rb b/metadata.rb
index abc1234..def5678 100644
--- a/metadata.rb
+++ b/metadata.rb
@@ -1,6 +1,6 @@ name 'runit'
-maintainer 'Heavy Water Operations, LLC.'
-maintainer_email 'support@hw-ops.com'
+maintainer 'Chef Software, Inc.'
+maintainer_email 'cookbooks@chef.io'
license 'Apache 2.0'
description 'Installs runit and provides runit_service definition'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
@@ -8,12 +8,14 @@
recipe 'runit', 'Installs and configures runit'
-%w(ubuntu debian gentoo centos redhat amazon scientific oracle enterpriseenterprise).each do |os|
+%w(ubuntu debian gentoo centos redhat amazon scientific oracle enterpriseenterprise oracle zlinux).each do |os|
supports os
end
depends 'packagecloud'
depends 'yum-epel'
-source_url 'https://github.com/hw-cookbooks/runit' if respond_to?(:source_url)
-issues_url 'https://github.com/hw-cookbooks/runit/issues' if respond_to?(:issues_url)
+source_url 'https://github.com/chef-cookbooks/runit' if respond_to?(:source_url)
+issues_url 'https://github.com/chef-cookbooks/runit/issues' if respond_to?(:issues_url)
+
+chef_version '>= 11.0' if respond_to?(:chef_version)
|
Update owner, add chef_version and additional platforms
Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
|
diff --git a/metadata.rb b/metadata.rb
index abc1234..def5678 100644
--- a/metadata.rb
+++ b/metadata.rb
@@ -4,6 +4,6 @@ license 'Apache 2.0'
description 'Installs/Configures Visual Studio 2012'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version '0.1.0'
+version (ENV['BUILD_NUMBER'] ? "0.0.#{ENV['BUILD_NUMBER']}" : '0.1.0')
depends 'windows'
depends '7-zip'
|
Make version configurable from CI
|
diff --git a/metadata.rb b/metadata.rb
index abc1234..def5678 100644
--- a/metadata.rb
+++ b/metadata.rb
@@ -6,10 +6,11 @@ long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.4.0'
-supports 'ubuntu'
+supports 'ubuntu', '>= 12.04'
-depends 'sqlite'
depends 'build-essential'
-depends 'git'
-depends 'mysql'
depends 'resolvconf'
+
+suggests 'mysql'
+suggests 'sqlite'
+suggests 'postgres'
|
Define supported platforms and suggest cookbooks
|
diff --git a/lib/event_store/messaging/writer.rb b/lib/event_store/messaging/writer.rb
index abc1234..def5678 100644
--- a/lib/event_store/messaging/writer.rb
+++ b/lib/event_store/messaging/writer.rb
@@ -24,6 +24,7 @@
def write(msg)
messages << msg
+ msg
end
def written?(msg)
|
Return message from the write method.
|
diff --git a/db/migrate/20160420102347_remove_appointed_person_for_england_and_wales_tag.rb b/db/migrate/20160420102347_remove_appointed_person_for_england_and_wales_tag.rb
index abc1234..def5678 100644
--- a/db/migrate/20160420102347_remove_appointed_person_for_england_and_wales_tag.rb
+++ b/db/migrate/20160420102347_remove_appointed_person_for_england_and_wales_tag.rb
@@ -0,0 +1,26 @@+class RemoveAppointedPersonForEnglandAndWalesTag < Mongoid::Migration
+ def self.up
+ organisation_tag = Tag.where(tag_type: 'organisation', tag_id: 'appointed-person-for-england-and-wales-under-the-proceeds-of-crime-act-2002').first
+ if organisation_tag.present?
+ Artefact.where(tag_ids: organisation_tag.tag_id).each do |tagged_document|
+ print "#{artefact.slug}: "
+ tagged_document.organisation_ids = (tagged_document.organisation_ids - [organisation_tag.tag_id])
+
+ if tagged_document.save
+ print "Removed"
+ else
+ print "Error\n"
+ print tagged_document.errors.full_messages.join("\n\t\t")
+ end
+ print "\n"
+ RummageableArtefact.new(tagged_document).submit
+ end
+
+ organisation_tag.destroy
+ end
+ end
+
+ def self.down
+ # This org was created in error, there's no need for a down to re-instate it
+ end
+end
|
Revert "Revert "Revert "Revert "Migration to remove an org created in error""""
|
diff --git a/lib/formulas/gunning_fog.rb b/lib/formulas/gunning_fog.rb
index abc1234..def5678 100644
--- a/lib/formulas/gunning_fog.rb
+++ b/lib/formulas/gunning_fog.rb
@@ -3,6 +3,16 @@ def score(text, stats)
percent = three_syllables(stats['word_count'], text['syllables'])
calc_score(stats['average_words_per_sentence'], percent)
+ end
+
+ def score_per_sentence(text, stats_split)
+ res = []
+ for i in 0..text['sentences'].length-1
+ percent = three_syllables(stats_split['word_count'][i],
+ text['syllables_by_sentence'][i])
+ res.push(calc_score(stats_split['word_count'][i], percent))
+ end
+ res
end
#percentage of words with three syllables
@@ -21,4 +31,4 @@ def name
'Gunning-Fog Score'
end
-end+end
|
Add per sentence gunning frog
|
diff --git a/lib/rails-html-sanitizer.rb b/lib/rails-html-sanitizer.rb
index abc1234..def5678 100644
--- a/lib/rails-html-sanitizer.rb
+++ b/lib/rails-html-sanitizer.rb
@@ -5,17 +5,19 @@
module Rails
module Html
- module Sanitizer
- def full_sanitizer
- Html::FullSanitizer
- end
+ class Sanitizer
+ class << self
+ def full_sanitizer
+ Html::FullSanitizer
+ end
- def link_sanitizer
- Html::LinkSanitizer
- end
+ def link_sanitizer
+ Html::LinkSanitizer
+ end
- def white_list_sanitizer
- Html::WhiteListSanitizer
+ def white_list_sanitizer
+ Html::WhiteListSanitizer
+ end
end
end
end
|
Change Sanitizer to class with class methods.
|
diff --git a/lib/relish/commands/base.rb b/lib/relish/commands/base.rb
index abc1234..def5678 100644
--- a/lib/relish/commands/base.rb
+++ b/lib/relish/commands/base.rb
@@ -9,23 +9,21 @@
attr_writer :args
+ def self.option(name)
+ define_method(name) do
+ @options[name.to_s] || parsed_options_file[name.to_s]
+ end
+ end
+
def initialize(args = [])
@args = clean_args(args)
@param = get_param
@options = get_options
end
- def organization
- @options['organization']
- end
-
- def project
- @options['project']
- end
-
- def api_token
- @options['api_token']
- end
+ option :organization
+ option :project
+ option :api_token
def url
"http://#{@options['host'] || DEFAULT_HOST}/api"
|
Fix specs, add a little DSL to the Command::Base for defining an option
|
diff --git a/lib/web_console/template.rb b/lib/web_console/template.rb
index abc1234..def5678 100644
--- a/lib/web_console/template.rb
+++ b/lib/web_console/template.rb
@@ -18,7 +18,7 @@
# Render a template (inferred from +template_paths+) as a plain string.
def render(template)
- view = View.new(template_paths, instance_values, nil)
+ view = View.new(ActionView::LookupContext.new(template_paths), instance_values, nil)
view.render(template: template, layout: false)
end
end
|
Drop the Action View warnings for Rails 6
|
diff --git a/Casks/fluid.rb b/Casks/fluid.rb
index abc1234..def5678 100644
--- a/Casks/fluid.rb
+++ b/Casks/fluid.rb
@@ -1,13 +1,13 @@ cask :v1 => 'fluid' do
- version '1.8.3'
- sha256 '56438a946b281b009626a06cb099a7198e948bc8bef18a19c1bceb28bbe4d619'
+ version '1.8.4'
+ sha256 'ccb7d282e9613ebd1949f27e942b4cf516dea1c0cf45c3c2ee4042893a6e97d3'
url "http://fluidapp.com/dist/Fluid_#{version}.zip"
appcast 'http://fluidapp.com/appcast/fluid1.rss',
:sha256 => '260c43831d82b9fa593d9f32cca7bc61b594f5993908b104601ed866ee7c518a'
name 'Fluid'
homepage 'http://fluidapp.com/'
- license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder
+ license :commercial
app 'Fluid.app'
end
|
Update Fluid to version 1.8.4
This commit changes the version number and the SHA. I have also
changed the licence type to commercial.
|
diff --git a/lib/miq_automation_engine/service_models/miq_ae_service_orchestration_template_vnfd.rb b/lib/miq_automation_engine/service_models/miq_ae_service_orchestration_template_vnfd.rb
index abc1234..def5678 100644
--- a/lib/miq_automation_engine/service_models/miq_ae_service_orchestration_template_vnfd.rb
+++ b/lib/miq_automation_engine/service_models/miq_ae_service_orchestration_template_vnfd.rb
@@ -1,6 +1,6 @@ module MiqAeMethodService
class MiqAeServiceOrchestrationTemplateVnfd < MiqAeServiceOrchestrationTemplate
- CREATE_ATTRIBUTES = [:name, :description, :content, :draft, :orderable, :ems_id]
+ CREATE_ATTRIBUTES = [:name, :description, :content, :draft, :orderable, :ems_id].freeze
def self.create(options = {})
attributes = options.symbolize_keys.slice(*CREATE_ATTRIBUTES)
|
Fix rubocop issues for NFV support
Fix rubocop issues for NFV support
(transferred from ManageIQ/manageiq@3ff720d354039416cef82df1c1a6dcee393f481c)
|
diff --git a/sassc-import_once.gemspec b/sassc-import_once.gemspec
index abc1234..def5678 100644
--- a/sassc-import_once.gemspec
+++ b/sassc-import_once.gemspec
@@ -18,7 +18,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
- spec.add_dependency "sassc", "~> 1.8"
+ spec.add_dependency "sassc", [">= 1.8", "< 3"]
spec.add_development_dependency "bundler"
spec.add_development_dependency "rake"
spec.add_development_dependency "minitest"
|
Allow newer sassc for m1 macs compatibility
Newer sassc versions use newer ffi versions,
which are needed for m1 macs.
|
diff --git a/src/modules/module_monkey.rb b/src/modules/module_monkey.rb
index abc1234..def5678 100644
--- a/src/modules/module_monkey.rb
+++ b/src/modules/module_monkey.rb
@@ -6,13 +6,11 @@ cfg_file = bot.base_path + "/" + filename
puts "Reading monkey config from '#{cfg_file}'"
@expressions = YAML.load_file(cfg_file)
- puts "Read"
end
def privmsg(bot, from, reply_to, msg)
@expressions.value.each { |expr|
expr.each { |trigger, reply|
- puts "trig"
if m = Regexp.new(trigger).match(msg)
updated_reply = reply.clone
(m.length - 1).times.map { |i| i + 1 }.each { |i|
|
Remove debug from monkey module
Signed-off-by: Aki Saarinen <278bc57fbbff6b7b38435aea0f9d37e3d879167e@akisaarinen.fi>
|
diff --git a/lib/serializers/group_serializer.rb b/lib/serializers/group_serializer.rb
index abc1234..def5678 100644
--- a/lib/serializers/group_serializer.rb
+++ b/lib/serializers/group_serializer.rb
@@ -6,11 +6,6 @@ name: group.name,
transfer_count: group.transfer_count,
- user: {
- uuid: group.user.uuid,
- name: group.user.name
- },
-
created_at: group.created_at,
updated_at: group.updated_at,
deleted_at: group.deleted_at
|
Drop unneeded user info from Group serialization
|
diff --git a/lib/web_components_rails/railtie.rb b/lib/web_components_rails/railtie.rb
index abc1234..def5678 100644
--- a/lib/web_components_rails/railtie.rb
+++ b/lib/web_components_rails/railtie.rb
@@ -5,8 +5,11 @@ ActionView::Base.module_eval do
include WebComponentsRails::AssetTagHelper
end
- Rails.application.assets.context_class.class_eval do
- include WebComponentsRails::AssetTagHelper
+ # Certain run modes in Rails (like rails g migration), won't have assets loaded
+ if Rails.application.assets.present?
+ Rails.application.assets.context_class.class_eval do
+ include WebComponentsRails::AssetTagHelper
+ end
end
end
|
Support runtime environments without asset pipeline
|
diff --git a/app/controllers/hovercard/users_controller.rb b/app/controllers/hovercard/users_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/hovercard/users_controller.rb
+++ b/app/controllers/hovercard/users_controller.rb
@@ -3,23 +3,9 @@ before_filter :find_user
def hovercard
- @challenges_count = @user.supported_challenges.published.active.count
- @submissions_count = Submission.submissions_for(@user).eligible.joins(:challenge).where("challenges.submissions_published = ? and challenges.published_at is not null", true).count
-
- submission_ids = @user.all_submission_ids
- submission_ids = ['null'] if submission_ids.blank?
-
- @awards_count = Submission.includes(:challenge, :prizes).
- joins(<<-EOF).
- join `prizes_attributions` on `submissions`.id = `prizes_attributions`.submission_id
- join `challenges` AS challenges2 on `challenges2`.id = `submissions`.challenge_id
- EOF
- where(<<-EOF).
- `submissions`.id in (#{submission_ids.join(", ")})
- and
- `challenges2`.moderation_stage = "#{Challenge::ModerationStage::FINISHED}"
- EOF
- order("`prizes_attributions`.created_at DESC").paginate(:page => 1).total_entries
+ @challenges_count = @user.visible_challenges.count
+ @submissions_count = @user.visible_submissions.count
+ @awards_count = @user.visible_awards.count
super
end
|
Update the way user challenges, submissions and awards are loaded.
|
diff --git a/app/serializers/helpdesk_ticket_serializer.rb b/app/serializers/helpdesk_ticket_serializer.rb
index abc1234..def5678 100644
--- a/app/serializers/helpdesk_ticket_serializer.rb
+++ b/app/serializers/helpdesk_ticket_serializer.rb
@@ -2,6 +2,7 @@ attributes :id,
:student,
:task,
+ :task_definition_id,
:tutorial,
:target_grade,
:description,
@@ -29,6 +30,11 @@ def target_grade
object.project.target_grade
end
+
+ def task_definition_id
+ task = object.task
+ task.task_definition_id if task
+ end
end
class ShallowHelpdeskTicketSerializer < ActiveModel::Serializer
|
FIX: Add missing task def id to ticket serialiser
|
diff --git a/medium-editor-rails.gemspec b/medium-editor-rails.gemspec
index abc1234..def5678 100644
--- a/medium-editor-rails.gemspec
+++ b/medium-editor-rails.gemspec
@@ -16,6 +16,6 @@ gem.files = `git ls-files`.split($/)
gem.require_paths = ['lib']
- gem.add_dependency 'railties', '>= 3.0'
+ gem.add_dependency 'railties', '~> 3.0'
gem.add_development_dependency 'bundler', '~> 1.0'
end
|
Change dependency railties to ~> 3.0
|
diff --git a/test/integration/stats_test.rb b/test/integration/stats_test.rb
index abc1234..def5678 100644
--- a/test/integration/stats_test.rb
+++ b/test/integration/stats_test.rb
@@ -2,7 +2,8 @@
class StatsTest < SystemTest
test "page params is not integer" do
- visit '/stats?page="3\">XSS"'
+ string_param_path = '/stats?page="3\""'
+ visit URI.encode(string_param_path)
assert page.has_content? "Stats"
end
end
|
Fix URI::InvalidURIError: bad URI(is not URI?) in stats test
rake-test 0.7.0 stopped formatting params in urls[1] if they were already
in rest format. Test was passing in previous versions as side effect of
path being escaped by Rack::Test:Untils.build_nested_query (`#{escape(params)}`).
Test was originally written for paginate method blowing up in stats_controller
when params was not integer[2]. Test works the same after escaping the url.
XSS in path is removed because it misleads reader about purpose of test.
[1] https://github.com/rack-test/rack-test/commit/4a4b2c1bde9ce00929df2d5458915e342b9c1ea1#diff-f0893663b0bd05064de46c2b32ac81fbR213
[2] https://github.com/rubygems/rubygems.org/commit/e978744c4f86772f0478bcaf92df84aef40e3878
|
diff --git a/app/helpers/api/pages_helper.rb b/app/helpers/api/pages_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/api/pages_helper.rb
+++ b/app/helpers/api/pages_helper.rb
@@ -10,7 +10,7 @@
# List all images required for api/featured.json
def images_src_set(page)
- %w[medium_square medium large].each_with_index.collect do |size, index|
+ %w[medium medium_square large].each_with_index.collect do |size, index|
(url = image_url(page, size)).present? ? (url.to_s + " #{index + 1}x") : nil
end
end
|
Revert "Changed the order of images in the srcset attrib"
This reverts commit 33e665a8c0cb7ce36f3d5121fa0a7c164b6994e8.
|
diff --git a/config/software/libossp-uuid.rb b/config/software/libossp-uuid.rb
index abc1234..def5678 100644
--- a/config/software/libossp-uuid.rb
+++ b/config/software/libossp-uuid.rb
@@ -22,8 +22,7 @@ end
# ftp on ftp.ossp.org is unavaiable so we must use another mirror site.
-# From homebrew discussion, following url is better for now: https://github.com/Homebrew/homebrew/pull/14288
-source url: "http://gnome-build-stage-1.googlecode.com/files/uuid-#{version}.tar.gz"
+source url: "http://www.mirrorservice.org/sites/ftp.ossp.org/pkg/lib/uuid/uuid-#{version}.tar.gz"
relative_path "uuid-#{version}"
|
Use www.mirrorservice.org because googlecode.com will be shutdown
|
diff --git a/app/models/retirement_manager.rb b/app/models/retirement_manager.rb
index abc1234..def5678 100644
--- a/app/models/retirement_manager.rb
+++ b/app/models/retirement_manager.rb
@@ -3,7 +3,7 @@ ems_ids = MiqServer.my_server.zone.ext_management_system_ids
[LoadBalancer, OrchestrationStack, Vm, Service].each do |model|
table = model.arel_table
- arel = table[:retires_on].not_eq(nil).or(table[:retired].eq(true))
+ arel = table[:retires_on].not_eq(nil).or(table[:retired].not_eq(true))
arel = arel.and(table[:ems_id].in(ems_ids)) if model.column_names.include?('ems_id') # Service not assigned to ems_ids
model.where(arel).each(&:retirement_check)
end
|
Switch the retired logic as proposed by tinaafitz
See: https://www.pivotaltracker.com/story/show/145237979
|
diff --git a/shepherd.gemspec b/shepherd.gemspec
index abc1234..def5678 100644
--- a/shepherd.gemspec
+++ b/shepherd.gemspec
@@ -14,6 +14,9 @@ s.description = %q{Check if/how your projects are growing up!}
s.date = Time.now.strftime('%Y-%m-%d')
+ s.add_development_dependency('yard', '~> 0.7.2')
+ s.add_development_dependency('rspec', '~> 2.6.0')
+
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
Use rspec and yard in development
|
diff --git a/activerecord/lib/active_record/internal_metadata.rb b/activerecord/lib/active_record/internal_metadata.rb
index abc1234..def5678 100644
--- a/activerecord/lib/active_record/internal_metadata.rb
+++ b/activerecord/lib/active_record/internal_metadata.rb
@@ -35,7 +35,7 @@ # Creates a internal metadata table with columns +key+ and +value+
def create_table
unless table_exists?
- connection.create_table(table_name, id: false) do |t|
+ connection.create_table(table_name, primary_key: :key, id: false ) do |t|
t.column :key, :string
t.column :value, :string
t.timestamps
|
Use `key` as primary key in schema.
|
diff --git a/open_badges.gemspec b/open_badges.gemspec
index abc1234..def5678 100644
--- a/open_badges.gemspec
+++ b/open_badges.gemspec
@@ -19,6 +19,6 @@
gem.add_dependency "activesupport", "~> 3.0"
- gem.add_development_dependency "rspec", "2.11.0"
+ gem.add_development_dependency "rspec", "2.14.0"
gem.add_development_dependency "timecop", "0.4.5"
end
|
Update RSpec to 2.14.0 to fix ActiveSupport::Deprecation bug in Ruby 2.x.
|
diff --git a/lib/chef_zero/endpoints/user_association_requests_count_endpoint.rb b/lib/chef_zero/endpoints/user_association_requests_count_endpoint.rb
index abc1234..def5678 100644
--- a/lib/chef_zero/endpoints/user_association_requests_count_endpoint.rb
+++ b/lib/chef_zero/endpoints/user_association_requests_count_endpoint.rb
@@ -6,7 +6,7 @@ # /users/NAME/association_requests/count
class UserAssociationRequestsCountEndpoint < RestBase
def get(request)
- get_data(request, request.rest_path[0..-2])
+ get_data(request, request.rest_path[0..-3])
username = request.rest_path[1]
result = list_data(request, [ 'organizations' ]).select do |org|
|
Fix 404 in assoc. request count to be correct
|
diff --git a/core/spec/lib/factlink_api/user_manager_spec.rb b/core/spec/lib/factlink_api/user_manager_spec.rb
index abc1234..def5678 100644
--- a/core/spec/lib/factlink_api/user_manager_spec.rb
+++ b/core/spec/lib/factlink_api/user_manager_spec.rb
@@ -6,8 +6,8 @@ DateTime.stub!(now: time)
FactlinkApi::UserManager.create_user "Gerard", "gelefiets@hotmail.com", "god1337"
@u = User.where(username: "Gerard").first
- @u.valid_password?("god1337").should be_true
- @u.email.should == "gelefiets@hotmail.com"
+ @u.encrypted_password.should == 'god1337'
+ @u.email.should == 'gelefiets@hotmail.com'
@u.confirmed_at.to_i.should == time.to_i
end
end
|
Revert "Fix UserManager Spec, check for valid_password"
This reverts commit 0080c2e92e03519a07684ca93ed123525c6e2d7e.
|
diff --git a/rakelib/node_package.rake b/rakelib/node_package.rake
index abc1234..def5678 100644
--- a/rakelib/node_package.rake
+++ b/rakelib/node_package.rake
@@ -3,12 +3,12 @@
namespace :node_package do
task :build do
- sh 'npm run build'
+ sh "npm run build"
end
desc "Has all examples and dummy apps use local node_package folder for react-on-rails node dependency"
task :symlink do
- sh_in_dir(gem_root, "npm run symlink-node-package")
+ # sh_in_dir(gem_root, "npm run symlink-node-package")
end
end
|
Disable symlinking of node package
|
diff --git a/app/controllers/api/memberships_controller.rb b/app/controllers/api/memberships_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/memberships_controller.rb
+++ b/app/controllers/api/memberships_controller.rb
@@ -9,7 +9,7 @@ end
def my_memberships
- @memberships = current_user.memberships
+ @memberships = current_user.memberships.joins(:group).order('groups.full_name ASC')
respond_with_collection
end
|
Order groups by full name in search dropdown
|
diff --git a/padrino-rpm.gemspec b/padrino-rpm.gemspec
index abc1234..def5678 100644
--- a/padrino-rpm.gemspec
+++ b/padrino-rpm.gemspec
@@ -16,6 +16,6 @@ s.summary = %q{Padrino Instrumentation for New Relic RPM}
s.files = `git ls-files`.split("\n")
- s.add_dependency(%q<newrelic_rpm>, "~> 3.3.5")
+ s.add_dependency(%q<newrelic_rpm>, "~> 3.3.3")
end
|
Maintain compatibility with newrelic ~3.3.3
As per #8 newrelic changed the signature of the dispatch methods in
3.3.3. This commit restores compatibilty with 3.3.3 and higher, closing
|
diff --git a/{{cookiecutter.role_project_name}}/spec/{{cookiecutter.role_name}}_spec.rb b/{{cookiecutter.role_project_name}}/spec/{{cookiecutter.role_name}}_spec.rb
index abc1234..def5678 100644
--- a/{{cookiecutter.role_project_name}}/spec/{{cookiecutter.role_name}}_spec.rb
+++ b/{{cookiecutter.role_project_name}}/spec/{{cookiecutter.role_name}}_spec.rb
@@ -1,6 +1,6 @@ require "spec_helper_#{ENV['SPEC_TARGET_BACKEND']}"
-describe package('python-dev'), :if => os[:family] == 'debian' do
+describe package('python-dev'), :if => ['debian', 'alpine'].include?(os[:family]) do
it { should be_installed }
end
@@ -8,6 +8,10 @@ it { should be_installed }
end
+describe package('build-base'), :if => os[:family] == 'alpine' do
+ it { should be_installed }
+end
+
describe command('which python') do
its(:exit_status) { should eq 0 }
end
|
Update spec for Alpine Linux.
|
diff --git a/app/controllers/api/v1/stats_controller.rb b/app/controllers/api/v1/stats_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/v1/stats_controller.rb
+++ b/app/controllers/api/v1/stats_controller.rb
@@ -6,15 +6,22 @@ before_action :require_api_key_or_authenticate_user!
def app
- if problem = @app.problems.order_by(:last_notice_at.desc).first
- @last_error_time = problem.last_notice_at
+ from, to = params.values_at(:from, :to)
+
+ problems_scope = @app.problems
+ problems_scope = problems_scope.where(:first_notice_at.gte => from.to_i) if from
+ problems_scope = problems_scope.where(:last_notice_at.lte => to.to_i) if to
+
+ last_error_time = if problem = problems_scope.order_by(:last_notice_at.desc).first
+ problem.last_notice_at
end
stats = {
:name => @app.name,
:id => @app.id,
- :last_error_time => @last_error_time,
- :unresolved_errors => @app.unresolved_count
+ :last_error_time => last_error_time,
+ :errors => problems_scope.count,
+ :unresolved_errors => problems_scope.unresolved.count
}
respond_to do |format|
|
Add time range params to stats action; include errors count
|
diff --git a/app/controllers/job_messages_controller.rb b/app/controllers/job_messages_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/job_messages_controller.rb
+++ b/app/controllers/job_messages_controller.rb
@@ -11,16 +11,15 @@ def get
status = ActiveJob::Status.get(params[:job_id])
if status.working?
- flash_now(:success, t('poll_job.working_message', progress: status[:progress], total: status[:total]))
+ flash_now(:notice, t('poll_job.working_message', progress: status[:progress], total: status[:total]))
else
if status.queued?
- status_msg = t('poll_job.queued')
+ flash_now(:notice,t('poll_job.queued'))
elsif status.completed?
- status_msg = t('poll_job.completed')
+ flash_now(:success, t('poll_job.completed'))
else
- status_msg = t('poll_job.failed')
+ flash_now(:error, t('poll_job.failed'))
end
- flash_now(:success, status_msg)
if status.completed? || status.failed?
session[:job_id] = nil
end
|
Use other flash keys for progress status messages
|
diff --git a/app/controllers/select_phone_controller.rb b/app/controllers/select_phone_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/select_phone_controller.rb
+++ b/app/controllers/select_phone_controller.rb
@@ -2,6 +2,8 @@ require 'evidence_query_string_builder'
class SelectPhoneController < ApplicationController
+ protect_from_forgery except: :select_phone
+
def index
@form = SelectPhoneForm.new({})
end
|
3491: Disable CSRF protection on select-phone form
This is so that requests from old frontend wont be rejected because they
do not contain the csrf value.
Authors: 4128f4e12f262ed8971b6235be968af8ca8e7344@vixus0
|
diff --git a/app/forms/backend/page_translation_form.rb b/app/forms/backend/page_translation_form.rb
index abc1234..def5678 100644
--- a/app/forms/backend/page_translation_form.rb
+++ b/app/forms/backend/page_translation_form.rb
@@ -13,5 +13,5 @@ property :seo_slug, on: :seo
validates :title, presence: true
- validates :seo_slug, presence: true
+ validates :seo_slug, presence: true # TODO only if necessary!
end
|
Add todo regarding saving the page seo.
|
diff --git a/lib/mongo_mapper/plugins/embedded_callbacks.rb b/lib/mongo_mapper/plugins/embedded_callbacks.rb
index abc1234..def5678 100644
--- a/lib/mongo_mapper/plugins/embedded_callbacks.rb
+++ b/lib/mongo_mapper/plugins/embedded_callbacks.rb
@@ -34,6 +34,9 @@ end
end
+# Need to monkey patch ActiveModel for now since it uses the internal
+# _run_validation_callbacks, which is impossible to override due to the
+# way ActiveSupport::Callbacks is implemented.
ActiveModel::Validations::Callbacks.class_eval do
def run_validations!
run_callbacks(:validation) { super }
|
Add note about ActiveModel::Validations monkey patch
|
diff --git a/piperator.gemspec b/piperator.gemspec
index abc1234..def5678 100644
--- a/piperator.gemspec
+++ b/piperator.gemspec
@@ -5,21 +5,21 @@ require 'piperator/version'
Gem::Specification.new do |spec|
- spec.name = 'piperator'
- spec.version = Piperator::VERSION
- spec.authors = ['Ville Lautanala']
- spec.email = ['lautis@gmail.com']
+ spec.name = 'piperator'
+ spec.version = Piperator::VERSION
+ spec.authors = ['Ville Lautanala']
+ spec.email = ['lautis@gmail.com']
- spec.summary = 'Composable pipelines for Enumerators.'
- spec.description = 'Composable pipelines for Enumerators.'
- spec.homepage = 'https://github.com/lautis/piperator'
- spec.license = 'MIT'
+ spec.summary = 'Composable pipelines for Enumerators.'
+ spec.description = 'Composable pipelines for Enumerators.'
+ spec.homepage = 'https://github.com/lautis/piperator'
+ spec.license = 'MIT'
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(test|spec|features)/})
end
- spec.bindir = 'exe'
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
+ spec.bindir = 'exe'
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']
spec.add_development_dependency 'bundler', '~> 1.14'
|
Remove extra spaces from gemspec
|
diff --git a/spec/chirp/runner_spec.rb b/spec/chirp/runner_spec.rb
index abc1234..def5678 100644
--- a/spec/chirp/runner_spec.rb
+++ b/spec/chirp/runner_spec.rb
@@ -26,8 +26,12 @@ $stderr = STDERR
end
- it 'does not explode' do
- expect { subject.run! }.to_not raise_error StandardError
+ %w(cpu disk memory network).each do |script_name|
+ it "runs a #{script_name} script" do
+ subject.run!
+ expect($stdout.string).to match(/Spawning.*scripts\/#{script_name}"$/)
+ expect($stdout.string).to match(/---> #{script_name} [\d\.]+s \(exit 0\)$/)
+ end
end
end
end
|
Make some assertions about script run output
|
diff --git a/spec/coffeescript_spec.rb b/spec/coffeescript_spec.rb
index abc1234..def5678 100644
--- a/spec/coffeescript_spec.rb
+++ b/spec/coffeescript_spec.rb
@@ -45,7 +45,7 @@
context "matching file extensions" do
it "matches .coffee files" do
- expect(converter.matches(".coffee")).to be_true
+ expect(converter.matches(".coffee")).to be(true)
end
end
|
Use be(true) in spec because be_true has changed.
|
diff --git a/site-cookbooks/backup_restore/spec/recipes/backup_directory_spec.rb b/site-cookbooks/backup_restore/spec/recipes/backup_directory_spec.rb
index abc1234..def5678 100644
--- a/site-cookbooks/backup_restore/spec/recipes/backup_directory_spec.rb
+++ b/site-cookbooks/backup_restore/spec/recipes/backup_directory_spec.rb
@@ -0,0 +1,20 @@+require_relative '../spec_helper'
+
+describe 'backup_restore::backup_directory' do
+ let(:chef_run) do
+ ChefSpec::Runner.new(
+ cookbook_path: %w(site-cookbooks cookbooks),
+ platform: 'centos',
+ version: '6.5'
+ ).converge(described_recipe)
+ end
+
+ it 'run full backup' do
+ log_dir = '/var/log/backup'
+ user = 'root'
+ expect(chef_run).to run_bash('run_full_backup').with(
+ code: "backup perform --trigger directory --config-file /etc/backup/config.rb --log-path=#{log_dir}",
+ user: "#{user}"
+ )
+ end
+end
|
Add chef-spec for backup_directory recipe
|
diff --git a/app/models/entry.rb b/app/models/entry.rb
index abc1234..def5678 100644
--- a/app/models/entry.rb
+++ b/app/models/entry.rb
@@ -2,14 +2,14 @@ include Mongoid::Document
include Mongoid::Timestamps
- field :script, :type => Binary
- field :score, :type => Integer
+ field :script, type: Binary
+ field :score, type: Integer
embeds_many :comments
- embedded_in :challenge, :inverse_of => :entries
+ embedded_in :challenge, inverse_of: :entries
referenced_in :user
- validates_length_of :script, :minimum => 1, :maximum => MAX_FILESIZE
+ validates_length_of :script, minimum: 1, maximum: MAX_FILESIZE
def owner?(current_user)
user == current_user
|
Use new Hash syntax in Entry model
|
diff --git a/app/models/order.rb b/app/models/order.rb
index abc1234..def5678 100644
--- a/app/models/order.rb
+++ b/app/models/order.rb
@@ -9,7 +9,7 @@ def paypal_url(return_url, notify_url)
values = {
:business => 'nina.breznik@sosed.si',
- :cmd => '_xclick',
+ :cmd => '_s-xclick',
:upload => 1,
:return => return_url,
:invoice => id,
|
Change from _xclick to _s-xclick
|
diff --git a/app/models/tweet.rb b/app/models/tweet.rb
index abc1234..def5678 100644
--- a/app/models/tweet.rb
+++ b/app/models/tweet.rb
@@ -12,6 +12,7 @@ end
def self.country_sentiment(country_code)
- tweets = Tweet.where(country_code: country_code)
+ tweets = Tweet.where("country_code = '#{country_code}' and sentiment_score is not null")
+ (tweets.pluck(:sentiment_score).inject(:+) / tweets.length).round(4)
end
end
|
Add method Tweet to get overall average sentiment for a country
|
diff --git a/myrails-docker-unicorn/spec/Dockerfile_spec.rb b/myrails-docker-unicorn/spec/Dockerfile_spec.rb
index abc1234..def5678 100644
--- a/myrails-docker-unicorn/spec/Dockerfile_spec.rb
+++ b/myrails-docker-unicorn/spec/Dockerfile_spec.rb
@@ -16,6 +16,11 @@ expect(os_version).to include("Ubuntu 16")
end
+ # This test is new
+ it "installs required packages" do
+ expect(package("nodejs")).to be_installed
+ end
+
def os_version
command("lsb_release -a").stdout
end
|
Update How_to & spec tdd file
|
diff --git a/lib/dolphy/core.rb b/lib/dolphy/core.rb
index abc1234..def5678 100644
--- a/lib/dolphy/core.rb
+++ b/lib/dolphy/core.rb
@@ -1,5 +1,5 @@-require "dolphy/router"
-require "dolphy/template_engines"
+require 'dolphy/router'
+require 'dolphy/template_engines'
require 'rack'
module Dolphy
|
Use ' instead of "
|
diff --git a/lib/mist/client.rb b/lib/mist/client.rb
index abc1234..def5678 100644
--- a/lib/mist/client.rb
+++ b/lib/mist/client.rb
@@ -12,7 +12,11 @@ timeout = args[:timeout] || 300
Mist.logger.debug "got server #{server}"
- client = MessagePack::RPC::Client.new(server, 18_800)
+ server_info = server.split(':')
+ host = server_info[0]
+ port = server_info[1] || '18800'
+
+ client = MessagePack::RPC::Client.new(host, port)
client.timeout = timeout
result = client.call(method, args)
|
Allow the Client to handle server ports
Split out the hostname & port from the server name when connecting the RPC
client.
|
diff --git a/lib/node_module.rb b/lib/node_module.rb
index abc1234..def5678 100644
--- a/lib/node_module.rb
+++ b/lib/node_module.rb
@@ -0,0 +1,51 @@+require "node_module/version"
+require 'live_ast/to_ruby'
+require 'v8'
+
+module NodeModule
+
+ def self.included(base)
+ base.extend ClassMethods
+ end
+
+ module ClassMethods
+ def node_module(*methods)
+ if methods.empty?
+ NodeModule.execute_following_methods_as_javascript!(self)
+ else
+ NodeModule.execute_methods_as_javascript!(methods, self)
+ end
+ end
+ end
+
+ module_function
+
+ def self.eval_js(js)
+ @js_ctx ||= V8::Context.new
+ @js_ctx.eval(js)
+ end
+
+ def self.execute_methods_as_javascript!(methods, receiver)
+ methods.each do |name|
+ meth = receiver.instance_method(name)
+ body = meth.to_ruby.split[2..-1].join
+
+ remove_method(meth)
+
+ receiver.define_method(name) do
+ NodeModule.eval_js(body)
+ end
+ end
+ end
+
+ def self.execute_following_methods_as_javascript!(receiver)
+ active = nil
+ receiver.define_singleton_method(:method_added) do |meth_name|
+ return if active
+ active = true
+ receiver.node_module(meth_name)
+ active = false
+ end
+ end
+
+end
|
Implement the mixin (oh my god, my eyes!)
|
diff --git a/lib/raml/parser.rb b/lib/raml/parser.rb
index abc1234..def5678 100644
--- a/lib/raml/parser.rb
+++ b/lib/raml/parser.rb
@@ -9,13 +9,26 @@ module Raml
class Parser
+ def initialize
+ Psych.add_domain_type 'include', 'include' do |_, value|
+ File.read(value)
+ end
+ end
+
def parse(yaml)
raml = YAML.load(yaml)
Raml::Parser::Root.new.parse(raml)
end
def parse_file(path)
- parse File.read(path)
+ # Change directories so that relative file !includes work properly
+ wd = Dir.pwd
+ Dir.chdir File.dirname(path)
+
+ raml = parse File.read(File.basename(path))
+
+ Dir.chdir wd
+ raml
end
def self.parse(yaml)
|
Fix includes - Psych was clearing out the !include
|
diff --git a/lib/runscope-rb.rb b/lib/runscope-rb.rb
index abc1234..def5678 100644
--- a/lib/runscope-rb.rb
+++ b/lib/runscope-rb.rb
@@ -26,7 +26,7 @@
def self.proxy_domain(address)
raise BucketNotSetError unless bucket
- subdomain = address.gsub(".","-")
+ subdomain = address.gsub("-", "--").gsub(".", "-")
"#{subdomain}-#{bucket}.runscope.net"
end
|
Replace dashes with double dashes
|
diff --git a/lib/sheet/write.rb b/lib/sheet/write.rb
index abc1234..def5678 100644
--- a/lib/sheet/write.rb
+++ b/lib/sheet/write.rb
@@ -23,7 +23,7 @@ end
def create_dir_if_doesnt_exist
- if ! Dir.exists?(Sheet.sheets_dir)
+ if ! File.directory?(Sheet.sheets_dir)
Dir.mkdir(Sheet.sheets_dir)
end
end
|
Use File.directory? for 1.8 compatibility
|
diff --git a/lib/yard-virtus.rb b/lib/yard-virtus.rb
index abc1234..def5678 100644
--- a/lib/yard-virtus.rb
+++ b/lib/yard-virtus.rb
@@ -7,3 +7,12 @@ require File.join(_dir, "yard", "virtus", "handlers")
require File.join(_dir, "yard", "virtus", "declarations")
require File.join(_dir, "yard", "virtus", "code_objects")
+
+# According to ruby conventions if library is called
+# `yard-virtus` it should be included via
+#
+# require "yard/virtus"
+#
+# But YARD plugins do not follow this convention and require
+# gem names like `yard-*` and being required by the same name.
+# Hence this confusing filename.
|
Add a little rant about library name and how it should be required
|
diff --git a/lib/emcee/resolver.rb b/lib/emcee/resolver.rb
index abc1234..def5678 100644
--- a/lib/emcee/resolver.rb
+++ b/lib/emcee/resolver.rb
@@ -1,6 +1,9 @@ module Emcee
# Resolver is responsible for interfacing with Sprockets.
class Resolver
+ attr_reader :context, :directory
+ private :context, :directory
+
def initialize(context)
@context = context
@directory = File.dirname(context.pathname)
@@ -9,13 +12,13 @@ # Declare a file as a dependency to Sprockets. The dependency will be
# included in the application's html bundle.
def require_asset(path)
- @context.require_asset(path)
+ context.require_asset(path)
end
# Return the contents of a file. Does any required processing, such as SCSS
# or CoffeeScript.
def evaluate(path)
- @context.evaluate(path)
+ context.evaluate(path)
end
# Indicate if an asset should be inlined or not. References to files at an
@@ -25,7 +28,7 @@ end
def absolute_path(path)
- File.absolute_path(path, @directory)
+ File.absolute_path(path, directory)
end
end
end
|
Use instance variables in Resolver with accessors
|
diff --git a/lib/endpoints/base.rb b/lib/endpoints/base.rb
index abc1234..def5678 100644
--- a/lib/endpoints/base.rb
+++ b/lib/endpoints/base.rb
@@ -1,4 +1,4 @@-module Endpoints
+module Transferatu::Endpoints
# The base class for all Sinatra-based endpoints. Use sparingly.
class Base < Sinatra::Base
register Pliny::Extensions::Instruments
|
Move Endpoints under proper module
|
diff --git a/lib/endpoints/base.rb b/lib/endpoints/base.rb
index abc1234..def5678 100644
--- a/lib/endpoints/base.rb
+++ b/lib/endpoints/base.rb
@@ -29,5 +29,11 @@ '{"error": "Invalid Login" }'
end
+ private
+
+ def token
+ request.env['HTTP_AUTHORIZATION']
+ end
+
end
end
|
Create a method to extract the auth token from the header
|
diff --git a/lib/filters/filter.rb b/lib/filters/filter.rb
index abc1234..def5678 100644
--- a/lib/filters/filter.rb
+++ b/lib/filters/filter.rb
@@ -5,10 +5,10 @@ attr_reader :name, :selection_policy, :selected_values
private :selection_policy, :selected_values
- def initialize(name, param_value, selection_policy)
+ def initialize(name, current_param_value, selection_policy)
@name = name
@selection_policy = selection_policy
- @selected_values = selection_policy.selected_values_from(param_value)
+ @selected_values = selection_policy.selected_values_from(current_param_value)
@filter_options = []
end
@@ -25,7 +25,7 @@ end
def current_param
- param_string(selected_options.map(&:value))
+ param_string(selected_values)
end
def param_after_toggle_for(filter_option)
|
Change the way current param is calculated
|
diff --git a/gmail-slack-notifier.gemspec b/gmail-slack-notifier.gemspec
index abc1234..def5678 100644
--- a/gmail-slack-notifier.gemspec
+++ b/gmail-slack-notifier.gemspec
@@ -23,6 +23,7 @@ spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "travis"
spec.add_development_dependency "codeclimate-test-reporter"
+ spec.add_development_dependency "rubocop"
spec.add_dependency "gmail"
spec.add_dependency "slack-notifier"
|
Add Rubocop gem to allow it to be run locally
|
diff --git a/DDMathParser.podspec b/DDMathParser.podspec
index abc1234..def5678 100644
--- a/DDMathParser.podspec
+++ b/DDMathParser.podspec
@@ -16,7 +16,7 @@ s.osx.deployment_target = '10.9'
s.watchos.deployment_target = '2.0'
- s.source_files = 'MathParser/*.{h,m,swift}'
+ s.source_files = 'MathParser/Sources/MathParser/*.{h,m,swift}'
s.requires_arc = true
s.module_name = 'MathParser'
|
Fix source_files file path in podspec
The addition of the Swift Package file changed the file path for the math parser's source files. This change updates the podspec with the new source_files file path.
|
diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake
index abc1234..def5678 100644
--- a/lib/tasks/assets.rake
+++ b/lib/tasks/assets.rake
@@ -0,0 +1,19 @@+Rake::Task['assets:precompile']
+ .clear_prerequisites
+ .enhance(['assets:compile_environment'])
+
+namespace :assets do
+ # In this task, set prerequisites for the assets:precompile task
+ task compile_environment: :webpack do
+ Rake::Task['assets:environment'].invoke
+ end
+
+ desc 'Compile assets with webpack'
+ task :webpack do
+ sh 'npm run build:client'
+ end
+
+ task :clobber do
+ rm_r Dir.glob(Rails.root.join('app/assets/webpack/*'))
+ end
+end
|
Add asset compilation task for webpack
|
diff --git a/Casks/beatport-pro.rb b/Casks/beatport-pro.rb
index abc1234..def5678 100644
--- a/Casks/beatport-pro.rb
+++ b/Casks/beatport-pro.rb
@@ -1,6 +1,6 @@ class BeatportPro < Cask
- version '2.0.5_124'
- sha256 '8c1c7dd3bc180eef7f5d12f258241522a659aab1f6dcdc8f077cf151952d1ff2'
+ version '2.1.0_133'
+ sha256 'd668c8fb82be5a5402a2470f7f65df75d08bad84352a609ea694290e29df93e2'
url "http://pro.beatport.com/mac/#{version}/beatportpro_#{version}.dmg"
homepage 'http://pro.beatport.com/'
|
Update Beatport Pro to v2.1.0
|
diff --git a/hanke-henry-calendar.gemspec b/hanke-henry-calendar.gemspec
index abc1234..def5678 100644
--- a/hanke-henry-calendar.gemspec
+++ b/hanke-henry-calendar.gemspec
@@ -19,5 +19,6 @@
gem.add_development_dependency 'rspec', '>= 2.0'
gem.add_development_dependency 'rake'
+ gem.add_development_dependency 'rdoc'
gem.add_development_dependency 'autotest'
end
|
Add rdoc as development dependency
|
diff --git a/event_store-client-http.gemspec b/event_store-client-http.gemspec
index abc1234..def5678 100644
--- a/event_store-client-http.gemspec
+++ b/event_store-client-http.gemspec
@@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'event_store-client-http'
- s.version = '0.0.3.5'
+ s.version = '0.0.4.0'
s.summary = 'HTTP Client for EventStore'
s.description = ' '
|
Package version increased from 0.0.3.5 to 0.0.4.0
|
diff --git a/frontend/app/helpers/spree/navigation_helper.rb b/frontend/app/helpers/spree/navigation_helper.rb
index abc1234..def5678 100644
--- a/frontend/app/helpers/spree/navigation_helper.rb
+++ b/frontend/app/helpers/spree/navigation_helper.rb
@@ -1,39 +1,12 @@ module Spree
module NavigationHelper
- def categories_data
- [
- {
- name: :women,
- url: nested_taxons_path('women'),
- subcategories: [
- { dresses: nested_taxons_path('women/dresses') },
- { shirts_and_blouses: nested_taxons_path('women/shirts-and-blouses') },
- { t_shirts_and_tops: nested_taxons_path('women/tops-and-t-shirts') },
- { sweaters: nested_taxons_path('women/sweaters') },
- { skirts: nested_taxons_path('women/skirts') },
- { jackets_and_coats: nested_taxons_path('women/jackets-and-coats') }
- ]
- },
- {
- name: :men,
- url: nested_taxons_path('men'),
- subcategories: [
- { shirts: nested_taxons_path('men/shirts') },
- { t_shirts: nested_taxons_path('men/t-shirts') },
- { sweaters: nested_taxons_path('men/sweaters') },
- { jackets_and_coats: nested_taxons_path('men/jackets-and-coats') }
- ]
- },
- {
- name: :sportswear,
- url: nested_taxons_path('sportswear'),
- subcategories: [
- { tops: nested_taxons_path('sportswear/tops') },
- { pants: nested_taxons_path('sportswear/pants') },
- { sweatshirts: nested_taxons_path('sportswear/sweatshirts') }
- ]
- }
- ]
+ def spree_navigation_data
+ SpreeStorefrontConfig[:navigation] || []
+ # safeguard for older Spree installs that don't have spree_navigation initializer
+ # or spree.yml file present
+ rescue
+ []
+ end
def main_nav_image(category, type)
image_path = "homepage/#{type}_#{category}.jpg"
|
Replace hardcoded categories with data fetches from spree_storefront.yaml file
|
diff --git a/app/controllers/manage/work_experiences_controller.rb b/app/controllers/manage/work_experiences_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/manage/work_experiences_controller.rb
+++ b/app/controllers/manage/work_experiences_controller.rb
@@ -5,12 +5,13 @@ respond_to :html, :json
def index
- @work_experiences = WorkExperience.page params[:page]
+ @work_experiences = policy_scope(WorkExperience).page params[:page]
respond_with(@work_experiences)
end
def new
@work_experience = WorkExperience.new
+ authorize @work_experience
respond_with(@work_experience, :location => manage_work_experiences_path)
end
@@ -19,7 +20,7 @@
def create
@work_experience = WorkExperience.new(work_experience_params)
- @work_experience.user = current_user
+ authorize @work_experience
@work_experience.save
respond_with(@work_experience, :location => manage_work_experiences_path)
end
@@ -36,11 +37,18 @@
private
def set_work_experience
- @work_experience = WorkExperience.find(params[:id])
+ @work_experience = policy_scope(WorkExperience).find(params[:id])
+ authorize @work_experience
end
def work_experience_params
- params.require(:work_experience).permit(:organization, :position, :description, :start_date, :end_date)
+ params.require(:work_experience).permit(
+ :organization,
+ :position,
+ :description,
+ :start_date,
+ :end_date
+ ).merge!(user: current_user)
end
end
end
|
Add missing authorize calls to work experiences controller
|
diff --git a/Casks/air-video-server-hd.rb b/Casks/air-video-server-hd.rb
index abc1234..def5678 100644
--- a/Casks/air-video-server-hd.rb
+++ b/Casks/air-video-server-hd.rb
@@ -1,6 +1,6 @@ cask :v1 => 'air-video-server-hd' do
- version '2.1.4'
- sha256 '7c516edccbc7556d798af330fada0498f9a57ddd91e325be69ad81c9357d241a'
+ version '2.2.0'
+ sha256 'f43c826dd5742d01e0586ad0e07edd2771353480482ac0b8eb9cc98da20a6f0e'
# amazonaws.com is the official download host per the vendor homepage
url "https://s3.amazonaws.com/AirVideoHD/Download/Air+Video+Server+HD+#{version}.dmg"
|
Update Air Video Server HD to 2.2.0
|
diff --git a/week-4/defining-variables.rb b/week-4/defining-variables.rb
index abc1234..def5678 100644
--- a/week-4/defining-variables.rb
+++ b/week-4/defining-variables.rb
@@ -0,0 +1,39 @@+#Solution Below
+
+first_name = "Brian"
+last_name = "Wagner"
+age = 39
+
+
+# RSpec Tests. They are included in this file because the local variables you are creating are not accessible across files. If we try to run these files as a separate file per normal operation, the local variable checks will return nil.
+
+
+describe 'first_name' do
+ it "is defined as a local variable" do
+ expect(defined?(first_name)).to eq 'local-variable'
+ end
+
+ it "is a String" do
+ expect(first_name).to be_a String
+ end
+end
+
+describe 'last_name' do
+ it "is defined as a local variable" do
+ expect(defined?(last_name)).to eq 'local-variable'
+ end
+
+ it "be a String" do
+ expect(last_name).to be_a String
+ end
+end
+
+describe 'age' do
+ it "is defined as a local variable" do
+ expect(defined?(age)).to eq 'local-variable'
+ end
+
+ it "is an integer" do
+ expect(age).to be_a Fixnum
+ end
+end
|
Add response to lesson 4.2.1
|
diff --git a/app/controllers/gobierto_people/person_events_controller.rb b/app/controllers/gobierto_people/person_events_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/gobierto_people/person_events_controller.rb
+++ b/app/controllers/gobierto_people/person_events_controller.rb
@@ -3,14 +3,8 @@ include PoliticalGroupsHelper
def index
- if params[:date]
- @events = filter_by_date_param
- calendar_date_range = (Date.parse(params[:date]).at_beginning_of_month - 1.week)..(Date.parse(params[:date]).at_end_of_month + 1.week)
- else
- @events = current_site.person_events.upcoming.sorted
- calendar_date_range = (Time.zone.now.at_beginning_of_month - 1.week)..(Time.zone.now.at_end_of_month + 1.week)
- end
-
+ @events = current_site.person_events.upcoming.sorted
+ @events = filter_by_date_param if params[:date]
@calendar_events = current_site.person_events.for_month_calendar(calendar_date_range)
@people = current_site.people.active.sorted
@political_groups = get_political_groups
@@ -31,5 +25,14 @@ rescue ArgumentError
@events
end
+
+ def calendar_date_range
+ if params[:start_date]
+ (Date.parse(params[:start_date]).at_beginning_of_month.at_beginning_of_week)..(Date.parse(params[:start_date]).at_end_of_month.at_end_of_week)
+ else
+ (Time.zone.now.at_beginning_of_month.at_beginning_of_week)..(Time.zone.now.at_end_of_month.at_end_of_week)
+ end
+ end
+
end
end
|
Move calendar_date_range calculation into method
|
diff --git a/spec/views/themes/index.html.haml_spec.rb b/spec/views/themes/index.html.haml_spec.rb
index abc1234..def5678 100644
--- a/spec/views/themes/index.html.haml_spec.rb
+++ b/spec/views/themes/index.html.haml_spec.rb
@@ -4,16 +4,16 @@ before(:each) do
assign(:themes, [
Theme.create!(
- :title => "Title"
+ :title => "Title1"
),
Theme.create!(
- :title => "Title"
+ :title => "Title2"
)
])
end
it "renders a list of themes" do
render
- assert_select "tr>td", :text => "Title".to_s, :count => 2
+ assert_select "tr>td", :text => /Title.*/, :count => 2
end
end
|
Fix for failed view spec
|
diff --git a/exercise-one/extended-euklid.rb b/exercise-one/extended-euklid.rb
index abc1234..def5678 100644
--- a/exercise-one/extended-euklid.rb
+++ b/exercise-one/extended-euklid.rb
@@ -0,0 +1,54 @@+# Ruby script to calculate ggT(a,b) via euklid
+@a = ARGV[0].to_i
+@b = ARGV[1].to_i
+
+# Function to validate our own implementation
+# Found on http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/77359
+def calculate_gcd(a, b)
+ a, b = b, a % b while b != 0
+ a
+end
+
+def valid_input(a, b)
+ ( a*a + b*b ) != 0
+end
+
+def a_b_positive
+ @a, @b = @a.abs, @b.abs
+end
+
+def a_larger_b
+ @a, @b = @b, @a if @b > @a
+end
+
+def diophant_solved(x, y)
+ calculate_gcd(@a, @b) == ( @a*x + @b*y)
+end
+
+def extended_euklid
+ puts "a: #{@a} b: #{@b}"
+ index = 0
+ r = Array.new
+ k = Array.new
+ r[index], r[index+1] = @a, @b
+ k[index], k[index+1] = 1, 0
+ q = Array.new
+ loop do
+ index = index+1
+ q[index] = r[index-1] / r[index]
+ r[index+1] = r[index-1] - (q[index] * r[index])
+ k[index+1] = k[index-1] - (q[index] * k[index])
+ puts "Step: r: #{r} q: #{q.compact}"
+ break if diophant_solved(k[index], (r[index] - k[index] * @a) / @b)
+ end
+ puts "x: #{k[index]}"
+ puts "y: #{(r[index] - k[index] * @a) / @b}"
+end
+
+# Main function
+if valid_input(@a, @b)
+ a_b_positive
+ a_larger_b
+ calculate_gcd(@a, @b)
+ extended_euklid
+end
|
Add own extended euklid algorithm implementation
|
diff --git a/lib/deep_cover/node/collections.rb b/lib/deep_cover/node/collections.rb
index abc1234..def5678 100644
--- a/lib/deep_cover/node/collections.rb
+++ b/lib/deep_cover/node/collections.rb
@@ -2,6 +2,7 @@
module DeepCover
class Node::Array < Node
+ include NodeBehavior::CoverWithNextInstruction
include NodeBehavior::CoverEntry
Static = Node::Literal
|
Make Array smarter. Fixes cases without the square brackets
|
diff --git a/lib/scss_lint/linter/hex_format.rb b/lib/scss_lint/linter/hex_format.rb
index abc1234..def5678 100644
--- a/lib/scss_lint/linter/hex_format.rb
+++ b/lib/scss_lint/linter/hex_format.rb
@@ -1,24 +1,20 @@ module SCSSLint
class Linter::HexFormat < Linter
include LinterRegistry
-
- def visit_prop(node)
- if node.value.is_a?(Sass::Script::String) &&
- node.value.type == :identifier
-
- node.value.value.scan(HEX_REGEX) do |match|
- add_hex_lint(node, match.first) unless valid_hex_format?(match.first)
- end
- end
-
- yield # Continue visiting children
- end
def visit_script_color(node)
return unless node.original && node.original.match(HEX_REGEX)
unless valid_hex_format?(node.original[HEX_REGEX, 1])
add_hex_lint(node, node.original)
+ end
+ end
+
+ def visit_script_string(node)
+ return unless node.type == :identifier
+
+ node.value.scan(HEX_REGEX) do |match|
+ add_hex_lint(node, match.first) unless valid_hex_format?(match.first)
end
end
|
Simplify HexFormat linter string searching
The `HexFormat` linter was using `visit_prop` with a manual check to see
if the value of the property was a `Sass::Script::String`, rather than
just using `visit_script_string`.
Switching to `visit_script_string` simplifies the code.
Change-Id: I84a64b97071b74d9d37ff40360f4683a2e557368
Reviewed-on: https://gerrit.causes.com/29015
Tested-by: jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@causes.com>
Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com>
|
diff --git a/lib/whatsapp/protocol/keystream.rb b/lib/whatsapp/protocol/keystream.rb
index abc1234..def5678 100644
--- a/lib/whatsapp/protocol/keystream.rb
+++ b/lib/whatsapp/protocol/keystream.rb
@@ -22,7 +22,7 @@
def decode(data)
# TODO: Hash check
- @rc4.decrypt(data.byteslice(4..-1))
+ @rc4.decrypt(data.byteslice(4..-1) || '')
end
end
|
Fix problem with chunked stanza
|
diff --git a/lib/extensions/drivers_license_invalid_validator.rb b/lib/extensions/drivers_license_invalid_validator.rb
index abc1234..def5678 100644
--- a/lib/extensions/drivers_license_invalid_validator.rb
+++ b/lib/extensions/drivers_license_invalid_validator.rb
@@ -1,17 +1,16 @@-class DriversLicenseInvalidValidator < ActiveModel::Validator
+class DriversLicenseInvalidValidator
def validate(record)
if !@options[:attributes].include?(:drivers_license_number)
- record.errors.add(:base, 'Missing required supplied attribute drivers_license_number')
+ record.errors.add(:base, 'Missing required attribute drivers_license_number')
elsif !@options[:attributes].include?(:drivers_license_state)
- record.errors.add(:base, 'Missing required supplied attribute drivers_license_state')
- elsif record.drivers_license_number.nil?
- record.errors.add(:drivers_license_number, 'Attribute drivers_license_number cannot be blank.')
- elsif record.drivers_license_state.nil?
- record.errors.add(:drivers_license_state, 'Attribute drivers_license_state cannot be blank.')
+ record.errors.add(:base, 'Missing required attribute drivers_license_state')
+ elsif record.drivers_license_number.blank?
+ record.errors.add(:drivers_license_number, 'cannot be blank.')
+ elsif record.drivers_license_state.blank?
+ record.errors.add(:drivers_license_state, 'cannot be blank.')
else
invalid = DlValidator.invalid?(record.drivers_license_number, record.drivers_license_state)
record.errors.add(:base, 'Drivers license is invalid.') if invalid
end
end
end
-
|
Change from .nil? to .blank?
|
diff --git a/lib/generators/georgia/upgrade/upgrade_generator.rb b/lib/generators/georgia/upgrade/upgrade_generator.rb
index abc1234..def5678 100644
--- a/lib/generators/georgia/upgrade/upgrade_generator.rb
+++ b/lib/generators/georgia/upgrade/upgrade_generator.rb
@@ -1,16 +1,18 @@ # encoding: UTF-8
require 'rails/generators/migration'
+require 'rails/generators/active_record'
module Georgia
module Generators
class UpgradeGenerator < ::Rails::Generators::Base
include Rails::Generators::Migration
+
source_root File.expand_path('../templates', __FILE__)
desc "Upgrades Georgia CMS to fit latest changes"
- def self.next_migration_number(dirname)
- Time.now.strftime("%Y%m%d%H%M%S")
+ def self.next_migration_number(number)
+ ActiveRecord::Generators::Base.next_migration_number(number)
end
def create_migration
|
Fix same migration number error
|
diff --git a/lib/human_attribute_values/human_attribute_value.rb b/lib/human_attribute_values/human_attribute_value.rb
index abc1234..def5678 100644
--- a/lib/human_attribute_values/human_attribute_value.rb
+++ b/lib/human_attribute_values/human_attribute_value.rb
@@ -37,10 +37,10 @@ defaults << value.to_s
options[:default] = defaults
- I18n.translate(defaults.shift, **options)
+ I18n.t(defaults.shift, **options)
end
end
end
-ActiveRecord::Base.send :include, HumanAttributeValues
-ActiveModel::Model.send :include, HumanAttributeValues
+ActiveRecord::Base.include HumanAttributeValues
+ActiveModel::Model.include HumanAttributeValues
|
Tidy up code a bit
|
diff --git a/QuadernoKit.podspec b/QuadernoKit.podspec
index abc1234..def5678 100644
--- a/QuadernoKit.podspec
+++ b/QuadernoKit.podspec
@@ -11,7 +11,7 @@ s.platform = :ios, '6.1'
s.public_header_files = 'QuadernoKit/*.h'
- s.source_files = 'QuadernoKit/QuadernoKit.h'
+ s.source_files = 'QuadernoKit/QuadernoKit.h', 'QuadernoKit/RECQuaderno*'
s.dependency 'AFNetworking', '~> 2.0'
end
|
Include more source files in CocoaPods specification
|
diff --git a/lib/rock_rms/resources/recurring_donation_detail.rb b/lib/rock_rms/resources/recurring_donation_detail.rb
index abc1234..def5678 100644
--- a/lib/rock_rms/resources/recurring_donation_detail.rb
+++ b/lib/rock_rms/resources/recurring_donation_detail.rb
@@ -5,15 +5,17 @@ module RecurringDonationDetail
def create_recurring_donation_detail(
recurring_donation_id:,
+ fee_coverage_amount: nil,
fund_id:,
amount:
)
-
options = {
'AccountId' => fund_id,
'Amount' => amount,
'ScheduledTransactionId' => recurring_donation_id
}
+
+ options['FeeCoverageAmount'] = fee_coverage_amount if fee_coverage_amount
post(recurring_donation_detail_path, options)
end
|
Add FeeCoverageAmount when creating recurring donation detail
|
diff --git a/lib/trysail_blog_notification/parser/base_parser.rb b/lib/trysail_blog_notification/parser/base_parser.rb
index abc1234..def5678 100644
--- a/lib/trysail_blog_notification/parser/base_parser.rb
+++ b/lib/trysail_blog_notification/parser/base_parser.rb
@@ -15,6 +15,7 @@ # @param [Nokogiri::HTML::Document] nokogiri
# @return [TrySailBlogNotification::LastArticle]
def parse(nokogiri)
+ raise NotImplementedError, "You must implement #{self.class}##{__method__}"
end
private
|
Raise NotImplementedError in parse method
|
diff --git a/RKXMLReaderSerialization.podspec b/RKXMLReaderSerialization.podspec
index abc1234..def5678 100644
--- a/RKXMLReaderSerialization.podspec
+++ b/RKXMLReaderSerialization.podspec
@@ -1,6 +1,6 @@ Pod::Spec.new do |s|
s.name = "RKXMLReaderSerialization"
- s.version = "0.20.0"
+ s.version = "0.1.0"
s.summary = "A RestKit serialization format implementation for XML using XMLReader."
s.homepage = "https://github.com/RestKit/RKXMLReaderSerialization"
s.license = { :type => 'Apache', :file => 'LICENSE'}
@@ -10,7 +10,7 @@ s.ios.deployment_target = '5.0'
s.osx.deployment_target = '10.7'
- s.source = { :git => "https://github.com/RestKit/RKXMLReaderSerialization.git" }
+ s.source = { :git => "https://github.com/RestKit/RKXMLReaderSerialization.git", :tag => 'v0.1.0' }
s.source_files = '*.{h,m}'
s.dependency 'RestKit', '>= 0.20.0dev'
|
Switch version to 0.0.1 and add tag to Podspec
|
diff --git a/multi_json.gemspec b/multi_json.gemspec
index abc1234..def5678 100644
--- a/multi_json.gemspec
+++ b/multi_json.gemspec
@@ -13,7 +13,7 @@ spec.licenses = ['MIT']
spec.name = 'multi_json'
spec.require_paths = ['lib']
- spec.required_rubygems_version = Gem::Requirement.new(">= 1.3.6")
+ spec.required_rubygems_version = '>= 1.3.6'
spec.summary = %q{A gem to provide swappable JSON backends.}
spec.test_files = Dir['spec/**/*']
spec.version = MultiJson::VERSION
|
Use of custom objects is not necessary here
|
diff --git a/app/helpers/jwt_helper.rb b/app/helpers/jwt_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/jwt_helper.rb
+++ b/app/helpers/jwt_helper.rb
@@ -22,6 +22,7 @@ attrs[:tool_consumer_instance_guid] = params[:tool_consumer_instance_guid]
attrs[:context_id] = params[:context_id]
attrs[:lms_course_id] = params[:custom_canvas_course_id]
+ attrs[:lms_account_id] = params[:custom_canvas_account_id]
attrs[:kid] = params[:oauth_consumer_key]
end
|
feature: Add Canvas account ID to the JWT
We need a secure way to determine the account ID associated with the request. Storing it in the JWT on the LTI launch will allow us to do this.
|
diff --git a/app/models/forem/forum.rb b/app/models/forem/forum.rb
index abc1234..def5678 100644
--- a/app/models/forem/forum.rb
+++ b/app/models/forem/forum.rb
@@ -19,7 +19,7 @@ alias_attribute :title, :name
# Fix for #339
- default_scope { order('name ASC') }
+ default_scope { order(:name) }
def last_post_for(forem_user)
if forem_user && (forem_user.forem_admin? || moderator?(forem_user))
|
Update Forem::Forum order in the default_scope
Fix to avoid ambiguous column errors
Fixes #533
Fixes #529
|
diff --git a/app/models/reservation.rb b/app/models/reservation.rb
index abc1234..def5678 100644
--- a/app/models/reservation.rb
+++ b/app/models/reservation.rb
@@ -24,7 +24,7 @@
enum status: %w(disapproved pending approved)
- validates :item_id, presence: true
+ validates :item, presence: true
validates :count, numericality: { only_integer: true, greater_than: 0 }
before_save :change_status
|
Validate association instead of attribute
|
diff --git a/app/models/spree/sound.rb b/app/models/spree/sound.rb
index abc1234..def5678 100644
--- a/app/models/spree/sound.rb
+++ b/app/models/spree/sound.rb
@@ -3,14 +3,16 @@
validate :no_attachment_errors
- has_attached_file :attachment,
- presence: true,
- styles: {
- mp3: { format: :mp3, bitrate: "192K", samplerate: 44100 },
- },
+ has_attached_file :attachment,
+ styles: {
+ mp3: { format: :mp3, bitrate: "192K", samplerate: 44100 },
+ },
processors: [:audio_convert],
url: "/spree/sounds/:id/:style/:basename.:extension",
path: ":rails_root/public/spree/sounds/:id/:style/:basename.:extension"
+ validates_attachment :attachment,
+ :presence => true,
+ :content_type => { :content_type => /\Aaudio/ }
before_post_process :skip_invalid_audio
|
Add security validation as required by paperclip 4.0.0 and later
https://github.com/thoughtbot/paperclip#security-validations
|
diff --git a/atomic.gemspec b/atomic.gemspec
index abc1234..def5678 100644
--- a/atomic.gemspec
+++ b/atomic.gemspec
@@ -7,7 +7,7 @@ s.date = Time.now.strftime('YYYY-MM-DD')
s.description = "An atomic reference implementation for JRuby and green or GIL-threaded impls"
s.email = ["headius@headius.com", "mental@rydia.net"]
- s.files = Dir['{lib,examples,test}/**/*'] + Dir['{*.txt,*.gemspec,Rakefile}']
+ s.files = Dir['{lib,examples,test,ext}/**/*'] + Dir['{*.txt,*.gemspec,Rakefile}']
s.homepage = "http://github.com/headius/ruby-atomic"
s.require_paths = ["lib"]
s.summary = "An atomic reference implementation for JRuby and green or GIL-threaded impls"
|
Add ext dir for Java stuff.
|
diff --git a/Casks/handbrakecli-nightly.rb b/Casks/handbrakecli-nightly.rb
index abc1234..def5678 100644
--- a/Casks/handbrakecli-nightly.rb
+++ b/Casks/handbrakecli-nightly.rb
@@ -1,6 +1,6 @@ cask :v1 => 'handbrakecli-nightly' do
- version '6509svn'
- sha256 '5beb028c999cebf8112413c46821b348d2584139fbe2070704522ade45c44e63'
+ version '6536svn'
+ sha256 'e0efe336b287ae5df4b592b74434a6c61cdfda9affea8409fd8bba03034bc82d'
url "http://download.handbrake.fr/nightly/HandBrake-#{version}-MacOSX.6_CLI_x86_64.dmg"
homepage 'http://handbrake.fr'
|
Update HandbrakeCLI Nightly to v6536svn
HandBrakeCLI Nightly Build 6536svn released 2014-11-21.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.