coral_core 0.2.26 → 0.2.30

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 (46) hide show
  1. data/Gemfile +7 -2
  2. data/Gemfile.lock +84 -15
  3. data/VERSION +1 -1
  4. data/coral_core.gemspec +51 -16
  5. data/lib/{coral_core/command.rb → coral/command/shell.rb} +12 -116
  6. data/lib/coral/machine/fog.rb +215 -0
  7. data/lib/coral/network/default.rb +26 -0
  8. data/lib/coral/node/rackspace.rb +23 -0
  9. data/lib/coral_core.rb +249 -134
  10. data/lib/coral_core/config.rb +233 -275
  11. data/lib/coral_core/config/collection.rb +57 -0
  12. data/lib/coral_core/config/options.rb +70 -0
  13. data/lib/coral_core/config/project.rb +225 -0
  14. data/lib/coral_core/core.rb +19 -173
  15. data/lib/coral_core/event/puppet_event.rb +98 -0
  16. data/lib/coral_core/mixin/config_collection.rb +52 -0
  17. data/lib/coral_core/mixin/config_ops.rb +51 -0
  18. data/lib/coral_core/mixin/config_options.rb +38 -0
  19. data/lib/coral_core/mixin/lookup.rb +211 -0
  20. data/lib/coral_core/mixin/macro/object_interface.rb +292 -0
  21. data/lib/coral_core/mixin/macro/plugin_interface.rb +277 -0
  22. data/lib/coral_core/mixin/settings.rb +46 -0
  23. data/lib/coral_core/mixin/sub_config.rb +208 -0
  24. data/lib/coral_core/mod/hash.rb +29 -0
  25. data/lib/{hiera_backend.rb → coral_core/mod/hiera_backend.rb} +0 -0
  26. data/lib/coral_core/plugin.rb +261 -0
  27. data/lib/coral_core/plugin/command.rb +95 -0
  28. data/lib/coral_core/plugin/machine.rb +152 -0
  29. data/lib/coral_core/plugin/network.rb +24 -0
  30. data/lib/coral_core/plugin/node.rb +184 -0
  31. data/lib/coral_core/plugin_base.rb +147 -0
  32. data/lib/coral_core/repository.rb +471 -82
  33. data/lib/coral_core/util/cli.rb +293 -0
  34. data/lib/coral_core/util/data.rb +178 -8
  35. data/lib/coral_core/util/disk.rb +13 -0
  36. data/lib/coral_core/util/git.rb +35 -10
  37. data/lib/coral_core/{interface.rb → util/interface.rb} +31 -21
  38. data/lib/coral_core/util/process.rb +43 -0
  39. data/locales/en.yml +8 -0
  40. data/spec/coral_core/interface_spec.rb +45 -45
  41. metadata +109 -34
  42. data/.gitmodules +0 -12
  43. data/lib/coral_core/memory.rb +0 -226
  44. data/lib/coral_core/util/git/base.rb +0 -65
  45. data/lib/coral_core/util/git/lib.rb +0 -89
  46. data/lib/coral_core/util/git/remote.rb +0 -12
@@ -1,65 +0,0 @@
1
-
2
- module Git
3
-
4
- #*******************************************************************************
5
- # Errors
6
-
7
- class GitDirectoryError < StandardError
8
- end
9
-
10
- #*******************************************************************************
11
- # Base Git definition
12
-
13
- class Base
14
-
15
- #-----------------------------------------------------------------------------
16
- # Constructor / Destructor
17
-
18
- def initialize(options = {})
19
- if working_dir = options[:working_directory]
20
- options[:repository] ||= File.join(working_dir, '.git')
21
-
22
- if File.file?(options[:repository])
23
- File.read(options[:repository]).each_line do |line|
24
- matches = line.match(/^\s*gitdir:\s*(.+)\s*/)
25
- if matches.length && matches[1]
26
- options[:repository] = matches[1]
27
- break
28
- end
29
- end
30
- end
31
-
32
- if File.directory?(options[:repository])
33
- options[:index] ||= File.join(options[:repository], 'index')
34
- else
35
- raise GitDirectoryError.new("Git repository directory #{options[:repository]} not found for #{working_dir}")
36
- end
37
- end
38
-
39
- if options[:log]
40
- @logger = options[:log]
41
- @logger.info("Starting Git")
42
- else
43
- @logger = nil
44
- end
45
-
46
- @working_directory = options[:working_directory] ? Git::WorkingDirectory.new(options[:working_directory]) : nil
47
- @repository = options[:repository] ? Git::Repository.new(options[:repository]) : nil
48
- @index = options[:index] ? Git::Index.new(options[:index], false) : nil
49
- end
50
-
51
- #-----------------------------------------------------------------------------
52
- # Commit extensions
53
-
54
- def add(path = '.', opts = {})
55
- self.lib.add(path, opts)
56
- end
57
-
58
- #-----------------------------------------------------------------------------
59
- # Remote extensions
60
-
61
- def pull(remote = 'origin', branch = 'master')
62
- self.lib.pull(remote, branch)
63
- end
64
- end
65
- end
@@ -1,89 +0,0 @@
1
-
2
- module Git
3
- class Lib
4
-
5
- #-----------------------------------------------------------------------------
6
- # Commit extensions
7
-
8
- def add(path = '.', opts = {})
9
- arr_opts = []
10
- arr_opts << '-u' if opts[:update]
11
- if path.is_a?(Array)
12
- arr_opts += path
13
- else
14
- arr_opts << path
15
- end
16
- command('add', arr_opts)
17
- end
18
-
19
- #---
20
-
21
- def commit(message, opts = {})
22
- arr_opts = ['-m', message]
23
- arr_opts << "--author=\'#{opts[:author]}\'" unless opts[:author] && opts[:author].empty?
24
- arr_opts << '-a' if opts[:add_all]
25
- arr_opts << '--allow-empty' if opts[:allow_empty]
26
- command('commit', arr_opts)
27
- end
28
-
29
- #-----------------------------------------------------------------------------
30
- # Remote extensions
31
-
32
- def remote_add(name, url, opts = {})
33
- arr_opts = ['add']
34
- arr_opts << '-f' if opts[:with_fetch]
35
- arr_opts << name
36
- arr_opts << url
37
-
38
- command('remote', arr_opts)
39
- end
40
-
41
- #---
42
-
43
- def remote_set_url(name, url, opts = {})
44
- arr_opts = ['set-url']
45
-
46
- if opts[:add]
47
- arr_opts << '--add' if opts[:add]
48
- end
49
-
50
- if opts[:delete]
51
- arr_opts << '--delete' if opts[:delete]
52
- end
53
-
54
- if opts[:push]
55
- arr_opts << '--push' if opts[:push]
56
- end
57
-
58
- arr_opts << name
59
- arr_opts << url
60
-
61
- command('remote', arr_opts)
62
- end
63
-
64
- #---
65
-
66
- def remote_remove(name)
67
- command('remote', ['rm', name])
68
- end
69
-
70
- #---
71
-
72
- def pull(remote, branch = 'master', tags = false)
73
- command('pull', [remote, branch])
74
- command('pull', ['--tags', remote]) if tags
75
- end
76
-
77
- #-----------------------------------------------------------------------------
78
- # Utilities
79
-
80
- def escape(s)
81
- escaped = s.to_s.gsub('"', '\'')
82
- if escaped =~ /^\-+/
83
- escaped
84
- else
85
- %Q{"#{escaped}"}
86
- end
87
- end
88
- end
89
- end
@@ -1,12 +0,0 @@
1
-
2
- module Git
3
- class Remote
4
-
5
- #-----------------------------------------------------------------------------
6
- # Remote endpoints
7
-
8
- def set_url(url, opts = {})
9
- @base.lib.remote_set_url(@name, url, opts)
10
- end
11
- end
12
- end