tpkg 1.21.1 → 1.22.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/tpkg/deployer.rb CHANGED
@@ -156,7 +156,7 @@ class Deployer
156
156
  # deploy_params is an array that holds the list of paramters that is used when invoking tpkg on to the remote
157
157
  # servers where we want to deploy to.
158
158
  #
159
- # servers is an array or a callback that list the remote servers where we want to deploy to
159
+ # servers is an array, a filename or a callback that list the remote servers where we want to deploy to
160
160
  def deploy(deploy_params, servers)
161
161
  params = deploy_params.join(" ")
162
162
  cmd = "tpkg #{params} -n"
@@ -175,6 +175,13 @@ class Deployer
175
175
  deploy_to = []
176
176
  if servers.kind_of?(Proc)
177
177
  deploy_to = servers.call
178
+ elsif servers.size == 1 && File.exists?(servers[0])
179
+ File.open(servers[0], 'r') do |f|
180
+ while line = f.gets
181
+ deploy_to << line.chomp.split(",")
182
+ end
183
+ end
184
+ deploy_to.flatten!
178
185
  else
179
186
  deploy_to = servers
180
187
  end
data/lib/tpkg/metadata.rb CHANGED
@@ -230,12 +230,12 @@ class Metadata
230
230
  end
231
231
 
232
232
  def self.get_pkgs_metadata_from_yml_doc(yml_doc, metadata=nil, source=nil)
233
- metadata = {} if metadata.nil?
233
+ metadata ||= {}
234
234
  metadata_lists = yml_doc.split("---")
235
235
  metadata_lists.each do | metadata_text |
236
236
  if metadata_text =~ /^:?name:(.+)/
237
237
  name = $1.strip
238
- metadata[name] = [] if !metadata[name]
238
+ metadata[name] ||= []
239
239
  metadata[name] << Metadata.new(metadata_text,'yml', source)
240
240
  end
241
241
  end
@@ -363,6 +363,14 @@ class Metadata
363
363
  # TODO: use DTD to validate XML
364
364
  errors = verify_required_fields
365
365
  end
366
+
367
+ # Verify version and package version begin with a digit
368
+ if to_hash[:version].to_s !~ /^\d/
369
+ errors << "Version must begins with a digit"
370
+ end
371
+ if to_hash[:package_version] && to_hash[:package_version].to_s !~ /^\d/
372
+ errors << "Package version must begins with a digit"
373
+ end
366
374
  errors
367
375
  end
368
376
 
@@ -0,0 +1,86 @@
1
+ type: map
2
+ mapping:
3
+ "schema_file": { type: text }
4
+ "name": { type: str, required: yes }
5
+ "version": { type: text, required: yes }
6
+ "package_version": { type: text }
7
+ "maintainer": { type: str, required: yes }
8
+ "operatingsystem": { type: seq, sequence: [ {type: str} ] }
9
+ "architecture": { type: seq, sequence: [ {type: str} ] }
10
+ "description": { type: str }
11
+ "bugreporting": { type: str }
12
+ "dependencies":
13
+ type: seq
14
+ sequence:
15
+ - type: map
16
+ mapping:
17
+ "name": { type: str, required: yes }
18
+ "minimum_version": { type: text }
19
+ "maximum_version": { type: text }
20
+ "minimum_package_version": { type: text }
21
+ "maximum_package_version": { type: text }
22
+ "native": { type: bool }
23
+ "type": { type: any, pattern: /(native|tpkg)$/ }
24
+ "conflicts":
25
+ type: seq
26
+ sequence:
27
+ - type: map
28
+ mapping:
29
+ "name": { type: str, required: yes }
30
+ "minimum_version": { type: text }
31
+ "maximum_version": { type: text }
32
+ "minimum_package_version": { type: text }
33
+ "maximum_package_version": { type: text }
34
+ "native": { type: bool }
35
+ "type": { type: any, pattern: /(native|tpkg)$/ }
36
+ "externals":
37
+ type: seq
38
+ sequence:
39
+ - type: map
40
+ mapping:
41
+ "name": { type: text, required: yes }
42
+ "data": { type: text }
43
+ "datascript": { type: text }
44
+ "datafile": { type: text }
45
+ "files":
46
+ type: map
47
+ mapping:
48
+ "file_defaults":
49
+ type: map
50
+ mapping:
51
+ "posix":
52
+ type: map
53
+ mapping:
54
+ "owner": { type: text }
55
+ "group": { type: text }
56
+ "perms": { type: text }
57
+ "dirs_defaults":
58
+ type: map
59
+ mapping:
60
+ "posix":
61
+ type: map
62
+ mapping:
63
+ "owner": { type: text }
64
+ "group": { type: text }
65
+ "perms": { type: text }
66
+ "files":
67
+ type: seq
68
+ sequence:
69
+ - type: map
70
+ mapping:
71
+ "path": { type: text, required: yes }
72
+ "encrypt": { type: any, pattern: /^true$|^precrypt$/ }
73
+ "init":
74
+ type: map
75
+ mapping:
76
+ "start": { type: int }
77
+ "levels": { type: seq, sequence: [ { type: int } ] }
78
+ "crontab":
79
+ type: map
80
+ mapping: { "user": { type: str } }
81
+ "posix":
82
+ type: map
83
+ mapping: { "owner": { type: text },
84
+ "group": { type: text },
85
+ "perms": { type: text } }
86
+
data/schema/schema.yml CHANGED
@@ -41,6 +41,7 @@ mapping:
41
41
  "name": { type: text, required: yes }
42
42
  "data": { type: text }
43
43
  "datascript": { type: text }
44
+ "datafile": { type: text }
44
45
  "files":
45
46
  type: map
46
47
  mapping:
@@ -82,3 +83,4 @@ mapping:
82
83
  mapping: { "owner": { type: text },
83
84
  "group": { type: text },
84
85
  "perms": { type: text } }
86
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tpkg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.21.1
4
+ version: 1.22.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darren Dao
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2010-03-17 00:00:00 -07:00
13
+ date: 2010-04-23 00:00:00 +00:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -55,24 +55,25 @@ extensions: []
55
55
  extra_rdoc_files: []
56
56
 
57
57
  files:
58
- - bin/cpan2tpkg
59
- - bin/tpkg_xml_to_yml
60
- - bin/tpkg
61
- - bin/gem2tpkg
62
- - schema/tpkg.dtd
63
- - schema/schema-1.0.yml
64
- - schema/tpkg-1.0.0.dtd
65
- - schema/tpkg-1.0.4.dtd
66
- - schema/tpkg-1.0.3.dtd
67
- - schema/schema.yml
68
- - schema/tpkg-1.0.5.dtd
69
- - schema/tpkg-1.0.2.dtd
70
- - schema/tpkg-1.0.1.dtd
71
58
  - lib/tpkg/versiontype.rb
72
59
  - lib/tpkg/deployer.rb
73
60
  - lib/tpkg/thread_pool.rb
74
61
  - lib/tpkg/metadata.rb
75
62
  - lib/tpkg.rb
63
+ - schema/tpkg-1.0.4.dtd
64
+ - schema/tpkg-1.0.0.dtd
65
+ - schema/tpkg-1.0.5.dtd
66
+ - schema/tpkg.dtd
67
+ - schema/tpkg-1.0.1.dtd
68
+ - schema/tpkg-1.0.3.dtd
69
+ - schema/schema.yml
70
+ - schema/tpkg-1.0.2.dtd
71
+ - schema/schema-1.0.yml
72
+ - schema/schema-1.0.5.yml
73
+ - bin/tpkg
74
+ - bin/cpan2tpkg
75
+ - bin/gem2tpkg
76
+ - bin/tpkg_xml_to_yml
76
77
  - Rakefile
77
78
  has_rdoc: true
78
79
  homepage: http://tpkg.sourceforge.net