Sha256: 1e5e81d456172888072ec8cfb592aafe544fb3696882d4c811e956f18d0c26ca

Contents?: true

Size: 831 Bytes

Versions: 1

Compression:

Stored size: 831 Bytes

Contents

require 'rails/generators/base'

module Datalab
  module Generators
    class Base < Rails::Generators::Base #:nodoc:
      def self.source_root
        @_datalab_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'datalab', generator_name, 'templates'))
      end

      def self.banner
        "rails generate datalab:#{generator_name} #{self.arguments.map{ |a| a.usage }.join(' ')} [options]"
      end

      private

      def add_gem(name, options = {})
        gemfile_content = File.read(destination_path("Gemfile"))
        File.open(destination_path("Gemfile"), 'a') { |f| f.write("\n") } unless gemfile_content =~ /\n\Z/
        gem name, options unless gemfile_content.include? name
      end

      def print_usage
        self.class.help(Thor::Base.shell.new)
        exit
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
datalab-generators-0.1.0 lib/generators/datalab.rb