sunzi 1.5.2 → 2.0.0

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.
Files changed (40) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +1 -1
  3. data/CHANGELOG.md +7 -0
  4. data/README.md +14 -37
  5. data/bin/console +14 -0
  6. data/bin/setup +8 -0
  7. data/{bin → exe}/sunzi +0 -0
  8. data/lib/sunzi.rb +18 -22
  9. data/lib/sunzi/actions.rb +35 -0
  10. data/lib/sunzi/cli.rb +6 -139
  11. data/lib/sunzi/command.rb +113 -0
  12. data/lib/sunzi/core_ext.rb +10 -0
  13. data/lib/sunzi/dependency.rb +26 -29
  14. data/lib/sunzi/endpoint.rb +17 -0
  15. data/lib/sunzi/plugin.rb +17 -0
  16. data/sunzi.gemspec +9 -9
  17. data/{lib/templates → templates}/create/.gitignore +0 -0
  18. data/{lib/templates → templates}/create/files/.gitkeep +0 -0
  19. data/{lib/templates → templates}/create/install.sh +13 -7
  20. data/{lib/templates → templates}/create/recipes/sunzi.sh +0 -0
  21. data/{lib/templates → templates}/create/roles/db.sh +0 -0
  22. data/{lib/templates → templates}/create/roles/web.sh +0 -0
  23. data/templates/create/sunzi.yml +27 -0
  24. data/templates/dependency/gemfile.erb +6 -0
  25. data/templates/dependency/install.erb +6 -0
  26. metadata +45 -36
  27. data/lib/sunzi/cloud.rb +0 -24
  28. data/lib/sunzi/cloud/base.rb +0 -98
  29. data/lib/sunzi/cloud/digital_ocean.rb +0 -78
  30. data/lib/sunzi/cloud/linode.rb +0 -154
  31. data/lib/sunzi/dns.rb +0 -25
  32. data/lib/sunzi/dns/base.rb +0 -7
  33. data/lib/sunzi/dns/linode.rb +0 -26
  34. data/lib/sunzi/dns/route53.rb +0 -25
  35. data/lib/sunzi/logger.rb +0 -17
  36. data/lib/sunzi/utility.rb +0 -17
  37. data/lib/templates/create/sunzi.yml +0 -30
  38. data/lib/templates/setup/digital_ocean/digital_ocean.yml +0 -28
  39. data/lib/templates/setup/linode/linode.yml +0 -42
  40. data/test/test_cli.rb +0 -40
@@ -1,40 +0,0 @@
1
- require 'sunzi'
2
- require 'minitest/autorun'
3
-
4
- class TestCli < Minitest::Test
5
- def setup
6
- @cli = Sunzi::Cli.new
7
- end
8
-
9
- def test_parse_target
10
- assert_equal ['user', 'example.com', '2222'], @cli.parse_target('user@example.com:2222')
11
- assert_equal ['root', 'example.com', '2222'], @cli.parse_target('example.com:2222')
12
- assert_equal ['user', 'example.com', '22'], @cli.parse_target('user@example.com')
13
- assert_equal ['root', 'example.com', '22'], @cli.parse_target('example.com')
14
- assert_equal ['root', '192.168.0.1', '22'], @cli.parse_target('192.168.0.1')
15
- end
16
-
17
- def test_parse_target_with_ssh_config
18
- ssh_config = lambda do |host|
19
- if host == 'example.com'
20
- { :host_name => "buzz.example.com", :user => "foobar", :port => 2222 }
21
- else
22
- {}
23
- end
24
- end
25
-
26
- Net::SSH::Config.stub(:for, ssh_config) do
27
- assert_equal ['foobar', 'buzz.example.com', '2222'], @cli.parse_target('example.com')
28
- assert_equal ['foobar', 'buzz.example.com', '8080'], @cli.parse_target('example.com:8080')
29
- assert_equal ['piyo', 'buzz.example.com', '2222'], @cli.parse_target('piyo@example.com')
30
- assert_equal ['piyo', 'buzz.example.com', '8080'], @cli.parse_target('piyo@example.com:8080')
31
- assert_equal ['root', '192.168.0.1', '22'], @cli.parse_target('192.168.0.1')
32
- end
33
- end
34
-
35
- def test_create
36
- @cli.create 'sandbox'
37
- assert File.exist?('sandbox/sunzi.yml')
38
- FileUtils.rm_rf 'sandbox'
39
- end
40
- end