Class: Slnky::Generator::Base
- Inherits:
-
Object
- Object
- Slnky::Generator::Base
- Defined in:
- lib/slnky/generator.rb
Instance Attribute Summary collapse
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(name) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(name) ⇒ Base
Returns a new instance of Base.
11 12 13 14 15 16 |
# File 'lib/slnky/generator.rb', line 11 def initialize(name) @name = name @dir = File.("slnky-#{name}") short = self.class.name.split('::').last.downcase @template = File.("../template/#{short}", __FILE__) end |
Instance Attribute Details
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
9 10 11 |
# File 'lib/slnky/generator.rb', line 9 def dir @dir end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/slnky/generator.rb', line 8 def name @name end |
Instance Method Details
#generate ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/slnky/generator.rb', line 18 def generate puts "generating service #{@name}:" puts " from: #{@template}" puts " to: #{@dir}" process_files # make service executable `chmod 755 #{@dir}/service-slnky-#{@name}` # git init puts "initializing git..." `cd #{@dir} && git init . || true` `cd #{@dir} && git add .` end |