diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
---|---|
diff --git a/Latch.podspec b/Latch.podspec
index abc1234..def5678 100644
--- a/Latch.podspec
+++ b/Latch.podspec
@@ -1,6 +1,6 @@ Pod::Spec.new do |s|
s.name = "Latch"
- s.version = "1.1.0"
+ s.version = "1.2.0"
s.summary = "A simple Swift Keychain Wrapper for iOS"
s.homepage = "https://github.com/endocrimes/Latch"
s.documentation_url = "https://endocrimes.github.io/Latch"
@@ -8,6 +8,7 @@ s.author = { "Danielle Lancashire" => "[email protected]" }
s.social_media_url = "http://twitter.com/endocrimes"
s.platform = :ios, "8.0"
+ s.platform = :watchos, "2.0"
s.source = { :git => "#{s.homepage}.git", :tag => s.version }
s.source_files = "Classes", "Latch/*.{h,swift}"
s.framework = "Security"
|
Enable watchOS support in podspec and bump to 1.2.0
|
diff --git a/lib/cocoapods/resolver/lazy_specification.rb b/lib/cocoapods/resolver/lazy_specification.rb
index abc1234..def5678 100644
--- a/lib/cocoapods/resolver/lazy_specification.rb
+++ b/lib/cocoapods/resolver/lazy_specification.rb
@@ -25,7 +25,7 @@ def specification
@specification ||= source.specification(name, version)
end
- end
+ end
class External
def all_specifications
|
[LazySpecification] Fix indentation of an end
|
diff --git a/lib/puppet/provider/network_device_ssh/ce.rb b/lib/puppet/provider/network_device_ssh/ce.rb
index abc1234..def5678 100644
--- a/lib/puppet/provider/network_device_ssh/ce.rb
+++ b/lib/puppet/provider/network_device_ssh/ce.rb
@@ -1,3 +1,15 @@+# 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.
+
# encoding: utf-8
require 'puppet/provider/ce/device_ssh/device_ssh.rb'
require 'puppet/provider/ce/api/apibase.rb'
@@ -13,8 +25,6 @@ end
def flush
- Puppet::NetDev::CE::Device.set_ssh_ip(resource[:sship])
- Puppet::NetDev::CE::Device.set_ssh_username(resource[:sshuser])
- Puppet::NetDev::CE::Device.set_ssh_password(resource[:sshpass])
+ Puppet::NetDev::CE::Device_ssh.ssh_instance(resource[:sship], resource[:sshuser], resource[:sshpass])
end
end
|
Add description of LICENSE and Modify
|
diff --git a/lib/yard/server/commands/static_file_command.rb b/lib/yard/server/commands/static_file_command.rb
index abc1234..def5678 100644
--- a/lib/yard/server/commands/static_file_command.rb
+++ b/lib/yard/server/commands/static_file_command.rb
@@ -24,7 +24,20 @@ return
end
end
+ favicon?
self.status = 404
+ end
+
+ private
+
+ # Return an empty favicon.ico if it does not exist so that
+ # browsers don't complain.
+ def favicon?
+ return unless request.path == '/favicon.ico'
+ self.headers['Content-Type'] = 'image/png'
+ self.status = 200
+ self.body = ''
+ raise FinishRequest
end
end
end
|
Return an empty favicon.ico for browsers that request it (if it does not exist in static paths)
|
diff --git a/template/foss/tasks/uber_jar.rake b/template/foss/tasks/uber_jar.rake
index abc1234..def5678 100644
--- a/template/foss/tasks/uber_jar.rake
+++ b/template/foss/tasks/uber_jar.rake
@@ -3,7 +3,7 @@ desc "Build the uberjar"
task :uberjar => [ ] do
if `which lein`
- sh "lein uberjar"
+ sh "lein -U uberjar"
mv "target/#{EZBake::Config[:uberjar_name]}", EZBake::Config[:uberjar_name]
else
puts "You need lein on your system"
|
Add -U to `lein uberjar`
Without this, we don't always check for updated SNAPSHOTs.
|
diff --git a/lib/joint/instance_methods.rb b/lib/joint/instance_methods.rb
index abc1234..def5678 100644
--- a/lib/joint/instance_methods.rb
+++ b/lib/joint/instance_methods.rb
@@ -24,7 +24,6 @@ :filename => send(name).name,
:content_type => send(name).type,
})
- io.close if io.respond_to?(:close)
end
assigned_attachments.clear
end
|
Revert "close the file after putting it on the grid"
This reverts commit 4ecfeaae2c800c5a37d60a1566dfe7f923221055.
Caused all the tests to fail and came with none of its own. Need to know more of the problem it was solving.
|
diff --git a/lib/newline_hw/gui_trigger.rb b/lib/newline_hw/gui_trigger.rb
index abc1234..def5678 100644
--- a/lib/newline_hw/gui_trigger.rb
+++ b/lib/newline_hw/gui_trigger.rb
@@ -19,15 +19,38 @@ end
def call
+ applescript = case application
+ when "iTerm2"
+ applescript_for_iterm
+ else
+ applescript_for_terminal
+ end
+ puts applescript
`osascript -e '#{applescript}'`
end
- private def applescript
- s = ""
- s += "tell application \"#{application}\" to do script "
- s += "\"EDITOR=#{editor} hw #{@newline_submission_id}\"\n"
- s += "tell application \"#{application}\" to activate"
- s
+ private def command_to_run_in_tty
+ "hw #{@newline_submission_id} --editor=#{@editor}"
+ end
+
+
+ private def applescript_for_terminal
+ <<-APPLESCRIPT
+ tell application "#{application}" to do script "#{command_to_run_in_tty}"
+ tell application "#{application}" to activate
+ APPLESCRIPT
+ end
+
+ private def applescript_for_iterm
+ <<-APPLESCRIPT
+ tell application \"#{application}\"
+ set newWindow to (create window with default profile)
+
+ tell current session of newWindow
+ write text "#{command_to_run_in_tty}"
+ end tell
+ end tell
+ APPLESCRIPT
end
end
end
|
Add AppleScript support for iterm2
|
diff --git a/lib/tagify_string/core_ext.rb b/lib/tagify_string/core_ext.rb
index abc1234..def5678 100644
--- a/lib/tagify_string/core_ext.rb
+++ b/lib/tagify_string/core_ext.rb
@@ -26,7 +26,7 @@ end
# The Sonia Clause. Check for all garbage characters. Return an empty string in this case.
- output = self.gsub("_", "").parameterize(opts[:sep])
+ output = self.gsub("_", " ").parameterize(opts[:sep])
return "" if output.length == 0
# Otherwise, attach prefix, process for case and send back.
|
Replace with space to keep in the spirit of things.
|
diff --git a/lib/analyze_educators_export.rb b/lib/analyze_educators_export.rb
index abc1234..def5678 100644
--- a/lib/analyze_educators_export.rb
+++ b/lib/analyze_educators_export.rb
@@ -0,0 +1,42 @@+require 'csv'
+
+class AnalyzeEducatorsExport < Struct.new :path
+
+ def contents
+ encoding_options = {
+ invalid: :replace,
+ undef: :replace,
+ replace: ''
+ }
+
+ @file ||= File.read(path).encode('UTF-8', 'binary', encoding_options)
+ .gsub(/\\\\/, '')
+ .gsub(/\\"/, '')
+ end
+
+ def data
+ csv_options = {
+ headers: true,
+ header_converters: :symbol,
+ converters: ->(h) { nil_converter(h) }
+ }
+
+ @parsed_csv ||= CSV.parse(contents, csv_options)
+ end
+
+ def nil_converter(value)
+ value unless value == '\N'
+ end
+
+ def get_educators_for_school(school_local_id)
+ puts data.select { |row| row[:school_local_id] == school_local_id }
+ .map { |row| present_educator(row) }
+ end
+
+ def present_educator(row)
+ educator_view = "#{row[:full_name]} – #{row[:homeroom] || 'No homeroom'}"
+ educator_view += " – Admin" if row[:staff_type] == "Administrator"
+ educator_view
+ end
+
+end
|
Add code to fetch staff list by school
+ This is part of the process of onboarding a second school onto Student Insights
+ We need to check the second school's staff list in X2 for missing educators and Active/Inactive status set correctly
+ #293
|
diff --git a/lib/discordrb/events/message.rb b/lib/discordrb/events/message.rb
index abc1234..def5678 100644
--- a/lib/discordrb/events/message.rb
+++ b/lib/discordrb/events/message.rb
@@ -7,9 +7,9 @@ end
def author; @message.author; end
- def user; @message.author; end
+ alias_method :user, :author
def channel; @message.channel; end
def content; @message.content; end
- def text; @message.content; end
+ alias_method :text, :content
end
end
|
Use alias_method instead of duplicating the method code
|
diff --git a/lib/fact_check_email_handler.rb b/lib/fact_check_email_handler.rb
index abc1234..def5678 100644
--- a/lib/fact_check_email_handler.rb
+++ b/lib/fact_check_email_handler.rb
@@ -32,8 +32,8 @@ return false
end
- # &after_each_message: an optional block to call after processing each message
- def process(&after_each_message)
+ # takes an optional block to call after processing each message
+ def process
if ENV.include?("RUN_FACT_CHECK_FETCHER")
Mail.all(read_only: false, delete_after_find: true) do |message|
message.skip_deletion unless process_message(message)
|
Remove a redundant block parameter
|
diff --git a/lib/generator/implementation.rb b/lib/generator/implementation.rb
index abc1234..def5678 100644
--- a/lib/generator/implementation.rb
+++ b/lib/generator/implementation.rb
@@ -1,6 +1,6 @@ require 'delegate'
require 'forwardable'
-require_relative 'template_values'
+require 'generator/template_values'
module Generator
class Implementation
|
Use require rather than require_relative.
This is consistent with all the other generator includes.
|
diff --git a/lib/omnibus/compressors/null.rb b/lib/omnibus/compressors/null.rb
index abc1234..def5678 100644
--- a/lib/omnibus/compressors/null.rb
+++ b/lib/omnibus/compressors/null.rb
@@ -18,6 +18,10 @@ class Compressor::Null < Compressor::Base
id :null
+ def package_name
+ ''
+ end
+
def run!
# noop
end
|
Define package_name on Null compressor to be the empty string
|
diff --git a/lib/refills/import_generator.rb b/lib/refills/import_generator.rb
index abc1234..def5678 100644
--- a/lib/refills/import_generator.rb
+++ b/lib/refills/import_generator.rb
@@ -7,15 +7,41 @@ argument :snippet, type: :string, required: true
def copy_html
- copy_file "_#{snippet}.html.erb", "app/views/refills/_#{snippet}.html.erb"
+ copy_file view_name(snippet), view_destination
end
def copy_styles
- copy_file "stylesheets/refills/_#{snippet}.scss", "app/assets/stylesheets/refills/_#{snippet}.scss"
+ copy_file stylesheet_template, stylesheet_destination
end
def copy_javascripts
copy_file "javascripts/refills/_#{snippet}.js", "app/assets/javascripts/refills/_#{snippet}.js"
end
+
+ private
+
+ def stylesheet_destination
+ File.join('app', 'assets', 'stylesheets', 'refills', stylesheet_name(snippet_name))
+ end
+
+ def view_destination
+ File.join('app', 'views', 'refills', view_name(snippet_name))
+ end
+
+ def stylesheet_template
+ File.join('stylesheets', 'refills', stylesheet_name(snippet))
+ end
+
+ def view_name(name)
+ "_#{name}.html.erb"
+ end
+
+ def stylesheet_name(name)
+ "_#{name}.scss"
+ end
+
+ def snippet_name
+ snippet.underscore
+ end
end
end
|
Use Rails naming conventions for partials
|
diff --git a/lib/rspec-rayo/tropo1/driver.rb b/lib/rspec-rayo/tropo1/driver.rb
index abc1234..def5678 100644
--- a/lib/rspec-rayo/tropo1/driver.rb
+++ b/lib/rspec-rayo/tropo1/driver.rb
@@ -42,7 +42,6 @@ latch = @latches[latch_name]
raise RuntimeError, "No latch by that name" unless latch
latch.wait @latch_timeout
- end
end
def place_call(session_url)
|
Fix a stupid syntax error
|
diff --git a/test/test-command.rb b/test/test-command.rb
index abc1234..def5678 100644
--- a/test/test-command.rb
+++ b/test/test-command.rb
@@ -0,0 +1,29 @@+require "fileutils"
+require "stringio"
+require "clipcellar/version"
+require "clipcellar/command"
+
+class CommandTest < Test::Unit::TestCase
+ class << self
+ def startup
+ @@tmpdir = File.join(File.dirname(__FILE__), "tmp", "database")
+ FileUtils.rm_rf(@@tmpdir)
+ FileUtils.mkdir_p(@@tmpdir)
+ @@command = Clipcellar::Command.new
+ @@command.instance_variable_set(:@database_dir, @@tmpdir)
+ end
+
+ def shutdown
+ FileUtils.rm_rf(@@tmpdir)
+ end
+ end
+
+ def test_version
+ s = ""
+ io = StringIO.new(s)
+ $stdout = io
+ @@command.version
+ assert_equal("#{Clipcellar::VERSION}\n", s)
+ $stdout = STDOUT
+ end
+end
|
Add a test for version command
|
diff --git a/dsass.gemspec b/dsass.gemspec
index abc1234..def5678 100644
--- a/dsass.gemspec
+++ b/dsass.gemspec
@@ -1,13 +1,13 @@
Gem::Specification.new do |s|
s.name = 'dsass'
- s.version = '1.0'
+ s.version = '1.0.1'
s.date = '2012-06-08'
s.summary = 'SASS runner for Drupal'
s.description = 'Provides the dsass command to run sass --watch on all themes in a Drupal installation which support SASS.'
s.authors = ['Matthew Scharley']
s.email = '[email protected]'
- s.files = []
+ s.files = ['LICENSE', 'README.markdown']
s.executables << 'dsass'
s.homepage = 'https://github.com/mscharley/dsass'
|
Add documentation to the gem
|
diff --git a/bugsnag.gemspec b/bugsnag.gemspec
index abc1234..def5678 100644
--- a/bugsnag.gemspec
+++ b/bugsnag.gemspec
@@ -18,7 +18,13 @@ s.require_paths = ["lib"]
s.add_runtime_dependency 'multi_json', ["~> 1.0"]
- s.add_runtime_dependency 'httparty', ["< 1.0", ">= 0.6"]
+
+ if RUBY_VERSION < "1.9"
+ # Use ruby 1.8 compatible httparty
+ s.add_runtime_dependency 'httparty', ["< 0.12.0", ">= 0.6"]
+ else
+ s.add_runtime_dependency 'httparty', ["< 1.0", ">= 0.6"]
+ end
s.add_development_dependency 'rspec'
s.add_development_dependency 'rdoc'
|
Use ruby 1.8 compatible httparty in gemspec for older rubies
|
diff --git a/lib/controllers/frontend/spree/checkout_controller_decorator.rb b/lib/controllers/frontend/spree/checkout_controller_decorator.rb
index abc1234..def5678 100644
--- a/lib/controllers/frontend/spree/checkout_controller_decorator.rb
+++ b/lib/controllers/frontend/spree/checkout_controller_decorator.rb
@@ -1,4 +1,3 @@-require 'spree/core/validators/email'
Spree::CheckoutController.class_eval do
before_action :check_authorization
before_action :check_registration, except: [:registration, :update_registration]
|
Remove reference to the old EmailValidator
It was removed in https://github.com/spree/spree/commit/f80b0c30cac356f465ba35d1a98d29b7bd945f54
|
diff --git a/laravel/recipes/storage_permissions.rb b/laravel/recipes/storage_permissions.rb
index abc1234..def5678 100644
--- a/laravel/recipes/storage_permissions.rb
+++ b/laravel/recipes/storage_permissions.rb
@@ -5,6 +5,7 @@ cwd "#{deploy[:deploy_to]}/current"
code <<-EOH
chown -R www-data:www-data app/storage
+ chown -R www-data:www-data public/documents
EOH
end
end
|
Add RW permissions to image folders
|
diff --git a/CUtil.podspec b/CUtil.podspec
index abc1234..def5678 100644
--- a/CUtil.podspec
+++ b/CUtil.podspec
@@ -1,6 +1,6 @@ Pod::Spec.new do |s|
s.name = "CUtil"
- s.version = "0.1.17"
+ s.version = "0.1.18"
s.summary = "CUtil is a common utilities collection. It is designed as a tool-box for iOS development."
s.author = { "Acttos" => "[email protected]", "Jason" => "[email protected]" }
s.social_media_url = "https://twitter.com/hulu0319"
|
Add a new version 0.1.18 for CocoaPods.
|
diff --git a/modules/cron/spec/defines/crondotdee_spec.rb b/modules/cron/spec/defines/crondotdee_spec.rb
index abc1234..def5678 100644
--- a/modules/cron/spec/defines/crondotdee_spec.rb
+++ b/modules/cron/spec/defines/crondotdee_spec.rb
@@ -0,0 +1,35 @@+require_relative '../../../../spec_helper'
+
+describe 'cron::crondotdee' do
+
+ let(:title) { 'true_cron' }
+
+ let (:default_params) {{
+ :command => '/bin/true',
+ :hour => '12',
+ :minute => '34',
+ }}
+
+ context 'with mandatory params' do
+ let(:params) { default_params }
+
+ it { should contain_file('/etc/cron.d/true_cron').with_content(/34 12 \* \* \* root \/bin\/true/) }
+ end
+
+ context 'with explicit empty string MAILTO' do
+ let(:params) { default_params.merge({
+ :mailto => '""',
+ })}
+
+ it { should contain_file('/etc/cron.d/true_cron').with_content(/MAILTO=""/) }
+ end
+
+ context 'with undefined MAILTO' do
+ let(:params) { default_params.merge({
+ :mailto => '',
+ })}
+
+ it { should contain_file('/etc/cron.d/true_cron').without_content(/MAILTO/) }
+ end
+
+end
|
Add specs for the new crondotdee class
|
diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/exercises_helper.rb
+++ b/app/helpers/exercises_helper.rb
@@ -1,4 +1,25 @@ module ExercisesHelper
+ # 'CodeRayify' class implementation taken from
+ # http://allfuzzy.tumblr.com/post/27314404412/markdown-and-code-syntax-highlighting-in-ruby-on
+ class CodeRayify < Redcarpet::Render::HTML
+ def block_code(code, language)
+ CodeRay.scan(code, language).div(:line_numbers => :table)
+ end
+ end
+
+ # Display in markdown ("prettified").
+ def markdown(text)
+ coderayified = CodeRayify.new(no_images: true)
+
+ extensions = { hard_wrap: true, filter_html: true, autolink: true,
+ no_intraemphasis: true, fenced_code_blocks: true,
+ tables: true, superscript: true }
+
+ markdown = Redcarpet::Markdown.new(coderayified, extensions)
+ markdown.render(text).html_safe
+ end
+
+ # Pluralize question text.
def pluralize_questions(count)
return "#{count} questões cadastradas" if count >= 0
"#{count} questão cadastrada"
|
Add method to deal with markdown text
|
diff --git a/lib/buildkit/version.rb b/lib/buildkit/version.rb
index abc1234..def5678 100644
--- a/lib/buildkit/version.rb
+++ b/lib/buildkit/version.rb
@@ -1,5 +1,5 @@ # frozen_string_literal: true
module Buildkit
- VERSION = '1.4.5'
+ VERSION = '1.4.6'
end
|
Patch upgrade 1.4.5 to 1.4.6, to remove deprecation warnings from Faraday
|
diff --git a/lib/capybara/helpers.rb b/lib/capybara/helpers.rb
index abc1234..def5678 100644
--- a/lib/capybara/helpers.rb
+++ b/lib/capybara/helpers.rb
@@ -39,7 +39,7 @@ def inject_asset_host(html)
if Capybara.asset_host
if Nokogiri::HTML(html).css("base").empty? and match = html.match(/<head[^<]*?>/)
- html.insert match.end(0), "<base href='#{Capybara.asset_host}' />"
+ html.clone.insert match.end(0), "<base href='#{Capybara.asset_host}' />"
end
else
html
|
Make sure we don't accidentally modify the body
Since we don't know where it comes from in the driver. Related to #958
|
diff --git a/lib/coalesce/grouper.rb b/lib/coalesce/grouper.rb
index abc1234..def5678 100644
--- a/lib/coalesce/grouper.rb
+++ b/lib/coalesce/grouper.rb
@@ -20,12 +20,16 @@ end
def each(items, &proc)
+ # We try to use find_each vs. each for Enumerables that support it.
+
+ each_method = items.respond_to?(:find_each) ? :find_each : :each
+
return enum_for(__method__, items) unless block_given?
- return items.each(&proc) if !@enabled
+ return items.send(each_method, &proc) if !@enabled
batch = nil
- iterator = items.each
+ iterator = items.send(each_method)
candidate = iterator.next
loop do
|
Use find_each vs. find when possible
|
diff --git a/lib/diary_issue_hook.rb b/lib/diary_issue_hook.rb
index abc1234..def5678 100644
--- a/lib/diary_issue_hook.rb
+++ b/lib/diary_issue_hook.rb
@@ -10,7 +10,7 @@ # Instead of creating a time entry with a blank comment, copy the first 200
# characters from the journal (the issue comment)
if time_entry && journal && time_entry.comments.blank?
- comments = journal.notes[0..199]
+ comments = journal.notes[0..250]
# To be honest, a new record is not expected at this point with the
# current redmine implementation, but just in case...
if time_entry.new_record?
|
Copy 251 characters from the journal, instead of 200
|
diff --git a/lib/ekylibre/first_run/loaders/demo.rb b/lib/ekylibre/first_run/loaders/demo.rb
index abc1234..def5678 100644
--- a/lib/ekylibre/first_run/loaders/demo.rb
+++ b/lib/ekylibre/first_run/loaders/demo.rb
@@ -2,8 +2,9 @@ Ekylibre::FirstRun.add_loader :demo do |first_run|
if Preference.get!(:demo, false, :boolean).value
-
- Ekylibre::FirstRun::Faker::Sales.run(max: first_run.max)
+
+ # replace by sales.csv / purchases.csv more real.
+ # Ekylibre::FirstRun::Faker::Sales.run(max: first_run.max)
# replace by interventions.csv more real.
# Ekylibre::FirstRun::Faker::Interventions.run(max: first_run.max)
|
Replace fake sales and purchases by more real one
|
diff --git a/app/models/course_data/block.rb b/app/models/course_data/block.rb
index abc1234..def5678 100644
--- a/app/models/course_data/block.rb
+++ b/app/models/course_data/block.rb
@@ -36,7 +36,7 @@ DEFAULT_POINTS = 10
def training_modules
- training_module_ids.collect { |id| TrainingModule.find(id) }
+ TrainingModule.where(id: training_module_ids)
end
def date_manager
|
Update how TrainingModule records are collected for a Block
We're in ActiveRecord world now.
|
diff --git a/lib/holidays/finder/rules/in_region.rb b/lib/holidays/finder/rules/in_region.rb
index abc1234..def5678 100644
--- a/lib/holidays/finder/rules/in_region.rb
+++ b/lib/holidays/finder/rules/in_region.rb
@@ -6,7 +6,6 @@ def call(requested, available)
return true if requested.include?(:any)
- #TODO HERE IS WHERE WE TREAT UNDERSCORES AS SUBREGIONS FROM A PARENT
# When an underscore is encountered, derive the parent regions
# symbol and check for both.
requested = requested.collect do |r|
|
[issue-331] Remove unnecessary TODO in region rules
|
diff --git a/lib/lets_encrypt_heroku/acme_client.rb b/lib/lets_encrypt_heroku/acme_client.rb
index abc1234..def5678 100644
--- a/lib/lets_encrypt_heroku/acme_client.rb
+++ b/lib/lets_encrypt_heroku/acme_client.rb
@@ -36,7 +36,7 @@ private
def client
- @client ||= Acme::Client.new(private_key: private_key, endpoint: 'https://acme-v01.api.letsencrypt.org/')
+ @client ||= Acme::Client.new(private_key: private_key, endpoint: LetsEncryptHeroku.configuration.endpoint)
registration = @client.register(contact: email)
registration.agree_terms
@client
|
Use `endpoint` from config instead of hardcoding it.
|
diff --git a/lib/toolshed/databases/mysql/backup.rb b/lib/toolshed/databases/mysql/backup.rb
index abc1234..def5678 100644
--- a/lib/toolshed/databases/mysql/backup.rb
+++ b/lib/toolshed/databases/mysql/backup.rb
@@ -1,5 +1,7 @@ require 'toolshed/error'
require 'toolshed/password'
+
+require 'fileutils'
module Toolshed
module Databases
@@ -19,9 +21,14 @@ @wait_time = options[:wait_time] || 120
end
+ def create_path
+ FileUtils.mkdir_p(File.dirname(path))
+ end
+
def execute
raise TypeError, "Wait time passed in is not a number #{wait_time}" unless wait_time.is_a?(Fixnum)
Toolshed.logger.info "Starting execution of mysqldump -h #{host} -u #{username} #{hidden_password_param} #{name} > #{path}."
+ create_path
Toolshed::Base.wait_for_command("mysqldump -h #{host} -u #{username} #{password_param} #{name} > #{path}", wait_time)
Toolshed.logger.info 'mysqldump has completed.'
end
|
Create the path if it does not exist when performing mysql dump
|
diff --git a/lib/wright/provider/user/gnu_passwd.rb b/lib/wright/provider/user/gnu_passwd.rb
index abc1234..def5678 100644
--- a/lib/wright/provider/user/gnu_passwd.rb
+++ b/lib/wright/provider/user/gnu_passwd.rb
@@ -36,8 +36,12 @@ '-s' => shell,
'-d' => home
}.reject { |_k, v| v.nil? }.flatten
- options << '-r' if system_user?
+ options << system_user_option if system_user?
options.map(&:to_s)
+ end
+
+ def system_user_option
+ '-r'
end
def comment
|
Clean up GNU user provider
Extract system_user_options method.
|
diff --git a/pages/lib/refinery/pages/admin/instance_methods.rb b/pages/lib/refinery/pages/admin/instance_methods.rb
index abc1234..def5678 100644
--- a/pages/lib/refinery/pages/admin/instance_methods.rb
+++ b/pages/lib/refinery/pages/admin/instance_methods.rb
@@ -4,7 +4,7 @@ module InstanceMethods
def error_404(exception=nil)
- if (@page = Page.find_by_menu_match("^/404$", :include => [:parts, :slugs])).present?
+ if (@page = Page.where(:menu_match => "^/404$").includes(:parts, :slugs).first).present?
params[:action] = 'error_404'
# change any links in the copy to the admin_root_path
# and any references to "home page" to "Dashboard"
|
Use arel style instead of dynamic finder.
|
diff --git a/lib/joker-api/errors.rb b/lib/joker-api/errors.rb
index abc1234..def5678 100644
--- a/lib/joker-api/errors.rb
+++ b/lib/joker-api/errors.rb
@@ -1,3 +1,5 @@ module JokerAPI
class AuthorisationError < RuntimeError; end
+ class ObjectNotFound < RuntimeError; end
+ class IncompleteRequest < RuntimeError; end
end
|
Add some more error types.
|
diff --git a/lib/malady/evaluator.rb b/lib/malady/evaluator.rb
index abc1234..def5678 100644
--- a/lib/malady/evaluator.rb
+++ b/lib/malady/evaluator.rb
@@ -1,47 +1,43 @@ module Malady
- class Evaluator
+ module Evaluator
+ module_function
+ def evaluate(env, ast)
+ type = ast.first
+ rest = ast[1..-1]
+ if type == :list
+ evaluated_list = eval_ast(env, ast)
+ fn = evaluated_list[1]
+ args = evaluated_list[2..-1]
+ fn.call(*args)
+ else
+ eval_ast(env, ast)
+ end
+ end
- class << self
- def evaluate(env, ast)
- type = ast.first
- rest = ast[1..-1]
- if type == :list
- evaluated_list = eval_ast(env, ast)
- fn = evaluated_list[1]
- args = evaluated_list[2..-1]
- fn.call(*args)
- else
- eval_ast(env, ast)
- end
+ def eval_with_repl_env(ast)
+ repl_env = {
+ '+' => lambda { |x, y| x + y },
+ '-' => lambda { |x, y| x - y },
+ '/' => lambda { |x, y| Integer(x / y) },
+ '*' => lambda { |x, y| x * y }
+ }
+ evaluate(repl_env, ast)
+ end
+
+ def eval_ast(env, ast)
+ type = ast.first
+ rest = ast[1..-1]
+ case type
+ when :symbol
+ env[ast[1]]
+ when :list
+ result = [:list]
+ result + rest.map { |ast| evaluate(env, ast) }
+ when :integer
+ ast[1]
+ else
+ ast
end
-
- def eval_with_repl_env(ast)
- repl_env = {
- '+' => lambda { |x, y| x + y },
- '-' => lambda { |x, y| x - y },
- '/' => lambda { |x, y| Integer(x / y) },
- '*' => lambda { |x, y| x * y }
- }
- evaluate(repl_env, ast)
- end
-
- private
- def eval_ast(env, ast)
- type = ast.first
- rest = ast[1..-1]
- case type
- when :symbol
- env[ast[1]]
- when :list
- result = [:list]
- result + rest.map { |ast| evaluate(env, ast) }
- when :integer
- ast[1]
- else
- ast
- end
- end
-
end
end
end
|
Change Evaluator class to a module
|
diff --git a/lib/mws-rb/api/feeds.rb b/lib/mws-rb/api/feeds.rb
index abc1234..def5678 100644
--- a/lib/mws-rb/api/feeds.rb
+++ b/lib/mws-rb/api/feeds.rb
@@ -1,6 +1,8 @@ module MWS
module API
class Feeds < Base
+ XSD_PATH = File.join(File.dirname(__FILE__), "feeds", "xsd")
+
Actions = [:get_feed_submission_list, :get_feed_submission_list_by_next_token,
:get_feed_submission_count, :cancel_feed_submissions, :get_feed_submission_result ]
|
Add global reference to the location of XSD files
|
diff --git a/lib/translations/cli.rb b/lib/translations/cli.rb
index abc1234..def5678 100644
--- a/lib/translations/cli.rb
+++ b/lib/translations/cli.rb
@@ -7,7 +7,7 @@ class_option :directory, aliases: ["-d"], default: "config/locales", type: :string, desc: "Directory containing the translations"
class_option :master, aliases: ["-m"], default: "en", type: :string, desc: "The master locale"
- desc "translate LOCALE [KEYS]", ""
+ desc "translate LOCALE [KEYS]", "Translate the KEYS into the given LOCALE"
def translate locale, *keys
@serializer = Serializer.new options.directory, options.master
translations = @serializer.translations
|
Add a description for translate
|
diff --git a/holidays.gemspec b/holidays.gemspec
index abc1234..def5678 100644
--- a/holidays.gemspec
+++ b/holidays.gemspec
@@ -7,15 +7,15 @@ Gem::Specification.new do |gem|
gem.name = 'holidays'
gem.version = Holidays::VERSION
- gem.authors = ['Alex Dunae', 'Hana Wang']
- gem.email = ['[email protected]', '[email protected]']
+ gem.authors = ['Alex Dunae']
+ gem.email = ['[email protected]']
gem.homepage = 'https://github.com/alexdunae/holidays'
- gem.description = %q{A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!}
- gem.summary = %q{A collection of Ruby methods to deal with statutory and other holidays.}
+ gem.description = %q(A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!)
+ gem.summary = %q(A collection of Ruby methods to deal with statutory and other holidays.)
+ gem.files = `git ls-files`.split("\n") - ['.gitignore', '.travis.yml']
gem.test_files = gem.files.grep(/^test/)
- gem.require_paths = ["lib"]
+ gem.require_paths = ['lib']
gem.licenses = ['MIT']
gem.add_development_dependency 'bundler'
gem.add_development_dependency 'rake'
end
-
|
Update gemspec to specify files
|
diff --git a/spec/views/miq_policy/_alert_details.html.haml_spec.rb b/spec/views/miq_policy/_alert_details.html.haml_spec.rb
index abc1234..def5678 100644
--- a/spec/views/miq_policy/_alert_details.html.haml_spec.rb
+++ b/spec/views/miq_policy/_alert_details.html.haml_spec.rb
@@ -1,7 +1,7 @@ describe "miq_policy/_alert_details.html.haml" do
before do
@alert = FactoryGirl.create(:miq_alert)
- SEVERITIES = MiqPolicyController::Alerts::SEVERITIES
+ stub_const("#{controller.class}::SEVERITIES", MiqPolicyController::Alerts::SEVERITIES)
exp = {:eval_method => 'nothing', :mode => 'internal', :options => {}}
allow(@alert).to receive(:expression).and_return(exp)
set_controller_for_view("miq_policy")
|
Fix warning about top level constant access
Stub the constant on the test controller instead of creating a new,
top-level constant.
|
diff --git a/giphy.gemspec b/giphy.gemspec
index abc1234..def5678 100644
--- a/giphy.gemspec
+++ b/giphy.gemspec
@@ -19,8 +19,8 @@ spec.require_paths = ["lib"]
spec.add_development_dependency "bundler", "~> 1.3"
- spec.add_development_dependency "rake"
- spec.add_development_dependency "rspec"
+ spec.add_development_dependency "rake", "~> 10.1"
+ spec.add_development_dependency "rspec", "~> 2.14"
spec.add_dependency "faraday", "~> 0.8.8"
spec.add_dependency "faraday_middleware-parse_oj", "~> 0.2.1"
end
|
Use pesimitic locking for dev dependencies
|
diff --git a/week-4/add-it-up/my-solution.rb b/week-4/add-it-up/my-solution.rb
index abc1234..def5678 100644
--- a/week-4/add-it-up/my-solution.rb
+++ b/week-4/add-it-up/my-solution.rb
@@ -0,0 +1,75 @@+# Add it up!
+
+# Complete each step below according to the challenge directions and
+# include it in this file. Also make sure everything that isn't code
+# is commented in the file.
+
+# I worked on this challenge with: Emmett Garber.
+
+# 0. total Pseudocode
+# make sure all pseudocode is commented out!
+
+# Input: Array
+# Output: Sum of the array elements
+# Steps to solve the problem.
+# sum=0
+# Array.each do |x|
+# sum+=x
+# end
+
+# p sum
+
+# 1. total initial solution
+
+def total(num_Array)
+ sum=0
+ num_Array.each do |x|
+ sum+=x
+ end
+ p sum
+end
+
+# total([1,1,1])
+# total([0,0,0])
+
+# 3. total refactored solution
+
+
+
+# 4. sentence_maker pseudocode
+# make sure all pseudocode is commented out!
+# Input: Array of strings
+# Output: Joined elements/sentence
+# Steps to solve the problem.
+
+# set variable to store sentence
+# capitalize first letter of first element
+# loop through the array, add each element to sentence
+# return sentence with period
+
+# 5. sentence_maker initial solution
+
+def sentence_maker(word_Array)
+ sentence=""
+ word_Array[0].capitalize!
+
+ c=1
+ word_Array.each do |x|
+ sentence+="#{x} "
+ break if c==(word_Array.count-1)
+ c+=1
+ end
+
+ sentence+=word_Array[word_Array.count-1]
+ p sentence + "."
+end
+
+# 6. sentence_maker refactored solution
+
+# def sentence_maker(word_Array)
+
+# word_Array[0].capitalize!
+
+# sentence=word_Array.join(" ")
+# p sentence + "."
+# end
|
Add add it up challenge
|
diff --git a/limit_detectors.gemspec b/limit_detectors.gemspec
index abc1234..def5678 100644
--- a/limit_detectors.gemspec
+++ b/limit_detectors.gemspec
@@ -19,8 +19,8 @@ spec.require_paths = ["lib"]
spec.add_development_dependency 'bundler'
- spec.add_development_dependency 'rake'
+ spec.add_development_dependency 'rake', '~> 10.4'
spec.add_development_dependency 'rspec', '~> 3.0'
- spec.add_development_dependency 'pry'
+ spec.add_development_dependency 'pry', '~> 0.10'
spec.add_development_dependency 'pry-doc'
end
|
Fix rake & pry version a bit tigher
|
diff --git a/app/models/spree/gateway/stripe_ach_gateway.rb b/app/models/spree/gateway/stripe_ach_gateway.rb
index abc1234..def5678 100644
--- a/app/models/spree/gateway/stripe_ach_gateway.rb
+++ b/app/models/spree/gateway/stripe_ach_gateway.rb
@@ -0,0 +1,36 @@+module Spree
+ class Gateway::StripeAchGateway < Gateway::StripeGateway
+
+ def method_type
+ 'stripe_ach'
+ end
+
+ def create_profile(payment)
+ return unless payment.source&.gateway_customer_profile_id.nil?
+
+ options = {
+ email: payment.order.user&.email || payment.order.email,
+ login: preferred_secret_key,
+ }.merge! address_for(payment)
+
+ source = payment.source
+ bank_account = if source.gateway_payment_profile_id.present?
+ source.gateway_payment_profile_id
+ else
+ source
+ end
+
+ response = provider.store(bank_account, options)
+
+ if response.success?
+ payment.source.update!({
+ gateway_customer_profile_id: response.params['id'],
+ gateway_payment_profile_id: response.params['default_source'] || response.params['default_card']
+ })
+
+ else
+ payment.send(:gateway_error, response.message)
+ end
+ end
+ end
+end
|
Add ACH payment support for Stripe Gateway
|
diff --git a/app/serializers/sprangular/order_serializer.rb b/app/serializers/sprangular/order_serializer.rb
index abc1234..def5678 100644
--- a/app/serializers/sprangular/order_serializer.rb
+++ b/app/serializers/sprangular/order_serializer.rb
@@ -1,18 +1,17 @@ module Sprangular
class OrderSerializer < BaseSerializer
- attributes :id, :number, :item_total, :total, :ship_total, :state,
- :adjustment_total, :user_id, :created_at, :updated_at,
- :completed_at, :payment_total, :shipment_state, :payment_state,
- :email, :special_instructions, :channel, :included_tax_total,
- :additional_tax_total, :display_included_tax_total,
- :display_additional_tax_total, :tax_total, :currency,
- :display_item_total, :display_total, :display_ship_total,
- :display_tax_total, :checkout_steps
+ attributes *order_attributes
+ attributes | [:display_total, :display_item_total, :display_ship_total, :display_tax_total, :checkout_steps]
attribute :total_quantity
+ attribute :token
def total_quantity
object.line_items.sum(:quantity)
+ end
+
+ def token
+ object.guest_token
end
has_one :bill_address, serializer: Sprangular::AddressSerializer
|
Allow order_attributes to be appended to by extensions. Adds token attribute
|
diff --git a/app/components/twitter/bootstrap/components/v3/responsive_media_object.rb b/app/components/twitter/bootstrap/components/v3/responsive_media_object.rb
index abc1234..def5678 100644
--- a/app/components/twitter/bootstrap/components/v3/responsive_media_object.rb
+++ b/app/components/twitter/bootstrap/components/v3/responsive_media_object.rb
@@ -18,7 +18,7 @@ end
def div_container_classes
- ['responsive-media', 'col-lg-12', additional_div_container_classes]
+ ['responsive-media', 'col-lg-12', additional_div_container_classes].flatten
end
end
end
|
Fix additional div container classes not working on v3 responsive media object.
|
diff --git a/conekta.gemspec b/conekta.gemspec
index abc1234..def5678 100644
--- a/conekta.gemspec
+++ b/conekta.gemspec
@@ -23,6 +23,7 @@ spec.add_dependency "faraday"
spec.add_dependency "json"
spec.add_dependency "sys-uname"
+ spec.add_dependency "i18n"
spec.add_development_dependency "rspec", ">= 3.0"
spec.add_development_dependency "pry"
|
Fix i18n dependency load error
|
diff --git a/lib/active_remote/scope_keys.rb b/lib/active_remote/scope_keys.rb
index abc1234..def5678 100644
--- a/lib/active_remote/scope_keys.rb
+++ b/lib/active_remote/scope_keys.rb
@@ -1,3 +1,5 @@+require 'active_support/core_ext/module'
+
module ActiveRemote
module ScopeKeys
extend ActiveSupport::Concern
@@ -7,12 +9,11 @@ end
module ClassMethods
- def _scope_keys
- @_scope_keys ||= []
- end
+ mattr_accessor :_scope_keys
+ self._scope_keys = []
def scope_key(*keys)
- _scope_keys += keys.map(&:to_s)
+ self._scope_keys += keys.map(&:to_s)
end
def scope_keys
|
Use mattr_accessor to save state of scope key
Instance variables in modules get messy with inheritance. This ensures
that @_scope_keys is the same at the parent module and child module
level.
|
diff --git a/lib/controllers/frontend/solidus_paypal_braintree/checkouts_controller.rb b/lib/controllers/frontend/solidus_paypal_braintree/checkouts_controller.rb
index abc1234..def5678 100644
--- a/lib/controllers/frontend/solidus_paypal_braintree/checkouts_controller.rb
+++ b/lib/controllers/frontend/solidus_paypal_braintree/checkouts_controller.rb
@@ -14,9 +14,9 @@ @payment = Spree::PaymentCreate.new(@order, payment_params).build
if @payment.save
- render text: "ok"
+ render plain: "ok"
else
- render text: "not-ok"
+ render plain: "not-ok"
end
end
|
Update render plain to rails 5 syntax
|
diff --git a/multilateration.gemspec b/multilateration.gemspec
index abc1234..def5678 100644
--- a/multilateration.gemspec
+++ b/multilateration.gemspec
@@ -8,8 +8,8 @@ spec.version = Multilateration::VERSION
spec.authors = ["Arron Mabrey"]
spec.email = ["[email protected]"]
- spec.description = %q{TODO: Write a gem description}
- spec.summary = %q{TODO: Write a gem summary}
+ spec.description = %q{Solves for the location of an unknown signal emitter by using the signal TDOA between multiple signal receivers with known locations.}
+ spec.summary = %q{Solves for the location of an unknown signal emitter by using the signal TDOA between multiple signal receivers with known locations.}
spec.homepage = ""
spec.license = "MIT"
|
Add gemspec description and summary
|
diff --git a/no-style-please.gemspec b/no-style-please.gemspec
index abc1234..def5678 100644
--- a/no-style-please.gemspec
+++ b/no-style-please.gemspec
@@ -2,7 +2,7 @@
Gem::Specification.new do |spec|
spec.name = "no-style-please"
- spec.version = "0.4.6"
+ spec.version = "0.4.7"
spec.authors = ["Riccardo Graziosi"]
spec.email = ["[email protected]"]
|
Update gem version to 0.4.7
|
diff --git a/LolayPair.podspec b/LolayPair.podspec
index abc1234..def5678 100644
--- a/LolayPair.podspec
+++ b/LolayPair.podspec
@@ -16,7 +16,5 @@ }
s.source_files = 'LolayPairGlobals.*','LolayNamePair.*','LolayNumberPair.h.*','LolayStringPair.*','LolayPairTests.*','LolayInvestigo/LolayNSLogTracker.*','LolayInvestigo/LolayNoTracker.*'
s.requires_arc = true
- s.frameworks = 'XCTest','Foundation'
s.ios.deployment_target = '7.0'
- s.xcconfig = { 'OTHER_LDFLAGS' => '-ObjC'}
end
|
Update podspec to remove XCTest
|
diff --git a/app/controllers/scrapers_controller.rb b/app/controllers/scrapers_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/scrapers_controller.rb
+++ b/app/controllers/scrapers_controller.rb
@@ -0,0 +1,36 @@+# started the scraper controller
+#
+# require 'pry'
+# require_relative '..\..\lib\housing_listing_scraper\housing_listing_scraper'
+#
+# class ListingsController < ApplicationController
+# skip_before_filter :verify_authenticity_token
+#
+# def show
+# set_scraper
+# render_scraper_formats
+# end
+#
+# def scraper_params
+# params.require(:scraper).permit(:id, :address, :listed_at, :latitude, :longitude, :description, :discriminatory, :heading)
+# end
+#
+# def set_scraper
+# @scraper = Listing.find_by(id: params[:id])
+# end
+#
+# def render_scraper_formats
+# respond_to do |format|
+# format.html
+# format.json {render json: @scraper.to_json}
+# end
+# end
+#
+# def render_scrapers_formats
+# respond_to do |format|
+# format.html
+# format.json {render json: @scrapers.to_json}
+# end
+# end
+#
+# end
|
Copy template for scrapers controller
|
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -25,7 +25,7 @@
def destroy
auth_session.invalidate!
- redirect_to :back, notice: 'Signed out. (>-.-)>'
+ redirect_back fallback_location: root_path, notice: 'Signed out. (>-.-)>'
end
def failure
|
Fix redirect_to :back (removed in Rails 5.1)
|
diff --git a/lib/guard/ejs.rb b/lib/guard/ejs.rb
index abc1234..def5678 100644
--- a/lib/guard/ejs.rb
+++ b/lib/guard/ejs.rb
@@ -52,7 +52,9 @@ hash[@options[:namespace]][path] = compiled
end
- puts hash.inspect
+ File.open(@options[:output], 'w') do |file|
+ file.write hash.inspect
+ end
end
def run_on_removals(paths)
|
Write compiled templates to a file.
|
diff --git a/testing/rspec/spec/integration/cuke_modeler_integration_spec.rb b/testing/rspec/spec/integration/cuke_modeler_integration_spec.rb
index abc1234..def5678 100644
--- a/testing/rspec/spec/integration/cuke_modeler_integration_spec.rb
+++ b/testing/rspec/spec/integration/cuke_modeler_integration_spec.rb
@@ -0,0 +1,13 @@+require "#{File.dirname(__FILE__)}/../spec_helper"
+
+
+describe 'the gem' do
+
+ it 'is compatible with the most recent version of `cucumber-gherkin`' do
+ output = `bundle outdated`
+ out_of_date_line = output.split("\n").find { |line| line =~ /cucumber-gherkin/ }
+
+ expect(output).to_not include('cucumber-gherkin'), "Expected to be up to date but found '#{out_of_date_line}'"
+ end
+
+end
|
Add test for detecting new Gherkin versions
The test suite will now fail if a newer version of Gherkin exists. This
way I won't not notice half a dozen new versions getting released for
months at a time.
|
diff --git a/lib/camel_caser/strategies/raw_input.rb b/lib/camel_caser/strategies/raw_input.rb
index abc1234..def5678 100644
--- a/lib/camel_caser/strategies/raw_input.rb
+++ b/lib/camel_caser/strategies/raw_input.rb
@@ -24,7 +24,8 @@ unless params.empty?
json = MultiJson.dump(transform_params(params))
@env['rack.input'] = StringIO.new(json)
- @env['rack.input'].rewind
+ @env['rack.input'].rewind
+ @env['CONTENT_LENGTH'] = json.length
end
end
|
Update CONTENT_LENGTH after converting to underscore
|
diff --git a/lib/hpcloud/commands/servers.rb b/lib/hpcloud/commands/servers.rb
index abc1234..def5678 100644
--- a/lib/hpcloud/commands/servers.rb
+++ b/lib/hpcloud/commands/servers.rb
@@ -23,7 +23,8 @@ if servers.empty?
display "You currently have no servers, use `#{selfname} servers:add <name>` to create one."
else
- servers.table([:id, :name, :key_name, :flavor_id, :image_id, :created_at, :private_ip_address, :public_ip_address, :state])
+ servers.table([:id, :name, :created_at, :updated_at, :key_name, :public_ip_address, :state])
+ #servers.table
end
rescue Excon::Errors::Forbidden => error
display_error_message(error)
|
Update some attributes that needs to be displayed.
|
diff --git a/lib/performance_promise/sql_recorder.rb b/lib/performance_promise/sql_recorder.rb
index abc1234..def5678 100644
--- a/lib/performance_promise/sql_recorder.rb
+++ b/lib/performance_promise/sql_recorder.rb
@@ -33,7 +33,7 @@ 'SCHEMA',
'SQLR-EXPLAIN',
]
- payload[:name] && ignore_query_names.any? { |name| payload[:name].in?(name) }
+ payload[:name] && ignore_query_names.any? { |name| payload[:name].include?(name) }
end
def clean_trace(trace)
|
Use .include? instead of .in?
|
diff --git a/lib/rb-kqueue/watcher/signal.rb b/lib/rb-kqueue/watcher/signal.rb
index abc1234..def5678 100644
--- a/lib/rb-kqueue/watcher/signal.rb
+++ b/lib/rb-kqueue/watcher/signal.rb
@@ -1,7 +1,7 @@ module KQueue
class Watcher
# The {Watcher} subclass for events fired when a signal is received.
- # File events are watched via {Queue#watch_for_signal}.
+ # Signal events are watched via {Queue#watch_for_signal}.
class Signal < Watcher
# The name of the signal, e.g. "KILL" for SIGKILL.
#
|
Fix a minor doc error.
|
diff --git a/lib/simple_form/inputs/numeric_input.rb b/lib/simple_form/inputs/numeric_input.rb
index abc1234..def5678 100644
--- a/lib/simple_form/inputs/numeric_input.rb
+++ b/lib/simple_form/inputs/numeric_input.rb
@@ -22,14 +22,12 @@ protected
def infer_attrs_from_validations(input_options)
- obj = @builder.object
+ model_class = @builder.object.class
- return unless obj.class.respond_to?(:validators_on)
+ # The model should include ActiveModel::Validations.
+ return unless model_class.respond_to?(:validators_on)
- validators = obj.class.validators_on(attribute_name)
- num_validator = validators.find {|v| v.is_a?(ActiveModel::Validations::NumericalityValidator) }
-
- return if num_validator.nil?
+ num_validator = find_numericality_validator(model_class) or return
options = num_validator.__send__(:options)
@@ -37,6 +35,11 @@ input_options[:max] ||= options[:less_than_or_equal_to]
input_options[:step] ||= options[:only_integer] && 1
end
+
+ def find_numericality_validator(model_class)
+ validators = model_class.validators_on(attribute_name)
+ validators.find {|v| ActiveModel::Validations::NumericalityValidator === v }
+ end
end
end
end
|
Refactor the code a bit
|
diff --git a/app/mailers/georgia_mailer/notifier.rb b/app/mailers/georgia_mailer/notifier.rb
index abc1234..def5678 100644
--- a/app/mailers/georgia_mailer/notifier.rb
+++ b/app/mailers/georgia_mailer/notifier.rb
@@ -3,7 +3,7 @@
def new_message_notification(message)
@message = GeorgiaMailer::MessageDecorator.decorate(message)
- emails_to = Georgia::User.admins.map(&:email)
+ emails_to = Georgia::User.where(receives_notifications: true).map(&:email)
unless emails_to.empty?
mail(
from: "[email protected]",
|
Send emails only to users with receives_notifications true
|
diff --git a/lib/anal_uuid.rb b/lib/anal_uuid.rb
index abc1234..def5678 100644
--- a/lib/anal_uuid.rb
+++ b/lib/anal_uuid.rb
@@ -1,5 +1,18 @@ require 'anal_uuid/version'
+# Parse a UUID as defined in IETF RFC 4122, "A Universally Unique IDentifier
+# (UUID) URN Namespace" by Leach, Mealling, and Salz
+# (http://www.ietf.org/rfc/rfc4122.txt)
+#
+# Other references:
+#
+# "Universal Unique Identifier". The Open Group. CDE 1.1: Remote Procedure Call
+# (http://pubs.opengroup.org/onlinepubs/9629399/apdxa.htm).
+#
+# "Privilege (Authorisation) Services." The Open Group. DCE 1.1: Authentication
+# and Security Services
+# (http://pubs.opengroup.org/onlinepubs/9668899/chap5.htm#tagcjh_08_02_01_01).
+#
module AnalUUID
# Your code goes here...
end
|
Add some notes to main
|
diff --git a/db/migrate/20140822150920_create_neighborly_balanced_orders.neighborly_balanced.rb b/db/migrate/20140822150920_create_neighborly_balanced_orders.neighborly_balanced.rb
index abc1234..def5678 100644
--- a/db/migrate/20140822150920_create_neighborly_balanced_orders.neighborly_balanced.rb
+++ b/db/migrate/20140822150920_create_neighborly_balanced_orders.neighborly_balanced.rb
@@ -0,0 +1,11 @@+# This migration comes from neighborly_balanced (originally 20140817195359)
+class CreateNeighborlyBalancedOrders < ActiveRecord::Migration
+ def change
+ create_table :neighborly_balanced_orders do |t|
+ t.references :project, index: true, null: false
+ t.string :href, null: false
+
+ t.timestamps
+ end
+ end
+end
|
Add orders migration from neigborly balanced
|
diff --git a/lib/stackprofiler/middleware.rb b/lib/stackprofiler/middleware.rb
index abc1234..def5678 100644
--- a/lib/stackprofiler/middleware.rb
+++ b/lib/stackprofiler/middleware.rb
@@ -30,6 +30,8 @@ profile = StackProfx.run(@stackprof_opts) { out = @app.call env }
Thread.new do
+ iseq = RubyVM::InstructionSequence::of @app.method(:call)
+ profile[:suggested_rebase] = iseq.object_id
profile[:name] = Rack::Request.new(env).fullpath
url = URI::parse ui_url
|
Send along suggested stack rebase
|
diff --git a/app/models/gobierto_data/connection.rb b/app/models/gobierto_data/connection.rb
index abc1234..def5678 100644
--- a/app/models/gobierto_data/connection.rb
+++ b/app/models/gobierto_data/connection.rb
@@ -9,14 +9,18 @@ class << self
def execute_query(site, query)
base_connection_config = connection_config
- return null_query unless (db_config = site&.gobierto_data_settings&.db_config).present?
+ return null_query unless (db_conf = db_config(site)).present?
- establish_connection(db_config)
+ establish_connection(db_conf)
connection.execute(query)
rescue ActiveRecord::StatementInvalid => e
failed_query(e.message)
ensure
establish_connection(base_connection_config)
+ end
+
+ def db_config(site)
+ site&.gobierto_data_settings&.db_config
end
private
|
Define db_config class method with site argument in GobiertoData::Connection
|
diff --git a/lib/vault/storage/yaml_store.rb b/lib/vault/storage/yaml_store.rb
index abc1234..def5678 100644
--- a/lib/vault/storage/yaml_store.rb
+++ b/lib/vault/storage/yaml_store.rb
@@ -8,30 +8,39 @@
delegate :[], :[]=, :size, :each, :delete, :to => :doc
- def initialize(file=nil, contents=ActiveSupport::OrderedHash.new)
+ def initialize(file=nil)
@file = file
+ at_exit { flush if @file.present? }
+ end
- if @file.nil?
- @doc = contents
- else
- at_exit { flush }
- end
+ def initialize_copy(*)
+ @file = nil
end
def filter(query)
- filtered = doc.inject(ActiveSupport::OrderedHash.new) do |result, (key, properties)|
+ results = doc.inject(ActiveSupport::OrderedHash.new) do |result, (key, properties)|
result[key] = properties if Set.new(properties).superset?(Set.new(query))
result
end
- self.class.new(nil, filtered)
+ filtered_copy(results)
end
def flush
File.open(@file, "w+") {|f| YAML.dump(@doc, f) }
end
+ protected
+
+ def doc=(doc)
+ @doc = doc
+ end
+
private
+
+ def filtered_copy(doc)
+ dup.tap {|store| store.doc = doc }
+ end
def doc
@doc ||= ActiveSupport::OrderedHash.new(YAML.load_file(@file))
|
Clean up the implementation of YamlStore a bit
|
diff --git a/lib/zensana/services/zendesk.rb b/lib/zensana/services/zendesk.rb
index abc1234..def5678 100644
--- a/lib/zensana/services/zendesk.rb
+++ b/lib/zensana/services/zendesk.rb
@@ -3,7 +3,7 @@ module Zensana
class Zendesk
include HTTMultiParty
- default_timeout 10
+ default_timeout 20
#debug_output
def self.inst
|
Extend timeout on ZenDesk calls
|
diff --git a/lib/erbtex.rb b/lib/erbtex.rb
index abc1234..def5678 100644
--- a/lib/erbtex.rb
+++ b/lib/erbtex.rb
@@ -1,7 +1,6 @@ #! /usr/bin/env ruby
require 'bundler/setup'
-Bundler.require
require 'erubis'
require 'pry'
|
Remove unneeded Budler.require from main lib file.
|
diff --git a/lib/contextio.rb b/lib/contextio.rb
index abc1234..def5678 100644
--- a/lib/contextio.rb
+++ b/lib/contextio.rb
@@ -6,3 +6,4 @@
require_relative 'contextio/api_resource'
require_relative 'contextio/email_settings'
+require_relative 'contextio/connect_token'
|
Make sure connect tokens are included in gem.
|
diff --git a/lib/rantly.rb b/lib/rantly.rb
index abc1234..def5678 100644
--- a/lib/rantly.rb
+++ b/lib/rantly.rb
@@ -5,7 +5,6 @@ end
require 'rantly/generator'
-require 'rantly/shrinks'
def Rantly(n=1,&block)
if n > 1
|
Make shrink's monkey patching opt-in
|
diff --git a/csstats.gemspec b/csstats.gemspec
index abc1234..def5678 100644
--- a/csstats.gemspec
+++ b/csstats.gemspec
@@ -4,19 +4,21 @@ require 'csstats/version'
Gem::Specification.new do |gem|
- gem.name = "csstats"
+ gem.name = 'csstats'
gem.version = CSstats::VERSION
- gem.authors = ["Justas Palumickas"]
- gem.email = ["[email protected]"]
- gem.homepage = "https://github.com/jpalumickas/csstats/"
+ gem.author = 'Justas Palumickas'
+ gem.email = '[email protected]'
+ gem.homepage = 'https://github.com/jpalumickas/csstats/'
gem.summary = gem.description
gem.description = %q{ Gem which handle csstats.dat file generated by CSX module in AMX Mod X (http://www.amxmodx.org/) }
gem.license = 'MIT'
+ gem.required_ruby_version = '>= 1.9.2'
+
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.require_paths = ['lib']
gem.add_dependency 'hashie', '~> 2.0'
gem.add_development_dependency 'bundler', '~> 1.0'
|
Add required ruby version into gemspec
|
diff --git a/lib/nehm/menu.rb b/lib/nehm/menu.rb
index abc1234..def5678 100644
--- a/lib/nehm/menu.rb
+++ b/lib/nehm/menu.rb
@@ -45,7 +45,7 @@
def select
newline
- choice('e', 'Exit'.red) { raise Interrupt }
+ choice('e', 'Exit'.red) { UI.term }
# Output items
@items.each do |item|
|
Use UI.term instead of Interrupt in 'configure'
|
diff --git a/lib/needs_csv.rb b/lib/needs_csv.rb
index abc1234..def5678 100644
--- a/lib/needs_csv.rb
+++ b/lib/needs_csv.rb
@@ -4,12 +4,15 @@ class NeedsCsv < CsvRenderer
def to_csv
CSV.generate do |csv|
- csv << ["Id", "Lead department", "Priority", "Title", "Format", "Tags", "Context", "Status", "Updated at", "Statutory", "Fact checker", "Writing dept", "Interaction", "Related needs"]
+ csv << ["Id", "Lead department", "Priority", "Title", "Format", "Tags", "Context", "Status", "Updated at", "Statutory", "Fact checker", "Writing dept", "Interaction", "Related needs", "Reason for formatting decision", "Reason for decision", "DG Links", "Existing Services"]
@data.each do |need|
csv << [need.id, need.accountabilities_for_csv, need.named_priority, need.title, need.kind.to_s, need.tag_list,
need.description, need.status, need.updated_at.to_formatted_s(:db),
need.statutory, need.fact_checkers_for_csv, need.writing_department.to_s,
- need.interaction, need.related_needs]
+ need.interaction, need.related_needs, need.reason_for_formatting_decision,
+ need.reason_for_decision, need.directgov_links.collect(&:directgov_id).join(','),
+ need.existing_services.collect(&:url).join(',')
+ ]
end
end
end
|
Add reasoning, dg links and existing services to CSV export
|
diff --git a/croudia.gemspec b/croudia.gemspec
index abc1234..def5678 100644
--- a/croudia.gemspec
+++ b/croudia.gemspec
@@ -16,6 +16,8 @@ gem.version = Croudia::VERSION
gem.add_dependency 'mechanize', '~> 2.5.1'
+ gem.add_development_dependency 'rake', '~> 0.9.2.2'
+ gem.add_development_dependency 'rdoc', '~> 3.11'
gem.add_development_dependency 'rspec', '~> 2.10.1'
gem.add_development_dependency 'webmock', '~> 1.8.7'
end
|
Add rake & rdoc to development dependency
|
diff --git a/lib/pg_search.rb b/lib/pg_search.rb
index abc1234..def5678 100644
--- a/lib/pg_search.rb
+++ b/lib/pg_search.rb
@@ -12,15 +12,10 @@
module ClassMethods
def pg_search_scope(name, options)
- scope = PgSearch::Scope.new(name, self, options)
- scope_method =
- if respond_to?(:scope) && !protected_methods.include?('scope')
- :scope # ActiveRecord 3.x
- else
- :named_scope # ActiveRecord 2.x
- end
-
- send(scope_method, name, scope.to_proc)
+ self.scope(
+ name,
+ PgSearch::Scope.new(name, self, options).to_proc
+ )
end
end
|
Remove conditional logic around Active Record 2 named_scope.
|
diff --git a/lib/poper/cli.rb b/lib/poper/cli.rb
index abc1234..def5678 100644
--- a/lib/poper/cli.rb
+++ b/lib/poper/cli.rb
@@ -16,6 +16,9 @@
def run(commit)
Runner.new(commit).run.each do |message|
+ # message.commit and message.message are Strings
+ # prints first 7 characteres of the commit sha1 hash
+ # followed by the associated message
puts "#{message.commit[0..6]}: #{message.message}"
end
end
|
Add a comment to clarify a piece of code
|
diff --git a/lib/repos/cli.rb b/lib/repos/cli.rb
index abc1234..def5678 100644
--- a/lib/repos/cli.rb
+++ b/lib/repos/cli.rb
@@ -38,7 +38,7 @@ if options[:verbose]
Dir.chdir repository do
system 'git status'
- system 'git stash list'
+ system 'git stash --no-pager list'
puts
end
end
|
Fix an issue with --verbose by disabling the pager for git stash
|
diff --git a/dummy/spec/models/story_spec.rb b/dummy/spec/models/story_spec.rb
index abc1234..def5678 100644
--- a/dummy/spec/models/story_spec.rb
+++ b/dummy/spec/models/story_spec.rb
@@ -1,4 +1,7 @@ require 'spec_helper'
+
+class ChildStory < Story
+end
describe Product do
describe 'member methods' do
@@ -6,6 +9,7 @@ it 'principally works' do
subject = FactoryGirl.create(:story)
subject.activate!
+ ChildStory.create!(name: 'Dummy', project_id: subject.project_id, offeror_id: subject.offeror_id, text: 'Dummy')
user = FactoryGirl.create(:user)
next_task = subject.next_task_for_user(user)
|
Test that not a child story is considered at Product.stories('no-name', user) call.
|
diff --git a/spec/controllers/friendships_controller_spec.rb b/spec/controllers/friendships_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/friendships_controller_spec.rb
+++ b/spec/controllers/friendships_controller_spec.rb
@@ -0,0 +1,28 @@+require 'spec_helper'
+
+describe FriendshipsController do
+ describe "POST #create" do
+ let(:user) { FactoryGirl.create :user }
+ let(:user_two) { FactoryGirl.create :user }
+ it "adds user_two as a friend of user" do
+ session[:user_id] = user.id
+ post :create, id: user_two.id
+ expect(user.friends.first).to eq(user_two)
+ end
+
+ it "adds user as a friend of user_two" do
+ session[:user_id] = user.id
+ post :create, id: user_two.id
+ expect(user_two.friends.first).to eq(user)
+ end
+
+ it "redirects to the appropriate user's profile" do
+ session[:user_id] = user.id
+ post :create, id: user_two.id
+ expect(response).to redirect_to(user_two)
+ end
+ end
+
+ describe "DELETE #destroy" do
+ end
+end
|
Add tests for friendship creation
|
diff --git a/route.rb b/route.rb
index abc1234..def5678 100644
--- a/route.rb
+++ b/route.rb
@@ -1,4 +1,8 @@-# cities = [[1, 2], [3, 4], [8, 7], [10, 12], [2, 4]]
+# cities = [
+# [[1, 2], [3, 4], [8, 7], [10, 12], [2, 4]],
+# [[1, 2], [3, 4], [8, 7], [10, 12], [2, 4]],
+# ...
+#]
class TSP
@@ -6,17 +10,17 @@
def initialize(cities)
@cities = cities
+ @combinations = cities.permutation.to_a
end
- def get_total
+ def get_total(combination)
counter = 1
- total = get_distance([0, 0], cities[0])
- until counter == cities.length
- p total
- total += get_distance(cities[counter - 1], cities[counter])
+ total = get_distance([0, 0], combination[0])
+ until counter == combination.length
+ total += get_distance(combination[counter - 1], combination[counter])
counter += 1
end
- total + get_distance([0,0], cities[-1])
+ total + get_distance([0,0], combination[-1])
end
def get_distance(point_a, point_b)
@@ -25,18 +29,16 @@ Math.hypot(x_diff, y_diff)
end
- def all_possible_route_configurations
- # build a collection of all possible orders for given points
+ def route
+ @combinations.min_by do |route|
+ get_total(route)
+ end
end
- def find_best_route
- # map over collection of possible routes with the get total distance function.
- # return shortest distance.
+ def dist
+ get_total(route)
end
end
-cities = [[1, 2], [3, 4], [8, 7], [10, 12], [2, 4]]
-tsp = TSP.new(cities)
-p tsp.get_total
|
Add solution to pass all tests
|
diff --git a/db/migrate/20140324144244_copy_artefact_need_id_to_array_field_need_ids.rb b/db/migrate/20140324144244_copy_artefact_need_id_to_array_field_need_ids.rb
index abc1234..def5678 100644
--- a/db/migrate/20140324144244_copy_artefact_need_id_to_array_field_need_ids.rb
+++ b/db/migrate/20140324144244_copy_artefact_need_id_to_array_field_need_ids.rb
@@ -0,0 +1,12 @@+class CopyArtefactNeedIdToArrayFieldNeedIds < Mongoid::Migration
+ def self.up
+ artefacts_with_need_id = Artefact.where(:need_id.exists => true, :need_id.nin => ["", nil])
+ artefacts_with_need_id.each do |artefact|
+ artefact.set(:need_ids, [artefact.need_id])
+ end
+ end
+
+ def self.down
+ Artefact.where(:need_ids.exists => true).update_all(:need_ids => [])
+ end
+end
|
Migrate existing need_ids to Array field `need_ids`
|
diff --git a/lib/acfs/model.rb b/lib/acfs/model.rb
index abc1234..def5678 100644
--- a/lib/acfs/model.rb
+++ b/lib/acfs/model.rb
@@ -20,7 +20,7 @@ include ActiveModel::Conversion
include ActiveModel::Validations
- require 'model/initialization'
+ require 'acfs/model/initialization'
include Model::Initialization
end
|
Fix require bug on rails 3.2.
|
diff --git a/provider/vendor/plugins/oauth2_provider/lib/oauth2/provider/ssl_helper.rb b/provider/vendor/plugins/oauth2_provider/lib/oauth2/provider/ssl_helper.rb
index abc1234..def5678 100644
--- a/provider/vendor/plugins/oauth2_provider/lib/oauth2/provider/ssl_helper.rb
+++ b/provider/vendor/plugins/oauth2_provider/lib/oauth2/provider/ssl_helper.rb
@@ -6,7 +6,7 @@ module SslHelper
def self.included(controller_class)
- controller_class.before_filter :mandatory_ssl
+ controller_class.before_filter :mandatory_ssl unless ENV['DISABLE_OAUTH_SSL']
end
protected
|
Add ability to disable SSL validation on controllers.
|
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -10,7 +10,7 @@
def index
@courses = apply_scopes(Course.accessible_by(current_user)).paginate(
- page: params[:page],
+ page: params[:page].present? ? params[:page] : 1,
per_page: 9
)
end
|
Fix courses pagination when 'page' param is empty
|
diff --git a/app/controllers/explore_controller.rb b/app/controllers/explore_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/explore_controller.rb
+++ b/app/controllers/explore_controller.rb
@@ -6,15 +6,15 @@ @licenses = Project.popular_licenses(:facet_limit => 40).first(10)
project_scope = Project.includes(:repository).maintained.with_description
-
- @trending_projects = project_scope.recently_created.hacker_news.limit(10).to_a.uniq(&:name).first(6)
- @new_projects = project_scope.order('projects.created_at desc').limit(6)
+
+ @trending_projects = project_scope.recently_created.hacker_news.limit(20).to_a.uniq(&:name).first(10)
+ @new_projects = project_scope.order('projects.created_at desc').limit(10)
end
private
helper_method :project_search
def project_search(sort)
- Project.search('', sort: sort, order: 'desc').paginate(per_page: 6, page: 1).results.map{|result| ProjectSearchResult.new(result) }
+ Project.search('', sort: sort, order: 'desc').paginate(per_page: 10, page: 1).results.map{|result| ProjectSearchResult.new(result) }
end
end
|
Load 10 projects per list on explore page
|
diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/welcome_controller.rb
+++ b/app/controllers/welcome_controller.rb
@@ -19,7 +19,9 @@ end
# Show the response in an appropriate form.
- render :json => response.body
+ render :json => response.body # <-- Nice way to debug.
+
+ # @world = response.body
end
end
|
Update option to render reponse as JSON or instance variable
|
diff --git a/spec/controllers/comments_controller_spec.rb b/spec/controllers/comments_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/comments_controller_spec.rb
+++ b/spec/controllers/comments_controller_spec.rb
@@ -7,8 +7,9 @@ context "GET #new" do
it "assigns a new comment to @comment" do
- # get :new
- # expect(assigns(:comment)).to eq(Comment.last)
+ stub_authorize_user!
+ get :new
+ expect(assigns(:comment)).to eq(Comment.last)
end
end
|
Add authorize user to tests
|
diff --git a/core/db/default/spree/stores.rb b/core/db/default/spree/stores.rb
index abc1234..def5678 100644
--- a/core/db/default/spree/stores.rb
+++ b/core/db/default/spree/stores.rb
@@ -3,7 +3,7 @@ Spree::Store.new do |s|
s.code = 'spree'
s.name = 'Spree Demo Site'
- s.url = 'demo.spreecommerce.com'
+ s.url = 'example.com'
s.mail_from_address = '[email protected]'
end.save!
end
|
Change the default canonical URL for a store to example.com
[Fixes #5674]
|
diff --git a/ec2list.gemspec b/ec2list.gemspec
index abc1234..def5678 100644
--- a/ec2list.gemspec
+++ b/ec2list.gemspec
@@ -19,8 +19,8 @@ spec.require_paths = ["lib"]
spec.add_runtime_dependency "aws_config"
- spec.add_runtime_dependency "aws-sdk"
- spec.add_runtime_dependency "slop"
+ spec.add_runtime_dependency "aws-sdk", "~> 1.0"
+ spec.add_runtime_dependency "slop", "~> 3.0"
spec.add_development_dependency "bundler", "~> 1.5"
spec.add_development_dependency "rake"
end
|
Add build constraint for aws-sdk and slop
|
diff --git a/app/lib/api_entreprise/rna_adapter.rb b/app/lib/api_entreprise/rna_adapter.rb
index abc1234..def5678 100644
--- a/app/lib/api_entreprise/rna_adapter.rb
+++ b/app/lib/api_entreprise/rna_adapter.rb
@@ -6,9 +6,11 @@ end
def process_params
- # Responses with a 206 codes are sometimes not useable,
- # as the RNA calls often return a 206 with an error message,
- # not a partial response
+ # Sometimes the associations endpoints responses with a 206,
+ # and these response are often useable as the they only
+ # contain an error message.
+ # Therefore here we make sure that our response seems valid
+ # by checking that there is an association attribute.
if !data_source.key?(:association)
{}
else
|
Improve a comment in RNAAdapter
|
diff --git a/spec/views/admissions/index.html.erb_spec.rb b/spec/views/admissions/index.html.erb_spec.rb
index abc1234..def5678 100644
--- a/spec/views/admissions/index.html.erb_spec.rb
+++ b/spec/views/admissions/index.html.erb_spec.rb
@@ -1,4 +1,7 @@ require 'rails_helper'
RSpec.describe "admissions/index", type: :view do
+ it "shows a + when a result has matching history numbers" do
+ pending ## sunspot testing
+ end
end
|
Add pending test for Sunspot-dependent feature
|
diff --git a/lib/faker/role.rb b/lib/faker/role.rb
index abc1234..def5678 100644
--- a/lib/faker/role.rb
+++ b/lib/faker/role.rb
@@ -8,7 +8,7 @@ end
def by_index i
- all_values.fetch(i) { require 'pry'; binding.pry }
+ all_values.fetch(i) { raise NotEnoughRoles, "You only have #{i} roles defined, and you tried to access number #{i+1}!" }
end
private
@@ -18,4 +18,6 @@ end
end
end
+
+ class NotEnoughRoles < StandardError; end
end
|
Remove random pry in Faker::Role
|
diff --git a/spec/fc-reminder/providers/base_spec.rb b/spec/fc-reminder/providers/base_spec.rb
index abc1234..def5678 100644
--- a/spec/fc-reminder/providers/base_spec.rb
+++ b/spec/fc-reminder/providers/base_spec.rb
@@ -18,7 +18,7 @@ end
describe "#run" do
- let(:team_name) { "Barcelona" }
+ let(:team_name) { "Team Name" }
it { expect(provider.run(team_name)).to be_instance_of(Hash) }
it { expect(provider.run(team_name)).to be_empty }
|
Use more generic team name
|
diff --git a/models/player.rb b/models/player.rb
index abc1234..def5678 100644
--- a/models/player.rb
+++ b/models/player.rb
@@ -45,6 +45,10 @@
def self.authorize(name, pass)
p = self.find_by_name(name)
- p && p.password == pass
+ if p && p.password == pass
+ p
+ else
+ nil
+ end
end
end
|
Modify to Player::authorize return the Player object.
|
diff --git a/app/services/delete_branch_service.rb b/app/services/delete_branch_service.rb
index abc1234..def5678 100644
--- a/app/services/delete_branch_service.rb
+++ b/app/services/delete_branch_service.rb
@@ -0,0 +1,42 @@+class DeleteBranchService
+ def execute(project, branch_name, current_user)
+ repository = project.repository
+ branch = repository.find_branch(branch_name)
+
+ # No such branch
+ unless branch
+ return error('No such branch')
+ end
+
+ # Dont allow remove of protected branch
+ if project.protected_branch?(branch_name)
+ return error('Protected branch cant be removed')
+ end
+
+ # Dont allow user to remove branch if he is not allowed to push
+ unless current_user.can?(:push_code, project)
+ return error('You dont have push access to repo')
+ end
+
+ if repository.rm_branch(branch_name)
+ Event.create_ref_event(project, current_user, branch, 'rm')
+ success('Branch was removed')
+ else
+ return error('Failed to remove branch')
+ end
+ end
+
+ def error(message)
+ {
+ message: message,
+ state: :error
+ }
+ end
+
+ def success(message)
+ {
+ message: message,
+ state: :success
+ }
+ end
+end
|
Delete branch service with permission checks
Signed-off-by: Dmitriy Zaporozhets <[email protected]>
|
diff --git a/vignette.gemspec b/vignette.gemspec
index abc1234..def5678 100644
--- a/vignette.gemspec
+++ b/vignette.gemspec
@@ -17,11 +17,11 @@ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ["lib"]
- gem.add_dependency "activesupport"
- gem.add_dependency "actionpack"
+ gem.add_dependency "activesupport", ">= 3.0"
+ gem.add_dependency "actionpack", ">= 3.0"
- gem.add_development_dependency "rspec"
- gem.add_development_dependency "guard-rspec"
- gem.add_development_dependency "haml"
- gem.add_development_dependency "pry-byebug"
+ gem.add_development_dependency "rspec", ">= 3.2.0"
+ gem.add_development_dependency "guard-rspec", ">= 4.5.0"
+ gem.add_development_dependency "haml", ">= 4.0.6"
+ gem.add_development_dependency "pry-byebug", ">= 0"
end
|
Add versioning for dependency gems
|
diff --git a/app/helpers/mailpenny_helper.rb b/app/helpers/mailpenny_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/mailpenny_helper.rb
+++ b/app/helpers/mailpenny_helper.rb
@@ -2,9 +2,16 @@ private
# Returns the profile for the specified user
- # @param [user] the user whose profile path is required
+ # @param user [User] the user whose profile path is required
# @return [String] absolute path to the user's profile page
def user_profile_path(user)
"/#{user.username}"
end
+
+ # Return the number of messages unread for the user
+ # @param user [User] the user whose unread count you want
+ # @return [Integer] the number of conversations still unread for this user
+ def unread_count_for(user)
+ user.conversations.select { |c| !c.read_by? user }.count
+ end
end
|
Define a helper to count unread messages
|
diff --git a/railties/helpers/application.rb b/railties/helpers/application.rb
index abc1234..def5678 100644
--- a/railties/helpers/application.rb
+++ b/railties/helpers/application.rb
@@ -2,4 +2,5 @@ # Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
+ helper :all # include all helpers, all the time
end
|
Make it a default assumption that you want all helpers, all the time (yeah, yeah)
git-svn-id: afc9fed30c1a09d8801d1e4fbe6e01c29c67d11f@6222 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
|
diff --git a/railties/lib/commands/runner.rb b/railties/lib/commands/runner.rb
index abc1234..def5678 100644
--- a/railties/lib/commands/runner.rb
+++ b/railties/lib/commands/runner.rb
@@ -20,11 +20,8 @@ opts.parse!
end
-if defined?(RAILS_ENV)
- RAILS_ENV.replace(options[:environment])
-else
- ENV["RAILS_ENV"] = options[:environment]
-end
+ENV["RAILS_ENV"] = options[:environment]
+RAILS_ENV.replace(options[:environment]) if defined?(RAILS_ENV)
require RAILS_ROOT + '/config/environment'
eval(ARGV.first)
|
Make sure ENV['RAILS_ENV'] and RAILS_ENV are kept in sync
git-svn-id: afc9fed30c1a09d8801d1e4fbe6e01c29c67d11f@2539 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.