rna 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +18 -9
- data/lib/rna/dsl.rb +8 -0
- data/lib/rna/version.rb +1 -1
- data/spec/project/config/rna/api.rb +18 -0
- data/spec/project/config/rna/masta.rb +12 -0
- data/spec/project/config/rna.rb +0 -30
- metadata +8 -4
data/README.md
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
Rna gem
|
2
|
-
===========
|
1
|
+
# Rna gem
|
3
2
|
|
4
3
|
[![Build History][2]][1]
|
5
4
|
|
@@ -8,15 +7,13 @@ Rna gem
|
|
8
7
|
|
9
8
|
Rna is a ruby gem that provides simple DSL for generating node.json files required by chef-solo.
|
10
9
|
|
11
|
-
Requirements
|
12
|
-
------------
|
10
|
+
## Requirements
|
13
11
|
|
14
12
|
<pre>
|
15
13
|
$ gem install rna
|
16
14
|
</pre>
|
17
15
|
|
18
|
-
Usage
|
19
|
-
------------
|
16
|
+
## Usage
|
20
17
|
|
21
18
|
<pre>
|
22
19
|
$ mkdir rna_project
|
@@ -26,8 +23,9 @@ $ rna init
|
|
26
23
|
|
27
24
|
This will sets starter config/rna.rb and config/s3.yml files.
|
28
25
|
|
29
|
-
Example
|
30
|
-
|
26
|
+
### Example:
|
27
|
+
|
28
|
+
#### config/rna.rb file
|
31
29
|
|
32
30
|
```ruby
|
33
31
|
# This is starter example rna template.
|
@@ -184,6 +182,8 @@ output/stag-api-resque.json:
|
|
184
182
|
}
|
185
183
|
```
|
186
184
|
|
185
|
+
#### Uploading to S3
|
186
|
+
|
187
187
|
<pre>
|
188
188
|
$ rna build -o s3 # saves s3 based on config/s3.yml settings
|
189
189
|
</pre>
|
@@ -195,4 +195,13 @@ access_key_id: hocuspocus
|
|
195
195
|
secret_access_key: opensesame
|
196
196
|
bucket: my-bucket
|
197
197
|
folder: chef/rna
|
198
|
-
```
|
198
|
+
```
|
199
|
+
|
200
|
+
#### Breaking up config/rna.rb
|
201
|
+
|
202
|
+
If you have a lot of roles, the config/rna.rb file can get unwieldy long. You can break up the rna.rb file and put role defintions in the config/rna directory. Any file in this directory will be automatically loaded.
|
203
|
+
|
204
|
+
An example is in the spec/project folder:
|
205
|
+
|
206
|
+
* config/rna/api.rb
|
207
|
+
* config/rna/masta.rb
|
data/lib/rna/dsl.rb
CHANGED
@@ -13,6 +13,14 @@ module Rna
|
|
13
13
|
|
14
14
|
def evaluate
|
15
15
|
instance_eval(File.read(@path), @path)
|
16
|
+
load_roles
|
17
|
+
end
|
18
|
+
|
19
|
+
# load any roles defined in project/config/rna/*
|
20
|
+
def load_roles
|
21
|
+
Dir.glob("#{File.dirname(@path)}/rna/*").each do |path|
|
22
|
+
instance_eval(File.read(path), path)
|
23
|
+
end
|
16
24
|
end
|
17
25
|
|
18
26
|
def global(options={},&block)
|
data/lib/rna/version.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
# api
|
2
|
+
role 'prod-api-redis', 'stag-api-redis'
|
3
|
+
role 'prod-api-resque', 'stag-api-resque' do
|
4
|
+
inherits 'prod-api-app'
|
5
|
+
set 'workers', 8
|
6
|
+
end
|
7
|
+
role 'prod-api-app', 'stag-api-app' do
|
8
|
+
role_list ['base','api_app']
|
9
|
+
set 'application', 'api'
|
10
|
+
set 'deploy_code', true
|
11
|
+
set 'repository', 'git@github.com:br/api.git'
|
12
|
+
set 'scout', {
|
13
|
+
'key' => 'abc',
|
14
|
+
'gems' => {
|
15
|
+
'redis' => nil
|
16
|
+
}
|
17
|
+
}
|
18
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# masta
|
2
|
+
role 'masta-app' do
|
3
|
+
output false
|
4
|
+
set 'masta_app', 123
|
5
|
+
end
|
6
|
+
role 'prod-masta-redis', 'stag-masta-redis'
|
7
|
+
role 'prod-masta-android', 'stag-masta-android' do
|
8
|
+
inherits 'masta-app'
|
9
|
+
set 'application', 'masta'
|
10
|
+
set 'deploy_code', true
|
11
|
+
set 'repository', 'git@github.com:arockwell/masta_blasta.git'
|
12
|
+
end
|
data/spec/project/config/rna.rb
CHANGED
@@ -21,36 +21,6 @@ end
|
|
21
21
|
role 'base' do
|
22
22
|
role_list ['base']
|
23
23
|
end
|
24
|
-
# api
|
25
|
-
role 'prod-api-redis', 'stag-api-redis'
|
26
|
-
role 'prod-api-resque', 'stag-api-resque' do
|
27
|
-
inherits 'prod-api-app'
|
28
|
-
set 'workers', 8
|
29
|
-
end
|
30
|
-
role 'prod-api-app', 'stag-api-app' do
|
31
|
-
role_list ['base','api_app']
|
32
|
-
set 'application', 'api'
|
33
|
-
set 'deploy_code', true
|
34
|
-
set 'repository', 'git@github.com:br/api.git'
|
35
|
-
set 'scout', {
|
36
|
-
'key' => 'abc',
|
37
|
-
'gems' => {
|
38
|
-
'redis' => nil
|
39
|
-
}
|
40
|
-
}
|
41
|
-
end
|
42
|
-
# masta
|
43
|
-
role 'masta-app' do
|
44
|
-
output false
|
45
|
-
set 'masta_app', 123
|
46
|
-
end
|
47
|
-
role 'prod-masta-redis', 'stag-masta-redis'
|
48
|
-
role 'prod-masta-android', 'stag-masta-android' do
|
49
|
-
inherits 'masta-app'
|
50
|
-
set 'application', 'masta'
|
51
|
-
set 'deploy_code', true
|
52
|
-
set 'repository', 'git@github.com:arockwell/masta_blasta.git'
|
53
|
-
end
|
54
24
|
|
55
25
|
###################################
|
56
26
|
# Post processing rules that run at the end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rna
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -188,6 +188,8 @@ files:
|
|
188
188
|
- rna.gemspec
|
189
189
|
- spec/lib/rna_spec.rb
|
190
190
|
- spec/project/config/rna.rb
|
191
|
+
- spec/project/config/rna/api.rb
|
192
|
+
- spec/project/config/rna/masta.rb
|
191
193
|
- spec/project/config/s3.example.yml
|
192
194
|
- spec/project2/.gitkeep
|
193
195
|
- spec/project2/Guardfile
|
@@ -205,7 +207,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
205
207
|
version: '0'
|
206
208
|
segments:
|
207
209
|
- 0
|
208
|
-
hash:
|
210
|
+
hash: 2001643032789055325
|
209
211
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
210
212
|
none: false
|
211
213
|
requirements:
|
@@ -214,7 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
216
|
version: '0'
|
215
217
|
segments:
|
216
218
|
- 0
|
217
|
-
hash:
|
219
|
+
hash: 2001643032789055325
|
218
220
|
requirements: []
|
219
221
|
rubyforge_project:
|
220
222
|
rubygems_version: 1.8.24
|
@@ -225,6 +227,8 @@ summary: Rna is a ruby gem that provides simple DSL for generating node.json fil
|
|
225
227
|
test_files:
|
226
228
|
- spec/lib/rna_spec.rb
|
227
229
|
- spec/project/config/rna.rb
|
230
|
+
- spec/project/config/rna/api.rb
|
231
|
+
- spec/project/config/rna/masta.rb
|
228
232
|
- spec/project/config/s3.example.yml
|
229
233
|
- spec/project2/.gitkeep
|
230
234
|
- spec/project2/Guardfile
|