deploy_docus 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/deploy_docus/base.rb +4 -2
- data/lib/deploy_docus/deployer.rb +21 -8
- data/lib/deploy_docus/generators/new.rb +19 -0
- data/lib/deploy_docus/generators/templates/new/Gemfile +3 -0
- data/lib/deploy_docus/generators/templates/new/Procfile +1 -0
- data/lib/deploy_docus/generators/templates/new/config.ru +5 -0
- data/lib/deploy_docus/generators/templates/new/config.yml +4 -0
- data/lib/deploy_docus/generators/templates/new/keys/.gitkeep +0 -0
- data/lib/deploy_docus/generators.rb +5 -0
- data/lib/deploy_docus/version.rb +1 -1
- data/lib/deploy_docus.rb +1 -0
- metadata +44 -15
data/lib/deploy_docus/base.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'sinatra/base'
|
2
|
+
require 'json'
|
2
3
|
|
3
4
|
module DeployDocus
|
4
5
|
class Base < Sinatra::Base
|
@@ -12,10 +13,11 @@ module DeployDocus
|
|
12
13
|
config = DeployDocus::Config.new(params[:application])
|
13
14
|
deployer = DeployDocus::Deployer.new(config['repository'], "keys/#{params[:application]}_rsa", config.deploy_task(params[:environment]))
|
14
15
|
|
16
|
+
content_type :json
|
15
17
|
if deployer.deploy!
|
16
|
-
"OK"
|
18
|
+
{:status => "OK"}.to_json
|
17
19
|
else
|
18
|
-
"NOT OK"
|
20
|
+
{:status => "NOT OK", :error => deployer.errors}.to_json
|
19
21
|
end
|
20
22
|
end
|
21
23
|
end
|
@@ -1,10 +1,17 @@
|
|
1
1
|
require 'git-ssh-wrapper'
|
2
|
+
require 'active_model'
|
2
3
|
|
3
4
|
module DeployDocus
|
4
5
|
class Deployer
|
6
|
+
include ActiveModel::Validations
|
7
|
+
|
5
8
|
attr_reader :repository, :ssh_key, :deploy_task
|
6
9
|
attr_accessor :wrapper
|
7
10
|
|
11
|
+
validates :repository, :presence => {:allow_blank => false}
|
12
|
+
validates :ssh_key, :presence => {:allow_blank => false}
|
13
|
+
validates :deploy_task, :presence => {:allow_blank => false}
|
14
|
+
|
8
15
|
#
|
9
16
|
# Manages cloning and deploying the repository
|
10
17
|
# This class is agnostic of any web interface and can be used as a library
|
@@ -15,15 +22,19 @@ module DeployDocus
|
|
15
22
|
# And execute the deploy_task on it.
|
16
23
|
#
|
17
24
|
def initialize(repository, ssh_key, deploy_task)
|
18
|
-
|
25
|
+
ssh_key = File.expand_path(ssh_key) if ssh_key
|
26
|
+
@repository, @ssh_key, @deploy_task = repository, ssh_key, deploy_task
|
19
27
|
end
|
20
28
|
|
21
29
|
def deploy!
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
30
|
+
if self.valid?
|
31
|
+
GitSSHWrapper.with_wrapper(:private_key_path => ssh_key) do |w|
|
32
|
+
@wrapper = w
|
33
|
+
|
34
|
+
clone && run_deploy
|
35
|
+
end
|
36
|
+
else
|
37
|
+
false
|
27
38
|
end
|
28
39
|
end
|
29
40
|
|
@@ -31,12 +42,14 @@ module DeployDocus
|
|
31
42
|
private
|
32
43
|
def clone
|
33
44
|
puts "cloning #{repository}"
|
34
|
-
%x[#{
|
45
|
+
%x[#{wrapper.nil? ? '' : 'env ' + @wrapper.git_ssh} git clone #{repository} #{tmp}]
|
46
|
+
$?.exitstatus == 0
|
35
47
|
end
|
36
48
|
|
37
49
|
def run_deploy
|
38
50
|
puts "deploying : #{deploy_task}"
|
39
|
-
%x[#{
|
51
|
+
%x[#{wrapper.nil? ? '' : 'env ' + @wrapper.git_ssh} cd #{tmp}; #{deploy_task}]
|
52
|
+
$?.exitstatus == 0
|
40
53
|
end
|
41
54
|
|
42
55
|
def tmp
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'thor/group'
|
2
|
+
|
3
|
+
module DeployDocus
|
4
|
+
module Generators
|
5
|
+
class New < Thor::Group
|
6
|
+
include Thor::Actions
|
7
|
+
|
8
|
+
argument :name
|
9
|
+
|
10
|
+
def self.source_root
|
11
|
+
File.dirname(__FILE__)
|
12
|
+
end
|
13
|
+
|
14
|
+
def copy_files
|
15
|
+
directory "templates/new", name
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
web: bundle exec rackup -p $PORT
|
File without changes
|
data/lib/deploy_docus/version.rb
CHANGED
data/lib/deploy_docus.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deploy_docus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-10-28 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
|
-
requirement: &
|
16
|
+
requirement: &70277829594420 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70277829594420
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: minitest
|
27
|
-
requirement: &
|
27
|
+
requirement: &70277829594000 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70277829594000
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rack-test
|
38
|
-
requirement: &
|
38
|
+
requirement: &70277829593460 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70277829593460
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: mocha
|
49
|
-
requirement: &
|
49
|
+
requirement: &70277829592920 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70277829592920
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: sinatra
|
60
|
-
requirement: &
|
60
|
+
requirement: &70277829592380 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70277829592380
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
|
-
requirement: &
|
71
|
+
requirement: &70277829591720 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 0.8.7
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70277829591720
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: git-ssh-wrapper
|
82
|
-
requirement: &
|
82
|
+
requirement: &70277829591280 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,7 +87,29 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70277829591280
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: activemodel
|
93
|
+
requirement: &70277829578380 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
type: :runtime
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *70277829578380
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: thor
|
104
|
+
requirement: &70277829577880 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :runtime
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *70277829577880
|
91
113
|
description: Deploy your application with a POST request
|
92
114
|
email: dev@evome.fr
|
93
115
|
executables: []
|
@@ -98,6 +120,13 @@ files:
|
|
98
120
|
- lib/deploy_docus/base.rb
|
99
121
|
- lib/deploy_docus/config.rb
|
100
122
|
- lib/deploy_docus/deployer.rb
|
123
|
+
- lib/deploy_docus/generators.rb
|
124
|
+
- lib/deploy_docus/generators/new.rb
|
125
|
+
- lib/deploy_docus/generators/templates/new/Gemfile
|
126
|
+
- lib/deploy_docus/generators/templates/new/Procfile
|
127
|
+
- lib/deploy_docus/generators/templates/new/config.ru
|
128
|
+
- lib/deploy_docus/generators/templates/new/config.yml
|
129
|
+
- lib/deploy_docus/generators/templates/new/keys/.gitkeep
|
101
130
|
- lib/deploy_docus/version.rb
|
102
131
|
homepage: https://github.com/evome/deploy_docus
|
103
132
|
licenses: []
|