jdl 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/jdl +17 -15
- data/lib/jdl/version.rb +1 -1
- data/lib/jdl.rb +2 -3
- metadata +3 -3
data/bin/jdl
CHANGED
@@ -18,6 +18,7 @@ option_parser = OptionParser.new do |opts|
|
|
18
18
|
options[:path] = '.'
|
19
19
|
options[:file_ex] = 'js'
|
20
20
|
options[:output_name] = 'jdl.js'
|
21
|
+
options[:debug] = false
|
21
22
|
# Option 作为flag,带一组用逗号分割的arguments,用于将arguments作为数组解析
|
22
23
|
opts.on('-t path,file_ex,output_name', '--tranfer path,file_ex,output_name', Array, 'List of 3 arguments') do |value|
|
23
24
|
options[:array] = value
|
@@ -28,33 +29,34 @@ option_parser = OptionParser.new do |opts|
|
|
28
29
|
options[:output_name] = options[:array][2]
|
29
30
|
end
|
30
31
|
|
31
|
-
opts.on('-p', '--path', 'Set options as path') do |value|
|
32
|
+
opts.on('-p path', '--path path', 'Set options as path') do |value|
|
32
33
|
# 这个部分就是使用这个Option后执行的代码
|
33
|
-
options[:path] = value
|
34
|
-
|
34
|
+
options[:path] = value
|
35
35
|
end
|
36
|
-
opts.on('-e', '--file_ex', 'Set options as file_ex') do |value|
|
36
|
+
opts.on('-e ex', '--file_ex ex', 'Set options as file_ex') do |value|
|
37
37
|
# 这个部分就是使用这个Option后执行的代码
|
38
38
|
options[:file_ex] = value
|
39
39
|
end
|
40
40
|
|
41
|
-
opts.on('-o', '--output', 'Set options as output_name') do |value|
|
41
|
+
opts.on('-o output', '--output output', 'Set options as output_name') do |value|
|
42
42
|
# 这个部分就是使用这个Option后执行的代码
|
43
43
|
options[:output_name] = value
|
44
44
|
end
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
File.delete(output_name) if File.exist?(output_name)
|
52
|
-
Jdl.getfiles(path ,file_ex ,output_name)
|
53
|
-
|
46
|
+
opts.on('-d', '--verbose', 'Set options as verbose') do |value|
|
47
|
+
# 这个部分就是使用这个Option后执行的代码
|
48
|
+
options[:debug] = value
|
49
|
+
end
|
54
50
|
end.parse!
|
55
51
|
|
56
52
|
# puts options.inspect
|
53
|
+
path = options[:path]
|
54
|
+
file_ex = options[:file_ex]
|
55
|
+
output_name = options[:output_name]
|
57
56
|
|
57
|
+
p "path = #{path}" if(options[:debug])
|
58
|
+
p "fname = #{file_ex}" if(options[:debug])
|
59
|
+
p "output_name = #{output_name}" if(options[:debug])
|
58
60
|
|
59
|
-
|
60
|
-
|
61
|
+
File.delete(output_name) if File.exist?(output_name)
|
62
|
+
Jdl.getfiles(path ,file_ex ,output_name)
|
data/lib/jdl/version.rb
CHANGED
data/lib/jdl.rb
CHANGED
@@ -8,9 +8,9 @@ module Jdl
|
|
8
8
|
# #>chmod 777 runtest.sh
|
9
9
|
#
|
10
10
|
def self.getfiles(path,fname,output_name)
|
11
|
+
|
11
12
|
re = []
|
12
13
|
allre = []
|
13
|
-
ff = []
|
14
14
|
Dir.foreach(path) do |f|
|
15
15
|
allre << f
|
16
16
|
end
|
@@ -35,13 +35,12 @@ module Jdl
|
|
35
35
|
self.print_arr(fullfilename,output_name)
|
36
36
|
# p ff
|
37
37
|
re << f
|
38
|
-
|
38
|
+
# p fullfilename
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
# p extname
|
43
43
|
return re
|
44
|
-
# return ff
|
45
44
|
end
|
46
45
|
|
47
46
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jdl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -92,7 +92,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
92
92
|
version: '0'
|
93
93
|
segments:
|
94
94
|
- 0
|
95
|
-
hash:
|
95
|
+
hash: 2541092676907615134
|
96
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
97
|
none: false
|
98
98
|
requirements:
|
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
101
|
version: '0'
|
102
102
|
segments:
|
103
103
|
- 0
|
104
|
-
hash:
|
104
|
+
hash: 2541092676907615134
|
105
105
|
requirements: []
|
106
106
|
rubyforge_project:
|
107
107
|
rubygems_version: 1.8.25
|