diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/log.gemspec b/log.gemspec
index abc1234..def5678 100644
--- a/log.gemspec
+++ b/log.gemspec
@@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'evt-log'
- s.version = '2.1.1.0'
+ s.version = '2.1.1.1'
s.summary = 'Logging to STD IO with levels, tagging, and coloring'
s.description = ' '
|
Package version is increased from 2.1.1.0 to 2.1.1.1
|
diff --git a/tool/find.rb b/tool/find.rb
index abc1234..def5678 100644
--- a/tool/find.rb
+++ b/tool/find.rb
@@ -0,0 +1,10 @@+#!/usr/bin/env ruby
+Dir.chdir('../rubyspec') do
+ regexp = Regexp.new(ARGV[0])
+ Dir.glob('**/*.rb') do |file|
+ contents = File.read(file)
+ if regexp =~ contents
+ puts file
+ end
+ end
+end
|
Add a small script to search for multi-line regexp patterns
|
diff --git a/lib/rulers.rb b/lib/rulers.rb
index abc1234..def5678 100644
--- a/lib/rulers.rb
+++ b/lib/rulers.rb
@@ -9,10 +9,15 @@ return [404, {'Content-Type' => 'text/html'}, []]
end
- klass, action = get_controller_and_action(env)
- controller = klass.new(env)
- text = controller.send(action)
- [200, {'Content-Type' => 'text/html'}, [text]]
+ begin
+ klass, action = get_controller_and_action(env)
+ controller = klass.new(env)
+ text = controller.send(action)
+ [200, {'Content-Type' => 'text/html'}, [text]]
+ rescue => e
+ puts "Exception raised: #{e.message}"
+ [500, {'Content-Type' => 'text/html'}, ['Server error']]
+ end
end
end
|
Add exception rescue for call
|
diff --git a/lib/rumoji.rb b/lib/rumoji.rb
index abc1234..def5678 100644
--- a/lib/rumoji.rb
+++ b/lib/rumoji.rb
@@ -8,7 +8,15 @@
# Transform emoji into its cheat-sheet code
def encode(str)
- str.gsub(Emoji::ALL_REGEXP) { |match| (emoji = Emoji.find_by_string(match)) && emoji.code || match }
+ str.gsub(Emoji::ALL_REGEXP) do |match|
+ if emoji = Emoji.find_by_string(match)
+ if block_given?
+ yield emoji
+ else
+ emoji.code || match
+ end
+ end
+ end
end
# Transform a cheat-sheet code into an Emoji
@@ -16,9 +24,9 @@ str.gsub(/:([^\s:]?[\w-]+):/) { |match| (Emoji.find($1) || match).to_s }
end
- def encode_io(readable, writeable=StringIO.new(""))
+ def encode_io(readable, writeable=StringIO.new(""), &block)
readable.each_line do |line|
- writeable.write encode(line)
+ writeable.write encode(line, &block)
end
writeable
end
|
Implement the ability to pass a block to encode_io and encode
This allows a library user to easily customize the representation of an
emoji (mapping it to a custom image for example)
|
diff --git a/lib/aerosol/connection.rb b/lib/aerosol/connection.rb
index abc1234..def5678 100644
--- a/lib/aerosol/connection.rb
+++ b/lib/aerosol/connection.rb
@@ -6,7 +6,8 @@ include Dockly::Util::Logger::Mixin
logger_prefix '[aerosol connection]'
- dsl_attribute :user, :host, :jump
+ dsl_attribute :user, :host, :jump, :use_private_ip
+ default_value :use_private_ip, false
def with_connection(&block)
ensure_present! :user, :host
|
Use public_hostname by default unless overridden.
|
diff --git a/lib/chef-notifier/mail.rb b/lib/chef-notifier/mail.rb
index abc1234..def5678 100644
--- a/lib/chef-notifier/mail.rb
+++ b/lib/chef-notifier/mail.rb
@@ -34,7 +34,7 @@ private
def send_mail(message, subject=nil)
- if(@args[:recipients])
+ if(@args.respond_to?(:[]) && @args[:recipients])
Pony.mail(
:to => @args[:recipients],
:subject => subject || "[Chef ERROR #{Socket.gethostname}]",
|
Check that args are properly initialized before proceeding
|
diff --git a/dolphy.gemspec b/dolphy.gemspec
index abc1234..def5678 100644
--- a/dolphy.gemspec
+++ b/dolphy.gemspec
@@ -3,7 +3,7 @@ require 'dolphy/version'
Gem::Specification.new do |s|
- s.name = "Dolphy"
+ s.name = "dolphy"
s.version = Dolphy::VERSION
s.date = "2014-08-14"
s.summary = "A small and simple web framework."
|
Use lowercase for gem name.
|
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
@@ -21,7 +21,7 @@ spec.add_development_dependency 'rspec', '~> 3.9.0'
spec.add_development_dependency 'rspec-its', '~> 1.0'
spec.add_development_dependency 'rspec-collection_matchers', '~> 1.0'
- spec.add_development_dependency 'rubocop', '~> 0.79.0'
+ spec.add_development_dependency 'rubocop', '~> 0.80.0'
spec.add_development_dependency 'rake', '~> 13.0.0'
spec.add_development_dependency 'rspec-json_expectations', '~> 2.2'
spec.add_development_dependency 'simplecov', '~> 0.18.0'
|
Update rubocop requirement from ~> 0.79.0 to ~> 0.80.0
Updates the requirements on [rubocop](https://github.com/rubocop-hq/rubocop) to permit the latest version.
- [Release notes](https://github.com/rubocop-hq/rubocop/releases)
- [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop-hq/rubocop/compare/v0.79.0...v0.80.0)
Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
|
diff --git a/dd-agent/recipes/default.rb b/dd-agent/recipes/default.rb
index abc1234..def5678 100644
--- a/dd-agent/recipes/default.rb
+++ b/dd-agent/recipes/default.rb
@@ -13,7 +13,7 @@ apt_repository 'datadog' do
keyserver 'keyserver.ubuntu.com'
key 'C7A7DA52'
- uri 'http://apt.datadoghq.com'
+ uri node.datadog.repo
distribution "unstable"
components ["main"]
action :add
|
Allow a different apt-repo for dd-agent
|
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.0.0'
+ VERSION = '3.0.1.pre'
ENGINEYARD_SERVERSIDE_VERSION = ENV['ENGINEYARD_SERVERSIDE_VERSION'] || '2.4.2'
end
|
Add .pre for next release
|
diff --git a/envryo.gemspec b/envryo.gemspec
index abc1234..def5678 100644
--- a/envryo.gemspec
+++ b/envryo.gemspec
@@ -24,4 +24,5 @@ spec.add_development_dependency "bundler", "~> 1.6"
spec.add_development_dependency "rake"
spec.add_development_dependency "rspec"
+ spec.add_development_dependency "pry"
end
|
Add pry as development dependency
|
diff --git a/spec/factories/tasks.rb b/spec/factories/tasks.rb
index abc1234..def5678 100644
--- a/spec/factories/tasks.rb
+++ b/spec/factories/tasks.rb
@@ -12,17 +12,19 @@ # use it like this to create a task with an organizer:
# create(:task_with_organizer, organizer: a_user_instance)
#
- factory :task_with_organizer do
+ transient do
+ organizer nil
+ end
- # these can be passed in when using the factory but aren't real attributes
- transient do
- organizer { create(:user) }
- end
-
- # using the transient attribute to assign an organizer
- after(:create) do |task, evaluator|
+ # using the transient attribute to assign an organizer
+ after(:create) do |task, evaluator|
+ if evaluator.organizer
create(:task_organizer_role, user: evaluator.organizer, task: task)
end
+ end
+
+ factory :urgent_task do
+ due_date { Date.today + 1.day }
end
factory :task_with_location do
|
Simplify general task factory (can always set an organizer now), and add an urgent_task factory.
|
diff --git a/spec/view/index_spec.rb b/spec/view/index_spec.rb
index abc1234..def5678 100644
--- a/spec/view/index_spec.rb
+++ b/spec/view/index_spec.rb
@@ -6,15 +6,14 @@ before(:each) do
view.stub(:user_signed_in).and_return(false)
view.stub(:current_user).and_return(nil)
+ render
end
it 'shows the homepage' do
- render
rendered.should contain 'Growstuff'
end
it 'should have signup/login links' do
- render
rendered.should contain 'Sign up'
rendered.should contain 'Log in'
end
@@ -27,16 +26,15 @@ @user = User.create(:email => "growstuff@example.com", :password => "irrelevant")
@user.confirm!
sign_in @user
+ render
end
it 'should show username' do
- render
rendered.should contain 'You are signed in as'
rendered.should contain 'growstuff@example.com'
end
it 'should show logout link' do
- render
rendered.should contain 'Log out'
end
end
|
Unify calls to "render" in spec tests.
|
diff --git a/app/models/jobs/base.rb b/app/models/jobs/base.rb
index abc1234..def5678 100644
--- a/app/models/jobs/base.rb
+++ b/app/models/jobs/base.rb
@@ -5,6 +5,6 @@ module Jobs
class Base
Dir["#{Rails.root}/app/models/jobs/mail/*.rb"].each {|file| require file }
- #extend ResqueJobLogging
+ extend ResqueJobLogging
end
end
|
Revert "trying removing extending of empty module"
This reverts commit aaafeb27e49d45015a8bdc01ce55d36ed0318964.
|
diff --git a/lib/mina/unicorn/tasks.rb b/lib/mina/unicorn/tasks.rb
index abc1234..def5678 100644
--- a/lib/mina/unicorn/tasks.rb
+++ b/lib/mina/unicorn/tasks.rb
@@ -5,8 +5,7 @@ namespace :unicorn do
include Mina::Unicorn::Utility
- # Following recommendations from http://unicorn.bogomips.org/unicorn_1.html#rack-environment
- set :unicorn_env, -> { fetch(:rails_env) == "development" ? "development" : "deployment" }
+ set :unicorn_env, -> { fetch(:rails_env) || fetch(:rack_env) || "deployment" }
set :unicorn_config, -> { "#{fetch(:current_path)}/config/unicorn.rb" }
set :unicorn_pid, -> { "#{fetch(:current_path)}/tmp/pids/unicorn.pid" }
set :unicorn_cmd, -> { "#{fetch(:bundle_prefix, "#{fetch(:bundle_bin)} exec")} unicorn" }
|
Change unicorn_env to pass any rails_env or rack_env values
Why:
Unicorn -E flag overwrites RACK_ENV variable, making it impossible to
set RACK_ENV without modifying unicorn_env config.
|
diff --git a/spec/factories/users.rb b/spec/factories/users.rb
index abc1234..def5678 100644
--- a/spec/factories/users.rb
+++ b/spec/factories/users.rb
@@ -1,6 +1,7 @@ FactoryGirl.define do
factory :user do
email { Faker::Internet.email }
+ username {Faker::Internet.user_name}
password "password"
password_confirmation "password"
end
|
Improve user factory to create usernames too
|
diff --git a/spec/factories/users.rb b/spec/factories/users.rb
index abc1234..def5678 100644
--- a/spec/factories/users.rb
+++ b/spec/factories/users.rb
@@ -2,7 +2,7 @@
FactoryGirl.define do
factory :user do
- username { Faker::Internet.user_name }
+ sequence(:username) { |n| "user_#{n}" }
first_name { Faker::Name.first_name }
last_name { Faker::Name.last_name }
email { Faker::Internet.email }
|
Stabilize tests - generate unique usernames
Some tests are failing because Faker::Internet.user_name
doesn't have enough entropy in order to generate only unique
usernames for within a full test runs which leads to failing
tests since a user object cannot be created.
|
diff --git a/spec/models/qua_spec.rb b/spec/models/qua_spec.rb
index abc1234..def5678 100644
--- a/spec/models/qua_spec.rb
+++ b/spec/models/qua_spec.rb
@@ -5,7 +5,7 @@ before do
FactoryGirl.create(:qua1)
end
- context "Qua.center" do
+ context "Qua#center" do
before do
@q = Qua.center
end
|
Modify test code for qua spec
|
diff --git a/lib/nyny/request_scope.rb b/lib/nyny/request_scope.rb
index abc1234..def5678 100644
--- a/lib/nyny/request_scope.rb
+++ b/lib/nyny/request_scope.rb
@@ -36,9 +36,10 @@ @halt_response = Response.new body, status, @headers.merge(headers)
end
- def redirect_to path
- @redirect = path
+ def redirect_to uri, status=302
+ @redirect = [uri, status]
end
+ alias_method :redirect, :redirect_to
def apply_to &handler
@response = @halt_response || begin
@@ -46,7 +47,7 @@ end
cookies.each {|k,v| @response.set_cookie k,v }
- @response.redirect(@redirect) if @redirect
+ @response.redirect(*@redirect) if @redirect
@response.finish
@response
end
|
Allow to set status in redirect, add alias for sinatra interop
|
diff --git a/lib/raml_models/method.rb b/lib/raml_models/method.rb
index abc1234..def5678 100644
--- a/lib/raml_models/method.rb
+++ b/lib/raml_models/method.rb
@@ -12,7 +12,7 @@ end
def request_body
- Rambo::RamlModels::Body.new(schema.bodies.first)
+ Rambo::RamlModels::Body.new(schema.bodies.first) if schema.bodies.first
end
def description
|
Add conditional to prevent NoMethodError
|
diff --git a/lib/rrj/rabbit/connect.rb b/lib/rrj/rabbit/connect.rb
index abc1234..def5678 100644
--- a/lib/rrj/rabbit/connect.rb
+++ b/lib/rrj/rabbit/connect.rb
@@ -56,7 +56,8 @@ def bunny_conf_static
{
connection_timeout: 5,
- connection_name: "[#{rand(999)}] backend"
+ connection_name: "[#{rand(999)}] backend",
+ recover_from_connection_close: false
}
end
end
|
Disable option auto recover from close
|
diff --git a/lib/voight_kampff/test.rb b/lib/voight_kampff/test.rb
index abc1234..def5678 100644
--- a/lib/voight_kampff/test.rb
+++ b/lib/voight_kampff/test.rb
@@ -12,7 +12,7 @@ load_crawlers
@agent ||= @@crawlers.find do |crawler|
- user_agent_string =~ Regexp.new(crawler['pattern'], Regexp::IGNORECASE)
+ self.user_agent_string =~ Regexp.new(crawler['pattern'], Regexp::IGNORECASE)
end || {}
end
|
Fix bug where are user agents were seen as humans
Not sure why this is affecting some people and not others but apparently
user_agent_string is nil for some of them. Using self.user_agent_string
fixes the issue.
|
diff --git a/gemrat.gemspec b/gemrat.gemspec
index abc1234..def5678 100644
--- a/gemrat.gemspec
+++ b/gemrat.gemspec
@@ -20,7 +20,7 @@
spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake"
- spec.add_development_dependency "rspec", "2.13.0"
- spec.add_development_dependency "pry", "0.9.12.2"
- spec.add_development_dependency "colored", "1.2"
+ spec.add_runtime_dependency "rspec", "2.13.0"
+ spec.add_runtime_dependency "pry", "0.9.12.2"
+ spec.add_runtime_dependency "colored", "1.2"
end
|
Change dev to runtime dependencies
|
diff --git a/config/unicorn.rb b/config/unicorn.rb
index abc1234..def5678 100644
--- a/config/unicorn.rb
+++ b/config/unicorn.rb
@@ -17,5 +17,5 @@ puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT'
end
- Sequel::Model.db = Sequel.connect(Evercam::Config[:database])
-end+ Sequel::Model.db = Sequel.connect(Evercam::Config[:database], max_connections: 20)
+end
|
Set database max connections to 20
|
diff --git a/liquid-autoescape.gemspec b/liquid-autoescape.gemspec
index abc1234..def5678 100644
--- a/liquid-autoescape.gemspec
+++ b/liquid-autoescape.gemspec
@@ -21,8 +21,8 @@ s.add_dependency "liquid", ">= 2.0", "< 4.0"
s.add_development_dependency "appraisal", "~> 2.0"
- s.add_development_dependency "rake"
+ s.add_development_dependency "rake", "~> 12.0"
s.add_development_dependency "rspec", "~> 3.0"
- s.add_development_dependency "rubocop"
- s.add_development_dependency "yard", ">= 0.9.11"
+ s.add_development_dependency "rubocop", "~> 0.52"
+ s.add_development_dependency "yard", "~> 0.9.11"
end
|
Use more precise version restrictions on dev dependencies
|
diff --git a/spec/unit/puppet/provider/ip6tables_spec.rb b/spec/unit/puppet/provider/ip6tables_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/puppet/provider/ip6tables_spec.rb
+++ b/spec/unit/puppet/provider/ip6tables_spec.rb
@@ -0,0 +1,61 @@+#!/usr/bin/env rspec
+
+require 'spec_helper'
+if Puppet.version < '3.4.0'
+ require 'puppet/provider/confine/exists'
+else
+ require 'puppet/confine/exists'
+end
+provider_class = Puppet::Type.type(:firewall).provider(:ip6tables)
+describe 'ip6tables' do
+ let(:params) { {:name => '000 test foo', :action => 'accept'} }
+ let(:provider) { provider_class }
+ let(:resource) { Puppet::Type.type(:firewall) }
+ let(:ip6tables_version) { '1.4.0' }
+
+ before :each do
+
+ end
+
+ def stub_iptables
+ allow(Puppet::Type::Firewall).to receive(:defaultprovider).and_return provider
+ # Stub confine facts
+ allow(provider).to receive(:command).with(:iptables_save).and_return "/sbin/iptables-save"
+
+ allow(Facter.fact(:kernel)).to receive(:value).and_return('Linux')
+ allow(Facter.fact(:operatingsystem)).to receive(:value).and_return('Debian')
+ allow(Facter.fact('ip6tables_version')).to receive(:value).and_return(ip6tables_version)
+ allow(Puppet::Util::Execution).to receive(:execute).and_return ""
+ allow(Puppet::Util).to receive(:which).with("iptables-save").
+ and_return "/sbin/iptables-save"
+ end
+
+ shared_examples 'raise error' do
+ it {
+ stub_iptables
+ expect {
+ provider.new(resource.new(params))
+ }.to raise_error(Puppet::DevError, error_message)
+ }
+ end
+ shared_examples 'run' do
+ it {
+ stub_iptables
+ provider.new(resource.new(params))
+ }
+ end
+ context 'iptables 1.3' do
+ let(:params) { {:name => '000 test foo', :action => 'accept'} }
+ let(:error_message) { /The ip6tables provider is not supported on version 1\.3 of iptables/ }
+ let(:ip6tables_version) { '1.3.10' }
+ it_should_behave_like 'raise error'
+ end
+ context 'ip6tables nil' do
+ let(:params) { {:name => '000 test foo', :action => 'accept'} }
+ let(:error_message) { /The ip6tables provider is not supported on version 1\.3 of iptables/ }
+ let(:ip6tables_version) { nil }
+ it_should_behave_like 'run'
+ end
+
+
+end
|
Add unit test for ip6tables provider against version 1.3.10
|
diff --git a/unidata.gemspec b/unidata.gemspec
index abc1234..def5678 100644
--- a/unidata.gemspec
+++ b/unidata.gemspec
@@ -20,4 +20,5 @@ gem.add_development_dependency 'rspec', '~> 2.10'
gem.add_development_dependency 'simplecov', '~> 0.7'
gem.add_development_dependency 'coveralls', '~> 0.6'
+ gem.add_development_dependency 'mime-types', '~> 1.23'
end
|
Fix for travis ci build failing in 1.8 mode
|
diff --git a/railties/test/application/rackup_test.rb b/railties/test/application/rackup_test.rb
index abc1234..def5678 100644
--- a/railties/test/application/rackup_test.rb
+++ b/railties/test/application/rackup_test.rb
@@ -35,7 +35,7 @@ # keep it working for now
test "deprecated ActionController::Dispatcher still works" do
rackup
- assert_kind_of? Rails::Application, ActionController::Dispatcher.new
+ assert_kind_of Rails::Application, ActionController::Dispatcher.new
end
test "the config object is available on the application object" do
|
Fix typo on rackup test (ht: pleax)
|
diff --git a/app/controllers/node_types_controller.rb b/app/controllers/node_types_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/node_types_controller.rb
+++ b/app/controllers/node_types_controller.rb
@@ -1,15 +1,16 @@ class NodeTypesController < ApplicationController
def index
if params[:ids]
- node_types ||= NodeType.where(id: params[:ids])
+ @node_types ||= NodeType.where(id: params[:ids])
else
- node_types = NodeType.all
+ @node_types = NodeType.all
end
respond_to do |format|
+ format.html
format.json {
render json: {
- node_types: node_types.as_api_response(:ember)
+ node_types: @node_types.as_api_response(:ember)
}
}
end
|
Make node_types accessible as instance variables & add format.html for view
|
diff --git a/app/controllers/workspaces_controller.rb b/app/controllers/workspaces_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/workspaces_controller.rb
+++ b/app/controllers/workspaces_controller.rb
@@ -1,11 +1,36 @@ class WorkspacesController < ActionController::Base
+
+ before_filter :initialize_session_workspace
+
def show
end
def update
+ data = JSON.parse params['data']
+ type = data.keys.first
+ items = data.values
+ existing = session[:workspace][type] || []
+ session[:workspace][type] = (existing + items).uniq
end
def destroy
+ data = JSON.parse params['data']
+ type = data.keys.first
+ items = data.values
+ existing = session[:workspace][type] || []
+ existing.delete_if {|item| items.include? item}
+ session[:workspace][type] = existing
end
+
+ after_filter :debug_session
+ private
+ def debug_session
+ logger.error "SESSION: #{session.inspect}"
+ end
+
+ def initialize_session_workspace
+ session[:workspace] ||= {}
+ end
+
end
|
Save to workspace: Add/remove items from session when boxes are checked or unchecked
Debug: log session contents on every workspace request
|
diff --git a/app/models/competitions/tabor_overall.rb b/app/models/competitions/tabor_overall.rb
index abc1234..def5678 100644
--- a/app/models/competitions/tabor_overall.rb
+++ b/app/models/competitions/tabor_overall.rb
@@ -11,7 +11,7 @@ "Category 4 Men",
"Category 4 Women",
"Category 5 Men",
- "Fixed Gear",
+ "Masters Men 50+",
"Masters Men",
"Masters Women",
"Senior Men",
@@ -20,11 +20,7 @@ end
def maximum_events(race)
- if race.name == "Category 4 Men" || race.name == "Masters Women"
- 4
- else
- 5
- end
+ 6
end
def double_points_for_last_event?
|
Update Tabor competition for 2015
|
diff --git a/app/serializers/assessment_serializer.rb b/app/serializers/assessment_serializer.rb
index abc1234..def5678 100644
--- a/app/serializers/assessment_serializer.rb
+++ b/app/serializers/assessment_serializer.rb
@@ -1,6 +1,6 @@ class AssessmentSerializer < ActiveModel::Serializer
embed :ids, include: true
- attributes :id, :score, :notes, :published, :created_at
+ attributes :id, :score, :notes, :published, :created_at, :updated_at
has_one :submission
has_one :assessor
end
|
Add updated_at field to serializer.
|
diff --git a/app/serializers/discussion_serializer.rb b/app/serializers/discussion_serializer.rb
index abc1234..def5678 100644
--- a/app/serializers/discussion_serializer.rb
+++ b/app/serializers/discussion_serializer.rb
@@ -13,6 +13,6 @@ end
def description_html
- product_markdown(product, object.comments.first.body)
+ product_markdown(product, object.comments.first.try(:body))
end
end
|
Fix 500 errors with some discussions
|
diff --git a/spec/bundler/vendored_persistent_spec.rb b/spec/bundler/vendored_persistent_spec.rb
index abc1234..def5678 100644
--- a/spec/bundler/vendored_persistent_spec.rb
+++ b/spec/bundler/vendored_persistent_spec.rb
@@ -0,0 +1,68 @@+# frozen_string_literal: true
+require "spec_helper"
+require "bundler/vendored_persistent"
+
+RSpec.describe Bundler::PersistentHTTP do
+ describe "#warn_old_tls_version_rubygems_connection" do
+ let(:uri) { "https://index.rubygems.org" }
+ let(:connection) { instance_double(subject.http_class) }
+ let(:tls_version) { "TLSv1.2" }
+ let(:socket) { double("Socket") }
+ let(:socket_io) { double("SocketIO") }
+
+ before do
+ allow(connection).to receive(:use_ssl?).and_return(!tls_version.nil?)
+ allow(socket).to receive(:io).and_return(socket_io)
+ connection.instance_variable_set(:@socket, socket)
+
+ if tls_version
+ allow(socket_io).to receive(:ssl_version).and_return(tls_version)
+ end
+ end
+
+ shared_examples_for "does not warn" do
+ it "does not warn" do
+ allow(Bundler.ui).to receive(:warn).never
+ subject.warn_old_tls_version_rubygems_connection(URI(uri), connection)
+ end
+ end
+
+ shared_examples_for "does warn" do |expected|
+ it "warns" do
+ expect(Bundler.ui).to receive(:warn).with(expected)
+ subject.warn_old_tls_version_rubygems_connection(URI(uri), connection)
+ end
+ end
+
+ context "an HTTPS uri with TLSv1.2" do
+ include_examples "does not warn"
+ end
+
+ context "without SSL" do
+ let(:tls_version) { nil }
+
+ include_examples "does not warn"
+ end
+
+ context "with a different TLD" do
+ let(:uri) { "https://foo.bar" }
+ include_examples "does not warn"
+
+ context "and an outdated TLS version" do
+ let(:tls_version) { "TLSv1" }
+ include_examples "does not warn"
+ end
+ end
+
+ context "with a nonsense TLS version" do
+ let(:tls_version) { "BlahBlah2.0Blah" }
+ include_examples "does not warn"
+ end
+
+ context "with an outdated TLS version" do
+ let(:tls_version) { "TLSv1" }
+ include_examples "does warn",
+ "Your Ruby version does not support TLSv1.1 or newer, which will be required to connect to https://index.rubygems.org by January 2018."
+ end
+ end
+end
|
Add specs for warning for old TLS versions
|
diff --git a/bin/install_git_submodules.rb b/bin/install_git_submodules.rb
index abc1234..def5678 100644
--- a/bin/install_git_submodules.rb
+++ b/bin/install_git_submodules.rb
@@ -11,10 +11,11 @@
puts "-----> Installing submodule #{c["path"]} #{c["branch"]}"
branch_flag = c["branch"] ? "-b #{c['branch']}" : ""
- `git clone --single-branch #{c["url"]} #{branch_flag} #{ENV['BUILD_DIR']}/#{c["path"]}`
+ build_path = "#{ENV['BUILD_DIR']}/#{c["path"]}"
+ `git clone -q --single-branch #{c["url"]} #{branch_flag} #{build_path}`
if c.key?("revision")
puts " Setting submodule revision to #{c["revision"]}"
- Dir.chdir(c["path"]) do
+ Dir.chdir(build_path) do
`git reset --hard #{c["revision"]}`
end
end
|
Update chdir to correct build path.
|
diff --git a/worker/config/pre-daemonize/container.rb b/worker/config/pre-daemonize/container.rb
index abc1234..def5678 100644
--- a/worker/config/pre-daemonize/container.rb
+++ b/worker/config/pre-daemonize/container.rb
@@ -50,5 +50,9 @@ let(:from_address) do
"dev@smartlogic.io"
end
+
+ let(:notification_service) do
+ NotificationService
+ end
end
end
|
Add notification service to AppContainer
|
diff --git a/LeetCode/remove_duplicates_sorted_list.rb b/LeetCode/remove_duplicates_sorted_list.rb
index abc1234..def5678 100644
--- a/LeetCode/remove_duplicates_sorted_list.rb
+++ b/LeetCode/remove_duplicates_sorted_list.rb
@@ -0,0 +1,53 @@+# Given a sorted linked list, delete all duplicates such that each element appear only once.
+#
+
+class Node < Struct.new(:value, :link)
+end
+
+class List
+ def initialize
+ @root = nil
+ end
+
+ def add(value)
+ @root = Node.new(value, @root)
+ end
+
+ def display
+ it = @root
+ while it
+ print "#{it.value} "
+ it = it.link
+ end
+ puts
+ end
+
+ def dedup
+ it = @root
+ prev = nil
+ while it
+ if prev && it.value == prev.value
+ prev.link = it.link
+ else
+ prev = it
+ end
+ it = it.link
+ end
+ end
+end
+
+list = List.new
+list.add(1)
+list.add(1)
+list.add(2)
+list.add(2)
+list.add(2)
+list.add(2)
+list.add(3)
+list.add(4)
+list.add(4)
+list.add(4)
+list.add(4)
+list.display
+list.dedup
+list.display
|
Remove duplicates from sorted list
|
diff --git a/Rakefile.rb b/Rakefile.rb
index abc1234..def5678 100644
--- a/Rakefile.rb
+++ b/Rakefile.rb
@@ -2,4 +2,10 @@ desc "Minify files"
task :minify do
system "java -jar _build/htmlcompressor.jar -r --type html --compress-js -o _site _site"
-end # task :minify+end # task :minify
+
+# Usage: rake drafts
+desc "Build Jekyll site with _drafts posts"
+task :drafts do
+ system "jekyll build --drafts --limit_posts 10"
+end # task :drafts
|
Add rake task for building Jekyll _drafts posts
|
diff --git a/api/app/views/spree/api/orders/show.v1.rabl b/api/app/views/spree/api/orders/show.v1.rabl
index abc1234..def5678 100644
--- a/api/app/views/spree/api/orders/show.v1.rabl
+++ b/api/app/views/spree/api/orders/show.v1.rabl
@@ -18,7 +18,7 @@ end
child :payments => :payments do
- attributes :id, :amount, :state, :source_type
+ attributes *payment_attributes
child :payment_method => :payment_method do
attributes :id, :name, :environment
|
[api] Return *all* the payment attributes in the order payload
|
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
@@ -6,7 +6,7 @@ before_filter :configure_permitted_parameters, if: :devise_controller?
def configure_permitted_parameters
- extras = :name, :address_street, :address_locality, :address_region, :address_postcode
+ extras = :name, :address_street, :address_locality, :address_region, :address_postcode, :gift_code
devise_parameter_sanitizer.for(:sign_up) << extras
devise_parameter_sanitizer.for(:account_update) << extras
end
|
Allow gift code to be passed through when signing up
|
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
@@ -3,6 +3,6 @@
protect_from_forgery
- before_filter :authenticate_user!
+ prepend_before_filter :authenticate_user!
before_filter :require_signin_permission!
end
|
Make sure user authentication is executed first
|
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
@@ -5,7 +5,7 @@
protect_from_forgery
- include AuthHelper
+ include AMEE::Authentication::AuthHelper
include ApplicationHelper
helper_method :current_user_session, :current_user, :logged_in?, :admin_login_required
|
Use explicit scope for auth helper. AC-159
|
diff --git a/app/controllers/github_hook_controller.rb b/app/controllers/github_hook_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/github_hook_controller.rb
+++ b/app/controllers/github_hook_controller.rb
@@ -1,7 +1,7 @@ require "json"
class GithubHookController < ApplicationController
- skip_before_filter :verify_authenticity_token, :check_if_login_required
+ skip_before_action :verify_authenticity_token, :check_if_login_required
def index
message_logger = GithubHook::MessageLogger.new(logger)
|
Fix for Redmine version => 4.0.3
Rename `skip_before_filter` to `skip_before_action` because `skip_before_filter` was deprecated in Ruby on Rails 5
|
diff --git a/app/controllers/host_status_controller.rb b/app/controllers/host_status_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/host_status_controller.rb
+++ b/app/controllers/host_status_controller.rb
@@ -35,13 +35,17 @@ end
def state
- normal.map { |x|
- x.slice("host_name", "current_state")
+ normal.inject({ }) { |hash,elem|
+ hash[elem.first] = elem.last.slice("host_name", "current_state")
+ hash
}
end
def normal
- status.map { |x| x.last['hoststatus']}
+ status.inject({ }) do |hash,elem|
+ hash[elem.first] = elem.last['hoststatus']
+ hash
+ end
end
end
|
Fix data format for state and normal -> Hash
|
diff --git a/app/controllers/newsletters_controller.rb b/app/controllers/newsletters_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/newsletters_controller.rb
+++ b/app/controllers/newsletters_controller.rb
@@ -14,6 +14,12 @@
if @newsletter.save
redirect_to '/newsletter'
+ else
+ flash[:error] = "Newsletter entry invalid: "
+ @newsletter.errors.full_messages.each do |err|
+ flash[:error] += err
+ end
+ redirect_to '/admin'
end
end
|
Set up error message for invalid newsletters
|
diff --git a/app/models/default_signature_threshold.rb b/app/models/default_signature_threshold.rb
index abc1234..def5678 100644
--- a/app/models/default_signature_threshold.rb
+++ b/app/models/default_signature_threshold.rb
@@ -1,7 +1,7 @@ class DefaultSignatureThreshold
- DEFAULT_VALUES = { unspecified_person: 15,
+ DEFAULT_VALUES = { unspecified_person: 100,
unaffiliated: 100,
- candidate: 15,
+ candidate: 25,
federal: { upper: 500, lower: 350 },
major_city_council: 25,
state: 100,
|
Return unspecified signature to 100
Related to opengovernment/product#113
|
diff --git a/lib/action-gmailer.rb b/lib/action-gmailer.rb
index abc1234..def5678 100644
--- a/lib/action-gmailer.rb
+++ b/lib/action-gmailer.rb
@@ -0,0 +1,45 @@+require "action_mailer"
+require "active_support"
+
+module ActionGmailer
+
+ class DeliveryError < StandardError
+ end
+
+ class DeliveryMethod
+
+ attr_accessor :settings
+
+ def initialize(settings)
+ self.settings = settings
+ end
+
+ def smtp_server
+ self.settings[:smtp_server]
+ end
+
+ def smtp_port
+ self.settings[:smtp_port]
+ end
+
+ def ouath2_token
+ self.settings[:token]
+ end
+
+ def email
+ self.settings[:email]
+ end
+
+ def host
+ self.settings[:smtp_host]
+ end
+
+ def deliver!(mail)
+ #FIXME: send
+ rescue
+ raise DeliveryError, "FIXME"
+ end
+ end
+end
+
+ActionMailer::Base.add_delivery_method :action_gmailer, ActionGmailer::DeliveryMethod
|
Add delivery plug stub for ActionMailer
|
diff --git a/app/models/application_record.rb b/app/models/application_record.rb
index abc1234..def5678 100644
--- a/app/models/application_record.rb
+++ b/app/models/application_record.rb
@@ -11,6 +11,12 @@ # activate this line:
# "updated_at",
"current_sign_in_at" ]
+
+ # Sometimes the Ruby class name does not match up with the FBOS/FBJS/FE name.
+ # Entering a class into this dictionary allows for special cases.
+ SPECIAL_NAMES = {
+ GenericPointer => "Point"
+ }
# Determine if the changes to the model are worth broadcasting or not.
# Reduces network noise.
@@ -36,7 +42,8 @@ end
def chan_name
- "sync.#{self.class.name}.#{self.id}"
+ klass = self.class
+ "sync.#{(SPECIAL_NAMES[klass] || klass.name)}.#{self.id}"
end
def broadcast!
|
Fix auto_sync bug with generic points
|
diff --git a/app/models/application_record.rb b/app/models/application_record.rb
index abc1234..def5678 100644
--- a/app/models/application_record.rb
+++ b/app/models/application_record.rb
@@ -4,7 +4,7 @@ def audited_user_id
user = ::Audited.store[:audited_user] # from as_user
user ||= ::Audited.store[:current_user].call if ::Audited.store[:current_user].respond_to?(:call) # from controller method
- return nil if user.nil? && Rails.env != 'test' # for debugging purposes this should fail loudly in tests
+ return nil if user.nil? && !Rails.env.test? # for debugging purposes this should fail loudly in tests
user.id
end
end
|
Use Rails.env.test? rather than Rails.env == 'test'
|
diff --git a/query/spec/appointments/model_spec.rb b/query/spec/appointments/model_spec.rb
index abc1234..def5678 100644
--- a/query/spec/appointments/model_spec.rb
+++ b/query/spec/appointments/model_spec.rb
@@ -2,12 +2,57 @@
describe CQalendaRS::Query::Appointments::Model do
+ let(:appointment1) { { start_time: "2015-02-05 09:50:00", end_time: "2015-02-05 10:20:00", description: "Collis' RubyConf Keynote" } }
+ let(:appointment2) { { start_time: "2015-02-04 19:00:00", end_time: "2015-02-04 23:00:00", description: "RubyConf Opening Partay!" } }
+ let(:appointment3) { { start_time: "2015-02-07 16:30:00", end_time: "2015-02-07 20:45:00", description: "RubyConf Picnic" } }
+
+ before do
+ [appointment1, appointment2, appointment3].each do |appointment_hash|
+ DB[:appointments].insert(appointment_hash)
+ end
+ end
+
+ after do
+ DB[:appointments].truncate
+ end
+
describe ".all" do
-
+
+ subject(:all_appointments) { CQalendaRS::Query::Appointments::Model.all }
+
it "returns all appointments in an array of value objects" do
- expect(CQalendaRS::Query::Appointments::Model.all).to eql([])
+ expect(all_appointments).to be_an_instance_of(Array) \
+ .and(all(be_an_instance_of(CQalendaRS::Query::Appointments::Model::Appointment)))
end
-
+
+ it "returns the expected number of appointments" do
+ expect(all_appointments.count).to eql(3)
+ end
+
+ it "returns the earliest appointment first" do
+ first_appointment = all_appointments.first
+
+ expect(first_appointment.start_time).to eql(Time.parse(appointment2[:start_time]))
+ expect(first_appointment.end_time).to eql(Time.parse(appointment2[:end_time]))
+ expect(first_appointment.description).to eql(appointment2[:description])
+ end
+
+ it "returns the middle appointment second" do
+ second_appointment = all_appointments[1]
+
+ expect(second_appointment.start_time).to eql(Time.parse(appointment1[:start_time]))
+ expect(second_appointment.end_time).to eql(Time.parse(appointment1[:end_time]))
+ expect(second_appointment.description).to eql(appointment1[:description])
+ end
+
+ it "returns the latest appointment last" do
+ last_appointment = all_appointments.last
+
+ expect(last_appointment.start_time).to eql(Time.parse(appointment3[:start_time]))
+ expect(last_appointment.end_time).to eql(Time.parse(appointment3[:end_time]))
+ expect(last_appointment.description).to eql(appointment3[:description])
+ end
+
end
end
|
Add more tests for the appointments Model.all method
|
diff --git a/week-4/basic-math.rb b/week-4/basic-math.rb
index abc1234..def5678 100644
--- a/week-4/basic-math.rb
+++ b/week-4/basic-math.rb
@@ -0,0 +1,87 @@+# Solution Below
+
+
+
+
+
+
+# RSpec Tests. They are included in this file because the local variables you are creating are not accessible across files. If we try to run these files as a separate file per normal operation, the local variable checks will return nil.
+
+num1 = 101
+num2 = 3
+
+sum = num1 + num2
+difference = num1 - num2
+quotient = num1.to_f / num2.to_f
+product = num1 * num2
+modulus = num1 % num2
+
+describe 'num1' do
+ it "is defined as a local variable" do
+ expect(defined?(num1)).to eq 'local-variable'
+ end
+
+ it "is an integer" do
+ expect(num1).to be_a Fixnum
+ end
+end
+
+describe 'num2' do
+ it "is defined as a local variable" do
+ expect(defined?(num2)).to eq 'local-variable'
+ end
+
+ it "is an integer" do
+ expect(num2).to be_a Fixnum
+ end
+end
+
+describe 'sum' do
+ it "is defined as a local variable" do
+ expect(defined?(sum)).to eq 'local-variable'
+ end
+
+ it "is assigned the value of num1 + num2" do
+ expect(sum).to eq num1 + num2
+ end
+end
+
+describe 'difference' do
+ it "is defined as a local variable" do
+ expect(defined?(difference)).to eq 'local-variable'
+ end
+
+ it "is assigned the value of num1 - num2" do
+ expect(difference).to eq num1 - num2
+ end
+end
+
+describe 'product' do
+ it "is defined as a local variable" do
+ expect(defined?(product)).to eq 'local-variable'
+ end
+
+ it "is assigned the value of num1 * num2" do
+ expect(product).to eq num1 * num2
+ end
+end
+
+describe 'quotient' do
+ it "is defined as a local variable" do
+ expect(defined?(quotient)).to eq 'local-variable'
+ end
+
+ it "is assigned the value of num1 / num2" do
+ expect(quotient).to eq num1.to_f / num2.to_f
+ end
+end
+
+describe 'modulus' do
+ it "is defined as a local variable" do
+ expect(defined?(modulus)).to eq 'local-variable'
+ end
+
+ it "is assigned the value of num1 % num2" do
+ expect(modulus).to eq num1.to_f % num2.to_f
+ end
+end
|
Add file for basic math
|
diff --git a/app/views/tags/show.atom.builder b/app/views/tags/show.atom.builder
index abc1234..def5678 100644
--- a/app/views/tags/show.atom.builder
+++ b/app/views/tags/show.atom.builder
@@ -1,4 +1,4 @@-atom_feed do |feed|
+atom_feed(:root_url => polymorphic_url(@tag)) do |feed|
feed.title("Latest activity for #{@tag}")
feed.updated(@tag.updated_at)
@@ -10,10 +10,8 @@ # sanitize strips away the ul/li tags
entry.content(sanitize(event_html, :tags => %w(a href p span)), :type => 'html')
- if event.actor
- entry.author do |author|
- author.name(event.actor.login)
- end
+ entry.author do |author|
+ author.name(event.actor.nil? ? "crantastic" : event.actor.login)
end
end
end
|
Set a more natural root url and always include author for the feed entries.
|
diff --git a/worker/config/environments/production.rb b/worker/config/environments/production.rb
index abc1234..def5678 100644
--- a/worker/config/environments/production.rb
+++ b/worker/config/environments/production.rb
@@ -3,3 +3,6 @@
# Change the production log level to debug
#config.log_level = :debug
+
+require 'syslog/logger'
+DaemonKit.logger = Syslog::Logger.new("worker")
|
Set syslog logger for daemon kit workers
|
diff --git a/rakefile.rb b/rakefile.rb
index abc1234..def5678 100644
--- a/rakefile.rb
+++ b/rakefile.rb
@@ -25,7 +25,7 @@ desc 'Uninstalls the gem'
task :uninstall do
puts "Uninstalling gem #{NAME}"
- puts %x[gem uninstall #{NAME}]
+ puts %x[gem uninstall #{NAME} --all]
end
desc 'Installs the gem from the local source'
|
Uninstall all versions to avoid an interactive question, especially on automated build machines.
|
diff --git a/features/support/env.rb b/features/support/env.rb
index abc1234..def5678 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -1,3 +1,4 @@+require 'fileutils'
require 'vim-flavor'
class FakeUserEnvironment
@@ -5,6 +6,10 @@ File.open(expand(virtual_path), 'w') do |f|
f.write(content)
end
+ end
+
+ def delete_path path
+ FileUtils.remove_entry_secure(path)
end
def expand(virtual_path)
|
Add a helper method - delete_path
|
diff --git a/test/controllers/updates_controller_test.rb b/test/controllers/updates_controller_test.rb
index abc1234..def5678 100644
--- a/test/controllers/updates_controller_test.rb
+++ b/test/controllers/updates_controller_test.rb
@@ -2,19 +2,19 @@
class UpdatesControllerTest < ActionController::TestCase
test 'redirect from first step to second step' do
- put :update, :id => :first
+ put :update, :id => 'first'
assert_redirected_to update_path(:second)
assert_equal 'Thing was updated from step first.', flash[:notice]
end
test 'redirect from second step to final step' do
- put :update, :id => :second
+ put :update, :id => 'second'
assert_redirected_to update_path(:last_step)
assert_equal 'Thing was updated from step second.', flash[:notice]
end
test 'redirect from last_step to root path' do
- put :update, :id => :last_step
+ put :update, :id => 'last_step'
assert_redirected_to update_path(:wicked_finish)
assert_equal 'Thing was updated from step last_step.', flash[:notice]
end
|
Update controller test, does it work in Rails 3?
|
diff --git a/hive-runner-android.gemspec b/hive-runner-android.gemspec
index abc1234..def5678 100644
--- a/hive-runner-android.gemspec
+++ b/hive-runner-android.gemspec
@@ -1,7 +1,7 @@ Gem::Specification.new do |s|
s.name = 'hive-runner-android'
s.version = '1.1.3'
- s.date = '2015-02-26'
+ s.date = Time.now.strftime("%Y-%m-%d")
s.summary = 'Hive Runner Android'
s.description = 'The Android controller module for Hive Runner'
s.authors = ['Jon Wilson']
|
Set date to always be today
|
diff --git a/lib/klarna_gateway.rb b/lib/klarna_gateway.rb
index abc1234..def5678 100644
--- a/lib/klarna_gateway.rb
+++ b/lib/klarna_gateway.rb
@@ -3,15 +3,27 @@ require "klarna_gateway/version"
require "active_merchant/billing/gateways/klarna_gateway"
require "klarna_gateway/engine"
+require "byebug"
module KlarnaGateway
module ControllerSession
+ KLARNA_SESSION_LIFETIME = 60.minutes
+
def klarna_session
- klarna = Spree::PaymentMethod.where(type: 'Spree::Gateway::KlarnaCredit').last
- order = Spree::OrderSerializer.new(@order, klarna.preferences[:country])
- response = klarna.provider.create_session(order)
- session[:token] = response.client_token
- render json: {token: response.client_token}
+ byebug
+ if session.has_key?(:klarna_credit_session_created) && session[:klarna_credit_session_created] > KLARNA_SESSION_LIFETIME.ago
+ # TODO: update session
+ render json: {token: session[:klarna_credit_session_token]}
+ else
+ klarna = Spree::PaymentMethod.where(type: 'Spree::Gateway::KlarnaCredit').last
+ order = Spree::OrderSerializer.new(@order, klarna.preferences[:country])
+ response = klarna.provider.create_session(order)
+ if response.success?
+ session[:klarna_credit_session_token] = response.client_token
+ session[:klarna_credit_session_created] = Time.current
+ end
+ render json: {token: response.client_token}
+ end
end
def self.included(base)
|
Save token for 60 minutes
|
diff --git a/app/serializers/slack/ephemeral/poll_closed_serializer.rb b/app/serializers/slack/ephemeral/poll_closed_serializer.rb
index abc1234..def5678 100644
--- a/app/serializers/slack/ephemeral/poll_closed_serializer.rb
+++ b/app/serializers/slack/ephemeral/poll_closed_serializer.rb
@@ -2,6 +2,6 @@ include Slack::Ephemeral::Message
def text
- I18n.t(:"slack.poll_closed", title: object.title, url: slack_link_for(poll))
+ I18n.t(:"slack.poll_closed", title: object.title, url: slack_link_for(object))
end
end
|
Fix ephemeral poll closed serializer
|
diff --git a/app/controllers/renalware/hd/dashboards_controller.rb b/app/controllers/renalware/hd/dashboards_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/renalware/hd/dashboards_controller.rb
+++ b/app/controllers/renalware/hd/dashboards_controller.rb
@@ -10,7 +10,7 @@ preference_set = PreferenceSet.for_patient(@patient).first_or_initialize
access_profile = Renalware::Accesses.cast_patient(@patient).current_profile
profile = Profile.for_patient(@patient).first_or_initialize
- sessions = Session.for_patient(@patient).limit(10).ordered
+ sessions = Session.for_patient(@patient).includes(:signed_off_by).limit(10).ordered
dry_weights = DryWeight.for_patient(@patient).limit(10).includes(:assessor).ordered
render locals: {
|
Remove N+1 query in HD Dashboard
|
diff --git a/app/boot.rb b/app/boot.rb
index abc1234..def5678 100644
--- a/app/boot.rb
+++ b/app/boot.rb
@@ -19,4 +19,4 @@
# Heroku's ruby buildpack freezes the Gemfile to prevent accidental damage
# However, we actually *want* to manipulate Gemfiles for other repos.
-Bundler.settings[:frozen] = "0"
+Bundler.settings.temporary(frozen: 0)
|
Fix the specs by manipulating Bundler's settings differently
In `app/boot.rb`, we try to set Bundler's settings to "unfreeze"
the bundle for the purposes of our tests. This has been broken
for a little while due to a changed API in Bundler since v1.16.0,
resulting in
[errors when running the tests][circle-gocardless-bump-258]:
```
An error occurred while loading ./spec/app/workers/dependency_file_fetcher_spec.rb.
Failure/Error: Bundler.settings[:frozen] = "0"
NoMethodError:
undefined method `[]=' for #<Bundler::Settings:0x00000002958f38>
Did you mean? []
```
Bundler removed this API for tweaking the settings in
[June][8ccf49c], but an alternative means for updating
them was introduced before that in [August 2016][3b6dd37].
This switches to using the way that is in Bundler now: using
`Bundler::Settings#temporary`.
[circle-gocardless-bump-258]: https://circleci.com/gh/gocardless/bump/258?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link
[8ccf49c]: https://github.com/bundler/bundler/commit/8ccf49c3b4a086f1e0cad2130dc30c04304175b7
[3b6dd37]: https://github.com/bundler/bundler/commit/3b6dd372dca9b695e9283d8c49644b9dec9ef260
|
diff --git a/abfab.gemspec b/abfab.gemspec
index abc1234..def5678 100644
--- a/abfab.gemspec
+++ b/abfab.gemspec
@@ -6,7 +6,7 @@ gem.email = ['christopher.m.hanks@gmail.com']
gem.description = %q{A/B testing with Redis.}
gem.summary = %q{Fabulous A/B testing with persistence to Redis.}
- gem.homepage = ''
+ gem.homepage = 'https://github.com/chanks/abfab'
gem.files = `git ls-files`.split($\)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
Set github repository as gem homepage.
|
diff --git a/Casks/apimac-timer.rb b/Casks/apimac-timer.rb
index abc1234..def5678 100644
--- a/Casks/apimac-timer.rb
+++ b/Casks/apimac-timer.rb
@@ -0,0 +1,14 @@+class ApimacTimer < Cask
+ version :latest
+ sha256 :no_check
+
+ url 'http://www.apimac.com/download/timer.dmg'
+ homepage 'http://www.apimac.com/mac/timer/'
+ license :gratis
+
+ app 'Apimac Timer.app'
+ zap :delete => [
+ '~/Library/Preferences/Apimac',
+ '~/Library/Application Support/Apimac',
+ ]
+end
|
Add Apimac Timer.app, last 7.0.0 version
|
diff --git a/money.gemspec b/money.gemspec
index abc1234..def5678 100644
--- a/money.gemspec
+++ b/money.gemspec
@@ -7,7 +7,7 @@ s.description = "Money and currency exchange support library."
s.has_rdoc = true
s.rubyforge_project = "money"
- s.authors = ["Tobias Luetke", "Hongli Lai", "Jeremy McNevin"]
+ s.authors = ["Tobias Luetke", "Hongli Lai", "Jeremy McNevin", "Shane Emmons"]
s.files = [
"README.rdoc", "MIT-LICENSE", "money.gemspec", "Rakefile",
|
Add myself (Shane Emmons) to authors
|
diff --git a/month.gemspec b/month.gemspec
index abc1234..def5678 100644
--- a/month.gemspec
+++ b/month.gemspec
@@ -8,9 +8,9 @@ gem.version = Month::VERSION
gem.authors = ["Matt Royal"]
gem.email = ["mroyal@gmail.com"]
- gem.description = %q{TODO: Write a gem description}
- gem.summary = %q{TODO: Write a gem summary}
- gem.homepage = ""
+ gem.description = %q{The missing Month class every project ends up needing}
+ gem.summary = %q{}
+ gem.homepage = "https://github.com/matt-royal/month"
gem.files = `git ls-files`.split($/)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
Add basic info to gemspec
|
diff --git a/core/range/size_spec.rb b/core/range/size_spec.rb
index abc1234..def5678 100644
--- a/core/range/size_spec.rb
+++ b/core/range/size_spec.rb
@@ -11,10 +11,6 @@ (1.0..15.9).size.should == 15
(1.1..16.0).size.should == 15
(1.1..15.9).size.should == 15
-
- (0..Float::INFINITY).size.should == Float::INFINITY
- (-Float::INFINITY..0).size.should == Float::INFINITY
- (-Float::INFINITY..Float::INFINITY).size.should == Float::INFINITY
end
it "returns 0 if last is less than first" do
@@ -23,6 +19,12 @@ (Float::INFINITY..0).size.should == 0
end
+ it 'returns Float::INFINITY for increasing, infinite ranges' do
+ (0..Float::INFINITY).size.should == Float::INFINITY
+ (-Float::INFINITY..0).size.should == Float::INFINITY
+ (-Float::INFINITY..Float::INFINITY).size.should == Float::INFINITY
+ end
+
it "returns nil if first and last are not Numeric" do
(:a..:z).size.should be_nil
('a'..'z').size.should be_nil
|
Move infinite range expectations to their own example
|
diff --git a/steam-condenser.gemspec b/steam-condenser.gemspec
index abc1234..def5678 100644
--- a/steam-condenser.gemspec
+++ b/steam-condenser.gemspec
@@ -17,7 +17,7 @@
s.add_development_dependency 'mocha', '~> 0.13.0'
s.add_development_dependency 'rake', '~> 10.0.1'
- s.add_development_dependency 'shoulda-context', '~> 1.0.0'
+ s.add_development_dependency 'shoulda-context', '~> 1.1.1'
s.add_development_dependency 'yard', '~> 0.8.0'
s.files = Dir.glob '**/*'
|
Update shoulda-context dependency to 1.1.1
|
diff --git a/support/publish-gems.rb b/support/publish-gems.rb
index abc1234..def5678 100644
--- a/support/publish-gems.rb
+++ b/support/publish-gems.rb
@@ -11,17 +11,20 @@ end
gem_order = %w{
+ torquebox-core
torquebox-vfs
- torquebox-base
torquebox-capistrano-support
torquebox-rake-support
- torquebox-container-foundation
- torquebox-messaging-container
- torquebox-naming-container
+ torquebox-configure
torquebox-naming
+ torquebox-security
+ torquebox-transactions
+ torquebox-cache
torquebox-messaging
+ torquebox-stomp
torquebox-web
torquebox
+ torquebox-server
}
if gem_map.keys.sort != gem_order.sort
|
Adjust the gem-publisher for 2.x gems
|
diff --git a/jquery_mobile_rails.gemspec b/jquery_mobile_rails.gemspec
index abc1234..def5678 100644
--- a/jquery_mobile_rails.gemspec
+++ b/jquery_mobile_rails.gemspec
@@ -16,7 +16,7 @@ s.files = Dir["{app,config,db,lib,vendor}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
s.test_files = Dir["test/**/*"]
- s.add_dependency "rails", ">= 3.1.0"
+ s.add_dependency "railties", ">= 3.1.0"
s.add_development_dependency "sqlite3"
s.require_path = 'lib'
|
Replace 'rails' with 'railties', to not require extra gems when not needed.
|
diff --git a/app/importers/data_transformers/json_transformer.rb b/app/importers/data_transformers/json_transformer.rb
index abc1234..def5678 100644
--- a/app/importers/data_transformers/json_transformer.rb
+++ b/app/importers/data_transformers/json_transformer.rb
@@ -8,26 +8,31 @@ end
end
+ def date_rows
+ [ :event_date, :date_taken, :assessment_date ]
+ end
+
+ def boolean_rows
+ [ :asbence, :tardy, :has_exact_time ]
+ end
+
def transform_row(row)
row[:local_id] = row[:local_id].to_s
# Date rows to datetime
- if row[:event_date].present?
- row[:event_date] = parse_date(row[:event_date])
- elsif row[:date_taken].present?
- row[:date_taken] = parse_date(row[:date_taken])
+ date_rows.each do |dr|
+ if row[dr].present?
+ row[dr] = parse_date(row[dr])
+ end
end
- # Boolean rows to boolean
- if row[:asbence].present?
- row[:asbence] = parse_boolean(row[:asbence])
+ boolean_rows.each do |br|
+ if row[br].present?
+ row[br] = parse_boolean(row[br])
+ end
end
- if row[:tardy].present?
- row[:tardy] = parse_boolean(row[:tardy])
- end
- if row[:has_exact_time].present?
- row[:has_exact_time] = parse_boolean(row[:has_exact_time])
- end
+
+ return row
end
def parse_date(event_date)
|
Add assessment_dateto json date fields for parsing
|
diff --git a/app/models/services/doc_collections/upload_files.rb b/app/models/services/doc_collections/upload_files.rb
index abc1234..def5678 100644
--- a/app/models/services/doc_collections/upload_files.rb
+++ b/app/models/services/doc_collections/upload_files.rb
@@ -12,19 +12,18 @@
# Check which files are already uploaded
dir = File.expand_path('..', doc_collection.local_path)
- Dir.chdir(dir) do
- all_files = Dir[File.join(doc_collection.slug, '**', '*')].select do |file|
- File.file?(file)
- end
- uploaded_files = bucket.objects.with_prefix(doc_collection.slug).map(&:key)
- remaining_files = all_files - uploaded_files
+ Dir.chdir dir
+ all_files = Dir[File.join(doc_collection.slug, '**', '*')].select do |file|
+ File.file?(file)
+ end
+ uploaded_files = bucket.objects.with_prefix(doc_collection.slug).map(&:key)
+ remaining_files = all_files - uploaded_files
- # Upload remaining files
- remaining_files.take(BATCH_SIZE).each do |file|
- content_type = MimeMagic.by_path(file).to_s
- bucket.objects[file].write(file: file, content_type: content_type)
- remaining_files.delete(file)
- end
+ # Upload remaining files
+ remaining_files.take(BATCH_SIZE).each do |file|
+ content_type = MimeMagic.by_path(file).to_s
+ bucket.objects[file].write(file: file, content_type: content_type)
+ remaining_files.delete(file)
end
# Enqueue yourself if there are more files to upload
|
Fix uploading doc collection files
|
diff --git a/app/presenters/tree_builder_report_saved_reports.rb b/app/presenters/tree_builder_report_saved_reports.rb
index abc1234..def5678 100644
--- a/app/presenters/tree_builder_report_saved_reports.rb
+++ b/app/presenters/tree_builder_report_saved_reports.rb
@@ -20,7 +20,7 @@ def x_get_tree_roots(count_only, _options)
folder_ids = {}
u = User.current_user
- g = u.admin_user? ? nil : u.miq_group.miq_user_role.name.split('-').last
+ g = u.admin_user? ? nil : u.miq_group
MiqReport.having_report_results(:miq_group => g, :select => [:id, :name]).each do |r|
folder_ids[r.name] = to_cid(r.id.to_i)
end
|
Change condition for report tree
|
diff --git a/bud.gemspec b/bud.gemspec
index abc1234..def5678 100644
--- a/bud.gemspec
+++ b/bud.gemspec
@@ -22,4 +22,5 @@ s.add_dependency 'backports'
s.add_dependency 'tokyocabinet'
s.add_dependency 'syntax'
+ s.add_dependency 'zookeeper'
end
|
Add dependency on "zookeeper" gem.
|
diff --git a/core/file/owned_spec.rb b/core/file/owned_spec.rb
index abc1234..def5678 100644
--- a/core/file/owned_spec.rb
+++ b/core/file/owned_spec.rb
@@ -6,5 +6,28 @@ end
describe "File.owned?" do
- it "needs to be reviewed for spec completeness"
+ before(:each) do
+ @filename = tmp("i_exist")
+ touch(@filename)
+ end
+
+ after(:each) do
+ rm_r @filename
+ end
+
+ it "returns false if file does not exist" do
+ File.owned?("I_am_a_bogus_file").should == false
+ end
+
+ it "returns true if the file exist and is owned by the user" do
+ File.owned?(@filename).should == true
+ end
+
+ platform_is_not :windows do
+ it "returns false when the file is not owned by the user" do
+ system_file = '/etc/passwd'
+ File.owned?(system_file).should == false
+ end
+ end
+
end
|
Add spec for File.owned? and fix a bug
Add spec for File.owned?, plus fix an error inside of rubinius
implementation: when a file was missing an exception was raised
instead of returning false.
Delete a duplicated definition of File.owned? inside of¬
kernel/common/file.rb
|
diff --git a/test/config_spec.rb b/test/config_spec.rb
index abc1234..def5678 100644
--- a/test/config_spec.rb
+++ b/test/config_spec.rb
@@ -14,6 +14,13 @@ describe "#admin_password" do
it "is the admin password defined in the config file" do
subject.admin_password.should == "test-changethispassword"
+ end
+ end
+
+ describe "#image_upload_path" do
+ it "defaults to /images/:timestamp/_name" do
+ subject.stub(:yaml) { {} }
+ subject.image_upload_path.should == "/images/:timestamp_:name"
end
end
|
Add a test covering the default value of image_upload_path.
|
diff --git a/ced.gemspec b/ced.gemspec
index abc1234..def5678 100644
--- a/ced.gemspec
+++ b/ced.gemspec
@@ -11,7 +11,7 @@ gem.description = %q{Ruby interface for CED's email verification service.}
gem.summary = %q{The Central Email Database is an email verification service. You pass it an email address and it tells you if the email address is real or not. This gem wraps the API in a more Ruby friendly syntax. CED also corrects common typos in email domains.}
gem.homepage = "https://github.com/cimm/ced"
- spec.license = "MIT"
+ gem.license = "MIT"
gem.files = `git ls-files`.split($/)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
Fix license typo in gemspec
|
diff --git a/test/paid/alias_test.rb b/test/paid/alias_test.rb
index abc1234..def5678 100644
--- a/test/paid/alias_test.rb
+++ b/test/paid/alias_test.rb
@@ -2,18 +2,9 @@
module Paid
class AliasTest < Test::Unit::TestCase
- should "aliases should be listable" do
- @mock.expects(:get).once.returns(test_response(test_alias_array))
- c = Paid::Alias.all
- assert c.data.kind_of? Array
- c.each do |paid_alias|
- assert paid_alias.kind_of?(Paid::Alias)
- end
- end
-
should "aliases should not be deletable" do
assert_raises NoMethodError do
- @mock.expects(:get).once.returns(test_response(test_alias))
+ @mock.expects(:get).once.returns(test_response(test_customer))
c = Paid::Alias.retrieve("test_alias")
c.delete
end
|
Remove old tests for listable aliases.
|
diff --git a/lib/action_flow/workflow.rb b/lib/action_flow/workflow.rb
index abc1234..def5678 100644
--- a/lib/action_flow/workflow.rb
+++ b/lib/action_flow/workflow.rb
@@ -11,6 +11,7 @@ @steps << new_step
else
step = "#{new_step}_step".classify.constantize
+ step.module_eval { define_method(:execute, &action) } if block_given?
@steps << step
end
end
@@ -18,7 +19,7 @@ def execute(controller, max_step = nil)
@steps.each_with_index do |s, i|
controller.extend s
- controller.max_step_reached = i + 1
+ controller.max_step_reached = i + 1 if controller.respond_to?(:max_step_reached=)
if !controller.passes? || (!max_step.nil? && max_step.to_i == (i + 1))
controller.execute
return true
|
Allow add_step to take a block again
execute checks to see if the controller responds to max_step_reached= before just calling it
git-svn-id: bbecf9db08a75a77aa31d13d235dbc25c5353c8b@21 82013aef-fb27-0410-99a1-c1893322ecab
|
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -10,7 +10,6 @@ rescue_from Exception, :with => :render_error
rescue_from ActionController::RoutingError, :with => :render_not_found
rescue_from ActionController::UnknownController, :with => :render_not_found
- rescue_from ActionController::UnknownAction, :with => :render_not_found
end
def no_users?
|
Remove error catching for UnknownError
|
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,7 +2,6 @@ # Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
- before_filter :set_cache_buster
add_flash_types :error
@@ -22,10 +21,17 @@ decorate current_user
}
+ private
+
def set_cache_buster
response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
response.headers["Pragma"] = "no-cache"
response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
end
+ def after_sign_out_path_for(resource_or_scope)
+ set_cache_buster
+ root_path
+ end
+
end
|
Remove headers cache only on logout
|
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,7 +4,7 @@ protect_from_forgery with: :exception
# TODO : Remove this basic HTTP authentication before delivery
- before_action :authenticate, if: "Rails.env.production?"
+ # before_action :authenticate, if: "Rails.env.production?"
protected
|
Remove basic http auth on prod
|
diff --git a/app/documents/renalware/blood_pressure.rb b/app/documents/renalware/blood_pressure.rb
index abc1234..def5678 100644
--- a/app/documents/renalware/blood_pressure.rb
+++ b/app/documents/renalware/blood_pressure.rb
@@ -18,5 +18,21 @@ def blank?
systolic.blank? && diastolic.blank?
end
+
+ # Compare BPs by first comparing systolic values. If they are equal, compare by diastolic.
+ # Missing values default to a large number so they will come e.g last if #min is called
+ # on an array of BloodPressures.
+ def <=>(other)
+ dia = diastolic.presence || 10000
+ sys = systolic.presence || 10000
+ other_dia = other.diastolic.presence || 10000
+ other_sys = other.systolic.presence || 10000
+
+ if sys == other_sys
+ dia <=> other_dia
+ else
+ sys <=> other_sys
+ end
+ end
end
end
|
Add comparison operator to BloodPressure
|
diff --git a/app/models/visualization/table_blender.rb b/app/models/visualization/table_blender.rb
index abc1234..def5678 100644
--- a/app/models/visualization/table_blender.rb
+++ b/app/models/visualization/table_blender.rb
@@ -1,4 +1,6 @@ # encoding: utf-8
+
+require_dependency 'map/copier'
module CartoDB
module Visualization
|
Add map copier dependency
Before it was taken implicitly from the controllers
|
diff --git a/lib/extensions/require_nested.rb b/lib/extensions/require_nested.rb
index abc1234..def5678 100644
--- a/lib/extensions/require_nested.rb
+++ b/lib/extensions/require_nested.rb
@@ -11,6 +11,27 @@ require_dependency filename
end
+ # If the nested constant has a top-level constant with the same name, then both
+ # must be defined at the same time, otherwise the Rails autoloader can get
+ # confused.
+ #
+ # For example, suppose we have the following
+ #
+ # # app/models/thing_grouper.rb
+ # class ThingGrouper < ApplicationRecord
+ # require_nested :Thing
+ # end
+ #
+ # # app/models/thing_grouper/thing.rb
+ # class ThingGrouper::Thing; end
+ #
+ # # app/models/thing.rb
+ # class Thing < ApplicationRecord; end
+ #
+ # When the require_nested call is made, we will define `ThingGrouper`'s nested
+ # `Thing`, but at the same time we must also define `::Thing` in order to allow
+ # the Rails autloader to work correctly. We do this by using a special-case call
+ # to `require_nested` on `Object`, if a top-level `thing.rb` file exists.
if ActiveSupport::Dependencies.search_for_file(name.to_s.underscore) && self != Object
Object.require_nested name
end
|
Add comment to clarify intent
|
diff --git a/Casks/xoctave.rb b/Casks/xoctave.rb
index abc1234..def5678 100644
--- a/Casks/xoctave.rb
+++ b/Casks/xoctave.rb
@@ -0,0 +1,15 @@+cask :v1 => 'xoctave' do
+ version :latest
+ sha256 :no_check
+
+ url 'http://www.xoctave.com/demo/xoctave%20demo.dmg'
+ name 'Xoctave'
+ homepage 'http://www.xoctave.com/'
+ license :commercial
+
+ app 'Xoctave.app'
+
+ uninstall :quit => 'org.magnifier.magnifier'
+
+ zap :delete => '~/xoctave'
+end
|
Add Xoctave, a commercial IDE for GNU Octave
|
diff --git a/sudokuru.rb b/sudokuru.rb
index abc1234..def5678 100644
--- a/sudokuru.rb
+++ b/sudokuru.rb
@@ -5,18 +5,18 @@ puts "Let's solve some Sudoku!"
if ARGV[0] != nil
- @input_file = ARGV[0]
+ input_file = ARGV[0]
else
puts "No file specified. Searching for default input file."
- @input_file = "./puzzles/input.txt"
+ input_file = "./puzzles/input.txt"
end
begin
- puts "Using provided file: #{@input_file}"
- file = File.open(@input_file, "r")
+ puts "Using provided file: #{input_file}"
+ file = File.open(input_file, "r")
rescue
- puts "ERROR. Given file doesn't exist. Halting."
exit
end
+
data = file.read
file.close
|
Downgrade instance variable to local
Learn your place, local variable!
|
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
@@ -8,4 +8,10 @@ def set_analytics_headers
set_slimmer_headers(format: "smart_answer")
end
+
+ def set_expiry(duration = 30.minutes)
+ unless Rails.env.development?
+ expires_in(duration, :public => true)
+ end
+ end
end
|
Add set_expiry method to ApplicationController
As we'll need to consistently (and easily) set cache control headers,
add a protected method to ApplicationController.
|
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
@@ -12,9 +12,8 @@ @graph = Koala::Facebook::API.new(session[:fb_access_token])
@graph.debug_token(session[:fb_access_token])
rescue Koala::Facebook::AuthenticationError,
- Koala::Facebook::ClientError => e
- reset_facebook_access_token(e)
- render 'home/facebook_login'
+ Koala::Facebook::ClientError => e
+ handle_facebook_error(e)
end
def init_facebook_user
@@ -25,10 +24,13 @@ session[:fb_access_token] = user_info['access_token'] if user_info
end
- def reset_facebook_access_token(e)
- return unless e && e.fb_error_type == 'OAuthException' &&
- e.fb_error_code == 190 && e.fb_error_subcode == 463
- session[:fb_access_token] = nil
- init_facebook_graph
+ def handle_facebook_error(e)
+ if e && e.fb_error_type == 'OAuthException' && e.fb_error_code == 190 &&
+ e.fb_error_subcode == 463
+ session[:fb_access_token] = nil
+ init_facebook_graph
+ else
+ render 'home/facebook_login'
+ end
end
end
|
Fix facebook error handling from ApplicationController
|
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
@@ -3,5 +3,8 @@ # For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
-
+ def default_url_options
+ return { protocol: 'https' } if Rails.env.staging? || Rails.env.production?
+ {}
+ end
end
|
Add default protocol for urls
|
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,15 +1,5 @@-# Filters added to this controller apply to all controllers in the application.
-# Likewise, all the methods added will be available for all controllers.
-
class ApplicationController < ActionController::Base
- helper :all # include all helpers, all the time
-
- # See ActionController::RequestForgeryProtection for details
- # Uncomment the :secret if you're not using the cookie session store
- protect_from_forgery # :secret => '50e2fefbc3ab09ef4f0b09cf2c53247a'
-
- # See ActionController::Base for details
- # Uncomment this to filter the contents of submitted sensitive data parameters
- # from your application log (in this case, all fields with names like "password").
- # filter_parameter_logging :password
+ filter_parameter_logging :password
+ helper :all
+ protect_from_forgery
end
|
Remove app controller comment cruft.
|
diff --git a/app/controllers/webmentions_controller.rb b/app/controllers/webmentions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/webmentions_controller.rb
+++ b/app/controllers/webmentions_controller.rb
@@ -4,7 +4,7 @@ protect_from_forgery except: [:create]
def index
- webmentions if logged_in?
+ webmentions
end
def show
|
Remove logged_in? restriction on grabbing webmentions. Solves a problem where the RSS feed would blow up when visited by an unauthenticated user.
|
diff --git a/app/controllers/wpcc/engine_controller.rb b/app/controllers/wpcc/engine_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/wpcc/engine_controller.rb
+++ b/app/controllers/wpcc/engine_controller.rb
@@ -3,5 +3,24 @@ protect_from_forgery
layout 'wpcc/engine'
+ before_action :log_session
+ after_action :log_session
+
+ private
+
+ def log_session
+ Rails.logger.info("Session: #{session_information}")
+ end
+
+ def session_information
+ session.to_hash.slice(
+ 'salary',
+ 'salary_frequency',
+ 'contribution_preference',
+ 'employee_percent',
+ 'employer_percent',
+ 'eligible_salary'
+ )
+ end
end
end
|
Add session information to the logs
* This makes easier to investigate problems during development
but also will help us to identify problems on the tests and production
environments.
|
diff --git a/lib/wiscale.rb b/lib/wiscale.rb
index abc1234..def5678 100644
--- a/lib/wiscale.rb
+++ b/lib/wiscale.rb
@@ -1,5 +1,60 @@+require 'rubygems'
+require 'httparty'
+require 'json'
+require 'ostruct'
+
class WiScale
+ def initialize(*params)
+ @publickey = params[0][:publickey] if params.length > 0
+ @userid = params[0][:userid] if params.length > 0
+ end
+
+ def get_status()
+ ret_val = JSON.parse(HTTParty.get(api_url + '/once', :query => {:action => 'probe'}))
+ return ret_val['status']
+ end
+
+ def get_once()
+ ret_val = JSON.parse(HTTParty.get(api_url + '/once', :query => {:action => 'get'}))
+ return ret_val['body']['once']
+ end
+
+ def get_meas(*params)
+ if params.length == 1
+ #TODO pass params to api for things like limie
+ ret_val = JSON.parse(HTTParty.get(api_url + '/measure', :query => {:action => 'getmeas', :userid => userid, :publickey => publickey}))
+ else
+ ret_val = JSON.parse(HTTParty.get(api_url + '/measure', :query => {:action => 'getmeas', :userid => userid, :publickey => publickey}))
+ end
+
+
+ if ret_val['status'] == 0
+ OpenStruct.new(ret_val['body'])
+ end
+ end
+
+ #TODO this should call get_meas(:limit=>1) once first todo is done
+ def get_last_meas
+ ret_val = JSON.parse(HTTParty.get(api_url + '/measure', :query => {:action => 'getmeas', :userid => userid, :publickey => publickey, :limit => 1}))
+
+ if ret_val['status'] == 0
+ return OpenStruct.new(ret_val['body'])
+ end
+ end
+
+ def api_url
+ @api_url || @api_url = 'http://wbsapi.withings.net'
+ end
+
+ def userid
+ @userid
+ end
+
+ def publickey
+ @publickey
+ end
+
end
|
Add basic api status check and getmeas call
|
diff --git a/app/models/concerns/development/scopes.rb b/app/models/concerns/development/scopes.rb
index abc1234..def5678 100644
--- a/app/models/concerns/development/scopes.rb
+++ b/app/models/concerns/development/scopes.rb
@@ -16,6 +16,13 @@ :redevelopment, :as_of_right, :age_restricted, :hidden
scope :close_to, CloseToQuery.new(self).scope
+ # scope_accessible :close_to
+
+ scope :place_id, proc { |id| where(place_id: id) }
+ scope_accessible :place_id
+
+ scope :neighborhood_ids, proc { |ids| where(place_id: ids) }
+ scope_accessible :neighborhood_ids
end
end
|
Add place_id and neighborhood_ids as filters
|
diff --git a/app/models/newsletters/newsletter_user.rb b/app/models/newsletters/newsletter_user.rb
index abc1234..def5678 100644
--- a/app/models/newsletters/newsletter_user.rb
+++ b/app/models/newsletters/newsletter_user.rb
@@ -28,10 +28,12 @@
validates :lang,
presence: true,
+ allow_blank: false,
inclusion: %w( fr en )
validates :role,
presence: true,
+ allow_blank: false,
inclusion: %w( subscriber tester )
scope :testers, -> { where(role: 'tester') }
|
Add allow_blank: false property for lang and role attributes
|
diff --git a/app/workers/import_connection_data_job.rb b/app/workers/import_connection_data_job.rb
index abc1234..def5678 100644
--- a/app/workers/import_connection_data_job.rb
+++ b/app/workers/import_connection_data_job.rb
@@ -24,6 +24,6 @@ end
def date_fields
- %w(creation_date startDate publishedAt pushed_at created)
+ %w(creation_date startDate publishedAt pushed_at created created_at)
end
end
|
Add created at field to date field
|
diff --git a/app/helpers/socializer/application_helper.rb b/app/helpers/socializer/application_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/socializer/application_helper.rb
+++ b/app/helpers/socializer/application_helper.rb
@@ -9,7 +9,7 @@ end
def separator
- content_tag(:span, :class => 'separator') do
+ content_tag(:span, class: 'separator') do
'–'.html_safe
end
end
|
Use the new Ruby 1.9 hash syntax.
|
diff --git a/app/serializers/api/adjustment_serializer.rb b/app/serializers/api/adjustment_serializer.rb
index abc1234..def5678 100644
--- a/app/serializers/api/adjustment_serializer.rb
+++ b/app/serializers/api/adjustment_serializer.rb
@@ -4,6 +4,15 @@ class AdjustmentSerializer < ActiveModel::Serializer
attributes :id, :amount, :label, :eligible,
:adjustable_type, :adjustable_id,
- :originator_type, :originator_id
+ :originator_type, :originator_id,
+ :tax_category_id
+
+ def tax_category_id
+ if object.originator_type == "Spree::TaxRate"
+ object.originator.tax_category_id
+ else
+ object.tax_category_id
+ end
+ end
end
end
|
Add the tax_category_id for each adjustement
- This tax_category_id could be null
- Special case if the originator is a Spree::TaxRate: then use the tax_category_id of the originator
Co-Authored-By: Matt-Yorkley <52dd53e39aabc3ad9893bf4bdc49ac9095b2e246@users.noreply.github.com>
|
diff --git a/lib/consistency_fail/engine.rb b/lib/consistency_fail/engine.rb
index abc1234..def5678 100644
--- a/lib/consistency_fail/engine.rb
+++ b/lib/consistency_fail/engine.rb
@@ -5,7 +5,9 @@ MODEL_DIRECTORY_REGEXP = /models/
def preload_all_models
- model_dirs = Rails.configuration.load_paths.select{|lp| MODEL_DIRECTORY_REGEXP =~ lp}
+ model_dirs = $LOAD_PATH.select do |lp|
+ MODEL_DIRECTORY_REGEXP =~ lp
+ end
model_dirs.each do |d|
Dir.glob(File.join(d, "**", "*.rb")).each do |model_filename|
require_dependency model_filename
|
Use wider load path searching to accomodate older Rails versions
|
diff --git a/lib/finitio/type/proxy_type.rb b/lib/finitio/type/proxy_type.rb
index abc1234..def5678 100644
--- a/lib/finitio/type/proxy_type.rb
+++ b/lib/finitio/type/proxy_type.rb
@@ -25,7 +25,7 @@ :to_s
].each do |meth|
define_method(meth) do |*args, &bl|
- raise Error, "Proxy not resolved" unless @target
+ raise Error, "Proxy `#{target_name}` not resolved" unless @target
@target.send(meth, *args, &bl)
end
end
|
Improve "Proxy not resolved" error message (add type name).
This commit adds the type name of this frequent error message,
to help debugging what's wrong.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.