Sha256: 816b6383838e4d3cc0a6e8877310c8ebad3a986eaeb43cc41c5b77874b263564

Contents?: true

Size: 1.79 KB

Versions: 1

Compression:

Stored size: 1.79 KB

Contents

require 'transcriptic/base_generator'

module Transcriptic
  class ProjectGenerator < BaseGenerator

    argument :name
    class_option :group,
      type: :string,
      default: "org.autoprotocol.unclaimed"
    class_option :version,
      type: :string,
      default: "1.0.0"
    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')

      version

      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 update_build_version(labfile)
      @version = labfile.options[:version]
      template 'project/Build.erb', target.join('project/Build.scala'), force: true
    end

    def autoprotocol_version
      Transcriptic::AUTOPROTOCOL_VERSION
    end

    def description
      options[:description]
    end

    def group
      options[:group]
    end

    def version
      @version = options[:version]
    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

1 entries across 1 versions & 1 rubygems

Version Path
transcriptic-0.2.10 lib/transcriptic/project_generator.rb