diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -5,31 +5,20 @@ # Auditorium.create(movietheater_id: 1) # Seats belong to an auditorium -Auditorium.create(movietheater_id: 1) +# 10.times do +# Seat.create( +# auditorium_id: 1, +# ) +# end +# 20.times do +# Seat.create( +# auditorium_id: 2, +# ) +# end -CategoryProduct.create!([ - {category_id: 1, product_id: 2}, - {category_id: 1, product_id: 4}, - {category_id: 1, product_id: 7}, - {category_id: 2, product_id: 1}, - {category_id: 2, product_id: 2}, - {category_id: 2, product_id: 4}, - {category_id: 2, product_id: 7}, - {category_id: 3, product_id: 5}, - {category_id: 3, product_id: 6}, - {category_id: 1, product_id: 3}, - {category_id: 1, product_id: 5}, - {category_id: 2, product_id: 5}, - {category_id: 2, product_id: 6} - - 200.times do - Address.create( - address_1: Faker::Address.street_address, - address_2: Faker::Address.secondary_address, - city: Faker::Address.city, - state: Faker::Address.state, - zip: Faker::Address.zip, - employee_id: Employee.all.sample.id - ) -end+# 30.times do +# Seat.create( +# auditorium_id: 3, +# ) +# end
Add seed data for seats for each auditorium.
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -8,9 +8,18 @@ require 'net/http' require 'uri' +require 'json' def open(url) Net::HTTP.get(URI.parse(url)) end -page_content = open('http://data.cityofnewyork.us/resource/n3p6-zve2.json')+page_content = open('http://data.cityofnewyork.us/resource/n3p6-zve2.json') + +School.delete_all + +all_high_schools = JSON.parse(page_content) +all_high_schools.each do |x| + School.create(name: x["school_name"], dbn: x["dbn"], total_students: x["total_students"], lat: x["location_1"]["latitude"],long: x["location_1"]["longitude"], boro: x["boro"], street_address: x["primary_address_line_1"], zip: x["zip"], overview: x["overview_paragraph"], website: x["website"], phone_number: x["phone_number"], grade_span_min: x["grade_span_min"], grade_span_max: x["grade_span_max"], program_highlights: x["program_highlights"] ) +end +
Add call to socrata open data API to create school seed data
diff --git a/lib/sandbox_event.rb b/lib/sandbox_event.rb index abc1234..def5678 100644 --- a/lib/sandbox_event.rb +++ b/lib/sandbox_event.rb @@ -1,4 +1,4 @@ class SandboxEvent < ActiveRecord::Base self.table_name = "atomic.events" - establish_connection("redshift_sandbox") - end+ establish_connection(ENV['SANDBOX_DATABASE_URL'] || "redshift_sandbox") + end
Support overriding of sandbox database via ENV var
diff --git a/lib/controls/id.rb b/lib/controls/id.rb index abc1234..def5678 100644 --- a/lib/controls/id.rb +++ b/lib/controls/id.rb @@ -9,7 +9,7 @@ third_prefix = ['8', '9', 'A', 'B'].sample - "#{first_octet}-4000-#{third_prefix}000-0000-000000000000" + "#{first_octet}-0000-4000-#{third_prefix}000-000000000000" # NOTE This should become: Identifier::UUID::Controls::Incrementing.example(i) [Scott, Mon Oct 12 2015] end
Swap second and third octets
diff --git a/lib/versatile_rjs.rb b/lib/versatile_rjs.rb index abc1234..def5678 100644 --- a/lib/versatile_rjs.rb +++ b/lib/versatile_rjs.rb @@ -7,9 +7,24 @@ require 'versatile_rjs/railtie' module VersatileRJS - VERSION = '0.0.2' + VERSION = '0.1.0' class <<self attr_accessor :javascript_framework, :debug_rjs + alias_method :debug_rjs?, :debug_rjs + end + + def self.framework_module + javascript_framework.to_s.camelcase + end + + def self.implementation_class_of(mod) + class_name_tree = mod.name.split('::') + + class_dirnames = class_name_tree[0...-1] + class_basename = class_name_tree[-1] + implementation_class_name = [class_dirnames, framework_module, class_basename].flatten.join('::') + + implementation_class_name.constantize end end
Add alias debug_rjs? / implementation_class_of method
diff --git a/scan.rb b/scan.rb index abc1234..def5678 100644 --- a/scan.rb +++ b/scan.rb @@ -0,0 +1,102 @@+#!/usr/bin/ruby + +##require 'rubygems' +require 'sinatra' + +## Configuration +SCANWEB_HOME = File.dirname(__FILE__) +SCRIPT_FILE = SCANWEB_HOME + "/scan.sh" +OUTPUT_DIR = '/export/work/scan' +#OUTPUT_DIR = 'c:/temp/scan' + +set :port, 10080 + +## +def create_path_table(basename) + { + :pdf_path => "#{OUTPUT_DIR}/#{basename}.pdf", + :log_path => "#{OUTPUT_DIR}/#{basename}.log", + :thumbs_path => "#{OUTPUT_DIR}/#{basename}_thumbs.zip", + } +end + +# too ad-hoc implementation. sleep 1 if it conflicts... +def create_basename + time_str = Time.now.strftime("%Y%m%d-%H%M%S") + + basename = "scan-#{time_str}" + + path_table = create_path_table(basename) + if File.exists?(path_table[:pdf_path]) || + File.exists?(path_table[:log_path]) || + File.exists?(path_table[:thumbs_path]) then + sleep 1 + return create_basename() + end + + return basename +end + + +helpers do + include Rack::Utils + alias_method :h, :escape_html + alias_method :u, :escape +end + +get '/' do + erb :index +end + +get '/invalid' do + return 'パラメータの指定が不正です。' +end + +post '/scan' do + source = params[:source] + mode = params[:mode] + resolution = params[:resolution] + + unless source =~ /^[a-zA-Z ]+$/ && + mode =~ /^[a-zA-Z]+$/ && + resolution =~ /^[0-9]+$/ then + redirect '/invalid' + end + + basename = create_basename() + path_table = create_path_table(basename) + + ##File.open(path_table[:log_path], "w") do |fp| + ## fp.puts("TEXT!") + ##end + system(%Q(#{SCRIPT_FILE} "#{path_table[:pdf_path]}" "#{path_table[:log_path]}" "#{path_table[:thumbs_path]}" "#{source}" "#{mode}" "#{resolution}")) + + # If output exists, treat as scanning is succeeded. + if File.exists?(path_table[:pdf_path]) then + ##if true + @success = true + @message = 'スキャンが完了しました。' + @basename = basename + else + @success = false + @message = 'スキャンに失敗しました。' + if File.exists?(path_table[:log_path]) then + @log_text = File.read(path_table[:log_path]) + else + @log_text = 'ログファイルが見つかりません。' + end + end + + erb :scan +end + +get '/image/:basename' do + basename = params[:basename] + + unless basename =~ /^[a-zA-Z0-9]+$/ then + redirect '/invalid' + end + + return basename +end +
Set the port to 10080.
diff --git a/test/unit/types/integer_range_type_test.rb b/test/unit/types/integer_range_type_test.rb index abc1234..def5678 100644 --- a/test/unit/types/integer_range_type_test.rb +++ b/test/unit/types/integer_range_type_test.rb @@ -5,18 +5,22 @@ assert_equal [4, 5], type.encode(4..5) assert_equal [4, nil], type.encode(4..Float::INFINITY) assert_equal [nil, 5], type.encode(-Float::INFINITY..5) + assert_equal [0, 20], type.encode(20..0) end test 'decode' do assert_equal 4..5, type.decode([4, 5]) assert_equal 4..Float::INFINITY, type.decode([4, nil]) assert_equal -Float::INFINITY..5, type.decode([nil, 5]) + assert_equal -Float::INFINITY..Float::INFINITY, type.decode([nil, nil]) end test 'typecast' do assert_equal 1..5, type.typecast(1..5) + assert_equal 1..5, type.typecast(5..1) assert_equal 1..5, type.typecast([1, 5]) assert_equal 1..Float::INFINITY, type.typecast([1, nil]) assert_equal -Float::INFINITY..2, type.typecast([nil, 2]) + assert_equal -Float::INFINITY..Float::INFINITY, type.typecast([nil, nil]) end end
Add a few more edge case tests. 1) Because ruby supports max..min style ranges, some fiddling is necessary. 2) Ensure that [nil, nil] is handled. This is a valid postgres range that could be decoded
diff --git a/marpa.rb b/marpa.rb index abc1234..def5678 100644 --- a/marpa.rb +++ b/marpa.rb @@ -2,16 +2,17 @@ class Marpa attr_accessor :chart, :source, :state_machine, :state_size - attr_accessor :previous_chart + attr_accessor :previous_chart, :charts def initialize grammar @state_machine = StateMachine.new(grammar) @state_size = state_machine.size + @charts = [] reset end def reset - @chart = Chart.new(0, state_size) + charts[0] = @chart = Chart.new(0, state_size) @previous_chart = nil chart.add state_machine.starting_state, @chart self @@ -20,19 +21,17 @@ def parse source @source = source consumer = method(:marpa_pass) - if source.kind_of?(Enumerator) - source.each &consumer - else - source.each_char &consumer - end + generator = source.kind_of?(Enumerator) ? source : source.each_char + generator.each.with_index &consumer success? end - def marpa_pass sym + def marpa_pass sym, index @previous_chart = chart @previous_chart.memoize_transitions @chart = Chart.new(@previous_chart.index.succ, state_size) + charts[index + 1] = chart consume sym end
Save all charts in an array.
diff --git a/places/social_stream-places.gemspec b/places/social_stream-places.gemspec index abc1234..def5678 100644 --- a/places/social_stream-places.gemspec +++ b/places/social_stream-places.gemspec @@ -4,7 +4,7 @@ Gem::Specification.new do |s| s.name = "social_stream-places" s.version = SocialStream::Places::VERSION.dup - s.authors = ["Carolina García", "GING - DIT - UPM"] + s.authors = ["Carolina Garcia", "GING - DIT - UPM"] s.summary = "Places support for Social Stream, the core for building social network websites" s.description = "Social Stream is a Ruby on Rails engine providing your application with social networking features and activity streams.\n\nThis gem allow you to add places as a new social stream activity" s.email = "holacarol@gmail.com"
Remove tilde from Carolina's last name
diff --git a/lib/git_crecord.rb b/lib/git_crecord.rb index abc1234..def5678 100644 --- a/lib/git_crecord.rb +++ b/lib/git_crecord.rb @@ -7,7 +7,7 @@ def self.main(argv) if argv.include?('--version') puts VERSION - 0 + true else run end @@ -20,7 +20,7 @@ return false if files.empty? result = UI.run(files) return result.call == true if result.respond_to?(:call) - 0 + true end end end
Use booleans as return-values of the program
diff --git a/lib/tescha/pack.rb b/lib/tescha/pack.rb index abc1234..def5678 100644 --- a/lib/tescha/pack.rb +++ b/lib/tescha/pack.rb @@ -19,28 +19,29 @@ if __FILE__ == $PROGRAM_NAME require 'tescha/meta_test' + include Tescha - instance_in_test = Tescha::Pack.new 'An empty test pack' do + instance_in_test = Pack.new 'An empty test pack' do end puts "\n---------------------------#judge_results" - Tescha::MetaTest.test( + MetaTest.test( "returns a Tescha::ResultSet", - ( actual = instance_in_test.judge_results ).instance_of?( expected = Tescha::ResultSet ), - "#{actual.inspect} is not a #{expected}" + ( actual = instance_in_test.judge_results ).instance_of?( ResultSet ), + "#{actual.inspect} is not a Tescha::ResultSet" ) puts "\n---------------------------#initialize" - pack = Tescha::Pack.new "test pack to test its test block's context" do - Tescha::MetaTest.test( + pack = Pack.new "test pack to test its test block's context" do + MetaTest.test( "the given block is evaluated in the context of the Tescha::Pack instance", - self.instance_of?( Tescha::Pack ), + self.instance_of?( Pack ), "#{self.inspect} is not a Tescha::Pack" ) end pack.judge_results - Tescha::MetaTest.test( + MetaTest.test( "outside the block is NOT evaluated in the context of the Tescha::Pack instance", ( self.to_s == 'main' ), "#{self.inspect} is not main object"
Delete some verbose expressions in spec
diff --git a/lib/tracker_api.rb b/lib/tracker_api.rb index abc1234..def5678 100644 --- a/lib/tracker_api.rb +++ b/lib/tracker_api.rb @@ -27,6 +27,7 @@ autoload :Project, 'tracker_api/endpoints/project' autoload :Projects, 'tracker_api/endpoints/projects' autoload :Stories, 'tracker_api/endpoints/stories' + autoload :Story, 'tracker_api/endpoints/story' end module Resources
Add Story Endpoint to Endpoints module declaration While attempting to call ```.story([id])``` on a project object, received error: > NameError: uninitialized constant Tracker::Endpoints::Story Found we weren't actually including that endpoint. =)
diff --git a/lib/travis/logs.rb b/lib/travis/logs.rb index abc1234..def5678 100644 --- a/lib/travis/logs.rb +++ b/lib/travis/logs.rb @@ -34,7 +34,7 @@ def version @version ||= - `git rev-parse HEAD 2>/dev/null || echo ${SOURCE_VERSION:-fafafaf}`.strip + `git rev-parse HEAD 2>/dev/null || echo ${HEROKU_SLUG_COMMIT:-fafafaf}`.strip end end end
Switch to env var with correct deployed version
diff --git a/actioncable/test/test_helper.rb b/actioncable/test/test_helper.rb index abc1234..def5678 100644 --- a/actioncable/test/test_helper.rb +++ b/actioncable/test/test_helper.rb @@ -4,7 +4,6 @@ require "active_support/testing/autorun" require "puma" -require "mocha/minitest" require "rack/mock" begin
Remove mocha from ActionCable tests Q.E.D.
diff --git a/test/unit/recipes/default_spec.rb b/test/unit/recipes/default_spec.rb index abc1234..def5678 100644 --- a/test/unit/recipes/default_spec.rb +++ b/test/unit/recipes/default_spec.rb @@ -2,7 +2,7 @@ describe 'g5-rbenv::default' do let(:chef_run) do - ChefSpec::Runner.new do |node| + ChefSpec::SoloRunner.new do |node| node.set['rbenv']['ruby_version'] = ruby_version end.converge(described_recipe) end
Update unit tests for latest ChefSpec
diff --git a/at_most.gemspec b/at_most.gemspec index abc1234..def5678 100644 --- a/at_most.gemspec +++ b/at_most.gemspec @@ -8,14 +8,13 @@ spec.version = AtMost::VERSION spec.authors = ["Kristian Freeman"] spec.email = ["kristian@kristianfreeman.com"] - spec.description = %q{TODO: Write a gem description} - spec.summary = %q{TODO: Write a gem summary} - spec.homepage = "" + spec.description = %q{Limit your ActiveRecord models} + spec.summary = %q{A simple extension to ActiveRecord to allow limiting of model creation via validation. This gem was extracted out of a Rails app function that limited the number of users that could be created with CRUD access to a different AR model.} + spec.homepage = "https://github.com/imkmf/at_most" spec.license = "MIT" spec.files = `git ls-files`.split($/) - spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) + spec.test_files = spec.files.grep(%r{^(spec)/}) spec.require_paths = ["lib"] spec.add_dependency "activerecord"
Update Gemspec, getting prepared for version 0.0.1 release
diff --git a/hive-runner-android.gemspec b/hive-runner-android.gemspec index abc1234..def5678 100644 --- a/hive-runner-android.gemspec +++ b/hive-runner-android.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'hive-runner-android' - s.version = '1.1.2' + s.version = '1.1.3' s.date = '2015-02-26' s.summary = 'Hive Runner Android' s.description = 'The Android controller module for Hive Runner' @@ -10,6 +10,6 @@ s.homepage = 'https://github.com/bbc/hive-runner-android' s.license = 'MIT' s.add_runtime_dependency 'device_api-android', '~> 1.0' - s.add_runtime_dependency 'hive-runner', '~> 2.0' + s.add_runtime_dependency 'hive-runner', '~> 2.0.5' s.add_runtime_dependency 'terminal-table', '>= 1.4' end
Use hive-runner 2.0.5 or greater
diff --git a/spec/octocatalog-diff/integration/examples_spec.rb b/spec/octocatalog-diff/integration/examples_spec.rb index abc1234..def5678 100644 --- a/spec/octocatalog-diff/integration/examples_spec.rb +++ b/spec/octocatalog-diff/integration/examples_spec.rb @@ -0,0 +1,60 @@+# frozen_string_literal: true + +require_relative '../tests/spec_helper' + +require 'open3' +require 'stringio' + +describe 'examples/octocatalog-diff.cfg.rb' do + let(:script) { File.expand_path('../../../examples/octocatalog-diff.cfg.rb', File.dirname(__FILE__)) } + let(:ls_l) { Open3.capture2e("ls -l '#{script}'").first } + + it 'should exist' do + expect(File.file?(script)).to eq(true), ls_l + end + + it 'should not raise errors when loaded' do + load script + end + + it 'should create OctocatalogDiff::Config namespace and .config method' do + k = Kernel.const_get('OctocatalogDiff::Config') + expect(k.to_s).to eq('OctocatalogDiff::Config') + end + + it 'should return a hash from the .config method' do + result = OctocatalogDiff::Config.config + expect(result).to be_a_kind_of(Hash) + end +end + +describe 'examples/api/v1/catalog-builder-local-files.rb' do + let(:script) { File.expand_path('../../../examples/api/v1/catalog-builder-local-files.rb', File.dirname(__FILE__)) } + let(:ls_l) { Open3.capture2e("ls -l '#{script}'").first } + + it 'should exist' do + expect(File.file?(script)).to eq(true), ls_l + end + + context 'executing' do + before(:each) do + @stdout_obj = StringIO.new + @old_stdout = $stdout + $stdout = @stdout_obj + end + + after(:each) do + $stdout = @old_stdout + end + + it 'should compile and run' do + load script + output = @stdout_obj.string.split("\n") + expect(output).to include('Object returned from OctocatalogDiff::API::V1.catalog is: OctocatalogDiff::API::V1::Catalog') + expect(output).to include('The catalog is valid.') + expect(output).to include('The catalog was built using OctocatalogDiff::Catalog::Computed') + expect(output).to include('- System::User - bob') + expect(output).to include('The resources are equal!') + end + end +end
Add tests for example settings and example APIv1 catalog builder
diff --git a/mayhem-rails.gemspec b/mayhem-rails.gemspec index abc1234..def5678 100644 --- a/mayhem-rails.gemspec +++ b/mayhem-rails.gemspec @@ -18,6 +18,8 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ['lib'] + spec.add_runtime_dependency 'mayhem', '0.0.2' + spec.add_development_dependency 'bundler', '~> 1.3' spec.add_development_dependency 'rake' end
Add mayhem gem as a dependency
diff --git a/main.rb b/main.rb index abc1234..def5678 100644 --- a/main.rb +++ b/main.rb @@ -2,14 +2,21 @@ $main_info = {}; -proj_list = Dir['/home/ethan/games/kerbal/CKAN-meta/*'] +ckan_dir = '/home/ethan/games/kerbal/CKAN-meta' -proj_list.each do |proj| - versions = Dir["#{proj}/*.ckan"] - versions.each do |v| - puts "Reading #{v}" - info = JSON.parse(File.read(v)) +proj_list = Dir['#{ckan_dir}/*'] + +# sweet! "split" on a string handles blank lines in exactly the way I want :) +files = `cd #{ckan_dir}; git log --name-only --format='format:' HEAD~5..HEAD`.split + +files.each do |f| + path = "#{ckan_dir}/#{f}" + if File.exists?(path) then + puts "Reading #{f}" + info = JSON.parse(File.read(path)) $main_info[info['identifier']] = info + else + puts "No such file #{f}" end end
Switch to parsing Git history to find CKAN files to read
diff --git a/ab/ab.rb b/ab/ab.rb index abc1234..def5678 100644 --- a/ab/ab.rb +++ b/ab/ab.rb @@ -1,11 +1,16 @@ #!/usr/bin/env ruby -url = 'http://127.0.0.1:4100/articles' -server = 'unicorn_6' +server, port = *ARGV +server ||= 'unamed_server' +port ||= '3000' + +url = "http://127.0.0.1:#{port}/articles" users = [1, 2, 4, 8, 16, 32, 64, 128] -puts "Warming up..." -`ab #{url}` +`mkdir -p ab/#{server}` + +puts 'Warming up...' +5.times { `ab #{url}` } users.each do |user_count| puts "Runnning test with #{user_count} users"
Update script to receive server and port
diff --git a/lib/constellation/runner.rb b/lib/constellation/runner.rb index abc1234..def5678 100644 --- a/lib/constellation/runner.rb +++ b/lib/constellation/runner.rb @@ -5,10 +5,9 @@ class Runner < Thor include Thor::Actions - @@config = Config.new - def initialize(*) super + @config = Config.new end desc "init", "Generates a ConstellationFile and initializes the application"
Change config to an instance variable
diff --git a/rb/spec/integration/selenium/webdriver/mouse_spec.rb b/rb/spec/integration/selenium/webdriver/mouse_spec.rb index abc1234..def5678 100644 --- a/rb/spec/integration/selenium/webdriver/mouse_spec.rb +++ b/rb/spec/integration/selenium/webdriver/mouse_spec.rb @@ -26,14 +26,15 @@ text.should == "Dropped!" end - not_compliant_on :browser => :firefox, :platform => :windows do - it "double clicks an element" do - driver.navigate.to url_for("javascriptPage.html") - element = driver.find_element(:id, 'doubleClickField') + it "double clicks an element" do + driver.navigate.to url_for("javascriptPage.html") + element = driver.find_element(:id, 'doubleClickField') - driver.mouse.double_click element - element.attribute(:value).should == 'DoubleClicked' - end + driver.mouse.double_click element + + wait(5).until { + element.attribute(:value) == 'DoubleClicked' + } end it "context clicks an element" do @@ -41,7 +42,10 @@ element = driver.find_element(:id, 'doubleClickField') driver.mouse.context_click element - element.attribute(:value).should == 'ContextClicked' + + wait(5).until { + element.attribute(:value) == 'ContextClicked' + } end end
JariBakken: Add missing wait to double/context click spec. git-svn-id: aa1aa1384423cb28c2b1e29129bb3a91de1d9196@14055 07704840-8298-11de-bf8c-fd130f914ac9
diff --git a/lib/materialize_renderer.rb b/lib/materialize_renderer.rb index abc1234..def5678 100644 --- a/lib/materialize_renderer.rb +++ b/lib/materialize_renderer.rb @@ -0,0 +1,9 @@+class MaterializeRenderer < MaterializePagination::Rails + + # @return [String] rendered pagination link + def page_number(page) + classes = ['waves-effect', ('active' if page == current_page)].join(' ') + tag :li, link(page, page, :rel => rel_value(page)), class: classes + end + +end
Create a helper for materialize will paginate gem
diff --git a/raygun_client.gemspec b/raygun_client.gemspec index abc1234..def5678 100644 --- a/raygun_client.gemspec +++ b/raygun_client.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'raygun_client' - s.version = '0.2.0.0' + s.version = '0.2.0.1' s.summary = 'Client for the Raygun API using the Obsidian HTTP client' s.description = ' '
Package version is increased from 0.2.0.0 to 0.2.0.1 (Changed logging when posting to Raygun is complete)
diff --git a/lib/thrift_client/thrift.rb b/lib/thrift_client/thrift.rb index abc1234..def5678 100644 --- a/lib/thrift_client/thrift.rb +++ b/lib/thrift_client/thrift.rb @@ -1,5 +1,15 @@ module Thrift class BufferedTransport + def timeout=(timeout) + @transport.timeout = timeout + end + + def timeout + @transport.timeout + end + end + + class FramedTransport def timeout=(timeout) @transport.timeout = timeout end
Add support for specifying client-side timeouts when using FramedTransport
diff --git a/spec/ehrmagerd/translator_spec.rb b/spec/ehrmagerd/translator_spec.rb index abc1234..def5678 100644 --- a/spec/ehrmagerd/translator_spec.rb +++ b/spec/ehrmagerd/translator_spec.rb @@ -2,8 +2,8 @@ describe Ehrmagerd::Translator do it 'translates a string into ehrmagerd-speak' do - test_string1 = "Oh my god" - expect(Ehrmagerd::Translator.translate(test_string1)).to eq "EHRMAGERD" + test_string1 = "OhMyGod, Goosebumps, my favorite books!" + expect(Ehrmagerd::Translator.translate(test_string1)).to eq "ERMAHGERDGERSERBERMPSMAH FRAVRIT BERKS!" test_string2 = "Dogecoins are dumb" expect(Ehrmagerd::Translator.translate(test_string1)).to eq "DERGERCERNS ER DERMB"
Update spec to use the test post request's string
diff --git a/spec/integration/negative_spec.rb b/spec/integration/negative_spec.rb index abc1234..def5678 100644 --- a/spec/integration/negative_spec.rb +++ b/spec/integration/negative_spec.rb @@ -19,6 +19,28 @@ expect(subject.to_tex).to eq('-\left(1 + 2 + 3\right)') end end + + describe 'when it is the result of an expression' do + let(:x) { Danica::Wrapper::Variable.new(:x) } + let(:y) { Danica::Wrapper::Variable.new(:y) } + let(:z) { Danica::Wrapper::Variable.new(:z) } + let(:negative_parcel) { y + z } + subject do + x - (y + z) + end + + it 'wraps parcel into a group' do + expect(subject.to_gnu).to eq('x -(y + z)') + end + + context 'when the negative parcel is an expression' do + let(:negative_parcel) { Danica.build(:y, :z) { x + z } } + + it 'wraps parcel into a group' do + expect(subject.to_gnu).to eq('x -(y + z)') + end + end + end end end
Add more specs over negativity
diff --git a/test/fakeweb_helper.rb b/test/fakeweb_helper.rb index abc1234..def5678 100644 --- a/test/fakeweb_helper.rb +++ b/test/fakeweb_helper.rb @@ -1,6 +1,6 @@ require 'fakeweb' -FakeWeb.allow_net_connect = false +FakeWeb.allow_net_connect = %r[^https?://codeclimate.com/] def fake(routes) routes.map { |k, v|
Allow FakeWeb to connection to CodeClimate.
diff --git a/lib/diesel/testing/application.rb b/lib/diesel/testing/application.rb index abc1234..def5678 100644 --- a/lib/diesel/testing/application.rb +++ b/lib/diesel/testing/application.rb @@ -7,11 +7,19 @@ class Application < Rails::Application config.encoding = "utf-8" config.action_mailer.default_url_options = { :host => 'localhost' } - config.paths.config.database = "#{APP_ROOT}/config/database.yml" - config.paths.config.routes << "#{APP_ROOT}/config/routes.rb" - config.paths.app.controllers << "#{APP_ROOT}/app/controllers" - config.paths.app.views << "#{APP_ROOT}/app/views" - config.paths.log = "tmp/log" + if Rails::VERSION::MAJOR >= 3 && Rails::VERSION::MINOR >= 1 + config.paths['config/database'] = "#{APP_ROOT}/config/database.yml" + config.paths['config/routes'] << "#{APP_ROOT}/config/routes.rb" + config.paths['app/controllers'] << "#{APP_ROOT}/app/controllers" + config.paths['app/views'] << "#{APP_ROOT}/app/views" + config.paths['log'] = "tmp/log/development.log" + else + config.paths.config.database = "#{APP_ROOT}/config/database.yml" + config.paths.config.routes << "#{APP_ROOT}/config/routes.rb" + config.paths.app.controllers << "#{APP_ROOT}/app/controllers" + config.paths.app.views << "#{APP_ROOT}/app/views" + config.paths.log = "tmp/log" + end config.cache_classes = true config.whiny_nils = true config.consider_all_requests_local = true
Fix deprecation warning introduced in Rails 3.1.x Somehow, the path manipulation on 3.1.x is not working on 3.0.x either. You've been warned.
diff --git a/lib/dm-salesforce/soap_wrapper.rb b/lib/dm-salesforce/soap_wrapper.rb index abc1234..def5678 100644 --- a/lib/dm-salesforce/soap_wrapper.rb +++ b/lib/dm-salesforce/soap_wrapper.rb @@ -2,6 +2,8 @@ module DataMapperSalesforce class SoapWrapper + class ClassesFailedToGenerate < StandardError; end + def initialize(module_name, driver_name, wsdl_path, api_dir) @module_name, @driver_name, @wsdl_path, @api_dir = module_name, driver_name, File.expand_path(wsdl_path), File.expand_path(api_dir) generate_soap_classes @@ -24,7 +26,9 @@ unless Dir["#{wsdl_api_dir}/#{module_name}*.rb"].size == 3 Dir.chdir(wsdl_api_dir) do - puts system(`which wsdl2ruby.rb`.chomp, "--wsdl", wsdl_path, "--module_path", module_name, "--classdef", module_name, "--type", "client") + unless system("wsdl2ruby.rb", "--wsdl", wsdl_path, "--module_path", module_name, "--classdef", module_name, "--type", "client") + raise ClassesFailedToGenerate, "Could not generate the ruby classes from the WSDL" + end FileUtils.rm Dir["*Client.rb"] end end
Check whether the classes actually do get generated
diff --git a/lib/pah/partials/_rack_timeout.rb b/lib/pah/partials/_rack_timeout.rb index abc1234..def5678 100644 --- a/lib/pah/partials/_rack_timeout.rb +++ b/lib/pah/partials/_rack_timeout.rb @@ -1,4 +1,15 @@+rack_timeout = <<RACK_TIMEOUT + +use Rack::Timeout +RACK_TIMEOUT + +in_root do + inject_into_file 'config.ru', rack_timeout, {after: "require ::File.expand_path('../config/environment', __FILE__)", verbose: false} +end + +git add: 'config.ru' + copy_static_file 'config/initializers/rack_timeout.rb' +git add: 'config/initializers/rack_timeout.rb' -git add: 'config/initializers/rack_timeout.rb' git_commit 'Add Rack::Timeout configuration.'
Add on , to configure rack-timeout into application middleware.
diff --git a/spec/support/postgres_matchers.rb b/spec/support/postgres_matchers.rb index abc1234..def5678 100644 --- a/spec/support/postgres_matchers.rb +++ b/spec/support/postgres_matchers.rb @@ -1,39 +1,68 @@ require 'rspec/expectations' # NOTE: This matcher does not work for multiple NOTIFY statements on the same channel -RSpec::Matchers.define :notify do |channel,payload| +# RSpec::Matchers.define :notify do |channel,payload,&match_block| +module NotifyMatcher - supports_block_expectations - def diffable? - @notified == true + def notify(*args, &block) + Notify.new(*args, &block) end - match do |code| - pg = PGconn.open(:dbname => 'clicker_test') - pg.exec "LISTEN #{channel}" - @notified = false + class Notify - code.call + def initialize(channel, payload=nil, &payload_block) + @channel = channel + @payload = payload + @payload_block = payload_block if block_given? + end - wait = Proc.new do - pg.wait_for_notify(0.5) do |actual_channel, pid, actual_payload| - return wait if channel != actual_channel + def supports_block_expectations? + true + end - @notified = true - @actual = actual_payload - expect(actual_payload).to eq payload + def diffable? + @notified == true + end + + def matches?(code) + pg = PGconn.open(:dbname => 'clicker_test') + pg.exec "LISTEN #{@channel}" + @notified = false + + code.call + + payload_matches = nil + + wait = Proc.new do + pg.wait_for_notify(0.5) do |actual_channel, pid, actual_payload| + return wait if @channel != actual_channel + + @notified = true + @actual = actual_payload + + payload_matches = actual_payload == @payload if @payload + @payload_block.call(actual_payload) if @payload_block + end + end + + wait.call + if @payload + @notified == true && payload_matches == true + else + @notified == true end end - wait.call - expect(@notified).to eq true - end - - failure_message do - if @notified == false - "Expected a NOTIFY on channel `#{channel}` (received nothing on that channel instead)" - else - "Expected a NOTIFY on channel `#{channel}`\n\tExpected payload: #{payload.inspect}\n\tGot payload: #{@actual.inspect}" + def failure_message + if @notified == false + "Expected a NOTIFY on channel `#{@channel}` (received nothing on that channel instead)" + else + "Expected a NOTIFY on channel `#{@channel}`\n\tExpected payload: #{@payload.inspect}\n\tGot payload: #{@actual.inspect}" + end end end end + +RSpec.configure do |config| + config.include(NotifyMatcher) +end
Update postgres matcher to accept blocks
diff --git a/lib/modulr/global_export_collector.rb b/lib/modulr/global_export_collector.rb index abc1234..def5678 100644 --- a/lib/modulr/global_export_collector.rb +++ b/lib/modulr/global_export_collector.rb @@ -7,11 +7,26 @@ end def to_js(buffer = '') - buffer << "var #{@global} = (function() {\n" + buffer << "#{define_global} = (function() {\n" buffer << File.read(PATH_TO_MODULR_SYNC_JS) buffer << transport buffer << "\n return require('#{main.id}');\n" buffer << "})();\n" end + + def define_global + if @global.include?('.') + props = @global.split('.') + str = props.shift + results = "var #{str};" + props.each do |prop| + results << "\n#{str} = #{str} || {};" + str << ".#{prop}" + end + "#{results}\n#{str}" + else + "var #{@global}" + end + end end end
Allow the global export method to handle nested namespaces.
diff --git a/lib/volt/page/path_string_renderer.rb b/lib/volt/page/path_string_renderer.rb index abc1234..def5678 100644 --- a/lib/volt/page/path_string_renderer.rb +++ b/lib/volt/page/path_string_renderer.rb @@ -6,6 +6,7 @@ require 'volt/page/string_template_renderer' module Volt + class ViewLookupException < Exception ; end class PathStringRenderer attr_reader :html def initialize(path, attrs=nil, page=nil, render_from_path=nil) @@ -19,9 +20,14 @@ @view_lookup = Volt::ViewLookupForPath.new(page, render_from_path) full_path, controller_path = @view_lookup.path_for_template(path, nil) + if full_path == nil + raise ViewLookupException, "Unable to find view at `#{path}`" + end + controller_class, action = ControllerHandler.get_controller_and_action(controller_path) - controller = controller_class.new(SubContext.new(attrs, nil, true)) + controller = controller_class.new#(SubContext.new(attrs, nil, true)) + controller.model = SubContext.new(attrs, nil, true) renderer = StringTemplateRenderer.new(page, controller, full_path)
Make PathStringRenderer use the attrs hash as the model, so you can access properties as models in the view.
diff --git a/lib/yahoo_gemini_client/collection.rb b/lib/yahoo_gemini_client/collection.rb index abc1234..def5678 100644 --- a/lib/yahoo_gemini_client/collection.rb +++ b/lib/yahoo_gemini_client/collection.rb @@ -25,7 +25,7 @@ JSON.parse(response.body).with_indifferent_access[:response] else # TODO testme - raise "Reponse Unsuccessful: #{response.body}" + raise "GET Request Unsuccessful. Response: #{response.body}" end end
Make error message more accurate and descriptive.
diff --git a/test/locotimezone_errors_test.rb b/test/locotimezone_errors_test.rb index abc1234..def5678 100644 --- a/test/locotimezone_errors_test.rb +++ b/test/locotimezone_errors_test.rb @@ -0,0 +1,29 @@+require 'test_helper' + +class LocotimezoneErrorsTest < Minitest::Test + + describe 'testing error handling' do + it 'must be empty if bad request' do + result = Locotimezone.locotime address: '' + assert true, result[:geo].empty? + assert true, result[:timezone].empty? + end + + it 'must be empty if no location is found' do + result = Locotimezone.locotime address: '%' + assert true, result[:geo].empty? + assert true, result[:timezone].empty? + end + + it 'raises argument error if no address is given' do + assert_raises(ArgumentError) { Locotimezone.locotime } + end + + it 'raises argument error if no location is given when timezone only' do + assert_raises ArgumentError do + Locotimezone.locotime timezone_only: true + end + end + + end +end
Include test coverage for the handling and raising exceptions.
diff --git a/lib/acme/client/resources/authorization.rb b/lib/acme/client/resources/authorization.rb index abc1234..def5678 100644 --- a/lib/acme/client/resources/authorization.rb +++ b/lib/acme/client/resources/authorization.rb @@ -25,7 +25,7 @@ end def assign_attributes(body) - @expires = Time.parse(body['expires']) if body.has_key? 'expires' + @expires = Time.iso8601(body['expires']) if body.has_key? 'expires' @domain = body['identifier']['value'] @status = body['status'] end
Use ISO8601 format for time parsing
diff --git a/test/unit/validation_info_test.rb b/test/unit/validation_info_test.rb index abc1234..def5678 100644 --- a/test/unit/validation_info_test.rb +++ b/test/unit/validation_info_test.rb @@ -5,10 +5,10 @@ should 'validate the presence of validation methodology description' do info = ValidationInfo.new info.valid? - assert info.errors.invalid?(:validation_methodology) + assert info.errors[:validation_methodology].any? info.validation_methodology = 'lalala' info.valid? - assert !info.errors.invalid?(:validation_methodology) + assert !info.errors[:validation_methodology].any? end should 'refer to and validate the presence of an organization' do
rails3: Fix ValidationInfoTest unit test. Change deprecated call for method invalid?(attr) in ActiveModel::Errors class by [:attr].any?
diff --git a/lib/database_cleaner/generic/truncation.rb b/lib/database_cleaner/generic/truncation.rb index abc1234..def5678 100644 --- a/lib/database_cleaner/generic/truncation.rb +++ b/lib/database_cleaner/generic/truncation.rb @@ -6,7 +6,7 @@ raise ArgumentError, "The only valid options are :only and :except. You specified #{opts.keys.join(',')}." end if opts.has_key?(:only) && opts.has_key?(:except) - raise ArgumentError, "You may only specify either :only or :either. Doing both doesn't really make sense does it?" + raise ArgumentError, "You may only specify either :only or :except. Doing both doesn't really make sense does it?" end @only = opts[:only]
Fix typo in Truncation options error message
diff --git a/NotificationObserverHelper.podspec b/NotificationObserverHelper.podspec index abc1234..def5678 100644 --- a/NotificationObserverHelper.podspec +++ b/NotificationObserverHelper.podspec @@ -9,4 +9,5 @@ s.license = { :type => 'MIT', :file => 'LICENSE'} s.authors = { 'RATNA PAUL SAKA' => 'pauljason89442@gmail.com' } s.source_files = 'NotificationObserverHelper/NotificationObserverHelper.swift' +s.swift_version = '4.2' end
Update swift version to 4.2 in podspec.
diff --git a/plugins/provisioners/salt/errors.rb b/plugins/provisioners/salt/errors.rb index abc1234..def5678 100644 --- a/plugins/provisioners/salt/errors.rb +++ b/plugins/provisioners/salt/errors.rb @@ -4,7 +4,7 @@ module Salt module Errors class SaltError < Vagrant::Errors::VagrantError - error_namespace("salt") + error_namespace("vagrant.provisioners.salt") end end end
Fix salt provisioner error namespace to be more consistent with other provisioners
diff --git a/plugins/system/check-raid-status.rb b/plugins/system/check-raid-status.rb index abc1234..def5678 100644 --- a/plugins/system/check-raid-status.rb +++ b/plugins/system/check-raid-status.rb @@ -0,0 +1,66 @@+#! /usr/bin/env ruby + +# Exit status codes +EXIT_OK = 0 +EXIT_WARNING = 1 +EXIT_CRIT = 2 +exit_code = EXIT_OK + + +RAID_INFO = "/Users/mjones/projects/elzar/org_cookbooks/monitor/data.test" + +def read_file(raid_info) + a = File.open(raid_info,"r") + data = a.read + a.close + return data +end + +raid_status= read_file(RAID_INFO) + +matt_test = raid_status.split(/(md[0-9]*)/) + +h = Hash.new +n = 0 +k = "" +v = "" + +matt_test.each do |data| + if n.even? and n != 0 + v = data + h.store(k,v) + elsif n.odd? + k = data + end + n = n + 1 +end + +h.each do |key, value| + raid_state = value.split()[1] + total_dev = value.match(/[0-9]*\/[0-9]*/).to_s[0] + working_dev = value.match(/[0-9]*\/[0-9]*/).to_s[2] + failed_dev = value.match(/\[[U,_]*\]/).to_s.count "_" + recovery_state = value.include? "recovery" + puts recovery_state.inspect + + line_out = "#{key} is #{raid_state} + #{total_dev} total devices + #{working_dev} working devices + #{failed_dev} failed devices" + # OPTIMIXE + # this should/can be written as a switch statement + if raid_state == "active" && working_dev >= total_dev && !recovery_state + puts line_out + elsif raid_state == "active" && working_dev < total_dev && recovery_state + puts line_out.concat " \n\t\t *RECOVERING*" + exit_code = EXIT_WARNING if exit_code <= EXIT_WARNING + elsif raid_state == "active" && working_dev < total_dev && !recovery_state + puts line_out.concat "\n\t\t *NOT RECOVERING*" + exit_code = EXIT_CRIT if exit_code <= EXIT_CRIT + elsif raid_state != "active" + puts line_out + exit_code = EXIT_CRIT if exit_code <= EXIT_CRIT + end + +end +exit(exit_code)
Add monitor to check for the status of a raid array This monitor will read '/proc/mdstat' and parse it for several values. [n/m] where n is the total number of devices and m is the number of working devics. [UUU_UU] where U means the specific component is up and _ means that it is down It will also check for a recovery status in the case of a failed component The alerting breaks down as follows [green]: n == m no recovery state [yellow] n > m recovery state [red] n > m no recovery state array is !active When defining active using mdstats, active implies that the device is up. It can be in one of several states such as sync, clean, etc
diff --git a/childprocess.gemspec b/childprocess.gemspec index abc1234..def5678 100644 --- a/childprocess.gemspec +++ b/childprocess.gemspec @@ -18,10 +18,10 @@ s.test_files = `git ls-files -- spec/*`.split("\n") s.require_paths = ["lib"] - s.add_development_dependency "rspec", [">= 2.0.0"] - s.add_development_dependency "yard", [">= 0"] - s.add_development_dependency "rake", ["~> 0.9.2"] - s.add_runtime_dependency "ffi", ["~> 1.0.6"] + s.add_development_dependency "rspec", ">= 2.0.0" + s.add_development_dependency "yard", ">= 0" + s.add_development_dependency "rake", "~> 0.9.2" + s.add_runtime_dependency "ffi", "~> 1.0.6" end
Remove arrays from dep specification
diff --git a/spec/features/projects/gfm_autocomplete_load_spec.rb b/spec/features/projects/gfm_autocomplete_load_spec.rb index abc1234..def5678 100644 --- a/spec/features/projects/gfm_autocomplete_load_spec.rb +++ b/spec/features/projects/gfm_autocomplete_load_spec.rb @@ -1,12 +1,10 @@ require 'spec_helper' describe 'GFM autocomplete loading', feature: true, js: true do - let(:user) { create(:user) } let(:project) { create(:project) } before do - project.team << [user, :master] - login_as user + login_as :admin visit namespace_project_path(project.namespace, project) end
Use admin user in tests
diff --git a/spec/unit/request/protocol/class_methods/get_spec.rb b/spec/unit/request/protocol/class_methods/get_spec.rb index abc1234..def5678 100644 --- a/spec/unit/request/protocol/class_methods/get_spec.rb +++ b/spec/unit/request/protocol/class_methods/get_spec.rb @@ -18,7 +18,14 @@ context 'with "ftp"' do let(:input) { 'ftp' } it 'should raise error' do - expect { subject }.to raise_error(KeyError, 'key not found: "ftp"') + # jruby has different message format + expectation = + begin + {}.fetch('ftp') + rescue KeyError => error + error + end + expect { subject }.to raise_error(KeyError, expectation.message) end end end
Fix specs to accept jruby exception message formats
diff --git a/ooxml_parser.gemspec b/ooxml_parser.gemspec index abc1234..def5678 100644 --- a/ooxml_parser.gemspec +++ b/ooxml_parser.gemspec @@ -10,7 +10,7 @@ s.description = 'Parse OOXML files (docx, xlsx, pptx)' s.email = ['shockwavenn@gmail.com', 'rzagudaev@gmail.com'] s.files = `git ls-files lib LICENSE.txt README.md`.split($RS) - s.add_runtime_dependency('nokogiri', '1.6.8') + s.add_runtime_dependency('nokogiri', '~> 1.6') s.add_runtime_dependency('rubyzip', '~> 1.1') s.add_runtime_dependency('ruby-filemagic') s.add_runtime_dependency('xml-simple', '~> 1.1')
Revert "Temporary install specific version of nokogiri"
diff --git a/spec/acceptance/onetemplate_spec.rb b/spec/acceptance/onetemplate_spec.rb index abc1234..def5678 100644 --- a/spec/acceptance/onetemplate_spec.rb +++ b/spec/acceptance/onetemplate_spec.rb @@ -1,17 +1,44 @@ require 'spec_helper_acceptance' describe 'onetemplate type' do + before :all do + pp = <<-EOS + class { 'one': + oned => true, + } + EOS + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) + end describe 'when creating a template' do it 'should idempotently run' do pp = <<-EOS - class { 'one': - oned => true, - } -> - onetemplate { 'new_template': - disks => 'foo', - nics => 'bar', - memory => 512, + onetemplate { 'test-vm': + # Capacity + cpu => 1, + memory => 128, + + # OS + os_kernel => '/vmlinuz', + os_initrd => '/initrd.img', + os_root => 'sda1', + os_kernel_cmd => 'ro xencons=tty console=tty1', + + # Features + acpi => true, + pae => true, + + # Disks + disks => [ 'Data', 'Experiments', ], + + # Network + nics => [ 'Blue', 'Red', ], + + # I/O Devices + graphics_type => 'vnc', + graphics_listen => '0.0.0.0', + graphics_port => 5, } EOS @@ -23,7 +50,7 @@ describe 'when destroying a template' do it 'should idempotently run' do pp =<<-EOS - onetemplate { 'new_template': + onetemplate { 'test-vm': ensure => absent, } EOS
Update acceptance tests for onetemplate
diff --git a/spec/features/idea_features_spec.rb b/spec/features/idea_features_spec.rb index abc1234..def5678 100644 --- a/spec/features/idea_features_spec.rb +++ b/spec/features/idea_features_spec.rb @@ -30,7 +30,10 @@ expect(page).to have_content(title) expect(page).to have_content(description) - expect(page).to have_content(tags) + expect(page).to have_content("tag1") + expect(page).to have_content("tag2") + expect(page).to have_content("tag3") + expect(page).to have_content("tag4") end end
Change Idea feeature spec expectaions Expect each tag string to appear individually. The tags are seen with a bunch of extra HTML cruft between them, making the tests fail each time. Explicitly expecting each tag individually allows the returned page to pass the spec.
diff --git a/app/presenters/search_presenter.rb b/app/presenters/search_presenter.rb index abc1234..def5678 100644 --- a/app/presenters/search_presenter.rb +++ b/app/presenters/search_presenter.rb @@ -21,7 +21,7 @@ end def format_date(timestamp) - return nil if timestamp.blank? + raise ArgumentError, "Timestamp is blank" if timestamp.blank? timestamp.to_datetime.rfc3339 end
Revert "Make date field in DocumentSearch optional" This reverts commit 230461613f1a51d4cb93d415e27001c4dd66c748. Date fields were made optional because of a problem in a publishing API republishing task which was not saving the dates correctly. This caused errors in finder-frontend because Atom feeds for finders rely on the `public_timestamp` field). The original publishing API issue has now been fixed so specialist publisher should no longer send blank date fields to the search API.
diff --git a/app/services/processor_resolver.rb b/app/services/processor_resolver.rb index abc1234..def5678 100644 --- a/app/services/processor_resolver.rb +++ b/app/services/processor_resolver.rb @@ -21,8 +21,8 @@ def available_names_for [ + feed.processor, feed.name, - feed.processor, FALLBACK_PROCESSOR ] end
Use explicit processor option as a default
diff --git a/les_09/modules/accessors.rb b/les_09/modules/accessors.rb index abc1234..def5678 100644 --- a/les_09/modules/accessors.rb +++ b/les_09/modules/accessors.rb @@ -0,0 +1,25 @@+module Accessors + def self.included(base) + base.extend ClassMethods + end + + module ClassMethods + def attr_accessor_with_history(*args) + args.each do |arg| + var_name = "@#{arg}".to_sym + + define_method(arg) { instance_variable_get(var_name) } + + define_method("#{arg}=".to_sym) do |value| + instance_variable_set(var_name, value) + + @var_history ||= {} + @var_history[var_name] ||= [] + @var_history[var_name] << value + end + + define_method("#{arg}_history") { @var_history[var_name] } + end + end + end +end
Add Accessors module with attr_accessor_with_history method
diff --git a/db/migrate/20101110121308_set_file_size_not_null_in_project_files.rb b/db/migrate/20101110121308_set_file_size_not_null_in_project_files.rb index abc1234..def5678 100644 --- a/db/migrate/20101110121308_set_file_size_not_null_in_project_files.rb +++ b/db/migrate/20101110121308_set_file_size_not_null_in_project_files.rb @@ -1,10 +1,7 @@ class SetFileSizeNotNullInProjectFiles < ActiveRecord::Migration def self.up #deletes all files with file_size NULL - ProjectFile.where("file_file_size IS NULL").each do |f| - f.destroy - end - + execute("DELETE FROM `project_files` WHERE `file_file_size` IS NULL") change_column_null(:project_files, :file_file_size, false) end
Fix migration which doesn't work unless you update your code one commit at a time. Nugi, don't write this type of code in migrations. Stick to SQL commands and simple migration tasks.
diff --git a/features/fixtures/rails_integrations/app/lib/tasks/resque_setup.rake b/features/fixtures/rails_integrations/app/lib/tasks/resque_setup.rake index abc1234..def5678 100644 --- a/features/fixtures/rails_integrations/app/lib/tasks/resque_setup.rake +++ b/features/fixtures/rails_integrations/app/lib/tasks/resque_setup.rake @@ -1,5 +1,8 @@ require 'resque/tasks' task 'resque:setup' => :environment do + # Add a default to run every queue, unless otherwise specified + ENV['QUEUE'] = '*' unless ENV.include?('QUEUE') + require './app/workers/resque_worker' end
Add a default Resque QUEUE to run
diff --git a/lib/rrj/tools/bin/config.rb b/lib/rrj/tools/bin/config.rb index abc1234..def5678 100644 --- a/lib/rrj/tools/bin/config.rb +++ b/lib/rrj/tools/bin/config.rb @@ -14,6 +14,7 @@ Config.load_and_set_settings(config_conf) end rescue LoadError => exception - p 'Don\'t use gem config' + p "Don't use gem config : #{exception}" +rescue => exception p exception end
Write exception when anther error to 'LoadError'
diff --git a/lib/sidekiq/logging/json.rb b/lib/sidekiq/logging/json.rb index abc1234..def5678 100644 --- a/lib/sidekiq/logging/json.rb +++ b/lib/sidekiq/logging/json.rb @@ -22,7 +22,7 @@ end def process_message(message) - result = message.match(/INFO: (done|start)(: ([0-9\.]+) sec)?$/) + result = message.match(/INFO: (done|start|fail)(: ([0-9\.]+) sec)?$/) return { message: message } unless result
Fix parsing for runtime, status when the status is reported failure.
diff --git a/lib/docs/scrapers/node.rb b/lib/docs/scrapers/node.rb index abc1234..def5678 100644 --- a/lib/docs/scrapers/node.rb +++ b/lib/docs/scrapers/node.rb @@ -23,12 +23,12 @@ HTML version do - self.release = '6.2.2' + self.release = '6.3.1' self.base_url = 'https://nodejs.org/api/' end version '4 LTS' do - self.release = '4.4.6' + self.release = '4.4.7' self.base_url = "https://nodejs.org/dist/v#{release}/docs/api/" end end
Update Node.js documentation (6.3.1, 4.4.7)
diff --git a/lib/doorkeeper/request.rb b/lib/doorkeeper/request.rb index abc1234..def5678 100644 --- a/lib/doorkeeper/request.rb +++ b/lib/doorkeeper/request.rb @@ -7,7 +7,7 @@ module Doorkeeper module Request - extend self + module_function def authorization_strategy(strategy) get_strategy strategy, %w(code token)
Use module_function instead of extending self
diff --git a/lib/em-socksify/errors.rb b/lib/em-socksify/errors.rb index abc1234..def5678 100644 --- a/lib/em-socksify/errors.rb +++ b/lib/em-socksify/errors.rb @@ -2,7 +2,7 @@ module Socksify class SOCKSError < Exception - def self.define (message) + def self.define(message) Class.new(self) do def initialize super(message)
Remove space between method call and parentheses. Avoid `warning: parentheses after method name is interpreted as an argument list, not a decomposed argument`
diff --git a/lib/github_merge/merge.rb b/lib/github_merge/merge.rb index abc1234..def5678 100644 --- a/lib/github_merge/merge.rb +++ b/lib/github_merge/merge.rb @@ -10,5 +10,17 @@ def local! config = YAML.load_file @file + repo_dir = clone_repos(config) + end + + def clone_repos(config) + repo_dir = "#{Dir.pwd}/out" + FileUtils.mkdir_p repo_dir + Dir.chdir repo_dir do + config["repositories"].each do |repo| + `git clone #{repo["url"]} #{repo["sub directory"]}` + end + end + repo_dir end end
Clone repos based on YAML config
diff --git a/lib/analytics_instrumentation/analytics_mapping.rb b/lib/analytics_instrumentation/analytics_mapping.rb index abc1234..def5678 100644 --- a/lib/analytics_instrumentation/analytics_mapping.rb +++ b/lib/analytics_instrumentation/analytics_mapping.rb @@ -22,7 +22,7 @@ replaceAllTokens(analysis, params, view_assigns) - analysis[:parameters] ||= {} + analysis["parameters"] ||= {} HashWithIndifferentAccess.new(analysis) end
Use string instead of symbol to look up parameters
diff --git a/lib/safer_dates/enforcers/attribute_typecasting.rb b/lib/safer_dates/enforcers/attribute_typecasting.rb index abc1234..def5678 100644 --- a/lib/safer_dates/enforcers/attribute_typecasting.rb +++ b/lib/safer_dates/enforcers/attribute_typecasting.rb @@ -6,7 +6,12 @@ def self.fallback_string_to_time(string) return nil if StringUtils.blank?(string) - raise InvalidDateTimeFormat.new(string) + + if string =~ DateParser::ISO_DATE + DateTime.new($1.to_i, $2.to_i, $3.to_i, 00, 00, 00) + else + raise InvalidDateTimeFormat.new(string) + end end class InvalidDateFormat < StandardError; end
Allow date only formats for datetime instantiation
diff --git a/modules/mongodb/lib/puppet/type/mongodb_replset.rb b/modules/mongodb/lib/puppet/type/mongodb_replset.rb index abc1234..def5678 100644 --- a/modules/mongodb/lib/puppet/type/mongodb_replset.rb +++ b/modules/mongodb/lib/puppet/type/mongodb_replset.rb @@ -9,6 +9,13 @@ newproperty(:members, :array_matching => :all) do desc 'Hostnames of members' + + validate do |value| + arbiter = @resources[:arbiter] + if !arbiter.nil? and value.include?(arbiter) + raise Puppet::Error, 'Members shouldnt contain arbiter' + end + end def insync?(is) is.sort == should.sort
Make sure members doesn't contain arbiter
diff --git a/spec/messages_spec.rb b/spec/messages_spec.rb index abc1234..def5678 100644 --- a/spec/messages_spec.rb +++ b/spec/messages_spec.rb @@ -4,6 +4,14 @@ describe '#inform_creation_of_social_media_links' do let(:message) { messagable.inform_creation_of_social_media_links } + + it 'outputs a message to stdout' do + expect(outputting_message).to output.to_stdout + end + end + + describe '#inform_creation_of_technical_skills' do + let(:message) { messagable.inform_creation_of_technical_skills } it 'outputs a message to stdout' do expect(outputting_message).to output.to_stdout
Bring code coverage back up
diff --git a/pages/brightcontent-pages.gemspec b/pages/brightcontent-pages.gemspec index abc1234..def5678 100644 --- a/pages/brightcontent-pages.gemspec +++ b/pages/brightcontent-pages.gemspec @@ -18,7 +18,7 @@ s.add_dependency "brightcontent-core", version s.add_dependency "brightcontent-attachments", version s.add_dependency "awesome_nested_set", ">= 3.0.0.rc.3" - s.add_dependency "jquery-ui-rails", ">= 2.3.0" + s.add_dependency "jquery-ui-rails", "~> 5.0.0" s.add_dependency "the_sortable_tree", "~> 2.3.0" s.add_development_dependency "sqlite3"
Update jquery-ui-rails dependency in gemspec
diff --git a/spec/resource_spec.rb b/spec/resource_spec.rb index abc1234..def5678 100644 --- a/spec/resource_spec.rb +++ b/spec/resource_spec.rb @@ -1,5 +1,5 @@-$LOAD_PATH.unshift File.dirname(__FILE__) -require 'spec_helper' +require_relative 'spec_helper' + require 'wright/resource' include Wright
Use require_relative in resource spec
diff --git a/patch.rb b/patch.rb index abc1234..def5678 100644 --- a/patch.rb +++ b/patch.rb @@ -15,4 +15,39 @@ def tag_name type end -end+end + +# Print JSON posted to Appium +# Requires from lib/selenium/webdriver/remote.rb +require 'selenium/webdriver/remote/capabilities' +require 'selenium/webdriver/remote/bridge' +require 'selenium/webdriver/remote/server_error' +require 'selenium/webdriver/remote/response' +require 'selenium/webdriver/remote/commands' +require 'selenium/webdriver/remote/http/common' +require 'selenium/webdriver/remote/http/default' + +module Selenium::WebDriver::Remote + class Bridge + # Code from lib/selenium/webdriver/remote/bridge.rb + def raw_execute(command, opts = {}, command_hash = nil) + verb, path = COMMANDS[command] || raise(ArgumentError, "unknown command: #{command.inspect}") + path = path.dup + + path[':session_id'] = @session_id if path.include?(":session_id") + + begin + opts.each { |key, value| path[key.inspect] = escaper.escape(value.to_s) } + rescue IndexError + raise ArgumentError, "#{opts.inspect} invalid for #{command.inspect}" + end + + puts verb + puts path + puts command_hash.to_json + + puts "-> #{verb.to_s.upcase} #{path}" if $DEBUG + http.call verb, path, command_hash + end # def + end # class +end # module
Print JSON sent to Appium
diff --git a/app/controllers/hook_controller.rb b/app/controllers/hook_controller.rb index abc1234..def5678 100644 --- a/app/controllers/hook_controller.rb +++ b/app/controllers/hook_controller.rb @@ -3,7 +3,7 @@ MAX_SIZE = 100 * 1024 def digest - status = :ok + status = :accepted json = {} if request.body.length > MAX_SIZE status = :bad_request @@ -18,7 +18,7 @@ if token begin if Cenit::Hook.digest(token, params[:slug], request.body.read, request.content_type) - json[:status] = :ok + json[:status] = :accepted else json[:error] = "Hook token is invalid" status = :unauthorized
Add | Responding hook requests with Accepted status code
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 @@ -1,13 +1,11 @@ class MainController < ApplicationController - before_filter :check_for_mobile + before_filter :check_for_mobile, :only => index def index if @user_agent == :tablet @voted = Vote.already_voted?(request.remote_ip) @image = Photo.new @current_image = Photo.last - else - end end @@ -38,8 +36,7 @@ end def check_for_mobile - # request.user_agent =~ /Mobile|webOS/ ? (request.variant = :tablet) : (request.variant = :desktop) - @user_agent =~ /Mobile|webOS/ ? (request.variant = :tablet) : (request.variant = :desktop) + request.user_agent =~ /Mobile|webOS/ ? (@user_agent = :tablet) : (@user_agent = :desktop) end end
Fix bug in check_for_mobile method that was preventing correct rendering
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -38,5 +38,6 @@ include_recipe "mysql" include_recipe "apache2" +include_recipe "apache2::mod_php5" include_recipe "composer" include_recipe "laravel::laravel"
Fix installation of PHP for Apache
diff --git a/convert_waze_data.rb b/convert_waze_data.rb index abc1234..def5678 100644 --- a/convert_waze_data.rb +++ b/convert_waze_data.rb @@ -0,0 +1,15 @@+require 'json' +require 'hashie' + +mercator = IO.read("waze/1396867493_mercator.txt") +hash = JSON.parse mercator +msg = Hashie::Mash.new hash +File.open("proj_input", "w") do |f| + msg.irregularities.each do |irr| + irr.line.each do |line| + f.puts line.y.to_s + ' ' + line.x.to_s + end + end +end + +`proj +proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +a=6378137 +b=6378137 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs -I -f ’%.9f’ proj_input > proj_output`
Add script to convert from Waze Mercator projection to WGS84 used by Open Street Map et.al.
diff --git a/app/controllers/conversations_controller.rb b/app/controllers/conversations_controller.rb index abc1234..def5678 100644 --- a/app/controllers/conversations_controller.rb +++ b/app/controllers/conversations_controller.rb @@ -2,9 +2,17 @@ before_action :get_mailbox before_action :get_conversation, except: [:index] + before_action :get_box, only: [:index] def index - @conversations = @mailbox.inbox.paginate(page: params[:page], per_page: 10) + if @box.eql? "inbox" + @conversations = @mailbox.inbox + elsif @box.eql? "sent" + @conversations = @mailbox.sentbox + else + @conversations = @mailbox.trash + end + @conversations = @conversations.paginate(page: params[:page], per_page: 10) end def show @@ -18,6 +26,13 @@ private + def get_box + if params[:box].blank? or !["inbox","sent","trash"].include?(params[:box]) + params[:box] = 'inbox' + end + @box = params[:box] + end + def get_mailbox @mailbox ||= current_user.mailbox end
Modify index action for sentbox and trash'
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -26,7 +26,9 @@ frontend/base-ie6.css frontend/base-ie7.css frontend/base-ie8.css - ) + ) + + config.assets.prefix = '/contacts-assets' # Generators config.generators do |g|
Change assets prefix to contacts-assets Matches changes made in puppet config
diff --git a/railties/helpers/application_controller.rb b/railties/helpers/application_controller.rb index abc1234..def5678 100644 --- a/railties/helpers/application_controller.rb +++ b/railties/helpers/application_controller.rb @@ -5,8 +5,7 @@ helper :all # include all helpers, all the time # See ActionController::RequestForgeryProtection for details - # Uncomment the :secret if you're not using the cookie session store - protect_from_forgery # :secret => '<%= app_secret %>' + protect_from_forgery # See ActionController::Base for details # Uncomment this to filter the contents of submitted sensitive data parameters
Update the generated controller to not include the deprecated :secret option to protect_from_forgery
diff --git a/pages/db/migrate/20140105190324_add_custom_slug_to_refinery_pages.rb b/pages/db/migrate/20140105190324_add_custom_slug_to_refinery_pages.rb index abc1234..def5678 100644 --- a/pages/db/migrate/20140105190324_add_custom_slug_to_refinery_pages.rb +++ b/pages/db/migrate/20140105190324_add_custom_slug_to_refinery_pages.rb @@ -1,20 +1,15 @@ class AddCustomSlugToRefineryPages < ActiveRecord::Migration[4.2] def up - if page_column_names.exclude?('custom_slug') - add_column :refinery_pages, :custom_slug, :string - end + add_column :refinery_pages, :custom_slug, :string unless custom_slug_exists? end def down - if page_column_names.include?('custom_slug') - remove_column :refinery_pages, :custom_slug - end + remove_column :refinery_pages, :custom_slug if custom_slug_exists? end private - def page_column_names - return [] unless defined?(::Refinery::Page) - Refinery::Page.column_names.map(&:to_s) + def custom_slug_exists? + column_exists?(:refinery_pages, :custom_slug) end end
Fix checking :custom_slug existence to use column_exists?
diff --git a/lib/docs/scrapers/react_native.rb b/lib/docs/scrapers/react_native.rb index abc1234..def5678 100644 --- a/lib/docs/scrapers/react_native.rb +++ b/lib/docs/scrapers/react_native.rb @@ -3,7 +3,7 @@ self.name = 'React Native' self.slug = 'react_native' self.type = 'react' - self.release = '0.21' + self.release = '0.22' self.base_url = 'https://facebook.github.io/react-native/docs/' self.root_path = 'getting-started.html' self.links = {
Update React Native documentation (0.22)
diff --git a/build-scripts/emscripten/config.rb b/build-scripts/emscripten/config.rb index abc1234..def5678 100644 --- a/build-scripts/emscripten/config.rb +++ b/build-scripts/emscripten/config.rb @@ -1,23 +1,23 @@ #!/usr/bin/false NAME = "emscripten" -VERSION = "1.37.27" +VERSION = "1.38.11" RELEASE = "1" FILES = [ [ "https://github.com/kripken/emscripten/archive/#{VERSION}.tar.gz", - "a345032415362a0a66e4886ecd751f6394237ff764b1f1c40dde25410792991c", + "5521e8eefbee284b6a72797c7f63ce606d37647930cd8f4d48d45d02c4e1da95", "emscripten-#{VERSION}.tgz" ], [ "https://github.com/kripken/emscripten-fastcomp/archive/#{VERSION}.tar.gz", - "409055d32dca9788b7ef15fbe81bd1df82a0ab91337f15be3254c11d5743043a", + "55ddc1b1f045a36ac34ab60bb0e1a0370a40249eba8d41cd4e427be95beead18", "emscripten_fastcomp-#{VERSION}.tgz" ], [ "https://github.com/kripken/emscripten-fastcomp-clang/archive/#{VERSION}.tar.gz", - "bd532912eab4e52bd83f603c7fb4d2fe770b99ede766e2b9a82f5f3f68f4a168", + "1d2ac9f8dab54f0f17e4a77c3cd4653fe9f890831ef6e405320850fd7351f795", "emscripten_fastcomp_clang-#{VERSION}.tgz" ] ]
Update build scripts for Emscripten 1.38.11
diff --git a/lib/finite_machine/async_proxy.rb b/lib/finite_machine/async_proxy.rb index abc1234..def5678 100644 --- a/lib/finite_machine/async_proxy.rb +++ b/lib/finite_machine/async_proxy.rb @@ -3,8 +3,10 @@ module FiniteMachine # An asynchronous messages proxy class AsyncProxy + include Threadable + include ThreadContext - attr_reader :context + attr_threadsafe :context # Initialize an AsynxProxy # @@ -13,15 +15,14 @@ # # @api private def initialize(context) - @context = context + self.context = context end # Delegate asynchronous event to event queue # # @api private def method_missing(method_name, *args, &block) - @event_queue = FiniteMachine.event_queue - @event_queue << AsyncCall.build(@context, Callable.new(method_name), *args, &block) + event_queue << AsyncCall.build(context, Callable.new(method_name), *args, &block) end end # AsyncProxy end # FiniteMachine
Change async proxy to use thread context and threadsafe attribute.
diff --git a/lib/lambra/library/code_loader.rb b/lib/lambra/library/code_loader.rb index abc1234..def5678 100644 --- a/lib/lambra/library/code_loader.rb +++ b/lib/lambra/library/code_loader.rb @@ -29,12 +29,9 @@ script = Rubinius::CompiledMethod::Script.new(cm, file, true) be = Rubinius::BlockEnvironment.new - script.eval_binding = binding - # script.eval_source = string cm.scope.script = script be.under_context(binding.variables, cm) - be.from_eval! be.call_on_instance(instance) end
Make it work with rbx-head
diff --git a/lib/modalfields/standardfields.rb b/lib/modalfields/standardfields.rb index abc1234..def5678 100644 --- a/lib/modalfields/standardfields.rb +++ b/lib/modalfields/standardfields.rb @@ -10,6 +10,7 @@ date binary :limit=>nil boolean + timestamp end ModalFields.alias :timestamp=>:datetime
Add timestamp to the predefined field types
diff --git a/lib/tasks/panopticon.rake b/lib/tasks/panopticon.rake index abc1234..def5678 100644 --- a/lib/tasks/panopticon.rake +++ b/lib/tasks/panopticon.rake @@ -14,7 +14,8 @@ title: "Business finance and support finder", description: "Find business finance, support, grants and loans backed by the government.", need_id: "B1017", - prefixes: [APP_SLUG], + paths: [], + prefixes: ["/#{APP_SLUG}"], state: "live", indexable_content: "Business finance and support finder") registerer.register(record)
Update registered routes to match new scheme. They should now be full paths, not just slugs.
diff --git a/config/initializers/rack_attack.rb b/config/initializers/rack_attack.rb index abc1234..def5678 100644 --- a/config/initializers/rack_attack.rb +++ b/config/initializers/rack_attack.rb @@ -2,7 +2,7 @@ Rack::Attack.throttled_response = ->(env) { [429, {}, [ActionView::Base.new.render(file: 'public/429.html')]] } ActiveSupport::Notifications.subscribe('rack.attack') do |name, start, finish, request_id, req| - Airbrake.notify Exception.new "#{req.ip} has been rate limited for url #{req.url}" + Airbrake.notify Exception.new(message: "#{req.ip} has been rate limited for url #{req.url}", data: req.env['rack.attack.throttle_data']) end @config = YAML.load_file("#{Rails.root}/config/rack_attack.yml").with_indifferent_access
Add throttling data for airbrake exception
diff --git a/lib/tumblargh/node/tag.rb b/lib/tumblargh/node/tag.rb index abc1234..def5678 100644 --- a/lib/tumblargh/node/tag.rb +++ b/lib/tumblargh/node/tag.rb @@ -8,6 +8,10 @@ n = name.split(':') if n.size == 2 @type = "#{n.first.camelize.to_sym}Tag" + + raise "There's an unclosed block somewhere..." if @type == 'BlockTag' + + @type else super end
Raise if theres an unclosed block found. Will improve this with debugging in the future.
diff --git a/config/initializers/xmstdn/secureheaders.rb b/config/initializers/xmstdn/secureheaders.rb index abc1234..def5678 100644 --- a/config/initializers/xmstdn/secureheaders.rb +++ b/config/initializers/xmstdn/secureheaders.rb @@ -5,7 +5,7 @@ secure: true, httponly: true, samesite: { - strict: true + lax: true } } config.referrer_policy = 'origin-when-cross-origin'
:pill: Fix a bug that user cannot remote follow
diff --git a/spec/support/capybara_helpers.rb b/spec/support/capybara_helpers.rb index abc1234..def5678 100644 --- a/spec/support/capybara_helpers.rb +++ b/spec/support/capybara_helpers.rb @@ -38,7 +38,7 @@ # Simulate a browser restart by clearing the session cookie. def clear_browser_session - page.driver.remove_cookie('_gitlab_session') + page.driver.delete_cookie('_gitlab_session') end end
Rename remove_cookie -> delete_cookie in Capybara helper for Selenium driver
diff --git a/test/integration/install_certificate/controls/install_certificate.rb b/test/integration/install_certificate/controls/install_certificate.rb index abc1234..def5678 100644 --- a/test/integration/install_certificate/controls/install_certificate.rb +++ b/test/integration/install_certificate/controls/install_certificate.rb @@ -1,8 +1,10 @@-# TODO: verify with x509_certificate -describe file('/etc/apache2/ssl/dnsimple.xyz.crt') do - its('content') { should match /-----BEGIN CERTIFICATE-----/ } +describe x509_certificate('/etc/apache2/ssl/dnsimple.xyz.crt') do + its('key_length') { should be 2048 } + its('subject.CN') { should eq 'www.dnsimple.xyz' } end -# TODO: verify with key_rsa -describe file('/etc/apache2/ssl/dnsimple.xyz.key') do - its('content') { should match /-----BEGIN RSA PRIVATE KEY-----/ } + +describe key_rsa('/etc/apache2/ssl/dnsimple.xyz.key') do + it { should be_private } + it { should be_public } + its('key_length') { should be 2048 } end
Test cert and key with x509_certificate and key_rsa, respectively
diff --git a/tests_isolated/acceptance/admin/calculations_test.rb b/tests_isolated/acceptance/admin/calculations_test.rb index abc1234..def5678 100644 --- a/tests_isolated/acceptance/admin/calculations_test.rb +++ b/tests_isolated/acceptance/admin/calculations_test.rb @@ -3,7 +3,7 @@ require_relative "../acceptance_test" # :stopdoc: -class CategoriesTest < AcceptanceTest +class Admin::CategoriesTest < AcceptanceTest test "edit" do FactoryBot.create(:discipline)
Fix name clash in test
diff --git a/rakelib/console.rake b/rakelib/console.rake index abc1234..def5678 100644 --- a/rakelib/console.rake +++ b/rakelib/console.rake @@ -1,3 +1,11 @@+# This requires Cycript to be installed on the device: +# +# $ apt-get install cycript +# +# This task then loads the helpers, defined in the file with the same path as +# this file except for the extension ‘.cy’, and then opens a ssh connection and +# attaches cycript to the AppleTV process. + desc 'Open the Cycript console' task :console do tmp = "/tmp/Cycript-AppleTV-Helpers.cy"
Add some doc about Cycript.
diff --git a/config/environments/development.rb b/config/environments/development.rb index abc1234..def5678 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -16,5 +16,11 @@ # Don't care if the mailer can't send config.action_mailer.raise_delivery_errors = false -# Uncomment the following line if you're getting "A copy of XX has been removed from the module tree but is still active!" as it may help you: -# config.after_initialize { Dependencies.load_once_paths = Dependencies.load_once_paths.select { |path| (path =~ /app/).nil? } }+# Uncomment the following lines if you're getting +# "A copy of XX has been removed from the module tree but is still active!" +# or you want to develop a plugin and don't want to restart every time a change is made: +#config.after_initialize do +# ::ActiveSupport::Dependencies.load_once_paths = ::ActiveSupport::Dependencies.load_once_paths.select do |path| +# (path =~ /app/).nil? +# end +#end
Update the code that reloads plugin app directories to more robust code
diff --git a/config/local.rb b/config/local.rb index abc1234..def5678 100644 --- a/config/local.rb +++ b/config/local.rb @@ -1,11 +1,7 @@ I18n.available_locales = Noosfero.available_locales -Noosfero.default_locale = 'pt_BR' +Noosfero.default_locale = 'es_ES' FastGettext.locale = Noosfero.default_locale FastGettext.default_locale = Noosfero.default_locale I18n.locale = Noosfero.default_locale I18n.default_locale = Noosfero.default_locale -if Rails.env.development? - ActionMailer::Base.delivery_method = :file -end -
Change default language to es_ES
diff --git a/config/initializers/live_events.rb b/config/initializers/live_events.rb index abc1234..def5678 100644 --- a/config/initializers/live_events.rb +++ b/config/initializers/live_events.rb @@ -19,7 +19,7 @@ LiveEvents.logger = Rails.logger LiveEvents.cache = Rails.cache LiveEvents.statsd = InstStatsd::Statsd - LiveEvents.max_queue_size = -> { Setting.get('live_events_max_queue_size', 1000).to_i } + LiveEvents.max_queue_size = -> { Setting.get('live_events_max_queue_size', 5000).to_i } LiveEvents.settings = -> { plugin_settings = Canvas::Plugin.find(:live_events)&.settings if plugin_settings && Canvas::Plugin.value_to_boolean(plugin_settings['use_consul']) @@ -29,4 +29,3 @@ end } end -
Increase live events max queue size closes PLAT-4551 Test Plan: - n/a Change-Id: I6a82092fcddf5f382443193f0e5d73eb8913c6d4 Reviewed-on: https://gerrit.instructure.com/198003 Tested-by: Jenkins Reviewed-by: Weston Dransfield <e9203059795dc94e28a8831c65eb7869e818825e@instructure.com> QA-Review: Weston Dransfield <e9203059795dc94e28a8831c65eb7869e818825e@instructure.com> Product-Review: Marc Phillips <b810f855174e0bc032432310b0808df2cf714fbc@instructure.com>
diff --git a/test/integration/middleware_test.rb b/test/integration/middleware_test.rb index abc1234..def5678 100644 --- a/test/integration/middleware_test.rb +++ b/test/integration/middleware_test.rb @@ -1,6 +1,6 @@ require 'test_helper' -class FacebookCanvas::MiddlewareTest < ActionDispatch::IntegrationTest +class FacebookCanvas::IntegrationMiddlewareTest < ActionDispatch::IntegrationTest test 'convert post to get request' do post '/foo/index' assert_response :success
Rename integration test class to avoid future name clashes
diff --git a/test/test_ocf_physical_container.rb b/test/test_ocf_physical_container.rb index abc1234..def5678 100644 --- a/test/test_ocf_physical_container.rb +++ b/test/test_ocf_physical_container.rb @@ -0,0 +1,46 @@+# coding: utf-8 +require_relative 'helper' +require 'epub/ocf/physical_container' + +class TestOCFPhysicalContainer < Test::Unit::TestCase + def setup + @path = 'OPS/nav.xhtml' + @content = File.read(File.join('test/fixtures/book', @path)) + end + + class TestZipruby < self + def setup + super + @container_path = 'test/fixtures/book.epub' + @container = EPUB::OCF::PhysicalContainer::Zipruby.new(@container_path) + end + + def test_class_method_open + EPUB::OCF::PhysicalContainer::Zipruby.open @container_path do |container| + assert_instance_of EPUB::OCF::PhysicalContainer::Zipruby, container + assert_equal @content, container.read(@path).force_encoding('UTF-8') + assert_equal File.read('test/fixtures/book/OPS/日本語.xhtml'), container.read('OPS/日本語.xhtml').force_encoding('UTF-8') + end + end + + def test_class_method_read + assert_equal @content, EPUB::OCF::PhysicalContainer::Zipruby.read(@container_path, @path).force_encoding('UTF-8') + end + + def test_open_yields_over_container_with_opened_archive + @container.open do |container| + assert_instance_of EPUB::OCF::PhysicalContainer::Zipruby, container + end + end + + def test_container_in_open_block_can_readable + @container.open do |container| + assert_equal @content, container.read(@path).force_encoding('UTF-8') + end + end + + def test_read + assert_equal @content, @container.read(@path).force_encoding('UTF-8') + end + end +end
Add test cases for OCF::PhysicalContainer::Zipruby
diff --git a/badcards.gemspec b/badcards.gemspec index abc1234..def5678 100644 --- a/badcards.gemspec +++ b/badcards.gemspec @@ -19,7 +19,7 @@ spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 1.5" - spec.add_development_dependency "rake" - spec.add_development_dependency "rspec" - spec.add_development_dependency "coveralls" + spec.add_development_dependency "rake", "~> 10.1.0", ">= 10.1.0" + spec.add_development_dependency "rspec", "~> 2.14.1", ">= 2.14.1" + spec.add_development_dependency "coveralls", "~> 0.7.0", ">= 0.7.0" end
Remove open-ended, pessimistic gemspec dependency
diff --git a/spec/features/invalid_oauth_spec.rb b/spec/features/invalid_oauth_spec.rb index abc1234..def5678 100644 --- a/spec/features/invalid_oauth_spec.rb +++ b/spec/features/invalid_oauth_spec.rb @@ -11,6 +11,6 @@ error_message = I18n.t('error.oauth_invalid') visit '/courses' expect(page).to have_content error_message - expect(page).to have_content 'Login' + expect(page).to have_content 'Log in' end end
Update auth spec to look for 'Log in' instead of 'Login'
diff --git a/spec/javascripts/fixtures/emojis.rb b/spec/javascripts/fixtures/emojis.rb index abc1234..def5678 100644 --- a/spec/javascripts/fixtures/emojis.rb +++ b/spec/javascripts/fixtures/emojis.rb @@ -8,9 +8,11 @@ end it 'emojis/emojis.json' do |example| - # Copying the emojis.json from the public folder - fixture_file_name = File.expand_path('emojis/emojis.json', JavaScriptFixturesHelpers::FIXTURE_PATH) - FileUtils.mkdir_p(File.dirname(fixture_file_name)) - FileUtils.cp(Rails.root.join('public/-/emojis/1/emojis.json'), fixture_file_name) + JavaScriptFixturesHelpers::FIXTURE_PATHS.each do |fixture_path| + # Copying the emojis.json from the public folder + fixture_file_name = File.expand_path('emojis/emojis.json', fixture_path) + FileUtils.mkdir_p(File.dirname(fixture_file_name)) + FileUtils.cp(Rails.root.join('public/-/emojis/1/emojis.json'), fixture_file_name) + end end end
Fix for mismatch in EE on FIXTURE_PATHS to FIXTURE_PATH Signed-off-by: Rémy Coutable <4ea0184b9df19e0786dd00b28e6daa4d26baeb3e@rymai.me>
diff --git a/app/lenses/date_range_lens.rb b/app/lenses/date_range_lens.rb index abc1234..def5678 100644 --- a/app/lenses/date_range_lens.rb +++ b/app/lenses/date_range_lens.rb @@ -7,9 +7,9 @@ attr_accessor :pairs, :range_builder - def initialize(*args) - super(*args) + def initialize(options:, **args) self.range_builder = DateRangeBuilder.new(max_range: [options[:min_date], Time.zone.today]) + super end def range
Fix meal report lens bug
diff --git a/app/models/anonymous_block.rb b/app/models/anonymous_block.rb index abc1234..def5678 100644 --- a/app/models/anonymous_block.rb +++ b/app/models/anonymous_block.rb @@ -3,7 +3,7 @@ require "digest" class AnonymousBlock < ApplicationRecord - belongs_to :user + belongs_to :user, optional: true belongs_to :question, optional: true def self.get_identifier(ip)
Allow anonymous blocks without an owner
diff --git a/app/services/person_search.rb b/app/services/person_search.rb index abc1234..def5678 100644 --- a/app/services/person_search.rb +++ b/app/services/person_search.rb @@ -10,7 +10,12 @@ name_matches, query_matches, fuzzy_matches = perform_searches exact_matches = name_matches.select { |p| p.name == @query } - (exact_matches + name_matches + query_matches + fuzzy_matches).uniq[0..@max - 1] + + exact_matches. + push(*name_matches). + push(*query_matches). + push(*fuzzy_matches). + uniq[0..@max - 1] end private
Join search results with push() instead of +()
diff --git a/lib/authcop/railtie.rb b/lib/authcop/railtie.rb index abc1234..def5678 100644 --- a/lib/authcop/railtie.rb +++ b/lib/authcop/railtie.rb @@ -37,6 +37,6 @@ end console do - AuthCop.unsafe! + AuthCop.unsafe! unless ENV["AUTHCOP"] end -end+end
Allow console to start in safe mode when AUTHCOP environment variable is present