templates/rake.erb in cukedep-0.1.10 vs templates/rake.erb in cukedep-0.1.11
- old
+ new
@@ -15,31 +15,37 @@
if development_env
rel_path = cukedep_dir.relative_path_from(rake_dir)%>
# Use development codebase
require_relative '<%=rel_path.to_s + '/lib/cukedep/file-action'%>'
<% else%>
-require 'cukedep/file-action'
+require 'cukedep/file-action'
<% end%>
# Run Cucumber via specialized Rake task
require 'cucumber/rake/task'
# UGLY workaround for bug in Cucumber's rake task
if Gem::VERSION[0].to_i >= 2 && Cucumber::VERSION <= '1.3.2'
# Monkey-patch a buggy method
- class Cucumber::Rake::Task::ForkedCucumberRunner
- def gem_available?(gemname)
- if Gem::VERSION[0].to_i >= 2
- gem_available_new_rubygems?(gemname)
- else
- gem_available_old_rubygems?(gemname)
+ module Cucumber
+ module Rake
+ module Task
+ class ForkedCucumberRunner
+ def gem_available?(gemname)
+ if Gem::VERSION[0].to_i >= 2
+ gem_available_new_rubygems?(gemname)
+ else
+ gem_available_old_rubygems?(gemname)
+ end
+ end
+ end
end
- end
+ end
end # class
end
# Create a task called cucumber
-Cucumber::Rake::Task.new do |t|
+Cucumber::Rake::Task.new do |_|
end
#######################################
# Retrieving state at end of Cukedep::Application#run! method
#######################################
@@ -48,17 +54,18 @@
SOURCE_DIR = '<%=source_dir%>'
# Constant holding the location of the Cucumber project
CUKE_PROJECT = '<%=proj_dir%>'
-# The list of all "legacy" feature file (feature files without the @feature: tag)
-AllUnidentifiedFeatures = [<%anonymous_list = anonymous.map { |name| "'#{name}'"}%>
+# The list of all "legacy" feature file
+# (feature files without the @feature: tag)
+AllUnidentifiedFeatures = [<%anonymous_list = anonymous.map {|nm| "'#{nm}'"}%>
<%=anonymous_list.join(",\n ")%>
]
-
+
# The list of all encountered feature ids
-AllFeatureIdentifiers = [ <%identifier_list = feature_ids.map {|f_id| ":#{f_id}"}%>
+AllFeatureIdentifiers = [ <%identifier_list = feature_ids.map {|fid| ":#{fid}"}%>
<%=identifier_list.join(",\n ")%>
]
def run_builtin_actions(anEvent)
@@ -76,53 +83,53 @@
# if it is located in the project features dir.
def project_path_of(aFilename)
CUKE_PROJECT + '/features/' + aFilename
end
-# Helper method. Given the name of files in the source dir, copy them
+# Helper method. Given the name of files in the source dir, copy them
# into the project dir.
def copy_to_project(filenames)
filenames.each do |fname|
source_path = source_path_of(fname)
dest_path = project_path_of(fname)
FileUtils.copy_file(source_path, dest_path)
end
end
-# Helper method. Given the name of files in the features dir of the project,
+# Helper method. Given the name of files in the features dir of the project,
# copy them into the source dir.
def copy_from_project(*filenames)
filenames.each do |fname|
source_path = project_path_of(fname)
dest_path = source_path_of(fname)
FileUtils.copy_file(source_path, dest_path)
end
end
-# Helper method. Delete all the files in the
-# the project's features dir that match one of
+# Helper method. Delete all the files in the
+# the project's features dir that match one of
# the file name pattern
def clean_project_dir(fname_patterns)
- curr_dir = Dir.getwd()
+ curr_dir = Dir.getwd
begin
Dir.chdir(CUKE_PROJECT + '/features')
fname_patterns.each do |patt|
filenames = Dir.glob(patt)
filenames.each { |fn| FileUtils.remove_file(fn) }
end
- ensure #Always restore previous working dir.
+ ensure # Always restore previous working dir.
Dir.chdir(curr_dir)
end
end
# Helper method. Invoke Cucumber with the given project root dir.
-# Assumption: all features files to execute are placed
+# Assumption: all features files to execute are placed
# in the appropriate folder.
def invoke_cuke(projectDir)
- curr_dir = Dir.getwd()
+ curr_dir = Dir.getwd
Dir.chdir(projectDir)
begin
do_cuke = Rake::Task[:cucumber]
do_cuke.reenable
do_cuke.invoke
@@ -135,29 +142,29 @@
def process_files(filenames)
run_builtin_actions(:before_each)
copy_to_project(filenames)
invoke_cuke(CUKE_PROJECT)
run_builtin_actions(:after_each)
- #del_from_project(filenames)
+ # del_from_project(filenames)
end
def process_a_feature(filename)
process_files([filename])
end
# Default rake task is also top-level task
-task :default => :run_all_features
+task default: :run_all_features
desc 'Run all features'
-task :run_all_features => [:before_all, :all_features, :after_all] do
+task run_all_features: [:before_all, :all_features, :after_all] do
; # Do nothing
end
-desc 'Before all'
+desc 'Before all'
task :before_all do
run_builtin_actions(:before_all)
end
desc 'After_all'
@@ -171,15 +178,15 @@
end
# Tasks for feature files involved in dependencies
<%deps.each do |dep|%>
<%dep_list = dep.dependents.map { |ff| ":#{ff.feature.identifier}" } %>
-desc "<%=dep.dependee.feature.identifier%>: run <%=dep.dependee.basename%>"
-task :<%=dep.dependee.feature.identifier%> <%= dep_list.empty? ? '' : %Q|=> [#{dep_list.join(', ') }]| %> do
+desc '<%=dep.dependee.feature.identifier%>: run <%=dep.dependee.basename%>'
+task <%=dep.dependee.feature.identifier%><%= dep_list.empty? ? '' : %Q|: [#{dep_list.join(', ') }]| %> do
process_a_feature('<%=dep.dependee.basename%>')
end
<%end%>
-task :all_features => ([:unidentified] + AllFeatureIdentifiers) do
+task all_features: ([:unidentified] + AllFeatureIdentifiers) do
end
-# End of file
\ No newline at end of file
+# End of file