hackety_sling 0.0.3 → 0.0.4

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/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ script: "bundle exec rake"
2
+ rvm:
3
+ - 1.9.2
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Hackety Sling
2
+
3
+ [![Build Status](https://secure.travis-ci.org/ralph/hackety-sling.png)](http://travis-ci.org/ralph/hackety-sling)
4
+
5
+ Hackety Sling is a very simple blog software based on [Sinatra](http://github.com/sinatra/sinatra) and [Document Mapper](http://github.com/ralph/document_mapper). It will add the following pages to your Sinatra application:
6
+
7
+ * An index page (`/`), showing 2 posts by default
8
+ * Posts by year/month/day, e.g. `/2010/08/10/`, `/2010/08/` or `/2010/`
9
+ * Showing a single post, e.g.: `/2010/11/13/my-post/`
10
+ * Showing posts by tag, e.g.: `/tags/ruby/`
11
+ * Showing posts by author, e.g.: `/author/ralph/`
12
+ * An archive page: `/archive/`
13
+ * An atom feed: `/atom.xml`
14
+
15
+
16
+ Getting Hackety Sling to play nice with your existing Sinatra Application is easy. Just include the module and add some configuration settings, like in the example below:
17
+
18
+ ```ruby
19
+ class MySuperBlog < Sinatra::Base
20
+ register Sinatra::HacketySling
21
+
22
+ set :hackety_sling_title, 'My super blog | A blog about stuff'
23
+ set :hackety_sling_author, 'Carlos Testuser'
24
+
25
+
26
+ # Optional
27
+ set :hackety_sling_posts_on_index
28
+
29
+ get '/other-sinatra-page/' do
30
+ erubis :other_sinatra_page
31
+ end
32
+ end
33
+ ```
34
+
35
+ ## Author
36
+
37
+ Written by [Ralph von der Heyden](http://www.rvdh.de). Don't hesitate to contact me if you have any further questions.
38
+
39
+ Follow me on [Twitter](http://twitter.com/ralph)
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module HacketySling
3
- VERSION = '0.0.3'
3
+ VERSION = '0.0.4'
4
4
  end
5
5
  end
@@ -13,26 +13,26 @@ module Sinatra
13
13
  app.get '/' do
14
14
  limit = app.hackety_sling_posts_on_index
15
15
  @posts = Post.order_by(:date => :desc).limit(limit).all
16
- erubis :index
16
+ erb :index
17
17
  end
18
18
 
19
19
  app.get '/archive/' do
20
20
  @posts = Post.order_by(:date => :asc).all
21
- erubis :post_list
21
+ erb :post_list
22
22
  end
23
23
 
24
24
  %w(tags author).each do |attribute|
25
25
  app.get "/#{attribute}/:value/" do |value|
26
26
  @posts = Post.order_by(:date => :desc)
27
27
  @posts = @posts.where(attribute.to_sym.include => value).all
28
- erubis :posts
28
+ erb :posts
29
29
  end
30
30
  end
31
31
 
32
32
  Post.all.each do |post|
33
33
  app.get post.permalink do
34
34
  @post = post
35
- erubis :post
35
+ erb :post
36
36
  end
37
37
  base_name = post.file_name_without_extension.sub(/^\d{4}-\d{2}-\d{2}-/, '')
38
38
  app.get "/#{base_name}/" do
@@ -47,7 +47,7 @@ module Sinatra
47
47
  selector_hash[ymd[index]] = date_part.to_i unless date_part.nil?
48
48
  end
49
49
  @posts = Post.order_by(:date => :desc).where(selector_hash).all
50
- erubis :posts
50
+ erb :posts
51
51
  end
52
52
 
53
53
  app.get '/atom.xml' do
@@ -19,7 +19,7 @@ describe TestApp do
19
19
  end
20
20
 
21
21
  before do
22
- @post_titles = Sinatra::HacketySling::Post.all.map(&:title)
22
+ @post_titles = Sinatra::HacketySling::Post.order_by(:title => :asc).all.map(&:title)
23
23
  end
24
24
 
25
25
  describe 'when requesting the index path' do
data/test/post_test.rb CHANGED
@@ -10,10 +10,10 @@ include Sinatra::HacketySling
10
10
 
11
11
  describe Post do
12
12
  it 'should return the correct date permalink' do
13
- assert_equal '/2010/08/09/', Post.first.date_permalink
13
+ assert_equal '/2010/08/09/', Post.order_by(:title => :asc).first.date_permalink
14
14
  end
15
15
 
16
16
  it 'should return the correct permalink' do
17
- assert_equal '/2010/08/09/test-post-1/', Post.first.permalink
17
+ assert_equal '/2010/08/09/test-post-1/', Post.order_by(:title => :asc).first.permalink
18
18
  end
19
19
  end
data/test/test_app.rb CHANGED
@@ -3,4 +3,5 @@ require 'sinatra/hackety_sling'
3
3
 
4
4
  class TestApp < Sinatra::Base
5
5
  register Sinatra::HacketySling
6
+ set :views, Proc.new { File.join(root, '..', 'views') }
6
7
  end
@@ -1,4 +1,4 @@
1
- <% @posts.each do |post| -%>
1
+ <% @posts.each do |post| %>
2
2
  <a href="<%= post.permalink %>"><%=post.title %></a>
3
3
  <%= post.to_html %>
4
- <% end -%>
4
+ <% end %>
File without changes
@@ -1,3 +1,3 @@
1
- <%- @posts.each do |post| -%>
1
+ <% @posts.each do |post| %>
2
2
  <a href="<%= post.permalink %>"><%=post.title %></a>
3
- <%- end -%>
3
+ <% end %>
@@ -1,4 +1,4 @@
1
- <% @posts.each do |post| -%>
1
+ <% @posts.each do |post| %>
2
2
  <a href="<%= post.permalink %>"><%=post.title %></a>
3
3
  <%= post.to_html %>
4
- <% end -%>
4
+ <% end %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hackety_sling
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-06-23 00:00:00.000000000Z
12
+ date: 2011-10-20 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: document_mapper
16
- requirement: &2153291960 !ruby/object:Gem::Requirement
16
+ requirement: &70301858857940 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2153291960
24
+ version_requirements: *70301858857940
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: erubis
27
- requirement: &2153291540 !ruby/object:Gem::Requirement
27
+ requirement: &70301858857080 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2153291540
35
+ version_requirements: *70301858857080
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: sinatra
38
- requirement: &2153291120 !ruby/object:Gem::Requirement
38
+ requirement: &70301858855940 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2153291120
46
+ version_requirements: *70301858855940
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: ratom
49
- requirement: &2153290700 !ruby/object:Gem::Requirement
49
+ requirement: &70301858854820 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2153290700
57
+ version_requirements: *70301858854820
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rack-test
60
- requirement: &2153290280 !ruby/object:Gem::Requirement
60
+ requirement: &70301858852940 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2153290280
68
+ version_requirements: *70301858852940
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: RedCloth
71
- requirement: &2155964520 !ruby/object:Gem::Requirement
71
+ requirement: &70301858851920 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2155964520
79
+ version_requirements: *70301858851920
80
80
  description: A simple blog engine based on Sinatra and document_mapper
81
81
  email:
82
82
  - ralph@rvdh.de
@@ -85,7 +85,9 @@ extensions: []
85
85
  extra_rdoc_files: []
86
86
  files:
87
87
  - .gitignore
88
+ - .travis.yml
88
89
  - Gemfile
90
+ - README.md
89
91
  - Rakefile
90
92
  - hackety_sling.gemspec
91
93
  - lib/sinatra/hackety_sling.rb
@@ -98,10 +100,10 @@ files:
98
100
  - test/test_posts/2010-08-10-test-post-2.textile
99
101
  - test/test_posts/2010-11-13-test-post-3.textile
100
102
  - test/test_posts/2011-02-28-test-post-4.textile
101
- - views/index.erubis
102
- - views/post.erubis
103
- - views/post_list.erubis
104
- - views/posts.erubis
103
+ - views/index.erb
104
+ - views/post.erb
105
+ - views/post_list.erb
106
+ - views/posts.erb
105
107
  homepage: http://rvdh.de
106
108
  licenses: []
107
109
  post_install_message:
@@ -114,15 +116,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
114
116
  - - ! '>='
115
117
  - !ruby/object:Gem::Version
116
118
  version: '0'
119
+ segments:
120
+ - 0
121
+ hash: -4069875926690539564
117
122
  required_rubygems_version: !ruby/object:Gem::Requirement
118
123
  none: false
119
124
  requirements:
120
125
  - - ! '>='
121
126
  - !ruby/object:Gem::Version
122
127
  version: '0'
128
+ segments:
129
+ - 0
130
+ hash: -4069875926690539564
123
131
  requirements: []
124
132
  rubyforge_project:
125
- rubygems_version: 1.8.5
133
+ rubygems_version: 1.8.10
126
134
  signing_key:
127
135
  specification_version: 3
128
136
  summary: A simple blog engine based on Sinatra and document_mapper