Sha256: 8fa3e6e765ee1b1b5e36174703da8dd566ab935e02f6fd46e4bc412742f971f7

Contents?: true

Size: 1.42 KB

Versions: 3

Compression:

Stored size: 1.42 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, required: false, 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
        copy_file '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

3 entries across 3 versions & 1 rubygems

Version Path
automation_wizard-2.0.4 lib/automation_wizard/generators/project.rb
automation_wizard-2.0.3 lib/automation_wizard/generators/project.rb
automation_wizard-2.0.2 lib/automation_wizard/generators/project.rb