tryouts 2.1.0 → 2.2.0.pre.RC1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: dbbfffa0cddd9a7e3e7515a9d48a4574041f9c98c5896d5abba268f8583b3efc
4
+ data.tar.gz: ad85207912aeb782ea679c4298c1beeac8837ef1e42e9ecefc51a5fda832ca25
5
+ SHA512:
6
+ metadata.gz: f0b5b32c5ec3c48f0cde12963cfdefc7202284c13b464b11d4fbd2cbc24f928e8147471a653d7f345bcdad509fec94a458c2a007362236c1970c4f304766f405
7
+ data.tar.gz: 96a95e649151dd3b815bd8993e9ea2ad2133616a968a6254a5e4930b7ebe39acebff3b8d086b009bf8755b6872198f516a8f2a7f352a023b892e2d3622c8fe9e
data/README.rdoc CHANGED
@@ -45,7 +45,7 @@ For real world examples, see the Gibbler[http://github.com/delano/gibbler/tree/m
45
45
  All code before the first test definition is assumed to be setup code. All code after the last definition is assumed to be cleanup code. Here is an example:
46
46
 
47
47
 
48
- # This is called after all tests
48
+ # This is called before all tests
49
49
  require 'gibbler'
50
50
  Gibbler.digest_type = Digest::SHA256
51
51
 
data/Rakefile CHANGED
@@ -25,6 +25,7 @@ begin
25
25
  gem.email = "delano@solutious.com"
26
26
  gem.homepage = "http://github.com/delano/tryouts"
27
27
  gem.authors = ["Delano Mandelbaum"]
28
+ gem.add_dependency("sysinfo", ">= 0.7.3")
28
29
  end
29
30
  Jeweler::GemcutterTasks.new
30
31
  rescue LoadError
metadata CHANGED
@@ -1,70 +1,62 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: tryouts
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 2.1.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.2.0.pre.RC1
6
5
  platform: ruby
7
- authors:
6
+ authors:
8
7
  - Delano Mandelbaum
9
- autorequire:
8
+ autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
-
13
- date: 2011-02-12 00:00:00 -05:00
14
- default_executable: try
15
- dependencies: []
16
-
11
+ date: 2024-04-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sysinfo
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.9.0.pre.RC1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.9.0.pre.RC1
17
27
  description: Don't waste your time writing tests
18
28
  email: delano@solutious.com
19
- executables:
29
+ executables:
20
30
  - try
21
31
  extensions: []
22
-
23
- extra_rdoc_files:
24
- - LICENSE.txt
25
- - README.rdoc
26
- files:
27
- - .gitignore
28
- - CHANGES.txt
32
+ extra_rdoc_files: []
33
+ files:
29
34
  - LICENSE.txt
30
35
  - README.rdoc
31
36
  - Rakefile
32
- - VERSION.yml
33
37
  - bin/try
34
- - lib/sysinfo.rb
35
38
  - lib/tryouts.rb
36
- - try/step1_try.rb
37
- - try/step2_try.rb
38
- - try/step3_try.rb
39
- - try/step4_try.rb
40
- - tryouts.gemspec
41
- has_rdoc: true
42
39
  homepage: http://github.com/delano/tryouts
43
- licenses: []
44
-
45
- post_install_message:
46
- rdoc_options:
47
- - --charset=UTF-8
48
- require_paths:
40
+ licenses:
41
+ - MIT
42
+ metadata: {}
43
+ post_install_message:
44
+ rdoc_options: []
45
+ require_paths:
49
46
  - lib
50
- required_ruby_version: !ruby/object:Gem::Requirement
51
- none: false
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- version: "0"
56
- required_rubygems_version: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
59
49
  - - ">="
60
- - !ruby/object:Gem::Version
61
- version: "0"
50
+ - !ruby/object:Gem::Version
51
+ version: '3.1'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">"
55
+ - !ruby/object:Gem::Version
56
+ version: 1.3.1
62
57
  requirements: []
63
-
64
- rubyforge_project: tryouts
65
- rubygems_version: 1.5.2
66
- signing_key:
67
- specification_version: 3
58
+ rubygems_version: 3.3.26
59
+ signing_key:
60
+ specification_version: 4
68
61
  summary: Don't waste your time writing tests
69
62
  test_files: []
70
-
data/.gitignore DELETED
@@ -1 +0,0 @@
1
- pkg
data/CHANGES.txt DELETED
@@ -1,35 +0,0 @@
1
- TRYOUTS, CHANGES
2
-
3
- #### 2.1.0 (2011-02-12) ###############################
4
-
5
- * CHANGE: Default output is less verbose (eg. PASS/FAIL/SKIP)
6
- * CHANGE: -q now prints nothing to STDOUT. Check $?. If 0, all tests pass
7
- otherwise it contains the number of tests that failed.
8
- * ADDED: -v option for increased output.
9
-
10
-
11
- #### 2.0.4 (2011-01-06) ###############################
12
-
13
- * ADDED: -q option for reduced output.
14
-
15
- #### 2.0.3 (2010-11-03) ###############################
16
-
17
- * FIXED: Print test value not expected value twice!
18
-
19
- #### 2.0.2 (2010-11-03) ###############################
20
-
21
- * FIXED: Properly skip test cases with commented out expectations (i.e ##=>)
22
- * CHANGE: Revised CLI output. Print output for each test case as it's running.
23
-
24
-
25
- #### 2.0.1.002 (2010-07-21) ###############################
26
-
27
- * FIXED: clean error (bad value for range). Didn't run tryouts. Bad Delano!
28
-
29
- #### 2.0.1 (2010-07-21) ###############################
30
-
31
- * FIXED: Fix range of lines executed for clean, was double executing most test defs
32
-
33
- #### 2.0.0 (2010-07-19) ###############################
34
-
35
- Initial 2.0 release.
data/VERSION.yml DELETED
@@ -1,4 +0,0 @@
1
- ---
2
- :MAJOR: 2
3
- :MINOR: 1
4
- :PATCH: 0
data/lib/sysinfo.rb DELETED
@@ -1,278 +0,0 @@
1
- require 'socket'
2
- require 'time'
3
-
4
- # = SysInfo
5
- #
6
- # A container for the platform specific system information.
7
- # Portions of this code were originally from Amazon's EC2 AMI tools,
8
- # specifically lib/platform.rb.
9
- class SysInfo
10
- unless defined?(IMPLEMENTATIONS)
11
- VERSION = "0.7.3".freeze
12
- IMPLEMENTATIONS = [
13
-
14
- # These are for JRuby, System.getproperty('os.name').
15
- # For a list of all values, see: http://lopica.sourceforge.net/os.html
16
-
17
- #regexp matcher os implementation
18
- [/mac\s*os\s*x/i, :unix, :osx ],
19
- [/sunos/i, :unix, :solaris ],
20
- [/windows\s*ce/i, :windows, :wince ],
21
- [/windows/i, :windows, :windows ],
22
- [/osx/i, :unix, :osx ],
23
-
24
- # These are for RUBY_PLATFORM and JRuby
25
- [/java/i, :java, :java ],
26
- [/darwin/i, :unix, :osx ],
27
- [/linux/i, :unix, :linux ],
28
- [/freebsd/i, :unix, :freebsd ],
29
- [/netbsd/i, :unix, :netbsd ],
30
- [/solaris/i, :unix, :solaris ],
31
- [/irix/i, :unix, :irix ],
32
- [/cygwin/i, :unix, :cygwin ],
33
- [/mswin/i, :windows, :windows ],
34
- [/djgpp/i, :windows, :djgpp ],
35
- [/mingw/i, :windows, :mingw ],
36
- [/bccwin/i, :windows, :bccwin ],
37
- [/wince/i, :windows, :wince ],
38
- [/vms/i, :vms, :vms ],
39
- [/os2/i, :os2, :os2 ],
40
- [nil, :unknown, :unknown ],
41
- ].freeze
42
-
43
- ARCHITECTURES = [
44
- [/(i\d86)/i, :x86 ],
45
- [/x86_64/i, :x86_64 ],
46
- [/x86/i, :x86 ], # JRuby
47
- [/ia64/i, :ia64 ],
48
- [/alpha/i, :alpha ],
49
- [/sparc/i, :sparc ],
50
- [/mips/i, :mips ],
51
- [/powerpc/i, :powerpc ],
52
- [/universal/i,:x86_64 ],
53
- [nil, :unknown ],
54
- ].freeze
55
- end
56
-
57
- attr_reader :vm
58
- attr_reader :os
59
- attr_reader :impl
60
- attr_reader :arch
61
- attr_reader :hostname
62
- attr_reader :ipaddress_internal
63
- attr_reader :uptime
64
-
65
- attr_reader :paths
66
- attr_reader :tmpdir
67
- attr_reader :home
68
- attr_reader :shell
69
- attr_reader :user
70
- attr_reader :ruby
71
-
72
- attr_reader :attr_names
73
- alias :implementation :impl
74
- alias :architecture :arch
75
-
76
- def initialize
77
- @vm, @os, @impl, @arch = find_platform_info
78
- @hostname, @ipaddress_internal, @uptime = find_network_info
79
- @ruby = RUBY_VERSION.split('.').collect { |v| v.to_i }
80
- @user = ENV['USER']
81
- require 'Win32API' if @os == :windows && @vm == :ruby
82
- end
83
-
84
- # Returns [vm, os, impl, arch]
85
- def find_platform_info
86
- vm, os, impl, arch = :ruby, :unknown, :unknown, :unknow
87
- IMPLEMENTATIONS.each do |r, o, i|
88
- next unless RUBY_PLATFORM =~ r
89
- os, impl = [o, i]
90
- break
91
- end
92
- ARCHITECTURES.each do |r, a|
93
- next unless RUBY_PLATFORM =~ r
94
- arch = a
95
- break
96
- end
97
- os == :java ? guess_java : [vm, os, impl, arch]
98
- end
99
-
100
- # Returns [hostname, ipaddr (internal), uptime]
101
- def find_network_info
102
- hostname, ipaddr, uptime = :unknown, :unknown, :unknown
103
- begin
104
- hostname = find_hostname
105
- ipaddr = find_ipaddress_internal
106
- uptime = find_uptime
107
- rescue => ex # Be silent!
108
- end
109
- [hostname, ipaddr, uptime]
110
- end
111
-
112
- # Return the hostname for the local machine
113
- def find_hostname; Socket.gethostname; end
114
-
115
- # Returns the local uptime in hours. Use Win32API in Windows,
116
- # 'sysctl -b kern.boottime' os osx, and 'who -b' on unix.
117
- # Based on Ruby Quiz solutions by: Matthias Reitinger
118
- # On Windows, see also: net statistics server
119
- def find_uptime
120
- hours = 0
121
- begin
122
- seconds = execute_platform_specific("find_uptime") || 0
123
- hours = seconds / 3600 # seconds to hours
124
- rescue => ex
125
- #puts ex.message # TODO: implement debug?
126
- end
127
- hours
128
- end
129
-
130
-
131
- # Return the local IP address which receives external traffic
132
- # from: http://coderrr.wordpress.com/2008/05/28/get-your-local-ip-address/
133
- # NOTE: This <em>does not</em> open a connection to the IP address.
134
- def find_ipaddress_internal
135
- # turn off reverse DNS resolution temporarily
136
- orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true
137
- UDPSocket.open {|s| s.connect('65.74.177.129', 1); s.addr.last } # GitHub IP
138
- ensure
139
- Socket.do_not_reverse_lookup = orig
140
- end
141
-
142
- # Returns a Symbol of the short platform descriptor in the format: VM-OS
143
- # e.g. <tt>:java-unix</tt>
144
- def platform
145
- "#{@vm}-#{@os}".to_sym
146
- end
147
-
148
- # Returns a String of the full platform descriptor in the format: VM-OS-IMPL-ARCH
149
- # e.g. <tt>java-unix-osx-x86_64</tt>
150
- def to_s(*args)
151
- "#{@vm}-#{@os}-#{@impl}-#{@arch}".to_sym
152
- end
153
-
154
- # Returns the environment paths as an Array
155
- def paths; execute_platform_specific(:paths); end
156
- # Returns the path to the current user's home directory
157
- def home; execute_platform_specific(:home); end
158
- # Returns the name of the current shell
159
- def shell; execute_platform_specific(:shell); end
160
- # Returns the path to the current temp directory
161
- def tmpdir; execute_platform_specific(:tmpdir); end
162
-
163
- private
164
-
165
- # Look for and execute a platform specific method.
166
- # The name of the method will be in the format: +dtype-VM-OS-IMPL+.
167
- # e.g. find_uptime_ruby_unix_osx
168
- #
169
- def execute_platform_specific(dtype)
170
- criteria = [@vm, @os, @impl]
171
- while !criteria.empty?
172
- meth = [dtype, criteria].join('_').to_sym
173
- return self.send(meth) if SysInfo.private_method_defined?(meth)
174
- criteria.pop
175
- end
176
- raise "#{dtype}_#{@vm}_#{@os}_#{@impl} not implemented"
177
- end
178
-
179
- def paths_ruby_unix; (ENV['PATH'] || '').split(':'); end
180
- def paths_ruby_windows; (ENV['PATH'] || '').split(';'); end # Not tested!
181
- def paths_java
182
- delim = @impl == :windows ? ';' : ':'
183
- (ENV['PATH'] || '').split(delim)
184
- end
185
-
186
- def tmpdir_ruby_unix; (ENV['TMPDIR'] || '/tmp'); end
187
- def tmpdir_ruby_windows; (ENV['TMPDIR'] || 'C:\\temp'); end
188
- def tmpdir_java
189
- default = @impl == :windows ? 'C:\\temp' : '/tmp'
190
- (ENV['TMPDIR'] || default)
191
- end
192
-
193
- def shell_ruby_unix; (ENV['SHELL'] || 'bash').to_sym; end
194
- def shell_ruby_windows; :dos; end
195
- alias_method :shell_java_unix, :shell_ruby_unix
196
- alias_method :shell_java_windows, :shell_ruby_windows
197
-
198
- def home_ruby_unix; File.expand_path(ENV['HOME']); end
199
- def home_ruby_windows; File.expand_path(ENV['USERPROFILE']); end
200
- def home_java
201
- if @impl == :windows
202
- File.expand_path(ENV['USERPROFILE'])
203
- else
204
- File.expand_path(ENV['HOME'])
205
- end
206
- end
207
-
208
- # Ya, this is kinda wack. Ruby -> Java -> Kernel32. See:
209
- # http://www.oreillynet.com/ruby/blog/2008/01/jruby_meets_the_windows_api_1.html
210
- # http://msdn.microsoft.com/en-us/library/ms724408(VS.85).aspx
211
- # Ruby 1.9.1: Win32API is now deprecated in favor of using the DL library.
212
- def find_uptime_java_windows_windows
213
- kernel32 = com.sun.jna.NativeLibrary.getInstance('kernel32')
214
- buf = java.nio.ByteBuffer.allocate(256)
215
- (kernel32.getFunction('GetTickCount').invokeInt([256, buf].to_java).to_f / 1000).to_f
216
- end
217
- def find_uptime_ruby_windows_windows
218
- # Win32API is required in self.guess
219
- getTickCount = Win32API.new("kernel32", "GetTickCount", nil, 'L')
220
- ((getTickCount.call()).to_f / 1000).to_f
221
- end
222
- def find_uptime_ruby_unix_osx
223
- # This is faster than "who" and could work on BSD also.
224
- (Time.now.to_f - Time.at(`sysctl -b kern.boottime 2>/dev/null`.unpack('L').first).to_f).to_f
225
- end
226
-
227
- # This should work for most unix flavours.
228
- def find_uptime_ruby_unix
229
- # who is sloooooow. Use File.read('/proc/uptime')
230
- (Time.now.to_i - Time.parse(`who -b 2>/dev/null`).to_f)
231
- end
232
- alias_method :find_uptime_java_unix_osx, :find_uptime_ruby_unix
233
-
234
- # Determine the values for vm, os, impl, and arch when running on Java.
235
- def guess_java
236
- vm, os, impl, arch = :java, :unknown, :unknown, :unknown
237
- require 'java'
238
- include_class java.lang.System unless defined?(System)
239
-
240
- osname = System.getProperty("os.name")
241
- IMPLEMENTATIONS.each do |r, o, i|
242
- next unless osname =~ r
243
- os, impl = [o, i]
244
- break
245
- end
246
-
247
- osarch = System.getProperty("os.arch")
248
- ARCHITECTURES.each do |r, a|
249
- next unless osarch =~ r
250
- arch = a
251
- break
252
- end
253
- [vm, os, impl, arch]
254
- end
255
-
256
- # Returns the local IP address based on the hostname.
257
- # According to coderrr (see comments on blog link above), this implementation
258
- # doesn't guarantee that it will return the address for the interface external
259
- # traffic goes through. It's also possible the hostname isn't resolvable to the
260
- # local IP.
261
- #
262
- # NOTE: This code predates the current ip_address_internal. It was just as well
263
- # but the other code is cleaner. I'm keeping this old version here for now.
264
- def ip_address_internal_alt
265
- ipaddr = :unknown
266
- begin
267
- saddr = Socket.getaddrinfo( Socket.gethostname, nil, Socket::AF_UNSPEC, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME)
268
- ipaddr = saddr.select{|type| type[0] == 'AF_INET' }[0][3]
269
- rescue => ex
270
- end
271
- ipaddr
272
- end
273
- end
274
-
275
-
276
- if $0 == __FILE__
277
- puts SysInfo.new.to_yaml
278
- end
data/try/step1_try.rb DELETED
@@ -1,51 +0,0 @@
1
- require 'rubygems'
2
- require 'hexoid'
3
-
4
- POOP = 1
5
-
6
- # TEST 1: test matches result with expectation
7
- a = 1 + 1
8
- #=> 2
9
-
10
-
11
- ## TEST 2: comments, tests, and expectations can
12
- ## contain multiple lines
13
- a = 1
14
- b = 2
15
- a + b
16
- # => 3
17
- # => 2 + 1
18
-
19
- # TEST 3: test expectation type matters
20
- 'foo'.class
21
- #=> String
22
-
23
-
24
- # TEST 4: instance variables can be used in expectations
25
- @a = 1
26
- @a
27
- #=> @a
28
-
29
-
30
- # TEST 5: test ignores blank lines before expectations
31
- @a += 1
32
- 'foo'
33
-
34
-
35
- #=> 'foo'
36
-
37
-
38
- # TEST 6: test allows whiny expectation markers for textmate users *sigh*
39
- 'foo'
40
- # => 'foo'
41
-
42
-
43
- # TEST 7: test expectations can be commented out
44
- 'foo'
45
- ##=> 'this would fail'
46
-
47
- x = raise rescue 'foo'
48
- #=> 'foo'
49
-
50
-
51
-
data/try/step2_try.rb DELETED
@@ -1,59 +0,0 @@
1
- # run me with
2
- # ruby -rubygems -Ilib step1_tryouts.rb
3
-
4
-
5
- ## some addition
6
- a = 1
7
- b = 2
8
- a + b + 1
9
- # => 4
10
-
11
-
12
- # multiple expectations
13
- 'foo' + 'bar'
14
- #=> 'foobar'
15
- #=> :foobar.to_s
16
-
17
-
18
- # test ignores comments before expectations
19
- 'foo'
20
- # ignored comment
21
- # ignored comment
22
- #=> 'foo'
23
-
24
-
25
- ## test uses helper methods
26
- ## ( #foo is defined on top of file )
27
- #foo()
28
- ##=> foo
29
-
30
-
31
- #begin
32
- # raise
33
- #rescue
34
- # 'foo'
35
- #end
36
- ##=> 'foo'
37
-
38
- ## test handles multiple code lines
39
- ## only only tests last line against expectation
40
- #str = ""
41
- #str << 'foo'
42
- #str << 'bar'
43
- #str
44
- ##=> 'foobar'
45
- ##
46
- ### test failure
47
- ##'this fails'
48
- ###=> 'expectation not met'
49
- #
50
-
51
-
52
- #
53
- # require 'pathname'
54
- # require Pathname(__FILE__).dirname.parent + 'lib/nofw'
55
- #
56
- # # test failure
57
- # 'this fails'
58
- # #=> 'expectation not met'
59
- #
data/try/step3_try.rb DELETED
@@ -1,19 +0,0 @@
1
-
2
-
3
- begin
4
- raise
5
- rescue
6
- 'foo'
7
- end
8
- #=> 'foo'
9
-
10
- # test handles multiple code lines
11
- # only only tests last line against expectation
12
- str = ""
13
- str << 'foo'
14
- str << 'bar'
15
- str
16
- #=> 'foobar'
17
-
18
-
19
-
data/try/step4_try.rb DELETED
@@ -1,6 +0,0 @@
1
- require 'pathname'
2
- require Pathname(__FILE__).dirname.parent + 'lib/nofw'
3
-
4
-
5
- # The syntax could be a derivative from step 3 (helpers?)
6
-
data/tryouts.gemspec DELETED
@@ -1,53 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{tryouts}
8
- s.version = "2.1.0"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Delano Mandelbaum"]
12
- s.date = %q{2011-02-12}
13
- s.default_executable = %q{try}
14
- s.description = %q{Don't waste your time writing tests}
15
- s.email = %q{delano@solutious.com}
16
- s.executables = ["try"]
17
- s.extra_rdoc_files = [
18
- "LICENSE.txt",
19
- "README.rdoc"
20
- ]
21
- s.files = [
22
- ".gitignore",
23
- "CHANGES.txt",
24
- "LICENSE.txt",
25
- "README.rdoc",
26
- "Rakefile",
27
- "VERSION.yml",
28
- "bin/try",
29
- "lib/sysinfo.rb",
30
- "lib/tryouts.rb",
31
- "try/step1_try.rb",
32
- "try/step2_try.rb",
33
- "try/step3_try.rb",
34
- "try/step4_try.rb",
35
- "tryouts.gemspec"
36
- ]
37
- s.homepage = %q{http://github.com/delano/tryouts}
38
- s.rdoc_options = ["--charset=UTF-8"]
39
- s.require_paths = ["lib"]
40
- s.rubyforge_project = %q{tryouts}
41
- s.rubygems_version = %q{1.5.2}
42
- s.summary = %q{Don't waste your time writing tests}
43
-
44
- if s.respond_to? :specification_version then
45
- s.specification_version = 3
46
-
47
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
48
- else
49
- end
50
- else
51
- end
52
- end
53
-