Class: Decoct::Dscript
- Inherits:
-
Object
show all
- Includes:
- Dmeta
- Defined in:
- lib/decoct/dscript.rb
Constant Summary
Constants included
from Dconstants
Decoct::Dconstants::LIB, Decoct::Dconstants::PUBLIC, Decoct::Dconstants::SPEC, Decoct::Dconstants::TEMPLATES, Decoct::Dconstants::VIEWS
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Dmeta
#copy_file, included
Constructor Details
#initialize(app_name) ⇒ Dscript
Returns a new instance of Dscript.
11
12
13
14
|
# File 'lib/decoct/dscript.rb', line 11
def initialize(app_name)
fail "app name cannot be nil or empty!!!" if app_name.eql?(nil) || app_name.empty?
@app_name = app_name
end
|
Instance Attribute Details
#app_name ⇒ Object
Returns the value of attribute app_name.
7
8
9
|
# File 'lib/decoct/dscript.rb', line 7
def app_name
@app_name
end
|
Instance Method Details
#copy_app_file ⇒ Object
46
47
48
49
|
# File 'lib/decoct/dscript.rb', line 46
def copy_app_file
copy_file("generic_app.rb", "#{app_name}#{File::SEPARATOR}#{app_name}.rb")
puts "Copied application file"
end
|
#copy_autotest_file ⇒ Object
34
35
36
37
|
# File 'lib/decoct/dscript.rb', line 34
def copy_autotest_file
copy_file(".autotest", "#{app_name}#{File::SEPARATOR}.autotest")
puts "Copied autotest files"
end
|
#copy_icons ⇒ Object
51
52
53
54
55
56
|
# File 'lib/decoct/dscript.rb', line 51
def copy_icons
from = ["icons#{File::SEPARATOR}fail.png", "icons#{File::SEPARATOR}ok.png"]
to = [ "#{app_name}#{File::SEPARATOR}icons#{File::SEPARATOR}fail.png", "#{app_name}#{File::SEPARATOR}icons#{File::SEPARATOR}ok.png"]
copy_file(from, to)
puts "Copied icons"
end
|
#copy_rspec_files ⇒ Object
39
40
41
42
43
44
|
# File 'lib/decoct/dscript.rb', line 39
def copy_rspec_files
from = ["spec#{File::SEPARATOR}spec.opts", "spec#{File::SEPARATOR}rcov.opts", "spec#{File::SEPARATOR}spec_helper.rb", "spec#{File::SEPARATOR}app_spec.rb"]
to = ["#{app_name}#{File::SEPARATOR}spec#{File::SEPARATOR}spec.opts", "#{app_name}#{File::SEPARATOR}spec#{File::SEPARATOR}rcov.opts", "#{app_name}#{File::SEPARATOR}spec#{File::SEPARATOR}spec_helper.rb", "#{app_name}#{File::SEPARATOR}spec#{File::SEPARATOR}#{app_name}_spec.rb"]
copy_file(from, to)
puts "Copied rspec files"
end
|
#create_app_dir ⇒ Object
29
30
31
32
|
# File 'lib/decoct/dscript.rb', line 29
def create_app_dir
Dir.mkdir("#{app_name}") if !test(?d, "#{app_name}")
puts "Created application directory - #{app_name}"
end
|
#run ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/decoct/dscript.rb', line 16
def run
create_app_dir
create_lib
create_spec
create_views
create_public
create_icons
copy_autotest_file
copy_rspec_files
copy_app_file
copy_icons
end
|