Sha256: d42896ccecc432cb909d6bf43d8dfcac93bdc0d7d34af83fc54b9edffd86c24f
Contents?: true
Size: 1.26 KB
Versions: 3
Compression:
Stored size: 1.26 KB
Contents
class SiteManager def initialize name, db_backend, db_config, info, actions load './db_sqlite3.rb' if db_backend == :sqlite3 load './info/' + name + ".rb" @@db = Backend.new db_config @@actions = actions @@info = info end def add_site info Site.new info end def add_task action, options fail NoAction unless @@actions.include? action @@db.insert_action action, options end def run_tasks collect_tasks_by_site.each do |site, tasks| s = Site.new site actions = tasks.group_by { |t| t[:action] } . keys actions.each do |a| load ACTIONS_PATH + "/#{a}/#{s.project_name}.rb" s.extend Actions end tasks.each do |t| s.add_task t end s.run_all end end private def collect_tasks_by_site tasks = [] @@actions.each_key do |action| tasks.push @@db.select_all_actions_by_status action, @@actions[action], :pending end tasks.flatten! tasks.group_by { |t| t[:site] } end class NoAction < StandardError end end require './config.rb' require './site.rb' sm = SiteManager.new NAME, DB_BACKEND, DB_CONFIG, INFO, ACTIONS p = { :project_name => "otr", :name => "live", :root => "rootLive/", :git => "gitPath" } sm.add_site p ac = { :site => 1, :requested_commit => "co" } sm.add_task :commits, ac sm.run_tasks
Version data entries
3 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kit-0.0.2 | ./site_manager.rb |
kit-0.0.2 | site_manager.rb |
kit-0.0.1 | site_manager.rb |