diff stringlengths 65 26.7k | message stringlengths 7 9.92k |
|---|---|
diff --git a/example/send-get-request.rb b/example/send-get-request.rb
index abc1234..def5678 100644
--- a/example/send-get-request.rb
+++ b/example/send-get-request.rb
@@ -3,22 +3,43 @@ # Simple get request example.
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
+require 'ostruct'
+require 'optparse'
require 'rubygems'
require 'meac_control'
require 'httpclient'
-host = ARGV.shift
-deviceid = ARGV.shift
+options = OpenStruct.new
+options.commands = []
-unless host and deviceid
- puts "Usage: #{File.basename(__FILE__)} <ip-address> <device-id>"
+opts = OptionParser.new do |o|
+ o.banner = "Usage: #{File.basename(__FILE__)} [options]"
+
+ o.on('-i', '--ip-address IP', 'IP address of the webhost') do |value|
+ options.ip = value
+ end
+
+ o.on('-d', '--device ID', 'Device id') do |value|
+ options.device = MEACControl::Device.new(value)
+ end
+
+ o.on('--query-drive', 'Query wheter the AC is on or off') do
+ options.commands << MEACControl::Command::Drive.request
+ end
+
+ o.on('--query-fan-speed', 'Query the AC fan speed') do
+ options.commands << MEACControl::Command::FanSpeed.request
+ end
+end
+opts.parse!
+
+unless options.ip and options.device and !options.commands.empty?
+ puts opts.banner
+ puts opts.summarize
exit 1
end
-command = [MEACControl::Command::Drive.request, MEACControl::Command::FanSpeed.request]
-device = MEACControl::Device.new(deviceid)
-
-xml = MEACControl::XML::GetRequest.new(device, command)
+xml = MEACControl::XML::GetRequest.new(options.device, options.commands)
puts "########### get request ###########"
puts xml.to_xml
@@ -29,7 +50,7 @@ client = HTTPClient.new
client.protocol_version = 'HTTP/1.0'
client.agent_name = 'meac_control/1.0'
-response = client.post("http://#{host}/servlet/MIMEReceiveServlet", xml.to_xml, header)
+response = client.post("http://#{options.ip}/servlet/MIMEReceiveServlet", xml.to_xml, header)
puts "########### get response ###########"
puts response.content
| Use a real options parser.
|
diff --git a/lib/dooie.rb b/lib/dooie.rb
index abc1234..def5678 100644
--- a/lib/dooie.rb
+++ b/lib/dooie.rb
@@ -1,5 +1,57 @@ require "dooie/version"
module Dooie
- # Your code goes here...
+ class TodoFinder
+
+ TODO_PATTERNS = [/#+(\s)*TODO(\:)*/i]
+ TODO_FILE_HEADER = "Here are your TODO items \n"
+
+ def initialize
+ @todo_items = find_todo_items
+ @todo_file = File.new('todo_items.txt', 'w')
+ end
+
+ def run
+ create_todo_file(@todo_items)
+ end
+
+ def create_todo_file(todo_items)
+ todo_items.each do |item|
+ @todo_file.write(item)
+ end
+ end
+
+ def extract_and_format_todos(line)
+ clean_line = line.scan(/#.*/).first
+ TODO_PATTERNS.each do |pattern|
+ clean_line.gsub!(pattern,'').strip!
+ end
+ clean_line
+ end
+
+ def find_todo_items
+ todo_items = []
+
+ files_with_todos.each do |file|
+ text = File.read(file)
+ text.each_line do |line|
+ next unless TODO_PATTERNS.any?{ |pattern| line =~ pattern }
+ todo_items << "[] #{extract_and_format_todos(line)} \n"
+ end
+ end
+
+ todo_items
+ end
+
+ def files_with_todos
+ files_with_todos = []
+
+ Dir['**/*.rb'].each do |file|
+ text = File.read(file)
+ files_with_todos << file if TODO_PATTERNS.any?{ |pattern| text =~ pattern }
+ end
+
+ files_with_todos
+ end
+ end
end
| Add all the magic to create todo_files
|
diff --git a/cookbooks/windows/recipes/default.rb b/cookbooks/windows/recipes/default.rb
index abc1234..def5678 100644
--- a/cookbooks/windows/recipes/default.rb
+++ b/cookbooks/windows/recipes/default.rb
@@ -33,27 +33,4 @@ end
end
-# Webtrends System Setup
-#Install SNMP feature
-windows_feature "SNMP-Service"
- action :install
-end
-
-#Install Powershell feature
-windows_feature "PowerShell-ISE"
- action :install
-end
-
-#Install .NET 3.5.1
-windows_feature "NET-Framework-Core"
- action :install
-end
-
-
-#Install MSMQ
-windows_feature "MSMQ-Server"
- action :install
-end
-
-
| Remove Webtrends server config out of the Windows cookbook
|
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
@@ -1,3 +1,6 @@+# wait for squid to be started
+sleep 15
+
describe port(3128) do
it { should be_listening }
end
| Add a sleep before we check the port
Squid takes a while to start up
Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
|
diff --git a/test/integration/links_for_ads_test.rb b/test/integration/links_for_ads_test.rb
index abc1234..def5678 100644
--- a/test/integration/links_for_ads_test.rb
+++ b/test/integration/links_for_ads_test.rb
@@ -6,7 +6,7 @@ class LinksForAds < ActionDispatch::IntegrationTest
include WebMocking
- before { @ad = create(:ad, comments_enabled: true) }
+ before { @ad = create(:ad) }
it 'shows message link in available ads' do
@ad.update(status: :available)
| Remove unnecessary creation parameter in a test
|
diff --git a/manageiq-providers-ovirt.gemspec b/manageiq-providers-ovirt.gemspec
index abc1234..def5678 100644
--- a/manageiq-providers-ovirt.gemspec
+++ b/manageiq-providers-ovirt.gemspec
@@ -15,7 +15,7 @@
s.add_runtime_dependency "ovirt", "~>0.18.0"
s.add_runtime_dependency "parallel", "~>1.9" # For ManageIQ::Providers::Ovirt::Legacy::Inventory
- s.add_runtime_dependency "ovirt-engine-sdk", "~>4.1.13"
+ s.add_runtime_dependency "ovirt-engine-sdk", "~>4.2.0"
s.add_development_dependency "codeclimate-test-reporter", "~> 1.0.0"
s.add_development_dependency "simplecov"
| Update to version 4.2.0 of the oVirt Ruby SDK
This version of the SDK is backwards compatible with the previous one,
but it also introduces support for the features that have been added to
oVirt in version 4.2.
The more relevant change in the SDK itself is the addition of exceptions
specific for authentication failures and timeouts, which are convenient
to simplify error handling in the provider.
Signed-off-by: Juan Hernandez <59e5b8140de97cc91c3fb6c5342dce948469af8c@redhat.com>
|
diff --git a/parser_spec.rb b/parser_spec.rb
index abc1234..def5678 100644
--- a/parser_spec.rb
+++ b/parser_spec.rb
@@ -27,13 +27,15 @@ read_test_file("haku.action")
end
- def read_test_file(filename)
- f = File.new("testhtml/" + filename + ".html")
- contents = ""
- while (line = f.gets)
- contents += line
- end
- f.close
- contents
+end
+
+
+def read_test_file(filename)
+ f = File.new("testhtml/" + filename + ".html")
+ contents = ""
+ while (line = f.gets)
+ contents += line
end
+ f.close
+ contents
end | Move helper to outer context to be shared
Signed-off-by: Aki Saarinen <278bc57fbbff6b7b38435aea0f9d37e3d879167e@akisaarinen.fi>
|
diff --git a/stitches.gemspec b/stitches.gemspec
index abc1234..def5678 100644
--- a/stitches.gemspec
+++ b/stitches.gemspec
@@ -11,6 +11,7 @@ s.homepage = "https://github.com/stitchfix/stitches"
s.summary = "You'll be in stitches at how easy it is to create a service at Stitch Fix"
s.description = "You'll be in stitches at how easy it is to create a service at Stitch Fix"
+ s.license = "MIT"
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
| Add license to gemspec, is MIT |
diff --git a/SwinjectPropertyLoader.podspec b/SwinjectPropertyLoader.podspec
index abc1234..def5678 100644
--- a/SwinjectPropertyLoader.podspec
+++ b/SwinjectPropertyLoader.podspec
@@ -1,6 +1,6 @@ Pod::Spec.new do |s|
s.name = "SwinjectPropertyLoader"
- s.version = "1.0.0-beta.1"
+ s.version = "1.0.0-beta.2"
s.summary = "Swinject extension to load property values from resources"
s.description = <<-DESC
SwinjectPropertyLoader is an extension of Swinject to load property values from resources that are bundled with your application/framework.
@@ -15,6 +15,6 @@ s.osx.deployment_target = '10.10'
s.watchos.deployment_target = '2.0'
s.tvos.deployment_target = '9.0'
- s.dependency 'Swinject', '2.0.0-beta.1'
+ s.dependency 'Swinject', '2.0.0-beta.2'
s.requires_arc = true
end
| Set the version number to v1.0.0-beta.2.
|
diff --git a/app/admin/units.rb b/app/admin/units.rb
index abc1234..def5678 100644
--- a/app/admin/units.rb
+++ b/app/admin/units.rb
@@ -12,12 +12,14 @@ end
filter :army
+ filter :unit_category
filter :name
filter :value_points
index do
column :id
column :army
+ column :unit_category
column :name
column :min_size
column :max_size
| Add unit category column and filter to unit panel
|
diff --git a/lib/musicscraper/boomkat/recommended_new.rb b/lib/musicscraper/boomkat/recommended_new.rb
index abc1234..def5678 100644
--- a/lib/musicscraper/boomkat/recommended_new.rb
+++ b/lib/musicscraper/boomkat/recommended_new.rb
@@ -1,8 +1,14 @@ module Musicscraper
module Boomkat
class RecommendedNew
- def self.boomkat_all
- new.all
+ attr_reader :genre
+
+ def initialize(genre='')
+ @genre = genre
+ end
+
+ def self.boomkat_all(genre='')
+ new(genre).all
end
def all
@@ -37,7 +43,33 @@ end
def boomkat_url
- 'https://boomkat.com/new-releases?q[status]=recommended'
+ "https://boomkat.com/new-releases?q[status]=recommended&q[genre]=#{genre_map}"
+ end
+
+ def genre_map
+ genres[genre]
+ end
+
+ def genres
+ {
+ 'Dub Techno' => 62,
+ 'Hip-Hop' => 54,
+ 'Dark Ambient/Drone' => 57,
+ 'Disco/Funk' => 45,
+ 'Dub' => 55,
+ 'Early Electronic/Soundtrack' => 51,
+ 'Electronic' => 46,
+ 'Noise' => 56,
+ 'Folk' => 60,
+ 'Grime' => 52,
+ 'Indie/Alternative' => 49,
+ 'Industrial' => 47,
+ 'Jazz' => 58,
+ 'Jungle/Footwork' => 50,
+ 'Ambient/Modern Classical' => 44,
+ 'Techno/House' => 48,
+ 'World' => 53
+ }
end
end
end
| Add genre selection to Boomkat
|
diff --git a/lib/amanuensis/generator.rb b/lib/amanuensis/generator.rb
index abc1234..def5678 100644
--- a/lib/amanuensis/generator.rb
+++ b/lib/amanuensis/generator.rb
@@ -5,9 +5,9 @@ check_required_configuration!
CodeManager.use configuration.code_manager
- push build
+ success = push build
- create_release
+ create_release if success.all?
end
private
@@ -17,7 +17,7 @@ end
def push(changelog)
- push.each do |type|
+ push.map do |type|
Push.use type
Push.run
end
| Create release if push succeed
|
diff --git a/lib/horza/core_extensions/string.rb b/lib/horza/core_extensions/string.rb
index abc1234..def5678 100644
--- a/lib/horza/core_extensions/string.rb
+++ b/lib/horza/core_extensions/string.rb
@@ -12,14 +12,6 @@ def symbolize
underscore.to_sym
end
-
- def underscore
- gsub(/::/, '/')
- .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
- .gsub(/([a-z\d])([A-Z])/, '\1_\2')
- .tr('-', '_')
- .downcase
- end
end
end
end
| Remove :underscore method as it is not needed or being called.
Because of the dependency load order, the actual method being
called is the one defined in /active_support/core_ext/string/inflections.rb
|
diff --git a/app/models/game.rb b/app/models/game.rb
index abc1234..def5678 100644
--- a/app/models/game.rb
+++ b/app/models/game.rb
@@ -1,7 +1,7 @@ class Game < ActiveRecord::Base
has_many :players, dependent: :destroy
validates_each :players do |game, attr, value|
- game.errors.add :base, :game_is_full if game.players.size >= game.number_of_players
+ game.errors.add :base, :game_is_full if game.players.size > game.number_of_players
end
validates :number_of_players, numericality: { only_integer: true, greater_than_or_equal_to: 2, less_than_or_equal_to: Player.pieces.count }
end
| Fix features on max users
|
diff --git a/app/controllers/questions_controller.rb b/app/controllers/questions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/questions_controller.rb
+++ b/app/controllers/questions_controller.rb
@@ -5,7 +5,7 @@ def index
@activities = PublicActivity::Activity.order('created_at DESC').limit(20)
@search = Question.search(params[:q])
- @questions = @search.result(:distinct => true).page(params[:page])
+ @questions = @search.result(:distinct => true).order('updated_at DESC').page(params[:page])
end
def show
| Order collection by updated date
|
diff --git a/lib/hash_diff/comparison.rb b/lib/hash_diff/comparison.rb
index abc1234..def5678 100644
--- a/lib/hash_diff/comparison.rb
+++ b/lib/hash_diff/comparison.rb
@@ -1,6 +1,12 @@ module HashDiff
- class Comparison < Struct.new(:left, :right)
-
+ class Comparison
+ def initialize(left, right)
+ @left = left
+ @right = right
+ end
+
+ attr_reader :left, :right
+
def diff
@diff ||= find_differences { |l, r| [l, r] }
end
| Drop a bunch of methods we no longer rely one, mainly the writers.
|
diff --git a/lib/tasks/scans/refresh_scores.rake b/lib/tasks/scans/refresh_scores.rake
index abc1234..def5678 100644
--- a/lib/tasks/scans/refresh_scores.rake
+++ b/lib/tasks/scans/refresh_scores.rake
@@ -0,0 +1,16 @@+namespace :headlines do
+ namespace :scans do
+ desc "Refresh domain scan scores"
+ task refresh_scores: :environment do
+ header = Struct.new(:name, :score)
+
+ Headlines::Scan.find_each do |scan|
+ score = Headlines::GenerateScanResultsHash.call(
+ headers: scan.results.map { |(name, value)| header.new(name, value.to_i) }
+ ).score
+
+ scan.update_attributes!(score: score)
+ end
+ end
+ end
+end
| Add task to refresh scan results
|
diff --git a/lib/llt/form_builder/api.rb b/lib/llt/form_builder/api.rb
index abc1234..def5678 100644
--- a/lib/llt/form_builder/api.rb
+++ b/lib/llt/form_builder/api.rb
@@ -12,4 +12,7 @@ forms = LLT::FormBuilder.build(*request_json)
json(forms);
end
+
+ options '/generate' do
+ end
end
| Add options to allow cross origin POSTs
|
diff --git a/lib/sass/tree/while_node.rb b/lib/sass/tree/while_node.rb
index abc1234..def5678 100644
--- a/lib/sass/tree/while_node.rb
+++ b/lib/sass/tree/while_node.rb
@@ -1,14 +1,26 @@ require 'sass/tree/node'
module Sass::Tree
+ # A dynamic node representing a Sass `@while` loop.
+ #
+ # @see Sass::Tree
class WhileNode < Node
+ # @param expr [Script::Node] The parse tree for the continue expression
+ # @param options [Hash<Symbol, Object>] An options hash;
+ # see [the Sass options documentation](../../Sass.html#sass_options)
def initialize(expr, options)
@expr = expr
super(options)
end
- private
+ protected
+ # Runs the child nodes until the continue expression becomes false.
+ #
+ # @param environment [Sass::Environment] The lexical environment containing
+ # variable and mixin values
+ # @return [Array<Tree::Node>] The resulting static nodes
+ # @see Sass::Tree
def _perform(environment)
children = []
new_environment = Sass::Environment.new(environment)
| [Sass] Convert Sass::Tree::WhileNode docs to YARD.
|
diff --git a/library/monitor/synchronize_spec.rb b/library/monitor/synchronize_spec.rb
index abc1234..def5678 100644
--- a/library/monitor/synchronize_spec.rb
+++ b/library/monitor/synchronize_spec.rb
@@ -31,4 +31,9 @@ it "raises a LocalJumpError if not passed a block" do
-> {Monitor.new.synchronize }.should raise_error(LocalJumpError)
end
+
+ it "raises a thread error if the monitor is not owned on exiting the block" do
+ monitor = Monitor.new
+ -> { monitor.synchronize { monitor.exit } }.should raise_error(ThreadError)
+ end
end
| Raise error if monitor not owned when leaving synchronization block.
|
diff --git a/config/unicorn.rb b/config/unicorn.rb
index abc1234..def5678 100644
--- a/config/unicorn.rb
+++ b/config/unicorn.rb
@@ -1,8 +1,20 @@-# https://devcenter.heroku.com/articles/rails-unicorn
require 'redis'
-worker_processes 3
-timeout 15
+app_path = File.expand_path(File.dirname(__FILE__) + '/..')
+working_directory = app_path
+
+worker_processes (ENV["UNICORN_WORKERS"] || 3).to_i
+
+listen (ENV["UNICORN_PORT"] || 3000).to_i
+
+if ENV["RAILS_ENV"] == "production"
+ stderr_path "#{app_path}/log/unicorn.stderr.log"
+ stdout_path "#{app_path}/log/unicorn.stdout.log"
+ pid "#{app_path}/tmp/pids/unicorn.pid"
+end
+
+timeout 30
+
preload_app true
before_fork do |server, worker|
| Update Unicorn's config for production.
|
diff --git a/lib/appium_console.rb b/lib/appium_console.rb
index abc1234..def5678 100644
--- a/lib/appium_console.rb
+++ b/lib/appium_console.rb
@@ -7,8 +7,10 @@
def define_reload
Pry.send(:define_singleton_method, :reload) do
- files = load_appium_txt file: Dir.pwd + '/appium.txt'
- files.each do |file|
+ parsed = load_appium_txt file: Dir.pwd + '/appium.txt'
+ return unless parsed && parsed[:appium_lib] && parsed[:appium_lib][:requires]
+ requires = parsed[:appium_lib][:requires]
+ requires.each do |file|
# If a page obj is deleted then load will error.
begin
load file
| Update to work with new appium_lib gem
|
diff --git a/spawn.gemspec b/spawn.gemspec
index abc1234..def5678 100644
--- a/spawn.gemspec
+++ b/spawn.gemspec
@@ -22,7 +22,7 @@ exclude_folders = 'spec/rails/{doc,lib,log,nbproject,tmp,vendor,test}'
exclude_files = Dir['**/*.log'] + Dir[exclude_folders+'/**/*'] + Dir[exclude_folders]
s.files = Dir['{examples,lib,tasks,spec}/**/*'] +
- %w(CHANGELOG init.rb LICENSE Rakefile README) -
+ %w(CHANGELOG init.rb LICENSE README.markdown) -
exclude_files
s.require_paths = ["lib"]
end
| Fix file list in gemspec
|
diff --git a/arg-parser.gemspec b/arg-parser.gemspec
index abc1234..def5678 100644
--- a/arg-parser.gemspec
+++ b/arg-parser.gemspec
@@ -1,6 +1,6 @@ GEMSPEC = Gem::Specification.new do |s|
s.name = "arg-parser"
- s.version = "0.2"
+ s.version = "0.2.1"
s.authors = ["Adam Gardiner"]
s.date = "2013-08-11"
s.summary = "ArgParser is a simple, yet powerful, command-line argument (option) parser"
| Update version number to 0.2.1
|
diff --git a/lib/feedcellar/gui.rb b/lib/feedcellar/gui.rb
index abc1234..def5678 100644
--- a/lib/feedcellar/gui.rb
+++ b/lib/feedcellar/gui.rb
@@ -1,6 +1,10 @@ module Feedcellar
class GUI
class << self
+ def available?
+ gui_available?
+ end
+
def show_uri(uri)
Gtk.show_uri(uri) if gui_available?
end
| Add a GUI available check method
|
diff --git a/lib/jekyll/command.rb b/lib/jekyll/command.rb
index abc1234..def5678 100644
--- a/lib/jekyll/command.rb
+++ b/lib/jekyll/command.rb
@@ -3,7 +3,7 @@ def self.globs(source, destination)
Dir.chdir(source) do
dirs = Dir['*'].select { |x| File.directory?(x) }
- dirs -= [destination]
+ dirs -= [destination, File.realpath(destination), File.basename(destination)]
dirs = dirs.map { |x| "#{x}/**/*" }
dirs += ['*']
end
| Fix bug where Command.globs didn't delete the destination directory.
There was often a mix between absolute and relative paths and in the
previous version, the destination argument was usually an absolute
path where the glob array (from Dir['*']) was a relative path.
|
diff --git a/lib/piston/version.rb b/lib/piston/version.rb
index abc1234..def5678 100644
--- a/lib/piston/version.rb
+++ b/lib/piston/version.rb
@@ -2,7 +2,7 @@ module VERSION #:nodoc:
MAJOR = 1
MINOR = 9
- TINY = 0
+ TINY = 1
STRING = [MAJOR, MINOR, TINY].join(".")
end
| Prepare for next release (some time in the future).
|
diff --git a/resources/chef-repo/site-cookbooks/backup_restore/libraries/ruby.rb b/resources/chef-repo/site-cookbooks/backup_restore/libraries/ruby.rb
index abc1234..def5678 100644
--- a/resources/chef-repo/site-cookbooks/backup_restore/libraries/ruby.rb
+++ b/resources/chef-repo/site-cookbooks/backup_restore/libraries/ruby.rb
@@ -1,7 +1,18 @@ module BackupRubyHelper
+ def dynamic?
+ -> (_, application) { application[:type] == 'dynamic' }
+ end
+
def application_paths
applications = node['cloudconductor']['applications']
- dynamic_applications = applications.select { |_, application| application[:type] == 'dynamic' }
- dynamic_applications.keys.map { |name| "archive.add '#{node['rails_part']['app']['base_path']}/#{name}/current'" }.join('\n')
+ paths = applications.select(&dynamic?).keys.map do |name|
+ begin
+ Pathname.new("#{node['rails_part']['app']['base_path']}/#{name}/current").realpath
+ rescue Errno::ENOENT
+ nil
+ end
+ end
+
+ paths.compact.map { |path| "archive.add '#{path}'" }.join("\n")
end
end
| Use real directory instead of current symbolic link when backup
|
diff --git a/app/presenters/mortgage_calculator/repayment_presenter.rb b/app/presenters/mortgage_calculator/repayment_presenter.rb
index abc1234..def5678 100644
--- a/app/presenters/mortgage_calculator/repayment_presenter.rb
+++ b/app/presenters/mortgage_calculator/repayment_presenter.rb
@@ -16,39 +16,39 @@ end
def debt
- number_to_currency model.debt, unit: nil
+ convert_to_currency(model.debt)
end
def price
- number_to_currency model.price, unit: nil
+ convert_to_currency(model.price)
end
def deposit
- number_to_currency model.deposit, unit: nil
+ convert_to_currency(model.deposit)
end
def term_years
- return nil if model.term_years.blank?
-
- model.term_years
+ model.term_years.presence
end
def interest_rate
- return nil if model.interest_rate.blank?
-
- model.interest_rate
+ model.interest_rate.presence
end
def monthly_payment
- number_to_currency model.monthly_payment, unit: nil
+ convert_to_currency(model.monthly_payment)
end
def total_interest
- number_to_currency model.total_interest, unit: nil
+ convert_to_currency(model.total_interest)
end
def total_payable
- number_to_currency model.total_payable, unit: nil
+ convert_to_currency(model.total_payable)
+ end
+
+ def convert_to_currency(value)
+ number_to_currency(value.presence || 0, unit: '')
end
def self.model_name
| Remove duplication in repayment presenter
|
diff --git a/lib/tasks/flutie.rake b/lib/tasks/flutie.rake
index abc1234..def5678 100644
--- a/lib/tasks/flutie.rake
+++ b/lib/tasks/flutie.rake
@@ -12,6 +12,6 @@ desc 'install flutie stylesheets into public/ directory'
task :install => :environment do
# Copy the flutie stylesheets into rails_root/public/stylesheets/sass
- copy_files("../../public/stylesheets", "/public", directory)
+ copy_files("../../app/assets/stylesheets", "/public", directory)
end
end
| Change source path of copy_files.
|
diff --git a/lib/tasks/portal.rake b/lib/tasks/portal.rake
index abc1234..def5678 100644
--- a/lib/tasks/portal.rake
+++ b/lib/tasks/portal.rake
@@ -0,0 +1,14 @@+namespace :portal do
+ namespace :fixups do
+ desc "Establish SDS counterparts for all models that need it"
+ task :create_sds_counterparts => :environment do
+ [User, RitesPortal::Learner, RitesPortal::Offering].each do |klass|
+ klass.all.each do |u|
+ if (! u.sds_config) || (! u.sds_config.sds_id)
+ u.create_sds_counterpart
+ end
+ end
+ end
+ end
+ end
+end | Add a rake task for creating all the SDS counterparts for the instances that need them.
|
diff --git a/lib/tasks/router.rake b/lib/tasks/router.rake
index abc1234..def5678 100644
--- a/lib/tasks/router.rake
+++ b/lib/tasks/router.rake
@@ -13,16 +13,12 @@ task :register_routes => :router_environment do
routes = [
%w(/ exact),
- %w(/browse prefix),
- %w(/browse.json exact),
- %w(/business exact),
%w(/search exact),
%w(/search.json exact),
%w(/search/opensearch.xml exact),
%w(/homepage exact),
%w(/tour exact),
%w(/ukwelcomes exact),
- %w(/visas-immigration exact),
]
routes.each do |path, type|
| Stop registering routes for browse
Remove the /browse, /business and /visas-immigration paths from
the router registration task.
|
diff --git a/db/data_migration/20190503121052_remove_incorect_user_and_role.rb b/db/data_migration/20190503121052_remove_incorect_user_and_role.rb
index abc1234..def5678 100644
--- a/db/data_migration/20190503121052_remove_incorect_user_and_role.rb
+++ b/db/data_migration/20190503121052_remove_incorect_user_and_role.rb
@@ -0,0 +1,14 @@+matthew_purves = Person.where(surname: 'Purves', forename: 'Matthew').first
+role = Role.where(name: 'Deputy Director, Schools').first
+role_appt = matthew_purves.role_appointments.where(role_id: role.id).first
+
+Services.publishing_api.patch_links('aa78b82f-e834-4c17-a9b9-66876fe46296', links: {'speaker' => []})
+Services.publishing_api.unpublish(matthew_purves.content_id, type: 'gone')
+Services.publishing_api.unpublish(role.content_id, type: 'gone')
+Services.publishing_api.unpublish(role_appt.content_id, type: 'gone')
+
+EditionRoleAppointment.where(role_appointment: role_appt).delete_all
+
+role_appt.delete
+role.delete
+matthew_purves.delete
| Add data migration to remove person and role.
This person and role were created in error.
This adds a data migration to remove them.
|
diff --git a/app/models/post.rb b/app/models/post.rb
index abc1234..def5678 100644
--- a/app/models/post.rb
+++ b/app/models/post.rb
@@ -29,6 +29,10 @@ created_at.strftime("%b %d, %Y %I:%M:%S %Z") if created_at
end
+ def gravatar_url
+ super.gsub /http:/, ''
+ end
+
private
def modify_parent_topic
| Remove http from gravatar url
Instead of explicitly setting http or https let the browser determine
that. //gravatar.com/blan instead of http(s)://gravatar.com/blah
|
diff --git a/app/models/user.rb b/app/models/user.rb
index abc1234..def5678 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -3,4 +3,11 @@ # :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
+
+ # Use ActiveJob to send mails in the background
+ #
+ # @return [ActiveJob::Base]
+ def send_devise_notification(notification, *args)
+ devise_mailer.send(notification, self, *args).deliver_later
+ end
end
| Send mails in the background
|
diff --git a/app/models/user.rb b/app/models/user.rb
index abc1234..def5678 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1,5 +1,6 @@ class User < ActiveRecord::Base
validates_presence_of :company
+ before_save :update_empty_fields
def self.company_info
company_info = []
@@ -33,4 +34,11 @@ 'ERROR'
end
end
+
+ private
+
+ def update_empty_fields
+ self.operating_system = "N/A" if self.operating_system == ""
+ self.browser = "N/A" if self.browser == ""
+ end
end
| Add callback to prevent empty fields in view
|
diff --git a/app/models/user.rb b/app/models/user.rb
index abc1234..def5678 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -38,15 +38,30 @@
def build_deck
json = []
- @deck = Food.all.sample(10)
- @deck.each do |food|
- json_food = {
- id: food.id,
- name: food.place.name,
- url: food.url,
- place_id: food.place.id
- }
- json << json_food
+ if self.neighborhoods.empty?
+ Food.all.each do |food|
+ json_food = {
+ id: food.id,
+ name: food.place.name,
+ url: food.url,
+ place_id: food.place.id
+ }
+ json << json_food
+ end
+ else
+ self.neighborhoods each do |neighborhood|
+ neighborhood.places each do |place|
+ place.foods each do |food|
+ json_food = {
+ id: food.id,
+ name: food.place.name,
+ url: food.url,
+ place_id: food.place.id
+ }
+ json << json_food
+ end
+ end
+ end
end
json
end
| Refactor build deck to account for neighborhoods
|
diff --git a/ReactiveSwift.podspec b/ReactiveSwift.podspec
index abc1234..def5678 100644
--- a/ReactiveSwift.podspec
+++ b/ReactiveSwift.podspec
@@ -20,4 +20,7 @@ s.dependency 'Result', '~> 4.0'
s.pod_target_xcconfig = {"OTHER_SWIFT_FLAGS[config=Release]" => "$(inherited) -suppress-warnings" }
+
+ s.cocoapods_version = ">= 1.4.0"
+ s.swift_version = "4.1"
end
| [podspec] Add cocoapods_version and swift_version to be explicit |
diff --git a/rest-client.gemspec b/rest-client.gemspec
index abc1234..def5678 100644
--- a/rest-client.gemspec
+++ b/rest-client.gemspec
@@ -1,6 +1,6 @@ # -*- encoding: utf-8 -*-
-require File.expand_path("../lib/restclient/version", __FILE__)
+require File.expand_path('../lib/restclient/version', __FILE__)
Gem::Specification.new do |s|
s.name = 'rest-client'
@@ -10,7 +10,7 @@ s.license = 'MIT'
s.email = 'rest.client@librelist.com'
s.executables = ['restclient']
- s.extra_rdoc_files = ["README.rdoc", "history.md"]
+ s.extra_rdoc_files = ['README.rdoc', 'history.md']
s.files = `git ls-files -z`.split("\0")
s.test_files = `git ls-files -z -- spec/*`.split("\0")
s.homepage = 'http://github.com/rest-client/rest-client'
| Use single quotes where possible.
|
diff --git a/myaso.gemspec b/myaso.gemspec
index abc1234..def5678 100644
--- a/myaso.gemspec
+++ b/myaso.gemspec
@@ -21,6 +21,8 @@ gem.add_dependency 'activesupport', '~> 3'
gem.add_development_dependency 'activerecord', '~> 3'
+ gem.add_development_dependency 'sqlite3', '~> 1.3'
+
gem.add_development_dependency 'tokyocabinet', '~> 1'
gem.add_development_dependency 'minitest', '~> 2.6'
| Use SQLite3 for testing purposes
|
diff --git a/lib/trysail_blog_notification/parser/user/momo_asakura.rb b/lib/trysail_blog_notification/parser/user/momo_asakura.rb
index abc1234..def5678 100644
--- a/lib/trysail_blog_notification/parser/user/momo_asakura.rb
+++ b/lib/trysail_blog_notification/parser/user/momo_asakura.rb
@@ -6,16 +6,49 @@ # @param [Nokogiri::HTML::Document] nokogiri
# @return [TrySailBlogNotification::LastArticle]
def parse(nokogiri)
- articles = nokogiri.xpath('//div[@class="skinMainArea2"]/article[@class="js-entryWrapper"]')
- first_article = articles.first
+ @nokogiri = nokogiri
- title_obj = first_article.xpath('//h1/a[@class="skinArticleTitle"]').first
- title = title_obj.children.first.content.strip
+ first_article = get_top_page_articles.first
+ title_obj = get_title_obj(first_article)
+ title = get_title(title_obj)
url = title_obj.attributes['href'].value
- last_update = first_article.xpath('//span[@class="articleTime"]//time').first.content
+ last_update = get_last_update(first_article)
TrySailBlogNotification::LastArticle.new(title, url, last_update)
end
+ private
+
+ # Get top page articles.
+ #
+ # @return [Nokogiri::XML::NodeSet]
+ def get_top_page_articles
+ @nokogiri.xpath('//div[@class="skinMainArea2"]/article[@class="js-entryWrapper"]')
+ end
+
+ # Get title object.
+ #
+ # @param [Nokogiri::XML::Element] article
+ # @return [Nokogiri::XML::Element]
+ def get_title_obj(article)
+ article.xpath('//h1/a[@class="skinArticleTitle"]').first
+ end
+
+ # Get title.
+ #
+ # @param [Nokogiri::XML::Element]
+ # @return [String]
+ def get_title(title_obj)
+ title_obj.children.first.content.strip
+ end
+
+ # Get last update date.
+ #
+ # @param [Nokogiri::XML::Element]
+ # @return [String]
+ def get_last_update(article)
+ article.xpath('//span[@class="articleTime"]//time').first.content
+ end
+
end
end | Split the some methods of TrySailBlogNotification::Parser::User::MomoAsakura
|
diff --git a/examples/machine_spec.rb b/examples/machine_spec.rb
index abc1234..def5678 100644
--- a/examples/machine_spec.rb
+++ b/examples/machine_spec.rb
@@ -0,0 +1,28 @@+$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
+require 'end_state'
+require 'end_state_matchers'
+
+class Easy < EndState::Guard
+ def will_allow?
+ true
+ end
+end
+
+class NoOp < EndState::Finalizer
+ def call
+ true
+ end
+end
+
+class Machine < EndState::StateMachine
+ transition a: :b do |t|
+ t.guard Easy
+ t.finalizer NoOp
+ end
+end
+
+describe Machine do
+ specify { expect(Machine).to have_transition(a: :b).with_guard(Easy).with_finalizer(NoOp) }
+ specify { expect(Machine).to have_transition(a: :b).with_guards(Easy, Easy).with_finalizers(NoOp, NoOp) }
+ specify { expect(Machine).not_to have_transition(a: :c) }
+end
| Add example usage of TransitionMatcher
|
diff --git a/server/app/controllers/application_controller.rb b/server/app/controllers/application_controller.rb
index abc1234..def5678 100644
--- a/server/app/controllers/application_controller.rb
+++ b/server/app/controllers/application_controller.rb
@@ -1,5 +1,7 @@ class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
- protect_from_forgery with: :exception
+ if Rails.env.production?
+ protect_from_forgery with: :exception
+ end
end
| Disable CSRF protection unless in Production
In production, jquery_ujs will be loaded because we won’t be running
the ember stuff separately
|
diff --git a/cookbooks/postgresql/recipes/postgis.rb b/cookbooks/postgresql/recipes/postgis.rb
index abc1234..def5678 100644
--- a/cookbooks/postgresql/recipes/postgis.rb
+++ b/cookbooks/postgresql/recipes/postgis.rb
@@ -18,8 +18,5 @@ # At the moment, the same PostGIS *single* version is installed for all PostgreSQL instances
#
([node['postgresql']['default_version']] + node['postgresql']['alternate_versions']).each do |pg_version|
- # For now, skip 9.4 Beta, which is not integrated yet in ubuntugis stable PPA
- if pg_version != '9.4'
- package "postgresql-#{pg_version}-postgis-#{node['postgresql']['postgis_version']}"
- end
+ package "postgresql-#{pg_version}-postgis-#{node['postgresql']['postgis_version']}"
end
| Install PostGIS for PostgreSQL 9.4
fix travis-ci/travis-ci#5178
|
diff --git a/mongo_session_store.gemspec b/mongo_session_store.gemspec
index abc1234..def5678 100644
--- a/mongo_session_store.gemspec
+++ b/mongo_session_store.gemspec
@@ -12,6 +12,7 @@ s.license = "MIT"
s.require_paths = ["lib"]
s.summary = "Rails session stores for Mongoid, or any other ODM. Rails 4 compatible."
+ s.required_ruby_version = ">= 1.9"
s.add_dependency "actionpack", "~> 4.0"
s.add_dependency "mongo", "~> 2.0"
| Set Ruby 1.9 as the minimum version
|
diff --git a/rack-cas.gemspec b/rack-cas.gemspec
index abc1234..def5678 100644
--- a/rack-cas.gemspec
+++ b/rack-cas.gemspec
@@ -14,10 +14,10 @@ s.email = 'adam.crownoble@biola.edu'
s.homepage = 'https://github.com/biola/rack-cas'
s.license = 'MIT'
- s.add_dependency('rack')
- s.add_dependency('addressable', '>= 2.3')
- s.add_dependency('nokogiri')
- s.add_development_dependency('rspec', '~> 2.11.0')
- s.add_development_dependency('rack-test')
- s.add_development_dependency('webmock')
+ s.add_dependency 'rack', '~> 1.3'
+ s.add_dependency 'addressable', '~> 2.3'
+ s.add_dependency 'nokogiri', '~> 1.5'
+ s.add_development_dependency 'rspec', '~> 2.11'
+ s.add_development_dependency 'rack-test', '~> 0.6'
+ s.add_development_dependency 'webmock', '~> 1.6'
end
| Add gem dependency version restrictions.
Gets rid of the warnings gem build was throwing.
|
diff --git a/nexmo.gemspec b/nexmo.gemspec
index abc1234..def5678 100644
--- a/nexmo.gemspec
+++ b/nexmo.gemspec
@@ -13,7 +13,7 @@ s.files = Dir.glob('{lib,spec}/**/*') + %w(LICENSE.txt README.md nexmo.gemspec)
s.required_ruby_version = '>= 2.0.0'
s.add_dependency('jwt')
- s.add_development_dependency('rake')
+ s.add_development_dependency('rake', '~> 12.0')
s.add_development_dependency('minitest', '~> 5.0')
s.add_development_dependency('webmock', '~> 3.0')
s.require_path = 'lib'
| Use version ~> 12 of rake gem
Fixes "open-ended dependency on rake is not recommended" warning.
|
diff --git a/open_resty.rb b/open_resty.rb
index abc1234..def5678 100644
--- a/open_resty.rb
+++ b/open_resty.rb
@@ -0,0 +1,18 @@+require "formula"
+
+class OpenResty < Formula
+ homepage "https://openresty.org/"
+ url "https://openresty.org/download/openresty-1.11.2.2.tar.gz"
+ sha256 "7f9ca62cfa1e4aedf29df9169aed0395fd1b90de254139996e554367db4d5a01"
+ version "1.11.2.2"
+
+ depends_on "lua"
+ depends_on "pcre"
+ depends_on "openssl"
+ depends_on "curl"
+
+ def install
+ system "./configure", "--prefix=#{prefix}"
+ system "make install"
+ end
+end
| Add lua library with opm package manager
|
diff --git a/sidekiq-limit_fetch.gemspec b/sidekiq-limit_fetch.gemspec
index abc1234..def5678 100644
--- a/sidekiq-limit_fetch.gemspec
+++ b/sidekiq-limit_fetch.gemspec
@@ -1,6 +1,6 @@ Gem::Specification.new do |gem|
gem.name = 'sidekiq-limit_fetch'
- gem.version = '2.2.5'
+ gem.version = '2.2.6'
gem.license = 'MIT'
gem.authors = 'brainopia'
gem.email = 'brainopia@evilmartians.com'
@@ -15,7 +15,7 @@ gem.test_files = gem.files.grep %r{^spec/}
gem.require_paths = %w(lib)
- gem.add_dependency 'sidekiq', '>= 2.6.5', '< 3.3'
+ gem.add_dependency 'sidekiq', '>= 2.6.5', '< 4.0'
gem.add_development_dependency 'rspec'
gem.add_development_dependency 'rake'
end
| Update dependency requirement for sidekiq and release new version
|
diff --git a/spec/lib/test_boosters/insights_uploader_spec.rb b/spec/lib/test_boosters/insights_uploader_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/test_boosters/insights_uploader_spec.rb
+++ b/spec/lib/test_boosters/insights_uploader_spec.rb
@@ -1,6 +1,7 @@-require 'spec_helper'
+require "spec_helper"
describe TestBoosters::InsightsUploader do
+
it "uploads dummy json file" do
ENV["SEMAPHORE_PROJECT_UUID"] = "not a project UUID"
ENV["SEMAPHORE_EXECUTABLE_UUID"] = "not a build UUID"
@@ -11,12 +12,12 @@ expect(uploader.upload("rspec", dymmy_json_file)).to eq(0)
end
- it "it fails to upload dummy json file - no file" do
+ it "fails to upload dummy json file - no file" do
uploader = described_class.new
expect(uploader.upload("rspec", "no-file")).to eq(1)
end
- it "it fails to upload dummy json file - malformed file" do
+ it "fails to upload dummy json file - malformed file" do
uploader = described_class.new
expect(uploader.upload("rspec", "README.md")).to eq(1)
end
| Remove it 'it ...' rspec statements
|
diff --git a/lib/opal/source_map.rb b/lib/opal/source_map.rb
index abc1234..def5678 100644
--- a/lib/opal/source_map.rb
+++ b/lib/opal/source_map.rb
@@ -28,7 +28,6 @@
new_lines = fragment.code.count "\n"
- puts "[add] gen_line: #{line}, source_line: #{source_line} (adding: #{new_lines})"
line += new_lines
column = 0
end
| Remove debug line left by mistake
|
diff --git a/simple_aws.gemspec b/simple_aws.gemspec
index abc1234..def5678 100644
--- a/simple_aws.gemspec
+++ b/simple_aws.gemspec
@@ -5,10 +5,10 @@ s.authors = ["Jason Roelofs"]
s.email = ["jameskilton@gmail.com"]
-# s.homepage = ""
+ s.homepage = "http://github.com/jameskilton/simple_aws"
s.summary = "The simplest and easiest to use and maintain AWS communication library"
- s.description = "The simplest and easiest to use and maintain AWS communication library"
+ s.description = "SimpleAWS is a clean, simple, and forward compatible library for talking to Amazon's AWS APIs."
s.add_dependency "nokogiri", "~> 1.5.0"
s.add_dependency "httparty", "~> 0.8.0"
| Update homepage and description in gemspec
|
diff --git a/spec/recipes/default_spec.rb b/spec/recipes/default_spec.rb
index abc1234..def5678 100644
--- a/spec/recipes/default_spec.rb
+++ b/spec/recipes/default_spec.rb
@@ -2,7 +2,7 @@
describe 'et_console_app::default' do
let(:chef_run) do
- ChefSpec::Runner.new do |node|
+ ChefSpec::Runner.new(platform: 'ubuntu', version: '12.04') do |node|
node.set['apache']['root_group'] = 'root'
node.set['et_console_app']['deploy_to'] = '/var/www/console.evertrue.com'
node.set['apache']['group'] = 'www-data'
@@ -10,8 +10,15 @@ end.converge(described_recipe)
end
- it 'includes apt::default' do
- expect(chef_run).to include_recipe 'apt::default'
+ %w(
+ apt::default
+ node::default
+ et_users::evertrue
+ apache2::default
+ ).each do |recipe|
+ it "includes #{recipe}" do
+ expect(chef_run).to include_recipe recipe
+ end
end
it 'creates /etc/apache2/conf.d/h5bp.conf' do
@@ -20,10 +27,6 @@ # group: node['apache']['root_group'],
mode: '0644'
)
- end
-
- it 'includes apache2::default' do
- expect(chef_run).to include_recipe 'apache2::default'
end
%w(/var/www/console.evertrue.com /var/www/web.evertrue.com).each do |path|
| Set platform for ChefSpec tests, refactor tests for included recipes
|
diff --git a/rspec-exercise/calculator.rb b/rspec-exercise/calculator.rb
index abc1234..def5678 100644
--- a/rspec-exercise/calculator.rb
+++ b/rspec-exercise/calculator.rb
@@ -23,32 +23,41 @@ class Evaluator
attr_reader :expression
def initialize(expression)
- @expression = expression
+ @expression = expression
+ @accumulator = nil
+ @value = nil
+ @operator = nil
end
+ attr_accessor :accumulator, :value, :operator
+ private :accumulator, :value, :operator
+
def call
- accumulator = nil
- value, operator = nil, nil
- tokens = Tokenizer.new(expression)
until tokens.empty?
case tokens.first
when /\d+/ # Integer
- value = tokens.consume.to_i
+ self.value = tokens.consume.to_i
case
when accumulator.nil? # should only be the first time through
- accumulator = value
+ self.accumulator = value
when operator.nil?
raise "I don't understand #{expression.inspect}"
else
- accumulator = accumulator.send(operator, value)
+ self.accumulator = accumulator.send(operator, value)
end
when /[\+\-\*\/]/ # Operator
- operator = tokens.consume.to_sym
+ self.operator = tokens.consume.to_sym
else
raise "I don't understand #{expression.inspect}"
end
end
accumulator
+ end
+
+ private
+
+ def tokens
+ @tokens ||= Tokenizer.new(expression)
end
end
| Move local variables to private accessors |
diff --git a/spec/usaidwat/client_spec.rb b/spec/usaidwat/client_spec.rb
index abc1234..def5678 100644
--- a/spec/usaidwat/client_spec.rb
+++ b/spec/usaidwat/client_spec.rb
@@ -0,0 +1,34 @@+require 'spec_helper'
+
+module USaidWat
+ module Client
+ describe Client do
+ before(:each) do
+ root = File.expand_path("../../../test/responses", __FILE__)
+
+ stub_request(:get, "http://www.reddit.com/user/mipadi/comments.json").
+ to_return(:body => IO.read(File.join(root, "comments_1.json")))
+ stub_request(:get, "http://www.reddit.com/user/mipadi/comments.json?count=25&after=t1_c77kq1t").
+ to_return(:body => IO.read(File.join(root, "comments_2.json")))
+ stub_request(:get, "http://www.reddit.com/user/mipadi/comments.json?count=50&after=t1_c74e76h").
+ to_return(:body => IO.read(File.join(root, "comments_3.json")))
+ stub_request(:get, "http://www.reddit.com/user/mipadi/comments.json?count=75&after=t1_c73pvjp").
+ to_return(:body => IO.read(File.join(root, "comments_4.json")))
+ end
+
+ let(:redditor) { Client::Redditor.new("mipadi") }
+
+ describe "#username" do
+ it "returns the Redditor's username" do
+ redditor.username.should == "mipadi"
+ end
+ end
+
+ describe "#comments" do
+ it "gets 100 comments" do
+ redditor.comments.count.should == 100
+ end
+ end
+ end
+ end
+end
| Write tests for Reddit client
|
diff --git a/Library/Homebrew/test/test_hardware.rb b/Library/Homebrew/test/test_hardware.rb
index abc1234..def5678 100644
--- a/Library/Homebrew/test/test_hardware.rb
+++ b/Library/Homebrew/test/test_hardware.rb
@@ -11,7 +11,7 @@ def test_hardware_intel_family
if Hardware::CPU.type == :intel
assert [:core, :core2, :penryn, :nehalem,
- :arrandale, :sandybridge, :ivybridge].include?(Hardware::CPU.family)
+ :arrandale, :sandybridge, :ivybridge, :haswell].include?(Hardware::CPU.family)
end
end
end
| Add Haswell to CPU tests
These tests need a lot of work...
|
diff --git a/spec/rails_app/db/migrate/20160101102949_create_tables.rb b/spec/rails_app/db/migrate/20160101102949_create_tables.rb
index abc1234..def5678 100644
--- a/spec/rails_app/db/migrate/20160101102949_create_tables.rb
+++ b/spec/rails_app/db/migrate/20160101102949_create_tables.rb
@@ -1,4 +1,6 @@-class CreateTables < ActiveRecord::Migration[4.2]
+BASE_CLASS = Rails::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[4.2] : ActiveRecord::Migration
+
+class CreateTables < BASE_CLASS
def change
create_table :users do |t|
t.string :username
| Handle Rails 5 migration versioning
|
diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb
index abc1234..def5678 100644
--- a/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb
+++ b/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb
@@ -5,8 +5,15 @@ describe 'Issue creation' do
let(:issue_title) { 'issue title' }
+ before do
+ Runtime::Browser.visit(:gitlab, Page::Main::Login)
+ Page::Main::Login.perform(&:sign_in_using_credentials)
+ end
+
it 'user creates an issue' do
- create_issue
+ Resource::Issue.fabricate_via_browser_ui! do |issue|
+ issue.title = issue_title
+ end
Page::Project::Menu.perform(&:click_issues)
@@ -18,9 +25,15 @@ File.absolute_path(File.join('spec', 'fixtures', 'banana_sample.gif'))
end
+ before do
+ issue = Resource::Issue.fabricate_via_api! do |issue|
+ issue.title = issue_title
+ end
+
+ issue.visit!
+ end
+
it 'user comments on an issue with an attachment' do
- create_issue
-
Page::Project::Issue::Show.perform do |show|
show.comment('See attached banana for scale', attachment: file_to_attach)
@@ -36,15 +49,6 @@ end
end
end
-
- def create_issue
- Runtime::Browser.visit(:gitlab, Page::Main::Login)
- Page::Main::Login.perform(&:sign_in_using_credentials)
-
- Resource::Issue.fabricate_via_browser_ui! do |issue|
- issue.title = issue_title
- end
- end
end
end
end
| Refactor create issue end-to-end test
This refactor:
- Moves the tests pre-conditions to a before blocks
- Creates an issue via the api for the second test to improve the
test suite performance
|
diff --git a/examples/item_searches/batch_request.rb b/examples/item_searches/batch_request.rb
index abc1234..def5678 100644
--- a/examples/item_searches/batch_request.rb
+++ b/examples/item_searches/batch_request.rb
@@ -0,0 +1,17 @@+require File.expand_path('../../helper.rb', __FILE__)
+
+Vacuum.configure :us do |c|
+ c.key = KEY
+ c.secret = SECRET
+ c.tag = ASSOCIATE_TAG
+end
+req = Vacuum.new :us
+
+req << { 'Operation' => 'ItemSearch',
+ 'ItemSearch.Shared.SearchIndex' => 'Books',
+ 'ItemSearch.Shared.Keywords' => 'Deleuze',
+ 'ItemSearch.1.ItemPage' => 1,
+ 'ItemSearch.2.ItemPage' => 2 }
+res = req.get
+
+binding.pry
| Add batch search request example.
|
diff --git a/heatup/05_multiple_validations_from_remote_xml_sitemap.rb b/heatup/05_multiple_validations_from_remote_xml_sitemap.rb
index abc1234..def5678 100644
--- a/heatup/05_multiple_validations_from_remote_xml_sitemap.rb
+++ b/heatup/05_multiple_validations_from_remote_xml_sitemap.rb
@@ -0,0 +1,25 @@+# Example of validation of a list of URLs from a remote XML sitemap
+
+require 'open-uri'
+require 'nokogiri'
+require 'w3c_validators'
+include W3CValidators
+validator = MarkupValidator.new
+
+totals = {:errors => 0, :warnings => 0}
+
+doc = Nokogiri::XML(open('https://github.com/jaimeiniesta/w3clove/raw/master/heatup/sitemap.xml'))
+doc.css('loc').collect {|item| item.text}.each do |url|
+ puts "\nValidating markup of #{url}"
+ results = validator.validate_uri(url)
+ puts "#{results.errors.count} errors, #{results.warnings.count} warnings"
+ totals[:errors] += results.errors.count
+ totals[:warnings] += results.warnings.count
+end
+
+puts "\nTOTAL:#{totals[:errors]} errors, #{totals[:warnings]} warnings"
+
+
+
+
+
| Add multiple validations from remote XML sitemap example
|
diff --git a/lib/generators/rspec/controller/templates/request_spec.rb b/lib/generators/rspec/controller/templates/request_spec.rb
index abc1234..def5678 100644
--- a/lib/generators/rspec/controller/templates/request_spec.rb
+++ b/lib/generators/rspec/controller/templates/request_spec.rb
@@ -3,8 +3,6 @@ RSpec.describe "<%= class_name.pluralize %>", <%= type_metatag(:request) %> do
describe "GET /<%= name.underscore.pluralize %>" do
it "works! (now write some real specs)" do
- get <%= index_helper %>_path
- expect(response).to have_http_status(200)
end
end
end
| Make content of automatic request spec almost empty
|
diff --git a/app/contexts/files/update_context.rb b/app/contexts/files/update_context.rb
index abc1234..def5678 100644
--- a/app/contexts/files/update_context.rb
+++ b/app/contexts/files/update_context.rb
@@ -27,7 +27,7 @@ created_successfully = edit_file_action.commit!(
params[:content],
params[:commit_message],
- params[:encooding]
+ params[:encoding]
)
if created_successfully
| Fix encoding pass to edit file satellite
Signed-off-by: Dmitriy Zaporozhets <be23d75b156792e5acab51b196a2deb155d35d6a@gmail.com>
|
diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/events_controller.rb
+++ b/app/controllers/events_controller.rb
@@ -13,4 +13,8 @@ params.require(:event).permit(:details, :submitter, :offender, :location, :date, :event_photo)
end
+ def show
+ @event = Event.find params[:id]
+ end
+
end
| Add show action to events controller
|
diff --git a/Casks/cocktail.rb b/Casks/cocktail.rb
index abc1234..def5678 100644
--- a/Casks/cocktail.rb
+++ b/Casks/cocktail.rb
@@ -4,4 +4,11 @@ version 'latest'
no_checksum
link 'Cocktail.app'
+
+ def caveats; <<-EOS.undent
+ This version of Cocktail is for OS X Mavericks only. If you are using other versions of
+ OS X, please run 'brew tap caskroom/versions' and install cocktail-mountainlion /
+ cocktail-lion / cocktail-snowleopard
+ EOS
+ end
end
| Add caveat for Cocktail: for OS X Mavericks only; instructions to tap from caskroom-versions
|
diff --git a/app/overrides/add_rich_editor_tab.rb b/app/overrides/add_rich_editor_tab.rb
index abc1234..def5678 100644
--- a/app/overrides/add_rich_editor_tab.rb
+++ b/app/overrides/add_rich_editor_tab.rb
@@ -2,5 +2,5 @@ virtual_path: 'spree/admin/shared/sub_menu/_configuration',
name: 'add_rich_editor_tab',
insert_bottom: '[data-hook="admin_configurations_sidebar_menu"]',
- text: '<li<%== " class=\"active\"" if controller.controller_name == "editor_settings" %>><%= link_to Spree.t(:rich_editor), edit_admin_editor_settings_path %></li>'
+ text: '<li<%== " class=\"active\"" if controller.controller_name == "editor_settings" %>><%= link_to Spree.t(:rich_editor), spree.edit_admin_editor_settings_path %></li>'
)
| Make deface use spree namespace for edit_admin_editor_settings_path.
|
diff --git a/test/functional/account_controller_patch_test.rb b/test/functional/account_controller_patch_test.rb
index abc1234..def5678 100644
--- a/test/functional/account_controller_patch_test.rb
+++ b/test/functional/account_controller_patch_test.rb
@@ -5,6 +5,8 @@ require Rails.root.join('test/functional/account_controller_test')
class AccountControllerTest
+ fixtures :users, :roles
+
context "GET /login CAS button" do
should "show up only if there's a plugin setting for CAS URL" do
Setting["plugin_redmine_omniauth_cas"]["cas_server"] = ""
@@ -15,4 +17,18 @@ assert_select '#cas-login'
end
end
+
+ context "GET login_with_omniauth" do
+ should "redirect to /my/page after successful login" do
+ request.env["omniauth.auth"] = {"uid"=>"admin"}
+ get :login_with_omniauth, :provider => "cas"
+ assert_redirected_to '/my/page'
+ end
+
+ should "redirect to /login after failed login" do
+ request.env["omniauth.auth"] = {"uid"=>"non-existent"}
+ get :login_with_omniauth, :provider => "cas"
+ assert_redirected_to '/login'
+ end
+ end
end
| Add some tests for omniauth login
|
diff --git a/test/rubygems/comparator/test_spec_comparator.rb b/test/rubygems/comparator/test_spec_comparator.rb
index abc1234..def5678 100644
--- a/test/rubygems/comparator/test_spec_comparator.rb
+++ b/test/rubygems/comparator/test_spec_comparator.rb
@@ -0,0 +1,20 @@+require 'rubygems/test_case'
+require 'rubygems/comparator'
+
+class TestSpecComparator < Gem::TestCase
+ def setup
+ super
+
+ options = { keep_all: true, no_color: true }
+ versions = ['0.0.1', '0.0.2', '0.0.3', '0.0.4']
+
+ @comparator = Gem::Comparator.new(options)
+
+ Dir.chdir(File.expand_path('../../gemfiles', File.dirname(__FILE__))) do
+ @comparator.compare_versions('lorem', versions)
+ end
+
+ @report = @comparator.report
+ end
+
+end
| Add test setup for SpecComparator
|
diff --git a/features/step_definitions/troo_steps.rb b/features/step_definitions/troo_steps.rb
index abc1234..def5678 100644
--- a/features/step_definitions/troo_steps.rb
+++ b/features/step_definitions/troo_steps.rb
@@ -7,8 +7,8 @@ end
Before do
- Troo::Configuration.load('test/support/.trooconf', :test)
- Ohm.connect(db: Troo.configuration.database)
+ config = Troo::Configuration.load('test/support/.trooconf', :test)
+ Ohm.connect(db: config.database)
end
After do
| Use test database for integration tests. |
diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/categories_controller.rb
+++ b/app/controllers/categories_controller.rb
@@ -4,7 +4,7 @@
class CategoriesController < ApplicationController
respond_to :json
- before_action :require_permissions, :set_course
+ before_action :set_course_and_validate
def add_category
set_wiki
@@ -25,8 +25,9 @@
private
- def set_course
+ def set_course_and_validate
@course = Course.find(params[:course_id])
+ raise NotPermittedError unless current_user&.can_edit?(@course)
end
def set_wiki
| Fix permission checking for CategoriesController
|
diff --git a/app/controllers/food_lists_controller.rb b/app/controllers/food_lists_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/food_lists_controller.rb
+++ b/app/controllers/food_lists_controller.rb
@@ -25,7 +25,7 @@ end
def default_sort_direction
- "desc"
+ "asc"
end
def additional_sorts
| Fix food list default sorting
|
diff --git a/app/controllers/mixins/compressed_ids.rb b/app/controllers/mixins/compressed_ids.rb
index abc1234..def5678 100644
--- a/app/controllers/mixins/compressed_ids.rb
+++ b/app/controllers/mixins/compressed_ids.rb
@@ -1,7 +1,7 @@ module CompressedIds
CID_OR_ID_MATCHER = ArRegion::CID_OR_ID_MATCHER
#
- # Methods to convert record id (id, fixnum, 12000000000056) to/from compressed id (cid, string, "12c56")
+ # Methods to convert record id (id, fixnum, 12000000000056) to/from compressed id (cid, string, "12r56")
# for use in UI controls (i.e. tree node ids, pulldown list items, etc)
#
| Fix comment to reflect reality
|
diff --git a/app/controllers/staticpage_controller.rb b/app/controllers/staticpage_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/staticpage_controller.rb
+++ b/app/controllers/staticpage_controller.rb
@@ -5,11 +5,13 @@
def createallusers
- AdminUser.first_or_create!(email: 'admin@example.com',
+ AdminUser.create(email: 'admin@example.com',
password: 'password',
password_confirmation: 'password')
- StudentMember.first_or_create!(id: '0',
+ puts "AdminUser created"
+
+ StudentMember.create(id: '0',
name: 'Default User',
rollnum: '15DF12345',
portfolio: 'Default Portfolio',
@@ -17,7 +19,7 @@ password: 'password',
password_confirmation: 'password')
- Coordinator.first_or_create!(id: '0',
+ Coordinator.create(id: '0',
name: 'Default User',
rollnum: '15DF12346',
portfolio: 'Default Portfolio',
@@ -25,6 +27,19 @@ password: 'password',
password_confirmation: 'password')
+ lastid = Alumni.all.count
+
+ for i in 1..10
+ j = lastid + i
+ Alumni.create(
+ id: j.to_s,
+ name: 'Default User ' + i.to_s,
+ year: '201' + i.to_s,
+ hall: 'SH',
+ department: 'alumdep' + i.to_s
+ )
+ end
+
render plain: "Done!"
end
| Change the createallusers action slightly.
Create 10 extra alumni, whenever this is done.
** Remove this when pushing into production **
Signed-off-by: Siddharth Kannan <805f056820c7a1cecc4ab591b8a0a604b501a0b7@gmail.com>
|
diff --git a/spec/models/product_spec.rb b/spec/models/product_spec.rb
index abc1234..def5678 100644
--- a/spec/models/product_spec.rb
+++ b/spec/models/product_spec.rb
@@ -1,11 +1,13 @@ require 'spec_helper'
+
+class Product::MyProduct; ; end
describe Product do
describe 'validations' do
describe 'english_name_available?' do
it 'assures that a english name is present' do
I18n.locale = :de
- subject = Factory.build(:product, name: 'Text Creation')
+ subject = Factory.build(:product, name: 'Product')
subject.valid?
subject.errors[:name].include?(
@@ -15,7 +17,7 @@ ).should == true
I18n.locale = I18n.default_locale
- subject = Factory.build(:product, name: 'Text Creation')
+ subject = Factory.build(:product, name: 'Product')
subject.valid?
subject.errors[:name].include?(
@@ -37,7 +39,7 @@ )
).should == true
- subject = Factory.build(:product, name: 'Text Creation')
+ subject = Factory.build(:product, name: 'My Product')
subject.valid?.should == true
subject.errors[:name].include?(
| Set type to Product if name equals Product.
|
diff --git a/spec/models/product_spec.rb b/spec/models/product_spec.rb
index abc1234..def5678 100644
--- a/spec/models/product_spec.rb
+++ b/spec/models/product_spec.rb
@@ -27,4 +27,30 @@ subject { product.utusemi(:sample, caption: :title) }
it { expect(subject.caption).to eq(subject.title) }
end
+
+ describe '::utusemi(type)' do
+ before { FactoryGirl.create(:product, title: 'foobar') }
+ subject { described_class.utusemi(:sample) }
+
+ it '::where by alias column' do
+ expect(subject.where(name: 'foobar').count).to eq(1)
+ end
+
+ it '::order by alias column' do
+ expect { subject.order(:name) }.not_to raise_error
+ end
+
+ it 'call alias column from instance' do
+ expect(subject.first.name).to eq(subject.first.title)
+ end
+ end
+
+ describe '::utusemi(type, options)' do
+ before { FactoryGirl.create(:product, title: 'foobar') }
+ subject { described_class.utusemi(:sample, caption: :title) }
+
+ it 'call alias column from instance' do
+ expect(subject.first.caption).to eq(subject.first.title)
+ end
+ end
end
| Add tests for ::utusemi method
|
diff --git a/spec/requests/users_spec.rb b/spec/requests/users_spec.rb
index abc1234..def5678 100644
--- a/spec/requests/users_spec.rb
+++ b/spec/requests/users_spec.rb
@@ -13,7 +13,7 @@ expect(page).to have_content("Personal information")
# log user out
- click_on "Logout"
+ find("input[value='Logout']", match: :first).click
#promote user to activist
@user.admin = true
| Fix user promotion password spec
|
diff --git a/spec/model_spec.rb b/spec/model_spec.rb
index abc1234..def5678 100644
--- a/spec/model_spec.rb
+++ b/spec/model_spec.rb
@@ -12,6 +12,13 @@
it { expect(action).to eq(result) }
+ context "when string includes utf-8 characters" do
+ let(:str) { "中文" }
+
+ it "should keeps those characters" do
+ expect(instance.send(:sanitize, str)).to eq(str)
+ end
+ end
end
end
| Add spec for utf-8 characters
|
diff --git a/bin/tic_tac_toe.ru b/bin/tic_tac_toe.ru
index abc1234..def5678 100644
--- a/bin/tic_tac_toe.ru
+++ b/bin/tic_tac_toe.ru
@@ -1,10 +1,3 @@-#!/usr/bin/env ruby
+require 'tic_tac_toe'
-require "bundler/setup"
-require 'rack'
-require "tic_tac_toe"
-
-Rack::Handler::WEBrick.run(
- TicTacToe::RackShell.new_shell,
- :Port => 9000
-)
+run TicTacToe::RackShell.new_shell
| Correct syntax of .ru file
|
diff --git a/pagerduty-sdk.gemspec b/pagerduty-sdk.gemspec
index abc1234..def5678 100644
--- a/pagerduty-sdk.gemspec
+++ b/pagerduty-sdk.gemspec
@@ -6,7 +6,7 @@
Gem::Specification.new do |gem|
gem.name = "pagerduty-sdk"
- gem.version = '1.0.8'
+ gem.version = '1.0.9'
gem.authors = ["Alfred Moreno"]
gem.email = ["kryptek@gmail.com"]
gem.description = %q{An SDK for Pagerduty's API}
| Update gem to 1.09; commits 5b7956c..cdc7551
|
diff --git a/config/initializers/gds_sso.rb b/config/initializers/gds_sso.rb
index abc1234..def5678 100644
--- a/config/initializers/gds_sso.rb
+++ b/config/initializers/gds_sso.rb
@@ -6,9 +6,3 @@ config.oauth_secret = ENV['OAUTH_SECRET']
config.oauth_root_url = Plek.current.find('signon')
end
-
-GDS::SSO.test_user = User.find_or_create_by(email: 'user@test.example.com').tap do |u|
- u.name = 'Test User'
- u.permissions = ['signin']
- u.save!
-end
| Remove SSO test user autocreation.
This causes a catch 22 situation when trying to
run initial migrations or schema loads as rake
loads the rails environment and tries to access
the `users` table. If the CreateUser migration
hasn't run yet, this causes an exception which
prevents the table being created.
We will revisit this in due course. |
diff --git a/spec/debian/packages_spec.rb b/spec/debian/packages_spec.rb
index abc1234..def5678 100644
--- a/spec/debian/packages_spec.rb
+++ b/spec/debian/packages_spec.rb
@@ -5,6 +5,10 @@ end
describe package('cron') do
+ it { should be_installed }
+end
+
+describe package('dtracetools-lx') do
it { should be_installed }
end
| Make sure dtracetools-lx is installed in Debian
|
diff --git a/spec/dm-active_model_spec.rb b/spec/dm-active_model_spec.rb
index abc1234..def5678 100644
--- a/spec/dm-active_model_spec.rb
+++ b/spec/dm-active_model_spec.rb
@@ -7,11 +7,6 @@ require 'dm-validations'
require 'amo_validation_compliance_spec'
end
-
-# This must be done until active_model/naming.rb
-# does that itself. The functionality in there relies
-# on the #parents method to be present on any module
-require 'active_support/core_ext/module/introspection'
describe 'An active_model compliant DataMapper::Resource' do
| Remove workaround as rails master is patched already |
diff --git a/spec/models/exim_log_spec.rb b/spec/models/exim_log_spec.rb
index abc1234..def5678 100644
--- a/spec/models/exim_log_spec.rb
+++ b/spec/models/exim_log_spec.rb
@@ -5,16 +5,23 @@ it "loads relevant lines of an uncompressed exim log file" do
Configuration.stub!(:incoming_email_domain).and_return("example.com")
File.stub_chain(:stat, :mtime).and_return(Date.new(2012, 10, 10))
- log = ["This is a line of a logfile relevant to foi+request-1234@example.com"]
+ log = [
+ "This is a line of a logfile relevant to foi+request-1234@example.com",
+ "This is the second line for the same foi+request-1234@example.com email address"
+ ]
File.should_receive(:open).with("/var/log/exim4/exim-mainlog-2012-10-10", "r").and_return(log)
ir = info_requests(:fancy_dog_request)
- InfoRequest.should_receive(:find_by_incoming_email).with("request-1234@example.com").and_return(ir)
+ InfoRequest.should_receive(:find_by_incoming_email).with("request-1234@example.com").twice.and_return(ir)
EximLog.load_file("/var/log/exim4/exim-mainlog-2012-10-10")
- ir.exim_logs.count.should == 1
- log = ir.exim_logs.first
+ ir.exim_logs.count.should == 2
+ log = ir.exim_logs[0]
log.order.should == 1
log.line.should == "This is a line of a logfile relevant to foi+request-1234@example.com"
+
+ log = ir.exim_logs[1]
+ log.order.should == 2
+ log.line.should == "This is the second line for the same foi+request-1234@example.com email address"
end
end
end
| Add a second log line to the test
|
diff --git a/src/vsphere_cpi/lib/cloud/vsphere/ip_conflict_detector.rb b/src/vsphere_cpi/lib/cloud/vsphere/ip_conflict_detector.rb
index abc1234..def5678 100644
--- a/src/vsphere_cpi/lib/cloud/vsphere/ip_conflict_detector.rb
+++ b/src/vsphere_cpi/lib/cloud/vsphere/ip_conflict_detector.rb
@@ -13,7 +13,11 @@ conflict_messages << "#{conflict[:vm_name]} on network #{conflict[:network_name]} with ip #{conflict[:ip]}"
end
- raise "Detected IP conflicts with other VMs on the same networks: #{conflict_messages.join(", ")}" unless ip_conflicts.empty?
+ if ip_conflicts.empty?
+ @logger.info("No IP conflicts detected")
+ else
+ raise "Detected IP conflicts with other VMs on the same networks: #{conflict_messages.join(", ")}"
+ end
end
private
@@ -27,6 +31,7 @@ if vm.nil?
next
end
+ @logger.info("Found VM '#{vm.name}' with IP '#{ip}'. Checking if VM belongs to network '#{name}'...")
vm.guest.net.each do |nic|
if nic.ip_address.include?(ip) && nic.network == name
| Add additional logging in IP conflict detector
- We've seen this test fail in CI twice, adding additional logging to
help find a fix
|
diff --git a/SwiftForms.podspec b/SwiftForms.podspec
index abc1234..def5678 100644
--- a/SwiftForms.podspec
+++ b/SwiftForms.podspec
@@ -7,5 +7,5 @@ s.authors = "Miguel Ángel Ortuño"
s.ios.deployment_target = "8.0"
s.source = { :git => "https://github.com/ortuman/SwiftForms.git", :tag => '1.0' }
- s.source_files = 'SwiftForms/descriptors/*.swift', 'SwiftForms/cells/base/*.swift', 'SwiftForms/cells/*.swift', 'SwiftForms/controllers/*.swift'
+ s.source_files = 'SwiftForms/descriptors/*.swift', 'SwiftForms/cells/base/*.swift', 'SwiftForms/cells/*.swift', 'SwiftForms/controllers/*.swift', 'SwiftForms/utilities/*.swift'
end
| Add `utilities` folder to podspec
|
diff --git a/lib/builderator/model.rb b/lib/builderator/model.rb
index abc1234..def5678 100644
--- a/lib/builderator/model.rb
+++ b/lib/builderator/model.rb
@@ -5,6 +5,7 @@ ##
class Base
attr_reader :resources
+ LIMIT = 4
def initialize(*args)
fetch(*args)
@@ -22,7 +23,7 @@ resources.select { |k, _| set.include?(k) }
end
- def reject(set)
+ def reject(set = [])
resources.reject { |k, _| set.include?(k) }
end
| Add default to reject argument
|
diff --git a/lib/capistrano-resque.rb b/lib/capistrano-resque.rb
index abc1234..def5678 100644
--- a/lib/capistrano-resque.rb
+++ b/lib/capistrano-resque.rb
@@ -1,2 +1,8 @@ require "capistrano-resque/version"
-require "capistrano-resque/capistrano_integration"
+
+if Gem::Version.new(Capistrano::VERSION) >= Gem::Version.new("3.0.0")
+ load File.expand_path("../capistrano-resque/tasks/capistrano-resque.rake", __FILE__)
+else
+ require "capistrano-resque/capistrano_integration"
+end
+
| Load different set of tasks based on Capistrano's version
|
diff --git a/lib/deploy/repository.rb b/lib/deploy/repository.rb
index abc1234..def5678 100644
--- a/lib/deploy/repository.rb
+++ b/lib/deploy/repository.rb
@@ -60,6 +60,6 @@ end
def last_commit_message
- @last_commit_message ||= `git log --pretty=%B -1`
+ @last_commit_message ||= `git log --pretty=%B -1`.chomp('')
end
end
| Remove all newlines from last commit message
|
diff --git a/activejob/lib/active_job/queue_name.rb b/activejob/lib/active_job/queue_name.rb
index abc1234..def5678 100644
--- a/activejob/lib/active_job/queue_name.rb
+++ b/activejob/lib/active_job/queue_name.rb
@@ -2,6 +2,7 @@ module QueueName
extend ActiveSupport::Concern
+ # Includes the ability to override the default queue name and prefix.
module ClassMethods
mattr_accessor(:queue_name_prefix)
mattr_accessor(:default_queue_name) { "default" }
| Document included ability of AJ::QueueName module for class methods [ci skip]
|
diff --git a/app/controllers/articles_controller.rb b/app/controllers/articles_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/articles_controller.rb
+++ b/app/controllers/articles_controller.rb
@@ -1,5 +1,16 @@ class ArticlesController < ApplicationController
+
+ before_action :set_article, only: [:show, :edit, :update, :destroy]
+ # GET - Show all the articles.
+ def index
+ @articles = Article.all
+ end
+
+ # GET - Show a single article.
+ def show
+ end
+
# GET - Show new form for create a artice.
def new
@article = Article.new
@@ -9,12 +20,46 @@ def create
# render plain: params[:article].inspect
@article = Article.new(article_params)
- @article.save
- redirect_to articles_show(@article)
+
+ if @article.save
+ flash[:success] = "The articles was created successfully."
+ redirect_to article_path(@article)
+ else
+ render :new
+ end
+ end
+
+ # GET - Show edit form.
+ def edit
+ end
+
+ # PUT - Edit the article
+ def update
+
+ if @article.update(article_params)
+ flash[:success] = "The article has been updated."
+ redirect_to article_path(@article)
+ else
+ render :edit
+ end
+ end
+
+ # DELETE - Delete an article.
+ def destroy
+
+ @article.destroy
+ flash[:notice] = "The articles was deleted"
+
+ redirect_to articles_path
end
private
+
+ def set_article
+ @article = Article.find(params[:id])
+ end
+
def article_params
params.require(:article).permit(:title, :description)
end
| New: Add index, edit, update, destroy and show actions.
- Add set_article before_action for refactoring the code.
|
diff --git a/app/controllers/requests_controller.rb b/app/controllers/requests_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/requests_controller.rb
+++ b/app/controllers/requests_controller.rb
@@ -14,7 +14,7 @@ if @request.save
redirect_to request(@request)
else
- @errors = @request.errors.full_messages
+ flash.new[:alert] = @request.errors.full_messages.join(", ")
render 'new'
end
end
| Add request creation error handling
|
diff --git a/app/models/metric/chargeback_helper.rb b/app/models/metric/chargeback_helper.rb
index abc1234..def5678 100644
--- a/app/models/metric/chargeback_helper.rb
+++ b/app/models/metric/chargeback_helper.rb
@@ -1,10 +1,8 @@ module Metric::ChargebackHelper
def hash_features_affecting_rate
tags = tag_names.split('|').reject { |n| n.starts_with?('folder_path_') }.sort.join('|')
- keys = [tags, parent_host_id, parent_ems_cluster_id, parent_storage_id, parent_ems_id]
+ keys = [tags] + resource_parents.map(&:id)
keys += [resource.container_image, timestamp] if resource_type == Container.name
- tenant_resource = resource.try(:tenant)
- keys.push(tenant_resource.id) unless tenant_resource.nil?
keys.join('_')
end
@@ -17,4 +15,8 @@ end
tag_list
end
+
+ def resource_parents
+ [parent_host, parent_ems_cluster, parent_storage, parent_ems, resource.try(:tenant)].compact
+ end
end
| Move determination of resource parents to the method
|
diff --git a/mingo.gemspec b/mingo.gemspec
index abc1234..def5678 100644
--- a/mingo.gemspec
+++ b/mingo.gemspec
@@ -8,8 +8,8 @@ s.platform = Gem::Platform::RUBY
s.authors = ["Chris Hanks"]
s.email = ["christopher.m.hanks@gmail.com"]
- s.homepage = ""
- s.summary = %q{A/B testing for Rails 3 and MongoDB.}
+ s.homepage = "https://github.com/chanks/mingo"
+ s.summary = %q{A simple A/B testing engine for Rails 3.}
s.description = %q{A Rails 3 engine for simple A/B testing, with results persisted to MongoDB.}
s.rubyforge_project = "mingo"
| Update gemspec homepage and summary.
|
diff --git a/lib/sesheta/diagnosis.rb b/lib/sesheta/diagnosis.rb
index abc1234..def5678 100644
--- a/lib/sesheta/diagnosis.rb
+++ b/lib/sesheta/diagnosis.rb
@@ -1,8 +1,6 @@ class Sesheta::Diagnosis < Hashie::Trash
property :icd, :from => :ICD
property :dx_name, :from => :DxName
- property :first_name, :from => :FirstName
- property :last_name, :from => :LastName
property :id
property :start_date, :from => :StartDate
property :stop_date, :from => :StopDate
| Remove first_name and last_name properties from Visit |
diff --git a/YPImagePicker.podspec b/YPImagePicker.podspec
index abc1234..def5678 100644
--- a/YPImagePicker.podspec
+++ b/YPImagePicker.podspec
@@ -13,7 +13,7 @@ s.ios.deployment_target = "9.0"
s.source_files = 'Source/**/*.swift'
s.dependency 'SteviaLayout', '~> 4.7.3'
- s.dependency 'PryntTrimmerView', '~> 4.0.0'
+ s.dependency 'PryntTrimmerView', '~> 4.0.2'
s.resources = ['Resources/*', 'Source/**/*.xib']
s.description = "Instagram-like image picker & filters for iOS supporting videos and albums"
s.swift_versions = ['3', '4.1', '4.2', '5.0', '5.1', '5.2']
| Update PryntTrimmerView version in Podspec
|
diff --git a/lib/wptemplates/utils.rb b/lib/wptemplates/utils.rb
index abc1234..def5678 100644
--- a/lib/wptemplates/utils.rb
+++ b/lib/wptemplates/utils.rb
@@ -11,6 +11,13 @@ normalized
end
+ def normalize_linklabel string
+ normalized = string.clone
+ normalized.strip!
+ normalized.squeeze!(' ')
+ normalized
+ end
+
def symbolize string
symbolized = normalize_link(string)
symbolized.tr!(' ','_')
| Add a utility for normalizing the links label
|
diff --git a/spec/controllers/spree/admin/shipping_categories_controller_spec.rb b/spec/controllers/spree/admin/shipping_categories_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/spree/admin/shipping_categories_controller_spec.rb
+++ b/spec/controllers/spree/admin/shipping_categories_controller_spec.rb
@@ -26,6 +26,15 @@ expect(response).to redirect_to spree.admin_shipping_categories_url
expect(shipping_category.reload.name).to eq "Super Frozen"
end
+
+ it "deletes an existing shipping category" do
+ shipping_category = create(:shipping_category)
+ expect {
+ spree_delete :destroy, id: shipping_category.id
+ }.to change(Spree::ShippingCategory.all, :count).by(-1)
+
+ expect(response).to redirect_to spree.admin_shipping_categories_url
+ end
end
end
end
| Add delete action test to ShippingCategoriesController spec
|
diff --git a/callcredit.gemspec b/callcredit.gemspec
index abc1234..def5678 100644
--- a/callcredit.gemspec
+++ b/callcredit.gemspec
@@ -7,7 +7,7 @@ gem.add_runtime_dependency 'unicode_utils', '~> 1.4.0'
gem.add_development_dependency 'rspec', '~> 3.7.0'
- gem.add_development_dependency 'webmock', '~> 3.1.0'
+ gem.add_development_dependency 'webmock', '~> 3.2.0'
gem.add_development_dependency 'rubocop'
gem.authors = ['Grey Baker']
| Update webmock requirement to ~> 3.2.0
Updates the requirements on [webmock](https://github.com/bblimke/webmock) to permit the latest version.
- [Changelog](https://github.com/bblimke/webmock/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bblimke/webmock/commits/v3.2.0) |
diff --git a/config/initializers/booking_locations.rb b/config/initializers/booking_locations.rb
index abc1234..def5678 100644
--- a/config/initializers/booking_locations.rb
+++ b/config/initializers/booking_locations.rb
@@ -1,4 +1,4 @@-unless Rails.env.production?
+unless Rails.env.production? || Rails.env.staging?
require 'booking_locations/stub_api'
BookingLocations.api = BookingLocations::StubApi.new
| Use the real booking locations API in staging
This was previously using the stubbed API.
|
diff --git a/gtk3/sample/misc/recentchooserdialog.rb b/gtk3/sample/misc/recentchooserdialog.rb
index abc1234..def5678 100644
--- a/gtk3/sample/misc/recentchooserdialog.rb
+++ b/gtk3/sample/misc/recentchooserdialog.rb
@@ -37,7 +37,7 @@ puts info.uri_display
puts info.age
puts info.local?
- info.exists
+ puts info.exist?
end
else
p "Close"
| Use exist? and undo deletion of puts
|
diff --git a/checkboxes_spec.rb b/checkboxes_spec.rb
index abc1234..def5678 100644
--- a/checkboxes_spec.rb
+++ b/checkboxes_spec.rb
@@ -24,6 +24,7 @@ count = 0
browser.checkboxes.each_with_index do |c, index|
+ c.should be_instance_of(CheckBox)
c.name.should == browser.checkbox(:index, index).name
c.id.should == browser.checkbox(:index, index).id
c.value.should == browser.checkbox(:index, index).value
| Make sure CheckBoxCollection enumerates ChecBox instances.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.