dpl 1.0.2 → 1.0.3
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 +4 -4
- data/lib/dpl/provider.rb +18 -1
- data/lib/dpl/provider/heroku/anvil.rb +2 -1
- data/lib/dpl/provider/heroku/git.rb +4 -0
- data/lib/dpl/provider/nodejitsu.rb +41 -0
- data/lib/dpl/version.rb +1 -1
- data/spec/provider/heroku_spec.rb +7 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45d759b440ccb1838b4738c28b23827a83db1a0c
|
4
|
+
data.tar.gz: 30db537d8213204f14c4e0974781eb00f34feeb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 116d8ce147d9eaac137e74ed1b1f56eb569efd48a0212fc0b5914be783289c1532409ec87d79861c779236ae954e5b1296c969b0d138260530351b4682817e87
|
7
|
+
data.tar.gz: eb0c13c8219333299a8809d490e264aaddb518d8fe4233657ecc751937f8c6437351e2a8a6183fa416fc7a585fc4aa49eb9c38e408c277a38303bebc9fbc835a
|
data/lib/dpl/provider.rb
CHANGED
@@ -8,6 +8,7 @@ module DPL
|
|
8
8
|
autoload :Heroku, 'dpl/provider/heroku'
|
9
9
|
autoload :EngineYard, 'dpl/provider/engine_yard'
|
10
10
|
autoload :DotCloud, 'dpl/provider/dot_cloud'
|
11
|
+
autoload :Nodejitsu, 'dpl/provider/nodejitsu'
|
11
12
|
|
12
13
|
def self.new(context, options)
|
13
14
|
return super if self < Provider
|
@@ -38,6 +39,10 @@ module DPL
|
|
38
39
|
system "pip install #{name}" if `which #{command}`.chop.empty?
|
39
40
|
end
|
40
41
|
|
42
|
+
def self.npm_g(name, command = name)
|
43
|
+
system "npm install -g #{name}" if `which #{command}`.chop.empty?
|
44
|
+
end
|
45
|
+
|
41
46
|
attr_reader :context, :options
|
42
47
|
|
43
48
|
def initialize(context, options)
|
@@ -66,7 +71,11 @@ module DPL
|
|
66
71
|
context.fold("Deploying application") { push_app }
|
67
72
|
|
68
73
|
Array(options[:run]).each do |command|
|
69
|
-
|
74
|
+
if command == 'restart'
|
75
|
+
context.fold("Restarting application") { restart }
|
76
|
+
else
|
77
|
+
context.fold("Running %p" % command) { run(command) }
|
78
|
+
end
|
70
79
|
end
|
71
80
|
ensure
|
72
81
|
remove_key if needs_key?
|
@@ -99,5 +108,13 @@ module DPL
|
|
99
108
|
def log(message)
|
100
109
|
$stderr.puts(message)
|
101
110
|
end
|
111
|
+
|
112
|
+
def run(command)
|
113
|
+
error "running commands not supported"
|
114
|
+
end
|
115
|
+
|
116
|
+
def error(message)
|
117
|
+
raise Error, message
|
118
|
+
end
|
102
119
|
end
|
103
120
|
end
|
@@ -16,8 +16,9 @@ module DPL
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def push_app
|
19
|
+
sha = ENV['TRAVIS_COMMIT'] || `git rev-parse HEAD`.strip
|
19
20
|
response = Excon.post release_url,
|
20
|
-
:body => { "slug_url" => slug_url, "description" => "Travis CI
|
21
|
+
:body => { "slug_url" => slug_url, "description" => "Deploy #{sha} via Travis CI" }.to_json,
|
21
22
|
:headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json' }
|
22
23
|
|
23
24
|
print "\nDeploying slug "
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module DPL
|
2
|
+
class Provider
|
3
|
+
class Nodejitsu < Provider
|
4
|
+
CONFIG_FILE = '.dpl/jitsu.json'
|
5
|
+
|
6
|
+
experimental "Nodejitsu"
|
7
|
+
requires 'json'
|
8
|
+
npm_g 'jitsu'
|
9
|
+
|
10
|
+
def config
|
11
|
+
{
|
12
|
+
"username" => option(:username),
|
13
|
+
"apiToken" => option(:api_key),
|
14
|
+
"apiTokenName" => "travis"
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
def check_auth
|
19
|
+
File.open(CONFIG_FILE, 'w') { |f| f << config.to_json }
|
20
|
+
end
|
21
|
+
|
22
|
+
def check_app
|
23
|
+
error "missing package.json" unless File.exist? 'package.json'
|
24
|
+
|
25
|
+
package = JSON.parse File.read('package.json')
|
26
|
+
message = "missing %s in package.json, see https://www.nodejitsu.com/documentation/appendix/package-json/"
|
27
|
+
error message % "subdomain" unless package['subdomain']
|
28
|
+
error message % "node version" unless package['engines'] and package['engines']['node']
|
29
|
+
error message % "start script" unless package['scripts'] and package['scripts']['start']
|
30
|
+
end
|
31
|
+
|
32
|
+
def needs_key?
|
33
|
+
false
|
34
|
+
end
|
35
|
+
|
36
|
+
def push_app
|
37
|
+
system "jitsu deploy -j #{CONFIG_FILE}"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/lib/dpl/version.rb
CHANGED
@@ -83,6 +83,13 @@ describe DPL::Provider::Heroku do
|
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
|
+
describe :restart do
|
87
|
+
example do
|
88
|
+
api.should_receive(:post_ps_restart).with("example")
|
89
|
+
provider.restart
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
86
93
|
describe :deploy do
|
87
94
|
example "not found error" do
|
88
95
|
provider.should_receive(:api) { raise ::Heroku::API::Errors::NotFound.new("the message", nil) }.at_least(:once)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dpl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konstantin Haase
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
11
|
+
date: 2013-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -76,6 +76,7 @@ files:
|
|
76
76
|
- lib/dpl/provider/heroku.rb
|
77
77
|
- lib/dpl/provider/heroku/anvil.rb
|
78
78
|
- lib/dpl/provider/heroku/git.rb
|
79
|
+
- lib/dpl/provider/nodejitsu.rb
|
79
80
|
- lib/dpl/version.rb
|
80
81
|
- notes/dotcloud.md
|
81
82
|
- notes/engine_yard.md
|