jabe 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. data/Gemfile +35 -0
  2. data/Gemfile.lock +217 -0
  3. data/LICENSE.txt +20 -0
  4. data/README.textile +12 -0
  5. data/Rakefile +55 -0
  6. data/VERSION +1 -0
  7. data/app/controllers/admin/base_controller.rb +3 -0
  8. data/app/controllers/admin/entries_controller.rb +42 -0
  9. data/app/controllers/admin/settings_controller.rb +11 -0
  10. data/app/controllers/comments_controller.rb +25 -0
  11. data/app/controllers/entries_controller.rb +26 -0
  12. data/app/helpers/application_helper.rb +9 -0
  13. data/app/models/admin.rb +9 -0
  14. data/app/models/comment.rb +17 -0
  15. data/app/models/entry.rb +17 -0
  16. data/app/models/settings.rb +2 -0
  17. data/app/stylesheets/_will_paginate.scss +102 -0
  18. data/app/stylesheets/application.scss +247 -0
  19. data/app/stylesheets/grid.scss +336 -0
  20. data/app/stylesheets/handheld.scss +7 -0
  21. data/app/stylesheets/style.scss +273 -0
  22. data/app/views/admin/entries/_form.html.haml +6 -0
  23. data/app/views/admin/entries/edit.html.haml +1 -0
  24. data/app/views/admin/entries/index.html.haml +43 -0
  25. data/app/views/admin/entries/new.html.haml +1 -0
  26. data/app/views/admin/settings/edit.html.haml +9 -0
  27. data/app/views/entries/_comment.html.haml +0 -0
  28. data/app/views/entries/_comment_form.html.haml +3 -0
  29. data/app/views/entries/index.html.haml +13 -0
  30. data/app/views/entries/show.html.haml +36 -0
  31. data/app/views/layouts/_footer.html.haml +2 -0
  32. data/app/views/layouts/_header.html.haml +4 -0
  33. data/app/views/layouts/_sidebar.html.haml +0 -0
  34. data/app/views/layouts/application.html.haml +59 -0
  35. data/config/initializers/sass.rb +5 -0
  36. data/config/initializers/settings.rb +5 -0
  37. data/config/initializers/time_formats.rb +4 -0
  38. data/config/routes.rb +26 -0
  39. data/features/admin.feature +30 -0
  40. data/features/entries.feature +24 -0
  41. data/features/step_definitions/admin_steps.rb +14 -0
  42. data/features/step_definitions/entry_steps.rb +35 -0
  43. data/features/step_definitions/support_steps.rb +3 -0
  44. data/features/step_definitions/web_steps.rb +219 -0
  45. data/features/support/blueprints.rb +31 -0
  46. data/features/support/env.rb +59 -0
  47. data/features/support/paths.rb +37 -0
  48. data/lib/generators/jabe/migrations/migrations_generator.rb +42 -0
  49. data/lib/generators/jabe/templates/migrations/create_comments.rb +20 -0
  50. data/lib/generators/jabe/templates/migrations/create_entries.rb +16 -0
  51. data/lib/generators/jabe/templates/migrations/create_settings.rb +21 -0
  52. data/lib/generators/jabe/templates/migrations/create_slugs.rb +18 -0
  53. data/lib/generators/jabe/templates/migrations/devise_create_admins.rb +26 -0
  54. data/lib/jabe.rb +9 -0
  55. data/public/.htaccess +220 -0
  56. data/public/apple-touch-icon.png +0 -0
  57. data/public/blackbird/blackbird.css +80 -0
  58. data/public/blackbird/blackbird.js +365 -0
  59. data/public/blackbird/blackbird.png +0 -0
  60. data/public/crossdomain.xml +25 -0
  61. data/public/images/delete_page.png +0 -0
  62. data/public/images/full_page.png +0 -0
  63. data/public/javascripts/application.js +34 -0
  64. data/public/javascripts/jquery-ui.js +11511 -0
  65. data/public/javascripts/jquery-ui.min.js +404 -0
  66. data/public/javascripts/jquery.js +7179 -0
  67. data/public/javascripts/jquery.min.js +167 -0
  68. data/public/javascripts/libs/dd_belatedpng.js +13 -0
  69. data/public/javascripts/libs/modernizr-1.6.min.js +30 -0
  70. data/public/javascripts/libs/profiling/charts.swf +0 -0
  71. data/public/javascripts/libs/profiling/config.js +59 -0
  72. data/public/javascripts/libs/profiling/yahoo-profiling.css +7 -0
  73. data/public/javascripts/libs/profiling/yahoo-profiling.min.js +39 -0
  74. data/public/javascripts/plugins.js +40 -0
  75. data/public/javascripts/rails.js +154 -0
  76. data/public/nginx.conf +108 -0
  77. data/public/robots.txt +5 -0
  78. data/spec/support/blueprints.rb +31 -0
  79. data/test/dummy/app/controllers/application_controller.rb +3 -0
  80. data/test/dummy/app/helpers/application_helper.rb +2 -0
  81. data/test/dummy/config/application.rb +45 -0
  82. data/test/dummy/config/boot.rb +10 -0
  83. data/test/dummy/config/environment.rb +5 -0
  84. data/test/dummy/config/environments/development.rb +26 -0
  85. data/test/dummy/config/environments/production.rb +49 -0
  86. data/test/dummy/config/environments/test.rb +35 -0
  87. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  88. data/test/dummy/config/initializers/devise.rb +142 -0
  89. data/test/dummy/config/initializers/inflections.rb +10 -0
  90. data/test/dummy/config/initializers/mime_types.rb +5 -0
  91. data/test/dummy/config/initializers/secret_token.rb +7 -0
  92. data/test/dummy/config/initializers/session_store.rb +8 -0
  93. data/test/dummy/config/routes.rb +58 -0
  94. data/test/dummy/db/migrate/20101229224027_create_settings.rb +21 -0
  95. data/test/dummy/db/migrate/20101229224028_create_slugs.rb +18 -0
  96. data/test/dummy/db/migrate/20101229224029_devise_create_admins.rb +26 -0
  97. data/test/dummy/db/migrate/20101229224030_create_entries.rb +16 -0
  98. data/test/dummy/db/migrate/20101229224031_create_comments.rb +20 -0
  99. data/test/dummy/db/schema.rb +82 -0
  100. data/test/dummy/vendor/plugins/acts_as_textiled/init.rb +8 -0
  101. data/test/dummy/vendor/plugins/acts_as_textiled/lib/acts_as_textiled.rb +108 -0
  102. data/test/dummy/vendor/plugins/acts_as_textiled/test/fixtures/author.rb +4 -0
  103. data/test/dummy/vendor/plugins/acts_as_textiled/test/fixtures/story.rb +4 -0
  104. data/test/dummy/vendor/plugins/acts_as_textiled/test/helper.rb +87 -0
  105. data/test/dummy/vendor/plugins/acts_as_textiled/test/textiled_test.rb +145 -0
  106. metadata +641 -0
data/Gemfile ADDED
@@ -0,0 +1,35 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'rails', '~> 3.0.3'
4
+ gem 'devise'
5
+ gem 'friendly_id', '3.1.8'
6
+ gem 'formtastic', '>= 1.2.3.beta'
7
+ gem 'haml', '>= 3.0.23'
8
+ gem 'haml-rails'
9
+ gem 'jquery-rails'
10
+ gem 'RedCloth'
11
+ gem 'sass', '>= 3.1.0.alpha.206'
12
+ gem 'will_paginate', ">= 3.0.pre2"
13
+
14
+ group :development, :test do
15
+ gem 'autotest'
16
+ gem 'autotest-fsevent' if RUBY_PLATFORM =~ /darwin/
17
+ gem 'autotest-growl' if RUBY_PLATFORM =~ /darwin/
18
+ gem 'capybara'
19
+ gem 'csv-mapper'
20
+ gem 'cucumber'
21
+ gem 'cucumber-rails'
22
+ gem 'database_cleaner', '>= 0.6.0'
23
+ gem 'faker'
24
+ gem 'jeweler'
25
+ gem 'launchy'
26
+ gem 'machinist', '>= 2.0.0.beta2'
27
+ gem 'mysql'
28
+ gem 'pickle'
29
+ gem 'rcov'
30
+ gem 'redgreen'
31
+ gem 'rspec-rails', '2.0.1'
32
+ gem 'ruby-debug'
33
+ gem 'sqlite3-ruby'
34
+ gem 'wirble'
35
+ end
@@ -0,0 +1,217 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ RedCloth (4.2.3)
5
+ ZenTest (4.4.2)
6
+ abstract (1.0.0)
7
+ actionmailer (3.0.3)
8
+ actionpack (= 3.0.3)
9
+ mail (~> 2.2.9)
10
+ actionpack (3.0.3)
11
+ activemodel (= 3.0.3)
12
+ activesupport (= 3.0.3)
13
+ builder (~> 2.1.2)
14
+ erubis (~> 2.6.6)
15
+ i18n (~> 0.4)
16
+ rack (~> 1.2.1)
17
+ rack-mount (~> 0.6.13)
18
+ rack-test (~> 0.5.6)
19
+ tzinfo (~> 0.3.23)
20
+ activemodel (3.0.3)
21
+ activesupport (= 3.0.3)
22
+ builder (~> 2.1.2)
23
+ i18n (~> 0.4)
24
+ activerecord (3.0.3)
25
+ activemodel (= 3.0.3)
26
+ activesupport (= 3.0.3)
27
+ arel (~> 2.0.2)
28
+ tzinfo (~> 0.3.23)
29
+ activeresource (3.0.3)
30
+ activemodel (= 3.0.3)
31
+ activesupport (= 3.0.3)
32
+ activesupport (3.0.3)
33
+ arel (2.0.6)
34
+ autotest (4.4.6)
35
+ ZenTest (>= 4.4.1)
36
+ autotest-fsevent (0.2.4)
37
+ sys-uname
38
+ autotest-growl (0.2.9)
39
+ babosa (0.2.0)
40
+ bcrypt-ruby (2.1.3)
41
+ builder (2.1.2)
42
+ capybara (0.4.0)
43
+ celerity (>= 0.7.9)
44
+ culerity (>= 0.2.4)
45
+ mime-types (>= 1.16)
46
+ nokogiri (>= 1.3.3)
47
+ rack (>= 1.0.0)
48
+ rack-test (>= 0.5.4)
49
+ selenium-webdriver (>= 0.0.27)
50
+ xpath (~> 0.1.2)
51
+ celerity (0.8.6)
52
+ childprocess (0.1.6)
53
+ ffi (~> 0.6.3)
54
+ columnize (0.3.2)
55
+ configuration (1.2.0)
56
+ csv-mapper (0.5.1)
57
+ fastercsv
58
+ cucumber (0.10.0)
59
+ builder (>= 2.1.2)
60
+ diff-lcs (~> 1.1.2)
61
+ gherkin (~> 2.3.2)
62
+ json (~> 1.4.6)
63
+ term-ansicolor (~> 1.0.5)
64
+ cucumber-rails (0.3.2)
65
+ cucumber (>= 0.8.0)
66
+ culerity (0.2.13)
67
+ database_cleaner (0.6.0)
68
+ devise (1.1.5)
69
+ bcrypt-ruby (~> 2.1.2)
70
+ warden (~> 1.0.2)
71
+ diff-lcs (1.1.2)
72
+ erubis (2.6.6)
73
+ abstract (>= 1.0.0)
74
+ faker (0.9.2)
75
+ i18n (~> 0.4)
76
+ fastercsv (1.5.3)
77
+ ffi (0.6.3)
78
+ rake (>= 0.8.7)
79
+ formtastic (1.2.3.beta)
80
+ actionpack (>= 2.3.7)
81
+ activesupport (>= 2.3.7)
82
+ i18n (>= 0.4.0)
83
+ friendly_id (3.1.8)
84
+ babosa (~> 0.2.0)
85
+ gherkin (2.3.2)
86
+ json (~> 1.4.6)
87
+ term-ansicolor (~> 1.0.5)
88
+ git (1.2.5)
89
+ haml (3.0.25)
90
+ haml-rails (0.3.4)
91
+ actionpack (~> 3.0)
92
+ activesupport (~> 3.0)
93
+ haml (~> 3.0)
94
+ railties (~> 3.0)
95
+ i18n (0.5.0)
96
+ jeweler (1.5.2)
97
+ bundler (~> 1.0.0)
98
+ git (>= 1.2.5)
99
+ rake
100
+ jquery-rails (0.2.6)
101
+ rails (~> 3.0)
102
+ thor (~> 0.14.4)
103
+ json (1.4.6)
104
+ json_pure (1.4.6)
105
+ launchy (0.3.7)
106
+ configuration (>= 0.0.5)
107
+ rake (>= 0.8.1)
108
+ linecache (0.43)
109
+ machinist (2.0.0.beta2)
110
+ mail (2.2.12)
111
+ activesupport (>= 2.3.6)
112
+ i18n (>= 0.4.0)
113
+ mime-types (~> 1.16)
114
+ treetop (~> 1.4.8)
115
+ mime-types (1.16)
116
+ mysql (2.8.1)
117
+ nokogiri (1.4.4)
118
+ pickle (0.4.4)
119
+ cucumber (>= 0.8)
120
+ rake
121
+ rspec (>= 1.3)
122
+ yard
123
+ polyglot (0.3.1)
124
+ rack (1.2.1)
125
+ rack-mount (0.6.13)
126
+ rack (>= 1.0.0)
127
+ rack-test (0.5.6)
128
+ rack (>= 1.0)
129
+ rails (3.0.3)
130
+ actionmailer (= 3.0.3)
131
+ actionpack (= 3.0.3)
132
+ activerecord (= 3.0.3)
133
+ activeresource (= 3.0.3)
134
+ activesupport (= 3.0.3)
135
+ bundler (~> 1.0)
136
+ railties (= 3.0.3)
137
+ railties (3.0.3)
138
+ actionpack (= 3.0.3)
139
+ activesupport (= 3.0.3)
140
+ rake (>= 0.8.7)
141
+ thor (~> 0.14.4)
142
+ rake (0.8.7)
143
+ rcov (0.9.9)
144
+ redgreen (1.2.2)
145
+ rspec (2.0.1)
146
+ rspec-core (~> 2.0.1)
147
+ rspec-expectations (~> 2.0.1)
148
+ rspec-mocks (~> 2.0.1)
149
+ rspec-core (2.0.1)
150
+ rspec-expectations (2.0.1)
151
+ diff-lcs (>= 1.1.2)
152
+ rspec-mocks (2.0.1)
153
+ rspec-core (~> 2.0.1)
154
+ rspec-expectations (~> 2.0.1)
155
+ rspec-rails (2.0.1)
156
+ rspec (~> 2.0.0)
157
+ ruby-debug (0.10.4)
158
+ columnize (>= 0.1)
159
+ ruby-debug-base (~> 0.10.4.0)
160
+ ruby-debug-base (0.10.4)
161
+ linecache (>= 0.3)
162
+ rubyzip (0.9.4)
163
+ sass (3.1.0.alpha.206)
164
+ selenium-webdriver (0.1.2)
165
+ childprocess (~> 0.1.5)
166
+ ffi (~> 0.6.3)
167
+ json_pure
168
+ rubyzip
169
+ sqlite3-ruby (1.3.2)
170
+ sys-uname (0.8.5)
171
+ term-ansicolor (1.0.5)
172
+ thor (0.14.6)
173
+ treetop (1.4.9)
174
+ polyglot (>= 0.3.1)
175
+ tzinfo (0.3.23)
176
+ warden (1.0.3)
177
+ rack (>= 1.0.0)
178
+ will_paginate (3.0.pre2)
179
+ wirble (0.1.3)
180
+ xpath (0.1.2)
181
+ nokogiri (~> 1.3)
182
+ yard (0.6.4)
183
+
184
+ PLATFORMS
185
+ ruby
186
+
187
+ DEPENDENCIES
188
+ RedCloth
189
+ autotest
190
+ autotest-fsevent
191
+ autotest-growl
192
+ capybara
193
+ csv-mapper
194
+ cucumber
195
+ cucumber-rails
196
+ database_cleaner (>= 0.6.0)
197
+ devise
198
+ faker
199
+ formtastic (>= 1.2.3.beta)
200
+ friendly_id (= 3.1.8)
201
+ haml (>= 3.0.23)
202
+ haml-rails
203
+ jeweler
204
+ jquery-rails
205
+ launchy
206
+ machinist (>= 2.0.0.beta2)
207
+ mysql
208
+ pickle
209
+ rails (~> 3.0.3)
210
+ rcov
211
+ redgreen
212
+ rspec-rails (= 2.0.1)
213
+ ruby-debug
214
+ sass (>= 3.1.0.alpha.206)
215
+ sqlite3-ruby
216
+ will_paginate (>= 3.0.pre2)
217
+ wirble
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Michael Moen
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,12 @@
1
+ h1. Jabe
2
+
3
+ h3. What is this?
4
+
5
+ Jabe is a bare bones blogging engine that is ultimately intended to be installed as a gem. It will grow as its needs do.
6
+
7
+ h2. Basic TODOs
8
+
9
+ * Authors
10
+ * Comment notifications
11
+ * SPAM prevention
12
+ * News feed
@@ -0,0 +1,55 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'rake'
11
+
12
+ require 'jeweler'
13
+ Jeweler::Tasks.new do |gem|
14
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
+ gem.name = "jabe"
16
+ gem.homepage = "http://github.com/pixels-and-bits/jabe"
17
+ gem.license = "MIT"
18
+ gem.summary = "Just Another Blog Engine"
19
+ gem.description = "Blog engine for Rails 3+"
20
+ gem.email = "michael@pixels-and-bits.com"
21
+ gem.authors = ['Michael Moen a.k.a. UnderpantsGnome', 'Neil Heinrich']
22
+ gem.files.exclude 'test/dummy'
23
+ gem.files.exclude 'spec'
24
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
25
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
26
+ # gem.add_runtime_dependency 'jabber4r', '> 0.1'
27
+ # gem.add_development_dependency 'rspec', '> 1.2.3'
28
+ end
29
+ Jeweler::RubygemsDotOrgTasks.new
30
+
31
+ require 'rake/testtask'
32
+ Rake::TestTask.new(:test) do |test|
33
+ test.libs << 'lib' << 'test'
34
+ test.pattern = 'test/**/test_*.rb'
35
+ test.verbose = true
36
+ end
37
+
38
+ require 'rcov/rcovtask'
39
+ Rcov::RcovTask.new do |test|
40
+ test.libs << 'test'
41
+ test.pattern = 'test/**/test_*.rb'
42
+ test.verbose = true
43
+ end
44
+
45
+ task :default => :test
46
+
47
+ require 'rake/rdoctask'
48
+ Rake::RDocTask.new do |rdoc|
49
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
50
+
51
+ rdoc.rdoc_dir = 'rdoc'
52
+ rdoc.title = "jabe #{version}"
53
+ rdoc.rdoc_files.include('README*')
54
+ rdoc.rdoc_files.include('lib/**/*.rb')
55
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.5.0
@@ -0,0 +1,3 @@
1
+ class Admin::BaseController < ApplicationController
2
+ before_filter :authenticate_admin!
3
+ end
@@ -0,0 +1,42 @@
1
+ class Admin::EntriesController < Admin::BaseController
2
+ helper_method :entry
3
+ before_filter :set_is_draft, :only => [:create, :update]
4
+
5
+ def index
6
+ @drafts = Entry.drafts
7
+ @published = Entry.published
8
+ end
9
+
10
+ def create
11
+ if entry = Entry.create(params[:entry])
12
+ redirect_to(admin_entries_path, :notice => 'Entry was successfully created.')
13
+ else
14
+ render :new
15
+ end
16
+ end
17
+
18
+ def update
19
+ if entry.update_attributes(params[:entry])
20
+ redirect_to(admin_entries_path, :notice => 'Entry was successfully updated.')
21
+ else
22
+ render :edit
23
+ end
24
+ end
25
+
26
+ def destroy
27
+ entry.destroy
28
+ redirect_to admin_entries_path
29
+ end
30
+
31
+ private
32
+
33
+ def entry
34
+ @entry ||= params[:id].blank? ?
35
+ Entry.new :
36
+ Entry.find(params[:id])
37
+ end
38
+
39
+ def set_is_draft
40
+ params[:entry][:draft] = (params[:commit] =~ /draft/i).present?
41
+ end
42
+ end
@@ -0,0 +1,11 @@
1
+ class Admin::SettingsController < Admin::BaseController
2
+
3
+ def update
4
+ if SETTINGS.update_attributes(params[:settings])
5
+ Time.zone = SETTINGS.time_zone
6
+ redirect_to admin_root_path, :notice => 'Settings updated'
7
+ else
8
+ render :edit
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,25 @@
1
+ class CommentsController < Admin::BaseController
2
+ layout 'application'
3
+ skip_before_filter :authenticate_admin!, :only => [ :create, :new ]
4
+ helper_method :entry, :comment
5
+
6
+ def create
7
+ if comment.save
8
+ redirect_to entry_path(entry), :notice => 'Your comment was submitted'
9
+ else
10
+ render 'entries/show'
11
+ end
12
+ end
13
+
14
+ private
15
+
16
+ def entry
17
+ @entry ||= Entry.find(params[:entry_id])
18
+ end
19
+
20
+ def comment
21
+ @comment ||= params[:id].blank? ?
22
+ entry.comments.new(params[:comment]) :
23
+ Comment.find(params[:id])
24
+ end
25
+ end
@@ -0,0 +1,26 @@
1
+ class EntriesController < ApplicationController
2
+ helper_method :entry, :comment
3
+
4
+ def index
5
+ @entries = Entry.published.paginate(
6
+ :page => (params[:page] || 1),
7
+ :per_page => (SETTINGS.entries_per_page || 5)
8
+ )
9
+ end
10
+
11
+ def show
12
+ if entry.draft? && ! admin_signed_in?
13
+ render 'public/404.html', :layout => false, :status => 404
14
+ end
15
+ end
16
+
17
+ private
18
+
19
+ def entry
20
+ @entry ||= Entry.find(params[:id])
21
+ end
22
+
23
+ def comment
24
+ @comment ||= entry.comments.new
25
+ end
26
+ end