woody 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Woody
2
2
 
3
- Podcast static site generator
3
+ **Woody is a static podcast site generator.**
4
+
5
+ Drop your mp3s in a folder, set some metadata and deploy a full podcast site to Amazon S3.
4
6
 
5
7
  ## Installation
6
8
 
@@ -9,11 +11,33 @@ To install, run this:
9
11
  $ gem install woody
10
12
 
11
13
  ## To Do List/Roadmap
12
- [Here, on trello](https://trello.com/board/woody-to-do-list/50c7903cc0e26dc906001fd6)
14
+ We've got a [Roadmap](https://trello.com/board/woody-to-do-list/50c7903cc0e26dc906001fd6) up and running on Trello where you can suggest features, report bugs and track the project's progress.
13
15
 
14
16
  ## Usage
15
17
 
16
- TODO: Write usage instructions here
18
+ Install the gem (see above) and create a new project with
19
+
20
+ $ woody new projectname
21
+
22
+ Woody will generate a new project with the name given. Open up the project folder and edit the **woody-config.yml** to your liking.
23
+
24
+ Dump some mp3s into the **/content** folder and run
25
+
26
+ $ woody compile
27
+
28
+ Woody will index the mp3s and prompt you for metadata. You can change this data by editing the **metadata.yml** file in the **/content/** directory.
29
+
30
+ After this, Woody will generate a full HTML site in the output folder. You can upload this to your host manually or use
31
+
32
+ $ woody deploy
33
+
34
+ to deploy your Woody site on to Amazon S3 (be sure to enter your AWS credentials correctly into the configuration file.)
35
+
36
+ **SCREENCAST COMING SOON!**
37
+
38
+ ## About Woody
39
+
40
+ Woody was developed by David Robertson and David Hewitson as a hosting solution for [an online sitcom](http://spaceferries.com). We decided to release it for free for a laugh.
17
41
 
18
42
  ## Contributing
19
43
 
@@ -10,9 +10,9 @@ module Woody
10
10
 
11
11
  # instantiate the metadata hash so shit doesn't explode in our faces
12
12
  # WEIRD SHIT: used .empty? here before but fails if used on hash seemingly
13
- if meta == false
14
- meta = Hash.new
15
- end
13
+ if meta == false
14
+ meta = Hash.new
15
+ end
16
16
 
17
17
  episodes = Array.new
18
18
  filesfound = Array.new
@@ -76,7 +76,7 @@ module Woody
76
76
  ep = Erubis::Eruby.new(File.read('templates/episode.html'))
77
77
  ep.result(config: $config, episodes: episodes, episode: episode)
78
78
  end
79
- write_output_file(episode.path) {|f| f.write(episode_compiled) }
79
+ write_output_file(episode.path!) {|f| f.write(episode_compiled) }
80
80
  end
81
81
 
82
82
  # Copy over iTunes.png
@@ -28,11 +28,13 @@ module Woody
28
28
  # @param [Array] touchedfiles specifies the S3 objects to keep
29
29
  def self.purge_bucket
30
30
  bucket = AWS::S3::Bucket.find $bucketname
31
- bucket.objects.each do |object|
32
- prefix = $config['s3']['prefix']
33
- if prefix.nil?
31
+ prefix = $config['s3']['prefix']
32
+ if prefix.nil?
33
+ bucket.objects.each do |object|
34
34
  object.delete unless @@touchedfiles.include? object.key
35
- else
35
+ end
36
+ else
37
+ bucket.objects.each do |object|
36
38
  if object.key.start_with? prefix # If using a prefix, don't delete anything outside of that 'subdirectory'
37
39
  object.delete unless @@touchedfiles.include? object.key
38
40
  end
data/lib/woody/episode.rb CHANGED
@@ -32,28 +32,43 @@ module Woody
32
32
 
33
33
  # @return the episode's page URL where possible, otherwise false
34
34
  def url
35
- return "#{$config['urlbase']}#{path}" unless path == false
35
+ return "#{$config['urlbase']}#{path!}" unless path! == false
36
36
  return false
37
37
  end
38
38
 
39
- # @return the episode's page path where possible, otherwise false
40
- def path(leader=true)
39
+ # @return the episode's page path! where possible, otherwise false. Does not take prefix in to account.
40
+ def path!(leader=true)
41
41
  return "#{leader ? "/" : ""}episode/#{@compiledname[0..-5]}.html" unless @compiledname.nil?
42
42
  return false
43
43
  end
44
44
 
45
+ # @return the episode's page path! where possible, otherwise false. Includes the site prefix if enabled.
46
+ def path(leader=true)
47
+ prefix = $config['s3']['prefix']
48
+ return "#{leader ? "/" : ""}#{prefix.nil? ? "" : prefix + "/" }episode/#{@compiledname[0..-5]}.html" unless @compiledname.nil?
49
+ return false
50
+ end
51
+
45
52
  # @return the episode's media file URL where possible, otherwise false
46
53
  def file_url
47
- return "#{$config['urlbase']}#{file_path}" unless file_path == false
54
+ return "#{$config['urlbase']}#{file_path!}" unless file_path! == false
48
55
  return false
49
56
  end
50
57
 
51
- # @return the episode's media file path where possible, otherwise false
52
- def file_path(leader=true)
58
+ # @return the episode's media file path! where possible, otherwise false. Does not take prefix in to account.
59
+ def file_path!(leader=true)
53
60
  return "#{leader ? "/" : ""}assets/mp3/#{@compiledname}" unless @compiledname.nil?
54
61
  return false
55
62
  end
56
63
 
64
+ # @return the episode's media file path! where possible, otherwise false. Includes site prefix if enabled.
65
+ def file_path(leader=true)
66
+ prefix = $config['s3']['prefix']
67
+ return "#{leader ? "/" : ""}#{prefix.nil? ? "" : prefix + "/" }assets/mp3/#{@compiledname}" unless @compiledname.nil?
68
+ return false
69
+ end
70
+
71
+
57
72
  # @return [String] a comma separated list of tags, or nil if no tags
58
73
  def keywords
59
74
  @tags.join ', ' unless @tags.nil? or @tags.empty?
data/lib/woody/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Woody
2
2
  # Specifies Woody gem version
3
- VERSION = "0.3.3"
3
+ VERSION = "0.3.4"
4
4
  end
data/lib/woody.rb CHANGED
@@ -31,7 +31,19 @@ module Woody
31
31
  puts "This doesn't look like a valid Woody site directory!"
32
32
  exit!
33
33
  end
34
-
34
+
35
+ # Strip trailing slash from urlbase, if present.
36
+ if $config['urlbase'].end_with? "/"
37
+ $config['urlbase'] = $config['urlbase'][0..-2]
38
+ end
39
+
40
+ if $config['distributiontype'] == "s3"
41
+ prefix = $config['s3']['prefix']
42
+ unless prefix.nil?
43
+ $config['urlbase'] = $config['urlbase'] + "/" + prefix
44
+ end
45
+ end
46
+
35
47
  options = {
36
48
  :access_key_id => $config['s3']['accesskey']['id'],
37
49
  :secret_access_key => $config['s3']['accesskey']['secret']
@@ -6,7 +6,7 @@
6
6
  <link rel="stylesheet" type="text/css" href="/assets/stylesheet.css" />
7
7
  </head>
8
8
  <body>
9
- <h1><%= link_to $config['title'], "/" %></h1>
9
+ <h1><%= link_to $config['title'], $config['urlbase'] %></h1>
10
10
  <h2><%= $config['subtitle'] %></h2>
11
11
  <hr />
12
12
  <%= yield %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: woody
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: