diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/tweetclock.rb b/tweetclock.rb index abc1234..def5678 100644 --- a/tweetclock.rb +++ b/tweetclock.rb @@ -10,22 +10,79 @@ configure :production do require 'newrelic_rpm' require 'hoptoad_notifier' + + HoptoadNotifier.configure do |config| + config.api_key = ENV['HOPTOAD_API_KEY'] + end + + use HoptoadNotifier::Rack + enable :raise_errors end -HoptoadNotifier.configure do |config| - config.api_key = ENV['HOPTOAD_API_KEY'] -end - -use HoptoadNotifier::Rack -enable :raise_errors set :redis, ENV['REDISTOGO_URL'] get '/' do redis.get(Time.now.to_i - 5) end -get '/:api_version/id_at/:posix' do +get '/:api_version/id_at/:posix_time.:format' do if params[:api_version] == '1' - redis.get params[:posix].to_i + tt = TweetTime.find(params[:posix_time].to_i) + return if tt.nil? + + case params[:format] + when 'json' + tt.to_json + when 'xml' + tt.to_xml + when 'atom' + tt.to_atom + else + tt.time + end + end +end + +class TweetTime + attr_accessor :time, :id + + def initialize(time, id) + @time, @id = time, id + end + + def to_h + {:time => @time, :id => @id} + end + + def to_json + to_h.to_json + end + + def self.find(time) + if (Time.now.to_i - time < SECONDS_TTL) + new time, redis.get(time) + else + near_time = find_nearest(time) + new near_time, redis.get(near_time) + end + end + + private + + def self.find_nearest(time) + time = Time.at(time) + if time.sec < 31 + previous_minute(time).to_i + else + next_minute(time).to_i + end + end + + def self.next_minute(time) + time + (60 - time.sec) + end + + def self.previous_minute(time) + time - time.sec end end
Return times and near-times in JSON format.
diff --git a/silverpop.gemspec b/silverpop.gemspec index abc1234..def5678 100644 --- a/silverpop.gemspec +++ b/silverpop.gemspec @@ -19,7 +19,8 @@ gem.email = 'webmaster@upworthy.com' gem.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)} gem.files = `git ls-files`.split("\n") - gem.homepage = '' + gem.homepage = 'http://www.github.com/upworthy/silverpop' + gem.licenses = ['BSD-3-Clause'] gem.name = 'silverpop' gem.require_paths = ['lib'] gem.summary = gem.description
Add homepage and license info to the gemspec
diff --git a/games/offer_game.rb b/games/offer_game.rb index abc1234..def5678 100644 --- a/games/offer_game.rb +++ b/games/offer_game.rb @@ -0,0 +1,32 @@+#/usr/bin/env ruby +require File.expand_path('../../lib/state.rb', __FILE__) +require File.expand_path('../../lib/client.rb', __FILE__) + +class Game + + game = State.new + nc = Client.new + nc.login + game.initBoard + + game.printBoard + + # make first move if true + if nc.offerGame + puts "First Move is mine" + nc.move(game.negamaxMove) + game.printBoard + end + + while not game.gameOver? do + nc.waitForMove + game.humanMove(nc.getOpponentMove) + game.printBoard + break if game.gameOver? + nc.move(game.negamaxMove) + game.printBoard + end + + nc.exit + +end
Add ability to offer games
diff --git a/sluggi.gemspec b/sluggi.gemspec index abc1234..def5678 100644 --- a/sluggi.gemspec +++ b/sluggi.gemspec @@ -24,7 +24,6 @@ spec.add_development_dependency "bundler", "~> 1.5" spec.add_development_dependency "rake", "~> 10.1" - spec.add_development_dependency "minitest", "~> 4.7" spec.add_development_dependency "sqlite3", "~> 1.3" spec.add_development_dependency "rails", "~> 4.0" end
Remove explicit dependency on minitest
diff --git a/lib/geocoder/lookups/maxmind.rb b/lib/geocoder/lookups/maxmind.rb index abc1234..def5678 100644 --- a/lib/geocoder/lookups/maxmind.rb +++ b/lib/geocoder/lookups/maxmind.rb @@ -7,11 +7,11 @@ private # --------------------------------------------------------------- - def results(query, reverse = false) + def results(query) # don't look up a loopback address, just return the stored result return [reserved_result] if loopback_address?(query) begin - doc = fetch_data(query, reverse) + doc = fetch_data(query) if doc && doc.size == 10 return [doc] else
Update method signatures (changed since pull request).
diff --git a/lib/mspec/opal/special_calls.rb b/lib/mspec/opal/special_calls.rb index abc1234..def5678 100644 --- a/lib/mspec/opal/special_calls.rb +++ b/lib/mspec/opal/special_calls.rb @@ -22,6 +22,12 @@ end end + add_special :not_compliant_on do + unless arglist.flatten.include? :opal + compile_default! + end + end + add_special :platform_is_not do unless arglist.flatten.include? :opal compile_default!
Add not_compliant_on to special calls (specs only)
diff --git a/lib/sequel/plugins/auditable.rb b/lib/sequel/plugins/auditable.rb index abc1234..def5678 100644 --- a/lib/sequel/plugins/auditable.rb +++ b/lib/sequel/plugins/auditable.rb @@ -0,0 +1,15 @@+# Keeps a record of the changes after create/update/destroy +module Sequel + module Plugins + module Auditable + + def self.configure(model, options = {}) + # Associations + model.one_to_many :audits, key: :auditable_id, reciprocal: :auditable, conditions: {auditable_type: model.to_s}, + adder: proc{|asset| asset.update(auditable_id: model.primary_key, auditable_type: model.to_s)}, + remover: proc{|asset| asset.update(auditable_id: nil, auditable_type: nil)}, + clearer: proc{assets_dataset.update(auditable_id: nil, auditable_type: nil)} + end + end + end +end
Add plugin with polymorphic association to audits
diff --git a/lib/clearance/testing.rb b/lib/clearance/testing.rb index abc1234..def5678 100644 --- a/lib/clearance/testing.rb +++ b/lib/clearance/testing.rb @@ -17,6 +17,6 @@ if defined?(RSpec) && RSpec.respond_to?(:configure) RSpec.configure do |config| config.include Clearance::Testing::Matchers - config.include Clearance::Testing::Helpers + config.include Clearance::Testing::Helpers, :type => :controller end end
Include certain helpers only for controller specs Travis CI was failing because of the conflict between the `sign_out` method meant for integration tests and the `sign_out` method used for controller specs. Example failure: https://travis-ci.org/thoughtbot/clearance/jobs/4730477
diff --git a/lib/dry/view/renderer.rb b/lib/dry/view/renderer.rb index abc1234..def5678 100644 --- a/lib/dry/view/renderer.rb +++ b/lib/dry/view/renderer.rb @@ -27,7 +27,7 @@ if path render(path, scope, &block) else - msg = "Template #{template} could not be found in paths:\n#{paths.map { |pa| "- #{pa}" }.join("\n")}" + msg = "Template #{template.inspect} could not be found in paths:\n#{paths.map { |pa| "- #{pa.to_s}" }.join("\n")}" raise TemplateNotFoundError, msg end end
Make message for TemplateNotFoundError more readable
diff --git a/lib/nulldb/extensions.rb b/lib/nulldb/extensions.rb index abc1234..def5678 100644 --- a/lib/nulldb/extensions.rb +++ b/lib/nulldb/extensions.rb @@ -36,7 +36,7 @@ superclass = ActiveRecord::VERSION::MAJOR >= 5 ? Migration.public_send(:[], "#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}".to_f) : Migration class Schema < superclass def self.define(info={}, &block) - instance_eval(&block) + new.define(info, &block) end end end
Fix monkey patch of Schema.define so it passes the info hash which is necessary to initialize schema_migrations table. Why does it matter when using nulldb? In some cases we us the nulldb adapter to get around database checks when the task we are running has no need for a database, like assets:precompile for production. This fix calls define correctly when you require nulldb but not necessarily using that adapter for all database.yml environments.
diff --git a/lib/sisimai/data/json.rb b/lib/sisimai/data/json.rb index abc1234..def5678 100644 --- a/lib/sisimai/data/json.rb +++ b/lib/sisimai/data/json.rb @@ -22,7 +22,7 @@ begin jsonoption.space = ' ' jsonoption.object_nl = ' ' - jsonstring = ::JSON.generate(damneddata ) + jsonstring = ::JSON.generate(damneddata, jsonoption) rescue warn '***warning: Failed to JSON.generate' end
Fix code: set the 2nd option to JSON.generate method
diff --git a/lib/voteable/voteable.rb b/lib/voteable/voteable.rb index abc1234..def5678 100644 --- a/lib/voteable/voteable.rb +++ b/lib/voteable/voteable.rb @@ -1,11 +1,13 @@ module Voteable - def is_voteable(options = {}, &block) - has n, :votes, 'Voteable::Vote', :as => :voteable, :child_key => [ :voteable_id ] + def is_voteable(options = {}) + has n, :votes, 'Voteable::Vote', as: :voteable, child_key: [ :voteable_id ] - #if !options[:every_x_days].nil? - # Vote.instance_eval { @@x_days = 0; def x_days; @@x_days; end; def x_days=(value); @@x_days = (value); end } - # Vote.x_days = options[:every_x_days] - #end + if (!options[:time_between_votes].nil? && options[:time_between_votes].class == Proc) + class << self + attr_accessor :time_between_votes + end + self.time_between_votes = options[:time_between_votes] + end include Voteable::InstanceMethods end
Change interface for setting the time between interface. Now accept a proc.
diff --git a/script.rb b/script.rb index abc1234..def5678 100644 --- a/script.rb +++ b/script.rb @@ -1,32 +1,43 @@ class Name def generate + puts nameString + end + + private + + $charVowels = ["a", "e", "i", "o", "u", "y"] + $charConsonants = ["b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "z"] + + def nameString name = Array.new(rand(2..12)) - charVowels = ["a", "e", "i", "o", "u", "y"] - charConsonants = ["b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "z"] - charFirst = rand(0..1) if charFirst == 0 - name[0] = charVowels[rand(charVowels.length)] + name[0] = randVowels else - name[0] = charConsonants[rand(charConsonants.length)] + name[0] = randConsonants end - (1..name.length-1).each do |index| - if charVowels.include?(name[index-1]) + if $charVowels.include?(name[index-1]) charNext = rand(0..1) - if charNext == 0 && charConsonants.include?(name[index-2]) - name[index] = charVowels[rand(charVowels.length)] + if charNext == 0 && $charConsonants.include?(name[index-2]) + name[index] = randVowels else - name[index] = charConsonants[rand(charConsonants.length)] + name[index] = randConsonants end else - name[index] = name[index] = charVowels[rand(charVowels.length)] + name[index] = randVowels end end - - puts name.join("").capitalize + name.join("").capitalize end + def randVowels + $charVowels[rand($charVowels.length)] + end + + def randConsonants + $charConsonants[rand($charConsonants.length)] + end end newName = Name.new
Move randoms into defs and all defs inside private. TODO: remove $
diff --git a/tooth.gemspec b/tooth.gemspec index abc1234..def5678 100644 --- a/tooth.gemspec +++ b/tooth.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |s| s.name = 'tooth' s.version = '0.0.1' - s.date = '2013-08-12' + s.date = '2013-10-12' s.description = "Simple page objects for Capybara" s.summary = "Simple page objects for Capybara" s.authors = ["Aliaksei Kliuchnikau"]
Set correct date for the first version
diff --git a/spec/pong_spec.rb b/spec/pong_spec.rb index abc1234..def5678 100644 --- a/spec/pong_spec.rb +++ b/spec/pong_spec.rb @@ -1,7 +1,13 @@ require 'pong' +require 'vector' describe Pong do it "is not a bartender" do expect { Pong.mix(:mojito) }.to raise_error end + + it "loads the vector library" do + v = Vector.new(3, 4) + v.length.should eq 5 + end end
Test for vector library inclusion.
diff --git a/github-keys.gemspec b/github-keys.gemspec index abc1234..def5678 100644 --- a/github-keys.gemspec +++ b/github-keys.gemspec @@ -20,4 +20,6 @@ gem.add_development_dependency 'rake' gem.add_development_dependency 'rspec' + + gem.add_dependency 'github_api', '~> 0.8.11' end
Add deps github_api ~> 0.8.11
diff --git a/app/models/friending.rb b/app/models/friending.rb index abc1234..def5678 100644 --- a/app/models/friending.rb +++ b/app/models/friending.rb @@ -1,4 +1,4 @@-class Rating < ActiveRecord::Base +class Friending < ActiveRecord::Base belongs_to :friendee, :polymorphic=>true belongs_to :friendor, :polymorphic=>true validates_uniqueness_of :friendee_id, :scope=> :friendor_id
Change Rating to Friending (this file was copied from rating.rb)
diff --git a/recipes/nginx-compat-https-map-emulation.rb b/recipes/nginx-compat-https-map-emulation.rb index abc1234..def5678 100644 --- a/recipes/nginx-compat-https-map-emulation.rb +++ b/recipes/nginx-compat-https-map-emulation.rb @@ -6,9 +6,13 @@ eos file "#{node['nginx']['dir']}/conf.d/https.conf" do - content https_map - owner 'root' - group node['root_group'] - mode '0644' + if node['nginx']['https_variable_emulation'] + content https_map + owner 'root' + group node['root_group'] + mode '0644' + else + action :delete + end notifies :reload, 'service[nginx]' -end if node['nginx']['https_variable_emulation']+end
Make https variable emulation removable if already added
diff --git a/week-4/math/my_solution.rb b/week-4/math/my_solution.rb index abc1234..def5678 100644 --- a/week-4/math/my_solution.rb +++ b/week-4/math/my_solution.rb @@ -18,4 +18,9 @@ def divide(num_1, num_2) num_1.to_f / num_2.to_f -end+end + +puts add(10, 2) +puts subtract(10, 2) +puts multiply(10, 2) +puts divide(10, 2)
Update my solution with output
diff --git a/test/jobs/clean_abandoned_site_channels_job_test.rb b/test/jobs/clean_abandoned_site_channels_job_test.rb index abc1234..def5678 100644 --- a/test/jobs/clean_abandoned_site_channels_job_test.rb +++ b/test/jobs/clean_abandoned_site_channels_job_test.rb @@ -1,13 +1,13 @@ require 'test_helper' class CleanAbandonedSiteChannelsJobTest < ActiveJob::TestCase - test "cleans abandoned site channels older than one day" do + test "cleans non-visible (abandoned) site channels older than one day" do publisher = publishers(:medium_media_group) assert SiteChannelDetails.find_by(brave_publisher_id: "medium_2.org") - assert_difference("Channel.count", -1) do - assert_difference("publisher.channels.count", -1) do + assert_difference("Channel.count", -1 * Channel.not_visible_site_channels.count) do + assert_difference("publisher.channels.count", -1 ) do CleanAbandonedSiteChannelsJob.perform_now end end @@ -15,13 +15,13 @@ refute SiteChannelDetails.find_by(brave_publisher_id: "medium_2.org") end - test "cleans abandoned site channel details older than one day" do + test "cleans non-visible (abandoned) site channel details older than one day" do assert SiteChannelDetails.find_by(brave_publisher_id: "medium_2.org") - assert_difference("SiteChannelDetails.count", -1) do + assert_difference("SiteChannelDetails.count", -1 * Channel.not_visible_site_channels.count) do CleanAbandonedSiteChannelsJob.perform_now end refute SiteChannelDetails.find_by(brave_publisher_id: "medium_2.org") end -end+end
Change requirements for abandoned channels
diff --git a/lib/ppcurses/form/radio_button_group.rb b/lib/ppcurses/form/radio_button_group.rb index abc1234..def5678 100644 --- a/lib/ppcurses/form/radio_button_group.rb +++ b/lib/ppcurses/form/radio_button_group.rb @@ -27,9 +27,9 @@ screen.attroff(Curses::A_REVERSE) if @selected @options.each_with_index do |option, index| if index == @current_option - screen.addstr(" #{option} #{RADIO_SELECTED}") + screen.addstr(" #{option} #{RADIO_SELECTED} ") else - screen.addstr(" #{option} #{RADIO_NOT_SELECTED}") + screen.addstr(" #{option} #{RADIO_NOT_SELECTED} ") end end end
Add extra space to distinguish options better
diff --git a/lib/rspec/parameterized/table_syntax.rb b/lib/rspec/parameterized/table_syntax.rb index abc1234..def5678 100644 --- a/lib/rspec/parameterized/table_syntax.rb +++ b/lib/rspec/parameterized/table_syntax.rb @@ -27,12 +27,18 @@ include TableSyntaxImplement end - refine Fixnum do - include TableSyntaxImplement - end + if Gem::Version.create(RUBY_VERSION) >= Gem::Version.create("2.4.0") + refine Integer do + include TableSyntaxImplement + end + else + refine Fixnum do + include TableSyntaxImplement + end - refine Bignum do - include TableSyntaxImplement + refine Bignum do + include TableSyntaxImplement + end end refine Array do
Fix deprecation warning on ruby 2.4.0 lib/rspec/parameterized/table_syntax.rb:30: warning: constant ::Fixnum is deprecated lib/rspec/parameterized/table_syntax.rb:34: warning: constant ::Bignum is deprecated
diff --git a/TreasureData-iOS-SDK.podspec b/TreasureData-iOS-SDK.podspec index abc1234..def5678 100644 --- a/TreasureData-iOS-SDK.podspec +++ b/TreasureData-iOS-SDK.podspec @@ -9,6 +9,7 @@ s.source = { :git => "https://github.com/treasure-data/td-ios-sdk.git", :tag => "0.0.6" } s.source_files = "TreasureData" s.library = 'z' + s.frameworks = ['Security'] s.public_header_files = "TreasureData/TreasureData.h" s.resources = 'Resources.bundle' s.requires_arc = true
Add 'Security' framework into the spec file
diff --git a/attributes/passenger.rb b/attributes/passenger.rb index abc1234..def5678 100644 --- a/attributes/passenger.rb +++ b/attributes/passenger.rb @@ -3,5 +3,8 @@ # node.default["nginx"]["passenger"]["version"] = "3.0.12" node.default["nginx"]["passenger"]["root"] = "/usr/lib/ruby/gems/1.8/gems/passenger-3.0.12" -node.default["nginx"]["passenger"]["ruby"] = %x{which ruby}.chomp node.default["nginx"]["passenger"]["max_pool_size"] = 10 + +# the default value of this attribute is set in the recipe. if set here using "which +# ruby" it results in failed chef runs on Windows just by being a dependency +node.default["nginx"]["passenger"]["ruby"] = ""
Remove default attribute that caused windows chef runs to fail The same default value was already set in the recipe. Removing it here should result in the same outcome without failing chef runs on windows.
diff --git a/spec/walk/entity_spec.rb b/spec/walk/entity_spec.rb index abc1234..def5678 100644 --- a/spec/walk/entity_spec.rb +++ b/spec/walk/entity_spec.rb @@ -41,6 +41,15 @@ test_class.to_summary.should == {:test_data => [{:name => "collection 1"}, {:name => "collection 2"}], :description => "test class desc"} end + + it 'should summaries a class as a hash and remove @ from the symbol names' do + collection = [double(:name => 'collection 1'), double(:name => 'collection 2')] + test_class = Vcloud::Walker::Resource::TestClass.new(double(:description => 'test class desc', :collection => collection)) + test_class.instance_variables.should eq([:@test_data, :@description]) + test_summary = test_class.to_summary + test_summary.keys.should eq([:test_data, :description]) + end + end end
Add test for part of to_summary functionality Small test but I think it's worth a test for the functionality that translates to a string, removes the @ and then symbolizes again.
diff --git a/spec/rackups/status.ru b/spec/rackups/status.ru index abc1234..def5678 100644 --- a/spec/rackups/status.ru +++ b/spec/rackups/status.ru @@ -1,15 +1,15 @@ require 'sinatra' class App < Sinatra::Base - get('/success') do + get('/v1/success') do status 200 end - post('/404') do + get('/v1/not_found') do status 404 end - post('/503') do + post('/v1/service_unavailable') do status 503 end end
Add v1 prefixes for convenience.
diff --git a/spec/support/devise.rb b/spec/support/devise.rb index abc1234..def5678 100644 --- a/spec/support/devise.rb +++ b/spec/support/devise.rb @@ -1,4 +1,4 @@ RSpec.configure do |config| # Add Devise's helpers for controller tests - config.include Devise::TestHelpers, type: :controller + config.include Devise::Test::ControllerHelpers, type: :controller end
Fix a Devise deprecation warning in the tests
diff --git a/spec/factories.rb b/spec/factories.rb index abc1234..def5678 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -13,4 +13,12 @@ map name 'Attacking: Payload 1' end + + factory :user do + email 'jimbob@example.com' + password '123abcCatDog!' + provider 'bnet' + uid '123456' + battletag 'jimbob#1234' + end end
Add User factory for testing
diff --git a/spec/factories.rb b/spec/factories.rb index abc1234..def5678 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -12,6 +12,7 @@ email { Forgery(:email).address } password { generate(:secure_password) } password_confirmation { |u| u.password } + full_name { Forgery(:name).full_name } trait :admin do role 'admin'
Add full_name to user factory
diff --git a/app/models/concerns/media_screenshot_archiver.rb b/app/models/concerns/media_screenshot_archiver.rb index abc1234..def5678 100644 --- a/app/models/concerns/media_screenshot_archiver.rb +++ b/app/models/concerns/media_screenshot_archiver.rb @@ -1,27 +1,27 @@ module MediaScreenshotArchiver extend ActiveSupport::Concern -# def screenshot_script=(script) -# @screenshot_script = script -# end -# -# def screenshot_script -# @screenshot_script -# end -# -# def screenshot_path -# base_url = CONFIG['public_url'] || self.request.base_url -# URI.join(base_url, 'screenshots/', Media.image_filename(self.url)).to_s -# end -# -# def archive_to_screenshot -# url = self.url -# picture = self.screenshot_path -# path = File.join(Rails.root, 'public', 'screenshots', Media.image_filename(url)) -# FileUtils.ln_sf File.join(Rails.root, 'public', 'pending_picture.png'), path -# self.data['screenshot'] = picture -# self.data['screenshot_taken'] = 0 -# key_id = self.key ? self.key.id : nil -# ScreenshotWorker.perform_async(url, picture, key_id, self.screenshot_script) -# end + def screenshot_script=(script) + @screenshot_script = script + end + + def screenshot_script + @screenshot_script + end + + def screenshot_path + base_url = CONFIG['public_url'] || self.request.base_url + URI.join(base_url, 'screenshots/', Media.image_filename(self.url)).to_s + end + + def archive_to_screenshot + url = self.url + picture = self.screenshot_path + path = File.join(Rails.root, 'public', 'screenshots', Media.image_filename(url)) + FileUtils.ln_sf File.join(Rails.root, 'public', 'pending_picture.png'), path + self.data['screenshot'] = picture + self.data['screenshot_taken'] = 0 + key_id = self.key ? self.key.id : nil + ScreenshotWorker.perform_async(url, picture, key_id, self.screenshot_script) + end end
Revert "Comment file related to screenshot archiver, that is not being used" This reverts commit 4e88297dac731d39a4cd6e8907caf3563cbc6f86.
diff --git a/lib/elocal_api_support/actions/index.rb b/lib/elocal_api_support/actions/index.rb index abc1234..def5678 100644 --- a/lib/elocal_api_support/actions/index.rb +++ b/lib/elocal_api_support/actions/index.rb @@ -4,9 +4,9 @@ def index render json: { current_page: current_page, - per_page: per_page, + per_page: filtered_objects.respond_to?(:per_page) ? filtered_objects.per_page : per_page, total_entries: filtered_objects.total_count, - total_pages: (params[:page].present? || params[:per_page].present?) ? filtered_objects.total_pages : 1, + total_pages: filtered_objects.respond_to?(:total_pages) ? filtered_objects.total_pages : 1, records: filtered_objects_for_json } end
Update per_page/total_pages to pull from filtered object
diff --git a/jekyll_asset_pipeline.gemspec b/jekyll_asset_pipeline.gemspec index abc1234..def5678 100644 --- a/jekyll_asset_pipeline.gemspec +++ b/jekyll_asset_pipeline.gemspec @@ -1,4 +1,4 @@-require File.expand_path('../lib/jekyll_asset_pipeline/version', __FILE__) +require File.expand_path('../lib/jekyll_asset_pipeline/version', __dir__) Gem::Specification.new do |s| # Metadata
Replace __FILE__ with __dir__ to fix Rubocop offense
diff --git a/depot/test/unit/product_test.rb b/depot/test/unit/product_test.rb index abc1234..def5678 100644 --- a/depot/test/unit/product_test.rb +++ b/depot/test/unit/product_test.rb @@ -1,7 +1,32 @@ require 'test_helper' class ProductTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end + test "product attributes must not be empty" do + product = Product.new + assert product.invalid? + assert product.errors[:title].any? + assert product.errors[:description].any? + assert product.errors[:image_url].any? + assert product.errors[:price].any? + end + + test "product price must be positive" do + product = Product.new(:title => "Cookbook", + :description => "Hello World", + :image_url => "hello.jpg") + + product.price = -1 + + assert product.invalid? + assert_equal "must be greater than or equal to 0.01", + product.errors[:price].join('; ') + + product.price = 0 + assert product.invalid? + assert_equal "must be greater than or equal to 0.01", + product.errors[:price].join('; ') + + product.price = 1 + assert product.valid? + end end
Add unit Test for product
diff --git a/db/migrate/20090225184215_add_token_to_invite.rb b/db/migrate/20090225184215_add_token_to_invite.rb index abc1234..def5678 100644 --- a/db/migrate/20090225184215_add_token_to_invite.rb +++ b/db/migrate/20090225184215_add_token_to_invite.rb @@ -0,0 +1,9 @@+class AddTokenToInvite < ActiveRecord::Migration + def self.up + add_column :invites, :token, :string + end + + def self.down + remove_column :invites, :token + end +end
Add token column to invites table
diff --git a/YumiBytedanceAdsSDK/2.4.6.7/YumiBytedanceAds.podspec b/YumiBytedanceAdsSDK/2.4.6.7/YumiBytedanceAds.podspec index abc1234..def5678 100644 --- a/YumiBytedanceAdsSDK/2.4.6.7/YumiBytedanceAds.podspec +++ b/YumiBytedanceAdsSDK/2.4.6.7/YumiBytedanceAds.podspec @@ -0,0 +1,19 @@+Pod::Spec.new do |s| + name = "BytedanceAds" + version = "2.4.6.7" + + s.name = "Yumi#{name}" + s.version = version + s.summary = "Yumi#{name}." + s.description = "Yumi#{name} is the #{name} SDK cocoapods created by Yumimobi" + s.homepage = "http://www.yumimobi.com/" + s.license = "MIT" + s.author = { "Yumimobi sdk team" => "ad-client@zplay.cn" } + s.ios.deployment_target = "8.0" + s.source = { :http => "https://adsdk.yumimobi.com/iOS/ThirdPartySDK/#{name}/#{name}-#{version}.tar.bz2" } + s.libraries = 'c++', 'resolv', 'z' + s.xcconfig = { 'OTHER_LDFLAGS' => '-ObjC' } + s.vendored_frameworks = 'BUAdSDK.framework' + s.resource = 'BUAdSDK.bundle' + s.frameworks = 'UIKit','MapKit','WebKit','MediaPlayer','CoreLocation','AdSupport','CoreMedia','AVFoundation','CoreTelephony','StoreKit','SystemConfiguration','MobileCoreServices','CoreMotion' +end
Add BytedanceAds SDK v2.4.6.7 but have CoreLocation
diff --git a/wareki.gemspec b/wareki.gemspec index abc1234..def5678 100644 --- a/wareki.gemspec +++ b/wareki.gemspec @@ -18,8 +18,8 @@ #spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] + spec.required_ruby_version = "2.0.0" spec.add_development_dependency "bundler", "~> 1.9" spec.add_development_dependency "rake", "~> 10.0" spec.add_development_dependency "rspec" end -
Add ruby version dependency. (for bsearch)
diff --git a/Casks/firefox-nightly-ja.rb b/Casks/firefox-nightly-ja.rb index abc1234..def5678 100644 --- a/Casks/firefox-nightly-ja.rb +++ b/Casks/firefox-nightly-ja.rb @@ -5,6 +5,7 @@ url "https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-mozilla-central-l10n/firefox-#{version}.ja-JP-mac.mac.dmg" homepage 'https://nightly.mozilla.org/' license :mpl + tags :vendor => 'Mozilla' app 'FirefoxNightly.app' end
Add tag stanza to Firefox Nightly JA
diff --git a/lib/tasks/gobierto_people/delete_activities.rake b/lib/tasks/gobierto_people/delete_activities.rake index abc1234..def5678 100644 --- a/lib/tasks/gobierto_people/delete_activities.rake +++ b/lib/tasks/gobierto_people/delete_activities.rake @@ -0,0 +1,13 @@+# frozen_string_literal: true + +namespace :gobierto_people do + desc "Delete people activities on a site" + task :delete_activities, [:site_domain] => [:environment] do |_t, args| + site = Site.find_by!(domain: args[:site_domain]) + + activities = site.activities.where(recipient_type: 'GobiertoPeople::Person') + activities_count = activities.count + site.activities.where(recipient_type: 'GobiertoPeople::Person').destroy_all + puts "== Deleted #{activities_count - activities.count} people activities on site #{site.domain}" + end +end
Add task to delete people activities on a site
diff --git a/lib/webmock/http_lib_adapters/http_rb/request.rb b/lib/webmock/http_lib_adapters/http_rb/request.rb index abc1234..def5678 100644 --- a/lib/webmock/http_lib_adapters/http_rb/request.rb +++ b/lib/webmock/http_lib_adapters/http_rb/request.rb @@ -1,9 +1,15 @@ module HTTP class Request def webmock_signature + request_body = if defined?(HTTP::Request::Body) + ''.tap { |string| body.each { |part| string << part } } + else + body + end + ::WebMock::RequestSignature.new(verb, uri.to_s, { headers: headers.to_h, - body: body + body: request_body }) end end
Make it compatible with the newest http.rb version (3.0.0) http.rb 3.0.0 have introduced HTTP::Request::Body abstraction ( https://github.com/httprb/http/pull/412) - let's make webmock compatible with it.
diff --git a/lib/hitch/ui.rb b/lib/hitch/ui.rb index abc1234..def5678 100644 --- a/lib/hitch/ui.rb +++ b/lib/hitch/ui.rb @@ -13,7 +13,7 @@ def self.prompt_for_pair(new_author) highline.say("I don't know who #{new_author} is.") if highline.agree("Do you want to add #{new_author} to ~/.hitch_pairs?") - author_name = highline.ask("What is #{new_author}'s full name?") + author_name = highline.ask("What is #{new_author}'s full name?").to_s Hitch::Author.add(new_author, author_name) Hitch::Author.write_file return new_author
Use explicit String for author's name This prevents a strange YAML dump in .hitch_authors, i.e. !ruby HighLine::String closes #15
diff --git a/solidus_product_feed.gemspec b/solidus_product_feed.gemspec index abc1234..def5678 100644 --- a/solidus_product_feed.gemspec +++ b/solidus_product_feed.gemspec @@ -23,7 +23,7 @@ s.add_runtime_dependency 'solidus_backend', [">= 1.0", "< 3"] s.add_development_dependency 'rspec-rails', '~> 3.4' - s.add_development_dependency 'rubocop', '~> 0.39.0' + s.add_development_dependency 'rubocop', '~> 0.49.0' s.add_development_dependency 'factory_bot_rails' s.add_development_dependency 'pry' s.add_development_dependency 'ffaker'
Update rubocop to fix vulnerability CVE-2017-8418 RuboCop 0.48.1 and earlier does not use /tmp in safe way, allowing local users to exploit this to tamper with cache files belonging to other users.
diff --git a/test/helper.rb b/test/helper.rb index abc1234..def5678 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -20,7 +20,7 @@ before(:all) do Integrity.configure { |c| - c.database "sqlite3::memory:" + c.database "sqlite3:test.db" c.directory File.expand_path(File.dirname(__FILE__) + "/../tmp") c.base_url "http://www.example.com" c.log "/dev/null"
Use a on-disk database for testing
diff --git a/lib/pkgr/env.rb b/lib/pkgr/env.rb index abc1234..def5678 100644 --- a/lib/pkgr/env.rb +++ b/lib/pkgr/env.rb @@ -10,6 +10,7 @@ def initialize(variables = nil) @variables = variables || [] + @variables.compact! end def to_s @@ -34,7 +35,7 @@ variables.inject({}) do |h, var| name, value = var.split('=', 2) - h[name.strip] = EnvValue.new(value).strip.unquote + h[name.strip] = EnvValue.new(value || "").strip.unquote h end end
Fix null values in EnvValue
diff --git a/haproxy_log_parser.gemspec b/haproxy_log_parser.gemspec index abc1234..def5678 100644 --- a/haproxy_log_parser.gemspec +++ b/haproxy_log_parser.gemspec @@ -12,6 +12,7 @@ s.add_development_dependency 'rspec', '~> 3.5.0' s.files = Dir.glob('lib/**/*') + [ + 'LICENSE', 'README.md', 'VERSION', 'haproxy_log_parser.gemspec'
Add LICENSE to gemspec files
diff --git a/lib/cocoapods_stats/sender.rb b/lib/cocoapods_stats/sender.rb index abc1234..def5678 100644 --- a/lib/cocoapods_stats/sender.rb +++ b/lib/cocoapods_stats/sender.rb @@ -2,7 +2,7 @@ module CocoaPodsStats class Sender - API_URL = 'http://stats-cocoapods-org.herokuapp.com/api/v1/install' + API_URL = 'https://stats.cocoapods.org/api/v1/install' def send(targets, pod_try: false) REST.post(
[Sender] Use the proper CocoaPods subdomain
diff --git a/lib/rodzilla.rb b/lib/rodzilla.rb index abc1234..def5678 100644 --- a/lib/rodzilla.rb +++ b/lib/rodzilla.rb @@ -31,6 +31,10 @@ bugzilla_resource('Bugzilla') end + def classifications + bugzilla_resource('Classification') + end + end end
Add classifications accessible from WebService
diff --git a/lib/combustion/application.rb b/lib/combustion/application.rb index abc1234..def5678 100644 --- a/lib/combustion/application.rb +++ b/lib/combustion/application.rb @@ -4,7 +4,7 @@ class Application < Rails::Application # Core Settings config.cache_classes = true - config.whiny_nils = true + config.whiny_nils = true if Rails.version < '4.0.0' config.consider_all_requests_local = true config.secret_token = Digest::SHA1.hexdigest Time.now.to_s
Disable setting whiny_nils when using Rails 4.0.0 and later.
diff --git a/blankplate-rails.gemspec b/blankplate-rails.gemspec index abc1234..def5678 100644 --- a/blankplate-rails.gemspec +++ b/blankplate-rails.gemspec @@ -16,6 +16,6 @@ s.files = Dir["{lib,vendor}/**/*"] + ["LICENSE", "Rakefile", "README.md"] s.test_files = Dir["test/**/*"] - s.add_dependency "rails", "~> 3.2.0" + s.add_dependency "rails", "~> 4.1.0" s.add_development_dependency "bundler" end
Set dependency to rails ~> 4.1
diff --git a/config.ru b/config.ru index abc1234..def5678 100644 --- a/config.ru +++ b/config.ru @@ -1,4 +1,6 @@ require 'rubygems' +require 'bundler' +Bundler.setup ENV['RACK_ENV'] ||= 'development'
Make sure we're operating inside the bundle
diff --git a/examples/bar_chart_sparkline.rb b/examples/bar_chart_sparkline.rb index abc1234..def5678 100644 --- a/examples/bar_chart_sparkline.rb +++ b/examples/bar_chart_sparkline.rb @@ -7,13 +7,17 @@ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'smart_chart' -width = 40 +width = 240 height = 20 chart = SmartChart::Bar.new( - :width => width, - :height => height, - :data => [4,60,80,50,10] + :width => width, + :height => height, + :y_min => 0, + :y_max => 100, + :bar_width => 3, + :bar_space => 1, + :data => [38,60,68,78,52,50,19,23,33,49,38,39,12,18] ) puts "<div style=\"width:#{width-2}px; height:#{height-1}px; overflow:hidden;\">"
Add spacing and y-min/max to bar chart sparkline example.
diff --git a/app/controllers/api/v1/users_controller.rb b/app/controllers/api/v1/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/v1/users_controller.rb +++ b/app/controllers/api/v1/users_controller.rb @@ -3,6 +3,20 @@ def create @user = User.new(user_params) if @user.save + playlist = @user.playlists.create( + title: "Welcome to YTTD!", + playlist_id: "PL-aXckYlcnjE5fHYkuEG5NJmf-Aa-4-zw", + thumbnail_url: "https://i.ytimg.com/vi/uLrFQQ2ysfQ/maxresdefault.jpg", + description: "Thanks for trying out YouTube Tutorial Dashboard! Click \"Watch\" on ths card to get started.", + channel_title: "Benjamin Cantlupe" + ) + playlist.videos.create( + title: "How to add a YouTube playlist to YTTD", + video_id: "uLrFQQ2ysfQ", + description: "Thanks for trying out YouTube Tutorial Dashboard! Getting started with YTTD:\n\n1. Find your favorite tutorial channel\n2. Click the playlists tab\n3. Select a playlist\n4. Copy the playlist URL (the end of the URL should include \"list=a-bunch-of-numbers-and-letters\"\n5. Log into YTTD\n6. Paste your URL into the dashboard form and watch the magic happen!\n\nThis project was created for the Flatiron School's Full-Stack web development program. \n\nMore info:\nYTTD web app - https://yttd.herokuapp.com/\nYTTD Source Code - https://github.com/BeejLuig/react-yt-tutorial-dashboard\nYTTD walkthrough - https://goo.gl/bKaFZu", + thumbnail_url: "https://i.ytimg.com/vi/uLrFQQ2ysfQ/maxresdefault.jpg" + + ) render 'users/user_with_token.json.jbuilder', user: @user else render json: {
Add default playlist to new user account
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 @@ -4,6 +4,8 @@ require 'rspec/rails' require "json" +require 'cacheable_flash' +require 'cacheable_flash/rspec_matchers' ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../') @@ -11,17 +13,16 @@ # in spec/support/ and its subdirectories. Dir[File.join(ENGINE_RAILS_ROOT, "spec/support/**/*.rb")].each {|f| require f } -require 'cacheable_flash' -# Instead of loading the installed gem, we load the source code directly, would this work? -#$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) -#$LOAD_PATH.unshift(File.dirname(__FILE__)) +RSpec.configure do |config| + config.treat_symbols_as_metadata_keys_with_true_values = true + config.run_all_when_everything_filtered = true + config.filter_run :focus -require 'cacheable_flash/rspec_matchers' + # 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 + config.order = 'random' -# Requires supporting files with custom matchers and macros, etc, -# in ./support/ and its subdirectories. -#Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f} - -RSpec.configure do |config| config.include CacheableFlash::RspecMatchers end
Update spec helper with rspec defaults
diff --git a/lib/utep_sso.rb b/lib/utep_sso.rb index abc1234..def5678 100644 --- a/lib/utep_sso.rb +++ b/lib/utep_sso.rb @@ -6,20 +6,20 @@ #{:get_user_by_ssiu_result=>{:user_name=>"awernick", :full_name=>"Alan Wernick, :email_address=>"awernick@miners.utep.edu", :authenticated=>true, :role_value=>"1080", :external_user=>false}, :@xmlns=>"http://tempuri.org/"} def self.authenticate(utep_cookie, utep_salt) - if authenticated?(utep_cookie, utep_salt) - @response.body[:get_user_by_ssiu_response][:get_user_by_ssiu_result] - end - end + if authenticated?(utep_cookie, utep_salt) + @response.body[:get_user_by_ssiu_response][:get_user_by_ssiu_result] + end + end + + def self.authenticated?(utep_cookie, utep_salt) + if utep_cookie && utep_salt + @response = @client.call(:get_user_by_ssiu, message: { sessionId: utep_cookie.to_s, salt: utep_salt.to_s }) + @response.body[:get_user_by_ssiu_response][:get_user_by_ssiu_result][:authenticated] + end + end - def self.authenticated?(utep_cookie, utep_salt) - if utep_cookie && utep_salt - @response = @client.call(:get_user_by_ssiu, message: { sessionId: utep_cookie.to_s, salt: utep_salt.to_s }) - @response.body[:get_user_by_ssiu_response][:get_user_by_ssiu_result][:authenticated] - end - end - - def self.deauthenticate(utep_cookie, utep_salt) - if authenticated?(utep_cookie,utep_salt) + def self.deauthenticate(utep_cookie, utep_salt) + if authenticated?(utep_cookie,utep_salt) @client.call(:log_off, message: { sessionId: utep_cookie.to_s}) end end
Fix weird spacing issues in file
diff --git a/app/models/enumerations/initiation_type.rb b/app/models/enumerations/initiation_type.rb index abc1234..def5678 100644 --- a/app/models/enumerations/initiation_type.rb +++ b/app/models/enumerations/initiation_type.rb @@ -1,7 +1,7 @@ module Enumerations InitiationType = %w[ - charge_sheet - postal_requisition + charge + requisition summons ] end
Update InitiationType enumeration from spec
diff --git a/activesupport/lib/active_support/core_ext/class/subclasses.rb b/activesupport/lib/active_support/core_ext/class/subclasses.rb index abc1234..def5678 100644 --- a/activesupport/lib/active_support/core_ext/class/subclasses.rb +++ b/activesupport/lib/active_support/core_ext/class/subclasses.rb @@ -28,9 +28,6 @@ # # Foo.subclasses # => [Bar] def subclasses - chain = descendants - chain.reject do |k| - chain.any? { |c| c > k } - end + descendants.select { |descendant| descendant.superclass == self } end end
Refactor to reduce complexity from O(n*2) to O(n) A class is only a direct descendant if its superclass is self. Fixes https://github.com/rails/rails/pull/37487
diff --git a/Casks/postbox.rb b/Casks/postbox.rb index abc1234..def5678 100644 --- a/Casks/postbox.rb +++ b/Casks/postbox.rb @@ -5,7 +5,7 @@ # amazonaws.com is the official download host per the vendor homepage url "https://s3.amazonaws.com/download.getpostbox.com/installers/#{version}/2_08c63331d92b59d2d99abea0a6eae8c0/postbox-#{version}-mac64.dmg" name 'Postbox' - homepage 'http://www.postbox-inc.com/' + homepage 'https://www.postbox-inc.com/' license :commercial tags :vendor => 'Postbox' depends_on :macos => '>= :mavericks'
Fix homepage to use SSL in Postbox Cask The HTTP URL is already getting redirected to HTTPS. Using the HTTPS URL directly makes it more secure and saves a HTTP round-trip.
diff --git a/Casks/thunder.rb b/Casks/thunder.rb index abc1234..def5678 100644 --- a/Casks/thunder.rb +++ b/Casks/thunder.rb @@ -1,13 +1,13 @@ cask :v1 => 'thunder' do version '2.6.7.1706' - sha256 '974de57f80e110f1a2001b7bf0b2e60edc28fd6a2234f8f2574ea49c8c6598ff' + sha256 '0eb7fa7e1448eebb3b60c4fa849888fff8697d20474771d0ad3001f4f5b3274d' # sandai.net is the official download host per the vendor homepage url "http://down.sandai.net/mac/thunder_dl#{version}_Beta.dmg" name '迅雷' name 'Thunder' homepage 'http://mac.xunlei.com/' - license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder + license :commercial app 'Thunder.app' end
Fix checksum in Thunder.app Cask
diff --git a/lib/gruf/version.rb b/lib/gruf/version.rb index abc1234..def5678 100644 --- a/lib/gruf/version.rb +++ b/lib/gruf/version.rb @@ -14,5 +14,5 @@ # OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # module Gruf - VERSION = '2.2.0.pre'.freeze + VERSION = '2.2.0'.freeze end
Bump to 2.2.0 for release
diff --git a/lib/hashid/rails.rb b/lib/hashid/rails.rb index abc1234..def5678 100644 --- a/lib/hashid/rails.rb +++ b/lib/hashid/rails.rb @@ -50,8 +50,13 @@ end def find(hashid) - return super hashid if caller.first(3).any?{|s| s =~ /active_record\/persistence.*reload/} - super decode_id(hashid) || hashid + model_reload? ? super(hashid) : super( decode_id(hashid) || hashid ) + end + + private + + def model_reload? + caller.first(3).any?{|s| s =~ /active_record\/persistence.*reload/} end end
Move the model reload detect regex to help method
diff --git a/lib/jstp/version.rb b/lib/jstp/version.rb index abc1234..def5678 100644 --- a/lib/jstp/version.rb +++ b/lib/jstp/version.rb @@ -1,4 +1,4 @@ # -*- encoding : utf-8 -*- module JSTP - VERSION = "0.1.0" + VERSION = "0.2.0" end
Support for TCP and WebSockets is now on the same level, follows support for separate port and mode configuration
diff --git a/lib/mongo_client.rb b/lib/mongo_client.rb index abc1234..def5678 100644 --- a/lib/mongo_client.rb +++ b/lib/mongo_client.rb @@ -4,7 +4,7 @@ attr_reader = :client def initialize(params) - @client = Mongo::Client.new(ENV['MONGOLAB_URI']) + @client = Mongo::Client.new(ENV['MONGODB_URI']) @params = params end
Change env variable name for mongo seems like now for some reason heroku gives it another name, than before
diff --git a/lib/multi_logger.rb b/lib/multi_logger.rb index abc1234..def5678 100644 --- a/lib/multi_logger.rb +++ b/lib/multi_logger.rb @@ -36,6 +36,8 @@ ActiveSupport::BufferedLogger elsif defined?(ActiveSupport::Logger) ActiveSupport::Logger + else + raise 'Rails logger not found' end end end
Raise error if Rails logger class is not found
diff --git a/lib/super_search.rb b/lib/super_search.rb index abc1234..def5678 100644 --- a/lib/super_search.rb +++ b/lib/super_search.rb @@ -1,9 +1,12 @@+require 'uri' + class SuperSearch def self.url "http://search.alaska.dev/" end def self.query_param_for(item_name) - item_name.gsub(/\s+/, '+') + # item_name.gsub(/\s+/, '+') + URI.encode item_name end def self.url_for(item_name) "#{SuperSearch.url}index.php?q=#{SuperSearch.query_param_for(item_name)}"
Use built in URI library to encode urls for supersearch
diff --git a/libraries/sysctl.rb b/libraries/sysctl.rb index abc1234..def5678 100644 --- a/libraries/sysctl.rb +++ b/libraries/sysctl.rb @@ -17,7 +17,7 @@ prefix += '.' unless prefix.empty? v.map { |key, value| compile_attr("#{prefix}#{key}", value) }.flatten.sort else - fail Chef::Exceptions::UnsupportedAction, "Sysctl cookbook can't handle values of type: #{v.class}" + raise Chef::Exceptions::UnsupportedAction, "Sysctl cookbook can't handle values of type: #{v.class}" end end end
Use fail instead of raise
diff --git a/lib/conceptql/operators/temporal_operator.rb b/lib/conceptql/operators/temporal_operator.rb index abc1234..def5678 100644 --- a/lib/conceptql/operators/temporal_operator.rb +++ b/lib/conceptql/operators/temporal_operator.rb @@ -5,8 +5,7 @@ # Base class for all temporal operators # # Subclasses must implement the where_clause method which should probably return - # a proc that can be executed as a Sequel "virtual row" e.g. - # Proc.new { l.end_date < r.start_date } + # a Sequel expression to use for filtering. class TemporalOperator < BinaryOperatorOperator register __FILE__
Fix comment to reflect current API
diff --git a/lib/itamae/plugin/recipe/rtn_rbenv/common.rb b/lib/itamae/plugin/recipe/rtn_rbenv/common.rb index abc1234..def5678 100644 --- a/lib/itamae/plugin/recipe/rtn_rbenv/common.rb +++ b/lib/itamae/plugin/recipe/rtn_rbenv/common.rb @@ -8,9 +8,14 @@ case os[:family] when %r(debian|ubuntu) + packages << 'autoconf' + packages << 'bison' + packages << 'build-essential' + packages << 'libssl-dev' + packages << 'libyaml-dev' + packages << 'libreadline6-dev' packages << 'zlib1g-dev' - packages << 'libssl-dev' - packages << 'libreadline6-dev' + packages << 'libncurses5-dev' when %r(redhat|fedora) packages << 'zlib-devel' packages << 'openssl-devel'
Add suggested build environment packages for debian/ubuntu https://github.com/sstephenson/ruby-build/wiki#suggested-build-environment
diff --git a/Casks/tg-pro.rb b/Casks/tg-pro.rb index abc1234..def5678 100644 --- a/Casks/tg-pro.rb +++ b/Casks/tg-pro.rb @@ -1,6 +1,6 @@ cask :v1 => 'tg-pro' do - version '2.6' - sha256 '2b84e6dbae6516584c8303fc7e7305026b7c62cf9eec94435bb8ee68c8859824' + version '2.7.1' + sha256 'b44547b1c76eb69441c3f41eb3975301ec59c405b645f16d835c4243b82031eb' url "http://www.tunabellysoftware.com/resources/TGPro_#{version.gsub('.','_')}.zip" name 'TG Pro'
Update TG Pro.app to v2.7.1
diff --git a/markety.gemspec b/markety.gemspec index abc1234..def5678 100644 --- a/markety.gemspec +++ b/markety.gemspec @@ -1,4 +1,5 @@ $:.push File.expand_path("../lib", __FILE__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'markety/version' Gem::Specification.new do |s|
Add lib to Ruby's load path
diff --git a/Casks/day-o.rb b/Casks/day-o.rb index abc1234..def5678 100644 --- a/Casks/day-o.rb +++ b/Casks/day-o.rb @@ -1,10 +1,10 @@ cask 'day-o' do - version :latest - sha256 :no_check + version '2.0' + sha256 '24c64e66499bde5149d43c7b9b33b44b46ac6d136fcc4a988fd7c298aff02071' - url 'http://shauninman.com/assets/downloads/Day-O.zip' + url "http://shauninman.com/assets/downloads/Day-#{version}.zip" name 'Day-O' - homepage 'http://www.shauninman.com/archive/2011/10/20/day_o_mac_menu_bar_clock' + homepage 'http://shauninman.com/archive/2016/10/20/day_o_2_mac_menu_bar_clock' - app 'Day-O/Day-O.app' + app "Day-#{version}/Day-O.app" end
Update Day-O to version 2.0
diff --git a/lib/cortex/posts.rb b/lib/cortex/posts.rb index abc1234..def5678 100644 --- a/lib/cortex/posts.rb +++ b/lib/cortex/posts.rb @@ -10,6 +10,10 @@ def get(id) client.get("/posts/#{id}") + end + + def get_published(id) + client.get("/posts/feed/#{id}") end def save(post)
Add get_published for a single published post
diff --git a/lib/autotest/twitter/config.rb b/lib/autotest/twitter/config.rb index abc1234..def5678 100644 --- a/lib/autotest/twitter/config.rb +++ b/lib/autotest/twitter/config.rb @@ -9,7 +9,7 @@ end class Config - attr_reader :consumer_key, :consumer_secret, :oauth_token, :oauth_token_secret, :label, :image_dir + attr_accessor :consumer_key, :consumer_secret, :oauth_token, :oauth_token_secret, :label, :image_dir end end end
Fix to attr_accessor from attr_reader
diff --git a/lib/em-c2dm/auth.rb b/lib/em-c2dm/auth.rb index abc1234..def5678 100644 --- a/lib/em-c2dm/auth.rb +++ b/lib/em-c2dm/auth.rb @@ -15,6 +15,7 @@ http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_PEER + http.ca_file = '/usr/lib/ssl/certs/ca-certificates.crt' # for heroku, may differ on your platform request = Net::HTTP::Post.new(uri.path) request["Content-Length"] = 0
Set ca_file path for heroku
diff --git a/mkdtemp.gemspec b/mkdtemp.gemspec index abc1234..def5678 100644 --- a/mkdtemp.gemspec +++ b/mkdtemp.gemspec @@ -20,4 +20,6 @@ # TODO: add 'docs' subdirectory, 'README.txt' when they're done s.files = Dir['lib/**/*', 'ext/*.{c,h,rb}', 'ext/depend'] s.extensions = ['ext/extconf.rb'] + + s.add_development_dependency 'rspec', '>= 2.0.0.beta' end
Add RSpec as a development dependency Signed-off-by: Wincent Colaiuta <c76ac2e9cd86441713c7dfae92c451f3e6d17fdc@wincent.com>
diff --git a/lib/fssm/support.rb b/lib/fssm/support.rb index abc1234..def5678 100644 --- a/lib/fssm/support.rb +++ b/lib/fssm/support.rb @@ -39,7 +39,7 @@ def rb_inotify? found = begin require 'rb-inotify' - INotify::Notifier.ancestors.include?(IO) + !INotify::Notifier.ancestors.include?(IO) rescue LoadError false end
Load rb-inotify when jQuery is working, rather than when it's not.
diff --git a/lib/marooned/cli.rb b/lib/marooned/cli.rb index abc1234..def5678 100644 --- a/lib/marooned/cli.rb +++ b/lib/marooned/cli.rb @@ -2,6 +2,7 @@ class CLI def initialize(argv) @argv = argv + @options = {} end def run @@ -14,6 +15,16 @@ opts.on("-v", "--version", "Print the version and exit") do puts "#{ Marooned::VERSION }" + exit + end + + opts.on("-h", "--help", "Print the help message and exit") do + puts opts + exit + end + + opts.on("-p", "--project [PROJECT_NAME]", "Specify the Xcode project to check") do |project| + @options[:project] = project end end end
Add help and project specifier
diff --git a/lib/no_proxy_fix.rb b/lib/no_proxy_fix.rb index abc1234..def5678 100644 --- a/lib/no_proxy_fix.rb +++ b/lib/no_proxy_fix.rb @@ -1,5 +1,5 @@ require 'no_proxy_fix/version' module NoProxyFix - require 'cext/generic_find_proxy' if RUBY_VERSION =~ /2\.4\.[10].*/ + require 'cext/generic_find_proxy' if RUBY_VERSION =~ /\A2\.4\.[10]/ end
Fix the regexp more strict
diff --git a/DEjson.podspec b/DEjson.podspec index abc1234..def5678 100644 --- a/DEjson.podspec +++ b/DEjson.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "DEjson" - s.version = "1.0.2" + s.version = "1.0.3" s.summary = "JSON parser and serializer in pure swift." s.description = <<-DESC Error resilient JSON parser and serializer in pure swift. @@ -13,10 +13,10 @@ s.author = { "Johannes Schriewer" => "j.schriewer@anfe.ma" } s.social_media_url = "http://twitter.com/dunkelstern" - s.ios.deployment_target = "8.4" + s.ios.deployment_target = "8.0" s.osx.deployment_target = "10.10" - s.source = { :git => "https://github.com/anfema/DEjson.git", :tag => "1.0.2" } + s.source = { :git => "https://github.com/anfema/DEjson.git", :tag => "1.0.3" } s.source_files = "Sources/*.swift" end
Set minimum deployment target of podspec to 8.0 to match the project settings.
diff --git a/etc/deploy/stages/dev.rb b/etc/deploy/stages/dev.rb index abc1234..def5678 100644 --- a/etc/deploy/stages/dev.rb +++ b/etc/deploy/stages/dev.rb @@ -7,6 +7,6 @@ after "deploy:updated", :build do invoke "doctrine:schema:drop_full" invoke "doctrine:migrations:migrate" - invoke "symfony:console", "h:d:f:l", "--no-interaction" + #invoke "symfony:console", "h:d:f:l", "--no-interaction" invoke "symfony:console", "cache:clear", "--env prod" end
Disable fixtures during deployment by default
diff --git a/lib/grape_doc/doc_generator.rb b/lib/grape_doc/doc_generator.rb index abc1234..def5678 100644 --- a/lib/grape_doc/doc_generator.rb +++ b/lib/grape_doc/doc_generator.rb @@ -34,7 +34,7 @@ end.join doc_dir = "#{Dir.pwd}/grape_doc" doc_path = "#{doc_dir}/api.md" - Dir::mkdir(doc_dir) + FileUtils.mkdir_p(doc_dir) output = File.open(doc_path, "w") output << generated_resources end
Use mkdir_p instead of mkdir
diff --git a/lib/stacker/stack/template.rb b/lib/stacker/stack/template.rb index abc1234..def5678 100644 --- a/lib/stacker/stack/template.rb +++ b/lib/stacker/stack/template.rb @@ -11,6 +11,18 @@ FORMAT_VERSION = '2010-09-09' extend Memoist + + def self.format object + formatted = JSON.pretty_generate object + + # put empty arrays on a single line + formatted.gsub! /: \[\s*\]/m, ': []' + + # put { "Ref": ... } on a single line + formatted.gsub! /\{\s+\"Ref\"\:\s+(?<ref>\"[^\"]+\")\s+\}/m, '{ "Ref": \\k<ref> }' + + formatted + "\n" + end def exists? File.exists? path @@ -44,7 +56,7 @@ memoize :diff def write value = local - File.write path, JSON.pretty_generate(value) + "\n" + File.write path, self.class.format(value) end def dump
Add a bit of more intelligent formatting to JSON output There's no way to make everyone happy, but some things can be standardized a bit. e.g. having Refs on a single line makes a lot of sense. Signed-off-by: Evan Owen <a31932a4150a6c43f7c4879727da9a731c3d5877@gmail.com>
diff --git a/lib/stacker_bee/connection.rb b/lib/stacker_bee/connection.rb index abc1234..def5678 100644 --- a/lib/stacker_bee/connection.rb +++ b/lib/stacker_bee/connection.rb @@ -30,8 +30,9 @@ def get(request) @faraday.get(@path, request.query_params) - rescue Faraday::Error::ConnectionFailed - raise ConnectionError, "Failed to connect to #{configuration.url}" + rescue Faraday::Error::ConnectionFailed => error + raise ConnectionError, + "Failed to connect to #{configuration.url}, #{error}" end end end
Include original error in ConnectionError
diff --git a/lib/mdi_cloud_decoder/track.rb b/lib/mdi_cloud_decoder/track.rb index abc1234..def5678 100644 --- a/lib/mdi_cloud_decoder/track.rb +++ b/lib/mdi_cloud_decoder/track.rb @@ -1,14 +1,7 @@ module MdiCloudDecoder class Track - attr_reader :id, - :asset, - :location_provided, - :latitude, - :longitude, - :received_at, - :recorded_at, - :fields, - :raw_data + attr_reader :id, :asset, :received_at, :recorded_at, :raw_data + attr_accessor :latitude, :longitude, :fields def initialize(json) # Convert fields as best as possible (speed, coordinates, etc)
Change some fields to writable
diff --git a/lib/tolaria/default_config.rb b/lib/tolaria/default_config.rb index abc1234..def5678 100644 --- a/lib/tolaria/default_config.rb +++ b/lib/tolaria/default_config.rb @@ -41,6 +41,7 @@ authenticity_token id utf8 + save_and_review ] end
Add save_and_review to permitted params
diff --git a/lib/tasks/export_trade_db.rake b/lib/tasks/export_trade_db.rake index abc1234..def5678 100644 --- a/lib/tasks/export_trade_db.rake +++ b/lib/tasks/export_trade_db.rake @@ -0,0 +1,49 @@+require 'zip' +require 'fileutils' +namespace :export do + task :trade_db => :environment do + RECORDS_PER_FILE = 500000 + ntuples = RECORDS_PER_FILE + offset = 0 + i = 0 + dir = 'tmp/trade_db_files/' + FileUtils.mkdir_p dir + begin + while(ntuples == RECORDS_PER_FILE) do + i = i + 1 + query = Trade::ShipmentReportQueries.full_db_query(RECORDS_PER_FILE, offset) + results = ActiveRecord::Base.connection.execute query + ntuples = results.ntuples + columns = results.fields + columns.map do |column| + column.capitalize! + column.gsub! '_', ' ' + end + values = results.values + Rails.logger.info("Query executed returning #{ntuples} records!") + filename = "trade_db_#{i}.csv" + Rails.logger.info("Processing batch number #{i} in #{filename}.") + File.open("#{dir}#{filename}", 'w') do |file| + file.write columns.join(',') + values.each do |record| + file.write "\n" + file.write record.join(',') + end + end + offset = offset + RECORDS_PER_FILE + end + Rails.logger.info("Trade database completely exported!") + zipfile = 'tmp/trade_db_files/trade_db.zip' + Zip::File.open(zipfile, Zip::File::CREATE) do |zipfile| + (1..i).each do |index| + filename = "trade_db_#{index}.csv" + zipfile.add(filename, dir + filename) + end + end + rescue => e + Rails.logger.info("Export aborted!") + Rails.logger.info("Caught exception #{e}") + Rails.logger.info(e.message) + end + end +end
Add rake task to export the entire trade db in csv files and then zipped
diff --git a/lib/tasks/replace_textile.rake b/lib/tasks/replace_textile.rake index abc1234..def5678 100644 --- a/lib/tasks/replace_textile.rake +++ b/lib/tasks/replace_textile.rake @@ -13,5 +13,16 @@ content.text_filter_name = "markdown" content.save! end + + Feedback.find_each do |feedback| + feedback.text_filter_name == "textile" or next + + body_html = feedback.html(:body) + feedback.body = ReverseMarkdown.convert body_html + extended_html = feedback.html(:extended) + feedback.extended = ReverseMarkdown.convert extended_html + feedback.text_filter_name = "markdown" + feedback.save! + end end end
Make textile_to_markdown task convert feedback
diff --git a/lib/travis/api/v2/http/user.rb b/lib/travis/api/v2/http/user.rb index abc1234..def5678 100644 --- a/lib/travis/api/v2/http/user.rb +++ b/lib/travis/api/v2/http/user.rb @@ -26,7 +26,7 @@ 'name' => user.name, 'login' => user.login, 'email' => user.email, - 'gravatar_id' => user.gravatar_id, + 'gravatar_id' => Digest::MD5.hexdigest(user.email), 'locale' => user.locale, 'is_syncing' => user.syncing?, 'synced_at' => format_date(user.synced_at),
Fix gravatar_id to use email. This is a temporary fix for travis-ci/travis-ci#2837, until the sync is fixed.
diff --git a/lib/yammer-staging-strategy.rb b/lib/yammer-staging-strategy.rb index abc1234..def5678 100644 --- a/lib/yammer-staging-strategy.rb +++ b/lib/yammer-staging-strategy.rb @@ -22,6 +22,7 @@ image: raw_info['mugshot_url'], name: raw_info['full_name'], nickname: raw_info['name'], + yammer_network_id: raw_info['network_id'], yammer_profile_url: raw_info['web_url'] } end
Add yammer_network_id to yammer staging strategy
diff --git a/ci_environment/composer/recipes/default.rb b/ci_environment/composer/recipes/default.rb index abc1234..def5678 100644 --- a/ci_environment/composer/recipes/default.rb +++ b/ci_environment/composer/recipes/default.rb @@ -7,6 +7,8 @@ bin_path = "#{phpenv_path}/versions/#{php_version}/bin" remote_file "#{bin_path}/composer.phar" do source "http://getcomposer.org/composer.phar" + owner node[:phpbuild][:user] + group node[:phpbuild][:group] mode "0644" end
Make sure composer and composer.phar owner is the same
diff --git a/Kakapo.podspec b/Kakapo.podspec index abc1234..def5678 100644 --- a/Kakapo.podspec +++ b/Kakapo.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Kakapo" - s.version = "0.0.1" + s.version = "0.1.0" s.summary = "Dynamically Mock server behaviors and responses." s.description = <<-DESC
Raise podspec version to 0.1.0
diff --git a/lib/carbonculture/place.rb b/lib/carbonculture/place.rb index abc1234..def5678 100644 --- a/lib/carbonculture/place.rb +++ b/lib/carbonculture/place.rb @@ -17,8 +17,8 @@ Organisation.new(organisation_name) end - def channels - body['channels'].map { |c| Channel.new(c, name, organisation_name) } + def channels(options = {}) + body['channels'].map { |c| Channel.new(c, name, organisation_name, options) } end def method_missing(method_name, *args, &block) @@ -29,4 +29,4 @@ end end end -end+end
Allow Channels call from Places to define options
diff --git a/web/builder.rb b/web/builder.rb index abc1234..def5678 100644 --- a/web/builder.rb +++ b/web/builder.rb @@ -4,7 +4,7 @@ class PGQuilter::Builder < Sinatra::Base # validate and store a build request; to be picked up by a worker - post '/build' do + post '/builds' do payload = JSON.parse request.body.read base_sha = payload.delete "base_sha" @@ -19,4 +19,21 @@ 200 end end + + get '/builds/:uuid' do |uuid| + b = PGQuilter::Build[uuid] + if b.nil? + status 404 + end + { + id: uuid, + created_at: b.created_at, + patches: b.patches.sort_by(&:order).map do |p| + { + sha1: Digest::SHA1.hexdigest(p.body) + } + end, + status: 'pending' + }.to_json + end end
Add GET endpoint for builds
diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index abc1234..def5678 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -5,7 +5,7 @@ set :use_sudo, false set(:deploy_to) {"#{home_dir}/webapps/elmo_rails/#{stage}"} set :default_environment, { - "PATH" => "$PATH:$HOME/bin:$HOME/webapps/elmo_rails/bin", + "PATH" => "$HOME/bin:$HOME/webapps/elmo_rails/bin:$PATH", "GEM_HOME" => "$HOME/webapps/elmo_rails/gems" }
2215: Move $PATH to the end of PATH to get the right Ruby
diff --git a/spec/features/category_spec.rb b/spec/features/category_spec.rb index abc1234..def5678 100644 --- a/spec/features/category_spec.rb +++ b/spec/features/category_spec.rb @@ -7,7 +7,9 @@ let(:tag_sommer) {ActsAsTaggableOn::Tag.find_by_name('sommer')} before do - category_jahreszeiten = Category.new(name: 'Jahreszeiten') + category_jahreszeiten = Category.new(name_de: 'Jahreszeiten') + # needs both translations + category_jahreszeiten = Category.new(name_en: 'seasons') category_jahreszeiten.save! tag_fruehling.categories << category_jahreszeiten tag_sommer.categories << category_jahreszeiten
MAke sure categories have all the translations
diff --git a/lib/convection/model/template/resource/aws_auto_scaling_launch_configuration.rb b/lib/convection/model/template/resource/aws_auto_scaling_launch_configuration.rb index abc1234..def5678 100644 --- a/lib/convection/model/template/resource/aws_auto_scaling_launch_configuration.rb +++ b/lib/convection/model/template/resource/aws_auto_scaling_launch_configuration.rb @@ -23,6 +23,12 @@ property :security_group, 'SecurityGroups', :array property :spot_price, 'SpotPrice' property :user_data, 'UserData' + + def block_device_mapping(&block) + dev_map = ResourceProperty::EC2BlockDeviceMapping.new(self) + dev_map.instance_exec(&block) if block + block_device_mappings << dev_map + end end end end
Add block device mapping helper to asg launch_config
diff --git a/spec/integration/vm/app/app.rb b/spec/integration/vm/app/app.rb index abc1234..def5678 100644 --- a/spec/integration/vm/app/app.rb +++ b/spec/integration/vm/app/app.rb @@ -10,13 +10,13 @@ end post '/' do - result.tap {|res| res['method'] = 'POST'}.to_json + result.to_json end def result { 'app' => 'sinatra', - 'method' => 'GET', + 'method' => request.request_method, 'path' => request.path_info, 'params' => params, 'headers' => RequestWrapper.new(request).headers,
Use Sinatra's request object instead of set default method
diff --git a/lib/correios_sigep/builders/xml/sender.rb b/lib/correios_sigep/builders/xml/sender.rb index abc1234..def5678 100644 --- a/lib/correios_sigep/builders/xml/sender.rb +++ b/lib/correios_sigep/builders/xml/sender.rb @@ -14,7 +14,7 @@ @builder.numero @sender.number @builder.complemento @sender.complement @builder.bairro @sender.neighborhood - @builder.reference @sender.reference + @builder.referencia @sender.reference @builder.cidade @sender.city @builder.uf @sender.state @builder.cep @sender.postal_code
Fix builder to use referencia instead of reference
diff --git a/lib/dpl/provider/heroku/git_deploy_key.rb b/lib/dpl/provider/heroku/git_deploy_key.rb index abc1234..def5678 100644 --- a/lib/dpl/provider/heroku/git_deploy_key.rb +++ b/lib/dpl/provider/heroku/git_deploy_key.rb @@ -2,6 +2,11 @@ class Provider module Heroku class GitDeployKey < GitSSH + deprecated( + "git-deploy-key strategy is deprecated, and will be shut down on June 26, 2017.", + "Please consider moving to the \`api\` or \`git\` strategy." + ) + def needs_key? false end
Add deprecation warning on git-deploy-key strategy
diff --git a/spec/rsr_group/catalog_spec.rb b/spec/rsr_group/catalog_spec.rb index abc1234..def5678 100644 --- a/spec/rsr_group/catalog_spec.rb +++ b/spec/rsr_group/catalog_spec.rb @@ -24,7 +24,7 @@ it 'iterates over the whole file' do count = 0 - RsrGroup::Catalog.all(6, credentials) do |chunk| + RsrGroup::Catalog.all(credentials) do |chunk| count += chunk.length end
Remove the chunk size argument and reinstate the test on the `Catalog::all` method
diff --git a/lib/image_optim/railtie.rb b/lib/image_optim/railtie.rb index abc1234..def5678 100644 --- a/lib/image_optim/railtie.rb +++ b/lib/image_optim/railtie.rb @@ -14,7 +14,7 @@ app.assets end - def options + def options(app) if app.config.assets.image_optim == true {} else @@ -23,7 +23,7 @@ end def register_preprocessor(app) - image_optim = ImageOptim.new(options) + image_optim = ImageOptim.new(options(app)) processor = proc do |_context, data| image_optim.optimize_image_data(data) || data
Make app available to options Seems to have been broken by 95fe0b9
diff --git a/lib/avocado/uploader.rb b/lib/avocado/uploader.rb index abc1234..def5678 100644 --- a/lib/avocado/uploader.rb +++ b/lib/avocado/uploader.rb @@ -32,6 +32,7 @@ def write_payload_to_json_file(&block) file = File.open 'avocado.json', 'w+:UTF-8' file.write JSON[payload] + file.rewind yield file ensure file.close
Use file.rewind before yielding for upload