Sha256: 37255b7c6b3230ca1726ed468cbaaad889827216e186b31af8c880b1335d98b5

Contents?: true

Size: 1.67 KB

Versions: 2

Compression:

Stored size: 1.67 KB

Contents

require 'thor/group'

module Lucid
  module Generators
    class Project < Thor::Group
      include Thor::Actions

      argument :name,    type: :string,  desc: 'Name of the project.'
      argument :driver,  type: :string,  desc: 'Framework driver to use.'

      desc 'Generates a project structure.'

      def self.source_root
        File.dirname(__FILE__) + '/project'
      end

      def spit_back_values
        puts "Create project '#{name}' using #{driver}."
      end

      def create_project_directory
        empty_directory(name)
      end

      def create_project_structure
        empty_directory("#{name}/specs")
        empty_directory("#{name}/common")
        empty_directory("#{name}/common/helpers")
        empty_directory("#{name}/common/support")
        empty_directory("#{name}/common/config")
        empty_directory("#{name}/common/data")
        empty_directory("#{name}/steps")
        empty_directory("#{name}/pages")
      end

      def copy_errors
        copy_file 'errors.rb', "#{name}/common/support/errors.rb"
      end

      def copy_browser
        if driver.downcase == 'fluent'
          copy_file 'browser-fluent.rb', "#{name}/common/support/browser.rb"
        end
      end

      def copy_driver
        if driver.downcase == 'fluent'
          copy_file 'driver-fluent.rb', "#{name}/common/support/driver.rb"
        end
      end

      def copy_events
        if driver.downcase == 'fluent'
          copy_file 'events-fluent.rb', "#{name}/common/support/events.rb"
        end
      end

      def copy_gemfile
        template 'Gemfile.tt', "#{name}/Gemfile"
      end
      
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lucid-0.3.3 lib/lucid/generators/project.rb
lucid-0.3.0 lib/lucid/generators/project.rb