diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/exercism/use_cases/updates_user_exercise.rb b/lib/exercism/use_cases/updates_user_exercise.rb index abc1234..def5678 100644 --- a/lib/exercism/use_cases/updates_user_exercise.rb +++ b/lib/exercism/use_cases/updates_user_exercise.rb @@ -13,6 +13,8 @@ exercise.user_id = user_id exercise.state = latest.state + exercise.language = latest.language + exercise.slug = latest.slug exercise.created_at ||= earliest_submission_at exercise.updated_at = most_recent_change_at exercise.completed_at = exercise.updated_at if done?
Save language/slug on user exercise
diff --git a/app/helpers/c3_helper.rb b/app/helpers/c3_helper.rb index abc1234..def5678 100644 --- a/app/helpers/c3_helper.rb +++ b/app/helpers/c3_helper.rb @@ -3,13 +3,13 @@ chart_id = opts[:id] || ('chart' + rand(10**8).to_s) content_tag(:div, '', :id => chart_id) + - javascript_tag(<<-EOJ) -$.get("#{url}").success(function(data) { - data.miq.zoomed = "#{opts[:zoomed]}"; - var chart = c3.generate(chartData(data.miqChart, data, { bindto: "##{chart_id}" })); - ManageIQ.charts.c3["#{chart_id}"] = chart; - miqSparkleOff(); -}); + javascript_tag(<<~EOJ) + $.get("#{url}").success(function(data) { + data.miq.zoomed = "#{opts[:zoomed]}"; + var chart = c3.generate(chartData(data.miqChart, data, { bindto: "##{chart_id}" })); + ManageIQ.charts.c3["#{chart_id}"] = chart; + miqSparkleOff(); + }); EOJ end @@ -17,10 +17,10 @@ chart_id = opts[:id] || ('chart' + rand(10**8).to_s) content_tag(:div, '', :id => chart_id) + - javascript_tag(<<-EOJ) -var data = #{data.to_json}; -var chart = c3.generate(chartData('#{data[:miqChart]}', data, { bindto: "##{chart_id}" })); -ManageIQ.charts.c3["#{chart_id}"] = chart; + javascript_tag(<<~EOJ) + var data = #{data.to_json}; + var chart = c3.generate(chartData('#{data[:miqChart]}', data, { bindto: "##{chart_id}" })); + ManageIQ.charts.c3["#{chart_id}"] = chart; EOJ end end
Fix rubocop warnings in C3Helper
diff --git a/lib/omniauth/strategies/wordpress_hosted.rb b/lib/omniauth/strategies/wordpress_hosted.rb index abc1234..def5678 100644 --- a/lib/omniauth/strategies/wordpress_hosted.rb +++ b/lib/omniauth/strategies/wordpress_hosted.rb @@ -33,7 +33,7 @@ def raw_info puts access_token.token - @raw_info ||= access_token.get("/me", :params => { 'access_token' => access_token.token }).parsed + @raw_info ||= access_token.get("/oauth/me", :params => { 'access_token' => access_token.token }).parsed end end end
Update endpoints used by WP OAuth Server 3.1.3
diff --git a/lib/vidibus/secure/extensions/controller.rb b/lib/vidibus/secure/extensions/controller.rb index abc1234..def5678 100644 --- a/lib/vidibus/secure/extensions/controller.rb +++ b/lib/vidibus/secure/extensions/controller.rb @@ -7,7 +7,7 @@ extend ActiveSupport::Concern included do - helper_method :valid_request? + helper_method(:valid_request?) if respond_to?(:helper_method) end # Generates a signature of a request path.
Use helper_method only if available
diff --git a/lib/aws/xray.rb b/lib/aws/xray.rb index abc1234..def5678 100644 --- a/lib/aws/xray.rb +++ b/lib/aws/xray.rb @@ -24,9 +24,9 @@ class << self # @param [String] name a logical name of this tracing context. - def trace(name: nil) + def trace(name: nil, trace: Trace.generate) name = name || config.name || raise(MissingNameError) - Context.with_new_context(name, Trace.generate) do + Context.with_new_context(name, trace) do Context.current.start_segment do |seg| yield seg end
Change to accept trace object
diff --git a/lib/lineprof.rb b/lib/lineprof.rb index abc1234..def5678 100644 --- a/lib/lineprof.rb +++ b/lib/lineprof.rb @@ -18,7 +18,14 @@ private def caller_filename(caller_lines) - caller_lines.first.split(':').first || DEFAULT_PATTERN + filename = caller_lines.first.split(':').first + + if filename + # Don't add \A because filename may not be an absolute path + /#{Regexp.escape(filename)}\z/ + else + DEFAULT_PATTERN + end end def format(result)
Fix NULL pointer given error with no argument It seems rblineprof requires regexp, not string. ``` $ bundle exec ruby example.rb /app/lib/lineprof.rb:11:in `lineprof': NULL pointer given (ArgumentError) from /app/lib/lineprof.rb:11:in `profile' from example.rb:3:in `<main>' ``` I guess example.rb worked well at one time though, I can't find the cause. It fails even with old rubies (2.2 ~ 2.5) ```ruby $ cat a.rb require 'bundler/inline' gemfile do source 'https://rubygems.org' gem 'lineprof' end Lineprof.profile do sleep 0.001 end ``` ``` $ docker run -v $PWD:/$PWD -w /$PWD ruby:2.2 ruby a.rb /usr/local/bundle/gems/lineprof-0.1.1/lib/lineprof.rb:11:in `lineprof': NULL pointer given (ArgumentError) from /usr/local/bundle/gems/lineprof-0.1.1/lib/lineprof.rb:11:in `profile' from a.rb:9:in `<main>' ```
diff --git a/lib/recog/db.rb b/lib/recog/db.rb index abc1234..def5678 100644 --- a/lib/recog/db.rb +++ b/lib/recog/db.rb @@ -34,6 +34,8 @@ xml = Nokogiri::XML(fd.read(fd.stat.size)) end + raise "#{self.path} is invalid XML: #{xml.errors.join(',')}" unless xml.errors.empty? + xml.xpath("/fingerprints").each do |fbase| if fbase['matches'] @match_key = fbase['matches'].to_s
Abort when the XML has any errors
diff --git a/lib/generators/mailboxer/views_generator.rb b/lib/generators/mailboxer/views_generator.rb index abc1234..def5678 100644 --- a/lib/generators/mailboxer/views_generator.rb +++ b/lib/generators/mailboxer/views_generator.rb @@ -0,0 +1,9 @@+class Mailboxer::ViewsGenerator < Rails::Generators::Base + source_root File.expand_path("../../../../app/views", __FILE__) + + desc "Copy Mailboxer views into your app" + def copy_views + directory('message_mailer', 'app/views/message_mailer') + directory('notification_mailer', 'app/views/notification_mailer') + end +end
Add generator for mailer views
diff --git a/lib/middleman-google-analytics/extension.rb b/lib/middleman-google-analytics/extension.rb index abc1234..def5678 100644 --- a/lib/middleman-google-analytics/extension.rb +++ b/lib/middleman-google-analytics/extension.rb @@ -19,7 +19,7 @@ module InstanceMethods def google_analytics_tag options = ::Middleman::GoogleAnalytics.options - options.debug ||= (not build?) + options.debug ||= development? ga = options.debug ? 'ga' : '/u/ga_debug' if tracking_id = options.tracking_id gaq = []
Use `ga_debug` only in development Before, it checked if not in `build`. I think to check for development is more accurate.
diff --git a/ruby/repl.rb b/ruby/repl.rb index abc1234..def5678 100644 --- a/ruby/repl.rb +++ b/ruby/repl.rb @@ -42,3 +42,15 @@ include Rails.application.routes.url_helpers nil end + +module IntegrationTestPryHelpers + def puts_select(*args) + puts HTMLSelector.new(args) { nodeset document_root_element }.select.to_html + end +end + +if defined? GitHub::IntegrationTestCase + class GitHub::IntegrationTestCase + include IntegrationTestPryHelpers + end +end
Use `puts_select` in integration tests
diff --git a/roles/web.rb b/roles/web.rb index abc1234..def5678 100644 --- a/roles/web.rb +++ b/roles/web.rb @@ -16,7 +16,7 @@ :pool_idle_time => 3600 }, :web => { - :status => "gpx_offline", + :status => "online", :memcached_servers => %w[rails1.ams rails2.ams rails3.ams] } )
Bring GPX access back online
diff --git a/spec/lib/heroku_config_manager_spec.rb b/spec/lib/heroku_config_manager_spec.rb index abc1234..def5678 100644 --- a/spec/lib/heroku_config_manager_spec.rb +++ b/spec/lib/heroku_config_manager_spec.rb @@ -0,0 +1,25 @@+require "spec_helper" +require "heroku_config_manager" + +describe HerokuConfigManager do + let(:apps) { ["foo"] } + let(:api_key) { "12345" } + let(:params) { { "MY_CONFIG_VAR" => "some-value" } } + + describe "#set" do + let(:manager) { double(set: nil) } + + subject { HerokuConfigManager.set(api_key, apps, params) } + before { HerokuConfigManager::Manager.stub(new: manager) } + + it "instantiates a new Manager object" do + expect(HerokuConfigManager::Manager).to receive(:new).with(api_key, apps) + subject + end + + it "calls set on the object" do + expect(manager).to receive(:set).with(params) + subject + end + end +end
Add specs for heroku config manager
diff --git a/spec/link_shrink/shrinker_base_spec.rb b/spec/link_shrink/shrinker_base_spec.rb index abc1234..def5678 100644 --- a/spec/link_shrink/shrinker_base_spec.rb +++ b/spec/link_shrink/shrinker_base_spec.rb @@ -16,8 +16,8 @@ end describe '#body_parameters' do - it 'raises error due to other methods not being overridden' do - expect{ link_shrink.body_parameters }.to raise_error + it 'raises nil when called without arguments' do + expect(link_shrink.body_parameters).to eq(nil) end end
Update base_spec for new body_parameters default return
diff --git a/lib/buildkite/rspec/formatter.rb b/lib/buildkite/rspec/formatter.rb index abc1234..def5678 100644 --- a/lib/buildkite/rspec/formatter.rb +++ b/lib/buildkite/rspec/formatter.rb @@ -5,19 +5,24 @@ class Formatter < ::RSpec::Core::Formatters::DocumentationFormatter ::RSpec::Core::Formatters.register(self, :example_started, :example_group_started, :example_failed) + def initialize(output) + super + @max_depth = ENV.fetch('BUILDKITE_RSPEC_MAX_DEPTH', 3).to_i + end def example_group_started(notification) - output.puts "--- #{current_indentation}#{notification.group.description}" + output.puts "--- #{current_indentation}#{notification.group.description}" if @group_level < @max_depth super end def example_started(notification) - output.puts "--- #{notification.example.group.full_description} #{notification.example.description}" if ENV['RSPEC_BREAK_ON_EXAMPLE'] + output.puts "--- #{notification.example.group.full_description} #{notification.example.description}" if ENV['BUILDKITE_RSPEC_BREAK_ON_EXAMPLE'] end def example_failed(notification) super - output.puts(notification.fully_formatted) + output.puts(notification.colorized_message_lines.join("\n")) + output.puts(notification.colorized_formatted_backtrace.join("\n")) output.puts("^^^ +++") end end
Add a max depth so it's not stupid
diff --git a/lib/diff_forward_plugin_patch.rb b/lib/diff_forward_plugin_patch.rb index abc1234..def5678 100644 --- a/lib/diff_forward_plugin_patch.rb +++ b/lib/diff_forward_plugin_patch.rb @@ -0,0 +1,16 @@+module DiffForwardPluginPatch + def self.included(base) + base.send(:include, InstanceMethods) + base.class_eval do + alias_method_chain :link_to_revision, :diff_link + end + end + + module InstanceMethods + def link_to_revision_with_diff_link(revision, project, options={}) + text = options.delete(:text) || format_revision(revision) + + link_to(text, {:controller => 'repositories', :action => 'diff', :id => project, :rev => revision}, :title => l(:label_revision_id, revision)) + end + end +end
Include a patch to rewrite diff links automatically.
diff --git a/lib/habitica_cli/commands/add.rb b/lib/habitica_cli/commands/add.rb index abc1234..def5678 100644 --- a/lib/habitica_cli/commands/add.rb +++ b/lib/habitica_cli/commands/add.rb @@ -4,10 +4,10 @@ module Commands def self.add(env, type, text) validate_type(type) - response = env.api.post('tasks', type: type, text: text) + response = env.api.post('tasks/user', type: type, text: text) if response.success? - task = cache_tasks(env, [response.body], type).first + task = cache_tasks(env, [response.body['data']], type).first puts "Added #{task['text']} [#{task['cid']}]" else puts "Error adding #{text}: #{response.body}"
feat: Update to new tasks endpoint
diff --git a/lib/project/pro_motion/adapters/pm_cursor_adapter.rb b/lib/project/pro_motion/adapters/pm_cursor_adapter.rb index abc1234..def5678 100644 --- a/lib/project/pro_motion/adapters/pm_cursor_adapter.rb +++ b/lib/project/pro_motion/adapters/pm_cursor_adapter.rb @@ -6,51 +6,16 @@ super() @cursor = opts.fetch(:cursor) @cell_options = opts.fetch(:cell, 1) + @cell_options[:cursor] = @cursor # slip the cursor inside so callbacks have it end def count cursor.count end - def item(position) + def item_data(position) cursor.moveToPosition(position) - cursor + cell_options # return the one & only one cell_options end - - def item_view_type_id(position) - 0 - end - - def view(position, convert_view, parent) - data = item(position) - out = convert_view || rmq.create!(cell_options[:cell_class] || Potion::TextView) - update_view(out, data) - if cell_options[:action] - find(out).on(:tap) do - find.screen.send(cell_options[:action], item(position), position) - end - end - out - end - - def update_view(out, data) - if cell_options[:update].is_a?(Proc) - cell_options[:update].call(out, data) - elsif cell_options[:update].is_a?(Symbol) || cell_options[:update].is_a?(String) - find.screen.send(cell_options[:update], out, data) - else - out.text = data.getString(cell_options[:title_column].to_i) - end - end - end -__END__ - -def table_data - { - cursor: my_cursor, - title_column: 0, - } -end -
Fix up the interface mismatch from base adapter and let base adapter do the view work.
diff --git a/sparql/unquote_literals.ru b/sparql/unquote_literals.ru index abc1234..def5678 100644 --- a/sparql/unquote_literals.ru +++ b/sparql/unquote_literals.ru @@ -6,6 +6,6 @@ } WHERE { ?s ?p ?_o . - FILTER (isLiteral(?_o) && strstarts(?_o, "\"") && strends(?_o, "\"")) + FILTER (isLiteral(?_o) && strstarts(str(?_o), "\"") && strends(str(?_o), "\"")) BIND (substr(?_o, 2, strlen(?_o) - 1) AS ?o) }
Add explicit cast to string for Virtuoso
diff --git a/spec/indent/cython_spec.rb b/spec/indent/cython_spec.rb index abc1234..def5678 100644 --- a/spec/indent/cython_spec.rb +++ b/spec/indent/cython_spec.rb @@ -4,9 +4,12 @@ before(:all) { vim.command "new" vim.command "set ft=cython" - # vim.command("set indentexpr?").should include "GetPythonPEPIndent(" + vim.command("set indentexpr?").should include "GetPythonPEPIndent(" } before(:each) { + # clear buffer + vim.normal 'gg"_dG' + # Insert two blank lines. # The first line is a corner case in this plugin that would shadow the # correct behaviour of other tests. Thus we explicitly jump to the first
Fix cython tests that successful due to Vim segfaulting and vimrunner not handling it
diff --git a/spec/support/the_bundle.rb b/spec/support/the_bundle.rb index abc1234..def5678 100644 --- a/spec/support/the_bundle.rb +++ b/spec/support/the_bundle.rb @@ -1,11 +1,9 @@ # frozen_string_literal: true -require "support/helpers" require "support/path" module Spec class TheBundle - include Spec::Helpers include Spec::Path attr_accessor :bundle_dir
Remove unneded require and inclusion
diff --git a/jqtree-rails.gemspec b/jqtree-rails.gemspec index abc1234..def5678 100644 --- a/jqtree-rails.gemspec +++ b/jqtree-rails.gemspec @@ -5,8 +5,8 @@ s.name = File.basename(__FILE__, '.gemspec') s.version = JqTree::Rails::VERSION s.platform = Gem::Platform::RUBY - s.authors = ["Ryan Scott Lewis"] - s.email = ["c00lryguy@gmail.com"] + s.authors = ["Ryan Scott Lewis", "Mario Uher"] # TODO: + s.email = ["c00lryguy@gmail.com", "uher.mario@gmail.com"] # Pull from Git repo (see f.files) s.homepage = "http://rubygems.org/gems/#{s.name}" s.summary = "Use jqTree with Rails 3" s.description = "This gem provides jqTree assets for your Rails 3 application." @@ -14,9 +14,9 @@ s.required_rubygems_version = ">= 1.3.6" s.add_dependency "railties", ">= 3.2.0", "< 5.0" - s.add_dependency "thor", "~> 0.14" + s.add_dependency "thor", "~> 0.14" # TODO: Find out why this is needed s.files = `git ls-files`.split("\n") - s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) } - s.require_path = 'lib' + s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) } # TODO: Remove + s.require_path = 'lib' # TODO: Pretty sure this is implied, check gemspec specifications end
Add Mario User to gem owners
diff --git a/lib/spaux/chef/default_client.rb b/lib/spaux/chef/default_client.rb index abc1234..def5678 100644 --- a/lib/spaux/chef/default_client.rb +++ b/lib/spaux/chef/default_client.rb @@ -0,0 +1,8 @@+config_file ::File.join('@work_dir', 'client.rb') +cache_path ::File.join('@work_dir', '.chef') +client_key ::File.join('@work_dir', 'client.pem') +json_attribs ::File.join('@work_dir', 'attributes.json') +chef_server_url 'https://api.opscode.com/organizations/spaux' +ssl_verify_mode :verify_peer +node_name 'spaux' +override_runlist ["recipe[spaux::machine]"]
Add default chef-client configuration file
diff --git a/rails/spec/helpers/divisions_helper_spec.rb b/rails/spec/helpers/divisions_helper_spec.rb index abc1234..def5678 100644 --- a/rails/spec/helpers/divisions_helper_spec.rb +++ b/rails/spec/helpers/divisions_helper_spec.rb @@ -1,15 +1,11 @@ require 'spec_helper' -# Specs in this file have access to a helper object that includes -# the DivisionsHelper. For example: -# -# describe DivisionsHelper do -# describe "string concat" do -# it "concats two strings with spaces" do -# expect(helper.concat_strings("this","that")).to eq("this that") -# end -# end -# end describe DivisionsHelper do - pending "add some examples to (or delete) #{__FILE__}" + # TODO Enable this test + # describe '#formatted_motion_text' do + # subject { formatted_motion_text division } + + # let(:division) { mock_model(Division, motion: "A bill [No. 2] and votes") } + # it { should eq("\n<p>A bill [No. 2] and votes</p>") } + # end end
Add commented out test exposing a division parsing bug
diff --git a/pakyow-core/lib/core/route_template_defaults.rb b/pakyow-core/lib/core/route_template_defaults.rb index abc1234..def5678 100644 --- a/pakyow-core/lib/core/route_template_defaults.rb +++ b/pakyow-core/lib/core/route_template_defaults.rb @@ -1,5 +1,5 @@ Pakyow::Router.instance.set(:default) { - template(:restful) { |data| + template(:restful) { get '/', fn(:index) # special case for show (view path is overridden)
Remove `data` from restful template
diff --git a/app/helpers/icon_helper.rb b/app/helpers/icon_helper.rb index abc1234..def5678 100644 --- a/app/helpers/icon_helper.rb +++ b/app/helpers/icon_helper.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true module IconHelper - def ion_icon(name, html_class = '') "<i class='ion ion-#{name} #{html_class}'></i>".html_safe end
Fix extra empty line after module beginning Rubocop rule: Layout/EmptyLinesAroundModuleBody: Extra empty line detected at module body beginning
diff --git a/app/lib/http_connection.rb b/app/lib/http_connection.rb index abc1234..def5678 100644 --- a/app/lib/http_connection.rb +++ b/app/lib/http_connection.rb @@ -18,23 +18,23 @@ def get(*args) __getobj__.get(*args) - rescue Faraday::Error::ResourceNotFound + rescue Faraday::ResourceNotFound raise ResourceNotFound - rescue Faraday::Error::ConnectionFailed + rescue Faraday::ConnectionFailed raise ConnectionFailed - rescue Faraday::Error::ClientError + rescue Faraday::ClientError raise ClientError end def post(*args) __getobj__.post(*args) - rescue Faraday::Error::ConnectionFailed + rescue Faraday::ConnectionFailed raise ConnectionFailed - rescue Faraday::Error::ClientError => error + rescue Faraday::ClientError => error case error.response[:status] when 422 raise UnprocessableEntity
Fix breaking change in Faraday
diff --git a/tasks/hoe.rb b/tasks/hoe.rb index abc1234..def5678 100644 --- a/tasks/hoe.rb +++ b/tasks/hoe.rb @@ -31,6 +31,7 @@ p.clean_globs |= GEM_CLEAN p.spec_extras = GEM_EXTRAS if GEM_EXTRAS + p.need_tar = false GEM_DEPENDENCIES.each do |dep| p.extra_deps << dep
[jdbc_drivers] Remove tar requirement to placate Windows Signed-off-by: Alex Coles <60c6d277a8bd81de7fdde19201bf9c58a3df08f4@alexcolesportfolio.com>
diff --git a/tayu.gemspec b/tayu.gemspec index abc1234..def5678 100644 --- a/tayu.gemspec +++ b/tayu.gemspec @@ -1,15 +1,15 @@ Gem::Specification.new do |s| s.name = 'tayu' - s.version = '0.0.2' - s.date = '2012-11-09' - s.summary = "Integrates PuppetDB with Rundeck" - s.description = "Provides a resource endpoint for RunDeck from a PuppetDB server" - s.authors = "Adrian van Dongen" + s.version = '0.0.3' + s.date = '2013-05-17' + s.summary = 'Integrates PuppetDB with Rundeck' + s.description = 'Provides a resource endpoint for RunDeck from a PuppetDB server' + s.authors = 'Adrian van Dongen' s.email = 'sirhopcount@goodfellasonline.nl' - s.files = ["lib/tayu.rb", "config/tayu.yml"] + s.files = ['lib/tayu.rb', 'config/tayu.yml'] s.homepage = 'http://github.com/sirhopcount/tayu' s.executable = 'tayu' - s.add_runtime_dependency "sinatra" + s.add_runtime_dependency 'builder', '>= 2.0.0' s.add_runtime_dependency 'rest-client' - s.add_dependency "builder", ">= 2.0.0" + s.add_runtime_dependency 'sinatra' end
Prepare gemspec file for new version
diff --git a/test/boot.rb b/test/boot.rb index abc1234..def5678 100644 --- a/test/boot.rb +++ b/test/boot.rb @@ -15,7 +15,8 @@ PLUGIN_ROOT = pwd + '..' ADAPTER = ENV['DB'] || 'mysql' -$LOAD_PATH << (PLUGIN_ROOT + 'lib') << (PLUGIN_ROOT + 'test/models') +$LOAD_PATH << (PLUGIN_ROOT + 'lib') +$LOAD_PATH << (PLUGIN_ROOT + 'test/models') config_file = PLUGIN_ROOT + 'test/database.yml' db_config = YAML::load(IO.read(config_file))
Split the LOAD_PATH additions in 2 lines (readability)
diff --git a/test/arelastic/filters/filter_test.rb b/test/arelastic/filters/filter_test.rb index abc1234..def5678 100644 --- a/test/arelastic/filters/filter_test.rb +++ b/test/arelastic/filters/filter_test.rb @@ -1,7 +1,7 @@ require 'helper' class Arelastic::FilterTest < Minitest::Test - def test_or + def test_and filter = Arelastic::Filters::Filter.new and_filter = filter.and(filter) @@ -10,7 +10,7 @@ assert_equal [filter, filter], and_filter.children end - def test_and + def test_or filter = Arelastic::Filters::Filter.new and_filter = filter.or(filter)
Swap and & or test names
diff --git a/test/jobs/populate_issues_job_test.rb b/test/jobs/populate_issues_job_test.rb index abc1234..def5678 100644 --- a/test/jobs/populate_issues_job_test.rb +++ b/test/jobs/populate_issues_job_test.rb @@ -21,7 +21,7 @@ test "#populate_multi_issues creates issues" do repo = repos(:issue_triage_sandbox) - repo.issues.where(state: 'open').destroy_all + repo.issues.where(state: 'open').delete_all VCR.use_cassette "issue_triage_sandbox_fetch_issues" do assert_difference("Issue.count", 1) do PopulateIssuesJob.perform_now(repo)
Delete all jobs, don't destroy in test
diff --git a/test/unit/compute/test_collections.rb b/test/unit/compute/test_collections.rb index abc1234..def5678 100644 --- a/test/unit/compute/test_collections.rb +++ b/test/unit/compute/test_collections.rb @@ -3,7 +3,7 @@ class UnitTestCollections < MiniTest::Test def setup Fog.mock! - @client = Fog::Compute.new(:provider => "Google") + @client = Fog::Compute.new(:provider => "Google", :google_project => "foo") common_ancestors = [Fog::Collection, Fog::Association, Fog::PagedCollection] descendants = ObjectSpace.each_object(Fog::Collection.singleton_class).to_a @@ -19,5 +19,4 @@ assert obj.respond_to?(:each), "#{klass} should be enumerable" end end - end
Add parameters to client mock to work without .fog
diff --git a/tools/check_interreplay_violations.rb b/tools/check_interreplay_violations.rb index abc1234..def5678 100644 --- a/tools/check_interreplay_violations.rb +++ b/tools/check_interreplay_violations.rb @@ -0,0 +1,27 @@+#!/usr/bin/ruby + +# This script parses mcs_finder.log to infer which subsequences ended in +# a bug. +# +# It only exists because old STS versions didn't store this information in an +# easily accessible way. It should be replaced with a simple tool that parses +# the appropriate information in runtime_stats.json. + +replay_number = 0 +replay_to_violation = {} + +File.foreach(ARGV[0]) do |line| + if line =~ /Current subset:/ + replay_number += 1 + end + if line =~ /No violation in/ + replay_to_violation[replay_number] = false + end + if line =~ /Violation!/ + replay_to_violation[replay_number] = true + end +end + +replay_to_violation.keys.sort.each do |key| + puts "Replay #{key} violation #{replay_to_violation[key]}" +end
Add temp tool for inferring which interreplay resulted in violation
diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -8,10 +8,6 @@ def confirmation_instructions user sendgrid_category 'Welcome' @user = user - puts "Email: #{@user.email}" - puts "Token: #{@user.confirmation_token}" - @url = confirmation_url @user - puts "URL: #{@url}" mail to: @user.email, subject: 'Welcome to Big Earth!' end end
Remove puts and method call.
diff --git a/app/models/data_average.rb b/app/models/data_average.rb index abc1234..def5678 100644 --- a/app/models/data_average.rb +++ b/app/models/data_average.rb @@ -1,5 +1,4 @@ class DataAverage - def self.calculate!(identified_by, timeslot) last = DataStore.from(identified_by, timeslot).last @@ -24,7 +23,7 @@ self.calculate!(identified_by, :one_hour) if last.created_at.min < 15 when :one_hour self.calculate!(identified_by, :four_hours) if last.created_at.hour % 4 == 0 - when :four_hour + when :four_hours self.calculate!(identified_by, :twelve_hours) if last.created_at.hour % 12 == 0 end end
Fix type in calculate next average
diff --git a/app/models/policy_group.rb b/app/models/policy_group.rb index abc1234..def5678 100644 --- a/app/models/policy_group.rb +++ b/app/models/policy_group.rb @@ -20,7 +20,8 @@ searchable title: :name, link: :search_link, - content: :summary_or_name + content: :summary_or_name, + description: :summary def search_link raise NotImplementedError, '#search_link must be implemented in PolicyGroup subclasses, PolicyGroup can\'t be indexed directly.'
Fix policy group search description
diff --git a/app/models/relationship.rb b/app/models/relationship.rb index abc1234..def5678 100644 --- a/app/models/relationship.rb +++ b/app/models/relationship.rb @@ -24,6 +24,11 @@ end def ensure_unique_relationship + ensure_unique_caretaker if caretaker? errors.add_to_base "These two people already have that relationship" if Relationship.including_people(from, to, relationship_type) end + + def ensure_unique_caretaker + errors.add_to_base "This person is already a caretaker" if Relationship.find(:first, :conditions => {:from_id => from.id, :to_id => to.id, :caretaker => true}) + end end
Add check to ensure caretaker is unique when adding to a person.
diff --git a/bindings/ruby/satsolver.rb b/bindings/ruby/satsolver.rb index abc1234..def5678 100644 --- a/bindings/ruby/satsolver.rb +++ b/bindings/ruby/satsolver.rb @@ -8,6 +8,3 @@ require 'satsolver/covenant' require 'satsolver/dump' -require 'satsolver/job' -require 'satsolver/request' -require 'satsolver/ruleinfo'
Remove includes of obsoleted files Most 'to_s' type functions are now provided in C code for all languages.
diff --git a/lib/circleci/http.rb b/lib/circleci/http.rb index abc1234..def5678 100644 --- a/lib/circleci/http.rb +++ b/lib/circleci/http.rb @@ -1,3 +1,5 @@+# encoding: utf-8 + module CircleCi class Http # @private
Add utf-8 magic encoding comment
diff --git a/lib/poke/controls.rb b/lib/poke/controls.rb index abc1234..def5678 100644 --- a/lib/poke/controls.rb +++ b/lib/poke/controls.rb @@ -5,7 +5,8 @@ BUTTONS = { up: Gosu::KbUp, down: Gosu::KbDown, left: Gosu::KbLeft, - right: Gosu::KbRight } + right: Gosu::KbRight, + q: Gosu::KbQ } def initialize(params) Params.check_params(params, PARAMS_REQUIRED)
Add :q to Controls::BUTTONS constant
diff --git a/lib/scrapr/github.rb b/lib/scrapr/github.rb index abc1234..def5678 100644 --- a/lib/scrapr/github.rb +++ b/lib/scrapr/github.rb @@ -6,6 +6,9 @@ base_uri 'https://api.github.com' basic_auth ENV['GH_USER'], ENV['GH_PASS'] - + + def get_user(username) + self.class.get("/users/#{username}") + end end end
Add method to get a single user.
diff --git a/rslp.gemspec b/rslp.gemspec index abc1234..def5678 100644 --- a/rslp.gemspec +++ b/rslp.gemspec @@ -4,7 +4,7 @@ Gem::Specification.new do |gem| gem.name = 'rslp' gem.version = '0.1.0' - gem.license = 'Apache 2.0' + gem.license = 'Apache-2.0' gem.author = 'Daniel J. Berger' gem.email = 'djberg96@gmail.com' gem.homepage = 'https://github.com/djberg96/rslp' @@ -16,8 +16,8 @@ gem.add_dependency('ffi', "~> 1.9.8") - gem.add_development_dependency('rake', "~> 10.0") - gem.add_development_dependency('rspec', "~> 3.0") + gem.add_development_dependency('rake') + gem.add_development_dependency('rspec', "~> 3.9") gem.description = <<-EOF The rslp library is an FFI interface for the OpenSLP service
Fix license name (missing hyphen) and remove versioning for Rake.
diff --git a/app/models/composition.rb b/app/models/composition.rb index abc1234..def5678 100644 --- a/app/models/composition.rb +++ b/app/models/composition.rb @@ -2,5 +2,10 @@ belongs_to :map belongs_to :user + has_many :player_selections + has_many :player_heroes, through: :player_selections + has_many :players, through: :player_heroes + has_many :heroes, through: :player_heroes + validates :map, presence: true end
Add some relations to Composition for players
diff --git a/app/models/development.rb b/app/models/development.rb index abc1234..def5678 100644 --- a/app/models/development.rb +++ b/app/models/development.rb @@ -16,6 +16,8 @@ STATUSES = [:projected, :planning, :in_construction, :completed].freeze enumerize :status, in: STATUSES, predicates: true + + serialize :walkscore, JSON def to_s name
Add serializer to get walkscore JSON string as a hash
diff --git a/app/models/wine_region.rb b/app/models/wine_region.rb index abc1234..def5678 100644 --- a/app/models/wine_region.rb +++ b/app/models/wine_region.rb @@ -1,7 +1,7 @@ class WineRegion < ApplicationRecord validates_presence_of :name belongs_to :country - belongs_to :state + belongs_to :state, optional: true # had_many :appellations # has_and_belongs_to_many :varietals end
Add optional: true to the WineRegion model for belongs_to state assocciation
diff --git a/test/test_rails3_integration.rb b/test/test_rails3_integration.rb index abc1234..def5678 100644 --- a/test/test_rails3_integration.rb +++ b/test/test_rails3_integration.rb @@ -17,7 +17,7 @@ test_suite_output = `rake test` exit_status = $? - assert exit_status.success?, "Rails 3 app's test suite should pass!" + assert exit_status.success?, "Rails 3 app's test suite should pass! Output was: #{test_suite_output}" assert_equal 1, test_suite_output.scan(/Loading test data in PostTest/).length assert_equal 1, test_suite_output.scan(/Loading test data in PostsControllerTest/).length
Include rails3 test suite output on failure
diff --git a/test/unit/action_mailer_test.rb b/test/unit/action_mailer_test.rb index abc1234..def5678 100644 --- a/test/unit/action_mailer_test.rb +++ b/test/unit/action_mailer_test.rb @@ -0,0 +1,57 @@+require File.expand_path(File.dirname(__FILE__) + '/../test_helper') + +class ActionMailerTest < Test::Unit::TestCase + class TestMailer < ActionMailer::Base + def signed_up(recipient) + subject 'Thanks for signing up' + from 'MyWebApp <welcome@mywebapp.com>' + recipients recipient + cc 'Nobody <nobody@mywebapp.com>' + bcc 'root@mywebapp.com' + body 'Congratulations!' + end + end + + def setup + ActionMailer::Base.deliveries = [] + end + + def test_should_use_camelized_application_name_for_default_subject_prefix + assert_equal '[AppRoot] ', ActionMailer::Base.default_subject_prefix + end + + def test_should_queue_email + assert_nothing_raised {TestMailer.queue_signed_up('john.smith@gmail.com')} + assert_equal 1, Email.count + + email = Email.find(1) + assert_equal '[AppRoot] Thanks for signing up', email.subject + assert_equal 'Congratulations!', email.body + assert_equal 'MyWebApp <welcome@mywebapp.com>', email.sender.with_name + assert_equal ['john.smith@gmail.com'], email.to.map(&:with_name) + assert_equal ['Nobody <nobody@mywebapp.com>'], email.cc.map(&:with_name) + assert_equal ['root@mywebapp.com'], email.bcc.map(&:with_name) + end + + def test_should_deliver_email + email = create_email( + :subject => 'Hello', + :body => 'How are you?', + :sender => create_email_address(:name => 'MyWebApp', :spec => 'welcome@mywebapp.com'), + :to => create_email_address(:spec => 'john.smith@gmail.com'), + :cc => create_email_address(:name => 'Nobody', :spec => 'nobody@mywebapp.com'), + :bcc => create_email_address(:spec => 'root@mywebapp.com') + ) + + assert_nothing_raised {ActionMailer::Base.deliver_email(email)} + assert_equal 1, ActionMailer::Base.deliveries.size + + delivery = ActionMailer::Base.deliveries.first + assert_equal 'Hello', delivery.subject + assert_equal 'How are you?', delivery.body + assert_equal ['welcome@mywebapp.com'], delivery.from + assert_equal ['john.smith@gmail.com'], delivery.to + assert_equal ['nobody@mywebapp.com'], delivery.cc + assert_equal ['root@mywebapp.com'], delivery.bcc + end +end
Add missing ActionMailer test from last commit
diff --git a/thor.gemspec b/thor.gemspec index abc1234..def5678 100644 --- a/thor.gemspec +++ b/thor.gemspec @@ -13,6 +13,13 @@ spec.homepage = "http://whatisthor.com/" spec.licenses = %w(MIT) spec.name = "thor" + spec.metadata = { + "bug_tracker_uri" => "https://github.com/erikhuda/thor/issues", + "changelog_uri" => "https://github.com/erikhuda/thor/blob/master/CHANGELOG.md", + "documentation_uri" => "http://whatisthor.com/", + "source_code_uri" => "https://github.com/erikhuda/thor/tree/v#{Thor::VERSION}", + "wiki_uri" => "https://github.com/erikhuda/thor/wiki" + } spec.require_paths = %w(lib) spec.required_ruby_version = ">= 2.0.0" spec.required_rubygems_version = ">= 1.3.5"
Add project metadata to the gemspec As per https://guides.rubygems.org/specification-reference/#metadata, add metadata to the gemspec file. This'll allow people to more easily access the source code, raise issues and read the changelog. These `bug_tracker_uri`, `changelog_uri`, `documentation_uri`, `source_code_uri`, and `wiki_uri` links will appear on the rubygems page at https://rubygems.org/gems/thor and be available via the rubygems API after the next release.
diff --git a/Casks/appcode.rb b/Casks/appcode.rb index abc1234..def5678 100644 --- a/Casks/appcode.rb +++ b/Casks/appcode.rb @@ -1,6 +1,6 @@ cask :v1 => 'appcode' do - version '3.1' - sha256 '88c07d17b450f4ee4adfbe8ab412467e6b3148b36163257c194b1a099c33e0ee' + version '3.1.1' + sha256 'f549e0fdfb7dcd2a1553ca452a75c1cbc135e3d66b926de0c58dde59865f3b6c' url "http://download.jetbrains.com/objc/AppCode-#{version}.dmg" homepage 'http://www.jetbrains.com/objc/'
Update AppCode to version 3.1.1 SHA has also been updated.
diff --git a/GPUImage.podspec b/GPUImage.podspec index abc1234..def5678 100644 --- a/GPUImage.podspec +++ b/GPUImage.podspec @@ -2,15 +2,26 @@ s.name = 'GPUImage' s.version = '0.1.2' s.license = 'BSD' - s.platform = :ios, '5.0' s.summary = 'An open source iOS framework for GPU-based image and video processing.' s.homepage = 'https://github.com/BradLarson/GPUImage' s.author = { 'Brad Larson' => 'contact@sunsetlakesoftware.com' } s.source = { :git => 'https://github.com/BradLarson/GPUImage.git', :tag => "#{s.version}" } + s.source_files = 'framework/Source/**/*.{h,m}' s.resources = 'framework/Resources/*.png' - s.osx.exclude_files = 'framework/Source/iOS/**/*.{h,m}' - s.ios.exclude_files = 'framework/Source/Mac/**/*.{h,m}' - s.frameworks = ['OpenGLES', 'CoreVideo', 'CoreMedia', 'QuartzCore', 'AVFoundation'] s.requires_arc = true + s.xcconfig = { 'CLANG_MODULES_AUTOLINK' => 'YES' } + + s.ios.deployment_target = '5.0' + s.ios.exclude_files = 'framework/Source/Mac' + + s.osx.deployment_target = '10.6' + s.osx.exclude_files = 'framework/Source/iOS', + 'framework/Source/GPUImageFilterPipeline.*', + 'framework/Source/GPUImageMovie.*', + 'framework/Source/GPUImageMovieComposition.*', + 'framework/Source/GPUImageVideoCamera.*', + 'framework/Source/GPUImageStillCamera.*', + 'framework/Source/GPUImageUIElement.*' + s.osx.xcconfig = { 'GCC_WARN_ABOUT_RETURN_TYPE' => 'YES' } end
Add OS X support to Podspec.
diff --git a/spec/support/shared_examples_for_achievement.rb b/spec/support/shared_examples_for_achievement.rb index abc1234..def5678 100644 --- a/spec/support/shared_examples_for_achievement.rb +++ b/spec/support/shared_examples_for_achievement.rb @@ -16,4 +16,18 @@ described_class.title.should_not be_nil described_class.description.should_not be_nil end + + it "should have buble parameters" do + b = described_class.bubble.with_indifferent_access + b[:orientation].should_not be_nil + + a = [] + variants = ['left', 'bottom', 'top', 'right'] + + variants.each do |k| + a.push k if b.has_key?(k) + end + + (variants - a).count.should == 2 + end end
Add check if achievement has bubble parameters
diff --git a/lib/specinfra/command/freebsd/v10/package.rb b/lib/specinfra/command/freebsd/v10/package.rb index abc1234..def5678 100644 --- a/lib/specinfra/command/freebsd/v10/package.rb +++ b/lib/specinfra/command/freebsd/v10/package.rb @@ -8,6 +8,18 @@ end end + alias :check_is_installed_by_pkg :check_is_installed + + def check_is_installed_by_rpm(package, version=nil) + cmd = "rpm -q #{escape(package)}" + if version + cmd = "#{cmd} | grep -w -- #{escape(package)}-#{escape(version)}" + end + cmd + end + + alias :check_is_installed_by_yum :check_is_installed_by_rpm + def install(package, version=nil, option='') "pkg install -y #{option} #{package}" end
Add check_is_installed_by_[rpm, yum] for FreeBSD 10
diff --git a/spec/views/releases/index.html.haml_spec.rb b/spec/views/releases/index.html.haml_spec.rb index abc1234..def5678 100644 --- a/spec/views/releases/index.html.haml_spec.rb +++ b/spec/views/releases/index.html.haml_spec.rb @@ -1,5 +1,10 @@ require 'rails_helper' RSpec.describe "releases/index.html.haml", type: :view do - pending "add some examples to (or delete) #{__FILE__}" + it "lists releases" do + assign(:releases, [Release.new(project: "dummy", version: "0.0.1")]) + render + expect(rendered).to include "dummy" + expect(rendered).to include "0.0.1" + end end
Add test for index view
diff --git a/config/initializers/01_configure_from_env.rb b/config/initializers/01_configure_from_env.rb index abc1234..def5678 100644 --- a/config/initializers/01_configure_from_env.rb +++ b/config/initializers/01_configure_from_env.rb @@ -13,9 +13,7 @@ end if ENV['QUERY_CONCURRENCY'] - Pancakes::Config.from_env :query_concurrency, ENV['QUERY_CONCURRENCY'].to_i -else - Pancakes::Config.from_env :query_concurrency, 16 + Pancakes::Config.from_env :query_concurrency, ENV['QUERY_CONCURRENCY'] || 16 end if %w(CAS_BASE_URL CAS_PROXY_CALLBACK_URL CAS_PROXY_RETRIEVAL_URL).all? { |e| ENV[e] }
Revert "Correct massive brain fart re: concurrency level setup." This reverts commit 867d2373ff21a405bee1cefb8ff5ac7caadbaf6d.
diff --git a/db/migrate/20130806204555_scope_cms_learning_and_sniffer_in_element_type.rb b/db/migrate/20130806204555_scope_cms_learning_and_sniffer_in_element_type.rb index abc1234..def5678 100644 --- a/db/migrate/20130806204555_scope_cms_learning_and_sniffer_in_element_type.rb +++ b/db/migrate/20130806204555_scope_cms_learning_and_sniffer_in_element_type.rb @@ -0,0 +1,9 @@+class ScopeCmsLearningAndSnifferInElementType < ActiveRecord::Migration + def self.up + ExchangePlugin::ExchangeElement.update_all ["element_type = 'CmsLearningPlugin::Learning'"], :element_type => 'CmsLearningPluginLearning' + ExchangePlugin::ExchangeElement.update_all ["element_type = 'SnifferPlugin::Opportunity'"], :element_type => 'SnifferPluginOpportunity' + end + + def self.down + end +end
Migrate type to use scope
diff --git a/lib/airplay/protocol.rb b/lib/airplay/protocol.rb index abc1234..def5678 100644 --- a/lib/airplay/protocol.rb +++ b/lib/airplay/protocol.rb @@ -10,15 +10,25 @@ @http.set_debug_output($stdout) if ENV.has_key?('HTTP_DEBUG') end - def put(resource, body = nil, headers = {}) - @request = Net::HTTP::Put.new resource - @request.body = body - @request.initialize_http_header DEFAULT_HEADERS.merge(headers) + def make_request(request) response = @http.request(@request) raise Airplay::Protocol::InvalidRequestError if response.code == 404 true end + def put(resource, body = nil, headers = {}) + @request = Net::HTTP::Put.new resource + @request.body = body + @request.initialize_http_header DEFAULT_HEADERS.merge(headers) + make_request(@request) + end + + def get(resource, headers = {}) + @request = Net::HTTP::Get.new resource + @request.initialize_http_header DEFAULT_HEADERS.merge(headers) + make_request(@request) + end + end class Airplay::Protocol::InvalidRequestError < StandardError; end
Add simplified requests for Airplay::Protocol
diff --git a/lib/ducktrap/params_hash/string/url_encoded.rb b/lib/ducktrap/params_hash/string/url_encoded.rb index abc1234..def5678 100644 --- a/lib/ducktrap/params_hash/string/url_encoded.rb +++ b/lib/ducktrap/params_hash/string/url_encoded.rb @@ -1,4 +1,4 @@-module Ducktrap +class Ducktrap class ParamsHash class String # Ducktrap for url encoded params hash
Fix toplevel class vs module
diff --git a/lib/docs/scrapers/cmake.rb b/lib/docs/scrapers/cmake.rb index abc1234..def5678 100644 --- a/lib/docs/scrapers/cmake.rb +++ b/lib/docs/scrapers/cmake.rb @@ -22,7 +22,7 @@ HTML version '3.6' do - self.release = '3.6.0' + self.release = '3.6.2' self.base_url = 'https://cmake.org/cmake/help/v3.6/' end
Update CMake documentation (3.6.2, 3.5.2)
diff --git a/lib/facter/java_version.rb b/lib/facter/java_version.rb index abc1234..def5678 100644 --- a/lib/facter/java_version.rb +++ b/lib/facter/java_version.rb @@ -14,10 +14,6 @@ Facter.add(:java_version) do setcode do t_java = Facter::Util::Resolution.exec("java -version 2>&1") - if t_java.nil? - java_version = "NOT_INSTALLED" - else - j_version = t_java.to_s.lines.first.strip.split(/version/)[1].gsub(/"/, "").strip - end + java_version = t_java.to_s.lines.first.strip.split(/version/)[1].gsub(/"/, "").strip end end
Fix variable name, remove nil logic If Java is not present, we should return nil
diff --git a/test/facebook_canvas/middleware_test.rb b/test/facebook_canvas/middleware_test.rb index abc1234..def5678 100644 --- a/test/facebook_canvas/middleware_test.rb +++ b/test/facebook_canvas/middleware_test.rb @@ -0,0 +1,91 @@+require 'test_helper' + +class FacebookCanvas::MiddlewareTest < ActiveSupport::TestCase + let(:middleware) { FacebookCanvas::Middleware.new(app, request_host, custom_filter) } + let(:request_host) { %r{.*} } + let(:custom_filter) { proc { |_env| true } } + let(:app) { proc { |env| [200, {}, env] } } + let(:env) { + { + "SERVER_NAME" => "test.host", + "REQUEST_METHOD" => original_request_method, + } + } + let(:original_request_method) { "POST" } + + describe "request_host" do + describe "matching any host" do + let(:request_host) { %r{.*} } + + test "modifies request method to GET" do + env["SERVER_NAME"] = "anything" + assert_request_method "GET" + end + end + + describe "matching speficic host" do + let(:request_host) { %r{\.fb\.} } + + test "modifies request method to GET if matched" do + env["SERVER_NAME"] = "test.fb.host" + assert_request_method "GET" + end + + test "does not change request method" do + env["SERVER_NAME"] = "test.facebook.host" + refute_request_method_change + end + end + end + + describe "custom_filter" do + let(:custom_filter) do + proc { |env| env[:pass_custom_filter] } + end + + test "modifies request method to GET if matched" do + env[:pass_custom_filter] = true + assert_request_method "GET" + end + + test "prevents change of request method" do + env[:pass_custom_filter] = false + refute_request_method_change + end + end + + describe "with Rails' POST request" do + before do + env["rack.request.form_hash"] = { + "utf8" => "✓" + } + end + + test "does not change request method" do + refute_request_method_change + end + end + + describe "with Rails' XHR requests" do + before do + env["HTTP_X_REQUESTED_WITH"] = "XMLHttpRequest" + end + + test "does not change request method" do + refute_request_method_change + end + end + + private + + def assert_request_method(expected) + status, headers, body = middleware.call(env) + + assert_instance_of Hash, body + assert_equal expected, body.fetch("REQUEST_METHOD") + end + + def refute_request_method_change + assert_request_method original_request_method + end +end
Add unit tests for FacebookCanvas::Middleware
diff --git a/test/lib/troo/presenters/member_test.rb b/test/lib/troo/presenters/member_test.rb index abc1234..def5678 100644 --- a/test/lib/troo/presenters/member_test.rb +++ b/test/lib/troo/presenters/member_test.rb @@ -10,7 +10,9 @@ before do @card = Fabricate(:card, external_member_ids: external_member_ids) - @member = Fabricate(:member) + Fabricate(:member, username: 'hydrogen', external_id: '20051') + Fabricate(:member, username: 'helium', external_id: '20052') + Fabricate(:member, username: 'lithium', external_id: '20053') end after { database_cleanup } @@ -18,8 +20,36 @@ describe '#show' do subject { described_class.new(@card, options).show } - it 'returns the members as a sentence' do - subject.must_equal('@gavinlaking1') + context 'when there a more than 2 members' do + let(:external_member_ids) { ['20051', '20052', '20053'] } + + it 'returns the members as a sentence' do + subject.must_equal('@hydrogen, @helium and @lithium') + end + end + + context 'when there is more than 1 member' do + let(:external_member_ids) { ['20051', '20052'] } + + it 'returns the members as a sentence' do + subject.must_equal('@hydrogen and @helium') + end + end + + context 'when there is one member' do + let(:external_member_ids) { ['20051'] } + + it 'returns the members as a sentence' do + subject.must_equal('@hydrogen') + end + end + + context 'when there are no members' do + let(:external_member_ids) { [] } + + it 'returns the members as a sentence' do + subject.must_equal('No members have been assigned.') + end end end end
Add more testing for Presenters::Member.
diff --git a/lib/rollbar/encoding.rb b/lib/rollbar/encoding.rb index abc1234..def5678 100644 --- a/lib/rollbar/encoding.rb +++ b/lib/rollbar/encoding.rb @@ -19,7 +19,7 @@ require 'rollbar/encoding/encoder' Rollbar::Encoding.encoding_class = Rollbar::Encoding::Encoder else + require 'rollbar/encoding/legacy_encoder' Rollbar::Encoding.encoding_class = Rollbar::Encoding::LegacyEncoder - require 'rollbar/encoding/legacy_encoder' end
Fix require order for Encoding module.
diff --git a/lib/sub_diff/builder.rb b/lib/sub_diff/builder.rb index abc1234..def5678 100644 --- a/lib/sub_diff/builder.rb +++ b/lib/sub_diff/builder.rb @@ -8,7 +8,7 @@ end def diff(*args, &block) - builder.diff(*args, &block) + adapter.diff(*args, &block) collection end @@ -22,15 +22,15 @@ private - def builder - constant.new(differ) + def adapter + adapter_class.new(differ) end - def constant - Module.nesting.last.const_get(constant_name) + def adapter_class + Module.nesting.last.const_get(adapter_name) end - def constant_name + def adapter_name type.to_s.capitalize end
Rename a variable for clarity
diff --git a/lib/tasks/uploader.rake b/lib/tasks/uploader.rake index abc1234..def5678 100644 --- a/lib/tasks/uploader.rake +++ b/lib/tasks/uploader.rake @@ -7,7 +7,7 @@ namespace :du do desc 'uploader test' - task :uploader, [:name, :host] => :environment do |t, args| + task :uploader, [:name, :host, :token] => :environment do |t, args| Rails.application.eager_load! puts "# Application fully loaded!" @@ -24,7 +24,7 @@ HTTParty.post("#{args[:host]}/api/v1/projects_domains/upload_model", { :body => domain_hash.to_json, #:basic_auth => { :username => api_key }, - :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json'} + :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'X-Authentication-Token' => args[:token]} }) puts "# Done!"
Add token as argument to task
diff --git a/lib/tic_tac_toe/game.rb b/lib/tic_tac_toe/game.rb index abc1234..def5678 100644 --- a/lib/tic_tac_toe/game.rb +++ b/lib/tic_tac_toe/game.rb @@ -29,6 +29,9 @@ end def do_turn + @console.puts "\nIt is the #{@to_play}'s move.'" + @console.puts @board.board_to_string + @console.puts moved = false while not moved move = get_move
Print the board before every turn
diff --git a/test/features/support/services/svc/user.rb b/test/features/support/services/svc/user.rb index abc1234..def5678 100644 --- a/test/features/support/services/svc/user.rb +++ b/test/features/support/services/svc/user.rb @@ -0,0 +1,45 @@+# encoding: UTF-8 + +require 'net/http' +require 'uri' +require 'json' +require_relative '../service.rb' + +module SVC + class User < Service + + def exists?(searchString) + res = get(searchString) + if res.any? {|user| user["dt_name"].include? searchString } + return true + else + return false + end + end + + def get(user) + session_cookie = "CGISESSID=#{@browser.cookies["CGISESSID"][:value]}" + headers = { + "Cookie" => session_cookie, + "Accept" => "application/json", + "Content-Type" => "application/x-www-form-urlencoded; charset=UTF-8" + } + # The search API is not well documented yet, but these params seems neccessary + params = { + "sEcho" => 2, + "searchmember" => user, + "searchfieldstype" => "standard", + "searchtype" => "contain", + "template_path" => "members/tables/members_results.tt" + } + + uri = URI.parse intranet(:search_patrons) + http = Net::HTTP.new(uri.host, uri.port) + req = Net::HTTP::Post.new(uri.request_uri, headers) + req.set_form_data(params) + res = http.request(req) + json = JSON.parse(res.body) + return json["aaData"] + end + end +end
Add SVC::User services exists? and get
diff --git a/spec/controllers/best_boy_controller_spec.rb b/spec/controllers/best_boy_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/best_boy_controller_spec.rb +++ b/spec/controllers/best_boy_controller_spec.rb @@ -1,24 +1,22 @@-require "spec_helper" +require 'spec_helper' describe BestBoyController do include BestBoyController::InstanceMethods - before(:each) do - @example = TestEvent.create - end + let(:test_event) { TestEvent.create } it 'sends valid custom event' do - best_boy_event @example, "testing" - best_boy = BestBoyEvent.where(owner_id: @example.id, owner_type: @example.class.name, event: 'testing').first + best_boy_event test_event, 'testing' + best_boy = BestBoyEvent.where(owner_id: test_event.id, owner_type: test_event.class.name, event: 'testing').first expect(best_boy).not_to be_nil end it 'raises error on empty event_phrase' do - expect { best_boy_event(@example, "") }.to raise_error + expect { best_boy_event(test_event, '') }.to raise_error end - it 'raises error on class not beeing a eventable' do + it 'raises error on class not beeing an eventable' do klass = Object.new - expect { best_boy_event(klass, "testing") }.to raise_error + expect { best_boy_event(klass, 'testing') }.to raise_error end end
Use let instead of before block
diff --git a/spec/lib/under_fire/album_toc_search_spec.rb b/spec/lib/under_fire/album_toc_search_spec.rb index abc1234..def5678 100644 --- a/spec/lib/under_fire/album_toc_search_spec.rb +++ b/spec/lib/under_fire/album_toc_search_spec.rb @@ -27,7 +27,7 @@ it "returns the correct query" do subject.query.must_include "182 " subject.query.must_include "98702 " - subject.query.must_include 'cmd="ALBUM_TOC"' + subject.query.must_include 'CMD="ALBUM_TOC"' subject.query.must_include "SINGLE_BEST_COVER" end end
Fix error in TOC search spec
diff --git a/spec/tty/table/renderer/basic/filter_spec.rb b/spec/tty/table/renderer/basic/filter_spec.rb index abc1234..def5678 100644 --- a/spec/tty/table/renderer/basic/filter_spec.rb +++ b/spec/tty/table/renderer/basic/filter_spec.rb @@ -0,0 +1,53 @@+# -*- encoding: utf-8 -*- + +require 'spec_helper' + +describe TTY::Table::Renderer::Basic, 'filter' do + let(:header) { ['h1', 'h2', 'h3'] } + let(:rows) { [['a1', 'a2', 'a3'], ['b1', 'b2', 'b3']] } + let(:table) { TTY::Table.new(header, rows) } + + subject(:renderer) { described_class.new(table, {filter: filter}) } + + context 'with header' do + context 'filtering only rows' do + let(:filter) { Proc.new { |val, row, col| + (col == 1 and row > 0) ? val.capitalize : val + } + } + + it 'filters only rows' do + subject.render.should == <<-EOS.normalize + h1 h2 h3 + a1 A2 a3 + b1 B2 b3 + EOS + end + end + + context 'filtering header and rows' do + let(:filter) { Proc.new { |val, row, col| col == 1 ? val.capitalize : val }} + + it 'filters only rows' do + subject.render.should == <<-EOS.normalize + h1 H2 h3 + a1 A2 a3 + b1 B2 b3 + EOS + end + end + end + + context 'without header' do + let(:header) { nil } + + let(:filter) { Proc.new { |val, row, col| col == 1 ? val.capitalize : val } } + + it 'filters only rows' do + subject.render.should == <<-EOS.normalize + a1 A2 a3 + b1 B2 b3 + EOS + end + end +end
Add tests for renderer filter option.
diff --git a/db/migrate/20130416004342_make_url_longer.rb b/db/migrate/20130416004342_make_url_longer.rb index abc1234..def5678 100644 --- a/db/migrate/20130416004342_make_url_longer.rb +++ b/db/migrate/20130416004342_make_url_longer.rb @@ -1,6 +1,6 @@ class MakeUrlLonger < ActiveRecord::Migration def up - change_column :posts, :url, :text, :limit => 1000 + change_column :posts, :url, :text end def down
Remove limit for postgres's sake
diff --git a/lib/cb/circuit_breaker.rb b/lib/cb/circuit_breaker.rb index abc1234..def5678 100644 --- a/lib/cb/circuit_breaker.rb +++ b/lib/cb/circuit_breaker.rb @@ -4,19 +4,22 @@ @last_failure_time = nil end - def execute + def execute(&block) update_state raise Cb::CircuitBrokenException if @state == :open + do_execute(&block) + end + + private + + def do_execute yield rescue => e open - puts e raise Cb::CircuitBrokenException end - - private def update_state if @state == :open && @last_failure_time + 10 < Time.now
Move yielding to helper method
diff --git a/lib/cb/utils/validator.rb b/lib/cb/utils/validator.rb index abc1234..def5678 100644 --- a/lib/cb/utils/validator.rb +++ b/lib/cb/utils/validator.rb @@ -14,7 +14,7 @@ begin json = JSON.parse(response.response.body) - if json[json.keys[0]].empty? + if json.keys.any? && json[json.keys[0]].empty? return false end rescue JSON::ParserError
Check if keys exist before accessing
diff --git a/lib/configuration/yaml.rb b/lib/configuration/yaml.rb index abc1234..def5678 100644 --- a/lib/configuration/yaml.rb +++ b/lib/configuration/yaml.rb @@ -26,13 +26,13 @@ end def generate_segment(segment_config) - segment_style = generate_style(segment_config['style']) + segment_style = generate_style segment_config['style'] segment = create_segment(segment_config['type'], segment_style) segment_config.each do |key, value| next if key == 'type' || key == 'style' begin - segment.send key+'=', value + segment.send key + '=', value rescue NoMethodError => e #TODO: Log the exception puts e.message @@ -44,12 +44,12 @@ private :generate_segment def generate_style(style_config) - style = create_style(style_config['type']) + style = create_style style_config['type'] style_config.each do |key, value| next if key == 'type' begin - style.send key+'=', value + style.send key + '=', value rescue NoMethodError => e #TODO: Log the exception puts e.message
Remove useless parenthesis add white spaces
diff --git a/lib/hubdown/cli_parser.rb b/lib/hubdown/cli_parser.rb index abc1234..def5678 100644 --- a/lib/hubdown/cli_parser.rb +++ b/lib/hubdown/cli_parser.rb @@ -9,10 +9,10 @@ :long => "--output OUTPUT", :description => "Name of the file to write the converted markdown into" - option :preview, - :short => "-p", - :long => "--preview", - :description => "Displays the output markdown in a browser", + option :wrap, + :short => "-w", + :long => "--wrap", + :description => "Wrap the markdown in html and add styles", :boolean => true
Switch params to -w for wrap Decided that using bcat internally was a bad idea... wrap allows for a user to pipe the output to bcat
diff --git a/lib/modules/ga_tracker.rb b/lib/modules/ga_tracker.rb index abc1234..def5678 100644 --- a/lib/modules/ga_tracker.rb +++ b/lib/modules/ga_tracker.rb @@ -0,0 +1,48 @@+module GaTracker + DIMENSIONS = { + "IP": 1, + "user_id": 2, + "organisation_id": 3, + "country_iso_code": 4, + "method_name": 5, + "provider_organisation_id": 6, + "provider_country_iso_code": 7, + "request_parameters": 8, + "time": 9, + "response_time": 10, + "response_status": 11, + "failure_details": 12, + "timeout": 13 + } + METRICS = { + "counter": 1 + } + + def self.add_caller_identification(hit, request, user) + hit.add_custom_dimension(DIMENSIONS[:IP], request.ip) + hit.add_custom_dimension(DIMENSIONS[:user_id], user.id) + hit.add_custom_dimension(DIMENSIONS[:organisation_id], user.organisation_id) + hit.add_custom_dimension(DIMENSIONS[:country_iso_code], user.organisation.country.iso_code2) + end + + def self.add_request_meta_data(hit, request, action_name, params, adapter) + hit.add_custom_dimension(DIMENSIONS[:method_name], action_name) + hit.add_custom_dimension(DIMENSIONS[:provider_organisation_id], adapter.organisation_id) + hit.add_custom_dimension(DIMENSIONS[:provider_country_iso_code], adapter.organisation.country.iso_code2) + hit.add_custom_dimension(DIMENSIONS[:request_parameters], params) + hit.add_custom_dimension(DIMENSIONS[:time], Date.today) + end + + def self.add_response_meta_data(hit, response, response_time, exception) + hit.add_custom_dimension(DIMENSIONS[:response_time], response_time) + hit.add_custom_dimension(DIMENSIONS[:response_status], response.status) + failure_details = exception.present? ? exception.message : ' ' + hit.add_custom_dimension(DIMENSIONS[:failure_details], failure_details) + timeout = exception.present? ? exception.cause.is_a?(Tiemout::Error) : false + hit.add_custom_dimension(DIMENSIONS[:timeout], timeout) + end + + def self.add_metrics(hit) + hit.add_custom_metric(METRICS[:counter], 1) + end +end
Add module for GA tracking using custom dimensions and metrics
diff --git a/lib/pad_utils/pad_menu.rb b/lib/pad_utils/pad_menu.rb index abc1234..def5678 100644 --- a/lib/pad_utils/pad_menu.rb +++ b/lib/pad_utils/pad_menu.rb @@ -1,9 +1,9 @@ module PadUtils - # Prompts user with a cli yes/no menu. Returns true or false. + # Prompt user with a cli yes/no menu. Returns true or false. # question: the question to ask # default: the default answer - def self.yes_no_menu(question: "question?", default: "y") + def self.yes_no_menu(question: "Question?", default: "y") default_answer = default == "y" ? "(Y/n)" : "(y/N)" STDOUT.print "#{question} #{default_answer}: " answer = STDIN.gets.chomp.strip.downcase @@ -13,10 +13,42 @@ PadUtils.log("Error in yes/no menu", e) end - # Prompts user with a cli open question menu. Returns a string. + # Prompt user with a cli open question menu. Returns a string. def self.question_menu(question) STDOUT.print "#{question}: " STDIN.gets.chomp.strip end + # Prompt user with a multiple choice menu. Returns a symbol. Always! + # question: the question to ask + # choices: hash of choices (e.g. {b: "blue", r: "red"}) + # default: symbol representing the default value. If none provided, last + # value in choices hash will be used. + def self.choice_menu(question: "Question?", choices: {}, default: nil) + STDOUT.puts + STDOUT.puts "- #{question}" + default ||= choices.keys.last + default = default.to_sym + + i = 0 + choices.each do |key, value| + i += 1 + STDOUT.print "#{i}. #{value}" + STDOUT.print " (default)" if key.to_s == default.to_s + STDOUT.print "\n" + end + + STDOUT.print "Your choice (1-#{choices.length}): " + answer = STDIN.gets.chomp.strip.to_i + STDOUT.puts + if answer == 0 || answer > choices.length + return default + else + return choices.keys[answer - 1].to_sym + end + + rescue Exception => e + PadUtils.log("Error in choice menu", e) + end + end
Add a cli multiple choice menu builder
diff --git a/lib/postgres_db_driver.rb b/lib/postgres_db_driver.rb index abc1234..def5678 100644 --- a/lib/postgres_db_driver.rb +++ b/lib/postgres_db_driver.rb @@ -4,7 +4,7 @@ class PostgresDbDriver < ActiveRecordDbDriver def create_schema(schema_name) - if ActiveRecord::Base.connection.select_all("SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = '#{schema_name}'").empty? + if select_rows("SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = '#{schema_name}'").empty? execute("CREATE SCHEMA \"#{schema_name}\"") end end @@ -14,14 +14,12 @@ end def create_database(database, configuration) - execute(<<SQL) -CREATE DATABASE #{configuration.catalog_name} -SQL + execute("CREATE DATABASE \"#{configuration.catalog_name}\"") end def drop(database, configuration) - unless ActiveRecord::Base.connection.select_all("SELECT * FROM pg_catalog.pg_database WHERE datname = '#{configuration.catalog_name}'").empty? - execute("DROP DATABASE #{configuration.catalog_name}") + unless select_rows("SELECT * FROM pg_catalog.pg_database WHERE datname = '#{configuration.catalog_name}'").empty? + execute("DROP DATABASE \"#{configuration.catalog_name}\"") end end @@ -45,7 +43,7 @@ protected def current_database - ActiveRecord::Base.connection.select_value("SELECT DB_NAME()") + select_value("SELECT current_database()") end def control_database_name
Remove some ActiveRecord guff from driver
diff --git a/lib/superstore/railtie.rb b/lib/superstore/railtie.rb index abc1234..def5678 100644 --- a/lib/superstore/railtie.rb +++ b/lib/superstore/railtie.rb @@ -6,8 +6,14 @@ initializer "superstore.config" do |app| ActiveSupport.on_load :superstore do - pathnames = [Rails.root.join('config', 'superstore.yml'), Rails.root.join('config', 'cassandra.yml')] + pathnames = [Rails.root.join('config', 'cassandra.yml'), Rails.root.join('config', 'superstore.yml')] if pathname = pathnames.detect(&:exist?) + if pathname.basename.to_s == 'cassandra.yml' + warn "***********************" + warn "config/cassandra.yml is deprecated. Use config/superstore.yml" + warn "***********************" + end + config = ERB.new(pathname.read).result config = YAML.load(config)
Read from cassandra.yml first, then superstore.yml
diff --git a/OBSlider.podspec b/OBSlider.podspec index abc1234..def5678 100644 --- a/OBSlider.podspec +++ b/OBSlider.podspec @@ -0,0 +1,14 @@+Pod::Spec.new do |s| + s.name = 'OBSlider' + s.version = '1.1.0' + s.license = 'MIT' + s.summary = 'A UISlider subclass that adds variable scrubbing speeds.' + s.homepage = 'https://github.com/ole/OBSlider' + s.author = { 'Ole Begemann' => 'ole@oleb.net' } + s.source = { :git => 'https://github.com/ole/OBSlider.git', :tag => '1.1.0' } + s.description = 'OBSlider is a UISlider subclass that adds variable scrubbing speeds as seen in the Music app on iOS. While scrubbing the slider, the user can slow down the scrubbing speed by moving the finger up or down (away from the slider). The distance thresholds and slowdown factors can be freely configured by the developer.' + s.platform = :ios + s.source_files = 'OBSlider/**/*.{h,m}' + + s.requires_arc = true +end
Add Podspec file to this repository for reference
diff --git a/capistrano-jetty.gemspec b/capistrano-jetty.gemspec index abc1234..def5678 100644 --- a/capistrano-jetty.gemspec +++ b/capistrano-jetty.gemspec @@ -1,7 +1,6 @@ # coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require 'capistrano/jetty/version' Gem::Specification.new do |spec| spec.name = 'capistrano-jetty'
Remove require for removed version file
diff --git a/casing.gemspec b/casing.gemspec index abc1234..def5678 100644 --- a/casing.gemspec +++ b/casing.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'casing' - s.version = '0.3.0' + s.version = '0.3.1' s.summary = 'Convert the case of strings, symbols, and hash keys, including camelCase, PascalCase, and underscore_case' s.description = ' '
Package version is increased from 0.3.0 to 0.3.1
diff --git a/torm.gemspec b/torm.gemspec index abc1234..def5678 100644 --- a/torm.gemspec +++ b/torm.gemspec @@ -26,6 +26,6 @@ # Defaults from generating the gemspec spec.add_development_dependency 'bundler', '~> 1.7' - spec.add_development_dependency 'rake', '~> 10.0' + spec.add_development_dependency 'rake', '~> 12.3' spec.add_development_dependency 'minitest' end
Update rake requirement from ~> 10.0 to ~> 12.3 Updates the requirements on [rake](https://github.com/ruby/rake) to permit the latest version. - [Release notes](https://github.com/ruby/rake/releases) - [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc) - [Commits](https://github.com/ruby/rake/compare/rake-10.0.0...v12.3.3) Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/db/migrate/20140708123314_index_role_assignments_filtered_fields.rb b/db/migrate/20140708123314_index_role_assignments_filtered_fields.rb index abc1234..def5678 100644 --- a/db/migrate/20140708123314_index_role_assignments_filtered_fields.rb +++ b/db/migrate/20140708123314_index_role_assignments_filtered_fields.rb @@ -0,0 +1,15 @@+class IndexRoleAssignmentsFilteredFields < ActiveRecord::Migration + + def self.up + add_index :role_assignments, [:accessor_id, :accessor_type] + add_index :role_assignments, [:accessor_id, :accessor_type, :role_id] + add_index :role_assignments, [:resource_id, :resource_type] + add_index :role_assignments, [:resource_id, :resource_type, :role_id] + add_index :role_assignments, [:accessor_id, :accessor_type, :resource_id, :resource_type] + add_index :profiles, [:type] + add_index :profiles, [:visible] + add_index :profiles, [:enabled] + add_index :profiles, [:validated] + end + +end
Speed up role assignments fetch (ActionItem3197)
diff --git a/ptolemy.gemspec b/ptolemy.gemspec index abc1234..def5678 100644 --- a/ptolemy.gemspec +++ b/ptolemy.gemspec @@ -14,4 +14,6 @@ gem.name = "ptolemy" gem.require_paths = ["lib"] gem.version = Ptolemy::VERSION + + gem.add_dependency "treetop" end
Add Treetop as a dependency.
diff --git a/app/models/spree/gateway/pay_pal_express.rb b/app/models/spree/gateway/pay_pal_express.rb index abc1234..def5678 100644 --- a/app/models/spree/gateway/pay_pal_express.rb +++ b/app/models/spree/gateway/pay_pal_express.rb @@ -5,7 +5,7 @@ preference :password, :string preference :signature, :string - attr_accessible :preferred_login, :preferred_password, :preferred_signature + attr_accessible :preferred_login, :preferred_password, :preferred_signature, :preferred_mode def provider_class PayPal::SDK::Merchant::API.new @@ -13,7 +13,7 @@ def provider PayPal::SDK.configure( - :mode => "sandbox", # Set "live" for production + :mode => preferred_mode.present? ? preferred_mode : "sandbox", :username => preferred_login, :password => preferred_password, :signature => preferred_signature)
Allow mode to be set to 'live'
diff --git a/yard.gemspec b/yard.gemspec index abc1234..def5678 100644 --- a/yard.gemspec +++ b/yard.gemspec @@ -16,7 +16,7 @@ s.homepage = "http://yardoc.org" s.platform = Gem::Platform::RUBY s.files = Dir.glob("{docs,bin,lib,spec,templates,benchmarks}/**/*") + - ['LICENSE', 'LEGAL', 'README.md', 'Rakefile', '.yardopts', __FILE__] + ['CHANGELOG.md', 'LICENSE', 'LEGAL', 'README.md', 'Rakefile', '.yardopts', __FILE__] s.require_paths = ['lib'] s.executables = ['yard', 'yardoc', 'yri'] s.has_rdoc = 'yard'
Add CHANGELOG.md to gemspec files
diff --git a/view_data.rb b/view_data.rb index abc1234..def5678 100644 --- a/view_data.rb +++ b/view_data.rb @@ -24,3 +24,6 @@ end puts "average sentence length #{l.inject(:+) / 100.0}" + +lexicon_density = hash.map {|key,internal| internal.keys.count * 1.0 / hash.keys.count}.inject(:+) / hash.keys.count +puts "lexicon density #{lexicon_density}"
Add a script to get the "density" of the lexicon. Signed-off-by: Sam Phippen <e5a09176608998a68778e11d5021c871e8fae93c@googlemail.com>
diff --git a/db/migrate/20150417115252_create_questions.rb b/db/migrate/20150417115252_create_questions.rb index abc1234..def5678 100644 --- a/db/migrate/20150417115252_create_questions.rb +++ b/db/migrate/20150417115252_create_questions.rb @@ -3,7 +3,7 @@ create_table :questions do |t| t.string :question_desc, null: false t.references :survey, null: false - t.references :answer, null: false + t.references :answer t.timestamps end
Remove null false validation on answer for question migration
diff --git a/commands/helpful/wiki.rb b/commands/helpful/wiki.rb index abc1234..def5678 100644 --- a/commands/helpful/wiki.rb +++ b/commands/helpful/wiki.rb @@ -17,17 +17,21 @@ if list == 'armor' event << "<http://monsterhunteronline.in/armor/?search=#{search}>" else - wiki = IO.readlines("bot/wiki")[0] - wiki = wiki.split(",") - links = "" - wiki.grep(/#{list}/).each { |x| links << "<http://monsterhunteronline.in/#{x}> \n" } - if links.length > 2000 - event << "Output has too many characters. Please be more specific in your search." + if list == 'monsters' + event << "<http://monsterhunteronline.in/monsters>" else - if links.length < 1 - event << "I wasn't able to dig up any results. Please try something else!" + wiki = IO.readlines("bot/wiki")[0] + wiki = wiki.split(",") + links = "" + wiki.grep(/#{list}/).each { |x| links << "<http://monsterhunteronline.in/#{x}> \n" } + if links.length > 2000 + event << "Output has too many characters. Please be more specific in your search." else - event << links + if links.length < 1 + event << "I wasn't able to dig up any results. Please try something else!" + else + event << links + end end end end
Fix monsters search not outputting anything
diff --git a/app/values/scanned_resource_pdf/renderer.rb b/app/values/scanned_resource_pdf/renderer.rb index abc1234..def5678 100644 --- a/app/values/scanned_resource_pdf/renderer.rb +++ b/app/values/scanned_resource_pdf/renderer.rb @@ -4,7 +4,7 @@ delegate :manifest_builder, to: :scanned_resource_pdf def initialize(scanned_resource_pdf, path) @scanned_resource_pdf = scanned_resource_pdf - @path = path + @path = Pathname.new(path.to_s) end def render @@ -12,6 +12,7 @@ prawn_document.start_new_page layout: downloader.layout if index > 0 prawn_document.image downloader.download end + FileUtils.mkdir_p(path.dirname) prawn_document.render_file(path) File.open(path) end
Make necessary directories for PDF derivative.
diff --git a/app/views/api/v1/orders/_order.json.jbuilder b/app/views/api/v1/orders/_order.json.jbuilder index abc1234..def5678 100644 --- a/app/views/api/v1/orders/_order.json.jbuilder +++ b/app/views/api/v1/orders/_order.json.jbuilder @@ -1,3 +1,4 @@+json.id order.id json.user order.user_id json.status order.status json.pickup_time order.pickup_time.to_datetime.strftime("%H:%M:%S")
Add id to order view partial
diff --git a/example/setup-exp.rb b/example/setup-exp.rb index abc1234..def5678 100644 --- a/example/setup-exp.rb +++ b/example/setup-exp.rb @@ -0,0 +1,25 @@+defProperty('duration', 60*30, "Duration of the experiment") + +rt = defTopology("nodes", 'node1-1.grid.orbit-lab.org,node1-2.grid.orbit-lab.org,node1-3.grid.orbit-lab.org,node1-4.grid.orbit-lab.org,node2-1.grid.orbit-lab.org,node2-2.grid.orbit-lab.org,node3-1.grid.orbit-lab.org,node3-2.grid.orbit-lab.org,node3-3.grid.orbit-lab.org,node4-1.grid.orbit-lab.org,node4-3.grid.orbit-lab.org') do |t| + info "#{t.size} nodes in experiment." +end + +defGroup('Nodes', "nodes") do |node| + # Add application and set properties for it here. +end + +allGroups.net.w0 do |interface| + interface.mode = "adhoc" + interface.type = 'g' + interface.channel = "6" + interface.ip = "192.168.0.%index%" + interface.essid = "hello" +end + +onEvent(:ALL_UP_AND_INSTALLED) do |event| + info "All interfaces are set up." + # Start the group(s) applications here. + wait property.duration + info "Wrapping up now." + Experiment.done +end
Add example experiment to bring up all wireless resources.
diff --git a/example/template2.rb b/example/template2.rb index abc1234..def5678 100644 --- a/example/template2.rb +++ b/example/template2.rb @@ -5,7 +5,7 @@ } # Knock out the amazon builder as it is not needed by this template - t.builders['amazon'] = '--' + t.builders['amazon'] = '~~' # Define the provisioners t.provisioners = { @@ -29,7 +29,7 @@ }, 900 => { # Knockout the ec2 instance prep - 'prepare-ec2-instance' => '--' + 'prepare-ec2-instance' => '~~' } } end
Update template to reflect default knockout prefix change
diff --git a/Ambly.podspec b/Ambly.podspec index abc1234..def5678 100644 --- a/Ambly.podspec +++ b/Ambly.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = 'Ambly' s.version = '0.3.0' - s.license = { :type => 'Eclipse Public License 1.0', :file => 'LICENSE' } + s.license = { :type => 'Eclipse Public License 1.0', :file => 'epl.html' } s.summary = 'ClojureScript REPL into embedded JavaScriptCore' s.homepage = 'https://github.com/omcljs/ambly' s.author = 'omcljs'
Update license file in podspec
diff --git a/mongoid_genesis.gemspec b/mongoid_genesis.gemspec index abc1234..def5678 100644 --- a/mongoid_genesis.gemspec +++ b/mongoid_genesis.gemspec @@ -2,17 +2,17 @@ $:.push File.expand_path("../lib", __FILE__) Gem::Specification.new do |s| - s.name = "mongoid_genesis" + s.name = "mongoid-genesis" s.version = '0.0.1' s.authors = ["Sebastien Rosa"] s.email = ["sebastien@demarque.com"] s.extra_rdoc_files = ["LICENSE", "README.md"] s.licenses = ["MIT"] - s.homepage = "http://www.demarque.com" + s.homepage = "https://github.com/demarque/mongoid-genesis" s.summary = "Preserve the original data of a model." s.description = "Mongoid Genesis will give you the ability to override attribute values without losing the original one." - s.rubyforge_project = "mongoid_genesis" + s.rubyforge_project = "mongoid-genesis" s.files = Dir.glob('{lib,spec}/**/*') + %w(LICENSE README.md Rakefile Gemfile) s.require_paths = ["lib"]
Use dash in the gem name
diff --git a/db_nazi.gemspec b/db_nazi.gemspec index abc1234..def5678 100644 --- a/db_nazi.gemspec +++ b/db_nazi.gemspec @@ -20,5 +20,4 @@ gem.add_development_dependency 'ritual', '~> 0.4.1' gem.add_development_dependency 'minitest', '~> 3.1.0' gem.add_development_dependency 'temporaries', '~> 0.3.0' - gem.add_development_dependency 'sqlite3', '~> 1.3.6' end
Remove sqlite3 from gemspec so Travis can run jdbcmysql build.
diff --git a/mtg_search_parser.gemspec b/mtg_search_parser.gemspec index abc1234..def5678 100644 --- a/mtg_search_parser.gemspec +++ b/mtg_search_parser.gemspec @@ -8,8 +8,7 @@ spec.version = MtgSearchParser::VERSION spec.authors = ["Donald Plummer"] spec.email = ["donald.plummer@gmail.com"] - spec.summary = %q{TODO: Write a short summary. Required.} - spec.description = %q{TODO: Write a longer description. Optional.} + spec.summary = %q{A ruby implementation of a MTG search string parser.} spec.homepage = "" spec.license = "MIT"
Add summary and homepage to gemspec
diff --git a/test/resque/test_helper.rb b/test/resque/test_helper.rb index abc1234..def5678 100644 --- a/test/resque/test_helper.rb +++ b/test/resque/test_helper.rb @@ -1,5 +1,3 @@-require 'minitest/autorun' - require 'simplecov' SimpleCov.start do add_filter do |source_file| @@ -9,6 +7,8 @@ require 'coveralls' Coveralls.wear! + +require 'minitest/autorun' ## # Add helper methods to Kernel
Move MiniTest initialization after SimpleCov. This ensures accurate reporting.
diff --git a/yard.gemspec b/yard.gemspec index abc1234..def5678 100644 --- a/yard.gemspec +++ b/yard.gemspec @@ -10,6 +10,7 @@ s.summary = "A documentation tool for consistent and usable documentation in Ruby." s.files = Dir.glob("{bin,lib,test,templates}/**/*") + ['LICENSE.txt', 'README.pdf'] s.executables = [ 'yardoc', 'yri' ] + s.add_dependency 'erubis' # s.has_rdoc = false end
Add erubis as gem dep git-svn-id: d05f03cd96514e1016f6c27423275d989868e1f9@798 a99b2113-df67-db11-8bcc-000c76553aea
diff --git a/MCHTTPRequestLogger.podspec b/MCHTTPRequestLogger.podspec index abc1234..def5678 100644 --- a/MCHTTPRequestLogger.podspec +++ b/MCHTTPRequestLogger.podspec @@ -11,5 +11,5 @@ s.ios.deployment_target = '5.0' s.osx.deployment_target = '10.7' - s.dependency 'AFNetworking', '>= 1.0' + s.dependency 'AFNetworking', '~> 1.0' end
Fix a possible issue with AFNetworking dependency versioning.