octopod 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MDllZmJhOThmNzM4OWFkMjk4YWFmNDRhM2M2YTM1YzA2MjQ0MzFiMw==
5
+ data.tar.gz: !binary |-
6
+ OGJjYmQ4MTFjZDlmOWE2OWEyYmU3OGJmODMwNWMyNjcwNmZiOTE0YQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ NmIzMTI3YTc1NGM5MGViZWYwYWZkYmYwM2VjZmJmMDQzODk1MjJiZGNkNGVk
10
+ Zjc5YzhjODRkOTMzNWIyNzU5ZDY5YjE2M2JlODA3NDAxYzMyOGE1ZjlmNmNj
11
+ OGQ1MTIxZjgyNDc2MjRmNzdmOGQyNTc5MjQ0Nzg4NWMxNTUxOTM=
12
+ data.tar.gz: !binary |-
13
+ NDcyNGIzNjcwZThkNTdhMzI1OTgxNWIxNzljYzhmYWNhMjQ2NjBiMGQ5NTdi
14
+ MzFiYWFmNGI4MmQ3NjgyMGExODlkZTU2NTBmODdkYmQzMTM5Mzg5ZmQyOTg1
15
+ MTNmMjhmM2Y2MGIxYzZkM2Y2MTBjYWJjZTY1YWU4YmE4ZDEyNWQ=
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .DS_Store
19
+ .rbenv-version
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in octopod.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Arne Eilermann
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # Octopod
2
+
3
+ The octopod gem wraps and extends the [jekyll](https://github.com/mojombo/jekyll) command line tool for the needs of [octopod – podcast delivery for geeks](https://github.com/pattex/octopod).
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'octopod'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install octopod
18
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/octopod ADDED
@@ -0,0 +1,214 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'optparse'
5
+ require 'yaml'
6
+
7
+ octopod_help = <<HELP
8
+ Octopod - podcast delivery for geeks
9
+
10
+ Basic Command Line Usage:
11
+ Standard Jekyll commands:
12
+ octopod # . -> ./_site
13
+ octopod <path to write generated site> # . -> <path>
14
+ octopod <path to source> <path to write generated site> # <path> -> <path>
15
+ octopod import <importer name> <options> # imports posts using named import script
16
+
17
+ Additional Octopod commands:
18
+ octopod episode # adds a template for a new episode
19
+ octopod deploy # deploys your site
20
+
21
+ See 'octopod <command> --help' for more information on a specific command.
22
+
23
+ Configuration is read from '<source>/_config.yml' but can be overriden
24
+ using the following options:
25
+
26
+ HELP
27
+
28
+ episode_help = <<EPISODE_HELP
29
+ octopod episode - generates a template to post your next episode
30
+
31
+ octopod episode [options] [audio file[, audio file]]
32
+
33
+ Configuration is read from '<source>/_config.yml' but can be overriden
34
+ using the following options:
35
+
36
+ EPISODE_HELP
37
+
38
+ deploy_help = <<DEPLOY_HELP
39
+ octopod deploy - deploys website via rsync
40
+
41
+ octopod deploy [path to write generated site] [options]
42
+
43
+ Configuration is read from '<source>/_config.yml' but can be overriden
44
+ using the following options:
45
+
46
+ DEPLOY_HELP
47
+
48
+ DEFAULT_EXT = '.md'
49
+
50
+ class OptionParser
51
+ alias_method :_octopod_banner=, :banner=
52
+ def banner=(_)
53
+ return ''
54
+ end
55
+ end
56
+
57
+ def ok_failed(condition)
58
+ if (condition)
59
+ puts "OK"
60
+ else
61
+ puts "FAILED"
62
+ end
63
+ end
64
+
65
+ def write_file?(filename)
66
+ if File.exists?(filename)
67
+ 'y' == ask("Fiel '#{filename}' already exists. Overwrite?", ['y', 'n'])
68
+ else
69
+ true
70
+ end
71
+ end
72
+
73
+ def ask(message, valid_options = nil)
74
+ if valid_options
75
+ answer = get_stdin("#{message} #{valid_options.to_s.gsub(/"/, '').gsub(/, /,'/')} ") while !valid_options.include?(answer)
76
+ else
77
+ answer = get_stdin(message)
78
+ end
79
+ answer
80
+ end
81
+
82
+ def get_stdin(message)
83
+ print message
84
+ STDIN.gets.chomp
85
+ end
86
+
87
+ if ARGV.size > 0 && (ARGV[0] == 'episode' || ARGV[0] == 'deploy')
88
+ options = YAML.load_file(File.join(ROOT_PATH, '_config.yml'))
89
+ options['posts_dir'] = File.join(ROOT_PATH, '_posts')
90
+
91
+ case ARGV[0]
92
+ when 'episode'
93
+ post_header = {
94
+ 'title' => nil,
95
+ 'layout' => 'post',
96
+ 'author' => options['author'],
97
+ 'explicit' => options['explicit'] || 'no',
98
+ 'audio' => {
99
+ 'm4a' => 'name.m4a',
100
+ 'mp3' => 'name.mp3',
101
+ 'opus' => 'name.opus'},
102
+ }
103
+
104
+ opts = OptionParser.new do |opts|
105
+ opts._octopod_banner = episode_help
106
+
107
+ opts.on("-a", "--author [AUTHOR]", "Name of post author") do |episode_author|
108
+ post_header['author'] = options['author'] = episode_author
109
+ end
110
+
111
+ opts.on("-c", "--chapters [chapter1,chapter2,...]", Array, "The episodes chapters.") do |episode_chapters|
112
+ warn episode_chapters.inspect
113
+ post_header['chapters'] = options['chapters'] = episode_chapters
114
+ end
115
+
116
+ opts.on("-d", "--duration [DURATION]", "Duration of the episode") do |episode_duration|
117
+ post_header['duration'] = options['duration'] = episode_duration.to_i
118
+ end
119
+
120
+ opts.on("-e", "--explicit [yes/no]", "Explicit rating for this episode (default: 'no')") do |episode_explicit|
121
+ post_header['explicit'] = options['explicit'] = episode_explicit
122
+ end
123
+
124
+ opts.on("--episode-cover [PATH]", "Path to the image that represents the episode.") do |episode_cover|
125
+ post_header['episode_cover'] = options['episode_cover'] = episode_cover
126
+ end
127
+
128
+ opts.on("-l", "--layout [LAYOUT]", "Layout to use (default: 'post')") do |episode_layout|
129
+ post_header['layout'] = options['layout'] = episode_layout
130
+ end
131
+
132
+ opts.on("-p", "--posts-dir [PATH]", "Path to the post directory (default: '_posts')") do |episode_posts_dir|
133
+ options['posts_dir'] = episode_posts_dir
134
+ end
135
+
136
+ opts.on("-s", "--subtitle [TEXT]", "Subtitle of the episode") do |episode_subtitle|
137
+ post_header['subtitle'] = options['subtitle'] = episode_subtitle
138
+ end
139
+
140
+ opts.on("--summary [TEXT]", "Summary of the episode") do |episode_summary|
141
+ post_header['summary'] = options['summary'] = episode_summary
142
+ end
143
+
144
+ opts.on("--tags [tag1,tag2,...]", Array, "Tags for the episode") do |episode_tags|
145
+ post_header['tags'] = options['tags'] = episode_tags
146
+ end
147
+
148
+ opts.on("-t", "--title [TEXT]", "Title of the episode") do |episode_title|
149
+ post_header['title'] = options['title'] = episode_title
150
+ end
151
+ end
152
+ opts.parse!
153
+
154
+ unless FileTest.directory?(options['posts_dir'])
155
+ abort("rake aborted: '#{options['posts_dir']}' directory not found.")
156
+ end
157
+
158
+ post_header['title'] = post_header['title'] || 'untitled'
159
+ slug = post_header['title'].downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '_')
160
+ date = Time.now.strftime('%Y-%m-%d')
161
+
162
+ filename = File.join(options['posts_dir'], "#{date}-#{slug}#{DEFAULT_EXT}")
163
+
164
+ abort() unless write_file?(filename)
165
+
166
+ open(filename, 'w') do |post|
167
+ post.puts post_header.to_yaml
168
+ post.puts '---'
169
+ post.puts "Insert eloquent and worth reading text here.\n\n"
170
+ post.puts "{{ page | web_player:site }}\n\n"
171
+ post.puts "## Shownotes\n* Note"
172
+ end
173
+
174
+ puts "Created new episode: #{filename}" if File.exists?(filename)
175
+ when 'deploy'
176
+ opts = OptionParser.new do |opts|
177
+ opts._octopod_banner = deploy_help
178
+
179
+ opts.on("--document-root [PATH]", "Path to the document root on the remote machine") do |deploy_document_root|
180
+ options['document_root'] = deploy_document_root
181
+ end
182
+
183
+ opts.on("--rsync-delete", "Delete extraneous files from destination dir") do |deploy_rsync_delete|
184
+ options['rsync_delete'] = deploy_rsync_delete
185
+ end
186
+
187
+ opts.on("--ssh-host [USER@]<HOST>", "[User and] host of the destination machine") do |deploy_ssh_host|
188
+ options['ssh_host'] = deploy_ssh_host =~ /\A\w*@.*/ ? deploy_ssh_host : "#{ENV['USER']}@#{deploy_ssh_host}"
189
+ end
190
+
191
+ opts.on("--ssh-port [PORT]", "SSH port on the remote machine") do |deploy_ssh_port|
192
+ options['ssh_port'] = deploy_ssh_port.to_i
193
+ end
194
+ end
195
+ opts.parse!
196
+
197
+ options['public_dir'] = ARGV[1] ? ARGV[1] : File.join(ROOT_PATH, '_site')
198
+ exclude = ""
199
+ if File.exists?('./rsync-exclude')
200
+ exclude = "--exclude-from '#{File.expand_path('./rsync-exclude')}'"
201
+ end
202
+ puts "## Deploying website via Rsync"
203
+
204
+ rsync_command = "rsync --progress -avze 'ssh -p #{options['ssh_port']}' #{exclude} \
205
+ #{"--delete" unless options['rsync_delete'] == false} \
206
+ #{options['public_dir']}/ #{options['ssh_host']}:#{options['document_root']}"
207
+
208
+ ok_failed system(rsync_command)
209
+ end
210
+ else
211
+ puts octopod_help if ARGV.size > 0 && ARGV[0] == '--help'
212
+ load Gem.bin_path('jekyll', 'jekyll')
213
+ end
214
+
@@ -0,0 +1,3 @@
1
+ module Octopod
2
+ VERSION = "0.1.0"
3
+ end
data/octopod.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'octopod/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "octopod"
8
+ spec.version = Octopod::VERSION
9
+ spec.authors = ["Arne Eilermann"]
10
+ spec.email = ["eilermann@lavabit.com"]
11
+ spec.description = %q{Command-line wrapper for jekyll and octopod}
12
+ spec.summary = %q{The octopod gem wraps and extends the jekyll command line tool for the needs of octopod – podcast delivery for geeks <https://github.com/pattex/octopod>}
13
+ spec.homepage = "https://github.com/pattex/octopod-gem"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = ['octopod']
18
+
19
+ spec.add_dependency "jekyll"
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: octopod
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Arne Eilermann
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-02-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jekyll
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Command-line wrapper for jekyll and octopod
56
+ email:
57
+ - eilermann@lavabit.com
58
+ executables:
59
+ - octopod
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - .gitignore
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - bin/octopod
69
+ - lib/octopod/version.rb
70
+ - octopod.gemspec
71
+ homepage: https://github.com/pattex/octopod-gem
72
+ licenses:
73
+ - MIT
74
+ metadata: {}
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ! '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project:
91
+ rubygems_version: 2.0.0
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: The octopod gem wraps and extends the jekyll command line tool for the needs
95
+ of octopod – podcast delivery for geeks <https://github.com/pattex/octopod>
96
+ test_files: []