diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/nominatim/address.rb b/lib/nominatim/address.rb index abc1234..def5678 100644 --- a/lib/nominatim/address.rb +++ b/lib/nominatim/address.rb @@ -71,5 +71,13 @@ def place @place ||= @attrs[:place] end + + def town + @town ||= @attrs[:town] + end + + def village + @village ||= @attrs[:village] + end end -end+end
Add some attributes to the Place model.
diff --git a/lib/rulers/file_model.rb b/lib/rulers/file_model.rb index abc1234..def5678 100644 --- a/lib/rulers/file_model.rb +++ b/lib/rulers/file_model.rb @@ -36,6 +36,33 @@ files = Dir["db/quotes/*.json"] files.map { |f| FileModel.new f } end + + # Have not implemented JSON ORM so + # using flat files at the moment... Fuck you if + # it bothers you + + def self.create attrs + hash = {} + hash["submitter"] = attrs["submitter"] || "" + hash["quote"] = attrs["quote"] || "" + hash["attribution"] = attrs["attribution"] || "" + + files = Dir["db/quotes/*.json"] + names = files.map { |f| f.split("/")[-1] } + highest = names.map { |b| b[0...-5].to_i }.max + id = highest + 1 + + File.open("db/quotes/#{id}.json", "w") do |f| + f.write <<-TEMPLATE +{ + "submitter": "#{hash["submitter"]}", + "quote": "#{hash["quote"]}", + "attribution": "#{hash["attribution"]}" +} +TEMPLATE + end + FileModel.new "db/quotes/#{id}.json" + end end end end
Use flat json files until ORM for JSON store is created, right now is hard coded to work with sample consumer app for quotes only for testing
diff --git a/lib/plz/commands/help.rb b/lib/plz/commands/help.rb index abc1234..def5678 100644 --- a/lib/plz/commands/help.rb +++ b/lib/plz/commands/help.rb @@ -23,9 +23,10 @@ end.map do |link| str = " plz #{link.title.underscore} #{target_name}" if key = link.href[/{(.+)}/, 1] - name = CGI.unescape(key).gsub(/[()]/, "").split("/").last - if property = link.parent.properties[name] - if example = property.data["example"] + path = CGI.unescape(key).gsub(/[()]/, "") + name = path.split("/").last + if property = JsonPointer.evaluate(@schema.data, path) + if example = property["example"] str << " #{name}=#{example}" end end
Improve the logic to resolve URI Template in href
diff --git a/lib/tasks/get_stops.rake b/lib/tasks/get_stops.rake index abc1234..def5678 100644 --- a/lib/tasks/get_stops.rake +++ b/lib/tasks/get_stops.rake @@ -0,0 +1,50 @@+# Save stops from matka API +require 'nokogiri' +require 'open-uri' + +desc "Get stops" +task :get_stops => :environment do + + url = "http://api.matka.fi/timetables/?m=stop&company=SH:TUR" + + params = ["user", "pass", "x", "y", "radius", "count"] + values = Hash.new + + puts "Get stops from developer.matka.fi" + + params.each { |p| + print "#{p}: " + values[p] = STDIN.gets.chomp + url += "&#{p}=#{values[p]}" + } + + doc = Nokogiri::XML(open(url)) + stop_nodes = doc.xpath("//STOP"); + + puts "Resolved #{stop_nodes.length} stops" + + saved = 0 + stop_nodes.each_with_index { |stop, i| + puts "#{i}: Go through stop" + # Get attributes + x = stop["xCoord"] + y = stop["yCoord"] + code = stop["code"] + api_id = stop["id"] + # Get stop name + name = stop.xpath("name").text + # Check if stop exists + s = Stop.find_by(num: code) + next unless s.nil? + # Save stop + s = Stop.create(:num => code, + :api_id => api_id, + :x => x, + :y => y, + :name => name) + saved += 1 unless s.nil? + } + + puts "#{saved} stops saved" + +end
Create get stops from API task
diff --git a/lib/tasks/spicerack.rake b/lib/tasks/spicerack.rake index abc1234..def5678 100644 --- a/lib/tasks/spicerack.rake +++ b/lib/tasks/spicerack.rake @@ -34,4 +34,12 @@ end end + task ui: :environment do + content = File.open('config/routes.rb', 'r') { |f| f.read } + File.open('config/routes.rb', 'w') do |f| + f.write content.sub "Application.routes.draw do", + "Application.routes.draw do\n get 'ui(/:action)', controller: 'ui' unless Rails.env.production?" + end + end + end
Make ui task add ui route
diff --git a/lib/runit-man/helpers.rb b/lib/runit-man/helpers.rb index abc1234..def5678 100644 --- a/lib/runit-man/helpers.rb +++ b/lib/runit-man/helpers.rb @@ -13,7 +13,11 @@ def host_name unless @host_name - @host_name = Socket.gethostbyname(Socket.gethostname).first + begin + @host_name = Socket.gethostbyname(Socket.gethostname).first + rescue + @host_name = Socket.gethostname + end end @host_name end
Fix absence in DNS error.
diff --git a/lib/sinatra/assetpack.rb b/lib/sinatra/assetpack.rb index abc1234..def5678 100644 --- a/lib/sinatra/assetpack.rb +++ b/lib/sinatra/assetpack.rb @@ -14,7 +14,7 @@ # Returns a list of formats that can be served. # Anything not in this list will be rejected. def self.supported_formats - @supported_formats ||= %w(css js png jpg gif) + @supported_formats ||= %w(css js png jpg gif otf eot ttf woff) end # Returns a map of what MIME format each Tilt type returns.
Add filetypes used in @font-face.
diff --git a/config/schedule.rb b/config/schedule.rb index abc1234..def5678 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -17,6 +17,6 @@ ## 14:45 is during our regular release slot, this may have to change ## post-April. 2am is our regular time for this. -every :day, at: ['2am', '2:45pm'], roles: [:admin] do +every :day, at: ['2am', '11:45am'], roles: [:admin] do runner 'script/dump_all_admin_to_public_documents_and_non_documents.rb' end
Change document mappings cron to 11:45am For Robin.
diff --git a/config/schedule.rb b/config/schedule.rb index abc1234..def5678 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -7,7 +7,7 @@ end every 1.day, :at => '2:49 am' do - runner "CGI::Session::ActiveRecordStore::Session.delete_all(['updated_at < ?', 1.day.ago.utc])" + runner "ActionController::Session::ActiveRecordStore::Session.delete_all(['updated_at < ?', 1.day.ago.utc])" end if File.exist?('config/email.yml')
Fix bug clearing old sessions.
diff --git a/lib/task_list/railtie.rb b/lib/task_list/railtie.rb index abc1234..def5678 100644 --- a/lib/task_list/railtie.rb +++ b/lib/task_list/railtie.rb @@ -11,7 +11,7 @@ if defined? ::Rails::Railtie class Railtie < ::Rails::Railtie initializer "task-lists" do |app| - TaskList.paths.each do |path| + TaskList.asset_paths.each do |path| app.config.assets.paths << path end end
Use asset_paths instead of paths
diff --git a/lib/tasks/messenger.rake b/lib/tasks/messenger.rake index abc1234..def5678 100644 --- a/lib/tasks/messenger.rake +++ b/lib/tasks/messenger.rake @@ -5,5 +5,15 @@ Rake::Task["environment"].invoke MetadataSync.new.run end + + Daemonette.run("publisher_publication_listener") do + Rake::Task["environment"].invoke + PublicationListener.new.run + end + + Daemonette.run("publisher_destruction_listener") do + Rake::Task["environment"].invoke + DestructionListener.new.run + end end end
Add Rake tasks for publication/destruction consumers.
diff --git a/lib/workflows/service.rb b/lib/workflows/service.rb index abc1234..def5678 100644 --- a/lib/workflows/service.rb +++ b/lib/workflows/service.rb @@ -1,5 +1,7 @@ module Workflows module Service + extend self + def success!(value=true) value end
Make Services methods available as module functions
diff --git a/lita-jira-issues.gemspec b/lita-jira-issues.gemspec index abc1234..def5678 100644 --- a/lita-jira-issues.gemspec +++ b/lita-jira-issues.gemspec @@ -3,8 +3,9 @@ spec.version = "0.1.0" spec.authors = ["Arthur Maltson"] spec.email = ["arthur@maltson.com"] - spec.description = "Show JIRA issue details in Lita" - spec.summary = "Lita plugin for listing JIRA issue details when they are mentioned in chat." + spec.description = "Lita handler to show JIRA issue details" + spec.summary = %q{Lita handler that looks for JIRA issue keys and + helpfully inserts details into the chat conversation.} spec.homepage = "https://github.com/amaltson/lita-jira-issues" spec.license = "MIT" spec.metadata = { "lita_plugin_type" => "handler" }
Update gemspec docs a bit
diff --git a/lib/carto/connector/providers/postgresql.rb b/lib/carto/connector/providers/postgresql.rb index abc1234..def5678 100644 --- a/lib/carto/connector/providers/postgresql.rb +++ b/lib/carto/connector/providers/postgresql.rb @@ -38,7 +38,8 @@ def optional_connection_attributes { port: { Port: 5432 }, - password: { PWD: nil } + password: { PWD: nil }, + sslmode: { SSLmode: 'require' } } end
Add sslmode to PG connector
diff --git a/core/argf/argf_spec.rb b/core/argf/argf_spec.rb index abc1234..def5678 100644 --- a/core/argf/argf_spec.rb +++ b/core/argf/argf_spec.rb @@ -1,7 +1,7 @@ require File.dirname(__FILE__) + '/../../spec_helper' describe "ARGF" do - it "is Enumerable" do + it "is extended by the Enumerable module" do ARGF.should be_kind_of(Enumerable) end end
Update the description of one of the ARGF specs.
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -26,7 +26,6 @@ end cpanm = node['perl']['cpanm'].to_hash - root_group = node['platform'] == 'mac_os_x' ? 'admin' : 'root' directory File.dirname(cpanm['path']) do recursive true @@ -36,7 +35,7 @@ source cpanm['url'] checksum cpanm['checksum'] owner 'root' - group root_group + group node['root_group'] mode '0755' end end
Use the root_group attribute from Ohai Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/app/helpers/nivo_helper.rb b/app/helpers/nivo_helper.rb index abc1234..def5678 100644 --- a/app/helpers/nivo_helper.rb +++ b/app/helpers/nivo_helper.rb @@ -1,15 +1,24 @@ module NivoHelper - def nivo_slider(hash = {}, &block) - options = { :theme => :default, :id => "" } - options.merge!(hash) - klass = "slide-wrapper theme-#{options[:theme]}" - id = options[:id] - - content_tag(:div, :class => klass) do - content_tag(:div, :id => id, :class => "nivoSlider #{options[:class]}") do - yield - end + # Convenient helper to create a div for your slider. The method's + # definition is similar to Action View's `content_tag` helper. + # It doesn't escape the given content by default though. + def nivo_slider(content_or_options = nil, options = {}, escape = false, &block) + # We are just keeping the two arguments to match Action View's + # definition of `content_tag` but the first argument isn't + # considered as the content if it's a Hash object. + if content_or_options.kind_of?(Hash) + options.merge!(content_or_options) end + options[:class] ? options[:class] << " nivoSlider" : options[:class] = "nivoSlider" + options[:id] ||= "slider" + + if content_or_options.kind_of?(Hash) && !block_given? + content_tag_string(:div, "", options, escape) + elsif block_given? + content_tag_string(:div, capture(&block), options, escape) + else + content_tag_string(:div, content_or_options, options, escape) + end end -end+end
Make `nivo_slider` behaves like `content_tag` The provided `nivo_slider` view helper now behaves more like Action View's `content_tag` for the sake of convenience. Also by default it doesn't escape the provided content and sets the div's id to "slider" and adds a "nivoSlider" class.
diff --git a/app/models/market_model.rb b/app/models/market_model.rb index abc1234..def5678 100644 --- a/app/models/market_model.rb +++ b/app/models/market_model.rb @@ -1,7 +1,11 @@ class MarketModel < ActiveRecord::Base include Privacy - FOUNDATIONS = %w(connections kWh kW_connection kW_max kW_contracted kW_flex) + FOUNDATIONS = %w( + connections kWh kW_connection kW_max kW_contracted + flex_realised flex_potential + ) + PRESENTABLES = %w(stakeholder_from stakeholder_to foundation applied_stakeholder tariff) DEFAULT_INTERACTIONS = [{ "stakeholder_from" => "", "stakeholder_to" => "",
Add flexibility measures to the front-end
diff --git a/app/models/shell_runner.rb b/app/models/shell_runner.rb index abc1234..def5678 100644 --- a/app/models/shell_runner.rb +++ b/app/models/shell_runner.rb @@ -9,7 +9,7 @@ # log: file path for logging stdout and stderr # @return [Boolean] `true` if successful (i.e,. exit 0), `false` otherwise def shell(cmd, opts) - full_cmd = '' + full_cmd = ''.dup full_cmd << "cd #{opts[:dir]} && " if opts[:dir] full_cmd << reset_env full_cmd << cmd
Fix frozen string literal regression See: https://freelancing-gods.com/2017/07/27/friendly-frozen-string-literals.html
diff --git a/lib/exception_notifier/campfire_notifier.rb b/lib/exception_notifier/campfire_notifier.rb index abc1234..def5678 100644 --- a/lib/exception_notifier/campfire_notifier.rb +++ b/lib/exception_notifier/campfire_notifier.rb @@ -1,6 +1,6 @@ class ExceptionNotifier class CampfireNotifier - cattr_accessor :tinder_available do true end + cattr_accessor :tinder_available attr_accessor :subdomain attr_accessor :token
Remove cattr_accesor default value, this breaks in Rails 4.0
diff --git a/ruy.gemspec b/ruy.gemspec index abc1234..def5678 100644 --- a/ruy.gemspec +++ b/ruy.gemspec @@ -1,5 +1,5 @@ Gem::Specification.new do |s| - s.name = 'Ruy' + s.name = 'ruy' s.version = '0.0.1' s.date = '2014-06-04' s.files = Dir['lib/**/*']
Fix gem name on gemspec
diff --git a/face_recognition.gemspec b/face_recognition.gemspec index abc1234..def5678 100644 --- a/face_recognition.gemspec +++ b/face_recognition.gemspec @@ -7,16 +7,22 @@ Gem::Specification.new do |s| s.name = "face_recognition" s.version = FaceRecognition::VERSION - s.authors = ["TODO: Your name"] - s.email = ["TODO: Your email"] - s.homepage = "TODO" - s.summary = "TODO: Summary of FaceRecognition." - s.description = "TODO: Description of FaceRecognition." + s.authors = ["Isaac Norman"] + s.email = ["idn@papercloud.com.au"] + s.homepage = "http://github.com/Papercloud/face_recognition" + s.summary = "Anon and Facebook User Auth" + s.description = "Allows registration of anon and Facebook users in your rails app" s.license = "MIT" s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"] - s.add_dependency "rails", "~> 4.1.9" + s.add_dependency "rails", ">= 4.1" + s.add_dependency "fb_graph2", "~> 0.1.1" s.add_development_dependency "sqlite3" + s.add_development_dependency 'rspec-rails', "~> 2.14.2" + s.add_development_dependency 'capybara', "~> 2.2.1" + s.add_development_dependency 'factory_girl_rails', "~> 4.4.1" + s.add_development_dependency 'database_cleaner', "~> 1.2.0" + s.add_development_dependency 'awesome_print', "~> 1.2.0" end
Update to the gem spec
diff --git a/coursepack.gemspec b/coursepack.gemspec index abc1234..def5678 100644 --- a/coursepack.gemspec +++ b/coursepack.gemspec @@ -6,7 +6,7 @@ spec.authors = ["Nathan Bailey"] spec.email = ["dev@dnbailey.org"] - spec.summary = "A courspack theme that allows teachers to publish instructional materials and post to LMS." + spec.summary = %q{A courspack theme that allows teachers to publish instructional materials and post to LMS.} spec.homepage = "https://github.com/dnbailey/coursepack" spec.license = "MIT"
Switch to delimited string for description
diff --git a/config/initializers/rufus-scheduler.rb b/config/initializers/rufus-scheduler.rb index abc1234..def5678 100644 --- a/config/initializers/rufus-scheduler.rb +++ b/config/initializers/rufus-scheduler.rb @@ -1,10 +1,11 @@ # frozen_string_literal: true -return if defined?(Rails::Console) || Rails.env.test? || File.split($0).last == 'rake' +return if defined?(Rails::Console) || Rails.env.test? || File.split($0).last == "rake" s = Rufus::Scheduler.singleton -s.every '1m' do - Rails.logger.info "hello, it's #{Time.now}" +s.every "1h" do + Rails.logger.info "Update characters" Rails.logger.flush + UpdateCharactersJob.perform_later end
Update characters info each hour
diff --git a/0_code_wars/next_featured_number.rb b/0_code_wars/next_featured_number.rb index abc1234..def5678 100644 --- a/0_code_wars/next_featured_number.rb +++ b/0_code_wars/next_featured_number.rb @@ -0,0 +1,34 @@+# http://www.codewars.com/kata/56abc5e63c91630882000057/ +# --- iteration 1 --- +def next_numb(n) + n += 1 + until n >= 9876543210 do + return n if digits_unique?(n) && n.odd? && multiple_of_three?(n) + n += 1 + end + return "There is no possible number that fulfills those requirements" +end + +private + +def digits_unique?(n) + n_str = n.to_s + n_str.chars.uniq.size == n_str.size +end + +def multiple_of_three?(n) + n % 3 == 0 +end + +# --- iteration 2 --- +def next_numb(n) + until n >= 9876543210 + n += 1 + return n if featured_number?(n) + end + "There is no possible number that fulfills those requirements" +end + +def featured_number?(n) + n.to_s.length == n.to_s.chars.uniq.length && n.odd? && n % 3 == 0 +end
Add code wars (7) next featured number
diff --git a/NSObject-SafeExpectations.podspec b/NSObject-SafeExpectations.podspec index abc1234..def5678 100644 --- a/NSObject-SafeExpectations.podspec +++ b/NSObject-SafeExpectations.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "NSObject-SafeExpectations" - s.version = "0.0.3" + s.version = "0.0.2" s.summary = "No more crashes getting unexpected values from a NSDictionary." s.homepage = "https://github.com/wordpress-mobile/NSObject-SafeExpectations" s.license = { :type => 'MIT', :file => 'LICENSE' }
Switch version back to 0.0.2
diff --git a/test/spec.rb b/test/spec.rb index abc1234..def5678 100644 --- a/test/spec.rb +++ b/test/spec.rb @@ -1,5 +1,5 @@ require_relative 'test_init' -Runner.! 'spec/*.rb' do |exclude| +Runner.('spec/*.rb') do |exclude| exclude =~ /spec_init.rb\z/ end
Replace bang actuator with call actuator.
diff --git a/config/projects/td-agent2.rb b/config/projects/td-agent2.rb index abc1234..def5678 100644 --- a/config/projects/td-agent2.rb +++ b/config/projects/td-agent2.rb @@ -2,14 +2,13 @@ require 'fileutils' require 'rubygems' -name "td-agent2" +name "td-agent" maintainer "Treasure Data, Inc" homepage "http://treasuredata.com" description "Treasure Agent: A data collector for Treasure Data" -replaces "td-agent" install_path "/opt/td-agent" -build_version "1.0.0" +build_version "2.0.0" build_iteration 0 # creates required build directories
Change td-agnet2 package to td-agent and 2.0 version
diff --git a/spec/controllers/concerns/jwt_token_spec.rb b/spec/controllers/concerns/jwt_token_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/concerns/jwt_token_spec.rb +++ b/spec/controllers/concerns/jwt_token_spec.rb @@ -43,22 +43,4 @@ expect(response).to have_http_status(:success) end end - - context "valid shared token" do - it "should be authorized" do - SharedAuth.create(secret: "shhhh im a secret") - request.headers["SharedAuthorization"] = "shhhh im a secret" - post :create, format: :json - expect(response).to have_http_status(:success) - end - end - - context "invalid shared token" do - it "should not be authorized" do - SharedAuth.create(secret: "shhhh im a secret") - request.headers["SharedAuthorization"] = "gar im a secret" - post :create, format: :json - expect(response).to have_http_status(:unauthorized) - end - end end
Remove old specs for SharedAuth jwt
diff --git a/0_code_wars/stop_spinning_my_words.rb b/0_code_wars/stop_spinning_my_words.rb index abc1234..def5678 100644 --- a/0_code_wars/stop_spinning_my_words.rb +++ b/0_code_wars/stop_spinning_my_words.rb @@ -0,0 +1,17 @@+# http://www.codewars.com/kata/5264d2b162488dc400000001/ +# --- iteration 1 --- +def spinWords(string) + string.split(" ") + .reduce([]){ |acc, word| acc << (word.size >= 5 ? word.reverse : word) } + .join(" ") +end + +# --- iteration 2 --- +def spinWords(str) + str.gsub(/\w+/) { |w| w.size < 5 ? w : w.reverse } +end + +# --- iteration 3 --- +def spinWords(str) + str.gsub(/\w{5,}/, &:reverse) +end
Add code wars (6) - stop spinning my words
diff --git a/updateable_views_inheritance.gemspec b/updateable_views_inheritance.gemspec index abc1234..def5678 100644 --- a/updateable_views_inheritance.gemspec +++ b/updateable_views_inheritance.gemspec @@ -21,6 +21,7 @@ s.add_dependency "activerecord", "~>3.2.12" s.add_dependency "pg" + s.add_development_dependency 'test-unit', '~> 3.0' s.add_development_dependency "rails", "~>3.2.12" s.add_development_dependency "bundler", "~>1.3" s.add_development_dependency "rake"
Update test dependency under ruby 2.2
diff --git a/google_analytics.gemspec b/google_analytics.gemspec index abc1234..def5678 100644 --- a/google_analytics.gemspec +++ b/google_analytics.gemspec @@ -16,7 +16,7 @@ 'This can be discovered by looking at the value assigned to +_uacct+' + 'in the Javascript code.' - s.files = %w( README.rdoc Rakefile rails/init.rb + s.files = %w( CREDITS MIT-LICENSE README.rdoc Rakefile rails/init.rb test/google_analytics_test.rb test/test_helper.rb test/view_helpers_test.rb
Add a few missing files to the manifest.
diff --git a/app/helpers/auth_key_pair_cloud_helper/textual_summary.rb b/app/helpers/auth_key_pair_cloud_helper/textual_summary.rb index abc1234..def5678 100644 --- a/app/helpers/auth_key_pair_cloud_helper/textual_summary.rb +++ b/app/helpers/auth_key_pair_cloud_helper/textual_summary.rb @@ -11,7 +11,7 @@ end def textual_group_properties - %i(name type fingerprint) + %i(name fingerprint) end # @@ -20,10 +20,6 @@ def textual_name @record.name - end - - def textual_type - @record.type end def textual_fingerprint
Remove 'type' from key pair list view Remove 'type' from key pair details page (transferred from ManageIQ/manageiq@48a51ef69f0d49fcda814bfd47ad508b5b8f1500)
diff --git a/app/models/renalware/patients/clear_patient_ukrdc_data.rb b/app/models/renalware/patients/clear_patient_ukrdc_data.rb index abc1234..def5678 100644 --- a/app/models/renalware/patients/clear_patient_ukrdc_data.rb +++ b/app/models/renalware/patients/clear_patient_ukrdc_data.rb @@ -16,6 +16,7 @@ patient.send_to_rpv = false patient.rpv_decision_on = Time.zone.today patient.rpv_recorded_by = by.to_s + patient.skip_death_validations = true patient.save_by!(by) end end
Fix bug clearing UKRDC data when patient dies When a patient dies the patient model enters a state where no further changes can be made to it unless you set the date_of_death and death causes. However this validation can be overriden by setting the virtual accessor Patient#skip_death_validations = true. This commit adds this to ClearPatientUKRDCData to prevent it raising a validation error when it attempts to save the patient.
diff --git a/cash_flow_analysis.gemspec b/cash_flow_analysis.gemspec index abc1234..def5678 100644 --- a/cash_flow_analysis.gemspec +++ b/cash_flow_analysis.gemspec @@ -20,4 +20,5 @@ spec.add_development_dependency "bundler", "~> 1.8" spec.add_development_dependency "rake", "~> 10.0" + spec.add_development_dependency "rspec" end
Add rspec as a development dependency.
diff --git a/NSUserDefaults-AESEncryptor.podspec b/NSUserDefaults-AESEncryptor.podspec index abc1234..def5678 100644 --- a/NSUserDefaults-AESEncryptor.podspec +++ b/NSUserDefaults-AESEncryptor.podspec @@ -11,6 +11,7 @@ s.authors = { 'Bruno Tortato Furtado' => 'bruno.furtado@gruponzn.com' } + s.dependency 'CocoaSecurity', '~> 1.2.2' s.source_files = 'NSUserDefaults-AESEncryptor/*.{h,m}' s.source = { :git => 'https://github.com/NZN/NSUserDefaults-AESEncryptor.git', :tag => '0.0.2' } end
Add dependency to podspec file
diff --git a/lib/action-store.rb b/lib/action-store.rb index abc1234..def5678 100644 --- a/lib/action-store.rb +++ b/lib/action-store.rb @@ -18,4 +18,6 @@ end end -ActiveRecord::Base.send(:include, ActionStore::Mixin)+ActiveSupport.on_load(:active_record) do + include ActionStore::Mixin +end
Use `ActiveSupport.on_load` to hook into Active Record. https://github.com/rails/rails/issues/23589#issuecomment-229247727 https://github.com/plataformatec/devise/commit/c2c74b0
diff --git a/lib/custom/pdftk.rb b/lib/custom/pdftk.rb index abc1234..def5678 100644 --- a/lib/custom/pdftk.rb +++ b/lib/custom/pdftk.rb @@ -9,7 +9,7 @@ end def source_url - "http://s3.amazonaws.com/guideline-util/pdftk.tar.gz" + "https://s3-us-west-2.amazonaws.com/gamc-util/pdftk.tar.gz" end def used?
Update for new bucket location
diff --git a/backend/app/controllers/spree/admin/tax_rates_controller.rb b/backend/app/controllers/spree/admin/tax_rates_controller.rb index abc1234..def5678 100644 --- a/backend/app/controllers/spree/admin/tax_rates_controller.rb +++ b/backend/app/controllers/spree/admin/tax_rates_controller.rb @@ -13,14 +13,6 @@ @available_categories = TaxCategory.order(:name) @calculators = TaxRate.calculators.sort_by(&:name) end - - def update_after - Rails.cache.delete('vat_rates') - end - - def create_after - Rails.cache.delete('vat_rates') - end end end end
Remove calls to deleting vat_rates keys, which don't appear to be used anymore
diff --git a/lib/forem/engine.rb b/lib/forem/engine.rb index abc1234..def5678 100644 --- a/lib/forem/engine.rb +++ b/lib/forem/engine.rb @@ -8,12 +8,6 @@ @root ||= Pathname.new(File.expand_path('../../', __FILE__)) end end - - config.after_initialize do - # Add Forem::Ability to whatever Ability class is defined. - # Could be Forem's (app/models/ability.rb) or could be application's. - ::Ability.send :include, Forem::Ability - end end end
Remove needless after_initialize to load Forem::Ability
diff --git a/lib/i18n/gettext.rb b/lib/i18n/gettext.rb index abc1234..def5678 100644 --- a/lib/i18n/gettext.rb +++ b/lib/i18n/gettext.rb @@ -13,7 +13,7 @@ # integer-index based style # TODO move this information to the pluralization module def plural_keys(*args) - args.length == 0 ? @@plural_keys : @@plural_keys[args.first] || @@plural_keys[:en] + args.empty? ? @@plural_keys : @@plural_keys[args.first] || @@plural_keys[:en] end def extract_scope(msgid, separator)
Use .empty? instead of length comparison with 0
diff --git a/lib/destiny_rb/vendors.rb b/lib/destiny_rb/vendors.rb index abc1234..def5678 100644 --- a/lib/destiny_rb/vendors.rb +++ b/lib/destiny_rb/vendors.rb @@ -8,7 +8,7 @@ if raw raw_data - elsif raw_data.empty? + elsif raw_data.empty? || raw_data.nil? return nil else vendor_hash = raw_data['data']['vendorHash']
Fix case where raw_data is nil This happens when Xur isnt at the tower and bungie doesnt return empty tags. Instead they just omit the tag entirely: ```` { ErrorCode: 1627 ThrottleSeconds: 0 ErrorStatus: "DestinyVendorNotFound" Message: "The Vendor you requested was not found." MessageData: {} } ```
diff --git a/spec/features/find_records_by_searching_a_attribute_that_returns_a_collection_spec.rb b/spec/features/find_records_by_searching_a_attribute_that_returns_a_collection_spec.rb index abc1234..def5678 100644 --- a/spec/features/find_records_by_searching_a_attribute_that_returns_a_collection_spec.rb +++ b/spec/features/find_records_by_searching_a_attribute_that_returns_a_collection_spec.rb @@ -0,0 +1,23 @@+require_relative "../../lib/query_string_search" +require_relative "../fixtures/movie" + +RSpec.describe "Finding data based on an attribute that returns a collection" do + let(:data_set) { Movie.random_collection } + + let(:movies_on_dvd) { data_set.select { |d| d.home_formats.include?("DVD") } } + let(:movies_on_dvd_or_bd) { data_set.select { |d| d.home_formats.include?("DVD") || d.home_formats.include?("BD") } } + + it "Returns the correct records when searching for one value" do + query_string = "home_formats=DVD" + results = QueryStringSearch.new(data_set, query_string).results + + expect(results).to eq(movies_on_dvd) + end + + it "Returns the correct records when searching for two values" do + query_string = "home_formats=DVD|BD" + results = QueryStringSearch.new(data_set, query_string).results + + expect(results).to eq(movies_on_dvd_or_bd) + end +end
Add feature test for matching against collection
diff --git a/lib/querylicious/query_reducer.rb b/lib/querylicious/query_reducer.rb index abc1234..def5678 100644 --- a/lib/querylicious/query_reducer.rb +++ b/lib/querylicious/query_reducer.rb @@ -8,7 +8,7 @@ require 'dry-initializer' module Querylicious - # Reducer + # Query Reducer for processing parsed query class QueryReducer extend Dry::Initializer
Update comment description for Querylicious::QueryReducer
diff --git a/lib/specinfra/helper/detect_os.rb b/lib/specinfra/helper/detect_os.rb index abc1234..def5678 100644 --- a/lib/specinfra/helper/detect_os.rb +++ b/lib/specinfra/helper/detect_os.rb @@ -2,7 +2,7 @@ module Helper module DetectOS def commands - self.class.const_get('Specinfra').const_get('Command').const_get(os[:family]).new + self.class.const_get('Specinfra').const_get('Command').const_get(os[:family].capitalize).new end def os
Fix according to the change of command class name
diff --git a/lib/tasks/dfid.rake b/lib/tasks/dfid.rake index abc1234..def5678 100644 --- a/lib/tasks/dfid.rake +++ b/lib/tasks/dfid.rake @@ -0,0 +1,26 @@+namespace :dfid do + desc "Migrate research outputs" + task migrate_research_outputs: :environment do + content_ids = Republisher.content_ids_for_document_type("dfid_research_output") + content_ids.each do |content_id| + RepublishService.new.call(content_id) do |payload| + puts "#{payload[:base_path]} - #{payload[:title]}" + + payload[:document_type] = "research_for_development_output" + + base_path = payload[:base_path].gsub("dfid-research-outputs", "research-for-development-outputs") + payload[:base_path] = base_path + payload[:routes][0][:path] = base_path + + payload[:details][:metadata] = payload[:details][:metadata].tap do |metadata| + metadata[:research_document_type] = metadata.delete(:dfid_document_type) || [] + metadata[:authors] = metadata.delete(:dfid_authors) || [] + metadata[:theme] = metadata.delete(:dfid_theme) || [] + if (review_status = metadata.delete(:dfid_review_status)) + metadata[:review_status] = review_status + end + end + end + end + end +end
Add a Rake task for migrate DFID research outputs We're moving these to a new finder with a new document type, base path and metadata fields. This Rake task should migrate the documents one by one over to the new finder by republishing new editions of the document with the payload transformed to the new format.
diff --git a/lib/what/modules.rb b/lib/what/modules.rb index abc1234..def5678 100644 --- a/lib/what/modules.rb +++ b/lib/what/modules.rb @@ -17,6 +17,8 @@ end end + # TODO: Load modules in the correct order (i.e., superclasses before + # subclasses). def self.require_dir(path) Dir[File.join(path, '*.rb')].each do |fn| require fn
Add TODO about module load order If a module that inherits from another module gets loaded before its parent, then that load will fail with a NameError. We load modules in the order returned by Dir[File.join(path, '*.rb')].each which doesn't guarantee that superclasses are required before subclasses.
diff --git a/lib/tasks/feed.rake b/lib/tasks/feed.rake index abc1234..def5678 100644 --- a/lib/tasks/feed.rake +++ b/lib/tasks/feed.rake @@ -0,0 +1,17 @@+namespace :newsitem do + desc "Destroy all newsitem marked as read" + task :clear => :environment do + Newsitem + .where("created_at < ?", 3.days.ago) + .where(unread: 0) + .destroy_all + end + + desc "Mark all news as read" + task :mark_as_read => :environment do + Newsitem.all.each do |item| + item.set_read + item.save! + end + end +end
Add custom rake tasks to clean up newsitem
diff --git a/lib/unity/engine.rb b/lib/unity/engine.rb index abc1234..def5678 100644 --- a/lib/unity/engine.rb +++ b/lib/unity/engine.rb @@ -11,6 +11,12 @@ Dir.glob(Rails.root + "app/decorators/**/*_decorator*.rb").each do |c| require_dependency(c) end + + Dir.glob(Rails.root + "app/services/unity/overrides/**/*_override*.rb").each do |c| + require_dependency(c) + end + + Unity::ApplicationController.helper Rails.application.helpers end initializer :append_migrations do |app|
Allow controller overrides by parent app.
diff --git a/lib/tasks/cleanup.rake b/lib/tasks/cleanup.rake index abc1234..def5678 100644 --- a/lib/tasks/cleanup.rake +++ b/lib/tasks/cleanup.rake @@ -6,7 +6,7 @@ if dryrun $stderr.puts "This is a dryrun - nothing will be deleted" end - holding_pen = InfoRequest.find_by_url_title('holding_pen') + holding_pen = InfoRequest.holding_pen_request old_events = holding_pen.info_request_events.find_each(:conditions => ['event_type in (?)', ['redeliver_incoming', 'destroy_incoming']]) do |event|
Use InfoRequest.holding_pen_request to find the holding pen Then it is automatically created if it does not already exist
diff --git a/db/migrate/20160919115131_add_details_to_system_consoles.rb b/db/migrate/20160919115131_add_details_to_system_consoles.rb index abc1234..def5678 100644 --- a/db/migrate/20160919115131_add_details_to_system_consoles.rb +++ b/db/migrate/20160919115131_add_details_to_system_consoles.rb @@ -0,0 +1,7 @@+class AddDetailsToSystemConsoles < ActiveRecord::Migration[5.0] + def change + add_column :system_consoles, :url, :string + add_column :system_consoles, :proxy_pid, :integer + add_column :system_consoles, :proxy_status, :string + end +end
Add details to SystemsConsole table. * add pid and status for 2nd level proxy. * add url for custom consoles.
diff --git a/app/controllers/addresses_controller.rb b/app/controllers/addresses_controller.rb index abc1234..def5678 100644 --- a/app/controllers/addresses_controller.rb +++ b/app/controllers/addresses_controller.rb @@ -1,11 +1,11 @@ class AddressesController < ApplicationController def from @address = Address.find(params[:id]) - @deliveries = @address.deliveries_sent.order("created_at DESC").paginate(page: params[:page]) + @deliveries = @address.deliveries_sent.includes(:open_events, :link_events, :email => :app).order("deliveries.created_at DESC").paginate(page: params[:page]) end def to @address = Address.find(params[:id]) - @deliveries = @address.deliveries_received.order("created_at DESC").paginate(page: params[:page]) + @deliveries = @address.deliveries_received.includes(:open_events, :link_events, :email => :app).order("created_at DESC").paginate(page: params[:page]) end end
Speed up addresses page by prefetching associations
diff --git a/app/controllers/instances_controller.rb b/app/controllers/instances_controller.rb index abc1234..def5678 100644 --- a/app/controllers/instances_controller.rb +++ b/app/controllers/instances_controller.rb @@ -1,7 +1,7 @@ class InstancesController < MVCLI::Controller requires :instances - requires :naming + requires :command def index instances.all @@ -12,10 +12,16 @@ end def create + template = Instances::CreateForm + argv = MVCLI::Argv.new command.argv + form = template.new argv.options + form.validate! + + #How expansive do we want these command line options to be? options = { - name: naming.generate_name('d', 'i'), - flavor_id: 1, - volume_size: 1, + name: form.name, + flavor_id: form.flavor, + volume_size: form.size } instances.create options end
Set up instances to use forms
diff --git a/web.rb b/web.rb index abc1234..def5678 100644 --- a/web.rb +++ b/web.rb @@ -1,6 +1,7 @@ require 'sinatra' require 'twilio-ruby' require 'json' +require 'pony' NUMBER_MAP = JSON.parse(ENV["ADDRESSES"]) SMTP_URI = URI.parse(ENV["SMTP_URI"])
Make sure Pony gets loaded
diff --git a/lib/mongo_mapper/utils.rb b/lib/mongo_mapper/utils.rb index abc1234..def5678 100644 --- a/lib/mongo_mapper/utils.rb +++ b/lib/mongo_mapper/utils.rb @@ -5,8 +5,8 @@ safe = options[:safe] safe = {:w => 1} if safe == true safe = {:w => 0} if safe == false - safe = {:w => safe} if safe.is_a? Fixnum + safe = {:w => safe} if safe.is_a? Integer safe end end -end+end
Fix deprecated use of Fixnum Using fixnum in ruby 2.4 generate warnings. change shouldn't have any real world impact (unless someone has a replica set with 2^63 members)
diff --git a/lib/spork/run_strategy.rb b/lib/spork/run_strategy.rb index abc1234..def5678 100644 --- a/lib/spork/run_strategy.rb +++ b/lib/spork/run_strategy.rb @@ -28,10 +28,10 @@ protected def self.factory(test_framework) - if Spork::RunStrategy::Forking.available? + if RUBY_PLATFORM =~ /mswin/ + Spork::RunStrategy::Magazine.new(test_framework) + else Spork::RunStrategy::Forking.new(test_framework) - else - Spork::RunStrategy::Magazine.new(test_framework) end end
Fix choice of magazine strategy for ms-win platforms.
diff --git a/puppet-lint-no_cron_resources-check.gemspec b/puppet-lint-no_cron_resources-check.gemspec index abc1234..def5678 100644 --- a/puppet-lint-no_cron_resources-check.gemspec +++ b/puppet-lint-no_cron_resources-check.gemspec @@ -24,5 +24,5 @@ spec.add_development_dependency 'rubocop', '~> 0.79.0' spec.add_development_dependency 'rake', '~> 13.0.0' spec.add_development_dependency 'rspec-json_expectations', '~> 2.2' - spec.add_development_dependency 'simplecov', '~> 0.17.1' + spec.add_development_dependency 'simplecov', '~> 0.18.0' end
Update simplecov requirement from ~> 0.17.1 to ~> 0.18.0 Updates the requirements on [simplecov](https://github.com/colszowka/simplecov) to permit the latest version. - [Release notes](https://github.com/colszowka/simplecov/releases) - [Changelog](https://github.com/colszowka/simplecov/blob/master/CHANGELOG.md) - [Commits](https://github.com/colszowka/simplecov/compare/v0.17.1...v0.18.0) Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/app/api/v1/project_controller.rb b/app/api/v1/project_controller.rb index abc1234..def5678 100644 --- a/app/api/v1/project_controller.rb +++ b/app/api/v1/project_controller.rb @@ -1,14 +1,49 @@ class API::V1::ProjectController < Grape::API - resource :projects do - desc 'GET /api/v1/projects/:id' + desc 'GET /api/v1/projects/:id/' params do - requires :id, type: Integer + requires :id, type: Integer, desc: 'project_id' end get ':id' do Project.find(id: params[:id].to_i) end + + route_params do + resource :requests do + desc 'GET /api/v1/projects/' + params do + end + get '/' do + + end + + desc 'GET /api/v1/projects/:id/' + params do + require :id, type: Integer, desc: 'request_id' + end + get ':id' do + + end + end + + resource :request_schemata do + desc 'GET /api/v1/request_schemata/' + params do + end + get '/' do + + end + + desc 'GET /api/v1/request_schemata/:id/' + params do + require :id, type: Integer, desc: 'project_schema_id' + end + get ':id' do + + end + end + end + end - end
Create initial routing of /api/v1/projects/*
diff --git a/link_to_action.gemspec b/link_to_action.gemspec index abc1234..def5678 100644 --- a/link_to_action.gemspec +++ b/link_to_action.gemspec @@ -16,7 +16,7 @@ s.files = `git ls-files`.split($\) s.test_files = Dir["test/**/*"] - s.add_development_dependency "rails", "~> 3.2.8" + s.add_development_dependency "rails", "~> 3.2.12" s.add_development_dependency "sqlite3" s.add_development_dependency "simplecov" s.add_development_dependency "debugger"
Update development dependency Rails to 3.2.12
diff --git a/examples/classify.rb b/examples/classify.rb index abc1234..def5678 100644 --- a/examples/classify.rb +++ b/examples/classify.rb @@ -0,0 +1,61 @@+# Document classification example using tokkens and linear SVM +require 'tokkens' # `rake install` or `gem install tokkens` +require 'liblinear' # `gem install liblinear-ruby` + +# define the training data +TRAINING_DATA = [ + ['school', 'The teacher writes a formula on the blackboard, while students are studying for their exams.'], + ['school', 'Students play soccer during the break after class, while a teacher watches over them.'], + ['school', 'All the students are studying hard for the final exams.'], + ['nature', 'The fox is running around the trees, while flowers bloom in the field.'], + ['nature', 'Where are the rabbits hiding today? Their holes below the trees are empty.'], + ['nature', 'The dark sky is bringing rain. The fox hides, rabbits find their holes, but the flowers surrender.'], + ['city', 'Cars are passing by swiftly, until the traffic lights become red.'], + ['city', 'Look at the high building, with so many windows. Who would live there?'], + ['city', 'The shopping centre building is over there, you will find everything you need to buy.'], +] + +# after training, these test sentences will receive a predicted classification +TEST_DATA = [ + 'How many students are in for the exams today?', + 'The forest has large trees, while the field has its flowers.', + 'Can we park our cars inside that building to go shopping?', +] + +# stop words don't carry meaning, we better ignore them +STOP_WORDS = %w( + the a on to at so today all many some + are is will would their you them their our everyone everything who there + while during over for below by with after in around until where +) + +def preprocess(s) + s.downcase.gsub(/[^a-z\s]/, '') +end + +@labels = Tokkens::Tokens.new +@tokenizer = Tokkens::Tokenizer.new(stop_words: STOP_WORDS) + +# train +training_labels = [] +training_samples = [] +TRAINING_DATA.each do |(label, sentence)| + training_labels << @labels.get(label) + tokens = @tokenizer.get(preprocess(sentence)).uniq + training_samples << Hash[tokens.zip([1] * tokens.length)] +end +#tokenizer.tokens.limit!(occurence: 2) # limit number of tokens - doesn't affect training though! +@model = Liblinear.train({}, training_labels, training_samples) + +# predict +@tokenizer.tokens.freeze! +TEST_DATA.each do |sentence| + tokens = @tokenizer.get(preprocess(sentence)) + label_number = Liblinear.predict(@model, Hash[tokens.zip([1] * tokens.length)]) + puts "#{sentence} -> #{tokens.map{|i| @tokenizer.tokens.find(i)}.join(' ')} -> #{@labels.find(label_number)}" +end + +# you might want to persist data for prediction at a later time +#model.save('test.model') +#labels.save('test.labels') +#tokenizer.tokens.save('test.tokens')
Add example of using gem with liblinear
diff --git a/lib/ase/color_modes/gray.rb b/lib/ase/color_modes/gray.rb index abc1234..def5678 100644 --- a/lib/ase/color_modes/gray.rb +++ b/lib/ase/color_modes/gray.rb @@ -24,7 +24,7 @@ private def rgb_value - (@value * 255).round + (@value * 255).to_i end end
Use to_i instead of round
diff --git a/spec/views/users/index.html.slim_spec.rb b/spec/views/users/index.html.slim_spec.rb index abc1234..def5678 100644 --- a/spec/views/users/index.html.slim_spec.rb +++ b/spec/views/users/index.html.slim_spec.rb @@ -2,6 +2,7 @@ describe 'users/index' do before(:each) do + assign(:filters, { all: 'All', foo: 'Bar' }) assign(:users, [ stub_model(User, name: 'Name', email: 'Email', location: 'Location', bio: 'Bio', homepage: 'Homepage', role: 'coach'), stub_model(User, name: 'Name', email: 'Email', location: 'Location', bio: 'Bio', homepage: 'Homepage', role: 'coach')
Set @filters in view spec
diff --git a/Library/Formula/attica.rb b/Library/Formula/attica.rb index abc1234..def5678 100644 --- a/Library/Formula/attica.rb +++ b/Library/Formula/attica.rb @@ -0,0 +1,14 @@+require 'formula' + +class Attica <Formula + url 'ftp://ftp.kde.org/pub/kde/stable/attica/attica-0.1.2.tar.bz2' + homepage 'http://www.kde.org/' + md5 '8b4207dbc0a826d422632bdb9c50d51a' + + depends_on 'cmake' + + def install + system "cmake . #{std_cmake_parameters}" + system "make install" + end +end
Add formula for Attica 0.1.2.
diff --git a/db/data_migration/20130218111418_add_another_detailed_guide_type_for_co.rb b/db/data_migration/20130218111418_add_another_detailed_guide_type_for_co.rb index abc1234..def5678 100644 --- a/db/data_migration/20130218111418_add_another_detailed_guide_type_for_co.rb +++ b/db/data_migration/20130218111418_add_another_detailed_guide_type_for_co.rb @@ -0,0 +1,16 @@+[ + ['Legislative process: taking a bill through Parliament', 'If you are working on proposed legislation or on regulations or orders that may become statutory, check the process by which bills become law.', 'citizenship/government', 'Living in the UK, government and democracy'] +].each do |row| + title, description, parent_tag, parent_title = row + category = MainstreamCategory.create( + title: title, + slug: title.parameterize, + parent_tag: parent_tag, + parent_title: parent_title, + description: description + ) + if category + puts "Mainstream category '#{category.title}' created" + end +end +
Add another MainstreamCategory for CO https://www.pivotaltracker.com/story/show/44547999
diff --git a/lib/caged_chef/chef_auth.rb b/lib/caged_chef/chef_auth.rb index abc1234..def5678 100644 --- a/lib/caged_chef/chef_auth.rb +++ b/lib/caged_chef/chef_auth.rb @@ -1,5 +1,5 @@ require 'mixlib/authentication/signedheaderauth' -require 'openSSL' +require 'openssl' require 'faraday' module CagedChef
Fix (Hopefully) openSSL failure on TravisCI Travis is complaining about not being able to find openSSL. Ruby docs say to require 'openssl' where I've been using require 'openSSL'. Maybe this works?
diff --git a/app/controllers/languages_controller.rb b/app/controllers/languages_controller.rb index abc1234..def5678 100644 --- a/app/controllers/languages_controller.rb +++ b/app/controllers/languages_controller.rb @@ -6,11 +6,11 @@ def show find_language - @created = []#Project.language(@language).few_versions.order('projects.created_at DESC').limit(5).includes(:github_repository) - @updated = []#Project.language(@language).many_versions.order('projects.latest_release_published_at DESC').limit(5).includes(:github_repository) + @created = Project.language(@language).few_versions.order('projects.created_at DESC').limit(5).includes(:github_repository) + @updated = Project.language(@language).many_versions.order('projects.latest_release_published_at DESC').limit(5).includes(:github_repository) @color = Languages::Language[@language].try(:color) - @watched = []#Project.language(@language).most_watched.limit(5) - @popular = []#Project.language(@language).order('projects.rank DESC').limit(5).includes(:github_repository) + @watched = Project.language(@language).most_watched.limit(5) + @popular = Project.language(@language).order('projects.rank DESC').limit(5).includes(:github_repository) end def find_language
Revert "Disable the language pages for a minute" This reverts commit 06df89b35a4bc15def197f542faadf87058e5987.
diff --git a/lib/jackad/config.rb b/lib/jackad/config.rb index abc1234..def5678 100644 --- a/lib/jackad/config.rb +++ b/lib/jackad/config.rb @@ -1,7 +1,7 @@ module Jackad class Config def self.setup - @@options ||= YAML.load_file('/usr/local/jackad.yml') + YAML.load_file('/usr/local/jackad/ldap.yml') end end end
Load LDAP settings from yaml file
diff --git a/lib/nmap/os_class.rb b/lib/nmap/os_class.rb index abc1234..def5678 100644 --- a/lib/nmap/os_class.rb +++ b/lib/nmap/os_class.rb @@ -31,7 +31,7 @@ # @return [String] # def vendor - @node['vendor'] + @vendor ||= @node.get_attribute('vendor') end # @@ -40,9 +40,7 @@ # @return [Symbol, nil] # def family - @family ||= if @node['osfamily'] - @node['osfamily'].to_sym - end + @family ||= @node.get_attribute('osfamily').to_sym end # @@ -63,7 +61,7 @@ # Returns a number between 0 and 10. # def accuracy - @accuracy ||= @node['accuracy'].to_i + @accuracy ||= @node.get_attribute('accuracy').to_i end #
Use get_attribute for required attributes.
diff --git a/lib/rutty/errors.rb b/lib/rutty/errors.rb index abc1234..def5678 100644 --- a/lib/rutty/errors.rb +++ b/lib/rutty/errors.rb @@ -1,5 +1,15 @@ module Rutty + ## + # Raised by {Rutty::Helpers#check_installed!} if the check fails. + # + # @author Josh Lindsey + # @since 2.0.0 class NotInstalledError < StandardError; end + ## + # Raised by various {Rutty::Actions} methods on invalid options, etc. + # + # @author Josh Lindsey + # @since 2.0.0 class BadUsage < StandardError; end end
Add docs for error classes
diff --git a/db/migrate/20200921171234_add_domain_column_to_api_tokens_tables.rb b/db/migrate/20200921171234_add_domain_column_to_api_tokens_tables.rb index abc1234..def5678 100644 --- a/db/migrate/20200921171234_add_domain_column_to_api_tokens_tables.rb +++ b/db/migrate/20200921171234_add_domain_column_to_api_tokens_tables.rb @@ -0,0 +1,8 @@+# frozen_string_literal: true + +class AddDomainColumnToApiTokensTables < ActiveRecord::Migration[6.0] + def change + add_column :user_api_tokens, :domain, :string + add_column :admin_api_tokens, :domain, :string + end +end
Add migration to add domain column to api tokens tables
diff --git a/app/services/classroom_config.rb b/app/services/classroom_config.rb index abc1234..def5678 100644 --- a/app/services/classroom_config.rb +++ b/app/services/classroom_config.rb @@ -1,29 +1,30 @@ # frozen_string_literal: true class ClassroomConfig - CONFIGURABLES = %w[issues].freeze + CONFIGURABLES = %w[issues].freeze + CONFIGBRANCH = "github-classroom" attr_reader :github_repository def initialize(github_repository) - raise ArgumentError, "Invalid configuration repo" unless github_repository.branch_present? "github-classroom" + raise ArgumentError, "Invalid configuration repo" unless github_repository.branch_present? CONFIGBRANCH @github_repository = github_repository end def setup_repository(repo) - configs_tree = @github_repository.branch_tree("github-classroom") + configs_tree = @github_repository.branch_tree(CONFIGBRANCH) configs_tree.tree.each do |config| send("generate_#{config.path}", repo, config.sha) if CONFIGURABLES.include? config.path end - repo.remove_branch("github-classroom") + repo.remove_branch(CONFIGBRANCH) true rescue GitHub::Error false end def configurable?(repo) - repo.branch_present?("github-classroom") + repo.branch_present?(CONFIGBRANCH) end def configured?(repo)
Make config branch name a constant
diff --git a/test/helper.rb b/test/helper.rb index abc1234..def5678 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -42,6 +42,10 @@ end end +if ActiveSupport::TestCase.respond_to?(:test_order=) + ActiveSupport::TestCase.test_order = :random +end + module Foreigner class UnitTest < ActiveSupport::TestCase end @@ -57,4 +61,4 @@ migration end end -end+end
Set ActiveSupport::TestCase.test_order to avoid warning
diff --git a/spec/vcloud/fog/fog_model_interface_spec.rb b/spec/vcloud/fog/fog_model_interface_spec.rb index abc1234..def5678 100644 --- a/spec/vcloud/fog/fog_model_interface_spec.rb +++ b/spec/vcloud/fog/fog_model_interface_spec.rb @@ -22,4 +22,4 @@ Vcloud::Fog::ModelInterface.new.get_vm_by_href(vm_href).should == vm end -end+end
Add missing newline at end of file
diff --git a/lib/generators/active_record/two_factor_authentication_generator.rb b/lib/generators/active_record/two_factor_authentication_generator.rb index abc1234..def5678 100644 --- a/lib/generators/active_record/two_factor_authentication_generator.rb +++ b/lib/generators/active_record/two_factor_authentication_generator.rb @@ -6,7 +6,7 @@ source_root File.expand_path("../templates", __FILE__) def copy_two_factor_authentication_migration - migration_template "migration.rb", "db/migrate/two_factor_authentication_add_to_#{table_name}" + migration_template "migration.rb", "db/migrate/two_factor_authentication_add_to_#{table_name}.rb" end end
Add file extension to ActiveRecord generator
diff --git a/neo4j-rspec.gemspec b/neo4j-rspec.gemspec index abc1234..def5678 100644 --- a/neo4j-rspec.gemspec +++ b/neo4j-rspec.gemspec @@ -17,5 +17,5 @@ spec.require_paths = ["lib"] spec.add_dependency "neo4j", ">= 6.0.0" - spec.add_dependency "rspec", "~> 3.4" + spec.add_dependency "rspec", ">= 3.0" end
Allow newer versions of rspec and bring back to 3.0 I'm not sure if the gem supports rspec 3.0, but it would be good to go back as far as we can
diff --git a/app/controllers/answers_controller.rb b/app/controllers/answers_controller.rb index abc1234..def5678 100644 --- a/app/controllers/answers_controller.rb +++ b/app/controllers/answers_controller.rb @@ -1,12 +1,11 @@ get '/answers/:id/edit' do @answer = Answer.find(params[:id]) if logged_in? && (current_user.id == @answer.user_id) - @answer = Answer.find(params[:id]) - erb :'/answers/edit' + @answer = Answer.find(params[:id]) + erb :'/answers/edit' else - redirect "/questions/#{@answer.question_id}" + redirect "/questions/#{@answer.question_id}" end - end put '/answers/:id' do @@ -29,7 +28,11 @@ delete '/answers/:id' do @answer = Answer.find(params[:id]) if logged_in? && (current_user.id == @answer.user_id) + answer_id = @answer.id @answer.destroy + content_type :json + { answer_id: answer_id }.to_json + else + redirect "/questions/#{@answer.question_id}" end - redirect "/questions/#{@answer.question_id}" end
Add handler for ajax request
diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index abc1234..def5678 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -15,6 +15,18 @@ # Render page without blocking respond_to do |format| format.html + end + end + + def show + member = Rails.cache.fetch(["users", params[:id]], expires_in: 2.days) do + Github::Client.new("/users/#{params[:id]}", {}).find.parsed_response + end + + # render response + respond_to do |format| + format.html + format.json {render json: member} end end
Add show action for member
diff --git a/app/serializers/label_serializer.rb b/app/serializers/label_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/label_serializer.rb +++ b/app/serializers/label_serializer.rb @@ -1,3 +1,7 @@ class LabelSerializer < BaseSerializer attributes :id, :name, :lang_id, :is_dialect, :for_seq, :for_meaning, :parent_id + + def lang_id + object.lang.code + end end
Use the proper public lang-id
diff --git a/lib/phonegap/file_merger.rb b/lib/phonegap/file_merger.rb index abc1234..def5678 100644 --- a/lib/phonegap/file_merger.rb +++ b/lib/phonegap/file_merger.rb @@ -18,8 +18,12 @@ if name == root_name File.open file_path, 'a' do |file| files.each do |filename| + # skip the file that is opened for appending + next if File.basename(filename) == root_name + filename = File.join @root_dir, filename next unless file_exists? filename + file.write "\n\n---\n" file.write File.read(filename).strip FileUtils.rm filename unless name == File.basename(filename)
Fix rendering each API header twice.
diff --git a/lib/brew-cask-upgrade.rb b/lib/brew-cask-upgrade.rb index abc1234..def5678 100644 --- a/lib/brew-cask-upgrade.rb +++ b/lib/brew-cask-upgrade.rb @@ -5,7 +5,7 @@ require 'vendor/homebrew-fork/global' require 'hbc' -CASKROOM = "/usr/local/Caskroom" +CASKROOM = Hbc.caskroom def each_installed Hbc.installed.each_with_index do |name, i|
Use caskroom path defined in Hbc
diff --git a/lib/tasks/repositories.rake b/lib/tasks/repositories.rake index abc1234..def5678 100644 --- a/lib/tasks/repositories.rake +++ b/lib/tasks/repositories.rake @@ -1,7 +1,13 @@+require 'repository_updater' + namespace :repos do + desc "Pull initial repository data from GitHub" + task :bootstrap => [:environment] do + RepositoryUpdater.bootstrap + end + desc "Update repositories with live info from GitHub" - task :update => [:environment] do - require 'repository_updater' - RepositoryUpdater.update + task :update, [:limit] => [:environment] do |t, args| + RepositoryUpdater.update(args[:limit] || 15) end end
Add task for repos:bootstrap, and let :update take a limit argument
diff --git a/lib/tasks/worker_tasks.rake b/lib/tasks/worker_tasks.rake index abc1234..def5678 100644 --- a/lib/tasks/worker_tasks.rake +++ b/lib/tasks/worker_tasks.rake @@ -5,7 +5,9 @@ else array_of_feed_onestop_ids = [] end - feed_eater_worker = FeedEaterWorker.perform_async(array_of_feed_onestop_ids, args.import_level) + # Defalut import level + import_level = (args.import_level || 0).to_i + feed_eater_worker = FeedEaterWorker.perform_async(array_of_feed_onestop_ids, import_level) if feed_eater_worker puts "FeedEaterWorker ##{feed_eater_worker} has been created and enqueued." else
Check import_level in rake task
diff --git a/app/controllers/authors_controller.rb b/app/controllers/authors_controller.rb index abc1234..def5678 100644 --- a/app/controllers/authors_controller.rb +++ b/app/controllers/authors_controller.rb @@ -1,6 +1,6 @@ class AuthorsController < ApplicationController def index - @authors = AuthorDecorator.decorate_collection User.author + @authors = AuthorDecorator.decorate_collection User.author.prolific end def show
Use User.prolific to sort authors on index.
diff --git a/app/controllers/friends_controller.rb b/app/controllers/friends_controller.rb index abc1234..def5678 100644 --- a/app/controllers/friends_controller.rb +++ b/app/controllers/friends_controller.rb @@ -13,6 +13,22 @@ def pending @pending_list = current_user.pending_friends @requested_list = current_user.requested_friends + end + + def search + search_result = params[:search] + @results = User.search(search_result).to_a.keep_if { |user| + user != current_user + } + + @results + end + + def send_request + friend = User.find(params[:friend_id]) + Friendship.request(current_user, friend) + flash[:success] = "Your request has been send successfully!" + redirect_to user_dashboard_path(current_user) end def create
Create the search and send_request actions
diff --git a/app/controllers/records_controller.rb b/app/controllers/records_controller.rb index abc1234..def5678 100644 --- a/app/controllers/records_controller.rb +++ b/app/controllers/records_controller.rb @@ -10,7 +10,7 @@ format.json { head :no_content } else format.html { render action: 'edit' } - format.json { render json: @table.errors, status: :unprocessable_entity } + format.json { render json: @record.errors, status: :unprocessable_entity } end end end
Use correct object when rendering errors in record controller.
diff --git a/lib/vmdb/gettext/domains.rb b/lib/vmdb/gettext/domains.rb index abc1234..def5678 100644 --- a/lib/vmdb/gettext/domains.rb +++ b/lib/vmdb/gettext/domains.rb @@ -3,7 +3,7 @@ module Vmdb module Gettext module Domains - TEXT_DOMAIN = 'manageiq'.freeze + TEXT_DOMAIN ||= 'manageiq'.freeze def self.domains @domains ||= []
Fix warning about already initialized TEXT_DOMAIN constant This would happen during application start with rails engines / plugins using their own gettext catalogs $ rails console lib/vmdb/gettext/domains.rb:6: warning: already initialized constant Vmdb::Gettext::Domains::TEXT_DOMAIN lib/vmdb/gettext/domains.rb:6: warning: previous definition of TEXT_DOMAIN was here ... irb(main):001:0>
diff --git a/lib/alki/loader.rb b/lib/alki/loader.rb index abc1234..def5678 100644 --- a/lib/alki/loader.rb +++ b/lib/alki/loader.rb @@ -9,6 +9,13 @@ def initialize(root_dir) @root_dir = root_dir + end + + def load_all + Dir[File.join(@root_dir,'**','*.rb')].inject({}) do |h,path| + file = path.gsub(File.join(@root_dir,''),'').gsub(/\.rb$/,'') + h.merge!(file => Loader.load(path)) + end end def load(file)
Add load_all method to Alki::Loader
diff --git a/lib/email_trail.rb b/lib/email_trail.rb index abc1234..def5678 100644 --- a/lib/email_trail.rb +++ b/lib/email_trail.rb @@ -5,7 +5,9 @@ class Base def self.delivering_email(message) + puts self.caller.inspect puts message.inspect + puts message.to_s to = message.to.to_s subject = message.subject.to_s message = message.body.to_s
Add a few puts statements for debugging
diff --git a/Casks/butt.rb b/Casks/butt.rb index abc1234..def5678 100644 --- a/Casks/butt.rb +++ b/Casks/butt.rb @@ -0,0 +1,11 @@+cask :v1 => 'butt' do + version '0.1.14' + sha256 'f12eac6ad2af8bc38717cccde3f7f139d426b6d098ef94f7dcd6ae7d1225f6ad' + + url "http://downloads.sourceforge.net/sourceforge/butt/butt-#{version}/butt-#{version}.dmg" + name 'Broadcast Using This Tool' + homepage 'http://butt.sourceforge.net/' + license :gpl + + app 'butt.app' +end
Add Broadcast With This Tool
diff --git a/tradier.gemspec b/tradier.gemspec index abc1234..def5678 100644 --- a/tradier.gemspec +++ b/tradier.gemspec @@ -15,7 +15,7 @@ gem.license = 'MIT' - gem.add_dependency 'faraday', '~> 0.9' + gem.add_dependency 'faraday', '~> 0.8' gem.add_dependency 'faraday_middleware' gem.add_dependency 'celluloid' gem.add_dependency 'multi_json'
Revert "change faraday dependency to 0.9" This reverts commit 21229f2dc2282bbfd23244698853d9e7bc413927.
diff --git a/lib/plugins/sub.rb b/lib/plugins/sub.rb index abc1234..def5678 100644 --- a/lib/plugins/sub.rb +++ b/lib/plugins/sub.rb @@ -1,3 +1,4 @@+gem 'httparty', '=0.13.5' require 'httparty' require 'open-uri'
Debug - specify HTTParty version
diff --git a/app/views/osc_jobs/show.json.jbuilder b/app/views/osc_jobs/show.json.jbuilder index abc1234..def5678 100644 --- a/app/views/osc_jobs/show.json.jbuilder +++ b/app/views/osc_jobs/show.json.jbuilder @@ -1,4 +1,5 @@ json.extract! @osc_job, :name, :batch_host, :script_path, :staged_script_name, :staged_dir, :created_at, :updated_at, :status +json.set! 'status_label', status_label(@osc_job) json.set! 'fs_root', Filesystem.new.fs(@osc_job.staged_dir) json.folder_contents (@folder_contents) do |content| json.set! 'path', content
Send the current status label with the ajax response
diff --git a/lib/reel/mixins.rb b/lib/reel/mixins.rb index abc1234..def5678 100644 --- a/lib/reel/mixins.rb +++ b/lib/reel/mixins.rb @@ -1,57 +1,59 @@-module HTTPVersionsMixin +module Reel + module HTTPVersionsMixin - HTTP_VERSION_1_0 = '1.0'.freeze - HTTP_VERSION_1_1 = '1.1'.freeze - DEFAULT_HTTP_VERSION = HTTP_VERSION_1_1 -end + HTTP_VERSION_1_0 = '1.0'.freeze + HTTP_VERSION_1_1 = '1.1'.freeze + DEFAULT_HTTP_VERSION = HTTP_VERSION_1_1 + end -module ConnectionMixin + module ConnectionMixin - # Obtain the IP address of the remote connection - def remote_ip - @socket.peeraddr(false)[3] + # Obtain the IP address of the remote connection + def remote_ip + @socket.peeraddr(false)[3] + end + alias_method :remote_addr, :remote_ip + + # Obtain the hostname of the remote connection + def remote_host + # NOTE: Celluloid::IO does not yet support non-blocking reverse DNS + @socket.peeraddr(true)[2] + end end - alias_method :remote_addr, :remote_ip - # Obtain the hostname of the remote connection - def remote_host - # NOTE: Celluloid::IO does not yet support non-blocking reverse DNS - @socket.peeraddr(true)[2] + module RequestMixin + + def method + @http_parser.http_method + end + + def headers + @http_parser.headers + end + + def [] header + headers[header] + end + + def version + @http_parser.http_version || HTTPVersionsMixin::DEFAULT_HTTP_VERSION + end + + def url + @http_parser.url + end + + def uri + @uri ||= URI(url) + end + + def path + @http_parser.request_path + end + + def query_string + @http_parser.query_string + end + end end - -module RequestMixin - - def method - @http_parser.http_method - end - - def headers - @http_parser.headers - end - - def [] header - headers[header] - end - - def version - @http_parser.http_version || HTTPVersionsMixin::DEFAULT_HTTP_VERSION - end - - def url - @http_parser.url - end - - def uri - @uri ||= URI(url) - end - - def path - @http_parser.request_path - end - - def query_string - @http_parser.query_string - end - -end
Move the Mixins into the Reel module
diff --git a/lib/search_tree.rb b/lib/search_tree.rb index abc1234..def5678 100644 --- a/lib/search_tree.rb +++ b/lib/search_tree.rb @@ -5,3 +5,4 @@ require 'search_tree/payload' require 'search_tree/node' require "search_tree/version" +require 'search_tree/factory/fielded_search_factory'
Load of fielded search by default
diff --git a/core/app/views/users/user.rb b/core/app/views/users/user.rb index abc1234..def5678 100644 --- a/core/app/views/users/user.rb +++ b/core/app/views/users/user.rb @@ -35,7 +35,7 @@ end def authority - Authority.from self[:graph_user] + (Authority.from self[:graph_user]).to_f end def all_channel_id
Fix for presenting authority in the UI
diff --git a/spec/views/assets/_support_facility_fta.html.haml_spec.rb b/spec/views/assets/_support_facility_fta.html.haml_spec.rb index abc1234..def5678 100644 --- a/spec/views/assets/_support_facility_fta.html.haml_spec.rb +++ b/spec/views/assets/_support_facility_fta.html.haml_spec.rb @@ -2,9 +2,9 @@ describe "assets/_support_facility_fta.html.haml", :type => :view do - it 'fta info' do - test_asset = create(:administration_building, :fta_funding_type_id => 1, :pcnt_capital_responsibility =>22, :fta_facility_type_id => 1, :facility_capacity_type_id => 1) - test_asset.fta_mode_types << FtaModeType.first + it 'fta info', do + test_asset = create(:administration_building, :fta_funding_type_id => 1, :pcnt_capital_responsibility =>22, :fta_facility_type_id => 1, :facility_capacity_type_id => 1, :primary_fta_mode_type => FtaModeType.first, :fta_private_mode_type => FtaPrivateModeType.first) + test_asset.secondary_fta_mode_types << FtaModeType.second test_asset.save! assign(:asset, test_asset) render @@ -12,6 +12,8 @@ expect(rendered).to have_content(FtaFundingType.first.to_s) expect(rendered).to have_content('22%') expect(rendered).to have_content(FtaModeType.first.to_s) + expect(rendered).to have_content(FtaModeType.second.to_s) + expect(rendered).to have_content(FtaPrivateModeType.first.to_s) expect(rendered).to have_content(FtaFacilityType.first.to_s) expect(rendered).to have_content(FacilityCapacityType.first.to_s) end
Add extra tests to support_facility_fta
diff --git a/app/controllers/admin/policy_advisory_groups_controller.rb b/app/controllers/admin/policy_advisory_groups_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/policy_advisory_groups_controller.rb +++ b/app/controllers/admin/policy_advisory_groups_controller.rb @@ -1,4 +1,6 @@ class Admin::PolicyAdvisoryGroupsController < Admin::BaseController + before_filter :cope_with_attachment_action_params, only: [:update] + def index @policy_advisory_groups = PolicyAdvisoryGroup.order(:name) end @@ -36,4 +38,11 @@ def build_attachment @policy_advisory_group.build_empty_attachment end + + def cope_with_attachment_action_params + return unless params[:policy_advisory_group] && params[:policy_advisory_group][:policy_advisory_group_attachments_attributes] + params[:policy_advisory_group][:policy_advisory_group_attachments_attributes].each do |_, policy_advisory_group_attachment_params| + Admin::AttachmentActionParamHandler.manipulate_params!(policy_advisory_group_attachment_params) + end + end end
Handle new attachment replacement params
diff --git a/nimbuskit-basics.podspec b/nimbuskit-basics.podspec index abc1234..def5678 100644 --- a/nimbuskit-basics.podspec +++ b/nimbuskit-basics.podspec @@ -1,5 +1,5 @@ Pod::Spec.new do |s| - s.name = "NimbusKit Basics" + s.name = "NimbusKit-Basics" s.version = "1.2.0" s.license = { :type => 'BSD' } s.summary = "One file, plenty of basics."
Fix typo in podspec name.
diff --git a/test/integration/ssl_enforcement_test.rb b/test/integration/ssl_enforcement_test.rb index abc1234..def5678 100644 --- a/test/integration/ssl_enforcement_test.rb +++ b/test/integration/ssl_enforcement_test.rb @@ -0,0 +1,40 @@+# encoding: utf-8 +#-- +# Copyright (C) 2011 Gitorious AS +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +#++ +require 'test_helper' + +class SslEnforcementTest < ActionController::IntegrationTest + context "with SSL enabled" do + setup do + # @ssl_enabled = @request.env['HTTPS'] + # @request.env['HTTPS'] = "on" + @use_ssl = GitoriousConfig["use_ssl"] + GitoriousConfig["use_ssl"] = true + end + + teardown do + # @request.env['HTTPS'] = @ssl_enabled + GitoriousConfig["use_ssl"] = @use_ssl + end + + should "not redirect from https to http" do + get "https://#{GitoriousConfig['gitorious_host']}/projects" + + assert_response :success + end + end +end
Add integration test for SSL browsing
diff --git a/spec/features/add_event_spec.rb b/spec/features/add_event_spec.rb index abc1234..def5678 100644 --- a/spec/features/add_event_spec.rb +++ b/spec/features/add_event_spec.rb @@ -9,6 +9,9 @@ fill_in 'event_title', with: 'A Ruby meeting' fill_in 'venue_name', with: 'urban' + page.execute_script %Q{ $('#venue_name').trigger('focus') } + page.execute_script %Q{ $('#venue_name').trigger('keydown') } + wait_for_ajax expect(page).to have_text('Urban Airship')
Update AddEventSpec to trigger autocomplete via focus and keydown events