Narnach-simple_gate 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -50,6 +50,11 @@ connection.
50
50
 
51
51
  == Recent changes
52
52
 
53
+ === Version 0.5.4
54
+
55
+ * Fixed gemspec: add missing spec files and added missing gem dependencies
56
+ * Updated Rakefile with ruby 1.9 workaround and a missing file spotter
57
+
53
58
  === Version 0.5.3
54
59
 
55
60
  * Added yardoc documentation to all classes.
data/Rakefile CHANGED
@@ -9,21 +9,41 @@ require 'rubygems'
9
9
 
10
10
  begin
11
11
  # Parse gemspec using the github safety level.
12
- data = File.read('simple_gate.gemspec')
12
+ file = Dir['*.gemspec'].first
13
+ data = File.read(file)
13
14
  spec = nil
14
- Thread.new { spec = eval("$SAFE = 3
15
- %s" % data)}.join
15
+ # FIXME: Lowered SAFE from 3 to 2 to work with Ruby 1.9 due to rubygems
16
+ # performing a require internally
17
+ Thread.new { spec = eval("$SAFE = 2\n%s" % data)}.join
16
18
 
17
19
  # Create the gem tasks
18
20
  Rake::GemPackageTask.new(spec) do |package|
19
21
  package.gem_spec = spec
20
22
  end
21
23
  rescue Exception => e
22
- printf "WARNING: Error caught (%s): %s
23
- ", e.class.name, e.message
24
+ printf "WARNING: Error caught (%s): %s\n%s", e.class.name, e.message, e.backtrace[0...5].map {|l| ' %s' % l}.join("\n")
24
25
  end
25
26
 
26
27
  desc 'Package and install the gem for the current version'
27
28
  task :install => :gem do
28
29
  system "sudo gem install -l pkg/%s-%s.gem" % [spec.name, spec.version]
29
30
  end
31
+
32
+ desc 'Show files missing from gemspec'
33
+ task :diff do
34
+ files = %w[
35
+ Rakefile
36
+ *README*
37
+ *LICENSE*
38
+ *.gemspec
39
+ bin/*
40
+ lib/**/*
41
+ spec/**/*
42
+ ].map {|pattern| Dir.glob(pattern)}.flatten.select{|f| File.file?(f)}
43
+ missing_files = files - spec.files
44
+ extra_files = spec.files - files
45
+ puts "File missing from the gemspec:"
46
+ puts missing_files.join(" ")
47
+ puts "Extra files not (yet) in the gemspec:"
48
+ puts extra_files.join(" ")
49
+ end
data/simple_gate.gemspec CHANGED
@@ -3,8 +3,8 @@ Gem::Specification.new do |s|
3
3
  s.name = 'simple_gate'
4
4
  s.summary = "SimpleGate makes it possible to use net/ssh/gateway's capabilities in a simple to use way."
5
5
  s.description = s.summary
6
- s.version = '0.5.3'
7
- s.date = '2009-05-16'
6
+ s.version = '0.5.4'
7
+ s.date = '2009-06-11'
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Wes Oldenbeuving"]
10
10
  s.email = "narnach@gmail.com"
@@ -17,12 +17,13 @@ Gem::Specification.new do |s|
17
17
  simple_gate/server_definition
18
18
  simple_gate/router]
19
19
  test_files = %w[]
20
- spec_files = %w[simple_gate]
20
+ spec_files = %w[simple_gate simple_gate/router]
21
+ other_files = %w[spec/spec_helper.rb]
21
22
  s.bindir = "bin"
22
23
  s.require_path = "lib"
23
24
  s.executables = bin_files
24
25
  s.test_files = test_files.map {|f| 'test/%s_test.rb' % f} + spec_files.map {|f| 'spec/%s_spec.rb' % f}
25
- s.files = root_files + bin_files.map {|f| 'bin/%s' % f} + lib_files.map {|f| 'lib/%s.rb' % f} + s.test_files
26
+ s.files = root_files + bin_files.map {|f| 'bin/%s' % f} + lib_files.map {|f| 'lib/%s.rb' % f} + s.test_files + other_files
26
27
 
27
28
  # rdoc
28
29
  s.has_rdoc = true
@@ -31,4 +32,7 @@ Gem::Specification.new do |s|
31
32
 
32
33
  # Requirements
33
34
  s.required_ruby_version = ">= 1.8.0"
35
+ s.add_dependency 'net-ssh', ">= 2.0.0"
36
+ s.add_dependency 'net-ssh-gateway', ">= 1.0.0"
37
+ s.add_dependency 'activesupport', ">= 2.2.0"
34
38
  end
@@ -0,0 +1,53 @@
1
+ require File.join(File.dirname(__FILE__), '..', 'spec_helper')
2
+ require 'simple_gate/router'
3
+
4
+ describe Router do
5
+ describe "#find" do
6
+ it "should find a direct path from start to target" do
7
+ router = Router.new({
8
+ 'start' => %w[target]
9
+ })
10
+ router.find('start','target').should == %w[start target]
11
+ end
12
+
13
+ it "should find a path from start to target through an intermediate node" do
14
+ router = Router.new({
15
+ 'start' => %w[node],
16
+ 'node' => %w[target],
17
+ })
18
+ router.find('start','target').should == %w[start node target]
19
+ end
20
+
21
+ it "should find the shortest path from start to target" do
22
+ router = Router.new({
23
+ 'start' => %w[node node2 node3],
24
+ 'node' => %w[node2],
25
+ 'node2' => %w[node3],
26
+ 'node3' => %w[target]
27
+ })
28
+ router.find('start','target').should == %w[start node3 target]
29
+ end
30
+
31
+ it 'should return nil if no route could be found' do
32
+ router = Router.new({
33
+ 'start' => %w[],
34
+ })
35
+ router.find('start','target').should be_nil
36
+ end
37
+
38
+ it 'should return nil if the starting point can not be found' do
39
+ router = Router.new({})
40
+ router.find('start','target').should be_nil
41
+ end
42
+
43
+ it 'should not cause a stack overflow in a cyclical route graph' do
44
+ router = Router.new({
45
+ 'start' => %w[node],
46
+ 'node' => %w[node target],
47
+ })
48
+ lambda {
49
+ router.find('start','target').should == %w[start node target]
50
+ }.should_not raise_error(SystemStackError)
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,2 @@
1
+ lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(lib_dir)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Narnach-simple_gate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wes Oldenbeuving
@@ -9,10 +9,39 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-16 00:00:00 -07:00
12
+ date: 2009-06-11 00:00:00 -07:00
13
13
  default_executable:
14
- dependencies: []
15
-
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: net-ssh
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.0.0
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: net-ssh-gateway
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.0
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: activesupport
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 2.2.0
44
+ version:
16
45
  description: SimpleGate makes it possible to use net/ssh/gateway's capabilities in a simple to use way.
17
46
  email: narnach@gmail.com
18
47
  executables:
@@ -34,6 +63,8 @@ files:
34
63
  - lib/simple_gate/server_definition.rb
35
64
  - lib/simple_gate/router.rb
36
65
  - spec/simple_gate_spec.rb
66
+ - spec/simple_gate/router_spec.rb
67
+ - spec/spec_helper.rb
37
68
  has_rdoc: true
38
69
  homepage: http://www.github.com/Narnach/simple_gate
39
70
  post_install_message:
@@ -65,3 +96,4 @@ specification_version: 2
65
96
  summary: SimpleGate makes it possible to use net/ssh/gateway's capabilities in a simple to use way.
66
97
  test_files:
67
98
  - spec/simple_gate_spec.rb
99
+ - spec/simple_gate/router_spec.rb