Class: L5MTools::Application
- Inherits:
-
Object
- Object
- L5MTools::Application
show all
- Includes:
- Tools
- Defined in:
- lib/l5m-tools.rb,
lib/l5m-tools/application.rb more...
Instance Method Summary
collapse
Methods included from Tools
#ask, #change_directory, #copy_with_replace, #copy_with_replace_without_puts, #duplicate_and_replace, #replace, #send_mail, #to_file, #user_home
Instance Method Details
permalink
#del(*args) ⇒ Object
read file list from file and delete them
[View source]
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/l5m-tools/application.rb', line 46
def del(*args)
replacements = {args[1] => args[2]}
File.open(args[0], "r") do |infile|
while (line = infile.gets)
line = line.chomp.strip
if line.length > 0 && line[0] != '#'
FileUtils.rm(line, :force => true)
end
end
end
end
|
[View source]
22
|
# File 'lib/l5m-tools.rb', line 22
alias :dup :duplicate_app
|
permalink
#duplicate_app(*args) ⇒ Object
[View source]
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/l5m-tools/application.rb', line 10
def duplicate_app(*args)
delete = args.delete('-d')
replacements = {args[1] => args[2]}
unless File.exist?(args[0])
duplicate_wo_csv(*args)
else
File.open(args[0], "r") do |infile|
while (line = infile.gets)
line = line.chomp.strip
if line.length > 0 && line[0] != '#'
FileUtils.rm(line, :force => true) if duplicate_and_replace( line.chomp , replacements )[1] != line && delete
end
end
end
end
end
|
permalink
#duplicate_wo_csv(*args) ⇒ Object
[View source]
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/l5m-tools/application.rb', line 30
def duplicate_wo_csv(*args)
delete = args.delete('-d')
package = args[0]
application = args[1]
replacements = {args[1] => args[2]}
Dir.glob("#{WORKSPACE}/#{package}/{src,WebContent}/**/#{application}*.*", File::FNM_CASEFOLD).each{|line|
bn = File.basename(line, ".*")
unless(bn[application.length] =~ /[a-z0-9]/)
FileUtils.rm(line, :force => true) if duplicate_and_replace( line.chomp , replacements )[1] != line && delete
end
}
end
|
[View source]
21
22
23
24
25
26
|
# File 'lib/l5m-tools.rb', line 21
def make_app(*args, &block)
package = ask("rem","Please input package name").downcase
application = ask("","Please input application name")
use_base_worker = ask("true","Use AbstractBaseWorker?").to_boolean
old_make_app(package, application, use_base_worker, &block)
end
|
permalink
#make_app(package, application, use_base_worker, &block) ⇒ Object
[View source]
15
16
17
18
19
20
|
# File 'lib/l5m-tools.rb', line 15
def make_app(*args, &block)
package = ask("rem","Please input package name").downcase
application = ask("","Please input application name")
use_base_worker = ask("true","Use AbstractBaseWorker?").to_boolean
old_make_app(package, application, use_base_worker, &block)
end
|
permalink
#old_make_app ⇒ Object
[View source]
14
|
# File 'lib/l5m-tools.rb', line 14
alias old_make_app make_app
|
permalink
#run(*args, &block) ⇒ Object
[View source]
23
24
25
|
# File 'lib/l5m-tools.rb', line 23
def run(*args, &block)
send args.shift, *args, &block
end
|