dnnbundler 0.1.5 → 0.1.6
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.
- checksums.yaml +4 -4
- data/README.md +35 -19
- data/lib/dnnbundler/cli.rb +28 -6
- data/lib/dnnbundler/fileStringReplacer/fileStringReplacer.rb +26 -0
- data/lib/dnnbundler/version.rb +1 -1
- data/lib/dnnbundler/zipFileGenerator.rb +2 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 96c347bb2f330fdeefd588f01d2721339587b80d
|
|
4
|
+
data.tar.gz: d69601f50871db50d78185c5dbcad341d475eb7b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f2e22d533440874f46923a28e58b0ce8f1ca8e50f23fb63ae4a08b5cffe4dea32b7b12d76f447d3678872d205191771a2679718177df31b5f6691dc2e1c65b32
|
|
7
|
+
data.tar.gz: 148501b005a3fec11644306275be2d60e0eb6d6b7aec9c2571ce0f2f83d0e4fb2579b6c4fa11877015abb3e8d989cf943476149211a9c32d5c4cc630164027b4
|
data/README.md
CHANGED
|
@@ -25,34 +25,50 @@ Or install it yourself as:
|
|
|
25
25
|
To configure packaging create a json config with the following schema:
|
|
26
26
|
|
|
27
27
|
{
|
|
28
|
-
"
|
|
29
|
-
"entries": [
|
|
30
|
-
"path_to_file",
|
|
31
|
-
"path_to_directory", // real path in file system to file or directory
|
|
28
|
+
"packages": [
|
|
32
29
|
{
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
30
|
+
"name": "out.[PACKAGE_VERSION].zip", // [PACKAGE_VERSION] is a placeholder for package version which will be taken from manifest file
|
|
31
|
+
"entries": [
|
|
32
|
+
"path_to_file",
|
|
33
|
+
"path_to_directory", // real path in file system to file or directory
|
|
34
|
+
{
|
|
35
|
+
"type": "file", // type of entry, if absent will be treated as 'file'
|
|
36
|
+
"name": "test.json", // real path in file system to file or directory
|
|
37
|
+
"path": "new_path_in_zip" // optional
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"type": "zip", // nested zip archive
|
|
41
|
+
"name": "test.zip", // name of nested zip archive, can include directories. 'path' property is being ignored for this kind of entries
|
|
42
|
+
"ignoreEntries": [ ... ] // local array of entries to ignore
|
|
43
|
+
"entries": [ // array of entries for nested zip file, same format as above
|
|
44
|
+
"file",
|
|
45
|
+
"dir",
|
|
46
|
+
...
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"ignoreEntries": [
|
|
51
|
+
".DS_Store"
|
|
45
52
|
]
|
|
46
53
|
}
|
|
47
54
|
],
|
|
48
|
-
"
|
|
49
|
-
"
|
|
55
|
+
"manifests": [
|
|
56
|
+
"path_to_dnn_manifest" // dnn manifest file
|
|
50
57
|
]
|
|
51
58
|
}
|
|
52
59
|
|
|
53
60
|
to create package run:
|
|
54
61
|
|
|
55
|
-
dnnbundler path_to_config.json
|
|
62
|
+
dnnbundler build path_to_config.json
|
|
63
|
+
|
|
64
|
+
it is possible to increment build or sprint numbers:
|
|
65
|
+
|
|
66
|
+
dnnbundler build path_to_config.json --bumpBuild
|
|
67
|
+
dnnbundler build path_to_config.json --bumpSprint
|
|
68
|
+
|
|
69
|
+
it is also possible to specify custom version number:
|
|
70
|
+
|
|
71
|
+
dnnbundler build path_to_config.json --targetVersion 2017.08.0004
|
|
56
72
|
|
|
57
73
|
## Development
|
|
58
74
|
|
data/lib/dnnbundler/cli.rb
CHANGED
|
@@ -1,21 +1,43 @@
|
|
|
1
1
|
require "dnnbundler/zipFileGenerator"
|
|
2
|
+
require "dnnbundler/fileStringReplacer/fileStringReplacer"
|
|
2
3
|
require "thor"
|
|
3
4
|
require "json"
|
|
4
5
|
|
|
5
6
|
module Dnnbundler
|
|
6
7
|
class CLI < Thor
|
|
7
|
-
desc "build CONFIG", ""
|
|
8
|
+
desc "build CONFIG [options]", "creates a zip package according to given configuration file"
|
|
8
9
|
option :bumpBuild
|
|
10
|
+
option :bumpSprint
|
|
11
|
+
option :targetVersion, :type => :string
|
|
9
12
|
def build( config )
|
|
10
13
|
puts "Build with config #{config}"
|
|
11
14
|
file = File.read(config)
|
|
12
15
|
data_hash = JSON.parse(file)
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
manifest_files = data_hash["manifests"]
|
|
18
|
+
current_version = Dnnbundler::getVersionFromManifest manifest_files[0]
|
|
19
|
+
version_numbers = current_version.split(".").map { |x| x.to_i }
|
|
20
|
+
|
|
21
|
+
version_numbers[1] = version_numbers[1] + 1 if options[:bumpSprint]
|
|
22
|
+
version_numbers[2] = 1 if options[:bumpSprint]
|
|
23
|
+
version_numbers[2] = version_numbers[2] + 1 if options[:bumpBuild]
|
|
24
|
+
version_numbers = options[:targetVersion].split(".").map { |x| x.to_i } if options[:targetVersion]
|
|
25
|
+
|
|
26
|
+
new_version = Dnnbundler::formatVersion(version_numbers)
|
|
27
|
+
puts "current version is #{current_version}"
|
|
28
|
+
puts "new version is #{new_version}"
|
|
29
|
+
|
|
30
|
+
data_hash["packages"].each do |package|
|
|
31
|
+
package["name"].sub! "[PACKAGE_VERSION]", new_version
|
|
32
|
+
Dnnbundler::replaceVersionInManifestFiles manifest_files, new_version
|
|
33
|
+
|
|
34
|
+
generator = ZipFileGenerator.new(package)
|
|
35
|
+
generator.write
|
|
36
|
+
end
|
|
19
37
|
end
|
|
20
38
|
end
|
|
39
|
+
|
|
40
|
+
def self.formatVersion(version)
|
|
41
|
+
"#{version[0].to_s.rjust(4, "0")}.#{version[1].to_s.rjust(2, "0")}.#{version[2].to_s.rjust(4, "0")}"
|
|
42
|
+
end
|
|
21
43
|
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Dnnbundler
|
|
2
|
+
def self.replaceVersionInManifestFiles(file_names, new_version)
|
|
3
|
+
file_names.each do |file_name|
|
|
4
|
+
text = File.read(file_name)
|
|
5
|
+
replace_expr = '\1' + new_version + '\3'
|
|
6
|
+
text.gsub!(ManifestVersionRegex::NewManifestRegex, replace_expr )
|
|
7
|
+
text.gsub!(ManifestVersionRegex::OldManifestRegex, replace_expr )
|
|
8
|
+
|
|
9
|
+
# To merely print the contents of the file, use:
|
|
10
|
+
# puts new_contents
|
|
11
|
+
|
|
12
|
+
# To write changes to the file, use:
|
|
13
|
+
File.open(file_name, "w") {|file| file.puts text }
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.getVersionFromManifest(file_name)
|
|
18
|
+
text = File.read(file_name)
|
|
19
|
+
(ManifestVersionRegex::NewManifestRegex.match(text) || ManifestVersionRegex::OldManifestRegex.match(text)).captures[1]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
module ManifestVersionRegex
|
|
23
|
+
OldManifestRegex = /(<version>)(\d*?\.\d*?\.\d*)(<\/version>)/
|
|
24
|
+
NewManifestRegex = /(<package .*? version=")(\d*?\.\d*?\.\d*)(.*?>)/
|
|
25
|
+
end
|
|
26
|
+
end
|
data/lib/dnnbundler/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dnnbundler
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Le0Michine
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-04-
|
|
11
|
+
date: 2017-04-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: thor
|
|
@@ -102,6 +102,7 @@ files:
|
|
|
102
102
|
- lib/dnnbundler/cli.rb
|
|
103
103
|
- lib/dnnbundler/fileEntry.rb
|
|
104
104
|
- lib/dnnbundler/fileEntryType.rb
|
|
105
|
+
- lib/dnnbundler/fileStringReplacer/fileStringReplacer.rb
|
|
105
106
|
- lib/dnnbundler/jsonConfig.rb
|
|
106
107
|
- lib/dnnbundler/version.rb
|
|
107
108
|
- lib/dnnbundler/zipFileGenerator.rb
|