mvnizer 0.9.0 → 1.2.0
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/.gitignore +52 -0
- data/.travis.yml +2 -3
- data/CHANGELOG.org +31 -0
- data/Dockerfile +4 -2
- data/Gemfile +8 -11
- data/Gemfile.lock +38 -102
- data/README.org +29 -24
- data/Rakefile +4 -24
- data/bin/mvnizer +14 -2
- data/conf/default.yml +5 -2
- data/lib/mvnizer/commands/new_project.rb +13 -0
- data/lib/mvnizer/coordinate_parser.rb +4 -4
- data/lib/mvnizer/mvnize.rb +17 -10
- data/lib/mvnizer/project.rb +10 -7
- data/lib/mvnizer/templates/Dockerfile.erb +7 -0
- data/lib/mvnizer/templates/Main.java.erb +8 -0
- data/lib/mvnizer/templates/_dependency.xml.erb +2 -2
- data/lib/mvnizer/templates/pom.xml.erb +22 -3
- data/lib/mvnizer/version.rb +1 -1
- data/mvnizer.gemspec +16 -100
- metadata +13 -138
- data/features/new_project.feature +0 -39
- data/features/search_artefact.feature +0 -14
- data/features/step_definitions/pom_steps.rb +0 -18
- data/features/support/env.rb +0 -24
- data/spec/commands/add_dependency_spec.rb +0 -25
- data/spec/commands/new_project_spec.rb +0 -38
- data/spec/commands/new_war_project_spec.rb +0 -58
- data/spec/commands/project_factory_spec.rb +0 -22
- data/spec/commands/search_artefact_spec.rb +0 -94
- data/spec/configuration_spec.rb +0 -28
- data/spec/coordinate_parser_spec.rb +0 -92
- data/spec/dummy.txt.erb +0 -1
- data/spec/dummy_pom.xml +0 -30
- data/spec/mvnize_spec.rb +0 -100
- data/spec/project_spec.rb +0 -29
- data/spec/spec_helper.rb +0 -11
- data/spec/task_helper_spec.rb +0 -66
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6bf5efb3ab3b0675e036cb927b33c0fedc65b525784b59c4d35aec74bb5f0b27
|
|
4
|
+
data.tar.gz: 0e35fceb9db2f91e1f8cf051653e98f24d6c5449dc2eb839098a63b24f2053b0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 22b459abf1bf9abe8d76a21837da8d7a8c87a93d0bf95aea63277289f82f82d57e5c369d7df1d2f5f9655244e5bd9914ecf66b9f8a54bd29de5a92a58e85faee
|
|
7
|
+
data.tar.gz: 0b6ad9ed09c7d90c8447a8608f56a5dadf24d9909377eb5da8347ef4bee4ec81256b38f4fa96e18a934745d52d359c2a33222899d0b1f5de020c3267cd9d1a9d
|
data/.gitignore
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# rcov generated
|
|
2
|
+
coverage
|
|
3
|
+
coverage.data
|
|
4
|
+
|
|
5
|
+
# rdoc generated
|
|
6
|
+
rdoc
|
|
7
|
+
|
|
8
|
+
# yard generated
|
|
9
|
+
doc
|
|
10
|
+
.yardoc
|
|
11
|
+
|
|
12
|
+
# bundler
|
|
13
|
+
.bundle
|
|
14
|
+
|
|
15
|
+
# jeweler generated
|
|
16
|
+
pkg
|
|
17
|
+
|
|
18
|
+
# aruba test folder
|
|
19
|
+
tmp
|
|
20
|
+
|
|
21
|
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
|
22
|
+
#
|
|
23
|
+
# * Create a file at ~/.gitignore
|
|
24
|
+
# * Include files you want ignored
|
|
25
|
+
# * Run: git config --global core.excludesfile ~/.gitignore
|
|
26
|
+
#
|
|
27
|
+
# After doing this, these files will be ignored in all your git projects,
|
|
28
|
+
# saving you from having to 'pollute' every project you touch with them
|
|
29
|
+
#
|
|
30
|
+
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
|
31
|
+
#
|
|
32
|
+
# For MacOS:
|
|
33
|
+
#
|
|
34
|
+
#.DS_Store
|
|
35
|
+
|
|
36
|
+
# For TextMate
|
|
37
|
+
#*.tmproj
|
|
38
|
+
#tmtags
|
|
39
|
+
|
|
40
|
+
# For emacs:
|
|
41
|
+
*~
|
|
42
|
+
\#*
|
|
43
|
+
.\#*
|
|
44
|
+
|
|
45
|
+
# For vim:
|
|
46
|
+
#*.swp
|
|
47
|
+
|
|
48
|
+
# For redcar:
|
|
49
|
+
#.redcar
|
|
50
|
+
|
|
51
|
+
# For rubinius:
|
|
52
|
+
#*.rbc
|
data/.travis.yml
CHANGED
data/CHANGELOG.org
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
* Mvnizer 1.2.0
|
|
2
|
+
|
|
3
|
+
- Add =--docker= option to generate =Dockerfile=
|
|
4
|
+
- Add =--logger= option to add logging dependencies to the project
|
|
5
|
+
- Add =--main=[Main class name]= option to generate main class, and set up =maven-shade-plugin= automatically.
|
|
6
|
+
- Fix bug with patch component of version not supporting multiple digits.
|
|
7
|
+
|
|
8
|
+
* Mvnizer 1.1.0
|
|
9
|
+
|
|
10
|
+
- Update nokogiri dependency to 1.12
|
|
11
|
+
|
|
12
|
+
* Mvnizer 1.0.0
|
|
13
|
+
|
|
14
|
+
- Release of major version!
|
|
15
|
+
|
|
16
|
+
* Mvnizer 0.11.0
|
|
17
|
+
|
|
18
|
+
- Update mvnizer to be used with ruby 2.7.0
|
|
19
|
+
- Remove dependency on jeweler
|
|
20
|
+
|
|
21
|
+
* Mvnizer 0.10.0
|
|
22
|
+
|
|
23
|
+
- Update default junit version to 5.7.0
|
|
24
|
+
- Update maven compiler plugin to 3.8.1
|
|
25
|
+
|
|
26
|
+
* Mvnizer 0.9.0
|
|
27
|
+
|
|
28
|
+
- Update rack dependency version.
|
|
29
|
+
|
|
1
30
|
* Mvnizer 0.8.0
|
|
2
31
|
|
|
3
32
|
- Update dependencies version.
|
|
@@ -10,6 +39,8 @@
|
|
|
10
39
|
|
|
11
40
|
- Maven plugins support,
|
|
12
41
|
- Update dependencies version.
|
|
42
|
+
- Add support for Maven plugins
|
|
43
|
+
- Set ruby 2.3.0 as minimum version
|
|
13
44
|
|
|
14
45
|
* Mvnizer 0.5.0
|
|
15
46
|
|
data/Dockerfile
CHANGED
|
@@ -10,8 +10,10 @@ RUN apt-get update -q && \
|
|
|
10
10
|
apt-get install -qy git vim rvm --no-install-recommends && \
|
|
11
11
|
apt-get clean
|
|
12
12
|
|
|
13
|
-
RUN /bin/bash -l -c "rvm autolibs packages && rvm install 2.
|
|
14
|
-
RUN /bin/bash -l -c "gem update --system && gem install bundler"
|
|
13
|
+
RUN /bin/bash -l -c "rvm autolibs packages && rvm install 2.7.0 && rvm use 2.7.0"
|
|
14
|
+
RUN /bin/bash -l -c "gem update -f --no-document --system && gem install bundler"
|
|
15
|
+
|
|
16
|
+
WORKDIR /mvnizer
|
|
15
17
|
|
|
16
18
|
# To run:
|
|
17
19
|
# docker run -t -i -v $(pwd):/mvnizer mvnizer-build:latest /bin/bash
|
data/Gemfile
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
source 'https://rubygems.org'
|
|
2
2
|
|
|
3
|
-
ruby "
|
|
3
|
+
ruby ">= 2.7.0"
|
|
4
4
|
|
|
5
|
-
gem 'httparty', '~> 0.
|
|
6
|
-
gem 'nokogiri', '~> 1.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
# removed `last_comment` in rspec.
|
|
10
|
-
gem 'rake', '< 11.0'
|
|
5
|
+
gem 'httparty', '~> 0.17'
|
|
6
|
+
gem 'nokogiri', '~> 1.12'
|
|
7
|
+
gem 'rake', '~> 13.0'
|
|
8
|
+
gem 'rake-release'
|
|
11
9
|
|
|
12
10
|
group :development do
|
|
13
|
-
gem 'rspec', '~>
|
|
14
|
-
gem 'rspec-mocks', '~>
|
|
11
|
+
gem 'rspec', '~> 3.10.0'
|
|
12
|
+
gem 'rspec-mocks', '~> 3.10.0'
|
|
15
13
|
gem 'fakefs', '~> 0.14'
|
|
16
|
-
gem '
|
|
17
|
-
gem 'aruba', '~> 0.14'
|
|
14
|
+
# gem 'aruba', '~> 0.14'
|
|
18
15
|
end
|
data/Gemfile.lock
CHANGED
|
@@ -1,119 +1,55 @@
|
|
|
1
1
|
GEM
|
|
2
2
|
remote: https://rubygems.org/
|
|
3
3
|
specs:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
cucumber (>= 1.3.19)
|
|
9
|
-
ffi (~> 1.9.10)
|
|
10
|
-
rspec-expectations (>= 2.99)
|
|
11
|
-
thor (~> 0.19)
|
|
12
|
-
backports (3.11.4)
|
|
13
|
-
builder (3.2.3)
|
|
14
|
-
childprocess (0.9.0)
|
|
15
|
-
ffi (~> 1.0, >= 1.0.11)
|
|
16
|
-
contracts (0.16.0)
|
|
17
|
-
cucumber (3.1.2)
|
|
18
|
-
builder (>= 2.1.2)
|
|
19
|
-
cucumber-core (~> 3.2.0)
|
|
20
|
-
cucumber-expressions (~> 6.0.1)
|
|
21
|
-
cucumber-wire (~> 0.0.1)
|
|
22
|
-
diff-lcs (~> 1.3)
|
|
23
|
-
gherkin (~> 5.1.0)
|
|
24
|
-
multi_json (>= 1.7.5, < 2.0)
|
|
25
|
-
multi_test (>= 0.1.2)
|
|
26
|
-
cucumber-core (3.2.1)
|
|
27
|
-
backports (>= 3.8.0)
|
|
28
|
-
cucumber-tag_expressions (~> 1.1.0)
|
|
29
|
-
gherkin (~> 5.0)
|
|
30
|
-
cucumber-expressions (6.0.1)
|
|
31
|
-
cucumber-tag_expressions (1.1.1)
|
|
32
|
-
cucumber-wire (0.0.1)
|
|
33
|
-
descendants_tracker (0.0.4)
|
|
34
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
|
35
|
-
diff-lcs (1.3)
|
|
36
|
-
fakefs (0.14.3)
|
|
37
|
-
faraday (0.9.2)
|
|
38
|
-
multipart-post (>= 1.2, < 3)
|
|
39
|
-
ffi (1.9.25)
|
|
40
|
-
ffi (1.9.25-java)
|
|
41
|
-
gherkin (5.1.0)
|
|
42
|
-
git (1.5.0)
|
|
43
|
-
github_api (0.16.0)
|
|
44
|
-
addressable (~> 2.4.0)
|
|
45
|
-
descendants_tracker (~> 0.0.4)
|
|
46
|
-
faraday (~> 0.8, < 0.10)
|
|
47
|
-
hashie (>= 3.4)
|
|
48
|
-
mime-types (>= 1.16, < 3.0)
|
|
49
|
-
oauth2 (~> 1.0)
|
|
50
|
-
hashie (3.6.0)
|
|
51
|
-
highline (2.0.0)
|
|
52
|
-
httparty (0.16.2)
|
|
4
|
+
diff-lcs (1.4.4)
|
|
5
|
+
fakefs (0.20.1)
|
|
6
|
+
httparty (0.18.1)
|
|
7
|
+
mime-types (~> 3.0)
|
|
53
8
|
multi_xml (>= 0.5.2)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
git (>= 1.2.5)
|
|
59
|
-
github_api (~> 0.16.0)
|
|
60
|
-
highline (>= 1.6.15)
|
|
61
|
-
nokogiri (>= 1.5.10)
|
|
62
|
-
psych
|
|
63
|
-
rake
|
|
64
|
-
rdoc
|
|
65
|
-
semver2
|
|
66
|
-
jwt (2.1.0)
|
|
67
|
-
mime-types (2.99.3)
|
|
68
|
-
mini_portile2 (2.4.0)
|
|
69
|
-
multi_json (1.13.1)
|
|
70
|
-
multi_test (0.1.2)
|
|
9
|
+
mime-types (3.3.1)
|
|
10
|
+
mime-types-data (~> 3.2015)
|
|
11
|
+
mime-types-data (3.2021.0225)
|
|
12
|
+
mini_portile2 (2.6.1)
|
|
71
13
|
multi_xml (0.6.0)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
nokogiri (1.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
rspec (
|
|
89
|
-
|
|
90
|
-
rspec-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
rspec-mocks (2.99.4)
|
|
96
|
-
semver2 (3.4.2)
|
|
97
|
-
thor (0.20.0)
|
|
98
|
-
thread_safe (0.3.6)
|
|
99
|
-
thread_safe (0.3.6-java)
|
|
14
|
+
nokogiri (1.12.5)
|
|
15
|
+
mini_portile2 (~> 2.6.1)
|
|
16
|
+
racc (~> 1.4)
|
|
17
|
+
nokogiri (1.12.5-java)
|
|
18
|
+
racc (~> 1.4)
|
|
19
|
+
racc (1.5.2)
|
|
20
|
+
racc (1.5.2-java)
|
|
21
|
+
rake (13.0.3)
|
|
22
|
+
rake-release (1.3.0)
|
|
23
|
+
bundler (>= 1.11, < 3)
|
|
24
|
+
rspec (3.10.0)
|
|
25
|
+
rspec-core (~> 3.10.0)
|
|
26
|
+
rspec-expectations (~> 3.10.0)
|
|
27
|
+
rspec-mocks (~> 3.10.0)
|
|
28
|
+
rspec-core (3.10.1)
|
|
29
|
+
rspec-support (~> 3.10.0)
|
|
30
|
+
rspec-expectations (3.10.1)
|
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
32
|
+
rspec-support (~> 3.10.0)
|
|
33
|
+
rspec-mocks (3.10.2)
|
|
34
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
35
|
+
rspec-support (~> 3.10.0)
|
|
36
|
+
rspec-support (3.10.2)
|
|
100
37
|
|
|
101
38
|
PLATFORMS
|
|
102
39
|
java
|
|
103
40
|
ruby
|
|
104
41
|
|
|
105
42
|
DEPENDENCIES
|
|
106
|
-
aruba (~> 0.14)
|
|
107
43
|
fakefs (~> 0.14)
|
|
108
|
-
httparty (~> 0.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
rake
|
|
112
|
-
rspec (~>
|
|
113
|
-
rspec-mocks (~>
|
|
44
|
+
httparty (~> 0.17)
|
|
45
|
+
nokogiri (~> 1.12)
|
|
46
|
+
rake (~> 13.0)
|
|
47
|
+
rake-release
|
|
48
|
+
rspec (~> 3.10.0)
|
|
49
|
+
rspec-mocks (~> 3.10.0)
|
|
114
50
|
|
|
115
51
|
RUBY VERSION
|
|
116
|
-
ruby 2.
|
|
52
|
+
ruby 2.7.0p0
|
|
117
53
|
|
|
118
54
|
BUNDLED WITH
|
|
119
55
|
2.1.4
|
data/README.org
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
Bootstraps a Maven project. Because archetypes shouldn't be so
|
|
2
|
-
complicated.
|
|
1
|
+
Bootstraps a Maven project. Because archetypes shouldn't be so complicated.
|
|
3
2
|
|
|
4
3
|
[[https://travis-ci.org/tychobrailleur/mvnizer][https://travis-ci.org/tychobrailleur/mvnizer.svg?branch=master]]
|
|
5
4
|
[[https://badge.fury.io/rb/mvnizer][https://badge.fury.io/rb/mvnizer.svg]]
|
|
@@ -7,8 +6,7 @@ complicated.
|
|
|
7
6
|
|
|
8
7
|
* Introduction
|
|
9
8
|
|
|
10
|
-
Mvnizer is ideal to create a throwaway Maven project that adds
|
|
11
|
-
junit as a dependency and sets up the Maven project structure.
|
|
9
|
+
Mvnizer is ideal to create a throwaway Maven project that adds junit as a dependency and sets up the Maven project structure.
|
|
12
10
|
|
|
13
11
|
* Install
|
|
14
12
|
|
|
@@ -34,27 +32,38 @@ complicated.
|
|
|
34
32
|
<group:>artifact<:version><:type>
|
|
35
33
|
#+END_EXAMPLE
|
|
36
34
|
|
|
37
|
-
with the values between angled brackets optional. =type= can only
|
|
38
|
-
have one of the following three values: =jar= (default), =war= or
|
|
39
|
-
=pom=. This command creates a project in the =artifact= folder,
|
|
40
|
-
populating the proper values in the pom file.
|
|
35
|
+
with the values between angled brackets optional. =type= can only have one of the following three values: =jar= (default), =war= or =pom=. This command creates a project in the =artifact= folder, populating the proper values in the pom file.
|
|
41
36
|
|
|
42
37
|
Here are some examples of valid commands:
|
|
43
38
|
|
|
44
39
|
#+BEGIN_EXAMPLE
|
|
45
40
|
mvnizer new foo
|
|
46
41
|
mvnizer new foo:war
|
|
47
|
-
mvnizer new foo:1.0:war
|
|
42
|
+
mvnizer new foo:1.0.0:war
|
|
48
43
|
mvnizer new com.example:foo
|
|
49
44
|
mvnizer new com.example:foo:war
|
|
50
|
-
mvnizer new com.example:foo:1.0:war
|
|
45
|
+
mvnizer new com.example:foo:1.0.0:war
|
|
51
46
|
#+END_EXAMPLE
|
|
52
47
|
|
|
48
|
+
The version *must* be of the form =major.minor.patch-classifier=.
|
|
49
|
+
|
|
50
|
+
*** Options
|
|
51
|
+
|
|
52
|
+
The following options can be used to add specific files to the project:
|
|
53
|
+
|
|
54
|
+
- =--docker= :: this creates a =Dockerfile= based on the Java 11 distroless base image. It assumes that the jar generated by the build can be executed using the =java -jar= command;
|
|
55
|
+
- =--main=[Main class name] :: this creates a class with a =main= method that can be executed using the =java -jar= command. It also adds the =maven-shade-plugin= to the pom, with this class as the main class.
|
|
56
|
+
- =--logger= :: this adds logging dependencies to the project. The jar added are defined as the =logging_deps= of the configuration file. The default are:
|
|
57
|
+
|
|
58
|
+
#+begin_src
|
|
59
|
+
logging_deps: [ "org.slf4j:slf4j-api:1.7.32:jar",
|
|
60
|
+
"org.slf4j:slf4j-simple:1.7.32:jar",
|
|
61
|
+
"ch.qos.logback:logback-core:1.2.6:jar" ]
|
|
62
|
+
#+end_src
|
|
63
|
+
|
|
53
64
|
*** WAR Project
|
|
54
65
|
|
|
55
|
-
If the type of project generated is =war=, a servlet
|
|
56
|
-
(=ExampleServlet=) is generated, along with a JSP file and an
|
|
57
|
-
empty =web.xml= file.
|
|
66
|
+
If the type of project generated is =war=, a servlet (=ExampleServlet=) is generated, along with a JSP file and an empty =web.xml= file.
|
|
58
67
|
|
|
59
68
|
When running the Jetty plugin, /e.g./:
|
|
60
69
|
|
|
@@ -62,28 +71,24 @@ Here are some examples of valid commands:
|
|
|
62
71
|
mvn org.eclipse.jetty:jetty-maven-plugin:9.4.12.v20180830:run-war
|
|
63
72
|
#+END_EXAMPLE
|
|
64
73
|
|
|
65
|
-
|
|
74
|
+
The example can then be accessed at http://localhost:8080/hello
|
|
66
75
|
|
|
67
76
|
** Add Dependency
|
|
68
77
|
|
|
69
|
-
To add dependencies, you must be in the folder where the pom file you
|
|
70
|
-
want to add the dependency to is.
|
|
78
|
+
To add dependencies, you must be in the folder where the pom file you want to add the dependency to is.
|
|
71
79
|
|
|
72
|
-
To add a dependency, simply pass the coordinates of the dependency, and
|
|
73
|
-
add scope if needed (if no scope is given, =compile= is assumed):
|
|
80
|
+
To add a dependency, simply pass the coordinates of the dependency, and add scope if needed (if no scope is given, =compile= is assumed):
|
|
74
81
|
|
|
75
82
|
#+BEGIN_EXAMPLE
|
|
76
83
|
mvnizer add org.apache.commons:commons-lang3:3.1:jar
|
|
77
84
|
mvnizer add org.mockito:mockito-core:1.9.5-rc1:jar:test
|
|
78
85
|
#+END_EXAMPLE
|
|
79
86
|
|
|
80
|
-
The =search= features makes it easy to find the coordinates of the
|
|
81
|
-
dependencies for you.
|
|
87
|
+
The =search= features makes it easy to find the coordinates of the dependencies for you.
|
|
82
88
|
|
|
83
89
|
** Dependency Search
|
|
84
90
|
|
|
85
|
-
You can search for dependencies in the Maven central repository with the
|
|
86
|
-
command:
|
|
91
|
+
You can search for dependencies in the Maven central repository with the command:
|
|
87
92
|
|
|
88
93
|
#+BEGIN_EXAMPLE
|
|
89
94
|
$ mvnizer search <text>
|
|
@@ -91,6 +96,6 @@ command:
|
|
|
91
96
|
|
|
92
97
|
* License
|
|
93
98
|
|
|
94
|
-
MIT License.
|
|
99
|
+
MIT License.
|
|
95
100
|
|
|
96
|
-
© Copyright 2012–
|
|
101
|
+
© Copyright 2012–2021 — Sébastien Le Callonnec
|
data/Rakefile
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
1
|
+
# coding: utf-8
|
|
3
2
|
require 'rubygems'
|
|
4
3
|
require 'bundler'
|
|
4
|
+
require 'rake/release'
|
|
5
|
+
|
|
5
6
|
begin
|
|
6
7
|
Bundler.setup(:default, :development)
|
|
7
8
|
rescue Bundler::BundlerError => e
|
|
@@ -11,25 +12,6 @@ rescue Bundler::BundlerError => e
|
|
|
11
12
|
end
|
|
12
13
|
require 'rake'
|
|
13
14
|
|
|
14
|
-
require 'jeweler'
|
|
15
|
-
require './lib/mvnizer/version.rb'
|
|
16
|
-
Jeweler::Tasks.new do |gem|
|
|
17
|
-
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
|
18
|
-
gem.name = "mvnizer"
|
|
19
|
-
gem.version = Mvnizer::Version::STRING
|
|
20
|
-
gem.homepage = "http://github.com/tychobrailleur/mvnizer"
|
|
21
|
-
gem.license = "MIT"
|
|
22
|
-
gem.summary = %Q{Bootstrap a Maven project without the pain of archetypes.}
|
|
23
|
-
gem.description = %Q{Bootstrap a Maven project without the pain of archetypes.}
|
|
24
|
-
gem.email = "sebastien@weblogism.com"
|
|
25
|
-
gem.authors = ["Sébastien Le Callonnec"]
|
|
26
|
-
|
|
27
|
-
gem.executables = ['mvnizer']
|
|
28
|
-
# dependencies defined in Gemfile
|
|
29
|
-
end
|
|
30
|
-
Jeweler::RubygemsDotOrgTasks.new
|
|
31
|
-
|
|
32
|
-
require 'rspec/core'
|
|
33
15
|
require 'rspec/core/rake_task'
|
|
34
16
|
RSpec::Core::RakeTask.new(:spec) do |spec|
|
|
35
17
|
spec.pattern = FileList['spec/**/*_spec.rb']
|
|
@@ -47,9 +29,7 @@ Rake::RDocTask.new do |rdoc|
|
|
|
47
29
|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
|
48
30
|
|
|
49
31
|
rdoc.rdoc_dir = 'rdoc'
|
|
50
|
-
rdoc.title = "
|
|
32
|
+
rdoc.title = "mvnizer #{version}"
|
|
51
33
|
rdoc.rdoc_files.include('README*')
|
|
52
34
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
53
35
|
end
|
|
54
|
-
|
|
55
|
-
# -*- coding: utf-8 -*-
|
data/bin/mvnizer
CHANGED
|
@@ -26,7 +26,7 @@ HELP
|
|
|
26
26
|
|
|
27
27
|
options = {}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
opt_parser = OptionParser.new do |opts|
|
|
30
30
|
opts.banner = help
|
|
31
31
|
|
|
32
32
|
opts.on_tail("-h", "--help", "Show this message") do
|
|
@@ -38,10 +38,22 @@ opts = OptionParser.new do |opts|
|
|
|
38
38
|
puts "Mvnizer " + Mvnizer::Version::STRING
|
|
39
39
|
exit 0
|
|
40
40
|
end
|
|
41
|
+
|
|
42
|
+
opts.on("--docker", "Create Dockerfile. Ignored if not `new' command.") do
|
|
43
|
+
options[:docker] = true
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
opts.on("--main [MAIN_CLASS]", "Create a main class with name MAIN_CLASS.") do |main|
|
|
47
|
+
options[:main] = main
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
opts.on("--logger", "Add logging dependencies. Ignored if not `new' command.") do
|
|
51
|
+
options[:logger] = true
|
|
52
|
+
end
|
|
41
53
|
end
|
|
42
54
|
|
|
43
55
|
# Read command line options into `options` hash
|
|
44
|
-
|
|
56
|
+
opt_parser.parse!
|
|
45
57
|
|
|
46
58
|
if ARGV.size == 2
|
|
47
59
|
options[:command] = ARGV[0]
|
data/conf/default.yml
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
group_id: com.example
|
|
2
2
|
version: 0.0.1-SNAPSHOT
|
|
3
3
|
type: jar
|
|
4
|
-
dependencies: [ "junit:junit:
|
|
5
|
-
plugins: [ ":maven-compiler-plugin:3.8.
|
|
4
|
+
dependencies: [ "org.junit.jupiter:junit-jupiter-engine:5.7.0:jar:test" ]
|
|
5
|
+
plugins: [ ":maven-compiler-plugin:3.8.1" ]
|
|
6
|
+
logging_deps: [ "org.slf4j:slf4j-api:1.7.32:jar",
|
|
7
|
+
"org.slf4j:slf4j-simple:1.7.32:jar",
|
|
8
|
+
"ch.qos.logback:logback-core:1.2.6:jar" ]
|
|
@@ -24,6 +24,19 @@ module Mvnizer
|
|
|
24
24
|
"#{project.artifact_id}/.editorconfig",
|
|
25
25
|
project)
|
|
26
26
|
|
|
27
|
+
if project.main
|
|
28
|
+
target_directory = project.package_name.gsub(/\./, File::SEPARATOR)
|
|
29
|
+
generate_file(File.join(TEMPLATE_DIR, "Main.java.erb"),
|
|
30
|
+
"#{project.artifact_id}/src/main/java/#{target_directory}/#{project.main}.java",
|
|
31
|
+
project)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
if project.docker
|
|
35
|
+
generate_file(File.join(TEMPLATE_DIR, "Dockerfile.erb"),
|
|
36
|
+
"#{project.artifact_id}/Dockerfile",
|
|
37
|
+
project)
|
|
38
|
+
end
|
|
39
|
+
|
|
27
40
|
end
|
|
28
41
|
|
|
29
42
|
# Returns the list of dependencies to be added for this type of project.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
module Mvnizer
|
|
1
|
+
module Mvnizer
|
|
2
2
|
class CoordinateParser
|
|
3
3
|
# Parse the coordinates of an artifact.
|
|
4
4
|
def parse(coordinates)
|
|
5
5
|
p = nil
|
|
6
6
|
# When no group and type is given
|
|
7
|
-
if coordinates =~ /\A([a-zA-Z][\w\.\-]+)(:(\d+\.\d+\.\d(\-\w+)?))?:(war|jar|pom)/
|
|
7
|
+
if coordinates =~ /\A([a-zA-Z][\w\.\-]+)(:(\d+\.\d+\.\d+(\-\w+)?))?:(war|jar|pom)/
|
|
8
8
|
p = Project.new(nil, $1, $3, $5)
|
|
9
9
|
else
|
|
10
|
-
coordinates.scan(/(([a-zA-Z][\w\.\-]+):)?([a-zA-Z][\w\.\-]+)(:(\d+\.\d+\.\d(\-\w+)?))?(:(war|jar|pom))?/) do
|
|
10
|
+
coordinates.scan(/(([a-zA-Z][\w\.\-]+):)?([a-zA-Z][\w\.\-]+)(:(\d+\.\d+\.\d+(\-\w+)?))?(:(war|jar|pom))?/) do
|
|
11
11
|
|i,g,a,v0,v,m,t0,t|
|
|
12
12
|
p = Project.new(g, a, v, t)
|
|
13
13
|
end
|
|
@@ -20,7 +20,7 @@ module Mvnizer
|
|
|
20
20
|
# the scope (test, compile, provided, runtime, system or import)
|
|
21
21
|
def parse_scoped_coordinates(coordinates)
|
|
22
22
|
p = nil
|
|
23
|
-
if coordinates =~ /\A(([a-zA-Z][\w\.\-]+):)?([a-zA-Z][\w\.\-]+)(:(\d+\.\d+(\.\d)?(\-\w+)?))?:(war|jar|pom):?(test|compile|provided|runtime|system|import)?/
|
|
23
|
+
if coordinates =~ /\A(([a-zA-Z][\w\.\-]+):)?([a-zA-Z][\w\.\-]+)(:(\d+\.\d+(\.\d+)?(\-\w+)?))?:(war|jar|pom):?(test|compile|provided|runtime|system|import)?/
|
|
24
24
|
p = Project.new($2, $3, $5, $8, [], $9)
|
|
25
25
|
end
|
|
26
26
|
p
|
data/lib/mvnizer/mvnize.rb
CHANGED
|
@@ -17,19 +17,19 @@ module Mvnizer
|
|
|
17
17
|
# passed in +options+.
|
|
18
18
|
# If the command does not exit, throw an error.
|
|
19
19
|
def run(options)
|
|
20
|
-
raise ArgumentError,
|
|
20
|
+
raise ArgumentError, 'Please give a name to the project.' unless options[:name]
|
|
21
21
|
|
|
22
22
|
case options[:command]
|
|
23
|
-
when
|
|
23
|
+
when 'new'
|
|
24
24
|
project_details = define_project(options)
|
|
25
|
-
project_command = Mvnizer::Command::ProjectFactory.create(project_details.type)
|
|
26
25
|
|
|
26
|
+
project_command = Mvnizer::Command::ProjectFactory.create(project_details.type)
|
|
27
27
|
project_command.run(project_details)
|
|
28
28
|
out.puts("Project #{project_details.artifact_id} created successfully.")
|
|
29
|
-
when
|
|
29
|
+
when 'search'
|
|
30
30
|
search_command = Command::SearchArtefact.new
|
|
31
31
|
search_command.run(options)
|
|
32
|
-
when
|
|
32
|
+
when 'add'
|
|
33
33
|
add_command = Command::AddDependency.new
|
|
34
34
|
add_command.run(options)
|
|
35
35
|
else
|
|
@@ -51,20 +51,27 @@ module Mvnizer
|
|
|
51
51
|
return_project = Project.new(project.group_id || options[:group_id],
|
|
52
52
|
project.artifact_id,
|
|
53
53
|
project.version || options[:version],
|
|
54
|
-
project.type || options[:type]
|
|
54
|
+
project.type || options[:type],
|
|
55
|
+
[], nil, [],
|
|
56
|
+
options[:main],
|
|
57
|
+
options[:docker] || false)
|
|
55
58
|
|
|
56
59
|
|
|
57
60
|
# Get default dependencies, and add them after having parsed their coords.
|
|
58
61
|
dependencies = options[:dependencies]
|
|
59
|
-
dependencies
|
|
62
|
+
dependencies&.each do |d|
|
|
60
63
|
return_project.add_dependency(@coordinate_parser.parse_scoped_coordinates(d))
|
|
61
|
-
end
|
|
64
|
+
end
|
|
62
65
|
|
|
66
|
+
# If logger is true, add logging dependencies.
|
|
67
|
+
options[:logging_deps]&.each do |d|
|
|
68
|
+
return_project.add_dependency(@coordinate_parser.parse_scoped_coordinates(d))
|
|
69
|
+
end
|
|
63
70
|
|
|
64
71
|
plugins = options[:plugins]
|
|
65
|
-
plugins
|
|
72
|
+
plugins&.each do |p|
|
|
66
73
|
return_project.add_plugin(@coordinate_parser.parse_scoped_coordinates(p))
|
|
67
|
-
end
|
|
74
|
+
end
|
|
68
75
|
|
|
69
76
|
return_project
|
|
70
77
|
end
|
data/lib/mvnizer/project.rb
CHANGED
|
@@ -3,9 +3,10 @@ module Mvnizer
|
|
|
3
3
|
# The elements of the coordinates are read-only.
|
|
4
4
|
class Project
|
|
5
5
|
include Erbicole
|
|
6
|
-
attr_reader :group_id, :artifact_id, :version, :type, :dependencies, :scope, :plugins
|
|
6
|
+
attr_reader :group_id, :artifact_id, :version, :type, :dependencies, :scope, :plugins, :main, :docker
|
|
7
7
|
|
|
8
|
-
def initialize(group_id, artifact_id, version, type, dependencies = [],
|
|
8
|
+
def initialize(group_id, artifact_id, version, type, dependencies = [],
|
|
9
|
+
scope = nil, plugins = [], main = nil, docker = false)
|
|
9
10
|
@group_id = group_id
|
|
10
11
|
@artifact_id = artifact_id
|
|
11
12
|
@version = version
|
|
@@ -13,6 +14,8 @@ module Mvnizer
|
|
|
13
14
|
@dependencies = dependencies
|
|
14
15
|
@scope = scope
|
|
15
16
|
@plugins = plugins
|
|
17
|
+
@main = main
|
|
18
|
+
@docker = docker
|
|
16
19
|
end
|
|
17
20
|
|
|
18
21
|
def add_dependency(dependency)
|
|
@@ -25,11 +28,11 @@ module Mvnizer
|
|
|
25
28
|
|
|
26
29
|
# Check whether the project coordinates of this project
|
|
27
30
|
# match the ones of the other project.
|
|
28
|
-
def ==(
|
|
29
|
-
(group_id ==
|
|
30
|
-
&& artifact_id ==
|
|
31
|
-
&& version ==
|
|
32
|
-
&& type ==
|
|
31
|
+
def ==(other)
|
|
32
|
+
(group_id == other.group_id \
|
|
33
|
+
&& artifact_id == other.artifact_id \
|
|
34
|
+
&& version == other.version \
|
|
35
|
+
&& type == other.type)
|
|
33
36
|
end
|
|
34
37
|
|
|
35
38
|
def package_name
|