inqlude 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +23 -0
  3. data/{README → README.md} +0 -0
  4. data/TODO +24 -9
  5. data/accessing-inqlude-data.md +55 -0
  6. data/inqlude.gemspec +2 -1
  7. data/lib/cli.rb +36 -4
  8. data/lib/creator.rb +17 -32
  9. data/lib/distros/suse.rb +2 -2
  10. data/lib/downloader.rb +37 -0
  11. data/lib/exceptions.rb +2 -0
  12. data/lib/inqlude.rb +21 -15
  13. data/lib/json_object.rb +104 -0
  14. data/lib/kde_frameworks_creator.rb +14 -10
  15. data/lib/kde_frameworks_release.rb +14 -13
  16. data/lib/library.rb +4 -4
  17. data/lib/manifest.rb +165 -28
  18. data/lib/manifest_handler.rb +14 -16
  19. data/lib/verifier.rb +23 -48
  20. data/lib/version.rb +1 -1
  21. data/lib/view.rb +29 -26
  22. data/manifest-format.md +15 -0
  23. data/spec/data/inqlude-all-karchive.json +31 -0
  24. data/spec/data/inqlude-all.json +120 -0
  25. data/spec/data/invalid-schema.manifest +4 -0
  26. data/spec/data/karchive-release-5.4.manifest +29 -0
  27. data/spec/data/karchive-release.manifest +7 -7
  28. data/spec/data/karchive.readme +0 -6
  29. data/spec/data/newlib/newlib.manifest +11 -4
  30. data/spec/data/rendertest-generic.manifest +4 -1
  31. data/spec/integration/cli_create_spec.rb +24 -0
  32. data/spec/integration/cli_general_spec.rb +19 -0
  33. data/spec/integration/cli_get_involved_spec.rb +14 -0
  34. data/spec/integration/cli_help_spec.rb +21 -0
  35. data/spec/integration/cli_list_spec.rb +23 -0
  36. data/spec/integration/cli_verify_spec.rb +37 -0
  37. data/spec/integration/cli_view_spec.rb +28 -0
  38. data/spec/integration/spec_helper.rb +2 -0
  39. data/spec/{creator_spec.rb → unit/creator_spec.rb} +8 -41
  40. data/spec/unit/downloader_spec.rb +32 -0
  41. data/spec/unit/json_object_spec.rb +273 -0
  42. data/spec/{kde_frameworks_creator_spec.rb → unit/kde_frameworks_creator_spec.rb} +13 -14
  43. data/spec/{kde_frameworks_release_spec.rb → unit/kde_frameworks_release_spec.rb} +14 -10
  44. data/spec/{library_spec.rb → unit/library_spec.rb} +7 -7
  45. data/spec/{manifest_handler_spec.rb → unit/manifest_handler_spec.rb} +21 -17
  46. data/spec/unit/manifest_spec.rb +301 -0
  47. data/spec/{rpm_manifestizer_spec.rb → unit/rpm_manifestizer_spec.rb} +0 -0
  48. data/spec/{settings_spec.rb → unit/settings_spec.rb} +0 -0
  49. data/spec/{spec_helper.rb → unit/spec_helper.rb} +10 -12
  50. data/spec/{verifier_spec.rb → unit/verifier_spec.rb} +24 -15
  51. data/spec/{view_spec.rb → unit/view_spec.rb} +38 -7
  52. data/view/all.html.haml +4 -4
  53. data/view/commercial.html.haml +1 -1
  54. data/view/development.html.haml +3 -3
  55. data/view/get.html.haml +11 -2
  56. data/view/group.html.haml +4 -4
  57. data/view/index.html.haml +1 -1
  58. data/view/library.html.haml +8 -9
  59. data/view/unreleased.html.haml +1 -1
  60. data/yes_ship_it.conf +3 -0
  61. metadata +67 -51
  62. data/spec/manifest_spec.rb +0 -63
@@ -7,7 +7,7 @@ describe KdeFrameworksCreator do
7
7
  describe "#framework" do
8
8
  it "raises error on invalid name" do
9
9
  c = KdeFrameworksCreator.new
10
- expect{c.framework("invalid-name")}.to raise_error
10
+ expect{c.framework("invalid-name")}.to raise_error(InqludeError)
11
11
  end
12
12
  end
13
13
 
@@ -24,9 +24,9 @@ describe KdeFrameworksCreator do
24
24
  }
25
25
  k.fill_in_data framework, manifest
26
26
 
27
- expect( manifest["display_name"] ).to eq "KArchive"
28
- expect( manifest["description"] ).to eq "The intro"
29
- expect( manifest["urls"]["vcs"] ).to eq "http://git.kde.org/karchive"
27
+ expect( manifest.display_name ).to eq "KArchive"
28
+ expect( manifest.description ).to eq "The intro"
29
+ expect( manifest.urls.vcs ).to eq "http://git.kde.org/karchive"
30
30
  end
31
31
  end
32
32
 
@@ -144,7 +144,7 @@ describe KdeFrameworksCreator do
144
144
 
145
145
  f = c.framework("ki18n")
146
146
 
147
- expect( c.errors.count ).to eq 4
147
+ expect( c.errors.count ).to eq 3
148
148
 
149
149
  error_hash = {}
150
150
  c.errors.each do |error|
@@ -154,7 +154,6 @@ describe KdeFrameworksCreator do
154
154
  expect( error_hash.has_key? "missing_title" ).to be true
155
155
  expect( error_hash.has_key? "missing_summary" ).to be true
156
156
  expect( error_hash.has_key? "missing_introduction" ).to be true
157
- expect( error_hash.has_key? "missing_link_home_page" ).to be true
158
157
  end
159
158
 
160
159
  it "generates error for missing summary" do
@@ -173,7 +172,7 @@ describe KdeFrameworksCreator do
173
172
  expect( f["title"] ).to eq "KService"
174
173
  expect( f["summary"] ).to be nil
175
174
 
176
- expect( c.errors.count ).to eq 3
175
+ expect( c.errors.count ).to eq 2
177
176
  end
178
177
 
179
178
  it "optionally doesn't generate error for missing summary" do
@@ -232,13 +231,13 @@ describe KdeFrameworksCreator do
232
231
  manifest = Manifest.parse_file File.join(output_dir,"karchive",
233
232
  "karchive.manifest")
234
233
 
235
- expect( manifest["name"] ).to eq "karchive"
236
- expect( manifest["display_name"] ).to eq "KArchive"
237
- expect( manifest["urls"]["vcs"] ).to eq "https://projects.kde.org/projects/frameworks/karchive/repository"
238
- expect( manifest["urls"]["homepage"] ).to eq "https://projects.kde.org/projects/frameworks/karchive"
239
- expect( manifest["description"] ).to eq "KArchive provides classes for easy reading, creation and manipulation of\n\"archive\" formats like ZIP and TAR.\n\nIf also provides transparent compression and decompression of data, like the\nGZip format, via a subclass of QIODevice."
240
- expect( manifest["urls"]["mailing_list"] ).to eq "https://mail.kde.org/mailman/listinfo/kde-frameworks-devel"
241
- expect( manifest["summary"] ).to eq "Reading, creation, and manipulation of file archives"
234
+ expect( manifest.name ).to eq "karchive"
235
+ expect( manifest.display_name ).to eq "KArchive"
236
+ expect( manifest.urls.vcs ).to eq "https://projects.kde.org/projects/frameworks/karchive/repository"
237
+ expect( manifest.urls.homepage ).to eq "https://projects.kde.org/projects/frameworks/karchive"
238
+ expect( manifest.description ).to eq "KArchive provides classes for easy reading, creation and manipulation of\n\"archive\" formats like ZIP and TAR.\n\nIf also provides transparent compression and decompression of data, like the\nGZip format, via a subclass of QIODevice."
239
+ expect( manifest.urls.mailing_list ).to eq "https://mail.kde.org/mailman/listinfo/kde-frameworks-devel"
240
+ expect( manifest.summary ).to eq "Reading, creation, and manipulation of file archives"
242
241
  end
243
242
 
244
243
  it "overwrites existing manifests" do
@@ -31,8 +31,8 @@ describe KdeFrameworksRelease do
31
31
  k.read_generic_manifests
32
32
 
33
33
  expect( k.generic_manifests.count ).to eq 2
34
- expect( k.generic_manifests[0]["name"] ).to eq "karchive"
35
- expect( k.generic_manifests[1]["name"] ).to eq "kservice"
34
+ expect( k.generic_manifests[0].name ).to eq "karchive"
35
+ expect( k.generic_manifests[1].name ).to eq "kservice"
36
36
  end
37
37
 
38
38
  it "writes release manifests" do
@@ -50,23 +50,27 @@ describe KdeFrameworksRelease do
50
50
  expect( File.exists? manifest_path ).to be true
51
51
 
52
52
  manifest = Manifest.parse_file( manifest_path )
53
- expect( manifest["name"] ).to eq "kservice"
54
- expect( manifest["version"] ).to eq "4.9.90"
55
- expect( manifest["release_date"] ).to eq "2014-02-01"
56
- expect( manifest["schema_type"] ).to eq "release"
53
+ expect(manifest.class).to be ManifestRelease
54
+ expect( manifest.name ).to eq "kservice"
55
+ expect( manifest.version ).to eq "4.9.90"
56
+ expect( manifest.release_date ).to eq "2014-02-01"
57
57
  end
58
58
  end
59
59
 
60
60
  it "creates release manifest from generic manifest" do
61
61
  generic_manifest = Manifest.parse_file(
62
62
  given_file("karchive-generic.manifest") )
63
- date = "2014-07-07"
64
- version = "5.0.0"
63
+ date = "2014-11-06"
64
+ version = "5.4.0"
65
65
  release_manifest = KdeFrameworksRelease.create_release_manifest(
66
66
  generic_manifest, date, version)
67
- expected_json = File.read( given_file("karchive-release.manifest") )
67
+ expected_json = File.read( given_file("karchive-release-5.4.manifest") )
68
68
  expected_json.chomp! # Remove newline added by File.read
69
- expect( Manifest.to_json(release_manifest) ).to eq expected_json
69
+ expect( release_manifest.to_json ).to eq expected_json
70
+ end
71
+
72
+ it "strips patch release" do
73
+ expect(KdeFrameworksRelease.strip_patch_release("5.4.0")).to eq "5.4"
70
74
  end
71
75
 
72
76
  end
@@ -25,8 +25,8 @@ describe Library do
25
25
  library = Library.new
26
26
  library.manifests = manifests
27
27
 
28
- expect( library.generic_manifest["name"] ).to eq "mylib"
29
- expect( library.generic_manifest["schema_type"] ).to eq "generic"
28
+ expect( library.generic_manifest.name ).to eq "mylib"
29
+ expect( library.generic_manifest.class ).to be ManifestGeneric
30
30
  end
31
31
 
32
32
  it "returns relase manifests" do
@@ -40,7 +40,7 @@ describe Library do
40
40
 
41
41
  expect( library.release_manifests.count ).to eq 2
42
42
  library.release_manifests.each do |release_manifest|
43
- expect( release_manifest["schema_type"] ).to eq "release"
43
+ expect( release_manifest.class ).to be ManifestRelease
44
44
  end
45
45
  end
46
46
 
@@ -53,8 +53,8 @@ describe Library do
53
53
  library = Library.new
54
54
  library.manifests = manifests
55
55
 
56
- expect( library.latest_manifest["schema_type"] ).to eq "release"
57
- expect( library.latest_manifest["version"] ).to eq "1.1"
56
+ expect( library.latest_manifest.class ).to be ManifestRelease
57
+ expect( library.latest_manifest.version ).to eq "1.1"
58
58
  end
59
59
 
60
60
  it "returns latest manifest from generic manifest" do
@@ -64,8 +64,8 @@ describe Library do
64
64
  library = Library.new
65
65
  library.manifests = manifests
66
66
 
67
- expect( library.latest_manifest["schema_type"] ).to eq "generic"
68
- expect( library.latest_manifest["version"] ).to be nil
67
+ expect( library.latest_manifest.class ).to be ManifestGeneric
68
+ expect( library.latest_manifest.version ).to be nil
69
69
  end
70
70
 
71
71
  end
@@ -26,14 +26,14 @@ describe ManifestHandler do
26
26
  end
27
27
 
28
28
  it "provides access to manifests" do
29
- expect(mh.manifest("awesomelib").class).to be Hash
30
- expect { mh.manifest("nonexisting") }.to raise_error
29
+ expect(mh.manifest("awesomelib")).to be_a Manifest
30
+ expect { mh.manifest("nonexisting") }.to raise_error(InqludeError)
31
31
  end
32
32
 
33
33
  it "reads schema type" do
34
- expect(mh.manifest("awesomelib")["schema_type"]).to eq "release"
35
- expect(mh.manifest("newlib")["schema_type"]).to eq "generic"
36
- expect(mh.manifest("proprietarylib")["schema_type"]).to eq "proprietary-release"
34
+ expect(mh.manifest("awesomelib").class).to be ManifestRelease
35
+ expect(mh.manifest("newlib").class).to be ManifestGeneric
36
+ expect(mh.manifest("proprietarylib").class).to be ManifestProprietaryRelease
37
37
  end
38
38
 
39
39
  context "default manifest path" do
@@ -63,28 +63,28 @@ describe ManifestHandler do
63
63
  it "returns stable libraries" do
64
64
  libraries = mh.libraries :stable
65
65
  expect( libraries.count ).to eq 2
66
- expect( libraries.first.manifests.last["name"] ).to eq "awesomelib"
67
- expect( libraries.first.manifests.last["version"] ).to eq "0.2.0"
66
+ expect( libraries.first.manifests.last.name ).to eq "awesomelib"
67
+ expect( libraries.first.manifests.last.version ).to eq "0.2.0"
68
68
  end
69
69
 
70
70
  it "returns development versions" do
71
71
  libraries = mh.libraries :edge
72
72
  expect( libraries.count ).to eq 1
73
- expect( libraries.first.manifests.last["name"] ).to eq "bleedingedge"
74
- expect( libraries.first.manifests.last["version"] ).to eq "edge"
73
+ expect( libraries.first.manifests.last.name ).to eq "bleedingedge"
74
+ expect( libraries.first.manifests.last.version ).to eq "edge"
75
75
  end
76
76
 
77
77
  it "returns unreleased libraries" do
78
78
  libraries = mh.unreleased_libraries
79
79
  expect( libraries.count ).to eq 1
80
- expect( libraries.first.manifests.last["name"] ).to eq "newlib"
80
+ expect( libraries.first.manifests.last.name ).to eq "newlib"
81
81
  end
82
82
 
83
83
  it "returns commercial libraries" do
84
84
  libraries = mh.commercial_libraries
85
85
  expect( libraries.count ).to eq 3
86
- expect( libraries.first.manifests.last["name"] ).to eq "awesomelib"
87
- expect( libraries[1].manifests.last["name"] ).to eq "commercial"
86
+ expect( libraries.first.manifests.last.name ).to eq "awesomelib"
87
+ expect( libraries[1].manifests.last.name ).to eq "commercial"
88
88
  end
89
89
 
90
90
  end
@@ -93,7 +93,7 @@ describe ManifestHandler do
93
93
  it "returns all libraries of a group" do
94
94
  libraries = mh.group("kde-frameworks")
95
95
  expect( libraries.count ).to eq 2
96
- expect( libraries.first.manifests.last["name"] ).to eq "awesomelib"
96
+ expect( libraries.first.manifests.last.name ).to eq "awesomelib"
97
97
  end
98
98
  end
99
99
 
@@ -127,15 +127,15 @@ describe ManifestHandler do
127
127
  it "reads generic manifest" do
128
128
  expect( @manifest_handler.library("karchive").manifests.count ).to eq 2
129
129
  generic_manifest = @manifest_handler.library("karchive").generic_manifest
130
- expect( generic_manifest["name"] ).to eq "karchive"
131
- expect( generic_manifest["schema_type"] ).to eq "generic"
130
+ expect( generic_manifest.name ).to eq "karchive"
131
+ expect( generic_manifest.class ).to be ManifestGeneric
132
132
  end
133
133
 
134
134
  it "lists development versions" do
135
135
  libraries = @manifest_handler.libraries :beta
136
136
  expect( libraries.count ).to eq 1
137
- expect( libraries.first.latest_manifest["name"] ).to eq "karchive"
138
- expect( libraries.first.latest_manifest["version"] ).to eq "4.9.90"
137
+ expect( libraries.first.latest_manifest.name ).to eq "karchive"
138
+ expect( libraries.first.latest_manifest.version ).to eq "4.9.90"
139
139
  end
140
140
 
141
141
  it "lists unreleased libraries" do
@@ -144,4 +144,8 @@ describe ManifestHandler do
144
144
  end
145
145
  end
146
146
 
147
+ it "generates inqlude-all.json" do
148
+ expected_json = File.read(test_data_path("inqlude-all.json"))
149
+ expect(mh.generate_inqlude_all).to eq expected_json
150
+ end
147
151
  end
@@ -0,0 +1,301 @@
1
+ require File.expand_path('../spec_helper', __FILE__)
2
+
3
+ describe Manifest do
4
+
5
+ include_context "manifest_files"
6
+
7
+ it "provides schema identifier" do
8
+ expect(ManifestRelease.schema_id).to include("inqlude.org")
9
+ expect(ManifestRelease.schema_id).to include("release")
10
+
11
+ expect(ManifestGeneric.schema_id).to include("inqlude.org")
12
+ expect(ManifestGeneric.schema_id).to include("generic")
13
+
14
+ expect(ManifestProprietaryRelease.schema_id).to include("inqlude.org")
15
+ expect(ManifestProprietaryRelease.schema_id).to include("proprietary")
16
+ end
17
+
18
+ it "returns schema id" do
19
+ expect(ManifestGeneric.schema_id).to eq(
20
+ "http://inqlude.org/schema/generic-manifest-v1#")
21
+ expect(ManifestRelease.schema_id).to eq(
22
+ "http://inqlude.org/schema/release-manifest-v1#")
23
+ expect(ManifestProprietaryRelease.schema_id).to eq(
24
+ "http://inqlude.org/schema/proprietary-release-manifest-v1#")
25
+ end
26
+
27
+ it "parses schema version" do
28
+ expect{Manifest.parse_schema_version("xxx")}.to raise_error(InqludeError)
29
+
30
+ version = Manifest.parse_schema_version(
31
+ "http://inqlude.org/schema/release-manifest-v1#" )
32
+ expect(version).to eq 1
33
+
34
+ version = Manifest.parse_schema_version(
35
+ "http://inqlude.org/schema/release-manifest-v2#" )
36
+ expect(version).to eq 2
37
+
38
+ version = Manifest.parse_schema_version(
39
+ "http://inqlude.org/schema/generic-manifest-v1#" )
40
+ expect(version).to eq 1
41
+ end
42
+
43
+ it "parses release manifest" do
44
+ filename = File.join settings.manifest_path, awesomelib_manifest_file
45
+ manifest = Manifest.parse_file filename
46
+ expect(manifest.class).to be ManifestRelease
47
+ expect(manifest.name).to eq "awesomelib"
48
+ expect(manifest.version).to eq "0.2.0"
49
+
50
+ expect(manifest.filename).to eq "awesomelib.2013-09-08.manifest"
51
+ expect(manifest.libraryname).to eq "awesomelib"
52
+
53
+ expect(manifest.schema_version).to eq 1
54
+ end
55
+
56
+ it "parses generic manifest" do
57
+ filename = File.join settings.manifest_path, newlib_manifest_file
58
+ manifest = Manifest.parse_file filename
59
+ expect(manifest.class).to be ManifestGeneric
60
+ expect(manifest.name).to eq "newlib"
61
+ expect(manifest.version).to eq nil
62
+
63
+ expect(manifest.filename).to eq "newlib.manifest"
64
+
65
+ expect(manifest.schema_version).to eq 1
66
+ end
67
+
68
+ it "writes JSON for release manifest" do
69
+ filename = File.join settings.manifest_path, awesomelib_manifest_file
70
+ manifest = Manifest.parse_file filename
71
+ expect( manifest.to_json ).to eq File.read( filename )
72
+ end
73
+
74
+ it "writes JSON for generic manifest" do
75
+ filename = File.join settings.manifest_path, newlib_manifest_file
76
+ manifest = Manifest.parse_file filename
77
+ expect( manifest.to_json ).to eq File.read( filename )
78
+ end
79
+
80
+ it "has accessors for all attributes" do
81
+ m = ManifestRelease.new
82
+
83
+ m.name = "Name"
84
+ expect(m.name).to eq "Name"
85
+
86
+ m.release_date = Date.parse("2014-08-11")
87
+ expect(m.release_date).to eq Date.parse("2014-08-11")
88
+ expect(m.release_date.to_s).to eq "2014-08-11"
89
+
90
+ m.version = "0.7.0"
91
+ expect(m.version).to eq "0.7.0"
92
+
93
+ m.summary = "One-line summary"
94
+ expect(m.summary).to eq "One-line summary"
95
+
96
+ m.urls.homepage = "http://example.com"
97
+ expect(m.urls.homepage).to eq "http://example.com"
98
+ m.urls.api_docs = "http://example.com/api"
99
+ expect(m.urls.api_docs).to eq "http://example.com/api"
100
+ m.urls.download = "http://example.com/download"
101
+ expect(m.urls.download).to eq "http://example.com/download"
102
+ m.urls.vcs = "https://example.com/git"
103
+ expect(m.urls.vcs).to eq "https://example.com/git"
104
+ m.urls.tutorial = "http://tutorial.example.com"
105
+ expect(m.urls.tutorial).to eq "http://tutorial.example.com"
106
+ m.urls.description_source = "http://wikipedia.de/juhu"
107
+ expect(m.urls.description_source).to eq "http://wikipedia.de/juhu"
108
+ m.urls.announcement = "http://cnn.com/headline"
109
+ expect(m.urls.announcement).to eq "http://cnn.com/headline"
110
+ m.urls.mailing_list = "mailto:list@example.com"
111
+ expect(m.urls.mailing_list).to eq "mailto:list@example.com"
112
+ m.urls.contact = "contact@example.com"
113
+ expect(m.urls.contact).to eq "contact@example.com"
114
+
115
+ m.urls.custom = { "special" => "pointer" }
116
+ expect(m.urls.custom["special"]).to eq "pointer"
117
+
118
+ m.licenses = ["GPLv2", "LGPLv2"]
119
+ expect(m.licenses).to eq ["GPLv2", "LGPLv2"]
120
+
121
+ m.description = "Multi-line description\nwith info."
122
+ expect(m.description).to eq "Multi-line description\nwith info."
123
+
124
+ m.authors = ["Clark Kent <ck@example.com>"]
125
+ expect(m.authors).to be_a Array
126
+ expect(m.authors).to eq ["Clark Kent <ck@example.com>"]
127
+
128
+ m.maturity = "stable"
129
+ expect(m.maturity).to eq "stable"
130
+
131
+ m.platforms = ["Linux", "Windows"]
132
+ expect(m.platforms).to eq ["Linux", "Windows"]
133
+
134
+ m.packages.source = "http://download.example.com/file"
135
+ expect(m.packages.source).to eq "http://download.example.com/file"
136
+
137
+ m.packages.openSUSE = { "something" => "here" }
138
+ expect(m.packages.openSUSE).to eq( { "something" => "here" } )
139
+
140
+ m.group = "kde-frameworks"
141
+ expect(m.group).to eq "kde-frameworks"
142
+ end
143
+
144
+ it "constructs object from schema id" do
145
+ m = Manifest.new(ManifestRelease.schema_id)
146
+ expect(m.schema_version).to eq 1
147
+ end
148
+
149
+ it "returns descendants" do
150
+ expect(Manifest.descendants).to be_a(Array)
151
+ expect(Manifest.descendants.count).to be >= 3
152
+ expect(Manifest.descendants).to include ManifestGeneric
153
+ expect(Manifest.descendants).to include ManifestRelease
154
+ end
155
+
156
+ it "contructs generic manifest from schema id" do
157
+ expect(Manifest.for_schema_id(ManifestGeneric.schema_id)).to(
158
+ be_a ManifestGeneric)
159
+ end
160
+
161
+ it "contructs release manifest from schema id" do
162
+ expect(Manifest.for_schema_id(ManifestRelease.schema_id)).to(
163
+ be_a ManifestRelease)
164
+ end
165
+
166
+ it "contructs proprietary release manifest from schema id" do
167
+ expect(Manifest.for_schema_id(ManifestProprietaryRelease.schema_id)).to(
168
+ be_a ManifestProprietaryRelease)
169
+ end
170
+
171
+ describe ".is_released?" do
172
+ it "returns release state for generic manifest without commercial license" do
173
+ expect(ManifestGeneric.new.is_released?).to be false
174
+ end
175
+
176
+ it "returns release state for generic manifest with only commercial license" do
177
+ manifest = ManifestGeneric.new
178
+ manifest.licenses = ["Commercial"]
179
+ expect(manifest.is_released?).to be true
180
+ end
181
+
182
+ it "returns release state for generic manifest with additional commercial license" do
183
+ manifest = ManifestGeneric.new
184
+ manifest.licenses = ["Commercial", "GPLv2"]
185
+ expect(manifest.is_released?).to be false
186
+ end
187
+
188
+ it "returns release state for release manifest" do
189
+ expect(ManifestRelease.new.is_released?).to be true
190
+ end
191
+
192
+ it "returns release state for proprietary release manifest" do
193
+ expect(ManifestProprietaryRelease.new.is_released?).to be true
194
+ end
195
+ end
196
+
197
+ describe ".path" do
198
+ it "returns generic manifest path" do
199
+ manifest = create_generic_manifest( "mylib" )
200
+ expect( manifest.path ).to eq( "mylib/mylib.manifest" )
201
+ end
202
+
203
+ it "returns release manifest path" do
204
+ manifest = create_manifest( "mylib", "2014-02-01", "1.0" )
205
+ expect( manifest.path ).to eq( "mylib/mylib.2014-02-01.manifest" )
206
+ end
207
+ end
208
+
209
+ describe ".expected_filename" do
210
+ it "returns expected filename for generic manifest" do
211
+ m = ManifestGeneric.new
212
+ m.name = "xyz"
213
+
214
+ expect(m.expected_filename).to eq "xyz.manifest"
215
+ end
216
+
217
+ it "returns expected filename for release manifest" do
218
+ m = ManifestRelease.new
219
+ m.name = "xyz"
220
+ m.release_date = "2014-08-14"
221
+
222
+ expect(m.expected_filename).to eq "xyz.2014-08-14.manifest"
223
+ end
224
+
225
+ it "returns expected filename for proprietary release manifest" do
226
+ m = ManifestProprietaryRelease.new
227
+ m.name = "xyz"
228
+ m.release_date = "2014-08-14"
229
+
230
+ expect(m.expected_filename).to eq "xyz.2014-08-14.manifest"
231
+ end
232
+ end
233
+
234
+ describe ".schema_name" do
235
+ it "returns expected schema name for generic manifest" do
236
+ m = ManifestGeneric.new
237
+ expect(m.schema_name).to eq "generic-manifest-v1"
238
+ end
239
+
240
+ it "returns expected schema name for release manifest" do
241
+ m = ManifestRelease.new
242
+ expect(m.schema_name).to eq "release-manifest-v1"
243
+ end
244
+
245
+ it "returns expected schema name for proprietary release manifest" do
246
+ m = ManifestProprietaryRelease.new
247
+ expect(m.schema_name).to eq "proprietary-release-manifest-v1"
248
+ end
249
+ end
250
+
251
+ describe ".has_version?" do
252
+ it "returns if generic manifest has version" do
253
+ expect(ManifestGeneric.new.has_version?).to be false
254
+ end
255
+
256
+ it "returns if release manifest has version" do
257
+ expect(ManifestGeneric.new.has_version?).to be false
258
+ end
259
+
260
+ it "returns if proprietary release manifest has version" do
261
+ expect(ManifestGeneric.new.has_version?).to be false
262
+ end
263
+ end
264
+
265
+ describe ".create_release_manifest" do
266
+ it "copies all data" do
267
+ generic = ManifestGeneric.new
268
+ generic.name = "MyLib"
269
+ generic.summary = "My Lib"
270
+ generic.urls.homepage = "http://example.com"
271
+ generic.urls.download = "http://example.com/download"
272
+ generic.licenses = ["LGPLv2.1+", "Commercial"]
273
+ generic.description = "My Library"
274
+ generic.authors = "Cornelius Schumacher <schumacher@kde.org>"
275
+ generic.maturity = "stable"
276
+ generic.platforms = ["Linux"]
277
+ generic.packages.source = "ftp://example.com"
278
+ generic.group = "magic"
279
+
280
+ release = generic.create_release_manifest("2014-08-17", "1.0")
281
+
282
+ expect(release.name).to eq "MyLib"
283
+ expect(release.summary).to eq "My Lib"
284
+ expect(release.urls.homepage).to eq "http://example.com"
285
+ expect(release.urls.download).to eq "http://example.com/download"
286
+ expect(release.licenses).to eq ["LGPLv2.1+", "Commercial"]
287
+ expect(release.description).to eq "My Library"
288
+ expect(release.authors).to eq "Cornelius Schumacher <schumacher@kde.org>"
289
+ expect(release.maturity).to eq "stable"
290
+ expect(release.platforms).to eq ["Linux"]
291
+ expect(release.packages.source).to eq "ftp://example.com"
292
+ expect(release.group).to eq "magic"
293
+
294
+ expect(release.release_date).to eq "2014-08-17"
295
+ expect(release.version).to eq "1.0"
296
+ end
297
+
298
+ it "sets release_date and version" do
299
+ end
300
+ end
301
+ end