asteroid 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -0
  3. data/Gemfile +1 -0
  4. data/README.md +45 -4
  5. data/Rakefile +1 -0
  6. data/asteroid.gemspec +0 -1
  7. data/bin/asteroid +4 -2
  8. data/lib/asteroid.rb +11 -10
  9. data/lib/asteroid/application.rb +60 -7
  10. data/lib/asteroid/config.rb +28 -14
  11. data/lib/asteroid/file_reference.rb +102 -0
  12. data/lib/asteroid/generator.rb +0 -4
  13. data/lib/asteroid/instance.rb +29 -9
  14. data/lib/asteroid/instance/command.rb +71 -36
  15. data/lib/asteroid/instance/scp.rb +26 -0
  16. data/lib/asteroid/instance/ssh.rb +2 -1
  17. data/lib/asteroid/instance/vars.rb +5 -2
  18. data/lib/asteroid/key_reference.rb +45 -0
  19. data/lib/asteroid/provider/abstract.rb +16 -1
  20. data/lib/asteroid/provider/digital_ocean.rb +35 -6
  21. data/lib/asteroid/provider/mock.rb +36 -14
  22. data/lib/asteroid/script.rb +3 -57
  23. data/lib/asteroid/server.rb +44 -25
  24. data/lib/asteroid/template.rb +19 -7
  25. data/lib/asteroid/template/liquid.rb +0 -0
  26. data/lib/asteroid/version.rb +1 -1
  27. data/sample/.gitignore +2 -0
  28. data/sample/README.md +1 -0
  29. data/sample/Rakefile +0 -0
  30. data/sample/TODO +9 -0
  31. data/sample/asteroid/files/nginx/available_site.conf.erb +0 -0
  32. data/sample/asteroid/files/nginx/nginx.conf +1 -0
  33. data/sample/asteroid/scripts/ubuntu.aster +4 -0
  34. data/sample/asteroid/servers/default.yml +3 -0
  35. data/sample/asteroid/servers/web.yml +5 -0
  36. data/sample/config/asteroid.rb +9 -0
  37. data/test/helper.rb +18 -2
  38. data/test/unit/test_application.rb +17 -0
  39. data/test/unit/test_file_reference.rb +18 -0
  40. data/test/unit/test_instance.rb +20 -4
  41. data/test/unit/test_script_reference.rb +9 -0
  42. data/test/unit/test_server.rb +46 -2
  43. data/test/unit/test_template.rb +16 -0
  44. metadata +24 -17
  45. data/lib/asteroid/config_file.rb +0 -46
@@ -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