claide 0.8.0 → 0.8.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 39fe6340165dbe39cd732747424e3360f6fde1ca
4
- data.tar.gz: 96a7229736da06c1c4ec61c9a2fc1a9a972fe1b2
3
+ metadata.gz: 45af4e6e8ec03d5589f197fc32431c8f97129e5f
4
+ data.tar.gz: c16b476522a679273485e15b52323bef604b900f
5
5
  SHA512:
6
- metadata.gz: 4cbd2c94407f1083a03629754892b8acbda7c2c5335f004c26e59f7040fb3532a161f082b7171a15f89f05db1cc80f2d447c645a35ff4fd5c45cb034126e6c25
7
- data.tar.gz: c9af023661f85713f91b4fb2b4480b73599c2506272ad1362fa6fa5a3feb110066c02e5479926890151bb16bb95ca2d890e46875f7c87471dc1697819e0f95c2
6
+ metadata.gz: 7468565a106cd8bada3afe58a23f1f9429ad496fdfd2ab30b068412043a979c70872fc50bae04e54640a727bd00391f2f6ea5a9c06c61190dfd5727cee9b6cd9
7
+ data.tar.gz: 389d403a08937d47fda48ffa54167ab5d60502d50cf646940b9b37ef56b4ae3f1eb9a37b7127b6f0d03b3c149bfc858b7c12c7511b199a9642eb0d7f4bd852a1
data/lib/claide.rb CHANGED
@@ -8,7 +8,7 @@ module CLAide
8
8
  #
9
9
  # CLAide’s version, following [semver](http://semver.org).
10
10
  #
11
- VERSION = '0.8.0'
11
+ VERSION = '0.8.1'
12
12
 
13
13
  require 'claide/ansi'
14
14
  require 'claide/argument'
@@ -54,7 +54,9 @@ module CLAide
54
54
  #
55
55
  def self.specification(path)
56
56
  matches = Dir.glob("#{path}/*.gemspec")
57
- spec = Gem::Specification.load(matches.first) if matches.count == 1
57
+ spec = silence_streams(STDERR) do
58
+ Gem::Specification.load(matches.first)
59
+ end if matches.count == 1
58
60
  unless spec
59
61
  warn '[!] Unable to load a specification for the plugin ' \
60
62
  "`#{path}`".ansi.yellow
@@ -113,6 +115,28 @@ module CLAide
113
115
  false
114
116
  end
115
117
  # rubocop:enable RescueException
118
+
119
+ # Executes the given block while silencing the given streams.
120
+ #
121
+ # @return [Object] The value of the given block.
122
+ #
123
+ # @param [Array] streams
124
+ # The streams to silence.
125
+ #
126
+ # @note credit to DHH http://stackoverflow.com/a/8959520
127
+ #
128
+ def self.silence_streams(*streams)
129
+ on_hold = streams.map(&:dup)
130
+ streams.each do |stream|
131
+ stream.reopen('/dev/null')
132
+ stream.sync = true
133
+ end
134
+ yield
135
+ ensure
136
+ streams.each_with_index do |stream, i|
137
+ stream.reopen(on_hold[i])
138
+ end
139
+ end
116
140
  end
117
141
  end
118
142
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: claide
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-25 00:00:00.000000000 Z
12
+ date: 2015-02-25 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email:
@@ -19,21 +19,21 @@ executables: []
19
19
  extensions: []
20
20
  extra_rdoc_files: []
21
21
  files:
22
+ - LICENSE
23
+ - README.markdown
24
+ - lib/claide.rb
25
+ - lib/claide/ansi.rb
22
26
  - lib/claide/ansi/cursor.rb
23
27
  - lib/claide/ansi/graphics.rb
24
28
  - lib/claide/ansi/string_escaper.rb
25
- - lib/claide/ansi.rb
26
29
  - lib/claide/argument.rb
27
30
  - lib/claide/argv.rb
31
+ - lib/claide/command.rb
28
32
  - lib/claide/command/argument_suggester.rb
29
33
  - lib/claide/command/banner.rb
30
34
  - lib/claide/command/plugin_manager.rb
31
- - lib/claide/command.rb
32
35
  - lib/claide/help.rb
33
36
  - lib/claide/informative_error.rb
34
- - lib/claide.rb
35
- - README.markdown
36
- - LICENSE
37
37
  homepage: https://github.com/CocoaPods/CLAide
38
38
  licenses:
39
39
  - MIT
@@ -44,17 +44,17 @@ require_paths:
44
44
  - lib
45
45
  required_ruby_version: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - '>='
47
+ - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: '0'
50
50
  required_rubygems_version: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  requirements: []
56
56
  rubyforge_project:
57
- rubygems_version: 2.0.14
57
+ rubygems_version: 2.4.5
58
58
  signing_key:
59
59
  specification_version: 3
60
60
  summary: A small command-line interface framework.