Sha256: 265b5314205e5d4c18510806611b43b73f684c892c653a52fde2edfb8cb38340

Contents?: true

Size: 1.57 KB

Versions: 3

Compression:

Stored size: 1.57 KB

Contents

# Rgentpl
module Rgentpl
  # Command
  #
  # Application command
  module Command
    # Generate group command
    #
    # General command
    class Generate < Thor::Group
      include Thor::Actions

      # @return [String] the final install application path
      attr_accessor :app_path
      # @return [String] the ctags full binary path
      attr_accessor :ctags

      # App name argument
      argument :app_name, type: :string, required: true,
                          desc: 'Application name'
      # @return [String] the application path root
      def self.source_root
        TEMPLATE_ROOT
      end

      class_option :app_path, type: :string,
                              required: true,
                              desc: 'Application path',
                              default: '/tmp'
      class_option :ctags, type: :string,
                           required: false,
                           desc: 'Full CTags path command',
                           default: '/usr/local/bin/ctags'
      # @return [void]
      def create_app
        @app_path = options['app_path']
        @ctags    = options['ctags']
        directory('src', "#{@app_path.chomp('/')}/#{app_name}")
      end

      # @return [void]
      def add_perms
        chmod("#{@app_path.chomp('/')}/#{app_name}/bin/#{app_name}", 0755)
      end

      # @return [void]
      def git
        run("cd #{app_path}/#{app_name} ;
          git init; git add . ;
          git ci -am 'First sending.' ;
          git checkout -b develop ;
          git checkout -b feature-domain-logic
        ")
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rgentpl-1.0.3 lib/rgentpl/command/generate.rb
rgentpl-1.0.2 lib/rgentpl/command/generate.rb
rgentpl-1.0.1 lib/rgentpl/command/generate.rb