Sha256: 15af42d1d89b9ecbb510776e630300685fb0c602cd718b381c95068fd42edc70

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

require 'thor/group'

module LucidGen
  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_driver
        if driver.downcase == 'fluent'
          copy_file 'driver-fluent.rb', "#{name}/common/support/driver.rb"
        end
      end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lucid-gen-1.0.0 lib/lucid-gen/generators/project.rb