diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/lib/extensions/arel_groups.rb b/lib/extensions/arel_groups.rb
index abc1234..def5678 100644
--- a/lib/extensions/arel_groups.rb
+++ b/lib/extensions/arel_groups.rb
@@ -0,0 +1,14 @@+# this is from https://github.com/rails/arel/pull/435
+# this allows sorting and where clauses to work with virtual_attribute columns
+if defined?(Arel::Nodes::Grouping)
+ module Arel
+ module Nodes
+ class Grouping
+ include Arel::Expressions
+ include Arel::AliasPredication
+ include Arel::OrderPredications
+ include Arel::Math
+ end
+ end
+ end
+end
|
Patch Arel Grouping to provide more functionality
This allows arel attributes (that are groups) to be used
in where clauses and sort clauses
|
diff --git a/committee.gemspec b/committee.gemspec
index abc1234..def5678 100644
--- a/committee.gemspec
+++ b/committee.gemspec
@@ -4,8 +4,8 @@
s.summary = "A collection of Rack middleware to support JSON Schema."
- s.authors = ["Brandur", "geemus (Wesley Beary)"]
- s.email = ["brandur@mutelight.org", "geemus+github@gmail.com"]
+ s.authors = ["Brandur", "geemus (Wesley Beary)", "ota42y"]
+ s.email = ["brandur@mutelight.org", "geemus+github@gmail.com", "ota42y@gmail.com"]
s.homepage = "https://github.com/interagent/committee"
s.license = "MIT"
|
Add ota42y to authors in gemspec
|
diff --git a/hook.rb b/hook.rb
index abc1234..def5678 100644
--- a/hook.rb
+++ b/hook.rb
@@ -14,6 +14,9 @@ payload = JSON.parse(request.body.read)
commits = payload["commits"]
repo = payload['repository']['full_name']
+
+ # Set status to 'pending' before performing check
+ report_status(repo, commit, 'pending', "Checking to see if there's a ticket number...")
commits.each do |commit|
if contains_ticket_number?(commit["message"])
|
Set the status to pending before running checks
|
diff --git a/lib/logstash-logger/logger.rb b/lib/logstash-logger/logger.rb
index abc1234..def5678 100644
--- a/lib/logstash-logger/logger.rb
+++ b/lib/logstash-logger/logger.rb
@@ -27,7 +27,7 @@
def format_message(severity, time, progname, message)
data = message
- if data.is_a?(String) && data[0] == '{'
+ if data.is_a?(String) && data.start_with?('{')
data = (JSON.parse(message) rescue nil) || message
end
|
Use start_with? to detect JSON
|
diff --git a/init.rb b/init.rb
index abc1234..def5678 100644
--- a/init.rb
+++ b/init.rb
@@ -5,7 +5,7 @@ #
# Release.
#
- def release
+ def index
puts "Test"
end
end
|
Switch to root level for the release task.
|
diff --git a/lib/servitude/pretty_print.rb b/lib/servitude/pretty_print.rb
index abc1234..def5678 100644
--- a/lib/servitude/pretty_print.rb
+++ b/lib/servitude/pretty_print.rb
@@ -1,4 +1,3 @@-require 'pry'
module Servitude
module PrettyPrint
|
Remove 'require' statement loading Pry
|
diff --git a/libraries/package_provider.rb b/libraries/package_provider.rb
index abc1234..def5678 100644
--- a/libraries/package_provider.rb
+++ b/libraries/package_provider.rb
@@ -0,0 +1,40 @@+#
+# Cookbook Name:: freebsd
+# Libraries:: package_provider
+#
+# Copyright 2012, ZephirWorks
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+require 'chef/provider/package/freebsd'
+
+class Chef
+ class Provider
+ class Package
+ class Freebsd
+
+ alias :original_initialize :initialize
+ def initialize(*args)
+ original_initialize(*args)
+
+ if node.platform?("freebsd") && node.platform_version.to_f < 8.2 &&
+ @new_resource.source != "ports"
+ Chef::Log.info "Packages for FreeBSD < 8.2 are gone, forcing #{@new_resource.name} to install from ports (was: #{@new_resource.source.inspect})"
+ @new_resource.source("ports")
+ end
+ end
+ end
+ end
+ end
+end
|
Fix older versions of FreeBSD to build packages from ports.
Signed-off-by: jtimberman <d6955d9721560531274cb8f50ff595a9bd39d66f@opscode.com>
|
diff --git a/omniauth.gemspec b/omniauth.gemspec
index abc1234..def5678 100644
--- a/omniauth.gemspec
+++ b/omniauth.gemspec
@@ -17,7 +17,7 @@ spec.licenses = ['MIT']
spec.name = 'omniauth'
spec.require_paths = ['lib']
- spec.required_rubygems_version = Gem::Requirement.new('>= 1.3.6')
+ spec.required_rubygems_version = '>= 1.3.6'
spec.summary = spec.description
spec.test_files = Dir.glob("spec/**/*")
spec.version = OmniAuth::VERSION
|
Use of custom objects is not necessary here
|
diff --git a/Casks/live-interior-3d-pro.rb b/Casks/live-interior-3d-pro.rb
index abc1234..def5678 100644
--- a/Casks/live-interior-3d-pro.rb
+++ b/Casks/live-interior-3d-pro.rb
@@ -2,6 +2,7 @@ version :latest
sha256 :no_check
+ # amazonaws.com/belightsoft was verified as official when first introduced to the cask
url 'https://s3.amazonaws.com/belightsoft/LiveInterior3DPro.dmg'
name 'Live Interior 3D Pro'
homepage 'https://www.belightsoft.com/products/liveinterior/proversion.php'
|
Fix `url` stanza comment for Live Interior 3D Pro.
|
diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/registrations_controller.rb
+++ b/app/controllers/registrations_controller.rb
@@ -1,21 +1,24 @@ # app/controllers/registrations_controller.rb
class RegistrationsController < Devise::RegistrationsController
- private
- def sign_up_params
- params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation, :cpf, :provider, :uid)
- end
- def account_update_params
- params.require(:user).permit(:first_name, :last_name, :nickname,:cpf,:email, :password, :password_confirmation, :current_password,:avatar,:cover_photo,:job_title,:bio,:rg, :consignor_organ, :company, :phone, :celphone, :schooling, :birth_date, :gender, :marital_status, :place_of_birth, :father, :mother, :address, :neighborhood, :uf, :zip_code, :special_needs, :complement,:need_certificate,:digital_certificate,:printed_certificate)
- end
protected
def update_resource(resource, params)
resource.update_without_password(params)
end
- protected
def after_update_path_for(resource)
user_path(resource)
end
+
+ private
+
+ def sign_up_params
+ params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation, :cpf, :provider, :uid)
+ end
+
+ def account_update_params
+ params.require(:user).permit(:first_name, :last_name, :nickname,:cpf,:email, :password, :password_confirmation, :current_password,:avatar,:cover_photo,:job_title,:bio,:rg, :consignor_organ, :company, :phone, :celphone, :schooling, :birth_date, :gender, :marital_status, :place_of_birth, :father, :mother, :address, :neighborhood, :uf, :zip_code, :special_needs, :complement,:need_certificate,:digital_certificate,:printed_certificate)
+ end
+
end
|
Improve RegistrationsController code organizartion and remove redundancy
|
diff --git a/LunchOverflow/spec/models/user_spec.rb b/LunchOverflow/spec/models/user_spec.rb
index abc1234..def5678 100644
--- a/LunchOverflow/spec/models/user_spec.rb
+++ b/LunchOverflow/spec/models/user_spec.rb
@@ -7,4 +7,11 @@ it { should have_db_column(:email).of_type(:string) }
it { should have_db_column(:password_digest).of_type(:string) }
end
+
+ describe "Validation tests" do
+ let(:blanks) { [nil, ''] }
+ it { should have_secure_password }
+ it { should have_valid(:user_name).when("Brian") }
+ it { should_not have_valid(:user_name).when(*blanks) }
+ end
end
|
Add validation tests for User
|
diff --git a/console_helper.rb b/console_helper.rb
index abc1234..def5678 100644
--- a/console_helper.rb
+++ b/console_helper.rb
@@ -16,7 +16,7 @@ require 'bundler/setup'
Bundler.require
- $pixiv = Pixiv.new(id, password) do |agent|
+ $pixiv = Pixiv.client(id, password) do |agent|
agent.user_agent_alias = 'Mac Safari'
agent.set_proxy(*proxy) if proxy
end
|
Use Pixiv.client instead of Pixiv.new
|
diff --git a/utils/hyperloglog/hll-err.rb b/utils/hyperloglog/hll-err.rb
index abc1234..def5678 100644
--- a/utils/hyperloglog/hll-err.rb
+++ b/utils/hyperloglog/hll-err.rb
@@ -18,7 +18,7 @@ elements << ele
i += 1
}
- r.pfadd('hll',*elements)
+ r.pfadd('hll',elements)
}
approx = r.pfcount('hll')
abs_err = (approx-i).abs
|
Fix HyperLogLog test script for new redis-rb API.
|
diff --git a/test/integration/lib/interactor/snapshooter.rb b/test/integration/lib/interactor/snapshooter.rb
index abc1234..def5678 100644
--- a/test/integration/lib/interactor/snapshooter.rb
+++ b/test/integration/lib/interactor/snapshooter.rb
@@ -8,9 +8,7 @@ include Shared
def create_screenshot
- file=Tempfile.new('screenshot').path
- file="#{file}.jpg"
-
+ file = tmp_file.path
# Note: we are using jpg because imagemagick png can last as much as 12s
# when converting images. Jpg is 1s. Increased quality be less lossy.
run("import -window root -quality 99% #{file}")
@@ -36,6 +34,11 @@ FileUtils.cp(img, target_path)
logger.info("Copied screenshot to #{target_path}")
end
+
+ def tmp_file
+ timestamp = Time.now.strftime('%Y%m%d-%H%M%S')
+ Tempfile.new(["screenshot-#{timestamp}",'.jpg'])
+ end
end
end
end
|
Move Snapshooter temp file logic to a helper method
|
diff --git a/oembed.gemspec b/oembed.gemspec
index abc1234..def5678 100644
--- a/oembed.gemspec
+++ b/oembed.gemspec
@@ -15,7 +15,7 @@ gem.require_paths = ["lib"]
gem.version = Oembed::VERSION
- gem.add_development_dependency 'rspec', '~> 2.11.0'
- gem.add_development_dependency 'simplecov', '~> 0.6.4'
- gem.add_development_dependency 'fakeweb', '~> 1.3.0'
+ gem.add_development_dependency 'rspec'
+ gem.add_development_dependency 'simplecov'
+ gem.add_development_dependency 'fakeweb'
end
|
Upgrade to the latest development gems
|
diff --git a/week_4/good_guess/my_solution.rb b/week_4/good_guess/my_solution.rb
index abc1234..def5678 100644
--- a/week_4/good_guess/my_solution.rb
+++ b/week_4/good_guess/my_solution.rb
@@ -1,5 +1,11 @@ # Good Guess
-
+def good_guess?(integer)
+ if integer == 42
+ return true
+ else
+ return false
+ end
+end
# I worked on this challenge [by myself, with: ].
|
Create method that takes an integer
|
diff --git a/noir.gemspec b/noir.gemspec
index abc1234..def5678 100644
--- a/noir.gemspec
+++ b/noir.gemspec
@@ -20,7 +20,7 @@
spec.required_ruby_version = '>= 1.9.2'
- spec.add_development_dependency 'bundler', '~> 1.9'
+ spec.add_development_dependency 'bundler', '~> 1.7'
spec.add_development_dependency 'rake', '10.4.2'
spec.add_development_dependency 'rspec', '3.2.0'
spec.add_development_dependency 'pry', '0.10.1'
|
Downgrade bundler version for compatible to 1.9.x
|
diff --git a/yell_adapters/ses_adapter.rb b/yell_adapters/ses_adapter.rb
index abc1234..def5678 100644
--- a/yell_adapters/ses_adapter.rb
+++ b/yell_adapters/ses_adapter.rb
@@ -6,7 +6,7 @@ include Yell::Helpers::Base
include Yell::Helpers::Formatter
- attr_accessor :ses, :body_text, :email_config
+ attr_accessor :ses, :body_text, :email_config, :errors
setup do |options|
self.formatter = options[:format]
@@ -16,20 +16,33 @@ )
self.email_config = options[:email_config]
self.body_text = ''
+ self.errors = false
end
write do |event|
self.body_text += formatter.call(event)
+ self.errors = true if event.level >= 3
end
close do
+ subject = format_subject(email_config['subject'])
ses.send_email(
- subject: 'Test email',
+ subject: subject,
from: email_config['from_address'],
to: email_config['to_addresses'],
body_text: body_text
)
end
+
+ private
+
+ def errors?
+ errors
+ end
+
+ def format_subject(base_subject)
+ errors? ? "Error: #{base_subject}" : "Sucess: #{base_subject}"
+ end
end
Yell::Adapters.register :ses_adapter, SesAdapter
|
Define custom subject on SesAdapter
|
diff --git a/test/helper.rb b/test/helper.rb
index abc1234..def5678 100644
--- a/test/helper.rb
+++ b/test/helper.rb
@@ -1,30 +1,31 @@-require 'simplecov'
-
-module SimpleCov::Configuration
- def clean_filters
- @filters = []
- end
-end
-
-SimpleCov.configure do
- clean_filters
- load_adapter 'test_frameworks'
-end
-
-ENV["COVERAGE"] && SimpleCov.start do
- add_filter "/.rvm/"
-end
+#
+#require 'simplecov'
+#
+#module SimpleCov::Configuration
+# def clean_filters
+# @filters = []
+# end
+#end
+#
+#SimpleCov.configure do
+# clean_filters
+# load_adapter 'test_frameworks'
+#end
+#
+#ENV["COVERAGE"] && SimpleCov.start do
+# add_filter "/.rvm/"
+#end
require 'rubygems'
-require 'bundler'
-begin
- Bundler.setup(:default, :development)
-rescue Bundler::BundlerError => e
- $stderr.puts e.message
- $stderr.puts "Run `bundle install` to install missing gems"
- exit e.status_code
-end
+#require 'bundler'
+#begin
+# Bundler.setup(:default, :development)
+#rescue Bundler::BundlerError => e
+# $stderr.puts e.message
+# $stderr.puts "Run `bundle install` to install missing gems"
+# exit e.status_code
+#end
require 'test/unit'
-require 'shoulda'
+#require 'shoulda'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
Comment out many lines to simplify dependency
|
diff --git a/test/helper.rb b/test/helper.rb
index abc1234..def5678 100644
--- a/test/helper.rb
+++ b/test/helper.rb
@@ -7,6 +7,14 @@ $stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
+
+if ENV["COVERAGE"]
+ require 'simplecov'
+ SimpleCov.start do
+ add_filter "/test/"
+ end
+end
+
require 'test/unit'
require 'shoulda'
|
Include simplecov for future testing
|
diff --git a/lib/g5_authenticatable_api/grape_helpers.rb b/lib/g5_authenticatable_api/grape_helpers.rb
index abc1234..def5678 100644
--- a/lib/g5_authenticatable_api/grape_helpers.rb
+++ b/lib/g5_authenticatable_api/grape_helpers.rb
@@ -1,7 +1,22 @@ module G5AuthenticatableApi
module GrapeHelpers
def authenticate_user!
- throw :error, status: 401, headers: {'WWW-Authenticate' => 'Bearer'}
+ unless access_token
+ throw :error, status: 401, headers: {'WWW-Authenticate' => 'Bearer'}
+ end
+ end
+
+ def access_token
+ @access_token ||= if env['HTTP_AUTHORIZATION']
+ parts = env['HTTP_AUTHORIZATION'].match(/Bearer (?<access_token>\S+)/)
+ parts['access_token']
+ else
+ Rack::Request.new(env).params['access_token']
+ end
+ end
+
+ def g5_auth_client
+ G5AuthenticationClient::Client.new(access_token: access_token)
end
end
end
|
Implement check for presence of access token
|
diff --git a/lib/paginate_alphabetically/view_helpers.rb b/lib/paginate_alphabetically/view_helpers.rb
index abc1234..def5678 100644
--- a/lib/paginate_alphabetically/view_helpers.rb
+++ b/lib/paginate_alphabetically/view_helpers.rb
@@ -28,7 +28,7 @@ end
def current_letter(available_letters)
- params[:letter].upcase || available_letters.first
+ params[:letter] || available_letters.first
end
def paginated_letter(available_letters, letter)
|
Remove defensive 'upcase' that errored on nil
A lowercase letter shouldn't have been generated, it would
only ever have been typed in, so rather than a verbose fix,
let's not worry about it.
|
diff --git a/lib/rack-cas/session_store/active_record.rb b/lib/rack-cas/session_store/active_record.rb
index abc1234..def5678 100644
--- a/lib/rack-cas/session_store/active_record.rb
+++ b/lib/rack-cas/session_store/active_record.rb
@@ -33,7 +33,7 @@ end
def destroy_session(env, sid, options)
- session = Session.where(session_id: sid).delete
+ session = Session.where(session_id: sid).delete_all
options[:drop] ? nil : generate_sid
end
@@ -46,4 +46,4 @@ Marshal.load(::Base64.decode64(data)) if data
end
end
-end+end
|
Fix bug in deleting active record sessions
|
diff --git a/refinerycms-acts-as-indexed.gemspec b/refinerycms-acts-as-indexed.gemspec
index abc1234..def5678 100644
--- a/refinerycms-acts-as-indexed.gemspec
+++ b/refinerycms-acts-as-indexed.gemspec
@@ -13,7 +13,7 @@
s.files = `git ls-files -- app/* lib/*`.split("\n")
- s.add_dependency 'refinerycms-core', '~> 3.0.0'
+ s.add_dependency 'refinerycms-core', ['>= 3.0.0', '< 4.0']
s.add_dependency 'acts_as_indexed', '~> 0.8.0'
s.add_dependency 'decorators', '~> 2.0.0'
end
|
Allow refinerycms-core version from >= 3.0.0 to < 4.0
|
diff --git a/Casks/handbrakecli-nightly.rb b/Casks/handbrakecli-nightly.rb
index abc1234..def5678 100644
--- a/Casks/handbrakecli-nightly.rb
+++ b/Casks/handbrakecli-nightly.rb
@@ -1,6 +1,6 @@ cask :v1 => 'handbrakecli-nightly' do
- version '6822svn'
- sha256 '06b3024888643041779f4ac301266739ef6a6c4a30972a951aec881fb28f50c3'
+ version '6859svn'
+ sha256 '656a716c4c75d325cdfda874db4215ba280355b672c6f19ae5dd01325955d5af'
url "http://download.handbrake.fr/nightly/HandBrake-#{version}-MacOSX.6_CLI_x86_64.dmg"
homepage 'http://handbrake.fr'
|
Update HandbrakeCLI Nightly to v6859svn
HandBrakeCLI Nightly v6859svn built 2015-02-02.
|
diff --git a/life.rb b/life.rb
index abc1234..def5678 100644
--- a/life.rb
+++ b/life.rb
@@ -1,3 +1,30 @@ #! /usr/bin/env ruby
-puts "hello world"
+require 'ncurses'
+
+class Life
+ def initialise_screen
+ Ncurses.initscr
+ end
+
+ def print_hello_world
+ Ncurses.mvaddstr(4, 19, "Hello, world!");
+ end
+
+ def refresh
+ Ncurses.refresh
+ end
+
+ def close_screen
+ Ncurses.endwin
+ end
+end
+
+if __FILE__ == $PROGRAM_NAME
+ game = Life.new
+ game.initialise_screen
+ game.print_hello_world
+ game.refresh
+ sleep(2.5)
+ game.close_screen
+end
|
Print hello world with ncurses
|
diff --git a/spec/models/agency_spec.rb b/spec/models/agency_spec.rb
index abc1234..def5678 100644
--- a/spec/models/agency_spec.rb
+++ b/spec/models/agency_spec.rb
@@ -18,7 +18,7 @@ expect(agency2).to be_invalid
end
- it 'updates slug if article title is updated' do
+ it 'updates slug if agency title is updated' do
agency = FactoryGirl.create(:agency, name: "The Title")
agency.slug = nil
agency.name = "Another Title"
@@ -26,4 +26,24 @@ agency.reload
expect(agency.slug).to eq "another-title"
end
+
+ describe "geocoded" do
+ it "generates longitude and latitude from city and state on save" do
+ agency = FactoryGirl.create(:agency)
+ expect(agency.latitude).to be_a(Float)
+ expect(agency.longitude).to be_a(Float)
+ end
+
+ it "updates geocoded coordinates when relevant fields are updated" do
+ agency = FactoryGirl.create(:agency)
+ ohio = FactoryGirl.create(:state_ohio)
+
+ expect{ agency.update_attributes({
+ city: "Worthington",
+ state_id: ohio.id,
+ street_address: "1867 Irving Road",
+ zipcode: '43085'
+ })}.to change{ agency.latitude }
+ end
+ end
end
|
Add geocoding specs for agency model
|
diff --git a/spec/models/course_spec.rb b/spec/models/course_spec.rb
index abc1234..def5678 100644
--- a/spec/models/course_spec.rb
+++ b/spec/models/course_spec.rb
@@ -1,5 +1,10 @@ require 'rails_helper'
RSpec.describe Course, :type => :model do
- pending "add some examples to (or delete) #{__FILE__}"
+ it "has a valid factory" do
+ factory = FactoryGirl.create(:course)
+ expect(factory).to be_valid, lambda { factory.errors.full_messages.join("\n") }
+ end
+
+ it "allows no null values"
end
|
Add course model test (for factory)
|
diff --git a/spec/models/invite_spec.rb b/spec/models/invite_spec.rb
index abc1234..def5678 100644
--- a/spec/models/invite_spec.rb
+++ b/spec/models/invite_spec.rb
@@ -6,4 +6,8 @@ invite.key.should_not be_empty
invite.key.should satisfy { |key| key.length > 16 }
end
+
+ it 'should require a description' do
+ invite = Invite.create(:description => '').should_not be_valid
+ end
end
|
Test that description must be provided
|
diff --git a/lib/comma/extractors.rb b/lib/comma/extractors.rb
index abc1234..def5678 100644
--- a/lib/comma/extractors.rb
+++ b/lib/comma/extractors.rb
@@ -1,17 +1,7 @@-# csv do
-# grain_type :name
-# bhc_site :state, :name => 'Site'
-# bin_grade :code
-#
-# trade_price_per_ton
-# traded_quantity
-# created_at
-# end
-
module Comma
class Extractor
-
+
def initialize(instance, &block)
@instance = instance
@block = block
@@ -27,16 +17,16 @@ class HeaderExtractor < Extractor
def method_missing(sym, *args, &block)
- @results << sym.to_s.gsub(/\s/, ' ').humanize if args.blank?
+ @results << sym.to_s.humanize if args.blank?
args.each do |arg|
case arg
when Hash
arg.each do |k, v|
- @results << v.to_s.gsub(/\s/, ' ').humanize
+ @results << v.to_s.humanize
end
when Symbol
- @results << arg.to_s.gsub(/\s/, ' ').humanize
+ @results << arg.to_s.humanize
else
raise "Unknown header symbol #{arg.inspect}"
end
|
Remove obsolete gsubbing of whitespace
|
diff --git a/spec/controllers/sessions_controller_spec.rb b/spec/controllers/sessions_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/sessions_controller_spec.rb
+++ b/spec/controllers/sessions_controller_spec.rb
@@ -1,5 +1,26 @@ require 'rails_helper'
describe SessionsController do
+ before { @request.env["devise.mapping"] = Devise.mappings[:user] }
+
it { is_expected.to be_kind_of Devise::SessionsController }
+
+ describe 'POST #create' do
+ describe 'after sign in' do
+ let(:user) { create :user }
+
+ describe 'when there is no stored location' do
+ it 'redirects to the user profile path' do
+ expect(post(:create, user: {login: user.username, password: user.password})).to redirect_to edit_user_registration_path
+ end
+ end
+
+ describe 'when there is a stored location' do
+ it 'redirects to the stored path' do
+ session["user_return_to"] = '/some-path'
+ expect(post(:create, user: {login: user.username, password: user.password})).to redirect_to '/some-path'
+ end
+ end
+ end
+ end
end
|
Add tests for the SessionsController
Describe the redirections after sign in with controller specs.
|
diff --git a/spec/system/conceal_event_group_flow_spec.rb b/spec/system/conceal_event_group_flow_spec.rb
index abc1234..def5678 100644
--- a/spec/system/conceal_event_group_flow_spec.rb
+++ b/spec/system/conceal_event_group_flow_spec.rb
@@ -0,0 +1,41 @@+# frozen_string_literal: true
+
+require 'rails_helper'
+
+# Skipped pending resolution of transactional fixtures issue. The changes to the database are rolled back
+# after the redirect, so there seems to be no way to test that they are being made.
+
+RSpec.xdescribe 'conceal and unconceal an event group using the settings page', type: :system, js: true do
+ let(:admin) { users(:admin_user) }
+
+ let(:event_group) { event_groups(:ramble) }
+ let(:organization) { event_group.organization }
+
+ context 'when event start times have the same date as UTC date' do
+ scenario 'The user is a steward of the organization' do
+ login_as admin, scope: :user
+
+ visit event_group_path(event_group, force_settings: true)
+
+ expect(event_group).not_to be_concealed
+ expect(organization).not_to be_concealed
+ people = Person.where(id: Effort.select(:person_id).where(event_id: event_group.events))
+ people.each { |person| expect(person).not_to be_concealed }
+
+ click_link 'Make private'
+ accept_alert
+
+ expect(page.find('.ost-toolbar')).to have_link('Make public')
+
+ expect(event_group).to be_concealed
+ expect(organization).to be_concealed
+ people.each do |person|
+ if person.efforts.size > 1
+ expect(person).not_to be_concealed
+ else
+ expect(person).to be_concealed
+ end
+ end
+ end
+ end
+end
|
Add system test for conceal event group flow (currently skipped pending resolution of transactional fixtures issue).
|
diff --git a/phaxio.gemspec b/phaxio.gemspec
index abc1234..def5678 100644
--- a/phaxio.gemspec
+++ b/phaxio.gemspec
@@ -17,7 +17,7 @@ gem.licenses = ['MIT']
gem.required_ruby_version = '>= 2.0'
- gem.add_dependency 'faraday', '~> 0.10'
+ gem.add_dependency 'faraday', '~> 0.10', '>= 1.0.1'
gem.add_dependency 'mime-types', '~> 3.0'
gem.add_dependency 'activesupport'
end
|
Update gemspec to support faraday >= 1.0.1
Faraday was updated to 1.0.0 last year- allow newer versions to be supported.
|
diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_bearingDistanceResolution.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_bearingDistanceResolution.rb
index abc1234..def5678 100644
--- a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_bearingDistanceResolution.rb
+++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_bearingDistanceResolution.rb
@@ -0,0 +1,32 @@+# mdJson 2.0 writer - bearing distance resolution
+
+# History:
+# Stan Smith 2017-10-20 original script
+
+require 'jbuilder'
+
+module ADIWG
+ module Mdtranslator
+ module Writers
+ module MdJson
+
+ module BearingDistanceResolution
+
+ def self.build(hBearRes)
+
+ Jbuilder.new do |json|
+ json.distanceResolution hBearRes[:distanceResolution]
+ json.distanceUnitOfMeasure hBearRes[:distanceUnitOfMeasure]
+ json.bearingResolution hBearRes[:bearingResolution]
+ json.bearingUnitOfMeasure hBearRes[:bearingUnitOfMeasure]
+ json.bearingReferenceDirection hBearRes[:bearingReferenceDirection]
+ json.bearingReferenceMeridian hBearRes[:bearingReferenceMeridian]
+ end
+
+ end # build
+ end # BearingDistanceResolution
+
+ end
+ end
+ end
+end
|
Add mdJson readers for 'bearingDistanceResolution'
include minitest
|
diff --git a/spec/controllers/backend/webserver_controller_spec.rb b/spec/controllers/backend/webserver_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/backend/webserver_controller_spec.rb
+++ b/spec/controllers/backend/webserver_controller_spec.rb
@@ -0,0 +1,21 @@+require 'rails_helper'
+
+describe Backend::WebserverController do
+ before(:each) do
+ @admin = create(:admin)
+ session[:admin_id] = @admin.id
+ end
+
+ describe 'POST restart' do
+ it 'touches tmp/restart.txt' do
+ post :restart
+ expect(File.exists?('tmp/restart.txt')).to eq true
+ end
+
+ it 'redirects to /backend' do
+ post :restart
+ expect(response).to redirect_to('/backend')
+ expect(flash[:notice]).to eq 'De webserver werd opnieuw opgestart'
+ end
+ end
+end
|
Add spec for testing the webserver restart.
|
diff --git a/spec/helpers/ems_cloud_helper/textual_summary_spec.rb b/spec/helpers/ems_cloud_helper/textual_summary_spec.rb
index abc1234..def5678 100644
--- a/spec/helpers/ems_cloud_helper/textual_summary_spec.rb
+++ b/spec/helpers/ems_cloud_helper/textual_summary_spec.rb
@@ -1,25 +1,23 @@ require "spec_helper"
describe EmsCloudHelper do
- def role_allows(_)
- true
- end
+ context "#textual_instances and #textual_images" do
+ def role_allows(_)
+ true
+ end
- before do
- @ems = FactoryGirl.create(:ems_openstack, :zone => FactoryGirl.build(:zone))
- controller.stub(:restful?).and_return(true)
- controller.stub(:controller_name).and_return("ems_cloud")
- end
+ before do
+ @ems = FactoryGirl.create(:ems_openstack, :zone => FactoryGirl.build(:zone))
+ controller.stub(:restful?).and_return(true)
+ controller.stub(:controller_name).and_return("ems_cloud")
+ end
- context "textual_instances" do
it "sets restful path for instances in summary for restful controllers" do
FactoryGirl.create(:vm_openstack, :ems_id => @ems.id)
expect(textual_instances[:link]).to eq("/ems_cloud/#{@ems.id}?display=instances")
end
- end
- context "textual_images" do
it "sets restful path for images in summary for restful controllers" do
FactoryGirl.create(:template_cloud, :ems_id => @ems.id)
|
Remove extra contexts and create a common one
|
diff --git a/Casks/tortoisehg.rb b/Casks/tortoisehg.rb
index abc1234..def5678 100644
--- a/Casks/tortoisehg.rb
+++ b/Casks/tortoisehg.rb
@@ -1,8 +1,8 @@ cask 'tortoisehg' do
- version '3.2.4'
- sha256 'c529539e20f4ff2f6d181a5c7f64ad5dcd9346605011ab4c3725c7cedf6b5a8c'
+ version '3.7.2'
+ sha256 'e429dadbc8d2f0c784795ce9f8df88cdd0d66b26a139b4283f5b4524aa926108'
- url "https://bitbucket.org/tortoisehg/files/downloads/TortoiseHg-#{version}-mac-x64.zip"
+ url "https://bitbucket.org/tortoisehg/files/downloads/TortoiseHg-#{version}-mac-x64.dmg"
name 'TortoiseHg'
homepage 'http://tortoisehg.bitbucket.org/'
license :gpl
|
Update TortoiseHg to version 3.7.2
Update TortoiseHg to version 3.7.2
|
diff --git a/app/concerns/dry_runnable.rb b/app/concerns/dry_runnable.rb
index abc1234..def5678 100644
--- a/app/concerns/dry_runnable.rb
+++ b/app/concerns/dry_runnable.rb
@@ -1,10 +1,8 @@ module DryRunnable
+ extend ActiveSupport::Concern
+
def dry_run!
- readonly!
-
- class << self
- prepend Sandbox
- end
+ @dry_run = true
log = StringIO.new
@dry_run_logger = Logger.new(log)
@@ -14,6 +12,7 @@
begin
raise "#{short_type} does not support dry-run" unless can_dry_run?
+ readonly!
check
rescue => e
error "Exception during dry-run. #{e.message}: #{e.backtrace.join("\n")}"
@@ -23,28 +22,38 @@ memory: memory,
log: log.string,
)
+ ensure
+ @dry_run = false
end
def dry_run?
- is_a? Sandbox
+ !!@dry_run
end
- module Sandbox
+ included do
+ prepend Wrapper
+ end
+
+ module Wrapper
attr_accessor :results
def logger
+ return super unless dry_run?
@dry_run_logger
end
- def save
- valid?
+ def save(options = {})
+ return super unless dry_run?
+ perform_validations(options)
end
- def save!
- save or raise ActiveRecord::RecordNotSaved
+ def save!(options = {})
+ return super unless dry_run?
+ save(options) or raise_record_invalid
end
def log(message, options = {})
+ return super unless dry_run?
case options[:level] || 3
when 0..2
sev = Logger::DEBUG
@@ -58,6 +67,7 @@ end
def create_event(event)
+ return super unless dry_run?
if can_create_events?
event = build_event(event)
@dry_run_results[:events] << event.payload
|
Make DryRunnable wrap Agent instead of extending an Agent instance
This allows DryRunnable to work with other concerns that override the
behavior of create_event(), such as SortableEvents.
|
diff --git a/summarizer/paragraphizer.rb b/summarizer/paragraphizer.rb
index abc1234..def5678 100644
--- a/summarizer/paragraphizer.rb
+++ b/summarizer/paragraphizer.rb
@@ -4,17 +4,17 @@
data[:counter_points].each_with_index do |points, index|
p, c = points
- paragraph += Presenter.clean(p["String"])[0..-2] + "\n"
+ paragraph += Presenter.clean(p["String"]) + "\n"
+ end
+
+ data[:negated_points].each_with_index do |point, index|
+ paragraph += Presenter.clean(point[1]["String"]) + "\n"
end
data[:related_points].each_with_index do |points, index|
p, r = points
- paragraph += Presenter.clean(p["String"])[0..-2] + "\n"
- paragraph += Presenter.clean(r["String"])[0..-2] + "\n"
- end
-
- data[:negated_points].each_with_index do |point, index|
- paragraph += Presenter.clean(point[1]["String"]) + "\n"
+ paragraph += Presenter.clean(p["String"]) + "\n"
+ paragraph += Presenter.clean(r["String"]) + "\n"
end
data[:common_points].each_with_index do |p, index|
|
Correct order and punctuation of plain summaries
Previously punctuation was stripped as commas were inserted. Negated
points should also be listed immediately after the contrasting ones.
|
diff --git a/lib/conjur/audit-api.rb b/lib/conjur/audit-api.rb
index abc1234..def5678 100644
--- a/lib/conjur/audit-api.rb
+++ b/lib/conjur/audit-api.rb
@@ -0,0 +1,41 @@+#
+# Copyright (C) 2013 Conjur Inc
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy of
+# this software and associated documentation files (the "Software"), to deal in
+# the Software without restriction, including without limitation the rights to
+# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+# the Software, and to permit persons to whom the Software is furnished to do so,
+# subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+module Conjur
+ module Audit
+ class API < Conjur::API
+ class << self
+ def host
+ ENV['CONJUR_AUDIT_URL'] || default_host
+ end
+
+ def default_host
+ case Conjur.env
+ when 'test', 'development'
+ "http://localhost:#{Conjur.service_base_port + 300}"
+ else
+ "https://audit-#{Conjur.stack}-conjur.herokuapp.com"
+ end
+ end
+ end
+ end
+ end
+end
|
Add host methods for audit.
|
diff --git a/pugbot.gemspec b/pugbot.gemspec
index abc1234..def5678 100644
--- a/pugbot.gemspec
+++ b/pugbot.gemspec
@@ -1,6 +1,6 @@ Gem::Specification.new do |gem|
gem.name = "pugbot"
- gem.version = "0.1.1.hotfix.1"
+ gem.version = "0.1.2"
gem.authors = ["Xzanth"]
gem.description = "Pug bot as cinch plugin"
gem.summary = "Cinch plugin for organising pick up games, designed"\
|
Increment version number as hotfix version doesn't work
|
diff --git a/UICollectionViewRightAlignedLayout.podspec b/UICollectionViewRightAlignedLayout.podspec
index abc1234..def5678 100644
--- a/UICollectionViewRightAlignedLayout.podspec
+++ b/UICollectionViewRightAlignedLayout.podspec
@@ -1,4 +1,4 @@-version = "0.0.2"
+version = "0.0.3"
Pod::Spec.new do |s|
s.name = "UICollectionViewRightAlignedLayout"
|
Update podspec to version 0.0.3
|
diff --git a/app/controllers/api/v1/nightbot_controller.rb b/app/controllers/api/v1/nightbot_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/v1/nightbot_controller.rb
+++ b/app/controllers/api/v1/nightbot_controller.rb
@@ -7,8 +7,19 @@ when 'current'
track = Play.where.not(played_at: nil).first.track
render text: format('Now playing: %s - %s', track.artist, track.name)
- when 'playlist', 'request'
- render text: 'TODO'
+ when 'playlist'
+ plays = Play.where(played_at: nil)
+ render text: plays.map { |play| play.track.name }.reverse.join(', ')
+ when /request\s+(?<name>.+)/
+ name = Regexp.last_match(:name)
+ track = Track.find_by(name: name)
+
+ if track
+ track.plays.create!
+ render text: format('Track name `%s\' successful requested', name)
+ else
+ render text: format('Track name `%s\' not found', name)
+ end
else
render text: 'Usage: !songs current|playlist|request'
end
|
Add playlist and request support to Nightbot API
|
diff --git a/app/controllers/api/v1/sessions_controller.rb b/app/controllers/api/v1/sessions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/v1/sessions_controller.rb
+++ b/app/controllers/api/v1/sessions_controller.rb
@@ -1,13 +1,30 @@-class Api::V1::SessionsController < Devise::SessionsController
+class Api::V1::SessionsController < ApplicationController
respond_to :json
def create
- resource = warden.authenticate!(:scope => resource_name, :recall => :login_failed)
- resource.reset_authentication_token!
- respond_with(resource)
+ if params[:user].blank?
+ render json: {error: "missing user parameter"}, status: 422
+ return
+ end
+
+ resource = User.find_for_database_authentication(email: params[:user][:email])
+ if resource && resource.valid_password?(params[:user][:password])
+ sign_in(:user, resource)
+ resource.reset_authentication_token!
+ render json: {auth_token: resource.authentication_token, user: resource}, status: 201
+ else
+ render json: {error: "Error with your login or password"}, status: 401
+ end
end
def destroy
- render json: "success".to_json
+ resource = User.find_for_database_authentication(id: params[:id])
+ if resource
+ resource.authentication_token = nil
+ resource.save
+ render json: {success: true}, status: 204
+ else
+ render json: {error: "User not recognized."}, status: 404
+ end
end
end
|
Add custom session controller for API-based login/logout
|
diff --git a/app/decorators/configured_system_decorator.rb b/app/decorators/configured_system_decorator.rb
index abc1234..def5678 100644
--- a/app/decorators/configured_system_decorator.rb
+++ b/app/decorators/configured_system_decorator.rb
@@ -2,8 +2,4 @@ def self.fonticon
'ff ff-configured-system'
end
-
- def fileicon
- "100/#{image_name.downcase}.png"
- end
end
|
Drop the fileicon in ConfiguredSystemDecorator
|
diff --git a/backend/lib/tasks/rubocop_brakeman_rspec.rake b/backend/lib/tasks/rubocop_brakeman_rspec.rake
index abc1234..def5678 100644
--- a/backend/lib/tasks/rubocop_brakeman_rspec.rake
+++ b/backend/lib/tasks/rubocop_brakeman_rspec.rake
@@ -0,0 +1,55 @@+require 'rubocop/rake_task'
+require 'rspec/core/rake_task'
+
+namespace :test do
+ desc 'Run RuboCop'
+ RuboCop::RakeTask.new(:rubocop) do |task|
+ # Make it easier to disable cops.
+ task.options << "--display-cop-names"
+
+ # Abort on failures (fix your code first)
+ task.fail_on_error = false
+ end
+
+ desc 'Run test'
+ RSpec::Core::RakeTask.new(:rspec) do |rspec|
+ rspec.rspec_opts = "--color --format documentation"
+ end
+
+ desc 'Runs Brakeman'
+ # based on https://brakemanscanner.org/docs/rake/
+ task :brakeman, :output_files do |_task, args|
+ # To abort on failures, set to true.
+ EXIT_ON_FAIL = false
+
+ require 'brakeman'
+
+ files = args[:output_files].split(' ') if args[:output_files]
+
+ # For more options, see source here:
+ # https://github.com/presidentbeef/brakeman/blob/master/lib/brakeman.rb#L30
+ options = {
+ app_path: ".",
+ exit_on_error: EXIT_ON_FAIL,
+ exit_on_warn: EXIT_ON_FAIL,
+ output_files: files,
+ print_report: true,
+ pager: false,
+ summary_only: true
+ }
+
+ tracker = Brakeman.run options
+ failures = tracker.filtered_warnings + tracker.errors
+
+ # Based on code here:
+ # https://github.com/presidentbeef/brakeman/blob/f2376c/lib/brakeman/commandline.rb#L120
+ if EXIT_ON_FAIL && failures.any?
+ puts 'Brakeman violations found. Aborting now...'
+ exit Brakeman::Warnings_Found_Exit_Code unless tracker.filtered_warnings.empty?
+ exit Brakeman::Errors_Found_Exit_Code if tracker.errors.any?
+ end
+ end
+end
+
+Rake::Task[:test].enhance ['test:rubocop', 'test:rspec', 'test:brakeman']
+
|
Write rubocop rspec and test rakefile
|
diff --git a/imaginary-client.gemspec b/imaginary-client.gemspec
index abc1234..def5678 100644
--- a/imaginary-client.gemspec
+++ b/imaginary-client.gemspec
@@ -18,6 +18,7 @@ gem.require_paths = ["lib"]
gem.add_dependency 'httmultiparty', '>= 0.3.8'
+ gem.add_dependency 'httparty', '>= 0.10.0'
gem.add_development_dependency 'rspec'
gem.add_development_dependency 'fakeweb'
|
Make sure we're using a safe version of httparty.
|
diff --git a/week-6/guessing-game/my_solution.rb b/week-6/guessing-game/my_solution.rb
index abc1234..def5678 100644
--- a/week-6/guessing-game/my_solution.rb
+++ b/week-6/guessing-game/my_solution.rb
@@ -6,30 +6,78 @@
# Pseudocode
-# Input:
-# Output:
+# Input: integer (it is called guess)
+# Output: whether you solved the problem or not.
# Steps:
+# Takes an integer from user as an input.
+# Random should be shuffle between the ranges of 0-99 (you can tell the range of this number to user if you want)
+# Compare the integer from the available randomized number from the game.
+# If the integer is smaller than random number, then return low.
+# If the integer is larger than random number, then return high.
+# If the integer is equal to the random number, then return correct.
+# Returns true if the last guess was correct and false otherwise.
# Initial Solution
+class GuessingGame
+ def initialize(answer)
+ @guess = answer
+ @guessed = false
+ end
+ # @number_to_guess = (0..99).begin + rand((0..99).size)
+ def guess(integer)
+ if integer == @guess
+ @guessed = true
+ :correct
+ elsif integer > @guess
+ @guessed = false
+ :high
+ else
+ @guessed = false
+ :low
+ end
+ end
+
+ def solved?
+ @guessed
+ end
+end
+
+# Refactored Solution
class GuessingGame
def initialize(answer)
- @correct_answer = answer
-
+ @guess = answer
+ @guessed = false
end
+ def guess(integer)
+ if integer == @guess
+ @guessed = true
+ :correct
+ elsif integer > @guess
+ @guessed = false
+ :high
+ else
+ @guessed = false
+ :low
+ end
+ end
+
+ def solved?
+ @guessed
+ end
end
+game = GuessingGame.new(10)
+game.solved? # => false
+game.guess(5) # => :low
+game.guess(20) # => :high
+game.solved? # => false
-
-# Refactored Solution
-
-
-
-
-
+game.guess(10) # => :correct
+game.solved? # => true
# Reflection
|
Include refactored solution in guessing game
|
diff --git a/src/main/resources/model/physical_element.rb b/src/main/resources/model/physical_element.rb
index abc1234..def5678 100644
--- a/src/main/resources/model/physical_element.rb
+++ b/src/main/resources/model/physical_element.rb
@@ -1,5 +1,5 @@ class PhysicalElement
- attr_accessor :order, :orderlabel #, :type, :id, :level
+ attr_accessor :order, :orderlabel, :id #, :type, :id, :level
end
|
Add field 'id' to physical info
|
diff --git a/lib/scss_lint/engine.rb b/lib/scss_lint/engine.rb
index abc1234..def5678 100644
--- a/lib/scss_lint/engine.rb
+++ b/lib/scss_lint/engine.rb
@@ -11,7 +11,7 @@ attr_reader :contents, :filename, :lines, :tree
def initialize(scss_or_filename)
- if File.exists?(scss_or_filename)
+ if File.exist?(scss_or_filename)
@filename = scss_or_filename
@engine = Sass::Engine.for_file(scss_or_filename, ENGINE_OPTIONS)
@contents = File.open(scss_or_filename, 'r').read
@@ -26,7 +26,7 @@ if error.is_a?(Encoding::UndefinedConversionError) ||
error.message.include?('invalid byte sequence')
raise FileEncodingError,
- "Unable to parse SCSS file: #{error.to_s}",
+ "Unable to parse SCSS file: #{error}",
error.backtrace
else
raise
|
Fix Rubocop lints in Engine class
Change-Id: Ib6135d18727a078277810f78ecfc516085e1362d
Reviewed-on: http://gerrit.causes.com/36708
Tested-by: jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@causes.com>
Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com>
|
diff --git a/lib/tic_tac_toe/game.rb b/lib/tic_tac_toe/game.rb
index abc1234..def5678 100644
--- a/lib/tic_tac_toe/game.rb
+++ b/lib/tic_tac_toe/game.rb
@@ -17,6 +17,8 @@ def get_move
got_input = false
while not got_input
+ @console.print "Enter your move [0-8]: "
+ @console.oflush
str = @console.gets
begin
move = Integer(str)
|
Add a move entry prompt
|
diff --git a/bin/geocode_cita.rb b/bin/geocode_cita.rb
index abc1234..def5678 100644
--- a/bin/geocode_cita.rb
+++ b/bin/geocode_cita.rb
@@ -0,0 +1,25 @@+#!/usr/bin/env ruby
+
+require 'csv'
+require 'geocoder'
+require 'json'
+
+locations = []
+
+# "REGION","DELIVERY BUREAU","PRIMARY CONTACT","POSTAL ADDRESS","Phone number"
+CSV.foreach('cita.csv', headers: true, return_headers: false) do |row|
+ address = row.fields[3].gsub(/\n/, ', ').strip
+ phone = row.fields.last.strip
+ lat, lng = Geocoder.coordinates(address)
+
+ locations << {
+ title: 'Citizens Advice',
+ address: address,
+ phone: phone,
+ lat: lat,
+ lng: lng
+ }
+ #sleep(1)
+end
+
+puts JSON.pretty_generate(locations)
|
Add script to process CitA csv
|
diff --git a/app/controllers/admin/events_controller.rb b/app/controllers/admin/events_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/admin/events_controller.rb
+++ b/app/controllers/admin/events_controller.rb
@@ -1,15 +1,13 @@ class Admin::EventsController < Admin::BaseController
before_filter :authenticate_user!
- skip_authorization_check # XXX because I'm using the BaseController for auth
+ load_and_authorize_resource
def index
- @events = Event.all
@num_competitors = Registrant.where({:competitor => true}).count
@num_non_competitors = Registrant.where({:competitor => false}).count
@num_registrants = @num_competitors + @num_non_competitors
end
def show
- @event = Event.find(params[:id])
end
end
|
Fix authorization check on the /admin/events page
|
diff --git a/app/serializers/invitation_serializer.rb b/app/serializers/invitation_serializer.rb
index abc1234..def5678 100644
--- a/app/serializers/invitation_serializer.rb
+++ b/app/serializers/invitation_serializer.rb
@@ -7,6 +7,6 @@ has_one :inviter, serializer: UserSerializer, root: :users
def url
- invitation_url(token)
+ invitation_url(token, default_url_options)
end
end
|
Fix failing confirmation on invite to poll
|
diff --git a/app/services/firebase_cloud_messaging.rb b/app/services/firebase_cloud_messaging.rb
index abc1234..def5678 100644
--- a/app/services/firebase_cloud_messaging.rb
+++ b/app/services/firebase_cloud_messaging.rb
@@ -17,16 +17,9 @@ NotificationsJob.perform_later(to.map{|u| u.id}, {
title: report.author.name,
body: message
- },{ avatar: report.author.avatar.url,
- report: {
- id: report.id,
- geo_latitude: report.geo_latitude,
- geo_longitude: report.geo_longitude,
- title: report.title,
- description: report.description,
- location_name: report.location_name,
- picture_url: report.picture_url
- }
+ },{
+ avatar: report.author.avatar.url,
+ report_id: report.id
})
end
|
Remove whole report info from NotificationData and add report_id.
|
diff --git a/spec/examples/hotel_booking_spec.rb b/spec/examples/hotel_booking_spec.rb
index abc1234..def5678 100644
--- a/spec/examples/hotel_booking_spec.rb
+++ b/spec/examples/hotel_booking_spec.rb
@@ -0,0 +1,95 @@+require 'spec_helper'
+require 'active_support/time'
+
+describe 'Hotel Booking Example' do
+
+ module Request
+ def self.create(params, params_module)
+ value = self.create_value(params || {}, params_module)
+
+ if value.values.all?(&:success?)
+ Success(value)
+ else
+ Failure(value)
+ end
+ end
+
+ private
+ def self.create_value(params, params_module)
+ properties = params_module.methods - Module.methods
+ request = Struct.new(*properties)
+ properties.reduce(request.new) do |container, property|
+ container[property] = params_module.send(property, params)
+ container
+ end
+ end
+ end
+
+ module HotelBookingRequestParams
+ extend self
+
+ def hotel_code(params)
+ value = params['hotel_code']
+ case
+ when value.nil?
+ Failure('hotel_code must not be empty')
+ when not(value =~ /^[A-Z]{3}[A-Z0-9]{4}$/)
+ Failure('hotel_code must be of pattern XXX0001')
+ else
+ Success(value)
+ end
+ end
+
+ def nights(params)
+ value = params.fetch('nights', 0).to_i
+ if value <= 0
+ Failure("nights must be a number greater than 0 (got '#{params['nights']}')")
+ else
+ Success(value)
+ end
+ end
+
+ def room_type(params)
+ case value = params['room_type']
+ when nil
+ Failure('room_type must not be empty')
+ else
+ Success(value)
+ end
+ end
+ end
+
+ class Struct
+ def to_hash
+ Hash[*members.zip(values).flatten]
+ end
+
+ def unwrap
+ self.class.new(*values.map(&:fetch))
+ end
+ end
+
+ it 'builds a valid request' do
+ params = {'hotel_code' => 'STO0001',
+ 'check_in' => '2012-06-15',
+ 'nights' => '3',
+ 'room_type' => 'DR',
+ 'guest1' => 'Max Payne',
+ 'guest2' => 'Jenny Payne'}
+ request = Request.create(params, HotelBookingRequestParams)
+ request.should be_a Success
+ value = request.fetch.unwrap
+ value.hotel_code.should eq "STO0001"
+ value.nights.should eq 3
+ end
+
+ it 'builds a failure request with no params' do
+ request = Request.create(nil, HotelBookingRequestParams)
+ request.should be_a Failure
+ value = request.fetch
+ value.hotel_code.should be_a Failure
+ value.nights.should be_a Failure
+ value.room_type.should be_a Failure
+ end
+
+end
|
Add example for creating requests
|
diff --git a/spec/unit/init_service_suse_spec.rb b/spec/unit/init_service_suse_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/init_service_suse_spec.rb
+++ b/spec/unit/init_service_suse_spec.rb
@@ -2,7 +2,7 @@
describe 'chef-client::init_service' do
- os = { platform: 'suse', version: '11.03', conf_dir: 'sysconfig' }
+ os = { platform: 'suse', version: '11.3', conf_dir: 'sysconfig' }
context os[:platform] do
|
Update suse version to match Fauxhai
|
diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/messages_controller.rb
+++ b/app/controllers/messages_controller.rb
@@ -1,7 +1,8 @@ class MessagesController < ApplicationController
def create
@thread = MessageThread.find(params[:thread_id])
- @message = @thread.messages.build(params[:message].merge(created_by: current_user))
+ @message = @thread.messages.build(params[:message])
+ @message.created_by = current_user
if @message.save
@thread.add_subscriber(current_user) unless current_user.ever_subscribed_to_thread?(@thread)
|
Rework message creation since created_by isn't mass assignable.
|
diff --git a/pronto.gemspec b/pronto.gemspec
index abc1234..def5678 100644
--- a/pronto.gemspec
+++ b/pronto.gemspec
@@ -24,5 +24,5 @@ s.add_dependency 'rugged', '~> 0.19.0'
s.add_dependency 'thor', '~> 0.18.0'
s.add_development_dependency 'rake', '~> 10.1.0'
- s.add_development_dependency 'rspec', '~> 2.13.0'
+ s.add_development_dependency 'rspec', '~> 2.14.0'
end
|
Update rspec version from 2.13.0 to 2.14.0
|
diff --git a/app.rb b/app.rb
index abc1234..def5678 100644
--- a/app.rb
+++ b/app.rb
@@ -42,7 +42,8 @@ def check_backend
NullWorker.perform_async(rand(30))
:ok
- rescue
+ rescue => e
+ puts e
:fail
end
|
Print error message for NullWorker
|
diff --git a/app/models/container_image_registry.rb b/app/models/container_image_registry.rb
index abc1234..def5678 100644
--- a/app/models/container_image_registry.rb
+++ b/app/models/container_image_registry.rb
@@ -1,9 +1,15 @@ class ContainerImageRegistry < ApplicationRecord
belongs_to :ext_management_system, :foreign_key => "ems_id"
+
+ # Associated with images in the registry.
has_many :container_images, :dependent => :nullify
has_many :containers, :through => :container_images
+ has_many :container_groups, :through => :container_images
+
+ # Associated with serving the registry itself - for openshift's internal
+ # image registry. These will be empty for external registries.
has_many :container_services
- has_many :container_groups, :through => :container_images
+ has_many :service_container_groups, :through => :container_services, :as => :container_groups
acts_as_miq_taggable
virtual_column :full_name, :type => :string
|
Add a :service_container_groups field to conserve the number of pods running the registry service functionality
|
diff --git a/app/models/i18n_content_translation.rb b/app/models/i18n_content_translation.rb
index abc1234..def5678 100644
--- a/app/models/i18n_content_translation.rb
+++ b/app/models/i18n_content_translation.rb
@@ -1,5 +1,5 @@ class I18nContentTranslation < ActiveRecord::Base
def self.existing_languages
- self.select(:locale).uniq.map{ |l| l.locale.to_sym }.to_a
+ self.select(:locale).distinct.map { |l| l.locale.to_sym }.to_a
end
end
|
Fix deprecation warning for `.uniq` usage
|
diff --git a/app/models/registrant_event_sign_up.rb b/app/models/registrant_event_sign_up.rb
index abc1234..def5678 100644
--- a/app/models/registrant_event_sign_up.rb
+++ b/app/models/registrant_event_sign_up.rb
@@ -3,6 +3,7 @@ #validates :event_category, :presence => true, :if => "signed_up"
validates :signed_up, :inclusion => {:in => [true, false] } # because it's a boolean
validate :category_chosen_when_signed_up
+ validate :category_in_age_range
validates :event_id, :presence => true, :uniqueness => {:scope => [:registrant_id]}
has_paper_trail :meta => { :registrant_id => :registrant_id }
@@ -14,8 +15,15 @@ def category_chosen_when_signed_up
if self.signed_up and self.event_category.nil?
errors[:base] << "Cannot sign up for #{self.event.name} without choosing a category"
- errors[:signed_up] = ""
- errors[:event_category_id] = ""
+ end
+ end
+
+ def category_in_age_range
+ unless self.event_category.nil?
+ if self.signed_up and !(self.event_category.age_range_start..self.event_category.age_range_end).include?(registrant.age)
+ errors[:base] << "You must be between #{self.event_category.age_range_start} and #{self.event_category.age_range_end}
+ years old to select #{self.event_category.name} for #{self.event.name} in #{self.event.event_class}"
+ end
end
end
|
Add validation for event age range on sign-up
|
diff --git a/lib/cenit/redis.rb b/lib/cenit/redis.rb
index abc1234..def5678 100644
--- a/lib/cenit/redis.rb
+++ b/lib/cenit/redis.rb
@@ -10,7 +10,7 @@
def client
unless instance_variable_defined?(:@redis_client)
- client = ::Redis.new
+ client = ::Redis.new(host: ENV["REDIS_HOST"], port: 6379, db: 15)
client =
begin
client.ping
|
Add support for config Redis conection
|
diff --git a/lib/excel_rails.rb b/lib/excel_rails.rb
index abc1234..def5678 100644
--- a/lib/excel_rails.rb
+++ b/lib/excel_rails.rb
@@ -18,7 +18,7 @@ def disposition(download, filename)
download = true if (filename && download == nil)
disposition = download ? "attachment;" : "inline;"
- disposition += " filename=#{filename}" if filename
+ disposition += " filename=\"#{filename}\"" if filename
headers["Content-Disposition"] = disposition
end
end
|
Add quoting to filename part of Content-Disposition header.
|
diff --git a/spec/lib/tasks/dev_seed_spec.rb b/spec/lib/tasks/dev_seed_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/tasks/dev_seed_spec.rb
+++ b/spec/lib/tasks/dev_seed_spec.rb
@@ -0,0 +1,18 @@+require 'rails_helper'
+require 'rake'
+
+describe 'rake db:dev_seed' do
+ before do
+ Rake.application.rake_require('tasks/db')
+ Rake::Task.define_task(:environment)
+ end
+
+ let :run_rake_task do
+ Rake::Task['db:dev_seed'].reenable
+ Rake.application.invoke_task('db:dev_seed')
+ end
+
+ it 'seeds the database without errors' do
+ expect { run_rake_task }.to_not raise_error
+ end
+end
|
Add spec for 'rake db:dev_seed' task
|
diff --git a/app/controllers/wireless_networks_controller.rb b/app/controllers/wireless_networks_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/wireless_networks_controller.rb
+++ b/app/controllers/wireless_networks_controller.rb
@@ -36,7 +36,7 @@ end
def all_joins
- "INNER JOIN locations ON locations.id = wireless_networks.location_id"
+ "LEFT OUTER JOIN locations ON locations.id = wireless_networks.location_id"
end
def all_includes
|
Make Wireless network location join optional
|
diff --git a/spec/support/settings_helper.rb b/spec/support/settings_helper.rb
index abc1234..def5678 100644
--- a/spec/support/settings_helper.rb
+++ b/spec/support/settings_helper.rb
@@ -2,6 +2,11 @@ settings = Config::Options.new.merge!(hash)
stub_const("Settings", settings)
allow(Vmdb::Settings).to receive(:for_resource) { settings }
+end
+
+def stub_template_settings(hash)
+ settings = Config::Options.new.merge!(hash)
+ allow(Vmdb::Settings).to receive(:template_settings) { settings }
end
def stub_local_settings(my_server)
|
Add stub_template_settings for testing access to template config
|
diff --git a/lib/vapebot/irc.rb b/lib/vapebot/irc.rb
index abc1234..def5678 100644
--- a/lib/vapebot/irc.rb
+++ b/lib/vapebot/irc.rb
@@ -3,6 +3,7 @@ def register
send_nick
send_user
+ sleep 3
send_pass
end
|
Add in delay to allow nickserv to prompt.
|
diff --git a/test/hw1_part5_test.rb b/test/hw1_part5_test.rb
index abc1234..def5678 100644
--- a/test/hw1_part5_test.rb
+++ b/test/hw1_part5_test.rb
@@ -5,9 +5,14 @@ attr_accessor_with_history :bar
end
+class Bar
+ attr_accessor_with_history :foo
+ attr_accessor_with_history :bar
+end
+
class TestAdvancedOOP < Test::Unit::TestCase
- def test_attr_accessor_with_history
+ def test_single_attr_accessor_with_history
f = Foo.new
assert_not_nil f
@@ -18,7 +23,7 @@ assert_equal [nil, 3, :wowzo, 'boo!'], f.bar_history
end
- def test_attr_accessor_with_history_different_instances
+ def test_single_attr_accessor_with_history_different_instances
f = Foo.new
f.bar = 1
f.bar = 2
@@ -28,4 +33,32 @@ assert_equal [nil, 4], f.bar_history
end
+ def test_multiple_attr_accessor_with_history
+ b = Bar.new
+ b.bar = 3
+ b.bar = :wowzo
+ b.bar = 'boo!'
+ b.foo = 4
+ b.foo = :woozy
+ b.foo = 'boom!'
+
+ assert_equal [nil, 3, :wowzo, 'boo!'], b.bar_history
+ assert_equal [nil, 4, :woozy, 'boom!'], b.foo_history
+ end
+
+ def test_multiple_attr_accessor_with_history_different_instances
+ b = Bar.new
+ b.bar = 1
+ b.bar = 2
+ b.foo = 3
+ b.foo = 4
+
+ b = Bar.new
+ b.bar = 4
+ b.foo = 5
+
+ assert_equal [nil, 4], b.bar_history
+ assert_equal [nil, 5], b.foo_history
+ end
+
end
|
Add multiple attr_accessor_with_history test to part5
|
diff --git a/lib/dirigible/request.rb b/lib/dirigible/request.rb
index abc1234..def5678 100644
--- a/lib/dirigible/request.rb
+++ b/lib/dirigible/request.rb
@@ -38,7 +38,7 @@
Utils.handle_api_error(response) unless (200..399).include?(response.status)
- Utils.parse_message(response.body)
+ Utils.parse_message(response)
end
end
end
|
Send response to parse_message. Not response.body.
|
diff --git a/FCModel.podspec b/FCModel.podspec
index abc1234..def5678 100644
--- a/FCModel.podspec
+++ b/FCModel.podspec
@@ -5,7 +5,7 @@ s.homepage = 'https://github.com/marcoarment/FCModel'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'Marco Arment' => 'me@marco.org' }
- s.source = { :git => 'https://github.com/marcoarment/FCModel.git', :tag => '0.1.0' }
+ s.source = { :git => 'https://github.com/marcoarment/FCModel.git', :tag => s.version.to_s }
s.source_files = 'FCModel/*.{h,m}'
s.library = 'sqlite3'
s.requires_arc = true
|
Use spec version as the source tag.
|
diff --git a/lib/flatware/fireable.rb b/lib/flatware/fireable.rb
index abc1234..def5678 100644
--- a/lib/flatware/fireable.rb
+++ b/lib/flatware/fireable.rb
@@ -11,8 +11,6 @@ while message = monitor.recv
if message == :EVENT_ACCEPTED
break
- else
- puts message
end
end
end
|
Remove socket lifecycle puts for monitor
|
diff --git a/requiregems.rb b/requiregems.rb
index abc1234..def5678 100644
--- a/requiregems.rb
+++ b/requiregems.rb
@@ -15,9 +15,9 @@ require 'RestClient'
rescue LoadError
puts "You're missing the gem `rest-client`. Would you like to install this now? (y/n)"
- input = gets
+ input = gets.chomp
if input == 'y'
- eval `gem install rest-client`
+ `gem install rest-client`
puts 'Gem installed! Continuing..'
else
puts 'To continue, install the rest-client gem'
@@ -31,9 +31,9 @@ require 'Nokogiri'
rescue LoadError
puts "You're missing the gem `nokogiri`. Would you like to install this now? (y/n)"
- input = gets
+ input = gets.chomp
if input == 'y'
- eval `gem install nokogiri`
+ `gem install nokogiri`
puts 'Gem installed! Continuing..'
else
puts 'To continue, install the nokogiri gem'
|
Fix require gems not working (maybe?)
|
diff --git a/lib/ripl/color_result.rb b/lib/ripl/color_result.rb
index abc1234..def5678 100644
--- a/lib/ripl/color_result.rb
+++ b/lib/ripl/color_result.rb
@@ -13,6 +13,7 @@ end
def format_result(result)
+ return super if !config[:color_result_engine]
format_prompt(result) + inspect_result(result)
end
|
Allow coloring to be disabled with false or nil
|
diff --git a/lib/spontaneous/facet.rb b/lib/spontaneous/facet.rb
index abc1234..def5678 100644
--- a/lib/spontaneous/facet.rb
+++ b/lib/spontaneous/facet.rb
@@ -30,7 +30,8 @@
def load_indexes!
paths.expanded(:config).each do |config_path|
- load(config_path / "indexes.rb" )
+ index_file = config_path / "indexes.rb"
+ load(index_file) if File.exists?(index_file)
end
end
|
Make loading of indexes.rb dependent on its existance
|
diff --git a/lib/wp_op/post_writer.rb b/lib/wp_op/post_writer.rb
index abc1234..def5678 100644
--- a/lib/wp_op/post_writer.rb
+++ b/lib/wp_op/post_writer.rb
@@ -25,7 +25,22 @@ end
def create_file_contents_for post
+ content = create_meta post
+ content += post.content
+ content
+ end
+ def create_meta post
+ m = "---\n"
+ m += "layout: post\n"
+ m += "title: \"#{post.title}\"\n"
+ m += "date: #{post.pub_date}\n"
+ m += "published: #{post.published}\n"
+ m += "footer: true\n"
+ m += "comments: false\n"
+ m += "categories:\n"
+ m += "---\n\n"
+ m
end
def verify_directory
|
Create actual post content for file
|
diff --git a/riddle.gemspec b/riddle.gemspec
index abc1234..def5678 100644
--- a/riddle.gemspec
+++ b/riddle.gemspec
@@ -14,9 +14,7 @@
s.rubyforge_project = 'riddle'
- s.files = `git ls-files`.split("\n")
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
s.require_paths = ['lib']
s.add_development_dependency 'rake', '>= 0.9.2'
|
Stop packaging test files with the gem
It drastically reduces the size of the gem, from 1.9M to 32K. The
default for new gems (created by bundler) is not to include test files.
See bundler/bundler#3207
|
diff --git a/rulers.gemspec b/rulers.gemspec
index abc1234..def5678 100644
--- a/rulers.gemspec
+++ b/rulers.gemspec
@@ -8,12 +8,14 @@ gem.version = Rulers::VERSION
gem.authors = ["Baozi Wu"]
gem.email = ["baojjeu@gmail.com"]
- gem.description = %q{TODO: Write a gem description}
- gem.summary = %q{TODO: Write a gem summary}
+ gem.description = %q{A Rack-based Web Framework}
+ gem.summary = %q{A Rack-based Web Framework}
gem.homepage = ""
gem.files = `git ls-files`.split($/)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ["lib"]
+
+ gem.add_runtime_dependency "rack"
end
|
Add descriptions and runtime dependency
|
diff --git a/source/util.rb b/source/util.rb
index abc1234..def5678 100644
--- a/source/util.rb
+++ b/source/util.rb
@@ -1,7 +1,11 @@ def to_number(ns)
- if ns.include? '.'
- return ns.to_f
+ if ns.class == String
+ if ns.include? '.'
+ return ns.to_f
+ else
+ return ns.to_i
+ end
else
- return ns.to_i
+ return ns
end
end
|
Fix to_number to work with numbers.
|
diff --git a/lib/llt/diff/alignment/difference/nrefs.rb b/lib/llt/diff/alignment/difference/nrefs.rb
index abc1234..def5678 100644
--- a/lib/llt/diff/alignment/difference/nrefs.rb
+++ b/lib/llt/diff/alignment/difference/nrefs.rb
@@ -1,5 +1,8 @@ module LLT
module Diff::Alignment::Difference
+
+ # This whole class could arguably deleted, not sure there is any need for it
+
class Nrefs
include Diff::Helpers::HashContainable
include Diff::Helpers::DiffReporter
|
Add comment about possible deprecation of Nrefs
|
diff --git a/lib/tasks/temporary/factual_migration.rake b/lib/tasks/temporary/factual_migration.rake
index abc1234..def5678 100644
--- a/lib/tasks/temporary/factual_migration.rake
+++ b/lib/tasks/temporary/factual_migration.rake
@@ -0,0 +1,25 @@+namespace :temporary do
+ desc 'Fill in city from old Factual imports'
+ task factual_re_migration: :environment do
+ factual_imports = [27, 28, 29]
+
+ factual_imports.each do |import_id|
+ raw_inputs = RawInput.where(import: import_id).where(exception: nil)
+
+ raw_inputs.each do |raw_input|
+ data = raw_input.data
+
+ locations = Location
+ .where(latitude: data['latitude'])
+ .where(longitude: data['longitude'])
+
+ locations.each do |location|
+ if data['locality'].present? && location.city.nil?
+ location.update_attribute(:city, data['locality'])
+ puts "Updated Location(#{location.id}): City: #{data['locality']} from RawInput(#{raw_input.id})"
+ end
+ end
+ end
+ end
+ end
+end
|
:elephant: Migrate cities for Factual imports
|
diff --git a/samples/elb.rb b/samples/elb.rb
index abc1234..def5678 100644
--- a/samples/elb.rb
+++ b/samples/elb.rb
@@ -13,9 +13,7 @@
puts "", "Your Load Balancers", ""
-p $elb.describe_load_balancers
-
-$elb.describe_load_balancers.describe_load_balancers_result.load_balancer_descriptions.each do |elb|
+$elb.describe_load_balancers.load_balancer_descriptions.each do |elb|
puts "Name: #{elb.load_balancer_name}"
puts "HealthCheck: #{elb.health_check.inspect}"
|
Update ELB sample to work with collapsed Result
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -35,19 +35,19 @@ def port_offset
base = case ENV["AKER_ENV"]
when /jruby/
- 108
+ 17
when /1.9/
- 207
+ 26
when /1.8/
- 306
+ 31
else
0
end
case ENV["ACTIVESUPPORT_VERSION"]
when /3.0/
- base * 6
+ base * 5
when /2.3/
- base
+ base * 7
else
base * 0
end
|
Use mutually prime port offsets to prevent overlap.
|
diff --git a/db/migrate/20150611164132_migrate_user_login.rb b/db/migrate/20150611164132_migrate_user_login.rb
index abc1234..def5678 100644
--- a/db/migrate/20150611164132_migrate_user_login.rb
+++ b/db/migrate/20150611164132_migrate_user_login.rb
@@ -20,7 +20,7 @@ validator.validate user
end
- user.update_attributes login: user.login
+ user.update_attribute :login, user.login
end
change_column :users, :login, :string, null: false
|
Set login even on deleted users
|
diff --git a/gitlab_git.gemspec b/gitlab_git.gemspec
index abc1234..def5678 100644
--- a/gitlab_git.gemspec
+++ b/gitlab_git.gemspec
@@ -11,7 +11,7 @@ s.homepage =
'https://gitlab.com/gitlab-org/gitlab_git'
- s.add_dependency('github-linguist', '~> 5.1.0')
+ s.add_dependency('github-linguist', '>= 5.1', '< 5.3')
s.add_dependency('activesupport', '>= 4.0')
s.add_dependency('rugged', '~> 0.26.0')
s.add_dependency('charlock_holmes', '~> 0.7.3')
|
Update github-linguist requirement to >= 5.1, < 5.3
Updates the requirements on [github-linguist](https://github.com/github/linguist) to permit the latest version.
- [Release notes](https://github.com/github/linguist/releases)
|
diff --git a/SDColor.podspec b/SDColor.podspec
index abc1234..def5678 100644
--- a/SDColor.podspec
+++ b/SDColor.podspec
@@ -7,6 +7,7 @@ spec.source = { :git => 'https://github.com/steam/SDColor.git', :tag => "#{spec.version}" }
spec.description = 'Use hexidecimal values to create UIColor objects.'
spec.source_files = 'SDColor/*.{h,m}'
+ spec.frameworks = 'UIKit'
spec.requires_arc = false
spec.license = { :type => 'MIT', :file => 'LICENSE' }
end
|
Add UIKit dependency to podspec
Signed-off-by: Sean Doughety <58cdf895b71f84481e06f521739b30fbd55e8539@gmail.com>
|
diff --git a/rails-sandbox-assets.gemspec b/rails-sandbox-assets.gemspec
index abc1234..def5678 100644
--- a/rails-sandbox-assets.gemspec
+++ b/rails-sandbox-assets.gemspec
@@ -15,5 +15,5 @@ gem.require_paths = ["lib"]
gem.version = SandboxAssets::VERSION
- gem.add_dependency 'rails', '~> 3.1'
+ gem.add_dependency 'rails', '>= 3.1'
end
|
Add support to Rails 4
|
diff --git a/schema.gemspec b/schema.gemspec
index abc1234..def5678 100644
--- a/schema.gemspec
+++ b/schema.gemspec
@@ -2,7 +2,7 @@ Gem::Specification.new do |s|
s.name = 'schema'
s.summary = "Primitives for schema and structure"
- s.version = '0.1.2.0'
+ s.version = '0.2.0.0'
s.description = ' '
s.authors = ['The Eventide Project']
|
Package version increased from 0.1.2.0 to 0.2.0.0
|
diff --git a/test/app_root/config/environment.rb b/test/app_root/config/environment.rb
index abc1234..def5678 100644
--- a/test/app_root/config/environment.rb
+++ b/test/app_root/config/environment.rb
@@ -1,7 +1,6 @@ require 'config/boot'
Rails::Initializer.run do |config|
- config.plugin_paths << '..'
config.plugins = %w(tags smart_field_constraints)
config.cache_classes = false
config.whiny_nils = true
|
Remove old additional plugin load paths
|
diff --git a/app/helpers/layouts_helper.rb b/app/helpers/layouts_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/layouts_helper.rb
+++ b/app/helpers/layouts_helper.rb
@@ -9,7 +9,7 @@ end
def gauges_tracking_code
- views["gauges_tracking_code"]
+ institution_views["gauges_tracking_code"]
end
def google_analytics?
|
Change old views var to institution_views with nyulibraries_templates change
|
diff --git a/app/models/helpdesk_ticket.rb b/app/models/helpdesk_ticket.rb
index abc1234..def5678 100644
--- a/app/models/helpdesk_ticket.rb
+++ b/app/models/helpdesk_ticket.rb
@@ -24,4 +24,19 @@ self.is_resolved = true
self.save!
end
+
+ # Unit for ticket
+ def unit
+ project.unit
+ end
+
+ # Student for ticket
+ def student
+ project.student
+ end
+
+ # Returns true iff ticket is associated with a task
+ def has_task?
+ !task.nil?
+ end
end
|
ENHANCE: Add convenience methods to helpdesk ticket model
|
diff --git a/test/unit/sitemap_generator_test.rb b/test/unit/sitemap_generator_test.rb
index abc1234..def5678 100644
--- a/test/unit/sitemap_generator_test.rb
+++ b/test/unit/sitemap_generator_test.rb
@@ -0,0 +1,15 @@+require "test_helper"
+require "elasticsearch/sitemap"
+
+class SitemapGeneratorTest < MiniTest::Unit::TestCase
+ def test_should_generate_sitemap
+ sitemap = SitemapGenerator.new('')
+
+ sitemap_xml = sitemap.generate_xml([ 'https://www.gov.uk/page', '/another-page', 'yet-another-page' ])
+ doc = Nokogiri::XML(sitemap_xml)
+ urls = doc.css('url > loc').map(&:inner_html)
+ assert_equal urls[0], 'https://www.gov.uk/page'
+ assert_equal urls[1], 'http://www.dev.gov.uk/another-page'
+ assert_equal urls[2], 'http://www.dev.gov.uk/yet-another-page'
+ end
+end
|
Add basic test for sitemap generation
Check to make sure both fully qualified urls and path only urls are
correctly handled when generating the sitemap.
|
diff --git a/models/scoreset.rb b/models/scoreset.rb
index abc1234..def5678 100644
--- a/models/scoreset.rb
+++ b/models/scoreset.rb
@@ -20,12 +20,12 @@ puts "found music!" if music
raise MusicMismatchError.new(song_name, music ? music.name : nil)
end
- DIFFICULTY.each do |diff, diff_num|
+ DIFFICULTY.each do |diff|
if s[:scores][diff][:achieve]
score = Score.new(
music: music,
scoreset: scoreset,
- difficulty: diff_num,
+ difficulty: DIFFICULTY.index(diff),
achieve: s[:scores][diff][:achieve],
miss: s[:scores][diff][:miss])
scoreset.add_score(score)
|
Fix bug (use DIFFICULTY as Array)
|
diff --git a/db/migrate/20100329124227_add_started_to_backup_job.rb b/db/migrate/20100329124227_add_started_to_backup_job.rb
index abc1234..def5678 100644
--- a/db/migrate/20100329124227_add_started_to_backup_job.rb
+++ b/db/migrate/20100329124227_add_started_to_backup_job.rb
@@ -0,0 +1,9 @@+class AddStartedToBackupJob < ActiveRecord::Migration
+ def self.up
+ add_column :backup_jobs, :started, :datetime
+ end
+
+ def self.down
+ remove_column :backup_jobs, :started
+ end
+end
|
Add migration to store the started timestamp. Not used yet
|
diff --git a/All_Permutations/solution.rb b/All_Permutations/solution.rb
index abc1234..def5678 100644
--- a/All_Permutations/solution.rb
+++ b/All_Permutations/solution.rb
@@ -0,0 +1,29 @@+#http://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/
+
+# Preorder
+$string_arr = %w( a b c )
+$used_chars = Array.new($string_arr.size,false)
+$depth = 0
+def backtracking(string)
+ # Stop condition
+ if $depth == $string_arr.size
+ p string
+ return
+ end
+
+ $string_arr.each_with_index do |char, index|
+ # if the char is already used move to next
+ next if $used_chars[index - 1]
+
+ string << char # Add the char to permutation
+ $used_chars[index - 1 ] = true # Make sure we know this char is already used
+ $depth += 1
+ backtracking(string)
+ string.pop
+ $used_chars[index - 1 ] = false
+ $depth -= 1
+ end
+end
+
+backtracking([])
+
|
Add first iteration on all permutation
|
diff --git a/docs/analytics_scripts/wikidata_stats.rb b/docs/analytics_scripts/wikidata_stats.rb
index abc1234..def5678 100644
--- a/docs/analytics_scripts/wikidata_stats.rb
+++ b/docs/analytics_scripts/wikidata_stats.rb
@@ -0,0 +1,17 @@+load "#{Rails.root}/lib/wikidata_summary_parser.rb"
+
+campaign = Campaign.find_by_slug 'wikidata_stats'
+
+i = 0
+
+campaign.courses.each do |course|
+ course.revisions.each do |rev|
+ i += 1
+ puts i
+ next if rev.summary
+ rev.update(summary: WikidataSummaryParser.fetch_summary(rev))
+ end
+end
+
+
+campaign.courses.each { |c| puts c.slug; WikidataSummaryParser.analyze_revisions(c.revisions.where(wiki: c.home_wiki)) }
|
Add scratch code for analyzing wikidata contribs for courses
|
diff --git a/app/helpers/gend_images_helper.rb b/app/helpers/gend_images_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/gend_images_helper.rb
+++ b/app/helpers/gend_images_helper.rb
@@ -15,7 +15,7 @@
def gend_thumb_url_for(gend_image)
url_for(
- controller: :gend_thumbs,
+ controller: '/gend_thumbs'.freeze,
action: :show,
id: gend_image.gend_thumb.id,
format: gend_image.gend_thumb.format
|
Use absolute path for controller in gend thumbs url helper
It needs this to point to the root namespace when the helper is used
from the API namespace.
|
diff --git a/puppet-{{cookiecutter.project_name}}/spec/classes/{{cookiecutter.project_name}}_db_sync_spec.rb b/puppet-{{cookiecutter.project_name}}/spec/classes/{{cookiecutter.project_name}}_db_sync_spec.rb
index abc1234..def5678 100644
--- a/puppet-{{cookiecutter.project_name}}/spec/classes/{{cookiecutter.project_name}}_db_sync_spec.rb
+++ b/puppet-{{cookiecutter.project_name}}/spec/classes/{{cookiecutter.project_name}}_db_sync_spec.rb
@@ -2,6 +2,9 @@
describe '{{cookiecutter.project_name}}::db::sync' do
shared_examples '{{cookiecutter.project_name}}-dbsync' do
+
+ it { is_expected.to contain_class('{{cookiecutter.project_name}}::deps') }
+
it { should contain_exec('{{cookiecutter.project_name}}-db-sync').with(
:command => '{{cookiecutter.project_name}}-manage db_sync ',
:path => [ '/bin', '/usr/bin', ],
|
Include deps class in unit test for sync
Change-Id: Ia8fd8c95fe1572b9132899ed76d1ca6386220900
|
diff --git a/rdl.gemspec b/rdl.gemspec
index abc1234..def5678 100644
--- a/rdl.gemspec
+++ b/rdl.gemspec
@@ -4,13 +4,20 @@
Gem::Specification.new do |s|
s.name = 'rdl'
- s.version = '1.0.0.rc1'
- s.date = '2015-12-16'
- s.summary = "Ruby type and contract system"
- s.description = s.summary
+ s.version = '1.0.0.rc2'
+ s.date = '2015-12-17'
+ s.summary = 'Ruby type and contract system'
+ s.description = <<-EOF
+RDL add support for adding contracts (pre- and postconditions) to methods.
+Preconditions are checked at run time when the method is called, and
+postconditions are checked at run time when the method returns.
+RDL also includes extensive support for type contracts, which check the types of arguments and returns
+when the method is called and when it returns, respectively.
+EOF
s.authors = ['University of Maryland, College Park']
s.email = ['rdl-users@googlegroups.com']
- s.files = Dir["lib/**/*", "types/**/*"]
+ s.files = Dir['lib/**/*', 'types/**/*']
s.homepage = 'https://github.com/plum-umd/rdl'
- s.license = "BSD-3-Clause"
+ s.license = 'BSD-3-Clause'
+ s.add_runtime_dependency 'require_all', '~> 1.3', '>= 1.3.3'
end
|
Add require_all dependency, fix description
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.