Class: Woody
- Inherits:
-
Object
- Object
- Woody
- Defined in:
- lib/woody.rb,
lib/woody/post.rb,
lib/woody/episode.rb,
lib/woody/version.rb,
lib/woody/compiler.rb,
lib/woody/deployer.rb,
lib/woody/generator.rb
Overview
Woody podcast static site generator
Defined Under Namespace
Modules: Compiler, Deployer, Generator Classes: Episode, Post
Constant Summary collapse
- VERSION =
Specifies Woody gem version
"0.4.1"
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#directory ⇒ Object
readonly
Returns the value of attribute directory.
Instance Method Summary collapse
- #dir(dir = "") ⇒ Object
-
#initialize(directory = ".") ⇒ Woody
constructor
Load configuration and connect to S3.
- #undir(string) ⇒ Object
- #update_templates ⇒ Object
Methods included from Deployer
Methods included from Compiler
Methods included from Generator
Constructor Details
#initialize(directory = ".") ⇒ Woody
Load configuration and connect to S3
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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/woody.rb', line 33 def initialize(directory = ".") @directory = directory @touchedfiles = [] @s3touchedobjects = [] begin @config = YAML.load_file(dir("woody-config.yml")) rescue Errno::ENOENT puts "This doesn't look like a valid Woody site directory!" exit! end # Strip trailing slash from urlbase, if present. if @config['urlbase'].end_with? "/" @config['urlbase'] = @config['urlbase'][0..-2] end if @config['distributiontype'] == "s3" prefix = @config['s3']['prefix'] unless prefix.nil? @config['urlbase'] = @config['urlbase'] + "/" + prefix end end = { :access_key_id => @config['s3']['accesskey']['id'], :secret_access_key => @config['s3']['accesskey']['secret'] } unless ENV['http_proxy'].nil? uri = URI(ENV['http_proxy']) p = Hash.new p[:host] = uri.host p[:port] = uri.port p[:user] = uri.user unless uri.user.nil? p[:password] = uri.password unless uri.password.nil? [:proxy] = p end AWS::S3::Base.establish_connection!() AWS::S3::DEFAULT_HOST.replace @config['s3']['hostname'] @bucketname = @config['s3']['bucket'] end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
79 80 81 |
# File 'lib/woody.rb', line 79 def config @config end |
#directory ⇒ Object (readonly)
Returns the value of attribute directory.
80 81 82 |
# File 'lib/woody.rb', line 80 def directory @directory end |
Instance Method Details
#dir(dir = "") ⇒ Object
82 83 84 |
# File 'lib/woody.rb', line 82 def dir(dir="") File.(File.join(@directory, dir)) end |
#undir(string) ⇒ Object
86 87 88 |
# File 'lib/woody.rb', line 86 def undir(string) string[dir.length+1..-1] end |
#update_templates ⇒ Object
90 91 92 |
# File 'lib/woody.rb', line 90 def update_templates Generator::update_templates(self) end |