everyday-plugins 1.1.1 → 1.2.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: 57974ef37221f25042264d8a003fc7031cfdb36c
4
- data.tar.gz: 67c51e46201e573904ead619b86124d72a990223
3
+ metadata.gz: 03c8b2ee7d2f36e2031d0154b2bdd0b6727e8318
4
+ data.tar.gz: 19748ee549e09132460add0f01193162b2021f61
5
5
  SHA512:
6
- metadata.gz: 975e5096f49d56d58af5d4cfd5b46bd5e9111194835c2e7a2bfc87c47b7a1d8e5d398f636913500702776bc296e0f5fd2c6d37edf5f9c7b4dd5b7a70659860e2
7
- data.tar.gz: f5af91435bbfc96c4afeeefc9ac0b37fad86f039c5a97a26aa9bb3a5fe0a9d09a5a7b8137f14a08c77f945fc0100b902a44012d5ff00001c9780af19394db9d3
6
+ metadata.gz: de06060ad36459a365b15ea31ac22de0617023ed0318fed2c964a8d05839148c517c2033a58f935c783bd7f7178817058ca47483e6e14e66c20f152af21f0937
7
+ data.tar.gz: fe0e4d88af10fe6d12cb3f135af9f5310584a43ad66d7e22c7e22e611253df943909b9b5451657fe69323ebd0ed5e15031dc7bbe6e0d9789ab8554c81d326c2f
@@ -21,7 +21,9 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.required_ruby_version = '>= 1.9.3'
23
23
 
24
- spec.add_development_dependency 'bundler', '~> 1.5'
24
+ spec.add_development_dependency 'bundler', '~> 1.6'
25
25
  spec.add_development_dependency 'rake', '~> 10.0'
26
26
  spec.add_development_dependency 'rspec'
27
+
28
+ spec.add_dependency 'everyday-cli-utils', '~> 1.7'
27
29
  end
@@ -1,3 +1,7 @@
1
+ require 'everyday-cli-utils'
2
+ include EverydayCliUtils
3
+ import :maputil
4
+
1
5
  module EverydayPlugins
2
6
  class Plugins
3
7
  def self.instance
@@ -113,4 +117,51 @@ module EverydayPlugins
113
117
  EverydayPlugins::Plugins.instance.register_variable(name, value)
114
118
  end
115
119
  end
120
+ module TypeHelper
121
+ def basic_type(list, *args)
122
+ options = Plugins.get_var :options
123
+ list.any? { |item|
124
+ if item[:block].nil?
125
+ flag_boolean(item, options)
126
+ else
127
+ item[:block].call(options, *args)
128
+ end
129
+ }
130
+ end
131
+
132
+ def flag_boolean(item, options)
133
+ item[:options].has_key?(:option) && options[item[:options][:option]] == (item[:options].has_key?(:value) ? item[:options][:value] : true)
134
+ end
135
+
136
+ def complex_filter(list, options, symbol)
137
+ list.filtermap { |item|
138
+ if item[:block].nil?
139
+ if item[:options].has_key?(symbol) && flag_boolean(item, options)
140
+ item[:options][symbol]
141
+ else
142
+ item[:options].has_key?(:option) && !options[item[:options][:option]].nil? ? options[item[:options][:option]] : false
143
+ end
144
+ else
145
+ rval = item[:block].call(options)
146
+ (rval.nil? || !rval) ? false : rval
147
+ end
148
+ }
149
+ end
150
+
151
+ def simple_type(list, *args)
152
+ options = Plugins.get_var :options
153
+ list.sort_by { |v| v[:options][:order] }.each { |item| item[:block].call(options, *args) }
154
+ end
155
+
156
+ def simple_type_with_result(list)
157
+ result = Plugins.get_var :result
158
+ simple_type(list, result)
159
+ end
160
+
161
+ def get_name(list)
162
+ options = Plugins.get_var :options
163
+ rval = complex_filter(list.sort_by { |v| -v[:options][:priority] }, options, :name)
164
+ (rval.nil? || rval.empty?) ? false : rval.first
165
+ end
166
+ end
116
167
  end
@@ -1,3 +1,3 @@
1
1
  module EverydayPlugins
2
- VERSION = '1.1.1'
2
+ VERSION = '1.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: everyday-plugins
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.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-04-30 00:00:00.000000000 Z
11
+ date: 2014-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.5'
19
+ version: '1.6'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.5'
26
+ version: '1.6'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: everyday-cli-utils
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.7'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.7'
55
69
  description: A simple gem plugin system. Extracted from the mvn2 gem.
56
70
  email:
57
71
  - henderea@gmail.com