postage 0.1.4 → 0.1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/AUTHORS ADDED
@@ -0,0 +1,7 @@
1
+ = Authors
2
+
3
+ Postage was maintained and developed by {Hallison
4
+ Batista}[http://hallisonbatista.com].
5
+
6
+ Please, contributors are most welcome.
7
+
data/HISTORY ADDED
@@ -0,0 +1,23 @@
1
+ [0.1.3 - 2009-07-21 - Updates]
2
+ * Removed debug flags.
3
+ * Added task for uninstall gem package.
4
+ * Documentation updated.
5
+
6
+ [0.1.2 - 2009-07-11 - Fixes]
7
+ * All tests have been fixed.
8
+ * Post class have been updated.
9
+ * Finder class have been updated.
10
+ * Fix syntax in task release.
11
+ * Added new extensions.
12
+
13
+ [0.1.1 - 2009-07-11 - Enhancements]
14
+ * Added useful tasks for packaging and release versions
15
+ in RubyForge.org.
16
+ * New information files.
17
+
18
+ [0.1.0 - July 2009]
19
+ * This version has been extracted from
20
+ {Postview}[http://postview.rubyforge.org] project.
21
+ * Posts and all attributes are loaded from text files.
22
+ * All files are found by Finder class.
23
+
data/INFO ADDED
@@ -0,0 +1,13 @@
1
+ :name: postage
2
+ :summary:
3
+ Postage API implemented for helper handle text files for posts.
4
+ :description:
5
+ Postage is an API developed for handle text files for posts for blogs
6
+ or anything else.
7
+ :authors:
8
+ - Hallison Batista
9
+ :email: email@hallisonbatista.com
10
+ :homepage: http://postage.rubyforge.org/
11
+ :dependencies:
12
+ maruku: >= 0.6.0
13
+ RedCloth: >= 4.2.2
data/MANIFEST ADDED
@@ -0,0 +1,23 @@
1
+ AUTHORS
2
+ HISTORY
3
+ INFO
4
+ LICENSE
5
+ MANIFEST
6
+ README
7
+ VERSION
8
+ Rakefile
9
+ lib/postage.rb
10
+ lib/postage/about.rb
11
+ lib/postage/extensions.rb
12
+ lib/postage/finder.rb
13
+ lib/postage/post.rb
14
+ lib/postage/version.rb
15
+ tasks/package.rake
16
+ tasks/postage.rake
17
+ templates/post.erb
18
+ test/fixtures/20080501-postage_test_post.ruby.postage.mkd
19
+ test/fixtures/20080601-postage_test_post.ruby.postage.mkd
20
+ test/fixtures/20090604-postage_test_post.ruby.postage.mkd
21
+ test/fixtures/20090604143805-postage_test_post.ruby.postage.mkd
22
+ test/finder_test.rb
23
+ test/post_test.rb
data/VERSION ADDED
@@ -0,0 +1,8 @@
1
+ ---
2
+ :release: 1
3
+ :date: 2009-09-08
4
+ :cycle: Beta release
5
+ :timestamp: 2009-09-08T16:56:38-04:00
6
+ :major: 0
7
+ :minor: 1
8
+ :patch: 4
data/lib/postage/post.rb CHANGED
@@ -40,8 +40,13 @@ class Post
40
40
  attr_reader :content
41
41
  # Filter for render post file.
42
42
  attr_reader :filter
43
+
44
+ # Post text file
43
45
  attr_reader :file
44
46
 
47
+ # Post file path
48
+ attr_reader :path
49
+
45
50
  # Initialize new post using options.
46
51
  def initialize(options = {})
47
52
  options.instance_variables_set_to(self)
@@ -58,7 +63,8 @@ class Post
58
63
  extract_tags(file_name)
59
64
  extract_filter(file_name)
60
65
  extract_title_and_content(file_name)
61
- @file = Pathname.new(file_name).expand_path
66
+ @path = Pathname.new(file_name)
67
+ @file = @path.to_s
62
68
  @title = @file.gsub('_', ' ').capitalize if @title.to_s.empty?
63
69
  @summary = @content.match(%r{<p>.*</p>}).to_s
64
70
  self
@@ -79,7 +85,7 @@ class Post
79
85
  # Get post file name and creates content and save into directory.
80
86
  def create_into(directory)
81
87
  build_file
82
- directory.join(@file).open 'w+' do |file|
88
+ Pathname.new(directory).join(@file).open 'w+' do |file|
83
89
  post = self
84
90
  file << ERB.new(load_template).result(binding)
85
91
  end
data/tasks/package.rake CHANGED
@@ -3,7 +3,7 @@ require 'rake/gempackagetask'
3
3
  load 'postage.gemspec'
4
4
 
5
5
  def package(ext)
6
- "pkg/#{spec.name}-#{spec.version}.#{ext}"
6
+ "pkg/#{@gemspec.name}-#{@gemspec.version}.#{ext}"
7
7
  end
8
8
 
9
9
  Rake::GemPackageTask.new(@gemspec) do |pkg|
@@ -12,12 +12,12 @@ end
12
12
 
13
13
  desc "Install gem package."
14
14
  task :install => [ :gem ] do
15
- `gem install pkg/#{Postage.specification.name}-#{Postage.specification.version}.gem --local`
15
+ `gem install #{package(:gem)} --local`
16
16
  end
17
17
 
18
18
  desc "Uninstall gem package."
19
19
  task :uninstall do
20
- `gem uninstall #{spec.name}`
20
+ `gem uninstall #{@gemspec.name}`
21
21
  end
22
22
 
23
23
  desc 'Publish gem and tarball to rubyforge.org.'
@@ -0,0 +1,5 @@
1
+ <%= post.title %>
2
+ <%= "=" * post.title.size %>
3
+
4
+ <%= post.content || "Input the content." %>
5
+
data/test/post_test.rb CHANGED
@@ -11,7 +11,7 @@ class TestPost < Test::Unit::TestCase
11
11
  :title => "Postage test <em>post</em>",
12
12
  :tags => %w(ruby postage),
13
13
  :filter => :markdown,
14
- :file => "20090604-postage_test_post.ruby.postage.mkd"
14
+ :file => "#{File.dirname(__FILE__)}/fixtures/20090604-postage_test_post.ruby.postage.mkd"
15
15
  }
16
16
  @post = Postage::Post.load("#{File.dirname(__FILE__)}/fixtures/20090604-postage_test_post.ruby.postage.mkd")
17
17
  end
@@ -26,7 +26,7 @@ class TestPost < Test::Unit::TestCase
26
26
  def test_should_load_attributes_from_file_name_with_datetime
27
27
  @attributes.update(
28
28
  :publish_date => DateTime.new(2009,6,4,14,38,5),
29
- :file => "20090604143805-postage_test_post.ruby.postage.mkd"
29
+ :file => "#{File.dirname(__FILE__)}/fixtures/20090604143805-postage_test_post.ruby.postage.mkd"
30
30
  )
31
31
  @post = Postage::Post.load("#{File.dirname(__FILE__)}/fixtures/20090604143805-postage_test_post.ruby.postage.mkd")
32
32
  @attributes.each do |attribute, value|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hallison Batista
@@ -42,26 +42,29 @@ extra_rdoc_files:
42
42
  - README
43
43
  - LICENSE
44
44
  files:
45
+ - AUTHORS
46
+ - HISTORY
47
+ - INFO
48
+ - LICENSE
49
+ - MANIFEST
50
+ - README
51
+ - VERSION
52
+ - Rakefile
45
53
  - lib/postage.rb
46
- - lib/postage/version.rb
47
- - lib/postage/post.rb
48
- - lib/postage/finder.rb
49
54
  - lib/postage/about.rb
50
55
  - lib/postage/extensions.rb
51
- - tasks/test.rake
52
- - tasks/postage.rake
53
- - tasks/documentation.rake
56
+ - lib/postage/finder.rb
57
+ - lib/postage/post.rb
58
+ - lib/postage/version.rb
54
59
  - tasks/package.rake
55
- - test/post_test.rb
60
+ - tasks/postage.rake
61
+ - templates/post.erb
56
62
  - test/fixtures/20080501-postage_test_post.ruby.postage.mkd
57
- - test/fixtures/20090604143805-postage_test_post.ruby.postage.mkd
58
63
  - test/fixtures/20080601-postage_test_post.ruby.postage.mkd
59
64
  - test/fixtures/20090604-postage_test_post.ruby.postage.mkd
60
- - test/fixtures/20090608-creating_new_entry_from_test_unit.ruby.postage.test.mkd
65
+ - test/fixtures/20090604143805-postage_test_post.ruby.postage.mkd
61
66
  - test/finder_test.rb
62
- - Rakefile
63
- - README
64
- - LICENSE
67
+ - test/post_test.rb
65
68
  has_rdoc: true
66
69
  homepage: http://postage.rubyforge.org/
67
70
  licenses: []
@@ -91,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
94
  requirements: []
92
95
 
93
96
  rubyforge_project: postage
94
- rubygems_version: 1.3.3
97
+ rubygems_version: 1.3.5
95
98
  signing_key:
96
99
  specification_version: 3
97
100
  summary: Postage API implemented for helper handle text files for posts.
@@ -1,17 +0,0 @@
1
- require 'rdoc'
2
- require 'rake/rdoctask'
3
-
4
- Rake::RDocTask.new("doc:api") do |rdoc|
5
- rdoc.title = "Postage - A lightweight API to write post files"
6
- rdoc.main = "README"
7
- rdoc.options = [ '-SHN', '-f', 'darkfish' ]
8
- rdoc.rdoc_dir = 'doc'
9
- rdoc.rdoc_files.include(
10
- "AUTHORS",
11
- "CHANGES",
12
- "LICENSE",
13
- "README",
14
- "lib/**/*.rb"
15
- )
16
- end
17
-
data/tasks/test.rake DELETED
@@ -1,7 +0,0 @@
1
- require 'rake/testtask'
2
-
3
- Rake::TestTask.new do |spec|
4
- spec.libs << "test"
5
- spec.test_files = FileList["test/*test.rb"]
6
- end
7
-
@@ -1,12 +0,0 @@
1
- Creating new `entry` from test unit
2
- ===================================
3
-
4
- Ok. This is a test for create new `entry` from test unit and this paragraph will summary.
5
-
6
- In this file, I'll write any content ... only for test.
7
- Postage is a lightweight API for load posts from flat file that contains
8
- text filtered by [Markdown][] syntax.
9
-
10
- [Markdown]: http://daringfireball.net/projects/markdown/
11
-
12
-