heroploy 0.0.4 → 0.0.5
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/.gitignore +2 -0
- data/README.md +3 -0
- data/lib/generators/heroploy/install/templates/config/heroploy.yml +36 -0
- data/lib/heroploy/commands/checks.rb +9 -0
- data/lib/heroploy/commands/git.rb +11 -0
- data/lib/heroploy/commands/heroku.rb +10 -4
- data/lib/heroploy/config/deployment_config.rb +17 -3
- data/lib/heroploy/config/environment.rb +2 -0
- data/lib/heroploy/config/remote_config.rb +15 -0
- data/lib/heroploy/config/shared_env.rb +14 -0
- data/lib/heroploy/tasks/check_task_lib.rb +9 -0
- data/lib/heroploy/tasks/deploy_task_lib.rb +18 -0
- data/lib/heroploy/tasks/env_task_lib.rb +6 -1
- data/lib/heroploy/tasks/env_var_task_lib.rb +79 -0
- data/lib/heroploy/version.rb +1 -1
- data/spec/lib/heroploy/commands/checks_spec.rb +41 -0
- data/spec/lib/heroploy/commands/git_spec.rb +7 -0
- data/spec/lib/heroploy/commands/heroku_spec.rb +9 -0
- data/spec/lib/heroploy/config/deployment_config_spec.rb +51 -7
- data/spec/lib/heroploy/config/environment_checks_spec.rb +0 -4
- data/spec/lib/heroploy/config/environment_spec.rb +3 -1
- data/spec/lib/heroploy/config/remote_config_spec.rb +32 -0
- data/spec/lib/heroploy/config/shared_env_spec.rb +16 -0
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 105eedfe09a02a9d37fa4f51a66a85be998488ab
|
4
|
+
data.tar.gz: eb15f7c1627dc9cfdef4f6531aaf675f145b7bbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3357bd2d6a57371ed2b33609baf2b867debdd1fa3798df6dbd89628f028cb5c8110333e08f4868cb06c464dd034af4d37f03f3f498598a2490944b41849554c
|
7
|
+
data.tar.gz: 5f8b1062cab707cd0c540810f07c6df7919d6a51ab3eed7fed078ed0627bbde45d6edd19b9dce2372763c9ee520ca4e468763b8d6431b8190a178cf560bcc40f
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -23,6 +23,9 @@ Or install it yourself as:
|
|
23
23
|
|
24
24
|
## Usage
|
25
25
|
|
26
|
+
**See [Configuring Heroploy](https://github.com/jbrunton/heroploy/wiki/Configuring-Heroploy) for a more detailed description of the options available.**
|
27
|
+
|
28
|
+
|
26
29
|
Add a ```heroploy.yml``` file to your application's config directory which describes the Heroku apps you will deploy to, and the checks you would like when deploying to each.
|
27
30
|
|
28
31
|
If you're running Rails, you can use this generator to add an example config file:
|
@@ -1,3 +1,30 @@
|
|
1
|
+
# This file shows you how to configure your Heroploy environments. For more
|
2
|
+
# details see https://github.com/jbrunton/heroploy/wiki/Configuring-Heroploy
|
3
|
+
|
4
|
+
load_configs:
|
5
|
+
|
6
|
+
# If you wish to define parts of your config file (e.g. secret keys) in a
|
7
|
+
# private repository, you can load these files here:
|
8
|
+
#
|
9
|
+
# my_private_config:
|
10
|
+
# repo: git.example.com:my-private-repo
|
11
|
+
# file: config/heroploy.yml
|
12
|
+
|
13
|
+
common:
|
14
|
+
required:
|
15
|
+
|
16
|
+
# List any configuration variables which should be defined for each environment
|
17
|
+
# here. For example, if you require each to have a facebook_app_key:
|
18
|
+
#
|
19
|
+
# - facebook_app_key
|
20
|
+
|
21
|
+
variables:
|
22
|
+
|
23
|
+
# If you wish to define any variables which should be common to all
|
24
|
+
# environments, add them here:
|
25
|
+
#
|
26
|
+
# facebook_app_key: a1b2c3
|
27
|
+
|
1
28
|
environments:
|
2
29
|
|
3
30
|
# Add a development environment, to which you can deploy anything:
|
@@ -25,6 +52,15 @@ environments:
|
|
25
52
|
# branch: master
|
26
53
|
# staged: true
|
27
54
|
|
55
|
+
# If you want to set any config vars on your Heroku apps, you can define them
|
56
|
+
# on a per-environment basis:
|
57
|
+
|
58
|
+
# development:
|
59
|
+
# app: my-development-app
|
60
|
+
# variables:
|
61
|
+
# facebook_app_key: a1b2c3
|
62
|
+
|
63
|
+
|
28
64
|
# Finally, if you have a single Heroku app, this should work for now:
|
29
65
|
|
30
66
|
heroku:
|
@@ -28,6 +28,15 @@ module Heroploy
|
|
28
28
|
raise "Changes not yet staged on #{env_name}"
|
29
29
|
end
|
30
30
|
end
|
31
|
+
|
32
|
+
def check_config(shared_env, env_config)
|
33
|
+
merged_keys = shared_env.variables.keys.concat(env_config.variables.keys)
|
34
|
+
shared_env.required.each do |key|
|
35
|
+
unless merged_keys.include?(key)
|
36
|
+
raise "Missing config value for '#{key}'"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
31
40
|
end
|
32
41
|
end
|
33
42
|
end
|
@@ -43,6 +43,17 @@ module Heroploy
|
|
43
43
|
def git_push_tag(tag)
|
44
44
|
Shell.exec("git push origin #{tag}")
|
45
45
|
end
|
46
|
+
|
47
|
+
def git_clone(repository, destination)
|
48
|
+
Dir.mktmpdir do |dir|
|
49
|
+
Dir.chdir(dir) do
|
50
|
+
Shell.exec("git clone #{repository} #{destination}")
|
51
|
+
if block_given?
|
52
|
+
yield
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
46
57
|
end
|
47
58
|
end
|
48
59
|
end
|
@@ -4,7 +4,9 @@ module Heroploy
|
|
4
4
|
module Commands
|
5
5
|
module Heroku
|
6
6
|
def heroku_exec(cmd, app_name)
|
7
|
-
|
7
|
+
Bundler.with_clean_env do
|
8
|
+
Shell.exec "heroku #{cmd} --app #{app_name}"
|
9
|
+
end
|
8
10
|
end
|
9
11
|
|
10
12
|
def heroku_run(cmd, app_name)
|
@@ -12,9 +14,13 @@ module Heroploy
|
|
12
14
|
end
|
13
15
|
|
14
16
|
def heroku_migrate(app_name)
|
15
|
-
|
16
|
-
|
17
|
-
|
17
|
+
heroku_run("rake db:migrate", app_name)
|
18
|
+
end
|
19
|
+
|
20
|
+
def heroku_config_set(shared_vars, env_vars, app_name)
|
21
|
+
merged_vars = shared_vars.merge(env_vars)
|
22
|
+
vars_string = merged_vars.collect.map{|key,value| "#{key}=#{value}"}.join(" ")
|
23
|
+
heroku_exec("config:set #{vars_string}", app_name)
|
18
24
|
end
|
19
25
|
end
|
20
26
|
end
|
@@ -1,10 +1,14 @@
|
|
1
1
|
require 'heroploy/config/deployment_config'
|
2
2
|
require 'heroploy/config/environment'
|
3
|
+
require 'heroploy/config/shared_env'
|
4
|
+
require 'heroploy/config/remote_config'
|
3
5
|
|
4
6
|
module Heroploy
|
5
7
|
module Config
|
6
8
|
class DeploymentConfig
|
7
9
|
attr_accessor :environments
|
10
|
+
attr_accessor :shared_env
|
11
|
+
attr_accessor :remote_configs
|
8
12
|
|
9
13
|
def [](env_name)
|
10
14
|
environments.select{ |env| env.name == env_name }.first
|
@@ -12,12 +16,22 @@ module Heroploy
|
|
12
16
|
|
13
17
|
def initialize(attrs = {})
|
14
18
|
unless attrs['environments'].nil?
|
15
|
-
@environments = attrs['environments'].map { |name,
|
19
|
+
@environments = attrs['environments'].map { |name, env_attrs| Environment.new(name, env_attrs) }
|
16
20
|
end
|
21
|
+
unless attrs['load_configs'].nil?
|
22
|
+
@remote_configs = attrs['load_configs'].map { |name, remote_config_attrs| RemoteConfig.new(name, remote_config_attrs) }
|
23
|
+
end
|
24
|
+
@shared_env = SharedEnv.new(attrs['common'])
|
17
25
|
end
|
18
26
|
|
19
|
-
def self.load
|
20
|
-
DeploymentConfig.new(YAML::load(File.open(
|
27
|
+
def self.load(filename = 'config/heroploy.yml')
|
28
|
+
DeploymentConfig.new(YAML::load(File.open(filename)))
|
29
|
+
end
|
30
|
+
|
31
|
+
def merge_config(deployment_config)
|
32
|
+
deployment_config.environments.each do |env_config|
|
33
|
+
self[env_config.name].variables.merge!(env_config.variables)
|
34
|
+
end
|
21
35
|
end
|
22
36
|
end
|
23
37
|
end
|
@@ -8,12 +8,14 @@ module Heroploy
|
|
8
8
|
attr_accessor :app
|
9
9
|
attr_accessor :tag
|
10
10
|
attr_accessor :checks
|
11
|
+
attr_accessor :variables
|
11
12
|
|
12
13
|
def initialize(name = nil, attrs = {})
|
13
14
|
@name = name
|
14
15
|
@remote = attrs['remote'] || name
|
15
16
|
@app = attrs['app']
|
16
17
|
@tag = attrs['tag']
|
18
|
+
@variables = attrs['variables'] || {}
|
17
19
|
@checks = EnvironmentChecks.new(attrs['checks'])
|
18
20
|
end
|
19
21
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Heroploy
|
2
|
+
module Config
|
3
|
+
class RemoteConfig
|
4
|
+
attr_accessor :name
|
5
|
+
attr_accessor :repository
|
6
|
+
attr_accessor :files
|
7
|
+
|
8
|
+
def initialize(name, attrs = {})
|
9
|
+
@name = name
|
10
|
+
@repository = attrs['repository']
|
11
|
+
@files = attrs['file'] ? [attrs['file']] : attrs['files']
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -29,6 +29,7 @@ module Heroploy
|
|
29
29
|
define_pushed_check
|
30
30
|
define_branch_check
|
31
31
|
define_staged_check
|
32
|
+
define_config_check
|
32
33
|
define_all_check
|
33
34
|
end
|
34
35
|
|
@@ -73,6 +74,14 @@ module Heroploy
|
|
73
74
|
@defined_tasks << :staged
|
74
75
|
end
|
75
76
|
end
|
77
|
+
|
78
|
+
def define_config_check
|
79
|
+
desc "check all required config variables are defined"
|
80
|
+
task :config => :load_remote_configs do
|
81
|
+
check_config(deploy_config.shared_env, env_config)
|
82
|
+
end
|
83
|
+
@defined_tasks << :config
|
84
|
+
end
|
76
85
|
|
77
86
|
def define_all_check
|
78
87
|
desc "do all the checks for #{env_config.name}"
|
@@ -2,6 +2,7 @@ require 'rake/tasklib'
|
|
2
2
|
|
3
3
|
require 'heroploy/commands/git'
|
4
4
|
require 'heroploy/tasks/env_task_lib'
|
5
|
+
require 'heroploy/config/deployment_config'
|
5
6
|
|
6
7
|
module Heroploy
|
7
8
|
module Tasks
|
@@ -18,6 +19,7 @@ module Heroploy
|
|
18
19
|
|
19
20
|
def define
|
20
21
|
define_fetch_task
|
22
|
+
define_load_configs_task
|
21
23
|
define_env_tasks
|
22
24
|
end
|
23
25
|
|
@@ -27,6 +29,22 @@ module Heroploy
|
|
27
29
|
git_fetch
|
28
30
|
end
|
29
31
|
end
|
32
|
+
|
33
|
+
def define_load_configs_task
|
34
|
+
desc 'load remote configs'
|
35
|
+
task :load_remote_configs do
|
36
|
+
unless deployment_config.remote_configs.nil?
|
37
|
+
deployment_config.remote_configs.each do |remote_config|
|
38
|
+
git_clone(remote_config.repository, remote_config.name) do
|
39
|
+
remote_config.files.each do |filename|
|
40
|
+
config_file = File.join(Dir.pwd, remote_config.name, filename)
|
41
|
+
deployment_config.merge_config(Heroploy::Config::DeploymentConfig.load(config_file))
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
30
48
|
|
31
49
|
def define_env_tasks
|
32
50
|
deployment_config.environments.each do |env|
|
@@ -59,9 +59,14 @@ module Heroploy
|
|
59
59
|
task :migrate do
|
60
60
|
heroku_migrate(env.app)
|
61
61
|
end
|
62
|
+
|
63
|
+
desc "set config variables"
|
64
|
+
task :config => :load_remote_configs do
|
65
|
+
heroku_config_set(deployment_config.shared_env.variables, env.variables, env.app)
|
66
|
+
end
|
62
67
|
|
63
68
|
desc "deploy to #{env.name}"
|
64
|
-
task :deploy => ['check:all', :push, :migrate, :tag]
|
69
|
+
task :deploy => ['check:all', :push, :config, :migrate, :tag]
|
65
70
|
end
|
66
71
|
end
|
67
72
|
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# require 'rake/tasklib'
|
2
|
+
#
|
3
|
+
# require 'heroploy/commands/heroku'
|
4
|
+
# require 'heroploy/commands/git'
|
5
|
+
# require 'heroploy/commands/checks'
|
6
|
+
#
|
7
|
+
# module Heroploy
|
8
|
+
# module Tasks
|
9
|
+
# class EnvVarTaskLib < ::Rake::TaskLib
|
10
|
+
# include ::Rake::DSL if defined?(::Rake::DSL)
|
11
|
+
#
|
12
|
+
# include Commands::Git
|
13
|
+
# include Commands::Heroku
|
14
|
+
# include Commands::Checks
|
15
|
+
#
|
16
|
+
# def initialize(deploy_config)
|
17
|
+
# @deploy_config = deploy_config
|
18
|
+
# @env_config = env_config
|
19
|
+
# @defined_tasks = []
|
20
|
+
# define
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# def define
|
24
|
+
# define_remote_check
|
25
|
+
# define_pushed_check
|
26
|
+
# define_branch_check
|
27
|
+
# define_staged_check
|
28
|
+
# define_all_check
|
29
|
+
# end
|
30
|
+
#
|
31
|
+
# def define_remote_check
|
32
|
+
# desc "check remote exists for #{env_config.name}"
|
33
|
+
# task :remote do
|
34
|
+
# remote = env_config.remote
|
35
|
+
# check_remote(remote)
|
36
|
+
# end
|
37
|
+
#
|
38
|
+
# @defined_tasks << :remote
|
39
|
+
# end
|
40
|
+
#
|
41
|
+
# def define_pushed_check
|
42
|
+
# if env_config.checks.pushed then
|
43
|
+
# desc "check changes have been pushed to origin"
|
44
|
+
# task :pushed do
|
45
|
+
# check_pushed(current_branch)
|
46
|
+
# end
|
47
|
+
# @defined_tasks << :pushed
|
48
|
+
# end
|
49
|
+
# end
|
50
|
+
#
|
51
|
+
# def define_branch_check
|
52
|
+
# if env_config.checks.branch then
|
53
|
+
# desc "check we can deploy to #{env_config.name} from the current branch"
|
54
|
+
# task :branch do
|
55
|
+
# valid_branch = env_config.checks.branch
|
56
|
+
# check_branch(current_branch, valid_branch, env_config.name)
|
57
|
+
# end
|
58
|
+
# @defined_tasks << :branch
|
59
|
+
# end
|
60
|
+
# end
|
61
|
+
#
|
62
|
+
# def define_staged_check
|
63
|
+
# if env_config.checks.staged then
|
64
|
+
# desc "check the changes have already been staged"
|
65
|
+
# task :staged do
|
66
|
+
# staging_env_config = deploy_config[env_config.checks.staged]
|
67
|
+
# check_staged(staging_env_config.remote, current_branch, staging_env_config.name)
|
68
|
+
# end
|
69
|
+
# @defined_tasks << :staged
|
70
|
+
# end
|
71
|
+
# end
|
72
|
+
#
|
73
|
+
# def define_all_check
|
74
|
+
# desc "do all the checks for #{env_config.name}"
|
75
|
+
# task :all => @defined_tasks
|
76
|
+
# end
|
77
|
+
# end
|
78
|
+
# end
|
79
|
+
# end
|
data/lib/heroploy/version.rb
CHANGED
@@ -95,4 +95,45 @@ describe Heroploy::Commands::Checks do
|
|
95
95
|
end
|
96
96
|
end
|
97
97
|
end
|
98
|
+
|
99
|
+
describe "#check_config" do
|
100
|
+
context "given a required variable" do
|
101
|
+
let(:required) { ['my-var'] }
|
102
|
+
|
103
|
+
context "if the shared environment defines the variable" do
|
104
|
+
let(:shared_attrs) { {'required' => required, 'variables' => {'my-var' => 'some-value'}} }
|
105
|
+
let(:env_vars) { {} }
|
106
|
+
let(:shared_env) { Heroploy::Config::SharedEnv.new(shared_attrs) }
|
107
|
+
let(:env) { Heroploy::Config::Environment.new('my-env', {'variables' => env_vars}) }
|
108
|
+
|
109
|
+
it "it executes successfully if the variables " do
|
110
|
+
commands.check_config(shared_env, env)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
context "if the Heroku environment defines the variable" do
|
115
|
+
let(:shared_attrs) { {'required' => required, 'variables' => {}} }
|
116
|
+
let(:env_vars) { {'my-var' => 'some-value'} }
|
117
|
+
let(:shared_env) { Heroploy::Config::SharedEnv.new(shared_attrs) }
|
118
|
+
let(:env) { Heroploy::Config::Environment.new('my-env', {'variables' => env_vars}) }
|
119
|
+
|
120
|
+
it "it executes successfully if the variables " do
|
121
|
+
commands.check_config(shared_env, env)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
context "if a required variable is missing a value" do
|
126
|
+
let(:shared_attrs) { {'required' => required, 'variables' => {}} }
|
127
|
+
let(:env_vars) { {} }
|
128
|
+
let(:shared_env) { Heroploy::Config::SharedEnv.new(shared_attrs) }
|
129
|
+
let(:env) { Heroploy::Config::Environment.new('my-env', {'variables' => env_vars}) }
|
130
|
+
|
131
|
+
it "raises an error" do
|
132
|
+
expect{
|
133
|
+
commands.check_config(shared_env, env)
|
134
|
+
}.to raise_error("Missing config value for 'my-var'")
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
98
139
|
end
|
@@ -122,4 +122,11 @@ describe Heroploy::Commands::Git do
|
|
122
122
|
commands.git_push_tag("my-tag")
|
123
123
|
end
|
124
124
|
end
|
125
|
+
|
126
|
+
context "#git_clone" do
|
127
|
+
it "clones the given repository" do
|
128
|
+
expect_command("git clone git.example.com:my-repo destination-path")
|
129
|
+
commands.git_clone("git.example.com:my-repo", "destination-path")
|
130
|
+
end
|
131
|
+
end
|
125
132
|
end
|
@@ -27,4 +27,13 @@ describe Heroploy::Commands::Heroku do
|
|
27
27
|
commands.heroku_migrate("my-app")
|
28
28
|
end
|
29
29
|
end
|
30
|
+
|
31
|
+
context "#heroku_config_set" do
|
32
|
+
it "sets the values for the given config variables" do
|
33
|
+
common_vars = {'foo' => 'foo'}
|
34
|
+
env_vars = {'bar' => 'bar'}
|
35
|
+
expect_command("heroku config:set foo=foo bar=bar --app my-app")
|
36
|
+
commands.heroku_config_set(common_vars, env_vars, "my-app")
|
37
|
+
end
|
38
|
+
end
|
30
39
|
end
|
@@ -3,18 +3,36 @@ require 'spec_helper'
|
|
3
3
|
describe Heroploy::Config::DeploymentConfig do
|
4
4
|
before(:each) { stub_shell }
|
5
5
|
|
6
|
-
let(:attrs)
|
6
|
+
let(:attrs) do
|
7
|
+
{
|
8
|
+
'environments' => {
|
9
|
+
'staging' => {},
|
10
|
+
'production' => {
|
11
|
+
'variables' => {'foo' => 'foo'}
|
12
|
+
}
|
13
|
+
},
|
14
|
+
'common' => {
|
15
|
+
'required' => ['my-var'],
|
16
|
+
'variables' => {'my-var' => 'some-value'}
|
17
|
+
}
|
18
|
+
}
|
19
|
+
end
|
7
20
|
|
8
21
|
subject(:deployment_config) { Heroploy::Config::DeploymentConfig.new(attrs) }
|
9
22
|
|
10
|
-
|
23
|
+
describe "#initialize" do
|
11
24
|
context "it initializes its environments" do
|
12
25
|
its(:environments) { should include an_environment_named(:staging) }
|
13
26
|
its(:environments) { should include an_environment_named(:production) }
|
14
27
|
end
|
28
|
+
|
29
|
+
context "it initializes its environment variables" do
|
30
|
+
its('shared_env.required') { should eq(['my-var']) }
|
31
|
+
its('shared_env.variables') { should eq({'my-var' => 'some-value'}) }
|
32
|
+
end
|
15
33
|
end
|
16
34
|
|
17
|
-
|
35
|
+
describe "#[]" do
|
18
36
|
it "returns the environment with the given name, if one exists" do
|
19
37
|
expect(deployment_config['staging']).to be_an_environment_named(:staging)
|
20
38
|
end
|
@@ -24,19 +42,45 @@ describe Heroploy::Config::DeploymentConfig do
|
|
24
42
|
end
|
25
43
|
end
|
26
44
|
|
27
|
-
|
45
|
+
describe "#merge_config" do
|
46
|
+
let(:other_config) do
|
47
|
+
build(:deployment_config, environments: [
|
48
|
+
build(:environment, :production, variables: {'bar' => 'bar'})
|
49
|
+
])
|
50
|
+
end
|
51
|
+
|
52
|
+
it "merges the environment variables defined by the other config" do
|
53
|
+
deployment_config.merge_config(other_config)
|
54
|
+
expect(deployment_config['production'].variables).to include('foo' => 'foo')
|
55
|
+
expect(deployment_config['production'].variables).to include('bar' => 'bar')
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe ".load" do
|
28
60
|
let(:yaml_config) do
|
29
61
|
<<-END
|
62
|
+
common:
|
63
|
+
required:
|
64
|
+
- my-var
|
65
|
+
variables:
|
66
|
+
my-var: some-value
|
30
67
|
environments:
|
31
68
|
heroku:
|
32
69
|
app: my-app
|
33
70
|
END
|
34
71
|
end
|
35
72
|
|
36
|
-
|
37
|
-
|
38
|
-
|
73
|
+
before { File.stub(:open).with('config/heroploy.yml').and_return(yaml_config) }
|
74
|
+
|
75
|
+
let(:deployment_config) { deployment_config = Heroploy::Config::DeploymentConfig.load }
|
76
|
+
|
77
|
+
it "it initializes the list of environments" do
|
39
78
|
expect(deployment_config.environments).to include an_environment_named(:heroku)
|
40
79
|
end
|
80
|
+
|
81
|
+
it "initializes the shared environment variables" do
|
82
|
+
expect(deployment_config.shared_env.required).to eq(['my-var'])
|
83
|
+
expect(deployment_config.shared_env.variables).to eq({ 'my-var' => 'some-value' })
|
84
|
+
end
|
41
85
|
end
|
42
86
|
end
|
@@ -8,7 +8,8 @@ describe Heroploy::Config::Environment do
|
|
8
8
|
let(:remote_name) { 'my-remote' }
|
9
9
|
let(:app_name) { 'my-app' }
|
10
10
|
let(:tag) { 'my-tag' }
|
11
|
-
let(:
|
11
|
+
let(:variables) { {'my-var' => 'some-value'} }
|
12
|
+
let(:attrs) { {'remote' => remote_name, 'app' => app_name, 'tag' => tag, 'variables' => variables} }
|
12
13
|
|
13
14
|
subject(:environment) { Heroploy::Config::Environment.new(env_name, attrs) }
|
14
15
|
|
@@ -16,6 +17,7 @@ describe Heroploy::Config::Environment do
|
|
16
17
|
its(:remote) { should eq(remote_name) }
|
17
18
|
its(:app) { should eq(app_name) }
|
18
19
|
its(:tag) { should eq(tag) }
|
20
|
+
its(:variables) { should eq(variables) }
|
19
21
|
its(:checks) { should be_instance_of(Heroploy::Config::EnvironmentChecks) }
|
20
22
|
end
|
21
23
|
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Heroploy::Config::RemoteConfig do
|
4
|
+
describe "#initialize" do
|
5
|
+
context "it initializes the accessors" do
|
6
|
+
let(:attrs) { {'repository' => 'my-repo.git'} }
|
7
|
+
subject(:remote_config) { Heroploy::Config::RemoteConfig.new('my-config', attrs) }
|
8
|
+
|
9
|
+
its(:name) { should eq('my-config') }
|
10
|
+
its(:repository) { should eq('my-repo.git') }
|
11
|
+
end
|
12
|
+
|
13
|
+
context "if a single file is defined" do
|
14
|
+
let(:attrs) { {'file' => 'config.yml'} }
|
15
|
+
subject(:remote_config) { Heroploy::Config::RemoteConfig.new('my-config', attrs) }
|
16
|
+
|
17
|
+
it "defines the :files accessor correctly" do
|
18
|
+
expect(remote_config.files).to eq(['config.yml'])
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context "if multiple files are defined" do
|
23
|
+
let(:attrs) { {'files' => ['config1.yml', 'config2.yml']} }
|
24
|
+
subject(:remote_config) { Heroploy::Config::RemoteConfig.new('my-config', attrs) }
|
25
|
+
|
26
|
+
it "defines the :files accessor correctly" do
|
27
|
+
expect(remote_config.files).to include('config1.yml')
|
28
|
+
expect(remote_config.files).to include('config2.yml')
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Heroploy::Config::SharedEnv do
|
4
|
+
describe "#initialize" do
|
5
|
+
context "it initializes the accessors" do
|
6
|
+
let(:variables) { {'my-var' => 'some-value'} }
|
7
|
+
let(:required) { ['my-var'] }
|
8
|
+
let(:attrs) { {'required' => required, 'variables' => variables} }
|
9
|
+
|
10
|
+
subject(:shared_env) { Heroploy::Config::SharedEnv.new(attrs) }
|
11
|
+
|
12
|
+
its(:required) { should eq(required) }
|
13
|
+
its(:variables) { should eq(variables) }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heroploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Brunton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -135,10 +135,13 @@ files:
|
|
135
135
|
- lib/heroploy/config/deployment_config.rb
|
136
136
|
- lib/heroploy/config/environment.rb
|
137
137
|
- lib/heroploy/config/environment_checks.rb
|
138
|
+
- lib/heroploy/config/remote_config.rb
|
139
|
+
- lib/heroploy/config/shared_env.rb
|
138
140
|
- lib/heroploy/engine.rb
|
139
141
|
- lib/heroploy/tasks/check_task_lib.rb
|
140
142
|
- lib/heroploy/tasks/deploy_task_lib.rb
|
141
143
|
- lib/heroploy/tasks/env_task_lib.rb
|
144
|
+
- lib/heroploy/tasks/env_var_task_lib.rb
|
142
145
|
- lib/heroploy/tasks/tasks.rake
|
143
146
|
- lib/heroploy/version.rb
|
144
147
|
- spec/factories.rb
|
@@ -150,6 +153,8 @@ files:
|
|
150
153
|
- spec/lib/heroploy/config/deployment_config_spec.rb
|
151
154
|
- spec/lib/heroploy/config/environment_checks_spec.rb
|
152
155
|
- spec/lib/heroploy/config/environment_spec.rb
|
156
|
+
- spec/lib/heroploy/config/remote_config_spec.rb
|
157
|
+
- spec/lib/heroploy/config/shared_env_spec.rb
|
153
158
|
- spec/lib/heroploy/tasks/check_all_spec.rb
|
154
159
|
- spec/lib/heroploy/tasks/check_branch_spec.rb
|
155
160
|
- spec/lib/heroploy/tasks/check_pushed_spec.rb
|
@@ -195,6 +200,8 @@ test_files:
|
|
195
200
|
- spec/lib/heroploy/config/deployment_config_spec.rb
|
196
201
|
- spec/lib/heroploy/config/environment_checks_spec.rb
|
197
202
|
- spec/lib/heroploy/config/environment_spec.rb
|
203
|
+
- spec/lib/heroploy/config/remote_config_spec.rb
|
204
|
+
- spec/lib/heroploy/config/shared_env_spec.rb
|
198
205
|
- spec/lib/heroploy/tasks/check_all_spec.rb
|
199
206
|
- spec/lib/heroploy/tasks/check_branch_spec.rb
|
200
207
|
- spec/lib/heroploy/tasks/check_pushed_spec.rb
|