Class: Bowline::Generators::Generator
- Inherits:
-
Templater::Generator
- Object
- Templater::Generator
- Bowline::Generators::Generator
- Defined in:
- lib/bowline/generators.rb
Class Method Summary (collapse)
- + (Object) chmod(destination, options = {})
- + (Object) source_root
- + (Object) touch(destination, options = {})
Instance Method Summary (collapse)
Class Method Details
+ (Object) chmod(destination, options = {})
99 100 101 102 103 |
# File 'lib/bowline/generators.rb', line 99 def self.chmod(destination, = {}) files << Templater::ActionDescription.new("chmod") do |generator| Templater::Actions::Chmod.new(generator, destination, ) end end |
+ (Object) source_root
105 106 107 |
# File 'lib/bowline/generators.rb', line 105 def self.source_root File.(File.join(File.dirname(__FILE__), *%w[.. .. templates])) end |
+ (Object) touch(destination, options = {})
93 94 95 96 97 |
# File 'lib/bowline/generators.rb', line 93 def self.touch(destination, = {}) empty_directories << Templater::ActionDescription.new("touch") do |generator| Templater::Actions::Touch.new(generator, destination, ) end end |
Instance Method Details
- (Object) shebang
89 90 91 |
# File 'lib/bowline/generators.rb', line 89 def shebang "#!/usr/bin/env #{RbConfig::CONFIG["RUBY_INSTALL_NAME"]}" end |
- (Object) with_modules(modules, options = {}, &block)
76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/bowline/generators.rb', line 76 def with_modules(modules, ={}, &block) indent = [: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 |