diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/rapns.gemspec b/rapns.gemspec index abc1234..def5678 100644 --- a/rapns.gemspec +++ b/rapns.gemspec @@ -17,4 +17,9 @@ s.require_paths = ["lib"] s.add_dependency "multi_json", "~> 1.0" -end + + if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby' + s.add_dependency "jruby-openssl" + s.add_dependency "activerecord-jdbc-adapter" + end +end
Add JRuby deps to gemspec.
diff --git a/Ascii85.gemspec b/Ascii85.gemspec index abc1234..def5678 100644 --- a/Ascii85.gemspec +++ b/Ascii85.gemspec @@ -15,7 +15,8 @@ s.rubyforge_project = "Ascii85" - s.add_development_dependency "rspec", ">= 2.4.0" + s.add_development_dependency "bundler", ">= 1.0.0" + s.add_development_dependency "rspec", ">= 2.4.0" s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
Add development dependency on bundler
diff --git a/Ascii85.gemspec b/Ascii85.gemspec index abc1234..def5678 100644 --- a/Ascii85.gemspec +++ b/Ascii85.gemspec @@ -16,7 +16,7 @@ s.rubyforge_project = "Ascii85" s.add_development_dependency "bundler", ">= 1.0.0" - s.add_development_dependency "rspec", ">= 2.4.0" + s.add_development_dependency "minitest",">= 2.6.0" s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- spec/*`.split("\n")
Gemspec: Replace dependency on rspec with minitest
diff --git a/Ascii85.gemspec b/Ascii85.gemspec index abc1234..def5678 100644 --- a/Ascii85.gemspec +++ b/Ascii85.gemspec @@ -15,6 +15,8 @@ s.rubyforge_project = "Ascii85" + s.add_development_dependency "rspec" + s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
Add rspec as development dependency
diff --git a/lib/chef/knife/solo_bootstrap.rb b/lib/chef/knife/solo_bootstrap.rb index abc1234..def5678 100644 --- a/lib/chef/knife/solo_bootstrap.rb +++ b/lib/chef/knife/solo_bootstrap.rb @@ -19,7 +19,7 @@ # Use (some) options from prepare and cook commands self.options = SoloPrepare.options - [:librarian, :sync_only, :why_run].each { |opt| option opt, SoloCook.options[opt] } + [:berkshelf, :librarian, :sync_only, :why_run].each { |opt| option opt, SoloCook.options[opt] } def run validate!
Include `:berkshelf` option to SoloBootstrap
diff --git a/lib/chef/knife/solo_bootstrap.rb b/lib/chef/knife/solo_bootstrap.rb index abc1234..def5678 100644 --- a/lib/chef/knife/solo_bootstrap.rb +++ b/lib/chef/knife/solo_bootstrap.rb @@ -2,10 +2,17 @@ require 'chef/knife/solo_cook' require 'chef/knife/solo_prepare' +require 'knife-solo/kitchen_command' +require 'knife-solo/ssh_command' + class Chef class Knife class SoloBootstrap < Knife + include KnifeSolo::KitchenCommand + include KnifeSolo::SshCommand + deps do + KnifeSolo::SshCommand.load_deps SoloPrepare.load_deps SoloCook.load_deps end @@ -17,12 +24,19 @@ [:sync_only, :why_run].each { |opt| option opt, SoloCook.options[opt] } def run + validate! + prepare = command_with_same_args(SoloPrepare) prepare.run cook = command_with_same_args(SoloCook) cook.config[:skip_chef_check] = true cook.run + end + + def validate! + validate_first_cli_arg_is_a_hostname! + validate_kitchen! end def command_with_same_args(klass)
Add validation to solo bootstrap class Otherwise the error message will display help message for an underlying subcommand.
diff --git a/test/workers/music_graph_worker_test.rb b/test/workers/music_graph_worker_test.rb index abc1234..def5678 100644 --- a/test/workers/music_graph_worker_test.rb +++ b/test/workers/music_graph_worker_test.rb @@ -1,6 +1,6 @@-require_relative 'test_helper' -class MusicGraphWorkerTest < MiniTest::Unit::TestCase - def test_example - skip "add some examples to (or delete) #{__FILE__}" - end -end +# require_relative 'test_helper' +# class MusicGraphWorkerTest < MiniTest::Unit::TestCase +# def test_example +# skip "add some examples to (or delete) #{__FILE__}" +# end +# end
Comment out test for Musicgraph
diff --git a/lib/github_cli/commands/forks.rb b/lib/github_cli/commands/forks.rb index abc1234..def5678 100644 --- a/lib/github_cli/commands/forks.rb +++ b/lib/github_cli/commands/forks.rb @@ -5,6 +5,9 @@ namespace :fork + option :sort, :type => :string, :aliases => ["-s"], + :banner => '<sort-category>', + :desc => 'Sort by newest, oldest or watchers' desc 'list <user> <repo>', 'Lists forks' long_desc <<-DESC List repository forks @@ -13,24 +16,21 @@ sort - newest, oldest, watchers, default: newest DESC - method_option :sort, :type => :string, :aliases => ["-s"], - :desc => 'Sort by newest, oldest or watchers', - :banner => '<sort-category>' def list(user, repo) - if options[:sort] - options[:params]['sort'] = options[:sort] - end - Fork.all user, repo, options[:params], options[:format] + params = options[:params].dup + params['sort'] = options[:sort] if options[:sort] + + Fork.all user, repo, params, options[:format] end + option :org, :type => :string, + :desc => 'Organization login. The repository will be forked into this organization.' desc 'create <user> <repo>', 'Create a new fork' - method_option :org, :type => :string, - :desc => ' Organization login. The repository will be forked into this organization.' def create(user, repo) - if options[:org] - options[:params]['org'] = options[:org] - end - Fork.create user, repo, options[:params], options[:format] + params = options[:params].dup + params['organization'] = options[:org] if options[:org] + + Fork.create user, repo, params, options[:format] end end # Forks
Update fork commands to take options.
diff --git a/lib/harvestman/crawler/parser.rb b/lib/harvestman/crawler/parser.rb index abc1234..def5678 100644 --- a/lib/harvestman/crawler/parser.rb +++ b/lib/harvestman/crawler/parser.rb @@ -29,7 +29,7 @@ @document = doc end else - @document.send("at_#{path_type}", path) + @document.send(path_type, path) end end end
Fix method sent to Nokogiri document
diff --git a/spec/fixture/phone.rb b/spec/fixture/phone.rb index abc1234..def5678 100644 --- a/spec/fixture/phone.rb +++ b/spec/fixture/phone.rb @@ -1,7 +1,7 @@ # forward declaration -#class Person -# include Neo4j::NodeMixin -#end +class Person + include Neo4j::NodeMixin +end class Phone include Neo4j::NodeMixin
Add forward declaration of Person since RSpec might fail otherwise
diff --git a/lib/smart_management/searcher.rb b/lib/smart_management/searcher.rb index abc1234..def5678 100644 --- a/lib/smart_management/searcher.rb +++ b/lib/smart_management/searcher.rb @@ -7,7 +7,9 @@ def call if @options.present? - @options.each { |k, v| @data = @data.where("#{k} like ?", "%#{v}%") } + @options.each do |k, v| + @data = @data.where("#{@data.table_name}.#{k} like ?", "%#{v}%") + end end @data end
Add the table name in query
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -3,13 +3,14 @@ license "MIT" description "Installs/Configures New Relic" long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version "0.3.7" +version "0.3.8" supports "ubuntu" supports "debian" supports "centos" supports "redhat" supports "fedora" +supports "scientific" depends "apache2" depends "php"
Add support for scientific linux
diff --git a/lib/clamshell/cli.rb b/lib/clamshell/cli.rb index abc1234..def5678 100644 --- a/lib/clamshell/cli.rb +++ b/lib/clamshell/cli.rb @@ -26,8 +26,8 @@ raise "File: #{file}, not found" unless File.exist?(file) if options["settings"] - file = options["settings"] - raise "Settings file: #{file}, not found." unless File.exist?(file) + settings_file = options["settings"] + raise "Settings file: #{settings_file}, not found." unless File.exist?(settings_file) end Clamshell.settings = Settings.new(options["settings"])
Rename variable name to avoid scope issues
diff --git a/Casks/webstorm-bundled-jdk.rb b/Casks/webstorm-bundled-jdk.rb index abc1234..def5678 100644 --- a/Casks/webstorm-bundled-jdk.rb +++ b/Casks/webstorm-bundled-jdk.rb @@ -4,7 +4,7 @@ url "https://download.jetbrains.com/webstorm/WebStorm-#{version}-custom-jdk-bundled.dmg" name 'WebStorm' - homepage 'http://www.jetbrains.com/webstorm/' + homepage 'https://www.jetbrains.com/webstorm/' license :commercial app 'WebStorm.app'
Update WebStorm bundled JDK homepage URL to HTTPS
diff --git a/Casks/plex-home-theater.rb b/Casks/plex-home-theater.rb index abc1234..def5678 100644 --- a/Casks/plex-home-theater.rb +++ b/Casks/plex-home-theater.rb @@ -1,11 +1,11 @@ cask :v1 => 'plex-home-theater' do - version '1.2.3.378-0c92ed32' + version '1.3.5.431-7966a4df' if Hardware::CPU.is_32_bit? - sha256 '7c2fd9541104346478fd7fa1e34c609bc6494202e82dcb91533b1e3931add232' + sha256 'c7ee467979ae0401db98cb7e8309a1bf81380c224d5c1bf58437f792ac95a0dd' url "https://downloads.plex.tv/plex-home-theater/#{version}/PlexHomeTheater-#{version}-macosx-i386.zip" else - sha256 '329011165014f20110c258049ab5de6c84a2957065e7dd01dfa68599ae9d4810' + sha256 '02f36aba9524563e6f67309d63f6c48e75ebaaddb5dc8dc825609f67d1701552' url "https://downloads.plex.tv/plex-home-theater/#{version}/PlexHomeTheater-#{version}-macosx-x86_64.zip" end
Upgrade Plex Home Theater to 1.2.3.378-0c92ed32
diff --git a/lib/json_streamer.rb b/lib/json_streamer.rb index abc1234..def5678 100644 --- a/lib/json_streamer.rb +++ b/lib/json_streamer.rb @@ -4,7 +4,7 @@ include Enumerable attr_reader :json_sequence - def initialize(model_class,ids, per_page = 1000, header = nil, footer = nil, &block) + def initialize(model_class,ids, per_page = 1000, header = '{ "items" : ', footer = '}', &block) @ids = ids @model_class = model_class @per_page = per_page <= 0 ? 1000 : per_page
Use predefined header and footer to return correct Json.
diff --git a/lib/pieces/server.rb b/lib/pieces/server.rb index abc1234..def5678 100644 --- a/lib/pieces/server.rb +++ b/lib/pieces/server.rb @@ -8,7 +8,8 @@ server = new(config.merge(app: app(config[:path]))) - listener = Listen.to("#{config[:path]}/config") do + listener = Listen.to("#{config[:path]}/config/", + "#{config[:path]}/app/views/") do print "Rebuilding #{config[:path]}... " Pieces::Builder.build(path: config[:path]) puts 'done.'
Add views to watched directories
diff --git a/lib/carrierwave/zipline.rb b/lib/carrierwave/zipline.rb index abc1234..def5678 100644 --- a/lib/carrierwave/zipline.rb +++ b/lib/carrierwave/zipline.rb @@ -15,7 +15,8 @@ if zip_file and is_zip?(zip_file) Zippy.open(zip_file.tempfile) do |zip| Zippy.list(zip_file.tempfile).sort().each do |name| - next if name =~ /__MACOSX|^\./ + puts name + next if name =~ /__MACOSX|^\.|\/$/ if yield(FilelessFile.new(zip[name], name)) nbr_files +=1 end
Handle folders (by skipping names ending in /)
diff --git a/app/controllers/instagram_controller.rb b/app/controllers/instagram_controller.rb index abc1234..def5678 100644 --- a/app/controllers/instagram_controller.rb +++ b/app/controllers/instagram_controller.rb @@ -10,13 +10,13 @@ def tags client = Instagram.client({}) tags = client.tag_search(params[:q]) - render json: tags + render json: {:tags => tags} end def recent_media client = Instagram.client({}) recent_media = client.tag_recent_media(params[:name], {:count => 10}) - render json: recent_media + render json: {:photos => recent_media} end end
Return Instagram results with tags and photos root keys.
diff --git a/jobs/progress.rb b/jobs/progress.rb index abc1234..def5678 100644 --- a/jobs/progress.rb +++ b/jobs/progress.rb @@ -1,7 +1,19 @@ SCHEDULER.every '1h', :first_in => Time.now + 10 do - q2_progress = Progress.new("sFETRDq0") - send_event('2014-q2-current-month', items: q2_progress.current_month) - send_event('2014-q2-rest-of-quarter', items: q2_progress.rest_of_quarter) - send_event('2014-q2-discuss', items: q2_progress.to_discuss) - send_event('2014-q2-done', items: q2_progress.done) + boards = { + "2013-q1" => "cEwY2JHh", + "2013-q2" => "m5Gxybf6", + "2013-q3" => "wkIzhRE3", + "2013-q4" => "5IZH6yGG", + "2014-q1" => "8P2Hgzlh", + "2014-q2" => "sFETRDq0" + } + + boards.each do |k,v| + progress = Progress.new(v) + send_event("#{k}-current-month", items: progress.current_month) + send_event("#{k}-rest-of-quarter", items: progress.rest_of_quarter) + send_event("#{k}-discuss", items: progress.to_discuss) + send_event("#{k}-done", items: progress.done) + end + end
Send jobs to all the widgets
diff --git a/lib/dimples/configuration.rb b/lib/dimples/configuration.rb index abc1234..def5678 100644 --- a/lib/dimples/configuration.rb +++ b/lib/dimples/configuration.rb @@ -18,7 +18,7 @@ def self.default_paths { - output: 'public', + output: './public', archives: 'archives', posts: 'archives/%Y/%m/%d', categories: 'archives/categories'
Change the default output path
diff --git a/lib/stream_helper.rb b/lib/stream_helper.rb index abc1234..def5678 100644 --- a/lib/stream_helper.rb +++ b/lib/stream_helper.rb @@ -1,6 +1,6 @@ require 'logger' require 'aws-sdk-core' require 'active_support/notifications' -require './lib/stream_reader/sequence_number_tracker' -require './lib/stream_reader/avro_parser' -require './lib/stream_reader/version' +require 'stream_reader/sequence_number_tracker' +require 'stream_reader/avro_parser' +require 'stream_reader/version'
Change file path for required files
diff --git a/lib/adauth/config.rb b/lib/adauth/config.rb index abc1234..def5678 100644 --- a/lib/adauth/config.rb +++ b/lib/adauth/config.rb @@ -35,11 +35,7 @@ private def work_out_base(s) - dcs = [] - s.split(/\./).each do |split| - dcs.push("dc=#{split}") - end - @base ||= dcs.join(', ') + @base ||= s.gsub(/\./,', dc=').gsub(/^/,"dc=") end end end
Change how adauth calculates the base
diff --git a/lib/blogstats/cli.rb b/lib/blogstats/cli.rb index abc1234..def5678 100644 --- a/lib/blogstats/cli.rb +++ b/lib/blogstats/cli.rb @@ -9,8 +9,10 @@ def run(args = ARGV) directory = Pathname.new(args.empty? ? Dir.getwd : args.first) - stats = directory.each_child.reject(&:directory?).map { |file| stats_for(file) }.reduce(&:merge) - puts stats + puts directory.each_child + .reject(&:directory?) + .map(&method(:stats_for)) + .reduce(&:merge) end private
Reformat main file processing pipeline
diff --git a/app/lib/guaranteed_income_calculator.rb b/app/lib/guaranteed_income_calculator.rb index abc1234..def5678 100644 --- a/app/lib/guaranteed_income_calculator.rb +++ b/app/lib/guaranteed_income_calculator.rb @@ -31,14 +31,14 @@ pot * TAXABLE_POT_PORTION end - # https://pensionwise-guidance.atlassian.net/wiki/pages/viewpage.action?pageId=34237 + # https://docs.google.com/spreadsheets/d/18oScEdlwr-msjdhFIotqpi4Z_6UnKR5xiQO5ctmEnRE/edit#gid=0 def annuity_rate case age - when 55...60 then 0.04389 - when 60...65 then 0.04850 - when 65...70 then 0.05492 - when 70...75 then 0.06199 - else 0.07293 + when 55...60 then 0.04377 + when 60...65 then 0.04843 + when 65...70 then 0.05496 + when 70...75 then 0.06212 + else 0.07225 end end end
Update annuity rates for February
diff --git a/app/serializers/news_feed_serializer.rb b/app/serializers/news_feed_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/news_feed_serializer.rb +++ b/app/serializers/news_feed_serializer.rb @@ -21,16 +21,9 @@ end def comment - first_substory = object.substories.first - # FIXME This logic doesn't belong in a serializer. Move it to the substory - # before_save hook. - if first_substory - formatted_comment = MessageFormatter.format_message first_substory.data["comment"] - first_substory.data["formatted_comment"] = formatted_comment - first_substory.save - first_substory.data["formatted_comment"] - end - end + first_substory = object.substories.first and first_substory.data["formatted_comment"] rescue nil + end + def include_comment? object.story_type == "comment" end
Comment formatting performing in model.
diff --git a/test/spec/test_service_base.rb b/test/spec/test_service_base.rb index abc1234..def5678 100644 --- a/test/spec/test_service_base.rb +++ b/test/spec/test_service_base.rb @@ -1,7 +1,6 @@ # encoding: utf-8 require 'rspec/given' -require 'amqp' require 'redis' require_relative 'helpers/connection'
Fix stale amqp require in tests
diff --git a/lib/nehm/playlist_manager.rb b/lib/nehm/playlist_manager.rb index abc1234..def5678 100644 --- a/lib/nehm/playlist_manager.rb +++ b/lib/nehm/playlist_manager.rb @@ -1,14 +1,14 @@ module Nehm module PlaylistManager def self.playlist - @temp_playlist || default_user_playlist || music_master_library + @temp_playlist || default_user_playlist || music_master_library unless OS.linux? end def self.set_playlist loop do playlist = HighLine.new.ask('Enter name of default iTunes playlist to which you want add tracks (press Enter to set it to default iTunes Music library)') - # If entered nothing, unset iTunes playlist + # If entered nothing, unset iTunes playlist if playlist == '' Cfg[:playlist] = nil puts Paint['Default iTunes playlist unset', :green]
Add check for OS in PlaylistManager.playlist
diff --git a/lib/rake/rake_test_loader.rb b/lib/rake/rake_test_loader.rb index abc1234..def5678 100644 --- a/lib/rake/rake_test_loader.rb +++ b/lib/rake/rake_test_loader.rb @@ -2,19 +2,23 @@ # Load the test files from the command line. argv = ARGV.select do |argument| - case argument - when /^-/ then - argument - when /\*/ then - FileList[argument].to_a.each do |file| - require File.expand_path file + begin + case argument + when /^-/ then + argument + when /\*/ then + FileList[argument].to_a.each do |file| + require File.expand_path file + end + + false + else + require File.expand_path argument + + false end - - false - else - require File.expand_path argument - - false + rescue LoadError => e + abort "\n#{e.message}\n\n" end end
Make LoadError from running tests more obvious
diff --git a/lib/tasks/redmine_audit.rake b/lib/tasks/redmine_audit.rake index abc1234..def5678 100644 --- a/lib/tasks/redmine_audit.rake +++ b/lib/tasks/redmine_audit.rake @@ -17,6 +17,11 @@ # TODO: stop load twice this .rake file. if !Rake::Task.task_defined?(:audit) task audit: :environment do + users = (ENV['users'] || '').split(',').each(&:strip!) + if users.empty? + raise 'need to specify environment variable: users' + end + # TODO: More better if requires mailer automatically. require_dependency 'mailer' require_relative '../../app/models/mailer.rb' @@ -24,7 +29,6 @@ redmine_ver = Redmine::VERSION advisories = RedmineAudit::Database.new.advisories(redmine_ver.to_s) if advisories.length > 0 - users = (ENV['users'] || '').split(',').each(&:strip!) Mailer.with_synched_deliveries do Mailer.unfixed_advisories_found(redmine_ver, advisories, users).deliver end
Raise if 'users' environment variable does not be specified.
diff --git a/lib/deep_cover/ast_root.rb b/lib/deep_cover/ast_root.rb index abc1234..def5678 100644 --- a/lib/deep_cover/ast_root.rb +++ b/lib/deep_cover/ast_root.rb @@ -1,21 +1,16 @@ require_relative 'node' module DeepCover - class AstRoot - include Node::Mixin - include HasTracker - include HasChild - + class AstRoot < Node has_tracker :root has_child main: Node, flow_entry_count: :root_tracker_hits, rewrite: -> { "#{covered_code.trackers_setup_source};%{root_tracker};%{node}" } - attr_reader :covered_code, :children + attr_reader :covered_code def initialize(child_ast, covered_code) @covered_code = covered_code - @children = augment_children([child_ast]) - super() + super(nil, parent: nil, base_children: [child_ast]) end end end
Make AstRoot a full node
diff --git a/MetasploitPenTestScript.gemspec b/MetasploitPenTestScript.gemspec index abc1234..def5678 100644 --- a/MetasploitPenTestScript.gemspec +++ b/MetasploitPenTestScript.gemspec @@ -20,7 +20,7 @@ spec.add_dependency 'msfrpc-client', '1.0.2' - spec.add_development_dependency 'bundler', '~> 1.6' + spec.add_development_dependency 'bundler' spec.add_development_dependency 'rake' - spec.add_development_dependency 'rspec', '3.0.0' + spec.add_development_dependency 'rspec' end
Remove version pinning for RSpec and Bundler to try to fix TravisCI
diff --git a/db/migrate/20160922152700_convert_legacy_facilitators_to_participants.rb b/db/migrate/20160922152700_convert_legacy_facilitators_to_participants.rb index abc1234..def5678 100644 --- a/db/migrate/20160922152700_convert_legacy_facilitators_to_participants.rb +++ b/db/migrate/20160922152700_convert_legacy_facilitators_to_participants.rb @@ -6,7 +6,11 @@ .where.not(user_id: ToolMember.where(tool_type: 'Assessment', role: ToolMember.member_roles[:participant]).select(:user_id)) .each { |tool_member| - ToolMember.create!(user: tool_member.user, tool: tool_member.tool, role: ToolMember.member_roles[:participant]) + ToolMember.create!(user: tool_member.user, + tool: tool_member.tool, + role: ToolMember.member_roles[:participant], + invited_at: tool_member.tool.created_at, + reminded_at: nil) } end end
Revise legacy facilitator import script
diff --git a/Aardvark.podspec b/Aardvark.podspec index abc1234..def5678 100644 --- a/Aardvark.podspec +++ b/Aardvark.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = 'Aardvark' s.version = '1.0.2' - s.license = 'Apache' + s.license = 'Apache License, Version 2.0' s.summary = 'Aardvark is a library that makes it dead simple to create actionable bug reports.' s.homepage = 'https://github.com/square/Aardvark' s.authors = 'Square'
Use proper license name in the podspec
diff --git a/spec/cocaine/command_line/runners/fake_runner_spec.rb b/spec/cocaine/command_line/runners/fake_runner_spec.rb index abc1234..def5678 100644 --- a/spec/cocaine/command_line/runners/fake_runner_spec.rb +++ b/spec/cocaine/command_line/runners/fake_runner_spec.rb @@ -10,13 +10,13 @@ it 'can tell if a command was run' do subject.call("some command", :environment) subject.call("other command", :other_environment) - subject.ran?("some command").should == true - subject.ran?("no command").should == false + subject.ran?("some command").should eq true + subject.ran?("no command").should eq false end it 'can tell if a command was run even if shell options were set' do subject.call("something 2>/dev/null", :environment) - subject.ran?("something").should == true + subject.ran?("something").should eq true end end
Change assertion syntax to match Thoughtbot style guide
diff --git a/lib/mixpanel_magic_lamp.rb b/lib/mixpanel_magic_lamp.rb index abc1234..def5678 100644 --- a/lib/mixpanel_magic_lamp.rb +++ b/lib/mixpanel_magic_lamp.rb @@ -8,4 +8,6 @@ # Include and extend the magic lamp Mixpanel.extend MixpanelMagicLamp::ClassMethods -Mixpanel.include MixpanelMagicLamp::InstanceMethods +class Mixpanel::Client + include MixpanelMagicLamp::InstanceMethods +end
Include as a private method call
diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb index abc1234..def5678 100644 --- a/app/controllers/activities_controller.rb +++ b/app/controllers/activities_controller.rb @@ -6,7 +6,7 @@ if params[:activity] @activity = Activity.new(params[:activity]) else - @activity = Activity.new(:when => Date.today) + @activity = Activity.new(:date => Date.today) end # Nested resources support
Fix attribute name in activites controller.
diff --git a/lib/puppet/type/ethtool.rb b/lib/puppet/type/ethtool.rb index abc1234..def5678 100644 --- a/lib/puppet/type/ethtool.rb +++ b/lib/puppet/type/ethtool.rb @@ -3,20 +3,33 @@ newparam(:name) { :tso => 'if TCP segment offload is enabled or disabled for this interface', + :lro => 'Specifies whether large receive offload should be enabled or disabled', :ufo => 'Specifies whether UDP fragmentation offload should be enabled or disabled', :gso => 'Specifies whether generic segmentation offload should be enabled', :gro => 'Specifies whether generic receive offload should be enabled', - :sg => 'Specifies whether scatter-gather should be enabled', + :sg => 'Specifies whether scatter_gather should be enabled', :checksum_rx => 'Specifies whether RX checksumming should be enabled', :checksum_tx => 'Specifies whether TX checksumming should be enabled', + :autonegotiate => 'if autonegotiation is enabled or disabled', :autonegotiate_tx => 'if autonegotiation is enabled or disabled for transmitting', - :autonegotiate_rx => 'if autonegotiation is enabled or disabled for receiving' + :autonegotiate_rx => 'if autonegotiation is enabled or disabled for receiving', + :adaptive_tx => '', + :adaptive_rx => '', }.each do |name, description| newproperty(name) do - desc description + desc description if description != '' newvalue(:enabled) newvalue(:disabled) end end + # FIXME - docs + {:rx_usecs => '', :rx_frames => '', :rx_usecs_irq => '', :rx_frames_irq => '', :tx_usecs => '', :tx_frames => '', :tx_usecs_irq => '', :tx_frames_irq => '', + :stats_block_usecs => '', :pkt_rate_low => '', :rx_usecs_low => '', :rx_frames_low => '', :tx_usecs_low => '', :tx_frames_low => '', :pkt_rate_high => '', + :rx_usecs_high => '', :rx_frames_high => '', :tx_usecs_high => '', :tx_frames_high => '', :sample_interval=> ''}.each do |prop_name, prop_docs| + newproperty(prop_name) do + desc prop_docs if prop_docs != '' + # FIXME Allow integers.. + end + end end
Fix up the type to know about the new arguments
diff --git a/lib/skroutz_api/parsing.rb b/lib/skroutz_api/parsing.rb index abc1234..def5678 100644 --- a/lib/skroutz_api/parsing.rb +++ b/lib/skroutz_api/parsing.rb @@ -1,11 +1,11 @@ module SkroutzApi::Parsing def parse_body(response) - OpenStruct.new((JSON.parse response.body)[resource_prefix.singularize]) + model_name.new((JSON.parse response.body)[resource_prefix.singularize], client) end def parse_array(response, resource_prefix) (JSON.parse response.body)[resource_prefix].map do |resource| - OpenStruct.new(resource) + model_name.new(resource, client) end end
Make SkroutzApi::Parsing parse methods return SkroutzApi::Resource instances instead of Openstructs
diff --git a/qa/qa/page/main/groups.rb b/qa/qa/page/main/groups.rb index abc1234..def5678 100644 --- a/qa/qa/page/main/groups.rb +++ b/qa/qa/page/main/groups.rb @@ -5,7 +5,7 @@ def prepare_test_namespace return if page.has_content?(Runtime::Namespace.name) - click_on 'New Group' + click_on 'New group' fill_in 'group_path', with: Runtime::Namespace.name fill_in 'group_description',
Fix new group button label in GitLab QA specs
diff --git a/lib/spikor_forge/module.rb b/lib/spikor_forge/module.rb index abc1234..def5678 100644 --- a/lib/spikor_forge/module.rb +++ b/lib/spikor_forge/module.rb @@ -22,14 +22,19 @@ end # TODO: support others than GNU tar `tar -z -x -O --wildcards -f #{@path} '*/metadata.json' > #{@metadata_path}` + raise "Failed to extract metadata for #{@path}" unless $?.success? end # Read the metadata file def read_metadata - metadata_file = File.open(@metadata_path, 'r') - @metadata = JSON.parse metadata_file.read - metadata_file.close - @metadata + begin + metadata_file = File.open(@metadata_path, 'r') + @metadata = JSON.parse metadata_file.read + metadata_file.close + @metadata + rescue + raise "Failed to read metadata file #{@metadata_path}" + end end def dependencies
Raise errors if metadata extraction and reading fails
diff --git a/ast.gemspec b/ast.gemspec index abc1234..def5678 100644 --- a/ast.gemspec +++ b/ast.gemspec @@ -1,9 +1,10 @@ Gem::Specification.new do |s| s.name = 'ast' s.version = '2.0.0' + s.license = 'MIT' s.authors = ["Peter Zotov"] s.email = ["whitequark@whitequark.org"] - s.homepage = "https://github.com/whitequark/ast" + s.homepage = "https://whitequark.github.io/ast/" s.summary = %q{A library for working with Abstract Syntax Trees.} s.description = s.summary
Update license and homepage in gemspec.
diff --git a/lib/template/lib/routes.rb b/lib/template/lib/routes.rb index abc1234..def5678 100644 --- a/lib/template/lib/routes.rb +++ b/lib/template/lib/routes.rb @@ -4,7 +4,10 @@ use Pliny::Middleware::RequestID use Pliny::Middleware::RequestStore::Seed, store: Pliny::RequestStore use Pliny::Middleware::Metrics - use Pliny::Middleware::Instruments + use Pliny::Middleware::CanonicalLogLineEmitter, + emitter: -> (data) { + Pliny.log_without_context({ canonical_log_line: true }.merge(data) + } use Pliny::Middleware::RescueErrors, raise: Config.raise_errors? use Rack::Timeout, service_timeout: Config.timeout if Config.timeout > 0
Add CanonicalLogLineEmitter to template middleware stack
diff --git a/app/controllers/answers_controller.rb b/app/controllers/answers_controller.rb index abc1234..def5678 100644 --- a/app/controllers/answers_controller.rb +++ b/app/controllers/answers_controller.rb @@ -11,7 +11,7 @@ def create @answer=Answer.new(answer_params) if @answer.save - redirect_to :root + redirect_to @answer else render :new end
Add show route rediret to
diff --git a/app/controllers/fluentd_controller.rb b/app/controllers/fluentd_controller.rb index abc1234..def5678 100644 --- a/app/controllers/fluentd_controller.rb +++ b/app/controllers/fluentd_controller.rb @@ -6,7 +6,7 @@ end def new - @fluentd = Fluentd.new(Fluentd::Agent::Fluentd.default_options) # TODO: not fluentd type + @fluentd = Fluentd.new(Fluentd::Agent::Fluentd.default_options.merge(:api_endpoint => "http://localhost:24220/")) # TODO: not fluentd type end def create
Set default API endpoint for fluentd
diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index abc1234..def5678 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -20,7 +20,7 @@ private def set_member - @member = User.current.find_by_forum_name(params[:forum_name]) + @member = User.current.where("LOWER(users.forum_name) = ?", params[:forum_name].to_s.downcase).first end def redirect_without_member
Allow members to be found case insensitively
diff --git a/app/models/spree/payment_decorator.rb b/app/models/spree/payment_decorator.rb index abc1234..def5678 100644 --- a/app/models/spree/payment_decorator.rb +++ b/app/models/spree/payment_decorator.rb @@ -1,9 +1,10 @@-Spree::Payment.class_eval do - alias_method :original_update_order, :update_order - - def update_order - # without reload order was updated with inaccurate data - order.reload - original_update_order +module Spree + module PaymentDecorator + def update_order + # without reload order was updated with inaccurate data + order.reload && super + end end end + +Spree::Payment.prepend Spree::PaymentDecorator
Fix problem with stack level too deep on PaymentDecorator
diff --git a/app/models/spree/variant_decorator.rb b/app/models/spree/variant_decorator.rb index abc1234..def5678 100644 --- a/app/models/spree/variant_decorator.rb +++ b/app/models/spree/variant_decorator.rb @@ -3,8 +3,8 @@ alias_method :orig_price_in, :price_in def price_in(currency) - return orig_price_in(currency) unless product.master.sale_price.present? - Spree::Price.new(:variant_id => self.id, :amount => product.master.sale_price, :currency => currency) + return orig_price_in(currency) unless sale_price.present? + Spree::Price.new(:variant_id => self.id, :amount => self.sale_price, :currency => currency) end end end
Fix how we select sale price
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -10,7 +10,14 @@ link = page.css('td.cafename')[item_num].css('a').first['href'] members = page.css('td.member')[item_num].text.gsub(/,/, '').to_f members = 0 if members < 1 - Cafe.create(title: name, score: members, url: link) + @cafe = Cafe.where(title: name).first + if @cafe + @cafe.url = link + @cafe.score = members + @cafe.save + else + Cafe.create(title: name, score: members, url: link) + end item_num += 1 end page_num += 1
Update seed to check for existing db entries
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.1.5' + s.version = '0.1.6' s.summary = 'Client for the Raygun API using the Obsidian HTTP client' s.description = ' '
Package version is increased from 0.1.5 to 0.1.6
diff --git a/EEEOperationCenter.podspec b/EEEOperationCenter.podspec index abc1234..def5678 100644 --- a/EEEOperationCenter.podspec +++ b/EEEOperationCenter.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "EEEOperationCenter" - s.version = "0.1.0" + s.version = "0.0.1" s.summary = "Say 'no' to God-classes, chop them up with the operation center" s.homepage = "https://github.com/epologee/EEEOperationCenter" # s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2"
Reset version number to 0.0.1
diff --git a/app/controllers/contacts_controller.rb b/app/controllers/contacts_controller.rb index abc1234..def5678 100644 --- a/app/controllers/contacts_controller.rb +++ b/app/controllers/contacts_controller.rb @@ -7,6 +7,7 @@ include QrcodeHelper skip_before_action :allow_cors + skip_before_action :set_menu_elements, :set_adult_validation, :set_background, :set_newsletter_user, :set_search_autocomplete, :set_slider, :set_social_network, :set_froala_key, only: :mapbox_popup # GET /contact # GET /contact.json
Add skip_before_action for mapbox_popup action in ContactsController
diff --git a/app/controllers/location_controller.rb b/app/controllers/location_controller.rb index abc1234..def5678 100644 --- a/app/controllers/location_controller.rb +++ b/app/controllers/location_controller.rb @@ -12,7 +12,7 @@ return unless params[:location] locations = WoeidHelper.search_by_name(params[:location]) - if !locations.nil? && locations.count == 1 + if locations && locations.count == 1 save_location locations[0].woeid else @locations = locations @@ -25,7 +25,7 @@ save_location params[:location] else locations = WoeidHelper.search_by_name(params[:location]) - if locations + if locations & locations.count == 1 save_location locations[0].woeid else redirect_to location_ask_path, alert: 'Hubo un error con el cambio de su ubicación. Inténtelo de nuevo.'
Normalize single result location check
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -9,4 +9,8 @@ ExpenseType.create(name: "Phone") ExpenseType.create(name: "Misc. 1") ExpenseType.create(name: "Misc. 2") -ExpenseType.create(name: "Misc. 3")+ExpenseType.create(name: "Misc. 3") + +PurchaseType.create(name:"small") +PurchaseType.create(name:"medium") +PurchaseType.create(name:"large")
Add purchase type seed data
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,9 +1,5 @@-# This file should contain all the record creation needed to seed the database with its default values. -# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). -# -# Examples: -# -# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) -# Mayor.create(name: 'Emanuel', city: cities.first) +# The Movietheater is the movie complex. +# Movietheater.create(name: "Chicago Movie Theater") -# Movietheater.create(name: "Chicago Movie Theater")+# Auditoriums are the individual theaters with the movietheater complex. +# Auditorium.create(movietheater_id: 1)
Add seed data for auditoriums.
diff --git a/app/controllers/requests_controller.rb b/app/controllers/requests_controller.rb index abc1234..def5678 100644 --- a/app/controllers/requests_controller.rb +++ b/app/controllers/requests_controller.rb @@ -4,7 +4,11 @@ job = Job.find(params[:job_id]) if @request.save Notification.create( - user_id: job.contractor.id, sender_id: current_user.id, job_id: params[:job_id], kind: "offer" + user_id: job.contractor.id, + sender_id: current_user.id, + request_id: @request.id, + job_id: params[:job_id], + kind: "offer" ) # UserMailer.request_made_email(job.contractor).deliver_now
Add request to notification when request is created
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -12,7 +12,7 @@ login_user if admin? flash[:notice] = "Login Successful!" - redirect_to users_path + redirect_to "/" else flash[:notice] = "Login Successful!" redirect_to profile_path(@user)
Change route on session controller for admin so that they are redirected to the homepage instead of a page listing all users
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,7 +1,27 @@-# This file should contain all the record creation needed to seed the database with its default values. -# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). -# -# Examples: -# -# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) -# Mayor.create(name: 'Emanuel', city: cities.first) +require 'nokogiri' +require 'open-uri' +require 'digest/md5' + +# seems to work http://stackoverflow.com/questions/1026337/how-do-i-get-link-to-an-image-on-wikipedia-from-the-infobox +def commons_page_to_image_url(file_url) + file_name = file_url[40..-1] + digest = Digest::MD5.hexdigest(URI.unescape(file_name)) + + "http://upload.wikimedia.org/wikipedia/commons/#{digest[0]}/#{digest[0..1]}/#{file_name}" +end + +doc = Nokogiri::XML(open('https://offenedaten.de/storage/f/2014-04-06T10%3A06%3A29.535Z/stadtmuseumberlin-stadtansichten.xml')).remove_namespaces! +doc.css('museumdat').each do |item| + place = Place::where({ + name: item.xpath('.//title[@pref="preferred"]').text, + description: item.xpath('.//title[@pref="alternate"]').text, + longitude: 0.0, + latitude: 0.0 + }).first_or_create + + Picture::where({ + url: commons_page_to_image_url(item.xpath('.//resourceID').text), + time: Date.new((item.xpath('.//earliestDate').empty? ? item.xpath('.//displayCreationDate').text : item.xpath('.//earliestDate').text).to_i), + place: place + }).first_or_create +end
Use the source xml to seed the db.
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -0,0 +1,44 @@+require 'open-uri' +require 'active_record/fixtures' + +related_identifier_types = [ + [ "DOI" ] + [ "URL" ] + [" arXiv "] + [" PMID "] + [" ARK "] + [" Handle "] + [" ISBN "] + [" ISTC"] + [" LISSN "] + [" LSID"] + [" PURL "] + [" URN "] +] + +related_identifier_types.each do |related_identifier_type| + StashDatacite::RelatedIdentifierType.create( related_identifier_type: related_identifier_type ) +end + + +relation_types = [ + [ " Cites" ] + [ " isCitedBy" ] + [ " Supplements" ] + [ " IsSupplementedBy" ] + [ " IsNewVersionOf" ] + [ " IsPreviousVersionOf" ] + [ " Continues" ] + [ " IsContinuedBy" ] + [ " IsPartOf" ] + [ " HasPart" ] + [ " IsDocumentedBy" ] + [ " Documents" ] + [ " IsIdenticalTo" ] + [ " IsDerivedFrom" ] + [ " IsSourceOf" ] +] + +relation_types.each do |relation_type| + StashDatacite::RelationType.create( relation_type: relation_type ) +end
Add Seed data to Load Relations and Related Identifiers
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,7 +1,15 @@-# This file should contain all the record creation needed to seed the database with its default values. -# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). -# -# Examples: -# -# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) -# Mayor.create(name: 'Emanuel', city: cities.first) +carrots = Crop.create( + name: 'carrots', + description: 'OMG CARROTS' + ) + +april = Pod.create( + month: Date.new(2013,4) + ) + +instr = Instruction.create( + crop: carrots, + pod: april, + summary: "It's time to plant the carrots, finally!", + detail: 'Bacon ipsum dolor sit amet nisi broccoli in voluptate broccoli broccoli irure broccoli broccoli broccoli dolor broccoli qui. Broccoli broccoli broccoli laboris ex elit pariatur broccoli broccoli broccoli adipisicing broccoli deserunt exercitation broccoli. Fugiat nostrud in aute anim consequat broccoli nisi eiusmod duis broccoli ut. Est broccoli broccoli broccoli esse, duis broccoli laborum broccoli cupidatat sunt officia. Broccoli broccoli anim elit aliquip, ex broccoli. Esse ut incididunt irure ut broccoli magna. Mollit non excepteur ullamco broccoli. Ut broccoli broccoli, broccoli tempor laborum broccoli. Broccoli adipisicing aute ea broccoli ut. Broccoli irure ex, culpa mollit broccoli reprehenderit elit broccoli veniam broccoli ut dolore pariatur proident. Ut laborum qui in sunt.' + )
Add seed data for testing
diff --git a/elk.gemspec b/elk.gemspec index abc1234..def5678 100644 --- a/elk.gemspec +++ b/elk.gemspec @@ -21,7 +21,7 @@ s.platform = Gem::Platform::RUBY s.extra_rdoc_files = ["README.MD", "MIT-LICENSE"] - s.required_ruby_version = ">= 2.4.0" + s.required_ruby_version = ">= 2.3.0" # elk dependencies s.add_dependency("rest-client", "~> 2.0")
Allow "Ruby" 2.3 to ensure jruby works I broke JRuby (at least 9.1, 9.2) in 0937423d5c039de2d4c0eb5443f00624d8140404
diff --git a/app/decorators/guest_book_decorator.rb b/app/decorators/guest_book_decorator.rb index abc1234..def5678 100644 --- a/app/decorators/guest_book_decorator.rb +++ b/app/decorators/guest_book_decorator.rb @@ -7,7 +7,7 @@ delegate_all def content - model.content.html_safe + model.content.html_safe if content? end def status
Add verification if content? before to display guest_book content
diff --git a/lib/syllabus/core.rb b/lib/syllabus/core.rb index abc1234..def5678 100644 --- a/lib/syllabus/core.rb +++ b/lib/syllabus/core.rb @@ -5,9 +5,6 @@ extend SpecInfra::Helper::DetectOS def self.run(args) - # XXX - extend SpecInfra::Helper.const_get(args[:type]) - backend = backend_for(args[:type]) config = Syllabus::Config.new_from_file(file: args[:file], backend: backend) logger = Syllabus::Logger.new(level: args[:level])
Remove unnecessary statement along with the update of specinfra
diff --git a/lib/data_mapper/mapper/relationship/builder/many_to_one.rb b/lib/data_mapper/mapper/relationship/builder/many_to_one.rb index abc1234..def5678 100644 --- a/lib/data_mapper/mapper/relationship/builder/many_to_one.rb +++ b/lib/data_mapper/mapper/relationship/builder/many_to_one.rb @@ -9,7 +9,7 @@ def fields super.merge({ source_key => target_key, - target_key => source_mapper.unique_alias(target_key, name) + target_key => DataMapper::Mapper.unique_alias(target_key, name) }) end end # class ManyToOne
Make the receiver of the call explicit
diff --git a/app/jobs/event_job.rb b/app/jobs/event_job.rb index abc1234..def5678 100644 --- a/app/jobs/event_job.rb +++ b/app/jobs/event_job.rb @@ -1,12 +1,11 @@ # A generic job for sending events to a user. # -# This class does not implement a usable action, so it must be implemented in a child class -# +# @abstract class EventJob < ActiveJob::Base include Rails.application.routes.url_helpers + # For link_to include ActionView::Helpers - include ActionView::Helpers::DateHelper - include Hydra::AccessControlsEnforcement + # For link_to_profile include HyraxHelper queue_as Hyrax.config.ingest_queue_name
Remove unused mixins from EventJob Reverts part of https://github.com/projecthydra-labs/hyrax/commit/a397bd67277bfc2ccb83e4a637e4a2f53850fd7a I don't think these mixins were ever doing anything useful
diff --git a/lib/govuk_content_models/require_all.rb b/lib/govuk_content_models/require_all.rb index abc1234..def5678 100644 --- a/lib/govuk_content_models/require_all.rb +++ b/lib/govuk_content_models/require_all.rb @@ -1,7 +1,7 @@ # Require this file in a non-Rails app to load all the things %w[ app/models app/validators app/repositories app/traits lib ].each do |path| - full_path = File.expand_path("../../../#{path}", __FILE__) + full_path = File.expand_path("#{File.dirname(__FILE__)}/../../#{path}", __FILE__) $LOAD_PATH.unshift full_path unless $LOAD_PATH.include?(full_path) end
Fix incorrect load path munging
diff --git a/app/models/ability.rb b/app/models/ability.rb index abc1234..def5678 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -3,13 +3,20 @@ include Sufia::Ability def featured_work_abilities - can [:create, :destroy, :update], FeaturedWork if user_groups.include? 'umg/up.dlt.scholarsphere-admin-viewers' + can [:create, :destroy, :update], FeaturedWork if admin_user? end def editor_abilities - if user_groups.include? 'umg/up.dlt.scholarsphere-admin-viewers' + if admin_user? can :create, TinymceAsset - can :update, ContentBlock + can [:create, :update], ContentBlock end + can :read, ContentBlock end + + private + + def admin_user? + user_groups.include? 'umg/up.dlt.scholarsphere-admin-viewers' + end end
Add abilities added to Sufia but missed in ScholarSphere due to overriding at the method level. (PR also put in to Sufia so that adopters no longer need to override methods like this.)
diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb index abc1234..def5678 100644 --- a/app/controllers/errors_controller.rb +++ b/app/controllers/errors_controller.rb @@ -5,6 +5,6 @@ before_filter :notify_airbrake_if_needed def notify_airbrake_if_needed - notify_airbrake(@exception) if @status_code >= 500 + notify_airbrake(@exception) if @status_code >= 500 && self.respond_to?(:notify_airbrake) end end
Check if airbrake is available
diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb index abc1234..def5678 100644 --- a/app/controllers/events_controller.rb +++ b/app/controllers/events_controller.rb @@ -1,7 +1,32 @@+# +# == EventsController +# class EventsController < ApplicationController + before_action :set_event, only: [:show] + before_action :event_module_enabled? + decorates_assigned :event, :comment + + # GET /events + # GET /events.json def index + @events = EventDecorator.decorate_collection(Event.online.order(created_at: :desc).page params[:page]) + seo_tag_index category end + # GET /event/1 + # GET /event/1.json def show + redirect_to @event, status: :moved_permanently if request.path_parameters[:id] != @event.slug + seo_tag_show event + end + + private + + def set_event + @event = Event.online.includes(:pictures, referencement: [:translations]).friendly.find(params[:id]) + end + + def event_module_enabled? + not_found unless @event_module.enabled? end end
Improve index and show action for Events controller
diff --git a/lib/tasks/import/covid19_shielding.rake b/lib/tasks/import/covid19_shielding.rake index abc1234..def5678 100644 --- a/lib/tasks/import/covid19_shielding.rake +++ b/lib/tasks/import/covid19_shielding.rake @@ -0,0 +1,35 @@+SERVICE_MAPPINGS = { + "shielding" => { lgsl: 1287, lgil: 8 }, + "vulnerable" => { lgsl: 1287, lgil: 6 }, + "volunteering" => { lgsl: 1113, lgil: 8 }, +}.freeze + +namespace :import do + desc "Imports COVID-19 shielding links from TheyHelpYou" + task covid19_shielding: :environment do + SERVICE_MAPPINGS.each do |type, codes| + puts "Fetching mappings for type #{type}, LGSL=#{codes[:lgsl]} LGIL=#{codes[:lgil]}" + service_interaction = ServiceInteraction.find_or_create_by( + service: Service.find_by(lgsl_code: codes[:lgsl]), + interaction: Interaction.find_by(lgil_code: codes[:lgil]), + ) + + response = Net::HTTP.get_response(URI.parse("https://www.theyhelpyou.co.uk/api/export-local-links-manager?type=#{type}")) + unless response.code_type == Net::HTTPOK + raise DownloadError, "Error downloading JSON in #{self.class}" + end + + data = JSON.parse(response.body) + puts "Got #{data.count} links" + data.each do |gss, url| + link = Link.find_or_initialize_by( + local_authority: LocalAuthority.find_by(gss: gss), + service_interaction: service_interaction, + ) + link.url = url + link.save! + end + puts "Done" + end + end +end
Add import script for COVID-19 URLs for vulnerable people We have been crowdsourcing URLs for council-provided Community Response Hubs on [TheyHelpYou][theyhelpyou]. We've been collecting and verifying these URLs on a publicly open [Google Sheet][sheet]. Updates to this sheet are automatically added to our database within 15 minutes. We get alerted to every change and manually check it for validity. In theory, there are three different needs that councils should be meeting: 1. Shielding extremely vulnerable people 2. Supporting non-shielded vulnerable people 3. Helping the public volunteer safely to meet the other two needs We've found that councils at the second tier are meeting these needs, at least in England. This means that they're being met by: - Counties (eg [Surrey][county]) - Unitary authorities (eg [Milton Keynes][uta]) - Districts/boroughs (eg [Manchester][district] or [Croydon][borough]) In practice, a lot of councils currently have all three needs on the same URL, certainly the first 2. Some of them have split volunteering information into different pages or even sites. We've exposed the URLs we have on a [new API endpoint][api] suitable for use with this import script: ``` GET https://www.theyhelpyou.co.uk/api/export-local-links-manager?type=shielding&nation=E ``` The API returns a JSON object mapping GSS codes to URLs, for example: ```json { "E06000047": "https://www.durham.gov.uk/covid19help", "W06000009": "https://www.pembrokeshire.gov.uk/coronavirus-covid-19-community-information/i-need-some-help", "E08000019": "https://www.sheffield.gov.uk/home/your-city-council/coronavirus-support-for-people", ... } ``` The `type` parameter must be one of `shielding`, `vulnerable` or `volunteering`. If we don't have a specific URL for a council for the requested type, the API will not return any data and that GSS code won't be included in the response. The `nation` parameter is optional to allow for filtering by Nation. If provided, it must be one of `E`, `N`, `S`, or `W`. The import script in this PR accesses this endpoint directly and fetches data for each type, then creates `Link`s for the relevant `ServiceInteraction` and `LocalAuthority`. For demonstration purposes, we've picked some LGSL and LGIL codes. We've used [LGSL code 1287][1287] (Current emergency situations - health) for shielded and vulnerable links, as it's intended for "an ongoing emergency related to public health such as a flu outbreak". For shielding we're using LGIL code 8, "Find information" as generally this is informational and councils will engage with residents directly. For help for non-shielded vulnerable people we've used LGIL code 6, "Providing access to community, professionals or business networks" as this is about requesting support. We've used [LGSL code 1113][1113] (Provision of information on volunteering opportunities available in the community) and LGIL code 8 for volunteering URLs. This combination isn't currently supported on GOV.UK, and Local Links Manager only has two links, neither of which are relevant. It may be better to create new emergency codes for this or to re-use others, in which case they're easy to change in a constant hash near the top of the rake task. As far as I'm aware, all that would be needed to get this data accessible via GOV.UK would be to create Local Transactions in Publisher for these LGSL and LGIL codes, then run this import script. The "tiering" in [Publisher's Local Services CSV][tiering] would also need updating to show that the LGSL codes chosen are provided by all tiers, followed by running the `import:add_service_tiers` rake task. I've not written an `Import` class for this like in `LocalAuthoritiesImporter` because I hope this is more of a one-off disposable task. Converting it to that format should be relatively straight-forward if that is preferred. [theyhelpyou]:https://www.theyhelpyou.co.uk/ [sheet]:https://docs.google.com/spreadsheets/d/1uwcEbPob7EcOKBe_H-OiYEP3fITjbZH-ccpc81fMO7s/edit#gid=1418426695 [county]:https://www.surreycc.gov.uk/people-and-community/emergency-planning-and-community-safety/coronavirus/community-support/need-help [uta]:https://www.milton-keynes.gov.uk/your-council-and-elections/coronavirus-support-and-information [district]:https://secure.manchester.gov.uk/info/100003/people_and_communities/7941/coronavirus_covid-19_-_manchester_community_response [borough]:https://www.croydon.gov.uk/healthsocial/phealth/coronavirus-information/support-for-hardship-or-difficulties [api]:https://github.com/boffbowsh/theyhelpyou/blob/master/api/export_for_llm.py [1287]:https://standards.esd.org.uk/?uri=service%2F1287 [1113]:https://standards.esd.org.uk/?uri=service%2F1113 [tiering]:https://github.com/alphagov/publisher/blob/master/data/local_services.csv
diff --git a/lib/weather_reporter/console_printer.rb b/lib/weather_reporter/console_printer.rb index abc1234..def5678 100644 --- a/lib/weather_reporter/console_printer.rb +++ b/lib/weather_reporter/console_printer.rb @@ -1,11 +1,31 @@ module WeatherReporter class ConsolePrinter + + ERROR_MESSAGE = 'Sorry weather report cannot generated' + def initialize(weather_obj) @weather_obj = weather_obj end def print_to_console - @weather_reporter + return error if error + end + + def error + error_code_present? ? error_message : empty_object + end + + def error_code_present? + @weather_obj.respond_to?(:error) + end + + def empty_object + ERROR_MESSAGE unless @weather_obj.location.current.respond_to?(:text) + end + + def error_message + error_message = @weather_obj.error.message.gsub('q', 'city') + error_message ? error_message : @weather_obj.error.message end end end
Handle error code from api Handle empty current object
diff --git a/app/mailers/account_mailer.rb b/app/mailers/account_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/account_mailer.rb +++ b/app/mailers/account_mailer.rb @@ -1,5 +1,5 @@ class AccountMailer < ActionMailer::Base - default from: "from@example.com" + default from: "clinton@dreisbach.us" def password_reset(reset) @user = reset.user
Update email to be an authorized one
diff --git a/app/processors/application.rb b/app/processors/application.rb index abc1234..def5678 100644 --- a/app/processors/application.rb +++ b/app/processors/application.rb @@ -2,7 +2,8 @@ def ActiveMessaging.logger @@logger ||= begin - logger = ActiveSupport::BufferedLogger.new(File.join(RAILS_ROOT, "log", "message_processing.log")) + io = RAILS_ENV == "production" ? File.join(RAILS_ROOT, "log", "message_processing.log") : STDOUT + logger = ActiveSupport::BufferedLogger.new(io) logger.level = ActiveSupport::BufferedLogger.const_get(Rails.configuration.log_level.to_s.upcase) if RAILS_ENV == "production" logger.auto_flushing = false
Make the poller log to stdout except for when we're in the production environment
diff --git a/app/services/channels/base.rb b/app/services/channels/base.rb index abc1234..def5678 100644 --- a/app/services/channels/base.rb +++ b/app/services/channels/base.rb @@ -3,12 +3,26 @@ module Channels class Base < Struct.new(:subscription, :event) def self.call(subscription, event) - new(subscription, event).call + instance = new(subscription, event) + + if ENV['SUPPRESS_NOTIFICATIONS'] + instance.suppress + else + instance.call + end end def call raise 'abstract - must subclass' end + + def suppress + Citygram::App.logger.info 'SUPPRESSED: class=%s subscription_id=%s event_id=%s' % [ + self.class.name, + subscription.id, + event.id + ] + end end end end
Add configuration option to suppress notifications
diff --git a/lib/handlers/uakari_delivery_handler.rb b/lib/handlers/uakari_delivery_handler.rb index abc1234..def5678 100644 --- a/lib/handlers/uakari_delivery_handler.rb +++ b/lib/handlers/uakari_delivery_handler.rb @@ -14,8 +14,8 @@ :track_clicks => settings[:track_clicks], :message => { :subject => message.subject, - :html => message.text_part.body, - :text => message.html_part.body, + :html => message.html_part.body, + :text => message.text_part.body, :from_name => settings[:from_name], :from_email => message.from.first, :to_email => message.to
Fix text <-> html oops
diff --git a/lib/infrataster/plugin/firewall/util.rb b/lib/infrataster/plugin/firewall/util.rb index abc1234..def5678 100644 --- a/lib/infrataster/plugin/firewall/util.rb +++ b/lib/infrataster/plugin/firewall/util.rb @@ -5,7 +5,7 @@ # Util class Util def self.address(node) - if node.respond_to?(:server) + if node.class == Resources::ServerResource node.server.address else node.to_s
Fix to accept String for node
diff --git a/lib/manageiq/providers/amazon/engine.rb b/lib/manageiq/providers/amazon/engine.rb index abc1234..def5678 100644 --- a/lib/manageiq/providers/amazon/engine.rb +++ b/lib/manageiq/providers/amazon/engine.rb @@ -13,6 +13,14 @@ def self.plugin_name _('Amazon Provider') end + + def self.init_loggers + $aws_log ||= Vmdb::Loggers.create_logger("aws.log") + end + + def self.apply_logger_config(config) + Vmdb::Loggers.apply_config_value(config, $aws_log, :level_aws) + end end end end
Move logger initialization and configuration into plugins
diff --git a/lib/qless/middleware/redis_reconnect.rb b/lib/qless/middleware/redis_reconnect.rb index abc1234..def5678 100644 --- a/lib/qless/middleware/redis_reconnect.rb +++ b/lib/qless/middleware/redis_reconnect.rb @@ -9,6 +9,7 @@ define_singleton_method :to_s do 'Qless::Middleware::RedisReconnect' end + define_singleton_method(:inspect, method(:to_s)) block ||= ->(job) { redis_connections }
Fix spec that was failing on 2.0.
diff --git a/lib/scanny/checks/xss/xss_send_check.rb b/lib/scanny/checks/xss/xss_send_check.rb index abc1234..def5678 100644 --- a/lib/scanny/checks/xss/xss_send_check.rb +++ b/lib/scanny/checks/xss/xss_send_check.rb @@ -4,17 +4,25 @@ # This can lead to download of private files from a server or to a XSS issue. class XssSendCheck < Check def pattern - pattern_send + [ + pattern_send, + pattern_send_with_param + ].join("|") end def check(node) - issue :high, warning_message, :cwe => 79 + if Machete.matches?(node, pattern_send) + issue :medium, warning_message, :cwe => [79, 115, 200] + elsif Machete.matches?(node, pattern_send_with_param) + issue :high, warning_message, :cwe => 201 + end end private def warning_message - "Send file or data to client in \"inline\" mode can lead to XSS issues." + "Send file or data to client in \"inline\" " + + "mode or with param can lead to XSS issues." end # send_file "file.txt", :disposition => "inline" @@ -28,10 +36,30 @@ any, HashLiteral< array = [ + any{even}, SymbolLiteral<value = :disposition>, - StringLiteral<string = "inline"> + StringLiteral<string = "inline">, + any{even} ] > + ] + > + > + EOT + end + + def pattern_send_with_param + <<-EOT + SendWithArguments< + name = :send_file | :send_data, + arguments = ActualArguments< + array = [ + any*, + SendWithArguments< + name = :[], + receiver = Send<name = :params> + >, + any* ] > >
Add implementation for param argument Update CWE and impacts
diff --git a/elk.gemspec b/elk.gemspec index abc1234..def5678 100644 --- a/elk.gemspec +++ b/elk.gemspec @@ -17,7 +17,6 @@ s.license = 'MIT' s.platform = Gem::Platform::RUBY - s.has_rdoc = true s.extra_rdoc_files = ["README.MD", "MIT-LICENSE"] s.required_ruby_version = ">= 2.3.0"
Remove deprecated has_rdoc= from gemspec Got this warning: > NOTE: Gem::Specification#has_rdoc= is deprecated with no replacement. It will be removed on or after 2018-12-01. > Gem::Specification#has_rdoc= called from /home/henrik/auctionet/tmp/devbox/gems/bundler/gems/elk-5e762f7b2ad2/elk.gemspec:20.
diff --git a/plugins/commands/plugin/command/repair.rb b/plugins/commands/plugin/command/repair.rb index abc1234..def5678 100644 --- a/plugins/commands/plugin/command/repair.rb +++ b/plugins/commands/plugin/command/repair.rb @@ -22,7 +22,7 @@ return if !argv raise Vagrant::Errors::CLIInvalidUsage, help: opts.help.chomp if argv.length > 0 - if options[:env_local] + if Vagrant::Plugin::Manager.instance.local_file action(Action.action_repair_local, env: @env) end
Use availablity of local plugins file instead of option
diff --git a/juxtapose.gemspec b/juxtapose.gemspec index abc1234..def5678 100644 --- a/juxtapose.gemspec +++ b/juxtapose.gemspec @@ -4,11 +4,11 @@ Gem::Specification.new do |spec| spec.name = "juxtapose" spec.version = Juxtapose::VERSION - spec.authors = ["Joe Lind", "Thomas Mayfield"] + spec.authors = ["Joe Lind", "Thomas Mayfield", "Jeffrey Chupp"] spec.email = ["thomas@terriblelabs.com"] spec.description = %q{Screenshot-based assertions for RubyMotion projects} spec.summary = %q{Screenshot-based assertions for RubyMotion projects} - spec.homepage = "" + spec.homepage = "https://github.com/terriblelabs/juxtapose" spec.license = "MIT" spec.files = `git ls-files`.split($/)
Add Jeffrey to authors and set homepage in gemspec.
diff --git a/learn-co.gemspec b/learn-co.gemspec index abc1234..def5678 100644 --- a/learn-co.gemspec +++ b/learn-co.gemspec @@ -19,6 +19,7 @@ spec.add_development_dependency "bundler", "~> 1.7" spec.add_development_dependency "rake", "~> 10.0" + spec.add_development_dependench "pry" spec.add_runtime_dependency "learn-test" spec.add_runtime_dependency "thor"
Add pry to dev dependencies
diff --git a/app/views/wash_with_soap/error.builder b/app/views/wash_with_soap/error.builder index abc1234..def5678 100644 --- a/app/views/wash_with_soap/error.builder +++ b/app/views/wash_with_soap/error.builder @@ -1,8 +1,8 @@ xml.instruct! -xml.Envelope "xmlns:xsi" => 'http://www.w3.org/2001/XMLSchema-instance', - :xmlns => 'http://schemas.xmlsoap.org/soap/envelope/' do - xml.Body do - xml.Fault :encodingStyle => 'http://schemas.xmlsoap.org/soap/encoding/' do +xml.tag! "soap:Envelope", "xmlns:soap" => 'http://schemas.xmlsoap.org/soap/envelope/', + "xmlns:xsi" => 'http://www.w3.org/2001/XMLSchema-instance' do + xml.tag! "soap:Body" do + xml.tag! "soap:Fault", :encodingStyle => 'http://schemas.xmlsoap.org/soap/encoding/' do xml.faultcode "Server", 'xsi:type' => 'xsd:QName' xml.faultstring error_message, 'xsi:type' => 'xsd:string' end
Remove namespace also from faultcode and faultstring
diff --git a/test/everypolitician/popolo/area_test.rb b/test/everypolitician/popolo/area_test.rb index abc1234..def5678 100644 --- a/test/everypolitician/popolo/area_test.rb +++ b/test/everypolitician/popolo/area_test.rb @@ -1,29 +1,40 @@ require 'test_helper' class AreaTest < Minitest::Test - def test_reading_popolo_areas - popolo = Everypolitician::Popolo::JSON.new( - areas: [{ id: '123', name: 'Newtown', type: 'constituency' }] - ) - area = popolo.areas.first - - assert_instance_of Everypolitician::Popolo::Areas, popolo.areas - assert_instance_of Everypolitician::Popolo::Area, area + def fixture + 'test/fixtures/estonia-ep-popolo-v1.0.json' end - def test_no_areas_in_popolo_data - popolo = Everypolitician::Popolo::JSON.new(other_data: [{ id: '123', foo: 'Bar' }]) - assert_equal true, popolo.areas.none? + def areas + @areas ||= Everypolitician::Popolo.read(fixture).areas end - def test_accessing_area_properties - popolo = Everypolitician::Popolo::JSON.new( - areas: [{ id: '123', name: 'Newtown', type: 'constituency' }] - ) - area = popolo.areas.first + def tartu + areas.find_by(name: 'Tartu linn') + end - assert_equal '123', area.id - assert_equal 'Newtown', area.name - assert_equal 'constituency', area.type + def test_areas_class + assert_instance_of Everypolitician::Popolo::Areas, areas + end + + def test_area_class + assert_instance_of Everypolitician::Popolo::Area, areas.first + end + + def test_id + assert_equal 'area/tartu_linn', tartu.id + end + + def test_name + assert_equal 'Tartu linn', tartu.name + end + + def test_type + assert_equal 'constituency', tartu.type + end + + def test_wikidata + skip unless tartu.respond_to? 'wikidata' + assert_equal 'Q3032626', tartu.wikidata end end
Switch Area test to real data
diff --git a/app/jobs/search_for_gist_job.rb b/app/jobs/search_for_gist_job.rb index abc1234..def5678 100644 --- a/app/jobs/search_for_gist_job.rb +++ b/app/jobs/search_for_gist_job.rb @@ -8,7 +8,7 @@ response.each do |comment| if JSON.parse(comment['body'])['keywords'].split(',').map(&:strip).include? keyword - SearchResult.create(comment: comment, search_id: search_id) + SearchResult.create(comment: comment.to_json, search_id: search_id) end end end
Make Search Result responce pretty
diff --git a/middleman-imageoptim.gemspec b/middleman-imageoptim.gemspec index abc1234..def5678 100644 --- a/middleman-imageoptim.gemspec +++ b/middleman-imageoptim.gemspec @@ -17,7 +17,7 @@ gem.require_paths = ["lib"] gem.add_dependency "middleman-core", [">= 3.0"] - gem.add_dependency "image_optim", "~> 0.9.1" + gem.add_dependency "image_optim", "~> 0.10.2" gem.add_development_dependency "rspec" gem.add_development_dependency "rake"
Bump image_optim from 0.9.1 to 0.10.2
diff --git a/app/screens/add_timer_screen.rb b/app/screens/add_timer_screen.rb index abc1234..def5678 100644 --- a/app/screens/add_timer_screen.rb +++ b/app/screens/add_timer_screen.rb @@ -20,10 +20,9 @@ :title => nil, :key => :primary_values, :rows => [{ - :key => :name, - :placeholder => "I learn to drive?", - :type => :string, - :auto_capitalization => :none + :key => :name, + :placeholder => "I learn to drive?", + :type => :string }, { :key => :start_time, :value => NSDate.alloc.init.timeIntervalSince1970.to_i,
Enable auto capitalization on form
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.30' + self.release = '0.31' self.base_url = 'https://facebook.github.io/react-native/docs/' self.root_path = 'getting-started.html' self.links = {
Update React Native documentation (0.31)
diff --git a/lib/bbq/rspec.rb b/lib/bbq/rspec.rb index abc1234..def5678 100644 --- a/lib/bbq/rspec.rb +++ b/lib/bbq/rspec.rb @@ -27,7 +27,11 @@ end ::RSpec.configure do |config| - config.include Feature, :type => :acceptance, :example_group => {:file_path => %r{spec/acceptance}} + if Gem::Version.new(::RSpec::Core::Version::STRING) >= Gem::Version.new('2.99') + config.include Feature, :type => :acceptance, :file_path => %r{spec/acceptance} + else + config.include Feature, :type => :acceptance, :example_group => {:file_path => %r{spec/acceptance}} + end config.include Matchers config.after :each, :type => :acceptance do ::Bbq::Session.pool.release
Fix deprecation warning for RSpec 3
diff --git a/lib/modables_dsl/dsl/arguments.rb b/lib/modables_dsl/dsl/arguments.rb index abc1234..def5678 100644 --- a/lib/modables_dsl/dsl/arguments.rb +++ b/lib/modables_dsl/dsl/arguments.rb @@ -33,11 +33,7 @@ # Else its a String, Integer, Boolean or Array. else - if args.include? :json - @args_h[meth] = ActiveSupport::JSON.encode(args.last) - else - @args_h[meth] = args.last - end + @args_h[meth] = args.last end end
Remove :json support for non-hash types
diff --git a/capistrano-team_notifications.gemspec b/capistrano-team_notifications.gemspec index abc1234..def5678 100644 --- a/capistrano-team_notifications.gemspec +++ b/capistrano-team_notifications.gemspec @@ -14,6 +14,7 @@ spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0") + spec.files -= ['images/screenshot.png'] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"]
Exclude screenshot from gem spec
diff --git a/lib/buffet/cli.rb b/lib/buffet/cli.rb index abc1234..def5678 100644 --- a/lib/buffet/cli.rb +++ b/lib/buffet/cli.rb @@ -23,7 +23,7 @@ end end.parse!(args) - specs = Buffet.extract_specs_from(opts.empty? ? 'spec' : opts) + specs = Buffet.extract_specs_from(opts.empty? ? ['spec'] : opts) runner = Runner.new runner.run specs
Fix Ruby 1.9 compatibility issue in options passing Wrap "spec" in an array so that Ruby 1.9 doesn't freak out when we call `#each` on it. Related story: http://www.pivotaltracker.com/story/show/32230263 (fixed) ("Fix Ruby 1.9 compatibility issue in options passing") Change-Id: I90e26c7469e9042913feffdeb897375a9cc30534 Reviewed-on: https://gerrit.causes.com/9315 Reviewed-by: Greg Hurrell <79e2475f81a6317276bf7cbb3958b20d289b78df@causes.com> Tested-by: Greg Hurrell <79e2475f81a6317276bf7cbb3958b20d289b78df@causes.com>
diff --git a/app/helpers/availability_zone_helper/textual_summary.rb b/app/helpers/availability_zone_helper/textual_summary.rb index abc1234..def5678 100644 --- a/app/helpers/availability_zone_helper/textual_summary.rb +++ b/app/helpers/availability_zone_helper/textual_summary.rb @@ -35,7 +35,7 @@ end def textual_block_storage_disk_capacity - return nil unless @record.respond_to?(:block_storage_disk_capacity) + return nil unless @record.respond_to?(:block_storage_disk_capacity) && !@record.ext_management_system.provider.nil? {:value => number_to_human_size(@record.block_storage_disk_capacity.gigabytes, :precision => 2)} end
Fix availability zone views when infra provider is not attached When an OpenStack infrastructure provider is not attached to the cloud provider, an "undefined method 'infra_ems'" error is thrown. This fix adds a nil check on provider. If it is nil, the disk capacity is not shown for the availability zone. Fixes BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1291774
diff --git a/script/collect_results.rb b/script/collect_results.rb index abc1234..def5678 100644 --- a/script/collect_results.rb +++ b/script/collect_results.rb @@ -0,0 +1,45 @@+require 'pathname' +require 'json' + +results_raw_path = ARGV[0] + +results_path = Pathname.new(results_raw_path) +all_stats_files = Dir.glob("#{results_path}/*.stats.json") +all_stats = all_stats_files.map {|f| JSON.parse(File.read(f)) } + +gems_count = all_stats.size +gems_which_finished_parsing = all_stats.select {|s| s.key?("parsing") } +gems_which_finished_building = all_stats.select {|s| s.key?("building") } +gems_which_finished_typing = all_stats.select {|s| s.key?("typing") } +gems_finished = gems_which_finished_typing.select {|s| s.key?("typing") }.size + +total_parsing_time = gems_which_finished_parsing.map {|s| s.fetch("parsing") }.sum +total_building_time = gems_which_finished_building.map {|s| s.fetch("building") }.sum +total_typing_time = gems_which_finished_typing.map {|s| s.fetch("typing") }.sum + +parsing_by_building = gems_which_finished_building.map {|s| s.fetch("parsing") / s.fetch("building") } +building_by_typing = gems_which_finished_typing.map {|s| s.fetch("building") / s.fetch("typing") } +typing_per_100k_nodes = gems_which_finished_typing.map {|s| (s.fetch("typing") * 100_000) / s.fetch("processed_nodes") } + +total_results = { + gems_count: gems_count, + gems_finished: gems_finished, + gems_finished_percent: gems_finished.to_f / gems_count, + total_parsing_time: total_parsing_time, + total_building_time: total_building_time, + total_typing_time: total_typing_time, + min_parsing_by_building: parsing_by_building.min, + max_parsing_by_building: parsing_by_building.max, + avg_parsing_by_building: parsing_by_building.sum / parsing_by_building.size, + min_building_by_typing: building_by_typing.min, + max_building_by_typing: building_by_typing.max, + avg_building_by_typing: building_by_typing.sum / building_by_typing.size, + min_typing_per_100k_nodes: typing_per_100k_nodes.min, + max_typing_per_100k_nodes: typing_per_100k_nodes.max, + avg_typing_per_100k_nodes: typing_per_100k_nodes.sum / typing_per_100k_nodes.size, +} + +require 'pp' +pp total_results + +puts all_stats_files.zip(all_stats).select {|_f, s| !s.key?("typing") }.map(&:first)
Add script which collect results
diff --git a/lib/travis/build/addons/srcclr.rb b/lib/travis/build/addons/srcclr.rb index abc1234..def5678 100644 --- a/lib/travis/build/addons/srcclr.rb +++ b/lib/travis/build/addons/srcclr.rb @@ -11,7 +11,24 @@ def before_finish sh.if('$TRAVIS_TEST_RESULT = 0') do sh.newline - sh.fold 'after_success' do + sh.fold 'srcclr' do + if api_token.empty? + sh.if "-z $SRCCLR_API_TOKEN" do + sh.echo "SRCCLR_API_TOKEN is empty and api_token is not set in .travis.yml", ansi: :red + end + sh.else do + sh.echo "Using SRCCLR_API_TOKEN", ansi: :yellow + end + else + sh.if "-n $SRCCLR_API_TOKEN" do + sh.echo "SRCCLR_API_TOKEN is set and is used instead of api_token in .travis.yml", ansi: :yellow + end + sh.else do + sh.echo "Using api_token in .travis.yml", ansi: :yellow + end + end + + sh.export 'SRCCLR_API_TOKEN', "${SRCCLR_API_TOKEN:-#{api_token}}", echo: false sh.echo "Running SourceClear agent", ansi: :yellow debug_env = debug? ? "env DEBUG=1" : "" @@ -23,6 +40,10 @@ def debug? config[:debug] end + + def api_token + config.fetch(:api_token, '') + end end end end
Read SourceClear API token from config If it's not empty, it defers to SRCCLR_API_TOKEN.
diff --git a/lib/tumugi/dag_result_reporter.rb b/lib/tumugi/dag_result_reporter.rb index abc1234..def5678 100644 --- a/lib/tumugi/dag_result_reporter.rb +++ b/lib/tumugi/dag_result_reporter.rb @@ -7,7 +7,7 @@ include Tumugi::Mixin::Listable def show(dag) - headings = ['Task', 'Requires', 'Parameters', 'State'] + headings = ['Task', 'Requires', 'Parameters', 'State', 'Elapsted'] Terminal::Table.new title: "Workflow Result", headings: headings do |t| dag.tsort.map.with_index do |task, index| proxy = task.class.merged_parameter_proxy @@ -19,7 +19,7 @@ "#{name}=#{val}" end t << :separator if index != 0 - t << [ task.id, requires.join("\n"), params.join("\n"), task.state ] + t << [ task.id, requires.join("\n"), params.join("\n"), task.state, task.elapsed_time ] end end end
Add elapsed time column to DAG result report
diff --git a/roo.gemspec b/roo.gemspec index abc1234..def5678 100644 --- a/roo.gemspec +++ b/roo.gemspec @@ -6,21 +6,20 @@ Gem::Specification.new do |spec| spec.name = 'roo' spec.version = Roo::VERSION - spec.authors = ['Thomas Preymesser', 'Hugh McGowan', 'Ben Woosley'] - spec.email = ['ruby.ruby.ruby.roo@gmail.com'] + spec.authors = ['Thomas Preymesser', 'Hugh McGowan', 'Ben Woosley', 'Oleksandr Simonov'] + spec.email = ['ruby.ruby.ruby.roo@gmail.com', 'oleksandr@simonov.me'] spec.summary = 'Roo can access the contents of various spreadsheet files.' spec.description = "Roo can access the contents of various spreadsheet files. It can handle\n* OpenOffice\n* Excelx\n* LibreOffice\n* CSV" spec.homepage = 'http://github.com/roo-rb/roo' spec.license = 'MIT' spec.files = `git ls-files -z`.split("\x0") - spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) + spec.files.reject! { |fn| fn.include?('test/files') } spec.require_paths = ['lib'] - spec.add_dependency 'nokogiri' - spec.add_dependency 'rubyzip', '~> 1' + spec.add_dependency 'nokogiri', '~> 1.5' + spec.add_dependency 'rubyzip', '~> 1.1', '>= 1.1.7' - spec.add_development_dependency 'rake', '>= 10.0' - spec.add_development_dependency 'minitest', '>= 5.4.3' + spec.add_development_dependency 'rake', '~> 10.1' + spec.add_development_dependency 'minitest', '~> 5.4', '>= 5.4.3' end
Update the gemspec and reduce the published gems size
diff --git a/config/initializers/01_app_config.rb b/config/initializers/01_app_config.rb index abc1234..def5678 100644 --- a/config/initializers/01_app_config.rb +++ b/config/initializers/01_app_config.rb @@ -1,11 +1,20 @@ module Cartodb def self.config return @config if @config + + begin config_file_hash = YAML.load_file("#{Rails.root}/config/app_config.yml") + rescue => e + raise "Missing or inaccessible config/app_config.yml: #{e.message}" + end @config ||= config_file_hash[Rails.env].try(:to_options!) if @config.blank? - raise "Can't find App configuration for #{Rails.env} environment on app_config.yml" + raise "Can't find App configuration for #{Rails.env} environment on config/app_config.yml" + end + + unless @config[:mandatory_keys].present? && (@config[:mandatory_keys].map(&:to_sym) - @config.keys).blank? + raise "Missing the following config keys on config/app_config.yml: #{(@config[:mandatory_keys].map(&:to_sym) - @config.keys).join(', ')}" end end
Raise error when important keys are missing fron app_config.yml
diff --git a/level_1/conditional_return_2/games.rb b/level_1/conditional_return_2/games.rb index abc1234..def5678 100644 --- a/level_1/conditional_return_2/games.rb +++ b/level_1/conditional_return_2/games.rb @@ -0,0 +1,15 @@+# Conditional Return II +# One of the most common places to use conditional returns is within methods. +# Refactor the code below, removing the search_result variable all together. +def search(games, search_term) + search_index = games.find_index(search_term) + search_result = if search_index + "Game #{search_term} found: #{games[search_index]} at index #{search_index}." + else + "Game #{search_term} not found." + end + return search_result +end + +games = ["Super Mario Bros.", "Contra", "Metroid", "Mega Man 2"] +puts search(games, "Contra")
Add a problem to be solved using conditional retur