Sha256: 767f72c32e3c1ac557aedebe5683c63380832c1f777d1167452c8749d900e370
Contents?: true
Size: 1.44 KB
Versions: 4
Compression:
Stored size: 1.44 KB
Contents
#!/usr/bin/env ruby # encoding: UTF-8 def create_feature_file(name) # options used to generate the file in the template function opts = { name: camelize(name) } # Feature file_path = File.join(FileUtils.pwd, 'features', 'specifications', "#{name.downcase}.feature") # Thor creates a file based on the templates/feature.tt template template('feature', file_path, opts) end def create_steps_file(name) # options used to generate the file in the template function opts = { name: camelize(name) } # Step file_path = File.join( FileUtils.pwd, 'features', 'steps_definitions', "#{name.downcase}_steps.rb" ) # Thor creates a file based on the templates/steps.tt template template('steps', file_path, opts) end def create_page_file(name) # options used to generate the file in the template function opts = { name: camelize(name) } # Thor creates a file based on the templates/page.tt template template('page', File.join( FileUtils.pwd, 'features', 'pages', "#{name.downcase}_page.rb"), opts) end def camelize(string) camelized = '' string.split('_').each do |s| camelized += s.capitalize end camelized end def in_root_project_folder? # Looks if the user is in the root folder of the project if !Dir.exist?(File.join(FileUtils.pwd, 'features', 'specifications')) puts 'Please run this command on the root folder of the project' exit 1 end true end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
magneton-0.2.0 | bin/magneton-helpers.rb |
cs-webautomator-0.1.8.1 | bin/cs-webautomator-helpers.rb |
magneton-0.1.0 | bin/magneton-helpers.rb |
cs-webautomator-0.1.8 | bin/cs-webautomator-helpers.rb |