Class: Hastie::ServerGenerator
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Hastie::ServerGenerator
- Includes:
- Thor::Actions
- Defined in:
- lib/hastie/server_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.banner ⇒ Object
11 12 13 |
# File 'lib/hastie/server_generator.rb', line 11 def self. "hastie create_server [NAME]" end |
.source_root ⇒ Object
18 19 20 |
# File 'lib/hastie/server_generator.rb', line 18 def self.source_root File.dirname(__FILE__) end |
Instance Method Details
#create_git_repo ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/hastie/server_generator.rb', line 36 def create_git_repo in_root do say_status "note", "creating git repository in #{self.destination_root}" repo = Grit::Repo.init(".") all_files = Dir.glob("./**") #all_files.each {|f| say_status "note", "adding #{f}"} repo.add(all_files) repo.commit_all("initial commit of server scaffold. created from hastie") end end |
#create_server ⇒ Object
32 33 34 |
# File 'lib/hastie/server_generator.rb', line 32 def create_server directory("templates/server", self.destination_root) end |
#set_destination ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/hastie/server_generator.rb', line 22 def set_destination # hack to unfreeze the options hash self. = Thor::CoreExt::HashWithIndifferentAccess.new() # want to allow for relative paths [:server_id] = File.basename(name) self.destination_root = File.join(File.dirname(name), [:server_id]) say_status "note", "root: #{self.destination_root}" end |