diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/github/ldap/user_search/active_directory.rb b/lib/github/ldap/user_search/active_directory.rb index abc1234..def5678 100644 --- a/lib/github/ldap/user_search/active_directory.rb +++ b/lib/github/ldap/user_search/active_directory.rb @@ -2,14 +2,6 @@ class Ldap module UserSearch class ActiveDirectory < Default - - # Returns a connection to the Active Directory Global Catalog - # - # See: https://technet.microsoft.com/en-us/library/cc728188(v=ws.10).aspx - # - def global_catalog_connection - GlobalCatalog.connection(ldap) - end private @@ -17,6 +9,10 @@ # Global Catalog to perform the user search. def search(search_options) Array(global_catalog_connection.search(search_options.merge(options))) + end + + def global_catalog_connection + GlobalCatalog.connection(ldap) end # When doing a global search for a user's DN, set the search base to blank @@ -29,6 +25,10 @@ STANDARD_GC_PORT = 3268 LDAPS_GC_PORT = 3269 + # Returns a connection to the Active Directory Global Catalog + # + # See: https://technet.microsoft.com/en-us/library/cc728188(v=ws.10).aspx + # def self.connection(ldap) @global_catalog_instance ||= begin netldap = ldap.connection
Make global connection interface private
diff --git a/lib/tasks/2018_06_05_send_new_attestations.rake b/lib/tasks/2018_06_05_send_new_attestations.rake index abc1234..def5678 100644 --- a/lib/tasks/2018_06_05_send_new_attestations.rake +++ b/lib/tasks/2018_06_05_send_new_attestations.rake @@ -43,7 +43,7 @@ dossier.attestation = dossier.build_attestation NewAttestationMailer.new_attestation(dossier).deliver_later - puts "Email envoyé à #{email} pour le dossier #{dossier.id}" + puts "Email envoyé à #{dossier.user.email} pour le dossier #{dossier.id}" puts end end
Fix a bug in a task
diff --git a/lib/tasks/deployment/20201123115503_update_head_teacher_school_summary_to_management_summary.rake b/lib/tasks/deployment/20201123115503_update_head_teacher_school_summary_to_management_summary.rake index abc1234..def5678 100644 --- a/lib/tasks/deployment/20201123115503_update_head_teacher_school_summary_to_management_summary.rake +++ b/lib/tasks/deployment/20201123115503_update_head_teacher_school_summary_to_management_summary.rake @@ -0,0 +1,14 @@+namespace :after_party do + desc 'Deployment task: update_head_teacher_school_summary_to_management_summary' + task update_head_teacher_school_summary_to_management_summary: :environment do + puts "Running deploy task 'update_head_teacher_school_summary_to_management_summary'" + + # Put your task implementation HERE. + AlertType.where(class_name: 'HeadTeachersSchoolSummaryTable').update_all(class_name: 'ManagementSummaryTable') + + # Update task as completed. If you remove the line below, the task will + # run with every deploy (or every time you call after_party:run). + AfterParty::TaskRecord + .create version: AfterParty::TaskRecorder.new(__FILE__).timestamp + end +end
Change HeadTeachersSchoolSummaryTable to ManagementSummaryTable in alert_types
diff --git a/app/models/user.rb b/app/models/user.rb index abc1234..def5678 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,6 +1,6 @@ class User < ActiveRecord::Base devise :two_factor_authenticatable, - otp_secret_encryption_key: ENV['TWO_FACTOR_ENCRYPTION_KEY'], + otp_secret_encryption_key: Rails.env.test? ? 'SECRET' : ENV['TWO_FACTOR_ENCRYPTION_KEY'], otp_allowed_drift: 60 devise :rememberable, :trackable, :validatable, :timeoutable
Make tests less dependent on config. For the test environment it's okay if no TWO_FACTOR_ENCRYPTION_KEY is set up, we can use any old key. This will make it easier to run tests from a fresh install.
diff --git a/google-cloud/lib/google-cloud.rb b/google-cloud/lib/google-cloud.rb index abc1234..def5678 100644 --- a/google-cloud/lib/google-cloud.rb +++ b/google-cloud/lib/google-cloud.rb @@ -13,9 +13,7 @@ # limitations under the License. ## -# This file is here to be autorequired by bundler, so that the .bigquery and -# #bigquery methods can be available, but the library and all dependencies won't -# be loaded until required and used. +# This file is here to be autorequired by bundler. gem "google-cloud-core"
Update comment for Google Cloud Correct the methods listed in the autorequire comment.
diff --git a/test/integration/connection_test.rb b/test/integration/connection_test.rb index abc1234..def5678 100644 --- a/test/integration/connection_test.rb +++ b/test/integration/connection_test.rb @@ -2,10 +2,18 @@ module Tropoli class ConnectionTest < IntegrationTest + test :"nick and user commands sent to establish connection" do + options = { :nick => "Tropoli", :user => "tropoli", :real => "Tropoli Bot" } + connection(options).tap do |c| + assert_sent_from c, "NICK #{options[:nick]}\r\n" + assert_sent_from c, "USER #{options[:user]} 0 0 :#{options[:real]}\r\n" + end + end + test :"pass sent before nick and user if supplied" do pass = "s3cr3t" connection(:pass => pass).tap do |c| - assert_sent_from c, "PASS #{pass}" + assert_sent_from c, "PASS #{pass}\r\n" end end
Add integration test for NICK and USER on connection establishment
diff --git a/spec/views/assets/_support_facility_fta.html.haml_spec.rb b/spec/views/assets/_support_facility_fta.html.haml_spec.rb index abc1234..def5678 100644 --- a/spec/views/assets/_support_facility_fta.html.haml_spec.rb +++ b/spec/views/assets/_support_facility_fta.html.haml_spec.rb @@ -3,7 +3,7 @@ describe "assets/_support_facility_fta.html.haml", :type => :view do it 'fta info' do - test_asset = create(:administration_building, :fta_funding_type_id => 1, :pcnt_capital_responsibility =>22, :fta_facility_type_id => 1, :facility_capacity_type_id => 1, :primary_fta_mode_type => FtaModeType.first, :fta_private_mode_type => FtaPrivateModeType.first) + test_asset = create(:administration_building, :fta_funding_type_id => 1, :pcnt_capital_responsibility =>22, :fta_facility_type_id => FtaFacilityType.first.id, :facility_capacity_type_id => 1, :primary_fta_mode_type => FtaModeType.first, :fta_private_mode_type => FtaPrivateModeType.first) test_asset.secondary_fta_mode_types << FtaModeType.second test_asset.save! assign(:asset, test_asset)
Fix support_facility_fta error on finding facilitytype
diff --git a/git_bumper.gemspec b/git_bumper.gemspec index abc1234..def5678 100644 --- a/git_bumper.gemspec +++ b/git_bumper.gemspec @@ -14,7 +14,7 @@ spec.homepage = 'https://github.com/lenon/git_bumper' spec.license = 'MIT' - spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } + spec.files = Dir['README.md', 'LICENSE.txt', 'lib/**/*'] spec.executables = ['git-bump'] spec.require_paths = ['lib']
Add only required files on .gem pkg
diff --git a/app/models/reviewit_config.rb b/app/models/reviewit_config.rb index abc1234..def5678 100644 --- a/app/models/reviewit_config.rb +++ b/app/models/reviewit_config.rb @@ -12,7 +12,7 @@ def load_data data = read_yaml data.merge!(data[Rails.env]) if data.key?(Rails.env) - data.symbolize_keys! + data.deep_symbolize_keys! apply_defaults(data) apply_open_structs(data) data
Fix reviewit config for mail configuration.
diff --git a/app/refineries/cloud_refinery.rb b/app/refineries/cloud_refinery.rb index abc1234..def5678 100644 --- a/app/refineries/cloud_refinery.rb +++ b/app/refineries/cloud_refinery.rb @@ -1,10 +1,11 @@ class CloudRefinery < ApplicationRefinery def create - [:name, :short_name, :description] + [:name, :short_name, :description, :hidden, :locked, :remote_avatar_url, :avatar, :rules] end def update + create + [:remove_avatar] end end
Add more allowed attributes to clouds refinery.
diff --git a/app/sweepers/location_sweeper.rb b/app/sweepers/location_sweeper.rb index abc1234..def5678 100644 --- a/app/sweepers/location_sweeper.rb +++ b/app/sweepers/location_sweeper.rb @@ -1,34 +1,37 @@ class LocationSweeper < ActionController::Caching::Sweeper - + include ApplicationHelper - + private - def expire_stop_fragments(stop) + def expire_stop_fragments(stop) # expire the stop page fragments stop_cache = stop_cache_path(stop) expire_fragment("#{stop_cache}.action_suffix=route_list") expire_fragment("#{stop_cache}.action_suffix=map") + expire_fragment("#{stop_cache}.action_suffix=map_variant") end - + def expire_stop_area_fragments(stop_area) stop_area_path = location_path(stop_area) stop_area_cache = main_url(stop_area_path, { :skip_protocol => true }) expire_fragment("#{stop_area_cache}.action_suffix=route_list") expire_fragment("#{stop_area_cache}.action_suffix=map") + expire_fragment("#{stop_area_cache}.action_suffix=map_variant") end - + def expire_route_fragments(route) # expire the route page fragments - route_path = url_for(:controller => '/locations', - :action => 'show_route', + route_path = url_for(:controller => '/locations', + :action => 'show_route', :scope => route.region, :id => route, :only_path => true) route_cache = main_url(route_path, { :skip_protocol => true }) - + expire_fragment("#{route_cache}.action_suffix=stop_list") expire_fragment("#{route_cache}.action_suffix=map") + expire_fragment("#{route_cache}.action_suffix=map_variant") end end
Remove cached location maps with the variant suffix too.
diff --git a/app/workers/feed_eater_worker.rb b/app/workers/feed_eater_worker.rb index abc1234..def5678 100644 --- a/app/workers/feed_eater_worker.rb +++ b/app/workers/feed_eater_worker.rb @@ -26,5 +26,6 @@ # logger.info '5. Creating FeedEater Reports' # logger.info '6. Uploading to S3' + # aws s3 sync . s3://onestop-feed-cache.transit.land end end
Comment describing s3 upload command
diff --git a/examples/ranking_csv.rb b/examples/ranking_csv.rb index abc1234..def5678 100644 --- a/examples/ranking_csv.rb +++ b/examples/ranking_csv.rb @@ -0,0 +1,54 @@+# coding: utf-8 +# 楽天ランキングAPIを利用し、ランキングデータをCSVとして保存するサンプル +# config.item_ranking_module = 'MyCSV' の使い方を説明したかっただけ + +require 'rakuten_api' +require 'faraday' +require 'csv' + +module MyCSV + CSV_KEYS = { + rank: "ランク", + shop_name: "店舗名", + shop_url: "店舗URL", + item_name: "商品名", + catchcopy: "キャッチコピー", + item_price: "価格", + medium_image_urls: "画像", + tax_flag: "消費税", + postage_flag: "送料", + review_count: "レビュー数", + review_average: "平均レビュー", + }.freeze + + def to_a + row = [] + h = to_hash + CSV_KEYS.keys.each do |key| + row << h[key] + end + row.map do |o| + o.is_a?(Array) ? o.first : o + end + end +end + +RakutenApi.configure do |config| + config.application_id = "[Your Application Id]" + config.item_ranking_module = 'MyCSV' +end + + +client = RakutenApi::ItemRanking::Client.new +response = client.request + +CSV.open(response.last_build_date.strftime('%Y%m%d%H%M') + '.csv', "wb", { col_sep: ',', row_sep: "\n", force_quotes: true }) do |csv| + csv << RakutenApi::ItemRanking::Model::CSV_KEYS.values + begin + response.simple_mapping.each do |f| + csv << f.to_a + end + sleep 1 + response = response.next_ranking + end while response.success? +end
Add rakuten ranking save as csv sample
diff --git a/spec/build/dependencygrapher/print_dependencies_spec.rb b/spec/build/dependencygrapher/print_dependencies_spec.rb index abc1234..def5678 100644 --- a/spec/build/dependencygrapher/print_dependencies_spec.rb +++ b/spec/build/dependencygrapher/print_dependencies_spec.rb @@ -7,6 +7,10 @@ @grapher = DependencyGrapher.new [] @grapher.should_receive(:get_system_defines) + end + + after :each do + $stdout = @stdout end it "prints the dependencies for all object files" do
Make sure $stdout is reassigned in :after action.
diff --git a/spec/generators/rspec/feature/feature_generator_spec.rb b/spec/generators/rspec/feature/feature_generator_spec.rb index abc1234..def5678 100644 --- a/spec/generators/rspec/feature/feature_generator_spec.rb +++ b/spec/generators/rspec/feature/feature_generator_spec.rb @@ -15,10 +15,16 @@ run_generator %w(posts) end describe 'the spec' do - subject { file('spec/features/posts_spec.rb') } - it { should exist } - it { should contain(/require 'spec_helper'/) } - it { should contain(/feature "Posts"/) } + subject(:feature_spec) { file('spec/features/posts_spec.rb') } + it "exists" do + expect(feature_spec).to exist + end + it "contains 'spec_helper'" do + expect(feature_spec).to contain(/require 'spec_helper'/) + end + it "contains the feature" do + expect(feature_spec).to contain(/feature "Posts"/) + end end end @@ -27,8 +33,10 @@ run_generator %w(posts --no-feature-specs) end describe "the spec" do - subject { file('spec/features/posts_spec.rb') } - it { should_not exist } + subject(:feature_spec) { file('spec/features/posts_spec.rb') } + it "does not exist" do + expect(feature_spec).to_not exist + end end end end
Change feature generator spec to use expect syntax
diff --git a/vendor/plugins/themes/rails/init.rb b/vendor/plugins/themes/rails/init.rb index abc1234..def5678 100644 --- a/vendor/plugins/themes/rails/init.rb +++ b/vendor/plugins/themes/rails/init.rb @@ -1,29 +1,32 @@-# Set up middleware to serve theme files -config.middleware.use "ThemeServer" +# Before the application gets setup this will fail badly if there's no database. +if RefinerySetting.table_exists? + # Set up middleware to serve theme files + config.middleware.use "ThemeServer" -# Add or remove theme paths to/from Refinery application -::Refinery::ApplicationController.module_eval do - before_filter do |controller| - controller.view_paths.reject! { |v| v.to_s =~ %r{^themes/} } - if (theme = RefinerySetting[:theme]).present? - # Set up view path again for the current theme. - controller.view_paths.unshift Rails.root.join("themes", theme, "views").to_s + # Add or remove theme paths to/from Refinery application + ::Refinery::ApplicationController.module_eval do + before_filter do |controller| + controller.view_paths.reject! { |v| v.to_s =~ %r{^themes/} } + if (theme = RefinerySetting[:theme]).present? + # Set up view path again for the current theme. + controller.view_paths.unshift Rails.root.join("themes", theme, "views").to_s - RefinerySetting[:refinery_menu_cache_action_suffix] = "#{theme}_site_menu" - else - # Set the cache key for the site menu (thus expiring the fragment cache if theme changes). - RefinerySetting[:refinery_menu_cache_action_suffix] = "site_menu" + RefinerySetting[:refinery_menu_cache_action_suffix] = "#{theme}_site_menu" + else + # Set the cache key for the site menu (thus expiring the fragment cache if theme changes). + RefinerySetting[:refinery_menu_cache_action_suffix] = "site_menu" + end end end + + if (theme = RefinerySetting[:theme]).present? + # Set up controller paths, which can only be brought in with a server restart, sorry. (But for good reason) + controller_path = Rails.root.join("themes", theme, "controllers").to_s + + ::ActiveSupport::Dependencies.load_paths.unshift controller_path + config.controller_paths.unshift controller_path + end + + # Include theme functions into application helper. + Refinery::ApplicationHelper.send :include, ThemesHelper end - -if (theme = RefinerySetting[:theme]).present? - # Set up controller paths, which can only be brought in with a server restart, sorry. (But for good reason) - controller_path = Rails.root.join("themes", theme, "controllers").to_s - - ::ActiveSupport::Dependencies.load_paths.unshift controller_path - config.controller_paths.unshift controller_path -end - -# Include theme functions into application helper. -Refinery::ApplicationHelper.send :include, ThemesHelper
Fix themes breaking rake db:setup because RefinerySetting.table_exists? is false.
diff --git a/features/support/app.rb b/features/support/app.rb index abc1234..def5678 100644 --- a/features/support/app.rb +++ b/features/support/app.rb @@ -3,6 +3,24 @@ class DillApp < Sinatra::Base; end +module WebApp + def define_page_body(html, path = "/test") + define_page <<-HTML, path + <html> + <body> + #{html} + </body> + </html> + HTML + end + + def define_page(html, path = "/test") + DillApp.get(path) { html } + end +end + +World WebApp + After do DillApp.reset! end
[tests] Allow defining the html we're working with.
diff --git a/formula/ruby-1.9.3-p327-falcon.rb b/formula/ruby-1.9.3-p327-falcon.rb index abc1234..def5678 100644 --- a/formula/ruby-1.9.3-p327-falcon.rb +++ b/formula/ruby-1.9.3-p327-falcon.rb @@ -6,6 +6,6 @@ def install run "autoconf" - autoconf(["--disable-install-doc"]) + autoconf(["--disable-install-doc", "--enable-shared", "--with-opt-dir=/app/.brew"]) end end
Add some more options to ruby
diff --git a/capistrano-nginx-unicorn.gemspec b/capistrano-nginx-unicorn.gemspec index abc1234..def5678 100644 --- a/capistrano-nginx-unicorn.gemspec +++ b/capistrano-nginx-unicorn.gemspec @@ -6,11 +6,11 @@ Gem::Specification.new do |gem| gem.name = "capistrano-nginx-unicorn" gem.version = Capistrano::NginxUnicorn::VERSION - gem.authors = ["Ivan Tkalin"] - gem.email = ["itkalin@gmail.com"] + gem.authors = ["Ivan Tkalin", "Kalys Osmonov"] + gem.email = ["kalys@osmonov.com"] gem.description = %q{Capistrano tasks for configuration and management nginx+unicorn combo for zero downtime deployments of Rails applications. Configs can be copied to the application using generators and easily customized.} gem.summary = %q{Create and manage nginx+unicorn configs from capistrano} - gem.homepage = "https://github.com/ivalkeen/capistrano-nginx-unicorn" + gem.homepage = "https://github.com/kalys/capistrano-nginx-unicorn" gem.files = `git ls-files`.split($/) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
Update authors, email, website of gem
diff --git a/NBJMergeLayout-ObjC.podspec b/NBJMergeLayout-ObjC.podspec index abc1234..def5678 100644 --- a/NBJMergeLayout-ObjC.podspec +++ b/NBJMergeLayout-ObjC.podspec @@ -12,6 +12,6 @@ s.osx.deployment_target = "10.7" s.source = { :git => "https://github.com/BrentleyJones/NBJMergeLayout-ObjC.git", :tag => "1.0.1" } s.source_files = "NBJMergeLayout/**/*.{h,m}" - s.requires_arc = false + s.requires_arc = true end
Fix requires_arc value in podspec
diff --git a/short_straw/straws.rb b/short_straw/straws.rb index abc1234..def5678 100644 --- a/short_straw/straws.rb +++ b/short_straw/straws.rb @@ -18,6 +18,29 @@ # When only one player remains, the game will end and display the winner. #========================================================================== +# CLASSES + +class Player +end + +class Straw +end + +class Game +end + + +#========================================================================== +# GAME CODE + +PLAYERS = %w(Mitch Byron Andrey Dan Larry Cynthia Luna Amelia Peter Anthony) + +game = Game.new(PLAYERS) + + + +#========================================================================== +# USER INTERFACE puts "Welcome to the Last Straw Game!" puts "In each round, players will draw straws of @@ -26,4 +49,13 @@ eliminated and" puts "a new round will begin, good luck!" -PLAYERS = %w(Mitch Byron Andrey Dan Larry Cynthia Luna Amelia Peter Anthony) +# MAIN GAME LOOP + +while !game.done? do + game.show_round_number + game.play_round + game.show_results + game.finish_round +end + +game.show_winner
Create game, player, and straw classes, add main game loop
diff --git a/db/migrate/20141020094819_create_featured_links.rb b/db/migrate/20141020094819_create_featured_links.rb index abc1234..def5678 100644 --- a/db/migrate/20141020094819_create_featured_links.rb +++ b/db/migrate/20141020094819_create_featured_links.rb @@ -0,0 +1,32 @@+class CreateFeaturedLinks < ActiveRecord::Migration + class FeaturedServicesAndGuidance < ActiveRecord::Base + end + class TopTasks < ActiveRecord::Base + end + + def up + create_table :featured_links do |t| + t.string :url + t.string :title + t.references :linkable + t.string :linkable_type + t.timestamps + end + + orgs_with_featured_services_and_guidance = FeaturedServicesAndGuidance.where("linkable_type='Organisation'").group('linkable_id').map { |link| link.linkable_id } + + TopTasks.all.each do |top_task| + if top_task.linkable_type == 'Organisation' && orgs_with_featured_services_and_guidance.include?(top_task.linkable_id) + next + end + FeaturedLinks.create top_task.attributes + end + FeaturedServicesAndGuidance.all.each do |featured_link| + FeaturedLinks.create featured_link.attributes + end + end + + def down + drop_table :featured_links + end +end
Create new featured link table
diff --git a/spec/unit/queueing_rabbit/configuration_spec.rb b/spec/unit/queueing_rabbit/configuration_spec.rb index abc1234..def5678 100644 --- a/spec/unit/queueing_rabbit/configuration_spec.rb +++ b/spec/unit/queueing_rabbit/configuration_spec.rb @@ -0,0 +1,11 @@+require 'spec_helper' + +describe QueueingRabbit::Configuration do + subject { Class.new { extend QueueingRabbit::Configuration} } + + it { should respond_to(:amqp_uri) } + it { should respond_to(:amqp_exchange_name) } + it { should respond_to(:amqp_exchange_options) } + it { should respond_to(:tcp_timeout) } + it { should respond_to(:heartbeat) } +end
Add a spec for QueueingRabbit::Configuration module.
diff --git a/db/migrate/20180420010616_cleanup_build_stage_migration.rb b/db/migrate/20180420010616_cleanup_build_stage_migration.rb index abc1234..def5678 100644 --- a/db/migrate/20180420010616_cleanup_build_stage_migration.rb +++ b/db/migrate/20180420010616_cleanup_build_stage_migration.rb @@ -2,6 +2,7 @@ include Gitlab::Database::MigrationHelpers DOWNTIME = false + TMP_INDEX = 'tmp_id_stage_partial_null_index'.freeze disable_ddl_transaction! @@ -13,16 +14,48 @@ end def up + disable_statement_timeout + + ## + # We steal from the background migrations queue to catch up with the + # scheduled migrations set. + # Gitlab::BackgroundMigration.steal('MigrateBuildStage') + ## + # We add temporary index, to make iteration over batches more performant. + # Conditional here is to avoid the need of doing that in a separate + # migration file to make this operation idempotent. + # + unless index_exists_by_name?(:ci_builds, TMP_INDEX) + add_concurrent_index(:ci_builds, :id, where: 'stage_id IS NULL', name: TMP_INDEX) + end + + ## + # We check if there are remaining rows that should be migrated (for example + # if Sidekiq / Redis fails / is restarted, what could result in not all + # background migrations being executed correctly. + # + # We migrate remaining rows synchronously in a blocking way, to make sure + # that when this migration is done we are confident that all rows are + # already migrated. + # Build.where('stage_id IS NULL').each_batch(of: 50) do |batch| range = batch.pluck('MIN(id)', 'MAX(id)').first Gitlab::BackgroundMigration::MigrateBuildStage.new.perform(*range) end + + ## + # We remove temporary index, because it is not required during standard + # operations and runtime. + # + remove_concurrent_index_by_name(:ci_builds, TMP_INDEX) end def down - # noop + if index_exists_by_name?(:ci_builds, TMP_INDEX) + remove_concurrent_index_by_name(:ci_builds, TMP_INDEX) + end end end
Add tmp index to ci_builds to optimize stages migration
diff --git a/spec/client_spec.rb b/spec/client_spec.rb index abc1234..def5678 100644 --- a/spec/client_spec.rb +++ b/spec/client_spec.rb @@ -10,14 +10,14 @@ end describe 'query_interval' do - before { MusicBrainz.config.query_interval = 0.5 } + before { MusicBrainz.config.query_interval = 0.2 } after { MusicBrainz.config.query_interval = 0 } it do expect{ request }.to_not raise_error expect{ request }.to raise_error MusicBrainz::RequestIntervalTooShort - sleep 0.5 + sleep 0.2 expect{ request }.to_not raise_error end end @@ -30,7 +30,7 @@ end describe 'retry' do - before { MusicBrainz.config.query_interval = 0.5 } + before { MusicBrainz.config.query_interval = 0.2 } before { MusicBrainz.config.retry = 1 } after { MusicBrainz.config.query_interval = 0 }
Reduce query interval in specs
diff --git a/spec/client_spec.rb b/spec/client_spec.rb index abc1234..def5678 100644 --- a/spec/client_spec.rb +++ b/spec/client_spec.rb @@ -0,0 +1,17 @@+require 'spec_helper' + +describe EventGirl::Client do + it 'creates instances with two arguments' do + expect(described_class.instance_method(:initialize).arity).to eql 2 + end + + it 'sets the api_token' do + subject = described_class.new(nil, 'abcxyz') + expect(subject.api_token).to eql 'abcxyz' + end + + it 'sets the url' do + subject = described_class.new('http://localhost:3000', nil) + expect(subject.url).to eql 'http://localhost:3000' + end +end
Test instance creation and argument assignment
diff --git a/spec/geezeo_spec.rb b/spec/geezeo_spec.rb index abc1234..def5678 100644 --- a/spec/geezeo_spec.rb +++ b/spec/geezeo_spec.rb @@ -0,0 +1,13 @@+require "spec_helper" + +describe Geezeo::Client do + before(:each) do + @client = Geezeo::Client.new(credentials) + end + + it "gets a list of accounts" do + @account = @client.accounts.all.first + + @account.id.should_not be_nil + end +end
Add first test. Let the TDD commence
diff --git a/lib/jcr.rb b/lib/jcr.rb index abc1234..def5678 100644 --- a/lib/jcr.rb +++ b/lib/jcr.rb @@ -39,4 +39,8 @@ hostname + "/crx/server" end end + + def self.dev_login + login(:hostname => "http://localhost:4502", :username => "admin", :password => "admin") + end end
Add convenience method to login to dev JCR
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 @@ -38,6 +38,6 @@ Jekyll::Site.new(config) end -def make_context(registers = {}) - Liquid::Context.new({}, {}, { site: site, page: page }.merge(registers)) +def make_context(registers = {}, environments: {}) + Liquid::Context.new(environments, {}, { site: site, page: page }.merge(registers)) end
Allow passing custom environments when making Liquid contexts for testing. Backwards-compatible with previous implementation.
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 @@ -25,5 +25,6 @@ added_constants = Object.constants - @constants added_constants.each { |name| Object.send(:remove_const, name) } ROM::Relation.instance_variable_set('@descendants', []) + ROM::Mapper.instance_variable_set('@descendants', []) end end
Support :prefix option and build Mapper descendants on Finalize
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,6 +1,11 @@ if ENV['COVERAGE'] == 'yes' require 'coveralls' - Coveralls.wear! + require 'simplecov' + + SimpleCov.formatter = Coveralls::SimpleCov::Formatter + SimpleCov.start do + add_filter %r{^/spec/} + end end require 'rspec'
Exclude /spec/ from coverage reports
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,6 +1,8 @@ require "hearthstone_api" require "rspec" require "vcr" +require "byebug" +require "dotenv" VCR.configure do |c| c.cassette_library_dir = "spec/support/vcr_cassettes" @@ -11,4 +13,5 @@ end RSpec.configure do |config| + Dotenv.load end
Add dotenv to spec 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 @@ -22,4 +22,9 @@ password: "test123", return_response: true } +RSpec.configure do |config| + config.before(:each) do + EmailEvents.adapter = :sendgrid + end +end
Reset test suite default to sendgrid.
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,3 +23,10 @@ Eventify::Database.instance_variable_set(:@sqlite, nil) end end + +# monkey-patch StubSocket for backwards compatibility so that specs would pass +# on newer Rubies +class StubSocket + def close + end +end
Add monkey-patch for StubSocket so that specs would pass
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 @@ -32,6 +32,10 @@ return true if value == :auth && !Support::MongoHQ.auth_node_configured? end + config.before :each do + Moped::Connection::Manager.instance_variable_set(:@pools, {}) + end + unless Support::MongoHQ.replica_set_configured? || Support::MongoHQ.auth_node_configured? $stderr.puts Support::MongoHQ.message end
Reset global connection pool on 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 @@ -6,8 +6,19 @@ $LOAD_PATH.unshift(File.expand_path(File.join(__FILE__, "..", "..", "lib"))) require 'duckweed' +module SpecHelpers + def open_page_in_browser + path = "/tmp/duckweed_sample_#{$$}.html" + File.open(path, 'w') do |f| + f.write(last_response.body) + end + `which open && open #{path}` + end +end + RSpec.configure do |conf| conf.include Rack::Test::Methods + conf.include SpecHelpers conf.before(:all) do Duckweed.redis = MockRedis.new @@ -16,5 +27,4 @@ conf.before(:each) do Duckweed.redis.reset! end - end
Add spec helpers to open page in web browser for debugging Obvious caveat: this will only work if you are running the tests on your local machine, and particularly, it depends on Mac OS X (for the "open" command).
diff --git a/buildr_plus.gemspec b/buildr_plus.gemspec index abc1234..def5678 100644 --- a/buildr_plus.gemspec +++ b/buildr_plus.gemspec @@ -25,5 +25,5 @@ s.rdoc_options = %w(--line-numbers --inline-source --title buildr_plus) s.add_dependency 'reality-core', '>= 1.4.0' - s.add_dependency 'reality-naming', '>= 1.4.0' + s.add_dependency 'reality-naming', '>= 1.5.0' end
Update the version of reality-naming in use
diff --git a/spec/winnow_spec.rb b/spec/winnow_spec.rb index abc1234..def5678 100644 --- a/spec/winnow_spec.rb +++ b/spec/winnow_spec.rb @@ -0,0 +1,16 @@+require 'spec_helper' + +describe Winnow::Fingerprinter do + describe '#fingerprints' do + it 'hashes strings to get keys' do + # if t = k = 1, then each character will become a fingerprint + fprinter = Winnow::Fingerprinter.new(t: 1, k: 1) + fprints = fingerprinter.fingerprints("abcdefg") + + hashes = Set.new(('a'..'g').map(&:hash)) + fprint_hashes = Set.new(fprints.map(&:value)) + + expect(fprint_hashes).to eq hashes + end + end +end
Add a test for simple-case fingerprinting.
diff --git a/spec/markwiki_spec.rb b/spec/markwiki_spec.rb index abc1234..def5678 100644 --- a/spec/markwiki_spec.rb +++ b/spec/markwiki_spec.rb @@ -1,11 +1,34 @@ require 'spec_helper' describe Markwiki do + before :all do + @name = "markwiki" + end + it 'has a version number' do expect(Markwiki::VERSION).not_to be nil end - it 'does something useful' do - expect(true).to eq(true) + describe 'creating a new Markwiki site' do + before :all do + Markwiki::Init.init_site(@name) + end + + after :all do + FileUtils.rm_rf(@name) + end + + it 'creates the top-level directory' do + top = Dir.exists? @name + expect(top).to eq(true) + end + + it 'creates the index page' do + expect(File.exists? "#{@name}/index.html").to eq(true) + end + + it 'creates the Markwiki configuration file' do + expect(File.exists? "#{@name}/.markwiki.cfg").to eq(true) + end end end
Update tests for Coveralls coverage
diff --git a/spec/nif_generator.rb b/spec/nif_generator.rb index abc1234..def5678 100644 --- a/spec/nif_generator.rb +++ b/spec/nif_generator.rb @@ -1,11 +1,27 @@ require 'lib/nif_generator' describe "NifGenerator" do - it "should validade a valid Nif" do + it "should validate a valid nif" do valid_nif = '502874210' nif_generator = NifGenerator.instance - result = NifGenerator.instance.validate(valid_nif) + result = nif_generator.validate(valid_nif) result.should == true end + + it "should not validate an invalid nif" do + invalid_nif = '502874211' + nif_generator = NifGenerator.instance + result = nif_generator.validate(invalid_nif) + + result.should == false + end + + it "should generate a valid nif" do + nif_generator = NifGenerator.instance + nif = nif_generator.generate + result = nif_generator.validate(nif) + + result.should == true + end end
Refactor and add rspec tests
diff --git a/examples/rails/app/controllers/snoop_controller.rb b/examples/rails/app/controllers/snoop_controller.rb index abc1234..def5678 100644 --- a/examples/rails/app/controllers/snoop_controller.rb +++ b/examples/rails/app/controllers/snoop_controller.rb @@ -11,6 +11,7 @@ @snoop[:session_options] = request.session_options @snoop[:session] = request.session.inspect @snoop[:load_path] = $LOAD_PATH + @snoop[:system_properties] = Hash[*Java::JavaLang::System.getProperties.to_a.flatten] if defined?(JRUBY_VERSION) end def hello
Add system properties to snoop
diff --git a/recipes/sevenscale_deploy/web.rb b/recipes/sevenscale_deploy/web.rb index abc1234..def5678 100644 --- a/recipes/sevenscale_deploy/web.rb +++ b/recipes/sevenscale_deploy/web.rb @@ -12,10 +12,11 @@ reason = ENV['REASON'] deadline = ENV['UNTIL'] - template = File.read(File.join(File.dirname(__FILE__), "assets", "maintenance.rhtml")) + maintenance_file = fetch(:maintenance_file, File.join(File.dirname(__FILE__), "assets", "maintenance.rhtml")) + + template = File.read(maintenance_file) result = ERB.new(template).result(binding) put result, "#{current_path}/public/system/maintenance.html", :mode => 0644 end - end
Add the ability to specify where the maintenance file comes from.
diff --git a/helpers/meta_helpers.rb b/helpers/meta_helpers.rb index abc1234..def5678 100644 --- a/helpers/meta_helpers.rb +++ b/helpers/meta_helpers.rb @@ -5,7 +5,7 @@ def canonical_url host = site_host + '/' - path = current_page.path.gsub('index.html', '') + path = current_page.url.gsub('index.html', '') host + path end
Use current_page.url instead of current_page.path for og:url
diff --git a/lib/omniauth/strategies/local.rb b/lib/omniauth/strategies/local.rb index abc1234..def5678 100644 --- a/lib/omniauth/strategies/local.rb +++ b/lib/omniauth/strategies/local.rb @@ -28,14 +28,13 @@ end def user_key + return nil unless request[:identity] return nil unless request[:identity]['account_attributes'] - # request[:identity]['account_attributes']['email'].send(:to_s) request[:identity]['account_attributes'][options[:user_key].to_s].send(:to_s) end def user_secret return nil unless request[:identity] - # request[:identity]['password'] request[:identity][options[:user_secret].to_s].send(:to_s) end
Fix when form empty submit.
diff --git a/apis/comic_vine.rb b/apis/comic_vine.rb index abc1234..def5678 100644 --- a/apis/comic_vine.rb +++ b/apis/comic_vine.rb @@ -13,7 +13,9 @@ "query" => query } - puts params + params = { + :params => params + } return JSON.parse((RestClient.get request_url, params).body)
Fix parameter passing to Comic Vine API url
diff --git a/spec/acceptance/basic_gnocchi_spec.rb b/spec/acceptance/basic_gnocchi_spec.rb index abc1234..def5678 100644 --- a/spec/acceptance/basic_gnocchi_spec.rb +++ b/spec/acceptance/basic_gnocchi_spec.rb @@ -8,6 +8,7 @@ pp = <<-EOS include openstack_integration include openstack_integration::repos + include openstack_integration::apache include openstack_integration::mysql include openstack_integration::keystone class { 'openstack_integration::gnocchi':
Use common class to manage apache service in beaker job Depends-on: https://review.opendev.org/#/c/745246/ Change-Id: I299640aed47071381efb4dfb95f77245223b7dce
diff --git a/lib/flipper/api.rb b/lib/flipper/api.rb index abc1234..def5678 100644 --- a/lib/flipper/api.rb +++ b/lib/flipper/api.rb @@ -17,6 +17,8 @@ builder.use Flipper::Api::JsonParams builder.use Flipper::Api::Middleware builder.run app + klass = self + builder.define_singleton_method(:inspect) { klass.inspect } # pretty rake routes output builder end
Add same hack as UI to make rake routes output mo' pretty
diff --git a/config/initializers/omni_auth.rb b/config/initializers/omni_auth.rb index abc1234..def5678 100644 --- a/config/initializers/omni_auth.rb +++ b/config/initializers/omni_auth.rb @@ -1,4 +1,5 @@ OmniAuth.config.logger = Rails.logger +OmniAuth.config.allowed_request_methods = [:post, :get] Rails.application.config.middleware.use OmniAuth::Builder do provider(
Allow GET request for omniauth gem Logins are failing on Chrome and it seems due to receiving `GET` requests. This is an attempt to get our logins working again.
diff --git a/app/models/user.rb b/app/models/user.rb index abc1234..def5678 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -33,7 +33,8 @@ name: project.name, client_id: project.client_id, work_weeks: project.work_weeks.for_user(self).map do |ww| - { project_id: ww.project_id, + { id: ww.id, + project_id: ww.project_id, actual_hours: ww.actual_hours, estimated_hours: ww.estimated_hours, cweek: ww.cweek,
Fix bug in the UI where work weeks wouldn't update, ID has to be set on initial page load
diff --git a/app/models/user.rb b/app/models/user.rb index abc1234..def5678 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2,7 +2,6 @@ belongs_to :group has_many :made_requests, class_name: 'Request', foreign_key: 'requester_id' has_many :fulfilled_requests, class_name: 'Request', foreign_key: 'responder_id' - has_many :votes, as: :voter has_many :votes, as: :candidate validates :first_name, :last_name, presence: true
Remove has_many to reflect changes to votes table
diff --git a/app/models/user.rb b/app/models/user.rb index abc1234..def5678 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -8,10 +8,9 @@ validates :last_name, presence: true validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i validates :email, presence: true, uniqueness: true - validates :password, length: { in: 6..20 } + validates :password, length: { in: 6..20 }, on: :create validates :zip_code, length: { is: 5 } validates_format_of :zip_code, :with => /\d/ - has_many :projects_created, class_name: "Project", foreign_key: "creator_id" has_many :collaborations, foreign_key: "collaborator_id"
Validate password length only on create
diff --git a/mandrill-delivery-method.gemspec b/mandrill-delivery-method.gemspec index abc1234..def5678 100644 --- a/mandrill-delivery-method.gemspec +++ b/mandrill-delivery-method.gemspec @@ -7,20 +7,19 @@ s.version = MandrillDeliveryMethod::VERSION s.platform = Gem::Platform::RUBY - s.files = `find . -type f`.split("\n") - # s.test_files = `find . -type f -- {test}/*`.split("\n") + s.files = `git ls-files`.split("\n") s.require_path = 'lib' s.authors = ['Mark Oude Veldhuis'] s.email = ['mark.oudeveldhuis@nedap.com'] s.homepage = 'https://github.com/nedap/mandrill-delivery-method' - s.add_dependency "mail" - s.add_dependency "mandrill-api", ">= 1.0.53" + s.add_runtime_dependency "mail", "~> 2.6" + s.add_runtime_dependency "mandrill-api", "~> 1.0", ">= 1.0.53" - s.add_development_dependency "webmock" - s.add_development_dependency "rails" - s.add_development_dependency "guard" - s.add_development_dependency "guard-minitest" - s.add_development_dependency "codeclimate-test-reporter", ">= 0.4.5" + s.add_development_dependency "webmock", "~> 1.20" + s.add_development_dependency "rails", "~> 4.0" + s.add_development_dependency "guard-minitest", "~> 2.4" + s.add_development_dependency "guard", "~> 2.11" + s.add_development_dependency "codeclimate-test-reporter", "~> 0.4", ">= 0.4.5" end
Update gemspec with proper dependency settings
diff --git a/pdf_ravager.gemspec b/pdf_ravager.gemspec index abc1234..def5678 100644 --- a/pdf_ravager.gemspec +++ b/pdf_ravager.gemspec @@ -12,11 +12,11 @@ s.summary = %q{DSL to aid filling out AcroForms PDF and XFA documents} s.description = %q{DSL to aid filling out AcroForms PDF and XFA documents} - s.add_runtime_dependency "json" + s.add_dependency "json" s.add_development_dependency "bundler", ">= 1.0.0" s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ["lib"] -end+end
Change json dependency to use add_dependency
diff --git a/db/migrate/20141229083623_remove_ghost_tables_enabled_from_users.rb b/db/migrate/20141229083623_remove_ghost_tables_enabled_from_users.rb index abc1234..def5678 100644 --- a/db/migrate/20141229083623_remove_ghost_tables_enabled_from_users.rb +++ b/db/migrate/20141229083623_remove_ghost_tables_enabled_from_users.rb @@ -4,8 +4,6 @@ end down do - alter_table :users do - add_column :users, :ghost_tables_enabled, :boolean, default: false - end + add_column :users, :ghost_tables_enabled, :boolean end end
Fix migration typo to be able to rollback if needed
diff --git a/activesupport/lib/active_support/testing/tagged_logging.rb b/activesupport/lib/active_support/testing/tagged_logging.rb index abc1234..def5678 100644 --- a/activesupport/lib/active_support/testing/tagged_logging.rb +++ b/activesupport/lib/active_support/testing/tagged_logging.rb @@ -1,10 +1,6 @@-require 'active_support/concern' - module ActiveSupport module Testing module TaggedLogging - extend ActiveSupport::Concern - attr_writer :tagged_logger def before_setup
Remove AS::Concern extension from Testing::TaggedLogging
diff --git a/spec/agharta/user_stream_spec.rb b/spec/agharta/user_stream_spec.rb index abc1234..def5678 100644 --- a/spec/agharta/user_stream_spec.rb +++ b/spec/agharta/user_stream_spec.rb @@ -17,6 +17,12 @@ end describe '#logger' do + before do + @logger = Logger.new($stdout) + Logger.should_receive(:new).with($stdout).and_return(@logger) + Logger.should_receive(:new).with(@stream.log_path).and_return(@logger) + end + it 'should be a MultiLogger' do @stream.logger.should be_a Agharta::MultiLogger end
Fix MultiLogger spec to use dummy logger.
diff --git a/spec/classes/bmclib_init_spec.rb b/spec/classes/bmclib_init_spec.rb index abc1234..def5678 100644 --- a/spec/classes/bmclib_init_spec.rb +++ b/spec/classes/bmclib_init_spec.rb @@ -0,0 +1,76 @@+#!/usr/bin/env rspec + +require 'spec_helper' + +describe 'bmclib', :type => 'class' do + + context 'on a RedHat osfamily' do + let(:params) {{}} + let :facts do { + :osfamily => 'RedHat', + :operatingsystem => 'RedHat' + } + end + + it { should contain_package('ipmitool').with( + :ensure => 'present' + )} + it { should contain_package('ipmidriver').with( + :ensure => 'present', + :name => 'OpenIPMI' + )} + it { should contain_service('ipmi').with( + :ensure => 'running', + :enable => 'true', + :hasrestart => 'true', + :hasstatus => 'true', + :require => [ 'Package[ipmitool]', 'Package[ipmidriver]' ] + )} + it { should contain_file('/etc/sysconfig/ipmi').with( + :ensure => 'present', + :path => '/etc/sysconfig/ipmi', + :notify => 'Service[ipmi]' + )} +# it 'should contain File[/etc/sysconfig/ipmi] with correct contents' do +# verify_contents(subject, '/etc/sysconfig/ipmi', [ +# '', +# ]) +# end + end + + context 'on a Debian osfamily' do + let(:params) {{}} + let :facts do { + :osfamily => 'Debian', + :operatingsystem => 'Debian' + } + end + + it { should contain_package('ipmitool').with( + :ensure => 'present' + )} + it { should contain_package('ipmidriver').with( + :ensure => 'present', + :name => 'openipmi' + )} + it { should contain_service('ipmi').with( + :ensure => 'running', + :enable => 'true', + :hasrestart => 'true', + :hasstatus => 'true', + :require => [ 'Package[ipmitool]', 'Package[ipmidriver]' ] + )} + it { should contain_file('/etc/default/ipmi').with( + :ensure => 'present', + :path => '/etc/default/ipmi', + :content => 'ENABLED=true', + :notify => 'Service[ipmi]' + )} + it 'should contain File[/etc/default/ipmi] with contents "ENABLED=true"' do + verify_contents(subject, '/etc/default/ipmi', [ + 'ENABLED=true', + ]) + end + end + +end
Add rspec test for Class['bmclib'].
diff --git a/spec/http/request/writer_spec.rb b/spec/http/request/writer_spec.rb index abc1234..def5678 100644 --- a/spec/http/request/writer_spec.rb +++ b/spec/http/request/writer_spec.rb @@ -1,3 +1,5 @@+# coding: utf-8 + require 'spec_helper' describe HTTP::Request::Writer do @@ -30,4 +32,12 @@ expect(io.string).to eq "4\r\nbees\r\n4\r\ncows\r\n0\r\n\r\n" end end + + describe '#add_body_type_headers' do + it 'properly calculates length of unicode string' do + writer = HTTP::Request::Writer.new(nil, 'Привет, мир!', {}, '') + writer.add_body_type_headers + expect(writer.join_headers).to match(/\r\nContent-Length: 21\r\n/) + end + end end
Add spec for unicode request body length header Related to #129
diff --git a/spec/ruby/core/fiber/new_spec.rb b/spec/ruby/core/fiber/new_spec.rb index abc1234..def5678 100644 --- a/spec/ruby/core/fiber/new_spec.rb +++ b/spec/ruby/core/fiber/new_spec.rb @@ -5,6 +5,13 @@ it "creates a fiber from the given block" do fiber = Fiber.new {} fiber.should be_an_instance_of(Fiber) + end + + it "creates a fiber from a subclass" do + class MyFiber < Fiber + end + fiber = MyFiber.new {} + fiber.should be_an_instance_of(MyFiber) end it "raises an ArgumentError if called without a block" do
Add spec for instantiating subclasses of Fiber
diff --git a/lib/grapple/components/will_paginate_pagination.rb b/lib/grapple/components/will_paginate_pagination.rb index abc1234..def5678 100644 --- a/lib/grapple/components/will_paginate_pagination.rb +++ b/lib/grapple/components/will_paginate_pagination.rb @@ -21,7 +21,8 @@ html = h(t(no_results_message)) else paginate_parameters[:param_name] = url_parameter(:page) if builder.namespace - html = template.will_paginate(records, { renderer: renderer }.compact.merge(paginate_parameters)) || '&nbsp;' + options = { renderer: renderer }.select { |_, value| !value.nil? }.merge(paginate_parameters) + html = template.will_paginate(records, options) || '&nbsp;' end builder.row "<td colspan=\"#{num_columns}\">#{html}</td>"
Fix for older versions of rails without the hash compact method
diff --git a/lib/shoulda/matchers/active_model/helpers.rb b/lib/shoulda/matchers/active_model/helpers.rb index abc1234..def5678 100644 --- a/lib/shoulda/matchers/active_model/helpers.rb +++ b/lib/shoulda/matchers/active_model/helpers.rb @@ -20,12 +20,12 @@ def default_error_message(key, options = {}) model_name = options.delete(:model_name) attribute = options.delete(:attribute) - I18n.translate( :"activerecord.errors.models.#{model_name}.attributes.#{attribute}.#{key}", { - :default => [ :"activerecord.errors.models.#{model_name}.#{key}", - :"activerecord.errors.messages.#{key}", - :"errors.attributes.#{attribute}.#{key}", - :"errors.messages.#{key}" - ]}.merge(options)) + default_translation = [ :"activerecord.errors.models.#{model_name}.#{key}", + :"activerecord.errors.messages.#{key}", + :"errors.attributes.#{attribute}.#{key}", + :"errors.messages.#{key}" ] + I18n.translate(:"activerecord.errors.models.#{model_name}.attributes.#{attribute}.#{key}", + { :default => default_translation }.merge(options)) end end end
Make the code easier to read.
diff --git a/chamber.gemspec b/chamber.gemspec index abc1234..def5678 100644 --- a/chamber.gemspec +++ b/chamber.gemspec @@ -26,7 +26,6 @@ spec.add_runtime_dependency "hashie", "~> 2.0" - spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" spec.add_development_dependency "rspec", "~> 2.14" spec.add_development_dependency "simplecov", "~> 0.7"
Remove bundler from the development dependencies. It lives outside of gemspecs
diff --git a/config/schedule.rb b/config/schedule.rb index abc1234..def5678 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -29,5 +29,9 @@ runner 'DigestBuilder.send_daily_email' end -every :minute { command "whoami" } -every :minute { command "which ruby" } +every :minute do + command "whoami" +end +every :minute do + command "which ruby" +end
Add crons to check env
diff --git a/app/mixins/numeric_sanitizers.rb b/app/mixins/numeric_sanitizers.rb index abc1234..def5678 100644 --- a/app/mixins/numeric_sanitizers.rb +++ b/app/mixins/numeric_sanitizers.rb @@ -9,11 +9,11 @@ # Strip extraneous non-numeric characters from an input number and return a float def sanitize_to_float(num) - num.to_s.scan(/\b-?[\d.]+/).join.to_f + num.to_s.gsub('$%\'"','').scan(/\b-?[\d.]+/).join.to_f end # Strip extraneous non-numeric characters from an input number and return a float def sanitize_to_int(num) - num.to_s.scan(/\b-?[\d.]+/).join.to_i + sanitize_to_float(num).to_i end end
Tweak coercions in the input sanitizers
diff --git a/lib/shoes/swt/shoes_layout.rb b/lib/shoes/swt/shoes_layout.rb index abc1234..def5678 100644 --- a/lib/shoes/swt/shoes_layout.rb +++ b/lib/shoes/swt/shoes_layout.rb @@ -30,7 +30,7 @@ def handle_scroll_bar(vertical_bar, height, scrollable_height) vertical_bar.setThumb height * height / scrollable_height vertical_bar.setMaximum scrollable_height - height + vertical_bar.getThumb - vertical_bar.setIncrement height / 2 + vertical_bar.increment = 10 end def set_gui_location
Change constant of vertical bar increment value
diff --git a/lib/tasks/commit_monitor.rake b/lib/tasks/commit_monitor.rake index abc1234..def5678 100644 --- a/lib/tasks/commit_monitor.rake +++ b/lib/tasks/commit_monitor.rake @@ -4,7 +4,7 @@ loop do print "." CommitMonitor.perform_async - sleep(60) + sleep(CommitMonitor.options["poll"]) end end
Move commit monitor polling time into an option.
diff --git a/app/models/pick.rb b/app/models/pick.rb index abc1234..def5678 100644 --- a/app/models/pick.rb +++ b/app/models/pick.rb @@ -7,4 +7,25 @@ group(:enclosure_id).order('count_container_id DESC').count('container_id') } + scope :feed, -> (feed) { + joins(container: :entries).where(entries: { feed_id: feed.id }) + } + scope :keyword, -> (keyword) { + joins(container: { entries: :keywords }) + .where(keywords: { id: keyword.id }) + } + scope :tag, -> (tag) { + joins(container: { entries: :tags }).where(tags: { id: tag.id }) + } + scope :topic, -> (topic) { + joins(container: { entries: { feed: :topics }}) + .where(topics: { id: topic.id }) + } + scope :category, -> (category) { + joins(container: { entries: { feed: { subscriptions: :categories }}}) + .where(categories: { id: category.id }) + } + scope :issue, -> (issue) { + joins(container: { entries: :issues }).where(issues: { id: issue.id }) + } end
Customize Pick stream scopes: Join enclosures table on `container_id`
diff --git a/lib/vagrant-ca-certificates/cap/debian/update_certificate_bundle.rb b/lib/vagrant-ca-certificates/cap/debian/update_certificate_bundle.rb index abc1234..def5678 100644 --- a/lib/vagrant-ca-certificates/cap/debian/update_certificate_bundle.rb +++ b/lib/vagrant-ca-certificates/cap/debian/update_certificate_bundle.rb @@ -5,6 +5,7 @@ # Capability for configuring the certificate bundle on Debian. module UpdateCertificateBundle def self.update_certificate_bundle(m) + m.communicate.sudo("ls /usr/share/ca-certificates/private | awk '{print \"private/\"$1;}' >> /etc/ca-certificates.conf") # enable our custom certs m.communicate.sudo('update-ca-certificates') do |type, data| if [:stderr, :stdout].include?(type) next if data =~ /stdin: is not a tty/
Enable uploaded certificates in ca-certificates.conf for debian
diff --git a/lib/vmdb/loggers/io_logger.rb b/lib/vmdb/loggers/io_logger.rb index abc1234..def5678 100644 --- a/lib/vmdb/loggers/io_logger.rb +++ b/lib/vmdb/loggers/io_logger.rb @@ -0,0 +1,31 @@+module Vmdb::Loggers + class IoLogger < StringIO + def initialize(logger, level = :info, prefix = nil) + @logger = logger + @level = level + @prefix = prefix + super() + end + + def write(string) + @buffer ||= "" + @buffer << string + dump_buffer if string.include?("\n") + end + + def <<(string) + write(string) + end + + private + + def dump_buffer + @buffer.each_line do |l| + next if l.empty? + line = [@prefix, l].join(" ").strip + @logger.send(@level, line) + end + @buffer = nil + end + end +end
Add IoLogger to be used for stdout and stderr logging
diff --git a/chef-repo/site-cookbooks/cbench-databox/recipes/default.rb b/chef-repo/site-cookbooks/cbench-databox/recipes/default.rb index abc1234..def5678 100644 --- a/chef-repo/site-cookbooks/cbench-databox/recipes/default.rb +++ b/chef-repo/site-cookbooks/cbench-databox/recipes/default.rb @@ -20,15 +20,13 @@ # Woraround for error in databox recipe where all databases get installed # regardless of the provided configuration. # See https://github.com/teohm/databox-cookbook/pull/6 -# Set attribute to nil such that the conditional check in the original cookbook works. +# Set attribute to nil did not work. Therefore implement choice here. mysql = node["databox"]["databases"]["mysql"] -if mysql || mysql.none? - node.override["databox"]["databases"]["mysql"] = nil +if mysql && mysql.any? + include_recipe "databox::mysql" end postgresql = node["databox"]["databases"]["postgresql"] -if postgresql || postgresql.none? - node.override["databox"]["databases"]["postgresql"] = nil -end - -include_recipe "databox"+if postgresql && postgresql.any? + include_recipe "databox::postgresql" +end
Add workaround for databox cookbook bug by implementing database choice directly
diff --git a/html_massage.gemspec b/html_massage.gemspec index abc1234..def5678 100644 --- a/html_massage.gemspec +++ b/html_massage.gemspec @@ -17,13 +17,12 @@ gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ["lib"] - gem.add_dependency "nokogiri", ">= 1.4" - gem.add_dependency "sanitize", ">= 2.0" + gem.add_dependency "nokogiri", "~> 1.6" + gem.add_dependency "sanitize", "~> 3.0" gem.add_dependency "thor" - gem.add_dependency "rest-client", ">= 1.6" - - gem.add_development_dependency "rspec", ">= 2.5" + gem.add_dependency "rest-client", "~> 1.7" gem.add_dependency "reverse_markdown", "~> 0.5" + gem.add_development_dependency "rspec", "~> 2.5" end
Update dependencies in gemspec; use ~> syntax
diff --git a/jfit.gemspec b/jfit.gemspec index abc1234..def5678 100644 --- a/jfit.gemspec +++ b/jfit.gemspec @@ -17,7 +17,7 @@ spec.files = `git ls-files -z`.split("\x0") spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) - spec.require_paths = ["lib"] + spec.require_paths = ["lib", "vendor"] spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "minitest"
Add vendor to require paths
diff --git a/lib/capistrano/data_bag/helper.rb b/lib/capistrano/data_bag/helper.rb index abc1234..def5678 100644 --- a/lib/capistrano/data_bag/helper.rb +++ b/lib/capistrano/data_bag/helper.rb @@ -5,9 +5,11 @@ module Helper def create_data_bag_item(bag, item, data = {}) FileUtils.makedirs "#{data_bags_path}/#{bag}" unless Dir.exist? "#{data_bags_path}/#{bag}" - File.open("#{data_bags_path}/#{bag}/#{item}.json", "w") do |f| + data_bag_item_file = "#{data_bags_path}/#{bag}/#{item}.json" + File.open(data_bag_item_file, "w") do |f| f.write JSON.pretty_generate(data.merge!(id: item)) end + puts "Created a new data bag item at: #{data_bag_item_file}" end def load_data_bag(bag)
Print data bag item file name after creation
diff --git a/lib/moltin/resource_collection.rb b/lib/moltin/resource_collection.rb index abc1234..def5678 100644 --- a/lib/moltin/resource_collection.rb +++ b/lib/moltin/resource_collection.rb @@ -8,6 +8,10 @@ end end + def each(&block) + @resources.each { |resource| yield resource } + end + def to_s @resources.map(&:to_s) end
Allow collection resources to be iterated over
diff --git a/ext/baz/extconf.rb b/ext/baz/extconf.rb index abc1234..def5678 100644 --- a/ext/baz/extconf.rb +++ b/ext/baz/extconf.rb @@ -1,4 +1,3 @@ # ext/baz/extconf.rb require 'mkmf' -$CXXFLAGS = '--std=c++0x' create_makefile( 'baz/baz' )
Revert - worked locally, but on Travis it seems . . .
diff --git a/app/lib/deprecated_attributes.rb b/app/lib/deprecated_attributes.rb index abc1234..def5678 100644 --- a/app/lib/deprecated_attributes.rb +++ b/app/lib/deprecated_attributes.rb @@ -0,0 +1,29 @@+require 'active_support/deprecation' + +module DeprecatedAttributes + extend ActiveSupport::Concern + + class_methods do + def deprecate_attribute(*names) + names.each do |name| + define_method(:"#{name}") do + callstack = caller_locations(0).map(&:to_s).reject{ |path| path =~ /deprecated_attributes\.rb/ } + ActiveSupport::Deprecation.warn("#{self.class.name}##{name} is deprecated and will be removed", callstack) + super() + end + + define_method(:"#{name}=") do |value| + callstack = caller_locations(0).map(&:to_s).reject{ |path| path =~ /deprecated_attributes\.rb/ } + ActiveSupport::Deprecation.warn("#{self.class.name}##{name}= is deprecated and will be removed", callstack) + super(value) + end + + define_method(:"#{name}?") do + callstack = caller_locations(0).map(&:to_s).reject{ |path| path =~ /deprecated_attributes\.rb/ } + ActiveSupport::Deprecation.warn("#{self.class.name}##{name}? is deprecated and will be removed", callstack) + super() + end + end + end + end +end
Add module for deprecating model attributes This will cause a deprecation message to be logged when any attribute related method (Model#foo, Model#foo= and Model#foo?) is used.
diff --git a/app/mailers/newsletter_mailer.rb b/app/mailers/newsletter_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/newsletter_mailer.rb +++ b/app/mailers/newsletter_mailer.rb @@ -4,7 +4,7 @@ def newsletter_email(client) clients_titles = ClientsTitles.select("title_id").where(:client_id => client.id) @offers = Offer.actual.where(:id => OffersTitles.select("offer_id").where(:title_id => clients_titles)).all.take(6) - mail(:to => "galika_tati@hotmail.com", :subject => "Newsletter Dealhunter") + mail(:to => client.user.email, :subject => "Newsletter Dealhunter") end end
Change to mail in newsletter
diff --git a/app/models/champs/carte_champ.rb b/app/models/champs/carte_champ.rb index abc1234..def5678 100644 --- a/app/models/champs/carte_champ.rb +++ b/app/models/champs/carte_champ.rb @@ -15,6 +15,14 @@ end end + def cadastres? + type_de_champ&.cadastres && type_de_champ.cadastres != '0' + end + + def quartiers_prioritaires? + type_de_champ&.quartiers_prioritaires && type_de_champ.quartiers_prioritaires != '0' + end + def position if dossier.present? dossier.geo_position
Add type options on carte champ
diff --git a/app/models/worthwhile/generic_work.rb b/app/models/worthwhile/generic_work.rb index abc1234..def5678 100644 --- a/app/models/worthwhile/generic_work.rb +++ b/app/models/worthwhile/generic_work.rb @@ -11,7 +11,7 @@ :publisher, :date_created, :subject, :resource_type, :identifier, :language, datastream: :descMetadata, multiple: true - include CurationConcern::WithGenericFiles - include CurationConcern::HumanReadableType + include ::CurationConcern::WithGenericFiles + include ::CurationConcern::HumanReadableType end end
Use the root namespace for CurationConcern
diff --git a/haxby.rb b/haxby.rb index abc1234..def5678 100644 --- a/haxby.rb +++ b/haxby.rb @@ -2,9 +2,9 @@ class Haxby < Formula homepage 'https://github.com/tabletcorry/haxby' - url "https://github.com/tabletcorry/haxby/tarball/haxby-0.1" + url "https://github.com/tabletcorry/haxby/tarball/haxby-0.2" head "git://github.com/tabletcorry/haxby.git" - sha256 "68671482d9b4b71b62e15e2335849aa4e48433ccf15a78c875daac983565e8ef" + sha256 "91584320d97c4602ea4967ba711942351d592ff3b414d5bdad887a68b0d6ea45" depends_on 'coreutils' # Specifically greadlink
Update formula version to v0.2
diff --git a/spec/helper.rb b/spec/helper.rb index abc1234..def5678 100644 --- a/spec/helper.rb +++ b/spec/helper.rb @@ -6,6 +6,23 @@ YAML::load( File.open(file) )["key"] end +def stub_api_endpoint + 'http://ffapi.fanfeedr.com/basic/api' +end + +def stub_leagues_url + "#{stub_api_endpoint}/leagues?api_key=#{stub_api_key}" +end + +def stub_league_url(league) + "#{stub_api_endpoint}/league/#{league['id']}?api_key=#{stub_api_key}" +end + +def stub_nfl + leagues = JSON.parse(json_fixture('leagues.json')) + leagues.select {|league| league["name"] == "NFL" }.first +end + def json_fixture(file) filename = File.dirname(__FILE__) + "/fixtures/#{file}" File.open(filename).read
Add stub methods for league specs
diff --git a/app/uploaders/avatar_uploader.rb b/app/uploaders/avatar_uploader.rb index abc1234..def5678 100644 --- a/app/uploaders/avatar_uploader.rb +++ b/app/uploaders/avatar_uploader.rb @@ -18,7 +18,7 @@ end def default_url - DEFAULT_AVATAR_URL + DEFAULT_AVATAR_URL + '?' + ENV['RAILS_ASSET_ID'] end def extension_white_list
Improve the caching of the default avatar
diff --git a/app/validators/slug_validator.rb b/app/validators/slug_validator.rb index abc1234..def5678 100644 --- a/app/validators/slug_validator.rb +++ b/app/validators/slug_validator.rb @@ -0,0 +1,6 @@+class SlugValidator < ActiveModel::EachValidator + # implement the method called during validation + def validate_each(record, attribute, value) + record.errors[attribute] << 'must be usable in a URL' unless value.parameterize.to_s == value.to_s + end +end
Add custom validator to check for well-formed slugs
diff --git a/lib/async_client/clients/qless.rb b/lib/async_client/clients/qless.rb index abc1234..def5678 100644 --- a/lib/async_client/clients/qless.rb +++ b/lib/async_client/clients/qless.rb @@ -2,3 +2,20 @@ require "qless" require "async_client/clients/qless/client" require "async_client/clients/qless/client_factory" + + +module AsyncClient + module Clients + module Qless + def self.build_async_client(host, port) + qless_async_client = build_qless_async_client(host, port) + AsyncClient::Client.new(qless_async_client) + end + + def self.build_qless_async_client(host, port) + factory = ClientFactory.new(:host => host, :port => port) + factory.product + end + end + end +end
Add factory methods to AsyncClient::Clients::Qless
diff --git a/config/initializers/dragonfly.rb b/config/initializers/dragonfly.rb index abc1234..def5678 100644 --- a/config/initializers/dragonfly.rb +++ b/config/initializers/dragonfly.rb @@ -8,17 +8,20 @@ url_format "/media/:job/:name" - if Rails.env.production? + case Rails.env + when 'development' + datastore :file, + root_path: Rails.root.join('public/system'), + server_root: Rails.root.join('public') + when 'test' + datastore :memory + else datastore :s3, bucket_name: ENV['S3_BUCKET'], access_key_id: ENV['S3_ACCESS_KEY_ID'], secret_access_key: ENV['S3_SECRET_ACCESS_KEY'], region: 'eu-west-1', fog_storage_options: {path_style: true} - else - datastore :file, - root_path: Rails.root.join('public/system/dragonfly', Rails.env), - server_root: Rails.root.join('public') end end
Set memory storage for file upload tests
diff --git a/lib/fullcontact/client/company.rb b/lib/fullcontact/client/company.rb index abc1234..def5678 100644 --- a/lib/fullcontact/client/company.rb +++ b/lib/fullcontact/client/company.rb @@ -9,7 +9,7 @@ url = "company/search" end response = get(url, options, false, faraday_options) - format.to_s.downcase == 'xml' ? response['person'] : response + format.to_s.downcase == 'xml' ? response['response'] : response end end end
Fix Company API XML accessing nonexistent tag
diff --git a/config/initializers/resque.rb b/config/initializers/resque.rb index abc1234..def5678 100644 --- a/config/initializers/resque.rb +++ b/config/initializers/resque.rb @@ -2,5 +2,5 @@ require 'resque-status' Resque.inline = ENV['APP_ENV'] == 'test' -Resque.redis = ENV['REDIS_HOST'] || 'localhost' +Resque.redis = ENV['REDIS_RESQUE_HOST'] || ENV['REDIS_HOST'] || 'localhost' Resque::Plugins::Status::Hash.expire_in = (30 * 24 * 60 * 60) # In seconds, a too small value remove working or queuing jobs
Add variable to be able to seperate Redis host for Resque.
diff --git a/lib/peribot/processor_registry.rb b/lib/peribot/processor_registry.rb index abc1234..def5678 100644 --- a/lib/peribot/processor_registry.rb +++ b/lib/peribot/processor_registry.rb @@ -18,14 +18,11 @@ @processors[processor] = true end - # Obtain a list of processors that have been previously registered. This - # method is also named "tasks" for backwards compatibility, however that - # form is deprecated. + # Obtain a list of processors that have been previously registered. # # @return An array of processors def list @processors.keys end - alias tasks list end end
Remove deprecated alias from ProcessorRegistry The tasks method was originally defined for the non-service "chains" in pre-0.9 Peribot, and was kept in ProcessorRegistry for backwards compatibility with calls like `bot.preprocessor.tasks`. With 0.9, the list method became the standard way to obtain registered handlers for both services and other processor types, and helps remove any special status that processors previously held.
diff --git a/lib/rack/insight/enable-button.rb b/lib/rack/insight/enable-button.rb index abc1234..def5678 100644 --- a/lib/rack/insight/enable-button.rb +++ b/lib/rack/insight/enable-button.rb @@ -1,45 +1,36 @@ module Rack::Insight - class EnableButton + class EnableButton < Struct.new :app, :insight include Render - MIME_TYPES = ["text/plain", "text/html", "application/xhtml+xml"] + CONTENT_TYPE_REGEX = /text\/(html|plain)|application\/xhtml\+xml/ - def initialize(app, insight) - @app = app - @insight = insight + def call(env) + status, headers, response = app.call(env) + + if okay_to_modify?(env, headers) + body = response.inject("") do |memo, part| + memo << part + memo + end + index = body.rindex("</body>") + if index + body.insert(index, render) + headers["Content-Length"] = body.bytesize.to_s + response = [body] + end + end + + [status, headers, response] end - def call(env) - @env = env - status, headers, body = @app.call(@env) - - if body.present? - response = Rack::Response.new(body, status, headers) - inject_button(response) if okay_to_modify?(env, response) - - response.to_a - else - [status, headers, body] - end + def okay_to_modify?(env, headers) + return false # нам кнопка не нужна + return false unless headers["Content-Type"] =~ CONTENT_TYPE_REGEX + return !(filters.find { |filter| env["REQUEST_PATH"] =~ filter }) end - def okay_to_modify?(env, response) - return false # нам кнопка не нужна - - return false unless response.ok? - req = Rack::Request.new(env) - filters = (env['rack-insight.path_filters'] || []).map { |str| %r(^#{str}) } - filter = filters.find { |filter| env['REQUEST_PATH'] =~ filter } - return MIME_TYPES.include?(req.media_type) && !req.xhr? && !filter - end - - def inject_button(response) - full_body = response.body.join - full_body.sub! /<\/body>/, render + "</body>" - - response["Content-Length"] = full_body.bytesize.to_s - - response.body = [full_body] + def filters + (env["rack-insight.path_filters"] || []).map { |str| %r(^#{str}) } end def render
Complete rewrite of `EnableButton` to ensure compatibility with all other Rack apps Conflicts: lib/rack/insight/enable-button.rb
diff --git a/lib/rubycritic/source_control_systems/source_control_system.rb b/lib/rubycritic/source_control_systems/source_control_system.rb index abc1234..def5678 100644 --- a/lib/rubycritic/source_control_systems/source_control_system.rb +++ b/lib/rubycritic/source_control_systems/source_control_system.rb @@ -24,6 +24,10 @@ systems.join(", ") end + def self.supported? + raise NotImplementedError.new("The #{self.class} class must implement the #{__method__} method.") + end + def has_revision? raise NotImplementedError.new("The #{self.class} class must implement the #{__method__} method.") end
Add missing abstract method to SourceControlSystem
diff --git a/lib/facter/puppet_settings.rb b/lib/facter/puppet_settings.rb index abc1234..def5678 100644 --- a/lib/facter/puppet_settings.rb +++ b/lib/facter/puppet_settings.rb @@ -0,0 +1,80 @@+# 'inspired/stolen' from puppetlabs-stdlib puppet_vardir fact + + +begin + require 'facter/util/puppet_settings' +rescue LoadError => e + # puppet apply does not add module lib directories to the $LOAD_PATH (See + # #4248). It should (in the future) but for the time being we need to be + # defensive which is what this rescue block is doing. + rb_file = File.join(File.dirname(__FILE__), 'util', 'puppet_settings.rb') + load rb_file if File.exists?(rb_file) or raise e +end + +Facter.add(:puppet_confdir) do + setcode do + # This will be nil if Puppet is not available. + Facter::Util::PuppetSettings.with_puppet do + Puppet[:confdir] + end + end +end + +Facter.add(:puppet_ssldir) do + setcode do + # This will be nil if Puppet is not available. + Facter::Util::PuppetSettings.with_puppet do + Puppet[:ssldir] + end + end +end + +Facter.add(:puppet_environmentpath) do + setcode do + # This will be nil if Puppet is not available. + Facter::Util::PuppetSettings.with_puppet do + Puppet[:environmentpath] + end + end +end + +Facter.add(:puppet_hostcert) do + setcode do + # This will be nil if Puppet is not available. + Facter::Util::PuppetSettings.with_puppet do + Puppet[:hostcert] + end + end +end +Facter.add(:puppet_hostprivkey) do + setcode do + # This will be nil if Puppet is not available. + Facter::Util::PuppetSettings.with_puppet do + Puppet[:hostprivkey] + end + end +end +Facter.add(:puppet_localcacert) do + setcode do + # This will be nil if Puppet is not available. + Facter::Util::PuppetSettings.with_puppet do + Puppet[:localcacert] + end + end +end +Facter.add(:puppet_cacert) do + setcode do + # This will be nil if Puppet is not available. + Facter::Util::PuppetSettings.with_puppet do + Puppet[:cacert] + end + end +end +Facter.add(:puppet_cacrl) do + setcode do + # This will be nil if Puppet is not available. + Facter::Util::PuppetSettings.with_puppet do + Puppet[:cacrl] + end + end +end
Add a couple of facts about the puppet installation
diff --git a/lib/gir_ffi/in_out_pointer.rb b/lib/gir_ffi/in_out_pointer.rb index abc1234..def5678 100644 --- a/lib/gir_ffi/in_out_pointer.rb +++ b/lib/gir_ffi/in_out_pointer.rb @@ -13,13 +13,12 @@ end def self.from type, value - return from_gboolean value if type == :gboolean return from_utf8 value if type == :utf8 - ffi_type = GirFFI::Builder::TAG_TYPE_MAP[type] || type + value = adjust_value_in type, value - size = FFI.type_size ffi_type - ptr = AllocationHelper.safe_malloc(size) + ffi_type = type_to_ffi_type type + ptr = AllocationHelper.safe_malloc(FFI.type_size ffi_type) ptr.send "put_#{ffi_type}", 0, value self.new ptr, type @@ -34,8 +33,18 @@ class << self private - def from_gboolean value - self.from :gint32, (value ? 1 : 0) + def type_to_ffi_type type + ffi_type = GirFFI::Builder::TAG_TYPE_MAP[type] || type + ffi_type = :int32 if type == :gboolean + ffi_type + end + + def adjust_value_in type, value + if type == :gboolean + (value ? 1 : 0) + else + value + end end def from_utf8 value
Refactor so InOutPointer knows it holds a :gboolean when it does.
diff --git a/lib/janky/builder/receiver.rb b/lib/janky/builder/receiver.rb index abc1234..def5678 100644 --- a/lib/janky/builder/receiver.rb +++ b/lib/janky/builder/receiver.rb @@ -10,7 +10,7 @@ elsif payload.completed? Build.complete(payload.id, payload.green?) else - return Rack::Response.new("Invalid", 402).finish + return Rack::Response.new("Bad Request", 400).finish end Rack::Response.new("OK", 201).finish
Return a 400 Bad Request for invalid payloads
diff --git a/lib/gdata.rb b/lib/gdata.rb index abc1234..def5678 100644 --- a/lib/gdata.rb +++ b/lib/gdata.rb @@ -19,4 +19,3 @@ require 'gdata/auth' # This is for Unicode "support" require 'jcode' if RUBY_VERSION < '1.9' -$KCODE = 'UTF8'
Fix for newer ruby version.
diff --git a/lib/ideas.rb b/lib/ideas.rb index abc1234..def5678 100644 --- a/lib/ideas.rb +++ b/lib/ideas.rb @@ -1,13 +1 @@-require "ideas/version" - -require "ideas/models/feature" -require "ideas/models/feature_set" -require "ideas/models/idea" - -require "ideas/scopes/root_scope" -require "ideas/scopes/idea_scope" -require "ideas/scopes/feature_scope" - -require "ideas/helpers" -require "ideas/loader" - +Dir[File.expand_path('../**/*.rb', __FILE__)].each{ |f| require f }
Simplify requiring of all files
diff --git a/lib/miq_automation_engine/service_models/miq_ae_service_manageiq-providers-openstack-cloud_manager-vm.rb b/lib/miq_automation_engine/service_models/miq_ae_service_manageiq-providers-openstack-cloud_manager-vm.rb index abc1234..def5678 100644 --- a/lib/miq_automation_engine/service_models/miq_ae_service_manageiq-providers-openstack-cloud_manager-vm.rb +++ b/lib/miq_automation_engine/service_models/miq_ae_service_manageiq-providers-openstack-cloud_manager-vm.rb @@ -9,6 +9,9 @@ expose :supports_resize? expose :validate_resize_confirm expose :validate_resize_revert + + expose :associate_floating_ip, :override_return => nil + expose :disassociate_floating_ip, :override_return => nil def attach_volume(volume_id, device = nil, options = {}) sync_or_async_ems_operation(options[:sync], "attach_volume", [volume_id, device])
Support associating Floating Ips with Instances * Add methods to the Openstack instance model for associating and disassociating floating ips with Openstack cloud instances. * Expose Associate and Disassociate Floating IP to Automate. (transferred from ManageIQ/manageiq@6273cc744c61389bad05a152eb2bcbb46c5f74cc)
diff --git a/lib/layer.rb b/lib/layer.rb index abc1234..def5678 100644 --- a/lib/layer.rb +++ b/lib/layer.rb @@ -32,7 +32,7 @@ end def rasterize(output) - size = "#{@terminal.width}*#{@terminal.height}" + size = "#{@terminal.width}px*#{@terminal.height}px" `phantomjs #{rasterize_path} #{@url} #{output} #{size}` end
Create image to be same size as the terminal
diff --git a/lib/hearthstone_json.rb b/lib/hearthstone_json.rb index abc1234..def5678 100644 --- a/lib/hearthstone_json.rb +++ b/lib/hearthstone_json.rb @@ -1,2 +1,18 @@+require 'httparty' + class HearthstoneJSON + include HTTParty + + API_URL_BASE = 'https://api.hearthstonejson.com'.freeze + API_VER = 'v1'.freeze + + base_uri "#{API_URL_BASE}/#{API_VER}" + + def initialize(locale = 'enUS', data_ver = 'latest') + @full_uri = "#{base_uri}/#{data_ver}/#{locale}" + end + + private + + attr_accessor :locale end
Add very basic setup for httparty
diff --git a/lib/mina/slack/tasks.rb b/lib/mina/slack/tasks.rb index abc1234..def5678 100644 --- a/lib/mina/slack/tasks.rb +++ b/lib/mina/slack/tasks.rb @@ -2,15 +2,15 @@ namespace :slack do task :post_info do if (url = fetch(:slack_url)) && (room = fetch(:slack_room)) - if set?(:user) - Net::SSH.start(fetch(:domain), fetch(:user)) do |ssh| - set(:last_revision, ssh.exec!("cd #{fetch(:deploy_to)}/scm; git log -n 1 --pretty=format:'%H' #{fetch(:branch)} --")) - end + login_data = if (user = fetch(:user)) + [ fetch(:domain), user ] else - login_data = fetch(:domain).split('@') - Net::SSH.start(login_data[1], login_data[0]) do |ssh| - set(:last_revision, ssh.exec!("cd #{fetch(:deploy_to)}/scm; git log -n 1 --pretty=format:'%H' #{fetch(:branch)} --")) - end + # "bob@127.5.1.2".split('@') + fetch(:domain).split('@').reverse + end + + Net::SSH.start(login_data[0], login_data[1]) do |ssh| + set(:last_revision, ssh.exec!("cd #{fetch(:deploy_to)}/scm; git log -n 1 --pretty=format:'%H' #{fetch(:branch)} --")) end set(:last_commit, `git log -n 1 --pretty=format:"%H" origin/#{fetch(:branch)} --`)
Fix domain settings without user
diff --git a/lib/rusic/theme_file.rb b/lib/rusic/theme_file.rb index abc1234..def5678 100644 --- a/lib/rusic/theme_file.rb +++ b/lib/rusic/theme_file.rb @@ -9,17 +9,19 @@ end def uploader - case dirname + case dirname.to_s when 'layouts', 'ideas', 'pages' - Uploaders::Template.new(self) + uploader = Uploaders::Template.new(self) when 'assets' case extname - when 'css', 'js' - Uploaders::EditableAsset.new(self) + when '.css', '.js' + uploader = Uploaders::EditableAsset.new(self) else - Uploaders::Asset.new(self) + uploader = Uploaders::Asset.new(self) end end + + uploader end def dirname @@ -27,7 +29,7 @@ end def filename - pathname.filename + pathname.basename end def extname
Fix extname and base name issues