templates/rake.erb in cukedep-0.1.11 vs templates/rake.erb in cukedep-0.2.00

- old
+ new

@@ -49,27 +49,26 @@ ####################################### # Retrieving state at end of Cukedep::Application#run! method ####################################### # Constant holding the location of the original feature files -SOURCE_DIR = '<%=source_dir%>' +SOURCE_DIR = '<%=source_dir%>'.freeze # Constant holding the location of the Cucumber project -CUKE_PROJECT = '<%=proj_dir%>' +CUKE_PROJECT = '<%=proj_dir%>'.freeze # The list of all "legacy" feature file # (feature files without the @feature: tag) AllUnidentifiedFeatures = [<%anonymous_list = anonymous.map {|nm| "'#{nm}'"}%> - <%=anonymous_list.join(",\n ")%> -] + <%=anonymous_list.join("\n ")%> +].freeze # The list of all encountered feature ids -AllFeatureIdentifiers = [ <%identifier_list = feature_ids.map {|fid| ":#{fid}"}%> - <%=identifier_list.join(",\n ")%> -] +AllFeatureIdentifiers = %I[<%identifier_list = feature_ids.map {|fid| "#{fid}"}%> + <%=identifier_list.join("\n ")%> +].freeze - def run_builtin_actions(anEvent) actions = Cukedep::ActionTriplet.builtin(anEvent) actions.run!(SOURCE_DIR, CUKE_PROJECT) unless actions.nil? end @@ -93,16 +92,15 @@ 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, # copy them into the source dir. def copy_from_project(*filenames) filenames.each do |fname| - source_path = project_path_of(fname) + source_path = project_path_of(fname) dest_path = source_path_of(fname) FileUtils.copy_file(source_path, dest_path) end end @@ -115,16 +113,15 @@ 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 # in the appropriate folder. def invoke_cuke(projectDir) curr_dir = Dir.getwd @@ -136,11 +133,10 @@ ensure Dir.chdir(curr_dir) end end - def process_files(filenames) run_builtin_actions(:before_each) copy_to_project(filenames) invoke_cuke(CUKE_PROJECT) run_builtin_actions(:after_each) @@ -149,40 +145,35 @@ def process_a_feature(filename) process_files([filename]) end - # Default rake task is also top-level task task default: :run_all_features - desc 'Run all features' -task run_all_features: [:before_all, :all_features, :after_all] do - ; # Do nothing +task run_all_features: %I[before_all all_features after_all] do end - desc 'Before all' task :before_all do run_builtin_actions(:before_all) end desc 'After_all' task :after_all do run_builtin_actions(:after_all) end - task :unidentified do process_files(AllUnidentifiedFeatures) end # Tasks for feature files involved in dependencies <%deps.each do |dep|%> -<%dep_list = dep.dependents.map { |ff| ":#{ff.feature.identifier}" } %> +<%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 +task <%= dep_list.empty? ? ':' + dep.dependee.feature.identifier : dep.dependee.feature.identifier + ':'%><%= dep_list.empty? ? '' : %Q| %I[#{dep_list.join(' ')}]| %> do process_a_feature('<%=dep.dependee.basename%>') end <%end%> task all_features: ([:unidentified] + AllFeatureIdentifiers) do