Sha256: 7de72d0663d2186bdfb3d33b7189ec5030c26e6e20bbea1696c6f6abc735422f

Contents?: true

Size: 1.35 KB

Versions: 2

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 == 'symbiont'
          copy_file 'driver-symbiont.rb', "#{name}/common/support/driver.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-gen-2.1.0 lib/lucid-gen/generators/project.rb
lucid-gen-2.0.0 lib/lucid-gen/generators/project.rb