Sha256: 2dc9b16962b65daaa7fdafa0e3c2000fdf913ff67ed1c3f72fd32ee8533f72c3

Contents?: true

Size: 933 Bytes

Versions: 3

Compression:

Stored size: 933 Bytes

Contents

require 'thor/group'
require 'fileutils'

module RTFDoc
  class Bootstrap < Thor::Group
    include Thor::Actions

    argument :name, type: :string, desc: 'Name of the directory to bootstrap', required: true

    source_root(File.expand_path('../templates', __dir__))

    def create_root_directory
      FileUtils.mkdir_p(name)
    end

    def create_skeleton
      FileUtils.mkdir_p("#{name}/content")
      FileUtils.mkdir_p("#{name}/dist")
      copy_file('gitignore', "#{name}/.gitignore")
    end

    def create_gemfile
      template('Gemfile.erb', "#{name}/Gemfile")
    end

    def create_webpack_config
      template('package.json.erb', "#{name}/package.json")
      template('webpack.config.js.erb', "#{name}/webpack.config.js")
    end

    def create_config
      template('config.yml.erb', "#{name}/config.yml")
    end

    private

    def gem_dir
      File.expand_path('../../../', __dir__)
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rtfdoc-0.1.2 lib/rtfdoc/generators/bootstrap.rb
rtfdoc-0.1.1 lib/rtfdoc/generators/bootstrap.rb
rtfdoc-0.1.0 lib/rtfdoc/generators/bootstrap.rb