Sha256: e1b7c6528ae60de4154c36bece7158879cff2d25ad36e5c1481a11eeadbb5177

Contents?: true

Size: 735 Bytes

Versions: 19

Compression:

Stored size: 735 Bytes

Contents

require 'grape/app'
require 'thor'

module Grape::App::CLI

  class Builder < Thor::Group
    include Thor::Actions
    argument :name, required: true

    def self.source_root
      File.join(File.dirname(__FILE__), 'templates')
    end

    def copy_templates
      prefix = File.join(self.class.source_root, "")

      Dir[File.join(self.class.source_root, '**', '*')].each do |file|
        next if File.directory?(file)

        file.sub! prefix, ""
        copy_file file, File.join(name, file)
      end
    end

    def init_lib
      empty_directory File.join(name, "lib", name)
    end

  end

  class Runner < Thor
    register Builder, :new, "new NAME", "create a new application"
  end

end

Grape::App::CLI::Runner.start

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
grape-app-0.5.1 lib/grape/app/cli.rb
grape-app-0.5.0 lib/grape/app/cli.rb
grape-app-0.4.3 lib/grape/app/cli.rb
grape-app-0.4.2 lib/grape/app/cli.rb
grape-app-0.4.1 lib/grape/app/cli.rb
grape-app-0.4.0 lib/grape/app/cli.rb
grape-app-0.3.17 lib/grape/app/cli.rb
grape-app-0.3.16 lib/grape/app/cli.rb
grape-app-0.3.15 lib/grape/app/cli.rb
grape-app-0.3.14 lib/grape/app/cli.rb
grape-app-0.3.12 lib/grape/app/cli.rb
grape-app-0.3.11 lib/grape/app/cli.rb
grape-app-0.3.10 lib/grape/app/cli.rb
grape-app-0.3.9 lib/grape/app/cli.rb
grape-app-0.3.5 lib/grape/app/cli.rb
grape-app-0.3.4 lib/grape/app/cli.rb
grape-app-0.3.3 lib/grape/app/cli.rb
grape-app-0.3.2 lib/grape/app/cli.rb
grape-app-0.3.1 lib/grape/app/cli.rb