diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/tasks/bootstrap.rake b/lib/tasks/bootstrap.rake index abc1234..def5678 100644 --- a/lib/tasks/bootstrap.rake +++ b/lib/tasks/bootstrap.rake @@ -26,7 +26,7 @@ # Creates an administrator account in the application desc "Create admin account if it does not exist" task(create_admin_account: :environment) do - unless User.find_by_name "admin" + unless User.where(username: "admin").exists? u = User.new u.username = "admin" u.password = "admin"
Fix för felaktig koll om adminkontot existerar
diff --git a/NNNetwork.podspec b/NNNetwork.podspec index abc1234..def5678 100644 --- a/NNNetwork.podspec +++ b/NNNetwork.podspec @@ -5,7 +5,7 @@ s.homepage = 'http://github.com/tomazsh/NNNetwork' s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { 'Tomaz Nedeljko' => 'tomaz@nedeljko.com' } - s.source = { :git => 'https://github.com/weiran/NNNetwork.git', :tag => '0.0.3' } + s.source = { :git => 'https://github.com/tomazsh/NNNetwork.git', :tag => '0.0.2' } s.ios.deployment_target = '5.0' s.osx.deployment_target = '10.7' s.source_files = 'NNNetwork'
Revert "Redirect podspec to this branch." This reverts commit 6739c0cec9448a1265fd3beb6c74f5ac83bba656.
diff --git a/vendor/plugins/private_messaging/spec/models/private_message_spec.rb b/vendor/plugins/private_messaging/spec/models/private_message_spec.rb index abc1234..def5678 100644 --- a/vendor/plugins/private_messaging/spec/models/private_message_spec.rb +++ b/vendor/plugins/private_messaging/spec/models/private_message_spec.rb @@ -25,6 +25,42 @@ message.should_not be_valid end end + + it "should tell me if a profile is the recipient" do + end + + it "should tell me if a profile is the sender" do + end + + it "should tell me if a profile can edit this message" do + end + + it "should tell me if a profile can see a message" do + end + + it "should delete a message on the sender side" do + end + + it "should delete a message on the recipient side" do + end + + it "should destroy a message if both sender and receiver delete it" do + end + + it "should find messages associated with a profile (e.g., either sender or recipient)" do + end + + it "should count messages associated with a profile" do + end + + it "should find messages between two profiles" do + end + + it "should count messages between two profiles" do + end + + it "should format its body with Textile" do + end end def create_message(options = {})
Add skeleton for enhanced model specs
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -7,4 +7,5 @@ # Mayor.create(name: 'Emanuel', city: cities.first) # -category = Category.find_or_create_by_name('uncategorized') +puts "Create default category.\n" +category = Category.where(name: Category.default).first_or_create
Refactor seed to use new ActiveRecord's find_or_create method
diff --git a/tasks/gpg_patch.rake b/tasks/gpg_patch.rake index abc1234..def5678 100644 --- a/tasks/gpg_patch.rake +++ b/tasks/gpg_patch.rake @@ -0,0 +1,14 @@+require 'buildr/gpg' + +raise "Patch applied in latest version of buildr" if Buildr::VERSION >= '1.4.16' + +module Buildr + module GPG + class << self + def sign_and_upload_all_packages(project) + project.packages.each { |pkg| Buildr::GPG.sign_and_upload(project, pkg) } + project.packages.map { |pkg| pkg.pom }.compact.uniq.each { |pom| Buildr::GPG.sign_and_upload(project, pom) } + end + end + end +end
Patch gpg addond to fix bug
diff --git a/lib/api2cart/daemon/total_request_count_guard.rb b/lib/api2cart/daemon/total_request_count_guard.rb index abc1234..def5678 100644 --- a/lib/api2cart/daemon/total_request_count_guard.rb +++ b/lib/api2cart/daemon/total_request_count_guard.rb @@ -1,14 +1,15 @@ module Api2cart::Daemon class TotalRequestCountGuard def initialize - self.request_counter = RequestCounter.new + self.queued_request_counter = RequestCounter.new self.waiting_queue = [] end def guard - wait_in_queue! if request_counter.request_count >= 20 - - response = request_counter.count_request { yield } + response = queued_request_counter.count_request do + wait_in_queue! if queued_request_counter.request_count > 20 + yield + end move_queue! response @@ -16,7 +17,7 @@ protected - attr_accessor :requests_currently_running, :waiting_queue, :request_counter + attr_accessor :requests_currently_running, :waiting_queue, :queued_request_counter def move_queue! return if waiting_queue.empty? @@ -26,6 +27,7 @@ end def wait_in_queue! + puts "Waiting for overall quota (currently #{queued_request_counter.request_count} requests are queued)" condition = Celluloid::Condition.new waiting_queue << condition condition.wait
Make TotalRequestCountGuard count queued requests, not only currently running ones
diff --git a/telemetry.gemspec b/telemetry.gemspec index abc1234..def5678 100644 --- a/telemetry.gemspec +++ b/telemetry.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'telemetry' - s.version = '0.1.0' + s.version = '0.1.1' s.summary = 'In-process telemetry based on observers' s.description = ' '
Package version is increased from 0.1.0 to 0.1.1
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,4 +1,3 @@-# This file is copied to spec/ when you run 'rails generate rspec:install' ENV["RAILS_ENV"] ||= 'test' require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' @@ -9,25 +8,9 @@ Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} RSpec.configure do |config| - # == Mock Framework - # - # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: - # - # config.mock_with :mocha - # config.mock_with :flexmock - # config.mock_with :rr config.mock_with :rspec - # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures - # config.fixture_path = "#{::Rails.root}/spec/fixtures" + config.use_transactional_fixtures = true - # If you're not using ActiveRecord, or you'd prefer not to run each of your - # examples within a transaction, remove the following line or assign false - # instead of true. - # config.use_transactional_fixtures = true - - # If true, the base class of anonymous controllers will be inferred - # automatically. This will be the default behavior in future versions of - # rspec-rails. config.infer_base_class_for_anonymous_controllers = false end
Use transactional fixtures, remove comments
diff --git a/superstring.gemspec b/superstring.gemspec index abc1234..def5678 100644 --- a/superstring.gemspec +++ b/superstring.gemspec @@ -1,4 +1,4 @@-# -*- encoding: utf-8 -*- +# encoding: UTF-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'superstring/version'
Tweak style of encoding magic comment
diff --git a/lib/flipper/adapters/operation_logger.rb b/lib/flipper/adapters/operation_logger.rb index abc1234..def5678 100644 --- a/lib/flipper/adapters/operation_logger.rb +++ b/lib/flipper/adapters/operation_logger.rb @@ -50,7 +50,7 @@ def inspect attributes = [ "name=#{name.inspect}", - "wrapped_adapter=#{__getobj__.inspect}", + "wrapped_adapter=#{adapter.inspect}", "operations=#{@operations.inspect}", ] "#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>"
Fix inspect for operation logger.
diff --git a/lib/modules/trade/compliance_grouping.rb b/lib/modules/trade/compliance_grouping.rb index abc1234..def5678 100644 --- a/lib/modules/trade/compliance_grouping.rb +++ b/lib/modules/trade/compliance_grouping.rb @@ -0,0 +1,69 @@+class Trade::ComplianceGrouping + attr_reader :query + + ATTRIBUTES = { + id: 'id', + importer: 'importer', + exporter: 'exporter', + term: 'term', + unit: 'unit', + purpose: 'purpose', + source: 'source', + taxon: 'taxon', + genus: 'genus', + family: 'family', + class: 'class' + } + + def initialize(type, attributes=nil, limit=nil) + @type = sanitise_params([type]).first + @attributes = sanitise_params(attributes) + @limit = sanitise_limit(limit) + @query = "#{non_compliant_shipments}#{group}" + end + + private + + def group + columns = @attributes.present? ? @attributes.join(',') : '' + <<-SQL + SELECT #{@type}, #{columns}, cnt, 100.0*cnt/(SUM(cnt) OVER ()) AS percent + FROM ( + SELECT #{@type}, #{columns}, COUNT(*) AS cnt + FROM non_compliant_shipments + GROUP BY #{@type}, #{columns} + ) counts + ORDER BY percent DESC + SQL + end + + def non_compliant_shipments + <<-SQL + WITH non_compliant_shipments AS ( + ( + SELECT #{ATTRIBUTES.values.join(',')} + FROM trade_shipments_appendix_i_mview + ) + UNION + ( + SELECT #{ATTRIBUTES.values.join(',')} + FROM trade_shipments_mandatory_quotas_mview + ) + UNION + ( + SELECT #{ATTRIBUTES.values.join(',')} + FROM trade_shipments_cites_suspensions_mview + ) + ) + SQL + end + + def sanitise_params(params) + return nil if params.blank? + params.map { |p| ATTRIBUTES[p.to_sym] } + end + + def sanitise_limit(limit) + limit.is_a?(Integer) ? limit : nil + end +end
Add module to fetch grouped data from mviews
diff --git a/lib/provision/workqueue/noop_listener.rb b/lib/provision/workqueue/noop_listener.rb index abc1234..def5678 100644 --- a/lib/provision/workqueue/noop_listener.rb +++ b/lib/provision/workqueue/noop_listener.rb @@ -22,15 +22,14 @@ @logger.info("#{spec[:hostname]} [passed]") end - def error(e,spec) - @results[spec[:hostname]] = "failed" - @errors=@errors+1 + def error(e, spec) + @results[spec[:hostname]] = "failed: #{e.to_s}" + @errors = @errors + 1 @logger.warn("#{spec[:hostname]} [failed] - #{e}") @logger.warn(e.backtrace) end def has_errors? - return @errors>0 + return @errors > 0 end end -
Put a bit more detail in failure messages
diff --git a/lib/puppet/parser/functions/dns_array.rb b/lib/puppet/parser/functions/dns_array.rb index abc1234..def5678 100644 --- a/lib/puppet/parser/functions/dns_array.rb +++ b/lib/puppet/parser/functions/dns_array.rb @@ -26,6 +26,7 @@ uri = URI.parse("#{args[0]}apiapp=#{args[1]}&apitoken=#{args[2]}&domain=#{args[3]}") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true + http.ssl_version=:TLSv1_2 http.verify_mode = OpenSSL::SSL::VERIFY_NONE http.read_timeout = 30 request = Net::HTTP::Get.new(uri.request_uri)
Adjust ruby ssl settings to use TLSv1.2 for connection to web server
diff --git a/lib/nmap/run_stat.rb b/lib/nmap/run_stat.rb index abc1234..def5678 100644 --- a/lib/nmap/run_stat.rb +++ b/lib/nmap/run_stat.rb @@ -1,6 +1,8 @@ module Nmap # # Represents the runstats of a scan. + # + # @since 0.7.0 # class RunStat < Struct.new(:end_time, :elapsed, :summary, :exit_status)
Mark RunStat as being added in 0.7.0.
diff --git a/test/note_test.rb b/test/note_test.rb index abc1234..def5678 100644 --- a/test/note_test.rb +++ b/test/note_test.rb @@ -23,4 +23,16 @@ assert_equal @note_220.total_frames, @note_220.samples.length assert_equal @distorted_note.total_frames, @distorted_note.samples.length end + + def test_amplitude_range + @basic_note.samples.each do |sample| + assert sample.abs <= 1 + end + @note_220.samples.each do |sample| + assert sample.abs <= 1 + end + @distorted_note.samples.each do |sample| + assert sample.abs <= 1 + end + end end
Add test to verify amplitude range
diff --git a/test/teststrap.rb b/test/teststrap.rb index abc1234..def5678 100644 --- a/test/teststrap.rb +++ b/test/teststrap.rb @@ -26,4 +26,11 @@ $original_path = Dir.pwd +# Ensure that the pkg directory is clean before starting tests, but don't do it for every test. +if File.directory? "test/test_project/pkg" + puts "Deleting existing test outputs" + rm_r FileList["test/test_project/pkg/*"] +end + +
Delete existing test packages before testing.
diff --git a/processor/virtual.rb b/processor/virtual.rb index abc1234..def5678 100644 --- a/processor/virtual.rb +++ b/processor/virtual.rb @@ -16,6 +16,18 @@ class VirtualCmdProcessor attr_reader :settings def initialize(interfaces, settings={}) + @interfaces = interfaces + @intf = interfaces[-1] + @settings = settings + end + def errmsg(message) + puts "Error: #{message}" + end + def msg(message) + puts message + end + def section(message, opts={}) + puts "Section: #{message}" end end end
Add stripped down version of I/O routines. Sync with rbx-trepanning.
diff --git a/zabbixapi.gemspec b/zabbixapi.gemspec index abc1234..def5678 100644 --- a/zabbixapi.gemspec +++ b/zabbixapi.gemspec @@ -12,7 +12,7 @@ s.description = %q{Allows you to work with zabbix api from ruby.} s.licenses = %w(MIT) - s.add_dependency('json') + s.add_dependency('json', '~> 1.6', '>= 1.6.0') s.rubyforge_project = "zabbixapi"
Fix json version in gemspec
diff --git a/fex.gemspec b/fex.gemspec index abc1234..def5678 100644 --- a/fex.gemspec +++ b/fex.gemspec @@ -18,6 +18,7 @@ gem.require_paths = ["lib"] gem.add_dependency 'savon', '~> 2.0' + gem.add_development_dependency "rake" gem.add_development_dependency "rspec" gem.add_development_dependency "pry-nav" end
Add Rake as test dependency for Travis
diff --git a/clipp/tests/tc_regression.rb b/clipp/tests/tc_regression.rb index abc1234..def5678 100644 --- a/clipp/tests/tc_regression.rb +++ b/clipp/tests/tc_regression.rb @@ -31,4 +31,17 @@ ) assert_log_match /action "block" executed/ end + + def test_negative_content_length + request = <<-EOS + GET / HTTP/1.1 + Content-Length: -1 + + EOS + request.gsub!(/^\s+/,"") + clipp( + input_hashes: [simple_hash(request)], + input: "pb:- @parse @fillbody" + ) + end end
clipp: Add negative content length regression test.
diff --git a/app/controllers/index.rb b/app/controllers/index.rb index abc1234..def5678 100644 --- a/app/controllers/index.rb +++ b/app/controllers/index.rb @@ -0,0 +1,23 @@+get '/' do + erb :index +end + +get '/signout' do + session[:current_user] = nil + redirect '/' +end + +get "/auth" do + redirect client.auth_code.authorize_url(:redirect_uri => 'http://localhost:9393/callback',:scope => 'https://www.googleapis.com/auth/userinfo.email',:access_type => "offline") +end + +get '/callback' do + + access_token = client.auth_code.get_token(params[:code], :redirect_uri => 'http://localhost:9393/callback') + response = access_token.get('https://www.googleapis.com/oauth2/v1/userinfo?alt=json') + puts "START" + puts '*' * 40 + p user_info = JSON.parse(response.body) + #=> user_info is {"id"=>"108553686725590595849", "email"=>"nzeplowitz@gmail.com", "verified_email"=>true, "name"=>"Nathan Zeplowitz", "given_name"=>"Nathan", "family_name"=>"Zeplowitz", "link"=>"https://plus.google.com/108553686725590595849", "picture"=>"https://lh6.googleusercontent.com/-ljNCYRCxZ0g/AAAAAAAAAAI/AAAAAAAAAuk/r6hMRgwCzD0/photo.jpg", "gender"=>"male"} + puts "END" +end
Create Authentication HTTP Calls To Google Oauth
diff --git a/trade_client.gemspec b/trade_client.gemspec index abc1234..def5678 100644 --- a/trade_client.gemspec +++ b/trade_client.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = "cf-trade-client" - s.version = "0.2.0" + s.version = "0.2.1" s.summary = "Ruby Coinfloor Client" s.description = "Client to trade on the Coinfloor platform using their API." s.email = "development@coinfloor.co.uk"
Upgrade gem version due pushing problems
diff --git a/app/models/attachment.rb b/app/models/attachment.rb index abc1234..def5678 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -7,7 +7,7 @@ field :title field :filename - attaches :file, with_url_field: true + attaches :file, with_url_field: true, update_existing: true embedded_in :specialist_document_edition
Set Attachable update option on Attachments
diff --git a/app/models/configured.rb b/app/models/configured.rb index abc1234..def5678 100644 --- a/app/models/configured.rb +++ b/app/models/configured.rb @@ -26,7 +26,11 @@ def Configured.included base class << base def method_missing method, *args - Rails.application.config.send(self.name.split(/::/).last.gsub(/([a-z])([A-Z])/, '\1_\2').downcase)[method.to_s.gsub(/\?$/, '').to_sym] + if method.to_s.end_with? '=' + Rails.application.config.send(self.name.split(/::/).last.gsub(/([a-z])([A-Z])/, '\1_\2').downcase)[method.to_s.gsub(/\=$/, '').to_sym] = args.first + else + Rails.application.config.send(self.name.split(/::/).last.gsub(/([a-z])([A-Z])/, '\1_\2').downcase)[method.to_s.gsub(/\?$/, '').to_sym] + end end end end
Allow assignment of configuration values through Configurable module
diff --git a/app/models/layers_map.rb b/app/models/layers_map.rb index abc1234..def5678 100644 --- a/app/models/layers_map.rb +++ b/app/models/layers_map.rb @@ -4,4 +4,6 @@ class LayersMap < ActiveRecord::Base belongs_to :layer belongs_to :map + + validates_uniqueness_of :layer_id, :scope => :map_id, :message => "already has this map" end
Add validation for adding the same map to a layer
diff --git a/app/models/rubyforger.rb b/app/models/rubyforger.rb index abc1234..def5678 100644 --- a/app/models/rubyforger.rb +++ b/app/models/rubyforger.rb @@ -14,7 +14,7 @@ def self.transfer(email, password) if rubyforger = Rubyforger.find_by_email(email) if user = rubyforger.transferable?(password) - user.update_password(password, password) + user.update_password(password) user.confirm_email! rubyforger.destroy user
Make unit tests pass with new clearance version
diff --git a/Formula/weechat.rb b/Formula/weechat.rb index abc1234..def5678 100644 --- a/Formula/weechat.rb +++ b/Formula/weechat.rb @@ -11,7 +11,10 @@ def install #FIXME: Compiling perl module doesn't work #FIXME: GnuTLS support isn't detected - system "cmake", "-DDISABLE_PERL=ON", std_cmake_parameters, "." + #NOTE: -DPREFIX has to be specified because weechat devs enjoy being non-standard + system "cmake", "-DPREFIX=#{prefix}", + "-DDISABLE_PERL=ON", + std_cmake_parameters, "." system "make install" end end
Fix Weechat always installing to /usr/local The WeeChat devs don't know about CMAKE_INSTALL_PREFIX apparently, someone should tell them. I won't. I plan on just sitting back and shacking my head side-to-side instead.
diff --git a/spec/project_spec.rb b/spec/project_spec.rb index abc1234..def5678 100644 --- a/spec/project_spec.rb +++ b/spec/project_spec.rb @@ -48,4 +48,14 @@ expect(project.tasks).to match expected end end + + describe "#build_task" do + it "raises error when invalid date passed as due date" do + project = TaskHandler::Project.new + expect do + project.build_task(["test_project", "test_task", "2011-01-32"]) + end.to raise_error(ArgumentError) + end + end + end
Add test case to confirm raising error
diff --git a/spec/recalls_spec.rb b/spec/recalls_spec.rb index abc1234..def5678 100644 --- a/spec/recalls_spec.rb +++ b/spec/recalls_spec.rb @@ -29,7 +29,7 @@ to_return(:status => 401, :body => "Invalid API Key", :headers => {}) end - it "should return a hash with an error" do + it "should return an error" do response = USASearch.search response.is_a?(String).should be_true response.should == "Invalid API Key"
Change description of recalls spec.
diff --git a/spec/controllers/tags_controller_spec.rb b/spec/controllers/tags_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/tags_controller_spec.rb +++ b/spec/controllers/tags_controller_spec.rb @@ -20,12 +20,12 @@ describe "#show" do it "has a 200 status code" do - get :show, {id: 2} + get :show, {id: 5} expect(response.status).to eq(200) end it "renders show template" do - get :show, {id: 2} + get :show, {id: 5} expect(response).to render_template("show") end
Make change to comply with circle ci tests
diff --git a/lib/discordrb/voice/encoder.rb b/lib/discordrb/voice/encoder.rb index abc1234..def5678 100644 --- a/lib/discordrb/voice/encoder.rb +++ b/lib/discordrb/voice/encoder.rb @@ -1,4 +1,9 @@-require 'opus-ruby' +begin + require 'opus-ruby' + OPUS_AVAILABLE = true +rescue LoadError + OPUS_AVAILABLE = false +end # Discord voice chat support module Discordrb::Voice @@ -11,7 +16,12 @@ @frame_size = 960 @channels = 2 @volume = 1.0 - @opus = Opus::Encoder.new(@sample_rate, @frame_size, @channels) + + if OPUS_AVAILABLE + @opus = Opus::Encoder.new(@sample_rate, @frame_size, @channels) + else + fail LoadError, 'Opus unavailable - voice not supported! Please install opus for voice support to work.' + end end def encode(buffer)
Make the opus dependency optional
diff --git a/lib/facter/sendmail_version.rb b/lib/facter/sendmail_version.rb index abc1234..def5678 100644 --- a/lib/facter/sendmail_version.rb +++ b/lib/facter/sendmail_version.rb @@ -5,8 +5,9 @@ Facter.add(:sendmail_version) do setcode do begin - command = 'sendmail -d0.4 -ODontProbeInterfaces=true -bv root 2>/dev/null' - version = Facter::Core::Execution.execute(command, { :on_fail => nil }) + options = { :on_fail => nil, :timeout => 10 } + command = 'sendmail -d0.4 -ODontProbeInterfaces=true -bv root 2>/dev/null </dev/null' + version = Facter::Core::Execution.execute(command, options) if version =~ /^Version ([0-9.]+)$/ $1 else
Enforce timeout in facter execution of sendmail
diff --git a/lib/front_end_builds/engine.rb b/lib/front_end_builds/engine.rb index abc1234..def5678 100644 --- a/lib/front_end_builds/engine.rb +++ b/lib/front_end_builds/engine.rb @@ -14,15 +14,13 @@ app.middleware.insert_before(::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public") end - initializer "front_end_assets.assets.precompile" do |app| + initializer "front_end_assets.assets.precompile", group: :all do |app| app.config.assets.precompile += %w( front_end_builds/vendor.css front_end_builds/admin.css front_end_builds/vendor.js front_end_builds/admin.js - front_end_builds/fontawesome-webfont.woff ) - app.config.assets.precompile << /\.(?:svg|eot|woff|ttf)$/ end end end
Use `group: all` so initializer is triggered during asset comp.
diff --git a/lib/lokka/models/similarity.rb b/lib/lokka/models/similarity.rb index abc1234..def5678 100644 --- a/lib/lokka/models/similarity.rb +++ b/lib/lokka/models/similarity.rb @@ -3,9 +3,8 @@ class Similarity include DataMapper::Resource - property :id, Serial - property :entry_id, Integer - property :similar_entry_id, Integer + property :entry_id, Integer, key: true + property :similar_entry_id, Integer, key: true property :score, Float belongs_to :entry
Drop id column from similarities
diff --git a/lib/paypal/express/response.rb b/lib/paypal/express/response.rb index abc1234..def5678 100644 --- a/lib/paypal/express/response.rb +++ b/lib/paypal/express/response.rb @@ -6,6 +6,7 @@ def initialize(response, options = {}) super response @pay_on_paypal = options[:pay_on_paypal] + @mobile = options[:mobile] end def redirect_uri @@ -24,8 +25,9 @@ def query(with_cmd = false) _query_ = {:token => self.token} - _query_.merge!(:cmd => '_express-checkout') if with_cmd - _query_.merge!(:useraction => 'commit') if pay_on_paypal + _query_.merge!(:cmd => '_express-checkout') if with_cmd + _query_.merge!(:cmd => '_express-checkout-mobile') if mobile + _query_.merge!(:useraction => 'commit') if pay_on_paypal _query_ end end
Allow override of cmd to enable forcing _express-checkout-mobile
diff --git a/lib/pycall/pyobject_wrapper.rb b/lib/pycall/pyobject_wrapper.rb index abc1234..def5678 100644 --- a/lib/pycall/pyobject_wrapper.rb +++ b/lib/pycall/pyobject_wrapper.rb @@ -1,5 +1,36 @@ module PyCall module PyObjectWrapper + module ClassMethods + private + + def wrap_class(pyobj) + define_singleton_method(:__pyobj__) { pyobj } + + PyCall.dir(__pyobj__).each do |name| + obj = PyCall.getattr(__pyobj__, name) + next unless obj.kind_of?(PyCall::PyObject) || obj.kind_of?(PyCall::PyObjectWrapper) + next unless PyCall.callable?(obj) + + define_method(name) do |*args, **kwargs| + PyCall.getattr(__pyobj__, name).(*args, **kwargs) + end + end + + class << self + def method_missing(name, *args, **kwargs) + return super unless PyCall.hasattr?(__pyobj__, name) + PyCall.getattr(__pyobj__, name) + end + end + + PyCall::Conversions.python_type_mapping(__pyobj__, self) + end + end + + def self.included(mod) + mod.extend ClassMethods + end + def initialize(pyobj, pytype=nil) check_type pyobj, pytype pytype ||= LibPython.PyObject_Type(pyobj)
Add wrap_class class method or a subclass of PyObjectWrapper
diff --git a/lib/resume_generator/header.rb b/lib/resume_generator/header.rb index abc1234..def5678 100644 --- a/lib/resume_generator/header.rb +++ b/lib/resume_generator/header.rb @@ -13,6 +13,9 @@ def initialize(pdf, data) @pdf = pdf @data = data + # Different rendering behaviour needed depending on whether the header is + # being drawn from left to right on the page or specifically placed at + # a location if data[:at] extend FormattedTextBoxEntry else
Add comment indicating reasoning for dynamic module inclusion
diff --git a/jam.gemspec b/jam.gemspec index abc1234..def5678 100644 --- a/jam.gemspec +++ b/jam.gemspec @@ -2,8 +2,12 @@ # project in your rails apps through git. Gem::Specification.new do |s| s.name = "jam.rb" + s.version = "0.0.3" + s.platform = Gem::Platform::RUBY + s.authors = ["Eduard Tsech"] + s.email = ["edtsech@gmail.com"] + s.homepage = "" s.summary = "JSON Api Maker." s.description = "JSON Api Maker." s.files = Dir["{app,lib,config}/**/*"] + ["MIT-LICENSE", "Rakefile", "Gemfile", "README.rdoc"] - s.version = "0.0.2" end
Add Some info into gemspec
diff --git a/atspi_app_driver.gemspec b/atspi_app_driver.gemspec index abc1234..def5678 100644 --- a/atspi_app_driver.gemspec +++ b/atspi_app_driver.gemspec @@ -13,7 +13,7 @@ 'README.md', 'LICENSE', 'Rakefile', - 'gems.rb' + 'Gemfile' ] s.add_dependency('gir_ffi', ['~> 0.8.0'])
Fix file list due to rename of gems.rb
diff --git a/spec/curb_spec.rb b/spec/curb_spec.rb index abc1234..def5678 100644 --- a/spec/curb_spec.rb +++ b/spec/curb_spec.rb @@ -4,12 +4,24 @@ unless RUBY_PLATFORM =~ /java/ require 'curb_spec_helper' + describe "Curb", :shared => true do + include CurbSpecHelper + + it_should_behave_like "WebMock" + + describe "when doing PUTs" do + it "should stub them" do + stub_http_request(:put, "www.example.com").with(:body => "put_data") + http_request(:put, "http://www.example.com", + :body => "put_data").status.should == "200" + end + end + end + describe "Webmock with Curb" do describe "using dynamic #http for requests" do - include CurbSpecHelper + it_should_behave_like "Curb" include CurbSpecHelper::DynamicHttp - - it_should_behave_like "WebMock" it "should work with uppercase arguments" do stub_request(:get, "www.example.com").to_return(:body => "abc") @@ -22,17 +34,13 @@ end describe "using named #http_* methods for requests" do - include CurbSpecHelper + it_should_behave_like "Curb" include CurbSpecHelper::NamedHttp - - it_should_behave_like "WebMock" end describe "using named #perform for requests" do - include CurbSpecHelper + it_should_behave_like "Curb" include CurbSpecHelper::Perform - - it_should_behave_like "WebMock" end end end
Add failing spec for PUTs and some DRY cleanup.
diff --git a/spec/post_spec.rb b/spec/post_spec.rb index abc1234..def5678 100644 --- a/spec/post_spec.rb +++ b/spec/post_spec.rb @@ -9,7 +9,7 @@ end before do - config = Hashie::Mash.new(layouts: { post: 'post' }) + config = Dimples::Configuration.prepare({}) allow(site).to receive(:config).and_return(config) end @@ -19,6 +19,24 @@ expect(subject.metadata[:slug]).to eq('hello') expect(subject.metadata[:layout]).to eq('post') expect(subject.metadata[:categories]).to eq(%w[personal dog]) + end + end + + describe '#url' do + context 'when the post is a draft' do + before { subject.draft = true } + + it 'returns the draft URL' do + expect(subject.url).to eq('/archives/drafts/2018/01/01/hello/') + end + end + + context 'when the post is final' do + before { subject.draft = false } + + it 'returns the proper URL' do + expect(subject.url).to eq('/archives/2018/01/01/hello/') + end end end
Switch to the config module, and add tests for the url method
diff --git a/lib/rack/dev-mark/theme/github_fork_ribbon.rb b/lib/rack/dev-mark/theme/github_fork_ribbon.rb index abc1234..def5678 100644 --- a/lib/rack/dev-mark/theme/github_fork_ribbon.rb +++ b/lib/rack/dev-mark/theme/github_fork_ribbon.rb @@ -29,7 +29,7 @@ EOS html. sub("</head>", "#{style_tag_str.strip}</head>"). - sub /(<body[^>]*>)/i, "\\1#{div_tag_str.strip}" + sub(/(<body[^>]*>)/, "\\1#{div_tag_str.strip}") end end end
Fix ambiguous regular expression literal
diff --git a/sprockets.gemspec b/sprockets.gemspec index abc1234..def5678 100644 --- a/sprockets.gemspec +++ b/sprockets.gemspec @@ -1,8 +1,8 @@ Gem::Specification.new do |s| s.name = "sprockets" s.version = "2.0.0" - s.summary = "JavaScript dependency management and concatenation" - s.description = "Sprockets is a Ruby library that preprocesses and concatenates JavaScript source files." + s.summary = "Rack-based asset packaging system" + s.description = "Sprockets is a Rack-based asset packaging system that concatenates and serves JavaScript, CoffeeScript, CSS, LESS, Sass, and SCSS." s.files = Dir["Rakefile", "lib/**/*"]
Update gemspec summary and description
diff --git a/sprockets.gemspec b/sprockets.gemspec index abc1234..def5678 100644 --- a/sprockets.gemspec +++ b/sprockets.gemspec @@ -10,9 +10,9 @@ s.add_dependency "rack", "~> 1.0" s.add_dependency "tilt", "~> 1.0" - s.add_development_dependency "execjs", "~> 0.4" - s.add_development_dependency "coffee-script", "~> 1.0" - s.add_development_dependency "ejs", "~> 1.0" + s.add_development_dependency "execjs" + s.add_development_dependency "coffee-script" + s.add_development_dependency "ejs" s.authors = ["Sam Stephenson", "Joshua Peek"] s.email = "sstephenson@gmail.com"
Kill requirements on dev deps
diff --git a/rf-rest-open-uri.gemspec b/rf-rest-open-uri.gemspec index abc1234..def5678 100644 --- a/rf-rest-open-uri.gemspec +++ b/rf-rest-open-uri.gemspec @@ -18,5 +18,6 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] + spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" end
Add bundler as a development dependency
diff --git a/cavalry.gemspec b/cavalry.gemspec index abc1234..def5678 100644 --- a/cavalry.gemspec +++ b/cavalry.gemspec @@ -20,8 +20,8 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_dependency "activemodel", "~> 6.0" - spec.add_dependency "activesupport", "~> 6.0" + spec.add_dependency "activemodel", ">= 5.1" + spec.add_dependency "activesupport", ">= 5.1" spec.add_development_dependency "bundler", "~> 1.15" spec.add_development_dependency "rake", "~> 10.0" spec.add_development_dependency "rspec", "~> 3.0"
Fix required activemodel version from ~> 5.1 to >= 6.0
diff --git a/dartium.rb b/dartium.rb index abc1234..def5678 100644 --- a/dartium.rb +++ b/dartium.rb @@ -9,7 +9,7 @@ devel do version '1.7.0-dev.4.6' - url 'https://storage.googleapis.com/dart-archive/channels/dev/releagithubse/41090/dartium/dartium-macos-ia32-release.zip' + url 'https://storage.googleapis.com/dart-archive/channels/dev/release/41090/dartium/dartium-macos-ia32-release.zip' sha256 'a4476ed9dc1f540ada173d83c3104d382094914ff431c09493077a2326406a6c' end
Remove stray characters from auto-generated formula.
diff --git a/lib/dmtx.rb b/lib/dmtx.rb index abc1234..def5678 100644 --- a/lib/dmtx.rb +++ b/lib/dmtx.rb @@ -10,23 +10,29 @@ def initialize(text = nil) @text = text - @enc = DmtxLib.dmtxEncodeCreate() - DmtxLib.dmtxEncodeSetProp(@enc, :DmtxPropPixelPacking, :DmtxPack24bppRGB) - DmtxLib.dmtxEncodeSetProp(@enc, :DmtxPropSizeRequest, :DmtxSymbolSquareAuto) end def write raise NoText, "please provide a text to encode" unless text raise NoFile, "please provide an output file" unless file + chunky_png_image.save(file, :fast_rgb) + end - DmtxLib.dmtxEncodeDataMatrix(@enc, text.length, text) - dmtx_encode = DmtxLib::DmtxEncode.new(@enc) +private + + def chunky_png_image + encoder = DmtxLib.dmtxEncodeCreate() + DmtxLib.dmtxEncodeSetProp(encoder, :DmtxPropPixelPacking, :DmtxPack24bppRGB) + DmtxLib.dmtxEncodeSetProp(encoder, :DmtxPropSizeRequest, :DmtxSymbolSquareAuto) + + DmtxLib.dmtxEncodeDataMatrix(encoder, text.length, text) + dmtx_encode = DmtxLib::DmtxEncode.new(encoder) computed_width = DmtxLib.dmtxImageGetProp(dmtx_encode[:image], :DmtxPropWidth) computed_height = DmtxLib.dmtxImageGetProp(dmtx_encode[:image], :DmtxPropHeight) dmtx_image = DmtxLib::DmtxImage.new(dmtx_encode[:image]) - image = ChunkyPNG::Image.from_rgb_stream(computed_width, computed_height, dmtx_image[:pxl].read_string_length(computed_height*computed_width*3)) - image.save(file, :fast_rgb) + ChunkyPNG::Image.from_rgb_stream(computed_width, computed_height, dmtx_image[:pxl].read_string_length(computed_height*computed_width*3)) end + end
Create a new DmtxEncode each time we write It looks like calling dmtxEncodeDataMatrix more than once on the same DmtxEncode leaks memory.
diff --git a/lib/grid.rb b/lib/grid.rb index abc1234..def5678 100644 --- a/lib/grid.rb +++ b/lib/grid.rb @@ -1,8 +1,8 @@ class Grid - def initialize(window, user, mapfile, tileset, map_key) + def initialize(window, user, mapfile, tileset) @window, @user = window, user - @map = Map.new(window, mapfile, tileset, map_key) + @map = Map.new(window, mapfile, tileset) end def draw
Remove map_key as a parameter for Grid
diff --git a/app/models/cart.rb b/app/models/cart.rb index abc1234..def5678 100644 --- a/app/models/cart.rb +++ b/app/models/cart.rb @@ -1,6 +1,6 @@ class Cart < ApplicationRecord belongs_to :user - belongs_to :variant, dependent: :destroy + belongs_to :variant validates_presence_of :quantity, :size
Fix косяка, при попытке удаления товара из корзины, удалялся вариант.
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 @@ -11,4 +11,11 @@ has_many :listings has_many :followed_listings, dependent: :destroy has_many :donation_applications, dependent: :destroy + + before_create :set_account_type + + # TODO Allow user to select default account type + def set_account_type + self.account_type = "organization" + end end
Fix account type not being set by default
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,7 @@ devise :database_authenticatable, :registerable, :recoverable, :rememberable, :confirmable, :validatable - enum locale: [:de, :en] + enum locale: { de: 0, en: 1 } has_secure_token :api_token #That's a rails feature!
Change locale enum to hash with integers
diff --git a/watir/all_tests.rb b/watir/all_tests.rb index abc1234..def5678 100644 --- a/watir/all_tests.rb +++ b/watir/all_tests.rb @@ -9,5 +9,5 @@ require "./test_installation.rb" require "./test_international.rb" require "./test_backup.rb" -require "./test_users.rb" +# require "./test_users.rb"
Remove failing test just to see
diff --git a/wrap_excel.gemspec b/wrap_excel.gemspec index abc1234..def5678 100644 --- a/wrap_excel.gemspec +++ b/wrap_excel.gemspec @@ -7,7 +7,7 @@ s.version = WrapExcel::VERSION s.authors = ["tomi"] s.email = ["tomiacannondale@gmail.com"] - s.homepage = "" + s.homepage = "https://github.com/tomiacannondale/wrap_excel" s.summary = "WrapExcel is a wrapper library that specializes in the operation of Excel win32ole." s.description = "WrapExcel is to wrap the win32ole, and easy to use Excel operations with ruby. Detailed description please see the README."
Add homepage address of gemspec.
diff --git a/db/migrate/20130311140347_create_continuous_trait_values.rb b/db/migrate/20130311140347_create_continuous_trait_values.rb index abc1234..def5678 100644 --- a/db/migrate/20130311140347_create_continuous_trait_values.rb +++ b/db/migrate/20130311140347_create_continuous_trait_values.rb @@ -1,7 +1,6 @@ class CreateContinuousTraitValues < ActiveRecord::Migration def change create_table :continuous_trait_values do |t| - t.integer :position t.references :otu t.references :continuous_trait t.float
Remove position from continuous trait
diff --git a/lib/puppet-swagger-generator/files/swagger/fuzzy_compare.rb b/lib/puppet-swagger-generator/files/swagger/fuzzy_compare.rb index abc1234..def5678 100644 --- a/lib/puppet-swagger-generator/files/swagger/fuzzy_compare.rb +++ b/lib/puppet-swagger-generator/files/swagger/fuzzy_compare.rb @@ -16,7 +16,7 @@ tests = normalized_should.keys.collect do |key| if [String, Fixnum].include? normalized_is[key].class normalized_is[key].to_s == normalized_should[key].to_s - elsif + else normalized_is[key].collect do |is_value| normalized_should[key].collect do |should_value| diff = if is_value.class == Hash
Fix bug in sync detection
diff --git a/Ruby/LeaderBoard/spec/leader_board_spec.rb b/Ruby/LeaderBoard/spec/leader_board_spec.rb index abc1234..def5678 100644 --- a/Ruby/LeaderBoard/spec/leader_board_spec.rb +++ b/Ruby/LeaderBoard/spec/leader_board_spec.rb @@ -0,0 +1,29 @@+require_relative '../leader_board' +require_relative '../race' +require_relative '../driver' +require_relative '../self_driving_car' +describe LeaderBoard do + before :each do + @driver_1 = Driver.new("Nico Rosberg", "DE") + @driver_2 = Driver.new("Lewis Hamilton", "UK") + @driver_3 = Driver.new("Sebastian Vettel", "DE") + @driver_4 = SelfDrivingCar.new("1.2", "ACME") + + @race_1 = Race.new("Australian Grand Prix", [@driver_1, @driver_2, @driver_3]) + @race_2 = Race.new("Malaysian Grand Prix", [@driver_3, @driver_2, @driver_1]) + @race_3 = Race.new("Chinese Grand Prix", [@driver_2, @driver_1, @driver_3]) + @race_4 = Race.new("Fictional Grand Prix", [@driver_1, @driver_2, @driver_4]) + @race_5 = Race.new("Fictional Grand Prix", [@driver_4, @driver_2, @driver_1]) + @driver_4.algorithm_version = "1.3" + @race_6 = Race.new("Fictional Grand Prix", [@driver_2, @driver_1, @driver_4]) + + @sample_leaderboard_1 = LeaderBoard.new([@race_1, @race_2, @race_3]) + @sample_leaderboard_2 = LeaderBoard.new([@race_4, @race_5, @race_6]) + end + + context "#winner" do + it "returns the driver with the most points" do + expect(@sample_leaderboard_1.driver_rankings.first).to eq("Lewis Hamilton") + end + end +end
Test for the winner method
diff --git a/tachikoma.gemspec b/tachikoma.gemspec index abc1234..def5678 100644 --- a/tachikoma.gemspec +++ b/tachikoma.gemspec @@ -20,7 +20,7 @@ spec.add_dependency 'safe_yaml' spec.add_dependency 'rake' - spec.add_dependency 'octokit', '< 3' + spec.add_dependency 'octokit', '>= 2', '< 3' spec.add_dependency 'json' spec.add_development_dependency 'bundler', '~> 1.3'
Add lower limit for octokit version
diff --git a/spec/gilded_rose_spec.rb b/spec/gilded_rose_spec.rb index abc1234..def5678 100644 --- a/spec/gilded_rose_spec.rb +++ b/spec/gilded_rose_spec.rb @@ -1,4 +1,4 @@-require './gilded_rose.rb' +require './gilded_rose' RSpec.describe GildedRose do
Remove unnecessary `.rb` extension in require statement
diff --git a/spec/signrequest_spec.rb b/spec/signrequest_spec.rb index abc1234..def5678 100644 --- a/spec/signrequest_spec.rb +++ b/spec/signrequest_spec.rb @@ -0,0 +1,81 @@+require 'spec_helper' + +describe SignRequest do + it 'has a version number' do + expect(SignRequest::VERSION).not_to be nil + end + + describe SignRequest::API do + describe '.authenticate' do + User = Struct.new(:username, :password, :subdomain) + valid = User.new('', '', '') + invalid = User.new('email', 'passwd', 'subdomain') + null = User.new(nil, nil, '') + + context 'when providing an invalid username and password combination' do + response = SignRequest::API.authenticate(invalid.username, + invalid.password, + invalid.subdomain) + + it 'returns a response code of 403 Forbidden' do + expect(response['code']).to eq(403) + end + + it 'returns a response body indicating invalid credentials' do + expect(response['body']['detail']).to eq( + 'Invalid username/password.' + ) + end + end + + context 'when providing a valid username and password combination' do + context 'with an invalid subdomain' do + response = SignRequest::API.authenticate(valid.username, + valid.password, + invalid.subdomain) + + it 'returns a response of 403' do + expect(response['code']).to eq(403) + end + + it 'returns a response body indicating ' do + end + end + + context 'with valid credentials for basic authentication' do + response = SignRequest::API.authenticate(valid.username, + valid.password, + valid.subdomain) + + it 'returns a response code of 201' do + expect(response['code']).to eq(201) + end + + it 'returns a response body with a token object, and a created object' do + expect(response['body']).to match( + 'token' => a_string_matching(/^[0-9a-zA-Z]*$/), + 'created' => true + ) + end + end + + context 'with no subdomain' do + response = SignRequest::API.authenticate(valid.username, + valid.password, + null.subdomain) + it 'returns a response code of 400' do + expect(response['code']).to eq(400) + end + + it 'returns a response body indicating subdomain as origin of BadRequest' do + expect(response['body']).to match( + 'subdomain' => a_collection_containing_exactly( + a_string_matching(/This field may not be blank./) + ) + ) + end + end + end + end + end +end
Remove unnecessary require 'json' from specs.
diff --git a/spec/tasks/reset_spec.rb b/spec/tasks/reset_spec.rb index abc1234..def5678 100644 --- a/spec/tasks/reset_spec.rb +++ b/spec/tasks/reset_spec.rb @@ -11,7 +11,6 @@ Question.count.should_not eq(0) end it "properly associates Questions with VoiceFiles" do - binding.pry Question.all.each do |q| q.voice_file.should eq(VoiceFile.find_by_short_name(q.short_name)) end
Remove pry statement from Rake task
diff --git a/SKStatefulTableViewController.podspec b/SKStatefulTableViewController.podspec index abc1234..def5678 100644 --- a/SKStatefulTableViewController.podspec +++ b/SKStatefulTableViewController.podspec @@ -9,7 +9,7 @@ } s.source = { :git => 'https://github.com/shiki/SKStatefulTableViewController.git', - :tag => '0.0.12' + :tag => s.version.to_s } s.platform = :ios, "7.1" s.source_files = 'SKStatefulTableViewController/*.{h,m}'
Fix for :tag value in podspec
diff --git a/gh.gemspec b/gh.gemspec index abc1234..def5678 100644 --- a/gh.gemspec +++ b/gh.gemspec @@ -20,7 +20,11 @@ s.add_runtime_dependency 'faraday', '~> 0.8' s.add_runtime_dependency 'backports' s.add_runtime_dependency 'multi_json', '~> 1.0' - s.add_runtime_dependency 'addressable' + if RUBY_VERSION < '2.0' + s.add_runtime_dependency 'addressable', '~> 2.4.0' + else + s.add_runtime_dependency 'addressable' + end s.add_runtime_dependency 'net-http-persistent', '>= 2.7' s.add_runtime_dependency 'net-http-pipeline' end
Fix old Rubies on old addressable
diff --git a/MSSocialKit.podspec b/MSSocialKit.podspec index abc1234..def5678 100644 --- a/MSSocialKit.podspec +++ b/MSSocialKit.podspec @@ -10,8 +10,8 @@ s.author = { "Devon Tivona" => "devon@monospacecollective.com" } s.source = { :git => 'https://github.com/monospacecollective/MSSocialKit.git', :tag => s.version.to_s } - s.source_files = 'MSSocialKit/*.{h,m,xcdatamodeld}' - s.resources = 'MSSocialKit/*.{png}' + s.source_files = 'MSSocialKit/*.{h,m}' + s.resources = 'MSSocialKit/*.{png,xcdatamodeld}' s.requires_arc = true
Revert "Moves data model from resource to source" This reverts commit b4b97ec6d092249f6882a485b6b6e4918ff8085c.
diff --git a/db/seeds/001-hets.rb b/db/seeds/001-hets.rb index abc1234..def5678 100644 --- a/db/seeds/001-hets.rb +++ b/db/seeds/001-hets.rb @@ -1,3 +1,7 @@-Sidekiq::Testing.disable! do +if Rails.env.production? RakeHelper::Hets.create_instances +else + Sidekiq::Testing.disable! do + RakeHelper::Hets.create_instances + end end
Fix NameError in seeds for production mode.
diff --git a/lib/import_o_matic/logger.rb b/lib/import_o_matic/logger.rb index abc1234..def5678 100644 --- a/lib/import_o_matic/logger.rb +++ b/lib/import_o_matic/logger.rb @@ -7,11 +7,13 @@ "#{timestamp.to_formatted_s(:db)} #{severity} #{msg}\n" end - def initialize object_name + def initialize object_name, max_logs = 10 object_name.gsub!('/', '_') self.counters = {} log_dir = "log/importations/#{object_name}" FileUtils.mkdir_p(log_dir) unless File.directory?(log_dir) + # Remove all logs unless max_logs -1 and create a new one + clear_logs log_dir, max_logs.pred timestamp = Time.now.utc.iso8601.gsub(/\W/, '') file_name = "#{timestamp}_#{object_name}_import.log" super self.path = "#{log_dir}/#{file_name}" @@ -35,6 +37,14 @@ self.error "\t#{text}" self.error "\t#{item.errors.full_messages.to_sentence}" end + + protected + + def clear_logs dir, max_logs + old_logs = Dir.glob("#{dir}/*").sort_by { |path| File.mtime(path) }.reverse + old_logs.shift(max_logs) if max_logs > 0 + File.delete(*old_logs) + end end end
Add old logs clear method
diff --git a/lib/marshalled_attributes.rb b/lib/marshalled_attributes.rb index abc1234..def5678 100644 --- a/lib/marshalled_attributes.rb +++ b/lib/marshalled_attributes.rb @@ -6,7 +6,7 @@ module SingletonMethods - def marshalled_attribute(*args) + def marshal(*args) args.each do |arg| define_method arg do Marshal.load(self[arg])
Make code consistent with docs
diff --git a/app/controllers/answers_controller.rb b/app/controllers/answers_controller.rb index abc1234..def5678 100644 --- a/app/controllers/answers_controller.rb +++ b/app/controllers/answers_controller.rb @@ -5,18 +5,10 @@ @question = Question.find(params[:question_id]) end - def new - @answer = Answer.find(params[:id]) - @question = @answer.question - - render 'new', locals: {answer: @answer, question: @question} - - end - def create question = Question.find(params[:question_id]) answer = question.answers.create(answers_params) - redirect_to question_path(question, "answers" => answer.id) + redirect_to question_path(question) end def edit
Remove unnecessary param from redirect.
diff --git a/app/controllers/flights_controller.rb b/app/controllers/flights_controller.rb index abc1234..def5678 100644 --- a/app/controllers/flights_controller.rb +++ b/app/controllers/flights_controller.rb @@ -16,7 +16,6 @@ if @search.valid? @flights = @search.generate_flights - p @flights if request.xhr? render :'flights/search_results', layout: false else
Remove print from FLight controller
diff --git a/app/controllers/recipes_controller.rb b/app/controllers/recipes_controller.rb index abc1234..def5678 100644 --- a/app/controllers/recipes_controller.rb +++ b/app/controllers/recipes_controller.rb @@ -20,14 +20,16 @@ api = NutritionIx.new(params[:recipe][:search]) if api.errors? - flash[:error] = klass.errors + flash[:error] = api.messages + @foods = Food.all + @search_foods = [] else @search_foods = Food.find_or_create_from_api(api.foods) @recipe.foods << @search_foods flash[:success] = t ".search.success" + @foods = Food.all - @search_foods end - @foods = Food.all - @search_foods render :new elsif params[:commit] == "Create Recipe"
Fix error if food search is empty in new recipe form
diff --git a/config/schedule.rb b/config/schedule.rb index abc1234..def5678 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -0,0 +1,6 @@+set :output, {:error => 'log/cron.error.log', :standard => 'log/cron.log'} +job_type :run_script, 'cd :path && RAILS_ENV=:environment script/:task' + +every 15.minutes do + run_script "relatedness.sh" +end
Update the relatedness graph every 15 minutes
diff --git a/app/uploaders/static_file_uploader.rb b/app/uploaders/static_file_uploader.rb index abc1234..def5678 100644 --- a/app/uploaders/static_file_uploader.rb +++ b/app/uploaders/static_file_uploader.rb @@ -1,6 +1,8 @@ class StaticFileUploader < BaseUploader include CarrierWave::MiniMagick + + def store_dir; "uploads/sf/#{model.id}" end version :thumb, if: :image? do process resize_to_fill: [32, 32]
Change store dir for static files
diff --git a/lib/ubuntu_unused_kernels.rb b/lib/ubuntu_unused_kernels.rb index abc1234..def5678 100644 --- a/lib/ubuntu_unused_kernels.rb +++ b/lib/ubuntu_unused_kernels.rb @@ -9,7 +9,10 @@ current = get_current PACKAGE_PREFIXES.each do |prefix| - latest = packages.select { |package| package.start_with?(prefix) }.last + latest = packages.sort.select { |package| + package.start_with?(prefix) + }.last + packages.delete(latest) packages.delete("#{prefix}-#{current}") end
Implement order handling in to_remove Just in case `dpkg` ever gives us unordered results. We can't rely on the latest being at the end.
diff --git a/Casks/cloudup.rb b/Casks/cloudup.rb index abc1234..def5678 100644 --- a/Casks/cloudup.rb +++ b/Casks/cloudup.rb @@ -4,7 +4,7 @@ url 'https://updates.cloudup.com/update?os=osx&app=Cloudup&format=zip&channel=release' homepage 'https://cloudup.com/download' - license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder + license :freemium app 'Cloudup.app' end
Update Cloudup.app license to Freemium.
diff --git a/Casks/jumpcut.rb b/Casks/jumpcut.rb index abc1234..def5678 100644 --- a/Casks/jumpcut.rb +++ b/Casks/jumpcut.rb @@ -3,6 +3,6 @@ homepage 'http://jumpcut.sourceforge.net/' version '0.63' sha1 '6ac88694f84b549f87c7c20bbf028f1d174d9e40' - link :app, 'Jumpcut.app' + link 'Jumpcut.app' end
Remove :app designation from Jumpcut link
diff --git a/Casks/rstudio.rb b/Casks/rstudio.rb index abc1234..def5678 100644 --- a/Casks/rstudio.rb +++ b/Casks/rstudio.rb @@ -1,6 +1,6 @@ cask :v1 => 'rstudio' do - version '0.99.484' - sha256 '5a7a9fc8559a653d38402aadbd7c1a8c726dfdf193ed5394c29fbfa9a4608b2b' + version '0.99.485' + sha256 '2125e01171b814f709c9c06d5baea4e7e895e7ae926657cdcc618de869e98413' # rstudio.org is the official download host per the vendor homepage url "http://download1.rstudio.org/RStudio-#{version}.dmg"
Upgrade RStudio to 0.99.485: fix Safari 9 bug There's a bug introduced with the change to Safari 9 and/or El Capitan where RStudio crashes when changing project. For reference, the specific issue is rstudio/rstudio#505.
diff --git a/Deferred.podspec b/Deferred.podspec index abc1234..def5678 100644 --- a/Deferred.podspec +++ b/Deferred.podspec @@ -8,7 +8,7 @@ 'Giles Van Gruisen' => 'giles@vangruisen.com', } spec.source = { :git => 'https://github.com/remarkableio/Deferred.git', :tag => "v#{spec.version}" } - spec.source_files = 'Source/**/*.{h,swift}' + spec.source_files = '**/*.{h,swift}' spec.requires_arc = true spec.ios.deployment_target = '8.0' end
Fix source files in podspec
diff --git a/Dopamine.podspec b/Dopamine.podspec index abc1234..def5678 100644 --- a/Dopamine.podspec +++ b/Dopamine.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Dopamine" - s.version = "0.0.1" + s.version = "0.1.0" s.summary = "A Swift client for http://usedopamine.com/" s.description = <<-DESC
Make podspec version match the defined version
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -9,7 +9,6 @@ version '5.10.2' supports 'centos', '~> 7.0' -supports 'centos', '~> 8.0' supports 'centos_stream', '~> 8.0' depends 'composer'
Remove CentOS 8 in favor of CentOS Stream 8 Signed-off-by: Lance Albertson <3161cdc7bf197e4c3a35b9cbe358c79910f27e90@osuosl.org>
diff --git a/econfig.gemspec b/econfig.gemspec index abc1234..def5678 100644 --- a/econfig.gemspec +++ b/econfig.gemspec @@ -11,6 +11,7 @@ gem.description = %q{Flexible configuration for Ruby/Rails applications with a variety of backends} gem.summary = %q{Congifure Ruby apps} gem.homepage = "https://github.com/elabs/econfig" + gem.license = "MIT" gem.files = `git ls-files`.split($/) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
Document project license in gemspec
diff --git a/Snippets.podspec b/Snippets.podspec index abc1234..def5678 100644 --- a/Snippets.podspec +++ b/Snippets.podspec @@ -2,7 +2,7 @@ spec.name = 'Snippets' spec.version = '0.1.14' spec.summary = 'Snippets in Swift' - spec.description = <<-DESCRIPTION + spec.description = <<-DESCRIPTION.gsub(/\s+/, ' ').chomp A collection of Swift snippets for enhancing standard Apple frameworks. The snippets have no non-standard dependencies, by design. DESCRIPTION
Clean up Pod description whitespace
diff --git a/lib/rom/support/data_proxy.rb b/lib/rom/support/data_proxy.rb index abc1234..def5678 100644 --- a/lib/rom/support/data_proxy.rb +++ b/lib/rom/support/data_proxy.rb @@ -0,0 +1,51 @@+module ROM + module DataProxy + attr_reader :data, :header, :tuple_proc + + NON_FORWARDABLE = [ + :each, :to_a, :to_ary, :kind_of?, :instance_of?, :is_a? + ].freeze + + def self.included(klass) + klass.class_eval do + extend ClassMethods + include Equalizer.new(:data) + end + end + + def initialize(data, header, tuple_proc = self.class.tuple_proc) + @data = data + @header = header + @tuple_proc = tuple_proc + end + + def each + return to_enum unless block_given? + data.each { |tuple| yield(tuple_proc[tuple]) } + end + + module ClassMethods + def tuple_proc + -> tuple { tuple } + end + + def forward(*methods) + (Array(methods).flatten - NON_FORWARDABLE).each do |method_name| + class_eval <<-RUBY, __FILE__, __LINE__ + 1 + def #{method_name}(*args, &block) + response = data.public_send(#{method_name.inspect}, *args, &block) + + if response.equal?(data) + self + elsif response.is_a?(data.class) + self.class.new(response, header, tuple_proc) + else + response + end + end + RUBY + end + end + end + end +end
Move DataProxy to support dir
diff --git a/lib/ruby-progressbar/timer.rb b/lib/ruby-progressbar/timer.rb index abc1234..def5678 100644 --- a/lib/ruby-progressbar/timer.rb +++ b/lib/ruby-progressbar/timer.rb @@ -6,7 +6,7 @@ :stopped_at def initialize(options = {}) - self.time = options[:time] || Time.new + self.time = options[:time] || ::ProgressBar::Time.new end def start
Change: Make Extra Sure We're Not Loading Ruby's Time Class
diff --git a/lib/tasks/markus_general.rake b/lib/tasks/markus_general.rake index abc1234..def5678 100644 --- a/lib/tasks/markus_general.rake +++ b/lib/tasks/markus_general.rake @@ -3,10 +3,12 @@ namespace :dev do RAILS_ENV="development" desc "Resets a MarkUs installation. Useful for developers. This is just a rake repos:drop && rake db:reset && rake db:populate" - task(:reset => [:environment, :"repos:drop", :"db:reset", :"db:populate"]) do - print("Resetting development environment of MarkUs...") - # nothing to do here - puts(" done!") + task(:reset => :environment) do + Rake::Task['repos:drop'].invoke # drop repositories + Rake::Task['db:reset'].invoke # reset the DB + sleep(2) # need to sleep a little, otherwise the reset doesn't seem to work + Rake::Task['db:populate'].invoke # repopulate DB + puts("Resetting development environment of MarkUs finished!") end end
Fix markus:dev:reset rake task. See review 523.
diff --git a/Casks/data-science-studio.rb b/Casks/data-science-studio.rb index abc1234..def5678 100644 --- a/Casks/data-science-studio.rb +++ b/Casks/data-science-studio.rb @@ -1,6 +1,6 @@ cask :v1 => 'data-science-studio' do - version '1.4.4' - sha256 'bea67d377bc4df2ac109bda21b3e15dd0ca84b7c56a57836a73502476b5df5fb' + version '2.0.0' + sha256 '97a2e10d14a26d337ba71170ddc5e4ad6e2b3eafe36adcd02048c7da2d402774' url "http://downloads.dataiku.com/public/studio/Data%20Science%20Studio%20#{version}.dmg" name 'Data Science Studio'
Update Data Science Studio to v2.0.0
diff --git a/lib/chefspec.rb b/lib/chefspec.rb index abc1234..def5678 100644 --- a/lib/chefspec.rb +++ b/lib/chefspec.rb @@ -1,8 +1,7 @@ require 'chef' +require 'chef/formatters/chefspec' require 'chefspec/chef_runner' require 'chefspec/version' - -require 'chef/formatters/chefspec' if defined?(RSpec) require 'chefspec/matchers/cron'
Load the formatter in order
diff --git a/lib/searchef.rb b/lib/searchef.rb index abc1234..def5678 100644 --- a/lib/searchef.rb +++ b/lib/searchef.rb @@ -21,5 +21,9 @@ require 'searchef/search_stub' require "searchef/version" +require 'webmock' + module Searchef end + +WebMock.allow_net_connect!
Allow real network connections to support remote_file, etc.
diff --git a/spec/factories/chambers.rb b/spec/factories/chambers.rb index abc1234..def5678 100644 --- a/spec/factories/chambers.rb +++ b/spec/factories/chambers.rb @@ -1,6 +1,6 @@ FactoryGirl.define do factory :chamber do sequence(:name) { |n| "#{Faker::Company.name}-#{n}" } - sequence(:account_number) { |n| "123456-#{n}" } + sequence(:account_number) { |n| "#{n}-#{Time.now.to_i}" } end end
Use time as integer for account number
diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index abc1234..def5678 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -4,5 +4,13 @@ factory :project do name { FFaker::Product.product_name } association :submitter, factory: :user + + trait :accepted do + after(:create) { |record| record.accept! } + end + + trait :rejected do + after(:create) { |record| record.reject! } + end end end
Create factories for all states
diff --git a/megegen.gemspec b/megegen.gemspec index abc1234..def5678 100644 --- a/megegen.gemspec +++ b/megegen.gemspec @@ -4,12 +4,12 @@ require 'megegen/version' Gem::Specification.new do |spec| - spec.name = "migration-generator" + spec.name = "megegen" spec.version = Megegen::VERSION spec.authors = ["Jack Wu"] spec.email = ["xuwupeng2000@gmail.com"] - spec.summary = %q{Migration file generator - It knows how to invoke Rails's generator } + spec.summary = %q{Mege.Gen Migration file generator - It knows how to invoke Rails's generator } spec.description = %q{Migration file generator - It knows how to invoke Rails's generator } spec.homepage = "https://github.com/xuwupeng2000/migration-generator" spec.license = "MIT"
Correct the name of Mege.Gen
diff --git a/test/models/commit_test.rb b/test/models/commit_test.rb index abc1234..def5678 100644 --- a/test/models/commit_test.rb +++ b/test/models/commit_test.rb @@ -1,21 +1,14 @@ require 'test_helper' class CommitTest < ActiveSupport::TestCase - setup do - @commit = commits(:rails_commit) - end - test ".merge_or_skip_ci? for merge commits" do - @commit.message = CommitReviewer::MERGE_COMMIT_MESSAGE - assert_equal true, Commit.merge_or_skip_ci?(@commit.message) + assert_equal true, Commit.merge_or_skip_ci?(CommitReviewer::MERGE_COMMIT_MESSAGE) + assert_equal false, Commit.merge_or_skip_ci?('haha') end test ".merge_or_skip_ci? for ci skip commits" do - @commit.message = CommitReviewer::CI_SKIP_COMMIT_MESSAGE - assert_equal true, Commit.merge_or_skip_ci?(@commit.message) - - @commit.message = CommitReviewer::SKIP_CI_COMMIT_MESSAGE - assert_equal true, Commit.merge_or_skip_ci?(@commit.message) + assert_equal true, Commit.merge_or_skip_ci?(CommitReviewer::CI_SKIP_COMMIT_MESSAGE) + assert_equal true, Commit.merge_or_skip_ci?(CommitReviewer::SKIP_CI_COMMIT_MESSAGE) end test ".valid_author?" do
Remove redundant setup in tests.
diff --git a/test/unit/test-cmd-edit.rb b/test/unit/test-cmd-edit.rb index abc1234..def5678 100644 --- a/test/unit/test-cmd-edit.rb +++ b/test/unit/test-cmd-edit.rb @@ -0,0 +1,34 @@+#!/usr/bin/env ruby +require 'rubygems'; require 'require_relative' +require_relative './mock-helper' +require_relative './cmd-helper' +require_relative '../../processor/command/edit' + +class TestCommandEdit < Test::Unit::TestCase + include MockUnitHelper + def setup + @name = File.basename(__FILE__, '.rb').split(/-/)[2] + $msgs = [] + $errmsgs = [] + common_setup(@name) + def @cmd.msg(message) + $msgs << message + end + def @cmd.errmsg(message) + $errmsgs << message + end + end + + def test_basic + old_editor = ENV['EDITOR'] + ENV['EDITOR'] = '#' + base_file = File.basename(__FILE__) + @cmd.proc.settings[:basename] = true + @cmd.run([@name]) + assert_equal "Running # +7 \"mock-helper.rb\"...", $msgs[-1] + @cmd.run([@name, 8]) + assert_equal "Running # +8 \"mock-helper.rb\"...", $msgs[-1] + @cmd.run([@name, __FILE__]) + assert_equal "Running # +1 \"#{base_file}\"...", $msgs[-1] + end +end
Add an "edit" command unit test.
diff --git a/spec/support/forking_spec.rb b/spec/support/forking_spec.rb index abc1234..def5678 100644 --- a/spec/support/forking_spec.rb +++ b/spec/support/forking_spec.rb @@ -5,16 +5,10 @@ it 'returns multiple futures for async execs' do future1 = async_fork_and_return do - 4.times do - puts "A" - end 1 end future2 = async_fork_and_return do - 4.times do - puts "B" - end 2 end
Remove some more unnecessary printing
diff --git a/lib/atlas/carrier.rb b/lib/atlas/carrier.rb index abc1234..def5678 100644 --- a/lib/atlas/carrier.rb +++ b/lib/atlas/carrier.rb @@ -13,6 +13,13 @@ attribute :kg_per_liter, Float attribute :graphviz_color, Symbol + attribute :co2_conversion_per_mj, Float + attribute :co2_exploration_per_mj, Float + attribute :co2_extraction_per_mj, Float + attribute :co2_treatment_per_mj, Float + attribute :co2_transportation_per_mj, Float + attribute :co2_waste_treatment_per_mj, Float + attribute :fce, Hash[Symbol => Hash] end # Carrier
Add FCE CO2 attributes to Carrier
diff --git a/lib/logue/version.rb b/lib/logue/version.rb index abc1234..def5678 100644 --- a/lib/logue/version.rb +++ b/lib/logue/version.rb @@ -2,5 +2,5 @@ # -*- ruby -*- module Logue - VERSION = '1.0.17' + VERSION = '1.0.18' end
Fix reference to whence file, which is now the file name instead of 'eval'
diff --git a/EnvoyAmbassador.podspec b/EnvoyAmbassador.podspec index abc1234..def5678 100644 --- a/EnvoyAmbassador.podspec +++ b/EnvoyAmbassador.podspec @@ -6,7 +6,7 @@ spec.license = 'MIT' spec.license = { type: 'MIT', file: 'LICENSE' } spec.author = { 'Fang-Pen Lin' => 'fang@envoy.com' } - spec.social_media_url = 'http://twitter.com/fangpenlin' + spec.social_media_url = 'https://twitter.com/fangpenlin' spec.ios.deployment_target = '8.0' spec.osx.deployment_target = '10.10' spec.source = {
Use https for author twitter link
diff --git a/lib/resque_future.rb b/lib/resque_future.rb index abc1234..def5678 100644 --- a/lib/resque_future.rb +++ b/lib/resque_future.rb @@ -16,7 +16,7 @@ # Same as enqueue_future excepts it allows manually setting the UUID for the future object. def enqueue_future_with_uuid(uuid, klass, *args) - FutureJob.create(queue_from_class(klass), uuid, klass, *args) + ResqueFuture::FutureJob.create(queue_from_class(klass), uuid, klass, *args) end # Get a future job
Fix namespace in reference to ResqueFuture::FutureJob
diff --git a/lib/rspec-sidekiq.rb b/lib/rspec-sidekiq.rb index abc1234..def5678 100644 --- a/lib/rspec-sidekiq.rb +++ b/lib/rspec-sidekiq.rb @@ -1,7 +1,8 @@+require "sidekiq" require "sidekiq/testing" require "rspec/sidekiq/batch" require "rspec/sidekiq/configuration" require "rspec/sidekiq/helpers" require "rspec/sidekiq/matchers" -require "rspec/sidekiq/sidekiq"+require "rspec/sidekiq/sidekiq"
Make sure sidekiq is required
diff --git a/db/migrate/20150112212957_create_schools.rb b/db/migrate/20150112212957_create_schools.rb index abc1234..def5678 100644 --- a/db/migrate/20150112212957_create_schools.rb +++ b/db/migrate/20150112212957_create_schools.rb @@ -8,7 +8,7 @@ t.string :district_name t.integer :district_no t.string :district_code - t.string :assembly_district + t.integer :assembly_district t.integer :senate_district t.string :addl_district_tag1 t.string :addl_district_tag2
Change type assembly_district field in schools DB
diff --git a/app/admin/devices/device.rb b/app/admin/devices/device.rb index abc1234..def5678 100644 --- a/app/admin/devices/device.rb +++ b/app/admin/devices/device.rb @@ -1,2 +1,38 @@ ActiveAdmin.register Devices::Device, as: 'Device' do + + member_action :renew do + resource.renew! + redirect_to :back, notice: I18n.t("admin.renewed", resource: resource.class.model_name.human) + end + + member_action :release do + resource.release! + redirect_to :back, notice: I18n.t("admin.renewed", resource: resource.class.model_name.human) + end + + index do + selectable_column + id_column + + column :mac_address + column :ip_address + column :updated_at + column :created_at + actions defaults: true do |device| + links = [] + + links << link_to(I18n.t("admin.renew", default: "Renew"), renew_admin_device_path(device.id)) + links << link_to(I18n.t("admin.release", default: "Release"), release_admin_device_path(device.id)) + + links.join(" ").html_safe + end + end + + action_item only: :show do + link_to(I18n.t("admin.renew", default: "Renew"), renew_admin_device_path(resource.id)) + end + + action_item only: :show do + link_to(I18n.t("admin.release", default: "Release"), release_admin_device_path(resource.id)) + end end
Add some helper methods to admin to renew/release ip addresses.