doorway 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.rvmrc +1 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +84 -0
- data/Rakefile +2 -0
- data/doorway.gemspec +22 -0
- data/lib/doorway.rb +20 -0
- data/lib/doorway/base.rb +15 -0
- data/lib/doorway/commands/exec.rb +5 -0
- data/lib/doorway/commands/exec_as.rb +9 -0
- data/lib/doorway/commands/packages.rb +15 -0
- data/lib/doorway/commands/remote_file.rb +15 -0
- data/lib/doorway/template.rb +33 -0
- data/lib/doorway/version.rb +5 -0
- data/spec/doorway/base_spec.rb +17 -0
- data/spec/doorway/commands/exec_as_spec.rb +25 -0
- data/spec/doorway/commands/exec_spec.rb +12 -0
- data/spec/doorway/commands/packages_spec.rb +42 -0
- data/spec/doorway/commands/remote_file_spec.rb +54 -0
- data/spec/doorway/template_spec.rb +82 -0
- data/spec/doorway_spec.rb +38 -0
- data/spec/shared/command_context.rb +19 -0
- data/spec/spec_helper.rb +8 -0
- data/spec/support/.gitkeep +0 -0
- metadata +129 -0
data/.gitignore
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use 1.9.3-p125-perf
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Felipe Coury
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Doorway
|
2
|
+
|
3
|
+
Sane set of utility methods to provision remote servers over SSH and SCP.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'doorway'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install doorway
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
doorway = Doorway.connect(:root, "10.0.1.20", :ssh_key => "~/.keys/somekey.pem")
|
22
|
+
doorway.exec "ls -la"
|
23
|
+
|
24
|
+
# -or-
|
25
|
+
|
26
|
+
Doorway.connect(:deployer, "10.0.1.20", :ssh_key => "~/.keys/deployer.pem") do |conn|
|
27
|
+
|
28
|
+
# Raw command execution
|
29
|
+
|
30
|
+
conn.exec "whoami"
|
31
|
+
conn.exec_as :root, "REALLY_GEM_UPDATE_SYSTEM=y gem update --system"
|
32
|
+
|
33
|
+
# Script execution
|
34
|
+
|
35
|
+
conn.exec_script <<-EOS.strip_heredoc
|
36
|
+
|
37
|
+
#!/bin/bash
|
38
|
+
apt-get install -y some-package
|
39
|
+
|
40
|
+
EOS
|
41
|
+
|
42
|
+
conn.exec_script_as :git, "scripts/add-public-ip"
|
43
|
+
|
44
|
+
# Remote files
|
45
|
+
|
46
|
+
conn.remote_file "/etc/nginx/nginx.conf", "nginx/nginx.conf"
|
47
|
+
conn.remote_file "/etc/init.d/nginx", "nginx/nginx.init.d"
|
48
|
+
conn.append_from "/etc/nginx/nginx.conf", "nginx/include"
|
49
|
+
|
50
|
+
# ERB templates
|
51
|
+
|
52
|
+
conn.remote_file "/etc/nginx/conf.d/site.conf",
|
53
|
+
:template => "nginx/vhost.conf.erb",
|
54
|
+
:server => "www.example.org",
|
55
|
+
:root => "/var/www/example"
|
56
|
+
|
57
|
+
conn.append_from "/etc/sudoers.d/my_sudoers",
|
58
|
+
:template => "sudoers/god.erb",
|
59
|
+
:user => "fcoury",
|
60
|
+
:allow => "/var/bin/all_your_base"
|
61
|
+
|
62
|
+
# Download a file to server
|
63
|
+
|
64
|
+
conn.get "https://webbynode_packages.s3.amazonaws.com/icecream-8.30.tar.gz", "/usr/local/src"
|
65
|
+
|
66
|
+
# Ubuntu specific package management
|
67
|
+
|
68
|
+
conn.add_ppa "chris-lea/node.js"
|
69
|
+
conn.install "nodejs"
|
70
|
+
|
71
|
+
# Advanced commands
|
72
|
+
|
73
|
+
conn.sed "/home/git/repo/.git/config",
|
74
|
+
/remote "github"/, 'remote "bitbucket"'
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
## Contributing
|
79
|
+
|
80
|
+
1. Fork it
|
81
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
82
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
83
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
84
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/doorway.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "doorway/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "doorway"
|
7
|
+
s.version = Doorway::Version::STRING
|
8
|
+
s.authors = ["Felipe Coury"]
|
9
|
+
s.email = ["felipe.coury@gmail.com"]
|
10
|
+
s.homepage = "http://github.com/webbynode/doorway"
|
11
|
+
s.summary = "Sane set of utility methods to provision remote servers over SSH and SCP."
|
12
|
+
s.description = s.summary
|
13
|
+
|
14
|
+
s.add_development_dependency "rspec" , "~> 2.11"
|
15
|
+
s.add_dependency "activesupport" , "~> 3.0"
|
16
|
+
s.add_dependency "net-ssh" , "~> 2.5.2"
|
17
|
+
|
18
|
+
s.files = `git ls-files`.split($\)
|
19
|
+
s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
20
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
21
|
+
s.require_paths = ["lib"]
|
22
|
+
end
|
data/lib/doorway.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require "active_support/core_ext/string/inflections"
|
2
|
+
require "net/ssh"
|
3
|
+
|
4
|
+
module Doorway
|
5
|
+
autoload :Version, "doorway/version"
|
6
|
+
autoload :Base, "doorway/base"
|
7
|
+
|
8
|
+
Dir[File.join(File.dirname(__FILE__), "doorway", "commands", "*.rb")].each do |f|
|
9
|
+
require f
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.connect(user, host, options={})
|
13
|
+
ssh = Net::SSH.start(host, user.to_s, options)
|
14
|
+
conn = Doorway::Base.new(ssh)
|
15
|
+
|
16
|
+
yield conn if block_given?
|
17
|
+
|
18
|
+
conn
|
19
|
+
end
|
20
|
+
end
|
data/lib/doorway/base.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
module Doorway
|
2
|
+
class Base
|
3
|
+
Dir[File.join(File.dirname(__FILE__), "commands", "*.rb")].each do |f|
|
4
|
+
command = File.basename(f)[/(.*)\.rb/, 1].camelize
|
5
|
+
module_name = "Doorway::#{command}"
|
6
|
+
self.send :include, module_name.constantize
|
7
|
+
end
|
8
|
+
|
9
|
+
attr_reader :conn
|
10
|
+
|
11
|
+
def initialize(conn)
|
12
|
+
@conn = conn
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Doorway::Packages
|
2
|
+
def update_packages
|
3
|
+
exec_as :root, "apt-get update"
|
4
|
+
end
|
5
|
+
|
6
|
+
def install(package)
|
7
|
+
exec_as :root,
|
8
|
+
"DEBIAN_FRONTEND=noninteractive apt-get install -y -q #{package}"
|
9
|
+
end
|
10
|
+
|
11
|
+
def add_ppa(ppa)
|
12
|
+
exec_as :root, "add-apt-repository ppa:#{ppa}"
|
13
|
+
update_packages
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Doorway::RemoteFile
|
2
|
+
def remote_file(remote, options)
|
3
|
+
if options.is_a?(Hash)
|
4
|
+
if template = options.delete(:template)
|
5
|
+
local = temp_from_template(template, options)
|
6
|
+
end
|
7
|
+
else
|
8
|
+
local = options
|
9
|
+
end
|
10
|
+
|
11
|
+
raise "You need to specify a local file or a template" unless local
|
12
|
+
|
13
|
+
conn.scp.upload! local, remote
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
require 'tempfile'
|
3
|
+
|
4
|
+
module Template
|
5
|
+
def asset(name)
|
6
|
+
File.expand_path("../../../assets/#{name}", __FILE__)
|
7
|
+
end
|
8
|
+
|
9
|
+
def compile_template(template, vars)
|
10
|
+
contents = File.read asset(template)
|
11
|
+
struct = ErbBinding.new(vars)
|
12
|
+
ERB.new(contents).result(struct.send(:get_binding))
|
13
|
+
end
|
14
|
+
|
15
|
+
def create_from_template(file, template, vars={})
|
16
|
+
write_file file, compile_template(template, vars)
|
17
|
+
end
|
18
|
+
|
19
|
+
def temp_from_template(template, vars={})
|
20
|
+
tmp = Tempfile.new("doorway")
|
21
|
+
tmp.write compile_template(template, vars)
|
22
|
+
end
|
23
|
+
|
24
|
+
def write_file(file, contents)
|
25
|
+
File.open(file, 'w+') { |f| f.write contents }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class ErbBinding < OpenStruct
|
30
|
+
def get_binding
|
31
|
+
binding
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Doorway::Base do
|
4
|
+
let(:ssh) { stub(:ssh) }
|
5
|
+
|
6
|
+
subject { Doorway::Base.new(ssh) }
|
7
|
+
|
8
|
+
its(:conn) { should == ssh }
|
9
|
+
|
10
|
+
describe "includes" do
|
11
|
+
it "includes all commands" do
|
12
|
+
subject.should be_kind_of(Doorway::Exec)
|
13
|
+
subject.should be_kind_of(Doorway::ExecAs)
|
14
|
+
subject.should be_kind_of(Doorway::RemoteFile)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Doorway::ExecAs do
|
4
|
+
include_context "command"
|
5
|
+
|
6
|
+
before { include_commands_from Doorway::ExecAs }
|
7
|
+
|
8
|
+
it "executes the command as the user" do
|
9
|
+
expected_command = %Q[sudo -i -u git bash -c "/etc/init.d/nginx stop"]
|
10
|
+
subject.should_receive(:exec).with(expected_command)
|
11
|
+
subject.exec_as :git, "/etc/init.d/nginx stop"
|
12
|
+
end
|
13
|
+
|
14
|
+
it "escapes double quotes" do
|
15
|
+
expected_command = %q[sudo -i -u git bash -c "echo \"something\" > ~/.bashrc"]
|
16
|
+
subject.should_receive(:exec).with(expected_command)
|
17
|
+
subject.exec_as :git, 'echo "something" > ~/.bashrc'
|
18
|
+
end
|
19
|
+
|
20
|
+
it "escapes dollar signs" do
|
21
|
+
expected_command = %q[sudo -i -u git bash -c "PATH=\$HOME/bin:\$PATH"]
|
22
|
+
subject.should_receive(:exec).with(expected_command)
|
23
|
+
subject.exec_as :git, 'PATH=$HOME/bin:$PATH'
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Doorway::Exec do
|
4
|
+
include_context "command"
|
5
|
+
|
6
|
+
before { include_commands_from Doorway::Exec }
|
7
|
+
|
8
|
+
it "executes the command as the default user" do
|
9
|
+
conn.should_receive(:exec!).with("command")
|
10
|
+
subject.exec "command"
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Doorway::Packages do
|
4
|
+
include_context "command"
|
5
|
+
|
6
|
+
before do
|
7
|
+
include_commands_from Doorway::Packages
|
8
|
+
subject.stub(:exec_as)
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "#update_packages" do
|
12
|
+
it "updates the package list" do
|
13
|
+
subject.should_receive(:exec_as).with(:root, "apt-get update")
|
14
|
+
subject.update_packages
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#install" do
|
19
|
+
it "installs a package" do
|
20
|
+
subject.should_receive(:exec_as).
|
21
|
+
with(:root,
|
22
|
+
"DEBIAN_FRONTEND=noninteractive apt-get install -y -q package")
|
23
|
+
subject.install "package"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#add_ppa" do
|
28
|
+
before do
|
29
|
+
subject.stub(:update_packages)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "executes the command as the default user" do
|
33
|
+
subject.should_receive(:exec_as).with(:root, "add-apt-repository ppa:ppa")
|
34
|
+
subject.add_ppa "ppa"
|
35
|
+
end
|
36
|
+
|
37
|
+
it "updates the packages" do
|
38
|
+
subject.should_receive(:update_packages)
|
39
|
+
subject.add_ppa "ppa"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Doorway::RemoteFile do
|
4
|
+
include_context "command"
|
5
|
+
|
6
|
+
before do
|
7
|
+
include_commands_from Doorway::RemoteFile
|
8
|
+
end
|
9
|
+
|
10
|
+
context "with a local file" do
|
11
|
+
it "uploads the file" do
|
12
|
+
scp.should_receive(:upload!).with('local', 'remote')
|
13
|
+
subject.remote_file 'remote', 'local'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context "with a template" do
|
18
|
+
before do
|
19
|
+
subject.stub(:temp_from_template => '/dir/temp')
|
20
|
+
end
|
21
|
+
|
22
|
+
it "creates a tempfile from the template" do
|
23
|
+
subject.should_receive(:temp_from_template).
|
24
|
+
with('nginx/vhost.conf.erb', hash_including(
|
25
|
+
:server => 'www.example.org',
|
26
|
+
:root => '/var/www/example'
|
27
|
+
)).
|
28
|
+
and_return('/path/to/temp')
|
29
|
+
|
30
|
+
subject.remote_file '/etc/nginx/conf.d/site.conf',
|
31
|
+
:template => 'nginx/vhost.conf.erb',
|
32
|
+
:server => 'www.example.org',
|
33
|
+
:root => '/var/www/example'
|
34
|
+
end
|
35
|
+
|
36
|
+
it "uploads the tempfile" do
|
37
|
+
scp.should_receive(:upload!).with('/dir/temp',
|
38
|
+
'/etc/nginx/conf.d/site.conf')
|
39
|
+
|
40
|
+
subject.remote_file '/etc/nginx/conf.d/site.conf',
|
41
|
+
:template => 'nginx/vhost.conf.erb',
|
42
|
+
:server => 'www.example.org',
|
43
|
+
:root => '/var/www/example'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context "with no template or local file" do
|
48
|
+
it "raises an error" do
|
49
|
+
expect do
|
50
|
+
subject.remote_file('file', :a => :b)
|
51
|
+
end.to raise_error
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require './lib/doorway/template'
|
2
|
+
|
3
|
+
describe Template do
|
4
|
+
subject { Class.new { include Template }.new }
|
5
|
+
|
6
|
+
describe "#asset" do
|
7
|
+
it "maps to the template path" do
|
8
|
+
expected = File.expand_path("../../../assets/path/file", __FILE__)
|
9
|
+
expect(subject.asset("path/file")).to eql(expected)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#compile_template' do
|
14
|
+
it "returns the string for the template" do
|
15
|
+
asset = subject.asset('vhosts/nginx/rails3.erb')
|
16
|
+
File.should_receive(:read).with(asset).
|
17
|
+
and_return('abcdef <%= app.name %> <%= app.path %>')
|
18
|
+
|
19
|
+
app = stub(
|
20
|
+
:name => 'app1',
|
21
|
+
:path => '/var/app/app1',
|
22
|
+
:domain => 'webby.com',
|
23
|
+
:alaises => 'app2.webby.com app3.webby.com'
|
24
|
+
)
|
25
|
+
|
26
|
+
result = subject.compile_template('vhosts/nginx/rails3.erb',
|
27
|
+
{ :app => app })
|
28
|
+
result.should == "abcdef app1 /var/app/app1"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#create_from_template' do
|
33
|
+
before do
|
34
|
+
subject.stub(:write_file)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "compiles the template" do
|
38
|
+
subject.should_receive(:compile_template).with('template', {})
|
39
|
+
subject.create_from_template 'file', 'template'
|
40
|
+
end
|
41
|
+
|
42
|
+
it "writes the file with compiled template" do
|
43
|
+
subject.stub(:compile_template => 'contents')
|
44
|
+
subject.should_receive(:write_file).with('file', 'contents')
|
45
|
+
subject.create_from_template 'file', 'template'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe '#write_file' do
|
50
|
+
it "writes the file" do
|
51
|
+
file = stub(:file)
|
52
|
+
File.should_receive(:open).with('file', 'w+').and_yield(file)
|
53
|
+
file.should_receive(:write).with('contents')
|
54
|
+
subject.write_file 'file', 'contents'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "#temp_from_template" do
|
59
|
+
let(:tmp) { stub(:tmp).as_null_object }
|
60
|
+
|
61
|
+
before do
|
62
|
+
subject.stub(:compile_template => 'contents')
|
63
|
+
Tempfile.stub(:new => tmp)
|
64
|
+
end
|
65
|
+
|
66
|
+
it "creates a tempfile" do
|
67
|
+
Tempfile.should_receive(:new).with("doorway").and_return(tmp)
|
68
|
+
expect(subject.temp_from_template("template", :a => :b)).to eql(tmp)
|
69
|
+
end
|
70
|
+
|
71
|
+
it "compiles the template" do
|
72
|
+
subject.should_receive(:compile_template).with("template", :a => :b).
|
73
|
+
and_return("temp_contents")
|
74
|
+
subject.temp_from_template("template", :a => :b)
|
75
|
+
end
|
76
|
+
|
77
|
+
it "writes the result of the template to the tempfile" do
|
78
|
+
tmp.should_receive(:write).with('contents')
|
79
|
+
subject.temp_from_template("template", :a => :b)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require './lib/doorway'
|
2
|
+
require './lib/doorway/base'
|
3
|
+
|
4
|
+
describe Doorway do
|
5
|
+
let(:ssh) { stub(:ssh) }
|
6
|
+
let(:ssh_conn) { stub(:ssh_conn) }
|
7
|
+
let(:conn) { stub(:conn) }
|
8
|
+
|
9
|
+
subject { Doorway }
|
10
|
+
|
11
|
+
before do
|
12
|
+
stub_const("Net::SSH", ssh)
|
13
|
+
Net::SSH.stub(:start => ssh_conn)
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#connect" do
|
17
|
+
it "creates a new SSH connection" do
|
18
|
+
Net::SSH.should_receive(:start).with("host", "root", hash_including(
|
19
|
+
:password => "password",
|
20
|
+
:port => 389
|
21
|
+
))
|
22
|
+
subject.connect(:root, "host", :password => "password", :port => 389)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "creates a new connection" do
|
26
|
+
Doorway::Base.should_receive(:new).with(ssh_conn).and_return(conn)
|
27
|
+
subject.connect(:root, "host")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "yields the connection if block given" do
|
31
|
+
yielded = false
|
32
|
+
subject.connect(:root, "host") do |conn|
|
33
|
+
yielded = conn.is_a?(Doorway::Base)
|
34
|
+
end
|
35
|
+
fail "block not raised or connection not of expected type" unless yielded
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
shared_context "command" do
|
2
|
+
let(:conn) { stub(:conn).as_null_object }
|
3
|
+
let(:scp) { stub(:scp).as_null_object }
|
4
|
+
|
5
|
+
class Subject; end
|
6
|
+
|
7
|
+
subject do
|
8
|
+
Subject.new
|
9
|
+
end
|
10
|
+
|
11
|
+
def include_commands_from(base)
|
12
|
+
Subject.send :include, base
|
13
|
+
end
|
14
|
+
|
15
|
+
before do
|
16
|
+
subject.stub(:conn => conn)
|
17
|
+
conn.stub(:scp => scp)
|
18
|
+
end
|
19
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
require "bundler"
|
2
|
+
Bundler.setup(:default, :development)
|
3
|
+
Bundler.require(:default, :development)
|
4
|
+
|
5
|
+
require "doorway"
|
6
|
+
|
7
|
+
Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|file| require file}
|
8
|
+
Dir[File.dirname(__FILE__) + "/shared/**/*.rb"].each {|file| require file}
|
File without changes
|
metadata
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: doorway
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Felipe Coury
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-07-12 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.11'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.11'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: activesupport
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '3.0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '3.0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: net-ssh
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 2.5.2
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.5.2
|
62
|
+
description: Sane set of utility methods to provision remote servers over SSH and
|
63
|
+
SCP.
|
64
|
+
email:
|
65
|
+
- felipe.coury@gmail.com
|
66
|
+
executables: []
|
67
|
+
extensions: []
|
68
|
+
extra_rdoc_files: []
|
69
|
+
files:
|
70
|
+
- .gitignore
|
71
|
+
- .rvmrc
|
72
|
+
- Gemfile
|
73
|
+
- LICENSE
|
74
|
+
- README.md
|
75
|
+
- Rakefile
|
76
|
+
- doorway.gemspec
|
77
|
+
- lib/doorway.rb
|
78
|
+
- lib/doorway/base.rb
|
79
|
+
- lib/doorway/commands/exec.rb
|
80
|
+
- lib/doorway/commands/exec_as.rb
|
81
|
+
- lib/doorway/commands/packages.rb
|
82
|
+
- lib/doorway/commands/remote_file.rb
|
83
|
+
- lib/doorway/template.rb
|
84
|
+
- lib/doorway/version.rb
|
85
|
+
- spec/doorway/base_spec.rb
|
86
|
+
- spec/doorway/commands/exec_as_spec.rb
|
87
|
+
- spec/doorway/commands/exec_spec.rb
|
88
|
+
- spec/doorway/commands/packages_spec.rb
|
89
|
+
- spec/doorway/commands/remote_file_spec.rb
|
90
|
+
- spec/doorway/template_spec.rb
|
91
|
+
- spec/doorway_spec.rb
|
92
|
+
- spec/shared/command_context.rb
|
93
|
+
- spec/spec_helper.rb
|
94
|
+
- spec/support/.gitkeep
|
95
|
+
homepage: http://github.com/webbynode/doorway
|
96
|
+
licenses: []
|
97
|
+
post_install_message:
|
98
|
+
rdoc_options: []
|
99
|
+
require_paths:
|
100
|
+
- lib
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
103
|
+
requirements:
|
104
|
+
- - ! '>='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
109
|
+
requirements:
|
110
|
+
- - ! '>='
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
requirements: []
|
114
|
+
rubyforge_project:
|
115
|
+
rubygems_version: 1.8.21
|
116
|
+
signing_key:
|
117
|
+
specification_version: 3
|
118
|
+
summary: Sane set of utility methods to provision remote servers over SSH and SCP.
|
119
|
+
test_files:
|
120
|
+
- spec/doorway/base_spec.rb
|
121
|
+
- spec/doorway/commands/exec_as_spec.rb
|
122
|
+
- spec/doorway/commands/exec_spec.rb
|
123
|
+
- spec/doorway/commands/packages_spec.rb
|
124
|
+
- spec/doorway/commands/remote_file_spec.rb
|
125
|
+
- spec/doorway/template_spec.rb
|
126
|
+
- spec/doorway_spec.rb
|
127
|
+
- spec/shared/command_context.rb
|
128
|
+
- spec/spec_helper.rb
|
129
|
+
- spec/support/.gitkeep
|