dnnbundler 0.1.7 → 0.1.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ca56a3f1880eddf8ae88de939be914073adcaec
4
- data.tar.gz: 781a3d692a996658ceaf8e0fd13aecfe4c36a3d8
3
+ metadata.gz: a4d04c6bbc8840bdec4b355fe9ff974c680a6eff
4
+ data.tar.gz: c4f172b99b1299d817e7c2815aa78e353ec95125
5
5
  SHA512:
6
- metadata.gz: 72a173d766a4d92933902663f2dd730c5a4278927dc6438f5b0f31167811f66829d8ab5876cef3e60c5c4a61858be467e4ac27cba4ae863b49c78438148ad89d
7
- data.tar.gz: 55d925638392936f619cfac4424cf46d84ec7c4d7ea3f1586e2dbd1e2f77381c0a57ee4c6762e7154a6071b24ca1d0a9b8dbcc6079ca6decb848b5cc5faa37f7
6
+ metadata.gz: 7e5e10d0042af66c58ced4256aa715ecb3617a8ee7e74b62cf04cc4c1fd48ea35f4522d3b22107d6c0283ff2b24bf5dec539f31c62b83edbf54a397302b09891
7
+ data.tar.gz: e38d0553f926cbfd4c1b8da91b789a54f05ece9a65041d253bd923d5c6bbd6f36e8631f5f6cc9268b2eb43dc74a4091de2bc63563ff56613635738b39d10101a
data/.gitignore CHANGED
@@ -1,9 +1,9 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/CODE_OF_CONDUCT.md CHANGED
@@ -1,74 +1,74 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at leomichine@gmail.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at leomichine@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in dnnbundler.gemspec
4
- gemspec
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in dnnbundler.gemspec
4
+ gemspec
data/LICENSE.txt CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2017 Le0Michine
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Le0Michine
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,88 +1,88 @@
1
- # Dnnbundler
2
-
3
- DNNBundler is intended to automate creation of zip packages for DotNetNuke.
4
- Put your Ruby code in the file `lib/dnnbundler`. To experiment with that code, run `bin/console` for an interactive prompt.
5
-
6
- TODO: Delete this and the text above, and describe your gem
7
-
8
- ## Installation
9
-
10
- Add this line to your application's Gemfile:
11
-
12
- ```ruby
13
- gem 'dnnbundler'
14
- ```
15
-
16
- And then execute:
17
-
18
- $ bundle
19
-
20
- Or install it yourself as:
21
-
22
- $ gem install dnnbundler
23
-
24
- ## Usage
25
-
26
- To configure packaging create a json config with the following schema:
27
-
28
- {
29
- "packages": [
30
- {
31
- "name": "out.[PACKAGE_VERSION].zip", // [PACKAGE_VERSION] is a placeholder for package version which will be taken from manifest file
32
- "entries": [
33
- "path_to_file",
34
- "path_to_directory", // real path in file system to file or directory
35
- {
36
- "type": "file", // type of entry, if absent will be treated as 'file'
37
- "name": "test.json", // real path in file system to file or directory
38
- "path": "new_path_in_zip" // optional
39
- },
40
- {
41
- "type": "zip", // nested zip archive
42
- "name": "test.zip", // name of nested zip archive, can include directories. 'path' property is being ignored for this kind of entries
43
- "ignoreEntries": [ ... ] // local array of entries to ignore
44
- "entries": [ // array of entries for nested zip file, same format as above
45
- "file",
46
- "dir",
47
- ...
48
- ]
49
- }
50
- ],
51
- "ignoreEntries": [
52
- ".DS_Store"
53
- ]
54
- }
55
- ],
56
- "manifests": [
57
- "path_to_dnn_manifest" // dnn manifest file
58
- ]
59
- }
60
-
61
- to create package run:
62
-
63
- dnnbundler build path_to_config.json
64
-
65
- it is possible to increment build or sprint numbers:
66
-
67
- dnnbundler build path_to_config.json --bumpBuild
68
- dnnbundler build path_to_config.json --bumpSprint
69
-
70
- it is also possible to specify custom version number:
71
-
72
- dnnbundler build path_to_config.json --targetVersion 2017.08.0004
73
-
74
- ## Development
75
-
76
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
77
-
78
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
79
-
80
- ## Contributing
81
-
82
- Bug reports and pull requests are welcome on GitHub at https://github.com/Le0Michine/dnnbundler. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
83
-
84
-
85
- ## License
86
-
87
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
88
-
1
+ # Dnnbundler
2
+
3
+ DNNBundler is intended to automate creation of zip packages for DotNetNuke.
4
+ Put your Ruby code in the file `lib/dnnbundler`. To experiment with that code, run `bin/console` for an interactive prompt.
5
+
6
+ TODO: Delete this and the text above, and describe your gem
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'dnnbundler'
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install dnnbundler
23
+
24
+ ## Usage
25
+
26
+ To configure packaging create a json config with the following schema:
27
+
28
+ {
29
+ "packages": [
30
+ {
31
+ "name": "out.[PACKAGE_VERSION].zip", // [PACKAGE_VERSION] is a placeholder for package version which will be taken from manifest file
32
+ "entries": [
33
+ "path_to_file",
34
+ "path_to_directory", // real path in file system to file or directory
35
+ {
36
+ "type": "file", // type of entry, if absent will be treated as 'file'
37
+ "name": "test.json", // real path in file system to file or directory
38
+ "path": "new_path_in_zip" // optional
39
+ },
40
+ {
41
+ "type": "zip", // nested zip archive
42
+ "name": "test.zip", // name of nested zip archive, can include directories. 'path' property is being ignored for this kind of entries
43
+ "ignoreEntries": [ ... ], // local array of entries to ignore
44
+ "entries": [ // array of entries for nested zip file, same format as above
45
+ "file",
46
+ "dir",
47
+ "..."
48
+ ]
49
+ }
50
+ ],
51
+ "ignoreEntries": [
52
+ ".DS_Store"
53
+ ]
54
+ }
55
+ ],
56
+ "manifests": [
57
+ "path_to_dnn_manifest" // dnn manifest file
58
+ ]
59
+ }
60
+
61
+ to create package run:
62
+
63
+ dnnbundler build path_to_config.json
64
+
65
+ it is possible to increment build or sprint numbers:
66
+
67
+ dnnbundler build path_to_config.json --bumpBuild
68
+ dnnbundler build path_to_config.json --bumpSprint
69
+
70
+ it is also possible to specify custom version number:
71
+
72
+ dnnbundler build path_to_config.json --targetVersion 2017.08.0004
73
+
74
+ ## Development
75
+
76
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
77
+
78
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
79
+
80
+ ## Contributing
81
+
82
+ Bug reports and pull requests are welcome on GitHub at https://github.com/Le0Michine/dnnbundler. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
83
+
84
+
85
+ ## License
86
+
87
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
88
+
data/Rakefile CHANGED
@@ -1,2 +1,2 @@
1
- require "bundler/gem_tasks"
2
- task :default => :spec
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/console CHANGED
@@ -1,14 +1,14 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "dnnbundler"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "dnnbundler"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup CHANGED
@@ -1,8 +1,8 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/dnnbundler.gemspec CHANGED
@@ -1,30 +1,31 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'dnnbundler/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "dnnbundler"
8
- spec.version = Dnnbundler::VERSION
9
- spec.authors = ["Le0Michine"]
10
- spec.email = ["leomichine@gmail.com"]
11
-
12
- spec.summary = %q{Creates zip packages for DNN.}
13
- spec.description = %q{Creates zip packages with complex structure.}
14
- spec.homepage = "https://github.com/Le0Michine/dnnbundler"
15
- spec.license = "MIT"
16
-
17
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
- f.match(%r{^(test|spec|features)/})
19
- end
20
- spec.bindir = "exe"
21
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
- spec.require_paths = ["lib"]
23
-
24
- spec.add_dependency "thor"
25
- spec.add_dependency "rubyzip"
26
- spec.add_dependency "json"
27
-
28
- spec.add_development_dependency "bundler", "~> 1.14"
29
- spec.add_development_dependency "rake", "~> 10.0"
30
- end
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'dnnbundler/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "dnnbundler"
8
+ spec.version = Dnnbundler::VERSION
9
+ spec.authors = ["Le0Michine"]
10
+ spec.email = ["leomichine@gmail.com"]
11
+
12
+ spec.summary = %q{Creates zip packages for DNN.}
13
+ spec.description = %q{Creates zip packages with complex structure.}
14
+ spec.homepage = "https://github.com/Le0Michine/dnnbundler"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_dependency "thor"
25
+ spec.add_dependency "rubyzip"
26
+ spec.add_dependency "json"
27
+ spec.add_dependency "zipbundler"
28
+
29
+ spec.add_development_dependency "bundler", "~> 1.14"
30
+ spec.add_development_dependency "rake", "~> 10.0"
31
+ end
data/exe/dnnbundler CHANGED
@@ -1,5 +1,5 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "dnnbundler"
4
-
1
+ #!/usr/bin/env ruby
2
+
3
+ require "dnnbundler"
4
+
5
5
  Dnnbundler::CLI.start( ARGV )
@@ -1,48 +1,54 @@
1
- require "dnnbundler/zipFileGenerator"
2
- require "dnnbundler/packageVersionReplacer"
3
- require "dnnbundler/jsonConfig"
4
- require "thor"
5
- require "json"
6
-
7
- module Dnnbundler
8
- class CLI < Thor
9
- desc "build CONFIG [options]", "creates a zip package according to given configuration file"
10
- option :bumpBuild
11
- option :bumpSprint
12
- option :targetVersion, :type => :string
13
- def build( config )
14
- puts "Build with config #{config}"
15
- file = File.read(config)
16
- data_hash = JSON.parse(file)
17
-
18
- manifest_files = data_hash[JsonConfig::Manifests]
19
- current_version = Dnnbundler::getVersionFromManifest manifest_files[0]
20
- version_numbers = Dnnbundler::splitVersionNumbers current_version
21
-
22
- version_numbers[1] = version_numbers[1] + 1 if options[:bumpSprint]
23
- version_numbers[2] = 1 if options[:bumpSprint]
24
- version_numbers[2] = version_numbers[2] + 1 if options[:bumpBuild]
25
- version_numbers = Dnnbundler::splitVersionNumbers(options[:targetVersion]) if options[:targetVersion]
26
-
27
- new_version = Dnnbundler::formatVersion(version_numbers)
28
- puts "current version is #{current_version}"
29
- puts "new version is #{new_version}"
30
-
31
- data_hash[JsonConfig::Packages].each do |package|
32
- package[JsonConfig::Name].sub! JsonConfig::PackageVersionPlaceholder, new_version
33
- Dnnbundler::replaceVersionInManifestFiles manifest_files, new_version
34
-
35
- generator = ZipFileGenerator.new(package)
36
- generator.write
37
- end
38
- end
39
- end
40
-
41
- def self.formatVersion(version)
42
- "#{version[0].to_s.rjust(4, "0")}.#{version[1].to_s.rjust(2, "0")}.#{version[2].to_s.rjust(4, "0")}"
43
- end
44
-
45
- def self.splitVersionNumbers(version_string)
46
- version_string.split(".").map { |x| x.to_i }
47
- end
48
- end
1
+ require "dnnbundler/packageVersionReplacer"
2
+ require "dnnbundler/jsonConfig"
3
+ require "thor"
4
+ require "json"
5
+ require "zipper"
6
+
7
+ module Dnnbundler
8
+ class CLI < Thor
9
+ desc "build CONFIG [options]", "creates a zip package according to given configuration file"
10
+ option :bumpBuild
11
+ option :bumpSprint
12
+ option :targetVersion, :type => :string
13
+ def build( config )
14
+ puts "Build with config #{config}"
15
+ file = File.read(config)
16
+ json_config = JSON.parse(file)
17
+
18
+ manifest_files = json_config[JsonConfig::Manifests]
19
+ current_version = Dnnbundler::getVersionFromManifest manifest_files[0]
20
+ version_numbers = Dnnbundler::splitVersionNumbers current_version
21
+
22
+ version_numbers[1] = version_numbers[1] + 1 if options[:bumpSprint]
23
+ version_numbers[2] = 1 if options[:bumpSprint]
24
+ version_numbers[2] = version_numbers[2] + 1 if options[:bumpBuild]
25
+ version_numbers = Dnnbundler::splitVersionNumbers(options[:targetVersion]) if options[:targetVersion]
26
+
27
+ new_version = Dnnbundler::formatVersion(version_numbers)
28
+ puts "current version is #{current_version}"
29
+ puts "new version is #{new_version}"
30
+
31
+ json_config[JsonConfig::Packages].each do |package|
32
+ package[JsonConfig::Name].sub!(JsonConfig::PackageVersionPlaceholder, new_version)
33
+ Dnnbundler::replaceVersionInManifestFiles manifest_files, new_version
34
+
35
+ generator = Zipper::ZipFileGenerator.new(package)
36
+ generator.write
37
+ end
38
+ end
39
+ end
40
+
41
+ # converts version numbers array into string <year>.<sprint>.<build>
42
+ # Params:
43
+ # +version+:: integer array: [year, sprint, build]
44
+ def self.formatVersion(version)
45
+ "#{version[0].to_s.rjust(4, "0")}.#{version[1].to_s.rjust(2, "0")}.#{version[2].to_s.rjust(4, "0")}"
46
+ end
47
+
48
+ # splits string version into integers
49
+ # Params:
50
+ # +version_string+:: string version, format is dot separated numbers <year>.<sprint>.<build>
51
+ def self.splitVersionNumbers(version_string)
52
+ version_string.split(".").map { |x| x.to_i }
53
+ end
54
+ end
@@ -1,13 +1,8 @@
1
- module Dnnbundler
2
- module JsonConfig
3
- Type = "type"
4
- Name = "name"
5
- Path = "path"
6
- Flatten = "flatten"
7
- Entries = "entries"
8
- IgnoreEntries = "ignoreEntries"
9
- Packages = "packages"
10
- Manifests = "manifests"
11
- PackageVersionPlaceholder = "[PACKAGE_VERSION]"
12
- end
13
- end
1
+ module Dnnbundler
2
+ module JsonConfig
3
+ Name = "name"
4
+ Packages = "packages"
5
+ Manifests = "manifests"
6
+ PackageVersionPlaceholder = "[PACKAGE_VERSION]"
7
+ end
8
+ end
@@ -1,26 +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
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
@@ -1,3 +1,3 @@
1
- module Dnnbundler
2
- VERSION = "0.1.7"
3
- end
1
+ module Dnnbundler
2
+ VERSION = "0.1.8"
3
+ end
data/lib/dnnbundler.rb CHANGED
@@ -1,7 +1,6 @@
1
- require "dnnbundler/version"
2
- require "dnnbundler/zipFileGenerator"
3
- require "dnnbundler/cli"
4
-
5
- module Dnnbundler
6
-
7
- end
1
+ require "dnnbundler/version"
2
+ require "dnnbundler/cli"
3
+
4
+ module Dnnbundler
5
+
6
+ end
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.7
4
+ version: 0.1.8
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-19 00:00:00.000000000 Z
11
+ date: 2017-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: zipbundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: bundler
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -100,12 +114,9 @@ files:
100
114
  - exe/dnnbundler
101
115
  - lib/dnnbundler.rb
102
116
  - lib/dnnbundler/cli.rb
103
- - lib/dnnbundler/fileEntry.rb
104
- - lib/dnnbundler/fileEntryType.rb
105
117
  - lib/dnnbundler/jsonConfig.rb
106
118
  - lib/dnnbundler/packageVersionReplacer.rb
107
119
  - lib/dnnbundler/version.rb
108
- - lib/dnnbundler/zipFileGenerator.rb
109
120
  homepage: https://github.com/Le0Michine/dnnbundler
110
121
  licenses:
111
122
  - MIT
@@ -126,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
137
  version: '0'
127
138
  requirements: []
128
139
  rubyforge_project:
129
- rubygems_version: 2.5.2
140
+ rubygems_version: 2.6.11
130
141
  signing_key:
131
142
  specification_version: 4
132
143
  summary: Creates zip packages for DNN.
@@ -1,40 +0,0 @@
1
- module Dnnbundler
2
- class FileEntry
3
- def initialize(file_name, entry_type = FileEntryType::FILE, flatten_structure = false, file_path = nil)
4
- @type = entry_type
5
- @name = file_name
6
- @path = file_path
7
- @flatten = flatten_structure
8
- end
9
-
10
- # Saves +StringIO+ buffer into object, intended to store nested zip files in memory
11
- def add_buffer(buffer)
12
- @buffer = buffer
13
- end
14
-
15
- # Entry type: ZIP or FILE
16
- def type
17
- @type
18
- end
19
-
20
- # Entry name, used as a real path in file system
21
- def name
22
- @name
23
- end
24
-
25
- # True if existing directory structure shouldn't be preserved'
26
- def flatten
27
- @flatten
28
- end
29
-
30
- # +StringIO+ buffer with nested zip file
31
- def buffer
32
- @buffer
33
- end
34
-
35
- # Path of entry in a zip archive
36
- def path
37
- @path
38
- end
39
- end
40
- end
@@ -1,6 +0,0 @@
1
- module Dnnbundler
2
- module FileEntryType
3
- ZIP = "ZIP"
4
- FILE = "FILE"
5
- end
6
- end
@@ -1,95 +0,0 @@
1
- require "dnnbundler/fileEntryType"
2
- require "dnnbundler/fileEntry"
3
- require "dnnbundler/jsonConfig"
4
- require "zip"
5
-
6
- module Dnnbundler
7
- class ZipFileGenerator
8
- # Initialize with the directory to zip and the location of the output archive.
9
- def initialize(data)
10
- @entries = data[JsonConfig::Entries]
11
- @ignore_entries = data[JsonConfig::IgnoreEntries]
12
- @output_file = data[JsonConfig::Name]
13
- end
14
-
15
- # Zip the input directory.
16
- def write
17
- buffer = create_zip @entries, @ignore_entries
18
-
19
- puts "\nwrite file #{@output_file}"
20
- File.open(@output_file, "wb") {|f| f.write buffer.string }
21
- end
22
-
23
- private
24
-
25
- # True if +fileEntry+ isn't included into +ignore_entries+ array'
26
- def filter_entries(fileEntryName, fileEntryType, ignore_entries)
27
- return true if ignore_entries == nil
28
- ignore_entries.each do |entry|
29
- return false if (fileEntryType.casecmp(FileEntryType::FILE) == 0) && (fileEntryName.include? entry)
30
- end
31
- return true
32
- end
33
-
34
- # Creates +FileEntry+ for file or array of entries for directory and subdirectories
35
- # Params:
36
- # +directory_or_file+:: path to directory or file
37
- # +entry_path+:: path with which the entry should be put into zip
38
- def get_entries(directory_or_file, entry_path, ignore_entries)
39
- if File.directory? directory_or_file
40
- get_dir_entries_recursively directory_or_file, entry_path, ignore_entries
41
- else
42
- FileEntry.new directory_or_file, FileEntryType::FILE, false, entry_path
43
- end
44
- end
45
-
46
- # Collects all files from directory recursively
47
- # Params:
48
- # +dir+:: start directory
49
- # +entry_path+:: path with which file should be placed into zip
50
- # +replace_path+:: part of path which is being replaced by +entry_path+
51
- def get_dir_entries_recursively(dir, entry_path, ignore_entries, replace_path = nil)
52
- replace_path = dir.clone if replace_path.nil?
53
- (Dir.entries(dir) - %w(. ..)).map { |v| File.join(dir, v) }.select { |path| filter_entries path, FileEntryType::FILE, ignore_entries }.map { |path|
54
- if File.directory? path
55
- get_dir_entries_recursively(path, entry_path, ignore_entries, replace_path)
56
- else
57
- entry_path_in_zip = (entry_path.nil? ? path : path.sub(replace_path, entry_path)).gsub(/^[\/\\]+/, "")
58
- FileEntry.new path, FileEntryType::FILE, false, entry_path_in_zip
59
- end
60
- }
61
- end
62
-
63
- # Creates zip file in memory from passed +FileEntry+ array, returns StringIO as result
64
- # Params:
65
- # +entries+:: array of +FileEntry+ objects
66
- def compress(entries)
67
- puts "\nadding the following entries into zip package"
68
- puts "#{ entries.map{ |x| x.name + ", " + x.path.to_s + ", " + x.type.to_s }.join("\n")}"
69
- buffer = Zip::File.add_buffer do |zio|
70
- entries.each do |file|
71
- if file.type.casecmp(FileEntryType::FILE) == 0
72
- zio.add(file.path == nil ? file.name : file.path, file.name)
73
- else
74
- zio.get_output_stream(file.name) { |os| os.write file.buffer.string }
75
- end
76
- end
77
- end
78
- end
79
-
80
- # Creates from json array of entries
81
- def create_zip(entries, ignore_entries)
82
- compress entries.map { |x|
83
- if x.is_a? String
84
- get_entries x, nil, ignore_entries
85
- elsif x[JsonConfig::Type].nil? || x[JsonConfig::Type].casecmp(FileEntryType::FILE) == 0
86
- get_entries x[JsonConfig::Name], x[JsonConfig::Path], ignore_entries
87
- elsif x[JsonConfig::Type].casecmp(FileEntryType::ZIP) == 0
88
- zip_file_entry = FileEntry.new x[JsonConfig::Name], FileEntryType::ZIP, false, x[JsonConfig::Path]
89
- zip_file_entry.add_buffer create_zip x[JsonConfig::Entries], x[JsonConfig::IgnoreEntries]
90
- result = zip_file_entry
91
- end
92
- }.flatten.select{ |f| filter_entries f.name, f.type, ignore_entries }.uniq{ |f| f.name }
93
- end
94
- end
95
- end