diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/helpers/keywords_helper.rb b/app/helpers/keywords_helper.rb index abc1234..def5678 100644 --- a/app/helpers/keywords_helper.rb +++ b/app/helpers/keywords_helper.rb @@ -10,7 +10,7 @@ def keyword_labels(keywords, type='primary') keywords.map do |keyword| - bootstrap_label(keyword.display_name, type) + bootstrap_label(keyword.name, type) end.join(' ').html_safe end
Use name for now to stop from breaking on tags
diff --git a/app/helpers/menu_bar_helper.rb b/app/helpers/menu_bar_helper.rb index abc1234..def5678 100644 --- a/app/helpers/menu_bar_helper.rb +++ b/app/helpers/menu_bar_helper.rb @@ -18,7 +18,7 @@ end def link_to_profile - menu_item('user', :profile, user_path) + menu_item('user', :my_account, user_path) end def link_to_classroom
Replace 'Profile' with 'My account' on menu bar
diff --git a/app/models/cookbook_version.rb b/app/models/cookbook_version.rb index abc1234..def5678 100644 --- a/app/models/cookbook_version.rb +++ b/app/models/cookbook_version.rb @@ -25,7 +25,14 @@ :tarball, presence: true, content_type: { - content_type: ['application/x-gzip', 'application/octet-stream'] + content_type: ['application/x-gzip', 'application/gzip', + 'application/octet-stream', 'application/x-tar', + 'application/x-compressed-tar', 'application/x-gtar', + 'application/x-bzip2', 'application/gzipped-tar', + 'application/x-compressed', 'application/download', + 'application/x-gtar-compressed', 'application/zip', + 'application/x-bzip', 'application/x-zip-compressed', + 'application/cap', 'application/x-tar-gz'] } )
Expand the list of valid tarball content types The existing community site has no validation on content type, so the following content types exist in the database: * application/x-gzip * application/gzip * application/octet-stream * application/x-tar * application/x-compressed-tar * application/x-gtar * application/x-bzip2 * application/gzipped-tar * application/x-compressed * application/download * application/x-gtar-compressed * application/zip * application/x-bzip * application/x-zip-compressed * application/cap * application/x-tar-gz We can impose validation going forward, but in order to import the existing community site data, we'll need to relax our constraints.
diff --git a/app/uploaders/file_uploader.rb b/app/uploaders/file_uploader.rb index abc1234..def5678 100644 --- a/app/uploaders/file_uploader.rb +++ b/app/uploaders/file_uploader.rb @@ -1,6 +1,6 @@ class FileUploader < CarrierWave::Uploader::Base POSSIBLE_IMG_EXTENSIONS = %w(jpg jpeg gif png) - POSSIBLE_DOC_EXTENSIONS = %w(chm csv diff doc docx dot dxf eps gml ics kml odp ods odt pdf ppt pptx ps rdf rtf sch txt wsdl xls xlsm xlsx xlt xml xsd xslt zip) + POSSIBLE_DOC_EXTENSIONS = %w(chm csv diff doc docx dot dxf eps gml ics kml odp ods odt pdf ppt pptx ps rdf rtf sch txt wsdl xls xlsm xlsx xlt xml xsd xslt zip msg) def extension_white_list POSSIBLE_IMG_EXTENSIONS + POSSIBLE_DOC_EXTENSIONS
Add in a new file attachment allowed (outlook .msg) [Trello Story](https://trello.com/c/VmHwceUv/227-add-in-a-new-file-attachment-allowed)
diff --git a/test/test_helper_methods.rb b/test/test_helper_methods.rb index abc1234..def5678 100644 --- a/test/test_helper_methods.rb +++ b/test/test_helper_methods.rb @@ -0,0 +1,26 @@+# -- encoding: utf-8 -- +require 'rim' +require 'test/unit' + +class TestHelperMethods < Test::Unit::TestCase + + class ::Rim + attr_accessor :some_new_attr + end + + def test_attr_accessor + rim = Rim.instance + assert_nil rim.some_new_attr, 'New attribute must be nil.' + rim.some_new_attr = :standard_setter + assert_equal :standard_setter, rim.some_new_attr + rim.some_new_attr :advanced_setter + assert_equal :advanced_setter, rim.some_new_attr + end + + def test_filelist + rim = Rim.instance + fl = rim.filelist(/rakefile/i, 'lib') + assert_equal %w(Rakefile lib), fl.to_a + end + +end
Add testing for helper methods of Rim.
diff --git a/regentanz.gemspec b/regentanz.gemspec index abc1234..def5678 100644 --- a/regentanz.gemspec +++ b/regentanz.gemspec @@ -26,5 +26,6 @@ s.add_development_dependency 'bundler' s.add_development_dependency 'factory_girl', '~> 2.0' s.add_development_dependency 'rdoc', '~> 2.4' + s.add_development_dependency 'rspec' end
Add rspec to development dependencies
diff --git a/robolove.gemspec b/robolove.gemspec index abc1234..def5678 100644 --- a/robolove.gemspec +++ b/robolove.gemspec @@ -6,8 +6,8 @@ Gem::Specification.new do |spec| spec.name = "Robolove" spec.version = Robolove::VERSION - spec.authors = ["Jonan Scheffler"] - spec.email = ["[email protected]"] + spec.authors = ["Jonan Scheffler", "Zoe Kay"] + spec.email = ["[email protected]", "[email protected]"] spec.summary = %q{A simple library to control LegoNXT robots.} spec.description = %q{Robolove wraps the lego_nxt gem to make driving easier.} spec.homepage = "https://github.com/1337807/robolove"
Add Zoe to the gemspec in thanks for her dedicated service to robotic love.
diff --git a/Tools/CocoaPods/CoconutKit.podspec b/Tools/CocoaPods/CoconutKit.podspec index abc1234..def5678 100644 --- a/Tools/CocoaPods/CoconutKit.podspec +++ b/Tools/CocoaPods/CoconutKit.podspec @@ -2,10 +2,10 @@ s.name = 'CoconutKit' s.version = '2.0' s.license = 'MIT' - s.summary = 'CoconutKit is a library of high-quality iOS components' + s.summary = 'CoconutKit is a library of high-quality iOS components.' s.homepage = 'https://github.com/defagos/CoconutKit' s.author = { 'Samuel Défago' => '[email protected]' } - s.source = { :git => 'git://github.com/defagos/CoconutKit-CocoaPods.git', :tag => '2.0' } + s.source = { :git => 'https://github.com/defagos/CoconutKit-CocoaPods.git', :tag => '2.0' } s.platform = :ios, '4.0' s.description = 'CoconutKit is a library of high-quality iOS components written at hortis le studio and in my spare time. It includes several tools for dealing with view controllers, multi-threading, view animations, as well as some new controls and various utility classes. These components are meant to make the life of an iOS programmer easier by reducing the boilerplate code written every day, improving code quality and enforcing solid application architecture.'
Fix warnings found by running 'pod spec lint'
diff --git a/cruise_config.rb b/cruise_config.rb index abc1234..def5678 100644 --- a/cruise_config.rb +++ b/cruise_config.rb @@ -1,5 +1,5 @@ Project.configure do |project| - project.email_notifier.emails = ["[email protected]", "[email protected]", "[email protected]"] + project.email_notifier.emails = ["[email protected]", "[email protected]"] if RUBY_PLATFORM[/mswin|mingw32/] project.build_command = "ruby script\\cruise_build.rb #{project.name}" else
Remove Ryan from cruise notifications
diff --git a/recipes/dbserver.rb b/recipes/dbserver.rb index abc1234..def5678 100644 --- a/recipes/dbserver.rb +++ b/recipes/dbserver.rb @@ -30,9 +30,10 @@ action [:create, :grant] end - mysql_database db['database'] do + mysql_database "Import to #{db['database']}" do connection mysql_connection - sql "source /vagrant/#{db['database']}.sql;" + database_name db['database'] + sql "source /vagrant/#{db['database']}.sql" action :query only_if { ::File.exist?("/vagrant/#{db['database']}.sql") } end
Use more descriptive title, and fix source query
diff --git a/spec/swarker/definition_spec.rb b/spec/swarker/definition_spec.rb index abc1234..def5678 100644 --- a/spec/swarker/definition_spec.rb +++ b/spec/swarker/definition_spec.rb @@ -1,9 +1,9 @@ describe Swarker::Definition do let(:swagger_definition) do - Swarker::Json::Reader.new(File.expand_path('../../fixtures/definitions/swagger.json.yml', __FILE__)).read + YAML.load_file(File.expand_path('../../fixtures/definitions/swagger.json.yml', __FILE__)) end let(:lurker_definition) do - Swarker::Json::Reader.new(File.expand_path('../../fixtures/definitions/lurker.json.yml', __FILE__)).read + YAML.load_file(File.expand_path('../../fixtures/definitions/lurker.json.yml', __FILE__)) end subject { Swarker::Definition.new(:user, lurker_definition) }
Fix definition specs not to be couple with Json::Reader
diff --git a/spec/units/view_helpers_spec.rb b/spec/units/view_helpers_spec.rb index abc1234..def5678 100644 --- a/spec/units/view_helpers_spec.rb +++ b/spec/units/view_helpers_spec.rb @@ -8,7 +8,12 @@ end test = Testing.new link = test.link_to_capturable("Login") - expect(link).to eq '<a href="#" class="capture_modal_open" id="capture_signin_link">Login</a>' + expect(link).to match(/^<a/) + expect(link).to match(/href="#"/) + expect(link).to match(/class="capture_modal_open"/) + expect(link).to match(/id="capture_signin_link"/) + expect(link).to match(/Login/) + expect(link).to match(/<\/a>$/) end end
Make view helper test more resilient to environmental differences The spec for the link_to_capturable view helper appears to be dependent on some part of the Ruby development environment. On my setup and Marcel's, the spec passes when we compare output against <a href="#" class="capture_modal_open" id="capture_signin_link">Login</a> However, in Rune's environment, the passing output is <a class="capture_modal_open" href="#" id="capture_signin_link">Login</a> To address this discrepancy, break down the test to look for matches within the string, regardless of the order in which they get rendered.
diff --git a/app/presenters/scheme_presenter.rb b/app/presenters/scheme_presenter.rb index abc1234..def5678 100644 --- a/app/presenters/scheme_presenter.rb +++ b/app/presenters/scheme_presenter.rb @@ -6,7 +6,7 @@ end def as_json(options={}) - attrs = @scheme.marshal_dump + attrs = @scheme.as_json attrs[:id] = @url_helper.build_scheme_url(attrs[:id]) valid_keys = [:id, :identifier, :title, :details, :web_url, :priority] + Scheme::FACET_KEYS attrs.select { |k,v| valid_keys.include?(k.to_sym) }
Access scheme attributes with as_json
diff --git a/app/services/create_tag_service.rb b/app/services/create_tag_service.rb index abc1234..def5678 100644 --- a/app/services/create_tag_service.rb +++ b/app/services/create_tag_service.rb @@ -27,9 +27,9 @@ end Event.create_ref_event(project, current_user, new_tag, 'add', 'refs/tags') - return success(new_tag) + success(new_tag) else - return error('Invalid reference name') + error('Invalid reference name') end end @@ -41,6 +41,6 @@ def create_push_data(project, user, tag) Gitlab::PushDataBuilder. - build(project, user, Gitlab::Git::BLANK_SHA, tag.target, tag.name, []) + build(project, user, Gitlab::Git::BLANK_SHA, tag.target, 'refs/tags/' + tag.name, []) end end
Fix ci data in hook when create git tag via UI
diff --git a/lib/learn_to_rank/load_search_queries.rb b/lib/learn_to_rank/load_search_queries.rb index abc1234..def5678 100644 --- a/lib/learn_to_rank/load_search_queries.rb +++ b/lib/learn_to_rank/load_search_queries.rb @@ -9,7 +9,7 @@ query = row["searchTerm"].strip queries[query] ||= [] queries[query] << { - content_id: row["contentId"], + link: row["link"], rank: row["avg_rank"], views: row["views"], clicks: row["clicks"],
Use link field from bigquery We don't store content IDs in ecommerce data any more.
diff --git a/color_schema_validator.gemspec b/color_schema_validator.gemspec index abc1234..def5678 100644 --- a/color_schema_validator.gemspec +++ b/color_schema_validator.gemspec @@ -13,14 +13,6 @@ spec.description = %q{TODO: Write a longer description or delete this line.} spec.homepage = "TODO: Put your gem's website or public repo URL here." - # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or - # delete this section to allow pushing this gem to any host. - if spec.respond_to?(:metadata) - spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'" - else - raise "RubyGems 2.0 or newer is required to protect against public gem pushes." - end - spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
Remove the code to prevent pushing public server
diff --git a/config/deploy/genigames-dev.rb b/config/deploy/genigames-dev.rb index abc1234..def5678 100644 --- a/config/deploy/genigames-dev.rb +++ b/config/deploy/genigames-dev.rb @@ -5,3 +5,5 @@ server domain, :app, :web role :db, domain, :primary => true set :branch, "gv-r32" + +set :asset_env, "RAILS_GROUPS=assets RAILS_RELATIVE_URL_ROOT=/portal"
Make sure assets get the correct relative url root
diff --git a/config/initializers/aws-sdk.rb b/config/initializers/aws-sdk.rb index abc1234..def5678 100644 --- a/config/initializers/aws-sdk.rb +++ b/config/initializers/aws-sdk.rb @@ -0,0 +1,8 @@+require 'aws-sdk' + +AWS.config( + access_key_id: Rails.application.secrets.aws_access_key_id, + secret_access_key: Rails.application.secrets.aws_secret_access_key +) + +# S3_BUCKET = AWS::S3.new.buckets[Rails.application.secrets.s3_bucket_name]
Initialize aws with credentials for dev environment.
diff --git a/week-6/die-2/my_solution.rb b/week-6/die-2/my_solution.rb index abc1234..def5678 100644 --- a/week-6/die-2/my_solution.rb +++ b/week-6/die-2/my_solution.rb @@ -1,14 +1,19 @@ # Die Class 2: Arbitrary Symbols -# I worked on this challenge [by myself]. -# I spent [#] hours on this challenge. +# I worked on this challenge by myself. + +# I spent 5 hours on this challenge. # Pseudocode # Input: labels # Output: number of sides and rolls # Steps: +# begin initializing method for the class +# IF the argument does not meet the initial requirement, raise an argument error +# create method for identifiying the elements of the array +# create method for determining the rolls for the 'die' # Initial Solution @@ -22,7 +27,7 @@ end def sides - @labels + @labels = @labels.length end def roll @@ -34,21 +39,20 @@ puts die.sides puts die.roll +# Reflection -# Refactored Solution +# What were the main differences between this die class and the last one you created in terms of implementation? Did you need to change much logic to get this to work? - - - - - - - -# Reflection -# What were the main differences between this die class and the last one you created in terms of implementation? Did you need to change much logic to get this to work? +# There wasn't really any difference in the logic between the first die challenge and this one for the first two methods. Similarly to the first, I struggled with the last method and finding a working solution to address the test failures. # What does this exercise teach you about making code that is easily changeable or modifiable? +# Making code changable allows for easier manipulation/adjustments at a later time. + # What new methods did you learn when working on this challenge, if any? -# What concepts about classes were you able to solidify in this challenge?+# I've used for strings before, but this time, I used the .length method on an array. + +# What concepts about classes were you able to solidify in this challenge? + +# I solidified my understanding of control flow.
Update to week-6 die 2 assignment
diff --git a/core/app/helpers/url_helper.rb b/core/app/helpers/url_helper.rb index abc1234..def5678 100644 --- a/core/app/helpers/url_helper.rb +++ b/core/app/helpers/url_helper.rb @@ -4,8 +4,6 @@ def set_mailer_url_options ActionMailer::Base.default_url_options[:host] = with_subdomain(request.subdomain) ActionMailer::Base.default_url_options[:port] = request.port_string - - puts ActionMailer::Base.default_url_options end def with_subdomain(subdomain)
Debug statement should be removed
diff --git a/Casks/gog-galaxy.rb b/Casks/gog-galaxy.rb index abc1234..def5678 100644 --- a/Casks/gog-galaxy.rb +++ b/Casks/gog-galaxy.rb @@ -12,4 +12,6 @@ uninstall :pkgutil => "com.gog.galaxy.galaxy_client_#{version}.pkg", :delete => '/Applications/GalaxyClient.app' + + depends_on :macos => '>= :mountain_lion' end
Add Mountain Lion dependency to GOG GalaxyClient per vendor homepage
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index abc1234..def5678 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -11,6 +11,11 @@ @layers = Layer.all.order(:updated_at => :desc).limit(3).includes(:maps) + @year_min = Map.minimum(:issue_year) + @year_max = Map.maximum(:issue_year) + @year_min = 1600 if @year_min == 0 + @year_max = 2015 if @year_max == 0 + if user_signed_in? @my_maps = current_user.maps.order(:updated_at => :desc).limit(3) end
Fix slider in home page
diff --git a/Casks/sequel-pro.rb b/Casks/sequel-pro.rb index abc1234..def5678 100644 --- a/Casks/sequel-pro.rb +++ b/Casks/sequel-pro.rb @@ -0,0 +1,5 @@+class SequelPro < Cask + url 'http://sequel-pro.googlecode.com/files/Sequel_Pro_0.9.9.1.dmg' + homepage 'http://www.sequelpro.com/' + version '0.9.9.1' +end
Add cask for Sequel Pro
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index abc1234..def5678 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -0,0 +1,40 @@+class TagsController < ApplicationController + before_filter :authenticate_user! + + # Enable CORS + before_filter :cors_preflight_check, :only => [:index] + after_filter :cors_set_access_control_headers, :only => [:index] + + def index + if params[:mode]=="popular" or !params[:q].present? + @tags = most_popular + else + @tags = match_tag + end + + items_per_page = params[:limit].present? ? params[:limit] : 25 + @tags = @tags.page(params[:page]).per(items_per_page) + + if @tags.blank? && params[:q].present? + @tags = [ ActsAsTaggableOn::Tag.new(name: params[:q]) ] + end + + respond_to do |format| + format.json { + render json: @tags + } + end + end + + + private + + def match_tag + ActsAsTaggableOn::Tag.where('name LIKE ?',"%#{ params[:q] }%") + end + + def most_popular + ActivityObject.tag_counts(:order => "count desc") + end + +end
Enhance tags service and enable cors for tags
diff --git a/dayglo.gemspec b/dayglo.gemspec index abc1234..def5678 100644 --- a/dayglo.gemspec +++ b/dayglo.gemspec @@ -1,7 +1,7 @@ $:.push File.expand_path('../lib', __FILE__) # Maintain your gem's version: -require 'exlibris/aleph/version' +require 'dayglo/version' # Describe your gem and declare its dependencies: Gem::Specification.new do |s| @@ -14,7 +14,7 @@ s.description = 'Library that implements some data structures and algorithms implemented in Ruby' s.license = 'MIT' - s.files = Dir['lib/**/*'] + ['MIT-LICENSE', 'Rakefile', 'README.md'] + s.files = Dir['lib/**/*'] + ['LICENSE', 'README.md'] s.test_files = Dir['spec/**/*'] s.add_dependency 'require_all', '~> 1.3.0'
Update copy and paste errors in the gemspec
diff --git a/spec/amee_spec.rb b/spec/amee_spec.rb index abc1234..def5678 100644 --- a/spec/amee_spec.rb +++ b/spec/amee_spec.rb @@ -25,11 +25,4 @@ }.should_not raise_error end - it "has an intentional bug in Rails 2.3 to test appraisal builds" do - # This should fail in - lambda { - [].uniq_by - }.should_not raise_error - end - end
Revert "Intentional bug to test appraisal" This reverts commit c270a2cff98f430cc86d86bf509a3d415124bfbe.
diff --git a/spec/conf_spec.rb b/spec/conf_spec.rb index abc1234..def5678 100644 --- a/spec/conf_spec.rb +++ b/spec/conf_spec.rb @@ -44,14 +44,14 @@ ) end - it 'does not use "unit" procedures'# do -# -# expect( -# Flor::Conf.prepare(%{\n point: cancel }, {}) -# ).to eq({ -# 'point' => 'cancel', 'root' => '.' -# }) -# end + it 'does not use "unit" procedures' do + + expect( + Flor::Conf.prepare(%{\n point: cancel }, {}) + ).to eq({ + 'point' => 'cancel', 'root' => '.' + }) + end end end
Bring back `point: cancel` spec for ConfExecutor
diff --git a/spec/game_spec.rb b/spec/game_spec.rb index abc1234..def5678 100644 --- a/spec/game_spec.rb +++ b/spec/game_spec.rb @@ -13,7 +13,7 @@ describe '#prompt_user_for_input' do it 'ask users to input the position on available spots where they want to place an X' do - expect(new_game.prompt_user_for_inpt).to include("Enter a number 0, 1, 2, 3, 4, 5, 6, 7, 8 to place an X") + expect(new_game.prompt_user_for_input).to include("Enter a number 0, 1, 2, 3, 4, 5, 6, 7, 8 to place an X") end end
Fix typo *inpt to input
diff --git a/acmesmith-google-cloud-storage.gemspec b/acmesmith-google-cloud-storage.gemspec index abc1234..def5678 100644 --- a/acmesmith-google-cloud-storage.gemspec +++ b/acmesmith-google-cloud-storage.gemspec @@ -20,7 +20,7 @@ spec.require_paths = ["lib"] spec.add_dependency "acmesmith" - spec.add_dependency "google-api-client", "~> 0.9.4" + spec.add_dependency "google-api-client", "~> 0.9.1" spec.add_development_dependency "bundler", "~> 1.11" spec.add_development_dependency "rake", "~> 10.0"
Revert "Fixed dependency (`@api.fetch_all` is available on google-api-client 0.9.4)" This reverts commit c0d97ce7d700464879a806713a69a084571736eb.
diff --git a/core/spec/models/taxon_spec.rb b/core/spec/models/taxon_spec.rb index abc1234..def5678 100644 --- a/core/spec/models/taxon_spec.rb +++ b/core/spec/models/taxon_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' -describe Taxon do - let(:taxon) { Taxon.new(:name => "Ruby on Rails") } +describe Spree::Taxon do + let(:taxon) { Spree::Taxon.new(:name => "Ruby on Rails") } context "validation" do it { should have_valid_factory(:taxon) } @@ -17,7 +17,7 @@ context "with parent taxon" do before do taxon.stub(:parent_id => 123) - Taxon.should_receive(:find).with(123).and_return(mock_model(Taxon, :permalink => "brands")) + Spree::Taxon.should_receive(:find).with(123).and_return(mock_model(Spree::Taxon, :permalink => "brands")) end it "should set permalink correctly when taxon has parent" do
Fix references in Taxon spec
diff --git a/app/controllers/teachers_controller.rb b/app/controllers/teachers_controller.rb index abc1234..def5678 100644 --- a/app/controllers/teachers_controller.rb +++ b/app/controllers/teachers_controller.rb @@ -1,5 +1,5 @@ class TeachersController < ApplicationController - + include SessionsHelper def index end @@ -17,6 +17,17 @@ redirect_to @teacher end + def edit + + end + + def update + teacher = Teacher.find_by(id: current_user.id) + teacher.update_attributes(name: params[:teachers][:name], bio: params[:teachers][:bio], subject: params[:teachers][:subject], grade_level: params[:teachers][:grade_level]) + teacher.save + redirect_to "/teachers/#{current_user.id}" + end + private # we removed :video from the params to create a new Teacher at signup
Include sessions helper in teachers controller. Edit/Update user profile is working.
diff --git a/app/representers/events_representer.rb b/app/representers/events_representer.rb index abc1234..def5678 100644 --- a/app/representers/events_representer.rb +++ b/app/representers/events_representer.rb @@ -17,10 +17,24 @@ links do property :course_id, as: :course - property :room, getter: -> (args) { room.to_s } + property :room, getter: -> (*) { room.to_s } collection :teacher_ids, as: :teachers collection :student_ids, as: :students property :applied_schedule_exception_ids, as: :applied_exceptions + end + + # Compound requests are injected separately from to_hash + compound do + + collection :courses, getter: -> (args) { args[:courses] } do + property :id + property :name + end + + collection :teachers, getter: -> (args) { args[:teachers] } do + property :id + property :full_name + end end def parallel
Add linked resources to EventRepresenter
diff --git a/viitenumero.gemspec b/viitenumero.gemspec index abc1234..def5678 100644 --- a/viitenumero.gemspec +++ b/viitenumero.gemspec @@ -22,6 +22,6 @@ spec.add_development_dependency "rake" spec.add_development_dependency "minitest" - spec.add_runtime_dependency "activemodel", ">= 4.0.0", "< 6.0.0" - spec.add_runtime_dependency "activesupport", ">= 4.0.0", "< 6.0.0" + spec.add_runtime_dependency "activemodel", ">= 4.0.0" + spec.add_runtime_dependency "activesupport", ">= 4.0.0" end
Remove active* version limitations to support Rails 6
diff --git a/db/sanitize_data.rb b/db/sanitize_data.rb index abc1234..def5678 100644 --- a/db/sanitize_data.rb +++ b/db/sanitize_data.rb @@ -0,0 +1,43 @@+ +def update_address(address, user) + unless address.nil? + address.firstname = user[:first_name] + address.lastname = user[:last_name] + address.phone = user[:phone] + address.save! + end +end + +def sanitize_data + canned_users = [ { :first_name => "Bob", :last_name => "jones", :email => "[email protected]", :phone => "0123456789" }, + { :first_name => "cindy", :last_name => "rest", :email => "[email protected]", :phone => "0123456789" }, + { :first_name => "Pete", :last_name => "smith", :email => "[email protected]", :phone => "0123456789" }, + { :first_name => "Tony", :last_name => "ballantyne", :email => "[email protected]", :phone => "0123456789" }, + { :first_name => "Ben", :last_name => "raven", :email => "[email protected]", :phone => "0123456789" }, + { :first_name => "Robyn", :last_name => "monster", :email => "[email protected]", :phone => "0123456789" }, + { :first_name => "Nako", :last_name => "tolkein", :email => "[email protected]", :phone => "0123456789" }, + { :first_name => "Helen", :last_name => "mitcham", :email => "[email protected]", :phone => "0123456789" }, + { :first_name => "Emma", :last_name => "low", :email => "[email protected]", :phone => "0123456789" }, + { :first_name => "Mandy", :last_name => "Trust", :email => "[email protected]", :phone => "0123456789" } ] + + Spree::Order.all.each_with_index do |order, index| + canned_user = canned_users[index%canned_users.size] + puts "updating order #{order.id} with #{canned_user[:first_name]}" + + order.email = canned_user[:email] + + update_address(order.bill_address, canned_user) + update_address(order.ship_address, canned_user) + order.save! + end + + Spree::User.all.each_with_index do |user, index| + unless user.email == "[email protected]" + canned_user = canned_users[index%canned_users.size] + puts "updating user #{user.id} with #{canned_user[:first_name]}" + + user.email = "#{canned_user[:email]}#{index}" + user.save! + end + end +end
Add script to sanitize order and user data.
diff --git a/lib/devise/async/backend/sucker_punch.rb b/lib/devise/async/backend/sucker_punch.rb index abc1234..def5678 100644 --- a/lib/devise/async/backend/sucker_punch.rb +++ b/lib/devise/async/backend/sucker_punch.rb @@ -10,15 +10,11 @@ new.async.perform(*args) end - # Loads the resource record and sends the email. - # - # It uses `orm_adapter` API to fetch the record in order to enforce - # compatibility among diferent ORMs. + # Return the connection to the pool after we're done with it + # see: https://github.com/brandonhilkert/sucker_punch#usage def perform(method, resource_class, resource_id, *args) ActiveRecord::Base.connection_pool.with_connection do - resource = resource_class.constantize.to_adapter.get!(resource_id) - args[-1] = args.last.symbolize_keys if args.last.is_a?(Hash) - mailer_class(resource).send(method, resource, *args).deliver + super end end
Fix comments for connection pooling
diff --git a/lib/fastlane/actions/recreate_schemes.rb b/lib/fastlane/actions/recreate_schemes.rb index abc1234..def5678 100644 --- a/lib/fastlane/actions/recreate_schemes.rb +++ b/lib/fastlane/actions/recreate_schemes.rb @@ -8,7 +8,6 @@ project = Xcodeproj::Project.open(params[:project]) project.recreate_user_schemes - #project.save end def self.description
Remove not required save call
diff --git a/lib/gym/xcodebuild_fixes/watchkit_fix.rb b/lib/gym/xcodebuild_fixes/watchkit_fix.rb index abc1234..def5678 100644 --- a/lib/gym/xcodebuild_fixes/watchkit_fix.rb +++ b/lib/gym/xcodebuild_fixes/watchkit_fix.rb @@ -28,7 +28,7 @@ def watchkit? Dir["#{PackageCommandGenerator.appfile_path}/**/*.plist"].any? do |plist_path| `/usr/libexec/PlistBuddy -c 'Print WKWatchKitApp' '#{plist_path}' 2>&1`.strip == 'true' - end + end && !(Gym::XcodebuildFixes.watchkit2?) end end end
Exclude WatchKitSupport 1 folder when include WatchKitSupport2
diff --git a/px.gemspec b/px.gemspec index abc1234..def5678 100644 --- a/px.gemspec +++ b/px.gemspec @@ -4,7 +4,7 @@ s.name = "px" s.version = "0.0.1" s.summary = "PX library" - s.description = "PX library" + s.description = "PaymentExpress 1.0 integration library" s.authors = ["Cyril David"] s.email = ["[email protected]"] s.homepage = "http://cyx.is" @@ -12,16 +12,17 @@ "LICENSE", "README*", "Makefile", - "lib/**/*.rb", + "lib/*.rb", + "lib/xml/*.xml", "*.gemspec", "test/*.*", ] s.license = "MIT" - s.add_dependency "requests" - s.add_dependency "xml-simple" - s.add_dependency "mote" - s.add_dependency "hache" - s.add_development_dependency "cutest" + s.add_dependency "requests", "~> 1.0" + s.add_dependency "xml-simple", "~> 1.1" + s.add_dependency "mote", "~> 1.1" + s.add_dependency "hache", "~> 1.1" + s.add_development_dependency "cutest", "~> 1.2" end
Fix the gemspec in prep for 0.0.1 release
diff --git a/sidekiq-hol.gemspec b/sidekiq-hol.gemspec index abc1234..def5678 100644 --- a/sidekiq-hol.gemspec +++ b/sidekiq-hol.gemspec @@ -15,7 +15,7 @@ gem.require_paths = ['lib'] gem.version = Sidekiq::Hol::VERSION - gem.add_dependency 'sidekiq', '~> 4.0.0' + gem.add_dependency 'sidekiq', '~> 4.0' gem.add_development_dependency 'rake' gem.add_development_dependency 'rspec'
Update sidekiq gem dependency, again
diff --git a/diffux-core.gemspec b/diffux-core.gemspec index abc1234..def5678 100644 --- a/diffux-core.gemspec +++ b/diffux-core.gemspec @@ -10,7 +10,7 @@ s.authors = ['Joe Lencioni', 'Henric Trotzig'] s.email = ['[email protected]', '[email protected]'] s.require_paths = ['lib'] - s.files = Dir['lib/**/*.rb'] + s.files = Dir['lib/**/*'] s.executables = ['diffux-snapshot', 'diffux-compare'] s.required_ruby_version = '>= 2.0.0'
Fix missing `take-snapshot.js` in bundled gem A core piece of the gem is the file `take-snapshot.js`. This file wasn't included in the bundled gem and caused the main diffux application to fail snapshotting.
diff --git a/config/environments/development.rb b/config/environments/development.rb index abc1234..def5678 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -17,6 +17,12 @@ config.action_mailer.raise_delivery_errors = false config.action_mailer.default_url_options = { host: URI.parse(Plek.find('signon')).host } + # Send emails to the local MailHog instance + config.action_mailer.delivery_method = :smtp + config.action_mailer.smtp_settings = { + port: 1025 + } + # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log
Configure mail to be sent via SMTP by default Allows connecting to the VM Mailhog instance
diff --git a/example/send-set-request.rb b/example/send-set-request.rb index abc1234..def5678 100644 --- a/example/send-set-request.rb +++ b/example/send-set-request.rb @@ -0,0 +1,61 @@+#!/usr/bin/env ruby + +# Simple set request example. + +$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib') +require 'ostruct' +require 'optparse' +require 'rubygems' +require 'meac_control' +require 'httpclient' + +options = OpenStruct.new +options.commands = [] + +opts = OptionParser.new do |o| + o.banner = "Usage: #{File.basename(__FILE__)} [options]" + + o.on('-i', '--ip-address IP', 'IP address of the webhost') do |value| + options.ip = value + end + + o.on('-d', '--device ID', 'Device id') do |value| + options.device = MEACControl::Device.new(value) + end + + o.on('--on', 'Turn AC on') do + cmd = MEACControl::Command::Drive.new + cmd.on + options.commands << cmd + end + + o.on('--off', 'Turn AC off') do + cmd = MEACControl::Command::Drive.new + cmd.off + options.commands << cmd + end +end +opts.parse! + +unless options.ip and options.device and !options.commands.empty? + puts opts.banner + puts opts.summarize + exit 1 +end + +xml = MEACControl::XML::SetRequest.new(options.device, options.commands) + +puts "########### set request ###########" +puts xml.to_xml +puts "" + +header = {'Accept' => 'text/xml', 'Content-Type' => 'text/xml'} + +client = HTTPClient.new +client.protocol_version = 'HTTP/1.0' +client.agent_name = 'meac_control/1.0' +response = client.post("http://#{options.ip}/servlet/MIMEReceiveServlet", xml.to_xml, header) + +puts "########### set response ###########" +puts response.content +puts ""
Add a sample set request script.
diff --git a/spec/bot_spec.rb b/spec/bot_spec.rb index abc1234..def5678 100644 --- a/spec/bot_spec.rb +++ b/spec/bot_spec.rb @@ -0,0 +1,70 @@+require 'cinch/test' +require 'cinch/plugins/loveletter' + +class MessageReceiver + attr_accessor :messages + + def initialize + @messages = [] + end + + def send(m) + @messages << m + end +end + +def get_replies_text(m) + get_replies(m).map(&:text) +end + +describe Cinch::Plugins::LoveLetter do + include Cinch::Test + + let(:channel1) { '#test' } + + let(:opts) {{ + :channels => [channel1], + :allowed_idle => 300, + }} + let(:bot) { + make_bot(Cinch::Plugins::LoveLetter, opts) { |c| + self.loggers.stub('debug') { nil } + } + } + + it 'makes a test bot' do + expect(bot).to be_a Cinch::Bot + end + + context 'while in a game' do + let(:chan) { MessageReceiver.new } + let(:player1) { 'test1' } + let(:player2) { 'test2' } + let(:user1) { MessageReceiver.new } + let(:user2) { MessageReceiver.new } + let(:players) { { + player1 => user1, + player2 => user2, + }} + + before :each do + bot.stub(:nick).and_return('testbot') + + bot.plugins[0].stub(:Channel).with(channel1).and_return(chan) + bot.plugins[0].stub(:User).with(player1).and_return(user1) + bot.plugins[0].stub(:User).with(player2).and_return(user2) + + chan.stub(:has_user?) { |u| players.keys.include?(u.nick) } + chan.stub(:name).and_return(channel1) + + get_replies(make_message(bot, "!join #{channel1}", nick: player1)) + get_replies(make_message(bot, "!join #{channel1}", nick: player2)) + get_replies(make_message(bot, "!start #{channel1}", nick: player1)) + end + + it 'allows the !players command' do + replies = get_replies_text(make_message(bot, "!players", nick: player1, channel: channel1)) + expect(replies.size).to be == 1 + end + end +end
spec: Add spec for bot (!player)
diff --git a/spec/exe_spec.rb b/spec/exe_spec.rb index abc1234..def5678 100644 --- a/spec/exe_spec.rb +++ b/spec/exe_spec.rb @@ -9,4 +9,9 @@ it 'runs' do expect(status).to be_success end + + context 'invalid arguments' do + let(:args){ ['invalid_argument'] } + specify { expect(status).to_not be_success } + end end
Check for failing exit status when recieving invalid arguments.
diff --git a/spec/msc_spec.rb b/spec/msc_spec.rb index abc1234..def5678 100644 --- a/spec/msc_spec.rb +++ b/spec/msc_spec.rb @@ -24,14 +24,14 @@ } eos -describe Asciidoctor::Diagram::MscInlineMacroProcessor do +describe Asciidoctor::Diagram::MscInlineMacroProcessor, :broken_on_windows do include_examples "inline_macro", :msc, MSC_CODE, [:png, :svg] end -describe Asciidoctor::Diagram::MscBlockMacroProcessor do +describe Asciidoctor::Diagram::MscBlockMacroProcessor, :broken_on_windows do include_examples "block_macro", :msc, MSC_CODE, [:png, :svg] end -describe Asciidoctor::Diagram::MscBlockProcessor do +describe Asciidoctor::Diagram::MscBlockProcessor, :broken_on_windows do include_examples "block", :msc, MSC_CODE, [:png, :svg] end
Disable mscgen specs on Windows
diff --git a/cookbooks/sys_dns/recipes/do_set_public.rb b/cookbooks/sys_dns/recipes/do_set_public.rb index abc1234..def5678 100644 --- a/cookbooks/sys_dns/recipes/do_set_public.rb +++ b/cookbooks/sys_dns/recipes/do_set_public.rb @@ -5,8 +5,15 @@ # RightScale Terms of Service available at http://www.rightscale.com/terms.php and, # if applicable, other agreements such as a RightScale Master Subscription Agreement. +if ! node.has_key?('cloud') + public_ip=`curl -s http://icanhazip.com/`.strip + log "Detected public IP: #{public_ip}" +else + public_ip = node['cloud']['public_ips'][0] +end + sys_dns "default" do id node['sys_dns']['id'] - address node['cloud']['public_ips'][0] + address public_ip action :set_public end
Add support for icanhazip.com when no cloud attribute is available.
diff --git a/examples/simple-consumer.rb b/examples/simple-consumer.rb index abc1234..def5678 100644 --- a/examples/simple-consumer.rb +++ b/examples/simple-consumer.rb @@ -14,7 +14,7 @@ # with e.g. `$stderr` if you want to see what's happening under the hood. logger = Logger.new(StringIO.new) -brokers = ENV.fetch("KAFKA_BROKERS") +brokers = ENV.fetch("KAFKA_BROKERS").split(",") # Make sure to create this topic in your Kafka cluster or configure the # cluster to auto-create topics.
Make sure the broker list is an array
diff --git a/app/workers/scraper_auto_run_worker.rb b/app/workers/scraper_auto_run_worker.rb index abc1234..def5678 100644 --- a/app/workers/scraper_auto_run_worker.rb +++ b/app/workers/scraper_auto_run_worker.rb @@ -10,7 +10,8 @@ if scraper.runnable? && scraper.auto_run? if scraper.owner.ability.can? :create, Run run = scraper.runs.create(queued_at: Time.now, auto: true, owner_id: scraper.owner_id) - Morph::Runner.new(run).synch_and_go! + # Throw the actual run onto the background so it can be safely restarted + RunWorker.perform_async(run.id) else # Raise an error so that when we're in read-only mode the jobs get requeued raise "Owner #{scraper.owner.nickname} doesn't have permission to create run"
Throw actual run onto background so can be safely restarted
diff --git a/AbstractView.podspec b/AbstractView.podspec index abc1234..def5678 100644 --- a/AbstractView.podspec +++ b/AbstractView.podspec @@ -0,0 +1,16 @@+Pod::Spec.new do |s| + s.name = 'AbstractView' + s.version = '0.0.1' + s.license = 'MIT' + s.summary = 'The AbstractView is a simple view that can be used as a simple background view using abstract shapes and a visual effect' + s.homepage = 'https://github.com/nuudles/AbstractView' + s.authors = { 'Christopher Luu' => '[email protected]' } + s.source = { :git => 'https://github.com/nuudles/AbstractView.git', :tag => s.version } + + s.ios.deployment_target = '8.0' + s.tvos.deployment_target = '9.0' + + s.source_files = 'AbstractView/*.swift', 'AbstractView/Shapes/*.swift' + + s.requires_arc = true +end
Add a podspec file for CocoaPods
diff --git a/spec/intact_spec.rb b/spec/intact_spec.rb index abc1234..def5678 100644 --- a/spec/intact_spec.rb +++ b/spec/intact_spec.rb @@ -1,11 +1,29 @@ require 'spec_helper' describe 'intact objects' do - let(:datapipe) do - Datapipes.new + context 'with intact all' do + let(:datapipe) do + Datapipes.new + end + + it 'runs without any errors' do + expect { datapipe.run_resource }.not_to raise_error + end end - it 'runs but occurs nothing' do - expect { datapipe.run_resource }.not_to raise_error + context 'with intact tube and sink' do + let(:source) do + Class.new(Datapipes::Source) do + def run + 10.times {|i| produce(i) } + end + end.new + end + + let(:datapipe) { Datapipes.new(source: source) } + + it 'runs without any errors' do + expect { datapipe.run_resource }.not_to raise_error + end end end
Add more intact objects spec
diff --git a/spec/prefix_spec.rb b/spec/prefix_spec.rb index abc1234..def5678 100644 --- a/spec/prefix_spec.rb +++ b/spec/prefix_spec.rb @@ -4,31 +4,50 @@ describe "#fix_params" do let(:input_function) { instance_double(Proc) } - let(:curried_function) { instance_double(Proc) } - before { expect(input_function).to receive(:curry).and_return(curried_function) } let(:machine) { instance_double(Machine) } - context "when prefix stack is empty" do - it "curries the given function with the default value, 1" do - expect(curried_function).to receive(:call).with(1) + describe "currying input functions with simple prefixes" do + let(:curried_function) { instance_double(Proc) } + before { expect(input_function).to receive(:curry).and_return(curried_function) } - subject.fix_params(input_function) + context "when prefix stack is empty" do + it "curries the given function with the default value, 1" do + expect(curried_function).to receive(:call).with(1) + + subject.fix_params(input_function) + end + + it "curries the given function with the given integer, if provided" do + expect(curried_function).to receive(:call).with(14) + + subject.fix_params(input_function, 14) + end end - it "curries the given function with the given integer, if provided" do - expect(curried_function).to receive(:call).with(14) + context "with an integer on the prefix stack" do + let(:curried_function) { instance_double(Proc) } + before { subject.stack << 1234 } - subject.fix_params(input_function, 14) + it "curries the given function with the integer on the stack" do + expect(curried_function).to receive(:call).with(1234) + + subject.fix_params(input_function) + end end end - context "with an integer on the prefix stack" do - before { subject.stack << 1234 } - it "curries the given function with the integer on the stack" do - expect(curried_function).to receive(:call).with(1234) + context "with a function on the prefix stack" do + let(:machine) { double() } + let(:prefix_function) { proc { |m| m.some_instruction() } } + before { subject.stack << prefix_function } - subject.fix_params(input_function) + it "chains the output of prefix function into the given function" do + expect(machine).to receive(:some_instruction).and_return(:foo) + expect(input_function).to receive(:call).with(:foo, machine) + + chained_function = subject.fix_params(input_function) + chained_function.call(machine) end end
Add specs for chaining functions
diff --git a/wanikani.gemspec b/wanikani.gemspec index abc1234..def5678 100644 --- a/wanikani.gemspec +++ b/wanikani.gemspec @@ -7,7 +7,7 @@ s.authors = ["Dennis Martinez"] s.email = "[email protected]" s.files = Dir['lib/**/*.rb'] - s.homepage = "http://github.com/dennmart/wanikani" + s.homepage = "http://github.com/dennmart/wanikani-gem" s.add_runtime_dependency "rest-client", "~> 1.6" s.add_runtime_dependency "multi_json", "~> 1.5.0"
Fix homepage link in gemspec
diff --git a/lib/controllers/frontend/spree/users_controller.rb b/lib/controllers/frontend/spree/users_controller.rb index abc1234..def5678 100644 --- a/lib/controllers/frontend/spree/users_controller.rb +++ b/lib/controllers/frontend/spree/users_controller.rb @@ -27,7 +27,9 @@ if @user.update_attributes(user_params) if params[:user][:password].present? # this logic needed b/c devise wants to log us out after password changes - sign_in(@user, event: :authentication, bypass: !Spree::Auth::Config[:signout_after_password_change]) + unless Spree::Auth::Config[:signout_after_password_change] + bypass_sign_in(@user) + end end redirect_to spree.account_url, notice: Spree.t(:account_updated) else
Remove use of deprecated `bypass` opt for sign_in This commit updates the logic in the Spree::UsersController to remove the usage of the deprecated `bypass` option for Devise's `sign_in` 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 @@ -23,24 +23,3 @@ PuppetlabsSpec::Files.cleanup end end - -require 'pathname' -dir = Pathname.new(__FILE__).parent -Puppet[:modulepath] = File.join(dir, 'fixtures', 'modules') - -# There's no real need to make this version dependent, but it helps find -# regressions in Puppet -# -# 1. Workaround for issue #16277 where default settings aren't initialised from -# a spec and so the libdir is never initialised (3.0.x) -# 2. Workaround for 2.7.20 that now only loads types for the current node -# environment (#13858) so Puppet[:modulepath] seems to get ignored -# 3. Workaround for 3.5 where context hasn't been configured yet, -# ticket https://tickets.puppetlabs.com/browse/MODULES-823 -# -ver = Gem::Version.new(Puppet.version.split('-').first) -if Gem::Requirement.new("~> 2.7.20") =~ ver || Gem::Requirement.new("~> 3.0.0") =~ ver || Gem::Requirement.new("~> 3.5") =~ ver - puts "augeasproviders: setting Puppet[:libdir] to work around broken type autoloading" - # libdir is only a single dir, so it can only workaround loading of one external module - Puppet[:libdir] = "#{Puppet[:modulepath]}/augeasproviders_core/lib" -end
Use modulesync to manage meta files
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 @@ -14,8 +14,8 @@ config.before(:each) do Dir.mkdir SPEC_TMP_DIR - FileUtils.cp_r(FIXTURE_SOURCE_PATH, SOURCE_BASE_PATH) - FileUtils.cp_r(FIXTURE_TARGET_PATH, TARGET_BASE_PATH) + FileUtils.copy_entry FIXTURE_SOURCE_PATH, SOURCE_BASE_PATH + FileUtils.copy_entry FIXTURE_TARGET_PATH, TARGET_BASE_PATH puts "Target dir before test:" puts Dir.entries TARGET_BASE_PATH end
Test new method of copying fixtures for testing
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,8 @@ require 'bundler/setup' + +# missing dependency for Paperclip::UrlGenerator require 'active_support/core_ext/module/delegation' + require 'paperclip/tus' RSpec.configure do |config|
Add comment why we require delegation from AS
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,3 @@ Bundler.require(:database, :test) -require File.expand_path '../database/db', __FILE__ -require File.expand_path '../database/domain', __FILE__+require File.expand_path '../../lib/humus', __FILE__
Load humus helpers into the specs.
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,10 +1,11 @@ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) -require 'jekyll/asciinema' if ENV['TRAVIS'] require 'coveralls' Coveralls.wear! end + +require 'jekyll/asciinema' TEST_DIR = File.dirname(__FILE__) TMP_DIR = File.expand_path("../tmp", TEST_DIR)
Move coverage code to the very top of the file According to the documentation it must be run before any application code is being required.
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 @@ -6,6 +6,10 @@ else require 'simplecov' SimpleCov.start do + add_filter 'spec/' + add_filter 'scripts/' + add_filter 'config/' + add_group 'Adapters', 'app/adapters' add_group 'API versions', 'app/api/versions' add_group 'API entities', 'app/api/entities'
Exclude config, scripts and spec from simplecov coverage report
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 @@ -14,7 +14,7 @@ c.extend VCR::RSpec::Macros end -config = YAML.load(File.new(File.expand_path('~/.dnsimple.test'))) +config = YAML.load(File.new(File.expand_path('~/.dnsimple.local'))) DNSimple::Client.base_uri = config['site'] || "https://test.dnsimple.com/" DNSimple::Client.username = config['username']
Use .dnsimple.local when running tests
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,20 @@+# This file was generated by the `rspec --init` command. Conventionally, all +# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. +# Require this file using `require "spec_helper"` to ensure that it is only +# loaded once. +# +# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration RSpec.configure do |c| + c.treat_symbols_as_metadata_keys_with_true_values = true + c.run_all_when_everything_filtered = true + c.filter_run :focus + + # Run specs in random order to surface order dependencies. If you find an + # order dependency and want to debug it, you can fix the order by providing + # the seed, which is printed after each run. + # --seed 1234 + c.order = 'random' + c.before :suite do compile_opal_coffee.should be_true end
Add good defaults for rspec
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 @@ -8,6 +8,15 @@ end RSpec.configure do |config| + # Use color in STDOUT + config.color = true + + # Use color not only in STDOUT but also in pagers and files + config.tty = true + + # run the examples in random order + config.order = :rand + config.filter_run focus: true config.run_all_when_everything_filtered = true config.warnings = true
Expand config in rspec helper Signed-off-by: Tim Smith <[email protected]>
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 @@ -26,8 +26,10 @@ end def post(options={}) - page = Jekyll::Post.new site, CONFIG_DEFAULTS["source"], "", "2015-01-01-post.md" - page.data = options + filename = File.expand_path("2015-01-01-post.md", CONFIG_DEFAULTS["source"]) + config = { :site => site, :collection => site.collections["posts"] } + page = Jekyll::Document.new filename, config + page.merge_data!(options) page end
Update tests to work with Jekyll 3
diff --git a/lib/genome/groupers/interaction_grouper.rb b/lib/genome/groupers/interaction_grouper.rb index abc1234..def5678 100644 --- a/lib/genome/groupers/interaction_grouper.rb +++ b/lib/genome/groupers/interaction_grouper.rb @@ -3,9 +3,19 @@ class InteractionGrouper def self.run ActiveRecord::Base.transaction do + puts 'reset members' + reset_members puts 'add members' add_members end + end + + def self.reset_members + DataModel::InteractionClaim.all.each do |interaction_claim| + interaction_claim.interaction = nil + interaction_claim.save + end + DataModel::Interaction.destroy_all end def self.add_members
Delete interactions before running the grouper
diff --git a/googlemaps-services.gemspec b/googlemaps-services.gemspec index abc1234..def5678 100644 --- a/googlemaps-services.gemspec +++ b/googlemaps-services.gemspec @@ -17,9 +17,9 @@ spec.files = Dir['lib/**/*.rb'] spec.require_paths = ['lib'] - spec.add_runtime_dependency 'nokogiri', '~> 1.7', '>= 1.7.0.1' - spec.add_runtime_dependency 'http', '~> 2.1', '>= 2.1.0' - spec.add_development_dependency 'bundler', '~> 1.12' - spec.add_development_dependency 'rake', '~> 10.0' - spec.add_development_dependency 'rspec', '~> 3.0' + spec.add_runtime_dependency 'nokogiri', '~> 1.7', '>= 1.7.1' + spec.add_runtime_dependency 'http', '~> 2.2', '>= 2.2.1' + spec.add_development_dependency 'bundler', '~> 1.14' + spec.add_development_dependency 'rake', '~> 12.0' + spec.add_development_dependency 'rspec', '~> 3.5' end
Upgrade deps to latest stable release
diff --git a/lib/multitenancy_tools/functions_dumper.rb b/lib/multitenancy_tools/functions_dumper.rb index abc1234..def5678 100644 --- a/lib/multitenancy_tools/functions_dumper.rb +++ b/lib/multitenancy_tools/functions_dumper.rb @@ -22,7 +22,9 @@ # @param mode [String] IO open mode def dump_to(file, mode: 'w') results = @connection.execute(<<-SQL) - SELECT pg_get_functiondef(f.oid) as definition + SELECT + trim(trailing e' \n' from pg_get_functiondef(f.oid)) || ';\n' + AS definition FROM pg_catalog.pg_proc f INNER JOIN pg_catalog.pg_namespace n ON (f.pronamespace = n.oid) WHERE n.nspname = #{@schema}; @@ -30,7 +32,7 @@ File.open(file, mode) do |f| results.each do |result| - f.write result['definition'].strip + ";\n" + f.write result['definition'] end end end
Append ; using only SQL
diff --git a/spec/features/auth_signin_spec.rb b/spec/features/auth_signin_spec.rb index abc1234..def5678 100644 --- a/spec/features/auth_signin_spec.rb +++ b/spec/features/auth_signin_spec.rb @@ -8,9 +8,7 @@ expect(page).to have_content("Password") end scenario "A successful sign in redirects to the user profile" do - User.create(name: "test_user", - password: "password", - password_confirmation: "password") + User.create(username: "test_user",password: "password",password_confirmation: "password") visit signin_path fill_in "user[username]", :with => "test_user" fill_in "user[password]", :with => "password"
Change name to use name in auth signin spec features test
diff --git a/ice_nine.gemspec b/ice_nine.gemspec index abc1234..def5678 100644 --- a/ice_nine.gemspec +++ b/ice_nine.gemspec @@ -13,7 +13,7 @@ gem.require_paths = %w[lib] gem.files = `git ls-files`.split($/) - gem.test_files = `git ls-files -- {spec}/{unit,integration}`.split($/) + gem.test_files = `git ls-files -- spec/{unit,integration}`.split($/) gem.extra_rdoc_files = %w[LICENSE README.md TODO] gem.add_development_dependency('rake', '~> 10.0.3')
Remove unnecessary configuration for test files
diff --git a/config/initializers/kaminari_config.rb b/config/initializers/kaminari_config.rb index abc1234..def5678 100644 --- a/config/initializers/kaminari_config.rb +++ b/config/initializers/kaminari_config.rb @@ -0,0 +1,11 @@+Kaminari.configure do |config| + # config.default_per_page = 25 + # config.max_per_page = nil + # config.window = 4 + # config.outer_window = 0 + # config.left = 0 + # config.right = 0 + # config.page_method_name = :page + # config.param_name = :page + # config.params_on_first_page = false +end
Add a skeleton kaminari configuration file
diff --git a/lib/hpcloud/commands/config/set.rb b/lib/hpcloud/commands/config/set.rb index abc1234..def5678 100644 --- a/lib/hpcloud/commands/config/set.rb +++ b/lib/hpcloud/commands/config/set.rb @@ -13,6 +13,9 @@ method_option :service_name, :type => :string, :aliases => '-s', :required => :true, :desc => 'Specify the name of the service, for which the configuration setting is intended.' + method_option :availability_zone, :default => "az1.region-a.geo.1", + :type => :string, :aliases => '-z', + :desc => 'Set the availability zone for the named service.' define_method "config:set" do # Refactor for common settings later service_name = options[:service_name]
Add the method option for availability zone back.
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -7,7 +7,6 @@ version '1.1.1' depends 'apt' -depends 'helpers_express42' depends 'lvm' depends 'nginx' depends 'postgresql_lwrp'
Remove helpers_express42 cookbook from deps
diff --git a/lib/electric_sheeps/sheepfile/evaluator.rb b/lib/electric_sheeps/sheepfile/evaluator.rb index abc1234..def5678 100644 --- a/lib/electric_sheeps/sheepfile/evaluator.rb +++ b/lib/electric_sheeps/sheepfile/evaluator.rb @@ -19,7 +19,7 @@ end def readable? - File.exists?(@path) + File.exists?(@path) && File.readable?(@path) end end end
Check that file is readable
diff --git a/lib/provision/core/provisioning_service.rb b/lib/provision/core/provisioning_service.rb index abc1234..def5678 100644 --- a/lib/provision/core/provisioning_service.rb +++ b/lib/provision/core/provisioning_service.rb @@ -20,6 +20,7 @@ def provision_vm(spec_hash) clean_vm(spec_hash) + # FIXME - numbering_service to potentially move out of here? (When we do dynamic dns) spec = Provision::Core::MachineSpec.new(spec_hash) @numbering_service.allocate_ip_for(spec) @image_service.build_image(spec[:template], spec)
Add comment noting where the code change is going to go
diff --git a/lib/simple_templates/parser/node_parser.rb b/lib/simple_templates/parser/node_parser.rb index abc1234..def5678 100644 --- a/lib/simple_templates/parser/node_parser.rb +++ b/lib/simple_templates/parser/node_parser.rb @@ -14,7 +14,7 @@ tokens.any? && self::STARTING_TOKENS.include?(tokens.first.type) end - def initialize(unescapes, tokens, allowed_placeholders) + def initialize(unescapes, tokens, allowed_placeholders = nil) @unescapes = unescapes.to_h.clone.freeze @tokens = tokens.clone.freeze
Add default nil value for
diff --git a/Casks/beyond-compare.rb b/Casks/beyond-compare.rb index abc1234..def5678 100644 --- a/Casks/beyond-compare.rb +++ b/Casks/beyond-compare.rb @@ -1,6 +1,6 @@ cask :v1 => 'beyond-compare' do - version '4.0.2.19186' - sha256 '891492897485cc8ef7fa4636185fbc9c188e8dac6ec4564f326884af43fc18d3' + version '4.0.3.19420' + sha256 '2feb23098fa6fdc6885ef57fbea1a638a820f4eaeffbbd2e820ef7dc6272342f' url "http://www.scootersoftware.com/BCompareOSX-#{version}.zip" homepage 'http://www.scootersoftware.com/' @@ -11,4 +11,11 @@ postflight do suppress_move_to_applications end + + zap :delete => [ + '~/Library/Application Support/Beyond Compare', + '~/Library/Caches/com.apple.helpd/Generated/com.ScooterSoftware.BeyondCompare.help', + '~/Library/Caches/com.ScooterSoftware.BeyondCompare', + '~/Library/Saved Application State/com.ScooterSoftware.BeyondCompare.savedState', + ] end
Update Beyond Compare.app to 4.0.3.19420 and add zap stanza
diff --git a/.launchd/sshfs.rb b/.launchd/sshfs.rb index abc1234..def5678 100644 --- a/.launchd/sshfs.rb +++ b/.launchd/sshfs.rb @@ -12,6 +12,7 @@ is_mounted = active_mounts.include? destination if !is_mounted + system 'mkdir', '-p', destination `#{$sshfs_path} #{port} -o #{options} \ '#{mount[:source]}' '#{destination}'` end
Create mount point if it doesn't exist The reason for this is that mount points are automatically deleted in /Volumes on OS X upon shutdown or reboot.
diff --git a/test/test_password_expired_controller.rb b/test/test_password_expired_controller.rb index abc1234..def5678 100644 --- a/test/test_password_expired_controller.rb +++ b/test/test_password_expired_controller.rb @@ -6,7 +6,7 @@ setup do @request.env["devise.mapping"] = Devise.mappings[:user] @user = User.create(username: 'hello', email: '[email protected]', - password: '1234', password_changed_at: 3.months.ago) + password: '1234', password_changed_at: 4.months.ago) sign_in(@user) end
Set password_changed_at to 4 months so test doesn't flap Solves https://github.com/devise-security/devise-security/issues/12
diff --git a/test/note_test.rb b/test/note_test.rb index abc1234..def5678 100644 --- a/test/note_test.rb +++ b/test/note_test.rb @@ -2,12 +2,19 @@ class TestNote < MiniTest::Test def setup - @note_1 = MusicTheory::Note.new(frequency: 220, duration: 2.0) + @frequency = 220.to_f + @duration = 2.0 + @sample_rate = 22050 + @note = MusicTheory::Note.new(frequency: @frequency, duration: @duration) end def test_total_frames - sample_rate = 22050 - frames = (2.0 * sample_rate).to_i - assert_equal frames, @note_1.total_frames + frames = (@duration * @sample_rate).to_i + assert_equal frames, @note.total_frames + end + + def test_cycles_per_frame + cycles_per_frame = @frequency / @sample_rate + assert_equal cycles_per_frame, @note.cycles_per_frame end end
Add cycles per frame test
diff --git a/lib/typhoeus/request/streamable.rb b/lib/typhoeus/request/streamable.rb index abc1234..def5678 100644 --- a/lib/typhoeus/request/streamable.rb +++ b/lib/typhoeus/request/streamable.rb @@ -27,7 +27,7 @@ # # @return [ Boolean ] True if any on_body blocks have been set. def streaming? - @on_body && @on_body.any? + on_body && on_body.any? end end end
Use getter method instead of instance variable to remove initialization warning
diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb index abc1234..def5678 100644 --- a/Library/Homebrew/cmd/uses.rb +++ b/Library/Homebrew/cmd/uses.rb @@ -15,10 +15,10 @@ uses = formulae.select do |f| used_formulae.all? do |ff| if recursive - f.recursive_dependencies.any? { |dep| dep.name == ff.name } || + f.recursive_dependencies.any? { |dep| dep.to_formula.name == ff.name } || f.recursive_requirements.any? { |req| req.name == ff.name } else - f.deps.any? { |dep| dep.name == ff.name } || + f.deps.any? { |dep| dep.to_formula.name == ff.name } || f.requirements.any? { |req| req.name == ff.name } end end
Convert dependencies to formulas for name matching Dependency names are prefixed with the tap location, therefore dependency names do not match formula names. We convert dependencies into formulas to ensure proper name checking. Closes Homebrew/homebrew#35058. Signed-off-by: Jack Nagel <[email protected]>
diff --git a/Formula/oxygen-icons.rb b/Formula/oxygen-icons.rb index abc1234..def5678 100644 --- a/Formula/oxygen-icons.rb +++ b/Formula/oxygen-icons.rb @@ -0,0 +1,14 @@+require 'formula' + +class OxygenIcons <Formula + url 'ftp://ftp.kde.org/pub/kde/stable/4.4.0/src/oxygen-icons-4.4.0.tar.bz2' + homepage 'http://www.oxygen-icons.org/' + md5 'fbcd429cc822cb88a815d97a4e66be4d' + + depends_on 'cmake' + + def install + system "cmake . #{std_cmake_parameters}" + system "make install" + end +end
Add formula for KDE's Oxygen icons version 4.4.0.
diff --git a/lib/forecast_io/configuration.rb b/lib/forecast_io/configuration.rb index abc1234..def5678 100644 --- a/lib/forecast_io/configuration.rb +++ b/lib/forecast_io/configuration.rb @@ -1,7 +1,7 @@ module ForecastIO module Configuration # Default API endpoint - DEFAULT_FORECAST_IO_API_ENDPOINT = 'https://api.forecast.io' + DEFAULT_FORECAST_IO_API_ENDPOINT = 'https://api.darksky.net' # Forecast API endpoint attr_writer :api_endpoint
Update to new darksky api endpoint
diff --git a/lib/staticmatic/configuration.rb b/lib/staticmatic/configuration.rb index abc1234..def5678 100644 --- a/lib/staticmatic/configuration.rb +++ b/lib/staticmatic/configuration.rb @@ -11,10 +11,11 @@ def initialize self.preview_server_port = 3000 + self.preview_server_host = "localhost" self.use_extensions_for_page_links = true self.sass_options = {} self.haml_options = {} self.coffee_options = '' end end -end+end
Make the default preview server host "localhost"
diff --git a/lib/tasks/seed_example_data.rake b/lib/tasks/seed_example_data.rake index abc1234..def5678 100644 --- a/lib/tasks/seed_example_data.rake +++ b/lib/tasks/seed_example_data.rake @@ -2,7 +2,7 @@ desc "Seed example data for C.O.D.E" task seed_example_data: :environment do p 'seed students' - for i in (1..100) + 100.times do Student.new({ name: Faker::Name.name, responsible: Faker::Name.name, @@ -13,7 +13,7 @@ end p 'seed Users' - for i in (1..20) + 20.times do User.new({ name: Faker::Name.name, email: Faker::Internet.email, @@ -25,7 +25,7 @@ end p 'seed school performace' - for i in (1..100) + 100.times do rd = rand(5.years).seconds.ago @@ -39,7 +39,7 @@ end p 'Seed incidents' - for i in (1..100) + 100.times do Incident.new({ student_id: rand(1..10), user_id: rand(1..9),
Replace 'for' iterations for proper loops in seed file This commit removes 4 bad smells pointed by codeclimate
diff --git a/thumbtack.gemspec b/thumbtack.gemspec index abc1234..def5678 100644 --- a/thumbtack.gemspec +++ b/thumbtack.gemspec @@ -18,7 +18,7 @@ spec.license = 'MIT' spec.name = 'thumbtack' spec.require_paths = ['lib'] - spec.required_ruby_version = '>= 2.3.6' + spec.required_ruby_version = '>= 2.4.5' spec.summary = 'The best Pinboard API client' spec.test_files = Dir.glob('test/**/*.rb') spec.version = Thumbtack::VERSION
Prepare for Ruby 2.3 end-of-life
diff --git a/toolsmith.gemspec b/toolsmith.gemspec index abc1234..def5678 100644 --- a/toolsmith.gemspec +++ b/toolsmith.gemspec @@ -13,7 +13,7 @@ s.summary = "A gem to craft UI's easily." s.description = "Toolsmith provides common helpers for UI components and styles." - s.files = Dir["{app,config,db,lib}/**/*"] + ["README.md"] + s.files = Dir["{app,config,db,lib}/**/*"] + ["Rakefile", "README.md", "CHANGELOG.md"] s.add_dependency "rails", "~> 3.2.11" s.add_dependency "compass-rails", "~> 1.0.3" @@ -23,4 +23,4 @@ s.add_development_dependency "guard-rspec", "~> 2.3.3" s.add_development_dependency "rb-fsevent", "~> 0.9.1" s.add_development_dependency "nokogiri", "~> 1.5.6" -end+end
Package gem with README and CHANGELOG
diff --git a/lastpass.gemspec b/lastpass.gemspec index abc1234..def5678 100644 --- a/lastpass.gemspec +++ b/lastpass.gemspec @@ -17,7 +17,7 @@ s.required_ruby_version = ">= 1.9.3" s.add_dependency "httparty", "~> 0.12.0" - s.add_dependency "pbkdf2", "~> 0.1.0" + s.add_dependency "pbkdf2-ruby", "~> 0.2.0" s.add_development_dependency "rake", "~> 10.0.0" s.add_development_dependency "rspec", "~> 2.14.0"
Use different PBKDF2 gem compatible with Ruby 2.0
diff --git a/klarna.gemspec b/klarna.gemspec index abc1234..def5678 100644 --- a/klarna.gemspec +++ b/klarna.gemspec @@ -8,8 +8,8 @@ gem.version = Klarna::VERSION gem.authors = ["Daniel Salmeron Amselem"] gem.email = ["[email protected]"] - gem.description = %q{TODO: Write a gem description} - gem.summary = %q{TODO: Write a gem summary} + gem.description = %q{XMLRPC Client to Klarna's API.} + gem.summary = %q{XMLRPC Client to Klarna's API.} gem.homepage = "" gem.add_development_dependency "rspec"
Add description of the gem in gem spec.
diff --git a/fabrication.gemspec b/fabrication.gemspec index abc1234..def5678 100644 --- a/fabrication.gemspec +++ b/fabrication.gemspec @@ -23,6 +23,6 @@ s.add_development_dependency("ffaker", [">= 0.4.0"]) s.add_development_dependency("activerecord", [">= 3.0.0"]) s.add_development_dependency("sqlite3-ruby", [">= 1.3.0"]) - s.add_development_dependency("bson_ext", [">= 1.0.7"]) - s.add_development_dependency("mongoid", [">= 2.0.0.beta.17"]) + s.add_development_dependency("bson_ext", ["1.0.4"]) + s.add_development_dependency("mongoid", ["2.0.0.beta.18"]) end
Fix development version mismatch of bson and bson_ext
diff --git a/taxjar-ruby.gemspec b/taxjar-ruby.gemspec index abc1234..def5678 100644 --- a/taxjar-ruby.gemspec +++ b/taxjar-ruby.gemspec @@ -18,6 +18,8 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] + spec.required_ruby_version = '>= 1.9.3' + spec.add_dependency 'addressable', '~> 2.3.8' spec.add_dependency 'http', '~> 0.9.4' spec.add_dependency 'memoizable', '~> 0.4.0'
Set required Ruby version to 1.9.3+ in gemspec
diff --git a/_plugins/mathjax.rb b/_plugins/mathjax.rb index abc1234..def5678 100644 --- a/_plugins/mathjax.rb +++ b/_plugins/mathjax.rb @@ -8,7 +8,7 @@ # Detect if we need to use block display style SYNTAX = /(display)?/ - def initialize(tag_name, markup,tokens) + def initialize(tag_name, markup, tokens) super if markup =~ SYNTAX if defined? $1 @@ -37,7 +37,7 @@ def render_display(context, math) # Since this is a block style formula, wrap it in a paragraph <<-HTML -<p> +<p style="text-align: center"> <span class="MathJax_Preview">#{h(math).strip}</span><script type="math/tex; mode=display"> #{math.strip} </script>
Use explicit alignment for block-style formulas
diff --git a/attributes/source.rb b/attributes/source.rb index abc1234..def5678 100644 --- a/attributes/source.rb +++ b/attributes/source.rb @@ -17,9 +17,9 @@ # limitations under the License. # -git_version = '1.8.1' +git_version = '1.8.2' default['git']['version'] = git_version default['git']['url'] = "https://github.com/gitster/git/tarball/v#{git_version}" -default['git']['checksum'] = '1a9d87a5e898' +default['git']['checksum'] = 'b01b7f6b216a' default['git']['prefix'] = '/usr/local'
Update Git to version 1.8.2
diff --git a/lib/securid.rb b/lib/securid.rb index abc1234..def5678 100644 --- a/lib/securid.rb +++ b/lib/securid.rb @@ -23,7 +23,7 @@ end def denied? - @status == AUTHENTICATED + @status == DENIED end end end
Fix bug with denied? method.
diff --git a/gist.rb b/gist.rb index abc1234..def5678 100644 --- a/gist.rb +++ b/gist.rb @@ -0,0 +1,97 @@+#!/usr/bin/env ruby +require 'net/http' +require 'json' + +class Gist + attr_accessor :id, :description, :public, :files + def initialize(hash) + @id = hash[:id] + @description = hash[:description] + @public = hash[:public] + @files = hash[:files] || {} + end + + def to_hash + hash = { + :description => @description, + :public => @public, + :files => @files, + } + hash[:id] = @id if not @id.nil? + + hash + end + + def to_json(*a) + self.to_hash.to_json(*a) + end + + def [](name) + @files[name] + end + + def []=(name, body) + if @files[name].nil? then + @files[name] = {} + end + @files[name][:content] = body + end + + def self.json_create(hash) + files = {} + hash[:files].each do |k,v| + files[k.to_s] = {:content => v[:content]} + end + + hash[:files] = files + + new(hash) + end +end + +class Gists + API_ROOT = "api.github.com" + def initialize(username, password) + @username = username + @password = password + end + + def get(resource) + Net::HTTP.start(API_ROOT, :use_ssl => true) do |http| + req = Net::HTTP::Get.new(resource) + req.basic_auth @username, @password + response = http.request(req) + + JSON.parse(response.body, :symbolize_names => true) + end + end + + def post(resource, body) + Net::HTTP.start(API_ROOT, :use_ssl => true) do |http| + req = Net::HTTP::Post.new(resource) + req.basic_auth @username, @password + req.body = body + response = http.request(req) + + JSON.parse(response.body, :symbolize_names => true) + end + end + + def get_all + get("/gists") + end + + def get_gist(id) + Gist.json_create(get("/gists/#{id}")) + end + + def save(gist) + if not gist.id.nil? then + post "/gists/#{gist.id}", gist.to_json + else + res = post "/gists", gist.to_json + gist.id = res["id"] + res + end + end +end
Add a tiny little Gist library that works for my purposes.
diff --git a/lib/rbzip2/io.rb b/lib/rbzip2/io.rb index abc1234..def5678 100644 --- a/lib/rbzip2/io.rb +++ b/lib/rbzip2/io.rb @@ -1,7 +1,7 @@ # This code is free software; you can redistribute it and/or modify it under # the terms of the new BSD License. # -# Copyright (c) 2011-2013, Sebastian Staudt +# Copyright (c) 2011-2017, Sebastian Staudt class RBzip2::IO @@ -16,6 +16,22 @@ @decompressor.close end + def getc + @decompressor.getc + end + + def gets + @decompressor.gets + end + + def putc(int) + @compressor.putc int + end + + def puts(line) + @compressor.puts line + end + def read @decompressor.read end
Add new methods to IO
diff --git a/lib/to_slug.rb b/lib/to_slug.rb index abc1234..def5678 100644 --- a/lib/to_slug.rb +++ b/lib/to_slug.rb @@ -17,7 +17,7 @@ def to_slug # Perform transliteration to replace non-ascii characters with an ascii # character - value = self.chars.normalize(:kd).gsub(/[^\x00-\x7F]/n, '') + value = self.mb_chars.normalize(:kd).gsub(/[^\x00-\x7F]/n, '') # Remove single quotes from input value.gsub!(/[']+/, '')
Use mb_chars instead of chars method. Chars is deprecated in Rails Edge.
diff --git a/git-scripts.gemspec b/git-scripts.gemspec index abc1234..def5678 100644 --- a/git-scripts.gemspec +++ b/git-scripts.gemspec @@ -19,7 +19,7 @@ '[email protected]', '[email protected]'] - s.add_dependency 'bundler', '~> 1.17' + s.add_dependency 'bundler', '~> 2.1' s.add_dependency 'octokit', '~> 4.0' s.add_dependency 'json', '~> 1.8'
Update bundler to avoid deprecation notices
diff --git a/lib/salt/page.rb b/lib/salt/page.rb index abc1234..def5678 100644 --- a/lib/salt/page.rb +++ b/lib/salt/page.rb @@ -33,13 +33,18 @@ File.join(parent_path, File.dirname(@path).gsub(site.source_paths[:pages], '')) end - def write(site, path, context = {}) + def write(site, path, context = false) directory_path = output_path(site, path) full_path = File.join(directory_path, output_file) @url = full_path.gsub(site.output_paths[:site], '').gsub(/index\.html$/, '') - contents = render(site, @contents, {this: self}.merge(context)) + contents = if context + render(site, @contents, {this: self}.merge(context)) + else + @contents + end + FileUtils.mkdir_p(directory_path) unless Dir.exist?(directory_path) File.open(full_path, 'w') do |file|
Make the context option, so we can write out raw files based on the contents.
diff --git a/app/jobs/log_job.rb b/app/jobs/log_job.rb index abc1234..def5678 100644 --- a/app/jobs/log_job.rb +++ b/app/jobs/log_job.rb @@ -13,7 +13,7 @@ if File.exist? initial_location FileUtils.touch initial_location - FileUtils.chmod 755, initial_location + FileUtils.chmod 777, initial_location end end
Make logs completely public in worker
diff --git a/test/test_helper.rb b/test/test_helper.rb index abc1234..def5678 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -14,14 +14,6 @@ end module RenderERBUtils - def view - @view ||= begin - path = ActionView::FileSystemResolver.new(FIXTURE_LOAD_PATH) - view_paths = ActionView::PathSet.new([path]) - ActionView::Base.new(view_paths) - end - end - def render_erb(string) @virtual_path = nil @@ -29,9 +21,8 @@ string.strip, "test template", ActionView::Template::Handlers::ERB, - {} + {format: :html, locals: []} ) - - template.render(self, {}).strip + self.render(template: template) end end
Fix tests for Rails 6 Template rendering has changed in [1] which causes tests to fail on Rails 6. This changes the `render_erb` test helper to be compatible with both Rails 5 and Rails 6. Also removes unused `view` method. [1] https://github.com/rails/rails/commit/db4b77aca147ec3c7376d803fc6ccb14c9195352#diff-e78f6b2a39ac178601ac63b89f981f98