mvn2 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b39f2e1b31e73e8e0e46b2933b0a99a61a894f15
4
- data.tar.gz: 8910e23d49347ba7beb82506f0e3fa34ebbecee9
3
+ metadata.gz: 6d175cc8ec8383e2dabc52b382c7da7896e98f5f
4
+ data.tar.gz: 935f582ce639c4cf457fc53f22cb02479c14ea35
5
5
  SHA512:
6
- metadata.gz: 9f6c81c323f67a021138a7fcd5a655d6c660331942cedb07981aebc85b4c2a96f33325c21912e1f530a8d5f27374e94bab229c0a48acdfe378a3f77769b2477f
7
- data.tar.gz: bd83204629ee2518a77280f9e01567e1235ad3fb4f6cad43ada9aebc3b6e22e3508d8f81fdb5d8e0591ae9d8f963ce89c0e63d38a7ae615526542089adaf1ba0
6
+ metadata.gz: 67b6338088188ac8b94e9e0fc8500c6157b866df54b87d8db4140769d663ee7931e0c32c2109e41dc228eb44d3f3d97bb72ba933a5b22182cbc19b15986404c6
7
+ data.tar.gz: f187506c332451d0064851d6610a8240c65f5df2085096be8391cb563e4489f88dd0dec7d376808c28672aa9e871be108fd56ff2620fc95589b18b774cfd1956
data/README.md CHANGED
@@ -30,7 +30,7 @@ Please see the plugin folder in this gem for examples of how to use the plugin s
30
30
  * `-h` or `--hide-between` to hide the output between the end of test results (the line starting with "Tests run:") and the next trigger line
31
31
  * `-w` or `--show-average` to show the average(s) before and after the build (average tracking must be enabled) (default is to not show averages)
32
32
  * `-b` or `--block-update` to block the average feature from updating the file(s)
33
- * `-v` or `--override-colors` to override the colors with the ones configured by the [colorconfig][colorconfig] script
33
+ * `-v` or `--override-colors` to override the colors with the ones configured by the `colorconfig` script
34
34
  * `-j` or `--show-projects` to show the `Building <project>` lines when outputting
35
35
  * `--run-before CMD` to run `CMD` before calling the maven build
36
36
  * `--run-after CMD` to run `CMD` after finishing the maven build
@@ -51,68 +51,9 @@ The following is my initial documentation of the plugin system. It may be impro
51
51
 
52
52
  Version 2.0.0 introduces a plugin system. Other gems can add plugins to mvn2. The files have to match the pattern `mvn2/plugin/*.plugin.rb` in your gem's `lib/` folder. If you do that, when the gem is installed, `mvn2` will automatically pick up on it and load it.
53
53
 
54
- Two examples of this are my gems `colorconfig` and `mvn2-say`.
54
+ Two examples of this are my gems `colorconfig` (https://rubygems.org/gems/colorconfig) and `mvn2-say` (https://rubygems.org/gems/mvn2-say).
55
55
 
56
- The `Mvn2::Plugin` module is used for registering a plugin of a defined type. It defines the `register` method. You should use `extend` so that you can define things statically. There is no need for a `build` method because it automatically adds the plugins at the time you call the method.
57
-
58
- Here is an example:
59
-
60
- ```ruby
61
- register :option, sym: :timer, names: %w(-t --timer), desc: 'display a timer while the build is in progress'
62
- ```
63
-
64
- And another:
65
-
66
- ```ruby
67
- register(:before_run, order: 2) { |options|
68
- Mvn2::Plugins.set_var :time1, Time.now
69
- Mvn2::Plugins.set_var :thread, options[:timer] ? Thread.new {
70
- start_time = Mvn2::Plugins.get_var :time1
71
- while true
72
- print "\r#{get_timer_message(start_time, Time.now)}"
73
- sleep(0.05)
74
- end
75
- } : nil
76
- }
77
- ```
78
-
79
- The `register` method takes a first parameter of the plugin type identifier, followed by an optional (but probably necessary) hash of options, and an optional block (usable with most built-in plugin types, required by some).
80
-
81
- -----
82
-
83
- If you want to define a new plugin type, you can extend the `Mvn2::PluginType`. This defines the `register_type` and `register_variable` methods. Technically, you don't really need to register a variable, but if you want to give it a certain starting value, you will need to register it and pass over the value. `register_type` takes a first parameter of the plugin type identifier, followed by a block. The block will always take a first parameter of the list of instances, followed by any additional parameters passed to the plugin when it is called. The block has the task of taking the list of plugin instances and turning it into whatever result the plugin is supposed to have.
84
-
85
- Here is an example:
86
-
87
- ```ruby
88
- register_type(:command_flag) { |list|
89
- options = Mvn2::Plugins.get_var :options
90
- flags = []
91
- list.each { |flag|
92
- if flag[:block].nil?
93
- flags << " #{flag[:options][:flag]}" if flag[:options].has_key?(:option) && options[flag[:options][:option]] == (flag[:options].has_key?(:value) ? flag[:options][:value] : true)
94
- else
95
- flag[:block].call(options, flags)
96
- end
97
- }
98
- flags.join
99
- }
100
- ```
101
-
102
- -----
103
-
104
- You might notice in the second plugin example, as well as the plugin type example, methods are called on `Mvn2::Plugins`. This is the class that stores all of the plugins and types. It has various methods, but the ones involved in making a plugin are:
105
-
106
- * `Mvn2::Plugins.get(type, *args)`
107
- * Gets the result of a plugin type. The first parameter is the plugin type identifier, followed by any additional arguments the plugin type takes.
108
- * `Mvn2::Plugins.get_var(name)`
109
- * Gets a single variable by name
110
- * `Mvn2::Plugins.get_vars(*names)`
111
- * Gets a list of variables by name. Useful for getting a lot of variables in one line.
112
- * `Mvn2::Plugins.set_var(name, value)`
113
- * Sets a single variable of the given name to the given value.
114
- * `Mvn2::Plugins.set_vars(vars = {})`
115
- * Sets a list of variables to the values specified. It use a hash format, so you can do something like `Mvn2::Plugins.set_vars found: true, info_line_last: false`
56
+ Please see my `everyday-plugins` (https://github.com/henderea/everyday-plugins) gem for more info on plugins.
116
57
 
117
58
  If you come up with a plugin, feel free to publish it on your own (that's what the plugin system is designed to support). If you think it should be part of the built-in plugin set, you can always file a pull request.
118
59
 
data/bin/mvn2 CHANGED
@@ -14,8 +14,8 @@ include EverydayPlugins
14
14
 
15
15
  Plugins.load_plugins 'mvn2'
16
16
 
17
- #abcd h jkl n p stuvw y 012
18
- # efg i m o qr x z 3456789
17
+ #abcd h jkl n p stuvw y 012 9
18
+ # efg i m o qr x z 345678
19
19
 
20
20
  class MyOptions
21
21
  extend OptionUtil
@@ -23,6 +23,7 @@ class MyOptions
23
23
  default_settings toggle: true
24
24
 
25
25
  defaults_option 'mvn2-defaults.yaml', %w(-1 --set-defaults), desc: 'set the defaults so you can just run mvn2 without any parameters (local to each folder)'
26
+ global_defaults_option '~/mvn2-defaults.yaml', %w(-2 --set-global-defaults), desc: 'set the global defaults so you can just run mvn2 without any parameters (global per user)'
26
27
 
27
28
  help_option ['--help'], desc: 'print out this help'
28
29
  end
@@ -34,7 +35,7 @@ MyOptions.parse!
34
35
 
35
36
  options = MyOptions.options
36
37
 
37
- Plugins.set_var(:options, options)
38
+ Plugins.set_var :options, options
38
39
 
39
40
  Signal.trap('SIGINT') {
40
41
  puts "\nBuild Canceled\n\n"
data/lib/mvn2/plugin.rb CHANGED
@@ -196,7 +196,6 @@ module Mvn2
196
196
  end
197
197
  class ColorTypes
198
198
  extend PluginType
199
- extend TypeHelper
200
199
 
201
200
  DEFAULT_COLOR_OPTS = {
202
201
  time: {
data/lib/mvn2/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mvn2
2
- VERSION = '2.2.0'
2
+ VERSION = '2.3.0'
3
3
  end
data/mvn2.gemspec CHANGED
@@ -22,6 +22,6 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency 'bundler', '~> 1.5'
23
23
  spec.add_development_dependency 'rake', '~> 10.0'
24
24
 
25
- spec.add_dependency 'everyday-cli-utils', '>= 1.3.0'
25
+ spec.add_dependency 'everyday-cli-utils', '>= 1.5.0'
26
26
  spec.add_dependency 'everyday-plugins', '>= 1.0.0'
27
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mvn2
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Henderson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-04 00:00:00.000000000 Z
11
+ date: 2014-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 1.3.0
47
+ version: 1.5.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 1.3.0
54
+ version: 1.5.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: everyday-plugins
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  version: '0'
117
117
  requirements: []
118
118
  rubyforge_project:
119
- rubygems_version: 2.2.0
119
+ rubygems_version: 2.2.2
120
120
  signing_key:
121
121
  specification_version: 4
122
122
  summary: Maven helper