lib/automation_wizard/generators/project.rb in automation_wizard-0.1.3 vs lib/automation_wizard/generators/project.rb in automation_wizard-2.0
- old
+ new
@@ -4,60 +4,53 @@
module Generators
class Project < Thor::Group
include Thor::Actions
argument :name, type: :string, desc: 'The name of the project'
- argument :pageobject_driver, type: :string, desc: 'Driver to use with PageObject'
+ argument :level, type: :string, desc: 'Project level'
- desc "Generates a project structure for automation applicant test"
+ desc 'Generates a project structure for automation applicant test'
def self.source_root
- File.dirname(__FILE__) + "/project"
+ File.dirname(__FILE__) + '/project'
end
-
- def create_top_directory
+
+ def create_project_structure
empty_directory(name)
+ empty_directory("#{name}/spec")
+ empty_directory("#{name}/lib")
+ empty_directory("#{name}/lib/models")
+ empty_directory("#{name}/lib/pages")
end
-
- def copy_cucumber_yml
- template "cucumber.yml.tt", "#{name}/cucumber.yml"
+
+ def copy_rspec
+ template '.rspec', "#{name}/.rspec"
end
-
+
def copy_gemfile
- template "Gemfile.tt", "#{name}/Gemfile"
+ template 'Gemfile', "#{name}/Gemfile"
end
def copy_rakefile
- copy_file "Rakefile", "#{name}/Rakefile"
+ copy_file 'Rakefile', "#{name}/Rakefile"
end
def copy_readme
- copy_file "Readme.md.tt", "#{name}/Readme.md"
+ copy_file 'Readme.md.tt', "#{name}/README.md"
end
- def create_cucumber_directories
- empty_directory("#{name}/features")
- empty_directory("#{name}/features/support")
- empty_directory("#{name}/features/step_definitions")
+ def copy_specs
+ template 'spec_helper.rb', "#{name}/spec/spec_helper.rb"
+ template 'loblaws_search_spec.rb.tt', "#{name}/spec/loblaws_search_spec.rb"
end
- def copy_env
- template "env.rb.tt", "#{name}/features/support/env.rb"
+ def copy_pages
+ template 'loblaws_home.rb.tt', "#{name}/lib/pages/loblaws_home.rb"
end
-
- def copy_hooks
- template "hooks.rb.tt", "#{name}/features/support/hooks.rb" unless no_driver_selected
- end
- def create_pages_directory
- empty_directory("#{name}/features/support/pages") unless no_driver_selected
+ def copy_models
+ template 'model_loblaws_search.rb.tt', "#{name}/lib/models/model_loblaws_search.rb"
end
-
-
- private
- def no_driver_selected
- pageobject_driver.downcase == 'none'
- end
end
end
end