diff stringlengths 65 26.7k | message stringlengths 7 9.92k |
|---|---|
diff --git a/providers/common.rb b/providers/common.rb
index abc1234..def5678 100644
--- a/providers/common.rb
+++ b/providers/common.rb
@@ -8,6 +8,12 @@ action :create
gid new_resource.group
end
+ end
+
+ directory new_resource.path do
+ action :create
+ owner new_resource.owner
+ group new_resource.group
end
# Update the code.
| Set up directory for checkout with proper perms
|
diff --git a/spec/factories/got_fixed_issues.rb b/spec/factories/got_fixed_issues.rb
index abc1234..def5678 100644
--- a/spec/factories/got_fixed_issues.rb
+++ b/spec/factories/got_fixed_issues.rb
@@ -2,7 +2,9 @@
FactoryGirl.define do
factory :got_fixed_issue, :class => 'Issue' do
- title "MyString"
+ title "A very bad issue..."
closed false
+ vendor_id "iWnj89"
+ number 7
end
end
| Extend FactoryGirl model of Issue
|
diff --git a/spec/models/file_depot_nfs_spec.rb b/spec/models/file_depot_nfs_spec.rb
index abc1234..def5678 100644
--- a/spec/models/file_depot_nfs_spec.rb
+++ b/spec/models/file_depot_nfs_spec.rb
@@ -1,5 +1,5 @@ describe FileDepotNfs do
- let(:ignore_uri) { "nfs://ignore.com/directory" }
+ let(:uri) { "nfs://ignore.com/directory" }
let(:actual_uri) { "nfs://actual_bucket/doo_directory" }
let(:file_depot_nfs) { FileDepotNfs.new(:uri => uri) }
@@ -9,7 +9,7 @@
describe "#merged_uri" do
before do
- file_depot_nfs.uri = ignore_uri
+ file_depot_nfs.uri = uri
end
it "should ignore the uri set on the depot object and return the uri parameter" do
| Fix NFS File Depot Spec Test
Tried to rename the "uri" attribute inadvertantly in previous incarnation of this
test and broke it. Fixing now.
|
diff --git a/examples/packages/databases/mysql_source.rb b/examples/packages/databases/mysql_source.rb
index abc1234..def5678 100644
--- a/examples/packages/databases/mysql_source.rb
+++ b/examples/packages/databases/mysql_source.rb
@@ -0,0 +1,41 @@+# Install the latest MySQL database from source
+package :mysql do
+ requires :mysql_dependencies, :mysql_user_group, :mysql_user, :mysql_core
+end
+
+package :mysql_dependencies do
+ description 'MySQL dependencies'
+ apt 'cmake'
+end
+
+package :mysql_user_group do
+ description 'MySQL user group'
+ group 'mysql'
+ verify do
+ has_group 'mysql'
+ end
+end
+
+package :mysql_user do
+ description 'MySQL user'
+ requires :mysql_user_group
+ runner 'useradd -r -g mysql mysql'
+ verify do
+ has_user 'mysql'
+ end
+end
+
+package :mysql_core do
+ description 'MySQL database'
+ version '5.5.25a'
+ requires :mysql_dependencies, :mysql_user_group, :mysql_user
+ source "http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-#{version}.tar.gz/from/http://cdn.mysql.com/" do
+ custom_archive "mysql-#{version}.tar.gz"
+ configure_command 'cmake .'
+ post :install, '/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql'
+ post :install, 'chown -R mysql:mysql /usr/local/mysql/data'
+ end
+ verify do
+ has_executable '/usr/local/mysql/bin/mysql'
+ end
+end
| Add example how to install MySQL from source
|
diff --git a/log.gemspec b/log.gemspec
index abc1234..def5678 100644
--- a/log.gemspec
+++ b/log.gemspec
@@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'evt-log'
- s.version = '2.1.0.0'
+ s.version = '2.1.1.0'
s.summary = 'Logging to STD IO with levels, tagging, and coloring'
s.description = ' '
| Package version is increased from 2.1.0.0 to 2.1.1.0
|
diff --git a/spec/features/create_posts_spec.rb b/spec/features/create_posts_spec.rb
index abc1234..def5678 100644
--- a/spec/features/create_posts_spec.rb
+++ b/spec/features/create_posts_spec.rb
@@ -1 +1,13 @@ require 'rails_helper.rb'
+
+feature 'Creating Posts' do
+ scenario 'Can create post' do
+ visit '/'
+ click_link 'Create Post'
+ fill_in 'Title', with: 'title'
+ fill_in 'Content', with: 'post content'
+ click_button 'Create'
+ expect(page).to have_content 'title'
+ expect(page).to have_content 'post content'
+ end
+end
| Create a failure test for creating posts
|
diff --git a/spec/integration/load_path_spec.rb b/spec/integration/load_path_spec.rb
index abc1234..def5678 100644
--- a/spec/integration/load_path_spec.rb
+++ b/spec/integration/load_path_spec.rb
@@ -0,0 +1,11 @@+require 'spec_helper'
+
+describe ROM::Roda::Plugin do
+ it 'uses load_path relative to application by default' do
+ subject.should_receive(:load_files).with(File.expand_path('models'))
+
+ class RelativeLoadPathExample < Roda
+ plugin :rom, :memory, load_path: 'models'
+ end
+ end
+end
| Add failing spec to test TravisCI
|
diff --git a/spec/regexp-random_example_spec.rb b/spec/regexp-random_example_spec.rb
index abc1234..def5678 100644
--- a/spec/regexp-random_example_spec.rb
+++ b/spec/regexp-random_example_spec.rb
@@ -16,7 +16,8 @@ random_example_matches(
/\w{10}/,
/(we(need(to(go(deeper)?)?)?)?) \1/,
- /case insensitive/i
+ /case insensitive/i,
+ /front seat|back seat/, # Which seat will I take??
)
end
end
| Test for random_example with OrGroup
Missing test area for 100% coverage
|
diff --git a/spec/features/example_feature_spec.rb b/spec/features/example_feature_spec.rb
index abc1234..def5678 100644
--- a/spec/features/example_feature_spec.rb
+++ b/spec/features/example_feature_spec.rb
@@ -8,6 +8,6 @@
scenario "When using Chrome, it works", js: true do
visit "/users"
- expect(page).to have_text("foobar")
+ expect(page).to have_text("Log in with your Rails Portal (development) account.")
end
end
| Correct expectation in feature spec
|
diff --git a/spec/read_time_estimator_spec.rb b/spec/read_time_estimator_spec.rb
index abc1234..def5678 100644
--- a/spec/read_time_estimator_spec.rb
+++ b/spec/read_time_estimator_spec.rb
@@ -9,9 +9,10 @@ end
end
- describe "time_per_word" do
+ describe "minutes_to_read" do
it "should output an amount of time given the length of a word" do
- expect("supercalifragilisticexpialidocious".time_per_word).to eql "02:10"
+ text = "word " * 250
+ expect(text.minutes_to_read.to eql 1.0
end
end
end
| Replace time_per_word spec with minutes_to_read spec. PA-2182
|
diff --git a/spec/support/platform_helpers.rb b/spec/support/platform_helpers.rb
index abc1234..def5678 100644
--- a/spec/support/platform_helpers.rb
+++ b/spec/support/platform_helpers.rb
@@ -1,8 +1,6 @@ def windows?
!!(RUBY_PLATFORM =~ /mswin|mingw|windows/)
end
-
-# def jruby?
def unix?
!windows?
| Remove the unused platform helper
Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
|
diff --git a/lib/raygun/testable.rb b/lib/raygun/testable.rb
index abc1234..def5678 100644
--- a/lib/raygun/testable.rb
+++ b/lib/raygun/testable.rb
@@ -4,7 +4,14 @@ class ItWorksException < StandardError; end
def track_test_exception
- Raygun.track_exception(ItWorksException.new("Woohoo!"))
+ Raygun.configuration.silence_reporting = false
+ raise ItWorksException.new("Woohoo!")
+ rescue ItWorksException => e
+ if Raygun.track_exception(e).success?
+ puts "Success! Now go check your Raygun.io Dashboard"
+ else
+ puts "Oh-oh, something went wrong - double check your API key"
+ end
end
end
| Add some informative output to the test task
|
diff --git a/lib/redactor2_rails.rb b/lib/redactor2_rails.rb
index abc1234..def5678 100644
--- a/lib/redactor2_rails.rb
+++ b/lib/redactor2_rails.rb
@@ -17,21 +17,21 @@ require 'redactor2_rails/orm/mongoid'
require 'redactor2_rails/engine'
- mattr_accessor :images_file_types, :files_file_types
+ mattr_accessor :images_file_types, :files_file_types, :devise_user, :image_model, :file_model
@@images_file_types = ['jpg', 'jpeg', 'png', 'gif', 'tiff']
@@files_file_types = ['pdf', 'doc', 'docx', 'xls', 'xlsx', 'rtf', 'txt']
def self.image_model
- Redactor2Rails::Image
+ @image_model || Redactor2Rails::Image
end
def self.file_model
- Redactor2Rails::File
+ @file_model || Redactor2Rails::File
end
def self.devise_user
- :user
+ @devise_user || :user
end
def self.devise_user_key
| Add possibility to update main configs by Redactor2Rails.devise_user=:admin
|
diff --git a/lib/tasks/article.rake b/lib/tasks/article.rake
index abc1234..def5678 100644
--- a/lib/tasks/article.rake
+++ b/lib/tasks/article.rake
@@ -16,4 +16,10 @@ Rails.logger.info 'Updating views for newly added articles'
Article.update_new_views
end
+
+ desc 'Update ratings for all articles'
+ task update_ratings: :environment do
+ Rails.logger.info 'Updating article ratings'
+ Article.update_all_ratings
+ end
end
| Add rake task to update ratings
|
diff --git a/lib/zebra/print_job.rb b/lib/zebra/print_job.rb
index abc1234..def5678 100644
--- a/lib/zebra/print_job.rb
+++ b/lib/zebra/print_job.rb
@@ -28,11 +28,12 @@
def send_to_printer(path)
# My ip is 192.168.101.99
- if RUBY_PLATFORM =~ /darwin/
- `lpr -h 192.168.101.99 -P #{@printer}`
- else
- `lp -h 192.168.101.99 -d #{@printer}`
- end
+ `lp -h 192.168.101.99 -d #{@printer} -o raw #{path}`
+ # if RUBY_PLATFORM =~ /darwin/
+ # `lpr -h 192.168.101.99 -P #{@printer} -o raw #{path}`
+ # else
+ # `lp -h 192.168.101.99 -d #{@printer} -o raw #{path}`
+ # end
end
end
end
| Remove conditional lp command args
|
diff --git a/lib/zebra/print_job.rb b/lib/zebra/print_job.rb
index abc1234..def5678 100644
--- a/lib/zebra/print_job.rb
+++ b/lib/zebra/print_job.rb
@@ -24,13 +24,10 @@
def check_existent_printers(printer)
existent_printers = Cups.show_destinations
- puts "EXISTENT PRINTERS: \n"
- existent_printers.each { |x| puts x }
raise UnknownPrinter.new(printer) unless existent_printers.include?(printer)
end
def send_to_printer(path)
- # debugger
puts "* * * * * * * * * * * * Sending file to printer #{@printer} at #{@remote_ip} * * * * * * * * * * "
`lp -h #{@remote_ip} -d #{@printer} -o raw #{path}`
end
| Remove logger info from print job
|
diff --git a/spec/keen-cli/collections_spec.rb b/spec/keen-cli/collections_spec.rb
index abc1234..def5678 100644
--- a/spec/keen-cli/collections_spec.rb
+++ b/spec/keen-cli/collections_spec.rb
@@ -11,6 +11,14 @@ expect(_).to eq(true)
end
+ it 'deletes the collection with filters' do
+ filters = '[{"property_name":"enemy","operator":"eq","property_value":"creeper"}]'
+ stub_request(:delete, "https://api.keen.io/3.0/projects/#{Keen.project_id}/events/minecraft-deaths?filters=%5B%7B%22property_name%22%3A%22enemy%22%2C%22operator%22%3A%22eq%22%2C%22property_value%22%3A%22creeper%22%7D%5D").
+ to_return(:status => 204, :body => "")
+ _, options = start "collections:delete --collection minecraft-deaths --filters #{filters}"
+ expect(_).to eq(true)
+ end
+
end
end
| Add spec for filtered delete
|
diff --git a/test/spec/settings/get_setting.rb b/test/spec/settings/get_setting.rb
index abc1234..def5678 100644
--- a/test/spec/settings/get_setting.rb
+++ b/test/spec/settings/get_setting.rb
@@ -1,21 +1,27 @@-data = {
- "some_setting" => "some value"
-}
+module GetSetting
+ def self.data
+ {
+ "some_setting" => "some value"
+ }
+ end
-settings = Settings.new data
+ def self.settings
+ Settings.new data
+ end
-describe Settings do
+ def self.get(key)
+ settings.get key
+ end
+end
+
+describe "Get Settings", :* do
specify "Getting a setting from the setting data gets the setting's value" do
- key = 'some_setting'
- setting = settings.get key
-
+ setting = GetSetting.get 'some_setting'
expect(setting == 'some value').to be
end
specify "Trying to get a setting that isn't in the data gets a nil" do
- key = 'setting_that_isnt_in_the_data'
- setting = settings.get key
-
+ setting = GetSetting.get 'setting_that_isnt_in_the_data'
expect(setting == nil).to be
end
end
| Test uses a control module
|
diff --git a/metadata.rb b/metadata.rb
index abc1234..def5678 100644
--- a/metadata.rb
+++ b/metadata.rb
@@ -4,7 +4,7 @@ license 'MIT'
description 'Installs/Configures New Relic'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version '2.7.2'
+version '2.8.0'
%w( debian ubuntu redhat centos fedora scientific amazon windows smartos ).each do |os|
supports os
| Enable the thread profiler based on attributes
|
diff --git a/metadata.rb b/metadata.rb
index abc1234..def5678 100644
--- a/metadata.rb
+++ b/metadata.rb
@@ -1,7 +1,7 @@-name 'magic'
+name 'et_magic'
version File.read(File.join(File.dirname(__FILE__), 'VERSION')).strip
description 'Cookbook helpers and other magical things'
long_description 'Cookbook helpers and other magical things'
maintainer 'Sean Clemmer'
maintainer_email 'sczizzo@gmail.com'
-license 'ISC'+license 'ISC'
| Rename cookbook to et_magic cookbook |
diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb
index abc1234..def5678 100644
--- a/spec/spec_helper_acceptance.rb
+++ b/spec/spec_helper_acceptance.rb
@@ -2,26 +2,16 @@ require 'beaker-puppet'
require 'beaker/puppet_install_helper'
require 'beaker/module_install_helper'
-require 'pry'
-install_puppet_agent_on(hosts)
+run_puppet_install_helper unless ENV['BEAKER_provision'] == 'no'
RSpec.configure do |c|
- # Project root
- proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
-
# Readable test descriptions
c.formatter = :documentation
# Configure all nodes in nodeset
c.before :suite do
- # Install module
- puppet_module_install(source: proj_root, module_name: 'virtualbox')
- hosts.each do |host|
- on host, puppet('module', 'install', 'puppetlabs-stdlib'), acceptable_exit_codes: [0, 1]
- on host, puppet('module', 'install', 'puppetlabs-apt'), acceptable_exit_codes: [0, 1]
- on host, puppet('module', 'install', 'stahnma-epel'), acceptable_exit_codes: [0, 1]
- on host, puppet('module', 'install', 'darin-zypprepo'), acceptable_exit_codes: [0, 1]
- end
+ install_module
+ install_module_dependencies
end
end
| Clean up acceptance spec helper
|
diff --git a/spec/tty/table/options_spec.rb b/spec/tty/table/options_spec.rb
index abc1234..def5678 100644
--- a/spec/tty/table/options_spec.rb
+++ b/spec/tty/table/options_spec.rb
@@ -7,7 +7,10 @@ let(:widths) { [] }
let(:aligns) { [] }
let(:object) {
- described_class.new rows, :column_widths => widths, :column_aligns => aligns
+ described_class.new rows,
+ :column_widths => widths,
+ :column_aligns => aligns,
+ :renderer => :basic
}
subject { object.to_s; object.renderer }
| Fix test failing on some rubies.
|
diff --git a/app/controllers/spree/admin/integration_controller.rb b/app/controllers/spree/admin/integration_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/spree/admin/integration_controller.rb
+++ b/app/controllers/spree/admin/integration_controller.rb
@@ -1,8 +1,10 @@ module Spree
module Admin
class IntegrationController < Spree::Admin::BaseController
+ include HTTParty
+ base_uri 'http://augury-admin.dev/api'
+
def register
-
email = 'integrator@spreecommerce.com'
if user = Spree::User.where('email' => email).first
# do nothing, for now....
@@ -16,13 +18,26 @@ user.generate_spree_api_key!
end
- # HTTParty.post to see if store is already registered (and get store_if so)
- #
- # if not another post to register
- #
+ # Register Store if Spree::Config[:store_id] isn't present
+ unless Spree::Config[:store_id].present?
+ options = {
+ body: {
+ signup: {
+ name: Spree::Config[:site_name],
+ url: request.url,
+ version: Spree.version,
+ api_key: user.spree_api_key,
+ email: email,
+ }
+ }
+ }
- Spree::Config[:store_id] = '123' #should be real store_id returned either post above.
-
+ response = self.class.post('/signups.json', options)
+ if response.code == 201
+ Spree::Config[:store_id] = response["store_id"]
+ Spree::Config[:pro_api_key] = response["auth_token"]
+ end
+ end
redirect_to :action => :show
end
| Use augury admin api for integration registration
|
diff --git a/lib/flash_patch/rails_3_1_session_loader.rb b/lib/flash_patch/rails_3_1_session_loader.rb
index abc1234..def5678 100644
--- a/lib/flash_patch/rails_3_1_session_loader.rb
+++ b/lib/flash_patch/rails_3_1_session_loader.rb
@@ -0,0 +1,14 @@+module FlashPatch
+ class Rails31SessionLoader
+ def initialize(decrypted_session_string)
+ @decrypted_session_string = decrypted_session_string
+ end
+
+ def load_session
+ session = Marshal.load @decrypted_session_string.gsub('FlashHash','FlashGash')
+ flash_messages_from_original_klass = session.delete('flash')
+ session['flash'] = ActionDispatch::Flash::FlashHash.new.update(flash_messages_from_original_klass)
+ session
+ end
+ end
+end
| Implement loader for Rails 3 1 session string by a Rails 3 0 app
|
diff --git a/lib/sastrawi/dictionary/array_dictionary.rb b/lib/sastrawi/dictionary/array_dictionary.rb
index abc1234..def5678 100644
--- a/lib/sastrawi/dictionary/array_dictionary.rb
+++ b/lib/sastrawi/dictionary/array_dictionary.rb
@@ -36,7 +36,7 @@ # Add a word to the dictionary
def add(word)
- return if word == ''
+ return if word.strip == ''
@words.push(word)
end
| Remove all whitespace from the start and the end before adding a word to dictionary
|
diff --git a/lib/vagrant/ansible_auto/cap/guest/posix.rb b/lib/vagrant/ansible_auto/cap/guest/posix.rb
index abc1234..def5678 100644
--- a/lib/vagrant/ansible_auto/cap/guest/posix.rb
+++ b/lib/vagrant/ansible_auto/cap/guest/posix.rb
@@ -0,0 +1,16 @@+
+# Here for documentation purposes only
+
+module VagrantPlugins
+ module AnsibleAuto
+ # Capabilities on guests and hosts
+ module Cap
+ # Capabilities on guests
+ module Guest
+ # Capabilities on POSIX hosts
+ module POSIX
+ end
+ end
+ end
+ end
+end
| Add POSIX capability parent module
for documentation purposes
|
diff --git a/test/text_bringer/test_buffer.rb b/test/text_bringer/test_buffer.rb
index abc1234..def5678 100644
--- a/test/text_bringer/test_buffer.rb
+++ b/test/text_bringer/test_buffer.rb
@@ -0,0 +1,14 @@+require "test/unit"
+require "text_bringer/buffer"
+
+class TestBuffer < Test::Unit::TestCase
+ include TextBringer
+
+ def test_delete_char
+ buffer = Buffer.new
+ buffer.insert("abc")
+ buffer.backward_char(2)
+ buffer.delete_char
+ assert_equal("ac", buffer.to_s)
+ end
+end
| Add a test for TextBringer::Buffer.
|
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb
index abc1234..def5678 100644
--- a/config/initializers/assets.rb
+++ b/config/initializers/assets.rb
@@ -4,7 +4,7 @@ Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path
-# Rails.application.config.assets.paths << Emoji.images_path
+Rails.application.config.assets.paths << "public/assets"
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
| Fix asset paths for production
|
diff --git a/templates/guide/fulldoc/html/setup.rb b/templates/guide/fulldoc/html/setup.rb
index abc1234..def5678 100644
--- a/templates/guide/fulldoc/html/setup.rb
+++ b/templates/guide/fulldoc/html/setup.rb
@@ -5,6 +5,14 @@ result = ''
log.enter_level(Logger::ERROR) { result = super }
result
+ end
+
+ def url_for(object, *args)
+ if CodeObjects::ExtraFileObject === object && object == options.readme
+ 'index.html'
+ else
+ super
+ end
end
end
| Update URL links for readme file in guide template
|
diff --git a/test/unit/lookups/pelias_test.rb b/test/unit/lookups/pelias_test.rb
index abc1234..def5678 100644
--- a/test/unit/lookups/pelias_test.rb
+++ b/test/unit/lookups/pelias_test.rb
@@ -23,7 +23,7 @@ end
def test_query_for_reverse_geocode
- lookup = Geocoder::Lookup::Mapzen.new
+ lookup = Geocoder::Lookup::Pelias.new
url = lookup.query_url(Geocoder::Query.new([45.423733, -75.676333]))
assert_match(/point.lat=45.423733&point.lon=-75.676333&size=1/, url)
end
| Use lookup indicated by test file.
|
diff --git a/test/integration/pretty_print_test.rb b/test/integration/pretty_print_test.rb
index abc1234..def5678 100644
--- a/test/integration/pretty_print_test.rb
+++ b/test/integration/pretty_print_test.rb
@@ -12,7 +12,7 @@ tmp.write str
tmp.flush
is_ok = `ruby -c #{tmp.path} 2>&1`
- assert_equal "Syntax OK\n", is_ok
+ is_ok.must_match /^Syntax OK/
end
describe "for the Regress module" do
| Allow for slightly different Syntax OK message from JRuby.
|
diff --git a/sunspot-queue.gemspec b/sunspot-queue.gemspec
index abc1234..def5678 100644
--- a/sunspot-queue.gemspec
+++ b/sunspot-queue.gemspec
@@ -13,6 +13,7 @@ s.add_dependency "resque"
s.add_dependency "sunspot_rails", ">= 1.3.0"
+ s.add_development_dependency "rake"
s.add_development_dependency "rspec", "~> 2.10.0"
s.add_development_dependency "resque_spec"
s.add_development_dependency "sunspot_solr"
| Add rake as a development dependency.
Rake is acting odd unless it's run through bundle exec.
|
diff --git a/omniauth-orcid.gemspec b/omniauth-orcid.gemspec
index abc1234..def5678 100644
--- a/omniauth-orcid.gemspec
+++ b/omniauth-orcid.gemspec
@@ -1,3 +1,4 @@+require "date"
require File.expand_path("../lib/omniauth-orcid/version", __FILE__)
Gem::Specification.new do |s|
| Fix "undefined method `today' for Date:Class" error.
|
diff --git a/_plugins/jekyll-pages-directory.rb b/_plugins/jekyll-pages-directory.rb
index abc1234..def5678 100644
--- a/_plugins/jekyll-pages-directory.rb
+++ b/_plugins/jekyll-pages-directory.rb
@@ -0,0 +1,52 @@+# https://github.com/bbakersmith/jekyll-pages-directory/blob/master/_plugins/jekyll-pages-directory.rb
+module Jekyll
+ class PagesDirGenerator < Generator
+ def generate(site)
+ pages_dir = site.config['pages'] || './_pages'
+ all_raw_paths = Dir["#{pages_dir}/**/*"]
+ all_raw_paths.each do |f|
+
+ if File.file?(File.join(site.source, '/', f))
+ filename = f.match(/[^\/]*$/)[0]
+ clean_filepath = f.gsub(/^#{pages_dir}\//, '')
+ clean_dir = extract_directory(clean_filepath)
+
+ site.pages << PagesDirPage.new(site,
+ site.source,
+ clean_dir,
+ filename,
+ pages_dir)
+
+ end
+ end
+ end
+
+ def extract_directory(filepath)
+ dir_match = filepath.match(/(.*\/)[^\/]*$/)
+ if dir_match
+ return dir_match[1]
+ else
+ return ''
+ end
+ end
+ end
+
+ class PagesDirPage < Page
+
+ def initialize(site, base, dir, name, pagesdir)
+ @site = site
+ @base = base
+ @dir = dir
+ @name = name
+
+ process(name)
+ read_yaml(File.join(base, pagesdir, dir), name)
+
+ data.default_proc = proc do |hash, key|
+ site.frontmatter_defaults.find(File.join(dir, name), type, key)
+ end
+
+ Jekyll::Hooks.trigger :pages, :post_init, self
+ end
+ end
+end
| Add plugin to enable _pages directory
https://github.com/bbakersmith/jekyll-pages-directory
|
diff --git a/lib/chore/strategies/worker/single_worker_strategy.rb b/lib/chore/strategies/worker/single_worker_strategy.rb
index abc1234..def5678 100644
--- a/lib/chore/strategies/worker/single_worker_strategy.rb
+++ b/lib/chore/strategies/worker/single_worker_strategy.rb
@@ -1,6 +1,6 @@ module Chore
module Strategy
- class SingleWorkerStrategy
+ class SingleWorkerStrategy
def initialize(manager)
@manager = manager
@worker = nil
@@ -10,9 +10,7 @@
def assign(work)
if workers_available?
- @worker = Worker.new
- @worker.start(work)
- @worker = nil
+ @worker = Worker.start(work)
true
end
end
| Fix SingleWorker's job startup call
|
diff --git a/lib/fog/octocloud/requests/compute/local_create_vm.rb b/lib/fog/octocloud/requests/compute/local_create_vm.rb
index abc1234..def5678 100644
--- a/lib/fog/octocloud/requests/compute/local_create_vm.rb
+++ b/lib/fog/octocloud/requests/compute/local_create_vm.rb
@@ -8,6 +8,8 @@ target.mkdir unless target.exist?
source = @box_dir.join(boxname)
+
+ raise "Invalid Cube Specified" unless source.exist?
# Copy the VMX over
FileUtils.cp(Pathname.glob(source.join("*.vmx")).first,
| Raise if cube doesn't exist.
|
diff --git a/xtime.rb b/xtime.rb
index abc1234..def5678 100644
--- a/xtime.rb
+++ b/xtime.rb
@@ -1,6 +1,6 @@ #!/usr/bin/env ruby
def mem(pid); `ps p #{pid} -o rss`.split.last.to_i; end
-t = Time.now
+t0 = Process.clock_gettime(Process::CLOCK_MONOTONIC)
pid = Process.spawn(*ARGV.to_a)
mm = 0
@@ -14,5 +14,5 @@ end
Process.waitall
-STDERR.puts "== %.2fs, %.1fMb ==" % [Time.now - t, mm / 1024.0]
-
+t1 = Process.clock_gettime(Process::CLOCK_MONOTONIC)
+STDERR.puts "== %.2fs, %.1fMb ==" % [t1 - t0, mm / 1024.0]
| Use monotonic time for measuring wall-clock time
|
diff --git a/test/cli/command/test_sessions.rb b/test/cli/command/test_sessions.rb
index abc1234..def5678 100644
--- a/test/cli/command/test_sessions.rb
+++ b/test/cli/command/test_sessions.rb
@@ -0,0 +1,41 @@+# frozen_string_literal: true
+
+require "helpers"
+
+# Tests for KBSecret::CLI::Command::Sessions
+class KBSecretCommandSessionsTest < Minitest::Test
+ include Helpers
+ include Helpers::CLI
+
+ def test_sessions_help
+ sessions_helps = [
+ %w[sessions --help],
+ %w[sessions -h],
+ %w[help sessions],
+ ]
+
+ sessions_helps.each do |sessions_help|
+ stdout, = kbsecret(*sessions_help)
+ assert_match(/Usage:/, stdout)
+ end
+ end
+
+ def test_sessions_outputs_list
+ stdout, = kbsecret "sessions"
+
+ stdout.lines.each do |session|
+ session.chomp!
+ assert KBSecret::Config.session?(session)
+ end
+ end
+
+ def test_sessions_outputs_all
+ stdout, = kbsecret "sessions", "-a"
+
+ user_team_count = stdout.lines.count { |line| line =~ /(Team|Users):/ }
+ secrets_root_count = stdout.lines.count { |lines| lines =~ /Secrets root:/ }
+
+ assert_equal KBSecret::Config.session_labels.size, user_team_count.size
+ assert_equal KBSecret::Config.session_labels.size, secrets_root_count.size
+ end
+end
| test/cli: Add tests for `kbsecret sessions`
|
diff --git a/Casks/clamxav.rb b/Casks/clamxav.rb
index abc1234..def5678 100644
--- a/Casks/clamxav.rb
+++ b/Casks/clamxav.rb
@@ -0,0 +1,7 @@+class Clamxav < Cask
+ url 'http://www.clamxav.com/downloads/ClamXav_2.3.6.dmg'
+ homepage 'http://www.clamxav.com/'
+ version '2.3.6'
+ sha1 '4e59947bc049109c375613979fb6092ffe67aa55'
+ link :app, 'ClamXav.app'
+end
| Add ClamXav (Version 2.3.6) Cask
|
diff --git a/lib/generators/crono/install/templates/migrations/create_crono_jobs.rb b/lib/generators/crono/install/templates/migrations/create_crono_jobs.rb
index abc1234..def5678 100644
--- a/lib/generators/crono/install/templates/migrations/create_crono_jobs.rb
+++ b/lib/generators/crono/install/templates/migrations/create_crono_jobs.rb
@@ -2,7 +2,7 @@ def self.up
create_table :crono_jobs do |t|
t.string :job_id, null: false
- t.text :log
+ t.text :log, limit: 4294967295 # LONGTEXT for MySQL
t.datetime :last_performed_at
t.boolean :healthy
t.timestamps null: false
| Fix MySQL default text size limit
|
diff --git a/s3-authorize.gemspec b/s3-authorize.gemspec
index abc1234..def5678 100644
--- a/s3-authorize.gemspec
+++ b/s3-authorize.gemspec
@@ -18,7 +18,7 @@ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
- spec.add_development_dependency "bundler", "~> 1.11"
+ spec.add_development_dependency "bundler"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency 'rspec', '~> 3.0'
end
| Remove version of development dependency "bundler"
|
diff --git a/spec/ethos/entity.rb b/spec/ethos/entity.rb
index abc1234..def5678 100644
--- a/spec/ethos/entity.rb
+++ b/spec/ethos/entity.rb
@@ -41,6 +41,12 @@ entity = Entity.new
asserts(entity.value) == 1
+ end
+
+ spec do
+ entity = Entity.new value: 2
+
+ asserts(entity.value) == 2
end
end
| Allow default attributes to be overridden
|
diff --git a/spec/minimax_spec.rb b/spec/minimax_spec.rb
index abc1234..def5678 100644
--- a/spec/minimax_spec.rb
+++ b/spec/minimax_spec.rb
@@ -0,0 +1,39 @@+require_relative '../lib/tic_tac_toe.rb'
+require 'pry'
+
+describe TicTacToe do
+ # let(:ttt){TicTacToe.new}
+ describe '#minimax' do
+ context 'a player wins' do
+ it "returns 1000 if it is a winning board is X" do
+ board = ["X", "X", "X", "O", "X", "X", "O", "X", "O"]
+ expect(TicTacToe.new(board, "X").minimax).to eq 1000
+ end
+
+ it "returns -1000 if it is a winning board is O" do
+ board = ["X", "X", "O", "O", "X", "X", "O", "O", "O"]
+ expect(TicTacToe.new(board, "O").minimax).to eq -1000
+ end
+ end
+
+ context 'draw' do
+ it "returns 0 if it is a draw" do
+ board = ["X", "O", "X", "X", "O", "O", "O", "X", "O"]
+ expect(TicTacToe.new(board, "O").minimax).to eq 0
+ end
+ end
+
+ context 'one move away from win' do
+ it "returns 990 if it is a winning board is X" do
+ board = ["X", "X", " ", " ", " ", " ", " ", " ", " "]
+ expect(TicTacToe.new(board, "X").minimax).to eq 990
+ end
+
+ it "returns -990 if it is a winning board is O" do
+ board = [" ", " ", " ", " ", " ", " ", " ", "O", "O"]
+ expect(TicTacToe.new(board, "O").minimax).to eq -990
+ end
+ end
+
+ end
+end | Test for minimax method, create test for winning, losing, draw, and step a way from winning and losing
|
diff --git a/aphrodite/app/controllers/api/v2/base_controller.rb b/aphrodite/app/controllers/api/v2/base_controller.rb
index abc1234..def5678 100644
--- a/aphrodite/app/controllers/api/v2/base_controller.rb
+++ b/aphrodite/app/controllers/api/v2/base_controller.rb
@@ -32,7 +32,7 @@ headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Expose-Headers'] = 'ETag'
headers['Access-Control-Allow-Methods'] = 'GET, POST, PATCH, PUT, DELETE, OPTIONS, HEAD'
- headers['Access-Control-Allow-Headers'] = '*,x-requested-with,Content-Type,If-Modified-Since,If-None-Match'
+ headers['Access-Control-Allow-Headers'] = '*,x-requested-with,Content-Type,If-Modified-Since,If-None-Match,Authorization'
headers['Access-Control-Max-Age'] = '86400'
end
| [aphrodite] Add Authorization to headers for CORS
|
diff --git a/backend/spec/controllers/spree/admin/alerts_spec.rb b/backend/spec/controllers/spree/admin/alerts_spec.rb
index abc1234..def5678 100644
--- a/backend/spec/controllers/spree/admin/alerts_spec.rb
+++ b/backend/spec/controllers/spree/admin/alerts_spec.rb
@@ -14,7 +14,7 @@ end
before do
- # Spree::Alert.should_receive(:current).and_return("string")
+ expect(Spree::Alert).to receive(:current).and_return("string")
end
# Regression test for #3716
| Stop hitting Spree's servers when running specs
I noticed this while running specs offline.
We were hitting Spree's "alert" endpoint every time we ran this backend spec.
|
diff --git a/DKHelper.podspec b/DKHelper.podspec
index abc1234..def5678 100644
--- a/DKHelper.podspec
+++ b/DKHelper.podspec
@@ -9,5 +9,5 @@ s.platform = :ios
s.ios.deployment_target = "7.1"
s.requires_arc = true
- s.source_files = 'DKHelper/*'
+ s.source_files = 'Sources/*'
end
| Update podspec file to link the sources
|
diff --git a/features/support/env.rb b/features/support/env.rb
index abc1234..def5678 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -1,7 +1,7 @@ require 'aruba/cucumber'
require 'stack_master'
require 'stack_master/testing'
-require 'aruba/in_process'
+require 'aruba/processes/in_process'
require 'pry'
require 'cucumber/rspec/doubles'
| Fix build failures from deprecated require
|
diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/main_controller.rb
+++ b/app/controllers/main_controller.rb
@@ -14,12 +14,13 @@ end
def stats
- @most_followed = Person.all :include => :user, :order => 'users.followers_count desc', :limit => 5
- @most_active = Person.all :include => :user, :order => 'users.statuses_count desc', :limit => 5
+ @most_followed = Person.all :joins => :user, :order => 'users.followers_count desc', :limit => 5
+ @most_active = Person.all :joins => :user, :order => 'users.statuses_count desc', :limit => 5
- @most_new_seven_days = Person.all(:include => {:user => :stats}, :order => 'stats.followers_change_last_seven_days desc', :limit => 5).map{|p| [p, p.user.stats.followers_change_last_seven_days]}
- @most_new_thirty_days = Person.all(:include => {:user => :stats}, :order => 'stats.followers_change_last_thirty_days desc', :limit => 5).map{|p| [p, p.user.stats.followers_change_last_thirty_days]}
+ @most_new_seven_days = Person.all(:joins => {:user => :stats}, :order => 'stats.followers_change_last_seven_days desc', :limit => 5).map{|p| [p, p.user.stats.followers_change_last_seven_days]}
+ @most_new_thirty_days = Person.all(:joins => {:user => :stats}, :order => 'stats.followers_change_last_thirty_days desc', :limit => 5).map{|p| [p, p.user.stats.followers_change_last_thirty_days]}
end
+
protected
| Fix bug on stats page when Person doesn't have a User
|
diff --git a/app/controllers/pacs_controller.rb b/app/controllers/pacs_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/pacs_controller.rb
+++ b/app/controllers/pacs_controller.rb
@@ -1,10 +1,22 @@ class PacsController < EmbeddedToolsController
+ before_action :authenticate, if: :authentication_required?
+
def exclude_syndicated_iframe_resizer?
true
end
protected
+ def authenticate
+ authenticate_or_request_with_http_basic do |username, password|
+ Authenticable.authenticate(username, password)
+ end
+ end
+
+ def authentication_required?
+ Authenticable.staging? || Rails.env.production?
+ end
+
def category_id
nil
end
| Add a temporary authentication on pacs tool
Disclaimer: I don't think there should be an automated test for this since
it will be removed in a few days.
|
diff --git a/games/network_game.rb b/games/network_game.rb
index abc1234..def5678 100644
--- a/games/network_game.rb
+++ b/games/network_game.rb
@@ -1,6 +1,6 @@ #/usr/bin/env ruby
-require './state'
-require './client'
+require File.expand_path('../../lib/state.rb', __FILE__)
+require File.expand_path('../../lib/client.rb', __FILE__)
require 'debugger'
class Game
@@ -16,14 +16,14 @@ # make first move if true
if nc.acceptGame(gameId)
puts "First Move is mine"
- nc.move(game.evalMove)
+ nc.move(game.negamaxMove)
end
while not game.gameOver? do
nc.waitForMove
game.humanMove(nc.getOpponentMove)
break if game.gameOver?
- nc.move(game.evalMove)
+ nc.move(game.negamaxMove)
end
nc.exit
| Update network game to use new paths
|
diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/bids_controller.rb
+++ b/app/controllers/bids_controller.rb
@@ -1,11 +1,6 @@ class BidsController < ApplicationController
before_action :set_round, only: [:index, :create]
before_action :set_player, only: [:create]
-
- def index
- @bids = @round.bids.all
- render :index, status: 200, locals: {errors: []}
- end
def create
submit_bid = SubmitBid.new(@round, @player, bid_params[:number_of_tricks], bid_params[:suit])
@@ -28,7 +23,7 @@ end
def set_player
- @player = Player.find_by(user: current_user)
+ @player = @round.game.players.find_by(user: current_user)
end
def bid_params
| Fix bug where users were being confused across multiple rounds
|
diff --git a/app/controllers/pins_controller.rb b/app/controllers/pins_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/pins_controller.rb
+++ b/app/controllers/pins_controller.rb
@@ -13,8 +13,8 @@ end
def create
- @user = User.find(params[:id])
- @pin = Pin.new(song_id: params[:song_id], user: @user.id, latitude: params[:lat], longitude: params[:lng], song_id: params[:song_id])
+ user = User.find(params[:id])
+ @pin = Pin.new(song_id: params[:song_id], user: user.id, latitude: params[:lat], longitude: params[:lng], song_id: params[:song_id])
redirect_to "pins/_form"
end
| Fix controller create method with local variables
|
diff --git a/Casks/google-earth-pro.rb b/Casks/google-earth-pro.rb
index abc1234..def5678 100644
--- a/Casks/google-earth-pro.rb
+++ b/Casks/google-earth-pro.rb
@@ -8,7 +8,9 @@ license :gratis
tags :vendor => 'Google'
- app 'Google Earth Pro.app'
+ pkg 'Install Google Earth.pkg'
+
+ uninstall :pkgutil => 'com.Google.GoogleEarthPro'
zap :delete => [
'~/Library/Application Support/Google Earth',
| Change install to pkg in Google Earth Pro Cask
|
diff --git a/Casks/intellij-idea-ce.rb b/Casks/intellij-idea-ce.rb
index abc1234..def5678 100644
--- a/Casks/intellij-idea-ce.rb
+++ b/Casks/intellij-idea-ce.rb
@@ -1,6 +1,6 @@ cask 'intellij-idea-ce' do
- version '2016.2.3'
- sha256 '3a180ff30a8c9b7bf8bf38f6297fcd9ec6d8994e2b0489b97bfbeead362fb3b8'
+ version '2016.2.4'
+ sha256 '36d7aaf6a10a5c3ac7899c8482449fbe7617d23c4a635086d48b4190551b921b'
url "https://download.jetbrains.com/idea/ideaIC-#{version}.dmg"
name 'IntelliJ IDEA Community Edition'
| Update IntelliJ IDEA CE to 2016.2.4
|
diff --git a/Casks/mendeley-desktop.rb b/Casks/mendeley-desktop.rb
index abc1234..def5678 100644
--- a/Casks/mendeley-desktop.rb
+++ b/Casks/mendeley-desktop.rb
@@ -1,6 +1,6 @@ cask :v1 => 'mendeley-desktop' do
- version '1.13.5'
- sha256 '99cc040095b198c984f8193eb7b5da4c39bbf77ac1b715161b4036ca7d55db35'
+ version '1.13.6'
+ sha256 '77eef115c488662494b2fcdcbbddcdde63bfe7d81800e5445a02228a0630160e'
url "http://desktop-download.mendeley.com/download/Mendeley-Desktop-#{version}-OSX-Universal.dmg"
name 'Mendeley'
| Upgrade Mendeley Desktop to v1.13.6
|
diff --git a/app/lib/service_change_notifier.rb b/app/lib/service_change_notifier.rb
index abc1234..def5678 100644
--- a/app/lib/service_change_notifier.rb
+++ b/app/lib/service_change_notifier.rb
@@ -12,7 +12,7 @@ 'error' => 'Request is nil')
elsif request == Net::HTTPSuccess
else
- send_mail(s, status)
+ send_mail(s.url, status)
request.retry
end
end
| Use service url instead of service
|
diff --git a/app/models/govuk_taxonomy/taxon.rb b/app/models/govuk_taxonomy/taxon.rb
index abc1234..def5678 100644
--- a/app/models/govuk_taxonomy/taxon.rb
+++ b/app/models/govuk_taxonomy/taxon.rb
@@ -2,10 +2,13 @@ # If you're changing it, consider extracting to a common Gem first, eh
module GovukTaxonomy
class Taxon
- extend Forwardable
attr_reader :name, :content_id, :base_path
attr_accessor :parent_node, :children
- def_delegators :tree, :map, :each
+
+ delegate :map,
+ :each,
+ :count,
+ to: :tree
def initialize(title:, base_path:, content_id:)
@name = title
@@ -42,8 +45,6 @@ ancestors + [self]
end
- delegate :count, to: :tree
-
def root?
parent_node.nil?
end
| Fix subtle 'delegate' v Forwardable conflict
These two methods of delegation aren't compatible. Since 'delegate'
is the one preferred by RuboCop, this removes all instances of the
'Forwardable' module, and replaces them with plain 'delegate' calls.
|
diff --git a/app/models/manual_with_sections.rb b/app/models/manual_with_sections.rb
index abc1234..def5678 100644
--- a/app/models/manual_with_sections.rb
+++ b/app/models/manual_with_sections.rb
@@ -1,17 +1,9 @@ class ManualWithSections
- attr_writer :sections, :removed_sections
+ attr_accessor :sections, :removed_sections
def initialize(sections: [], removed_sections: [])
@sections = sections
@removed_sections = removed_sections
- end
-
- def sections
- @sections.to_enum
- end
-
- def removed_sections
- @removed_sections.to_enum
end
def reorder_sections(section_order)
| Make array accessors return mutable instance vars
While this isn't ideal, it's going to make it easier for me to move
methods in `ManualWithSections` up into `Manual` incrementally.
|
diff --git a/Formula/gnupg.rb b/Formula/gnupg.rb
index abc1234..def5678 100644
--- a/Formula/gnupg.rb
+++ b/Formula/gnupg.rb
@@ -1,12 +1,12 @@ require 'brewkit'
class Gnupg <Formula
- @url='ftp://ftp.gnupg.org/gcrypt/gnupg/gnupg-1.4.9.tar.bz2'
+ @url='ftp://ftp.gnupg.org/gcrypt/gnupg/gnupg-1.4.10.tar.bz2'
@homepage='http://www.gnupg.org/'
- @sha1='826f4bef1effce61c3799c8f7d3cc8313b340b55'
+ @sha1='fd1b6a5f3b2dd836b598a1123ac257b8f105615d'
def install
- system "./configure", "--prefix=#{prefix}", "--disable-debug", "--disable-dependency-tracking"
+ system "./configure", "--prefix=#{prefix}", "--disable-debug", "--disable-dependency-tracking", "--disable-asm"
system "make"
system "make check"
| Update GnuPG formula to 1.4.10 and include --disable-asm to prevent breakage
|
diff --git a/app/jobs/gend_image_process_job.rb b/app/jobs/gend_image_process_job.rb
index abc1234..def5678 100644
--- a/app/jobs/gend_image_process_job.rb
+++ b/app/jobs/gend_image_process_job.rb
@@ -14,20 +14,16 @@ gend_image.src_image.image,
gend_image.captions.map(&:text_pos)).to_blob
- gend_image.gend_thumb = make_gend_thumb(gend_image)
+ thumb_img = gend_image.magick_image_list
+
+ thumb_img.resize_to_fit_anim!(MemeCaptainWeb::Config::THUMB_SIDE)
+
+ gend_image.gend_thumb = GendThumb.new(image: thumb_img.to_blob)
+
+ thumb_img.destroy!
gend_image.work_in_progress = false
gend_image.save!
end
-
- private
-
- def make_gend_thumb(gend_image)
- thumb_img = gend_image.magick_image_list
- thumb_img.resize_to_fit_anim!(MemeCaptainWeb::Config::THUMB_SIDE)
- gend_thumb = GendThumb.new(image: thumb_img.to_blob)
- thumb_img.destroy!
- gend_thumb
- end
end
| Revert "Move thumbnail generation into separate method."
This reverts commit 888b3dca1800747075255e6765b789492d795035.
|
diff --git a/Formula/nitro.rb b/Formula/nitro.rb
index abc1234..def5678 100644
--- a/Formula/nitro.rb
+++ b/Formula/nitro.rb
@@ -3,9 +3,9 @@ class Nitro < Formula
homepage "https://github.com/hobu/nitro"
# TODO: request a tagged release
- url "https://github.com/hobu/nitro.git", :revision => "c0c3fbba2638a68d3300191cd0a204542b78fc78"
- version "1.0-c0c3fbb"
- sha1 "c0c3fbba2638a68d3300191cd0a204542b78fc78"
+ url "https://github.com/hobu/nitro.git", :revision => "a3539c63128d9190fbd0043c1652d1b9397f8fcd"
+ version "1.0-a3539c6"
+ sha1 "a3539c63128d9190fbd0043c1652d1b9397f8fcd"
head "https://github.com/hobu/nitro.git", :branch => "master"
| Upgrade to latest Nitro HEAD
|
diff --git a/Formula/picat.rb b/Formula/picat.rb
index abc1234..def5678 100644
--- a/Formula/picat.rb
+++ b/Formula/picat.rb
@@ -4,20 +4,17 @@ url "http://picat-lang.org/download/picat24_src.tar.gz"
version "2.4.8"
sha256 "72b452a8ba94d6187d837dcdb46aab0d7dc724651bac99a8cf2ada5c0a3543dd"
- depends_on "gcc" => :build
+ depends_on "gcc"
def install
inreplace "emu/Makefile.picat.mac64", "/usr/local/bin/gcc", HOMEBREW_PREFIX/"bin/gcc-8"
system "make", "-C", "emu", "-f", "Makefile.picat.mac64"
- prefix.install Dir["doc", "emu", "exs", "lib"]
- end
-
- def post_install
- ln_sf prefix/"emu/picat_macx", HOMEBREW_PREFIX/"bin/picat"
+ mv "lib", "pi_lib"
+ prefix.install Dir["doc", "emu", "exs", "pi_lib"]
+ bin.install_symlink prefix/"emu/picat_macx" => "picat"
end
test do
- system "picat", "#{prefix}/exs/euler/p1.pi"
+ system "#{HOMEBREW_PREFIX}/bin/picat", "#{prefix}/exs/euler/p1.pi"
end
-end
-
+end | Update according to homebrew dev
|
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -21,28 +21,4 @@ yield
end
end
-
- def resource_users resource
- user_ids = [0]
-
- if resource.publications.any?
- resource.publications.each do |item|
- item.users.each do |user|
- user_ids.push(user.id)
- end
- end
- end
-
- if resource.activities.any?
- resource.activities.each do |item|
- item.users.each do |user|
- user_ids.push(user.id)
- end
- end
- end
-
- user_ids = user_ids.uniq
-
- User.where(id: user_ids).order_by_fullname
- end
end
| Refactor the Media content users method
|
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -42,6 +42,6 @@ end
def object_error_messages?(resource, *attrs)
- (resource.errors.keys & attrs).present?
+ (resource.errors.attribute_names & attrs).present?
end
end
| Fix for new Errors class
|
diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb
index abc1234..def5678 100644
--- a/app/mailers/application_mailer.rb
+++ b/app/mailers/application_mailer.rb
@@ -1,4 +1,6 @@ class ApplicationMailer < ActionMailer::Base
+ include Roadie::Rails::Automatic
+
default from: ENV['MAILGUN_FROM_EMAIL']
layout 'mailer'
end
| Add roadie to inline CSS for emails
|
diff --git a/app/models/events/delete_event.rb b/app/models/events/delete_event.rb
index abc1234..def5678 100644
--- a/app/models/events/delete_event.rb
+++ b/app/models/events/delete_event.rb
@@ -3,9 +3,9 @@ validates :ref_type, presence: true, inclusion: { in: %w{branch tag} }
validates :ref, presence: true
- def github_client=(github_client)
+ def github_event=(github_event)
[:ref_type, :ref].each do |attr|
- self[attr] = github_client.payload[attr]
+ self[attr] = github_event.payload[attr]
end
end
| Fix incorrect method name in DeleteEvent.
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,3 +1,10 @@ Rapporteur::Engine.routes.draw do
get '/(.:format)', to: 'statuses#show', as: :status
end
+
+unless Rails.application.routes.routes.any? { |r| Rapporteur::Engine == r.app.app }
+ ActiveSupport::Deprecation.warn('Rapporteur was not explicitly mounted in your application. Please add an explicit mount call to your /config/routes.rb. Automatically mounted Rapporteur::Engine to /status for backward compatibility. This will be no longer automatically mount in Rapporteur 4.')
+ Rails.application.routes.draw do
+ mount Rapporteur::Engine, at: '/status'
+ end
+end
| Add backward-compatible auto-mounting of Rails Engine.
|
diff --git a/Kiwi-KIF.podspec b/Kiwi-KIF.podspec
index abc1234..def5678 100644
--- a/Kiwi-KIF.podspec
+++ b/Kiwi-KIF.podspec
@@ -9,7 +9,7 @@ s.platform = :ios, '5.1'
s.source = { :git => "https://github.com/garnett/Kiwi-KIF.git", :tag => "#{s.version}" }
s.requires_arc = true
-
+ s.ios.xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => '$(inherited) "$(SDKROOT)/Developer/Library/Frameworks" "$(DEVELOPER_LIBRARY_DIR)/Frameworks" "$(DEVELOPER_DIR)/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks"' }
s.framework = 'XCTest'
s.source_files = 'src'
s.dependency 'Kiwi', '~>2.3.0'
| Fix compile issue for xcode6 beta 5
|
diff --git a/app/workers/push_update_worker.rb b/app/workers/push_update_worker.rb
index abc1234..def5678 100644
--- a/app/workers/push_update_worker.rb
+++ b/app/workers/push_update_worker.rb
@@ -5,7 +5,8 @@
def perform(timeline, account_id, status_id)
account = Account.find(account_id)
- status = Status.find(status_id)
+ status = Status.find(status_id)
+
message = Rabl::Renderer.new(
'api/v1/statuses/show',
status,
@@ -14,6 +15,8 @@ scope: InlineRablScope.new(account)
)
- ActionCable.server.broadcast("timeline:#{account_id}", type: 'update', timeline: timeline, message: message.render)
+ Redis.current.publish("timeline:#{timeline_id}", Oj.dump({ event: :update, payload: message, queued_at: (Time.now.to_f * 1000.0).to_i }))
+ rescue ActiveRecord::RecordNotFound
+ true
end
end
| Add proper message to PushUpdateWorker, use redis directly |
diff --git a/sector-five/enemy.rb b/sector-five/enemy.rb
index abc1234..def5678 100644
--- a/sector-five/enemy.rb
+++ b/sector-five/enemy.rb
@@ -1,5 +1,5 @@ class Enemy
- SPEED = 4
+ MAX_SPEED = 6
attr_reader :x, :y, :radius
@@ -7,13 +7,14 @@ @image = Gosu::Image.new('images/enemy.png')
@window = window
+ @speed = rand(1..MAX_SPEED)
@radius = 20
@x = rand(@window.width - 2 * @radius) + @radius
@y = 0
end
def move
- @y += SPEED
+ @y += @speed
end
def onscreen?
| Add random speeds to enemies
|
diff --git a/activerecord/test/cases/adapters/postgresql/prepared_statements_test.rb b/activerecord/test/cases/adapters/postgresql/prepared_statements_test.rb
index abc1234..def5678 100644
--- a/activerecord/test/cases/adapters/postgresql/prepared_statements_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/prepared_statements_test.rb
@@ -1,4 +1,5 @@ require "cases/helper"
+require "models/computer"
require "models/developer"
class PreparedStatementsTest < ActiveRecord::PostgreSQLTestCase
@@ -13,7 +14,7 @@ Developer.connection_config[:prepared_statements] = @default_prepared_statements
end
- def nothing_raised_with_falsy_prepared_statements
+ def test_nothing_raised_with_falsy_prepared_statements
assert_nothing_raised do
Developer.where(id: 1)
end
| Fix PG prepared statement test
|
diff --git a/fast_bitarray.gemspec b/fast_bitarray.gemspec
index abc1234..def5678 100644
--- a/fast_bitarray.gemspec
+++ b/fast_bitarray.gemspec
@@ -14,6 +14,7 @@ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = %w(lib)
+ spec.extensions = %w(ext/fast_bitarray/extconf.rb)
spec.add_development_dependency 'bundler', '~> 1.3'
spec.add_development_dependency 'rake'
| Build extconf.rb after gem installation
|
diff --git a/test/support/kitchen_helper.rb b/test/support/kitchen_helper.rb
index abc1234..def5678 100644
--- a/test/support/kitchen_helper.rb
+++ b/test/support/kitchen_helper.rb
@@ -5,11 +5,9 @@ module KitchenHelper
def in_kitchen
- Dir.mktmpdir do |dir|
- Dir.chdir(dir) do
- knife_command(Chef::Knife::Kitchen, ".").run
- yield
- end
+ outside_kitchen do
+ knife_command(Chef::Knife::Kitchen, ".").run
+ yield
end
end
| Fix DRY in kitchen test helper
|
diff --git a/config/initializers/public_host.rb b/config/initializers/public_host.rb
index abc1234..def5678 100644
--- a/config/initializers/public_host.rb
+++ b/config/initializers/public_host.rb
@@ -1 +1 @@-Whitehall.public_host = ENV['FACTER_govuk_platform'] == 'production' ? 'www.gov.uk' : 'www.dev.gov.uk'
+Whitehall.public_host = (ENV['FACTER_govuk_platform'] == 'production' ? 'www.gov.uk' : 'www.dev.gov.uk')
| Make this more clear with parentheses
|
diff --git a/test/unit/health_check/search_check_test.rb b/test/unit/health_check/search_check_test.rb
index abc1234..def5678 100644
--- a/test/unit/health_check/search_check_test.rb
+++ b/test/unit/health_check/search_check_test.rb
@@ -1,9 +1,51 @@ require_relative "../../test_helper"
-require "health_check/logging_config"
require "health_check/search_check"
-Logging.logger.root.appenders = nil
module HealthCheck
class SearchCheckTest < ShouldaUnitTestCase
+ def setup
+ @subject = SearchCheck.new
+ @search_results = ["any-old-thing"]
+ end
+
+ context "#result" do
+ should "delegate to it's corresponding results class" do
+ SearchCheckResult.expects(:new).with({check: @subject, search_results: @search_results})
+ @subject.result(@search_results)
+ end
+ end
+
+ context "#valid_imperative?" do
+ should "be true only for valid imperatives" do
+ assert @subject.tap { |c| c.imperative = "should" }.valid_imperative?
+ assert @subject.tap { |c| c.imperative = "should not" }.valid_imperative?
+ refute @subject.tap { |c| c.imperative = "anything else" }.valid_imperative?
+ end
+ end
+
+ context "#valid_path?" do
+ should "be true only for valid paths" do
+ assert @subject.tap { |c| c.path = "/" }.valid_path?
+ refute @subject.tap { |c| c.path = "foo" }.valid_path?
+ refute @subject.tap { |c| c.path = "" }.valid_path?
+ refute @subject.tap { |c| c.path = nil }.valid_path?
+ end
+ end
+
+ context "#valid_search_term?" do
+ should "be true only for non-blank search terms" do
+ assert @subject.tap { |c| c.search_term = "foo" }.valid_search_term?
+ refute @subject.tap { |c| c.search_term = "" }.valid_search_term?
+ refute @subject.tap { |c| c.search_term = nil }.valid_search_term?
+ end
+ end
+
+ context "valid_weight?" do
+ should "be true only for weights greater than 0" do
+ refute @subject.tap { |c| c.weight = -1 }.valid_weight?
+ refute @subject.tap { |c| c.weight = 0 }.valid_weight?
+ assert @subject.tap { |c| c.weight = 1 }.valid_weight?
+ end
+ end
end
end
| Add some simple testing for the SearchCheck struct
|
diff --git a/pronto-rubocop.gemspec b/pronto-rubocop.gemspec
index abc1234..def5678 100644
--- a/pronto-rubocop.gemspec
+++ b/pronto-rubocop.gemspec
@@ -19,7 +19,7 @@ s.test_files = `git ls-files -- {spec}/*`.split("\n")
s.require_paths = ['lib']
- s.add_dependency 'rubocop', '~> 0.13.0'
+ s.add_dependency 'rubocop', '~> 0.14.0'
s.add_dependency 'pronto', '~> 0.1.0'
s.add_development_dependency 'rake', '~> 10.1.0'
s.add_development_dependency 'rspec', '~> 2.14.0'
| Update rubocop dependency version from 0.13.0 to 0.14.0
|
diff --git a/features/step_definitions/rspec.rb b/features/step_definitions/rspec.rb
index abc1234..def5678 100644
--- a/features/step_definitions/rspec.rb
+++ b/features/step_definitions/rspec.rb
@@ -9,7 +9,9 @@
Then(/^the output should contain the following:$/) do |text|
real_text = text.gsub('{SOURCE_FILE}', Vigia::Rspec.adapter.source_file)
- expect(@vigia_stdout.lines.to_a).to include(*real_text.lines.to_a)
+ expect(@vigia_stdout.lines.to_a).to include(*real_text.lines.to_a), -> do
+ "Could not find lines: \n #{ (real_text.lines.to_a - @vigia_stdout.lines.to_a).join("\n") }"
+ end
end
Then(/^the total tests line should equal "(.*?)"$/) do |totals_line|
| Make expectation message more readble in cucumber tests
|
diff --git a/CoreDataKit.podspec b/CoreDataKit.podspec
index abc1234..def5678 100644
--- a/CoreDataKit.podspec
+++ b/CoreDataKit.podspec
@@ -1,6 +1,6 @@ Pod::Spec.new do |s|
s.name = "CoreDataKit"
- s.version = "0.6.0"
+ s.version = "0.6.1"
s.license = "MIT"
s.summary = "CoreDataKit makes common operations on objects and importing into CoreData a breeze."
@@ -16,6 +16,6 @@ s.source = { :git => "https://github.com/mac-cain13/CoreDataKit.git", :tag => s.version }
s.platform = :ios, "8.0"
s.requires_arc = true
- s.source_files = "CoreDataKit/*.swift"
+ s.source_files = "CoreDataKit/**/*.swift"
end
| Include Importing subdirectory files in podspec
|
diff --git a/flipper-cloud.gemspec b/flipper-cloud.gemspec
index abc1234..def5678 100644
--- a/flipper-cloud.gemspec
+++ b/flipper-cloud.gemspec
@@ -24,5 +24,5 @@ gem.metadata = Flipper::METADATA
gem.add_dependency 'flipper', "~> #{Flipper::VERSION}"
- gem.add_dependency "brow", "~> 0.2.0"
+ gem.add_dependency "brow", "~> 0.3.0"
end
| Update brow dependency to latest
|
diff --git a/http-protocol.gemspec b/http-protocol.gemspec
index abc1234..def5678 100644
--- a/http-protocol.gemspec
+++ b/http-protocol.gemspec
@@ -1,6 +1,6 @@ Gem::Specification.new do |s|
s.name = "http-protocol"
- s.version = '0.1.0'
+ s.version = '0.1.1'
s.summary = "HTTP protocol library designed to facilitate custom HTTP clients"
s.description = ' '
| Package version is increased from 0.1.0 to 0.1.1
|
diff --git a/jetpack-rails.gemspec b/jetpack-rails.gemspec
index abc1234..def5678 100644
--- a/jetpack-rails.gemspec
+++ b/jetpack-rails.gemspec
@@ -12,6 +12,7 @@ s.description = %q{A sweet boostrap mashup for Rails applications.
The philosophy is pretty simple, it should make building Rails apps go a lot faster.
The library prefers modularity over rigidity and mixins over defintions. Check out the github readme for more.}
+ s.license = 'MIT'
s.files = `git ls-files`.split("\n")
# s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -22,4 +23,4 @@ s.add_dependency 'sass-rails', '>= 3.1'
# s.add_development_dependency "rspec"
# s.add_runtime_dependency "rest-client"
-end+end
| Add MIT License to Gemspec
|
diff --git a/guard-kitchen.gemspec b/guard-kitchen.gemspec
index abc1234..def5678 100644
--- a/guard-kitchen.gemspec
+++ b/guard-kitchen.gemspec
@@ -11,7 +11,7 @@ spec.description = %q{Guard plugin for test kitchen}
spec.summary = %q{Guard plugin for test kitchen}
spec.homepage = "http://github.com/test-kitchen/guard-kitchen"
- spec.license = "Apache 2"
+ spec.license = "Apache-2.0"
spec.files = `git ls-files`.split($/)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
| Use a SPDX compliant license string in the gemspec
This is the correct string to use here
Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
|
diff --git a/spec/session_spec.rb b/spec/session_spec.rb
index abc1234..def5678 100644
--- a/spec/session_spec.rb
+++ b/spec/session_spec.rb
@@ -7,6 +7,11 @@ expect {
Net::SSH::Session.new('host', 'user', 'password', :timeout => 'data')
}.to raise_error ArgumentError, "Timeout value should be numeric"
+ end
+
+ it 'sets global session timeout value' do
+ session = Net::SSH::Session.new('host', 'user', 'password', :timeout => 1)
+ expect(session.timeout).to eq 1
end
end
end
| Raise error if :timeout option is not numeric
|
diff --git a/spree_ipay88.gemspec b/spree_ipay88.gemspec
index abc1234..def5678 100644
--- a/spree_ipay88.gemspec
+++ b/spree_ipay88.gemspec
@@ -16,7 +16,7 @@ s.require_path = 'lib'
s.requirements << 'none'
- s.add_dependency 'spree_core', '~> 2.1.1'
+ s.add_dependency 'spree_core', '~> 2.3.0'
s.add_development_dependency 'capybara', '~> 2.1'
s.add_development_dependency 'coffee-rails'
| Change requirements for ipay88 for spree 2.3.0
|
diff --git a/app/helpers/easy_app/dates_helper.rb b/app/helpers/easy_app/dates_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/easy_app/dates_helper.rb
+++ b/app/helpers/easy_app/dates_helper.rb
@@ -1,8 +1,8 @@ module EasyAPP
module DatesHelper
- def ll(date)
- date != '' ? l(date) : ''
+ def ll(date, opts = {})
+ date.blank? ? '' : l(date, opts)
end
end
| Allow to pass a hash of options to *ll* helper method
|
diff --git a/gemfiles/travis.rb b/gemfiles/travis.rb
index abc1234..def5678 100644
--- a/gemfiles/travis.rb
+++ b/gemfiles/travis.rb
@@ -1,5 +1,6 @@ source "https://rubygems.org".freeze
gem "codeclimate-test-reporter".freeze
+gem "rake".freeze
gem "rspec".freeze
gem "simplecov".freeze
| Add rake to Travis gemfile.
|
diff --git a/spec/player_spec.rb b/spec/player_spec.rb
index abc1234..def5678 100644
--- a/spec/player_spec.rb
+++ b/spec/player_spec.rb
@@ -1,5 +1,5 @@ require 'spec_helper'
-require_relatite '../src/team.rb'
+require_relative '../src/team.rb'
describe Team do
end
| Fix typo in require call.
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,5 +1,7 @@ require 'vcs_toolkit'
RSpec.configure do |config|
- # Use defaults for now
+ config.expect_with :rspec do |expect_config|
+ expect_config.syntax = :expect
+ end
end | Use expect syntax for all tests
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -3,14 +3,3 @@ #dependencies
require 'minitest/autorun'
require 'webmock/minitest'
-
-require 'turn'
-
-Turn.config do |c|
- # :outline - turn's original case/test outline mode [default]
- c.format = :outline
- # turn on invoke/execute tracing, enable full backtrace
- c.trace = true
- # use humanized test names (works only with :outline format)
- c.natural = true
-end
| Remove turn gem to get tests to run
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,4 +1,9 @@ require 'rspec'
+require 'webmock/rspec'
require 'spidr/version'
include Spidr
+
+RSpec.configure do |config|
+ config.after { WebMock.reset! }
+end
| Reset Webmock after each spec.
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -23,3 +23,24 @@ PuppetlabsSpec::Files.cleanup
end
end
+
+require 'pathname'
+dir = Pathname.new(__FILE__).parent
+Puppet[:modulepath] = File.join(dir, 'fixtures', 'modules')
+
+# There's no real need to make this version dependent, but it helps find
+# regressions in Puppet
+#
+# 1. Workaround for issue #16277 where default settings aren't initialised from
+# a spec and so the libdir is never initialised (3.0.x)
+# 2. Workaround for 2.7.20 that now only loads types for the current node
+# environment (#13858) so Puppet[:modulepath] seems to get ignored
+# 3. Workaround for 3.5 where context hasn't been configured yet,
+# ticket https://tickets.puppetlabs.com/browse/MODULES-823
+#
+ver = Gem::Version.new(Puppet.version.split('-').first)
+if Gem::Requirement.new("~> 2.7.20") =~ ver || Gem::Requirement.new("~> 3.0.0") =~ ver || Gem::Requirement.new("~> 3.5") =~ ver
+ puts "augeasproviders: setting Puppet[:libdir] to work around broken type autoloading"
+ # libdir is only a single dir, so it can only workaround loading of one external module
+ Puppet[:libdir] = "#{Puppet[:modulepath]}/augeasproviders_core/lib"
+end
| Use modulesync to manage meta files
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -11,6 +11,16 @@ config.color = true
config.default_formatter = "doc"
config.backtrace_exclusion_patterns = []
+
+ config.mock_with :rspec do |c|
+ # TODO: upgrade should syntax to expect syntax
+ c.syntax = [:should, :expect]
+ end
+
+ config.expect_with :rspec do |c|
+ # TODO: upgrade should syntax to expect syntax
+ c.syntax = [:should, :expect]
+ end
end
def fakeredis?
| Enable both should and expect syntax for now
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -10,7 +10,7 @@
if ENV['TOKEN']
Paperlex.token = ENV['TOKEN']
-elsif ENV['CONTRACTABLE_TOKEN']
+elsif ENV['REMOTE_SIGNATURE_TOKEN']
# we'll set Paperlex.token where needed in the specs
else
FakeWeb.allow_net_connect = false
| Correct env variable reference in the specs
|
diff --git a/lib/everything/piece.rb b/lib/everything/piece.rb
index abc1234..def5678 100644
--- a/lib/everything/piece.rb
+++ b/lib/everything/piece.rb
@@ -5,12 +5,6 @@ extend Forwardable
attr_reader :full_path
-
- # TODO: Add the following methods:
- # - dir (Relative to Everything.path)
- # - path (Relative to Everything.path)
- # - absolute_dir
- # - absolute_path
def initialize(full_path)
@full_path = full_path
| Remove TODOs that are done
|
diff --git a/lib/fake_delete/core.rb b/lib/fake_delete/core.rb
index abc1234..def5678 100644
--- a/lib/fake_delete/core.rb
+++ b/lib/fake_delete/core.rb
@@ -10,7 +10,7 @@ end
def only_deleted
- scoped.tap { |x| x.default_scoped = false }.where("#{self.table_name}.deleted != 0")
+ scoped.tap { |x| x.default_scoped = false }.where("#{self.table_name}.deleted <> 0")
end
def with_deleted
| Use <> instead of != (SQL standards)
|
diff --git a/lib/gifts/repo_table.rb b/lib/gifts/repo_table.rb
index abc1234..def5678 100644
--- a/lib/gifts/repo_table.rb
+++ b/lib/gifts/repo_table.rb
@@ -13,8 +13,9 @@ end
def add(path)
+ path = File.expand_path(path)
+
git_repo = Repo.new(path)
-
db_repo = table[path] || table.add(path, path: path)
@db.commits.add(git_repo, db_repo)
| Use absolute path of repo.
|
diff --git a/lib/gitlab/lfs_token.rb b/lib/gitlab/lfs_token.rb
index abc1234..def5678 100644
--- a/lib/gitlab/lfs_token.rb
+++ b/lib/gitlab/lfs_token.rb
@@ -20,13 +20,8 @@ def token
Gitlab::Redis.with do |redis|
token = redis.get(redis_key)
-
- if token
- redis.expire(redis_key, EXPIRY_TIME)
- else
- token = Devise.friendly_token(TOKEN_LENGTH)
- redis.set(redis_key, token, ex: EXPIRY_TIME)
- end
+ token ||= Devise.friendly_token(TOKEN_LENGTH)
+ redis.set(redis_key, token, ex: EXPIRY_TIME)
token
end
| Fix race condition that can be triggered if the token expires right after we retrieve it, but before we can set the new expiry time.
|
diff --git a/lib/overcommit/utils.rb b/lib/overcommit/utils.rb
index abc1234..def5678 100644
--- a/lib/overcommit/utils.rb
+++ b/lib/overcommit/utils.rb
@@ -4,7 +4,7 @@ include ConsoleMethods
def hook_name
- File.basename($0).gsub('-', '_')
+ File.basename($0).tr('-', '_')
end
def load_hooks
@@ -22,9 +22,9 @@ # http://stackoverflow.com/questions/1509915/converting-camel-case-to-underscore-case-in-ruby
def underscorize(str)
str.gsub(/::/, '/').
- gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
- gsub(/([a-z\d])([A-Z])/,'\1_\2').
- tr("-", "_").
+ gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
+ gsub(/([a-z\d])([A-Z])/, '\1_\2').
+ tr('-', '_').
downcase
end
end
| Address style cleanups in Utils
As pointed out by Joe on
https://gerrit.causes.com/#/c/22332/2/lib/overcommit/utils.rb
Change-Id: I5cc01a344f2b9ca9098969b72ff21ad3c91eb430
Reviewed-on: https://gerrit.causes.com/22356
Reviewed-by: Aiden Scandella <1faf1e8390cdac9204f160c35828cc423b7acd7b@causes.com>
Tested-by: Aiden Scandella <1faf1e8390cdac9204f160c35828cc423b7acd7b@causes.com>
|
diff --git a/app/helpers/gui_helper.rb b/app/helpers/gui_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/gui_helper.rb
+++ b/app/helpers/gui_helper.rb
@@ -1,7 +1,7 @@ module GuiHelper
def progress_bar(now, max, classes='green', width=200)
- ratio = 1.0*now/max
+ ratio = [1.0*now/max, 1.0].min
"<div class='progressbar #{classes}' style='width: #{width}px'>
<div class='bar1' style='width:#{width*ratio}px'></div>
<div class='bar2' style='width:#{width*ratio}px'></div>
@@ -10,7 +10,7 @@ end
def warning_progress_bar(now, max, width=200)
- ratio = 1.0*now/max
+ ratio = [1.0*now/max, 1.0].min
classes = case ratio
when 0..0.6 then :green
when 0.6..0.8 then :yellow
@@ -19,4 +19,4 @@ progress_bar now, max, classes, width
end
-end+end
| Fix invalid width for progress bars
|
diff --git a/lib/tasks/pictures.rake b/lib/tasks/pictures.rake
index abc1234..def5678 100644
--- a/lib/tasks/pictures.rake
+++ b/lib/tasks/pictures.rake
@@ -49,5 +49,11 @@ end
end
end
+
+ [:exif_data, :dimensions].each do |name|
+ desc '[OBSOLETE] Stub for old migration'
+ task name do
+ end
+ end
end
end
| Add rake task stubs for old migrations
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.