pry-test 0.5.4 → 0.5.5

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: b12439a96d3874b95e3d750fe082451989018de2
4
- data.tar.gz: d6eaff8ea882bd5b9366f65aaaf3625ce4fbdffd
3
+ metadata.gz: b74d2ed52a6c240c8fce9857115a28f19f12c192
4
+ data.tar.gz: 73d23a617531c4452414e150b595262f3ac0a2de
5
5
  SHA512:
6
- metadata.gz: d6613b1092703eab6088de402e5134b8f76e8f45f7e3b607fce7e91a04786cfa0b3e720a332d680d704cc7344746bc85ccdb17104786d2c05684e668376d71b7
7
- data.tar.gz: 3fc4ff9c8e6f42bcd57b8a58ca7cd5da2e8fe3d9a0417fa345f90dbbce6589c7061de780236139a315dd43f6acf2072cde493efa02d9a2dccc32943468dd20b4
6
+ metadata.gz: f0e904e78144a5a9efa74cb91ae3fba9c699fd6865efee22e7e8731015e064add2762525a792a43be1c2f45af9dc8f36d62a9eca190ecdbc3deb0a33ef801d42
7
+ data.tar.gz: ce72d5cd0e13d3b25674155a84c3136cc2bab9d9324610f4df563f99085e410bdb7e368f06f3508e919aa9082c4e610c0a1cf4f44e6d090b1d3efe709d93efd3
data/bin/pry-test CHANGED
@@ -1,11 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
- require "optparse"
3
- require_relative "../lib/pry-test"
4
-
5
- include PryTest::Color
6
2
 
7
- # setup the formatters list ---------------------------------------------------
8
- formatter_names = PryTest.formatters.map(&:short_name).sort
3
+ require "optparse"
9
4
 
10
5
  # setup the options -----------------------------------------------------------
11
6
  options = {}
@@ -18,7 +13,7 @@ parser = OptionParser.new do |opts|
18
13
  desc = "Runs the PryTest test suite and some additional demo tests."
19
14
  opts.on("--demo", desc) { |value| options[:demo] = value }
20
15
 
21
- desc = "The formatter to use. [#{formatter_names.join(", ")}]"
16
+ desc = "The formatter to use."
22
17
  opts.on("-f", "--formatter [FORMATTER]", desc) do |value|
23
18
  options[:formatter] = value
24
19
  end
@@ -43,42 +38,60 @@ parser.parse!
43
38
 
44
39
  ENV["PRY_TEST_DEMO"] = "true" if options[:demo]
45
40
 
46
- # setup the test path ---------------------------------------------------------
47
- path = ARGV.last unless ARGV.last =~ /^-/
48
- path = File.expand_path("../../test", __FILE__) if options[:demo]
49
- path ||= "test"
50
- path = File.join(Dir.pwd, path) unless path =~ /^\//
51
- unless File.exist?(path)
52
- puts "#{path} not found."
53
- puts "Please check the path and try again."
54
- exit 1
55
- end
56
- if path =~ /\.rb$/
57
- require path
58
- else
59
- Dir[File.join(path, "**/*.rb")].each { |path| require path }
60
- end
61
-
62
- # setup the formatter ---------------------------------------------------------
63
- formatter = PryTest.formatters.find { |f| f.short_name == options[:formatter] }
64
- formatter ||= begin
65
- if options[:async]
66
- PryTest.formatters.find { |f| f.short_name == "default_async" }
41
+ def require_tests(options)
42
+ path = ARGV.last unless ARGV.last =~ /^-/
43
+ path = File.expand_path("../../test", __FILE__) if options[:demo]
44
+ path ||= "test"
45
+ path = File.join(Dir.pwd, path) unless path =~ /^\//
46
+ unless File.exist?(path)
47
+ puts "#{path} not found."
48
+ puts "Please check the path and try again."
49
+ exit 1
50
+ end
51
+ if path =~ /\.rb$/
52
+ require path
67
53
  else
68
- PryTest.formatters.find { |f| f.short_name == "default" }
54
+ Dir[File.join(path, "**/*.rb")].each { |path| require path }
69
55
  end
70
56
  end
71
57
 
72
- # setup the test runner -------------------------------------------------------
73
- runner = PryTest::Runner.new(formatter.new, options)
58
+ def runner(options)
59
+ formatter = PryTest.formatters.find { |f| f.short_name == options[:formatter] }
60
+ formatter ||= begin
61
+ if options[:async]
62
+ PryTest.formatters.find { |f| f.short_name == "default_async" }
63
+ else
64
+ PryTest.formatters.find { |f| f.short_name == "default" }
65
+ end
66
+ end
67
+ PryTest::Runner.new(formatter.new, options)
68
+ end
74
69
 
75
70
  # setup pry -------------------------------------------------------------------
76
71
  options[:disable_pry] ||= options[:async] || RUBY_ENGINE == "jruby" || RUBY_ENGINE == "rbx"
77
72
 
78
73
  if options[:disable_pry]
74
+ if ENV["PRY_TEST_COVERAGE"]
75
+ require "simplecov"
76
+ require "coveralls"
77
+ SimpleCov.command_name "pry-test"
78
+ SimpleCov.formatter = Coveralls::SimpleCov::Formatter
79
+ SimpleCov.start do
80
+ add_filter "test/*.rb"
81
+ add_filter "bin"
82
+ end
83
+ end
84
+
85
+ require_relative "../lib/pry-test"
86
+ require_tests options
87
+ include PryTest::Color
79
88
  puts magenta("Disabling pry when running with: [#{RUBY_ENGINE}] #{options.inspect}")
80
- exit runner.run
89
+ exit runner(options).run
81
90
  else
91
+ require_relative "../lib/pry-test"
92
+ require_tests options
93
+ include PryTest::Color
94
+
82
95
  begin
83
96
  require "pry"
84
97
  require "pry-stack_explorer"
@@ -104,5 +117,5 @@ else
104
117
  puts
105
118
  end
106
119
 
107
- exit Pry.rescue { runner.run }
120
+ exit Pry.rescue { runner(options).run }
108
121
  end
data/ext/mkrf_conf.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  # based on instructions here:
2
2
  # http://en.wikibooks.org/wiki/Ruby_Programming/RubyGems#How_to_install_different_versions_of_gems_depending_on_which_version_of_ruby_the_installee_is_using
3
- require 'rubygems'
4
- require 'rubygems/command.rb'
5
- require 'rubygems/dependency_installer.rb'
3
+ require "rubygems"
4
+ require "rubygems/command.rb"
5
+ require "rubygems/dependency_installer.rb"
6
6
 
7
7
  begin
8
8
  Gem::Command.build_args = ARGV
@@ -12,22 +12,23 @@ end
12
12
  installer = Gem::DependencyInstaller.new
13
13
 
14
14
  begin
15
- if !(RUBY_ENGINE =~ /jruby/i)
16
- puts "Installing pry and pry-stack_explorer."
15
+ if RUBY_ENGINE =~ /jruby/i
16
+ puts "Engine is jruby... skip installation of pry gems."
17
+ else
18
+ puts "Installing pry gems..."
17
19
  installer.install "pry"
18
20
  installer.install "pry-stack_explorer"
19
21
  installer.install "pry-rescue"
20
- else
21
- puts "Platform is java... skip install for pry and pry-stack_explorer."
22
22
  end
23
23
  rescue Exception => e
24
24
  puts e.message
25
25
  puts e.backtrace.join("\n")
26
- exit(1)
26
+ exit 1
27
27
  end
28
28
 
29
- f = File.open(File.expand_path("../Rakefile", __FILE__), "w") # create dummy rakefile to indicate success
30
- f.write("task :default\n")
31
- f.close
29
+ # create dummy rakefile to indicate success
30
+ File.open(File.expand_path("../Rakefile", __FILE__), "w") do |file|
31
+ file.write("task :default\n")
32
+ end
32
33
 
33
- exit
34
+ exit 0
data/lib/pry-test.rb CHANGED
@@ -1,5 +1,2 @@
1
- path = File.expand_path("../pry-test/*.rb", __FILE__)
2
- Dir[path].each { |file| require file }
3
-
4
- path = File.expand_path("../pry-test/formatters/**/*.rb", __FILE__)
1
+ path = File.expand_path("../pry-test/**/*.rb", __FILE__)
5
2
  Dir[path].each { |file| require file }
@@ -1,3 +1,3 @@
1
1
  module PryTest
2
- VERSION = "0.5.4"
2
+ VERSION = "0.5.5"
3
3
  end
data/test/color_test.rb CHANGED
@@ -42,6 +42,11 @@ unless ENV["PRY_TEST_DEMO"]
42
42
  assert ColorTest::CRAYON.white("foo") == "\e[37mfoo\e[0m"
43
43
  end
44
44
 
45
+ test "gray" do
46
+ assert PryTest::Color.gray("foo") == "\e[90mfoo\e[0m"
47
+ assert ColorTest::CRAYON.gray("foo") == "\e[90mfoo\e[0m"
48
+ end
49
+
45
50
  end
46
51
 
47
52
  end
@@ -1,5 +1,5 @@
1
1
  if ENV["PRY_TEST_DEMO"]
2
- require_relative "test_helper"
2
+ require_relative "../test_helper"
3
3
 
4
4
  class TestCPULatency < PryTest::Test
5
5
 
@@ -28,3 +28,4 @@ if ENV["PRY_TEST_DEMO"]
28
28
 
29
29
  end
30
30
  end
31
+
@@ -1,5 +1,5 @@
1
1
  if ENV["PRY_TEST_DEMO"]
2
- require_relative "test_helper"
2
+ require_relative "../test_helper"
3
3
 
4
4
  class Fail < PryTest::Test
5
5
 
@@ -1,5 +1,5 @@
1
1
  if ENV["PRY_TEST_DEMO"]
2
- require_relative "test_helper"
2
+ require_relative "../test_helper"
3
3
 
4
4
  class TestIOLatency < PryTest::Test
5
5
 
data/test/test_helper.rb CHANGED
@@ -1,6 +1 @@
1
- if ENV["PRY_TEST_DEMO"] != "true"
2
- require "coveralls"
3
- Coveralls.wear!
4
- end
5
-
6
1
  require_relative "../lib/pry-test"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry-test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Hopkins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-19 00:00:00.000000000 Z
11
+ date: 2014-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: os
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: simplecov
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: coveralls
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -52,7 +66,7 @@ dependencies:
52
66
  - - ">="
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
55
- description: A testing framework that supports debugging test failures and errors
69
+ description: A small test framework that supports debugging test failures and errors
56
70
  when they happen.
57
71
  email:
58
72
  - natehop@gmail.com
@@ -81,9 +95,9 @@ files:
81
95
  - lib/pry-test/test_wrapper.rb
82
96
  - lib/pry-test/version.rb
83
97
  - test/color_test.rb
84
- - test/cpu_latency_test.rb
85
- - test/fail_test.rb
86
- - test/io_latency_test.rb
98
+ - test/demos/cpu_latency_test.rb
99
+ - test/demos/fail_test.rb
100
+ - test/demos/io_latency_test.rb
87
101
  - test/runner_test.rb
88
102
  - test/test_helper.rb
89
103
  - test/test_test.rb
@@ -111,14 +125,15 @@ rubyforge_project:
111
125
  rubygems_version: 2.2.2
112
126
  signing_key:
113
127
  specification_version: 4
114
- summary: A testing framework that supports debugging test failures and errors when
128
+ summary: A small test framework that supports debugging test failures and errors when
115
129
  they happen.
116
130
  test_files:
117
131
  - test/color_test.rb
118
- - test/cpu_latency_test.rb
119
- - test/fail_test.rb
120
- - test/io_latency_test.rb
132
+ - test/demos/cpu_latency_test.rb
133
+ - test/demos/fail_test.rb
134
+ - test/demos/io_latency_test.rb
121
135
  - test/runner_test.rb
122
136
  - test/test_helper.rb
123
137
  - test/test_test.rb
124
138
  - test/test_wrapper_test.rb
139
+ has_rdoc: