require 'thor/group' module AutomationWizard module Generators class Project < Thor::Group include Thor::Actions argument :name, type: :string, desc: 'The name of the project' argument :level, type: :string, desc: 'Project level' desc 'Generates a project structure for automation applicant test' def self.source_root File.dirname(__FILE__) + '/project' end 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_rspec template '.rspec', "#{name}/.rspec" end def copy_gemfile template 'Gemfile', "#{name}/Gemfile" end def copy_rakefile copy_file 'Rakefile', "#{name}/Rakefile" end def copy_readme copy_file 'Readme.md.tt', "#{name}/README.md" end 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_pages template 'loblaws_home.rb.tt', "#{name}/lib/pages/loblaws_home.rb" end def copy_models template 'model_loblaws_search.rb.tt', "#{name}/lib/models/model_loblaws_search.rb" end end end end