easy_app_helper 4.1.1 → 4.1.2

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: 434a85f02a1eaf504c9ed65adf914a645078642a
4
- data.tar.gz: 21f6e3d42db143603287c979a90dc8c0c7824e85
3
+ metadata.gz: a8ad72833020b17d6a18aa5d80a3ec6b39752f1d
4
+ data.tar.gz: 27b76179f874b068bce02b666b9877096f67db44
5
5
  SHA512:
6
- metadata.gz: 8ab470b01821537d0a0afb568f2a0549ec726a311b18675a9de899243a4a895b7d71b88fdadb51bc5f8ac555102c989474a1f2b8f84b7030fb2b6e4da3b4959c
7
- data.tar.gz: 9455efe10be024aa836d62bdaab32a8b776461d6d3332c8f889696197d577fdbc752762a19128ae2b2436f2acb81000f566b3aeac4e896ef3815c98fff928afc
6
+ metadata.gz: ffee1008b3e25274dc63b75946723f24d28f9a8b0f26c510c04b8741b7c783d4d0093b5c4cecafb8499a1c6a41f8eaaa67cbe3712a414a3e45174df0a97aefb6
7
+ data.tar.gz: 011cd2a385b3a3e3548df86174f876c05ff5c1e8b26df392a43e4498fdbddacdb5674c69d6ba8feb28dce601f33b2dde4dbd88fe817bf5912eacae651ae41bb1
@@ -40,6 +40,9 @@ module EasyAppHelper
40
40
  unless self::ALIASES.nil? or self::ALIASES.empty?
41
41
  line += ' (aliases: %s).' % [ self::ALIASES.join(', ') ]
42
42
  end
43
+ unless self::PROVIDER == EasyAppHelper::Scripts::SubCommandBase::PROVIDER
44
+ line += ' Provided by %s plugin.' % [ self::PROVIDER ]
45
+ end
43
46
  line
44
47
  end
45
48
 
@@ -35,21 +35,24 @@ module EasyAppHelper
35
35
  @by_name ||= {}
36
36
  end
37
37
 
38
- def self.sub_command_class(command_name_or_alias, provider=EasyAppHelper::Scripts::SubCommandBase::PROVIDER)
39
- candidates = by_provider[provider]
40
- raise "There is no provider declared for command '#{command_name_or_alias}'" if candidates.nil?
41
- candidates.select! do |sub_command_class|
38
+ def self.sub_command_class(command_name_or_alias, preferred_provider=EasyAppHelper::Scripts::SubCommandBase::PROVIDER)
39
+ candidates = by_name[command_name_or_alias].select do |sub_command_class|
42
40
  command_classes_for_command = by_name[command_name_or_alias]
43
41
  raise "There is no provider declared for command '#{command_name_or_alias}'" if command_classes_for_command.nil?
44
42
  command_classes_for_command.include? sub_command_class
45
43
  end
46
- raise "Cannot determine provider to use for '#{command_name_or_alias}'. Multiple providers exist !" unless candidates.size == 1
44
+ if candidates.size > 1
45
+ candidates.select! do |sub_command_class|
46
+ sub_command_class::PROVIDER == preferred_provider
47
+ end
48
+ raise "Cannot determine provider to use for '#{command_name_or_alias}'. Multiple providers exist !"
49
+ end
47
50
  candidates.first
48
51
  end
49
52
 
50
- def delegate_to_sub_command(provider = EasyAppHelper::Scripts::SubCommandBase::PROVIDER)
53
+ def delegate_to_sub_command(preferred_provider=EasyAppHelper::Scripts::SubCommandBase::PROVIDER)
51
54
  sub_command_name = extra_parameters.shift
52
- sub_command = EasyAppHelper::Scripts::SubCommandManager.sub_command_class(sub_command_name, provider).new
55
+ sub_command = EasyAppHelper::Scripts::SubCommandManager.sub_command_class(sub_command_name, preferred_provider).new
53
56
  sub_command.pre_process
54
57
  raise 'You have to implement \'do_process\'' unless sub_command.respond_to? :do_process
55
58
  sub_command.do_process
@@ -1,3 +1,3 @@
1
1
  module EasyAppHelper
2
- VERSION = '4.1.1'
2
+ VERSION = '4.1.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_app_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.1
4
+ version: 4.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - L.Briais
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-16 00:00:00.000000000 Z
11
+ date: 2016-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler