tbm 0.2.0.rc1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +15 -12
  2. data/lib/TBM/meta.rb +3 -3
  3. data/spec/config_spec.rb +4 -127
  4. metadata +6 -6
data/README.md CHANGED
@@ -26,20 +26,23 @@ You configure the tunnel boring machine by creating a configuration file in YAML
26
26
 
27
27
  An example configuration file follows:
28
28
 
29
- jira:
30
- host: ssh.example.com
31
- forward: 8080
32
- teamcity:
33
- host: ssh.example.com
34
- forward: 8111
29
+ dev.example.com:
30
+ jira: 2222
31
+ teamcity:
32
+ tunnel: 8888
35
33
  alias: tc
36
- jdbc-as400:
37
- host: ssh.example.com
38
- forward:
39
- greenmachine: [ 449, 8470, 8471, 8476 ]
40
- alias: [ ja, j400 ]
34
+ jdbc-as400:
35
+ as400: [ 449, 8470, 8471, 8476 ]
36
+ alias: [ ju, ussi ]
37
+ qa:
38
+ forward: 8080
39
+ staging:
40
+ alias: [ stage, st ]
41
+ tunnel: 8080:80
42
+ 5250: 8023:as400:23
43
+ webfacing: as400:10905
41
44
 
42
- This configuration file is still evolving -- I expect the format to continue to change, the above simply represents the current state.
45
+ Although the above configuration format is still subject to flux, I feel like it's starting to stabilize, so I'm going to need to document it more thoroughly. For the time being, you might want to look at the [closed issue](https://github.com/geoffreywiseman/tunnel-boring-machine/issues/38) regarding the format change.
43
46
 
44
47
  ## License ##
45
48
  I've put it under the UNLICENSE. Basically, I don't care if you use it, bundle it inside commercial software, or otherwise make use of it, and I don't offer any kind of warranty or support guarantees, nor do I guarantee that any of the projects dependencies are suited for whatever purpose you have in mind. That's all up to you. That said, if you want to talk about it, see the next section.
@@ -1,6 +1,6 @@
1
1
  # The namespace for this application/gem.
2
2
  module TBM
3
3
  APP_NAME = "Tunnel Boring Machine"
4
- VERSION = "0.2.0.rc1"
5
- RELEASE_DATE = '2012-12-30'
6
- end
4
+ VERSION = "0.2.0"
5
+ RELEASE_DATE = '2013-01-22'
6
+ end
@@ -73,7 +73,7 @@ describe ConfigParser do
73
73
  context "keyed by a non-String" do
74
74
  let(:gateway) { Array.new }
75
75
  let(:targets) { Hash.new }
76
- specify { subject.errors.should include( "Cannot parse gateway name: [] (Array)" ) }
76
+ specify { subject.errors.should include_match( /Cannot parse gateway name/ ) }
77
77
  end
78
78
 
79
79
  context "with target hash of tunnels" do
@@ -191,130 +191,6 @@ describe ConfigParser do
191
191
 
192
192
  end
193
193
 
194
- # target-details is a string (connection), array (array of connection) or hash (target-hash)
195
- # connection is an integer or string, matching any of: <port> or <localport>:<remoteport> or <localport>:host:<remoteport>
196
- # target-hash contains: alias, forward, remote-host
197
- # alias is string or array of strings containing aliases for the tunnel name.
198
- # forward contains a connection or array of connections
199
- # remote-host maps to a remote connection or array of remote connections
200
- # remote connection is an integer or a string in the following formats: <port>, <local-port>:<remote-port>
201
-
202
- # context "and no forward" do
203
- # it { should_not be_valid }
204
- # specify { subject.errors.should include_match(/no forward/) }
205
- # end
206
-
207
- # context "and a forward" do
208
- # let(:target) { { 'host' => 'host', 'username' => 'username', 'forward' => forward } }
209
- # let(:targetmock) { double(Tunnel::Target) }
210
-
211
- # before do
212
- # Tunnel::Target.stub(:new) { targetmock }
213
- # targetmock.stub( :host ) { 'host' }
214
- # end
215
-
216
- # context "of 8080" do
217
- # let(:forward) { 8080 }
218
- # it "should forward port 8080 on localhost" do
219
- # targetmock.should_receive( :forward_port ).with( 8080, nil )
220
- # subject.should be_valid
221
- # end
222
- # end
223
-
224
- # context "of [ 8000, 8443 ]" do
225
- # let(:forward) { [8000,8443] }
226
- # it "should forward ports 8080 and 8443" do
227
- # targetmock.should_receive( :forward_port ).with( 8000, nil )
228
- # targetmock.should_receive( :forward_port ).with( 8443, nil )
229
- # subject.should be_valid
230
- # end
231
- # end
232
-
233
- # context "of { alpha => 3000, beta => [ 8080, 8443 ] } ]" do
234
- # let(:forward) { { 'alpha' => 3000, 'beta' => [ 8080, 8443 ] } }
235
- # it "should forward port 3000 to alpha" do
236
- # targetmock.should_receive( :forward_port ).with( 3000, 'alpha' )
237
- # targetmock.stub( :forward_port ).with( anything(), 'beta' )
238
- # subject.should be_valid
239
- # end
240
- # it "should forward ports 8080, 8443 to alpha" do
241
- # targetmock.should_receive( :forward_port ).with( 8080, 'beta' )
242
- # targetmock.should_receive( :forward_port ).with( 8443, 'beta' )
243
- # targetmock.stub( :forward_port ).with( anything(), 'alpha' )
244
- # subject.should be_valid
245
- # end
246
- # end
247
-
248
- # context "of 8000.5" do
249
- # let(:forward) { 8000.5 }
250
- # it { should_not be_valid }
251
- # specify { subject.errors.should include_match(/Not sure how to handle forward .*: Float/) }
252
- # end
253
-
254
- # context "of -8080" do
255
- # let(:forward) { -8080 }
256
- # it { should_not be_valid }
257
- # specify { subject.errors.should include_match(/Invalid port/) }
258
- # end
259
-
260
- # context "of 'blueberry'" do
261
- # let(:forward) { 'blueberry' }
262
- # it { should_not be_valid }
263
- # specify { subject.errors.should include_match(/Not sure how to handle forward .*: String/) }
264
- # end
265
-
266
- # context "of 'blueberry'" do
267
- # let(:forward) { [ 80.80, -443, 'blueberry' ] }
268
- # it { should_not be_valid }
269
- # specify { subject.errors.should include_match(/Invalid port/) }
270
- # end
271
-
272
- # end
273
-
274
- # context "and an alias" do
275
- # let(:target) { { 'host' => 'host', 'username' => 'username', 'forward' => 8080 } }
276
- # let(:targetmock) { double(Tunnel::Target) }
277
-
278
- # before do
279
- # Tunnel::Target.stub(:new) { targetmock }
280
- # targetmock.stub(:forward_port)
281
- # end
282
-
283
- # it "should treat string as single alias" do
284
- # target['alias']= 'mr-smith'
285
- # targetmock.should_receive( :alias ).with( 'mr-smith' )
286
- # subject.should be_valid
287
- # end
288
-
289
- # it "should treat an array as a series of aliases" do
290
- # target['alias']= 'mr-smith'
291
- # targetmock.should_receive( :alias ).with( 'mr-smith' )
292
- # subject.should be_valid
293
- # end
294
-
295
- # it "should warn with any other content" do
296
- # target['alias'] = Hash.new
297
- # subject.should_not be_valid
298
- # subject.errors.should include_match( /Cannot parse alias/ )
299
- # end
300
- # end
301
- # end
302
-
303
- # end
304
-
305
- # context "containing a hash of five targets" do
306
- # let(:config) { { 'alpha' => { 'host' => 'host', 'forward' => 3001 }, 'beta' => { 'host' => 'host', 'forward' => 3002 }, 'gamma' => { 'host' => 'host', 'forward' => 3003 }, 'delta' => { 'host' => 'host', 'forward' => 3004 },
307
- # 'omega' => { 'host' => 'host', 'forward' => 3005 } } }
308
- # it "should return all five targets specified" do
309
- # subject.should be_valid
310
- # subject.get_target( 'alpha' ).should be_instance_of(Tunnel::Target)
311
- # subject.get_target( 'beta' ).should be_instance_of(Tunnel::Target)
312
- # subject.get_target( 'gamma' ).should be_instance_of(Tunnel::Target)
313
- # subject.get_target( 'delta' ).should be_instance_of(Tunnel::Target)
314
- # subject.get_target( 'omega' ).should be_instance_of(Tunnel::Target)
315
- # end
316
- # end
317
-
318
194
  end
319
195
  end
320
196
 
@@ -336,9 +212,10 @@ end
336
212
  RSpec::Matchers.define :have_tunnels do |expected|
337
213
  match do |actual|
338
214
  actual.should_not be_nil
339
- actual.tunnels.size.should eql(expected.size)
215
+ tunnels = actual.tunnels.sort_by { |t| t.port }
216
+ tunnels.size.should eql(expected.size)
340
217
  (0...expected.size).each do |index|
341
- tunnel = actual.tunnels[index]
218
+ tunnel = tunnels[index]
342
219
  properties = expected[index]
343
220
  properties.each do |k,v|
344
221
  tunnel.send(k).should eql(v)
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tbm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.rc1
5
- prerelease: 6
4
+ version: 0.2.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Geoffrey Wiseman
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-30 00:00:00.000000000 Z
12
+ date: 2013-01-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: net-ssh
@@ -66,13 +66,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
66
66
  version: '0'
67
67
  segments:
68
68
  - 0
69
- hash: -3696541644893645018
69
+ hash: -1799474746480285819
70
70
  required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  none: false
72
72
  requirements:
73
- - - ! '>'
73
+ - - ! '>='
74
74
  - !ruby/object:Gem::Version
75
- version: 1.3.1
75
+ version: '0'
76
76
  requirements: []
77
77
  rubyforge_project:
78
78
  rubygems_version: 1.8.24