flipflops 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.
- checksums.yaml +15 -0
- data/lib/flipflops.rb +81 -0
- metadata +43 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NjNiMmU1YjBiMmU5Y2FkZTNjMjEwY2QzOTNkMzA3NDk3ODFiNTNiZg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MjBhMjNjY2U5NTI4MTI0NmZkNzY4YjdlZDNmZjY1YTM5MjJlMjk1Ng==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MTA4OTY1N2E2N2M3ZDU1NmM4NDViNGQwYmEzZGFhODUwOTRjOWFmYWNkMzQ2
|
10
|
+
MjhjYzY3YWE2YTc1MDhhNWM5YTc4M2M0MTYxOThhNGY0OWVkMzIxNGFjNDA2
|
11
|
+
ZDVlYTk4YzI3ZmM0ZGI0YjU0MGVmY2FkNmViMTc3MDVkZGU5ZTY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NDYwZjYyZGVkYmEzNDExY2ZiODRiZmMxOWY2ZjlmNDkzZjAxNDVkNjExNmYz
|
14
|
+
NzU3ZGI4MTA1ZjcwZjg3ZGI3ZTNiMzdlNGNmYzEwOTQxNDUxODk4NmViNmMx
|
15
|
+
YjBhYjUyODQ2Y2ExZmI2MjQwYWEwYzAzNTllNDk0ZWI0MzA3NDM=
|
data/lib/flipflops.rb
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'net/ssh'
|
2
|
+
|
3
|
+
class FlipFlops
|
4
|
+
|
5
|
+
@loggedin = false
|
6
|
+
|
7
|
+
def set_repo(repo)
|
8
|
+
@repo = repo
|
9
|
+
self
|
10
|
+
end
|
11
|
+
|
12
|
+
def login(host, username, password, port = 22)
|
13
|
+
puts "=== Logging in to " + host + " ==="
|
14
|
+
begin
|
15
|
+
@ssh = Net::SSH.start(host, username, {:password => password, :port => port})
|
16
|
+
@loggedin = true
|
17
|
+
rescue Timeout::Error
|
18
|
+
puts "Slippers.login: Connection timed out."
|
19
|
+
rescue Errno::EHOSTUNREACH
|
20
|
+
puts "Slippers.login: Host unreachable."
|
21
|
+
rescue Errno::ECONNREFUSED
|
22
|
+
puts "Slippers.login: Host refused connection."
|
23
|
+
rescue Net::SSH::AuthenticationFailed
|
24
|
+
puts "Slippers.login: Authentication failed. Check your username/password combination."
|
25
|
+
end
|
26
|
+
self
|
27
|
+
end
|
28
|
+
|
29
|
+
def set_path(path)
|
30
|
+
puts "=== Changing directory to " + path + " ==="
|
31
|
+
if @loggedin
|
32
|
+
output = @ssh.exec!("cd " + path)
|
33
|
+
puts output
|
34
|
+
else
|
35
|
+
puts "Slippers.set_path: No establised SSH connection found."
|
36
|
+
end
|
37
|
+
self
|
38
|
+
end
|
39
|
+
|
40
|
+
def update_repo
|
41
|
+
puts "=== Updating the repo " + @repo + " ==="
|
42
|
+
if @loggedin
|
43
|
+
output = @ssh.exec!("git pull " + @repo)
|
44
|
+
puts output
|
45
|
+
else
|
46
|
+
puts "Slippers.update_repo: No establised SSH connection found."
|
47
|
+
end
|
48
|
+
self
|
49
|
+
end
|
50
|
+
|
51
|
+
def clone_repo
|
52
|
+
puts "=== Cloning the repo " + @repo + " ==="
|
53
|
+
if @loggedin
|
54
|
+
output = @ssh.exec!("git clone " + @repo)
|
55
|
+
puts output
|
56
|
+
else
|
57
|
+
puts "Slippers.update_repo: No establised SSH connection found."
|
58
|
+
end
|
59
|
+
self
|
60
|
+
end
|
61
|
+
|
62
|
+
def exec_script(script)
|
63
|
+
if @loggedin
|
64
|
+
output = @ssh.exec!(script)
|
65
|
+
puts output
|
66
|
+
else
|
67
|
+
puts "Slippers.exec_script: No establised SSH connection found."
|
68
|
+
end
|
69
|
+
self
|
70
|
+
end
|
71
|
+
|
72
|
+
def close
|
73
|
+
if @loggedin
|
74
|
+
puts "=== Closing connection ==="
|
75
|
+
@ssh.close
|
76
|
+
else
|
77
|
+
puts "Slippers.close: No establised SSH connection found."
|
78
|
+
end
|
79
|
+
self
|
80
|
+
end
|
81
|
+
end
|
metadata
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: flipflops
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sankha Narayan Guria
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2012-12-12 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A simple server deployment tool
|
14
|
+
email: sankha93@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/flipflops.rb
|
20
|
+
homepage: https://github.com/sankha93/flipflops
|
21
|
+
licenses: []
|
22
|
+
metadata: {}
|
23
|
+
post_install_message:
|
24
|
+
rdoc_options: []
|
25
|
+
require_paths:
|
26
|
+
- lib
|
27
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ! '>='
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '0'
|
32
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ! '>='
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
requirements: []
|
38
|
+
rubyforge_project:
|
39
|
+
rubygems_version: 2.0.3
|
40
|
+
signing_key:
|
41
|
+
specification_version: 4
|
42
|
+
summary: FlipFlops
|
43
|
+
test_files: []
|