Module: Automatic

Defined in:
lib/automatic.rb,
lib/automatic/log.rb,
lib/automatic/recipe.rb,
lib/automatic/pipeline.rb,
lib/automatic/feed_parser.rb

Overview

Name

Automatic::FeedParser

Author

774 <id774.net>

Created

Feb 19, 2012

Updated

Feb 24, 2012

Copyright

774 Copyright © 2012

License

Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.

Defined Under Namespace

Modules: FeedParser, Log, Pipeline, Plugin Classes: Recipe

Constant Summary collapse

VERSION =
"12.03"

Class Method Summary collapse

Class Method Details

.config_dirObject



27
28
29
# File 'lib/automatic.rb', line 27

def self.config_dir
  @root_dir + "/config/"
end

.plugins_dirObject



23
24
25
# File 'lib/automatic.rb', line 23

def self.plugins_dir
  @root_dir + "/plugins/"
end

.root_dirObject



19
20
21
# File 'lib/automatic.rb', line 19

def self.root_dir
  @root_dir
end

.run(root_dir) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/automatic.rb', line 31

def self.run(root_dir)
  @root_dir = root_dir
  recipe_path = ""
  require 'optparse'
  parser = OptionParser.new { |parser|
    parser.banner = "Usage: automatic [options] arg"
    parser.version = VERSION
    parser.separator "options:"
    parser.on('-c', '--config FILE', String,
              "recipe YAML file"){|c| recipe_path = c}
    parser.on('-h', '--help', "show this message") { 
      puts parser
      exit
    }
  }

  begin
    parser.parse!
    print "Loading #{recipe_path}\n" unless recipe_path == ""
  rescue OptionParser::ParseError => err
    $stderr.puts err.message
    $stderr.puts parser.help
    exit 1
  end

  # recipe treat as an object.
  recipe = Automatic::Recipe.new(recipe_path)
  Automatic::Pipeline.run(recipe)
end