Class: Crafti::Root

Inherits:
Object
  • Object
show all
Includes:
FileUtilsExtension, RunCommands
Defined in:
lib/crafti.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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).expand_path
end

Instance Attribute Details

#app_pathObject (readonly)

Returns the value of attribute app_path.



179
180
181
# File 'lib/crafti.rb', line 179

def app_path
  @app_path
end

#appnameObject (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_directoryObject



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