pattern 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- data/DOCS/todolist.txt +8 -8
- data/bin/pattern +13 -0
- data/etc/templates_path.conf +0 -1
- data/lib/configuration.rb +14 -1
- data/lib/version.rb +21 -1
- data/pattern-0.9.2.gem +0 -0
- data/pattern.gemspec +1 -1
- metadata +4 -4
data/DOCS/todolist.txt
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
1. 制作为rubygem
|
2
|
-
1.1. 添加可执行文件
|
3
|
-
1.2. 添加环境路径
|
2
|
+
1.1. 添加可执行文件 OK
|
3
|
+
1.2. 添加环境路径 OK
|
4
4
|
1.3. 一些bugs OK
|
5
|
-
2. 上传
|
6
|
-
3. 如果文件已经存在,不进行覆盖
|
7
|
-
4. 支持建立文件夹
|
8
|
-
5. 支持默认模式
|
9
|
-
6. 支持添加template目录
|
5
|
+
2. 上传 OK
|
6
|
+
3. 如果文件已经存在,不进行覆盖 OK
|
7
|
+
4. 支持建立文件夹 X
|
8
|
+
5. 支持默认模式 OK
|
9
|
+
6. 支持添加template目录 OK
|
10
10
|
6.1. config类来处理
|
11
11
|
6.2. 添加一个
|
12
12
|
6.3. 删除一个
|
13
13
|
7. 添加新的templates
|
14
|
-
8. 列出可用的template
|
14
|
+
8. 列出可用的template OK
|
15
15
|
9. help功能
|
16
16
|
|
17
17
|
发现一个问题,如果我的问题不能按我的想法来排列,我先做下面的,再做上面的,我会很不舒服
|
data/bin/pattern
CHANGED
@@ -14,6 +14,19 @@ if %w(--set -s).include? ARGV.first
|
|
14
14
|
exit(0)
|
15
15
|
end
|
16
16
|
|
17
|
+
if %w(--list -l).include? ARGV.first
|
18
|
+
require current_dir + '/../lib/configuration'
|
19
|
+
configuration = Configuration.new
|
20
|
+
configuration.list
|
21
|
+
exit(0)
|
22
|
+
end
|
23
|
+
|
24
|
+
if %w(--help -h).include? ARGV.first
|
25
|
+
require current_dir + '/../lib/version'
|
26
|
+
puts Pattern::HELP::STRING
|
27
|
+
exit(0)
|
28
|
+
end
|
29
|
+
|
17
30
|
require current_dir + '/../lib/compositecode'
|
18
31
|
pattern = CompositeCode.new(Command.new(ARGV))
|
19
32
|
pattern.execute
|
data/etc/templates_path.conf
CHANGED
data/lib/configuration.rb
CHANGED
@@ -17,14 +17,27 @@ class Configuration
|
|
17
17
|
file.puts absolute_path(p)
|
18
18
|
end
|
19
19
|
end
|
20
|
+
puts "Now you get templates path:"
|
21
|
+
puts get_path
|
20
22
|
end
|
21
23
|
def remove_path(path)
|
24
|
+
puts "Now you remove templates path:"
|
25
|
+
puts path
|
22
26
|
path_set = get_path - path.collect { |p| p= absolute_path(p) }
|
23
27
|
File.open(@config_file,"w") do |file|
|
24
28
|
path_set.each do |p|
|
25
29
|
file.puts p
|
26
30
|
end
|
27
|
-
end
|
31
|
+
end
|
32
|
+
puts "Now you get templates path:"
|
33
|
+
puts get_path
|
34
|
+
end
|
35
|
+
def list
|
36
|
+
list = []
|
37
|
+
get_path.uniq.each do |path|
|
38
|
+
list += Dir.entries(path)
|
39
|
+
end
|
40
|
+
puts list-[".",".."]
|
28
41
|
end
|
29
42
|
def execute(argv)
|
30
43
|
parameters = argv[2..100] || [Dir.pwd]
|
data/lib/version.rb
CHANGED
@@ -2,8 +2,28 @@ module Pattern
|
|
2
2
|
module VERSION #:nodoc:
|
3
3
|
MAJOR = 0
|
4
4
|
MINOR = 9
|
5
|
-
TINY =
|
5
|
+
TINY = 3
|
6
6
|
|
7
7
|
STRING = [MAJOR, MINOR, TINY].join('.')
|
8
8
|
end
|
9
|
+
module HELP
|
10
|
+
STRING = <<-EOF
|
11
|
+
pattern is a tool for coding/learning pattern/data structure.
|
12
|
+
Usage:
|
13
|
+
pattern -h/--help
|
14
|
+
pattern -v/--version
|
15
|
+
pattern -l/--list
|
16
|
+
pattern -s/--set [add/remove/default] [template_dir]
|
17
|
+
pattern [tempate_dir] [main_class_name] [-d target_dir]
|
18
|
+
pattern [-t tempate_dir] [-d target_dir("." is default)] [-c classes_name] [-op operations_name]
|
19
|
+
Examples:
|
20
|
+
pattern -l List template you get
|
21
|
+
pattern -s add . Add current dir as templates path
|
22
|
+
pattern ruby.composite Task Generate a composite pattern ,which base class name as Task
|
23
|
+
pattern -t ruby.composite -d E:/dev/pattern/target -c Task;CompositeTask;AddDryIngredientsTask,MixTask;MakeBatterTask -op execute,test
|
24
|
+
Further Help:
|
25
|
+
Further information:
|
26
|
+
https://github.com/azhao1981/pattern
|
27
|
+
EOF
|
28
|
+
end
|
9
29
|
end
|
data/pattern-0.9.2.gem
ADDED
Binary file
|
data/pattern.gemspec
CHANGED
@@ -4,7 +4,7 @@ Gem::Specification.new do |spec|
|
|
4
4
|
# Package information
|
5
5
|
#-----------------------------
|
6
6
|
spec.name = 'pattern'
|
7
|
-
spec.version = '0.9.
|
7
|
+
spec.version = '0.9.3'
|
8
8
|
spec.executables << 'pattern'
|
9
9
|
spec.has_rdoc = true
|
10
10
|
spec.rdoc_options << '--title' << 'Pattern' <<
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pattern
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 61
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 3
|
10
|
+
version: 0.9.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- weizhao
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-07 00:00:00 +08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|