caboodle 0.1.2 → 0.1.3

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -18,13 +18,21 @@ module Caboodle
18
18
  puts `cd #{args.first} && git push heroku master`
19
19
 
20
20
  when /kit:add/
21
- unless Caboodle::Site.kits.include?(args.first.capitalize)
22
- Caboodle::Kit.load_kit args.first.capitalize
23
- Caboodle::Kit.dump_config
24
- puts `git add .`
25
- puts `git commit -m"kit:add #{args}" -a`
26
- puts `git push heroku master`
27
- end
21
+ Caboodle::Kit.load_kit args.first.capitalize
22
+ puts "Dump config"
23
+ Caboodle::Kit.dump_config
24
+ puts "Pushing to Heroku"
25
+ puts `git add .`
26
+ puts `git commit -m"kit:add #{args}" -a`
27
+ puts `git push heroku master`
28
+ puts "Done!"
29
+ when /kit:remove/
30
+ Caboodle::Kit.unload_kit args.first.capitalize
31
+ puts "Pushing to Heroku"
32
+ puts `git add .`
33
+ puts `git commit -m"kit:remove #{args}" -a`
34
+ puts `git push heroku master`
35
+ puts "Done!"
28
36
  when "deploy"
29
37
  puts `git commit -m"deploy" -a`
30
38
  puts `git push heroku master`
data/lib/caboodle/kit.rb CHANGED
@@ -27,6 +27,7 @@ module Caboodle
27
27
  end
28
28
 
29
29
  def dump_config
30
+ puts "Dump config"
30
31
  p = File.expand_path(File.join(Caboodle::App.root,"config","site.yml"))
31
32
  d = Caboodle::Site.clone
32
33
  e = d.to_hash
@@ -57,6 +58,24 @@ module Caboodle
57
58
  Caboodle::Kits
58
59
  end
59
60
 
61
+ def unload_kit name
62
+ unless name.blank?
63
+ kit_name = name.to_s.split("::").last || name
64
+ kit_name = kit_name.downcase
65
+ puts "Loading Kit: #{kit_name}"
66
+ orig = Caboodle.constants
67
+ require "caboodle/kits/#{kit_name}/#{kit_name}" rescue puts "Warning! No such kit: #{kit_name}"
68
+ added = Caboodle.constants - orig
69
+ added.each do |d|
70
+ c = Caboodle.const_get(d)
71
+ if c.respond_to?(:is_a_caboodle_kit)
72
+ c.unregister
73
+ end
74
+ end
75
+ end
76
+ Caboodle::Kits
77
+ end
78
+
60
79
  def register
61
80
  required_settings.each do |r|
62
81
  unless Caboodle::Site[r]
@@ -66,8 +85,16 @@ module Caboodle
66
85
  Caboodle::Kit.dump_config
67
86
  end
68
87
  end
88
+ Site.kits << self.to_s.split("::").last
89
+ Site.kits.uniq!
69
90
  Caboodle::Kits << self
70
91
  end
92
+
93
+ def unregister
94
+ Caboodle::Kits.delete(self)
95
+ Caboodle::Site.kits.delete(self.to_s)
96
+ Caboodle::Kit.dump_config
97
+ end
71
98
 
72
99
  def require_all
73
100
  if(Caboodle::Site.kits)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboodle
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - steflewandowski