Class: Crafti::Root
- Inherits:
-
Object
- Object
- Crafti::Root
- Includes:
- FileUtilsExtension, RunCommands
- Defined in:
- lib/crafti.rb
Instance Attribute Summary collapse
-
#app_path ⇒ Object
readonly
Returns the value of attribute app_path.
-
#appname ⇒ Object
readonly
Returns the value of attribute appname.
Class Method Summary collapse
Instance Method Summary collapse
- #create_root_directory ⇒ Object
- #evaluate(&block) ⇒ Object
-
#initialize(appname) ⇒ Root
constructor
A new instance of Root.
Methods included from RunCommands
#bower, #bundle, #git, #run, #sudo
Methods included from FileUtilsExtension
#chmod, #chmod_r, #copy, #mkdir, #mkdirs, #template, #touch
Constructor Details
#initialize(appname) ⇒ Root
Returns a new instance of Root.
181 182 183 184 |
# File 'lib/crafti.rb', line 181 def initialize(appname) @appname = appname @app_path = ::Pathname.new(appname). end |
Instance Attribute Details
#app_path ⇒ Object (readonly)
Returns the value of attribute app_path.
179 180 181 |
# File 'lib/crafti.rb', line 179 def app_path @app_path end |
#appname ⇒ Object (readonly)
Returns the value of attribute appname.
179 180 181 |
# File 'lib/crafti.rb', line 179 def appname @appname end |
Class Method Details
.root(appname, &block) ⇒ Object
173 174 175 176 177 |
# File 'lib/crafti.rb', line 173 def self.root(appname, &block) app = new(appname) app.create_root_directory app.evaluate(&block) if block_given? end |
Instance Method Details
#create_root_directory ⇒ Object
190 191 192 |
# File 'lib/crafti.rb', line 190 def create_root_directory ::FileUtils.mkdir_p(app_path) end |
#evaluate(&block) ⇒ Object
186 187 188 |
# File 'lib/crafti.rb', line 186 def evaluate(&block) instance_eval &block end |