chake 0.21.2 → 0.80

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/.ackrc +1 -0
  3. data/.gitignore +22 -0
  4. data/.gitlab-ci.yml +24 -0
  5. data/.manifest +63 -0
  6. data/.rubocop.yml +53 -0
  7. data/.rubocop_todo.yml +40 -0
  8. data/ChangeLog.md +15 -0
  9. data/README.chef.md +70 -0
  10. data/README.itamae.md +58 -0
  11. data/README.md +110 -85
  12. data/README.shell.md +30 -0
  13. data/Rakefile +34 -10
  14. data/bin/chake +2 -2
  15. data/chake.gemspec +16 -16
  16. data/examples/test/.ssh_config +4 -0
  17. data/examples/test/Rakefile +1 -1
  18. data/examples/test/Vagrantfile +6 -0
  19. data/examples/test/config.rb +4 -4
  20. data/examples/test/cookbooks/basics/recipes/default.rb +1 -0
  21. data/examples/test/cookbooks/example/files/default/test +1 -0
  22. data/examples/test/cookbooks/example/files/{host-homer → host-lemur}/test.asc +0 -0
  23. data/lib/chake.rb +86 -153
  24. data/lib/chake/bootstrap/{01_debian.sh → chef/01_debian.sh} +0 -0
  25. data/lib/chake/bootstrap/{99_unsupported.sh → chef/99_unsupported.sh} +0 -0
  26. data/lib/chake/config.rb +2 -7
  27. data/lib/chake/config_manager.rb +93 -0
  28. data/lib/chake/config_manager/chef.rb +35 -0
  29. data/lib/chake/config_manager/itamae.rb +58 -0
  30. data/lib/chake/config_manager/shell.rb +34 -0
  31. data/lib/chake/config_manager/skel/chef/Rakefile +1 -0
  32. data/lib/chake/config_manager/skel/chef/config.rb +4 -0
  33. data/lib/chake/config_manager/skel/chef/cookbooks/basics/recipes/default.rb +1 -0
  34. data/lib/chake/config_manager/skel/chef/nodes.yaml +3 -0
  35. data/lib/chake/config_manager/skel/itamae/Rakefile +1 -0
  36. data/lib/chake/config_manager/skel/itamae/cookbooks/basics/default.rb +1 -0
  37. data/lib/chake/config_manager/skel/itamae/nodes.yaml +3 -0
  38. data/lib/chake/config_manager/skel/itamae/roles/basic.rb +1 -0
  39. data/lib/chake/config_manager/skel/shell/Rakefile +1 -0
  40. data/lib/chake/config_manager/skel/shell/nodes.yaml +3 -0
  41. data/lib/chake/connection.rb +83 -0
  42. data/lib/chake/{backend → connection}/local.rb +2 -8
  43. data/lib/chake/{backend → connection}/ssh.rb +6 -14
  44. data/lib/chake/node.rb +49 -29
  45. data/lib/chake/readline.rb +6 -10
  46. data/lib/chake/version.rb +1 -1
  47. data/man/.gitignore +2 -0
  48. data/man/Rakefile +27 -14
  49. data/man/readme2man.sed +5 -5
  50. data/spec/chake/backend/local_spec.rb +5 -6
  51. data/spec/chake/backend/ssh_spec.rb +8 -10
  52. data/spec/chake/backend_spec.rb +1 -2
  53. data/spec/chake/config_manager/chef_spec.rb +38 -0
  54. data/spec/chake/config_manager/itamae_spec.rb +69 -0
  55. data/spec/chake/config_manager/shell_spec.rb +54 -0
  56. data/spec/chake/config_manager_spec.rb +24 -0
  57. data/spec/chake/node_spec.rb +38 -15
  58. data/spec/spec_helper.rb +20 -18
  59. metadata +63 -43
  60. data/coverage/assets/0.11.0/application.css +0 -809
  61. data/coverage/assets/0.11.0/application.js +0 -43679
  62. data/coverage/assets/0.11.0/colorbox/border.png +0 -0
  63. data/coverage/assets/0.11.0/colorbox/controls.png +0 -0
  64. data/coverage/assets/0.11.0/colorbox/loading.gif +0 -0
  65. data/coverage/assets/0.11.0/colorbox/loading_background.png +0 -0
  66. data/coverage/assets/0.11.0/favicon_green.png +0 -0
  67. data/coverage/assets/0.11.0/favicon_red.png +0 -0
  68. data/coverage/assets/0.11.0/favicon_yellow.png +0 -0
  69. data/coverage/assets/0.11.0/loading.gif +0 -0
  70. data/coverage/assets/0.11.0/magnify.png +0 -0
  71. data/coverage/assets/0.11.0/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  72. data/coverage/assets/0.11.0/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  73. data/coverage/assets/0.11.0/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  74. data/coverage/assets/0.11.0/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  75. data/coverage/assets/0.11.0/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  76. data/coverage/assets/0.11.0/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  77. data/coverage/assets/0.11.0/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  78. data/coverage/assets/0.11.0/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  79. data/coverage/assets/0.11.0/smoothness/images/ui-icons_222222_256x240.png +0 -0
  80. data/coverage/assets/0.11.0/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  81. data/coverage/assets/0.11.0/smoothness/images/ui-icons_454545_256x240.png +0 -0
  82. data/coverage/assets/0.11.0/smoothness/images/ui-icons_888888_256x240.png +0 -0
  83. data/coverage/assets/0.11.0/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  84. data/coverage/index.html +0 -4158
  85. data/examples/test/nodes.yaml +0 -7
  86. data/examples/test/tmp/chake/test.local.bootstrap +0 -21
  87. data/examples/test/tmp/chake/test.local.json +0 -7
  88. data/examples/test/tmp/chake/test.local.plain.sha1sum +0 -9
  89. data/lib/chake/backend.rb +0 -80
  90. data/tags +0 -103
@@ -1,7 +0,0 @@
1
- vagrant@test.local:
2
- #run_list:
3
- #- recipe[example]
4
- shell:
5
- - touch /tmp/managed-with-shell
6
- - date
7
- - echo "123" > /tmp/output
@@ -1,21 +0,0 @@
1
- #!/bin/sh
2
- set -eu
3
- hostname="$1"
4
-
5
- echo "$hostname" > /etc/hostname
6
- hostname --file /etc/hostname
7
-
8
- fqdn=$(hostname --fqdn || true)
9
- if [ "$fqdn" != "$hostname" ]; then
10
- # if hostname is bar.example.com, we also want `bar` to be in /etc/hosts
11
- short_hostname=$(echo "$hostname" | cut -d . -f 1)
12
- if [ "$short_hostname" != "$hostname" ] && ! grep -q "\s${short_hostname}" /etc/hosts; then
13
- hostname="$hostname $short_hostname"
14
- fi
15
- printf "127.0.1.1\t%s\n" "$hostname" >> /etc/hosts
16
- fi
17
-
18
- # Stop cloud-init from resetting the hostname
19
- if [ -f /etc/cloud/cloud.cfg ]; then
20
- sed -i -e '/^\s*-\s*\(set_hostname\|update_hostname\)/d' /etc/cloud/cloud.cfg
21
- fi
@@ -1,7 +0,0 @@
1
- {
2
- "shell": [
3
- "touch /tmp/managed-with-shell",
4
- "date",
5
- "echo \"123\" > /tmp/output"
6
- ]
7
- }
@@ -1,9 +0,0 @@
1
- 4f452ef6c90f610fdd76153c42f97d0c81a0fda6 Rakefile
2
- 428a0c70c33acf8021e2a73be706a120dd335f16 Vagrantfile
3
- a70248580db38a6659bba1887c16ead12d8d2f6c config.rb
4
- 4e1243bd22c66e76c2ba9eddc1f91394e57f9f83 cookbooks/example/files/default/test
5
- eff499adf0d95c839fc3050f3411f99a1180f487 cookbooks/example/files/host-lemur/test.asc
6
- 4dc287355a2c39d0c1210181363c9bd526cadbe0 cookbooks/example/recipes/default.rb
7
- 81608a9bda8f5c903d1fccb769ab98b6f6fc548d nodes.yaml
8
- 606aca30bcc3daa3b6732db50c1e35b1980422d1 tmp/chake/test.local.bootstrap
9
- bdc280e517bdf1550f31330a2114438fd352ff52 tmp/chake/test.local.json
@@ -1,80 +0,0 @@
1
- module Chake
2
-
3
- class Backend < Struct.new(:node)
4
-
5
- class CommandFailed < Exception
6
- end
7
-
8
- def scp
9
- ['scp']
10
- end
11
-
12
- def scp_dest
13
- ''
14
- end
15
-
16
- def rsync
17
- ['rsync']
18
- end
19
-
20
- def rsync_dest
21
- node.path + '/'
22
- end
23
-
24
- def run(cmd)
25
- printf "%#{Node.max_node_name_length}s: $ %s\n", node.hostname, cmd
26
- io = IO.popen(command_runner + ['/bin/sh'], mode='w+', eer: [:child, :out])
27
- io.write(cmd)
28
- io.close_write
29
- io.each_line do |line|
30
- printf "%#{Node.max_node_name_length}s: %s\n", node.hostname, line.gsub(/\s*$/, '')
31
- end
32
- io.close
33
- if $?
34
- status = $?.exitstatus
35
- if status != 0
36
- raise CommandFailed.new([node.hostname, 'FAILED with exit status %d' % status].join(': '))
37
- end
38
- end
39
- end
40
-
41
- def run_shell
42
- system(*shell_command)
43
- end
44
-
45
- def run_as_root(cmd)
46
- if node.remote_username == 'root'
47
- run(cmd)
48
- else
49
- run('sudo ' + cmd)
50
- end
51
- end
52
-
53
- def to_s
54
- self.class.backend_name
55
- end
56
-
57
- def skip?
58
- false
59
- end
60
-
61
- def self.backend_name
62
- name.split("::").last.downcase
63
- end
64
-
65
- def self.inherited(subclass)
66
- @backends ||= []
67
- @backends << subclass
68
- end
69
-
70
- def self.get(name)
71
- backend = @backends.find { |b| b.backend_name == name }
72
- backend || raise(ArgumentError.new("Invalid backend name: #{name}"))
73
- end
74
-
75
- end
76
-
77
- end
78
-
79
- require 'chake/backend/ssh'
80
- require 'chake/backend/local'
data/tags DELETED
@@ -1,103 +0,0 @@
1
- !_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
2
- !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
3
- !_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
4
- !_TAG_PROGRAM_NAME Exuberant Ctags //
5
- !_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
6
- !_TAG_PROGRAM_VERSION 5.9~svn20110310 //
7
- AllFiles coverage/index.html /^ <a name="AllFiles"><\/a>$/;" a
8
- Chake lib/chake/config.rb /^module Chake$/;" m
9
- Chake lib/chake/config_manager.rb /^module Chake$/;" m
10
- Chake lib/chake/config_manager/chef.rb /^module Chake$/;" m
11
- Chake lib/chake/config_manager/shell.rb /^module Chake$/;" m
12
- Chake lib/chake/connection.rb /^module Chake$/;" m
13
- Chake lib/chake/connection/local.rb /^module Chake$/;" m
14
- Chake lib/chake/connection/ssh.rb /^module Chake$/;" m
15
- Chake lib/chake/node.rb /^module Chake$/;" m
16
- Chake lib/chake/readline.rb /^module Chake$/;" m
17
- Chake lib/chake/tmpdir.rb /^module Chake$/;" m
18
- Chake lib/chake/version.rb /^module Chake$/;" m
19
- Chef lib/chake/config_manager/chef.rb /^ class Chef < ConfigManager$/;" c class:Chake.ConfigManager
20
- CommandFailed lib/chake/connection.rb /^ class CommandFailed < Exception$/;" c class:Chake.Connection
21
- Commands lib/chake/readline.rb /^ class Commands < Readline$/;" c class:Chake
22
- ConfigManager lib/chake/config_manager.rb /^ class ConfigManager$/;" c class:Chake
23
- ConfigManager lib/chake/config_manager/chef.rb /^ class ConfigManager$/;" c class:Chake
24
- ConfigManager lib/chake/config_manager/shell.rb /^ class ConfigManager$/;" c class:Chake
25
- Connection lib/chake/connection.rb /^ class Connection < Struct.new(:node)$/;" c class:Chake
26
- Connection lib/chake/connection/local.rb /^ class Connection$/;" c class:Chake
27
- Connection lib/chake/connection/ssh.rb /^ class Connection$/;" c class:Chake
28
- Local lib/chake/connection/local.rb /^ class Local < Connection$/;" c class:Chake.Connection
29
- Node lib/chake/node.rb /^ class Node$/;" c class:Chake
30
- Rake bin/chake /^class Rake::Application$/;" c
31
- Readline lib/chake/readline.rb /^ class Readline$/;" c class:Chake
32
- Recipes lib/chake/readline.rb /^ class Recipes < Readline$/;" c class:Chake
33
- Shell lib/chake/config_manager/shell.rb /^ class Shell < ConfigManager$/;" c class:Chake.ConfigManager
34
- Ssh lib/chake/connection/ssh.rb /^ class Ssh < Connection$/;" c class:Chake.Connection
35
- accept lib/chake/config_manager.rb /^ def self.accept?(node)$/;" F class:Chake.ConfigManager
36
- accept lib/chake/config_manager/chef.rb /^ def self.accept?(node)$/;" F class:Chake.ConfigManager.Chef
37
- accept lib/chake/config_manager/shell.rb /^ def self.accept?(node)$/;" F class:Chake.ConfigManager.Shell
38
- apply lib/chake/config_manager.rb /^ def apply(config, silent = false)$/;" f class:Chake.ConfigManager
39
- apply lib/chake/config_manager/chef.rb /^ def apply(config, silent = false)$/;" f class:Chake.ConfigManager.Chef
40
- apply lib/chake/config_manager/shell.rb /^ def apply(config, silent = false)$/;" f class:Chake.ConfigManager.Shell
41
- bootstrap_steps lib/chake/config_manager.rb /^ def bootstrap_steps$/;" f class:Chake.ConfigManager
42
- command_runner lib/chake/connection/local.rb /^ def command_runner$/;" f class:Chake.Connection.Local
43
- command_runner lib/chake/connection/ssh.rb /^ def command_runner$/;" f class:Chake.Connection.Ssh
44
- config_manager lib/chake/node.rb /^ def config_manager$/;" f class:Chake.Node
45
- connection lib/chake/node.rb /^ def connection$/;" f class:Chake.Node
46
- connection_name lib/chake/connection.rb /^ def self.connection_name$/;" F class:Chake.Connection
47
- converge lib/chake/config_manager.rb /^ def converge(silent = false)$/;" f class:Chake.ConfigManager
48
- converge lib/chake/config_manager/chef.rb /^ def converge(silent = false)$/;" f class:Chake.ConfigManager.Chef
49
- converge lib/chake/config_manager/shell.rb /^ def converge(silent = false)$/;" f class:Chake.ConfigManager.Shell
50
- encrypted_for lib/chake.rb /^def encrypted_for(node)$/;" f
51
- finish lib/chake/readline.rb /^ def finish$/;" f class:Chake.Readline
52
- get lib/chake/config_manager.rb /^ def self.get(node)$/;" F class:Chake.ConfigManager
53
- get lib/chake/connection.rb /^ def self.get(name)$/;" F class:Chake.Connection
54
- history lib/chake/readline.rb /^ def history$/;" f class:Chake.Readline
55
- history_file lib/chake/readline.rb /^ def history_file$/;" f class:Chake.Readline
56
- history_file lib/chake/readline.rb /^ def self.history_file$/;" F class:Chake.Commands
57
- history_file lib/chake/readline.rb /^ def self.history_file$/;" F class:Chake.Recipes
58
- if_files_changed lib/chake.rb /^def if_files_changed(node, group_name, files)$/;" f
59
- inherited lib/chake/config_manager.rb /^ def self.inherited(klass)$/;" F class:Chake.ConfigManager
60
- inherited lib/chake/connection.rb /^ def self.inherited(subclass)$/;" F class:Chake.Connection
61
- init lib/chake/readline.rb /^ def init$/;" f class:Chake.Readline
62
- initialize lib/chake/config_manager.rb /^ def initialize(node)$/;" f class:Chake.ConfigManager
63
- initialize lib/chake/node.rb /^ def initialize(hostname, data = {})$/;" f class:Chake.Node
64
- json_config lib/chake/config_manager/chef.rb /^ def json_config$/;" f class:Chake.ConfigManager.Chef
65
- logging lib/chake/config_manager/chef.rb /^ def logging(silent)$/;" f class:Chake.ConfigManager.Chef
66
- max_node_name_length lib/chake/node.rb /^ def self.max_node_name_length$/;" F class:Chake.Node
67
- max_node_name_length lib/chake/node.rb /^ def self.max_node_name_length=(value)$/;" F class:Chake.Node
68
- name lib/chake/config_manager.rb /^ def name$/;" f class:Chake.ConfigManager
69
- path lib/chake/config_manager.rb /^ def path$/;" f class:Chake.ConfigManager
70
- path lib/chake/node.rb /^ def path$/;" f class:Chake.Node
71
- priority lib/chake/config_manager.rb /^ def self.priority(n = nil)$/;" F class:Chake.ConfigManager
72
- prompt lib/chake/readline.rb /^ def prompt$/;" f class:Chake.Readline
73
- prompt lib/chake/readline.rb /^ def self.prompt$/;" F class:Chake.Commands
74
- prompt lib/chake/readline.rb /^ def self.prompt$/;" F class:Chake.Recipes
75
- readline lib/chake/readline.rb /^ def readline$/;" f class:Chake.Readline
76
- rsync lib/chake/connection.rb /^ def rsync$/;" f class:Chake.Connection
77
- rsync lib/chake/connection/ssh.rb /^ def rsync$/;" f class:Chake.Connection.Ssh
78
- rsync_dest lib/chake/connection.rb /^ def rsync_dest$/;" f class:Chake.Connection
79
- rsync_dest lib/chake/connection/ssh.rb /^ def rsync_dest$/;" f class:Chake.Connection.Ssh
80
- rsync_ssh lib/chake/connection/ssh.rb /^ def rsync_ssh$/;" f class:Chake.Connection.Ssh
81
- run lib/chake/connection.rb /^ def run(cmd)$/;" f class:Chake.Connection
82
- run_as_root lib/chake/connection.rb /^ def run_as_root(cmd)$/;" f class:Chake.Connection
83
- run_shell lib/chake/connection.rb /^ def run_shell$/;" f class:Chake.Connection
84
- scp lib/chake/connection.rb /^ def scp$/;" f class:Chake.Connection
85
- scp lib/chake/connection/ssh.rb /^ def scp$/;" f class:Chake.Connection.Ssh
86
- scp_dest lib/chake/connection.rb /^ def scp_dest$/;" f class:Chake.Connection
87
- scp_dest lib/chake/connection/ssh.rb /^ def scp_dest$/;" f class:Chake.Connection.Ssh
88
- scp_options lib/chake/connection/ssh.rb /^ def scp_options$/;" f class:Chake.Connection.Ssh
89
- shell_command lib/chake/connection/local.rb /^ def shell_command$/;" f class:Chake.Connection.Local
90
- shell_command lib/chake/connection/ssh.rb /^ def shell_command$/;" f class:Chake.Connection.Ssh
91
- short_name lib/chake/config_manager.rb /^ def self.short_name$/;" F class:Chake.ConfigManager
92
- skip? lib/chake/connection.rb /^ def skip?$/;" f class:Chake.Connection
93
- skip? lib/chake/connection/local.rb /^ def skip?$/;" f class:Chake.Connection.Local
94
- ssh_config lib/chake/connection/ssh.rb /^ def ssh_config$/;" f class:Chake.Connection.Ssh
95
- ssh_config_file lib/chake/connection/ssh.rb /^ def ssh_config_file$/;" f class:Chake.Connection.Ssh
96
- ssh_options lib/chake/connection/ssh.rb /^ def ssh_options$/;" f class:Chake.Connection.Ssh
97
- ssh_prefix lib/chake/connection/ssh.rb /^ def ssh_prefix$/;" f class:Chake.Connection.Ssh
98
- ssh_target lib/chake/connection/ssh.rb /^ def ssh_target$/;" f class:Chake.Connection.Ssh
99
- thread_pool bin/chake /^ def thread_pool # :nodoc:$/;" f class:Rake
100
- tmpdir lib/chake/tmpdir.rb /^ def self.tmpdir$/;" F class:Chake
101
- to_s lib/chake/config_manager.rb /^ def to_s$/;" f class:Chake.ConfigManager
102
- to_s lib/chake/connection.rb /^ def to_s$/;" f class:Chake.Connection
103
- write_json_file lib/chake.rb /^def write_json_file(file, data)$/;" f