mvn2chain 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +27 -11
- data/bin/mvn2chain +8 -3
- data/lib/mvn2chain/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 517adb7e4558bb8d4a0db6c008b0ef7490cd7938
|
4
|
+
data.tar.gz: d05801008a89390d3c53c5d25a2f66288d3e7158
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d369c9d37db0d32b68149dbcbe500347ecbfec55ba3f2d2e9b0abc03884f7d0eeacbe8992e78e6eb8079b701021851e020909a31ab6497d360cef267d0f4118
|
7
|
+
data.tar.gz: 37a12473d378893ca15aee953d212e60011149d015252827277b85ecf99db19890ff04101e13bf45945b1c08e5e0f3949f28548a54a1d4b781158efdd903f8c5
|
data/README.md
CHANGED
@@ -1,28 +1,44 @@
|
|
1
|
-
#
|
1
|
+
# mvn2chain
|
2
2
|
|
3
|
-
|
3
|
+
A command line tool that makes it easy to chain `mvn2` calls. Register your dependencies with the `mvn2chain dep` commands and run them with the `mvn2chain exec` command. See `mvn2chain help`, `mvn2chain help dep`, and `mvn2chain help exec` for more information. Some commands have aliases.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
|
7
|
+
Install it yourself as:
|
8
8
|
|
9
|
-
gem
|
9
|
+
$ gem install mvn2chain
|
10
10
|
|
11
|
-
|
11
|
+
## Usage
|
12
12
|
|
13
|
-
|
13
|
+
###Add your dependencies
|
14
|
+
1. Change to the root directory of a maven project with a dependency you want to be able chain.
|
15
|
+
2. Use the `mvn2chain dep add <id> <path>` command to add the dependency to the registry. The `<id>` parameter is the short identifier for the dependency. You use this for referencing the dependency in `mvn2chain exec` calls, as well as for removing a dependency from the registry. The `<path>` parameter is the path to the root directory of the maven project for the dependency.
|
16
|
+
3. To see the dependencies you already have in the registry, use `mvn2chain dep list`.
|
17
|
+
4. If you want to remove a dependency, use the `mvn2chain dep remove <id>` command, where `<id>` is the id you gave the dependency when you added it.
|
18
|
+
5. There is no limit to how many levels of dependencies you can have, and no check (at least currently) for recursive dependencies (so be careful)
|
14
19
|
|
15
|
-
|
20
|
+
###Run a chained build
|
21
|
+
The `mvn2chain exec` command will allow you to build dependency projects and then the current project. It uses a special parameter syntax to allow you to specify `mvn2` parameters to the current project and any dependency projects (direct or indirect).
|
16
22
|
|
17
|
-
|
23
|
+
####Example
|
24
|
+
Let's say you have your project set up with dependencies `dep1` and `dep2`, and that `dep1` has the dependency `dep3`. If you want to build the project with `mvn2` parameter `-s`, dependency `dep1`with parameter `-e`, indirect dependency `dep3` with parameter `-0`, and skip dependency `dep2`, you would do the following:
|
18
25
|
|
19
|
-
|
26
|
+
mvn2chain exec -s +dep1 -e +dep3 -0 ~dep2
|
27
|
+
Here's the explanation:
|
20
28
|
|
21
|
-
|
29
|
+
1. You start off with all arguments being passed to the `mvn2` call for the current project, which is the `-s` argument in this case
|
30
|
+
2. Once you specify `+dep1`, you switch to specifying arguments for the `mvn2` call for `dep1`. This is because any argument starting with `+` will switch to specifying arguments for the dependency with the id taken from the rest of the characters in the argument with the `+`.
|
31
|
+
3. Now that you've switched to specifying arguments for `dep1`, `-e` will be given to that.
|
32
|
+
4. `dep3` isn't a dependency the current project knows about, but that doesn't matter because it chains by switching to the directory of the dependency and calling `mvn2chain exec` with the arguments given for the dependency *and* the extra arguments for other dependencies (plus excluded dependencies). In this case, that means it switches to the directory for `dep1` and calls `mvn2chain exec -e +dep3 -0 ~dep2` before switching back and running `mvn2 -s` in the current project
|
33
|
+
5. When it calls `mvn2chain exec` for the dependency, it will chain again with any dependencies that dependency has in the exact same fashion. In this example, that means it switches to the directory of `dep1` dependency `dep3` and calls `mvn2chain exec -0 ~dep2`
|
34
|
+
6. Since `dep3` doesn't have any dependencies of its own, it will just run `mvn2 -0` and unwind back `dep1`. If `dep1` had other dependencies, it would continue cycling through them and doing the same thing
|
35
|
+
7. Once it has gone through all of the dependencies that are not excluded, `dep1` will run its `mvn2 -e` call and unwind back to the first project
|
36
|
+
8. The first project has the dependency `dep2`, but the arguments you provided include `~dep2`. Any argument starting with `~` will cause the dependency with the id taken from the rest of the characters in the argument with the `~` to be skipped. You can exclude indirect dependencies in the same way because exclusions are always passed along to the chained builds. BTW, an argument starting with `~/` will probably not be counted as an exclusion since it will probably be transformed to the absolute path of your home directory by bash before being passed to `mvn2chain`.
|
37
|
+
9. Now that all of its dependencies are build, the initial project will run `mvn2 -s` and finish the process.
|
22
38
|
|
23
39
|
## Contributing
|
24
40
|
|
25
|
-
1. Fork it ( https://github.com/
|
41
|
+
1. Fork it ( https://github.com/henderea/mvn2chain/fork )
|
26
42
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
43
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
44
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/bin/mvn2chain
CHANGED
@@ -21,8 +21,9 @@ module Mvn2Chain
|
|
21
21
|
self.save if self.autosave
|
22
22
|
end
|
23
23
|
|
24
|
-
def deps
|
24
|
+
def deps(exclude = [])
|
25
25
|
@deps ||= load
|
26
|
+
(exclude.nil? || exclude.empty?) ? @deps : @deps.select { |k,_| !exclude.include?(k) }
|
26
27
|
end
|
27
28
|
|
28
29
|
def load
|
@@ -174,7 +175,7 @@ module Mvn2Chain
|
|
174
175
|
}
|
175
176
|
|
176
177
|
register(:command, id: :exec, parent: nil, name: 'exec', aliases: %w(build), short_desc: 'exec [ARGS...]', desc: 'execute a mvn2 build.',
|
177
|
-
long_desc:
|
178
|
+
long_desc: <<LONGDESC
|
178
179
|
Execute a mvn2 build.
|
179
180
|
|
180
181
|
Specify arguments for mvn2 as you would normally, and switch to specifying arguments for a dependency (direct or indirect) with a +dep, where 'dep' is the dependency id.
|
@@ -187,7 +188,11 @@ LONGDESC
|
|
187
188
|
arg_hash, exclude = args_to_hash(*args)
|
188
189
|
mine = arg_hash.delete(:me)
|
189
190
|
dir = Dir.getwd
|
190
|
-
|
191
|
+
if DataStore.deps(exclude).nil? || DataStore.deps(exclude).empty?
|
192
|
+
DataStore.deps.each { |v|
|
193
|
+
puts "Skipping '#{v[0]}'"
|
194
|
+
}
|
195
|
+
else
|
191
196
|
puts "Starting in #{dir}"
|
192
197
|
DataStore.deps.each { |v|
|
193
198
|
if exclude.include?(v[0])
|
data/lib/mvn2chain/version.rb
CHANGED