Sha256: 80d78869475233d09191b6def34da126caccf0679a1b3a150ab0317114c66b87

Contents?: true

Size: 1.53 KB

Versions: 2

Compression:

Stored size: 1.53 KB

Contents

require 'transcriptic/base_generator'

module Transcriptic
  class ProjectGenerator < BaseGenerator

    argument :name
    class_option :package,
      type: :string,
      default: "org.autoprotocol.unclaimed"
    class_option :author,
      type: :string,
      default: "John Appleseed"
    class_option :email,
      type: :string,
      default: "author@example.edu"
    class_option :description,
      type: :string,
      default: false

    def generate
      empty_directory target.join('app')
      empty_directory target.join('project')
      empty_directory target.join('logs')

      template 'app/Main.erb', target.join('app/Main.scala')
      template 'project/Build.erb', target.join('project/Build.scala')
      copy_file 'project/build.properties', target.join('project/build.properties')
      copy_file 'project/plugins.sbt', target.join('project/plugins.sbt')
      copy_file 'README.md', target.join('README.md')
      template 'LICENSE.erb', target.join('LICENSE')
      template 'Labfile.erb', target.join('Labfile')

      Transcriptic::DependenciesGenerator.new([File.join(Dir.pwd, name), []], options).invoke_all
    end

    def autoprotocol_version
      Transcriptic::AUTOPROTOCOL_VERSION
    end

    def description
      options[:description]
    end

    def package
      options[:package]
    end

    def author
      options[:author]
    end

    def email
      options[:email]
    end

    def author?
      not (options[:author] == "John Appleseed")
    end

    def copyright_year
      Time.now.year
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
transcriptic-0.2.5 lib/transcriptic/project_generator.rb
transcriptic-0.2.4 lib/transcriptic/project_generator.rb