Sha256: cc7611b5eb322719713232648441c19ba199c23ca5f037e5601d42aca18b6e7a

Contents?: true

Size: 1015 Bytes

Versions: 3

Compression:

Stored size: 1015 Bytes

Contents

module Apitome
  module Generators
    class InstallGenerator < Rails::Generators::Base
      source_root File.expand_path("../", __FILE__)

      desc "Installs the Apitome initializer and markdown file into your application."

      class_option :assets, type: :boolean,
                   aliases: "-a",
                   default: false,
                   desc:    "Install the javascript and stylesheet assets to /public"

      def copy_initializers
        copy_file "templates/initializer.rb", "config/initializers/apitome.rb"
        copy_file "templates/api.md", "doc/api.md"
      end

      def copy_assets
        return unless options[:assets]
        copy_file "../../../../app/assets/javascripts/apitome/bundle.js", "public/javascripts/apitome/application.js"
        copy_file "../../../../app/assets/stylesheets/apitome/bundle.css", "public/stylesheets/apitome/application.css"
      end

      def display_readme
        readme "POST_INSTALL" if behavior == :invoke
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
apitome-0.0.8 lib/generators/apitome/install/install_generator.rb
apitome-0.0.7 lib/generators/apitome/install/install_generator.rb
apitome-0.0.6 lib/generators/apitome/install/install_generator.rb