Sha256: 2a782087eea3d673733c069b6dd0117a1e54a958fcff07e2923507eb7dce933c
Contents?: true
Size: 1.8 KB
Versions: 1
Compression:
Stored size: 1.8 KB
Contents
gem "templater", ">= 0.3.2" require "templater" require "rbconfig" module Bowline module Generators #:nodoc: all extend Templater::Manifold desc <<-DESC Generate components for your application or entirely new applications. DESC class Generator < Templater::Generator def with_modules(modules, options={}, &block) indent = options[:indent] || 0 text = capture(&block) modules.each_with_index do |mod, i| concat((" " * (indent + i)) + "module #{mod}\n", block.binding) end text = text.to_a.map{ |line| (" " * modules.size) + line }.join concat(text, block.binding) modules.reverse.each_with_index do |mod, i| concat((" " * (indent + modules.size - i - 1)) + "end # #{mod}\n", block.binding) end end def shebang "#!/usr/bin/env #{RbConfig::CONFIG["RUBY_INSTALL_NAME"]}" end def self.source_root File.join(File.dirname(__FILE__), *%w[.. .. templates]) end end class NamedGenerator < Generator # NOTE: Currently this is not inherited, it will have to be # declared in each generator that inherits from this. first_argument :name, :required => true def initialize(*args) super end def class_name name.gsub('-', '_').camel_case end alias_method :module_name, :class_name def file_name name.snake_case end alias_method :base_name, :file_name def symbol_name file_name.gsub('-', '_') end end end end require "bowline/generators/application" require "bowline/generators/binder" require "bowline/generators/helper" require "bowline/generators/migration" require "bowline/generators/model" require "bowline/generators/window"
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bowline-0.6.2 | lib/bowline/generators.rb |