Class: CG::Scratch
Class Method Summary collapse
Instance Method Summary collapse
- #dir_exists?(name) ⇒ Boolean
-
#initialize ⇒ Scratch
constructor
A new instance of Scratch.
- #start ⇒ Object
Constructor Details
#initialize ⇒ Scratch
Returns a new instance of Scratch.
11 12 13 |
# File 'lib/cg/scratch.rb', line 11 def initialize @site = ARGV.first || 'example' end |
Class Method Details
.start! ⇒ Object
15 16 17 |
# File 'lib/cg/scratch.rb', line 15 def self.start! new.start end |
Instance Method Details
#dir_exists?(name) ⇒ Boolean
24 25 26 27 28 29 30 31 |
# File 'lib/cg/scratch.rb', line 24 def dir_exists?(name) begin cd(name) { } true rescue Errno::ENOENT false end end |
#start ⇒ Object
19 20 21 22 |
# File 'lib/cg/scratch.rb', line 19 def start mkdir(@site) unless dir_exists?(@site) cp_r(Dir.glob(SKEL_PATH + '/{*,.exclude}'), @site) end |