the_force 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ exclude_file_globs = []
7
7
 
8
8
  spec = Gem::Specification.new do |s|
9
9
  s.name = "the_force"
10
- s.version = '0.3.2'
10
+ s.version = '0.3.3'
11
11
  s.author = "Ryan Ziegler"
12
12
  s.email = "info@symbolforce.com"
13
13
  s.homepage = "http://www.symbolforce.com"
@@ -1,12 +1,16 @@
1
- module TheForce; end
1
+ require 'the_force/ruby_version'
2
2
 
3
3
  begin
4
- require 'system_timer'
4
+ require 'system_timer' if TheForce.ruby_version.is18?
5
+ rescue LoadError => e
6
+ puts "WARNING - SystemTimer gem not found...reverting to Timeout::timeout"
7
+ end
8
+
9
+ if defined? SystemTimer and TheForce.ruby_version.is18?
5
10
  def TheForce.timeout(*args, &b)
6
11
  SystemTimer.timeout_after(*args, &b)
7
12
  end
8
- rescue LoadError => e
9
- puts "WARNING - SystemTimer gem not found...reverting to Timeout::timeout"
13
+ else
10
14
  require 'timeout'
11
15
  def TheForce.timeout(*args, &b)
12
16
  Timeout.timeout(*args, &b)
@@ -14,6 +14,10 @@ module TheForce
14
14
  [major, minor] == [1,9]
15
15
  end
16
16
 
17
+ def v.is18?
18
+ [major, minor] == [1,8]
19
+ end
20
+
17
21
  v.freeze
18
22
  end
19
23
  end
data/lib/the_force.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  ROOT = File.join(File.dirname(__FILE__), 'the_force')
2
+ require File.join(ROOT, 'ruby_version')
2
3
  require File.join(ROOT, 'keep_trying')
3
4
  require File.join(ROOT, 'thread_pool')
4
5
  require File.join(ROOT, 'timer')
@@ -44,6 +44,10 @@ class TestKeepTrying < Test::Unit::TestCase
44
44
 
45
45
  #def test_works_without_systemtimer
46
46
  #def test_works_with_systemtimer
47
+
48
+ def test_systemtimer_is_not_loaded_in_19
49
+ assert false, "PENDING"
50
+ end
47
51
  end
48
52
 
49
53
  class TestKeepTryingSpecialError < StandardError
@@ -1,5 +1,5 @@
1
1
  require 'the_force/rails_support'
2
- require 'rails'
2
+ #require 'rails'
3
3
 
4
4
  class TestRailsSupport < Test::Unit::TestCase
5
5
  def test_collect_column
@@ -27,6 +27,10 @@ class TestRubyVersion < Test::Unit::TestCase
27
27
  def test_is19?
28
28
  assert_equal [@v.major, @v.minor] == [1,9], @v.is19?
29
29
  end
30
+
31
+ def test_is18?
32
+ assert_equal [@v.major, @v.minor] == [1,8], @v.is18?
33
+ end
30
34
 
31
35
  def test_is_frozen
32
36
  assert @v.frozen?
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 2
9
- version: 0.3.2
8
+ - 3
9
+ version: 0.3.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ryan Ziegler