diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/pvim/cli.rb b/lib/pvim/cli.rb index abc1234..def5678 100644 --- a/lib/pvim/cli.rb +++ b/lib/pvim/cli.rb @@ -2,9 +2,16 @@ module Pvim class CLI < Thor + include Thor::Actions + desc 'version', 'Prints version' def version puts Pvim::VERSION end + + desc 'pathogen', 'Get Pathogen from https://github.com/tpope/vim-pathogen' + def pathogen + get "https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim", "autoload/pathogen.vim" + end end end
Add 'pathogen' command for downloading pathogen from tpope/vim-pathogen repo
diff --git a/lib/toy_robot_simulator/command/matcher/matcher.rb b/lib/toy_robot_simulator/command/matcher/matcher.rb index abc1234..def5678 100644 --- a/lib/toy_robot_simulator/command/matcher/matcher.rb +++ b/lib/toy_robot_simulator/command/matcher/matcher.rb @@ -1,3 +1,6 @@+require './lib/toy_robot_simulator/command/matcher/base' +require './lib/toy_robot_simulator/command/matcher/place' + module Command module Matcher def self.parse(string)
Fix bug in Command::Matcher (hidden dependancy) This Module is dependant on ::Base and ::Place since it calls .constatns() on self, thus expects those constatnts to be defined. Solution is to require those modules at top of file. Better design is the way to solve this if more constants are to be defined in the future.
diff --git a/lib/travis/build/appliances/disable_ssh_roaming.rb b/lib/travis/build/appliances/disable_ssh_roaming.rb index abc1234..def5678 100644 --- a/lib/travis/build/appliances/disable_ssh_roaming.rb +++ b/lib/travis/build/appliances/disable_ssh_roaming.rb @@ -5,10 +5,14 @@ module Appliances class DisableSshRoaming < Base def apply - sh.cmd %(mkdir -p $HOME/.ssh) - sh.cmd %(chmod 0700 $HOME/.ssh) - sh.cmd %(touch $HOME/.ssh/config) - sh.cmd %(echo -e "Host *\n UseRoaming no\n" | cat - $HOME/.ssh/config > $HOME/.ssh/config.tmp && mv $HOME/.ssh/config.tmp $HOME/.ssh/config) + sh.cmd <<-EOF +if [ $(sw_vers -productVersion | cut -d . -f 2) -lt 12 ]; do + mkdir -p $HOME/.ssh + chmod 0700 $HOME/.ssh + touch $HOME/.ssh/config + echo -e "Host *\n UseRoaming no\n" | cat - $HOME/.ssh/config > $HOME/.ssh/config.tmp && mv $HOME/.ssh/config.tmp $HOME/.ssh/config +fi + EOF end end end
Fix an error where Sierra builds can't use git Due to the CVE earlier this year regarding "Roaming" mode in SSH, Apple has decided it's a good idea to just completely take out SSH roaming entirely, starting in macOS 10.12. Defining an invalid directive in the SSH configuration breaks Git, so we need to not set that directive. The "if OS minor version is < 12" syntax is weird, but is used elsewhere in the repo just the same way.
diff --git a/db/migrate/20151030145640_add_attachment_photo_to_drops.rb b/db/migrate/20151030145640_add_attachment_photo_to_drops.rb index abc1234..def5678 100644 --- a/db/migrate/20151030145640_add_attachment_photo_to_drops.rb +++ b/db/migrate/20151030145640_add_attachment_photo_to_drops.rb @@ -0,0 +1,11 @@+class AddAttachmentPhotoToDrops < ActiveRecord::Migration + def self.up + change_table :drops do |t| + t.attachment :photo + end + end + + def self.down + remove_attachment :drops, :photo + end +end
Update migration to add attachment photo to drop
diff --git a/app/models/package.rb b/app/models/package.rb index abc1234..def5678 100644 --- a/app/models/package.rb +++ b/app/models/package.rb @@ -13,4 +13,20 @@ class Package < ActiveRecord::Base belongs_to :revision + # Returns the comparator in the format needed for the XML + def xml_comp + comps = { + '>=' => 'ge', + '>' => 'gt', + '=' => 'eq', + '<=' => 'le', + '<' => 'lt', + '*<' => 'rlt', + '*<=' => 'rle', + '*>' => 'rgt', + '*>=' => 'rge' + } + + comps[self.comp] + end end
Add XML comparators to the Package model
diff --git a/lib/active_record/connection_adapters/oracle_enhanced_dirty.rb b/lib/active_record/connection_adapters/oracle_enhanced_dirty.rb index abc1234..def5678 100644 --- a/lib/active_record/connection_adapters/oracle_enhanced_dirty.rb +++ b/lib/active_record/connection_adapters/oracle_enhanced_dirty.rb @@ -18,6 +18,8 @@ # therefore need to convert empty string value to nil if old value is nil elsif column.type == :string && column.null && old.nil? value = nil if value == '' + elsif old == 0 && value.present? && value != '0' + value = nil else value = column.type_cast(value) end @@ -41,4 +43,4 @@ alias_method :field_changed?, :_field_changed? end end -end+end
Address 2 failues since numeric_changes_from_zero_to_string? method implemented at Rails.
diff --git a/lib/gems/pending/kubernetes/events/kubernetes_event_monitor.rb b/lib/gems/pending/kubernetes/events/kubernetes_event_monitor.rb index abc1234..def5678 100644 --- a/lib/gems/pending/kubernetes/events/kubernetes_event_monitor.rb +++ b/lib/gems/pending/kubernetes/events/kubernetes_event_monitor.rb @@ -5,7 +5,7 @@ def inventory # :service is required to handle also the case where @ems is Openshift - @inventory ||= @ems.connect(:service => EmsKubernetes.ems_type) + @inventory ||= @ems.connect(:service => ManageIQ::Providers::Kubernetes::ContainerManager.ems_type) end def watcher(version = nil)
Correct default view settings for renamed models
diff --git a/brew/cask/awsaml.rb b/brew/cask/awsaml.rb index abc1234..def5678 100644 --- a/brew/cask/awsaml.rb +++ b/brew/cask/awsaml.rb @@ -1,10 +1,10 @@ cask 'awsaml' do - version '2.0.0' - sha256 'cea42994cb52a71b8f811c38b25281604360b8216889e0f3217d4583cd7ead1a' + version '2.1.0' + sha256 '187f13a51cb28546fc04f127827e21b5d9c8515db577a3f5f463ac91648e512f' url "https://github.com/rapid7/awsaml/releases/download/v#{version}/awsaml-v#{version}-darwin-x64.zip" appcast 'https://github.com/rapid7/awsaml/releases.atom', - checkpoint: '786054d12bd083162881c42f3ec651187044c9d8ea5e30b485d6cba3c6e04c8c' + checkpoint: '600ea5739ae752442c890ece55e6d4841d05f93a64ac923dda771a30672ca3b3' name 'awsaml' homepage 'https://github.com/rapid7/awsaml'
Update homebrew cask for v2.1.0
diff --git a/app/models/glimage.rb b/app/models/glimage.rb index abc1234..def5678 100644 --- a/app/models/glimage.rb +++ b/app/models/glimage.rb @@ -1,5 +1,6 @@ class Glimage < ActiveRecord::Base belongs_to :project + has_many :comments attr_accessible :file, :filetype @@ -20,13 +21,13 @@ def filepath build_parents - File.join @repo.path, @project.name, file + File.join(@repo.path, @project.name, file) end def imagepath build_parents reponame = @repo.path.split(File::SEPARATOR).pop - File.join 'repos', reponame, @project.name, file + File::SEPARATOR + File.join('repos', reponame, @project.name, file) end # Returns thumbnail path
Add file separator to front of imagepath so that we can use it directly in html tags
diff --git a/api/spree_api.gemspec b/api/spree_api.gemspec index abc1234..def5678 100644 --- a/api/spree_api.gemspec +++ b/api/spree_api.gemspec @@ -22,6 +22,6 @@ s.add_dependency 'spree_core', s.version s.add_dependency 'rabl', '~> 0.13.1' s.add_dependency 'versioncake', '~> 3.4.0' - s.add_dependency 'fast_jsonapi', '~> 1.1.0' + s.add_dependency 'fast_jsonapi', '~> 1.2.0' s.add_dependency 'doorkeeper' end
Update fast_jsonapi gem to 1.2
diff --git a/app/admin/feedback.rb b/app/admin/feedback.rb index abc1234..def5678 100644 --- a/app/admin/feedback.rb +++ b/app/admin/feedback.rb @@ -21,6 +21,7 @@ f.input :newsletter_opt_in f.input :created_at, :as => :datepicker f.input :sent_at, :as => :datepicker + f.input :image, :hint => f.template.image_tag(f.object.image.url(:thumb)) end f.actions
Add image to Active Admin contact form
diff --git a/lib/health-data-standards/import/cda/procedure_importer.rb b/lib/health-data-standards/import/cda/procedure_importer.rb index abc1234..def5678 100644 --- a/lib/health-data-standards/import/cda/procedure_importer.rb +++ b/lib/health-data-standards/import/cda/procedure_importer.rb @@ -9,15 +9,13 @@ super(entry_finder) @entry_class = Procedure @value_xpath = nil - @incision_xpath = "./cda:entryRelationship[@typeCode='REFR']/cda:procedure[cda:code[@displayName='incision']]/cda:effectiveTime" end - + def create_entry(entry_element, nrh = NarrativeReferenceHandler.new) procedure = super extract_performer(entry_element, procedure) extract_site(entry_element, procedure) extract_negation(entry_element, procedure) - extract_incision_time(entry_element, procedure) procedure end @@ -32,12 +30,6 @@ procedure.site = extract_code(parent_element, "./cda:targetSiteCode") end - def extract_incision_time(parent_element, procedure) - if parent_element.at_xpath(@incision_xpath) - procedure.incision_time = HL7Helper.timestamp_to_integer(parent_element.at_xpath(@incision_xpath)['value']) - end - end - end end end
Revert "add incision_time to procedure imports". Use cat1 procedure performed importer instead. This reverts commit 4ff3382e1567b931670e39bada4f9f3a25759664.
diff --git a/files/default/ohai_plugins/local_passwd.rb b/files/default/ohai_plugins/local_passwd.rb index abc1234..def5678 100644 --- a/files/default/ohai_plugins/local_passwd.rb +++ b/files/default/ohai_plugins/local_passwd.rb @@ -0,0 +1,27 @@+provides 'etc', 'current_user' + +require 'etc' + +unless etc + etc Mash.new + + etc[:passwd] = Mash.new + etc[:group] = Mash.new + + File.readlines("/etc/passwd").each do |line| + splitline = line.chomp.split(":") + etc[:passwd][splitline[0]] = Mash.new(:dir => splitline[5], :uid => splitline[2].to_i, :gid => splitline[3].to_i, :shell => splitline[6], :gecos => splitline[4]) + end + + File.readlines("/etc/group").each do |line| + splitline = line.chomp.split(":") + g_members = [] + splitline[3].split(",").each{ |mem| g_members << mem } + etc[:group][splitline[0]] = Mash.new(:gid => splitline[2].to_i, :members => g_members) + end + +end + +unless current_user + current_user Etc.getlogin +end
Add ohai plugin for local passwords
diff --git a/spec/models/adjustment_metadata_spec.rb b/spec/models/adjustment_metadata_spec.rb index abc1234..def5678 100644 --- a/spec/models/adjustment_metadata_spec.rb +++ b/spec/models/adjustment_metadata_spec.rb @@ -1,3 +1,5 @@+require 'spec_helper' + describe AdjustmentMetadata do it "is valid when build from factory" do adjustment = create(:adjustment)
Fix uninitialized constant error when running model specs
diff --git a/test/test_response.rb b/test/test_response.rb index abc1234..def5678 100644 --- a/test/test_response.rb +++ b/test/test_response.rb @@ -4,20 +4,26 @@ class TestResponse < Test::Unit::TestCase - def setup - @response = SecondMate::Response.new( + def test_yaml_frontmatter + response = SecondMate::Response.new( "---\nstatus: 201\nheader:\n Foo: Baz\n---\nBody", {}, 200, {'Foo' => 'Bar'} - ) - end - - def test_yaml_frontmatter - response = @response.finish + ).finish assert_equal ['Body'], response.last.body assert_equal 'Baz', response[1]['Foo'] end + def test_templating + response = SecondMate::Response.new( + "<%= params['foo'] %>", + {'foo' => 'Bar'}, + 200, + {} + ).finish + assert_equal ['Bar'], response.last.body + end + end
Add unit test for response templating
diff --git a/test/controllers/pictures_controller_test.rb b/test/controllers/pictures_controller_test.rb index abc1234..def5678 100644 --- a/test/controllers/pictures_controller_test.rb +++ b/test/controllers/pictures_controller_test.rb @@ -25,6 +25,6 @@ delete :destroy, id: @picture end - assert_redirected_to pictures_path + assert_redirected_to root_path end end
Update test for picture destroy route. Pass tests
diff --git a/noodle.rb b/noodle.rb index abc1234..def5678 100644 --- a/noodle.rb +++ b/noodle.rb @@ -19,8 +19,11 @@ status 200 end - post '/nodes/:name' do - halt(422, "#{params[:name]} already exists.\n") if Node.find(params[:name]) + put '/nodes/:name' do + # TODO: Surely order matters + if node = Node.find(params[:name]) + node.delete + end options = nil begin @@ -35,6 +38,11 @@ status 201 end + post '/nodes/:name' do + halt(422, "#{params[:name]} already exists.\n") if Node.find(params[:name]) + call! env.merge("REQUEST_METHOD" => 'PUT') + end + get '/nodes/:name' do node = Node.find(params[:name]) body node.to_s unless node.nil? @@ -47,5 +55,12 @@ body "Deleted #{params[:name]}\n" status 200 end + + patch 'nodes/:name' do + end + + # TODO: Do? + #options '/nodes/:name' do + #end end
Add PUT stub OPTIONS and PATCH
diff --git a/helios.rb b/helios.rb index abc1234..def5678 100644 --- a/helios.rb +++ b/helios.rb @@ -6,7 +6,7 @@ sha1 "072461e7256fcbeb2013ded33a4f8eb427b1c9a9" version "0.8.279" - depends_on :java => "1.7" + depends_on :java => "1.7+" def install libexec.install "helios-tools-0.8.279-shaded.jar"
Allow Helios to run on Java8.
diff --git a/lib/bunny/heartbeat_sender.rb b/lib/bunny/heartbeat_sender.rb index abc1234..def5678 100644 --- a/lib/bunny/heartbeat_sender.rb +++ b/lib/bunny/heartbeat_sender.rb @@ -46,7 +46,8 @@ sleep @interval end rescue IOError => ioe - # ignored + puts ioe.message + stop rescue Exception => e puts e.message end
Stop heartbeat sender upon IOError It will be re-initialized by connection recovery if it's needed, otherwise it just protects us from having a busy loop.
diff --git a/test/test_encoding.rb b/test/test_encoding.rb index abc1234..def5678 100644 --- a/test/test_encoding.rb +++ b/test/test_encoding.rb @@ -7,6 +7,12 @@ Swift.db do |db| db.execute %q{drop table if exists users} db.execute %q{create table users(id serial, name text, primary key(id))} + + # Mysql on debian at least doesn't default to utf8. + if db.kind_of? Swift::DB::Mysql + db.execute %q{alter table users default character set utf8} + db.execute %q{alter table users change name name text charset utf8} + end end end
Set utf8 encoding for MySQL in encoding tests.
diff --git a/app/models/sample.rb b/app/models/sample.rb index abc1234..def5678 100644 --- a/app/models/sample.rb +++ b/app/models/sample.rb @@ -24,6 +24,19 @@ ) has_many :component_samples, through: :joins_as_compound_sample + attr_accessor :component_sample_uuids + + before_validation do + unless component_sample_uuids.nil? + discovered_component_samples = component_sample_uuids.map do |uuid_hash| + uuid = uuid_hash['uuid_sample_lims'] + Sample.with_uuid(uuid).first || raise(ActiveRecord::RecordNotFound, "No sample with uuid '#{uuid}'") + end + end + + self.component_samples = discovered_component_samples || [] + end + json do ignore( :new_name_format,
Add logic to Sample to handle component UUIDs in JSON message
diff --git a/config.rb b/config.rb index abc1234..def5678 100644 --- a/config.rb +++ b/config.rb @@ -0,0 +1,25 @@+# Require any additional compass plugins here. + +# Set this to the root of your project when deployed: +http_path = "/" +css_dir = "css" +sass_dir = "sass" +images_dir = "img" +javascripts_dir = "js" +fonts_dir = "fonts" + +output_style = :nested + +# To enable relative paths to assets via compass helper functions. Uncomment: +# relative_assets = true + +line_comments = false +color_output = false + + +# If you prefer the indented syntax, you might want to regenerate this +# project again passing --syntax sass, or you can uncomment this: +# preferred_syntax = :sass +# and then run: +# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass +preferred_syntax = :scss
Set up directory to work with Compass.
diff --git a/config.rb b/config.rb index abc1234..def5678 100644 --- a/config.rb +++ b/config.rb @@ -1,3 +1,3 @@ # Serve HTTP traffic on this port set :port, 4567 -set :host, "0.0.0.0" +set :bind, "0.0.0.0"
Use the right option to specify the address to bind to See http://www.sinatrarb.com/configuration.html
diff --git a/config.ru b/config.ru index abc1234..def5678 100644 --- a/config.ru +++ b/config.ru @@ -1,7 +1,6 @@ require './boot' require 'rack/static' -use Bouncer::Cacher require 'exception_mailer' if ENV['RACK_ENV'] == 'production' @@ -15,6 +14,8 @@ end end +use Bouncer::Cacher + # We need compatibility with redirector which serves its assets from '/''. # This is useful because then we can run redirector's tests unmodified against # Bouncer.
Put ExceptionMailer middleware outside of Cacher This way if Cacher raises an exception, it will get reported.
diff --git a/attributes/default.rb b/attributes/default.rb index abc1234..def5678 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -26,8 +26,7 @@ { "id" => "defaultHttpEndpoint", "host" => "*", - "httpport" => "9080", - "httpsport" => "9443" + "httpport" => "9080" } ], "includes" => [ "${shared.config.dir}/WicketSampleApp.xml" ]
Remove https port from wicket sample recipe as its not used.
diff --git a/attributes/install.rb b/attributes/install.rb index abc1234..def5678 100644 --- a/attributes/install.rb +++ b/attributes/install.rb @@ -1,7 +1,7 @@-default['traefik']['install']['version'] = '1.0.3' +default['traefik']['install']['version'] = '1.1.1' default['traefik']['install']['install_method'] = 'binary' default['traefik']['install']['binary']['version'] = node['traefik']['install']['version'] default['traefik']['install']['binary']['url'] = "https://github.com/containous/traefik/releases/download/v#{node['traefik']['install']['binary']['version']}/traefik_linux-amd64" -default['traefik']['install']['binary']['checksum'] = '784ede42d839c6e40781f59ddb63f20332be083d2e1f9bbd9593cf4f35a7cc0e' +default['traefik']['install']['binary']['checksum'] = nil default['traefik']['install']['binary']['path'] = '/usr/local/bin/traefik'
Update traefik to 1.1.1 and remove checksum You should add your own checksum
diff --git a/lib/travis/config/heroku/database.rb b/lib/travis/config/heroku/database.rb index abc1234..def5678 100644 --- a/lib/travis/config/heroku/database.rb +++ b/lib/travis/config/heroku/database.rb @@ -13,6 +13,7 @@ config = compact(Url.parse(url).to_h) config = deep_merge(DEFAULTS, config) unless config.empty? config[:pool] = pool.to_i if pool + config[:prepared_statements] = prepared_statements != 'false' if prepared_statements config end @@ -24,6 +25,10 @@ def pool env('DATABASE_POOL_SIZE', 'DB_POOL').compact.first + end + + def prepared_statements + env('PGBOUNCER_PREPARED_STATEMENTS').compact.first end def env(*keys)
Use PGBOUNCER_PREPARED_STATEMENTS env var to control prepared statements
diff --git a/testbot_cloud.gemspec b/testbot_cloud.gemspec index abc1234..def5678 100644 --- a/testbot_cloud.gemspec +++ b/testbot_cloud.gemspec @@ -18,7 +18,7 @@ s.require_paths = ["lib"] s.add_dependency "thor", ">0.14.5" - s.add_dependency "fog", "=0.7.2" + s.add_dependency "fog", ">0.7.2" s.add_dependency "activesupport", ">3.0.0" s.add_dependency "rake" s.add_development_dependency "bundler"
CHange gemspec to accept newer fog versions.
diff --git a/coder_wally.gemspec b/coder_wally.gemspec index abc1234..def5678 100644 --- a/coder_wally.gemspec +++ b/coder_wally.gemspec @@ -13,7 +13,7 @@ spec.homepage = 'https://github.com/gregstewart/coder_wally' spec.license = 'MIT' - spec.files = `git ls-files -z`.split('\x0') + 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.require_paths = ['lib']
Fix for weird string contains null byte message
diff --git a/attributes/default.rb b/attributes/default.rb index abc1234..def5678 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -1,2 +1,3 @@ default['cespi_application']['server_names']=[] -default['ncsd']['server_user']= 'nobody' + +default['nscd']['server_user']= 'nobody'
Fix type nscd / ncsd
diff --git a/attributes/default.rb b/attributes/default.rb index abc1234..def5678 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -24,4 +24,4 @@ # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -default[:aws_sdk_version] = "1.53.0" +default[:aws_sdk_version] = "1.64.0"
Update aws-sdk version to latest
diff --git a/attributes/jenkins.rb b/attributes/jenkins.rb index abc1234..def5678 100644 --- a/attributes/jenkins.rb +++ b/attributes/jenkins.rb @@ -1,3 +1,3 @@-default['jenkins']['master']['version'] = '1.619-1.1' +default['jenkins']['master']['version'] = '1.642-1.1' # LTS default['jenkins']['master']['jvm_options'] = '-Xms256m -Xmx256m' default['jenkins']['master']['listen_address'] = '127.0.0.1'
Set Jenkins to the latest LTS version
diff --git a/lib/lmgtfy_helper/view_helpers.rb b/lib/lmgtfy_helper/view_helpers.rb index abc1234..def5678 100644 --- a/lib/lmgtfy_helper/view_helpers.rb +++ b/lib/lmgtfy_helper/view_helpers.rb @@ -1,10 +1,14 @@ module LetMeGoogleThatForYouHelper module ViewHelpers - def lmgtfy_button phrase - link_to 'Let me google that for you... idiot...', - link(phrase), - class: 'btn btn-large lmgtfu-btn' + def lmgtfy_button phrase, label = nil + if label.present? + link_to label, link(phrase), class: 'btn btn-large lmgtfu-btn' + else + link_to 'Let me google that for you...', + link(phrase), + class: 'btn btn-large lmgtfu-btn' + end end def link phrase
Add custom label possibility, remove swear words
diff --git a/lib/pg_search/features/feature.rb b/lib/pg_search/features/feature.rb index abc1234..def5678 100644 --- a/lib/pg_search/features/feature.rb +++ b/lib/pg_search/features/feature.rb @@ -5,26 +5,30 @@ class Feature delegate :connection, :quoted_table_name, :to => :'@model' - def initialize(query, options, columns, model, normalizer) + def initialize(query, options, all_columns, model, normalizer) @query = query @options = options || {} - if @options[:only] - @columns = columns.select do - |c| [options[:only]].flatten.map(&:to_s).include? c.name - end - else - @columns = columns - end + @all_columns = all_columns @model = model @normalizer = normalizer end private - attr_reader :query, :options, :columns, :model, :normalizer + attr_reader :query, :options, :all_columns, :model, :normalizer def document columns.map { |column| column.to_sql }.join(" || ' ' || ") + end + + def columns + if options[:only] + all_columns.select do |column| + Array.wrap(options[:only]).map(&:to_s).include? column.name + end + else + all_columns + end end def normalize(expression)
Refactor :only column filtering to private method I prefer not to do any unnecessary calculations in #initialize, so that objects are easier to instantiate for unit testing.
diff --git a/lib/rdoc2mdoc/renderable_class.rb b/lib/rdoc2mdoc/renderable_class.rb index abc1234..def5678 100644 --- a/lib/rdoc2mdoc/renderable_class.rb +++ b/lib/rdoc2mdoc/renderable_class.rb @@ -11,7 +11,7 @@ end def short_description - comment.first_paragraph + truncate(comment.first_paragraph, 50) end def description @@ -32,5 +32,17 @@ def comment @comment ||= Comment.new(markup) end + + def truncate(string, max_length) + if string.length > max_length + omission = "..." + length_with_room_for_omission = max_length - omission.length + stop = string.rindex(/\s/, length_with_room_for_omission) || + length_with_room_for_omission + string[0...stop] + omission + else + string + end + end end end
Truncate short descriptions to 50 characters.
diff --git a/arm-none-eabi-gcc.rb b/arm-none-eabi-gcc.rb index abc1234..def5678 100644 --- a/arm-none-eabi-gcc.rb +++ b/arm-none-eabi-gcc.rb @@ -3,10 +3,10 @@ class ArmNoneEabiGcc < Formula homepage 'https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads' - version '6-2017-q1-update' + version '6-2017-q2-update' - url 'https://developer.arm.com/-/media/Files/downloads/gnu-rm/6_1-2017q1/gcc-arm-none-eabi-6-2017-q1-update-mac.tar.bz2' - sha256 'de4de95b09740272aa95ca5a43bb234ba29c323eddcad2ee34e901eebda910a2' + url 'https://developer.arm.com/-/media/Files/downloads/gnu-rm/6-2017q2/gcc-arm-none-eabi-6-2017-q2-update-mac.tar.bz2' + sha256 '7d3080514a2899d05fc55466cdc477e2448b6a62f536ffca3dd846822ff52900' def install system 'cp', '-r', 'arm-none-eabi', 'bin', 'lib', 'share', "#{prefix}/"
Update ARM gcc to `6-2017-q2-update`
diff --git a/lib/test_launcher/shell/runner.rb b/lib/test_launcher/shell/runner.rb index abc1234..def5678 100644 --- a/lib/test_launcher/shell/runner.rb +++ b/lib/test_launcher/shell/runner.rb @@ -15,6 +15,7 @@ @log_path = log_path %x{echo "" > #{log_path}} + Dir.chdir(%x[ git rev-parse --show-toplevel ].chomp) end def run(cmd, dir: ".")
Replace moving to git repo root as its required
diff --git a/lib/carto/export/map_statistics.rb b/lib/carto/export/map_statistics.rb index abc1234..def5678 100644 --- a/lib/carto/export/map_statistics.rb +++ b/lib/carto/export/map_statistics.rb @@ -0,0 +1,45 @@+module Carto + module Export + class MapStatistics + FILE_MODE = :file + STDOUT_MODE = :stdout + VALID_MODES = [FILE_MODE, STDOUT_MODE].freeze + + def initialize(mode: :file, path: nil, types: ['derived']) + assert_valid_mode(mode) + @mode = mode + @path = path || "/tmp/map_statistics_#{SecureRandom.urlsafe_base64}.csv" + @types = types + end + + def run! + @out = @mode == :file ? File.new(@path, 'w+') : STDOUT + result = [] + Carto::Visualization.where(type: @types).find_each { |vis| result << statistics_for_visualization(vis) } + @out.write(result[0].keys.join(', ') + "\n") + result.each { |row| @out.write(row.values.join(', ') + "\n") } + self + ensure + @out.close if @mode == :file + puts("You can see your results here: #{@out.path}") if @mode == :file + end + + private + + def statistics_for_visualization(visualization) + { + name: visualization.name, + total_data_layers: visualization.data_layers.count, + total_analyses: visualization.analyses.count, + user_account_type: visualization.user.account_type, + creation_date: visualization.created_at, + type: visualization.builder? ? 'builder' : 'editor' + } + end + + def assert_valid_mode(mode) + raise "Invalid mode: #{mode}" unless VALID_MODES.include?(mode) + end + end + end +end
Add file for exporting stats
diff --git a/lib/chalmersit/string_with_lang.rb b/lib/chalmersit/string_with_lang.rb index abc1234..def5678 100644 --- a/lib/chalmersit/string_with_lang.rb +++ b/lib/chalmersit/string_with_lang.rb @@ -0,0 +1,26 @@+class Chalmersit::StringWithLang + + attr_accessor :lang, :value + + def initialize(string) + @lang, @value = string.split(';', 2) + end + + def self.create(la, string) + self.new("#{la};#{string}") + end + + %w(sv en).each do |l| + define_singleton_method "create_#{l}" do |str| + self.create(l, str) + end + end + + def to_s + @value + end + + def original + "#{@lang};#{@value}" + end +end
Add datatype for strings with embedded language
diff --git a/lib/poseidon/producer_compression_config.rb b/lib/poseidon/producer_compression_config.rb index abc1234..def5678 100644 --- a/lib/poseidon/producer_compression_config.rb +++ b/lib/poseidon/producer_compression_config.rb @@ -10,7 +10,7 @@ if compression_codec @compression_codec = COMPRESSION_CODEC_MAP[compression_codec] if @compression_codec.nil? - raise ArgumentError, "Uknown compression codec: '#{compression_codec}' (accepted: #{COMPRESSION_CODEC_MAP.keys.inspect})" + raise ArgumentError, "Unknown compression codec: '#{compression_codec}' (accepted: #{COMPRESSION_CODEC_MAP.keys.inspect})" end else @compression_codec = nil
Correct a typo in an unknown codec message.
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -25,7 +25,7 @@ daemon_user(:graphite) standard_dirs('graphite') do - directories :conf_dir, :home_dir, :log_dir + directories :conf_dir, :data_dir, :home_dir, :log_dir end # Data onto a bulk device
Create the :data_dir as well
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -18,7 +18,7 @@ # Create directories app_dirs = [ - "#{node['sabnzbd']['install_dir']}" + "#{node['sabnzbd']['install_dir']}/#{node['sabnzbd']['version']}" ] app_dirs.each do |x|
Create the correct version directory
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -23,9 +23,9 @@ action :install end -chef_conf_dir = "/etc/hadoop/#{node[:hadoop][:conf_dir]}" +hadoop_conf_dir = "/etc/hadoop/#{node[:hadoop][:conf_dir]}" -directory chef_conf_dir do +directory hadoop_conf_dir do mode 0755 owner "root" group "root"
Rename to hadoop_conf_dir since we will have other configuration directories
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -23,7 +23,7 @@ source node['chef-vault']['gem_source'] version node['chef-vault']['version'] clear_sources true unless node['chef-vault']['gem_source'].nil? - compile_time true if Chef::Resource::ChefGem.method_defined?(:compile_time) + compile_time true end else chef_gem 'chef-vault' do
Remove chef 11 compatibility in chef_gem Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/config/schedule.rb b/config/schedule.rb index abc1234..def5678 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -21,7 +21,7 @@ set :output, 'log/cron.log' -every 15.minutes do +every 4.minutes do rake 'batch:update_constantly' end
Increase frequency of update cron job Now that updates are much faster, the wait between cron intervals is a significant portion of the time between updates. This way, it won't wait more than a few minutes between updates.
diff --git a/lib/endpoint_base/concerns/response_dsl.rb b/lib/endpoint_base/concerns/response_dsl.rb index abc1234..def5678 100644 --- a/lib/endpoint_base/concerns/response_dsl.rb +++ b/lib/endpoint_base/concerns/response_dsl.rb @@ -29,9 +29,10 @@ end def add_object(klass, object) - raise "object[:id] cannot be empty" unless object[:id].present? + raise 'object[id] cannot be empty' if object[:id].blank? && object['id'].blank? - @objects ||= Hash.new {|h,k| h[k] = []} + @objects ||= Hash.new { |h,k| h[k] = [] } + @objects[klass.to_s.pluralize] << object end end
Validate object[id] presence checking the id as a symbol and string
diff --git a/lib/faraday_persistent_excon/connection.rb b/lib/faraday_persistent_excon/connection.rb index abc1234..def5678 100644 --- a/lib/faraday_persistent_excon/connection.rb +++ b/lib/faraday_persistent_excon/connection.rb @@ -14,7 +14,7 @@ end def expired? - return false if last_use.nil? + return false if last_use.nil? || idle_timeout == 0 Time.now.utc - last_use > idle_timeout end
Disable idle_timeout when set to 0
diff --git a/lib/itamae/plugin/recipe/h2o/dependency.rb b/lib/itamae/plugin/recipe/h2o/dependency.rb index abc1234..def5678 100644 --- a/lib/itamae/plugin/recipe/h2o/dependency.rb +++ b/lib/itamae/plugin/recipe/h2o/dependency.rb @@ -3,7 +3,15 @@ when 'debian', 'ubuntu', 'mint' package 'wget' package 'cmake' + if node[:h2o][:mruby] == 'on' + package 'bison' + package 'ruby-dev' + end else package 'wget' package 'cmake' + if node[:h2o][:mruby] == 'on' + package 'bison' + package 'ruby' + end end
Add dependecy packages to enable mruby
diff --git a/lib/redis/rails/instrumentation.rb b/lib/redis/rails/instrumentation.rb index abc1234..def5678 100644 --- a/lib/redis/rails/instrumentation.rb +++ b/lib/redis/rails/instrumentation.rb @@ -30,4 +30,4 @@ end end -Redis::Client.prepend(Redis::Rails::Instrumentation::Logging) +Redis::Client.send(:prepend, Redis::Rails::Instrumentation::Logging)
Prepend is private on Ruby 2.0.0
diff --git a/instagram_api.gemspec b/instagram_api.gemspec index abc1234..def5678 100644 --- a/instagram_api.gemspec +++ b/instagram_api.gemspec @@ -1,16 +1,16 @@ # coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require 'instagram_api/version' +require 'instagram_api' Gem::Specification.new do |spec| spec.name = "instagram_api" spec.version = Instagram::VERSION spec.authors = ["Casey Scarborough"] spec.email = ["caseyscarborough@gmail.com"] - spec.description = "" - spec.summary = "" - spec.homepage = "" + spec.description = "A wrapper for the Instagram API." + spec.summary = "This gem is a simple and easy-to-use wrapper for accessing data from Instagram's API." + spec.homepage = "https://github.com/caseyscarborough/instagram" spec.license = "MIT" spec.files = `git ls-files`.split($/)
Update .gemspec with desc, summary, and homepage.
diff --git a/lib/et.rb b/lib/et.rb index abc1234..def5678 100644 --- a/lib/et.rb +++ b/lib/et.rb @@ -13,6 +13,8 @@ require "core_ext/hash" require "core_ext/object" require "core_ext/string" + +Nori.parser = :nokogiri module ET class Error < StandardError
Use Nokogiri as XML parser.
diff --git a/lib/blade/server.rb b/lib/blade/server.rb index abc1234..def5678 100644 --- a/lib/blade/server.rb +++ b/lib/blade/server.rb @@ -24,6 +24,7 @@ private def app Rack::Builder.app do + use Rack::ShowExceptions run Blade::RackAdapter.new end end
Add Rack::ShowExceptions middleware to help debug errors rendering the index page
diff --git a/lib/micromachine.rb b/lib/micromachine.rb index abc1234..def5678 100644 --- a/lib/micromachine.rb +++ b/lib/micromachine.rb @@ -28,4 +28,8 @@ rescue NoMethodError raise InvalidEvent end + + def ==(some_state) + state == some_state + end end
Allow comparing a Machine to a String This lets us redefine model methods as FSMs, and still be able to compare: class SomeModel < ActiveRecord::Base def activate! state.trigger(:activate) save! end def state @_state ||= MicroMachine.new(self[:state]).tap do |fsm| fsm.transitions_for[:activate] = { "pending" => "active" } fsm.on(:any) { self[:state] = state.state } end end end model = SomeModel.new model.activate! model.state == "active"
diff --git a/lib/oauth/config.rb b/lib/oauth/config.rb index abc1234..def5678 100644 --- a/lib/oauth/config.rb +++ b/lib/oauth/config.rb @@ -10,6 +10,9 @@ def self.instance(csrf, base_callback_url, invitation_token: nil, organization_name: nil) if config['client_id'].present? + if Cartodb::Central.sync_data_with_cartodb_central? + base_callback_url = Cartodb::Central.new.host + URI.parse(base_callback_url).path + end new(csrf, base_callback_url, invitation_token, organization_name) end end
Use central redirect uri if available
diff --git a/lib/opskit/vhost.rb b/lib/opskit/vhost.rb index abc1234..def5678 100644 --- a/lib/opskit/vhost.rb +++ b/lib/opskit/vhost.rb @@ -1,6 +1,6 @@ module OpsKit class VHost - PROVIDERS = [:apache, :nginx] + PROVIDERS = Dir.entries( File.join( File.dirname(__FILE__), "templates/" ) ).select {|f| !File.directory? f}.map{ |e| e.split('.').first.to_sym } attr_reader :provider, :conf @@ -14,8 +14,8 @@ if PROVIDERS.include? @provider.to_sym file_path = File.join( File.dirname(__FILE__), "templates/#{ @provider }.erb.conf" ) - else - file_path = @provider + elsif @conf[ :template_path ] + file_path = @conf[ :template ] end template = File.read( file_path )
Change VHost class to allow full template
diff --git a/lib/quiet_opener.rb b/lib/quiet_opener.rb index abc1234..def5678 100644 --- a/lib/quiet_opener.rb +++ b/lib/quiet_opener.rb @@ -27,7 +27,7 @@ Rails.logger.warn("PURGE: Unable to reach host #{host}") end if result == "200" - Rails.logger.info("PURGE: Purged URL #{url} at #{host}: #{result}") + Rails.logger.debug("PURGE: Purged URL #{url} at #{host}: #{result}") else Rails.logger.warn("PURGE: Unable to purge URL #{url} at #{host}: status #{result}") end
Make successful PURGEs log at debug level to reduce unecessary noise at default level (info)
diff --git a/lib/sidekiq/cron.rb b/lib/sidekiq/cron.rb index abc1234..def5678 100644 --- a/lib/sidekiq/cron.rb +++ b/lib/sidekiq/cron.rb @@ -6,3 +6,15 @@ module Cron end end + +if Redis::VERSION < '4.2' + module RedisCompatible + extend ActiveSupport::Concern + + def exists?(key) + exists(key) + end + end + + Redis.send(:include, RedisCompatible) +end
Add redis conn.exists? method compatible.
diff --git a/lib/tasks/rcov.rake b/lib/tasks/rcov.rake index abc1234..def5678 100644 --- a/lib/tasks/rcov.rake +++ b/lib/tasks/rcov.rake @@ -10,7 +10,8 @@ unless PLATFORM['i386-mswin32'] rcov = "rcov --sort coverage --rails --aggregate coverage.data " << - "--text-summary -Ilib -T -x gems/*,db/migrate/*" + "--text-summary -Ilib -T " << + "-x gems/*,db/migrate/*,jrails/*/*" else rcov = "rcov.cmd --sort coverage --rails --aggregate " << "coverage.data --text-summary -Ilib -T"
Exclude jrails files from coverage tests.
diff --git a/config/environment.rb b/config/environment.rb index abc1234..def5678 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -4,7 +4,7 @@ # Initialize the Rails application. Rails.application.initialize! -Rails.application.routes.default_url_options[:host] = 'articles-read.herokuapp.com' +Rails.application.routes.default_url_options[:host] = 'cutouts.herokuapp.com' ActionMailer::Base.smtp_settings = { :user_name => ENV['SENDGRID_USERNAME'],
Change the root URL of the app Signed-off-by: Siddharth Kannan <7a804f1d08bac02a84ba1822c22c8bf38be68ecc@tutanota.com>
diff --git a/spec/mutations/circle/member/change_status_spec.rb b/spec/mutations/circle/member/change_status_spec.rb index abc1234..def5678 100644 --- a/spec/mutations/circle/member/change_status_spec.rb +++ b/spec/mutations/circle/member/change_status_spec.rb @@ -13,7 +13,7 @@ it 'fills the comment body with an internationalized message' do Timecop.freeze(Time.parse("2016-01-01")) do outcome = Circle::Member::Comments::StatusChange.run(item: member, user: user, circle: circle, status: :blocked) - expect(outcome.result.body).to eq('John Doe blocked on January 01, 2016 by Generic User.') + expect(outcome.result.body).to eq('John Doe was blocked on January 01, 2016 by Generic User.') end end it 'creates a comment using the lale-bot user' do
Fix test; i18n string changed.
diff --git a/lib/api_matchers/core/find_in_json.rb b/lib/api_matchers/core/find_in_json.rb index abc1234..def5678 100644 --- a/lib/api_matchers/core/find_in_json.rb +++ b/lib/api_matchers/core/find_in_json.rb @@ -15,15 +15,13 @@ if key == expected_key unless expected_value.nil? if expected_value.is_a? DateTime or expected_value.is_a? Date - expected_value = expected_value.to_s + expected_value = expected_value.to_s elsif expected_value.is_a? Time - expected_value = expected_value.to_datetime.to_s + expected_value = expected_value.to_datetime.to_s end end - - if value == expected_value or expected_value.nil? - return value - end + + return value if value == expected_value or expected_value.nil? end # do we have more to recurse through? keep_going = nil
Put return in one line comparison
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -8,5 +8,5 @@ u = User.create(name: 'Thomas McDonald', email: 'example@example.com') u.authorizations << Authorization.new(email: 'example@example.com', provider: 'google', uid: 'lolnope') -u.questions << Question.new(title: 'What is QA?', body: 'I am unsure what this site is all about. Could somebody explain?') +u.questions << Question.new(title: 'What is QA?', body: 'I am unsure what [this site](/) is all about. Could somebody explain?') u.save
Change the initial question example to include a tiny bit of markdown
diff --git a/hutch.gemspec b/hutch.gemspec index abc1234..def5678 100644 --- a/hutch.gemspec +++ b/hutch.gemspec @@ -6,7 +6,7 @@ gem.add_runtime_dependency 'march_hare', '>= 3.0.0' else gem.platform = Gem::Platform::RUBY - gem.add_runtime_dependency 'bunny', '>= 2.9', '< 2.12' + gem.add_runtime_dependency 'bunny', '>= 2.9', '< 2.13' end gem.add_runtime_dependency 'carrot-top', '~> 0.0.7' gem.add_runtime_dependency 'multi_json', '~> 1.12'
Update bunny requirement from < 2.12, >= 2.9 to >= 2.9, < 2.13 Updates the requirements on [bunny](https://github.com/ruby-amqp/bunny) to permit the latest version. - [Release notes](https://github.com/ruby-amqp/bunny/releases) - [Changelog](https://github.com/ruby-amqp/bunny/blob/master/ChangeLog.md) - [Commits](https://github.com/ruby-amqp/bunny/commits/2.12.0) Signed-off-by: dependabot[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/app/models/select_phone_form.rb b/app/models/select_phone_form.rb index abc1234..def5678 100644 --- a/app/models/select_phone_form.rb +++ b/app/models/select_phone_form.rb @@ -2,7 +2,7 @@ include ActiveModel::Model include Evidence - attr_accessor :mobile_phone, :smart_phone, :landline + attr_reader :mobile_phone, :smart_phone, :landline validate :check_valid
3491: Reduce accessibility of model attributes Only need to be readable, not writable. Authors: 7656f885fae0d57a843f5d48e2e0751c4511da7e@richardtowers
diff --git a/plugins/cats.rb b/plugins/cats.rb index abc1234..def5678 100644 --- a/plugins/cats.rb +++ b/plugins/cats.rb @@ -0,0 +1,22 @@+class Cats < Linkbot::Plugin + Linkbot::Plugin.register('cats', self, + { + :message => {:regex=> /^!cats$/i, :handler=> :on_message} + } + ) + + def self.on_message(message, matches) + reddit = "http://www.reddit.com/r/cats.json" + catstreamer = "http://catstreamer.herokuapp.com/cats.json" + doc = ActiveSupport::JSON.decode(open(catstreamer).read) + url = doc["catpic"] + #url = doc["data"]["children"][rand(doc["data"]["children"].length)]["data"]["url"] + msg = "cats" + msg + url + end + + def self.help + "!cats = show a random cat gif" + end +end
Update to use the new Catstreamer app set up on Heroku
diff --git a/lib/rpush/client/active_record/app.rb b/lib/rpush/client/active_record/app.rb index abc1234..def5678 100644 --- a/lib/rpush/client/active_record/app.rb +++ b/lib/rpush/client/active_record/app.rb @@ -6,7 +6,7 @@ has_many :notifications, class_name: 'Rpush::Client::ActiveRecord::Notification', dependent: :destroy - validates :name, presence: true, uniqueness: { scope: [:type, :environment] } + validates :name, presence: true, uniqueness: { scope: [:type, :environment], case_sensitive: true } end end end
Fix case sensitive uniqueness deprecation warning
diff --git a/app/services/rta_api_service.rb b/app/services/rta_api_service.rb index abc1234..def5678 100644 --- a/app/services/rta_api_service.rb +++ b/app/services/rta_api_service.rb @@ -0,0 +1,123 @@+class RtaApiService + + def get_wo_trans(query) + uri = URI("https://api.rtafleet.com/graphql") + + unless check_api_key + return {success: false, response: "API key not found."} + end + + token = JSON.parse(get_token.body)["access_token"] + headers = { + 'Content-Type': 'application/json', + 'Authorization': 'Bearer ' + token, + 'Host': 'api.rtafleet.com' + } + + req = Net::HTTP.new(uri.host, uri.port) + req.use_ssl = true + response = req.post(uri.path, query, headers) + + return {success: true, response: JSON.parse(response.body)} + end + + def get_all_work_orders + query = {'query': + 'query { + getWorkOrderTransactions(tenantId: "RTA02603",facilityId:1,queryOptions:{filters:[{name:"postingDate",operator:GREATER_THAN_OR_EQUAL,values:"2020-10-01"},{name:"postingDate",operator:LESS_THAN_OR_EQUAL,values:"2020-10-31"}]}){ + meta{ + totalRecords + totalPages + limit + offset + page + } + workOrderTransactions{ + facility{ + id + } + workOrderLine{ + workOrder{ + number + } + lineNumber + } + number + type + postingDate + quantity + priceWithMarkup + totalPriceWithMarkup + item{ + ... on PartPosting{ + part{ + ... on NonFilePart{ + description + number + } + ... on Part{ + facility{ + id + } + partNumber + description + } + } + } + ... on EmployeePosting{ + employee{ + ... on Employee{ + number + name + } + ... on NonFileEmployee{ + employeeNumber + employeeAbbreviation + } + } + } + } + createdBy + } + } + }', + 'variables': {} + } + get_wo_trans(query.to_json) + end + + protected + + def check_api_key + if ENV['RTA_CLIENT_ID'] && ENV['RTA_CLIENT_SECRET'] + return true + else + return false + end + end + + private + + def get_token + uri = URI("https://rtafleet.auth0.com/oauth/token") + headers = { + 'Content-Type': 'application/x-www-form-urlencoded' + } + body = { + audience: 'https://api.rtafleet.com', + grant_type: 'client_credentials', + client_id: ENV['RTA_CLIENT_ID'], + client_secret: ENV['RTA_CLIENT_SECRET'] + } + + req = Net::HTTP::Post.new(uri) + req['Content-Type'] = headers['Content-Type'] + req.set_form_data(body) + + response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http| + http.request(req) + end + + return response + end +end
Implement RTA API Integration service.
diff --git a/app/services/twitter_service.rb b/app/services/twitter_service.rb index abc1234..def5678 100644 --- a/app/services/twitter_service.rb +++ b/app/services/twitter_service.rb @@ -13,26 +13,28 @@ # necessary {Tweet} records. def download_mentions opts = {} - opts[:since_id] = tweet.id if tweet = Tweet.last + if tweet = Tweet.last + opts[:since_id] = tweet.id + end tl = client.mentions_timeline opts tl.each do |tuit| - Tweet.create!(id: tuit.id, json: tuit.to_json) + Tweet.find_or_create!(tuit) end end private - def initialize - client = Twitter::REST::Client.new do |config| - config.consumer_key = ENV["TWITTER_CONSUMER_KEY"] - config.consumer_secret = ENV["TWITTER_CONSUMER_SECRET"] - config.access_token = ENV["TWITTER_ACCESS_TOKEN"] - config.access_token_secret = ENV["TWITTER_ACCESS_SECRET"] + def initialize + client = Twitter::REST::Client.new do |config| + config.consumer_key = ENV["TWITTER_CONSUMER_KEY"] + config.consumer_secret = ENV["TWITTER_CONSUMER_SECRET"] + config.access_token = ENV["TWITTER_ACCESS_TOKEN"] + config.access_token_secret = ENV["TWITTER_ACCESS_SECRET"] + end + + self.client = client end - self.client = client - end - end
Improve the way to create a Tweet
diff --git a/db/migrate/20220429092052_create_order_cycles_shipping_methods.rb b/db/migrate/20220429092052_create_order_cycles_shipping_methods.rb index abc1234..def5678 100644 --- a/db/migrate/20220429092052_create_order_cycles_shipping_methods.rb +++ b/db/migrate/20220429092052_create_order_cycles_shipping_methods.rb @@ -1,13 +1,12 @@-class CreateOrderCycleShippingMethods < ActiveRecord::Migration[6.1] +class CreateOrderCyclesShippingMethods < ActiveRecord::Migration[6.1] def up create_table :order_cycles_shipping_methods, id: false do |t| - t.references :order_cycle - t.references :shipping_method, foreign_key: { to_table: :spree_shipping_methods } + t.belongs_to :order_cycle + t.belongs_to :shipping_method, foreign_key: { to_table: :spree_shipping_methods } + t.index [:order_cycle_id, :shipping_method_id], + name: "order_cycles_shipping_methods_join_index", + unique: true end - add_index :order_cycles_shipping_methods, - [:order_cycle_id, :shipping_method_id], - name: "order_cycles_shipping_methods_join_index", - unique: true end def down
Use :belongs_to instead of :references in :order_cycles_shipping_methods Also fix migration class name.
diff --git a/git-review.gemspec b/git-review.gemspec index abc1234..def5678 100644 --- a/git-review.gemspec +++ b/git-review.gemspec @@ -21,4 +21,5 @@ s.add_runtime_dependency 'yajl-ruby' s.add_development_dependency 'rspec', '~> 2.13.0' + s.add_development_dependency 'hashie' end
Add hashie as development dependency This should fix Travis. Not sure how that happened.
diff --git a/spec/services/create_word_list_spec.rb b/spec/services/create_word_list_spec.rb index abc1234..def5678 100644 --- a/spec/services/create_word_list_spec.rb +++ b/spec/services/create_word_list_spec.rb @@ -0,0 +1,41 @@+require 'rails_helper' + +RSpec.describe CreateWordList, type: :service do + subject(:service) { CreateWordList.new(name, words) } + + context "with a valid name and set of words" do + let(:name) { "testing" } + let(:words) { [ + "apple", + "banana", + "carrot", + ] } + + it "succeeds" do + expect(service.call).to be_truthy + end + + it "adds another WordList" do + expect { service.call }.to change(WordList, :count).by(1) + end + + it "has the correct name in created wordlist" do + service.call + expect(WordList.last.name).to eql name + end + + it "has the correct words in the created wordlist" do + service.call + expect(WordList.last.words.pluck(:word)).to eql words + end + + it "returns a wordlist object" do + expect(service.call).to be_a(WordList) + end + + it "has no errors" do + service.call + expect(service.game.errors).to be_empty + end + end +end
Add spec for create wordlist service
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 @@ -2,6 +2,7 @@ module Crawler class Parser def initialize(url) + @url = url @document = Nokogiri::HTML(open(url)) end @@ -11,6 +12,10 @@ def xpath(path, &block) parse(:xpath, path, &block) + end + + def current_uri + URI.parse(@url) end private
Make current URI available inside block
diff --git a/roles/web.rb b/roles/web.rb index abc1234..def5678 100644 --- a/roles/web.rb +++ b/roles/web.rb @@ -17,7 +17,7 @@ :pool_idle_time => 0 }, :web => { - :status => "database_readonly", + :status => "online", :database_host => "db", :readonly_database_host => "db" }
Revert "Switch to readonly mode" This reverts commit 5dad101ba52615ef4e79413b292e1c042a715286.
diff --git a/roles/web.rb b/roles/web.rb index abc1234..def5678 100644 --- a/roles/web.rb +++ b/roles/web.rb @@ -14,8 +14,8 @@ :pool_idle_time => 0 }, :web => { - :status => "online", - :database_host => "db", + :status => "database_readonly", + :database_host => "db-slave", :readonly_database_host => "db-slave" } )
Switch site to readonly mode on ramoth
diff --git a/webapp/lib/trisano.rb b/webapp/lib/trisano.rb index abc1234..def5678 100644 --- a/webapp/lib/trisano.rb +++ b/webapp/lib/trisano.rb @@ -1,5 +1,5 @@ module Trisano - VERSION = %w(3 5 7).freeze + VERSION = %w(EDGE).freeze end require 'trisano/application'
Remove version number from edge deployment
diff --git a/lib/yarrow.rb b/lib/yarrow.rb index abc1234..def5678 100644 --- a/lib/yarrow.rb +++ b/lib/yarrow.rb @@ -6,6 +6,7 @@ require 'yarrow/configuration' require 'yarrow/console_runner' require 'yarrow/generator' +require 'yarrow/assets' require 'yarrow/html/asset_tags' require 'yarrow/output/mapper' require 'yarrow/output/generator'
Include assets path in main require Just to get the existing tests to pass. Will break it up in future changes once new content graph stuff is merged in.
diff --git a/lib/translatable_routes/action_dispatch/named_route_collection.rb b/lib/translatable_routes/action_dispatch/named_route_collection.rb index abc1234..def5678 100644 --- a/lib/translatable_routes/action_dispatch/named_route_collection.rb +++ b/lib/translatable_routes/action_dispatch/named_route_collection.rb @@ -2,10 +2,18 @@ module ActionDispatch module NamedRouteCollection extend ActiveSupport::Concern - + def define_i18n_url_helper(name) %w(path url).each do |type| helper = :"#{name}_#{type}" + + if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2 + @module = case type + when 'path' then @path_helpers_module + when 'url' then @url_helpers_module + end + end + @module.remove_possible_method helper @module.module_eval do define_method helper do |*args| @@ -17,7 +25,7 @@ helpers << helper end end - + end end end
FIX define_i18n_url_helper with Rails 4.2
diff --git a/middleman-core/lib/middleman-core/extensions/external_pipeline.rb b/middleman-core/lib/middleman-core/extensions/external_pipeline.rb index abc1234..def5678 100644 --- a/middleman-core/lib/middleman-core/extensions/external_pipeline.rb +++ b/middleman-core/lib/middleman-core/extensions/external_pipeline.rb @@ -19,8 +19,6 @@ def ready logger.info "== Executing: `#{options[:command]}`" - @watcher.poll_once! - if app.build? watch_command! else @@ -35,6 +33,8 @@ logger.info "== External: #{without_newline}" if without_newline.length > 0 end end + + @watcher.poll_once! rescue ::Errno::ENOENT => e logger.error "== External: Command failed with message: #{e.message}" exit(1)
Fix yesterday's bone-headed commit. again
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,6 @@ require 'puppetlabs_spec_helper/module_spec_helper' require 'rspec-puppet-facts' +require 'webmock/rspec' include RspecPuppetFacts
Include webmock into rspec helper
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -10,6 +10,9 @@ SimpleCov.start do add_filter '/spec/' + # Travis configures bundler to install dependencies in vendor + # https://github.com/colszowka/simplecov/issues/360 + add_filter '/vendor/' end $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
Resolve incorrect coverage results from Travis
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,9 +2,14 @@ require 'shared_examples' require 'puppet-openstack_spec_helper/facts' +fixture_path = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures')) + RSpec.configure do |c| c.alias_it_should_behave_like_to :it_configures, 'configures' c.alias_it_should_behave_like_to :it_raises, 'raises' + + c.module_path = File.join(fixture_path, 'modules') + c.manifest_dir = File.join(fixture_path, 'manifests') end at_exit { RSpec::Puppet::Coverage.report! }
Set fixture paths for unit tests This change defines manifest_dir and module_path expicitly in unit tests so that modules installed under fixtures directory is properly loaded. Closes-Bug: #1930403 Change-Id: I93c83dfe9b92ef772e1ae3c15f70aeac39ccf449
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -10,7 +10,6 @@ end config.color = true - config.treat_symbols_as_metadata_keys_with_true_values = true end require 'simplecov'
Remove obsolete RSpec config option
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,4 +1,6 @@ require 'simplecov' +require 'pathname' + SimpleCov.start do add_filter '/spec/' add_filter '/config/'
Add missing require for Pathname
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,9 +1,15 @@+$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) + require 'codeclimate-test-reporter' CodeClimate::TestReporter.start - -$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'contactually' require 'webmock/rspec' Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f} + +RSpec.configure do |config| + config.after(:suite) do + WebMock.disable_net_connect!(:allow => 'codeclimate.com') + end +end
Whitelist codeclimate after test suite is complete
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,4 +2,4 @@ require 'fluffle' -Fluffle.logger.level = :fatal +Fluffle.logger.level = Logger::Severity::FATAL
Use constant rather than symbol for logger level (Ruby <2.3)
diff --git a/ncsa-parser.gemspec b/ncsa-parser.gemspec index abc1234..def5678 100644 --- a/ncsa-parser.gemspec +++ b/ncsa-parser.gemspec @@ -22,5 +22,7 @@ s.add_dependency("rdoc") s.add_dependency("rake", ["~> 0.9"]) + s.add_dependency("minitest") + s.add_dependency("turn") end
Update build and version files to use bundler.
diff --git a/lib/pong/paddle.rb b/lib/pong/paddle.rb index abc1234..def5678 100644 --- a/lib/pong/paddle.rb +++ b/lib/pong/paddle.rb @@ -0,0 +1,18 @@+class Paddle + attr_accessor :x, :y, :rotation, :score + + def initialize(x, y, rotation) + @x = x + @y = y + @rotation = rotation + end + + def increaseScore + @score += 1 + end + + def setPosition(x, y) + @x = x; + @y = y; + end +end
Add a basic Paddle class.
diff --git a/platforms/ios/framework/Tangram-es.podspec b/platforms/ios/framework/Tangram-es.podspec index abc1234..def5678 100644 --- a/platforms/ios/framework/Tangram-es.podspec +++ b/platforms/ios/framework/Tangram-es.podspec @@ -0,0 +1,26 @@+Pod::Spec.new do |s| + + s.name = 'Tangram-es' + s.version = '0.7.1' + + s.summary = 'Open source C++ library for rendering 2D and 3D maps from vector data using OpenGL ES.' + s.description = 'Open source C++ library for rendering 2D and 3D maps from vector data using OpenGL ES, wrapped with native Cocoa Touch APIs.' + s.homepage = 'https://mapzen.com/products/tangram/' + s.license = { :type => 'MIT', :file => 'LICENSE' } + s.author = { 'Mapzen' => 'ios-support@mapzen.com' } + s.social_media_url = 'https://twitter.com/mapzen' + s.documentation_url = 'https://mapzen.com/documentation/tangram/ios-framework/0.7.0/' + + s.source = { + :http => "http://ios.mapzen.com/tangram-releases/tangram-release-#{s.version}.zip" + } + + s.platform = :ios + s.ios.deployment_target = '9.3' + + s.requires_arc = true + + s.vendored_frameworks = 'TangramMap.framework' + s.module_name = 'TangramMap' + +end
Add podspec file for iOS framework sourced from S3
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -2,9 +2,11 @@ require 'rails/all' -require 'figs' -# Don't run this initializer on travis. -Figs.load(stage: Rails.env) unless ENV['TRAVIS'] +if Rails.env.staging? || Rails.env.production? + require 'figs' + # Don't run this initializer on travis. + Figs.load(stage: Rails.env) unless ENV['TRAVIS'] +end # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production.
Use figs only on staging/production
diff --git a/spec/integration/adapter_spec.rb b/spec/integration/adapter_spec.rb index abc1234..def5678 100644 --- a/spec/integration/adapter_spec.rb +++ b/spec/integration/adapter_spec.rb @@ -8,10 +8,6 @@ let(:setup) { ROM.setup("yaml://#{root}/fixtures/test_db.yml") } before do - setup.schema do - base_relation(:users) { repository :default } - end - setup.relation(:users) do def by_name(name) find_all { |user| user[:name] == name }
Update spec to pass on latest rom
diff --git a/lib/bootstrap-sass.rb b/lib/bootstrap-sass.rb index abc1234..def5678 100644 --- a/lib/bootstrap-sass.rb +++ b/lib/bootstrap-sass.rb @@ -18,7 +18,7 @@ raise Bootstrap::FrameworkNotFound, "bootstrap-sass requires either Rails > 3.1 or Compass, neither of which are loaded" end stylesheets = File.expand_path(File.join("..", 'vendor', 'assets', 'stylesheets')) - Sass.load_paths << stylesheets + ::Sass.load_paths << stylesheets end private
Fix namespace Sass module due to conflict with bootstra-sass-rails No one should really use the two together, but in case they do, or in case any other library defines a Bootstrap::Sass module, we should be clear that we mean the global core Sass module here. Fixes thomas-mcdonald/bootstrap-sass#293
diff --git a/lib/ci/api/runners.rb b/lib/ci/api/runners.rb index abc1234..def5678 100644 --- a/lib/ci/api/runners.rb +++ b/lib/ci/api/runners.rb @@ -29,8 +29,11 @@ required_attributes! [:token] attributes = { description: params[:description], - tag_list: params[:tag_list], - run_untagged: params[:run_untagged] || true } + tag_list: params[:tag_list] } + + unless params[:run_untagged].nil? + attributes.merge!(run_untagged: params[:run_untagged]) + end runner = if runner_registration_token_valid?
Improve setting default runner attrs when using API
diff --git a/lib/counting_stars.rb b/lib/counting_stars.rb index abc1234..def5678 100644 --- a/lib/counting_stars.rb +++ b/lib/counting_stars.rb @@ -1,5 +1,25 @@-require "counting_stars/version" +require 'uri' +require 'open-uri' +require 'nokogiri' +require 'active_support/core_ext/object/to_query' +require 'counting_stars/version' module CountingStars - # Your code goes here... -end + + def self.count(query, site) + request "#{query} site:#{site}" + end + + def self.request(query) + uri = URI::HTTPS.build( + :host => 'encrypted.google.com', + :path => '/search', + :query => { :q => query }.to_query + ) + + page = Nokogiri::HTML(open(uri)) + page = page.css('div.slp').first.text + page.gsub(/[[:space:]]/, ' ').lstrip.split(' - ') + end + +end
Add request and count methods
diff --git a/lib/deliver/loader.rb b/lib/deliver/loader.rb index abc1234..def5678 100644 --- a/lib/deliver/loader.rb +++ b/lib/deliver/loader.rb @@ -6,7 +6,7 @@ # through it as well searching for language folders. APPLE_TV_DIR_NAME = "appleTV".freeze DEFAULT_DIR_NAME = "default".freeze - ALL_LANGUAGES = (FastlaneCore::Languages::ALL_LANGUAGES + [APPLE_TV_DIR_NAME, APPLE_TV_DIR_NAME]).map(&:downcase).freeze + ALL_LANGUAGES = (FastlaneCore::Languages::ALL_LANGUAGES + [APPLE_TV_DIR_NAME, APPLE_TV_DIR_NAME, DEFAULT_DIR_NAME]).map(&:downcase).freeze def self.language_folders(root) Dir.glob(File.join(root, '*')).select do |path|
Fix the default-setting feature. This is required for upload_metadata/load_from_filesystem to correctly load default values from the default folder.
diff --git a/lib/fiscalizer/tax.rb b/lib/fiscalizer/tax.rb index abc1234..def5678 100644 --- a/lib/fiscalizer/tax.rb +++ b/lib/fiscalizer/tax.rb @@ -1,47 +1,37 @@ class Fiscalizer - class Tax + class Tax + attr_accessor :base, :rate, :name, :total, :summed - attr_accessor :base, :rate, :name + def initialize(base: 0.0, rate: 0.0, name: '', total: nil, summed: nil) + @base = base + @rate = rate + @name = name + @total = total + @summed = summed + end - def initialize base: 0.0, rate: 0.0, name: "" - @base = base - @rate = rate - @name = name - end # initialize + def total + total || (base.to_f * (rate.to_f / 100.0)).round(2) + end - # Math - def base - return @base.to_f.round(2) - end # base + def summed + summed || (base.to_f + total.to_f).round(2) + end - def rate - return @rate.to_f.round(2) - end # rate + def base_str + format('%15.2f', base).strip + end - def total - return (base * (rate / 100.0) ).round(2) - end # total + def rate_str + format('%3.2f', rate).strip + end - def summed - return (base + total).round(2) - end # summed + def total_str + format('%15.2f', total).strip + end - # Convert to string - def base_str - return ("%15.2f" % base).strip - end # base_str - - def rate_str - return ("%3.2f" % rate).strip - end # rate_str - - def total_str - return ("%15.2f" % total).strip - end # total_str - - def summed_str - return ("%15.2f" % summed ).strip - end # summed_str - - end # Tax -end # Fiscalizer+ def summed_str + format('%15.2f', summed).strip + end + end +end
Add ability to overwrite calculated values and remove float conversion
diff --git a/spec/userdata_spec.rb b/spec/userdata_spec.rb index abc1234..def5678 100644 --- a/spec/userdata_spec.rb +++ b/spec/userdata_spec.rb @@ -4,8 +4,9 @@ describe Stem::Userdata do describe '#compile' do it "should produce identical output with identical input" do - output1 = Stem::Userdata.compile("spec/fixtures/userdata") - output2 = Stem::Userdata.compile("spec/fixtures/userdata") + output1 = Stem::Userdata.compile("spec/fixtures/userdata", :erb_binding => binding) + sleep(1) # Necessary to ensure different timestamps + output2 = Stem::Userdata.compile("spec/fixtures/userdata", :erb_binding => binding) output1.should == output2 end end
Add sleep(1) to spec to ensure compilations are done w/ different timestamps
diff --git a/lib/specstat/rspec.rb b/lib/specstat/rspec.rb index abc1234..def5678 100644 --- a/lib/specstat/rspec.rb +++ b/lib/specstat/rspec.rb @@ -12,12 +12,29 @@ # No-op end -RSpec.configure do |c| - c.around(:each) do |example| - example.run +class SpecstatFormatter + RSpec::Core::Formatters.register self, + :example_passed, + :example_pending, + :example_failed + + def initialize(out) + @out = out + end + + def example_finished(notification) + example = notification.example Specstat::Reporter.current_run.add(example) end - c.after(:all) do - Specstat::Reporter.current_run.submit! - end + alias example_passed example_finished + alias example_pending example_finished + alias example_failed example_finished end + +RSpec.configure do |c| + c.add_formatter SpecstatFormatter +end + +at_exit do + Specstat::Reporter.current_run.submit! +end
Switch from using an around filter to a formatter Apparently formatters are the preferred way of doing this since status is not available yet in a filter. See https://github.com/rspec/rspec-core/issues/2011 for details.
diff --git a/lib/driver.rb b/lib/driver.rb index abc1234..def5678 100644 --- a/lib/driver.rb +++ b/lib/driver.rb @@ -5,7 +5,7 @@ # @param [Player] player the player of the game. def run_driver(player) - input = player_input + input = player_input prompt: '> ' while (input.casecmp("quit") != 0) interpret_command(input, player)
Add player_input prompt: '> ' to handle default inputs
diff --git a/Library/Contributions/examples/brew-bottle.rb b/Library/Contributions/examples/brew-bottle.rb index abc1234..def5678 100644 --- a/Library/Contributions/examples/brew-bottle.rb +++ b/Library/Contributions/examples/brew-bottle.rb @@ -0,0 +1,21 @@+# Builds binary brew package +brew_install + +destination = HOMEBREW_PREFIX + "Bottles" +if not File.directory?(destination) + Dir.mkdir destination +end + +ARGV.each do|formula| + # Get the latest version + version = `brew list --versions #{formula}`.split.last + source = HOMEBREW_CELLAR + formula + version + filename = formula + '-' + version + '.tar.gz' + ohai "Bottling #{formula} #{version}..." + HOMEBREW_CELLAR.cd do + # Use gzip, much faster than bzip2 and hardly any file size difference + # when compressing binaries. + safe_system "tar czf #{destination}/#{filename} #{formula}/#{version}" + end + ohai "Bottled #{filename}" +end
Add initial brew bottle implementation.
diff --git a/recipes/_emojify.rb b/recipes/_emojify.rb index abc1234..def5678 100644 --- a/recipes/_emojify.rb +++ b/recipes/_emojify.rb @@ -12,7 +12,7 @@ end file File.join(node['emojify']['install_target'], 'emojify') do - content File.read(File.join(Chef::Config['file_cache_path'], 'emojify', 'emojify')) + content lazy { File.read(File.join(Chef::Config['file_cache_path'], 'emojify', 'emojify')) } mode '0755' action :create end
:bug: Fix emojify contents load issue emojify contents can be loaded after git clone(runtime) Use lazy block