diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/helpers/items_helper.rb b/app/helpers/items_helper.rb index abc1234..def5678 100644 --- a/app/helpers/items_helper.rb +++ b/app/helpers/items_helper.rb @@ -1,5 +1,4 @@ module ItemsHelper - def itemable_items_path(itemable) if itemable.class.name =~ /Channel$/ channel_items_path(channel_id: itemable.id) @@ -8,7 +7,7 @@ end end - def excerpt(item, length=140) + def excerpt_for(item, length=140) truncate(strip_tags(item.to_s.html_safe).html_safe, length: length) end @@ -19,7 +18,7 @@ when 'youtube' "<iframe src=\"https://www.youtube.com/embed/#{item.guid}\" />".html_safe when 'instagram' - "<img src=\"https://www.youtube.com/embed/#{item.assets.first.url}\" />".html_safe + "<img src=\"#{item.assets.first.url}\" />".html_safe else auto_link(item.to_s) end
Change excerpt name and correct instagram url
diff --git a/safedep.gemspec b/safedep.gemspec index abc1234..def5678 100644 --- a/safedep.gemspec +++ b/safedep.gemspec @@ -20,6 +20,5 @@ spec.add_runtime_dependency 'parser' spec.add_runtime_dependency 'astrolabe' - - spec.add_development_dependency 'bundler', '~> 1.7' + spec.add_runtime_dependency 'bundler', '~> 1.7' end
Change Bundler dependency to runtime one
diff --git a/libraries/solaris.rb b/libraries/solaris.rb index abc1234..def5678 100644 --- a/libraries/solaris.rb +++ b/libraries/solaris.rb @@ -0,0 +1,41 @@+ +class Chef + class Provider + class User + class Solaris < Chef::Provider::User::Useradd + def create + super + manage_password + unlock_user + end + + private + + def check_lock + lock_check = Mixlib::ShellOut.new("passwd -s #{@new_resource.username}") + lock_check.run_command + + if lock_check.exitstatus != 0 + raise Chef::Exceptions::User, "Cannot determine if #{@new_resource} is locked!" + end + + username, status = lock_check.stdout.split(' ') + + status == "LK" + end + + def lock_user + unless check_lock + run_command(:command => "passwd -l #{@new_resource.username}") + end + end + + def unlock_user + if check_lock + run_command(:command => "passwd -u #{@new_resource.username}") + end + end + end + end + end +end
Add Solaris class in preparation for newer versions of Chef User creation is splitting out into a new class for solaris/smartos on chef master.
diff --git a/lib/catscan/scannable.rb b/lib/catscan/scannable.rb index abc1234..def5678 100644 --- a/lib/catscan/scannable.rb +++ b/lib/catscan/scannable.rb @@ -14,7 +14,7 @@ module ClassMethods def scan(context, comment = nil, &block) - klass_name = context.class.name + klass_name = %w(Class).include?(context.class.name) ? context.name : context.class.name comment = Util.limit_bytesize(comment) if comment.present? ActiveSupport::Notifications.instrument("log.scan",
Clarify class name based on _klass context
diff --git a/lib/coinmux/file_util.rb b/lib/coinmux/file_util.rb index abc1234..def5678 100644 --- a/lib/coinmux/file_util.rb +++ b/lib/coinmux/file_util.rb @@ -1,12 +1,13 @@ require 'fileutils' +require 'tmpdir' module Coinmux::FileUtil class << self - def root_mkdir_p(*path) + def root_mkdir_p(*paths) begin - FileUtils.mkdir_p(path = File.join(Coinmux.root, *path)) + FileUtils.mkdir_p(path = File.join(Coinmux.root, *paths)) rescue - FileUtils.mkdir_p(path = File.join('.', *path)) + FileUtils.mkdir_p(path = File.join(Dir.tmpdir, *paths)) end path
Use temp dir when cannot mkdir at Coinmux.root
diff --git a/gilt-rb.gemspec b/gilt-rb.gemspec index abc1234..def5678 100644 --- a/gilt-rb.gemspec +++ b/gilt-rb.gemspec @@ -17,8 +17,4 @@ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ["lib"] - - # specify any dependencies here; for example: - # s.add_development_dependency "rspec" - # s.add_runtime_dependency "rest-client" end
Remove filler text from gemspec
diff --git a/benchmark/capture-assign.rb b/benchmark/capture-assign.rb index abc1234..def5678 100644 --- a/benchmark/capture-assign.rb +++ b/benchmark/capture-assign.rb @@ -0,0 +1,20 @@+require "liquid" +require "benchmark/ips" + +puts "Ruby #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" +puts "Liquid #{Liquid::VERSION}" + +template1 = '{% capture foobar %}foo{{ bar }}{% endcapture %}{{ foo }}{{ foobar }}' +template2 = '{% assign foobar = "foo" | append: bar %}{{ foobar }}' + +def render(template) + Liquid::Template.parse(template).render("bar" => "42") +end + +puts render(template1) +puts render(template2) + +Benchmark.ips do |x| + x.report('capture') { render(template1) } + x.report('assign') { render(template2) } +end
Add a benchmark for capture vs. assign in Liquid. [ci skip]
diff --git a/slather.gemspec b/slather.gemspec index abc1234..def5678 100644 --- a/slather.gemspec +++ b/slather.gemspec @@ -25,5 +25,5 @@ spec.add_development_dependency "cocoapods", "~> 0.34" spec.add_dependency "clamp", "~> 0.6" - spec.add_dependency "xcodeproj", "~> 0.17" + spec.add_dependency "xcodeproj", "~> 0.19.2" end
[Gemspec] Upgrade xcodeproj dependency to match new cocoapods verison's.
diff --git a/lib/ducktrap/external.rb b/lib/ducktrap/external.rb index abc1234..def5678 100644 --- a/lib/ducktrap/external.rb +++ b/lib/ducktrap/external.rb @@ -2,44 +2,126 @@ class External < self register :extern + include Equalizer.new(:block, :inverse_block) + + # Return inverse + # + # @return [Ducktrap] + # + # @api private + # def inverse - self.class.new(inverse_block, forward_block) + self.class.new(inverse_block, block) end + # Run with input + # + # @param [Object] input + # + # @return [Result] + # + # @api private + # def run(input) - Result::Static.new(self, input, @forward_block.call(input)) + Result::Static.new(self, input, @block.call(input)) end - attr_reader :forward_block, :inverse_block + # Return block + # + # @return [Proc] + # + # @api private + # + attr_reader :block + + # Return inverse block + # + # @return [Proc] + # + # @api private + # + attr_reader :inverse_block - def initialize(forward_block, inverse_block) - @forward_block, @inverse_block = forward_block, inverse_block + # Initialize object + # + # @param [Proc] block + # @param [Proc] inverse + # + # @return [undefined] + # + # @api private + # + def initialize(block, inverse_block) + @block, @inverse_block = block, inverse_block end + # Build external ducktrap + # + # @return [External] + # + # @api private + # def self.build(&block) Builder.new(self, &block).object end + # Builder for external ducktrap class Builder < Ducktrap::Builder + + # Capture forward block + # + # @return [self] + # + # @api private + # def forward(&block) - @forward_block = block + @block = block + self end + # Capture inverse block + # + # @return [self] + # + # @api private + # def inverse(&block) @inverse_block = block + self end - def forward_block - @forward_block || raise("No forward block specified!") + private + + # Return block + # + # @return [Proc] + # + # @api private + # + def block + @block || raise("No forward block specified!") end + # Return inverse block + # + # @return [Proc] + # + # @api private + # def inverse_block @inverse_block || raise("No inverse block specified!") end + # Return ducktrap + # + # @return [Ducktrap] + # + # @api private + # def object - klass.new(forward_block, inverse_block) + klass.new(block, inverse_block) end + end end end
Add yard docks for Ducktrap::External
diff --git a/plugin/dtrace/lib/dtrace_report.rb b/plugin/dtrace/lib/dtrace_report.rb index abc1234..def5678 100644 --- a/plugin/dtrace/lib/dtrace_report.rb +++ b/plugin/dtrace/lib/dtrace_report.rb @@ -13,7 +13,7 @@ if options[:tracer] == :self DtraceReport.tracer = Dtracer.new elsif options[:tracer] == :helper - DtracerReport.tracer = DtracerClient.new + DtraceReport.tracer = DtracerClient.new else raise "tracer option is self or helper" end
Fix "helper" mode, typo corrected. git-svn-id: 40196796c19c0e7557af02d93710b150381d7241@72 f5dbc166-08e2-44d3-850c-36126807790f
diff --git a/lib/woodhouse/process.rb b/lib/woodhouse/process.rb index abc1234..def5678 100644 --- a/lib/woodhouse/process.rb +++ b/lib/woodhouse/process.rb @@ -1,11 +1,11 @@ # TODO: take arguments. Also consider using thor. class Woodhouse::Process + + def initialize(keyw = {}) + @server = keyw[:server] || build_default_server(keyw) + end def execute - @server = Woodhouse::Server.new - @server.layout = Woodhouse.global_layout - @server.node = :default - # Borrowed this from sidekiq. https://github.com/mperham/sidekiq/blob/master/lib/sidekiq/cli.rb trap "INT" do Thread.main.raise Interrupt @@ -26,4 +26,13 @@ end end + private + + def build_default_server(keyw) + Woodhouse::Server.new.tap do |server| + server.layout = keyw[:layout] || Woodhouse.global_layout + server.node = keyw[:node] || :default + end + end + end
Allow alternate layout or node name to be passed into Woodhouse::Process.
diff --git a/test/server/metrics.rb b/test/server/metrics.rb index abc1234..def5678 100644 --- a/test/server/metrics.rb +++ b/test/server/metrics.rb @@ -2,7 +2,7 @@ MIN = { test_count:1, app_coverage:100, - test_coverage:98, + test_coverage:100, line_ratio:2.1, hits_ratio:0.7 }
Set min test-coverage (of tests) on server to 100%
diff --git a/fotoramajs.gemspec b/fotoramajs.gemspec index abc1234..def5678 100644 --- a/fotoramajs.gemspec +++ b/fotoramajs.gemspec @@ -1,4 +1,4 @@-require_relative 'lib/fotoramajs/version' +require File.expand_path('../lib/fotoramajs/version', __FILE__) Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY
Fix require for old Ruby
diff --git a/config/deploy.rb b/config/deploy.rb index abc1234..def5678 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -20,7 +20,7 @@ set :rails_env, "production" # for carrierwave -set :shared_children, shared_children + %w{public/uploads} +set :shared_children, shared_children + %w{public/uploads tmp/sockets} before "deploy:finalize_update", :copy_production_database_configuration, :replace_secret_token
Fix missing shared sockets folder [ci skip]
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,11 @@ Rails.application.routes.draw do - resources :expanded_test_ads - resources :ad_groups - resources :campaigns - # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html + constraints subdomain: 'api' do + scope module: 'api' do + namespace :v1 do + resources :expanded_test_ads + resources :ad_groups + resources :campaigns + end + end + end end
Configure to route to controllers in API module
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -31,5 +31,7 @@ end resources :search, only: :index + resources :recruiters, only: :show + get '/:id', to: 'developers#show', as: :developer end
Add route for recruiter show
diff --git a/flipper-active_support_cache_store.gemspec b/flipper-active_support_cache_store.gemspec index abc1234..def5678 100644 --- a/flipper-active_support_cache_store.gemspec +++ b/flipper-active_support_cache_store.gemspec @@ -21,5 +21,5 @@ gem.metadata = Flipper::METADATA gem.add_dependency 'flipper', "~> #{Flipper::VERSION}" - gem.add_dependency 'activesupport', '>= 4.2', '< 7' + gem.add_dependency 'activesupport', '>= 4.2', '< 8' end
Update gemspec for active support to < 8 also
diff --git a/bin/geocode_nicab.rb b/bin/geocode_nicab.rb index abc1234..def5678 100644 --- a/bin/geocode_nicab.rb +++ b/bin/geocode_nicab.rb @@ -6,19 +6,21 @@ locations = [] -# "Antrim CAB","Farranshane House","1 Ballygore Road","Antrim","BT41 2RN" +# "Antrim","Farranshane House","1 Ballygore Road","Antrim","BT41 2RN","028 9442 8176" CSV.foreach('nicab.csv', headers: true, return_headers: false) do |row| title = row.fields.first.strip address = row.fields[1..4].reject { |value| value.nil? || value.strip == '' }.map(&:strip).join(', ') + phone = row.fields.last.strip lat, lng = Geocoder.coordinates(address) locations << { - title: title, + title: "#{title} Citizens Advice Bureau", address: address, - phone: '', + phone: phone, lat: lat, lng: lng } + #sleep(1) end puts JSON.pretty_generate(locations)
Update NICAB script to handle most recent CSV
diff --git a/lib/zendesk_apps_support/sass_functions.rb b/lib/zendesk_apps_support/sass_functions.rb index abc1234..def5678 100644 --- a/lib/zendesk_apps_support/sass_functions.rb +++ b/lib/zendesk_apps_support/sass_functions.rb @@ -26,9 +26,9 @@ module SassC::Script::Functions module AppAssetUrl def app_asset_url(name) - raise ArgumentError, "Expected #{name} to be a string" unless name.is_a? Sass::Script::Value::String + raise ArgumentError, "Expected #{name} to be a string" unless name.is_a? SassC::Script::Value::String result = %{url("#{app_asset_url_helper(name)}")} - SassC::Script::String.new(result) + SassC::Script::Value::String.new(result) end private
Check for the right SassC string type
diff --git a/test/fallback_pure_spec.rb b/test/fallback_pure_spec.rb index abc1234..def5678 100644 --- a/test/fallback_pure_spec.rb +++ b/test/fallback_pure_spec.rb @@ -24,9 +24,10 @@ require 'inline' +require 'fuzzystringmatch' describe Inline, "when c compile failed, fall back into pure " do it "is for JRuby", :if => RUBY_PLATFORM == 'java' do - FuzzyStringMatch::JaroWinkler.create( :native ).pure?( ).should be_true + expect( FuzzyStringMatch::JaroWinkler.create( :native ).pure?( )).to be true end end
Support rspec 3.0 syntax on JRuby, too.
diff --git a/xylem.gemspec b/xylem.gemspec index abc1234..def5678 100644 --- a/xylem.gemspec +++ b/xylem.gemspec @@ -18,10 +18,10 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_dependency 'pg', '>= 0.11' spec.add_dependency 'activerecord', '>= 3.2' spec.add_development_dependency 'bundler', '~> 1.7' spec.add_development_dependency 'rake', '~> 10.0' spec.add_development_dependency 'minitest', '~> 5.6' + spec.add_development_dependency 'pg', '>= 0.11' end
Move pg gem to a dev dependency
diff --git a/helpers.rb b/helpers.rb index abc1234..def5678 100644 --- a/helpers.rb +++ b/helpers.rb @@ -3,6 +3,13 @@ def faraday(options = {}) @faraday ||= begin options[:timeout] ||= 6 + + # Make SSL work on heroku + if File.exists?('/usr/lib/ssl/certs/ca-certificates.crt') + options[:ssl] ||= {} + options[:ssl][:ca_path] = '/usr/lib/ssl/certs/ca-certificates.crt' + end + Faraday.new(options) do |b| b.request :url_encoded b.request :json
Make SSL work on heroku.
diff --git a/json_model.gemspec b/json_model.gemspec index abc1234..def5678 100644 --- a/json_model.gemspec +++ b/json_model.gemspec @@ -11,8 +11,6 @@ s.description = "ActiveRecord replacement for pure JSON models" s.required_rubygems_version = ">= 1.3.6" - - s.add_dependency "activemodel", "~> 3.0.0" s.files = Dir["{lib}/**/*.rb", "LICENSE", "*.md"] s.require_path = 'lib'
Revert "Dependency for active model" This reverts commit 72c7d09db27233f740e79908ece54e71e120d5e9. Conflicts: json_model.gemspec
diff --git a/app/models/item.rb b/app/models/item.rb index abc1234..def5678 100644 --- a/app/models/item.rb +++ b/app/models/item.rb @@ -1,5 +1,7 @@ class Item < ActiveRecord::Base include Taggable + has_many :channel_inherited_keywords, source: :keywords, through: :channel + has_many :entity_inherited_keywords, source: :keywords, through: :entity belongs_to :channel has_one :entity, through: :channel @@ -16,8 +18,13 @@ order('published_at DESC') } + scope :has_keyword_id, -> keyword_id { + with_tagging.joins(channel: [:taggings, entity: [:taggings]]).where('taggings.keyword_id = ? OR taggings_channels.keyword_id = ? OR taggings_entities.keyword_id = ?', keyword_id, keyword_id, keyword_id).distinct + } + scope :most_recent, -> { order('published_at DESC').limit(1) } scope :with_channel, -> { includes(:channel).where.not(channels: { id: nil }) } + scope :with_all_keywords, -> { includes(:keywords, :channel_inherited_keywords, :entity_inherited_keywords) } scope :by_channel, -> channel_id { where(:channel_id => channel_id) } scope :by_keyword_ids, -> keyword_ids { joins(:taggings).where('taggings.keyword_id IN (?)', keyword_ids).distinct @@ -29,13 +36,16 @@ end end + def all_keywords + keywords + channel_inherited_keywords + entity_inherited_keywords + end + def link if attributes['link'].blank? channel.link_for(self) else attributes['link'] end - end end
Allow for loading all associated keywords efficiently
diff --git a/app/models/site.rb b/app/models/site.rb index abc1234..def5678 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -6,6 +6,7 @@ has_many :images, dependent: :destroy has_many :authors, dependent: :destroy has_many :memberships, dependent: :destroy + has_many :editors, through: :memberships, source: :user validates :name, presence: true validates :fqdn, presence: true, uniqueness: true
Add relationship: Site -> User
diff --git a/distribo.gemspec b/distribo.gemspec index abc1234..def5678 100644 --- a/distribo.gemspec +++ b/distribo.gemspec @@ -22,6 +22,8 @@ spec.add_development_dependency "faker" spec.add_development_dependency "webmock" + spec.add_dependency 'eye' + spec.add_dependency 'dotenv' spec.add_dependency 'activesupport' spec.add_dependency 'bunny' spec.add_dependency 'redis'
Add eye and dotenv gems
diff --git a/app/game_layer.rb b/app/game_layer.rb index abc1234..def5678 100644 --- a/app/game_layer.rb +++ b/app/game_layer.rb @@ -2,12 +2,13 @@ scene def on_enter + load_sprite_sheet + @sprite_batch << Sprite.new(frame_name: 'boy.png', position: [Screen.half_width, Screen.half_height]) + end + + def load_sprite_sheet Joybox::Core::SpriteFrameCache.frames.add file_name: "sprites.plist" @sprite_batch = Joybox::Core::SpriteBatch.new file_name: "sprites.png" self << @sprite_batch - - @sprite_batch << Sprite.new(frame_name: 'boy.png', position: [Screen.half_width, Screen.half_height]) - @sprite_batch << Sprite.new(frame_name: 'girl_cat.png', position: [0, 0]) - @sprite_batch << Sprite.new(frame_name: 'girl_cat.png', position: [Screen.width, Screen.height]) end end
Refactor load_sprite_sheet and remove bottom-left/top-right sprites.
diff --git a/app/models/arp.rb b/app/models/arp.rb index abc1234..def5678 100644 --- a/app/models/arp.rb +++ b/app/models/arp.rb @@ -7,10 +7,12 @@ end def self.present_users - User.joins(:network_devices).where(network_devices: { - mac_address: all.map(&:mac_address), - use_for_presence: true - }).uniq + User.joins(:network_devices) + .where(privacy: false) + .where(network_devices: { + mac_address: all.map(&:mac_address), + use_for_presence: true + }).uniq end def self.mac_by_ip_address(ip_address)
Hide users that don't want to be shown
diff --git a/app/models/url.rb b/app/models/url.rb index abc1234..def5678 100644 --- a/app/models/url.rb +++ b/app/models/url.rb @@ -2,9 +2,10 @@ include Mongoid::Document field :site_name, type: String field :origin_url, type: String + field :movie_pics, type: Array field :title, type: String field :time, type: String - field :tags, type: String + field :tags, type: Array field :player_url, type: String field :emb_url, type: String field :rate, type: String
Modify Urls model to add movie pictures.
diff --git a/repository/memory.rb b/repository/memory.rb index abc1234..def5678 100644 --- a/repository/memory.rb +++ b/repository/memory.rb @@ -1,4 +1,5 @@ # encoding: utf-8 +require 'set' module Blabber module Repository @@ -27,11 +28,11 @@ end def add(id, *members) - memory.store(id, memory.fetch(id, []).push(*members)) + memory.store(id, memory.fetch(id, Set.new).add(*members)) end def remove(id, *members) - data = memory.fetch(id, []) + data = memory.fetch(id, Set.new) members.each { |member| data.delete(member) } memory.store(id, data) memory.delete(id) if data.empty?
Use sets to initialize collection keys in Repository::Memory
diff --git a/attributes/chef.rb b/attributes/chef.rb index abc1234..def5678 100644 --- a/attributes/chef.rb +++ b/attributes/chef.rb @@ -8,3 +8,4 @@ default[:sys][:chef][:server_url] = nil default[:sys][:chef][:use_syslog] = false default[:sys][:chef][:log_level] = ':info' +default[:sys][:chef][:overwrite_warning] = "DO NOT CHANGE THIS FILE MANUALLY! This file is managed by the Chef `sys` cookbook."
Add a tempate for the "don't edit" warning
diff --git a/test/test_helper.rb b/test/test_helper.rb index abc1234..def5678 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,5 +1,8 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) + +# RAILS_ENV needs to be set to development to mount the error page debug view +ENV['RAILS_ENV'] ||= 'development' require 'rails' require 'minitest/autorun'
Make sure the error page debug view gets mounted
diff --git a/lib/fetch/async.rb b/lib/fetch/async.rb index abc1234..def5678 100644 --- a/lib/fetch/async.rb +++ b/lib/fetch/async.rb @@ -3,6 +3,7 @@ def self.included(base) base.define_callback :url, :user_agent, + :headers, :before_first_process, :before_process, :process @@ -26,7 +27,7 @@ followlocation: true, timeout: Fetch.config.timeout, forbid_reuse: true, - headers: { "User-Agent" => (user_agent || Fetch.config.user_agent) } + headers: { "User-Agent" => (user_agent || Fetch.config.user_agent) }.merge(headers || {}) ) request.on_complete do |res|
Support sending headers to requests
diff --git a/lib/gitlab/util.rb b/lib/gitlab/util.rb index abc1234..def5678 100644 --- a/lib/gitlab/util.rb +++ b/lib/gitlab/util.rb @@ -24,6 +24,8 @@ def section_start(name, description = name) return unless ENV['CI'] + name.tr!(':', '-') + @section_name = name $stdout.puts "section_start:#{Time.now.to_i}:#{name}\r\e[0K#{description}" end @@ -31,6 +33,8 @@ def section_end(name = @section_name) return unless ENV['CI'] + name.tr!(':', '-') + $stdout.puts "section_end:#{Time.now.to_i}:#{name}\r\e[0K" end end
Remove colons from section names Collapsible sections use colons as a separator, so we replace them in the name with hyphens.
diff --git a/lib/results/why.rb b/lib/results/why.rb index abc1234..def5678 100644 --- a/lib/results/why.rb +++ b/lib/results/why.rb @@ -6,13 +6,15 @@ module Results module_function - # Wraps `arg` in a `Why` by calling the appropriate constructor. - def Why(arg) - case arg - when Because then Why::One.new(arg) - when Array then Why::Many.new(arg) - when Hash then Why::Named.new(arg) - else raise TypeError, "can't convert #{arg.class} into Why" + # Wraps `becauses` into the appropriate `Why` depending on its type: `One`, `Many`, or `Named`. + # @param [Because, Array<Because>, Hash<Object, Because>] becauses one or more `Because`'s to wrap in a `Why` + # @return [Why::Base] wrapped explanation(s) as a {Why::One One}, a {Why::Many Many}, or a {Why::Named Named} + def Why(becauses) + case becauses + when Because then Why::One.new(becauses) + when Array then Why::Many.new(becauses) + when Hash then Why::Named.new(becauses) + else raise TypeError, "can't convert #{becauses.class} into Why" end end
Improve yard documentation of Why()
diff --git a/lib/rich/engine.rb b/lib/rich/engine.rb index abc1234..def5678 100644 --- a/lib/rich/engine.rb +++ b/lib/rich/engine.rb @@ -7,7 +7,21 @@ isolate_namespace Rich initializer "rich.add_middleware" do |app| - app.config.assets.precompile += %w(rich/base.js rich/editor.css ckeditor) + config.assets.precompile << Proc.new do |path| + if path =~ /\.(css|js)\z/ + full_path = Rails.application.assets.resolve(path).to_path + app_assets_path = Rails.root.join('app', 'assets').to_path + if full_path.starts_with? app_assets_path + puts "including asset: " + full_path + true + else + puts "excluding asset: " + full_path + false + end + else + false + end + end app.middleware.use 'Rack::RawUpload', :paths => ['/rich/files'] end
Include all js and css assets in precompilation
diff --git a/spec/features/comment_spec.rb b/spec/features/comment_spec.rb index abc1234..def5678 100644 --- a/spec/features/comment_spec.rb +++ b/spec/features/comment_spec.rb @@ -4,7 +4,7 @@ context "on new comment page" do let(:query) { FactoryGirl.create(:query) } it "can see a form to write a new comment" do - stub_authorize_user! + # stub_authorize_user! visit new_query_comment_path(query) expect(page).to have_content("content") end
Comment out stub_authorize_user call - awaiting user auth helpers
diff --git a/spec/features/metrics_spec.rb b/spec/features/metrics_spec.rb index abc1234..def5678 100644 --- a/spec/features/metrics_spec.rb +++ b/spec/features/metrics_spec.rb @@ -6,9 +6,9 @@ include_examples 'create visits with dates' before do - book_a_luna_visit_late - book_a_luna_visit_late - book_a_mars_visit_late + luna_visit + luna_visit + mars_visit # Shared examples are booked within the first week of February, 2106. The # controller tracks one week behind the current date. @@ -17,7 +17,7 @@ end end - it 'should not fail' do + it 'has the correct overdue values' do expect(page).to have_selector('.luna-overdue', text: 2) expect(page).to have_selector('.mars-overdue', text: 1) end
Tweak feature spec to create overdue visits
diff --git a/twitter4j4r.gemspec b/twitter4j4r.gemspec index abc1234..def5678 100644 --- a/twitter4j4r.gemspec +++ b/twitter4j4r.gemspec @@ -2,7 +2,7 @@ require File.expand_path('../lib/twitter4j4r/version', __FILE__) Gem::Specification.new do |gem| - gem.authors = ["Tobias Crawley", "Marek Jelen"] + gem.authors = ["Tobias Crawley", "Marek Jelen", "Gregory Ostermayr"] gem.email = ["toby@tcrawley.org"] gem.description = %q{A thin, woefully inadequate wrapper around http://twitter4j.org/} gem.summary = %q{A thin, woefully inadequate wrapper around http://twitter4j.org/ that only supports the stream api with keywords.}
Add gregors as a gem author
diff --git a/migrate.rb b/migrate.rb index abc1234..def5678 100644 --- a/migrate.rb +++ b/migrate.rb @@ -2,79 +2,3 @@ require "sequel" $db = Sequel.connect("sqlite://database/database.db", :logger => Logger.new("log/db.log")) - -# $db.create_table :teams do -# Integer :number -# primary_key :number - -# String :name -# String :location - -# DateTime :created_at -# DateTime :updated_at -# end - -# $db.create_table :participations do -# Serial :id -# primary_key :id - -# foreign_key :competition_id, :competitions -# foreign_key :team_number, :teams - -# DateTime :created_at -# DateTime :updated_at -# end - -# $db.create_table :matches do -# Serial :id -# primary_key :id - -# String :raw_number -# Integer :red_score -# Integer :blue_score - -# foreign_key :competition_id, :competitions - -# DateTime :created_at -# DateTime :updated_at -# end - -# $db.create_table :competitions do -# Serial :id -# primary_key :id - -# String :name -# String :location - -# DateTime :created_at -# DateTime :updated_at -# end - -# $db.create_table :records do -# Serial :id -# primary_key :id - -# Text :notes -# String :raw_position - -# foreign_key :match_id, :matches -# foreign_key :team_number, :teams - -# DateTime :created_at -# DateTime :updated_at -# end - -# $db.create_table :extra_data do -# Serial :id -# primary_key :id - -# String :key -# Text :raw_value -# String :value_class - -# Integer :parent_key -# String :parent_class - -# DateTime :created_at -# DateTime :updated_at -# end
Remove old reference code, as migrations are written.
diff --git a/lib/readonce.rb b/lib/readonce.rb index abc1234..def5678 100644 --- a/lib/readonce.rb +++ b/lib/readonce.rb @@ -3,7 +3,7 @@ require 'httparty' class ReadOnce - BASE_URI = 'http://readonce-production.herokuapp.com' + BASE_URI = 'https://readonce-production.herokuapp.com' def self.from_key(key) r = ReadOnce.new
Use HTTPS, since Heroku now supports it OOB.
diff --git a/app/forms/taxon_form.rb b/app/forms/taxon_form.rb index abc1234..def5678 100644 --- a/app/forms/taxon_form.rb +++ b/app/forms/taxon_form.rb @@ -36,7 +36,7 @@ ] ) - Services.publishing_api.publish(content_id, "major") + Services.publishing_api.publish(content_id, "minor") Services.publishing_api.put_links( content_id,
Use "minor" update type for tag publishing Setting the update type to minor means we won't send email alerts for changes to a topic title or description. This will become relevant if topics will be tagged to other topics (we have no plans to do this, but we need to be careful). Since there is only ever one update type, all methods have been replaced by a constant. The only change is in the `RedirectItemPresenter` which previously was sent a "republish" update type. This was incorrect, as the app is publishing new data, not republishing old data.
diff --git a/NTMonthYearPicker.podspec b/NTMonthYearPicker.podspec index abc1234..def5678 100644 --- a/NTMonthYearPicker.podspec +++ b/NTMonthYearPicker.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'NTMonthYearPicker' - s.version = '1.0' + s.version = '1.0.0' s.summary = 'A simple month / year picker component for iOS.' s.description = 'NTMonthYearPicker is a simple month / year picker component for use in iOS applications.'
Use semantic versioning in podspec
diff --git a/week-4/largest-integer/13-largest-integer/my_solution.rb b/week-4/largest-integer/13-largest-integer/my_solution.rb index abc1234..def5678 100644 --- a/week-4/largest-integer/13-largest-integer/my_solution.rb +++ b/week-4/largest-integer/13-largest-integer/my_solution.rb @@ -12,8 +12,22 @@ #Your Solution Below def largest_integer(list_of_nums) - list_of_nums.sort! - return list_of_nums[-1] + max = list_of_nums[0] + + list_of_nums.each do |num| + if num > max + max = num + end + end + + return max + end +#Refactored +def largest_integer(list_of_nums) + list_of_nums.max +end + +
Add initial solution back in and use max in refactored solution
diff --git a/chef-zero.gemspec b/chef-zero.gemspec index abc1234..def5678 100644 --- a/chef-zero.gemspec +++ b/chef-zero.gemspec @@ -2,25 +2,25 @@ require 'chef_zero/version' Gem::Specification.new do |s| - s.name = "chef-zero" + s.name = 'chef-zero' s.version = ChefZero::VERSION s.platform = Gem::Platform::RUBY s.has_rdoc = true - s.extra_rdoc_files = ["README.rdoc", "LICENSE"] - s.summary = "Self-contained, easy-setup, fast-start in-memory Chef server for testing and solo setup purposes" + s.extra_rdoc_files = ['README.rdoc', 'LICENSE'] + s.summary = 'Self-contained, easy-setup, fast-start in-memory Chef server for testing and solo setup purposes' s.description = s.summary - s.author = "John Keiser" - s.email = "jkeiser@opscode.com" - s.homepage = "http://www.opscode.com" + s.author = 'John Keiser' + s.email = 'jkeiser@opscode.com' + s.homepage = 'http://www.opscode.com' - s.add_dependency 'thin' # webrick DOES NOT FREAKING WORK - s.add_dependency 'mixlib-log', '>= 1.3.0' - s.add_dependency 'solve', '>= 0.4.3' - s.add_dependency 'hashie', '>= 2.0.4' + s.add_dependency 'puma', '~> 2.0' + s.add_dependency 'mixlib-log', '~> 1.3' + s.add_dependency 'solve', '~> 0.4' + s.add_dependency 'hashie', '~> 2.0' - s.bindir = "bin" - s.executables = %w( chef-zero ) + s.bindir = 'bin' + s.executables = ['chef-zero'] s.require_path = 'lib' - s.files = %w(LICENSE README.rdoc Rakefile) + Dir.glob("{lib,spec}/**/*") + s.files = %w(LICENSE README.rdoc Rakefile) + Dir.glob('{lib,spec}/**/*') end
Fix up gemspec; add puma
diff --git a/APJSONMapping.podspec b/APJSONMapping.podspec index abc1234..def5678 100644 --- a/APJSONMapping.podspec +++ b/APJSONMapping.podspec @@ -10,7 +10,7 @@ s.author = { "Alexander Perechnev" => "herfleisch@me.com" } s.source = { :git => "https://github.com/aperechnev/APJSONMapping.git", :tag => "1.0" } - s.platform = :ios, '8.0' + s.platform = :ios, '8.4' s.source_files = 'APJSONMapping/APJSONMapping/*.{h,m}' s.requires_arc = true end
Make iOS 8.4 as minimum requirement.
diff --git a/core/db/migrate/20170317035819_add_lft_and_rgt_indexes_to_taxons.rb b/core/db/migrate/20170317035819_add_lft_and_rgt_indexes_to_taxons.rb index abc1234..def5678 100644 --- a/core/db/migrate/20170317035819_add_lft_and_rgt_indexes_to_taxons.rb +++ b/core/db/migrate/20170317035819_add_lft_and_rgt_indexes_to_taxons.rb @@ -0,0 +1,6 @@+class AddLftAndRgtIndexesToTaxons < ActiveRecord::Migration[5.0] + def change + add_index :spree_taxons, :lft + add_index :spree_taxons, :rgt + end +end
Add missing indexes for Spree::Taxon lft and rgt columns * These are used by `awesome_nested_set` to perform ordering and therefore indexes should be added to them
diff --git a/performance/aur.rb b/performance/aur.rb index abc1234..def5678 100644 --- a/performance/aur.rb +++ b/performance/aur.rb @@ -5,12 +5,20 @@ require 'aurb' -Benchmark.bm 7 do |x| - x.report 'search' do +Benchmark.bm 20 do |x| + x.report 'aurb upgrade' do + Aurb.aur.upgrade *`pacman -Qm`.split(/\n/) + end + + x.report 'aurb search' do Aurb.aur.search *:quake end - x.report 'upgrade' do - Aurb.aur.upgrade *`pacman -Qm`.split(/\n/) + x.report 'slurpy search' do + `slurpy --search quake` + end + + x.report 'bauerbill search' do + `bauerbill -Ss quake --aur` end end
Add contenders to performance check
diff --git a/asciidoctor-playground.rb b/asciidoctor-playground.rb index abc1234..def5678 100644 --- a/asciidoctor-playground.rb +++ b/asciidoctor-playground.rb @@ -0,0 +1,49 @@+#!/usr/bin/env ruby + +require 'asciidoctor' + +topics = Hash.new + +base_dir = ARGV[0] + +Dir.glob base_dir + '/docs/**/*.adoc' do |doc| + Asciidoctor.convert_file doc, base_dir: base_dir, mkdirs: true, to_dir: 'output' + + # collect topics to create index files later + asciidoctor_document = Asciidoctor.load_file doc + this_topics = asciidoctor_document.attributes['topics'].split(", ") + this_topics.each do |t| + if topics[t].nil? + topics[t] = [] + end + topics[t] << File.basename(doc, '.adoc') + '.html' + end + +end + +meta_index = <<END += Index + +END + +# create index files +topics.each do |t, docs| + meta_index += "link:#{t}-index.html[#{t}]\n\n" + index = <<END +== Index of #{t} + +END + docs.each do |doc| + index += "link:#{doc}[#{doc}]\n\n" + end + html = Asciidoctor.convert index, header_footer: true + File.open(base_dir + '/output/' + t + '-index.html', 'w') do |f| + f.write(html) + end + +end +html = Asciidoctor.convert meta_index, header_footer: true +File.open(base_dir + '/output/index.html', 'w') do |f| + f.write(html) +end +
Add playground for asciidoctor ruby api
diff --git a/event_store-entity_projection.gemspec b/event_store-entity_projection.gemspec index abc1234..def5678 100644 --- a/event_store-entity_projection.gemspec +++ b/event_store-entity_projection.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'event_store-entity_projection' - s.version = '0.0.2.2' + s.version = '0.0.3.0' s.summary = 'Projects an event stream into an entity' s.description = ' '
Package version is increased from 0.0.2.2 to 0.0.3.0
diff --git a/KINWebBrowser.podspec b/KINWebBrowser.podspec index abc1234..def5678 100644 --- a/KINWebBrowser.podspec +++ b/KINWebBrowser.podspec @@ -17,7 +17,6 @@ s.source_files = 'KINWebBrowser', 'KINWebBrowser/**/*.{h,m}' s.resources = "Assets/*.png" s.requires_arc = true - - s.weak_framework = 'WebKit' + s.frameworks = 'WebKit' end
Make reference to 'WebKit' strong
diff --git a/httpauth.gemspec b/httpauth.gemspec index abc1234..def5678 100644 --- a/httpauth.gemspec +++ b/httpauth.gemspec @@ -15,5 +15,6 @@ spec.has_rdoc = true spec.extra_rdoc_files = ["README.md", "LICENSE"] + spec.license = "MIT" spec.rdoc_options << "--charset=utf-8" end
Add license abbreviation to gemspec
diff --git a/spec/cc/engine/content_spec.rb b/spec/cc/engine/content_spec.rb index abc1234..def5678 100644 --- a/spec/cc/engine/content_spec.rb +++ b/spec/cc/engine/content_spec.rb @@ -8,14 +8,8 @@ describe "#body" do subject { content.body } - it "pulls from the config/contents directory" do - content = File.read( - File.expand_path( - File.join(__FILE__, "..", "..", "..", "..", "config", "contents", "#{linter}.md") - ) - ) - - expect(subject).to eq(content) + it "is a Markdown document starting with the linter's name" do + expect(subject.split("\n").first).to eq("## HamlLint/#{linter}") end context "when it's an unknown linter" do
Improve test for content body
diff --git a/spec/client/connection_spec.rb b/spec/client/connection_spec.rb index abc1234..def5678 100644 --- a/spec/client/connection_spec.rb +++ b/spec/client/connection_spec.rb @@ -29,7 +29,7 @@ it "raises error" do expect { connection.get("profile") }. - to raise_error Magnum::Client::Error, "API key required" + to raise_error Magnum::Client::AuthError, "API key required" end end @@ -44,7 +44,7 @@ it "raises error" do expect { connection.get("profile") }. - to raise_error Magnum::Client::Error, "API key is invalid" + to raise_error Magnum::Client::AuthError, "API key is invalid" end end end
Change error type in api tests
diff --git a/spec/program_area_list_spec.rb b/spec/program_area_list_spec.rb index abc1234..def5678 100644 --- a/spec/program_area_list_spec.rb +++ b/spec/program_area_list_spec.rb @@ -1,85 +1,13 @@ require 'spec_helper' +require 'shared_verso_list_examples' describe Verso::ProgramAreaList do use_vcr_cassette :record => :new_episodes before do @list = Verso::ProgramAreaList.new + @kontained = Verso::ProgramArea end - describe '#[]' do - it 'responds' do - @list.should respond_to(:[]) - end - - it 'is a Verso::ProgramArea object' do - @list[3].should be_a(Verso::ProgramArea) - end - end - - describe '#each' do - it 'responds' do - @list.should respond_to(:each) - end - - it 'yields' do - expect { |b| @list.each("foo", &b).to yield_control } - end - - it 'yields Verso::ProgramArea objects' do - @list.each do |c| - c.should be_a(Verso::ProgramArea) - end - end - end - - describe '#empty?' do - it 'responds' do - @list.should respond_to(:empty?) - end - - it 'is not empty' do - @list.should_not be_empty - end - end - - describe '#last' do - it 'responds' do - @list.should respond_to(:last) - end - - it 'is a Verso::ProgramArea object' do - @list.last.should be_a(Verso::ProgramArea) - end - end - - describe '#length' do - it 'responds' do - @list.should respond_to(:length) - end - - it 'is a Fixnum' do - @list.length.should be_a(Fixnum) - end - end - - describe '#first' do - it 'responds' do - @list.should respond_to(:first) - end - - it 'is a Verso::ProgramArea object' do - @list.first.should be_a(Verso::ProgramArea) - end - end - - describe '#count' do - it 'responds' do - @list.should respond_to(:count) - end - - it 'is a Fixnum' do - @list.count.should be_a(Fixnum) - end - end + it_behaves_like 'any Verso list' end
Use shared examples for array-like behavior
diff --git a/spec/recipes/ec2_hints_spec.rb b/spec/recipes/ec2_hints_spec.rb index abc1234..def5678 100644 --- a/spec/recipes/ec2_hints_spec.rb +++ b/spec/recipes/ec2_hints_spec.rb @@ -3,7 +3,7 @@ describe 'aws::ec2_hints' do let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) } - it 'adds the hint file' do + it 'creates the ohai hint' do expect(chef_run).to create_ohai_hint('ec2').at_compile_time end
Use a better description in the ChefSpec
diff --git a/foreigner-matcher.gemspec b/foreigner-matcher.gemspec index abc1234..def5678 100644 --- a/foreigner-matcher.gemspec +++ b/foreigner-matcher.gemspec @@ -12,7 +12,7 @@ s.summary = %q{Rspec matcher for testing the presence of foreign keys generated by Foreigner} s.description = %q{Adds rspec matcher to verify the presence of foreign keys generated by Foreigner in a table schema} - s.add_dependency "foreigner", "0.9.1" + s.add_dependency "foreigner", "~> 0.9.1" s.rubyforge_project = "foreigner-matcher"
Support foreigner versions ~> 0.9.1
diff --git a/site-cookbooks/nan-base/recipes/default.rb b/site-cookbooks/nan-base/recipes/default.rb index abc1234..def5678 100644 --- a/site-cookbooks/nan-base/recipes/default.rb +++ b/site-cookbooks/nan-base/recipes/default.rb @@ -22,6 +22,10 @@ tcsh nodejs npm + mysql-server + postgresql + redis-server + }.each do |p| package p do action :install
Add mysql, postgres & redis. Fixes #4.
diff --git a/app/controllers/rooms_controller.rb b/app/controllers/rooms_controller.rb index abc1234..def5678 100644 --- a/app/controllers/rooms_controller.rb +++ b/app/controllers/rooms_controller.rb @@ -4,11 +4,15 @@ def show @room = Room.find(params[:id]) - current_user.join(@room) unless @room.users.include?(current_user) + if !@room.users.include?(current_user) + _push_room_user_action(@room, 'join') + current_user.join(@room) + end end def join @room = Room.first_not_full + _push_room_user_action(current_user.room, 'leave') if current_user.room current_user.join @room redirect_to @room end @@ -21,7 +25,11 @@ private def push_room_user_action - channel = "/rooms/#{@room.id}/users/#{action_name}" + _push_room_user_action(@room, action_name) + end + + def _push_room_user_action(room, action) + channel = "/rooms/#{room.id}/users/#{action}" faye_client.publish(channel, { user: current_user, html: render_to_string('rooms/_user', locals: {user: current_user}, layout: false)
Fix join/leave events not sent in some cases
diff --git a/JDSlider.podspec b/JDSlider.podspec index abc1234..def5678 100644 --- a/JDSlider.podspec +++ b/JDSlider.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "JDSlider" - s.version = "0.0.1" + s.version = "1.0.0" s.summary = "An iOS Slider written in swift." s.description = "A full customizable Slider of UIView."
[MODIFIED] Set PodSpec to release 1.0.0
diff --git a/spec/features/admin/administrators_spec.rb b/spec/features/admin/administrators_spec.rb index abc1234..def5678 100644 --- a/spec/features/admin/administrators_spec.rb +++ b/spec/features/admin/administrators_spec.rb @@ -0,0 +1,37 @@+require 'rails_helper' + +feature 'Admin administrators' do + background do + @admin = create(:administrator) + @user = create(:user, username: 'Jose Luis Balbin') + @administrator = create(:administrator) + login_as(@admin.user) + visit admin_administrators_path + end + + scenario 'Index' do + expect(page).to have_content @administrator.name + expect(page).to have_content @administrator.email + expect(page).to_not have_content @user.name + end + + scenario 'Create Administrator', :js do + fill_in 'email', with: @user.email + click_button 'Search' + + expect(page).to have_content @user.name + click_link 'Add' + within("#administrators") do + expect(page).to have_content @user.name + end + end + + scenario 'Delete Administrator' do + find(:xpath, "//tr[contains(.,'#{@administrator.name}')]/td/a", text: 'Delete').click + + within("#administrators") do + expect(page).to_not have_content @administrator.name + end + end +end +
Add feature spec for new Administrators management in Admin area
diff --git a/spec/requests/receive_notification_spec.rb b/spec/requests/receive_notification_spec.rb index abc1234..def5678 100644 --- a/spec/requests/receive_notification_spec.rb +++ b/spec/requests/receive_notification_spec.rb @@ -15,7 +15,7 @@ } expect { - post '/ses', body + post '/ses', body.to_json }.to change(Recoil::Bounce, :count).by(1) expect(Recoil::Bounce.last.email).to eq 'example@example.com'
Fix spec: test with actual json-body
diff --git a/Casks/path-finder.rb b/Casks/path-finder.rb index abc1234..def5678 100644 --- a/Casks/path-finder.rb +++ b/Casks/path-finder.rb @@ -1,6 +1,7 @@ class PathFinder < Cask url 'http://get.cocoatech.com/PF6_LION.zip' homepage 'http://www.cocoatech.com/pathfinder/' - version '6.1.5' - sha1 '5c05b1f4b9c9f9e0cd31d58f1e3c3417cf1ef3c8' + version 'latest' + no_checksum + link 'Path Finder.app' end
Fix PathFinder cask version and add link
diff --git a/app/models/spree/order_decorator.rb b/app/models/spree/order_decorator.rb index abc1234..def5678 100644 --- a/app/models/spree/order_decorator.rb +++ b/app/models/spree/order_decorator.rb @@ -1,7 +1,18 @@ module Spree class Order < ActiveRecord::Base - attr_accessible :use_corrected_address - attr_accessor :use_corrected_address - + + # Redefine clone_billing_address to ensure that is_shipping + # is true on shipping attribute + + def clone_billing_address + if bill_address and self.ship_address.nil? + self.ship_address = bill_address.clone + else + self.ship_address.attributes = bill_address.attributes.except('id', 'updated_at', 'created_at') + end + ship_address.is_shipping = true + true + end + end end
Redefine clone billing address to set is_shipping = true on ship address
diff --git a/month.gemspec b/month.gemspec index abc1234..def5678 100644 --- a/month.gemspec +++ b/month.gemspec @@ -5,7 +5,7 @@ s.platform = Gem::Platform::RUBY s.authors = ['Tim Craft'] s.email = ['mail@timcraft.com'] - s.homepage = 'http://github.com/timcraft/month' + s.homepage = 'https://github.com/timcraft/month' s.description = 'A little Ruby library for working with months' s.summary = 'See description' s.files = Dir.glob('{lib,spec}/**/*') + %w(LICENSE.txt README.md month.gemspec)
Use https url in gemspec
diff --git a/DPFoundation.podspec b/DPFoundation.podspec index abc1234..def5678 100644 --- a/DPFoundation.podspec +++ b/DPFoundation.podspec @@ -1,12 +1,12 @@ Pod::Spec.new do |s| s.name = 'DPFoundation' - s.version = '0.0.1' + s.version = '1.0.0' s.license = 'MIT' s.summary = 'A minimal set of additions and tools to any iOS app.' s.homepage = 'https://github.com/dulaccc/DPFoundation' s.authors = { 'Pierre Dulac' => 'pierre@dulaccc.me' } - s.source = { :git => 'https://github.com/dulaccc/DPFoundation.git', :tag => '0.0.1' } - s.source_files = 'DPFoundation' + s.source = { :git => 'https://github.com/dulaccc/DPFoundation.git', :tag => '1.0.0' } + s.source_files = 'DPFoundation/**/*.{h,m}' s.requires_arc = true s.platform = :ios, '5.0'
Bring the 1.0.0 version live
diff --git a/lib/adminable/presenters/entry_presenter.rb b/lib/adminable/presenters/entry_presenter.rb index abc1234..def5678 100644 --- a/lib/adminable/presenters/entry_presenter.rb +++ b/lib/adminable/presenters/entry_presenter.rb @@ -12,6 +12,13 @@ next end end + end + + def link_to_self + view.link_to( + to_name, + edit_polymorphic_path(entry) + ) end def link_to_delete
Add link_to_self to entry presenter
diff --git a/idlewatch.rb b/idlewatch.rb index abc1234..def5678 100644 --- a/idlewatch.rb +++ b/idlewatch.rb @@ -24,10 +24,13 @@ Thread.new do debug "Starting timer" - loop do - sleep 29 * 60 - imap.idle_done - end + sleep 29 * 60 + imap.idle_done + end + + Thread.new do + debug "Starting ssl timer" + sleep 10 * 3600 + 59 * 60 end begin
Add ssl timer : 11h minus 1 min
diff --git a/app/lib/services.rb b/app/lib/services.rb index abc1234..def5678 100644 --- a/app/lib/services.rb +++ b/app/lib/services.rb @@ -3,10 +3,16 @@ module Services def self.content_store - @content_store ||= GdsApi::ContentStore.new(Plek.find("content-store")) + @content_store ||= GdsApi::ContentStore.new( + Plek.find("content-store"), + disable_cache: Rails.env.development? + ) end def self.rummager - @rummager ||= GdsApi::Rummager.new(Plek.find("search")) + @rummager ||= GdsApi::Rummager.new( + Plek.find("search"), + disable_cache: Rails.env.development? + ) end end
Disable cacheing in development env Rummager request responses were being cached and caused surprising behaviour in that newly added specialist documents would not show up in search results after cacheing on the dev vm. Also disable cacheing for content store to be consistent.
diff --git a/app/models/admin.rb b/app/models/admin.rb index abc1234..def5678 100644 --- a/app/models/admin.rb +++ b/app/models/admin.rb @@ -8,6 +8,8 @@ attr_accessible :email, :password, :password_confirmation, :remember_me attr_accessible :role_ids + validates :role_ids, presence: true + before_save :ensure_authentication_token has_many :assignments, dependent: :destroy
Add validation for role for new users. Note: there is still a bug when a user doesn't have a role assigned, which results in an infinite loop when they log in. This is because the root_url is /validations, which is limited to project_participants and above, and CanCan redirects to root_url on AccessDenied exceptions. This shouldn't be an issue if the website is managed properly, but that's not gone well in the past.
diff --git a/app/models/quote.rb b/app/models/quote.rb index abc1234..def5678 100644 --- a/app/models/quote.rb +++ b/app/models/quote.rb @@ -11,7 +11,7 @@ end def replace_with_raw_quote!(raw_quote, new_description) - self.description = new_description + update_attribute(:description, new_description) self.lines = raw_quote.lines.map do |raw_line| Line.from_raw_line(raw_line)
Fix updating of the description.
diff --git a/app/models/theme.rb b/app/models/theme.rb index abc1234..def5678 100644 --- a/app/models/theme.rb +++ b/app/models/theme.rb @@ -1,7 +1,8 @@ class Theme + ALPHA_TAXONOMY = '/alpha-taxonomy'.freeze # TODO: remove once all base paths have been updated EDUCATION_THEME_BASE_PATH = '/education-training-and-skills'.freeze def self.taxon_path_prefixes - [EDUCATION_THEME_BASE_PATH] + [EDUCATION_THEME_BASE_PATH, ALPHA_TAXONOMY] end end
Add alpha taxonomy to allowable path prefixes
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -10,6 +10,12 @@ end def permission_denied - redirect_to new_user_session_path if current_user.nil? + if current_user.nil? + flash.alert = t("permission_denied_sign_in") + redirect_to new_user_session_path + else + flash.alert = t("permission_denied") + render status: :unauthorized, text: "You are not authorised to access that page." + end end end
Fix permission_denied method so it actually denies permission.
diff --git a/cookbooks/pacman/default.rb b/cookbooks/pacman/default.rb index abc1234..def5678 100644 --- a/cookbooks/pacman/default.rb +++ b/cookbooks/pacman/default.rb @@ -53,4 +53,5 @@ package 'xf86-video-intel' package 'xorg' package 'xorg-xinit' +package 'xsel' package 'yarn'
Fix an issue that yank to clipboard in neovim See https://github.com/neovim/neovim/issues/2642
diff --git a/app/helpers/status_helper.rb b/app/helpers/status_helper.rb index abc1234..def5678 100644 --- a/app/helpers/status_helper.rb +++ b/app/helpers/status_helper.rb @@ -0,0 +1,28 @@+# +# Copyright:: Copyright (c) 2008-2012 Opscode, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +module StatusHelper + def time_difference_in_hms(unix_time) + now = Time.now.to_i + difference = now - unix_time.to_i + hours = (difference / 3600).to_i + difference = difference % 3600 + minutes = (difference / 60).to_i + seconds = (difference % 60) + return [hours, minutes, seconds] + end +end
Add missing missing status helpers.
diff --git a/qjson.gemspec b/qjson.gemspec index abc1234..def5678 100644 --- a/qjson.gemspec +++ b/qjson.gemspec @@ -15,8 +15,9 @@ s.description = "Description of Qjson." s.license = "MIT" - s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"] + s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") + s.require_paths = ["lib"] s.add_dependency "rails", "~> 3.2.0"
Use more normal file inclusion description.
diff --git a/spec/models/spree/shipment_spec.rb b/spec/models/spree/shipment_spec.rb index abc1234..def5678 100644 --- a/spec/models/spree/shipment_spec.rb +++ b/spec/models/spree/shipment_spec.rb @@ -6,54 +6,30 @@ subject { shipment.determine_state(shipment.order) } describe "#determine_state_with_signifyd" do + context "with a canceled order" do + before { shipment.order.update_columns(state: 'canceled') } - context "with a risky order" do - before { allow(shipment.order).to receive(:is_risky?).and_return(true) } + it "canceled shipments remain canceled", pending: true do + expect(subject).to eq "canceled" + end + end - context "the order is not approved" do - it "returns pending" do - allow(shipment.order).to receive(:approved?).and_return(false) - expect(subject).to eq "pending" - end + context "with an approved order" do + before { shipment.order.contents.approve(name: 'test approver') } + + it "pending shipments remain pending" do + expect(subject).to eq "pending" end + end - context "the order is approved" do + [:shipped, :ready].each do |state| + context "the shipment is #{state}" do + before { shipment.update(state: state) } it "defaults to existing behavior" do - allow(shipment.order).to receive(:approved?).and_return(true) expect(shipment).to receive(:determine_state).with(shipment.order) subject end end end - - context "without a risky order" do - before { allow(shipment.order).to receive(:is_risky?).and_return(false) } - - it "defaults to existing behavior" do - expect(shipment).to receive(:determine_state).with(shipment.order) - subject - end - end - - context "shipment state" do - [:shipped, :ready].each do |state| - context "the shipment is #{state}" do - before { shipment.update_columns(state: state) } - it "defaults to existing behavior" do - expect(shipment).to receive(:determine_state).with(shipment.order) - subject - end - end - end - - [:pending, :canceled].each do |state| - context "the shipment is #{state}" do - before { shipment.update_columns(state: state) } - it "is pending" do - expect(subject).to eq "pending" - end - end - end - end end end
Remove talk of risky order from shipment spec The determine_state override no longer takes order riskyness into account so let's eliminate that discussion from the specs and instead specify the current behaviour.
diff --git a/lib/axiom/types/numeric.rb b/lib/axiom/types/numeric.rb index abc1234..def5678 100644 --- a/lib/axiom/types/numeric.rb +++ b/lib/axiom/types/numeric.rb @@ -5,6 +5,8 @@ # Represents a numeric type class Numeric < Object + extend ValueComparable + primitive ::Numeric coercion_method :to_numeric
Update Numeric types to be value comparable
diff --git a/app/daily_job.rb b/app/daily_job.rb index abc1234..def5678 100644 --- a/app/daily_job.rb +++ b/app/daily_job.rb @@ -30,13 +30,14 @@ system("git add index.html") system("git commit -m 'Site Update on #{today}'") - system "git push orgin gh-pages" + # Push the branch + system("git push origin #{branch_name}") true end def self.branch_name - "update-#{now.strftime("%F-%H%M%S")}" + @_branch_name ||= "update-#{now.strftime("%F-%H%M%S")}" end def self.today
Fix typos and push to correct branch
diff --git a/lib/league_manager/team.rb b/lib/league_manager/team.rb index abc1234..def5678 100644 --- a/lib/league_manager/team.rb +++ b/lib/league_manager/team.rb @@ -1,6 +1,6 @@ module LeagueManager class Team < LeagueManager::Base attr_reader :color, :division_name, :league_name, :season_name, :active, :division - attr_reader :players, :standing + attr_reader :players, :standing, :season_champions, :playoffs_champions end end
Add season and playoffs champions flags
diff --git a/ext/spyglass/extconf.rb b/ext/spyglass/extconf.rb index abc1234..def5678 100644 --- a/ext/spyglass/extconf.rb +++ b/ext/spyglass/extconf.rb @@ -3,4 +3,4 @@ $CFLAGS = ENV["CFLAGS"].to_s + " " + `pkg-config opencv --cflags`.chomp $LOCAL_LIBS = ENV["LIBS"].to_s + " " + `pkg-config opencv --libs`.chomp -create_makefile("spyglass") +create_makefile("spyglass/spyglass")
Create the makefile with the right path.
diff --git a/devise_campaignable.gemspec b/devise_campaignable.gemspec index abc1234..def5678 100644 --- a/devise_campaignable.gemspec +++ b/devise_campaignable.gemspec @@ -21,7 +21,8 @@ spec.add_development_dependency "bundler", "~> 1.5" spec.add_development_dependency "rake" spec.add_development_dependency "rspec" - - spec.add_runtime_dependency "devise", "~> 3.2.0" + spec.add_development_dependency "activemodel" + + spec.add_runtime_dependency "devise", ">= 3.2.0" spec.add_runtime_dependency "gibbon", "~> 2.0" end
Add activemodel as a dev dependency. The specs load Devise, which in turn loads active_support/dependencies but this isn't itself an explicit dependency for devise
diff --git a/rack-uri_sanitizer.gemspec b/rack-uri_sanitizer.gemspec index abc1234..def5678 100644 --- a/rack-uri_sanitizer.gemspec +++ b/rack-uri_sanitizer.gemspec @@ -11,7 +11,7 @@ spec.description = %q{Rack::URISanitizer is a Rack middleware which cleans up } << %q{trailing % characters in request URI.} spec.summary = spec.description - spec.homepage = "" + spec.homepage = "https://github.com/cfabianski/rack-uri_sanitizer" spec.license = "MIT" spec.files = `git ls-files`.split($/)
Add homepage reference in gemspec
diff --git a/bedrock.rb b/bedrock.rb index abc1234..def5678 100644 --- a/bedrock.rb +++ b/bedrock.rb @@ -1,5 +1,5 @@ # Base Rails template for setting up a new project. -TEMPLATE_ROOT = "./rails-templates" +TEMPLATE_ROOT = "http://github.com/thethirdswitch/rails-templates/raw/master" ['test-frameworks.rb', 'formtastic.rb', 'authlogic.rb', 'standard.rb', 'git.rb'].each do |template| load_template "#{TEMPLATE_ROOT}/#{template}"
Set template root to github repo
diff --git a/docker/docparse/generate.rb b/docker/docparse/generate.rb index abc1234..def5678 100644 --- a/docker/docparse/generate.rb +++ b/docker/docparse/generate.rb @@ -6,8 +6,8 @@ args = Shellwords.split(File.read('.yardopts').gsub(/^[ \t]*#.+/m, '')) args.each_with_index do |arg, i| next unless arg == '--plugin' - next unless arguments[i + 1] - system "gem install yard-#{arguments[i + 1]}" + next unless args[i + 1] + system "gem install yard-#{args[i + 1]}" end end
Fix bug in YARD gem plugin installation
diff --git a/ruby/subscription-ach.rb b/ruby/subscription-ach.rb index abc1234..def5678 100644 --- a/ruby/subscription-ach.rb +++ b/ruby/subscription-ach.rb @@ -0,0 +1,26 @@+require 'chargify_api_ares' + +Chargify.configure do |c| + c.subdomain = ENV['CHARGIFY_SUBDOMAIN'] + c.api_key = ENV['CHARGIFY_API_KEY'] +end + +subscription = Chargify::Subscription.create( + :product_handle => 'test-trial-product', + :customer_attributes => { + :reference => "abc987", + :first_name => "Test ACH", + :last_name => "Customer987", + :email => "test@example.com" + }, + :bank_account_attributes => { + "bank_name"=> "Best Bank", + "bank_routing_number"=> "021000089", + "bank_account_number"=> "111111111111", + "bank_account_type"=> "checking", + "bank_account_holder_type"=> "personal", + "payment_type"=> "bank_account" + } +) + +puts subscription.inspect
Add example of creating an ACH subscription with the Ruby gem
diff --git a/spec/models/machine_spec.rb b/spec/models/machine_spec.rb index abc1234..def5678 100644 --- a/spec/models/machine_spec.rb +++ b/spec/models/machine_spec.rb @@ -1,4 +1,25 @@ require 'spec_helper' describe Machine do + describe 'create' do + before do + Machine.create( + name: 'sample', + difficulties: %w(BASIC MEDIUM HARD) + ) + @machine = Machine.find_by_name('sample') + end + subject { @machine } + context 'when successfully created' do + it 'has correct name' do + expect(subject.name).to eq 'sample' + end + it 'has correct difficulties' do + subject.difficulties.should have(3).items + subject.difficulties[0].should eq('BASIC') + subject.difficulties[1].should eq('MEDIUM') + subject.difficulties[2].should eq('HARD') + end + end + end end
Add specs for Machine model.
diff --git a/spec/requests/links_spec.rb b/spec/requests/links_spec.rb index abc1234..def5678 100644 --- a/spec/requests/links_spec.rb +++ b/spec/requests/links_spec.rb @@ -9,4 +9,25 @@ expect(response.status).to be(200) end end + + describe "GET /l/:short_name" do + context "when short_name exists" do + let(:link) { FactoryGirl.create(:link) } + + it "redirects to the link's URL" do + get link_path(link) + + expect(response).to redirect_to(link.url) + expect(response.status).to be(302) + end + end + + context "when the short_name doesn't exist" do + it "responds with a 404" do + get link_path("does-not-exist") + + expect(response.status).to be(404) + end + end + end end
Add request specs for short URL redirects - For a valid short URL, ensure that we respond with a 302 redirect - For an invalid short URL, ensure that we respond with a 404
diff --git a/dta_rapid.gemspec b/dta_rapid.gemspec index abc1234..def5678 100644 --- a/dta_rapid.gemspec +++ b/dta_rapid.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |spec| spec.name = "dta_rapid" - spec.version = "1.4.8" + spec.version = "1.4.9" spec.authors = ["Gareth Rogers", "Andrew Carr", "Matt Chamberlain"] spec.email = ["grogers@thoughtworks.com", "andrew@2metres.com", "mchamber@thoughtworks.com"]
Update gem version to 1.4.9
diff --git a/lib/acclimate/output.rb b/lib/acclimate/output.rb index abc1234..def5678 100644 --- a/lib/acclimate/output.rb +++ b/lib/acclimate/output.rb @@ -39,7 +39,7 @@ write "#{msg}... ", color block.call say_ok - rescue ConfirmationError => e + rescue Acclimate::ConfirmationError => e say_error say_stderr( e.message, :red ) e.finish
Fix NameError caused by not providing namesspace (due to Autolaoded).
diff --git a/lib/adhearsion/calls.rb b/lib/adhearsion/calls.rb index abc1234..def5678 100644 --- a/lib/adhearsion/calls.rb +++ b/lib/adhearsion/calls.rb @@ -49,6 +49,8 @@ call_id = key call remove_inactive_call call return unless reason + Adhearsion::Events.trigger :exception, reason + logger.error "Call #{call_id} terminated abnormally due to #{reason}. Forcing hangup." PunchblockPlugin.client.execute_command Punchblock::Command::Hangup.new, :async => true, :call_id => call_id end end
Add logging of exceptions which cause call actors to die and be force-hung-up
diff --git a/lib/eol_deprecations.rb b/lib/eol_deprecations.rb index abc1234..def5678 100644 --- a/lib/eol_deprecations.rb +++ b/lib/eol_deprecations.rb @@ -17,7 +17,7 @@ attr_reader :name, :version_line, :date, :link def initialize(hash) @name = hash['name'] - @match = Regexp.new(hash['match']) + @match = Regexp.new(hash['match'] || "") @version_line = hash['version_line'] @date = hash['date'] @link = hash['link']
Add default empty string for eol_extensions if no match Co-authored-by: David Freilich <0106e5ee349bb58d7c51800b6acf5b57cf80aef6@pivotal.io>
diff --git a/lib/fappu/connection.rb b/lib/fappu/connection.rb index abc1234..def5678 100644 --- a/lib/fappu/connection.rb +++ b/lib/fappu/connection.rb @@ -1,5 +1,5 @@+require 'open-uri' require 'json' -require 'faraday' module Fappu class Connection @@ -8,10 +8,11 @@ def initialize(settings={}) @base_url = settings[:base_url] || "https://api.fakku.net/index" - connection = Faraday.new(url: @base_url) - @response = connection.get - @body = JSON.parse @response.body + # @response = RestClient.get @base_url + @response = URI.parse(@base_url).read + + @body = JSON.parse @response @title = @response['title'] end
Use core uri lib. desu.
diff --git a/lib/redirector/tests.rb b/lib/redirector/tests.rb index abc1234..def5678 100644 --- a/lib/redirector/tests.rb +++ b/lib/redirector/tests.rb @@ -6,7 +6,7 @@ Old Url,New Url,Status http://#{args.host},https://www.gov.uk/government/organisations/#{args.whitehall_slug},301 CSV - `echo -n '#{tests_csv}' > #{tests_filename}` + `echo '#{tests_csv.chomp}' > #{tests_filename}` end end end
Add a chomp, remove an echo
diff --git a/lib/s3browser/worker.rb b/lib/s3browser/worker.rb index abc1234..def5678 100644 --- a/lib/s3browser/worker.rb +++ b/lib/s3browser/worker.rb @@ -14,8 +14,8 @@ key = record['s3']['object']['key'] info = s3.head_object({ bucket: bucket, key: key }) + info = info.to_h.merge(record['s3']['object']) - info = info.to_h store.add bucket, info end else
fix: Merge in missing object info
diff --git a/lib/stacks/inventory.rb b/lib/stacks/inventory.rb index abc1234..def5678 100644 --- a/lib/stacks/inventory.rb +++ b/lib/stacks/inventory.rb @@ -1,12 +1,16 @@ class Stacks::Inventory def initialize(stack_dir) - stack_file = "#{stack_dir}/stack.rb" - raise "no stack.rb found in #{stack_dir}" unless File.exist? stack_file - @stacks = Object.new @stacks.extend Stacks::DSL - @stacks.instance_eval(IO.read(stack_file), stack_file) + Dir.glob("#{stack_dir}/*.rb").each do |stack_file| + begin + @stacks.instance_eval(IO.read("#{stack_dir}/#{stack_file}"), "#{stack_dir}/#{stack_file}") + rescue + backtrace = $@.join("\n") + raise "Unable to instance_eval #{stack_file}\n#{$!}\n#{backtrace}" + end + end end def find(fqdn)
Revert "Revert "rpearce: Adding support for multiple stackbuilder-config files"" This reverts commit 36c6eec0ee544e0d7524a923aa116e95775df4d4.
diff --git a/spec/models/grok_spec.rb b/spec/models/grok_spec.rb index abc1234..def5678 100644 --- a/spec/models/grok_spec.rb +++ b/spec/models/grok_spec.rb @@ -14,13 +14,33 @@ end + describe "API response parsing for a single date" do - describe "API response parsing" do - - it "should return page views for a given article after a certain date" do + it "should return page views for a given article for a single day" do VCR.use_cassette "grok/pageview_data" do views = Grok.get_views_since_date_for_article "History of biology", "2014-09-18".to_date - expect(views.count).to equal(105) + + # Check for the expected views on a single day. + expect(views["2014-09-30"]).to eq(267) + end + end + + end + + describe "API response parsing for a date range" do + + it "should return page views for a given article in a certain date range" do + VCR.use_cassette "grok/pageview_data" do + views = Grok.get_views_since_date_for_article "History of biology", "2014-09-18".to_date + + # Check for the expected total views over a date range. + view_sum = 0 + views.each do |day, count| + if day.to_date >= "2014-12-23".to_date + view_sum += count + end + end + expect(view_sum).to eq(9027) end end @@ -30,4 +50,4 @@ describe "Public methods" do end -end+end
Fix Grok tests so they don't depend on when you create the fixtures
diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb index abc1234..def5678 100644 --- a/spec/support/capybara.rb +++ b/spec/support/capybara.rb @@ -0,0 +1,8 @@+require 'capybara/rails' +require 'capybara/dsl' + +RSpec.configure do |c| + c.include Capybara, :example_group => { + :file_path => /\bspec\/integration\// + } +end
Remove Test::Unit, replace with RSpec + Capybara
diff --git a/sorting.rb b/sorting.rb index abc1234..def5678 100644 --- a/sorting.rb +++ b/sorting.rb @@ -6,7 +6,15 @@ lesser.quicksort + [pivot] + greater.quicksort end + def quicksort! + self.replace(self.quicksort) + end + def insertion_sort + self.dup.insertion_sort! + end + + def insertion_sort! self.each_index do |i| j = i while j > 0 && self[j - 1] > self[j]
Add mutable and non-mutable versions of existing algorithms
diff --git a/hive-runner-android.gemspec b/hive-runner-android.gemspec index abc1234..def5678 100644 --- a/hive-runner-android.gemspec +++ b/hive-runner-android.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'hive-runner-android' - s.version = '1.1.0' + s.version = '1.1.1' s.date = '2015-02-26' s.summary = 'Hive Runner Android' s.description = 'The Android controller module for Hive Runner'
Check to see if an error message has been returned from DeviceDBComms