Skip to content

Commit

Permalink
Several fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Hallison Batista authored and Hallison Batista committed Oct 8, 2010
1 parent d31ed09 commit 35bdeb1
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 47 deletions.
80 changes: 51 additions & 29 deletions README.rdoc → README.md
@@ -1,50 +1,48 @@
= Postview
Postview - A lightweight blog engine
====================================

Just write your posts ... and view!
Postview is a simple blog engine (a.k.a. blogware) written in [Ruby][] using
the [Sinatra][] framework and [Kramdown][] parser to renders files written in
[Markdown][].

Postview is a simple blogware written in Ruby using Sinatra DSL and
renders files written in Markdown.
Features
--------

* Easy to configure.
* Easy to synchronize.
* Easy configuration.
* Easy synchronization.
* No database, it's use only text files written in [Markdown][].
* Has suport to themes.

Install {Ruby}[http://www.ruby-lang.org/] Gem package and try.
Getting started
---------------

== Getting start
Install [Ruby][] [Gem package][postview gem] and try.

The Postview requires the following gems:
The Postview depended of the following libraries (Gems):

* {Sinatra}[http://www.sinatrarb.com/]
* {Sinatra-Mapping}[http://sinatra-mapping.rubyforge.org/]
* {Postage}[http://postage.rubyforge.org/]
* [Sinatra][]
* [Sinatra-Mapping][]
* [Postage][]

Install stable gem from {RubyForge.org}[http://rubyforge.org/] or
{GemCutter.org}[http://gemcutter.org/].
Install stable gem from [RubyForge][] or [GemCutter.org][].

$ sudo gem install postview
$ sudo gem install postview

Or, install development gem from {Github.com}[http://github.com/].
Then, run command for create and setup a new Postview directory structure.

$ sudo gem install hallison-postview --source http://gems.github.com/
$ postview create path/to/blog

So, run command for create and setup a new Postview directory structure.
Or run using "--prompt-values":

$ postview create path/to/website

Or run using +--prompt-values+.

$ postview create --prompt-values
$ postview create path/to/blog --prompt-values

After setup, run server with command:

$ RACK_ENV=production postview server

NOTE: Inopportunely, Postview not run server using production environment,
yet.
$ postview server

In your browser, access http://127.0.0.1:9000/.

== Create new post
### Create new post

New post can be created by using the task `post`:

Expand All @@ -55,7 +53,7 @@ Following all instructions. Please, set environment variable +EDITOR+
or +VISUAL+ for editing your posts. Other else, run:

$ cd path/to/postview
$ EDITOR=<your favorite editor> rake post
$ EDITOR=<your-favorite-editor> rake post

The new post will be written in drafts directory. You can pass other
directory.
Expand Down Expand Up @@ -105,3 +103,27 @@ Example:

NOTE: Will added new enhancements for this feature.

[ruby]: http://www.ruby-lang.org
"Ruby Programming Language"

[sinatra]: http://www.sinatrarb.com/
"Sinatra - Classy web framework"

[kramdown]: http://kramdown.rubyforge.org/
"Kramdown - Markdown superset converter"

[markdown]: http://daringfireball.net/projects/markdown
"Markdown - The lightweight markup language"

[sinatra-mapping]: http://sinatra-mapping.rubyforge.org
"Sinatra::Mapping - Extension to map URL paths in Sinatra"

[postage]: http://postage.rubyforge.org/
"Postage - Postview base for parse text files"

[rubyforge]: http://rubyforge.org/
"RubyForge.org"

[gemcutter]: http://gemcutter.org/
"GemCutter.org"

5 changes: 2 additions & 3 deletions bin/postview
Expand Up @@ -5,14 +5,13 @@ require File.expand_path(File.join(__FILE__, "..", "..", "lib", "postview"))

command = ARGV.shift if Postview::CLI.commands.include? ARGV.first
program = File.basename(__FILE__)
ENV['RACK_ENV'] = 'production'

ARGV.options do |arguments|

arguments.summary_indent = " "
arguments.summary_width = 24
arguments.banner = <<-end_banner.gsub /^[ ]{4}/, ''
#{Postview::version_summary}
#{Postview::Version}
Usage:
#{program} <command> [options]
Expand All @@ -28,7 +27,7 @@ ARGV.options do |arguments|
arguments.separator "Global options:"

arguments.on("-h", "--help", nil, "Show this message.") { puts arguments }
arguments.on(nil, "--version", nil, "Show version information.") { puts Postview::about }
arguments.on(nil, "--version", nil, "Show version information.") { puts Postview::Version }

arguments.separator ""

Expand Down
4 changes: 2 additions & 2 deletions lib/postview/application/blog.rb
Expand Up @@ -12,7 +12,7 @@ class Postview::Application::Blog < Sinatra::Base #:nodoc: all
enable :static
enable :session

set :root, Postview.path
set :root, Postview.config.path
set :public, root.join("public")
set :views, theme.join("templates")

Expand Down Expand Up @@ -113,7 +113,7 @@ class Postview::Application::Blog < Sinatra::Base #:nodoc: all
show :search
end

get manager_path do
get dashboard_path do
authenticate!
if authenticated?
@page.title, @page.keywords = title_path(:manager, :posts), @all_tags.join(' ')
Expand Down
8 changes: 2 additions & 6 deletions lib/postview/cli/server_command.rb
@@ -1,4 +1,3 @@
# Copying (c) 2009 Hallison Batista
class Postview::CLI::ServerCommand #:nodoc: all

include Postview::CLI::Command
Expand Down Expand Up @@ -39,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} server <path> [options]
Expand All @@ -60,7 +59,7 @@ def parse_arguments
puts error
puts @arguments
end
puts "#{Postview.version_summary}\n\n"
puts "#{Postview::Version}\n\n"
end

def load_server
Expand All @@ -76,9 +75,6 @@ def load_server
# TODO: Improve this method for run server using production environment.
def start_server
init "Postview starting #{@server} on #{@options[:Host]}:#{@options[:Port]}" do
ENV['RACK_ENV'] = "production"
Postview.path = @path
puts "PATH: #{Postview.path}"
@postview = Rack::Builder.new do |application|
use Rack::CommonLogger, STDOUT
use Rack::ShowExceptions
Expand Down
4 changes: 2 additions & 2 deletions lib/postview/settings.rb
Expand Up @@ -114,7 +114,7 @@ def self.build_default_file

# Returns settings file.
def self.file
Postview.path.join(FILE_DIR, FILE_NAME)
Postview.config.path.join(FILE_DIR, FILE_NAME)
end

# Check directory and returns file that matches with a pattern.
Expand All @@ -125,7 +125,7 @@ def file_names_from(directory, pattern = "**.*")
# Returns a valid directory loaded from settings file.
def path_to(name, *paths)
return Pathname.new(directories[name], *paths) if directories[name].match(%r{^/.*})
Postview.path.join(directories[name], *paths)
Postview.config.path.join(directories[name], *paths)
end

# Parse all attributes to hash.
Expand Down
5 changes: 2 additions & 3 deletions postview.gemspec
Expand Up @@ -176,7 +176,6 @@ Gem::Specification.new do |spec|
#documentation
spec.has_rdoc = true
spec.extra_rdoc_files = [
"README.rdoc",
"COPYING",
"CHANGELOG"
]
Expand All @@ -194,9 +193,9 @@ Gem::Specification.new do |spec|
#{'-'*78}
#{Postview::Version}
Thanks for use this lightweight blogware. Now, you can read your posts by
Thanks for use this lightweight blog-engine. Now, you can read your posts by
editing in your favorite editor.
Please, feedback in http://github.com/hallison/postview/issues.
#{'-'*78}
end_message
Expand Down
4 changes: 2 additions & 2 deletions themes/default/templates/layout.erb
Expand Up @@ -5,7 +5,7 @@

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title><%=site.title%> :: <%=page.title%></title>
<meta name="generator" content="<%=Postview::version_summary%>" />
<meta name="generator" content="<%=Postview::Version%>" />
<meta name="description" content="<%=site.subtitle%>" />
<meta name="keywords" content="<%=page.keywords%>" />
<link rel="shortcut icon" href="<%=path_to :images, "favicon.ico"%>" />
Expand Down Expand Up @@ -119,7 +119,7 @@
<div id="footer">

<p>
<small><%=site.title%> &copy; 2009 <%=site.author%>. Powered by <%=link_to Postview::version_summary, "http://github.com/hallison/postview"%>.</small>
<small><%=site.title%> &copy; 2009 <%=site.author%>. Powered by <%=link_to Postview::Version, "http://github.com/hallison/postview"%>.</small>
</p>

</div><!-- footer -->
Expand Down

0 comments on commit 35bdeb1

Please sign in to comment.