kit 0.0.1

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 (2) hide show
  1. data/site_manager.rb +73 -0
  2. metadata +66 -0
@@ -0,0 +1,73 @@
1
+ class SiteManager
2
+
3
+ def initialize name, db_backend, db_config, info, actions
4
+
5
+ load './db_sqlite3.rb' if db_backend == :sqlite3
6
+
7
+ load './info/' + name + ".rb"
8
+
9
+
10
+ @@db = Backend.new db_config
11
+ @@actions = actions
12
+ @@info = info
13
+ end
14
+
15
+ def add_site info
16
+ Site.new info
17
+ end
18
+
19
+ def add_task action, options
20
+ fail NoAction unless @@actions.include? action
21
+ @@db.insert_action action, options
22
+ end
23
+
24
+ def run_tasks
25
+
26
+ collect_tasks_by_site.each do |site, tasks|
27
+ s = Site.new site
28
+
29
+ actions = tasks.group_by { |t| t[:action] } . keys
30
+
31
+ actions.each do |a|
32
+ load ACTIONS_PATH + "/#{a}/#{s.project_name}.rb"
33
+ s.extend Actions
34
+ end
35
+
36
+ tasks.each do |t|
37
+ s.add_task t
38
+ end
39
+
40
+ s.run_all
41
+
42
+ end
43
+ end
44
+
45
+ private
46
+ def collect_tasks_by_site
47
+
48
+ tasks = []
49
+ @@actions.each_key do |action|
50
+ tasks.push @@db.select_all_actions_by_status action, @@actions[action], :pending
51
+ end
52
+ tasks.flatten!
53
+
54
+ tasks.group_by { |t| t[:site] }
55
+ end
56
+
57
+ class NoAction < StandardError
58
+ end
59
+
60
+ end
61
+
62
+ require './config.rb'
63
+ require './site.rb'
64
+
65
+
66
+ sm = SiteManager.new NAME, DB_BACKEND, DB_CONFIG, INFO, ACTIONS
67
+
68
+ p = { :project_name => "otr", :name => "live", :root => "rootLive/", :git => "gitPath" }
69
+ sm.add_site p
70
+ ac = { :site => 1, :requested_commit => "co" }
71
+ sm.add_task :commits, ac
72
+ sm.run_tasks
73
+
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kit
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Evan Boyd Sosenko
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-04-28 00:00:00 -07:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: "\t\tkit is an extendable server tool for managing things like sites and vhosts. This is my first ruby gem and still has a ways to go.\n"
22
+ email:
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files: []
28
+
29
+ files:
30
+ - site_manager.rb
31
+ has_rdoc: true
32
+ homepage:
33
+ licenses:
34
+ - GPL-3
35
+ post_install_message:
36
+ rdoc_options: []
37
+
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ segments:
46
+ - 1
47
+ - 9
48
+ - 2
49
+ version: 1.9.2
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ segments:
56
+ - 0
57
+ version: "0"
58
+ requirements: []
59
+
60
+ rubyforge_project:
61
+ rubygems_version: 1.3.7
62
+ signing_key:
63
+ specification_version: 3
64
+ summary: Extendable tool to manage site development
65
+ test_files: []
66
+