Class: Texas::Task::NewProject
- Inherits:
-
Base
- Object
- Base
- Texas::Task::NewProject
show all
- Defined in:
- lib/texas/task/new_project.rb
Instance Attribute Summary
Attributes inherited from Base
#options
Instance Method Summary
collapse
Methods inherited from Base
#build, #initialize
#trace, #verbose, #warning
Instance Method Details
#dest_dir ⇒ Object
12
13
14
|
# File 'lib/texas/task/new_project.rb', line 12
def dest_dir
File.join(Dir.pwd, options.new_project_name)
end
|
#fixtures_dir(name) ⇒ Object
4
5
6
|
# File 'lib/texas/task/new_project.rb', line 4
def fixtures_dir(name)
File.join(Texas.texas_dir, "spec", "fixtures", name)
end
|
#run ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/texas/task/new_project.rb', line 16
def run
if File.exists?(dest_dir)
if Dir[File.join(dest_dir, "*")].empty?
FileUtils.rm_r dest_dir
else
trace "texas: directory is not empty: #{dest_dir}"
exit 1
end
end
FileUtils.cp_r source_dir, dest_dir
end
|
#source_dir ⇒ Object
8
9
10
|
# File 'lib/texas/task/new_project.rb', line 8
def source_dir
fixtures_dir "new-project"
end
|