dpl 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dpl/cli.rb +4 -0
- data/lib/dpl/provider.rb +23 -4
- data/lib/dpl/provider/dot_cloud.rb +1 -1
- data/lib/dpl/provider/heroku/git.rb +1 -1
- data/lib/dpl/provider/nodejitsu.rb +1 -1
- data/lib/dpl/version.rb +1 -1
- data/spec/provider/heroku_spec.rb +1 -1
- data/spec/provider_spec.rb +3 -3
- data/spec/spec_helper.rb +3 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b60ef07c3efd10ed791e52662655bf6ae8b9f25a
|
4
|
+
data.tar.gz: a03dc4e7e633af8bb810b961f88554e6e6e11b2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca7d8f39d87084784d1217e2fbeda9cbfb56aa7c8cfb8330e88ce4ebd6502956db4228cb6374adb614c2ecf749113b211c4bdeddf47c85843030ee2da1bd5965
|
7
|
+
data.tar.gz: d9e896346cae4da0c2ce91de14f924177e49863a11b7b36cb1d1ea782cb6e88535c34a850b8b4aa09b067717c2a018bd18a4364496392f8e9e08b8ff55eaf700
|
data/lib/dpl/cli.rb
CHANGED
data/lib/dpl/provider.rb
CHANGED
@@ -29,18 +29,26 @@ module DPL
|
|
29
29
|
load = options[:load] || name
|
30
30
|
gem(name, version)
|
31
31
|
rescue LoadError
|
32
|
-
|
32
|
+
context.shell("gem install %s -v %p" % [name, version])
|
33
33
|
Gem.clear_paths
|
34
34
|
ensure
|
35
35
|
require load
|
36
36
|
end
|
37
37
|
|
38
|
+
def self.context
|
39
|
+
self
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.shell(command)
|
43
|
+
system(command)
|
44
|
+
end
|
45
|
+
|
38
46
|
def self.pip(name, command = name)
|
39
|
-
|
47
|
+
context.shell "pip install #{name}" if `which #{command}`.chop.empty?
|
40
48
|
end
|
41
49
|
|
42
50
|
def self.npm_g(name, command = name)
|
43
|
-
|
51
|
+
context.shell "npm install -g #{name}" if `which #{command}`.chop.empty?
|
44
52
|
end
|
45
53
|
|
46
54
|
attr_reader :context, :options
|
@@ -68,6 +76,8 @@ module DPL
|
|
68
76
|
setup_key(".dpl/id_rsa.pub")
|
69
77
|
setup_git_ssh(".dpl/git-ssh", ".dpl/id_rsa")
|
70
78
|
end
|
79
|
+
|
80
|
+
cleanup
|
71
81
|
end
|
72
82
|
|
73
83
|
context.fold("Deploying application") { push_app }
|
@@ -83,6 +93,15 @@ module DPL
|
|
83
93
|
remove_key if needs_key?
|
84
94
|
end
|
85
95
|
|
96
|
+
def sha
|
97
|
+
@sha ||= ENV['TRAVIS_COMMIT'] || `git rev-parse HEAD`.strip
|
98
|
+
end
|
99
|
+
|
100
|
+
def cleanup
|
101
|
+
context.shell "git reset --hard #{sha}"
|
102
|
+
context.shell "git clean -dffqx -e .dpl"
|
103
|
+
end
|
104
|
+
|
86
105
|
def needs_key?
|
87
106
|
true
|
88
107
|
end
|
@@ -91,7 +110,7 @@ module DPL
|
|
91
110
|
end
|
92
111
|
|
93
112
|
def create_key(file)
|
94
|
-
|
113
|
+
context.shell "ssh-keygen -t rsa -N \"\" -C #{option(:key_name)} -f #{file}"
|
95
114
|
end
|
96
115
|
|
97
116
|
def setup_git_ssh(path, key_path)
|
data/lib/dpl/version.rb
CHANGED
@@ -69,7 +69,7 @@ describe DPL::Provider::Heroku do
|
|
69
69
|
describe :push_app do
|
70
70
|
example do
|
71
71
|
provider.options[:git] = "git://something"
|
72
|
-
provider.should_receive(:
|
72
|
+
provider.context.should_receive(:shell).with("git push git://something HEAD:master -f")
|
73
73
|
provider.push_app
|
74
74
|
end
|
75
75
|
end
|
data/spec/provider_spec.rb
CHANGED
@@ -27,7 +27,7 @@ describe DPL::Provider do
|
|
27
27
|
|
28
28
|
example "missing" do
|
29
29
|
example_provider.should_receive(:gem).with("foo", "~> 1.4").and_raise(LoadError)
|
30
|
-
example_provider.should_receive(:
|
30
|
+
example_provider.context.should_receive(:shell).with('gem install foo -v "~> 1.4"')
|
31
31
|
example_provider.requires("foo", :version => "~> 1.4")
|
32
32
|
end
|
33
33
|
end
|
@@ -41,7 +41,7 @@ describe DPL::Provider do
|
|
41
41
|
|
42
42
|
example "missing" do
|
43
43
|
example_provider.should_receive(:`).with("which foo").and_return("")
|
44
|
-
example_provider.should_receive(:
|
44
|
+
example_provider.context.should_receive(:shell).with("pip install foo")
|
45
45
|
example_provider.pip("foo")
|
46
46
|
end
|
47
47
|
end
|
@@ -71,7 +71,7 @@ describe DPL::Provider do
|
|
71
71
|
|
72
72
|
describe :create_key do
|
73
73
|
example do
|
74
|
-
provider.should_receive(:
|
74
|
+
provider.context.should_receive(:shell).with('ssh-keygen -t rsa -N "" -C foo -f thekey')
|
75
75
|
provider.create_key('thekey')
|
76
76
|
end
|
77
77
|
end
|
data/spec/spec_helper.rb
CHANGED
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.
|
4
|
+
version: 1.2.0
|
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-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|