Sha256: 5a364281b1f3b09291c2aefaf0fe881665b259d63ae4867f80da6e7c8fc3d3d0

Contents?: true

Size: 1.07 KB

Versions: 3

Compression:

Stored size: 1.07 KB

Contents

module PoolParty
  class Tasks
    include Callbacks
    
    # Setup and define all the tasks
    def initialize
      yield self if block_given?
    end
    # Define the tasks in the rakefile
    # From the rakefile
    def define_tasks
      # Run the command on the local system
      def run(cmd)
        Kernel.system(cmd.runnable)
      end
      # Basic setup action
      def setup_application
        @options ||= PoolParty.options(ARGV.dup)
      end
      
      # Require the poolparty specific tasks
      compiled_rakefile
      
      desc "Reload the static variables"
      task :reload do
        reload!
      end
      true
    end
    
    def reload!
      @compiled_rakefile = nil
    end
    
    def compiled_rakefile
      rake_str = []
      
      Dir["#{File.expand_path(File.dirname(__FILE__))}/tasks/*.rake"].each { |t| rake_str << open(t).read }
      plugin_rakefiles
      
      @compiled_rakefile ||= eval(rake_str.join("\n")) # Not ideal
    end
    def plugin_rakefiles
      Dir["#{PoolParty.plugin_dir}/*/Rakefile"].each {|t| load t }
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
auser-poolparty-0.1.1 lib/poolparty/tasks.rb
auser-poolparty-0.1.2 lib/poolparty/tasks.rb
jtzemp-poolparty-0.1.2 lib/poolparty/tasks.rb