Sha256: df76384c231ee7fb2b28810ebd626f0e05cd928a439f5af721a8839810997cb5

Contents?: true

Size: 1004 Bytes

Versions: 2

Compression:

Stored size: 1004 Bytes

Contents

require 'thor'
require 'active_support/all'
require 'napa/setup'
require 'napa/identity'
require 'dotenv'

module Napa
  module Generators
    class ReadmeGenerator < Thor::Group
      include Thor::Actions

      def load_environment
        Napa.load_environment
      end

      def service_name
        Napa::Identity.name
      end

      def routes
        routes = ""

        if defined? ApplicationApi
          ApplicationApi.routes.each do |api|
            method      = api.route_method.ljust(10)
            path        = api.route_path.ljust(40)
            description = api.route_description
            routes     += "     #{method} #{path} # #{description}"
          end
        end

        routes
      end

      def output_directory
        '.'
      end

      def readme
        self.class.source_root "#{File.dirname(__FILE__)}/templates/readme"
        say 'Generating readme...'
        directory '.', output_directory
        say 'Done!', :green
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
napa-0.4.1 lib/napa/generators/readme_generator.rb
napa-0.4.0 lib/napa/generators/readme_generator.rb