phase 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/phase/cli/deploy.rb +7 -6
- data/lib/phase/configuration.rb +12 -6
- data/lib/phase/kit/deploy/build.rb +30 -9
- data/lib/phase/kit/deploy/deployment.rb +15 -15
- data/lib/phase/version.rb +1 -1
- data/phase.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff87524fd331aa1846e689747bc4775a3df69f7d
|
4
|
+
data.tar.gz: ac049168017802c12ae6ed6b62c202b6c683704f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2358fef15cabba6491fae0977b28790efa8b4e1a16d308c8483951d046ec78a4d038da7291fde10c061acf96e1cfec3047f8f76e396b88e5928135afaf26ed8e
|
7
|
+
data.tar.gz: 12d985acdbd1f5624517270a12314d55c9a3335bc8945965b3b52a6fdfd40c36f89fdc9062b1ede3951cc94807625251496a24d2db0b3616d6464a585474e353
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.12
|
data/lib/phase/cli/deploy.rb
CHANGED
@@ -23,12 +23,13 @@ module Phase
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def run
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
if environment == "sandbox"
|
27
|
+
deployment = ::Phase::Deploy::SandboxDeployment.new
|
28
|
+
else
|
29
|
+
deployment = ::Phase::Deploy::Deployment.new(environment)
|
30
|
+
end
|
31
|
+
|
32
|
+
deployment.execute!
|
32
33
|
end
|
33
34
|
|
34
35
|
end
|
data/lib/phase/configuration.rb
CHANGED
@@ -23,12 +23,18 @@ module Phase
|
|
23
23
|
end
|
24
24
|
|
25
25
|
# Available options:
|
26
|
-
# *
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
#
|
26
|
+
# * docker_repository [String]
|
27
|
+
def deploy
|
28
|
+
@deploy ||= ::ActiveSupport::OrderedOptions.new
|
29
|
+
end
|
30
|
+
|
31
|
+
# Available options:
|
32
|
+
# * bundle_id_prefix [String]
|
33
|
+
# * directory_prefix [String]
|
34
|
+
# * bucket_name [String]
|
35
|
+
# * company_name [String]
|
36
|
+
# * full_image_url [String]
|
37
|
+
# * icon_image_url [String]
|
32
38
|
def ipa
|
33
39
|
@ipa ||= ::ActiveSupport::OrderedOptions.new
|
34
40
|
end
|
@@ -2,15 +2,16 @@ module Phase
|
|
2
2
|
module Deploy
|
3
3
|
|
4
4
|
class Build
|
5
|
-
attr_reader :version_tag
|
5
|
+
attr_reader :version_tag, :build_dir
|
6
6
|
|
7
|
-
def initialize(version_tag)
|
7
|
+
def initialize(version_tag, options = {})
|
8
8
|
@version_tag = version_tag
|
9
|
+
@build_dir = options.fetch(:build_dir, "./build")
|
9
10
|
end
|
10
11
|
|
11
12
|
def execute
|
12
13
|
build_image
|
13
|
-
|
14
|
+
tag_image
|
14
15
|
push
|
15
16
|
end
|
16
17
|
|
@@ -18,28 +19,48 @@ module Phase
|
|
18
19
|
|
19
20
|
def build_image
|
20
21
|
clear_build_dir
|
21
|
-
|
22
|
-
system("docker build -t #{repo_name}:#{version_tag}
|
22
|
+
clone_local_repo
|
23
|
+
system("docker build -t #{repo_name}:#{version_tag} #{build_dir}")
|
23
24
|
end
|
24
25
|
|
25
|
-
def
|
26
|
+
def clear_build_dir
|
27
|
+
::FileUtils.mkdir_p(build_dir)
|
28
|
+
end
|
29
|
+
|
30
|
+
def clone_local_repo
|
31
|
+
system("git clone --depth 1 -- file://$(pwd) #{build_dir}")
|
32
|
+
end
|
33
|
+
|
34
|
+
def tag_image
|
26
35
|
system("docker tag #{repo_name}:#{version_tag} #{repo_name}:latest")
|
27
36
|
end
|
28
37
|
|
29
38
|
def push
|
30
39
|
system("docker push #{repo_name}:#{version_tag}")
|
40
|
+
system("docker push #{repo_name}:latest")
|
31
41
|
end
|
32
42
|
|
33
43
|
def repo_name
|
34
|
-
::Phase.config.docker_repository
|
44
|
+
::Phase.config.deploy.docker_repository
|
35
45
|
end
|
36
46
|
end
|
37
47
|
|
38
48
|
|
39
49
|
class SandboxBuild < Build
|
40
|
-
def
|
41
|
-
|
50
|
+
def execute
|
51
|
+
build_image
|
52
|
+
push
|
42
53
|
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def build_image
|
58
|
+
system("docker build -t #{repo_name}:#{version_tag} .")
|
59
|
+
end
|
60
|
+
|
61
|
+
def push
|
62
|
+
system("docker push #{repo_name}:#{version_tag}")
|
63
|
+
end
|
43
64
|
end
|
44
65
|
|
45
66
|
end
|
@@ -1,26 +1,26 @@
|
|
1
1
|
module Phase
|
2
2
|
module Deploy
|
3
|
-
class Deployment
|
4
|
-
|
5
|
-
# environment
|
6
|
-
# build options
|
7
|
-
# tag strategy
|
8
|
-
# server options
|
9
|
-
# environment name
|
10
|
-
# role name
|
11
3
|
|
12
|
-
|
4
|
+
class Deployment
|
5
|
+
attr_reader :environment, :build
|
13
6
|
|
14
7
|
def initialize(environment, options = {})
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
else
|
19
|
-
self.build = Build.new
|
20
|
-
end
|
8
|
+
@environment = environment
|
9
|
+
@build = Build.new(options[:version_tag])
|
10
|
+
end
|
21
11
|
|
12
|
+
def execute!
|
13
|
+
@build.execute
|
14
|
+
deploy_image
|
15
|
+
end
|
16
|
+
end
|
22
17
|
|
18
|
+
|
19
|
+
class SandboxDeployment < Deployment
|
20
|
+
def initialize(options = {})
|
21
|
+
@build = SandboxBuild.new(options[:version_tag])
|
23
22
|
end
|
24
23
|
end
|
24
|
+
|
25
25
|
end
|
26
26
|
end
|
data/lib/phase/version.rb
CHANGED
data/phase.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_runtime_dependency 'fog', '~> 1.23'
|
28
28
|
spec.add_runtime_dependency 'capistrano', '~> 3.2'
|
29
29
|
spec.add_runtime_dependency 'colorize', '~> 0.7'
|
30
|
-
spec.add_runtime_dependency 'dotenv', '~> 0
|
30
|
+
spec.add_runtime_dependency 'dotenv', '~> 2.0'
|
31
31
|
|
32
32
|
spec.add_development_dependency 'bundler', '~> 1.6'
|
33
33
|
spec.add_development_dependency 'rake', '~> 10.1'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piers Mainwaring
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-04-
|
12
|
+
date: 2015-04-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: commander
|
@@ -115,14 +115,14 @@ dependencies:
|
|
115
115
|
requirements:
|
116
116
|
- - "~>"
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version: '0
|
118
|
+
version: '2.0'
|
119
119
|
type: :runtime
|
120
120
|
prerelease: false
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
123
|
- - "~>"
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version: '0
|
125
|
+
version: '2.0'
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: bundler
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|