runssh 0.1.0
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/README.rdoc +45 -0
- data/Rakefile +64 -0
- data/bin/runssh +31 -0
- data/bin/runssh_comp.sh +24 -0
- data/gpl-2.0.txt +339 -0
- data/lib/runsshlib/cli.rb +287 -0
- data/lib/runsshlib/config_file.rb +167 -0
- data/lib/runsshlib/ssh_backend.rb +36 -0
- data/lib/runsshlib.rb +44 -0
- data/spec/fixtures/runssh.yml +19 -0
- data/spec/runsshlib/cli_spec.rb +334 -0
- data/spec/runsshlib/config_file_spec.rb +275 -0
- data/spec/runsshlib/ssh_backend_spec.rb +68 -0
- data/spec/spec_helper.rb +85 -0
- metadata +133 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2010 Haim Ashkenazi
|
3
|
+
#
|
4
|
+
# This program is free software; you can redistribute it and/or
|
5
|
+
# modify it under the terms of the GNU General Public License
|
6
|
+
# as published by the Free Software Foundation; either version 2
|
7
|
+
# of the License, or (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program; if not, write to the Free Software
|
16
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
17
|
+
#
|
18
|
+
require 'rspec'
|
19
|
+
require 'tmpdir'
|
20
|
+
|
21
|
+
# got the idea from:
|
22
|
+
# http://stackoverflow.com/questions/1480537/how-can-i-validate-exits-and-aborts-in-rspec
|
23
|
+
module ExitCodeMatchers
|
24
|
+
RSpec::Matchers.define :exit_normaly do
|
25
|
+
actual = nil
|
26
|
+
match do |block|
|
27
|
+
begin
|
28
|
+
block.call
|
29
|
+
rescue SystemExit => e
|
30
|
+
actual = e.status
|
31
|
+
end
|
32
|
+
actual and actual == 0
|
33
|
+
end
|
34
|
+
failure_message_for_should do |block|
|
35
|
+
"expected block to exit with code 0 but" +
|
36
|
+
(actual.nil? ? " exit was not called" : " exited with #{actual}")
|
37
|
+
end
|
38
|
+
failure_message_for_should_not do |block|
|
39
|
+
"expected code not to exit with code 0 but it did"
|
40
|
+
end
|
41
|
+
description do
|
42
|
+
"expect block to exit with code 0"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
RSpec::Matchers.define :exit_abnormaly do
|
47
|
+
actual = nil
|
48
|
+
match do |block|
|
49
|
+
begin
|
50
|
+
block.call
|
51
|
+
rescue SystemExit => e
|
52
|
+
actual = e.status
|
53
|
+
end
|
54
|
+
actual and actual != 0
|
55
|
+
end
|
56
|
+
failure_message_for_should do |block|
|
57
|
+
"expected block to exit with code other then 0 but" +
|
58
|
+
(actual.nil? ? " exit was not called" : " exited with #{actual}")
|
59
|
+
end
|
60
|
+
failure_message_for_should_not do |block|
|
61
|
+
"expected code not to exit with code different then 0 but it did"
|
62
|
+
end
|
63
|
+
description do
|
64
|
+
"expect block to exit with code different then 0"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
Rspec.configure do |c|
|
70
|
+
c.mock_with :rspec
|
71
|
+
end
|
72
|
+
|
73
|
+
TMP_FILE = File.join(Dir.tmpdir, 'tempfile')
|
74
|
+
|
75
|
+
def cleanup_tmp_file
|
76
|
+
File.delete TMP_FILE if File.exists? TMP_FILE
|
77
|
+
bf = TMP_FILE + '.bak'
|
78
|
+
File.delete bf if File.exists? bf
|
79
|
+
end
|
80
|
+
|
81
|
+
def import_fixtures
|
82
|
+
yml = File.join(File.dirname(__FILE__), 'fixtures', 'runssh.yml')
|
83
|
+
c = RunSSHLib::ConfigFile.new(TMP_FILE)
|
84
|
+
c.import(yml)
|
85
|
+
end
|
metadata
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: runssh
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Haim Ashkenazi
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-10-27 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: trollop
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 83
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 16
|
33
|
+
- 2
|
34
|
+
version: 1.16.2
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rspec
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 13
|
46
|
+
segments:
|
47
|
+
- 2
|
48
|
+
- 0
|
49
|
+
- 1
|
50
|
+
version: 2.0.1
|
51
|
+
type: :development
|
52
|
+
version_requirements: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: rcov
|
55
|
+
prerelease: false
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
hash: 41
|
62
|
+
segments:
|
63
|
+
- 0
|
64
|
+
- 9
|
65
|
+
- 9
|
66
|
+
version: 0.9.9
|
67
|
+
type: :development
|
68
|
+
version_requirements: *id003
|
69
|
+
description: |
|
70
|
+
Runssh is a command line utility to help bookmark many
|
71
|
+
ssh connections in heirarchial groups.
|
72
|
+
|
73
|
+
email: haim@babysnakes.org
|
74
|
+
executables:
|
75
|
+
- runssh
|
76
|
+
extensions: []
|
77
|
+
|
78
|
+
extra_rdoc_files:
|
79
|
+
- README.rdoc
|
80
|
+
files:
|
81
|
+
- README.rdoc
|
82
|
+
- gpl-2.0.txt
|
83
|
+
- Rakefile
|
84
|
+
- lib/runsshlib/cli.rb
|
85
|
+
- lib/runsshlib/config_file.rb
|
86
|
+
- lib/runsshlib/ssh_backend.rb
|
87
|
+
- lib/runsshlib.rb
|
88
|
+
- bin/runssh
|
89
|
+
- bin/runssh_comp.sh
|
90
|
+
- spec/fixtures/runssh.yml
|
91
|
+
- spec/runsshlib/cli_spec.rb
|
92
|
+
- spec/runsshlib/config_file_spec.rb
|
93
|
+
- spec/runsshlib/ssh_backend_spec.rb
|
94
|
+
- spec/spec_helper.rb
|
95
|
+
has_rdoc: true
|
96
|
+
homepage: http://github.com/babysnakes/runssh
|
97
|
+
licenses: []
|
98
|
+
|
99
|
+
post_install_message:
|
100
|
+
rdoc_options:
|
101
|
+
- --main
|
102
|
+
- README.rdoc
|
103
|
+
require_paths:
|
104
|
+
- lib
|
105
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
hash: 57
|
111
|
+
segments:
|
112
|
+
- 1
|
113
|
+
- 8
|
114
|
+
- 7
|
115
|
+
version: 1.8.7
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
+
none: false
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
hash: 3
|
122
|
+
segments:
|
123
|
+
- 0
|
124
|
+
version: "0"
|
125
|
+
requirements: []
|
126
|
+
|
127
|
+
rubyforge_project:
|
128
|
+
rubygems_version: 1.3.7
|
129
|
+
signing_key:
|
130
|
+
specification_version: 3
|
131
|
+
summary: CLI utility to bookmark multiple ssh connections with hierarchy.
|
132
|
+
test_files: []
|
133
|
+
|