Sha256: ebe192bf1bbca20473e7b9e08a7633c875566e862df8fc75cfcdfbf7c297b55a

Contents?: true

Size: 1.41 KB

Versions: 2

Compression:

Stored size: 1.41 KB

Contents

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
automation_wizard-2.0.1 lib/automation_wizard/generators/project.rb
automation_wizard-2.0 lib/automation_wizard/generators/project.rb