asteroid 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/Gemfile +1 -0
- data/README.md +45 -4
- data/Rakefile +1 -0
- data/asteroid.gemspec +0 -1
- data/bin/asteroid +4 -2
- data/lib/asteroid.rb +11 -10
- data/lib/asteroid/application.rb +60 -7
- data/lib/asteroid/config.rb +28 -14
- data/lib/asteroid/file_reference.rb +102 -0
- data/lib/asteroid/generator.rb +0 -4
- data/lib/asteroid/instance.rb +29 -9
- data/lib/asteroid/instance/command.rb +71 -36
- data/lib/asteroid/instance/scp.rb +26 -0
- data/lib/asteroid/instance/ssh.rb +2 -1
- data/lib/asteroid/instance/vars.rb +5 -2
- data/lib/asteroid/key_reference.rb +45 -0
- data/lib/asteroid/provider/abstract.rb +16 -1
- data/lib/asteroid/provider/digital_ocean.rb +35 -6
- data/lib/asteroid/provider/mock.rb +36 -14
- data/lib/asteroid/script.rb +3 -57
- data/lib/asteroid/server.rb +44 -25
- data/lib/asteroid/template.rb +19 -7
- data/lib/asteroid/template/liquid.rb +0 -0
- data/lib/asteroid/version.rb +1 -1
- data/sample/.gitignore +2 -0
- data/sample/README.md +1 -0
- data/sample/Rakefile +0 -0
- data/sample/TODO +9 -0
- data/sample/asteroid/files/nginx/available_site.conf.erb +0 -0
- data/sample/asteroid/files/nginx/nginx.conf +1 -0
- data/sample/asteroid/scripts/ubuntu.aster +4 -0
- data/sample/asteroid/servers/default.yml +3 -0
- data/sample/asteroid/servers/web.yml +5 -0
- data/sample/config/asteroid.rb +9 -0
- data/test/helper.rb +18 -2
- data/test/unit/test_application.rb +17 -0
- data/test/unit/test_file_reference.rb +18 -0
- data/test/unit/test_instance.rb +20 -4
- data/test/unit/test_script_reference.rb +9 -0
- data/test/unit/test_server.rb +46 -2
- data/test/unit/test_template.rb +16 -0
- metadata +24 -17
- data/lib/asteroid/config_file.rb +0 -46
data/lib/asteroid/config_file.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
require 'tempfile'
|
2
|
-
require 'pathname'
|
3
|
-
|
4
|
-
module Asteroid
|
5
|
-
class ConfigFile
|
6
|
-
def initialize(fname)
|
7
|
-
@filename = if Pathname.new(fname).absolute?
|
8
|
-
fname
|
9
|
-
elsif File.exists?(f = File.join(Asteroid::Config.file_dir, '/', fname))
|
10
|
-
f
|
11
|
-
elsif File.exists?(f = File.join(Asteroid::Config.secret_file_dir, '/', fname))
|
12
|
-
f
|
13
|
-
else
|
14
|
-
nil
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def template?
|
19
|
-
@filename.split('.').last == "erb"
|
20
|
-
end
|
21
|
-
|
22
|
-
def filename
|
23
|
-
if template?
|
24
|
-
@rendered_filename ||= begin
|
25
|
-
file_data = File.read @filename
|
26
|
-
file = Tempfile.new('config')
|
27
|
-
rendered_template = Template.new(:erb).render(file_data, data)
|
28
|
-
file.write rendered_template
|
29
|
-
file.rewind
|
30
|
-
file.path
|
31
|
-
end
|
32
|
-
else
|
33
|
-
@filename
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def set_data(d)
|
38
|
-
@data = d
|
39
|
-
end
|
40
|
-
|
41
|
-
def data
|
42
|
-
@data ||= {}
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
end
|