cargo 0.0.1 → 0.0.2

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.
data/Rakefile CHANGED
@@ -1,5 +1,7 @@
1
+ require "cutest"
2
+
1
3
  task :test do
2
- system "cd test && ruby cargo_test.rb"
4
+ Cutest.run(Dir["test/*_test.rb"])
3
5
  end
4
6
 
5
7
  task :default => :test
data/cargo.gemspec CHANGED
@@ -1,10 +1,13 @@
1
+ require "./lib/cargo"
2
+
1
3
  Gem::Specification.new do |s|
2
4
  s.name = "cargo"
3
- s.version = "0.0.1"
5
+ s.version = Cargo::VERSION
4
6
  s.summary = "Require libraries without cluttering your namespace."
5
7
  s.description = "Cargo lets you use different versions of the same library by implementing two simple commands, which let you load programs without messing with your namespace."
6
8
  s.authors = ["Michel Martens", "Damian Janowski"]
7
9
  s.email = ["michel@soveran.com", "djanowski@dimaion.com"]
8
10
  s.homepage = "http://github.com/soveran/cargo"
9
- s.files = ["LICENSE", "README.markdown", "Rakefile", "lib/cargo.rb", "cargo.gemspec", "test/cargo_test.rb", "test/foo-1.0.0.rb", "test/foo-2.0.0.rb", "test/helper.rb"]
11
+ s.files = Dir[ "LICENSE", "README.markdown", "Rakefile", "lib/**/*.rb", "*.gemspec", "test/*.*" ]
12
+ s.add_development_dependency "cutest"
10
13
  end
data/lib/cargo.rb CHANGED
@@ -1,25 +1,21 @@
1
1
  module Cargo
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
 
4
- def self.import(file)
4
+ def import(file)
5
5
  unless file.match(/\.rb$/)
6
6
  file = "#{file}.rb"
7
7
  end
8
8
 
9
9
  load(file, true)
10
10
 
11
- @cargo
11
+ Thread.current[:cargo].tap do
12
+ Thread.current[:cargo] = nil
13
+ end
12
14
  end
13
15
 
14
- def self.export(cargo)
15
- @cargo = cargo
16
+ def export(cargo)
17
+ Thread.current[:cargo] = cargo
16
18
  end
17
19
  end
18
20
 
19
- def import(file)
20
- Cargo.import(file)
21
- end
22
-
23
- def export(cargo)
24
- Cargo.export(cargo)
25
- end
21
+ include Cargo
data/test/cargo_test.rb CHANGED
@@ -1,15 +1,14 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require File.join(File.dirname(__FILE__), "helper")
4
- require "ruby-debug"
3
+ require File.join(".", "lib", "cargo")
5
4
 
6
5
  setup do
7
6
  unless defined?(Foo1)
8
- Foo1 = import("foo-1.0.0")
7
+ Foo1 = import("test/foo-1.0.0")
9
8
  end
10
9
 
11
10
  unless defined?(Foo2)
12
- Foo2 = import("foo-2.0.0")
11
+ Foo2 = import("test/foo-2.0.0")
13
12
  end
14
13
  end
15
14
 
@@ -41,5 +40,3 @@ end
41
40
  test "Foo2 should be possible" do
42
41
  assert "Hello" == Foo2.new.bar
43
42
  end
44
-
45
- puts " ✔ All tests passed"
metadata CHANGED
@@ -1,35 +1,37 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: cargo
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 1
9
- version: 0.0.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Michel Martens
13
9
  - Damian Janowski
14
10
  autorequire:
15
11
  bindir: bin
16
12
  cert_chain: []
17
-
18
- date: 2010-07-26 00:00:00 -03:00
19
- default_executable:
20
- dependencies: []
21
-
22
- description: Cargo lets you use different versions of the same library by implementing two simple commands, which let you load programs without messing with your namespace.
23
- email:
13
+ date: 2012-01-22 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: cutest
17
+ requirement: &2156141560 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: *2156141560
26
+ description: Cargo lets you use different versions of the same library by implementing
27
+ two simple commands, which let you load programs without messing with your namespace.
28
+ email:
24
29
  - michel@soveran.com
25
30
  - djanowski@dimaion.com
26
31
  executables: []
27
-
28
32
  extensions: []
29
-
30
33
  extra_rdoc_files: []
31
-
32
- files:
34
+ files:
33
35
  - LICENSE
34
36
  - README.markdown
35
37
  - Rakefile
@@ -38,38 +40,28 @@ files:
38
40
  - test/cargo_test.rb
39
41
  - test/foo-1.0.0.rb
40
42
  - test/foo-2.0.0.rb
41
- - test/helper.rb
42
- has_rdoc: true
43
43
  homepage: http://github.com/soveran/cargo
44
44
  licenses: []
45
-
46
45
  post_install_message:
47
46
  rdoc_options: []
48
-
49
- require_paths:
47
+ require_paths:
50
48
  - lib
51
- required_ruby_version: !ruby/object:Gem::Requirement
49
+ required_ruby_version: !ruby/object:Gem::Requirement
52
50
  none: false
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- segments:
57
- - 0
58
- version: "0"
59
- required_rubygems_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
56
  none: false
61
- requirements:
62
- - - ">="
63
- - !ruby/object:Gem::Version
64
- segments:
65
- - 0
66
- version: "0"
57
+ requirements:
58
+ - - ! '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
67
61
  requirements: []
68
-
69
62
  rubyforge_project:
70
- rubygems_version: 1.3.7
63
+ rubygems_version: 1.8.10
71
64
  signing_key:
72
65
  specification_version: 3
73
66
  summary: Require libraries without cluttering your namespace.
74
67
  test_files: []
75
-
data/test/helper.rb DELETED
@@ -1,26 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- require File.join(File.dirname(__FILE__), "..", "lib", "cargo")
4
-
5
- AssertionFailed = Class.new(StandardError)
6
-
7
- def assert(value)
8
- return if value
9
-
10
- file, line = caller[0].split(":")
11
- code = File.readlines(file)[line.to_i - 1]
12
-
13
- puts " ✗ #{code.strip}"
14
- puts " #{file}:#{line}"
15
- exit(1)
16
- end
17
-
18
- def setup(&block)
19
- @_setup = block
20
- end
21
-
22
- def test(name = nil, &block)
23
- @_test = name
24
-
25
- block.call(@_setup.call)
26
- end