Class: Devtools::Site::Initializer
- Inherits:
-
Object
- Object
- Devtools::Site::Initializer
- Defined in:
- lib/devtools/site/initializer.rb
Overview
Supports initializing new projects with a Rakefile
Instance Attribute Summary collapse
-
#config_dir ⇒ Object
readonly
Returns the value of attribute config_dir.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
-
#site ⇒ Object
readonly
Returns the value of attribute site.
Class Method Summary collapse
Instance Method Summary collapse
-
#call ⇒ undefined
Init devtools using default config.
-
#initialize(site) ⇒ Initializer
constructor
A new instance of Initializer.
Constructor Details
#initialize(site) ⇒ Initializer
Returns a new instance of Initializer.
19 20 21 22 23 24 |
# File 'lib/devtools/site/initializer.rb', line 19 def initialize(site) @site = site @root = site.root config_dir = @root.join(DEFAULT_CONFIG_DIR_NAME).tap(&:mkpath) @config_dir = config_dir.parent end |
Instance Attribute Details
#config_dir ⇒ Object (readonly)
Returns the value of attribute config_dir.
17 18 19 |
# File 'lib/devtools/site/initializer.rb', line 17 def config_dir @config_dir end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
15 16 17 |
# File 'lib/devtools/site/initializer.rb', line 15 def root @root end |
#site ⇒ Object (readonly)
Returns the value of attribute site.
13 14 15 |
# File 'lib/devtools/site/initializer.rb', line 13 def site @site end |
Class Method Details
.call(root) ⇒ Object
9 10 11 |
# File 'lib/devtools/site/initializer.rb', line 9 def self.call(root) new(root).call end |
Instance Method Details
#call ⇒ undefined
Init devtools using default config
31 32 33 34 35 36 37 38 |
# File 'lib/devtools/site/initializer.rb', line 31 def call FileUtils.cp_r(DEFAULT_CONFIG_PATH, config_dir) site.sync init_rakefile self end |