diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/test/git_test.rb b/test/git_test.rb index abc1234..def5678 100644 --- a/test/git_test.rb +++ b/test/git_test.rb @@ -0,0 +1,37 @@+require 'test_helper' + +class GitTest < Minitest::Test + def test_get_tags_sort_by_date_asc + output = <<-EOF +refs/tags/0.0.1 Thu Aug 4 12:34:56 2011 +0200 +refs/tags/1.0.0 Fri Aug 5 11:11:11 2011 +0200 +refs/tags/1.0.1 Thu Sep 12 21:10:00 2013 +0200 +refs/tags/1.1.0 Thu Dec 10 10:10:10 2015 +0200 +refs/tags/2.0.0 Fri Dec 11 12:12:12 2015 +0200 + EOF + expected = [ + '0.0.1 Thu Aug 4 12:34:56 2011 +0200', + '1.0.0 Fri Aug 5 11:11:11 2011 +0200', + '1.0.1 Thu Sep 12 21:10:00 2013 +0200', + '1.1.0 Thu Dec 10 10:10:10 2015 +0200', + '2.0.0 Fri Dec 11 12:12:12 2015 +0200' + ] + MindTheChanges::Git.expects(:`).with("git for-each-ref --sort=taggerdate --format '%(refname) %(taggerdate)' refs/tags").returns(output).once + assert_equal(expected, MindTheChanges::Git.get_tags_sort_by_date_asc) + end + + def test_get_commit_hash + tag = '1.1.0' + output = "1a2b3c0f0f0f0f0f0f0f0f0f0f0f0f0f0f1a2b3c\n" + expected = output.strip + MindTheChanges::Git.expects(:`).with("git rev-list -n 1 #{tag}").returns(output).once + assert_equal(expected, MindTheChanges::Git.get_commit_hash(tag)) + end + + def test_get_commit_hash_of_head + output = "1a2b3c0f0f0f0f0f0f0f0f0f0f0f0f0f0f1a2b3c\n" + expected = output.strip + MindTheChanges::Git.expects(:`).with("git rev-parse HEAD").returns(output).once + assert_equal(expected, MindTheChanges::Git.get_commit_hash_of_head) + end +end
Add unit tests for Git class
diff --git a/lib/generators/georgia/upgrade/upgrade_generator.rb b/lib/generators/georgia/upgrade/upgrade_generator.rb index abc1234..def5678 100644 --- a/lib/generators/georgia/upgrade/upgrade_generator.rb +++ b/lib/generators/georgia/upgrade/upgrade_generator.rb @@ -23,6 +23,10 @@ rake 'db:migrate' end + def create_guest_role + rake 'georgia:upgrade' + end + end end end
Add guest role and clean roles to keep only one
diff --git a/lib/generators/pwdcalc/install/install_generator.rb b/lib/generators/pwdcalc/install/install_generator.rb index abc1234..def5678 100644 --- a/lib/generators/pwdcalc/install/install_generator.rb +++ b/lib/generators/pwdcalc/install/install_generator.rb @@ -1,19 +1,22 @@ module Pwdcalc module Generators - class InstallGenerator < Rails::Generators::Base + + class InstallGenerator < ::Rails::Generators::Base source_root File.expand_path('../templates', __FILE__) - - if ::Rails.version[0..2].to_f >= 3.1 - # Rails 3.1 has the asset pipeline, no need to copy JS files any more. - else - copy_file "../../../../../app/assets/javascripts/jquery.YAPSM.min.js", "public/javascripts/jquery.YAPSM.min.js" - copy_file "../../../../../app/assets/javascripts/jquery.pwdcalc.js", "public/javascripts/jquery.pwdcalc.js" - end def copy_locales copy_file "pwdcalc.en.yml", "config/locales/pwdcalc.en.yml" end + def copy_javascripts + if ::Rails.version[0..2].to_f >= 3.1 + # Rails 3.1 has the asset pipeline, no need to copy JS files any more. + else + copy_file "../../../../../app/assets/javascripts/jquery.YAPSM.min.js", "public/javascripts/jquery.YAPSM.min.js" + copy_file "../../../../../app/assets/javascripts/jquery.pwdcalc.js", "public/javascripts/jquery.pwdcalc.js" + end + end + end end -end+end
Fix generator for Rails version 3.0.x
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index abc1234..def5678 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -1,7 +1,8 @@ Rails.application.config.assets.precompile += %w( publify.js + publify.css publify_admin.js - publify.css + publify_admin.css accounts.css bootstrap.css )
Include admin css in precompile list
diff --git a/app/jobs/import_async_job.rb b/app/jobs/import_async_job.rb index abc1234..def5678 100644 --- a/app/jobs/import_async_job.rb +++ b/app/jobs/import_async_job.rb @@ -2,6 +2,6 @@ class ImportAsyncJob def perform(import_job) - ::ETL::AsyncImporter.perform(import_job) + ::ETL::AsyncImporter.import!(import_job) end end
Call the right method from the async job
diff --git a/app/jobs/import_paper_job.rb b/app/jobs/import_paper_job.rb index abc1234..def5678 100644 --- a/app/jobs/import_paper_job.rb +++ b/app/jobs/import_paper_job.rb @@ -0,0 +1,18 @@+class ImportPaperJob < ActiveJob::Base + queue_as :import + + def perform(body, legislative_term, reference) + fail "No scraper found for body #{body}" if body.scraper.nil? + scraper = body.scraper::Detail.new(legislative_term, reference) + Rails.logger.info "Importing single Paper: #{body} - #{legislative_term} / #{page}" + item = scraper.scrape + if Paper.where(body: body, legislative_term: item[:legislative_term], reference: item[:reference]).exists? + Rails.logger.info "Paper already exists: [#{item[:reference]}] \"#{item[:title]}\"" + return + end + Rails.logger.info "New Paper: [#{item[:reference]}] \"#{item[:title]}\"" + paper = Paper.create!(item.except(:full_reference).merge({ body: body })) + LoadPaperDetailsJob.perform_later(paper) if paper.originators.blank? + StorePaperPDFJob.perform_later(paper) + end +end
Add single paper import job
diff --git a/app/models/email_template.rb b/app/models/email_template.rb index abc1234..def5678 100644 --- a/app/models/email_template.rb +++ b/app/models/email_template.rb @@ -4,7 +4,7 @@ include Concerns::Sortable - validates :description, :from_name, presence: true + validates :description, :from_name, :from_email, presence: true validates :identifier, presence: true, uniqueness: { case_sensitive: false } validates :from_email, email: true validates :cc, :bcc, email: true, allow_blank: true
Make sure simple form recognizes from email to be required.
diff --git a/lib/tasks/remove_duplicate_virtual_users.rake b/lib/tasks/remove_duplicate_virtual_users.rake index abc1234..def5678 100644 --- a/lib/tasks/remove_duplicate_virtual_users.rake +++ b/lib/tasks/remove_duplicate_virtual_users.rake @@ -0,0 +1,49 @@+namespace :remove_duplicate_virtual_users do + desc 'Remove duplicate users by redirecting all posts to a single user' + task :remove => :environment do + puts 'Removing duplicate users' + + Post.all.each do |post| + next if post.receivers.empty? + + post.receivers.each do |receiver| + next unless receiver.virtual_user + + similar_users = User.where('name LIKE?', receiver.name) + + next if similar_users.size == 1 + + new_user = nil + similar_users.each do |user| + new_user = user unless user.virtual_user + end + + new_user = similar_users.first if new_user.nil? + + similar_user_ids = similar_users.map { |user| user.id } + + post_receivers = PostReceiver.where('user_id IN (?)', similar_user_ids) + + post_receivers.each do |post_receiver| + post_receiver.user_id = new_user.id + post_receiver.save + end + + votes = Vote.where('voter_id IN (?)', similar_user_ids) + + votes.each do |vote| + vote.voter_id = new_user.id + vote.save + end + + similar_user_ids.delete(new_user.id) + + similar_user_ids.each do |user_id| + TeamMember.where(user_id: user_id).destroy_all + User.destroy(user_id) + end + end + end + end +end +
Add rake task to remove virtual users
diff --git a/db/migrate/20140623105038_populate_extra_fields_for_cma_cases.rb b/db/migrate/20140623105038_populate_extra_fields_for_cma_cases.rb index abc1234..def5678 100644 --- a/db/migrate/20140623105038_populate_extra_fields_for_cma_cases.rb +++ b/db/migrate/20140623105038_populate_extra_fields_for_cma_cases.rb @@ -0,0 +1,38 @@+class PopulateExtraFieldsForCmaCases < Mongoid::Migration + @editions = Class.new do + include Mongoid::Document + store_in :specialist_document_editions + end + + def self.up + # For each specialist document edition which does not have extra fields + cma_cases.where(:extra_fields.in => [nil, {}]).each do |edition| + extra_fields = edition.attributes.slice(*extra_field_names) + edition.update_attributes!(extra_fields: extra_fields) + end + end + + def self.down + cma_cases.each do |edition| + edition.update_attributes!( + edition.extra_fields.merge(extra_fields: nil) + ) + end + end + +private + def self.extra_field_names + %w( + opened_date + closed_date + case_type + case_state + market_sector + outcome_type + ) + end + + def self.cma_cases + @editions.where(document_type: "cma_case") + end +end
Copy CMA case metadata into extra_fields The code was updated to pull the CMA case specific metadata from extra_fields but the data wasn't migrated.
diff --git a/ConsistencyManager.podspec b/ConsistencyManager.podspec index abc1234..def5678 100644 --- a/ConsistencyManager.podspec +++ b/ConsistencyManager.podspec @@ -5,7 +5,7 @@ spec.homepage = 'https://linkedin.github.io/ConsistencyManager-iOS' spec.authors = 'LinkedIn' spec.summary = 'Manages the consistency of immutable models.' - spec.source = { :git => 'https://github.com/li-kramgopa/ConsistencyManager-iOS.git', :tag => spec.version } + spec.source = { :git => 'https://github.com/linkedin/ConsistencyManager-iOS.git', :tag => spec.version } spec.source_files = 'ConsistencyManager/**/*.swift' spec.ios.deployment_target = '8.0'
Fix spec source to point to linkedIn
diff --git a/lib/baton/server.rb b/lib/baton/server.rb index abc1234..def5678 100644 --- a/lib/baton/server.rb +++ b/lib/baton/server.rb @@ -8,6 +8,7 @@ # Public: Initialize a Server. ALso, configures the server by reading Baton's configuration # file. def initialize + Ohai::Config[:plugin_path] << "/etc/chef/ohai_plugins" @ohai = Ohai::System.new @ohai.all_plugins configure
Allow for custom ohai plugins
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index abc1234..def5678 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -5,6 +5,7 @@ # Add additional assets to the asset load path # Rails.application.config.assets.paths << Emoji.images_path +Rails.application.config.assets.paths << Rails.root.join("vendor", "assets", "images") # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
Include vendor images in asset pipeline
diff --git a/lib/alephant/publisher.rb b/lib/alephant/publisher.rb index abc1234..def5678 100644 --- a/lib/alephant/publisher.rb +++ b/lib/alephant/publisher.rb @@ -29,8 +29,7 @@ opts[:receive_wait_time] || RECEIVE_WAIT_TIME, ) - @writer_opts = opts.select do |k,v| - [ + @writer_opts = opts.filter [ :msg_vary_id_path, :sequencer_table_name, :sequence_id_path, @@ -39,8 +38,7 @@ :s3_object_path, :view_path, :lookup_table_name - ].include? k - end + ] end def run!
Update Publisher to match new API within the BBC Cosmos Config gem
diff --git a/lib/cfcmd/cli/ls.rb b/lib/cfcmd/cli/ls.rb index abc1234..def5678 100644 --- a/lib/cfcmd/cli/ls.rb +++ b/lib/cfcmd/cli/ls.rb @@ -16,7 +16,7 @@ directories = connection.directories.map do |dir| { name: "cf://#{ dir.key }", - files: ::CFcmd::Util.number_to_human(dir.files.count), + files: ::CFcmd::Util.number_to_human(dir.count), size: ::CFcmd::Util.number_to_human_size(dir.bytes) } end
Use directory metadata instead of crawling buckets :flushed:
diff --git a/lib/document_generator.rb b/lib/document_generator.rb index abc1234..def5678 100644 --- a/lib/document_generator.rb +++ b/lib/document_generator.rb @@ -35,7 +35,6 @@ end def generate_matchers! - generate_matcher_dir! Rambo::RSpec::MatcherFile.new.generate end end
Delete extraneous line that wasn't helping anything
diff --git a/lib/mu/auth-sudo.rb b/lib/mu/auth-sudo.rb index abc1234..def5678 100644 --- a/lib/mu/auth-sudo.rb +++ b/lib/mu/auth-sudo.rb @@ -1,4 +1,10 @@ require 'sparql/client' +require 'logger' + +log_dir = '/logs' +Dir.mkdir(log_dir) unless Dir.exist?(log_dir) +log = Logger.new("#{log_dir}/application.log") +log.level = Kernel.const_get("Logger::#{ENV['LOG_LEVEL'].upcase}") module Mu module AuthSudo @@ -18,12 +24,12 @@ end def self.query(query) - puts "Executing sudo query: #{query}" + log.info "Executing sudo query: #{query}" sparql_client.query query end def self.update(query) - puts "Executing sudo update: #{query}" + log.info "Executing sudo update: #{query}" sparql_client.update query end end
Add logging for sudo queries
diff --git a/lib/replay/rails.rb b/lib/replay/rails.rb index abc1234..def5678 100644 --- a/lib/replay/rails.rb +++ b/lib/replay/rails.rb @@ -30,12 +30,24 @@ event_type.constantize.new(JSON.parse(data)) end + def metadata + Hash.new(envelope_data) + end + + def envelope + @envelope ||= Replay::EventEnvelope.new( + stream_id, + event, + metadata + ) + end + def self.events_for(stream_id) where(:stream_id => stream_id).order('created_at asc') end def self.event_stream(stream_id) - events_for(stream_id).to_a.map(&:event) + events_for(stream_id).to_a.map(&:envelope) end end
Store should be returning an entire event envelope
diff --git a/lib/scrunch/meta.rb b/lib/scrunch/meta.rb index abc1234..def5678 100644 --- a/lib/scrunch/meta.rb +++ b/lib/scrunch/meta.rb @@ -20,7 +20,7 @@ end def self.apply_metadata(file, metadata, cover) - %{AtomicParsley \"#{file}\" + %{AtomicParsley \"#{file}\" \ --title \"#{metadata["nam"]}\" \ --album \"#{metadata["alb"]}\" \ --artist \"#{metadata["ART"]}\" \
Fix a typo that causes AtomicParsley to fail
diff --git a/lib/engineyard/version.rb b/lib/engineyard/version.rb index abc1234..def5678 100644 --- a/lib/engineyard/version.rb +++ b/lib/engineyard/version.rb @@ -1,4 +1,4 @@ module EY - VERSION = '2.0.3' + VERSION = '2.0.4.pre' ENGINEYARD_SERVERSIDE_VERSION = ENV['ENGINEYARD_SERVERSIDE_VERSION'] || '2.0.1' end
Add .pre for next release
diff --git a/lib/facter/iis_version.rb b/lib/facter/iis_version.rb index abc1234..def5678 100644 --- a/lib/facter/iis_version.rb +++ b/lib/facter/iis_version.rb @@ -1,4 +1,4 @@-Facter.add(:iis_version) do +Facter.add(:iis_version4) do confine :kernel => :windows setcode do version = nil @@ -6,7 +6,7 @@ begin Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Microsoft\InetStp') do |reg| version = reg['VersionString'] - version = version[8,3] + version = version[8..-1] end rescue Win32::Registry::Error end
Change to handle versionnumbers abbove 10
diff --git a/lib/facter/netbiosname.rb b/lib/facter/netbiosname.rb index abc1234..def5678 100644 --- a/lib/facter/netbiosname.rb +++ b/lib/facter/netbiosname.rb @@ -2,6 +2,7 @@ # $hostname or $fqdn because these may be non-unique when truncated. Instead # we use the first 9 alphanumeric chars of the hostname and then append the # last 6 characters of the 8-character $uniqueid +require 'facter' Facter.add(:netbiosname) do setcode do uniqueid = Facter.value(:uniqueid)[2..7]
Add explicit requires to fact
diff --git a/lib/active_tsv/reflection.rb b/lib/active_tsv/reflection.rb index abc1234..def5678 100644 --- a/lib/active_tsv/reflection.rb +++ b/lib/active_tsv/reflection.rb @@ -4,7 +4,7 @@ class_eval <<-CODE, __FILE__, __LINE__ + 1 def #{name} #{name.to_s.singularize.classify}.where( - "#{self.name.downcase}_id" => self[self.class.primary_key] + "#{self.name.underscore}_id" => self[self.class.primary_key] ) end CODE @@ -14,7 +14,7 @@ class_eval <<-CODE, __FILE__, __LINE__ + 1 def #{name} #{name.to_s.singularize.classify}.where( - "#{self.name.downcase}_id" => self[self.class.primary_key] + "#{self.name.underscore}_id" => self[self.class.primary_key] ).first end CODE
Use underscore instead of downcase
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 @@ -1,7 +1,7 @@ class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. - protect_from_forgery with: :null_session + protect_from_forgery with: :exception before_action :authenticate_user! add_flash_types :danger, :error, :success, :warning
Switch from Null Session to Exception for CSRF Protection There are apparently some vulnerabilities to session nulling, depending on how one uses before_action. Not using before_action in vulnerable ways right now, but since I will undoubtedly forget this in the future I'm switching to exception.
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 @@ -1,12 +1,11 @@ class ApplicationController < ActionController::Base - before_action :store_location , :unless=> :login_page_access? + before_action :store_location , unless: :login_page_access? # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception + include SessionsHelper - include SessionsHelper - private def store_location @@ -14,7 +13,7 @@ end def login_page_access? - self.controller_name == 'login_page' || self.controller_name =='sessions' + %w(login_page sessions).include? self.controller_name end end
Refactor: Use hash rocket abbr and Rubyish String comparison
diff --git a/app/controllers/csv_preview_controller.rb b/app/controllers/csv_preview_controller.rb index abc1234..def5678 100644 --- a/app/controllers/csv_preview_controller.rb +++ b/app/controllers/csv_preview_controller.rb @@ -34,4 +34,13 @@ def visible_edition @visible_edition ||= attachment_data.visible_edition_for(current_user) end + + def incoming_upload_exists?(path) + path = path.sub(Whitehall.clean_uploads_root, Whitehall.incoming_uploads_root) + File.exist?(path) + end + + def upload_exists?(path) + File.exist?(path) && file_is_clean?(path) + end end
Copy BaseAttachmentsController methods into CsvPreviewController I think these are the only two methods in BaseAttachmentsController which need access to the filesystem. I'm hoping to implement them in a different way to avoid needing this access.
diff --git a/lib/cyclid/monkey_patches.rb b/lib/cyclid/monkey_patches.rb index abc1234..def5678 100644 --- a/lib/cyclid/monkey_patches.rb +++ b/lib/cyclid/monkey_patches.rb @@ -0,0 +1,32 @@+class Hash + # http://chrisholtz.com/blog/lets-make-a-ruby-hash-map-method-that-returns-a-hash-instead-of-an-array/ + def hmap(&block) + self.inject({}) do |hash, (k,v)| + hash.merge(block.call(k, v)) + end + end + + def interpolate(ctx) + self.hmap do |key, value| + if value.is_a? String + {key => value % ctx} + else + {key => value} + end + end + end +end + +class Array + def interpolate(ctx) + self.map do |entry| + if entry.is_a? Hash + entry.interpolate ctx + elsif entry.is_a? String + entry % @ctx + else + entry + end + end + end +end
Add useful methods to Hash & Array Hash.map returns an Array, so add Hash.hamp to return a Hash Add Array.interpolate & Hash.interpolate to centralise comprehensive methods to interpolate data into those structures E.g. job context.
diff --git a/lib/pansophy_authenticator/configuration/configurator.rb b/lib/pansophy_authenticator/configuration/configurator.rb index abc1234..def5678 100644 --- a/lib/pansophy_authenticator/configuration/configurator.rb +++ b/lib/pansophy_authenticator/configuration/configurator.rb @@ -25,20 +25,20 @@ end def config_values - @config_values ||= from_env + @config_values ||= from_env_or_base + end + + def from_env_or_base + FromEnv.new(base_config) end def base_config return self if @configuration_path.nil? - from_file + from_file_or_base end - def from_file + def from_file_or_base FromFile.new(self) - end - - def from_env - FromEnv.new(base_config) end end end
Rename and organise methods for clarity
diff --git a/benchmarks/list_comprehension.rb b/benchmarks/list_comprehension.rb index abc1234..def5678 100644 --- a/benchmarks/list_comprehension.rb +++ b/benchmarks/list_comprehension.rb @@ -8,20 +8,23 @@ require 'combinatorics/list_comprehension' Benchmark.bm(12) do |b| + singleton_list = ([1] * 500) + single_enum_list = [1..200, 1] + depth_list = [1..200] + b.report('singleton:') do - list = ([1] * 500) - - list.comprehension.each { |list| list.last } + singleton_list.comprehension.each { |list| list.last } end + b.report('single-enum:') do - list = [1..200, 1] - list.comprehension.each { |list| list.last } + single_enum_list.comprehension.each { |list| list.last } end (1..3).each do |n| + list = (depth_list * n) + b.report("depth #{n}:") do - list = ([1..200] * n) list.comprehension.each { |list| list.last } end end
Remove the list creating outside of the benchmark code.
diff --git a/lib/tty/prompt/symbols.rb b/lib/tty/prompt/symbols.rb index abc1234..def5678 100644 --- a/lib/tty/prompt/symbols.rb +++ b/lib/tty/prompt/symbols.rb @@ -32,6 +32,7 @@ pointer: '>', line: '─', pipe: '|', + handle: 'O', ellipsis: '...', radio_on: '(*)', radio_off: '( )',
Fix unicode symbol on windows.
diff --git a/get_column_widths.rb b/get_column_widths.rb index abc1234..def5678 100644 --- a/get_column_widths.rb +++ b/get_column_widths.rb @@ -0,0 +1,18 @@+def extract_values line + spaces = [] + result = [] + + while result != nil do + + if spaces.length==0 + line=line[0,line.length] + else + line=line[spaces.last+1,line.length] + end + + result = line.index(' ') + spaces.push(result) + end + + return spaces +end
ADD - get column widths
diff --git a/plugins/guests/debian/cap/change_host_name.rb b/plugins/guests/debian/cap/change_host_name.rb index abc1234..def5678 100644 --- a/plugins/guests/debian/cap/change_host_name.rb +++ b/plugins/guests/debian/cap/change_host_name.rb @@ -9,11 +9,11 @@ def self.change_host_name(machine, name) comm = machine.communicate - if !comm.test("hostname -f | grep -w '#{name}'") + if !comm.test("hostname -f | grep '^#{name}$'") basename = name.split(".", 2)[0] comm.sudo <<-EOH.gsub(/^ {14}/, '') # Set the hostname - echo '#{name}' > /etc/hostname + echo '#{basename}' > /etc/hostname hostname -F /etc/hostname # Remove comments and blank lines from /etc/hosts
guests/debian: Set hostname to short value Refs GH-7488
diff --git a/lib/dry/matcher/evaluator.rb b/lib/dry/matcher/evaluator.rb index abc1234..def5678 100644 --- a/lib/dry/matcher/evaluator.rb +++ b/lib/dry/matcher/evaluator.rb @@ -8,8 +8,8 @@ @output = nil end - def call(&block) - block.call(self) + def call + yield self @output end @@ -25,12 +25,12 @@ private - def handle_case(kase, *pattern, &block) + def handle_case(kase, *pattern) return @output if @matched if kase.matches?(@result, *pattern) @matched = true - @output = block.call(kase.resolve(@result)) + @output = yield(kase.resolve(@result)) end end end
Use yield instead of block.call with &block arguments This yields us a little performance improvement (see https://github.com/JuanitoFatas/fast-ruby#proccall-and-block-arguments-vs-yieldcode)
diff --git a/lib/forem/user_extensions.rb b/lib/forem/user_extensions.rb index abc1234..def5678 100644 --- a/lib/forem/user_extensions.rb +++ b/lib/forem/user_extensions.rb @@ -3,7 +3,14 @@ def self.included(base) Forem::Topic.belongs_to :user, :class_name => base.to_s Forem::Post.belongs_to :user, :class_name => base.to_s + + # FIXME: Obviously terrible, temp to get further + def forem_admin? + %w(refinery superuser).detect do |r| + has_role?(r) + end + end end end -end+end
[refinery] Make refinery user's forem_admin? key off of refinery roles.
diff --git a/lib/lightspeed_restaurant.rb b/lib/lightspeed_restaurant.rb index abc1234..def5678 100644 --- a/lib/lightspeed_restaurant.rb +++ b/lib/lightspeed_restaurant.rb @@ -1,43 +1,11 @@ # Lightspeed Restaurant Ruby Bindings # API spec at http://staging-exact-integration.posios.com/PosServer/swagger-ui.html -require 'rest-client' +require 'excon' require 'json' -# -# Version -# - require 'lightspeed_restaurant/version' - -# -# Resources -# - -require 'lightspeed_restaurant/company' -require 'lightspeed_restaurant/customer' -require 'lightspeed_restaurant/establishment' -require 'lightspeed_restaurant/feature' -require 'lightspeed_restaurant/floor' -require 'lightspeed_restaurant/order' -require 'lightspeed_restaurant/payment_type' -require 'lightspeed_restaurant/product' -require 'lightspeed_restaurant/product_group' -require 'lightspeed_restaurant/receipt' -require 'lightspeed_restaurant/referral' -require 'lightspeed_restaurant/report' -require 'lightspeed_restaurant/reservation' -require 'lightspeed_restaurant/table' -require 'lightspeed_restaurant/tax' -require 'lightspeed_restaurant/ticket' - -# -# Errors -# - -require 'lightspeed_restaurant/errors/lightspeed_restaurant_error' -require 'lightspeed_restaurant/errors/api_connection_error' +require 'lightspeed_restaurant/client' module LightspeedRestaurant - @base_uri = 'http://us1.posios.com/PosServer' end
Remove unnecessary require in the main module
diff --git a/lib/remotipart/middleware.rb b/lib/remotipart/middleware.rb index abc1234..def5678 100644 --- a/lib/remotipart/middleware.rb +++ b/lib/remotipart/middleware.rb @@ -24,8 +24,8 @@ end # Override the accepted format, because it isn't what we really want - if params['X-Http-Accept'] - env['HTTP_ACCEPT'] = params['X-Http-Accept'] + if params['X-HTTP-Accept'] + env['HTTP_ACCEPT'] = params['X-HTTP-Accept'] end end
Update HTTP_ACCEPT for jquery.iframe-transport update Change params['X-Http-Accept'] with params['X-HTTP-Accept']
diff --git a/lib/tasks/cached_assets.rake b/lib/tasks/cached_assets.rake index abc1234..def5678 100644 --- a/lib/tasks/cached_assets.rake +++ b/lib/tasks/cached_assets.rake @@ -4,6 +4,18 @@ include ActionView::Helpers::TagHelper include ActionView::Helpers::UrlHelper include ActionView::Helpers::AssetTagHelper + js_dir = "#{RAILS_ROOT}/public/javascripts/" + css_dir = "#{RAILS_ROOT}/public/stylesheets/" + js_assets = ['libraries', 'main'] + css_assets = ['main'] + js_assets.each do |basename| + path = "#{js_dir}#{basename}.js" + system("rm #{path}") if (File.exist?(path)) + end + css_assets.each do |basename| + path = "#{css_dir}#{basename}.css" + system("rm #{path}") if (File.exist?(path)) + end stylesheet_link_tag('core', 'fixmytransport', 'map', 'buttons', :cache => 'main') javascript_include_tag('fixmytransport', 'application', :charset => 'utf-8', :cache => 'main') javascript_include_tag('jquery-1.5.2.min', 'jquery-ui-1.8.13.custom.min', 'jquery.autofill.min', 'jquery.form.min', :charset => 'utf-8', :cache => 'libraries')
Destroy existing cached assets if they exist.
diff --git a/lib/tasks/evm_rake_helper.rb b/lib/tasks/evm_rake_helper.rb index abc1234..def5678 100644 --- a/lib/tasks/evm_rake_helper.rb +++ b/lib/tasks/evm_rake_helper.rb @@ -3,7 +3,7 @@ # For some rake tasks, the database.yml may not yet be setup and is not required anyway. # Note: Rails will not actually use the configuration and connect until you issue a query. def self.with_dummy_database_url_configuration - before, ENV["DATABASE_URL"] = ENV["DATABASE_URL"], "postgresql://user:pass@127.0.0.1/dbname" + before, ENV["DATABASE_URL"] = ENV["DATABASE_URL"], "postgresql:///not_existing_db?host=/var/lib/postgresql" yield ensure # ENV['x'] = nil deletes the key because ENV accepts only string values
Use unix sockets, not IPv4, for the dummy DB configuration. By default, we trust local unix socket connections[1], but not 127.0.0.1 or ::1. Therefore, we should use unix sockets for the rake task that ensures we don't try to connect using a badly configured database URL when we try to load rails environment. [1] https://github.com/ManageIQ/guides/blob/master/developer_setup.md Fixes #6915
diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb index abc1234..def5678 100644 --- a/config/initializers/cookies_serializer.rb +++ b/config/initializers/cookies_serializer.rb @@ -2,4 +2,4 @@ # Specify a serializer for the signed and encrypted cookie jars. # Valid options are :json, :marshal, and :hybrid. -Rails.application.config.action_dispatch.cookies_serializer = :marshal +Rails.application.config.action_dispatch.cookies_serializer = :hybrid
Change cookie serialiser to hybrid to prepare for switch to json
diff --git a/aphrodite/app/views/api/v2/documents/search.json.rabl b/aphrodite/app/views/api/v2/documents/search.json.rabl index abc1234..def5678 100644 --- a/aphrodite/app/views/api/v2/documents/search.json.rabl +++ b/aphrodite/app/views/api/v2/documents/search.json.rabl @@ -1,2 +1,6 @@ collection @results -attributes :title, :original_filename, :document_id, :num, :text, :created_at, :counters, :highlight+attributes :title, :original_filename, :document_id, :num, :text, :created_at, :counters, :highlight + +node :id do |result| + result.document_id +end
[aphrodite] Send id for documents in search
diff --git a/app/controllers/gobierto_people/welcome_controller.rb b/app/controllers/gobierto_people/welcome_controller.rb index abc1234..def5678 100644 --- a/app/controllers/gobierto_people/welcome_controller.rb +++ b/app/controllers/gobierto_people/welcome_controller.rb @@ -4,13 +4,24 @@ def index @people = current_site.people.active.politician.government.last(10) - @events = current_site.person_events.upcoming.sorted.first(10) @posts = current_site.person_posts.active.sorted.last(10) @political_groups = get_political_groups @home_text = load_home_text + set_events end private + + def set_events + @events = current_site.person_events.by_person_party(Person.categories[:government]).sorted + + if @events.upcoming.empty? + @no_upcoming_events = true + @events = @events.past.first(10) + else + @events = @events.upcoming.first(10) + end + end def load_home_text current_site.gobierto_people_settings.find_by(key: "home_text_#{I18n.locale}").try(:value)
Fix events retrieval for GobiertoPeople welcome controller
diff --git a/app/controllers/user_module_assessments_controller.rb b/app/controllers/user_module_assessments_controller.rb index abc1234..def5678 100644 --- a/app/controllers/user_module_assessments_controller.rb +++ b/app/controllers/user_module_assessments_controller.rb @@ -1,8 +1,12 @@ class UserModuleAssessmentsController < ApplicationController + + def create + @submitted_params = user_module_assessment_params + end private def user_module_assessment_params - + params.require(:user_module_assessment).permit(selected_answer_choices: {}) end end
Update strong parameters for UserModuleAssessment Rails 5.1 has a new feature for supporting arbitrary hashes that we'll be using to permit the selected_answer_choices for an assessment. https://github.com/rails/rails/commit/e86524c0c5a26ceec92895c830d1355ae47a7034
diff --git a/lib/xlogin/firmwares/vyos.rb b/lib/xlogin/firmwares/vyos.rb index abc1234..def5678 100644 --- a/lib/xlogin/firmwares/vyos.rb +++ b/lib/xlogin/firmwares/vyos.rb @@ -1,7 +1,8 @@ Xlogin.configure :vyos do |os| os.prompt(/[$#] (?:\e\[K)?\z/n) - os.bind(:login) do |username, password| + os.bind(:login) do |*args| + username, password = *args waitfor(/login:\s/) && puts(username) waitfor(/Password:\s/) && puts(password) waitfor
Change the login method to handle variable numbers of args
diff --git a/lib/engineyard/version.rb b/lib/engineyard/version.rb index abc1234..def5678 100644 --- a/lib/engineyard/version.rb +++ b/lib/engineyard/version.rb @@ -1,4 +1,4 @@ module EY - VERSION = '3.1.1' + VERSION = '3.1.2.pre' ENGINEYARD_SERVERSIDE_VERSION = ENV['ENGINEYARD_SERVERSIDE_VERSION'] || '2.6.1' end
Add .pre for next release
diff --git a/lib/fabrication/config.rb b/lib/fabrication/config.rb index abc1234..def5678 100644 --- a/lib/fabrication/config.rb +++ b/lib/fabrication/config.rb @@ -27,7 +27,7 @@ def fabricator_dir=(folders) puts "DEPRECATION WARNING: Fabrication::Config.fabricator_dir has been replaced by Fabrication::Config.fabricator_path" - fabricator_path = folders + self.fabricator_path = folders end attr_writer :sequence_start
Fix calling to setter method
diff --git a/lib/frankie/primitives.rb b/lib/frankie/primitives.rb index abc1234..def5678 100644 --- a/lib/frankie/primitives.rb +++ b/lib/frankie/primitives.rb @@ -7,7 +7,7 @@ def initialize body=[], status=200, header={} @raw_body = body - super + super body.to_s, status, header end def body= value
Convert the response to string before passing it to the superclass
diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index abc1234..def5678 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -6,6 +6,6 @@ warn 'with the command: CONSUMER_KEY=abc CONSUMER_SECRET=123 rails server' warn '*' * 80 else - provider :twitter, ENV['CONSUMER_KEY'], ENV['CONSUMER_SECRET'] + provider :twitter, ENV['eZHpmjVCOhmmwQSvGFopbOpwT'], ENV['2vqPUvvvGxWfQnjfTiBGDWMG2FNXHdexfXufMwFptvpOupF8rl'] end end
Add twitter API KEY and sceret
diff --git a/lib/kupong_integration.rb b/lib/kupong_integration.rb index abc1234..def5678 100644 --- a/lib/kupong_integration.rb +++ b/lib/kupong_integration.rb @@ -1,4 +1,5 @@-require "kupong_integration/version" +require 'kupong_integration/version' +require 'kupong_integration/service' module KupongIntegration # Your code goes here...
Fix country code for sweden
diff --git a/lib/seam/active_record.rb b/lib/seam/active_record.rb index abc1234..def5678 100644 --- a/lib/seam/active_record.rb +++ b/lib/seam/active_record.rb @@ -1,6 +1,5 @@ require 'seam' require "seam/active_record/version" -require 'moped' require 'subtle' module Seam
Remove one more bad ref, tests pass in-memory.
diff --git a/lib/blimp.rb b/lib/blimp.rb index abc1234..def5678 100644 --- a/lib/blimp.rb +++ b/lib/blimp.rb @@ -9,7 +9,6 @@ require_relative "blimp/sources/disk_source" require_relative "blimp/sources/fake_source" require_relative "blimp/sources/git_source" -require_relative "blimp/sources/mock_source" require_relative "blimp/source_dir" require_relative "blimp/source_file"
Remove require for unexistant mocksource
diff --git a/lib/tasks/statistics.rake b/lib/tasks/statistics.rake index abc1234..def5678 100644 --- a/lib/tasks/statistics.rake +++ b/lib/tasks/statistics.rake @@ -0,0 +1,20 @@+require_relative '../statistics.rb' + +namespace :statistics do + desc '月次のイベント履歴を集計します' + task :aggregation, [:yyyymm] => :environment do |tasks, args| + date = Time.current.prev_month.beginning_of_month + if args[:yyyymm].present? + date = %w(%Y%m %Y/%m %Y-%m).map do |fmt| + begin + Time.zone.strptime(args[:yyyymm], fmt) + rescue ArgumentError + end + end.compact.first + end + + raise ArgumentError, "Invalid format: #{args[:yyyymm]}" if date.nil? + + Statistics::Aggregation.run(date: date) + end +end
Create a task for the monthly aggregation
diff --git a/lib/vagrant-soa/plugin.rb b/lib/vagrant-soa/plugin.rb index abc1234..def5678 100644 --- a/lib/vagrant-soa/plugin.rb +++ b/lib/vagrant-soa/plugin.rb @@ -24,6 +24,10 @@ require_relative 'actions/setup_machine' hook.prepend(Action::SetupMachine) end + action_hook 'setup_machine', 'machine_action_provision' do |hook| + require_relative 'actions/setup_machine' + hook.prepend(Action::SetupMachine) + end action_hook 'setup_machine', 'machine_action_reload' do |hook| require_relative 'actions/setup_machine' hook.prepend(Action::SetupMachine)
Make sure we're setting up the machine when we provision
diff --git a/lib/myaso.rb b/lib/myaso.rb index abc1234..def5678 100644 --- a/lib/myaso.rb +++ b/lib/myaso.rb @@ -5,6 +5,7 @@ require 'myaso/version' require 'myaso/pi_table' require 'myaso/ngrams' +require 'myaso/lexicon' require 'myaso/tagger' require 'myaso/tagger/model' @@ -24,7 +25,3 @@ 'unknown word "%s"' % word end end - -# The Word structure represents frequencies of tagged words. -# -Myaso::Word = Struct.new(:word, :tag, :count)
Use Lexicon instead of Word
diff --git a/lib/xdrgen/output_file.rb b/lib/xdrgen/output_file.rb index abc1234..def5678 100644 --- a/lib/xdrgen/output_file.rb +++ b/lib/xdrgen/output_file.rb @@ -29,7 +29,7 @@ EOS end - def puts(s) + def puts(s="") @io.puts indented(s) end
Allow empty puts in OutputFile
diff --git a/lib/robot.rb b/lib/robot.rb index abc1234..def5678 100644 --- a/lib/robot.rb +++ b/lib/robot.rb @@ -14,7 +14,7 @@ end def address_pattern - /^#{@name}\s*/ + /^((#{@name}[:,]?)|\/)\s*/ end def hear(raw_message)
Update calling pattern for greater ease of communication
diff --git a/app/exporters/formatters/manual_indexable_formatter.rb b/app/exporters/formatters/manual_indexable_formatter.rb index abc1234..def5678 100644 --- a/app/exporters/formatters/manual_indexable_formatter.rb +++ b/app/exporters/formatters/manual_indexable_formatter.rb @@ -6,6 +6,12 @@ end private + def extra_attributes + { + specialist_sectors: specialist_sectors + } + end + def indexable_content entity.summary # Manuals don't have a body end @@ -13,4 +19,8 @@ def organisation_slugs [entity.organisation_slug] end + + def specialist_sectors + entity.tags.select { |t| t[:type] == "specialist_sector" }.map { |t| t[:slug] } + end end
Send specialist sectors to Rummager for Manuals In order to list Manuals on Topic pages for Specialist Sectors we need to send these to Rummager. We do this by pulling out the Specialist Sector tags when formatting the Manual for indexing and merging it into the `indexable_attributes` provided by the `AbstractIndexableFormatter`.
diff --git a/Casks/unity-android-support-for-editor.rb b/Casks/unity-android-support-for-editor.rb index abc1234..def5678 100644 --- a/Casks/unity-android-support-for-editor.rb +++ b/Casks/unity-android-support-for-editor.rb @@ -0,0 +1,15 @@+cask 'unity-android-support-for-editor' do + version '5.3.1f1' + sha256 'c805d5ea4bf3ab089909427bc1ba6af82e05fd04cac832b3f154f27821b6d54a' + + url "http://netstorage.unity3d.com/unity/cc9cbbcc37b4/MacEditorTargetInstaller/UnitySetup-Android-Support-for-Editor-#{version}.pkg" + name 'Unity Android Build Support' + homepage 'https://unity3d.com/unity/' + license :commercial + + depends_on cask: 'unity' + + pkg "UnitySetup-Android-Support-for-Editor-#{version}.pkg" + + uninstall pkgutil: 'com.unity3d.AndroidSupport' +end
Add Unity Android Build Support 5.3.1f1
diff --git a/whenever.gemspec b/whenever.gemspec index abc1234..def5678 100644 --- a/whenever.gemspec +++ b/whenever.gemspec @@ -21,4 +21,5 @@ s.add_development_dependency "mocha", ">= 0.9.5" s.add_development_dependency "rake" + s.add_development_dependency "minitest" end
Add minitest to development dependencies
diff --git a/tasks/boxes.rake b/tasks/boxes.rake index abc1234..def5678 100644 --- a/tasks/boxes.rake +++ b/tasks/boxes.rake @@ -12,6 +12,7 @@ sh 'rm -f boxes/quantal64/rootfs.tar.gz' sh 'cd boxes/quantal64 && sudo tar --numeric-owner -czf rootfs.tar.gz ./rootfs-amd64/*' sh "cd boxes/quantal64 && sudo chown #{ENV['USER']}:#{ENV['USER']} rootfs.tar.gz && tar -czf ../output/lxc-quantal64.box ./* --exclude=rootfs-amd64 --exclude=download-ubuntu" + sh 'cd boxes/quantal64 && sudo rm -rf rootfs-amd64' end end end
Clean up quantal64 rootfs after building box
diff --git a/lib/active_job/queue_adapters/sidekiq_adapter.rb b/lib/active_job/queue_adapters/sidekiq_adapter.rb index abc1234..def5678 100644 --- a/lib/active_job/queue_adapters/sidekiq_adapter.rb +++ b/lib/active_job/queue_adapters/sidekiq_adapter.rb @@ -8,6 +8,7 @@ #Sidekiq::Client does not support symbols as keys Sidekiq::Client.push \ 'class' => JobWrapper, + 'wrapped' => job.class.to_s, 'queue' => job.queue_name, 'args' => [ job.serialize ], 'retry' => true @@ -16,6 +17,7 @@ def enqueue_at(job, timestamp) Sidekiq::Client.push \ 'class' => JobWrapper, + 'wrapped' => job.class.to_s, 'queue' => job.queue_name, 'args' => [ job.serialize ], 'retry' => true,
Add wrapped class name for sidekiq web interface
diff --git a/lib/ffi-gobject_introspection/i_constant_info.rb b/lib/ffi-gobject_introspection/i_constant_info.rb index abc1234..def5678 100644 --- a/lib/ffi-gobject_introspection/i_constant_info.rb +++ b/lib/ffi-gobject_introspection/i_constant_info.rb @@ -21,7 +21,7 @@ when :utf8 raw_value.force_encoding('utf-8') when :gboolean - raw_value.nonzero? + !!raw_value.nonzero? else raw_value end
Fix up constant value extraction
diff --git a/lib/generators/refinerycms_podcasts_generator.rb b/lib/generators/refinerycms_podcasts_generator.rb index abc1234..def5678 100644 --- a/lib/generators/refinerycms_podcasts_generator.rb +++ b/lib/generators/refinerycms_podcasts_generator.rb @@ -1,6 +1,6 @@ class RefinerycmsPodcasts < Refinery::Generators::EngineInstaller - source_root File.expand_path('../../', __FILE__) + source_root File.expand_path('../../../', __FILE__) engine_name "podcasts" end
Fix generator source_root, so migrations get copied over correctly.
diff --git a/lib/whatsapp/protocol/nodes/clean_dirty_query_node.rb b/lib/whatsapp/protocol/nodes/clean_dirty_query_node.rb index abc1234..def5678 100644 --- a/lib/whatsapp/protocol/nodes/clean_dirty_query_node.rb +++ b/lib/whatsapp/protocol/nodes/clean_dirty_query_node.rb @@ -8,7 +8,7 @@ def initialize(dirty_node) category_nodes = dirty_node.children.select { |child| child.tag == 'category' }.map do |category| - CategoryNode.new(category.attribute(name)) + CategoryNode.new(category.attribute('name')) end super('clean', {xmlns: 'urn:xmpp:whatsapp:dirty'}, category_nodes)
Fix wrong attribute name in CleanDirtyQueryNode
diff --git a/NeoveraColorPicker.podspec b/NeoveraColorPicker.podspec index abc1234..def5678 100644 --- a/NeoveraColorPicker.podspec +++ b/NeoveraColorPicker.podspec @@ -7,11 +7,11 @@ s.author = 'Neovera' s.source = { :git => 'https://github.com/neovera/colorpicker.git', - :tag => '1.0' + :commit => '7e40a227f40d3e7328deb5e2f9953f85b6dd095c' } s.platform = :ios, '5.0' - s.source_files = 'Source/' - s.public_header_files = 'Source/' + s.source_files = 'Source/' + s.resources = 'Source/*.{xib}', 'Source/colorPicker.bundle' s.frameworks = 'UIKit', 'QuartzCore' s.requires_arc = true -end+end
Fix pod spec to include the resources I missed the xib files and bundle in the original pod spec. This commit fixes that issue
diff --git a/db/migrate/20101202205446_remove_published_articles.rb b/db/migrate/20101202205446_remove_published_articles.rb index abc1234..def5678 100644 --- a/db/migrate/20101202205446_remove_published_articles.rb +++ b/db/migrate/20101202205446_remove_published_articles.rb @@ -3,7 +3,7 @@ select_all("SELECT * from articles WHERE type = 'PublishedArticle'").each do |published| reference = Article.exists?(published['reference_article_id']) ? Article.find(published['reference_article_id']) : nil if reference - execute("UPDATE articles SET type = '#{reference.type}', abstract = '#{reference.abstract}', body = '#{reference.body}' WHERE articles.id = #{published['id']}") + execute(ActiveRecord::Base.sanitize_sql(["UPDATE articles SET type = ?, abstract = ?, body = ? WHERE articles.id = ?", reference.type, reference.abstract, reference.body, published['id']])) else execute("DELETE from articles where articles.id = #{published['id']}") end
Fix migration to generate proper SQL (ActionItem1733)
diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index abc1234..def5678 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -3,4 +3,4 @@ # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register_alias "text/html", :iphone -Mime::Type.register "application/pdf", :pdf+# Mime::Type.register "application/pdf", :pdf
Remove useless PDF mime-type registration Signed-off-by: Tommaso Visconti <be60654a2ce5335d5724f2c9dcbf232b965b889e@gmail.com>
diff --git a/CMRefresh.podspec b/CMRefresh.podspec index abc1234..def5678 100644 --- a/CMRefresh.podspec +++ b/CMRefresh.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "CMRefresh" - s.version = "0.0.8" + s.version = "0.0.9" s.summary = "Some util refresh categories for UIScrollView and it's subclasses." s.description = <<-DESC Some util refresh categories for UIScrollView and it's subclasses, which write in Objective-C, wish you love it, enjoy the code:D
Update podspec file(Version number to 0.0.9).
diff --git a/CMSignals.podspec b/CMSignals.podspec index abc1234..def5678 100644 --- a/CMSignals.podspec +++ b/CMSignals.podspec @@ -0,0 +1,10 @@+Pod::Spec.new do |s| + s.name = "CMSignals" + s.version = "1.0.0" + s.summary = "Qt Signals and Slots clone to Objective-C." + s.homepage = "https://github.com/edgurgel/CMSignals" + s.license = 'MIT' + s.author = { "Eduardo Gurgel" => "eduardo.gurgel@codeminer42.com", "Tiago Bastos" => "tiago.bastos@codeminer42.com" } + s.source = { :git => "https://github.com/edgurgel/CMSignals.git", :tag => "1.0.0" } + s.source_files = './CMSignals/*.{h,m}' +end
Add podspec for version 1.0.0
diff --git a/lib/feedcellar/curses_view.rb b/lib/feedcellar/curses_view.rb index abc1234..def5678 100644 --- a/lib/feedcellar/curses_view.rb +++ b/lib/feedcellar/curses_view.rb @@ -9,7 +9,8 @@ Curses.nonl # TODO - feeds.to_a.reject! {|feed| feed.title.nil? } + feeds = feeds.to_a + feeds.reject! {|feed| feed.title.nil? } feeds.each_with_index do |feed, i| Curses.setpos(i, 0)
Fix a link of the cursor position is not display
diff --git a/ruby/receive.rb b/ruby/receive.rb index abc1234..def5678 100644 --- a/ruby/receive.rb +++ b/ruby/receive.rb @@ -9,12 +9,13 @@ ch = conn.create_channel q = ch.queue("hello") -puts " [*] Waiting for messages in #{q.name}. To exit press CTRL+C" -q.subscribe(:block => true) do |delivery_info, properties, body| - puts " [x] Received #{body}" +begin + puts " [*] Waiting for messages in #{q.name}. To exit press CTRL+C" + q.subscribe(:block => true) do |delivery_info, properties, body| + puts " [x] Received #{body}" + end +rescue Interrupt => _ + puts " [x] Shutting down..." - # cancel the consumer to exit - delivery_info.consumer.cancel + conn.close end - -conn.close
Make the consumer in Tutorial 1 wait for messages until interrupted Just like the Java version does.
diff --git a/lib/postgresql/check/table.rb b/lib/postgresql/check/table.rb index abc1234..def5678 100644 --- a/lib/postgresql/check/table.rb +++ b/lib/postgresql/check/table.rb @@ -1,12 +1,12 @@ module Postgresql module Check module Table - def check(column, condition = nil) - @base.add_check(@table_name, column, condition) + def check(condition, options) + @base.add_check(@table_name, condition, options) end - def remove_check(column_name) - @base.remove_check(@table_name, column_name) + def remove_check(options) + @base.remove_check(@table_name, options) end end end
Change add_check and remove_check signatures
diff --git a/lib/response_mate/recorder.rb b/lib/response_mate/recorder.rb index abc1234..def5678 100644 --- a/lib/response_mate/recorder.rb +++ b/lib/response_mate/recorder.rb @@ -4,7 +4,7 @@ class Recorder include ResponseMate::ManifestParser - attr_accessor :base_url, :conn, :requests_manifest, :manifest, :oauth, :keys + attr_accessor :base_url, :conn, :manifest, :oauth, :keys def initialize(args = {}) @manifest = args[:manifest]
Remove redundant attr_accessor for :requests_manifest
diff --git a/SwiftCharts.podspec b/SwiftCharts.podspec index abc1234..def5678 100644 --- a/SwiftCharts.podspec +++ b/SwiftCharts.podspec @@ -5,7 +5,7 @@ s.homepage = "https://github.com/i-schuetz/SwiftCharts" s.license = { :type => "Apache License, Version 2.0", :file => "LICENSE" } s.authors = { "Ivan Schuetz" => "ivanschuetz@gmail.com"} - s.ios.deployment_target = "9.0" + s.ios.deployment_target = "8.0" s.source = { :git => "https://github.com/grafiti-io/SwiftCharts.git", :tag => s.version, :branch => 'master' } s.source_files = 'SwiftCharts/*.swift', 'SwiftCharts/**/*.swift' s.frameworks = "Foundation", "UIKit", "CoreGraphics"
Set pods deployment target back to 8
diff --git a/lib/subscription_fu/models.rb b/lib/subscription_fu/models.rb index abc1234..def5678 100644 --- a/lib/subscription_fu/models.rb +++ b/lib/subscription_fu/models.rb @@ -8,7 +8,7 @@ def needs_subscription send(:include, InstanceMethods) has_many :subscriptions, :class_name => "SubscriptionFu::Subscription", :as => :subject, :dependent => :destroy - delegate :plan, :sponsored?, :canceled?, :prefix => :subscription, :to => :current_subscription, :allow_nil => true + delegate :plan, :sponsored?, :canceled?, :prefix => :subscription, :to => :active_subscription, :allow_nil => true delegate :plan, :prefix => :upcoming_subscription, :to => :upcoming_subscription, :allow_nil => true end end @@ -18,18 +18,22 @@ self.class.model_name.human end - def current_subscription - @current_subscription ||= subscriptions.current(Time.now).last + def active_subscription + @active_subscription ||= subscriptions.current(Time.now).last + end + + def active_subscription? + !@active_subscription.nil? end def upcoming_subscription - current_subscription ? current_subscription.next_subscriptions.activated.last : nil + active_subscription ? active_subscription.next_subscriptions.activated.last : nil end def build_next_subscription(plan_key) - if current_subscription + if active_subscription # TODO refactor - subscriptions.build_for_initializing(plan_key, current_subscription.successor_start_date(plan_key), current_subscription.successor_billing_start_date, current_subscription) + subscriptions.build_for_initializing(plan_key, active_subscription.successor_start_date(plan_key), active_subscription.successor_billing_start_date, active_subscription) else subscriptions.build_for_initializing(plan_key) end
Rename current subscription to active subscription
diff --git a/morpher_inflecter.gemspec b/morpher_inflecter.gemspec index abc1234..def5678 100644 --- a/morpher_inflecter.gemspec +++ b/morpher_inflecter.gemspec @@ -15,6 +15,7 @@ gem.files = `git ls-files`.split($/) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) + gem.license = 'MIT' gem.require_paths = ["lib"] gem.has_rdoc = true
Put a license into gemspec
diff --git a/db/migrate/limits_to_mysql.rb b/db/migrate/limits_to_mysql.rb index abc1234..def5678 100644 --- a/db/migrate/limits_to_mysql.rb +++ b/db/migrate/limits_to_mysql.rb @@ -6,5 +6,6 @@ change_column :merge_request_diffs, :st_diffs, :text, limit: 2147483647 change_column :snippets, :content, :text, limit: 2147483647 change_column :notes, :st_diff, :text, limit: 2147483647 + change_column :events, :data, :text, limit: 2147483647 end end
Add limit change for 'data' column in 'events' when using MySQL
diff --git a/db/migrate/20150429184013_create_fitness_professional_profiles.rb b/db/migrate/20150429184013_create_fitness_professional_profiles.rb index abc1234..def5678 100644 --- a/db/migrate/20150429184013_create_fitness_professional_profiles.rb +++ b/db/migrate/20150429184013_create_fitness_professional_profiles.rb @@ -18,9 +18,10 @@ t.text :appointment_lengths, array: true, default: [] t.text :group_training, array: true, default: [] t.boolean :consent_waiver - t.references :user + t.references :user, index: true t.timestamps null: false end + add_foreign_key :fitness_professional_profiles, :users end end
Add foreign key to fitness professional profile table
diff --git a/spec/models/product_spec.rb b/spec/models/product_spec.rb index abc1234..def5678 100644 --- a/spec/models/product_spec.rb +++ b/spec/models/product_spec.rb @@ -10,4 +10,9 @@ it 'has many orders' do expect(product.orders).to be_truthy end + + it 'has many categories' do + product.categories.create(name: 'Travel Gear') + expect(product.categories.last.name).to eq('Travel Gear') + end end
Add spec for products having many categories
diff --git a/Casks/android-studio.rb b/Casks/android-studio.rb index abc1234..def5678 100644 --- a/Casks/android-studio.rb +++ b/Casks/android-studio.rb @@ -1,9 +1,9 @@ cask :v1 => 'android-studio' do - version '1.1.0' - sha256 '7d31edf46f57c2be12e228fbdb2344c0fb3a4e3fc07b692ec05156c575ef7a61' + version '1.2.0.12' + sha256 'a8d43f96bb29dd7636af7cc74215dc4a8b71feaaf064a1e8a06c79231a459e1e' # google.com is the official download host per the vendor homepage - url "https://dl.google.com/dl/android/studio/ide-zips/#{version}/android-studio-ide-135.1740770-mac.zip" + url "https://dl.google.com/dl/android/studio/ide-zips/#{version}/android-studio-ide-141.1890965-mac.zip" name 'Android Studio' homepage 'https://developer.android.com/sdk/' license :apache
Upgrade Android Studio.app to v1.2.0.12
diff --git a/spec/classes/rundeck_spec.rb b/spec/classes/rundeck_spec.rb index abc1234..def5678 100644 --- a/spec/classes/rundeck_spec.rb +++ b/spec/classes/rundeck_spec.rb @@ -39,4 +39,14 @@ it { expect { should contain_package('rundeck') }.to raise_error(Puppet::Error, /Nexenta not supported/) } end end + + context 'non-platform-specific config parameters' do + let(:facts) {{ + :osfamily => 'RedHat', + :serialnumber => 0, + :rundeck_version => '' + }} + + + end end
Add context for merging potentially conflicting tests
diff --git a/Casks/omnifocus-beta.rb b/Casks/omnifocus-beta.rb index abc1234..def5678 100644 --- a/Casks/omnifocus-beta.rb +++ b/Casks/omnifocus-beta.rb @@ -1,6 +1,6 @@ cask :v1 => 'omnifocus-beta' do - version '2.3.x-r245365' - sha256 'd601cc7585c2a8c9127e3ca8ac1ac00afb64e63d643ca40491acc0d796768857' + version '2.3.x-r247728' + sha256 '5aaf46a7f207f0fb340e52ccc26acc1f114c374d8f5b0aea4d8b366f101b6a0a' url "http://omnistaging.omnigroup.com/omnifocus-2.3.x/releases/OmniFocus-#{version}-Test.dmg" name 'OmniFocus'
Update OmniFocus Beta to version 2.3.x-r247728 This commit updates the version and sha256 stanzas.
diff --git a/Casks/the-unarchiver.rb b/Casks/the-unarchiver.rb index abc1234..def5678 100644 --- a/Casks/the-unarchiver.rb +++ b/Casks/the-unarchiver.rb @@ -0,0 +1,5 @@+class TheUnarchiver < Cask + url 'http://theunarchiver.googlecode.com/files/TheUnarchiver3.3.zip' + homepage 'http://unarchiver.c3.cx/' + version '3.3' +end
Add The Unarchiver - a free replacement for Archive Utiliy.app
diff --git a/db/migrate/20130321170151_rename_bookable_to_resource.rb b/db/migrate/20130321170151_rename_bookable_to_resource.rb index abc1234..def5678 100644 --- a/db/migrate/20130321170151_rename_bookable_to_resource.rb +++ b/db/migrate/20130321170151_rename_bookable_to_resource.rb @@ -1,5 +1,5 @@-class RenameresourceToResource < ActiveRecord::Migration +class RenameBookableToResource < ActiveRecord::Migration def change - rename_table :resources, :resources + rename_table :bookables, :resources end end
Fix erroneous search/replace in migration
diff --git a/db/migrate/20140818152233_default_value_for_task_body.rb b/db/migrate/20140818152233_default_value_for_task_body.rb index abc1234..def5678 100644 --- a/db/migrate/20140818152233_default_value_for_task_body.rb +++ b/db/migrate/20140818152233_default_value_for_task_body.rb @@ -1,13 +1,13 @@ class DefaultValueForTaskBody < ActiveRecord::Migration def up execute "ALTER TABLE tasks ALTER COLUMN body SET DEFAULT '[]'::JSON" - Task.where(body: nil).update_all(body: '[]') + execute "UPDATE tasks SET body = '[]' WHERE body IS NULL" change_column :tasks, :body, :json, null: false end def down execute "ALTER TABLE tasks ALTER COLUMN body DROP DEFAULT" change_column :tasks, :body, :json, null: true - Task.where("body::text = '[]'::text").update_all(body: nil) + execute "UPDATE tasks SET body = NULL WHERE body::text = '[]'::text" end end
Use SQL for all the things
diff --git a/spec/provider/appfog_spec.rb b/spec/provider/appfog_spec.rb index abc1234..def5678 100644 --- a/spec/provider/appfog_spec.rb +++ b/spec/provider/appfog_spec.rb @@ -21,7 +21,7 @@ describe "#push_app" do example "Without :app" do - expect(provider.context).to receive(:shell).with("af update dpl") + expect(provider.context).to receive(:shell).with("af update #{File.basename(Dir.getwd)}") expect(provider.context).to receive(:shell).with("af logout") provider.push_app end
Fix appfog spec about the directory's basename This fixes #154
diff --git a/spec/rpub/epub/cover_spec.rb b/spec/rpub/epub/cover_spec.rb index abc1234..def5678 100644 --- a/spec/rpub/epub/cover_spec.rb +++ b/spec/rpub/epub/cover_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Rpub::Epub::Cover do - let(:book) { double('book', config: double('config', :cover_image => 'cover.jpg', :title => 'title')) } + let(:book) { double('book', :config => double('config', :cover_image => 'cover.jpg', :title => 'title')) } let(:subject) { described_class.new(book).render } it { should have_xpath('/xmlns:html/xmlns:head/xmlns:title[text()="Cover"]') }
Fix accidental Ruby 1.9 Hash syntax
diff --git a/spec/support/email_helper.rb b/spec/support/email_helper.rb index abc1234..def5678 100644 --- a/spec/support/email_helper.rb +++ b/spec/support/email_helper.rb @@ -2,8 +2,6 @@ module EmailHelper # Some specs trigger actions that send emails, for example creating an order. # But sending emails doesn't work out-of-the-box. This code sets it up. - # It's here in a single place to allow an easy upgrade to Spree 2 which - # needs a different implementation of this method. def setup_email Spree::Config[:mails_from] = "test@ofn.example.org" end
Remove comment refering to old spree upgrade
diff --git a/test/integration/test_installation.rb b/test/integration/test_installation.rb index abc1234..def5678 100644 --- a/test/integration/test_installation.rb +++ b/test/integration/test_installation.rb @@ -1,6 +1,5 @@ # encoding: UTF-8 -require File.expand_path('../../test_helper', __FILE__) require File.expand_path('../../test_integration_helper', __FILE__) class InstallationTest < MiniTest::Spec
Remove standard helpers from integration tests
diff --git a/spec/unit/auom/unit/class_methods/try_convert_spec.rb b/spec/unit/auom/unit/class_methods/try_convert_spec.rb index abc1234..def5678 100644 --- a/spec/unit/auom/unit/class_methods/try_convert_spec.rb +++ b/spec/unit/auom/unit/class_methods/try_convert_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe AUOM,'.try_convert' do +describe AUOM::Unit, '.try_convert' do subject { object.try_convert(value) } let(:object) { AUOM::Unit } @@ -18,19 +18,19 @@ end context 'with fixnum' do - let(:value) { 1 } + let(:value) { 1 } it { should eql(AUOM::Unit.new(1)) } end context 'with rational' do - let(:value) { Rational(2,1) } + let(:value) { Rational(2,1) } it { should eql(AUOM::Unit.new(2)) } end context 'with Object' do - let(:value) { Object.new } + let(:value) { Object.new } it { should be(nil) } end
Correct spec metadata for explicit coverage
diff --git a/lib/twentyfour_seven_office/services/authentication.rb b/lib/twentyfour_seven_office/services/authentication.rb index abc1234..def5678 100644 --- a/lib/twentyfour_seven_office/services/authentication.rb +++ b/lib/twentyfour_seven_office/services/authentication.rb @@ -6,12 +6,18 @@ api_operation :login, input_data_types: { credential: Credential } api_operation :has_session - def self.login(credentials_hash) - unless credentials_hash.has_key?(:credential) - credentials_hash = { credential: credentials_hash } + def self.login(credentials) + if credentials.is_a?(TwentyfourSevenOffice::DataTypes::Credential) + credentials = { credential: TwentyfourSevenOffice::DataTypes::Credential.new(credentials) } + elsif credentials.is_a?(Hash) + unless credentials.has_key?(:credential) + credentials = { credential: credentials } + end + else + raise ArgumentError, "credential must be a Hash or a TwentyfourSevenOffice::DataTypes::Credential" end - session_id = new(nil).login(credentials_hash) + session_id = new(nil).login(credentials) SessionId.new(session_id: session_id) end
Make Authentication.login input recognition more robust
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -2,7 +2,7 @@ before_filter :load_user, only: [:show, :edit, :update] def index - @users = User.with_translations_for(:organisation).sort_by { |u| u.fuzzy_last_name.downcase } + @users = User.all(:include => {organisation: [:translations]}).sort_by { |u| u.fuzzy_last_name.downcase } end def show
Fix admin users list when user has no org
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 @@ -18,7 +18,7 @@ ] @nav_items.each do |ni| - if ni[:path] == request.env['REQUEST_PATH'] + if ni[:path] == request.path ni[:style] += " active" end end
Replace ENV['REQUEST_PATH'] with path to make it work in production too.
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 @@ -4,9 +4,9 @@ private - # def after_sign_in_path_for(resource_or_scope) - # current_user # redirects to a user's show page - # end + def after_sign_in_path_for(resource_or_scope) + current_user # redirects to a user's show page + end # NOTE: Adding new paramters def configure_permitted_parameters
Add redirect method after sign in
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 @@ -2,4 +2,9 @@ # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception + + before_action :check_rack_mini_profiler + def check_rack_mini_profiler + Rack::MiniProfiler.authorize_request if params[:rmp] + end end
Enable the rack mini profiler in production * Use the ?rmp=1 query parameter to enable it.
diff --git a/app/controllers/friendships_controller.rb b/app/controllers/friendships_controller.rb index abc1234..def5678 100644 --- a/app/controllers/friendships_controller.rb +++ b/app/controllers/friendships_controller.rb @@ -3,13 +3,16 @@ current_user = User.find(params[:current_user]) @user = User.find(params[:id]) current_user.friends << @user + @user.friends << current_user redirect_to user_path(@user) end def destroy #friend breakup + friend = User.find(params[:friend]) current_user = User.find(params[:id]) - current_user.friends.delete(params[:friend]) - redirect_to user_path(current_user.id) + friend.friends.delete(current_user) + current_user.friends.delete(friend) + redirect_to user_path(current_user) end end
Fix two way friendships ;)
diff --git a/config.ru b/config.ru index abc1234..def5678 100644 --- a/config.ru +++ b/config.ru @@ -3,5 +3,5 @@ Bundler.require :default, :development -Combustion.initialize! +Combustion.initialize! :all run Combustion::Application
Fix for Combustion's generated rackup file.
diff --git a/lib/nanoc/base/services/compiler/stages/determine_outdatedness.rb b/lib/nanoc/base/services/compiler/stages/determine_outdatedness.rb index abc1234..def5678 100644 --- a/lib/nanoc/base/services/compiler/stages/determine_outdatedness.rb +++ b/lib/nanoc/base/services/compiler/stages/determine_outdatedness.rb @@ -13,12 +13,19 @@ contract C::None => C::Any def run outdated_items = select_outdated_items - @outdatedness_store.clear - reps_of_items(outdated_items).each { |r| @outdatedness_store.add(r) } + outdated_reps = reps_of_items(outdated_items) + + store_outdated_reps(outdated_reps) + outdated_items end private + + def store_outdated_reps(reps) + @outdatedness_store.clear + reps.each { |r| @outdatedness_store.add(r) } + end def select_outdated_items @reps
Refactor: Clean up DetermineOutdatedness stage a bit more
diff --git a/app/views/categories/rss_feed.rss.builder b/app/views/categories/rss_feed.rss.builder index abc1234..def5678 100644 --- a/app/views/categories/rss_feed.rss.builder +++ b/app/views/categories/rss_feed.rss.builder @@ -1,7 +1,7 @@ xml.instruct! :xml, version: '1.0' xml.feed xmlns: 'http://www.w3.org/2005/Atom' do xml.id category_feed_url(@category) - xml.title "New Questions - #{@category.name} - #{SiteSetting['SiteName']}" + xml.title "New Posts - #{@category.name} - #{SiteSetting['SiteName']}" xml.author do xml.name "#{SiteSetting['SiteName']} - Codidact" end @@ -10,7 +10,7 @@ @posts.each do |post| xml.entry do - xml.id question_url(post) + xml.id generic_show_link(post) xml.title post.title xml.author do xml.name post.user.username @@ -18,7 +18,7 @@ end xml.published post.created_at&.iso8601 xml.updated post.last_activity&.iso8601 - xml.link href: question_path(post) + xml.link href: generic_show_link(post) xml.summary post.body.truncate(200), type: 'html' end end
Make RSS feeds use the right URL
diff --git a/domain.rb b/domain.rb index abc1234..def5678 100644 --- a/domain.rb +++ b/domain.rb @@ -29,6 +29,5 @@ # CocoaDocs # dom.entity :cocoadocs_pod_metrics, :cocoadocs_pod_metric, 'cocoadocs_pod_metrics' - dom.entity :cocoadocs_cloc_metrics, :cocoadocs_cloc_metric, 'cocoadocs_cloc_metrics' dom.entity :github_pod_metrics, :github_pod_metric, 'github_pod_metrics' end
Remove refernce to cloc table
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -11,7 +11,7 @@ resources :users, except: :show get '/profile' => 'users#show' - root 'site#index' + root 'welcome#index' namespace :api do
Change root to map/query page
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -38,5 +38,6 @@ get 'user/:id', to: 'users#show', as: 'show_user' get 'media/:id', to: 'media_items#show', as: 'show_media_item' + get ':id/edit', to: redirect('/admin/pages/%{id}/edit') get ':id', to: 'pages#show', as: 'show_page' end
Add route to edit any page by visiting /page/edit