elf_manifesto 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,11 +2,12 @@
2
2
  "Cucumber Features": {
3
3
  "coverage": {
4
4
  },
5
- "timestamp": 1324569020
5
+ "timestamp": 1324637858
6
6
  },
7
7
  "RSpec": {
8
8
  "coverage": {
9
9
  "/Users/wallace/wip/Workspace/Elf_Manifesto/lib/elf_manifesto/manifest_maker.rb": [
10
+ 1,
10
11
  1,
11
12
  null,
12
13
  1,
@@ -29,15 +30,15 @@
29
30
  null,
30
31
  null,
31
32
  1,
32
- 8,
33
- 8,
34
- 8,
35
- 8,
36
- 8,
37
- 8,
38
- 8,
33
+ 9,
34
+ 9,
35
+ 9,
36
+ 9,
37
+ 9,
38
+ 9,
39
+ 9,
39
40
  null,
40
- 8,
41
+ 9,
41
42
  null,
42
43
  null,
43
44
  1,
@@ -50,19 +51,22 @@
50
51
  null,
51
52
  null,
52
53
  1,
53
- 8,
54
- 8,
54
+ 9,
55
+ 9,
56
+ null,
57
+ 9,
55
58
  null,
56
- 8,
59
+ 19,
60
+ 19,
61
+ 19,
62
+ 67,
57
63
  null,
58
- 18,
59
- 18,
60
- 18,
61
- 18,
62
- 18,
63
- 18,
64
+ 19,
65
+ 19,
66
+ 19,
67
+ 19,
64
68
  null,
65
- 8,
69
+ 9,
66
70
  null,
67
71
  null,
68
72
  null,
@@ -70,6 +74,6 @@
70
74
  null
71
75
  ]
72
76
  },
73
- "timestamp": 1324562274
77
+ "timestamp": 1324637185
74
78
  }
75
79
  }
data/coverage/index.html CHANGED
@@ -23,7 +23,7 @@
23
23
  <img src="./assets/0.5.3/loading.gif" alt="loading"/>
24
24
  </div>
25
25
  <div id="wrapper" style="display:none;">
26
- <div class="timestamp">Generated <abbr class="timeago" title="2011-12-22T15:50:20+00:00">2011-12-22T15:50:20+00:00</abbr></div>
26
+ <div class="timestamp">Generated <abbr class="timeago" title="2011-12-23T10:57:38+00:00">2011-12-23T10:57:38+00:00</abbr></div>
27
27
  <ul class="group_tabs"></ul>
28
28
 
29
29
  <div id="content">
@@ -24,12 +24,12 @@ Feature: Create a Manifest
24
24
  Then the output should contain "<results>"
25
25
 
26
26
  Scenarios: Single globs
27
- | globs | results |
28
- | '*.*' | file1.txt\nfile2 |
29
- | '*.*' | Group1: (*.*) |
30
- | '*.png' | file4 |
31
- | '*.jpg' | file2.jpg |
32
- | '*.jpg' | file3.jpg |
27
+ | globs | results |
28
+ | '*.*' | file1.txt\nfile2 |
29
+ | '*.*' | Group1: (*.*) |
30
+ | '*.png' | file4 |
31
+ | '*.jpg' | file2.jpg |
32
+ | '*.jpg' | file3.jpg |
33
33
 
34
34
  Scenario Outline: render a simple template with multiple globs to the console
35
35
  Given a file named "simple.mustache" with:
@@ -44,21 +44,23 @@ Feature: Create a Manifest
44
44
  Then the output should contain "<results>"
45
45
 
46
46
  Scenarios: single globs
47
- | globs | results |
48
- | '*.*' | file1.txt file2 |
49
- | '*.*' | group1 (*.*) |
50
- | '*.png' | file4 |
51
- | '*.png' | (*.png) |
52
- | '*.jpg' | file2.jpg |
53
- | '*.jpg' | file3.jpg |
47
+ | globs | results |
48
+ | '*.*' | file1.txt file2 |
49
+ | '*.*' | group1 (*.*) |
50
+ | '*.png' | file4 |
51
+ | '*.png' | (*.png) |
52
+ | '*.jpg' | file2.jpg |
53
+ | '*.jpg' | file3.jpg |
54
54
 
55
55
  Scenarios: multiple globs
56
- | globs | results |
57
- | '*.*' '*.png' | group1 |
58
- | '*.*' '*.png' | group2 |
59
- | '*.*' '*.png' | file1.txt |
60
- | '*.*' '*.png' | file4.png |
56
+ | globs | results |
57
+ | '*.*' '*.png' | group1 |
58
+ | '*.*' '*.png' | group2 |
59
+ | '*.*' '*.png' | file1.txt |
60
+ | '*.*' '*.png' | file4.png |
61
61
 
62
+
63
+
62
64
  Scenario: render arbitrary properties
63
65
  Given a file named "simple.mustache" with:
64
66
  """
@@ -71,5 +73,39 @@ Feature: Create a Manifest
71
73
  When I run `manifesto -m simple.mustache --properties "{ group_id: '1234' }" '*.*'`
72
74
  Then the output should contain "1234"
73
75
 
76
+ Scenario Outline: URI escape any file paths
77
+ Given a file named "simple.mustache" with:
78
+ """
79
+ Matched Groups:
80
+ {{#groups}}
81
+ {{name}} ({{path}}):
82
+ Escaped
83
+ {{#files}}
84
+ {{.}}
85
+ {{/files}}
86
+ Raw
87
+ {{#files_raw}}
88
+ {{.}}
89
+ {{/files_raw}}
90
+ {{/groups}}
91
+ """
92
+ And some empty files path/file1.txt path/file2.jpg
93
+ When I run `manifesto --template simple.mustache "**/*.*"`
94
+ Then the output should contain "<results>"
95
+
96
+ Scenarios: Escaped paths
97
+ | results |
98
+ | path%2Ffile1.txt |
99
+ | path%2Ffile2.jpg |
100
+
101
+ Scenarios: Raw paths
102
+ | results |
103
+ | path/file1.txt |
104
+ | path/file2.jpg |
105
+
106
+
107
+
108
+
109
+
110
+
74
111
 
75
-
@@ -1,4 +1,4 @@
1
1
  module ElfManifesto
2
2
  # Tools for creating manifests from file collections and Mustache Templates
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
@@ -1,4 +1,5 @@
1
1
  require 'mustache'
2
+ require 'cgi'
2
3
 
3
4
  module ElfManifesto
4
5
 
@@ -47,8 +48,11 @@ module ElfManifesto
47
48
  globs.each do |glob|
48
49
  # e.g { group1: { path: '*.*', files: [file1, file2]} }
49
50
  group_name = "group#{pos}"
50
- files = Dir.glob(glob)
51
- file_group_object = { name: group_name, path: glob, files: files }
51
+ files_raw = Dir.glob(glob)
52
+ files = files_raw.map do |f|
53
+ CGI.escape f
54
+ end
55
+ file_group_object = { name: group_name, path: glob, files: files , files_raw: files_raw}
52
56
  file_groups[group_name.to_sym] = file_group_object
53
57
  file_groups[:groups].push file_group_object
54
58
  pos += 1
@@ -1,6 +1,9 @@
1
1
  Matched Groups:
2
2
  {{#groups}}
3
- {{name}} ({{path}}): {{#files}}{{.}} {{/files}}
3
+ {{name}} ({{path}}):
4
+ {{#files}}
5
+ {{.}}
6
+ {{/files}}
4
7
  {{/groups}}
5
8
 
6
9
  Each file glob passed in creates a new file group. Each group has a name, path and files property. Reference specific file groups by their name which is 'group' followed by the group number. So 'group1' for the first group etc.
@@ -11,5 +14,10 @@ And the files matching it are:
11
14
  {{.}}
12
15
  {{/group1.files}}
13
16
 
17
+ For the raw (unescaped paths)
18
+ {{#group1.files_raw}}
19
+ {{.}}
20
+ {{/group1.files_raw}}
21
+
14
22
  {{#props}}Properties{{/props}}
15
23
  {{props}}
data/readme.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  A gem for creating file manifests from Mustache templates
4
4
 
5
+ ## Change Log ##
6
+
7
+ V1.1.0
8
+ * File paths are URI escaped. Raw paths stored in files_raw collection for each file group.
9
+
5
10
  ## Usage ##
6
11
 
7
12
  Run from the command line. Provide a template file and pass in a number of file globs ("*.jpg", or "images/*.*" for example). Each file collection returned from the each glob will be used to populate the given template.
@@ -72,7 +77,7 @@ To use a built in template use the -s switch with the template name
72
77
 
73
78
  or just prefix the template name with an underscore
74
79
 
75
- `manifesto -m ims "*.*"`
80
+ `manifesto -m _ims "*.*"`
76
81
 
77
82
  ---
78
83
  ## Using config files ##
@@ -5,6 +5,8 @@ require 'mustache'
5
5
  all_files = ['file1.txt', 'file2.', 'file3.txt', 'image1.jpg', 'image2.jpg']
6
6
  image_files = ['image1.jpg', 'image2.jpg']
7
7
  txt_files = ['file1.txt', 'file2.', 'file3.txt']
8
+ deep_files = ['path/image1.jpg', 'path/image2.jpg']
9
+ deep_files_escaped = ['path%2Fimage1.jpg', 'path%2Fimage2.jpg']
8
10
 
9
11
  describe "Creating a manifest." do
10
12
  before(:each) do
@@ -52,6 +54,20 @@ describe "Creating a manifest." do
52
54
  manifesto.file_groups[:group3][:files].should eq txt_files
53
55
  end
54
56
 
57
+ it "should URI escape any paths" do
58
+ Dir.should_receive(:glob).with('**/*.jpg').and_return(deep_files)
59
+ mock_input_file_read "duff.template", simple_template()
60
+
61
+ ops = {
62
+ template: 'duff.template',
63
+ globs: ['**/*.jpg']
64
+ }
65
+
66
+ manifesto = ElfManifesto::ManifestMaker.new(ops)
67
+ manifesto.file_groups[:group1][:files].should eq deep_files_escaped
68
+ manifesto.file_groups[:group1][:files_raw].should eq deep_files
69
+ end
70
+
55
71
  describe "gathering information about the groups" do
56
72
  before(:each) do
57
73
  Dir.should_receive(:glob).with('*.jpg').and_return(image_files)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elf_manifesto
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-22 00:00:00.000000000Z
12
+ date: 2011-12-23 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70128444603640 !ruby/object:Gem::Requirement
16
+ requirement: &70301611178260 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.9.2.2
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70128444603640
24
+ version_requirements: *70301611178260
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler
27
- requirement: &70128444602080 !ruby/object:Gem::Requirement
27
+ requirement: &70301611176700 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.0.21
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70128444602080
35
+ version_requirements: *70301611176700
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &70128444600900 !ruby/object:Gem::Requirement
38
+ requirement: &70301611175660 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.7.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70128444600900
46
+ version_requirements: *70301611175660
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: cucumber
49
- requirement: &70128444599800 !ruby/object:Gem::Requirement
49
+ requirement: &70301611174700 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.1.4
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70128444599800
57
+ version_requirements: *70301611174700
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: guard-cucumber
60
- requirement: &70128444598840 !ruby/object:Gem::Requirement
60
+ requirement: &70301611173620 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 0.7.4
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70128444598840
68
+ version_requirements: *70301611173620
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: aruba
71
- requirement: &70128444598020 !ruby/object:Gem::Requirement
71
+ requirement: &70301611172840 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.4.9
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70128444598020
79
+ version_requirements: *70301611172840
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: simplecov
82
- requirement: &70128444597140 !ruby/object:Gem::Requirement
82
+ requirement: &70301611171840 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 0.4.0
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70128444597140
90
+ version_requirements: *70301611171840
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: guard-rspec
93
- requirement: &70128444596260 !ruby/object:Gem::Requirement
93
+ requirement: &70301611151480 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70128444596260
101
+ version_requirements: *70301611151480
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: growl
104
- requirement: &70128444595360 !ruby/object:Gem::Requirement
104
+ requirement: &70301611150100 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70128444595360
112
+ version_requirements: *70301611150100
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: rb-fsevent
115
- requirement: &70128444594480 !ruby/object:Gem::Requirement
115
+ requirement: &70301611148840 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: '0'
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *70128444594480
123
+ version_requirements: *70301611148840
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: commander
126
- requirement: &70128444593500 !ruby/object:Gem::Requirement
126
+ requirement: &70301611147380 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ~>
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: 4.0.6
132
132
  type: :runtime
133
133
  prerelease: false
134
- version_requirements: *70128444593500
134
+ version_requirements: *70301611147380
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: mustache
137
- requirement: &70128444592580 !ruby/object:Gem::Requirement
137
+ requirement: &70301611146440 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ~>
@@ -142,7 +142,7 @@ dependencies:
142
142
  version: 0.99.4
143
143
  type: :runtime
144
144
  prerelease: false
145
- version_requirements: *70128444592580
145
+ version_requirements: *70301611146440
146
146
  description: Primarily used for creating SCORM manifests. Uses mustache templates
147
147
  and file info to create manifests. Intended for use from the command line or on
148
148
  the build server.
@@ -241,7 +241,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
241
241
  version: '0'
242
242
  segments:
243
243
  - 0
244
- hash: 4463735547941563043
244
+ hash: -854480500229421632
245
245
  required_rubygems_version: !ruby/object:Gem::Requirement
246
246
  none: false
247
247
  requirements:
@@ -250,7 +250,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
250
250
  version: '0'
251
251
  segments:
252
252
  - 0
253
- hash: 4463735547941563043
253
+ hash: -854480500229421632
254
254
  requirements: []
255
255
  rubyforge_project: ELF_Manifesto
256
256
  rubygems_version: 1.8.10