Sha256: 843767688b61ee80bdd7c0746db68d7e2ee55c7fd65b57aacfd95d28dd9e244b

Contents?: true

Size: 1.55 KB

Versions: 4

Compression:

Stored size: 1.55 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 :pageobject_driver, type: :string, desc: 'Driver to use with PageObject'

      desc "Generates a project structure for automation applicant test"
      
      def self.source_root
        File.dirname(__FILE__) + "/project"
      end
    
      def create_top_directory
        empty_directory(name)
      end
      
      def copy_cucumber_yml
        template "cucumber.yml.tt", "#{name}/cucumber.yml"
      end
    
      def copy_gemfile
        template "Gemfile.tt", "#{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 create_cucumber_directories
        empty_directory("#{name}/features")
        empty_directory("#{name}/features/support")
        empty_directory("#{name}/features/step_definitions")
      end
      
      def copy_env
        template "env.rb.tt", "#{name}/features/support/env.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
      end


      private
        def no_driver_selected
          pageobject_driver.downcase == 'none'
        end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
automation_wizard-0.1.3 lib/automation_wizard/generators/project.rb
automation_wizard-0.1.2 lib/automation_wizard/generators/project.rb
automation_wizard-0.1.1 lib/automation_wizard/generators/project.rb
automation_wizard-0.1 lib/automation_wizard/generators/project.rb