Skip to content
Browse files

Improvements in documentation and source code

  • Loading branch information...
1 parent f180c68 commit 718340defc5fd1a8c8c789940c73f113fe31c0da Hallison Batista committed
Showing with 62 additions and 20 deletions.
  1. +38 −5 README.md
  2. +1 −1 Rakefile
  3. +10 −3 lib/postview.rb
  4. +3 −3 lib/postview/cli/create_command.rb
  5. +10 −8 postview.gemspec
View
43 README.md
@@ -42,6 +42,27 @@ After setup, run server with command:
In your browser, access http://127.0.0.1:9000/.
+### How it works
+
+The Postview creates a directory structure like this:
+
+ .
+ |-- config
+ |-- posts
+ | |-- archive
+ | `-- drafts
+ |-- public
+ |-- themes
+ | `-- default
+ | |-- images
+ | |-- stylesheets
+ | `-- templates
+ | |-- archive
+ | |-- drafts
+ | |-- posts
+ | `-- tags
+ `-- tmp
+
### Create new post
New post can be created by using the task `post`:
@@ -63,13 +84,20 @@ directory.
NOTE: New feature for creates new post from blog manager will be added.
-== Synchronize your posts
+Synchronize your posts
+----------------------
+
+Postview use by default FTP method for synchronization. But, is possible make
+deploy using [Heroku][] and [Git][].
+
-You can synchronize your page using the synchronize tasks. For more
-information about this task, run <code>rake -D sync</code>.
+### FTP
-It's need creates and edit file placed in +/your/home/directory/.netrc+.
-The +directory+ attribute most be setted in +settings.yml+ file.
+You can synchronize your files using the . For more information about
+this task, run <code>rake -D sync</code>.
+
+It's need creates and edit file placed in `/your/home/directory/.netrc`.
+The `directory` attribute most be setted in `settings.yml` file.
Example:
@@ -127,3 +155,8 @@ NOTE: Will added new enhancements for this feature.
[gemcutter]: http://gemcutter.org/
"GemCutter.org"
+[heroku]: http://heroku.com
+ "Heroku"
+
+[git]: http://git-scm.com
+ "Git"
View
2 Rakefile
@@ -52,7 +52,7 @@ namespace :doc do
CLOBBER << FileList["doc/*"]
- file "doc/api/index.html" => FileList["lib/**/*.rb", "README.rdoc", "CHANGELOG"] do |filespec|
+ file "doc/api/index.html" => FileList["lib/**/*.rb", "README.md", "CHANGELOG"] do |filespec|
rm_rf "doc"
rdoc "--op", "doc/api",
"--charset", "utf8",
View
13 lib/postview.rb
@@ -43,7 +43,7 @@ module Postview
require 'rubygems' unless $LOADED_FEATURES.include? 'rubygems.rb'
# Core requires.
- require 'optparse'
+ require 'optparse'
require 'pathname'
require 'ostruct'
require 'yaml'
@@ -51,14 +51,13 @@ module Postview
# 3rd part libraries/projects.
require 'sinatra/base' unless defined? ::Sinatra::Base
require 'sinatra/mapping' unless defined? ::Sinatra::Mapping
- require 'postage' unless defined? ::Postage
# Internal requires
require 'postview/compatibility' if RUBY_VERSION < "1.8.7"
require 'postview/extensions'
# Root path for Postview source.
- ROOT = Pathname.new("#{File.dirname(__FILE__)}/..").expand_path
+ ROOT = Pathname.new("#{File.dirname(__FILE__)}/..").expand_path.freeze
# Auto-load all internal requires.
autoload :Settings, 'postview/settings'
@@ -119,6 +118,8 @@ def initialize(attributes = {})
# end
class Configuration < Base
+ class EmptyError < Exception; end
+
# Default values.
DEFAULTS = {
:blog => {
@@ -179,6 +180,12 @@ def self.load(attributes = {})
new(attributes)
end
+ def self.load_file(filename)
+ yaml = YAML.load_file(filename)
+ raise EmptyError, "The file '#{filename}' is empty." unless yaml
+ load(yaml)
+ end
+
private
# Just initialize all attribute with default values.
View
6 lib/postview/cli/create_command.rb
@@ -38,7 +38,7 @@ def parse_arguments
@arguments.summary_indent = " "
@arguments.summary_width = 24
@arguments.banner = <<-end_banner.gsub(/^[ ]{6}/, '')
- #{Postview.version_summary}
+ #{Postview::Version}
Usage:
#{Postview.name.downcase} create <path>
@@ -66,7 +66,7 @@ def parse_arguments
puts error
puts @arguments
end
- puts "#{Postview.version_summary}\n\n"
+ puts "#{Postview::Version}\n\n"
end
def build_settings
@@ -278,7 +278,7 @@ def ftp(directory, destination = nil)
:tags => prompt("Tags separated by spaces").split(' '),
:filter => :markdown,
:content => <<-end_content.gsub(/^[ ]{28}/,'')
- Thanks for use #{Postview.version_summary}.
+ Thanks for use #{Postview::Version}.
Input here the content of your post.
end_content
View
18 postview.gemspec
@@ -3,16 +3,16 @@ Gem::Specification.new do |spec|
#about
spec.name = "postview"
- spec.summary = "Postview is a simple blogware that render Markdown files."
- spec.description = "Postview is a simple blogware written in Ruby using the Sinatra DSL for render files written in Markdown."
+ spec.summary = "Postview is a simple blog engine that render Markdown files."
+ spec.description = "Postview is a simple blog engine written in Ruby/Sinatra for render files written in Markdown."
spec.authors = ["Hallison Batista"]
- spec.email = "email@hallisonbatista.com"
- spec.homepage = "http://postage.rubyforge.org/"
+ spec.email = "hallison.batista@gmail.com"
+ spec.homepage = "http://postview.rubyforge.org/"
#
#version
spec.version = "0.10.0"
- spec.date = "2009-10-26"
+ spec.date = "2010-02-08"
#
#dependencies
@@ -22,10 +22,11 @@ Gem::Specification.new do |spec|
#manifest
spec.files = [
+ ".version",
"ABOUT",
"CHANGELOG",
"LICENSE",
- "README.rdoc",
+ "README.md",
"Rakefile",
"bin/postview",
"lib/postview.rb",
@@ -52,6 +53,7 @@ Gem::Specification.new do |spec|
"postview.gemspec",
"test/application_blog_test.rb",
"test/application_build_test.rb",
+ "test/config_test.rb",
"test/customizations.rb",
"test/fixtures/blog/config/settings.yml",
"test/fixtures/blog/posts/20090529-third_article.t1.t2.t3.mkd",
@@ -176,7 +178,7 @@ Gem::Specification.new do |spec|
#documentation
spec.has_rdoc = true
spec.extra_rdoc_files = [
- "COPYING",
+ "LICENSE",
"CHANGELOG"
]
spec.rdoc_options = [
@@ -191,7 +193,7 @@ Gem::Specification.new do |spec|
spec.rubyforge_project = spec.name
spec.post_install_message = <<-end_message.gsub(/^[ ]{4}/,'')
#{'-'*78}
- #{Postview::Version}
+ #{spec.name} v#{spec.version} (#{spec.date})
Thanks for use this lightweight blog-engine. Now, you can read your posts by
editing in your favorite editor.

0 comments on commit 718340d

Please sign in to comment.
Something went wrong with that request. Please try again.