specs 0.7 → 0.8

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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/bin/specs +4 -5
  3. data/lib/aspects/as.rb +15 -15
  4. data/lib/aspects/bios.rb +7 -7
  5. data/lib/aspects/brew.rb +7 -7
  6. data/lib/aspects/chicken.rb +17 -17
  7. data/lib/aspects/chocolatey.rb +7 -7
  8. data/lib/aspects/chrome.rb +15 -15
  9. data/lib/aspects/clojure.rb +13 -13
  10. data/lib/aspects/cpu.rb +14 -14
  11. data/lib/aspects/dmake.rb +5 -5
  12. data/lib/aspects/erlang.rb +13 -13
  13. data/lib/aspects/fabric.rb +5 -5
  14. data/lib/aspects/firefox.rb +13 -13
  15. data/lib/aspects/go.rb +5 -5
  16. data/lib/aspects/hadoop.rb +25 -25
  17. data/lib/aspects/hardware.rb +3 -3
  18. data/lib/aspects/haskell.rb +23 -27
  19. data/lib/aspects/hd.rb +9 -9
  20. data/lib/aspects/ie.rb +7 -7
  21. data/lib/aspects/inkscape.rb +16 -16
  22. data/lib/aspects/java.rb +9 -9
  23. data/lib/aspects/lacheck.rb +5 -0
  24. data/lib/aspects/latex.rb +7 -7
  25. data/lib/aspects/ld.rb +5 -5
  26. data/lib/aspects/links.rb +5 -5
  27. data/lib/aspects/lua.rb +5 -5
  28. data/lib/aspects/net.rb +5 -5
  29. data/lib/aspects/node.rb +19 -19
  30. data/lib/aspects/ocaml.rb +1 -1
  31. data/lib/aspects/opera.rb +14 -14
  32. data/lib/aspects/oz.rb +5 -5
  33. data/lib/aspects/perl.rb +2 -2
  34. data/lib/aspects/php.rb +13 -0
  35. data/lib/aspects/powershell.rb +7 -7
  36. data/lib/aspects/python.rb +13 -13
  37. data/lib/aspects/python3.rb +13 -0
  38. data/lib/aspects/ram.rb +11 -11
  39. data/lib/aspects/redis.rb +9 -3
  40. data/lib/aspects/ruby.rb +23 -23
  41. data/lib/aspects/scala.rb +3 -3
  42. data/lib/aspects/shell.rb +9 -9
  43. data/lib/aspects/splint.rb +5 -0
  44. data/lib/aspects/ssh.rb +5 -5
  45. data/lib/aspects/tap.rb +5 -5
  46. data/lib/aspects/thrift.rb +5 -5
  47. data/lib/aspects/virtualbox.rb +16 -16
  48. data/lib/aspects/xcode.rb +7 -7
  49. data/lib/specs.rb +79 -50
  50. data/lib/version.rb +4 -1
  51. metadata +146 -2
@@ -1,9 +1,9 @@
1
- module Recipe
2
- def self.shell
3
- if Os.windows?
4
- "echo %cmdextversion%"
5
- elsif Os.unix?
6
- "sh --version"
7
- end
8
- end
9
- end
1
+ module Recipe
2
+ def self.shell
3
+ if Os.windows?
4
+ 'echo %cmdextversion%'
5
+ elsif Os.unix?
6
+ 'sh --version'
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ module Recipe
2
+ def self.splint
3
+ 'splint -help version'
4
+ end
5
+ end
@@ -1,5 +1,5 @@
1
- module Recipe
2
- def self.ssh
3
- "ssh -V"
4
- end
5
- end
1
+ module Recipe
2
+ def self.ssh
3
+ 'ssh -V'
4
+ end
5
+ end
@@ -1,5 +1,5 @@
1
- module Recipe
2
- def self.tap
3
- "tap --version"
4
- end
5
- end
1
+ module Recipe
2
+ def self.tap
3
+ 'tap --version'
4
+ end
5
+ end
@@ -1,5 +1,5 @@
1
- module Recipe
2
- def self.thrift
3
- "thrift -version"
4
- end
5
- end
1
+ module Recipe
2
+ def self.thrift
3
+ 'thrift -version'
4
+ end
5
+ end
@@ -1,16 +1,16 @@
1
- module Recipe
2
- def self.virtualbox
3
- case Os.os_name
4
- when :windows
5
- if Os.x86?
6
- "\"C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage\" --version"
7
- else
8
- "C:\\Program Files (x86)\\Oracle\\VirtualBox\\VBoxManage --version"
9
- end
10
- when :mac
11
- "/Applications/Firefox.app/Contents/MacOS/firefox --version"
12
- else
13
- "firefox --version"
14
- end
15
- end
16
- end
1
+ module Recipe
2
+ def self.virtualbox
3
+ case Os.os_name
4
+ when :windows
5
+ if Os.x86?
6
+ '"C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage" --version'
7
+ else
8
+ 'C:\\Program Files (x86)\\Oracle\\VirtualBox\\VBoxManage --version'
9
+ end
10
+ when :mac
11
+ '/Applications/Firefox.app/Contents/MacOS/firefox --version'
12
+ else
13
+ 'firefox --version'
14
+ end
15
+ end
16
+ end
@@ -1,7 +1,7 @@
1
- module Recipe
2
- def self.xcode
3
- if Os.mac?
4
- "xcodebuild -version"
5
- end
6
- end
7
- end
1
+ module Recipe
2
+ def self.xcode
3
+ if Os.mac?
4
+ 'xcodebuild -version'
5
+ end
6
+ end
7
+ end
@@ -26,64 +26,76 @@
26
26
  # --version, -v:
27
27
  # print specs' own version
28
28
 
29
- require "getoptlong"
30
- require "pathname"
29
+ require 'getoptlong'
30
+ require 'pathname'
31
+ require 'contracts'
32
+ include Contracts
31
33
 
32
- require "version"
34
+ require 'version'
33
35
  SPECS_VERSION_STRING = "specs #{Specs::VERSION}"
34
36
 
35
- SPECS_HOME_PAGE = "https://github.com/mcandre/specs#readme"
37
+ SPECS_HOME_PAGE = 'https://github.com/mcandre/specs#readme'
36
38
 
37
39
  SPECS_DIR = Pathname.new(File.dirname(__FILE__))
38
40
 
39
41
  # Get the basic operating system name reliably, even in JRuby
40
42
  # Useful for OS-contextual command line instructions.
41
43
  #
42
- # E.g., "C:\Program Files (x86)\Mozilla Firefox\firefox --version" in Windows vs
43
- # "/Applications/Firefox.app/Contents/MacOS/firefox --version" in Mac vs
44
- # "firefox --version" in Unix
44
+ # E.g., 'C:\Program Files (x86)\Mozilla Firefox\firefox --version' in Windows vs
45
+ # '/Applications/Firefox.app/Contents/MacOS/firefox --version' in Mac vs
46
+ # 'firefox --version' in Unix
45
47
  #
46
48
  module Os
49
+ Contract nil => String
47
50
  def self.raw
48
51
  # Config deprecated in Ruby 1.9
49
- RbConfig::CONFIG["host_os"]
52
+ RbConfig::CONFIG['host_os']
50
53
  end
51
54
 
52
55
  # A series of OS descriptions.
53
56
  # Not all of these are mutually exclusive.
54
57
 
58
+ Contract nil => Bool
55
59
  def self.windows?
56
- self.raw =~ /cygwin|mswin|mingw|bccwin|wince|emx/
60
+ raw =~ /cygwin|mswin|mingw|bccwin|wince|emx/
57
61
  end
58
62
 
63
+ Contract nil => Bool
59
64
  def self.mingw?
60
- self.raw =~ /cygwin|mingw/
65
+ raw =~ /cygwin|mingw/
61
66
  end
62
67
 
68
+ Contract nil => Bool
63
69
  def self.mac?
64
- self.raw =~ /darwin/
70
+ raw =~ /darwin/
65
71
  end
66
72
 
73
+ Contract nil => Bool
67
74
  def self.unix?
68
- not self.windows?
75
+ !self.windows?
69
76
  end
70
77
 
78
+ Contract nil => Bool
71
79
  def self.haiku?
72
- self.raw =~ /haiku/
80
+ raw =~ /haiku/
73
81
  end
74
82
 
83
+ Contract nil => Bool
75
84
  def self.linux?
76
- self.unix? and not (self.mac? or self.haiku?)
85
+ self.unix? && !(self.mac? || self.haiku?)
77
86
  end
78
87
 
88
+ Contract nil => Bool
79
89
  def self.x86_64?
80
- RbConfig::CONFIG["arch"] =~ /64/
90
+ RbConfig::CONFIG['arch'] =~ /64/
81
91
  end
82
92
 
93
+ Contract nil => Bool
83
94
  def self.x86?
84
95
  !self.x86_64?
85
96
  end
86
97
 
98
+ Contract nil => Symbol
87
99
  def self.os_name
88
100
  if self.windows?
89
101
  :windows
@@ -99,76 +111,96 @@ module Os
99
111
  end
100
112
  end
101
113
 
114
+ #
115
+ # Recipe
116
+ #
102
117
  module Recipe
118
+ #
119
+ # Package
120
+ #
103
121
  module Package
104
122
  end
105
123
 
124
+ Contract nil => String
106
125
  def self.command_not_found
107
126
  # Windows but not MinGW
108
- if Os.windows? and !Os.mingw?
109
- "not recognized as an internal or external command"
127
+ if Os.windows? && !Os.mingw?
128
+ 'not recognized as an internal or external command'
110
129
  # MinGW or other Unix variant.
111
130
  else
112
- "command not found"
131
+ 'command not found'
113
132
  end
114
133
  end
115
134
 
135
+ Contract nil => String
116
136
  def self.os
117
137
  case Os.os_name
118
138
  when :windows
119
- "systeminfo | findstr /B /C:\"OS Name\" /C:\"OS Version\""
139
+ 'systeminfo | findstr /B /C:"OS Name" /C:"OS Version"'
120
140
  when :mac
121
- "system_profiler SPSoftwareDataType | grep 'System Version'"
141
+ 'system_profiler SPSoftwareDataType | grep \'System Version\''
122
142
  when :linux
123
- "lsb_release -a"
143
+ 'lsb_release -a'
124
144
  when :unix
125
- "uname -a"
145
+ 'uname -a'
146
+ # Punt.
147
+ else
148
+ 'echo $OS'
126
149
  end
127
150
  end
128
151
 
152
+ Contract nil => String
129
153
  def self.arch
130
- "ruby -rrbconfig -e 'puts RbConfig::CONFIG[\"arch\"]'"
154
+ 'ruby -rrbconfig -e \'puts RbConfig::CONFIG[\'arch\']\''
131
155
  end
132
156
 
157
+ Contract nil => String
133
158
  def self.specs
134
159
  SPECS_VERSION_STRING
135
160
  end
136
161
 
162
+ Contract nil => String
137
163
  def self.ruby_v
138
164
  RUBY_VERSION
139
165
  end
140
166
 
167
+ Contract nil => Bool
141
168
  def self.ruby1_8?
142
169
  RUBY_VERSION =~ /^1\.8/
143
170
  end
144
171
 
172
+ Contract nil => Bool
145
173
  def self.ruby1_9?
146
174
  RUBY_VERSION =~ /^1\.9/
147
175
  end
148
176
 
177
+ Contract nil => Bool
149
178
  def self.ruby2?
150
179
  RUBY_VERSION =~ /^2/
151
180
  end
152
181
 
182
+ Contract nil => String
153
183
  def self.rubygems
154
- "gem --version"
184
+ 'gem --version'
155
185
  end
156
186
 
187
+ Contract nil => String
157
188
  def self.rb
158
- "ruby --version"
189
+ 'ruby --version'
159
190
  end
160
191
 
192
+ Contract nil => ArrayOf[String]
161
193
  def self.ruby
162
194
  [rubygems, rb]
163
195
  end
164
196
  end
165
197
 
166
- BUILTINS = ["specs", "os", "arch", "ruby"]
198
+ BUILTINS = %w(specs os arch ruby)
167
199
 
168
200
  SEP = File::SEPARATOR
169
201
 
170
202
  # .../specs/aspects
171
- RECIPE_DIR = [SPECS_DIR, "aspects"].join(SEP)
203
+ RECIPE_DIR = [SPECS_DIR, 'aspects'].join(SEP)
172
204
 
173
205
  Dir[File.join(RECIPE_DIR, '**', '*.rb')].each do |file|
174
206
  require File.expand_path(file)
@@ -176,20 +208,18 @@ end
176
208
 
177
209
  # For a given spec, return the command line instruction(s)
178
210
  # that will get the spec's version information.
179
- def command(aspect)
211
+ def self.command(aspect)
180
212
  # Ruby methods can't use hypens (-),
181
213
  # So translate to underscores (_)
182
214
  # When looking up known aspects.
183
- method = aspect.gsub("-", "_").to_sym
215
+ method = aspect.gsub('-', '_').to_sym
184
216
 
185
217
  # Package?
186
- if aspect.include?(":")
187
- package_manager, package = aspect.split(":")
218
+ if aspect.include?(':')
219
+ package_manager, package = aspect.split(':')
188
220
  package_manager = package_manager.to_sym
189
221
 
190
- if Recipe::Package.methods.include?(package_manager)
191
- Recipe::Package.send(package_manager, package)
192
- end
222
+ Recipe::Package.send(package_manager, package) if Recipe::Package.methods.include?(package_manager)
193
223
  # Known aspect?
194
224
  elsif Recipe.methods.include?(method)
195
225
  Recipe.send(method)
@@ -202,14 +232,14 @@ end
202
232
 
203
233
  # Print a command line instruction and its output,
204
234
  # Emulating a user manually entering the instruction.
205
- def run(cmd, aspect)
235
+ def self.run(cmd, aspect)
206
236
  # Newline to visually separate multiple aspect commands.
207
- puts ""
237
+ puts ''
208
238
 
209
239
  if !cmd
210
240
  puts "#{aspect} aspect not implemented for this system"
211
241
  elsif cmd == SPECS_VERSION_STRING
212
- puts "specs --version"
242
+ puts 'specs --version'
213
243
  puts SPECS_VERSION_STRING
214
244
  else
215
245
  puts cmd
@@ -224,18 +254,18 @@ def run(cmd, aspect)
224
254
  end
225
255
  end
226
256
 
227
- def check_ruby_version
257
+ def self.check_ruby_version
228
258
  if Recipe.ruby1_8?
229
- puts "Requires Ruby 1.9 or higher."
230
- puts "http://www.ruby-lang.org/"
259
+ puts 'Requires Ruby 1.9 or higher.'
260
+ puts 'http://www.ruby-lang.org/'
231
261
  exit
232
262
  end
233
263
  end
234
264
 
235
- def usage
265
+ def self.usage
236
266
  puts "Specs:\n\n#{SPECS_VERSION_STRING}\n#{SPECS_HOME_PAGE}"
237
267
 
238
- exit if ARGV.include?("--version")
268
+ exit if ARGV.include?('--version')
239
269
  end
240
270
 
241
271
  def main
@@ -244,23 +274,22 @@ def main
244
274
  usage
245
275
 
246
276
  # Default aspects
247
- aspects = ["os", "hardware"]
248
- if !ARGV.empty?
249
- aspects = ARGV
250
- end
277
+ aspects = %w(os hardware)
278
+
279
+ aspects = ARGV unless ARGV.empty?
251
280
 
252
- aspects = aspects - ["specs"]
281
+ aspects = aspects - ['specs']
253
282
 
254
- aspects.each { |aspect|
283
+ aspects.each do |aspect|
255
284
  # What does the aspect module say to run
256
285
  # in order to retrieve the aspect information?
257
286
  cmds = command(aspect)
258
287
 
259
- if !cmds or cmds.instance_of?(String)
288
+ if !cmds || cmds.instance_of?(String)
260
289
  run(cmds, aspect)
261
290
  # Module returns an array of command strings.
262
291
  elsif cmds.instance_of?(Array)
263
292
  cmds.each { |cmd| run(cmd, aspect) }
264
293
  end
265
- }
294
+ end
266
295
  end
@@ -1,3 +1,6 @@
1
+ #
2
+ # Specs
3
+ #
1
4
  module Specs
2
- VERSION = "0.7"
5
+ VERSION = '0.8'
3
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specs
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.7'
4
+ version: '0.8'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Pennebaker
@@ -10,6 +10,20 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2013-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: contracts
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rake
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +66,104 @@ dependencies:
52
66
  - - '>='
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: flog
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: roodi
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: churn
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: cane
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: excellent
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: tailor
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - '>='
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
55
167
  - !ruby/object:Gem::Dependency
56
168
  name: guard
57
169
  requirement: !ruby/object:Gem::Requirement
@@ -68,6 +180,34 @@ dependencies:
68
180
  version: '0'
69
181
  - !ruby/object:Gem::Dependency
70
182
  name: guard-shell
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - '>='
186
+ - !ruby/object:Gem::Version
187
+ version: '0.6'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - '>='
193
+ - !ruby/object:Gem::Version
194
+ version: '0.6'
195
+ - !ruby/object:Gem::Dependency
196
+ name: rspec
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - '>='
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - '>='
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: cucumber
71
211
  requirement: !ruby/object:Gem::Requirement
72
212
  requirements:
73
213
  - - '>='
@@ -109,6 +249,7 @@ files:
109
249
  - lib/aspects/ie.rb
110
250
  - lib/aspects/inkscape.rb
111
251
  - lib/aspects/java.rb
252
+ - lib/aspects/lacheck.rb
112
253
  - lib/aspects/latex.rb
113
254
  - lib/aspects/ld.rb
114
255
  - lib/aspects/links.rb
@@ -119,13 +260,16 @@ files:
119
260
  - lib/aspects/opera.rb
120
261
  - lib/aspects/oz.rb
121
262
  - lib/aspects/perl.rb
263
+ - lib/aspects/php.rb
122
264
  - lib/aspects/powershell.rb
123
265
  - lib/aspects/python.rb
266
+ - lib/aspects/python3.rb
124
267
  - lib/aspects/ram.rb
125
268
  - lib/aspects/redis.rb
126
269
  - lib/aspects/ruby.rb
127
270
  - lib/aspects/scala.rb
128
271
  - lib/aspects/shell.rb
272
+ - lib/aspects/splint.rb
129
273
  - lib/aspects/ssh.rb
130
274
  - lib/aspects/tap.rb
131
275
  - lib/aspects/thrift.rb
@@ -153,7 +297,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
297
  version: '0'
154
298
  requirements: []
155
299
  rubyforge_project:
156
- rubygems_version: 2.0.6
300
+ rubygems_version: 2.0.14
157
301
  signing_key:
158
302
  specification_version: 4
159
303
  summary: Software version information at your fingertips