diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/tasks/shared_mustache.rake b/lib/tasks/shared_mustache.rake index abc1234..def5678 100644 --- a/lib/tasks/shared_mustache.rake +++ b/lib/tasks/shared_mustache.rake @@ -17,4 +17,9 @@ File.open(SharedMustache::Config.template_file, 'w') { |f| f.write javascript.join("\n") } end + + desc 'Cleans up the mustache template file used in production' + task :clean do + File.open(SharedMustache::Config.template_file, 'w') {} + end end
Add clean task to remove compiled templates
diff --git a/src/config.rb b/src/config.rb index abc1234..def5678 100644 --- a/src/config.rb +++ b/src/config.rb @@ -1,6 +1,6 @@ CONFIG = { indie: { merchant_id: "1065", - url: "https://209.235.214.90/setistatus/checkstatus.asp" + url: "https://www.stoneedge.net/setistatus/checkstatus.asp" } }
Use stoneedge domain instead of ip address
diff --git a/spec/connection_spec.rb b/spec/connection_spec.rb index abc1234..def5678 100644 --- a/spec/connection_spec.rb +++ b/spec/connection_spec.rb @@ -0,0 +1,56 @@+require File.dirname(__FILE__) + '/spec_helper.rb' + +def initialize_connection(spec = nil) + begin + connection = ActiveCouch::Connection.new(spec) + rescue + error = $!.to_s + end + return connection, error +end + + +describe ActiveCouch::Connection do + before(:each) do + @connection, @error = initialize_connection(:server => '192.168.0.150', :port => '7777') + end + + it "should set the server and port for the connection object and there must be no error" do + @connection.server.should == "192.168.0.150" + @connection.port.should == "7777" + @error.should == nil + end +end + +describe "An ActiveCouch::Connection object instantiated with no options specified" do + before(:each) do + @connection, @error = initialize_connection() + end + + it "should raise an error and return nil" do + @connection.should == nil + @error.should == "Configuration hash must contain keys for server and port" + end +end + +describe "An ActiveCouch::Connection object instantiated with only the server option specified" do + before(:each) do + @connection, @error = initialize_connection(:server => '192.168.0.150') + end + + it "should raise an error and return nil" do + @connection.should == nil + @error.should == "Configuration hash must contain keys for server and port" + end +end + +describe "An ActiveCouch::Connection object instantiated with only the port option specified" do + before(:each) do + @connection, @error = initialize_connection(:port => '7777') + end + + it "should raise an error and return nil" do + @connection.should == nil + @error.should == "Configuration hash must contain keys for server and port" + end +end
Add spec for ActiveCouch::Connection object git-svn-id: 2ad1d16e7bb7dbdd355f26be0e8dc086806de7c5@32 e44de9e2-1e40-0410-bb6c-c9d70e891a3e
diff --git a/spec/factories/roles.rb b/spec/factories/roles.rb index abc1234..def5678 100644 --- a/spec/factories/roles.rb +++ b/spec/factories/roles.rb @@ -17,4 +17,10 @@ action "manage" subject "event" end + + factory :contact_admin_role, class: Role do + name "contact_admin" + action "manage" + subject "contact" + end end
Add contact admin role to role factory.
diff --git a/spec/factories/users.rb b/spec/factories/users.rb index abc1234..def5678 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -1,5 +1,6 @@ FactoryGirl.define do factory :user do + id 1 username "Bob" password "password" end
Add user_id field to factory girl user object
diff --git a/sprockets-rails.gemspec b/sprockets-rails.gemspec index abc1234..def5678 100644 --- a/sprockets-rails.gemspec +++ b/sprockets-rails.gemspec @@ -2,7 +2,7 @@ s.name = "sprockets-rails" s.version = "2.0.0.rc1" - s.homepage = "https://github.com/josh/sprockets-rails" + s.homepage = "https://github.com/rails/sprockets-rails" s.summary = "Sprockets Rails integration" s.files = Dir["README.md", "lib/**/*.rb"]
Fix gemspec homepage to point to rails repo [ci skip]
diff --git a/Casks/dwarf-fortress-macnewbie.rb b/Casks/dwarf-fortress-macnewbie.rb index abc1234..def5678 100644 --- a/Casks/dwarf-fortress-macnewbie.rb +++ b/Casks/dwarf-fortress-macnewbie.rb @@ -1,8 +1,8 @@ class DwarfFortressMacnewbie < Cask - version '0.9.3' - sha256 '13b28647228ae977c78d302bafeb42cb6e0b62e3b3efe149f7504ad07a11e998' + version '0.9.5' + sha256 'eb2211d3f51ddceab5bfde4d6e4263a2868db91848091f43d6f16f49f4fb3440' - url 'http://dffd.wimbli.com/download.php?id=7922&f=Macnewbie_0.9.3.dmg' + url "http://dffd.wimbli.com/download.php?id=7922&f=Macnewbie_#{version}.dmg" homepage 'http://www.bay12forums.com/smf/index.php?topic=128960' link 'Macnewbie'
Update Dwarf Fortress MacNewbie to 0.9.5.
diff --git a/stoplight-admin.gemspec b/stoplight-admin.gemspec index abc1234..def5678 100644 --- a/stoplight-admin.gemspec +++ b/stoplight-admin.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |spec| spec.name = 'stoplight-admin' - spec.version = '0.1.0' + spec.version = '0.1.1' spec.authors = ['Cameron Desautels', 'Taylor Fausak'] spec.email = %w(camdez@gmail.com taylor@fausak.me) spec.summary = %q{A simple administration interface for the stoplight gem.}
Raise version number to 0.1.1
diff --git a/GestureRecognizerClosures.podspec b/GestureRecognizerClosures.podspec index abc1234..def5678 100644 --- a/GestureRecognizerClosures.podspec +++ b/GestureRecognizerClosures.podspec @@ -1,8 +1,8 @@ Pod::Spec.new do |s| s.name = "GestureRecognizerClosures" - s.version = "2.2.0" + s.version = "2.3.0" s.license = "MIT" - s.summary = "Closure support for handling gesture recognizers in Swift." + s.summary = "Closure handlers for gesture recognizers, controls and bar button items." s.homepage = "https://github.com/marcbaldwin/GestureRecognizerClosures" s.author = { "Marc Baldwin" => "marc.baldwin88@gmail.com" } s.source = { :git => "https://github.com/marcbaldwin/GestureRecognizerClosures.git", :tag => s.version }
Update pod version to 2.3.0
diff --git a/engines/debug/engine.rb b/engines/debug/engine.rb index abc1234..def5678 100644 --- a/engines/debug/engine.rb +++ b/engines/debug/engine.rb @@ -1,4 +1,5 @@ require_relative '../../parser/expansion_reader' +require 'yajl' module Tritium module Engines @@ -12,13 +13,21 @@ @root_step = Step::Text.new(@root_instruction) @root_step.execute(xhtml_file, env) + + return @root_step.object unless @root_step.debug[:env]["content_type"].include?("html") + + + trace = File.join(@script_path, "../tmp/debug.json") + + + f = File.open(trace, "w+") + + Yajl::Encoder.encode(@root_step.debug, f, :pretty => true, :indent => ' ') + f.close @root_step.object end - - def debug - @root_step.debug - end + def reader_klass Tritium::Parser::ExpansionReader
Debug: Write the debug logs to the tmp/ folder of the project as JSON
diff --git a/app/models/gend_image.rb b/app/models/gend_image.rb index abc1234..def5678 100644 --- a/app/models/gend_image.rb +++ b/app/models/gend_image.rb @@ -19,7 +19,7 @@ def create_thumbnail thumb_image = Magick::Image.from_blob(image)[0] - thumb_image.resize_to_fill!( + thumb_image.resize_to_fit!( MemeCaptainWeb::Config::ThumbSide, MemeCaptainWeb::Config::ThumbSide)
Use resize to fit instead of resize to fill. So text doesn't get cropped out in thumbnails.
diff --git a/db/migrate/20170106043605_add_read_reciepts.rb b/db/migrate/20170106043605_add_read_reciepts.rb index abc1234..def5678 100644 --- a/db/migrate/20170106043605_add_read_reciepts.rb +++ b/db/migrate/20170106043605_add_read_reciepts.rb @@ -0,0 +1,11 @@+class AddReadReciepts < ActiveRecord::Migration + def change + remove_column :task_comments, :is_new + + create_table :task_comments_read, options: 'id: false' do |t| + t.references :comments, index: true, foreign_key: true, null: false + t.references :users, index: true, foreign_key: true, null: false + t.timestamps null: false + end + end +end
NEW: Add migration to add task_comments_read
diff --git a/app/controllers/exercise_submissions_controller.rb b/app/controllers/exercise_submissions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/exercise_submissions_controller.rb +++ b/app/controllers/exercise_submissions_controller.rb @@ -5,7 +5,7 @@ before_filter :authenticate! def index - @submissions = paginated @exercise.submissions + @submissions = paginated @exercise.submissions_for current_user end def show
Fix exercise submissions for current user only
diff --git a/test/git/duo/core_extensions/array_test.rb b/test/git/duo/core_extensions/array_test.rb index abc1234..def5678 100644 --- a/test/git/duo/core_extensions/array_test.rb +++ b/test/git/duo/core_extensions/array_test.rb @@ -1,18 +1,14 @@ require_relative '../../../test_helper.rb' -module Git - module Duo - module CoreExtensions - class ArrayTest < Minitest::Test - def test_where_can_find_any_attribute - refute_empty alfred_and_bruce.where(key: 'brUCE') - refute_empty alfred_and_bruce.where(name: 'Alfred') - end +module Git::Duo::CoreExtensions + class ArrayTest < Minitest::Test + def test_where_can_find_any_attribute + refute_empty alfred_and_bruce.where(key: 'brUCE') + refute_empty alfred_and_bruce.where(name: 'Alfred') + end - def test_where_returns_empty_array_if_nothing_is_matched - assert_empty alfred_and_bruce.where(name: 'Joker') - end - end + def test_where_returns_empty_array_if_nothing_is_matched + assert_empty alfred_and_bruce.where(name: 'Joker') end end end
Define the module scope outside of the test class
diff --git a/ci_environment/firefox/attributes/tarball.rb b/ci_environment/firefox/attributes/tarball.rb index abc1234..def5678 100644 --- a/ci_environment/firefox/attributes/tarball.rb +++ b/ci_environment/firefox/attributes/tarball.rb @@ -1,4 +1,4 @@-default['firefox']['tarball']['version'] = "24.0" +default['firefox']['tarball']['version'] = "24.5.0esr" default['firefox']['tarball']['download_url'] = "http://ftp.mozilla.org/pub/firefox/releases/#{node['firefox']['tarball']['version']}/linux-#{kernel['machine']}/en-US/firefox-#{node['firefox']['tarball']['version']}.tar.bz2" # Required distro packages, preconfigured for Ubuntu 12.04
Update the Firefox version to 24.5.0esr
diff --git a/example/restore_child.rb b/example/restore_child.rb index abc1234..def5678 100644 --- a/example/restore_child.rb +++ b/example/restore_child.rb @@ -0,0 +1,13 @@+# swrk mode example + +images = "/tmp/criu/images" +log = "-" + +c = CRIU.new +p c.set_service_binary "/usr/local/sbin/criu" +p c.set_images_dir images +p c.set_log_file log +p c.set_shell_job true + +# Can wait restored process here / when using patched criu... +p(Process.waitpid2 c.restore_child)
Add example of previous commit
diff --git a/app/controllers/admin/settings_controller.rb b/app/controllers/admin/settings_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/settings_controller.rb +++ b/app/controllers/admin/settings_controller.rb @@ -27,7 +27,13 @@ def create Settings.defaults.keys.each do |k| if params[k] - Settings[k] = params[k] + # TODO: I know this is rubbish, but it's the best way, for now, of getting hashes done in + # the rough and ready admin settings I have. I need a better way of doing this stuff. + if k == "disciplinary_levels" + Settings[k] = eval params[k] + else + Settings[k] = params[k] + end end end redirect_to admin_settings_url
Make it so you can actually pass a hash through for disc levels from admin settings. Yes I know, I'm evalling stuff which comes in on the URL. This is not good, but it's behind an admin-only filter. I NEED a better way of doing the settings page.
diff --git a/app/controllers/api/v2/commits_controller.rb b/app/controllers/api/v2/commits_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/v2/commits_controller.rb +++ b/app/controllers/api/v2/commits_controller.rb @@ -13,6 +13,7 @@ def update commit.attempt_transition_to commit_params[:state] + commit.reviewer_id = params[:commit][:reviewer_id] commit.save respond_with(commit) end
Set reviewer when changing commit state [#97001584]
diff --git a/app/models/renalware/letters/letter_query.rb b/app/models/renalware/letters/letter_query.rb index abc1234..def5678 100644 --- a/app/models/renalware/letters/letter_query.rb +++ b/app/models/renalware/letters/letter_query.rb @@ -3,7 +3,7 @@ class LetterQuery def initialize(q: nil) @q = q || {} - @q[:s] ||= ["patient_family_name, patient_given_name"] + @q[:s] ||= ["issued_on desc"] end def call
Sort by issued_on date instead of name
diff --git a/config.rb b/config.rb index abc1234..def5678 100644 --- a/config.rb +++ b/config.rb @@ -44,6 +44,10 @@ ga.development = false end +configure :development do + activate :livereload +end + # middleman-deploy activate :deploy do |deploy| deploy.method = :git
Add live reload on dev
diff --git a/lib/generators/thincloud/test/test_generator.rb b/lib/generators/thincloud/test/test_generator.rb index abc1234..def5678 100644 --- a/lib/generators/thincloud/test/test_generator.rb +++ b/lib/generators/thincloud/test/test_generator.rb @@ -12,11 +12,12 @@ gem "guard" gem "growl" gem "minitest" - gem "mocha" gem "guard-minitest" gem "minitest-rails" gem "minitest-rails-shoulda", "~> 0.1.0" + gem "rb-fsevent", "~> 0.9.1" gem "simplecov" + gem "mocha" # Must be after minitest end application do
Fix gem order for warnings
diff --git a/lib/tekeya/feed/activity/resque/untrack_feed.rb b/lib/tekeya/feed/activity/resque/untrack_feed.rb index abc1234..def5678 100644 --- a/lib/tekeya/feed/activity/resque/untrack_feed.rb +++ b/lib/tekeya/feed/activity/resque/untrack_feed.rb @@ -12,6 +12,7 @@ def self.perform(untracked_feed_key, untracker_feed_key) # get the keys to the activities so we can decrement the counters later activity_keys = ::Tekeya.redis.zrange(untracked_feed_key, 0, -1) + return if activity_keys.empty? ::Tekeya.redis.multi do # delete the latest activities of the untracked entity from the tracker feed
Return if no activity keys for untrack job
diff --git a/spec/factories.rb b/spec/factories.rb index abc1234..def5678 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -18,6 +18,12 @@ name 'zion' end + factory :player_hero do + player + hero + confidence 60 + end + factory :user do email 'jimbob@example.com' password '123abcCatDog!'
Add PlayerHero factory for tests
diff --git a/actionpack-action_caching.gemspec b/actionpack-action_caching.gemspec index abc1234..def5678 100644 --- a/actionpack-action_caching.gemspec +++ b/actionpack-action_caching.gemspec @@ -17,5 +17,5 @@ gem.add_dependency "actionpack", ">= 4.0.0", "< 7" gem.add_development_dependency "mocha" - gem.add_development_dependency "activerecord", ">= 4.0.0", "< 6" + gem.add_development_dependency "activerecord", ">= 4.0.0", "< 7" end
Update activerecord to match activesupport
diff --git a/db/migrate/20150309195038_add_index_posts.rb b/db/migrate/20150309195038_add_index_posts.rb index abc1234..def5678 100644 --- a/db/migrate/20150309195038_add_index_posts.rb +++ b/db/migrate/20150309195038_add_index_posts.rb @@ -1,7 +1,7 @@ class AddIndexPosts < ActiveRecord::Migration def change add_index :posts, :title - add_index :posts, :body + add_index :posts, :body, :length => {:body => 5 } add_index :posts, :created_at add_index :posts, :updated_at end
Add index length to body index
diff --git a/db/migrations/18_store_solutions_as_steps.rb b/db/migrations/18_store_solutions_as_steps.rb index abc1234..def5678 100644 --- a/db/migrations/18_store_solutions_as_steps.rb +++ b/db/migrations/18_store_solutions_as_steps.rb @@ -3,7 +3,7 @@ def extract_steps(solution) - solution.lines.grep(%r(//)).each_with_index.map do |line, i| + (solution || "").lines.grep(%r(//)).each_with_index.map do |line, i| moves, explanation = line.chomp.split(%r$\s*//\s*$) {moves: moves, explanation: explanation,
Fix migration for solves without solutions
diff --git a/test/plugin/remove_attachment_test.rb b/test/plugin/remove_attachment_test.rb index abc1234..def5678 100644 --- a/test/plugin/remove_attachment_test.rb +++ b/test/plugin/remove_attachment_test.rb @@ -19,6 +19,12 @@ refute_equal nil, @user.avatar end + it "doesn't nullify files if set to 0" do + @user.avatar = fakeio + @user.remove_avatar = "0" + refute_equal nil, @user.avatar + end + it "keeps the remove value" do @user.remove_avatar = true assert_equal true, @user.remove_avatar
Add test for "0" in remove_attachment plugin
diff --git a/cookbooks/rundeck/recipes/default.rb b/cookbooks/rundeck/recipes/default.rb index abc1234..def5678 100644 --- a/cookbooks/rundeck/recipes/default.rb +++ b/cookbooks/rundeck/recipes/default.rb @@ -40,7 +40,10 @@ source "rundeck.pub" end -sudoers "rundeck-admin" do - user node[:rundeck][:user] - rights "ALL = NOPASSWD: ALL" +file "/etc/sudoers.d/rundeck" do + owner "root" + group "root" + mode "0440" + content "rundeck ALL = NOPASSWD: ALL" + action :create end
Use the ghetto LWRP and not the sudoers provider that has been deprecated Former-commit-id: 477057bfb8bd3229883de6bf2be84454e2fdace7 [formerly 7723c617d48ae057ed86fb13a6467e9d59b5c8dd] [formerly eff00b7054b6aa9ab06951dbf5d6d5ab8785ba60 [formerly 969e647bf0e56557595dbee0b6c4a1cf2ee07edb [formerly 707d56db92da0fdf05746c89f5d844279b8dded3]]] Former-commit-id: 6134321bbc7a737fb2e71be772d074dc7937b348 [formerly d7ba76e7df8febf365bfb8edc3b638290d1a8fea] Former-commit-id: a58c8c3a276f17bad59e2ea7ff88f9c635766c33 Former-commit-id: 0b583855c1c9aaab2a61b71861b421d468ca86be
diff --git a/core/app/models/spree/option_type.rb b/core/app/models/spree/option_type.rb index abc1234..def5678 100644 --- a/core/app/models/spree/option_type.rb +++ b/core/app/models/spree/option_type.rb @@ -7,7 +7,7 @@ has_many :products, through: :product_option_types has_and_belongs_to_many :prototypes, join_table: 'spree_option_types_prototypes' - validates :name, presence: true, uniqueness: true + validates :name, presence: true, uniqueness: true validates :presentation, presence: true default_scope -> { order("#{self.table_name}.position") }
Remove trailing whitespace from Spree::OptionType
diff --git a/json_model.gemspec b/json_model.gemspec index abc1234..def5678 100644 --- a/json_model.gemspec +++ b/json_model.gemspec @@ -12,6 +12,8 @@ s.required_rubygems_version = ">= 1.3.6" + s.add_dependency "activemodel", "~> 3.0.0" + s.files = Dir["{lib}/**/*.rb", "LICENSE", "*.md"] s.require_path = 'lib' end
Add ActiveModel dependency - Strzalek was right ;)
diff --git a/jujube.gemspec b/jujube.gemspec index abc1234..def5678 100644 --- a/jujube.gemspec +++ b/jujube.gemspec @@ -18,7 +18,7 @@ spec.files = `git ls-files`.split($/) spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features|examples)/}) + spec.test_files = spec.files.grep(%r{^(test|spec|features|acceptance)/}) spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 1.3"
Rename examples to acceptance in the gemspec
diff --git a/db/migrate/20161207053333_trigram_indices.rb b/db/migrate/20161207053333_trigram_indices.rb index abc1234..def5678 100644 --- a/db/migrate/20161207053333_trigram_indices.rb +++ b/db/migrate/20161207053333_trigram_indices.rb @@ -0,0 +1,14 @@+class TrigramIndices < ActiveRecord::Migration[5.0] + def change + if ActiveRecord::Base.connection.adapter_name == 'PostgreSQL' + execute 'DROP INDEX IF EXISTS src_images_trgm_idx' + execute "CREATE INDEX CONCURRENTLY src_images_trgm_idx ON src_images USING gin(search_document gin_trgm_ops);" + + execute 'DROP INDEX IF EXISTS gend_images_trgm_idx' + execute "CREATE INDEX CONCURRENTLY gend_images_trgm_idx ON gend_images USING gin(search_document gin_trgm_ops);" + + execute 'DROP INDEX IF EXISTS src_sets_trgm_idx' + execute "CREATE INDEX CONCURRENTLY src_sets_trgm_idx ON src_sets USING gin(search_document gin_trgm_ops);" + end + end +end
Create trigram indices to speed up searches
diff --git a/schema.gemspec b/schema.gemspec index abc1234..def5678 100644 --- a/schema.gemspec +++ b/schema.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = 'evt-schema' s.summary = "Primitives for schema and data structure" - s.version = '2.2.4.3' + s.version = '2.2.4.4' s.description = ' ' s.authors = ['The Eventide Project']
Package version is increased from 2.2.4.3 to 2.2.4.4
diff --git a/lib/octostar/repositories/project_repository.rb b/lib/octostar/repositories/project_repository.rb index abc1234..def5678 100644 --- a/lib/octostar/repositories/project_repository.rb +++ b/lib/octostar/repositories/project_repository.rb @@ -1,6 +1,5 @@ class ProjectRepository < Hanami::Repository def find_by_account(account_id, search = {}) - query = projects.where(account_id: account_id) query = text_search(query, search[:text]) query = author_search(query, search[:author]) @@ -12,33 +11,37 @@ private + def pattern(text) + "%#{text.downcase}%" + end + def text_search(query, text) return query if text.nil? - text = "%#{text}%" - query.where { name.like(text) | description.like(text) } + text = pattern(text) + query.where { name.ilike(text) | description.ilike(text) } end def author_search(query, author) return query if author.nil? - author = "%#{author}%" - query.where { owner.like(author) } + author = pattern(author) + query.where { owner.ilike(author) } end def language_search(query, lang) return query if lang.nil? - lang = "%#{lang}%" - query.where { lower(language).like(lang) } + lang = pattern(lang) + query.where { language.ilike(lang) } end def tags_search(query, tag) return query if tag.nil? Array(tag).each do |topic| - topic = "%#{topic}%" - query = query.where { array_to_string(topics, ',').like(topic) } + topic = pattern(topic) + query = query.where { array_to_string(topics, ',').ilike(topic) } end query end
Use ILIKE instead LIKE for case-insensitive matching
diff --git a/app/controllers/revisions_controller.rb b/app/controllers/revisions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/revisions_controller.rb +++ b/app/controllers/revisions_controller.rb @@ -10,7 +10,7 @@ course = Course.find(params[:course_id]) @revisions = course.revisions.where(user_id: user.id) - .order('revisions.created_at DESC') + .order('revisions.date DESC') .eager_load(:article) .limit(params[:limit] || DEFAULT_REVISION_LIMIT) end
Order recent user revisions by date, not created_at Often a batch of newly imported edits will have the same 'created_at' timestamp, and actual most recent edits will not be included within the results.
diff --git a/actionpack-action_caching.gemspec b/actionpack-action_caching.gemspec index abc1234..def5678 100644 --- a/actionpack-action_caching.gemspec +++ b/actionpack-action_caching.gemspec @@ -17,5 +17,5 @@ gem.add_dependency "actionpack", ">= 4.0.0" gem.add_development_dependency "mocha" - gem.add_development_dependency "activerecord", ">= 4.0.0", "< 7" + gem.add_development_dependency "activerecord", ">= 4.0.0" end
Remove upper limit for activerecord Co-Authored-By: jacobbednarz <0762c1501ad00586616d8e5e435b658a6323c402@gmail.com>
diff --git a/app/models/rails_invitable/red_pocket_record.rb b/app/models/rails_invitable/red_pocket_record.rb index abc1234..def5678 100644 --- a/app/models/rails_invitable/red_pocket_record.rb +++ b/app/models/rails_invitable/red_pocket_record.rb @@ -5,5 +5,6 @@ validates :referable_id, :referable_type, presence: true validates :referable_id, uniqueness: { scope: :referable_type } + validates :amount, numericality: { greater_than: 0 } end end
Add amount validation on records
diff --git a/lib/redmine_danthes/patches/wiki_controller_patch.rb b/lib/redmine_danthes/patches/wiki_controller_patch.rb index abc1234..def5678 100644 --- a/lib/redmine_danthes/patches/wiki_controller_patch.rb +++ b/lib/redmine_danthes/patches/wiki_controller_patch.rb @@ -0,0 +1,22 @@+require_dependency 'wiki_controller' + +module RedmineDanthes + module Patches + module WikiControllerPatch + + def self.included(base) + base.class_eval do + unloadable + + helper :bootstrap + helper :danthes + end + end + + end + end +end + +unless WikiController.included_modules.include?(RedmineDanthes::Patches::WikiControllerPatch) + WikiController.send(:include, RedmineDanthes::Patches::WikiControllerPatch) +end
Fix missing method in Wiki
diff --git a/app/representers/api/min/account_representer.rb b/app/representers/api/min/account_representer.rb index abc1234..def5678 100644 --- a/app/representers/api/min/account_representer.rb +++ b/app/representers/api/min/account_representer.rb @@ -34,7 +34,7 @@ link :stories do { - href: "#{api_account_stories_path(represented)}{?filters}", + href: "#{api_account_stories_path(represented)}{?page,per,zoom,filters}", templated: true } end @@ -42,7 +42,7 @@ link :series do { - href: "#{api_account_series_index_path(represented)}{?filters}", + href: "#{api_account_series_index_path(represented)}{?page,per,zoom,filters}", templated: true } end
Support paging on min representers for series/stories
diff --git a/app/notifiers/content_item_publisher.rb b/app/notifiers/content_item_publisher.rb index abc1234..def5678 100644 --- a/app/notifiers/content_item_publisher.rb +++ b/app/notifiers/content_item_publisher.rb @@ -7,9 +7,9 @@ delegate :content_id, to: :presenter delegate :publishing_api, to: Services - def initialize(presenter, update_type: nil) + def initialize(presenter, update_type: DEFAULT_UPDATE_TYPE) @presenter = presenter - @update_type = update_type || DEFAULT_UPDATE_TYPE + @update_type = update_type end def send_to_publishing_api
Use default argument to set the update_type
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -46,11 +46,11 @@ def self_select_allowed? allowed = false - @event.sessions.each do |session| - session.tables.each do |table| - allowed |= table.gm_self_select? - end - end + # @event.sessions.each do |session| + # session.tables.each do |table| + # allowed |= table.gm_self_select? + # end + # end allowed end
Make self_select_allowed? always return false
diff --git a/app/policies/keywording_policy.rb b/app/policies/keywording_policy.rb index abc1234..def5678 100644 --- a/app/policies/keywording_policy.rb +++ b/app/policies/keywording_policy.rb @@ -5,11 +5,11 @@ end def create? - record.keywordable.has_user?(user) + record.keywordable.has_user?(user) || user.admin? end def destroy? - record.keywordable.has_user?(user) + record.keywordable.has_user?(user) || user.admin? end end
Allow admins to add keywords
diff --git a/git-switch.rb b/git-switch.rb index abc1234..def5678 100644 --- a/git-switch.rb +++ b/git-switch.rb @@ -1,7 +1,32 @@ #!/usr/bin/ruby -last_branches = `git reflog | grep "checkout: moving" | cut -d' ' -f8 | head -8 | uniq`.split.drop(1) -last_branches.each_with_index do |name, index| +require "optparse" + +branches = nil +options = {} +options[:count] = 10 +options[:show] = :checkout + +begin + OptionParser.new do |opts| + opts.banner = "Usage: git switch [options]" + + opts.on("-m", "--modified", "Show recently modified branches") do + options[:show] = :modified + end + + end.parse! +rescue OptionParser::InvalidOption => e + puts e.to_s + exit +end + +case options[:show] +when :modified + branches = `git for-each-ref --format="%(refname)" --sort='-authordate' 'refs/heads' | sed 's/refs\\/heads\\///' | head -#{options[:count]}`.split +else + branches = `git reflog | grep "checkout: moving" | cut -d' ' -f8 | uniq | head -#{options[:count] + 1}`.split.drop(1) +end + +branches.each_with_index do |name, index| puts "#{name}" end -#nro = $stdin.readline.to_i -#`git checkout #{last_branches[nro]}`
Add option to show last modified branches
diff --git a/schema.gemspec b/schema.gemspec index abc1234..def5678 100644 --- a/schema.gemspec +++ b/schema.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = 'evt-schema' s.summary = "Primitives for schema and data structure" - s.version = '2.2.6.1' + s.version = '2.2.7.0' s.description = ' ' s.authors = ['The Eventide Project']
Package version is increased from 2.2.6.1 to 2.2.7.0
diff --git a/features/support/env.rb b/features/support/env.rb index abc1234..def5678 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -29,4 +29,9 @@ c.cassette_library_dir = 'fixtures/vcr_cassettes' c.hook_into :webmock end + + # Clean up any state left behind + at_exit do + # TODO clean up things created in Xero + end end
Add a place for post-test cleanup to go Tests should be idempotent when run without VCR. 0:05
diff --git a/lib/atlas/input.rb b/lib/atlas/input.rb index abc1234..def5678 100644 --- a/lib/atlas/input.rb +++ b/lib/atlas/input.rb @@ -4,7 +4,6 @@ DIRECTORY = 'inputs' - attribute :id, Integer attribute :query, String attribute :share_group, String attribute :label, String
Remove "id" attribute from Input Ref quintel/etsource#701
diff --git a/app/controllers/application.rb b/app/controllers/application.rb index abc1234..def5678 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -10,6 +10,7 @@ before_filter :can_create?, :only => [:new, :create] before_filter :can_edit?, :only => [:edit, :update, :destroy] + before_filter :current_network map_resource :profile, :singleton => true, :class => "User", :find => :current_user
Load current_network in an ApplicationController before_filter
diff --git a/lib/encrypt.rb b/lib/encrypt.rb index abc1234..def5678 100644 --- a/lib/encrypt.rb +++ b/lib/encrypt.rb @@ -12,13 +12,16 @@ end def decrypt key - return nil unless self.bytesize > 32 - cipher = OpenSSL::Cipher::AES256.new(:CTR) - cipher.decrypt - salt = self.byteslice(0..15) - cipher.key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(key, salt, 20000, 32) - cipher.iv = self.byteslice(16..31) - cipher.update(self.byteslice(32..-1)) << cipher.final + if self.bytesize > 32 + cipher = OpenSSL::Cipher::AES256.new(:CTR) + cipher.decrypt + salt = self.byteslice(0..15) + cipher.key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(key, salt, 20000, 32) + cipher.iv = self.byteslice(16..31) + cipher.update(self.byteslice(32..-1)) << cipher.final + else + nil + end end end end
Use if statement instead of return.
diff --git a/app/helpers/sessions_helper.rb b/app/helpers/sessions_helper.rb index abc1234..def5678 100644 --- a/app/helpers/sessions_helper.rb +++ b/app/helpers/sessions_helper.rb @@ -1,18 +1,27 @@ module SessionsHelper - # signs in a user + # signs in the current user def sign_in user session[:user_id] = user.id end - # signs out a user + # signs out the current user def sign_out session.delete :user_id @current_user = nil end - # returns the current signed in user, if one exists + # returns the current signed in user, if one exists, through either + # temporary or persistent session def current_user - @current_user ||= User.find_by(id: session[:user_id]) + if user_id = session[:user_id] + @current_user ||= User.find_by(id: user_id) + elsif user_id = cookies.signed[:user_id] + user = User.find_by(id: user_id) + if user && user.authenticated?(cookies[:remember_token]) + sign_in user + @current_user = user + end + end end # is user signed in?
Modify current_user action in sessions helper to make use of persistent sessions (secure cookies).
diff --git a/app/lib/test_pals_mock_ldap.rb b/app/lib/test_pals_mock_ldap.rb index abc1234..def5678 100644 --- a/app/lib/test_pals_mock_ldap.rb +++ b/app/lib/test_pals_mock_ldap.rb @@ -1,22 +1,4 @@ class TestPalsMockLDAP - - TEST_PAL_NAMES = %w[ - uri - rich - vivian - alonso - silva - laura - sarah - marcus - sofia - jodi - bill - hugo - fatima - ] - - TEST_PAL_EMAILS = TEST_PAL_NAMES.map { |n| "#{n}@demo.studentinsights.org" } def initialize(options) @options = options @@ -27,7 +9,7 @@ def bind raise 'LDAP error' unless ::EnvironmentVariable.is_true('USE_TEST_PALS_LDAP') - return TEST_PAL_EMAILS.include?(@email) && @password == 'demo-password' + return Educator.find_by_email(@email).present? && @password == 'demo-password' end def get_operation_result
Read educator emails in from database
diff --git a/app/mailers/feedback_mailer.rb b/app/mailers/feedback_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/feedback_mailer.rb +++ b/app/mailers/feedback_mailer.rb @@ -9,7 +9,7 @@ message = params[:message] || '[no message entered]' from = params[:from].blank? ? "anonymous@none.com" : params[:from] user_agent = params[:agent] || '[no user agent recorded]' - url = ENV['DOMAIN_NAME'] + url = ENV['CANONICAL_URL'] site_title = SETTINGS[:site_title] subject = "[#{site_title} Feedback] #{from}"
Use CANONICAL_URL env var to identify URL in feedback mailer
diff --git a/app/mailers/follower_mailer.rb b/app/mailers/follower_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/follower_mailer.rb +++ b/app/mailers/follower_mailer.rb @@ -2,7 +2,7 @@ helper :application - def self.live_effort_email(follower, split_times) + def live_effort_email(follower, split_times) @follower = follower @split_times = split_times @effort = split_times.first.effort
Change live_effort_email back to instance method.
diff --git a/app/models/concerns/wp_term.rb b/app/models/concerns/wp_term.rb index abc1234..def5678 100644 --- a/app/models/concerns/wp_term.rb +++ b/app/models/concerns/wp_term.rb @@ -2,6 +2,8 @@ extend ActiveSupport::Concern def update_term(json) + return unless json.is_a?(Hash) + self.class.mappable_wordpress_attributes.each do |wp_attribute| send("#{wp_attribute}=", json[wp_attribute]) end
Fix not found json for terms When a term no longer exists on the WP side the json will return an array containing an error message. This breaks the assignment of values because the look up is done with a string.
diff --git a/lib/grampus.rb b/lib/grampus.rb index abc1234..def5678 100644 --- a/lib/grampus.rb +++ b/lib/grampus.rb @@ -21,6 +21,6 @@ end def alive?(pid) - Process.getsid(pid) rescue false + Process.getpgid(pid) rescue false end end
Use Process.getpgid to see if process is alive as getsid is only available from ruby 2.0.0 onwards
diff --git a/lib/cuesnap/cli.rb b/lib/cuesnap/cli.rb index abc1234..def5678 100644 --- a/lib/cuesnap/cli.rb +++ b/lib/cuesnap/cli.rb @@ -9,6 +9,11 @@ main do |mp3_file, cue_file| # no-numbers comes in false when it's set, I know, crazy. options[:no_numbers] = !options[:'no-numbers'] if options.has_key?(:'no-numbers') + + # Check if mp3splt is accessible else exit + if (!command_accessible?('mp3splt')) + exit_now! "I looked for mp3splt but couldn't find it. Perhaps you need to install it." + end begin splitter = CueSnap::Splitter.new(mp3_file, cue_file, options) @@ -40,5 +45,15 @@ def self.file_not_found(file) help_now! "I looked for #{file}, but didn't find it." end + + def self.command_accessible?(cmd) + ENV['PATH'].split(':').each do |folder| + exists = File.exists?(folder + '/' + cmd) + exec = File.executable?(folder + '/' + cmd) if exists + return true if exec + end + return false; + end + end end
Determine if mp3splt is accessible
diff --git a/features/support/env.rb b/features/support/env.rb index abc1234..def5678 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -7,13 +7,18 @@ module Petstore class Client def initialize(opts = {}) + resp_headers = {"Content-Type" => "application/json", + "Connection" => "close", + "Access-Control-Allow-Headers" => "Content-Type, api_key, Authorization", + "Access-Control-Allow-Methods" => "GET, POST, DELETE, PUT, PATCH, OPTIONS"} + @conn = Faraday.new do |builder| builder.adapter :test do |stub| stub.get('/pet/1') { |env| [200, {}, "{\"id\": 1}"] } - stub.get('/pet/findByStatus?status=sold') { |env| [200, {}, "[{\"id\": 1}, {\"id\": 2}]"] } - stub.get('/pet/findByTags?tags=tag1%2Ctag2') { |env| [200, {}, "[{\"id\": 1}]"] } - stub.post('/pet', {"id"=>"1", "name"=>"Rex"}) { |env| [200, {}, "{\"code\": 200, \"message\": \"SUCCESS\"}"] } - stub.put('/pet', {"id"=>"2", "name"=>"RinTinTin"}) { |env| [200, {}, "{\"id\": 2, \"name\": \"RinTinTin\"}"] } + stub.get('/pet/findByStatus?status=sold') { |env| [200, resp_headers, "[{\"id\": 1}, {\"id\": 2}]"] } + stub.get('/pet/findByTags?tags=tag1%2Ctag2') { |env| [200, resp_headers, "[{\"id\": 1}]"] } + stub.post('/pet', {"id"=>"1", "name"=>"Rex"}) { |env| [200, resp_headers, "{\"code\": 200, \"message\": \"SUCCESS\"}"] } + stub.put('/pet', {"id"=>"2", "name"=>"RinTinTin"}) { |env| [200, resp_headers, "{\"id\": 2, \"name\": \"RinTinTin\"}"] } stub.delete('/pet/1') { |env| [200, {}, "no content"] } end end
Add response headers to request stubs.
diff --git a/lib/ansible_tower_client/collection_methods.rb b/lib/ansible_tower_client/collection_methods.rb index abc1234..def5678 100644 --- a/lib/ansible_tower_client/collection_methods.rb +++ b/lib/ansible_tower_client/collection_methods.rb @@ -9,7 +9,7 @@ results += body["results"] end - results.collect { |raw| new(raw) } + build_collection(results) end def find(id) @@ -17,6 +17,20 @@ raise ResourceNotFound.new(self, :id => id) if body['id'].nil? new(body) end + + private + + def build_collection(results) + results.collect do |result| + klass = class_from_type(result["type"]) + klass.new(result) + end + end + + def class_from_type(type) + camelized = type.split("_").collect(&:capitalize).join + AnsibleTowerClient.const_get(camelized) + end end end
Allow collections to be built based on the type defined on the object
diff --git a/init.rb b/init.rb index abc1234..def5678 100644 --- a/init.rb +++ b/init.rb @@ -8,6 +8,8 @@ url 'https://github.com/jgraichen/redmine_dashboard' author_url 'mailto:jg@altimos.de' + requires_redmine :version_or_higher => '2.1' + project_module :dashboard do permission :view_dashboards, { :rdb_dashboard => [:index ],
Add required redmine version check.
diff --git a/lib/engineyard-serverside-adapter/arguments.rb b/lib/engineyard-serverside-adapter/arguments.rb index abc1234..def5678 100644 --- a/lib/engineyard-serverside-adapter/arguments.rb +++ b/lib/engineyard-serverside-adapter/arguments.rb @@ -1,27 +1,22 @@ module EY module Serverside class Adapter - class Arguments < Struct.new(:app, :environment_name, :account_name, :config, :framework_env, :instances, :migrate, :ref, :repo, :stack, :verbose) + class Arguments - def app=(app) - enforce_nonempty!('app', app) - super + def self.nonempty_writer(*names) + names.each do |name| + define_method(:"#{name}=") do |value| + if value.to_s.empty? + raise ArgumentError, "Value for '#{name}' must be non-empty." + end + instance_variable_set("@#{name}", value) + end + end end - def environment_name=(env) - enforce_nonempty!('environment_name', env) - super - end - - def account_name=(acc) - enforce_nonempty!('account_name', acc) - super - end - - def framework_env=(framework_env) - enforce_nonempty!('framework_env', framework_env) - super - end + attr_reader :app, :environment_name, :account_name, :config, :framework_env, :instances, :migrate, :ref, :repo, :stack, :verbose + nonempty_writer :app, :environment_name, :account_name, :framework_env, :ref, :repo, :stack + attr_writer :config, :migrate, :verbose def instances=(instances) unless instances.respond_to?(:each) @@ -38,30 +33,7 @@ end end - super - end - - def ref=(ref) - enforce_nonempty!('ref', ref) - super - end - - def repo=(repo) - enforce_nonempty!('repo', repo) - super - end - - def stack=(stack) - enforce_nonempty!('stack', stack) - super - end - - private - - def enforce_nonempty!(name, value) - if value.to_s.empty? - raise ArgumentError, "Value for '#{name}' must be non-empty." - end + @instances = instances end end
Reduce Arguments class down to attr_readers/writers/nonempty_writers
diff --git a/lib/puppet-lint/plugins/check_documentation.rb b/lib/puppet-lint/plugins/check_documentation.rb index abc1234..def5678 100644 --- a/lib/puppet-lint/plugins/check_documentation.rb +++ b/lib/puppet-lint/plugins/check_documentation.rb @@ -1,11 +1,28 @@ class PuppetLint::Plugins::CheckDocumentation < PuppetLint::CheckPlugin + def whitespace_tokens + @whitespace_tokens ||= { + :WHITESPACE => true, + :NEWLINE => true, + :INDENT => true, + } + end + + def comment_tokens + @comment_tokens ||= { + :COMMENT => true, + :MLCOMMENT => true, + :SLASH_COMMENT => true, + } + end + check 'documentation' do (class_indexes + defined_type_indexes).each do |item_idx| - prev_token = tokens[0..item_idx[:start] - 1].reject { |token| - {:WHITESPACE => true, :NEWLINE => true, :INDENT => true}.include? token.type - }.last + prev_token = tokens[item_idx[:start] - 1] + while whitespace_tokens.include? prev_token.type + prev_token = prev_token.prev_token + end - unless {:COMMENT => true, :MLCOMMENT => true, :SLASH_COMMENT => true}.include? prev_token.type + unless comment_tokens.include? prev_token.type first_token = tokens[item_idx[:start]] if first_token.type == :CLASS type = 'class'
Replace a potentially big loop with a smaller one
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -4,7 +4,7 @@ IPAddr::RE_IPV6ADDRLIKE_COMPRESSED) def apps_hosts - hosts = %w(us eu tokyo).map{|region| "ping-#{region}.herokuapp.com"} + hosts = %w(us eu).map{|region| "ping-#{region}.herokuapp.com"} if request and not request.host.blank? hosts.reject!{|host| host == request.host} end
Remove tokyo from list of available regions/spaces
diff --git a/app/helpers/import_jobs_helper.rb b/app/helpers/import_jobs_helper.rb index abc1234..def5678 100644 --- a/app/helpers/import_jobs_helper.rb +++ b/app/helpers/import_jobs_helper.rb @@ -5,8 +5,10 @@ return unless import_job.status? status_colors = { - waiting: "blue", - processing: "orange", + waiting: "black", + :extracting => "yellow", + :transforming => "orange", + :loading => "blue", finished: "green", failed: "red" }.with_indifferent_access
Update import job helper colors
diff --git a/app/helpers/vote_counts_helper.rb b/app/helpers/vote_counts_helper.rb index abc1234..def5678 100644 --- a/app/helpers/vote_counts_helper.rb +++ b/app/helpers/vote_counts_helper.rb @@ -29,7 +29,7 @@ user = User.find_or_create_by(link: user_link) user.display_name = username - user.current_score = vote_count.content + user.current_score += rand(1..30) changed = user.changed? or user.new_record? @@ -40,7 +40,7 @@ end VoteCount.import vote_counts - ActionCable.server.broadcast "vote_counts", vote_counts.map {|n| [n.user_id.to_s, n.score] }.to_h + ActionCable.server.broadcast "vote_counts", vote_counts.map {|n| [n.user_id.to_s, n.score] }.to_h if vote_counts.present? return true
Add some test-in-prod code; optimizations
diff --git a/lib/activeadmin_settings_cached/coercions.rb b/lib/activeadmin_settings_cached/coercions.rb index abc1234..def5678 100644 --- a/lib/activeadmin_settings_cached/coercions.rb +++ b/lib/activeadmin_settings_cached/coercions.rb @@ -46,7 +46,7 @@ end def value_or_default(type, value, default) - result = Dry::Types["form.#{type}"].call(value) + result = Dry::Types["params.#{type}"].call(value) if Dry::Types[type].valid?(result) result else
Update to reflect on dry-type change: Renamed Types::Form to Types::Params
diff --git a/lib/bosh/gen/generators/extract_job_generator.rb b/lib/bosh/gen/generators/extract_job_generator.rb index abc1234..def5678 100644 --- a/lib/bosh/gen/generators/extract_job_generator.rb +++ b/lib/bosh/gen/generators/extract_job_generator.rb @@ -35,7 +35,9 @@ def copy_dependent_sources @blobs = false @packages.each do |package| - directory "src/#{package}" if File.exist?(File.join(source_release_path, "src", package)) + if File.exist?(File.join(source_release_path, "src", package)) + directory "src/#{package}" + end if File.exist?(File.join(source_release_path, "blobs", package)) directory "blobs/#{package}" @blobs = true
Clean up for 80 char lines
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -3,11 +3,16 @@ describe ApplicationController do it 'safely caches a page' do define_spec_public_cache_directory + file_path = path_for_file_in_spec_public_cache_directory('/test.html') + File.delete file_path if File.exists? file_path + File.should_not be_exist(file_path) + ApplicationController.perform_caching = true ApplicationController.cache_page 'test', '/test' - file_path = path_for_file_in_spec_public_cache_directory('/test.html') File.should be_exist(file_path) + ApplicationController.perform_caching = false + File.delete(file_path) end end
Make sure cached file does not exist before and after spec.
diff --git a/lib/link_thumbnailer/scrapers/default/favicon.rb b/lib/link_thumbnailer/scrapers/default/favicon.rb index abc1234..def5678 100644 --- a/lib/link_thumbnailer/scrapers/default/favicon.rb +++ b/lib/link_thumbnailer/scrapers/default/favicon.rb @@ -18,6 +18,7 @@ uri = ::URI.parse(href) uri.scheme ||= website.url.scheme uri.host ||= website.url.host + uri.path = uri.path&.sub(%r{^(?=[^\/])}, '/') uri rescue ::URI::InvalidURIError nil
Fix problem with uri path
diff --git a/lib/chef/knife/windows_helper.rb b/lib/chef/knife/windows_helper.rb index abc1234..def5678 100644 --- a/lib/chef/knife/windows_helper.rb +++ b/lib/chef/knife/windows_helper.rb @@ -18,17 +18,13 @@ require 'chef/knife' require 'chef/knife/winrm' -require 'chef/knife/bootstrap_windows_ssh' -require 'chef/knife/bootstrap_windows_winrm' require 'chef/knife/wsman_test' class Chef class Knife class WindowsHelper < Knife - banner "#{BootstrapWindowsWinrm.banner}\n" + - "#{BootstrapWindowsSsh.banner}\n" + - "#{Winrm.banner}\n" + + banner "#{Winrm.banner}\n" + "#{WsmanTest.banner}" end end
Remove bootstrap related dependency from windows helper Signed-off-by: Vivek Singh <ffdfd29e24c206a3c24e1247563eb4c218c7ffa5@msystechnologies.com>
diff --git a/lib/rspec/rails/matchers/relation_match_array.rb b/lib/rspec/rails/matchers/relation_match_array.rb index abc1234..def5678 100644 --- a/lib/rspec/rails/matchers/relation_match_array.rb +++ b/lib/rspec/rails/matchers/relation_match_array.rb @@ -1,15 +1,3 @@ if defined?(ActiveRecord::Relation) RSpec::Matchers::OperatorMatcher.register(ActiveRecord::Relation, '=~', RSpec::Matchers::BuiltIn::MatchArray) - - module RSpec - module Rails - module RelationOperationMatcherHook - def inherited(subclass) - RSpec::Matchers::OperatorMatcher.register(subclass, '=~', RSpec::Matchers::BuiltIn::MatchArray) - super - end - end - end - end - ActiveRecord::Relation.extend(RSpec::Rails::RelationOperationMatcherHook) end
Revert "Supports Rails 4 where each model has its own Relation subclass" This reverts commit 3b28ce7aa0f12a24616007827112e1b5ca85eea3. * OperatorRegistry now matches on ancestor chain, so this change is no longer necessary. See https://github.com/rspec/rspec-expectations/commit/e5e5a7475cf1f993b9e1bac8df485df29a544d95.
diff --git a/src/testup.rb b/src/testup.rb index abc1234..def5678 100644 --- a/src/testup.rb +++ b/src/testup.rb @@ -20,7 +20,7 @@ # Plugin information PLUGIN_ID = 'TestUp2'.freeze - PLUGIN_NAME = 'TestUp²'.freeze + PLUGIN_NAME = 'TestUp'.freeze PLUGIN_VERSION = '2.0.0'.freeze # Resource paths
Rename plugin name from TestUp² to just TestUp.
diff --git a/app/models/catch.rb b/app/models/catch.rb index abc1234..def5678 100644 --- a/app/models/catch.rb +++ b/app/models/catch.rb @@ -2,6 +2,8 @@ scope :recent, -> { order 'caught_at DESC' } scope :top_10, -> { limit 10 } scope :for_competition, ->(competition) { where competition: competition } + + attr_reader :image_remote_url has_attached_file :image, styles: { medium: '300x300#', thumbnail: '60x60#' }, @@ -25,4 +27,13 @@ def to_param "#{id} #{species}".parameterize end + + # see: https://github.com/thoughtbot/paperclip/wiki/Attachment-downloaded-from-a-URL + def image_remote_url=(url_value) + self.image = URI.parse url_value + # Assuming url_value is http://example.com/photos/face.png + # avatar_file_name == "face.png" + # avatar_content_type == "image/png" + @image_remote_url = url_value + end end
Add remote image URL support
diff --git a/lib/dreamhost_personal_backup.rb b/lib/dreamhost_personal_backup.rb index abc1234..def5678 100644 --- a/lib/dreamhost_personal_backup.rb +++ b/lib/dreamhost_personal_backup.rb @@ -4,8 +4,8 @@ module DreamhostPersonalBackup VERSION = '0.1' - def self.perform_backup(parameters = {}) - config_parameters = DreamhostPersonalBackup::Configurator.process_config_file(parameters[:config_file]) + def self.perform_backup(config_file) + config_parameters = DreamhostPersonalBackup::Configurator.process_config_file(config_file) logger = config_parameters[:logger]
Update main method to only accept a config file The main perform_backup method should only accept an optional config file and not a hash of parameters.
diff --git a/solo-config.rb b/solo-config.rb index abc1234..def5678 100644 --- a/solo-config.rb +++ b/solo-config.rb @@ -1,6 +1,14 @@-cookbook_path [ '/tmp/chef/recipes/cookbooks', '/tmp/chef/recipes/site-cookbooks' ] -file_cache_path '/tmp/chef/recipes/' -file_store_path '/tmp/chef/recipes/' +chef_base = '/tmp/chef/recipes/' + +chef_cookbook_dirs = [] +Dir.entries(chef_base).each do |d| + next if d[0,1] == '.' + chef_cookbook_dirs << '%s%s' % [ chef_base, d ] +end + +cookbook_path chef_cookbook_dirs +file_cache_path chef_base +file_store_path chef_base log_level :info log_location STDOUT -ssl_verify_mode :verify_none+ssl_verify_mode :verify_none
Support any number of cookbook folders
diff --git a/lib/lanes/api/formatted_reply.rb b/lib/lanes/api/formatted_reply.rb index abc1234..def5678 100644 --- a/lib/lanes/api/formatted_reply.rb +++ b/lib/lanes/api/formatted_reply.rb @@ -0,0 +1,50 @@+module Lanes + module API + module FormattedReply + # json methods + # constructs a Hash with success, messages, and data keys and + # populates them appropriately + + def std_api_reply(type, data, options) + success = options[:success].nil? ? true : options[:success] + json = {} + if data.is_a?(ActiveRecord::Base) && data.errors.any? + json[:errors] = {} + success = false + data.errors.each{ | attr, message | + json[:errors][attr] = message + } + end + if options[:total_count] + json[:total] = options.delete(:total_count) + end + json.merge( + success: success, + message: options[:messsage] || json_status_str(data, type.to_s.capitalize, success), + data: success ? records_for_reply(data, type, options) : [] + ) + end + + # @return Array<Array> returns either an array of fields + def records_for_reply(data, type, options) + return [] if :destroy == type + if options[:format] == 'array' + data.pluck( *requested_fields ) + else + data.as_json(options) + end + end + + def json_status_str(record, type, success) + if success + return type + " succeeded" + elsif record + return type + " failed: " + record.errors.full_messages.join("; ") + else + return "Record not found" + end + end + + end + end +end
Split formatting methods out into module
diff --git a/vagrant-parallels.gemspec b/vagrant-parallels.gemspec index abc1234..def5678 100644 --- a/vagrant-parallels.gemspec +++ b/vagrant-parallels.gemspec @@ -16,10 +16,11 @@ spec.required_rubygems_version = '>= 1.3.6' spec.rubyforge_project = 'vagrant-parallels' + spec.add_dependency 'nokogiri' + # Constraint rake to properly handle deprecated method usage # from within rspec spec.add_development_dependency 'rake', '~> 11.3.0' - spec.add_development_dependency 'nokogiri' spec.add_development_dependency 'rspec', '~> 2.14.0' spec.files = Dir['lib/**/*', 'locales/**/*', 'README.md', 'CHANGELOG.md', 'LICENSE.txt']
Add "nokogiri" as a runtime dependency
diff --git a/lib/rails_typed_settings/base.rb b/lib/rails_typed_settings/base.rb index abc1234..def5678 100644 --- a/lib/rails_typed_settings/base.rb +++ b/lib/rails_typed_settings/base.rb @@ -25,7 +25,7 @@ def setting(var_name, var_type, opts = {}) unless Setting.find_by(var_name: var_name.to_s) s = Setting.create(var_name: var_name.to_s, var_type: var_type.to_s) - s.d_val = opts[:default] if opts[:default] + s.d_val = opts[:default] if opts.has_key?(:default) s.save! end end
Fix issue where defaults wasn't being set if default => false.
diff --git a/lib/gov_kit/acts_as_noteworthy.rb b/lib/gov_kit/acts_as_noteworthy.rb index abc1234..def5678 100644 --- a/lib/gov_kit/acts_as_noteworthy.rb +++ b/lib/gov_kit/acts_as_noteworthy.rb @@ -13,7 +13,7 @@ unless included_modules.include? InstanceMethods instance_eval do - has_many :mentions, :as => :owner + has_many :mentions, :as => :owner, :order => 'date desc' with_options :as => :owner, :class_name => "Mention" do |c| c.has_many :google_news_mentions, :conditions => {:search_source => "Google News"}, :order => 'date desc'
Add a default order to mentions
diff --git a/lib/metamuse/services/echonest.rb b/lib/metamuse/services/echonest.rb index abc1234..def5678 100644 --- a/lib/metamuse/services/echonest.rb +++ b/lib/metamuse/services/echonest.rb @@ -4,6 +4,7 @@ include HTTParty base_uri 'http://developer.echonest.com/api' default_params :version => 3 + format :xml class << self attr_reader :api_key
Set xml format for requests
diff --git a/activemodel-email_address_validator.gemspec b/activemodel-email_address_validator.gemspec index abc1234..def5678 100644 --- a/activemodel-email_address_validator.gemspec +++ b/activemodel-email_address_validator.gemspec @@ -20,6 +20,6 @@ spec.add_dependency "activemodel", ">= 4.0", "< 6.0" spec.add_development_dependency "bundler", "~> 2.0" - spec.add_development_dependency "rake", "~> 10.0" + spec.add_development_dependency "rake", "~> 12.3" spec.add_development_dependency "minitest" end
Update rake requirement from ~> 10.0 to ~> 12.3 Updates the requirements on [rake](https://github.com/ruby/rake) to permit the latest version. - [Release notes](https://github.com/ruby/rake/releases) - [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc) - [Commits](https://github.com/ruby/rake/compare/rake-10.0.0...v12.3.3) Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/benchmark/tiers/0/bm_vm1_const.rb b/benchmark/tiers/0/bm_vm1_const.rb index abc1234..def5678 100644 --- a/benchmark/tiers/0/bm_vm1_const.rb +++ b/benchmark/tiers/0/bm_vm1_const.rb @@ -4,7 +4,11 @@ Const = 1 Benchmark.ips do |x| - x.report "const read", <<-CODE - Const - CODE + x.report "const read" do |times| + i = 0 + while i < times + Const + i += 1 + end + end end
Use loop style for const benchmark
diff --git a/lib/questionable/admin/answers.rb b/lib/questionable/admin/answers.rb index abc1234..def5678 100644 --- a/lib/questionable/admin/answers.rb +++ b/lib/questionable/admin/answers.rb @@ -13,7 +13,7 @@ column(:assignment) column(:option) column(:message) - default_actions + actions end end end
Update default_actions to actions for new active admin
diff --git a/spec/classes/kindle_spec.rb b/spec/classes/kindle_spec.rb index abc1234..def5678 100644 --- a/spec/classes/kindle_spec.rb +++ b/spec/classes/kindle_spec.rb @@ -3,7 +3,7 @@ describe 'kindle' do it do should contain_package('Kindle').with({ - :source => 'http://kindleformac.amazon.com/40381/KindleForMac.dmg' + :source => 'http://kindleformac.amazon.com/40381/KindleForMac.dmg', :provider => 'appdmg' }) end
Add missing comma in spec_helper.rb Hopefully fixing the Travis build
diff --git a/spec/classes/mod/jk_spec.rb b/spec/classes/mod/jk_spec.rb index abc1234..def5678 100644 --- a/spec/classes/mod/jk_spec.rb +++ b/spec/classes/mod/jk_spec.rb @@ -17,7 +17,11 @@ it { is_expected.to create_class('apache::mod::jk') } it { is_expected.to contain_class('apache') } it { is_expected.to contain_apache__mod('jk') } - it { is_expected.to contain_file('jk.conf') } + it { is_expected.to contain_file('jk.conf').that_notifies('Class[apache::service]').with( + :ensure => file, + :content => /<IfModule jk_module>/, + :content => /<\/IfModule>/, + )} end
Revert "Remove parameters from jk.conf file in mod::jk spec test" This reverts commit 1c2a3d84b9cdec7c254d8cc23b456c22bd42877b.
diff --git a/spec/ubuntu/apt-get_spec.rb b/spec/ubuntu/apt-get_spec.rb index abc1234..def5678 100644 --- a/spec/ubuntu/apt-get_spec.rb +++ b/spec/ubuntu/apt-get_spec.rb @@ -16,3 +16,22 @@ describe command('apt-get -y remove apg') do its(:exit_status) { should eq 0 } end + +# Make sure we apt pin udev in Ubuntu 16.XX and 17.XX +if property[:name] =~ /Ubuntu 16./ + describe file('/etc/apt/preferences.d/udev') do + it { should be_file } + its(:content) { should match /Package: udev/ } + its(:content) { should match /Pin: release */ } + its(:content) { should match /Pin-Priority: -1/ } + end +end + +if property[:name] =~ /Ubuntu 17./ + describe file('/etc/apt/preferences.d/udev') do + it { should be_file } + its(:content) { should match /Package: udev/ } + its(:content) { should match /Pin: release */ } + its(:content) { should match /Pin-Priority: -1/ } + end +end
Test for apt pinning of udev in Ubuntu 16.xx and 17.xx Adding 17.XX to be preemptive.
diff --git a/review-repos/report_license.rb b/review-repos/report_license.rb index abc1234..def5678 100644 --- a/review-repos/report_license.rb +++ b/review-repos/report_license.rb @@ -21,8 +21,7 @@ begin license=Licensee::GitProject.new(dir).license rescue ArgumentError - puts "Error getting license for #{dir}" - return " <reporting type='LicenseFilesReporter'>License causes error</reporting>\n" + return " <reporting type='LicenseReporter'>License causes error</reporting>\n" end if(license)
Stop printing to stdout and fix the report the error ends up on
diff --git a/app/formatters/duty_expression_formatter.rb b/app/formatters/duty_expression_formatter.rb index abc1234..def5678 100644 --- a/app/formatters/duty_expression_formatter.rb +++ b/app/formatters/duty_expression_formatter.rb @@ -0,0 +1,59 @@+class DutyExpressionFormatter + def self.format(duty_expression_id, duty_amount, monetary_unit, measurement_unit, measurement_unit_qualifier) + @formatted = case duty_expression_id + when "01" + if monetary_unit.present? && measurement_unit.present? + sprintf("%.2f %s/%s", duty_amount, monetary_unit, measurement_unit.description) + else + sprintf("%.2f%", duty_amount) + end + when "04" + sprintf("+ %.2f %s/%s", duty_amount, + monetary_unit, + measurement_unit.description) + when "12" + "+ EA" + when "14" + "+ EA R" + when "15" + sprintf("min %.2f %s/(%s/%s)", duty_amount, + monetary_unit, + measurement_unit.description, + measurement_unit_qualifier.description) + when "17" + sprintf("max %.2f%", duty_amount) + when "19" + sprintf("+ %.2f %s/%s", duty_amount, + monetary_unit, + measurement_unit.description) + when "21" + "+ AD S/Z" + when "25" + "+ AD S/Z R" + when "27" + "+ AD F/M" + when "29" + "+ AD F/M R" + when "35" + sprintf("max %.2f %s/%s", duty_amount, + monetary_unit, + measurement_unit.description) + when "36" + # TODO CIF + when "37" + # Empty + when "40" + # TODO Empty, check 21050099 for export + when "41" + # TODO Empty, check 21050099 for export + when "42" + # TODO Empty, check 21050099 for export + when "43" + # TODO Empty, check 21050099 for export + when "44" + # TODO Empty, check 21050099 for export + when "99" + measurement_unit.description + end + end +end
Add duty expression formatter (moved from backend app).
diff --git a/app/integrations/open_weather_map_client.rb b/app/integrations/open_weather_map_client.rb index abc1234..def5678 100644 --- a/app/integrations/open_weather_map_client.rb +++ b/app/integrations/open_weather_map_client.rb @@ -22,7 +22,7 @@ end begin - return Maybe(client.get(url_for(*coordinates))).map { |res| JSON.parse(res.body).presence } + return Maybe(client.get(url_for(*coordinates))).fmap { |res| JSON.parse(res.body).presence } rescue Net::OpenTimeout => e logger.warn "Net::OpenTimeout: Cannot open service OpenWeatherMap in time (#{e.message})" rescue Net::ReadTimeout => e
Fix wring method called on Maybe
diff --git a/lib/tablebuilder/table_builder.rb b/lib/tablebuilder/table_builder.rb index abc1234..def5678 100644 --- a/lib/tablebuilder/table_builder.rb +++ b/lib/tablebuilder/table_builder.rb @@ -0,0 +1,79 @@+module Tablebuilder + class Column + attr_accessor :column, :header, :content, :context + + def render_header + if @header.nil? + @context.t(".#{@column}") + elsif @header.respond_to? :call + @header.call + else + @header + end + end + + def render_content(object) + if @content.nil? + object.send @column + elsif self.content.respond_to? :call + @context.capture(object, &@content) + else + @content + end + end + end + + class TableBuilder + include ActionView::Helpers::TagHelper + + attr_accessor :output_buffer + + def initialize(model_list, context, options) + @model_list = model_list + @context = context + @options = options + @columns = [] + end + + def column(column, options = {}, &block) + col = Column.new + col.context = @context + col.column = column + col.content = block || options[:content] + col.header = options[:header] + @columns << col + end + + def render_table + content_tag :table do + render_thead + render_tbody + end + end + + private + + def render_thead + content_tag :tr do + @columns.map do |column| + content_tag :th do + column.render_header + end + end.join.html_safe + end + end + + def render_tbody + content_tag :tbody do + @model_list.map do |object| + content_tag :tr do + @columns.map do |column| + content_tag :td, column.render_content(object) + end.join.html_safe + end + end.join.html_safe + end + end + + end +end +
Add first version of TableBuilder class
diff --git a/app/policies/question_attachments_policy.rb b/app/policies/question_attachments_policy.rb index abc1234..def5678 100644 --- a/app/policies/question_attachments_policy.rb +++ b/app/policies/question_attachments_policy.rb @@ -1,21 +1,9 @@ class QuestionAttachmentsPolicy < ApplicationPolicy require_params :task + include TaskAccessCriteria def destroy? - current_user.admin? || task_owner? || metadata_task_collaborator? || has_sufficient_role? + current_user.admin? || task_owner? || metadata_task_collaborator? || can_view_all_manuscript_managers_for_journal? || can_view_manuscript_manager_for_paper? end - private - - def task_owner? - current_user.tasks.where(id: task.id).first - end - - def metadata_task_collaborator? - task.is_metadata? && task.paper.collaborators.exists?(current_user) - end - - def has_sufficient_role? - current_user.roles.where(journal_id: task.journal.id, can_view_all_manuscript_managers: true).exists? - end end
Use mixin in question attachments policy
diff --git a/lib/sideload_serializer/camelized_adapter.rb b/lib/sideload_serializer/camelized_adapter.rb index abc1234..def5678 100644 --- a/lib/sideload_serializer/camelized_adapter.rb +++ b/lib/sideload_serializer/camelized_adapter.rb @@ -27,7 +27,8 @@ compiled_meta[:primaryResourceId] = resource_identifier_id end - compiled_meta.merge!(self.class.deep_camelize_keys(instance_options.fetch(:meta, Hash.new).deep_dup)) + configured_meta = self.class.deep_camelize_keys(instance_options.fetch(:meta, Hash.new).deep_dup) + compiled_meta.merge!(configured_meta) if configured_meta.present? compiled_meta end
Handle configured meta being nil
diff --git a/omf_common/lib/omf_common/default_logging.rb b/omf_common/lib/omf_common/default_logging.rb index abc1234..def5678 100644 --- a/omf_common/lib/omf_common/default_logging.rb +++ b/omf_common/lib/omf_common/default_logging.rb @@ -45,7 +45,7 @@ def warn_removed(deprecated_name) define_method(deprecated_name) do |*args, &block| - logger.warn "[DEPRECATION] '#{deprecated_name}' is removed. Please do not use it." + logger.warn "[DEPRECATION] '#{deprecated_name}' is deprecated and not supported. Please do not use it." end end end
Reword msg for removed method
diff --git a/capistrano-rails.gemspec b/capistrano-rails.gemspec index abc1234..def5678 100644 --- a/capistrano-rails.gemspec +++ b/capistrano-rails.gemspec @@ -11,6 +11,8 @@ gem.summary = %q{Rails specific Capistrano tasks} gem.homepage = "https://github.com/capistrano/rails" + gem.licenses = ["MIT"] + gem.files = `git ls-files`.split($/) gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ["lib"]
Add MIT license to gemspec
diff --git a/db/migrate/20200517190138_rename_crop_fields.rb b/db/migrate/20200517190138_rename_crop_fields.rb index abc1234..def5678 100644 --- a/db/migrate/20200517190138_rename_crop_fields.rb +++ b/db/migrate/20200517190138_rename_crop_fields.rb @@ -1,5 +1,5 @@ class RenameCropFields < ActiveRecord::Migration[5.2] - def up + def change rename_column :users, :crop_h, :profile_picture_h rename_column :users, :crop_w, :profile_picture_w rename_column :users, :crop_x, :profile_picture_x @@ -9,15 +9,4 @@ rename_column :users, :crop_h_x, :profile_header_x rename_column :users, :crop_h_y, :profile_header_y end - - def down - rename_column :users, :profile_picture_h, :crop_h - rename_column :users, :profile_picture_w, :crop_w - rename_column :users, :profile_picture_x, :crop_x - rename_column :users, :profile_picture_y, :crop_y - rename_column :users, :profile_header_h, :crop_h_h - rename_column :users, :profile_header_w, :crop_h_w - rename_column :users, :profile_header_x, :crop_h_x - rename_column :users, :profile_header_y, :crop_h_y - end end
Simplify Rename Crop Fields migration
diff --git a/lib/money/bank/open_exchange_rates_loader.rb b/lib/money/bank/open_exchange_rates_loader.rb index abc1234..def5678 100644 --- a/lib/money/bank/open_exchange_rates_loader.rb +++ b/lib/money/bank/open_exchange_rates_loader.rb @@ -8,7 +8,7 @@ module Bank module OpenExchangeRatesLoader HIST_URL = 'https://raw.github.com/currencybot/open-exchange-rates/master/historical/' - OER_URL = 'http://openexchangerates.org/latest.php' + OER_URL = 'https://github.com/currencybot/open-exchange-rates/blob/master/latest.json' # Tries to load data from OpenExchangeRates for the given rate. # Won't do anything if there's no data available for that date
Use github for latest data.
diff --git a/circleci-bundle-update-pr.gemspec b/circleci-bundle-update-pr.gemspec index abc1234..def5678 100644 --- a/circleci-bundle-update-pr.gemspec +++ b/circleci-bundle-update-pr.gemspec @@ -9,8 +9,8 @@ spec.version = Circleci::Bundle::Update::Pr::VERSION spec.authors = ['Takashi Masuda'] spec.email = ['masutaka.net@gmail.com'] - spec.summary = 'Create GitHub PullRequest of bundle update in CircleCI' - spec.description = 'A script for continues bundle update. Use in CircleCI' + spec.summary = 'Provide continues bundle update using CircleCI' + spec.description = 'Create GitHub PullRequest of bundle update in CircleCI' spec.homepage = 'https://github.com/masutaka/circleci-bundle-update-pr' spec.license = 'MIT'
:pencil: Improve gem summary and description
diff --git a/spec/controllers/admin/settings_controller_spec.rb b/spec/controllers/admin/settings_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/admin/settings_controller_spec.rb +++ b/spec/controllers/admin/settings_controller_spec.rb @@ -40,8 +40,7 @@ end it 'redirects to :index by default' do - # FIXME: Make this a named route - expect(response).to redirect_to('/admin/settings') + expect(response).to redirect_to(admin_settings_path) end end end
Make test use changed path
diff --git a/spec/ruby/core/enumerator/lazy/fixtures/classes.rb b/spec/ruby/core/enumerator/lazy/fixtures/classes.rb index abc1234..def5678 100644 --- a/spec/ruby/core/enumerator/lazy/fixtures/classes.rb +++ b/spec/ruby/core/enumerator/lazy/fixtures/classes.rb @@ -0,0 +1,50 @@+# -*- encoding: us-ascii -*- + +module EnumeratorLazySpecs + class SpecificError < Exception; end + + class YieldsMixed + def self.initial_yields + [nil, 0, 0, 0, 0, nil, :default_arg, [], [], [0], [0, 1], [0, 1, 2]] + end + + def self.gathered_yields + [nil, 0, [0, 1], [0, 1, 2], [0, 1, 2], nil, :default_arg, [], [], [0], [0, 1], [0, 1, 2]] + end + + def self.gathered_yields_with_args(arg, *args) + [nil, 0, [0, 1], [0, 1, 2], [0, 1, 2], nil, arg, args, [], [0], [0, 1], [0, 1, 2]] + end + + def each(arg=:default_arg, *args) + yield + yield 0 + yield 0, 1 + yield 0, 1, 2 + yield(*[0, 1, 2]) + yield nil + yield arg + yield args + yield [] + yield [0] + yield [0, 1] + yield [0, 1, 2] + end + end + + class EventsMixed + def each + ScratchPad << :before_yield + + yield 0 + + ScratchPad << :after_yield + + raise SpecificError + + ScratchPad << :after_error + + :should_not_reach_here + end + end +end
Write spec fixtures for Enumerator::Lazy
diff --git a/spec/unit/converters/float/string_to_float_spec.rb b/spec/unit/converters/float/string_to_float_spec.rb index abc1234..def5678 100644 --- a/spec/unit/converters/float/string_to_float_spec.rb +++ b/spec/unit/converters/float/string_to_float_spec.rb @@ -25,4 +25,8 @@ converter.call('1.2a', strict: true) }.to raise_error(Necromancer::ConversionTypeError) end + + it "converts '1.2a' in non-strict mode" do + expect(converter.call('1.2a', strict: false)).to eq(1.2) + end end
Add non strict mode test.
diff --git a/spec/integration/commands/servers/reboot_spec.rb b/spec/integration/commands/servers/reboot_spec.rb index abc1234..def5678 100644 --- a/spec/integration/commands/servers/reboot_spec.rb +++ b/spec/integration/commands/servers/reboot_spec.rb @@ -0,0 +1,31 @@+require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') + +describe "servers:reboot command" do + def cli + @cli ||= HP::Cloud::CLI.new + end + + before(:all) do + @hp_svc = compute_connection + end + + ### Server creation returns status "failed to spawn", hence test fails + pending "when rebooting server with id" do + before(:all) do + response = @hp_svc.run_instances('ami-00000005', 1, 1, {'InstanceType' => 'm1.small'}) + @new_server_id = response.body['instancesSet'][0]['instanceId'] + @server = get_server(@hp_svc, @new_server_id) + end + + it "should show success message" do + @response, @exit = run_command("servers:reboot #{@new_server_id}").stdout_and_exit_status + @response.should eql("Rebooting server '#{@new_server_id}'.\n") + sleep(10) + end + + after(:all) do + @server.destroy + end + + end +end
Add specs for servers:reboot command.
diff --git a/octopi.gemspec b/octopi.gemspec index abc1234..def5678 100644 --- a/octopi.gemspec +++ b/octopi.gemspec @@ -2,8 +2,9 @@ Gem::Specification.new do |s| s.name = %q{octopi} - s.version = "0.0.1" + s.version = "0.0.2" + s.add_dependency 'httparty', '>=0.4.2' s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Felipe Coury"] s.date = %q{2009-04-19}
Add 'httparty' as a dependency in the gemspec. The 'httparty' gem is required by this library but not in the gemspec. Fixed this by adding an explicit dependency for the current version. If prior versions will also work, this version number requirement can be relaxed. Bumped the version number to force rebuilding of the gem. Signed-off-by: Felipe Coury <413bed34e59799564bf802e742f91eee94580e4a@gmail.com>