Permalink
Browse files

Reformat comments and source for legibility

  • Loading branch information...
1 parent 9a13e93 commit 056a24af4a424b00efc72b459786e0ed3732f5f3 @njonsson committed Nov 29, 2012
Showing with 31 additions and 16 deletions.
  1. +2 −2 README.markdown
  2. +1 −0 lib/cape/core_ext/hash.rb
  3. +1 −0 lib/cape/core_ext/symbol.rb
  4. +13 −6 lib/cape/dsl.rb
  5. +7 −4 lib/cape/rake.rb
  6. +2 −0 lib/cape/util.rb
  7. +4 −2 spec/cape/rake_spec.rb
  8. +1 −2 spec/spec_helper.rb
View
@@ -156,8 +156,8 @@ Cape lets you filter the Rake tasks to be mirrored. Note that Cape statements mu
require 'cape'
Cape do
- # Create Capistrano recipes for the Rake task 'foo' and/or for the tasks in the
- # 'foo' namespace.
+ # Create Capistrano recipes for the Rake task 'foo' and/or for the tasks in
+ # the 'foo' namespace.
mirror_rake_tasks :foo
end
@@ -9,6 +9,7 @@ module Hash
# _keys_.
#
# @param [Array] keys zero or more hash keys
+ #
# @return [Hash] a subset of the Hash
def slice(*keys)
::Hash[select { |key, value| keys.include? key }]
@@ -8,6 +8,7 @@ module Symbol
# Compares the String representation of the Symbol to that of another.
#
# @param [Symbol] other
+ #
# @return [0] the Symbol is equal to _other_
# @return [-1] the Symbol is lesser than _other_
# @return [1] the Symbol is greater than _other_
View
@@ -27,7 +27,8 @@ module DSL
# # Do something interesting with this hash:
# # * t[:name] -- the full name of the task
# # * t[:parameters] -- the names of task arguments
- # # * t[:description] -- documentation on the task, including parameters
+ # # * t[:description] -- documentation on the task, including
+ # # parameters
# end
# end
#
@@ -41,7 +42,8 @@ module DSL
# # Do something interesting with this hash:
# # * t[:name] -- the full name of the task
# # * t[:parameters] -- the names of task arguments
- # # * t[:description] -- documentation on the task, including parameters
+ # # * t[:description] -- documentation on the task, including
+ # # parameters
# end
# end
def each_rake_task(task_expression=nil, &block)
@@ -61,14 +63,16 @@ def local_rake_executable
# Sets the command used to run Rake on the local computer.
#
# @param [String] value the command used to run Rake on the local computer
+ #
# @return [String] _value_
#
# @example Changing the local Rake executable
# require 'cape'
#
# Cape do
# self.local_rake_executable = '/path/to/rake'
- # $stdout.puts "We changed the local Rake executable to #{self.local_rake_executable.inspect}."
+ # $stdout.puts 'We changed the local Rake executable to ' +
+ # "#{local_rake_executable.inspect}."
# end
def local_rake_executable=(value)
rake.local_executable = value
@@ -80,6 +84,7 @@ def local_rake_executable=(value)
# @param [Symbol, String] method the method called
# @param [Array] args the arguments passed to _method_
# @param [Proc] block the block passed to _method_
+ #
# @return the result of the forwarded method call
def method_missing(method, *args, &block)
@outer_self.send(method, *args, &block)
@@ -187,8 +192,8 @@ def mirror_rake_tasks(*arguments, &block)
options = arguments.last.is_a?(Hash) ? arguments.pop.dup : {}
unless arguments.length <= 1
raise ::ArgumentError,
- "wrong number of arguments (#{arguments_count} for 0 or 1, plus " +
- 'an options hash)'
+ ("wrong number of arguments (#{arguments_count} for 0 or 1, " +
+ 'plus an options hash)')
end
task_expression = arguments.first
@@ -211,14 +216,16 @@ def remote_rake_executable
# Sets the command used to run Rake on remote computers.
#
# @param [String] value the command used to run Rake on remote computers
+ #
# @return [String] _value_
#
# @example Changing the remote Rake executable
# require 'cape'
#
# Cape do
# self.remote_rake_executable = '/path/to/rake'
- # $stdout.puts "We changed the remote Rake executable to #{self.remote_rake_executable.inspect}."
+ # $stdout.puts 'We changed the remote Rake executable to ' +
+ # "#{remote_rake_executable.inspect}."
# end
def remote_rake_executable=(value)
rake.remote_executable = value
View
@@ -4,8 +4,8 @@ module Cape
class Rake
# The default command used to run Rake. We use `bundle check` to detect the
- # presence of Bundler and a Bundler configuration. If Bundler is installed
- # on the computer and configured, we prepend `rake` with `bundle exec`.
+ # presence of Bundler and a Bundler configuration. If Bundler is installed on
+ # the computer and configured, we prepend `rake` with `bundle exec`.
DEFAULT_EXECUTABLE = (
'/usr/bin/env ' +
'`' +
@@ -24,6 +24,7 @@ class Rake
# Sets the command used to run Rake on remote computers.
#
# @param [String] value the command used to run Rake on remote computers
+ #
# @return [String] _value_
attr_writer :remote_executable
@@ -37,6 +38,7 @@ def initialize(attributes={})
# Compares the Rake object to another.
#
# @param [Object] other another object
+ #
# @return [true] the Rake object is equal to _other_
# @return [false] the Rake object is unequal to _other_
def ==(other)
@@ -73,8 +75,8 @@ def each_task(task_expression=nil)
end
if previous_task
all_but_last_segment = this_task[:name].split(':')[0...-1].join(':')
- previous_task[:default] = (all_but_last_segment ==
- previous_task[:name])
+ previous_task[:default] = all_but_last_segment ==
+ previous_task[:name]
yield previous_task
end
end
@@ -101,6 +103,7 @@ def local_executable
# cached Rake task metadata.
#
# @param [String] value the command used to run Rake on the local computer
+ #
# @return [String] _value_
#
# @see #expire_cache!
View
@@ -7,6 +7,7 @@ module Util
#
# @param [String] singular_noun a singular noun
# @param [Fixnum] count the quantity of _singular_noun_; optional
+ #
# @return [String] the plural of _singular_noun_, unless _count_ is +1+
def self.pluralize(singular_noun, count=2)
return singular_noun if count == 1
@@ -17,6 +18,7 @@ def self.pluralize(singular_noun, count=2)
# Builds a list phrase from the elements of the specified _array_.
#
# @param [Array of String] array zero or more nouns
+ #
# @return [String] the elements of _array_, joined with commas and "and", as
# appropriate
def self.to_list_phrase(array)
View
@@ -29,8 +29,10 @@
describe '-- with specified attributes --' do
subject {
- described_class.new :local_executable => 'the specified value of #local_executable',
- :remote_executable => 'the specified value of #remote_executable'
+ described_class.new :local_executable => ('the specified value of ' +
+ '#local_executable'),
+ :remote_executable => ('the specified value of ' +
+ '#remote_executable')
}
its(:local_executable) {
View
@@ -1,4 +1,3 @@
RSpec.configure do |c|
- c.alias_it_should_behave_like_to :should_behave_like,
- 'should behave like'
+ c.alias_it_should_behave_like_to :should_behave_like, 'should behave like'
end

0 comments on commit 056a24a

Please sign in to comment.