diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/vagrantplugins.rb b/vagrantplugins.rb index abc1234..def5678 100644 --- a/vagrantplugins.rb +++ b/vagrantplugins.rb @@ -1,5 +1,5 @@ def install_plugins(plugins) - not_installed = get_not_installed plugins + not_installed = get_not_installed(plugins) if not_installed.any? puts "The following required plugins must be installed:" puts "'#{not_installed.join("', '")}'" @@ -29,6 +29,6 @@ # If plugins successfully installed, restart vagrant to detect changes. def continue - exec "vagrant #{ARGV[0]}" + exec "vagrant #{ARGV.join(' ')}" end
Make sure we continue with all switches after plugin install. Also adjusted style on function calls.
diff --git a/app/helpers/people_helper.rb b/app/helpers/people_helper.rb index abc1234..def5678 100644 --- a/app/helpers/people_helper.rb +++ b/app/helpers/people_helper.rb @@ -4,6 +4,8 @@ form_for @person, :html => { :multipart => true } do |form| yield form concat form.submit("Save") + concat " or " + concat link_to("cancel", person_path(@person)) end end end
Add cancel button to person edit forms
diff --git a/app/models/channel_member.rb b/app/models/channel_member.rb index abc1234..def5678 100644 --- a/app/models/channel_member.rb +++ b/app/models/channel_member.rb @@ -2,4 +2,5 @@ belongs_to :channel belongs_to :user validates :user_id, :channel_id, presence: true + validate :user_id, uniqueness: true end
Add uniqueness validation to user on channel member
diff --git a/app/models/person_edition.rb b/app/models/person_edition.rb index abc1234..def5678 100644 --- a/app/models/person_edition.rb +++ b/app/models/person_edition.rb @@ -10,7 +10,6 @@ field :affiliation, type: String # name: uses artefact name field :role, type: String - field :team, type: String field :description, type: String field :url, type: String field :telephone, type: String
Revert "Add team to PersonEdition" This reverts commit 96043a66ff73d51b44f1cefcd9fee1d1ce4b5169.
diff --git a/spec/csv2avro_spec.rb b/spec/csv2avro_spec.rb index abc1234..def5678 100644 --- a/spec/csv2avro_spec.rb +++ b/spec/csv2avro_spec.rb @@ -10,7 +10,7 @@ subject(:converter) { CSV2Avro.new(options) } it 'should write errors to STDERR' do - expect { converter.convert }.to output("line 4: Missing value at name\nline 5: Unable to parse\n").to_stderr + expect { converter.convert }.to output("line 4: Missing value at name\nline 7: Unable to parse\n").to_stderr end it 'should have a bad row' do @@ -24,7 +24,9 @@ expect(AvroReader.new(file).read).to eq( [ { 'id'=>1, 'name'=>'dresses', 'description'=>'Dresses' }, - { 'id'=>2, 'name'=>'female-tops', 'description'=>nil } + { 'id'=>2, 'name'=>'female-tops', 'description'=>nil }, + { 'id'=>4, 'name'=>'male-tops', 'description'=>"Male Tops\nand Male Shirts"}, + { 'id'=>6, 'name'=>'male-shoes', 'description'=>'Male Shoes'} ] ) end
Update tests to new test data
diff --git a/spec/registry_spec.rb b/spec/registry_spec.rb index abc1234..def5678 100644 --- a/spec/registry_spec.rb +++ b/spec/registry_spec.rb @@ -3,6 +3,17 @@ describe Calyx::Grammar::Registry do let(:registry) do Calyx::Grammar::Registry.new + end + + context '#evaluate' do + # Need to do some more work to determine what the tree representation should look like. + # + # In particular, need to look at whether the :choice and :concat nodes could be simplified + # in cases where there is only a single production rather than multiple choices. + # + # The best way to resolve this is probably to try generating some interesting trees and + # seeing what is useful in practice. + it 'should return a tree representation of the grammar' end specify 'registry evaluates the start rule' do
Add notes about improving the representation of tree structures
diff --git a/app/controllers/learning_objects_controller.rb b/app/controllers/learning_objects_controller.rb index abc1234..def5678 100644 --- a/app/controllers/learning_objects_controller.rb +++ b/app/controllers/learning_objects_controller.rb @@ -1,12 +1,12 @@ class LearningObjectsController < ApplicationController before_action :authenticate_user! + before_action :find_learning_object, only: [:show, :edit, :update] def index @learning_objects = LearningObject.where(user: current_user) end def show - @learning_object = LearningObject.find(params[:id]) end def new @@ -19,7 +19,7 @@ flash[:success] = "Objeto de Aprendizagem criado!" redirect_to @learning_object else - render "new" + render 'new' end end @@ -27,6 +27,12 @@ end def update + if @learning_object.update_attributes(learning_object_params) + flash[:success] = "Objeto de Aprendizagem atualizado!" + redirect_to @learning_object + else + render 'edit' + end end def destroy @@ -37,4 +43,8 @@ def learning_object_params params.require(:learning_object).permit(:title, :description, :available) end + + def find_learning_object + @learning_object = LearningObject.find(params[:id]) + end end
Implement edit learning object feature
diff --git a/test/unit/download/router_test.rb b/test/unit/download/router_test.rb index abc1234..def5678 100644 --- a/test/unit/download/router_test.rb +++ b/test/unit/download/router_test.rb @@ -37,7 +37,7 @@ domain = 'general' params = {'id' => '123', 'email' => 'test@test.com'} - $redis.expects(:set).with('downloads:general:123', '{"email":"test@test.com"}') + $redis.expects(:set).with('downloads:general:123', regexp_matches(/test@test.com/)) Download::Router.set_email(domain, params) end
Fix intermittent failing test through the use of regexp
diff --git a/ace-theme.gemspec b/ace-theme.gemspec index abc1234..def5678 100644 --- a/ace-theme.gemspec +++ b/ace-theme.gemspec @@ -1,10 +1,12 @@ Gem::Specification.new do |s| s.name = 'ace-theme' - s.version = '1.0.1' + s.version = '1.0.2' s.license = 'MIT' s.summary = 'Ace: A Jekyll theme.' s.author = 'Aliou Diallo' s.email = 'code@aliou.me' s.homepage = 'http://aliou.github.io/ace/' s.files = `git ls-files -z`.split("\x0").grep(%r{^_(sass|includes|layouts)/}) + s.add_runtime_dependency 'jekyll', '~> 3.2', '>= 3.2.0' + s.add_runtime_dependency 'jekyll-paginate', '~> 1.1' end
Add dependencies on Jekyll and jekyll-paginate.
diff --git a/lib/metacrunch/mab2/builder.rb b/lib/metacrunch/mab2/builder.rb index abc1234..def5678 100644 --- a/lib/metacrunch/mab2/builder.rb +++ b/lib/metacrunch/mab2/builder.rb @@ -33,6 +33,10 @@ @document end + def superorder! + controlfield("051", "n") + end + class SubfieldBuilder def initialize(datafield)
Add superorder helper to DSL.
diff --git a/lib/prefetcher/http_fetcher.rb b/lib/prefetcher/http_fetcher.rb index abc1234..def5678 100644 --- a/lib/prefetcher/http_fetcher.rb +++ b/lib/prefetcher/http_fetcher.rb @@ -16,10 +16,6 @@ fetch_async.value end - def get_from_memory - @redis_connection.get(cache_key) - end - # Returns cached version if availible. If not cached - makes request using #fetch . def get (get_from_memory || fetch).html_safe.force_encoding('utf-8')
Remove obsolete code - merging issue.
diff --git a/cbr2cbz.rb b/cbr2cbz.rb index abc1234..def5678 100644 --- a/cbr2cbz.rb +++ b/cbr2cbz.rb @@ -1,4 +1,20 @@ # encoding: utf-8 + +require 'optparse' + +options = {} +OptionParser.new do |opts| + opts.banner = "Usage: cbr2cbz [options] file ..." + + opts.on("-k", "--keep", "Keep original file") do |k| + options[:keep] = k + end + + opts.on_tail("-h", "--help", "Show this message") do + puts opts + exit + end +end.parse! require 'fileutils' require 'zip/zip' @@ -7,18 +23,18 @@ ARGV.each do |arg| files = File.directory?(arg) ? Dir.glob(arg + '/**') : [arg] files.each do |filename| - if File.extname(filename) == '.cbr' + if File.extname(filename).downcase == '.cbr' FileUtils.cd(File.dirname(filename)) do - # Unrar CBR filename_without_ext = File.basename(filename, '.*') + # Unrar CBR `unrar e "#{filename}" "#{filename_without_ext}"/` # Create CBZ - archive = filename_without_ext + '.cbz' + new_file = filename_without_ext + '.cbz' - Zip::ZipFile.open(archive, 'w') do |zipfile| + Zip::ZipFile.open(new_file, 'w') do |zipfile| Dir[filename_without_ext + "/*"].each do |file| zipfile.add(File.basename(file),file) end @@ -26,7 +42,7 @@ # Clean up FileUtils.rm_rf(filename_without_ext) - FileUtils.rm(filename) + FileUtils.rm(filename) unless options[:keep] end end end
Add keep original file option
diff --git a/pieces.gemspec b/pieces.gemspec index abc1234..def5678 100644 --- a/pieces.gemspec +++ b/pieces.gemspec @@ -21,6 +21,7 @@ spec.add_development_dependency 'bundler' spec.add_development_dependency 'codeclimate-test-reporter' spec.add_development_dependency 'mustache' + spec.add_development_dependency 'pry' spec.add_development_dependency 'rake' spec.add_development_dependency 'rspec' end
Add pry to dev dependencies
diff --git a/plugin_gems.rb b/plugin_gems.rb index abc1234..def5678 100644 --- a/plugin_gems.rb +++ b/plugin_gems.rb @@ -1,7 +1,7 @@ dir 'plugin_gems' download "httpclient", "2.4.0" download "td-client", "0.8.68" -download "td", "0.11.8" +download "td", "0.11.8.1" download "fluent-plugin-td", "0.10.26" download "thrift", "0.8.0" download "fluent-plugin-scribe", "0.10.14"
Use latest td command to reduce package size
diff --git a/user_with_email/test/forms/has_one_test.rb b/user_with_email/test/forms/has_one_test.rb index abc1234..def5678 100644 --- a/user_with_email/test/forms/has_one_test.rb +++ b/user_with_email/test/forms/has_one_test.rb @@ -0,0 +1,33 @@+require 'test_helper' + +class HasOneTest < ActiveSupport::TestCase + def setup + @parent = User.new + @model = Email.new + + @args = ActiveSupport::HashWithIndifferentAccess.new( + model: @model, + association_name: "email", + attrs: { + "address" => "petrakos@gmail.com" + }, + parent: @parent + ) + + @populator = FormObject::Populator::HasOne.new(@args) + end + + test "contains the according properties" do + assert_equal @model, @populator.model + assert_equal "email", @populator.association_name + assert_equal @args[:attrs], @populator.pending_attributes + assert_equal @parent, @populator.parent + end + + test "populates the model" do + @populator.call + + assert_equal "petrakos@gmail.com", @populator.model.address + assert_equal @parent.email, @populator.model + end +end
Add test case for HasOne populator
diff --git a/app/services/payload_parser.rb b/app/services/payload_parser.rb index abc1234..def5678 100644 --- a/app/services/payload_parser.rb +++ b/app/services/payload_parser.rb @@ -43,7 +43,7 @@ private def pull_request_or_issue_params - payload["pull_request"] || payload["issue"] + payload["pull_request"] || payload["issue"] || {} end def github_url
Return an empty hash if no pull request or issue
diff --git a/config/initializers/security_headers.rb b/config/initializers/security_headers.rb index abc1234..def5678 100644 --- a/config/initializers/security_headers.rb +++ b/config/initializers/security_headers.rb @@ -3,6 +3,8 @@ config.x_frame_options = 'DENY' config.x_content_type_options = "nosniff" config.x_xss_protection = {:value => 1, :mode => false} + # By default, load resources only from own origin. + # For CSS, allow styles from style elements and attributes for GWT. config.csp = { default_src: "self", style_src: "'self' 'unsafe-inline'",
Comment for CSP unsafe-inline cause.
diff --git a/app/importers/rows/access_row.rb b/app/importers/rows/access_row.rb index abc1234..def5678 100644 --- a/app/importers/rows/access_row.rb +++ b/app/importers/rows/access_row.rb @@ -15,7 +15,7 @@ ) student_assessment.assign_attributes( - scale_score: row[:assessment_scale_score], + scale_score: parse_or_nil(row[:assessment_scale_score]), performance_level: row[:assessment_performance_level], growth_percentile: row[:assessment_growth] ) @@ -35,4 +35,9 @@ return 'Composite' if row[:assessment_subject] == 'Overall' row[:assessment_subject] end + + # Missing or unparseable values are ignored and converted to nil + def parse_or_nil(value) + if value.nil? || value.to_i == 0 then nil else value.to_i end + end end
Access importer: guard against nil values upstream
diff --git a/Casks/backblaze.rb b/Casks/backblaze.rb index abc1234..def5678 100644 --- a/Casks/backblaze.rb +++ b/Casks/backblaze.rb @@ -8,4 +8,16 @@ license :commercial installer :manual => 'Backblaze Installer.app' + + uninstall :launchctl => [ + 'com.backblaze.bzserv.plist', + 'com.backblaze.bzbmenu.plist' + ], + :delete => '/Library/PreferencePanes/BackblazeBackup.prefPane' + zap :delete => [ + '/Library/Backblaze.bzpkg', + '~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/com.backblaze.backblazebackup.sfl', + '~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/com.backblaze.bzdoinstall.sfl', + '~/Library/Logs/BackblazeGUIInstaller' + ] end
Add uninstall and zap stanzas for Backblaze
diff --git a/roles/foundation.rb b/roles/foundation.rb index abc1234..def5678 100644 --- a/roles/foundation.rb +++ b/roles/foundation.rb @@ -22,8 +22,6 @@ :innodb_buffer_pool_size => "512M", :key_buffer_size => "64M", :max_connections => "200", - :query_cache_size => "48M", - :query_cache_type => "1", :sort_buffer_size => "8M", :tmp_table_size => "48M" }
Drop no longer support mysql configuration options
diff --git a/app/models/drift/static_model.rb b/app/models/drift/static_model.rb index abc1234..def5678 100644 --- a/app/models/drift/static_model.rb +++ b/app/models/drift/static_model.rb @@ -1,14 +1,6 @@ module Drift class StaticModel - - def initialize(args) - args.each do |k, v| - instance_variable_set("@#{k.to_s.underscore}", v) unless v.nil? - end - end - class << self - attr_accessor :source def all @@ -60,7 +52,12 @@ new(attributes) end + end + def initialize(args) + args.each do |k, v| + instance_variable_set("@#{k.to_s.underscore}", v) unless v.nil? + end end end end
Move instance method below class methods
diff --git a/TextFormater.podspec b/TextFormater.podspec index abc1234..def5678 100644 --- a/TextFormater.podspec +++ b/TextFormater.podspec @@ -8,7 +8,7 @@ DESC s.homepage = 'https://github.com/1fr3dg/TextFormater' - # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' + s.screenshots = 'https://github.com/1Fr3dG/TextFormater/blob/master/screen/example.png?raw=true' s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { 'Alfred Gao' => 'alfredg@alfredg.cn' } s.source = { :git => 'https://github.com/1fr3dg/TextFormater.git', :tag => s.version.to_s }
Modify podspec to add screenshot
diff --git a/config.ru b/config.ru index abc1234..def5678 100644 --- a/config.ru +++ b/config.ru @@ -6,6 +6,7 @@ require 'data_mapper' require 'slim' require "cuba/render" +require 'yaml' # app require "./app" @@ -13,4 +14,6 @@ #Bar.create name: "MonBar" #Beer.create price: 3, bar_id: Bar.first.id +ENV['CUBA_ENV'] ||= 'dev' + run Cuba
Add a basic support for environment
diff --git a/tasks/devtools.rake b/tasks/devtools.rake index abc1234..def5678 100644 --- a/tasks/devtools.rake +++ b/tasks/devtools.rake @@ -1,8 +1,8 @@ target_gemfile = Devtools.project.shared_gemfile_path source_gemfile = Devtools.shared_gemfile_path -target_config = Devtools.project.root -source_config = Devtools.default_config_path +project_root = Devtools.project.root +source_config = Devtools.default_config_path namespace :devtools do desc 'Sync Gemfile.devtools with gem' @@ -10,9 +10,9 @@ cp source_gemfile, target_gemfile, :verbose => true end - desc "Copy default configs and Gemfile.devtools to #{target_config}" + desc "Copy default configs and Gemfile.devtools to #{project_root}" task :init => [ :sync ] do - cp_r source_config, target_config, :verbose => true + cp_r source_config, project_root, :verbose => true end end
Rename local variable to be more meaningful
diff --git a/cookbooks/load-balancer/definitions/arr_farm_algorithm.rb b/cookbooks/load-balancer/definitions/arr_farm_algorithm.rb index abc1234..def5678 100644 --- a/cookbooks/load-balancer/definitions/arr_farm_algorithm.rb +++ b/cookbooks/load-balancer/definitions/arr_farm_algorithm.rb @@ -1,4 +1,5 @@ # Enum must be one of WeightedRoundRobin, LeastRequests, LeastResponseTime, WeightedTotalTraffic, RequestHash +# More about those algorithms: https://technet.microsoft.com/en-us/library/dd443524(v=ws.10).aspx define :arr_farm_algorithm, :algorithm => :LeastRequests do
Add comment about LB algorithms
diff --git a/core/lib/generators/refinery/engine/templates/db/seeds.rb b/core/lib/generators/refinery/engine/templates/db/seeds.rb index abc1234..def5678 100644 --- a/core/lib/generators/refinery/engine/templates/db/seeds.rb +++ b/core/lib/generators/refinery/engine/templates/db/seeds.rb @@ -16,8 +16,8 @@ :deletable => false, :menu_match => "^#{url}(\/|\/.+?|)$" ) - Refinery::Pages.default_parts.each do |default_page_part| - page.parts.create(:title => default_page_part, :body => nil) + Refinery::Pages.default_parts.each_with_index do |default_page_part, index| + page.parts.create(:title => default_page_part, :body => nil, :position => index) end end <% end %>
Set page part positions on engine generation.
diff --git a/spec/nod/base_files_spec.rb b/spec/nod/base_files_spec.rb index abc1234..def5678 100644 --- a/spec/nod/base_files_spec.rb +++ b/spec/nod/base_files_spec.rb @@ -0,0 +1,16 @@+ +require 'spec_helper' + +RSpec.describe BASE_FILES do + let (:base_files) {BASE_FILES.map {|file| File.basename(file)} } + + it 'contains a main javascript file' do + expect(base_files).to include('main.js') + end + it 'contains an index HTML file' do + expect(base_files).to include('index.html') + end + it 'contains a css file for styling' do + expect(base_files).to include('style.css') + end +end
Add specs for base files
diff --git a/bin/pcap-trace.rb b/bin/pcap-trace.rb index abc1234..def5678 100644 --- a/bin/pcap-trace.rb +++ b/bin/pcap-trace.rb @@ -0,0 +1,24 @@+#!/usr/bin/env ruby +# -*- encoding: utf-8 -*- +require 'arbdrone/nav_data.rb' +require 'pcap' + +include ARbDrone::NavData +include Pcap + +# TODO: Allow configuring a live network capture by specifying an interface +cap = Capture.open_offline ARGV[0] + +# Dummy values +setup 0, 0 + +cap.each do |p| + if p.udp? + if p.ip_src.to_s == '192.168.1.1' && p.udp_sport == 5554 + receive_data p.udp_data + end + if p.ip_dst.to_s == '192.168.1.1' && p.udp_dport == 5556 + puts p.udp_data.gsub(/\r/, "\n") unless p.udp_data =~ /^AT\*REF=\d+,\d+\r$/ + end + end +end
Add utility to trace drone packets
diff --git a/Library/Homebrew/os/mac/version.rb b/Library/Homebrew/os/mac/version.rb index abc1234..def5678 100644 --- a/Library/Homebrew/os/mac/version.rb +++ b/Library/Homebrew/os/mac/version.rb @@ -13,7 +13,7 @@ :snow_leopard => "10.6", :leopard => "10.5", :tiger => "10.4", - :linux => "0" + :x86_64_linux => "0" } def self.from_symbol(sym)
Fix bottle tag sort order for Linuxbrew
diff --git a/lib/job_board/services/allocate_jobs.rb b/lib/job_board/services/allocate_jobs.rb index abc1234..def5678 100644 --- a/lib/job_board/services/allocate_jobs.rb +++ b/lib/job_board/services/allocate_jobs.rb @@ -8,7 +8,7 @@ def initialize(jobs: [], count: 1, from: '', queue: '', site: '') @count = count @from = from - @jobs = jobs + @jobs = jobs || [] @queue = queue @site = site end
Handle case where jobs is nil
diff --git a/lib/puppet/provider/dbmigrate/script.rb b/lib/puppet/provider/dbmigrate/script.rb index abc1234..def5678 100644 --- a/lib/puppet/provider/dbmigrate/script.rb +++ b/lib/puppet/provider/dbmigrate/script.rb @@ -30,7 +30,7 @@ def default_args scriptname = "#{resource[:name]}/stuff/db-migrate.py" if File.file?("#{Facter.value(:root_home)}/.my.cnf") - [scriptname, "--config-file=#{Facter.value(:root_home)}/.my.cnf"] + [scriptname, "--mysql-config-file=#{Facter.value(:root_home)}/.my.cnf"] else [scriptname] end
Upgrade to the new db-migrate.py config flag
diff --git a/lib/saasable/mongoid/scoped_document.rb b/lib/saasable/mongoid/scoped_document.rb index abc1234..def5678 100644 --- a/lib/saasable/mongoid/scoped_document.rb +++ b/lib/saasable/mongoid/scoped_document.rb @@ -10,7 +10,7 @@ # Indexes index({saas_id: 1}) - index({saad_id: 1, _id: 1}, unique: true) + index({saas_id: 1, _id: 1}, unique: true) class << self alias_method_chain :index, :saasable
Fix typo in index key
diff --git a/random_bell.gemspec b/random_bell.gemspec index abc1234..def5678 100644 --- a/random_bell.gemspec +++ b/random_bell.gemspec @@ -20,5 +20,5 @@ spec.add_development_dependency "bundler" spec.add_development_dependency "rake" - spec.add_development_dependency "rspec" + spec.add_development_dependency "rspec", "~> 2" end
Add version to development dependency.
diff --git a/app/controllers/spree/checkout_controller_decorator.rb b/app/controllers/spree/checkout_controller_decorator.rb index abc1234..def5678 100644 --- a/app/controllers/spree/checkout_controller_decorator.rb +++ b/app/controllers/spree/checkout_controller_decorator.rb @@ -0,0 +1,21 @@+module Spree + CheckoutController.class_eval do + + before_filter :redirect_to_coinbase_if_needed, :only => [:update] + + private + + def redirect_to_coinbase_if_needed + Rails.logger.debug 'Redirect to coinbase' + return unless params[:state] == "payment" + return unless params[:order][:payments_attributes] + + payment_method = Spree::PaymentMethod.find(params[:order][:payments_attributes].first[:payment_method_id]) + Rails.logger.debug payment_method.inspect + return unless payment_method.kind_of?(Spree::PaymentMethod::Coinbase) + Rails.logger.debug "REDIRECT COIN" + redirect_to(spree.coinbase_invoice_path(:payment_method_id => payment_method.id)) and return + end + + end +end
Add redirect to coinbase if they submit payment form.
diff --git a/week-6/gps2_3.rb b/week-6/gps2_3.rb index abc1234..def5678 100644 --- a/week-6/gps2_3.rb +++ b/week-6/gps2_3.rb @@ -0,0 +1,44 @@+# Your Names +# 1) +# 2) + +# We spent [#] hours on this challenge. + +# Bakery Serving Size portion calculator. + +def serving_size_calc(item_to_make, order_quantity) + library = {"cookie" => 1, "cake" => 5, "pie" => 7} + error_counter = 3 + + library.each do |food| + if library[food] != library[item_to_make] + p error_counter += -1 + end + end + + if error_counter > 0 + raise ArgumentError.new("#{item_to_make} is not a valid input") + end + + serving_size = library.values_at(item_to_make)[0] + serving_size_mod = order_quantity % serving_size + + case serving_size_mod + when 0 + return "Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}" + else + return "Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}, you have #{serving_size_mod} leftover ingredients. Suggested baking items: TODO: MAKE THIS FEATURE" + end +end + +p serving_size_calc("pie", 7) +p serving_size_calc("pie", 8) +p serving_size_calc("cake", 5) +p serving_size_calc("cake", 7) +p serving_size_calc("cookie", 1) +p serving_size_calc("cookie", 10) +p serving_size_calc("THIS IS AN ERROR", 5) + +# Reflection + +
Add new GPS 2.3 Code
diff --git a/rss-dcterms.gemspec b/rss-dcterms.gemspec index abc1234..def5678 100644 --- a/rss-dcterms.gemspec +++ b/rss-dcterms.gemspec @@ -4,7 +4,7 @@ Gem::Specification.new do |gem| gem.authors = ["KITAITI Makoto"] gem.email = ["KitaitiMakoto@gmail.com"] - gem.description = %q{Enable standard bundled RSS library parse and make feeds including DCMI Metadata Terms} + gem.description = %q{Enable standard bundled RSS library parse and make feeds including DCMI(Dublin Core Metadata Initiative) Metadata Terms} gem.summary = %q{DCTERMS support for standard bundled RSS library} gem.homepage = "https://gitorious.org/rss/dcterms"
Add full name of DCMI
diff --git a/services/twitter.rb b/services/twitter.rb index abc1234..def5678 100644 --- a/services/twitter.rb +++ b/services/twitter.rb @@ -1,17 +1,16 @@ service :twitter do |data, payload| repository = payload['repository']['name'] - url = URI.parse("http://twitter.com/statuses/update.xml") + url = URI.parse("http://twitter.com/statuses/update.xml") statuses = Array.new - if data['digest'] == false then #=> continue normal behaviour + if data['digest'] == '1' + commit = payload['commits'][-1] + tiny_url = shorten_url(payload['repository']['url'] + '/commits/' + payload['ref'].split('/')[-1]) + statuses.push "[#{repository}] #{tiny_url} #{commit['author']['name']} - #{payload['commits'].length} commits" + else payload['commits'].each do |commit| tiny_url = shorten_url(commit['url']) statuses.push "[#{repository}] #{tiny_url} #{commit['author']['name']} - #{commit['message']}" - end - else #=> Only post the latest commit - payload['commits'].pop do |commit| - tiny_url = shorten_url(commit['url']) - statuses.push "[#{repository}] #{tiny_url} #{commit['author']['name']} - #{payload['commits'].length} commits" end end
Fix up the Twitter digest code
diff --git a/lib/generators/tabster/install_generator.rb b/lib/generators/tabster/install_generator.rb index abc1234..def5678 100644 --- a/lib/generators/tabster/install_generator.rb +++ b/lib/generators/tabster/install_generator.rb @@ -0,0 +1,21 @@+module Tabster + module Generators + class InstallGenerator < Rails::Generators::Base + source_root File.expand_path("../../templates", __FILE__) + + desc "Creates a Tabster initializer and copies css styles to your application" + + def copy_initializer + template 'tabster.rb', 'config/initializers/tabster.rb' + end + + def copy_stylesheet + copy_file "tabster.css", File.join('app/assets/stylesheets', "#{file_name}.css") + end + + def show_readme + readme "README" if behavior == :invoke + end + end + end +end # Tabster
Add setup generator for config and styles files.
diff --git a/lib/shipit/first_parent_commits_iterator.rb b/lib/shipit/first_parent_commits_iterator.rb index abc1234..def5678 100644 --- a/lib/shipit/first_parent_commits_iterator.rb +++ b/lib/shipit/first_parent_commits_iterator.rb @@ -8,7 +8,7 @@ next end - if last_ancestor.parents.first.sha == commit.sha + if last_ancestor.parents.empty? || last_ancestor.parents.first.sha == commit.sha yield last_ancestor = commit end end
Handle orphan commits in GithubSyncJob
diff --git a/recipes/dsc_demo.rb b/recipes/dsc_demo.rb index abc1234..def5678 100644 --- a/recipes/dsc_demo.rb +++ b/recipes/dsc_demo.rb @@ -17,19 +17,19 @@ # dsc_resource 'demogroupremove' do - resource_name :group + resource :group property :groupname, 'demo1' property :ensure, 'absent' end dsc_resource 'demogroupadd' do - resource_name :group + resource :group property :GroupName, 'demo1' property :MembersToInclude, 'administrator' end dsc_resource 'demogroupadd2' do - resource_name :group + resource :group property :GroupName, 'demo1' property :MembersToInclude, 'administrator' end
Fix demo recipe to use resource attribute instead of resource_name
diff --git a/ryespy.gemspec b/ryespy.gemspec index abc1234..def5678 100644 --- a/ryespy.gemspec +++ b/ryespy.gemspec @@ -8,11 +8,8 @@ spec.version = Ryespy::VERSION spec.authors = ["tiredpixel"] spec.email = ["tp@tiredpixel.com"] - spec.description = %q{Ryespy provides a simple executable for listening to - IMAP mailboxes or FTP folders, keeps track of what it's seen using Redis, - and notifies Redis in a way in which Resque and Sidekiq can process using - workers.} - spec.summary = %q{Ryespy listens to IMAP and FTP and queues in Redis (Sidekiq/Resque).} + spec.description = %q{Redis Sidekiq/Resque IMAP and FTP listener.} + spec.summary = %q{Redis Sidekiq/Resque IMAP and FTP listener.} spec.homepage = "https://github.com/tiredpixel/ryespy" spec.license = "MIT" @@ -21,7 +18,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_dependency "redis", "~> 3.0.4" + spec.add_dependency "redis", "~> 3.0" spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake"
Update gemspec metadata and lock to redis 3.x instead of 3.0.x .
diff --git a/schema.gemspec b/schema.gemspec index abc1234..def5678 100644 --- a/schema.gemspec +++ b/schema.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = 'evt-schema' s.summary = "Primitives for schema and data structure" - s.version = '2.2.4.1' + s.version = '2.2.4.2' s.description = ' ' s.authors = ['The Eventide Project']
Package version increased from 2.2.4.1 to 2.2.4.2
diff --git a/app/filters/link_filter.rb b/app/filters/link_filter.rb index abc1234..def5678 100644 --- a/app/filters/link_filter.rb +++ b/app/filters/link_filter.rb @@ -7,6 +7,9 @@ *.youtube.com vimeo.com soundcloud.com + i.imgur.com + *.cloudfront.net + *.s3.amazonaws.com } def process(post) @@ -38,7 +41,7 @@ end def rewrite_for_https_support! - parser.search("iframe").each do |iframe| + parser.css("iframe,img").each do |iframe| if src = iframe.try(:attributes).try(:[], 'src').try(:value) host = URI.parse(src).host if HTTPS_WHITELIST.find { |domain| File.fnmatch(domain, host) }
Rewrite HTTPS URLs for images as well
diff --git a/.citrus/config.rb b/.citrus/config.rb index abc1234..def5678 100644 --- a/.citrus/config.rb +++ b/.citrus/config.rb @@ -1,3 +1,3 @@ Citrus::Configuration.describe do |c| - c.build_script = 'gem ins bundler && bundle install && bundle exec rspec' + c.build_script = 'bundle install && bundle exec rspec' end
Drop bundler gem install from example, lags on rubygems.
diff --git a/features/step_definitions/teacher_registers_steps.rb b/features/step_definitions/teacher_registers_steps.rb index abc1234..def5678 100644 --- a/features/step_definitions/teacher_registers_steps.rb +++ b/features/step_definitions/teacher_registers_steps.rb @@ -1,4 +1,8 @@ Given /^I am an anonymous user$/ do + User.anonymous(true) + get '/sessions/destroy' + response.should redirect_to('/') + follow_redirect! true # for now ... end
Fix Teacher registration step definition There was an issue appearing only on the CI server because the anonymous user was not present when it was expected to be so. I've updated the step definitions to ensure the user is there.
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,18 +1,6 @@ require 'codewars_cli/runner' require 'aruba/cucumber' require 'aruba/in_process' - -Before do - @real_path = ENV['HOME'] - @fake_home = File.join('/tmp','fake_home') - FileUtils.mkdir_p(@fake_home) - set_environment_variable 'HOME', @fake_home -end - -After do - ENV['HOME'] = @real_home - FileUtils.rm_rf @fake_home, :secure => true -end Aruba.configure do |config| config.command_launcher = :in_process
Remove extra configuration for mocking ENV[HOME] aruba handle it
diff --git a/app/models/raw_time_row.rb b/app/models/raw_time_row.rb index abc1234..def5678 100644 --- a/app/models/raw_time_row.rb +++ b/app/models/raw_time_row.rb @@ -4,7 +4,7 @@ include ActiveModel::Serializers::JSON RAW_TIME_ATTRIBUTES = [:id, :absolute_time, :entered_time, :bib_number, :split_name, :sub_split_kind, :data_status, - :split_time_exists, :entered_lap, :stopped_here, :with_pacer, :source, :remarks] + :split_time_exists, :entered_lap, :lap, :stopped_here, :with_pacer, :source, :remarks] RAW_TIME_METHODS = [:military_time, :sub_split_kind] def serialize
Add lap back to the Raw Time Row serializer
diff --git a/BlocksKit.podspec b/BlocksKit.podspec index abc1234..def5678 100644 --- a/BlocksKit.podspec +++ b/BlocksKit.podspec @@ -15,13 +15,4 @@ s.ios.frameworks = 'MessageUI' s.ios.source_files = 'BlocksKit/*.{h,m}', 'BlocksKit/UIKit/*.{h,m}', 'BlocksKit/MessageUI/*.{h,m}' s.ios.deployment_target = '5.0' - s.documentation = { - :html => 'http://pandamonia.github.com/BlocksKit/Documentation/index.html', - :appledoc => [ - '--project-company', 'Pandamonia LLC', - '--company-id', 'us.pandamonia', - '--no-repeat-first-par', - '--no-warn-invalid-crossref' - ] - } end
Remove documentation bit from podspec
diff --git a/app/controllers/v1/usergroups_controller.rb b/app/controllers/v1/usergroups_controller.rb index abc1234..def5678 100644 --- a/app/controllers/v1/usergroups_controller.rb +++ b/app/controllers/v1/usergroups_controller.rb @@ -3,5 +3,16 @@ def index render json: current_user.groups end + + def create + current_user.groups << Group.find(params[:usergroup][:id]) + render json: current_user.save + end + + def destroy + current_user.group_ids.delete(Group.find(params[:id]).id) + render json: current_user.save + end + end end
Add api for joining and leaving groups
diff --git a/app/mutations/task/comments/base_comment.rb b/app/mutations/task/comments/base_comment.rb index abc1234..def5678 100644 --- a/app/mutations/task/comments/base_comment.rb +++ b/app/mutations/task/comments/base_comment.rb @@ -28,7 +28,7 @@ def self.commenter @commenter ||= User::Identity.find_or_create_by(email: 'lale-bot@lale.help') do |identity| identity.password = SecureRandom.uuid - identity.user = User.new(first_name: 'Lale', last_name: 'Bot', status: :active) + identity.user = User.new(first_name: 'Lale', last_name: 'Bot') end.user end
Fix spec; status field isn't on the user any more.
diff --git a/app/overrides/add_capture_order_shortcut.rb b/app/overrides/add_capture_order_shortcut.rb index abc1234..def5678 100644 --- a/app/overrides/add_capture_order_shortcut.rb +++ b/app/overrides/add_capture_order_shortcut.rb @@ -0,0 +1,21 @@+Deface::Override.new(:virtual_path => "spree/admin/orders/index", + :name => "add_capture_order_shortcut", + :insert_bottom => "[data-hook='admin_orders_index_row_actions']", + #copied from backend / app / views / spree / admin / payments / _list.html.erb: + :text => '<% order.payment.actions.grep(/^capture$/).each do |action| %> + <%= link_to_with_icon "icon-#{action}", t(action), fire_admin_order_payment_path(order, order.payment, :e => action), :method => :put, :no_text => true, :data => {:action => action} %> + <% end %>' + ) + +#Resize columns to fit new button (note: this may break with a new version of spree) +Deface::Override.new(:virtual_path => "spree/admin/orders/index", + :name => "add_capture_order_shortcut_first_column", + :set_attributes => "#listing_orders colgroup col:first-child", + :attributes => {:style => "width: 12%"} #was 16% + ) +Deface::Override.new(:virtual_path => "spree/admin/orders/index", + :name => "add_capture_order_shortcut_last_column", + :set_attributes => "#listing_orders colgroup col:last-child", + :attributes => {:style => "width: 12%"} #was 8% + ) +
Add capture button and resize columns
diff --git a/app/presenters/event_reconcile_presenter.rb b/app/presenters/event_reconcile_presenter.rb index abc1234..def5678 100644 --- a/app/presenters/event_reconcile_presenter.rb +++ b/app/presenters/event_reconcile_presenter.rb @@ -7,7 +7,7 @@ end def unreconciled_batch - event.unreconciled_efforts.order(:last_name).limit(20) + @unreconciled_batch ||= event.unreconciled_efforts.order(:last_name).limit(20) end private
Fix bug in EventReconcilePresenter that kept efforts from being matched.
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,4 +2,9 @@ Bundler.require require 'ostruct' +require 'rspec/fire' require File.expand_path("../../lib/textrazor" ,__FILE__) + +RSpec.configure do |config| + config.include(RSpec::Fire) +end
Add code to initialise rspec-fire.
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,18 +1,10 @@ require 'puppetlabs_spec_helper/module_spec_helper' require 'shared_examples' - -require 'puppet-openstack_spec_helper/defaults' -require 'rspec-puppet-facts' -include RspecPuppetFacts +require 'puppet-openstack_spec_helper/facts' RSpec.configure do |c| c.alias_it_should_behave_like_to :it_configures, 'configures' c.alias_it_should_behave_like_to :it_raises, 'raises' - # TODO(aschultz): remove this after all tests converted to use OSDefaults - # instead of referencing @default_facts - c.before :each do - @default_facts = OSDefaults.get_facts - end end at_exit { RSpec::Puppet::Coverage.report! }
Move rspec-puppet-facts to spec helper This change updates the module to use the rspec-puppet-facts as defined in the puppet-openstack_spec_helper. Change-Id: I8da03b20f05fa25aab70147d6f4445e4fdbc1101
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,6 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) + require 'tempfile' require 'rspec' require 'fakefs/spec_helpers' @@ -9,7 +10,9 @@ # Requires supporting files with custom matchers and macros, etc, # in ./support/ and its subdirectories. -Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f} +Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each do |f| + require File.expand_path(f) +end RSpec.configure do |config| config.mock_with :mocha
Fix support requires in spec/helper.rb
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 @@ -12,7 +12,7 @@ config.before :suite do system 'rm -r /tmp/s3' - s3 = spawn 'fakes3 --port 10001 --root /tmp/s3' + s3 = spawn 'fakes3 --port 10001 --root /tmp/s3', err: '/dev/null' sleep 1 end
Hide fakes3 output in 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 @@ -7,6 +7,7 @@ require "syoboi_calendar" require "webmock/rspec" +WebMock.allow_net_connect! module SyoboiCalendar::Fixture extend self
Allow net connect in spec
diff --git a/attributes/client.rb b/attributes/client.rb index abc1234..def5678 100644 --- a/attributes/client.rb +++ b/attributes/client.rb @@ -5,8 +5,14 @@ case node["platform_family"] when "debian" + abi_version = case version + when "5.5" then "18" + when "5.6" then "18.1" + else "" + end + default["percona"]["client"]["packages"] = %W[ - libperconaserverclient-dev-#{version} percona-server-client-#{version} + libperconaserverclient#{abi_version}-dev percona-server-client-#{version} ] when "rhel" default["percona"]["client"] = %W[
Fix odd package names on ubuntu trusty
diff --git a/lib/spirit_intent_listener/spirit/intent_listener.rb b/lib/spirit_intent_listener/spirit/intent_listener.rb index abc1234..def5678 100644 --- a/lib/spirit_intent_listener/spirit/intent_listener.rb +++ b/lib/spirit_intent_listener/spirit/intent_listener.rb @@ -1,8 +1,9 @@ module Spirit class IntentListener - attr_reader :environment + attr_reader :environment, :redis def initialize(environment, config={}) @environment = environment + @redis = config.fetch(:redis, default_redis) end def listen @@ -25,8 +26,8 @@ 'intents.spirit.*' end - def redis - @redis ||= Redis.new + def default_redis + Redis.new end def logger
Allow redis to be injected into intent listener
diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb index abc1234..def5678 100644 --- a/app/controllers/help_controller.rb +++ b/app/controllers/help_controller.rb @@ -3,9 +3,6 @@ class HelpController < ApplicationController before_filter :setup_slimmer_artefact before_filter :set_expiry - - rescue_from AbstractController::ActionNotFound, :with => :error_404 - rescue_from ActionView::MissingTemplate, :with => :error_404 def index end
Remove redundant rescue_from calls from HelpController
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index abc1234..def5678 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -3,9 +3,13 @@ layout 'relaunch' def index +=begin + Find a way to cache this: + unless user_signed_in? || admin_user_signed_in? expires_in 1.hour, public: true end +=end render end
Remove caching from home index action.
diff --git a/data-aggregation-index.gemspec b/data-aggregation-index.gemspec index abc1234..def5678 100644 --- a/data-aggregation-index.gemspec +++ b/data-aggregation-index.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'data_aggregation-index' - s.version = '0.5.0.1' + s.version = '0.5.0.2' s.summary = 'Event store data aggregation index library' s.description = ' '
Package version is incremented from 0.5.0.1 to 0.5.0.2
diff --git a/spec/branch_spec.rb b/spec/branch_spec.rb index abc1234..def5678 100644 --- a/spec/branch_spec.rb +++ b/spec/branch_spec.rb @@ -0,0 +1,12 @@+require 'spec_helper' +require 'compo' +require 'branch_shared_examples' + +# Mock implementation of a Branch +class MockBranch + include Compo::Branch +end + +describe MockBranch do + it_behaves_like 'a branch' +end
Add spec for mocked-up branches.
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,6 +1,5 @@ require 'rubygems' require 'spork' -require 'spork/ext/ruby-debug' Spork.prefork do require 'bundler'
Remove spork debug hooks for now. Doesn't work on Travis because we exclude ruby-debug.
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 @@ -14,8 +14,7 @@ } end require_relative '../postman/database' -require_relative 'support/test_adapter' -require_relative 'support/spawners' +Dir[::File.join(root, "support/**/*.rb")].each { |f| require f } RSpec.configure do |config|
Load all files inside support dir in one line
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,7 +1,8 @@ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) # Require necessary files for sidekiq to believe it's running in server mode -require 'celluloid' +require 'sidekiq/version' +require 'celluloid' if Sidekiq::VERSION < "4.0.0" require 'sidekiq/cli' require 'sidekiq/launcher'
Make the celluloid requirement conditional on the Sidekiq version.
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 @@ -17,4 +17,19 @@ end require File.expand_path('../../vendor/buildr/spec/spec_helpers', __FILE__) + + module SpecHelpers + def root_project_filename(project_name) + "#{project_name}#{Buildr::IntellijIdea::IdeaFile::DEFAULT_SUFFIX}.ipr" + end + + def root_module_filename(project_name) + "#{project_name}#{Buildr::IntellijIdea::IdeaFile::DEFAULT_SUFFIX}.iml" + end + + def subproject_module_filename(parent_project_name, project_name) + "#{project_name}/#{parent_project_name}-#{project_name}#{Buildr::IntellijIdea::IdeaFile::DEFAULT_SUFFIX}.iml" + end + end + end
Customize spec helper to add some iidea specific helpers
diff --git a/simple_form.gemspec b/simple_form.gemspec index abc1234..def5678 100644 --- a/simple_form.gemspec +++ b/simple_form.gemspec @@ -17,6 +17,8 @@ s.test_files = Dir["test/**/*.rb"] s.test_files -= Dir["test/support/country_select/**/*"] s.require_paths = ["lib"] + + s.required_ruby_version = '>= 2.3.0' s.add_dependency('activemodel', '>= 5.0') s.add_dependency('actionpack', '>= 5.0')
Add required Ruby version to .gemspec file
diff --git a/spec/consul_spec.rb b/spec/consul_spec.rb index abc1234..def5678 100644 --- a/spec/consul_spec.rb +++ b/spec/consul_spec.rb @@ -5,7 +5,7 @@ end describe command('consul version'), :if => ['alpine', 'debian'].include?(os[:family]) do - its(:stdout) { should contain("Consul v0.6.4") } + its(:stdout) { should contain("Consul v0.7.0") } end describe file('/usr/local/bin/consul') do
Update spec about Consul version on Linux.
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 @@ -17,7 +17,7 @@ :database => 'chie_test', } -DATABASE_URL = "mysql2://#{CREDENTIALS[:user]}:#{CREDENTIALS[:password]}@#{CREDENTIALS[:host]}/#{CREDENTIALS[:database]}" +DATABASE_URL = "mysql2://#{CREDENTIALS[:username]}:#{CREDENTIALS[:password]}@#{CREDENTIALS[:host]}/#{CREDENTIALS[:database]}" def sqlexec(cmd) `mysql --user='#{CREDENTIALS[:username]}' --password='#{CREDENTIALS[:password]}' '#{CREDENTIALS[:database]}' -e '#{cmd}'`
Fix stupid typo in DATABASE_URL helper
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 @@ -8,8 +8,10 @@ end calculate_stack_overflow_depth(2) else - 0 + 16384 end + +puts STACK_OVERFLOW_DEPTH class DeterministicHash
Set a very big stack number if we can't determine one.
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 @@ -41,7 +41,7 @@ return app end -ENV['GASTRO_RESET_TOKEN'] = Digest::MD5.new.hexdigest(Time.now.to_i.to_s) -ENV['MORPH_API_KEY'] = Digest::MD5.new.hexdigest((Time.now.to_i + 10).to_s) +ENV['GASTRO_RESET_TOKEN'] = Digest::MD5.new.hexdigest(rand(Time.now.to_i).to_s) +ENV['MORPH_API_KEY'] = Digest::MD5.new.hexdigest(rand(Time.now.to_i).to_s) Capybara.app, _ = app
Make test data random, to help uncover any surprising bugs
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 @@ -40,3 +40,5 @@ end OmniAuth.config.test_mode = true + +WebMock.disable_net_connect! :allow => /coveralls\.io/
Configure Webmock to allow HTTP requests to coveralls.io
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 @@ -15,4 +15,12 @@ # Only allow expect syntax c.syntax = :expect end + + config.before do + Celluloid.shutdown + Celluloid.boot + + Celluloid.logger = nil + Msgr.logger = nil + end end
Reset Celluloid actors and logger settings before 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 @@ -13,5 +13,10 @@ config.before do allow(KindleManager::FileStore).to receive(:downloads_dir).and_return('spec/fixtures/downloads') + + # Mock credentials + %w[AMAZON_USERNAME_CODE AMAZON_PASSWORD_CODE AMAZON_CODE_SALT].each do |key| + ENV[key] = 'test' + end end end
Fix test with mocking credentials
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 @@ -13,8 +13,8 @@ SimpleCov.start do command_name 'spec:unit' + add_filter 'support' add_filter 'config' - add_filter 'spec' add_filter 'vendor' minimum_coverage 98.5
Remove coverage filter for specs. DOH!
diff --git a/resources/uninstall_package.rb b/resources/uninstall_package.rb index abc1234..def5678 100644 --- a/resources/uninstall_package.rb +++ b/resources/uninstall_package.rb @@ -18,12 +18,17 @@ delete_cache_path_action = "Delete the installer cache directory #{installer_cache_path}" delete_install_path_action = "Delete installation dir by link ''#{installation_path}''" - service service_name do - action [:stop, :disable] - # Defer directory deletion to the end of run list + + unless service_name.to_s.empty? + service service_name do + action [:stop, :disable] + end + end + + ruby_block 'Defer directories deletion to the end of run list' do + block {} notifies :delete, "directory[#{delete_cache_path_action}]" notifies :run, "dynatrace_delete_directory_by_link[#{delete_install_path_action}]" - not_if { service_name.to_s.empty? } end directory delete_cache_path_action do
[JLT-163581] Refactor uninstall recipes * Fixed bug in agents_package_uinstall recipe after last refactoring * Verified fix by running agents-package-uninstall-centos-6
diff --git a/app/models/registerable_edition.rb b/app/models/registerable_edition.rb index abc1234..def5678 100644 --- a/app/models/registerable_edition.rb +++ b/app/models/registerable_edition.rb @@ -41,10 +41,13 @@ end def state - if archivable? + case edition.state + when "archived", "deleted" "archived" + when "published" + "live" else - edition.state == "published" ? "live" : "draft" + "draft" end end @@ -67,10 +70,4 @@ [] end end - -private - - def archivable? - edition.state == "archived" || edition.state == "deleted" - end end
Clean logic for setting registerable edition state * Clarifies logic for setting registerable edition state
diff --git a/db/migrate/20141121025443_create_schools.rb b/db/migrate/20141121025443_create_schools.rb index abc1234..def5678 100644 --- a/db/migrate/20141121025443_create_schools.rb +++ b/db/migrate/20141121025443_create_schools.rb @@ -1,16 +1,16 @@ class CreateSchools < ActiveRecord::Migration def change create_table :schools do |t| - t.string :program_code - t.string :program_name - t.string :dbn - t.string :printed_school_name - t.string :interest_area - t.string :selection_method - t.string :selection_method_abbrevi - t.string :directory_page_ - t.string :borough - t.string :urls + # t.string :program_code + # t.string :program_name + # t.string :dbn + # t.string :printed_school_name + # t.string :interest_area + # t.string :selection_method + # t.string :selection_method_abbrevi + # t.string :directory_page_ + # t.string :borough + # t.string :urls t.string :phone_number t.string :grade_span_min @@ -22,6 +22,15 @@ t.string :school_type t.string :latitude t.string :longitude + t.text :se_services + t.string :total_students + t.text :program_highlights + t.text :overview_paragraph + t.string :website + t.text :extracurricular_activities + t.string :boro + t.string :dbn + t.string :school_name t.timestamps end
Modify school migration file to only pull from one Socrata API
diff --git a/test/integration/session_answers_test.rb b/test/integration/session_answers_test.rb index abc1234..def5678 100644 --- a/test/integration/session_answers_test.rb +++ b/test/integration/session_answers_test.rb @@ -27,7 +27,7 @@ end test "Returning to start of flow resets session" do - visit "coronavirus-find-support/s" + visit "find-coronavirus-support/s" within "legend" do assert_page_has_content "What do you need help with because of coronavirus?" end @@ -36,7 +36,7 @@ within "legend" do assert_page_has_content "Do you feel safe where you live?" end - visit "coronavirus-find-support/s" + visit "find-coronavirus-support/s" within "legend" do assert_page_has_content "What do you need help with because of coronavirus?" end
Update broken test from changing flow slug We changed the coronavirus-find-support flow to find-coronavirus-support , however this test was added with then old path.
diff --git a/catarse_moip.gemspec b/catarse_moip.gemspec index abc1234..def5678 100644 --- a/catarse_moip.gemspec +++ b/catarse_moip.gemspec @@ -18,7 +18,7 @@ s.test_files = s.files.grep(%r{^(test|spec|features)/}) s.add_dependency "rails", "~> 3.2.13" - s.add_dependency('libxml-ruby', '~> 2.3.3') + s.add_dependency('libxml-ruby', '~> 2.6.0') s.add_development_dependency "rspec-rails" s.add_development_dependency "factory_girl_rails"
Update libxml-ruby version to the latest I could not install or proceed with my catarse install due to this version failing on OSX.
diff --git a/app/controllers/crowdblog/controller.rb b/app/controllers/crowdblog/controller.rb index abc1234..def5678 100644 --- a/app/controllers/crowdblog/controller.rb +++ b/app/controllers/crowdblog/controller.rb @@ -4,7 +4,7 @@ before_filter :authorize! def authorize! - redirect_to main_app.new_user_session_url unless current_user + redirect_to main_app.user_sign_in_url end end end
Use sign in url in main_app
diff --git a/app/controllers/decisions_controller.rb b/app/controllers/decisions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/decisions_controller.rb +++ b/app/controllers/decisions_controller.rb @@ -1,6 +1,10 @@ class DecisionsController < ApplicationController def show decision = co.decisions.find(params[:id]) - redirect_to proposal_path(decision.proposal) + if decision.proposal.is_a?(Resolution) + redirect_to resolution_path(decision.proposal) + else + redirect_to proposal_path(decision.proposal) + end end end
Handle resolution type better in DecisionsController.
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 @@ -0,0 +1,24 @@+get '/questions' do + @questions = Question.all + erb :'/questions/index' +end + +get '/questions/new' do + erb :'/questions/new' + # <input type="hidden" name="question[user_id]" value="<%= current_user.id %>"> +end + +post '/questions' do + question = Question.new(params[:question]) + if question.save + redirect '/questions' + else + @errors = question.errors.full_messages + erb :'/questions/new' + end +end + +get '/questions/:id' do + @question = Question.find(params[:id]) + erb :'/questions/show' +end
Create some routes for questions
diff --git a/app/models/miq_remote_console_worker.rb b/app/models/miq_remote_console_worker.rb index abc1234..def5678 100644 --- a/app/models/miq_remote_console_worker.rb +++ b/app/models/miq_remote_console_worker.rb @@ -20,4 +20,16 @@ def container_port 3001 end + + def configure_service_worker_deployment(definition) + super + + definition[:spec][:template][:spec][:containers].first[:volumeMounts] << {:name => "remote-console-httpd-config", :mountPath => "/etc/httpd/conf.d"} + definition[:spec][:template][:spec][:volumes] << {:name => "remote-console-httpd-config", :configMap => {:name => "remote-console-httpd-configs", :defaultMode => 420}} + + if ENV["REMOTE_CONSOLE_SSL_SECRET_NAME"].present? + definition[:spec][:template][:spec][:containers].first[:volumeMounts] << {:name => "remote-console-httpd-ssl", :mountPath => "/etc/pki/tls"} + definition[:spec][:template][:spec][:volumes] << {:name => "remote-console-httpd-ssl", :secret => {:secretName => ENV["REMOTE_CONSOLE_SSL_SECRET_NAME"], :items => [{:key => "remote_console_crt", :path => "certs/server.crt"}, {:key => "remote_console_key", :path => "private/server.key"}], :defaultMode => 400}} + end + end end
Enable SSL to the remote console pods
diff --git a/lib/open_conference_ware/engine.rb b/lib/open_conference_ware/engine.rb index abc1234..def5678 100644 --- a/lib/open_conference_ware/engine.rb +++ b/lib/open_conference_ware/engine.rb @@ -11,7 +11,11 @@ ] initializer "open_conference_ware.assets.precompile" do |app| - app.config.assets.precompile += %w(ie.css) + # Precompile IE-only assets + app.config.assets.precompile += ['ie.js'] + + # Include vendored image, font, and flash assets when precompiling + app.config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif *.eot *.svg *.ttf *.woff *.swf) end config.generators do |g|
Update asset pre-compilation list to include more file types
diff --git a/lib/rubycritic/analysers_runner.rb b/lib/rubycritic/analysers_runner.rb index abc1234..def5678 100644 --- a/lib/rubycritic/analysers_runner.rb +++ b/lib/rubycritic/analysers_runner.rb @@ -27,7 +27,7 @@ end def aggregate_smells(smell_adapters) - smell_adapters.map(&:smells).flatten.sort + smell_adapters.flat_map(&:smells).sort end end
Use flat_map instead of map followed by flatten Not only is this more idiomatic, [it's also better performance wise!][1] [1]: http://gistflow.com/posts/578-use-flat_map-instead-of-map-flatten
diff --git a/lib/simple_queues/encoders/json.rb b/lib/simple_queues/encoders/json.rb index abc1234..def5678 100644 --- a/lib/simple_queues/encoders/json.rb +++ b/lib/simple_queues/encoders/json.rb @@ -3,7 +3,7 @@ module SimpleQueues class JsonEncoder def encode(message) - JSON.generate(message) + message.to_json end def decode(message)
Fix 'NoMethodError merge for JSON::Ext::Generator::State' See http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/3739dd637e038fa9 And http://stackoverflow.com/questions/4934917/rails-json-conversion-error
diff --git a/lib/business_calendar/holiday_determiner.rb b/lib/business_calendar/holiday_determiner.rb index abc1234..def5678 100644 --- a/lib/business_calendar/holiday_determiner.rb +++ b/lib/business_calendar/holiday_determiner.rb @@ -17,9 +17,8 @@ elsif removals.include? date false elsif !additions_only - Holidays.between(date, date, @regions, :observed) - .select { |h| @holiday_names.include? h[:name] } - .size > 0 + Holidays.between(date, date, @regions, :observed). + any? { |h| @holiday_names.include? h[:name] } end end end
Use Ruby 1.8-compatible syntax. Also a minor refactor.
diff --git a/lib/spout/templates/test/dictionary_test.rb b/lib/spout/templates/test/dictionary_test.rb index abc1234..def5678 100644 --- a/lib/spout/templates/test/dictionary_test.rb +++ b/lib/spout/templates/test/dictionary_test.rb @@ -4,7 +4,7 @@ include Spout::Tests # You may add additional tests here - # test "the truth" do + # def test_truth # assert true # end end
Use standard ruby method for defining tests
diff --git a/findrepos.gemspec b/findrepos.gemspec index abc1234..def5678 100644 --- a/findrepos.gemspec +++ b/findrepos.gemspec @@ -17,6 +17,8 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ['lib'] + spec.add_dependency 'thor' + spec.add_development_dependency 'bundler', '~> 1.6' spec.add_development_dependency 'rake' spec.add_development_dependency 'rspec'
Add thor to the dependencies (I forgot to do this earlier)
diff --git a/spec/file_readers/base_spec.rb b/spec/file_readers/base_spec.rb index abc1234..def5678 100644 --- a/spec/file_readers/base_spec.rb +++ b/spec/file_readers/base_spec.rb @@ -1,5 +1,13 @@ require 'spec_helper' describe RubyJawbone::FileReaders::Base do - # + let(:file) { double "File" } + + describe "#initialize" do + it "receives and sets the file" do + file_reader = RubyJawbone::FileReaders::Base.new(file) + + expect(file_reader.file).to eq file + end + end end
Add small tests to cover a file reader being initialized with a file.
diff --git a/spec/node/node_version_spec.rb b/spec/node/node_version_spec.rb index abc1234..def5678 100644 --- a/spec/node/node_version_spec.rb +++ b/spec/node/node_version_spec.rb @@ -3,13 +3,13 @@ # Node 4.x if property[:name] =~ /v4./ describe command('node -v') do - its(:stdout) { should contain('v4.8.1') } + its(:stdout) { should contain('v4.8.2') } end end # Node 6.x if property[:name] =~ /v6./ describe command('node -v') do - its(:stdout) { should contain('v6.10.1') } + its(:stdout) { should contain('v6.10.2') } end end
Update for Node.js v4.8.2 and v6.10.2
diff --git a/api/gificiency.rb b/api/gificiency.rb index abc1234..def5678 100644 --- a/api/gificiency.rb +++ b/api/gificiency.rb @@ -51,7 +51,11 @@ def get_random_gif_by_category(category) gif_set = get_category_gifs(category) - gif_set.sample[:url] + unless gif_set.empty? + gif_set.sample[:url] + else + 'No GIF found.' + end end end
Return empty result if no GIF found in "API"
diff --git a/lib/cli.rb b/lib/cli.rb index abc1234..def5678 100644 --- a/lib/cli.rb +++ b/lib/cli.rb @@ -0,0 +1,37 @@+require 'thor' +require 'card' +require 'yubioath' +require 'yubioath/select' + +class CLI < Thor + CARD = Card.new(name: 'Yubico Yubikey NEO OTP+CCID') + + package_name 'yubioath' + + desc 'list', 'list current OTP tokens' + def list + require 'yubioath/calculate_all' + CARD.tap do |card| + YubiOATH::Select.send(aid: ::YubiOATH::AID, to: card) + all = YubiOATH::CalculateAll.send(timestamp: Time.now, to: card) + + STDOUT.puts + STDOUT.puts 'YubiOATH Tokens:' + STDOUT.puts '----------------' + + all[:codes].each_with_index do |token, index| + STDOUT.puts "#{index+1}. #{token.name}: #{token.code}" + end + end + end + + desc 'token NAME', 'get the current OTP value for NAME' + def token(name) + require 'yubioath/calculate' + CARD.tap do |card| + YubiOATH::Select.send(aid: ::YubiOATH::AID, to: card) + token = YubiOATH::Calculate.send(name: name, timestamp: Time.now, to: card) + STDOUT.puts token.code + end + end +end
Define the CLI using Thor
diff --git a/RPBorderlessSegmentedControl.podspec b/RPBorderlessSegmentedControl.podspec index abc1234..def5678 100644 --- a/RPBorderlessSegmentedControl.podspec +++ b/RPBorderlessSegmentedControl.podspec @@ -8,8 +8,7 @@ s.author = { "Brandon Evans" => "brandon.evans@robotsandpencils.com" } s.source = { :git => "https://github.com/RobotsAndPencils/RPBorderlessSegmentedControl.git", :tag => s.version.to_s } - s.platform = :osx, '10.9' - s.osx.deployment_target = '10.9' + s.platform = :osx, '10.8' s.requires_arc = true s.source_files = 'Classes', 'Categories'
Drop deployment target to 10.8
diff --git a/spec/centos/install_chef_spec.rb b/spec/centos/install_chef_spec.rb index abc1234..def5678 100644 --- a/spec/centos/install_chef_spec.rb +++ b/spec/centos/install_chef_spec.rb @@ -0,0 +1,7 @@+require 'spec_helper' + +# Make sure Chef installs + +describe command('curl -kL https://www.chef.io/chef/install.sh | bash') do + its(:exit_status) { should eq 0 } +end
Test ensure Chef can install
diff --git a/spec/dummy/config/application.rb b/spec/dummy/config/application.rb index abc1234..def5678 100644 --- a/spec/dummy/config/application.rb +++ b/spec/dummy/config/application.rb @@ -9,7 +9,7 @@ # require "rails/test_unit/railtie" Bundler.require(*Rails.groups) -require "transam_spatial" +require "transam_sign" module Dummy class Application < Rails::Application
Make dummy app config require transam_sign (not transam_spatial)
diff --git a/spec/lib/requeue_content_spec.rb b/spec/lib/requeue_content_spec.rb index abc1234..def5678 100644 --- a/spec/lib/requeue_content_spec.rb +++ b/spec/lib/requeue_content_spec.rb @@ -1,6 +1,10 @@ require "rails_helper" RSpec.describe RequeueContent do + before do + ContentItem.destroy_all + end + let!(:content_item1) { create(:live_content_item, base_path: '/ci1') } let!(:content_item2) { create(:live_content_item, base_path: '/ci2') } let!(:content_item3) { create(:live_content_item, base_path: '/ci3') }
Delete all content items before running requeue test This test is brittle because if another test leaves a content item hanging arund, this test fails because it reads the first content item out of the database. This change ensures we start with a clean slate.