nucleon 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/Gemfile +4 -8
  2. data/Gemfile.lock +0 -28
  3. data/README.rdoc +13 -5
  4. data/Rakefile +9 -1
  5. data/VERSION +1 -1
  6. data/bin/nucleon +55 -0
  7. data/lib/core/codes.rb +107 -0
  8. data/lib/core/config/collection.rb +57 -0
  9. data/lib/core/config/options.rb +70 -0
  10. data/lib/core/config.rb +342 -0
  11. data/lib/core/core.rb +54 -0
  12. data/lib/core/errors.rb +84 -0
  13. data/lib/core/facade.rb +283 -0
  14. data/lib/core/gems.rb +80 -0
  15. data/lib/core/manager.rb +594 -0
  16. data/lib/core/mixin/action/commit.rb +58 -0
  17. data/lib/core/mixin/action/project.rb +53 -0
  18. data/lib/core/mixin/action/push.rb +52 -0
  19. data/lib/core/mixin/config/collection.rb +53 -0
  20. data/lib/core/mixin/config/options.rb +39 -0
  21. data/lib/core/mixin/macro/object_interface.rb +361 -0
  22. data/lib/core/mixin/macro/plugin_interface.rb +380 -0
  23. data/lib/core/mixin/settings.rb +46 -0
  24. data/lib/core/mixin/sub_config.rb +148 -0
  25. data/lib/core/mod/hash.rb +29 -0
  26. data/lib/core/plugin/action.rb +371 -0
  27. data/lib/core/plugin/base.rb +313 -0
  28. data/lib/core/plugin/command.rb +98 -0
  29. data/lib/core/plugin/event.rb +53 -0
  30. data/lib/core/plugin/extension.rb +12 -0
  31. data/lib/core/plugin/project.rb +890 -0
  32. data/lib/core/plugin/template.rb +80 -0
  33. data/lib/core/plugin/translator.rb +38 -0
  34. data/lib/core/util/cli.rb +353 -0
  35. data/lib/core/util/console.rb +237 -0
  36. data/lib/core/util/data.rb +404 -0
  37. data/lib/core/util/disk.rb +114 -0
  38. data/lib/core/util/git.rb +43 -0
  39. data/lib/core/util/liquid.rb +17 -0
  40. data/lib/core/util/logger.rb +147 -0
  41. data/lib/core/util/package.rb +93 -0
  42. data/lib/core/util/shell.rb +239 -0
  43. data/lib/nucleon/action/add.rb +69 -0
  44. data/lib/nucleon/action/create.rb +52 -0
  45. data/lib/nucleon/action/extract.rb +49 -0
  46. data/lib/nucleon/action/remove.rb +51 -0
  47. data/lib/nucleon/action/save.rb +53 -0
  48. data/lib/nucleon/action/update.rb +37 -0
  49. data/lib/nucleon/command/bash.rb +146 -0
  50. data/lib/nucleon/event/regex.rb +52 -0
  51. data/lib/nucleon/project/git.rb +465 -0
  52. data/lib/nucleon/project/github.rb +108 -0
  53. data/lib/nucleon/template/json.rb +16 -0
  54. data/lib/nucleon/template/wrapper.rb +16 -0
  55. data/lib/nucleon/template/yaml.rb +16 -0
  56. data/lib/nucleon/translator/json.rb +27 -0
  57. data/lib/nucleon/translator/yaml.rb +27 -0
  58. data/lib/nucleon.rb +18 -15
  59. data/locales/en.yml +3 -132
  60. data/nucleon.gemspec +66 -27
  61. data/spec/core/util/console_spec.rb +489 -0
  62. metadata +109 -96
@@ -0,0 +1,98 @@
1
+
2
+ module Nucleon
3
+ module Plugin
4
+ class Command < Base
5
+
6
+ #-----------------------------------------------------------------------------
7
+ # Command plugin interface
8
+
9
+ def normalize
10
+ super
11
+ end
12
+
13
+ #---
14
+
15
+ def to_s
16
+ return build(export)
17
+ end
18
+
19
+ #-----------------------------------------------------------------------------
20
+ # Property accessor / modifiers
21
+
22
+ def command(default = '')
23
+ return string(get(:command, default))
24
+ end
25
+
26
+ #---
27
+
28
+ def command=command
29
+ set(:command, string(command))
30
+ end
31
+
32
+ #---
33
+
34
+ def args(default = [])
35
+ return array(get(:args, default))
36
+ end
37
+
38
+ #---
39
+
40
+ def args=args
41
+ set(:args, array(args))
42
+ end
43
+
44
+ #---
45
+
46
+ def flags(default = [])
47
+ return array(get(:flags, default))
48
+ end
49
+
50
+ #---
51
+
52
+ def flags=flags
53
+ set(:flags, array(flags))
54
+ end
55
+
56
+ #---
57
+
58
+ def data(default = {})
59
+ return hash(get(:data, default))
60
+ end
61
+
62
+ #---
63
+
64
+ def data=data
65
+ set(:data, hash(data))
66
+ end
67
+
68
+ #---
69
+
70
+ def subcommand=subcommand
71
+ unless Util::Data.empty?(subcommand)
72
+ set(:subcommand, new(hash(subcommand)))
73
+ end
74
+ end
75
+
76
+ #-----------------------------------------------------------------------------
77
+ # Command operations
78
+
79
+ def build(components = {}, overrides = nil, override_key = false)
80
+ logger.debug("Building command with #{components.inspect}")
81
+ logger.debug("Overrides: #{overrides.inspect}")
82
+ logger.debug("Override key: #{override_key}")
83
+
84
+ return '' # Implement in sub classes
85
+ end
86
+
87
+ #---
88
+
89
+ def exec(options = {}, overrides = nil)
90
+ logger.debug("Executing command with #{options.inspect}")
91
+ logger.debug("Overrides: #{overrides.inspect}")
92
+
93
+ # Implement in sub classes (don't forget the yield!)
94
+ return true
95
+ end
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,53 @@
1
+
2
+ module Nucleon
3
+ module Plugin
4
+ class Event < Base
5
+
6
+ #-----------------------------------------------------------------------------
7
+ # Event plugin interface
8
+
9
+
10
+ #-----------------------------------------------------------------------------
11
+ # Property accessor / modifiers
12
+
13
+ #-----------------------------------------------------------------------------
14
+ # Operations
15
+
16
+ def render
17
+ return name
18
+ end
19
+
20
+ #---
21
+
22
+ def check(source)
23
+ # Implement in sub classes
24
+ return true
25
+ end
26
+
27
+ #-----------------------------------------------------------------------------
28
+ # Utilities
29
+
30
+ def self.build_info(type, data)
31
+ data = data.split(/\s*,\s*/) if data.is_a?(String)
32
+ return super(type, data)
33
+ end
34
+
35
+ #---
36
+
37
+ def self.translate(data)
38
+ options = super(data)
39
+
40
+ case data
41
+ when String
42
+ components = data.split(':')
43
+
44
+ options[:provider] = components.shift
45
+ options[:string] = components.join(':')
46
+
47
+ logger.debug("Translating event options: #{options.inspect}")
48
+ end
49
+ return options
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,12 @@
1
+
2
+ module Nucleon
3
+ module Plugin
4
+ class Extension < Base
5
+
6
+ #-----------------------------------------------------------------------------
7
+ # Extension plugin interface
8
+
9
+ # This plugin type is just a system container for various plugin hooks
10
+ end
11
+ end
12
+ end