Sha256: c64cca25c0697d048b0c48b08796799b971635b596e0984379e3ead18b08dc86

Contents?: true

Size: 1.89 KB

Versions: 2

Compression:

Stored size: 1.89 KB

Contents

require 'thor/group'

module Venom
  module Generators
    class Workshop < Thor::Group
      include Thor::Actions
      
      argument :name, type: :string, desc: "Name of the workshop."
      argument :driver, type: :string, desc: "Driver to use with Symbiont."
      argument :library, type: :string, desc: "Use shared library directory."
      desc "Generates a workshop structure."
      
      def self.source_root
        File.dirname(__FILE__) + "/workshop"
      end
      
      def spit_back_values
        puts "Create workshop '#{name}' using #{driver}."
        puts "Use a separate library." if use_library
      end
      
      def create_workshop_directory
        empty_directory(name)
      end
      
      def create_workshop_structure
        empty_directory("#{name}/specs")
        empty_directory("#{name}/specs/support")
        empty_directory("#{name}/specs/support/test_steps")
        empty_directory("#{name}/specs/support/test_data")
      end
      
      def create_library_directory
        empty_directory("#{name}/lib") if use_library
      end
      
      def create_definitions_directory
        if use_library
          empty_directory("#{name}/lib/definitions")
        else
          empty_directory("#{name}/specs/definitions")
        end
      end
      
      def copy_dsl_runner
        copy_file "cucumber.yml", "#{name}/cucumber.yml"
      end
      
      def copy_rakefile
        copy_file "Rakefile", "#{name}/Rakefile"
      end
      
      def copy_gemfile
        template "Gemfile.tt", "#{name}/Gemfile"
      end
      
      def copy_env
        template "env.rb.tt", "#{name}/specs/support/env.rb"
      end
      
      def copy_hooks
        copy_file "hooks.rb", "#{name}/specs/support/hooks.rb"
      end
      
      private
      
      def use_library
        library == 'true'
      end
    end # class: Workshop
  end # module: Generators
end # module: Venom

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
venom-0.0.2 lib/venom/generators/workshop.rb
venom-0.0.1 lib/venom/generators/workshop.rb