shakespeare 0.1.0 → 0.1.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.
Files changed (41) hide show
  1. data/README.md +88 -84
  2. data/Rakefile +42 -42
  3. data/app/controllers/admin/pages_controller.rb +46 -46
  4. data/app/controllers/pages_controller.rb +4 -4
  5. data/app/models/page.rb +9 -9
  6. data/app/views/admin/pages/_form.html.erb +37 -37
  7. data/app/views/admin/pages/edit.html.erb +2 -2
  8. data/app/views/admin/pages/index.html.erb +23 -23
  9. data/app/views/admin/pages/new.html.erb +2 -2
  10. data/app/views/layouts/admin.html.erb +8 -8
  11. data/app/views/pages/show.html.erb +2 -2
  12. data/config/cucumber.yml +7 -7
  13. data/config/routes.rb +7 -7
  14. data/features/admin_pages.feature +37 -37
  15. data/features/public_pages.feature +11 -11
  16. data/features/step_definitions/page_steps.rb +6 -6
  17. data/features/step_definitions/web_steps.rb +258 -258
  18. data/features/support/env.rb +55 -55
  19. data/features/support/paths.rb +32 -32
  20. data/features/support/shakespeare_env.rb +2 -2
  21. data/generators/shakespeare/USAGE +4 -4
  22. data/generators/shakespeare/shakespeare_generator.rb +7 -7
  23. data/generators/shakespeare/templates/20091230095600_create_pages.rb +25 -25
  24. data/lib/shakespeare.rb +6 -6
  25. data/lib/shakespeare/helpers.rb +15 -15
  26. data/lib/shakespeare/settings.rb +29 -29
  27. data/lib/shakespeare/shakespeare.rb +7 -7
  28. data/lib/shakespeare/view_helpers.rb +28 -28
  29. data/rerun.txt +1 -1
  30. data/shakespeare.gemspec +89 -0
  31. data/spec/blueprints.rb +8 -8
  32. data/spec/controllers/admin/pages_controller_spec.rb +34 -34
  33. data/spec/database.yml +20 -20
  34. data/spec/helpers_spec.rb +19 -19
  35. data/spec/models/page_spec.rb +27 -27
  36. data/spec/schema.rb +15 -15
  37. data/spec/shakespeare_generator_spec.rb +35 -35
  38. data/spec/shakespeare_spec.rb +2 -2
  39. data/spec/spec_helper.rb +40 -40
  40. data/spec/view_helpers_spec.rb +102 -102
  41. metadata +2 -1
data/rerun.txt CHANGED
@@ -1 +1 @@
1
-
1
+
@@ -0,0 +1,89 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{shakespeare}
8
+ s.version = "0.1.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Paul Campbell"]
12
+ s.date = %q{2010-01-04}
13
+ s.email = %q{paul@rslw.com}
14
+ s.extra_rdoc_files = [
15
+ "README.md"
16
+ ]
17
+ s.files = [
18
+ "README.md",
19
+ "Rakefile",
20
+ "app/controllers/admin/pages_controller.rb",
21
+ "app/controllers/pages_controller.rb",
22
+ "app/models/page.rb",
23
+ "app/views/admin/pages/_form.html.erb",
24
+ "app/views/admin/pages/edit.html.erb",
25
+ "app/views/admin/pages/index.html.erb",
26
+ "app/views/admin/pages/new.html.erb",
27
+ "app/views/layouts/admin.html.erb",
28
+ "app/views/pages/show.html.erb",
29
+ "config/cucumber.yml",
30
+ "config/routes.rb",
31
+ "features/admin_pages.feature",
32
+ "features/public_pages.feature",
33
+ "features/step_definitions/page_steps.rb",
34
+ "features/step_definitions/web_steps.rb",
35
+ "features/support/env.rb",
36
+ "features/support/paths.rb",
37
+ "features/support/shakespeare_env.rb",
38
+ "generators/definition.txt",
39
+ "generators/shakespeare/USAGE",
40
+ "generators/shakespeare/shakespeare_generator.rb",
41
+ "generators/shakespeare/templates/20091230095600_create_pages.rb",
42
+ "lib/shakespeare.rb",
43
+ "lib/shakespeare/helpers.rb",
44
+ "lib/shakespeare/settings.rb",
45
+ "lib/shakespeare/shakespeare.rb",
46
+ "lib/shakespeare/view_helpers.rb",
47
+ "rails/init.rb",
48
+ "rerun.txt",
49
+ "shakespeare.gemspec",
50
+ "spec/blueprints.rb",
51
+ "spec/controllers/admin/pages_controller_spec.rb",
52
+ "spec/database.yml",
53
+ "spec/debug.log",
54
+ "spec/helpers_spec.rb",
55
+ "spec/models/page_spec.rb",
56
+ "spec/schema.rb",
57
+ "spec/shakespeare_generator_spec.rb",
58
+ "spec/shakespeare_spec.rb",
59
+ "spec/spec_helper.rb",
60
+ "spec/view_helpers_spec.rb"
61
+ ]
62
+ s.homepage = %q{http://www.github.com/paulca/shakespeare}
63
+ s.rdoc_options = ["--charset=UTF-8"]
64
+ s.require_paths = ["lib"]
65
+ s.rubygems_version = %q{1.3.5}
66
+ s.summary = %q{A Rails drop in CMS.}
67
+ s.test_files = [
68
+ "spec/blueprints.rb",
69
+ "spec/controllers/admin/pages_controller_spec.rb",
70
+ "spec/helpers_spec.rb",
71
+ "spec/models/page_spec.rb",
72
+ "spec/schema.rb",
73
+ "spec/shakespeare_generator_spec.rb",
74
+ "spec/shakespeare_spec.rb",
75
+ "spec/spec_helper.rb",
76
+ "spec/view_helpers_spec.rb"
77
+ ]
78
+
79
+ if s.respond_to? :specification_version then
80
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
81
+ s.specification_version = 3
82
+
83
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
84
+ else
85
+ end
86
+ else
87
+ end
88
+ end
89
+
data/spec/blueprints.rb CHANGED
@@ -1,9 +1,9 @@
1
- require 'machinist/active_record'
2
- require 'sham'
3
- require 'faker'
4
-
5
- Sham.title { Faker::Lorem.sentence }
6
-
7
- Page.blueprint do
8
- title
1
+ require 'machinist/active_record'
2
+ require 'sham'
3
+ require 'faker'
4
+
5
+ Sham.title { Faker::Lorem.sentence }
6
+
7
+ Page.blueprint do
8
+ title
9
9
  end
@@ -1,35 +1,35 @@
1
- require 'spec/spec_helper'
2
-
3
- describe Admin::PagesController do
4
-
5
- describe "#protect_in_production" do
6
-
7
-
8
- context "not in production" do
9
-
10
- it "shouldn't do anything" do
11
- @controller = Admin::PagesController.new
12
- @controller.protect_in_production.should be_true
13
- end
14
-
15
- end
16
-
17
- context "in production" do
18
-
19
- it "shouldn't allow proceeding by default" do
20
- Shakespeare.stub!(:env).and_return('production')
21
- get :index
22
- response.body.should == 'Unauthorized'
23
- end
24
-
25
- it "should allow proceeding if allow_anonymous is set" do
26
- Shakespeare.stub!(:env).and_return('production')
27
- Shakespeare::Settings.stub!(:allow_anonymous).and_return(true)
28
- get :index
29
- response.body.should_not == 'Unauthorized'
30
- end
31
-
32
- end
33
- end
34
-
1
+ require 'spec/spec_helper'
2
+
3
+ describe Admin::PagesController do
4
+
5
+ describe "#protect_in_production" do
6
+
7
+
8
+ context "not in production" do
9
+
10
+ it "shouldn't do anything" do
11
+ @controller = Admin::PagesController.new
12
+ @controller.protect_in_production.should be_true
13
+ end
14
+
15
+ end
16
+
17
+ context "in production" do
18
+
19
+ it "shouldn't allow proceeding by default" do
20
+ Shakespeare.stub!(:env).and_return('production')
21
+ get :index
22
+ response.body.should == 'Unauthorized'
23
+ end
24
+
25
+ it "should allow proceeding if allow_anonymous is set" do
26
+ Shakespeare.stub!(:env).and_return('production')
27
+ Shakespeare::Settings.stub!(:allow_anonymous).and_return(true)
28
+ get :index
29
+ response.body.should_not == 'Unauthorized'
30
+ end
31
+
32
+ end
33
+ end
34
+
35
35
  end
data/spec/database.yml CHANGED
@@ -1,21 +1,21 @@
1
- sqlite:
2
- :adapter: sqlite
3
- :database: vendor/plugins/shakespeare/test/shakespeare_plugin.sqlite.db
4
-
5
- sqlite3:
6
- :adapter: sqlite3
7
- :dbfile: vendor/plugins/shakespeare/test/shakespeare_plugin.sqlite3.db
8
-
9
- postgresql:
10
- :adapter: postgresql
11
- :username: postgres
12
- :password: postgres
13
- :database: shakespeare_plugin_test
14
- :min_messages: ERROR
15
-
16
- mysql:
17
- :adapter: mysql
18
- :host: localhost
19
- :username: root
20
- :password:
1
+ sqlite:
2
+ :adapter: sqlite
3
+ :database: vendor/plugins/shakespeare/test/shakespeare_plugin.sqlite.db
4
+
5
+ sqlite3:
6
+ :adapter: sqlite3
7
+ :dbfile: vendor/plugins/shakespeare/test/shakespeare_plugin.sqlite3.db
8
+
9
+ postgresql:
10
+ :adapter: postgresql
11
+ :username: postgres
12
+ :password: postgres
13
+ :database: shakespeare_plugin_test
14
+ :min_messages: ERROR
15
+
16
+ mysql:
17
+ :adapter: mysql
18
+ :host: localhost
19
+ :username: root
20
+ :password:
21
21
  :database: shakespeare_plugin_test
data/spec/helpers_spec.rb CHANGED
@@ -1,19 +1,19 @@
1
- require 'spec/spec_helper.rb'
2
-
3
- describe Shakespeare::Helpers do
4
-
5
- class TestController < ApplicationController
6
- end
7
-
8
- describe "#page_content" do
9
- before do
10
- @page = mock_model(Page)
11
- Page.stub!(:find_by_url).and_return(@page)
12
- end
13
-
14
- it "should pull the page" do
15
- @controller = TestController.new
16
- @controller.page_content.should == @page
17
- end
18
- end
19
- end
1
+ require 'spec/spec_helper.rb'
2
+
3
+ describe Shakespeare::Helpers do
4
+
5
+ class TestController < ApplicationController
6
+ end
7
+
8
+ describe "#page_content" do
9
+ before do
10
+ @page = mock_model(Page)
11
+ Page.stub!(:find_by_url).and_return(@page)
12
+ end
13
+
14
+ it "should pull the page" do
15
+ @controller = TestController.new
16
+ @controller.page_content.should == @page
17
+ end
18
+ end
19
+ end
@@ -1,28 +1,28 @@
1
- require 'spec/spec_helper'
2
-
3
- describe Page do
4
-
5
- describe "#robots" do
6
-
7
- before do
8
- @page = Page.make_unsaved
9
- end
10
-
11
- it "should have no robots" do
12
- @page.robots.should be_blank
13
- end
14
-
15
- it "should have nofollow by itself" do
16
- @page.nofollow = true
17
- @page.robots.should == 'nofollow'
18
- end
19
-
20
- it "should have both nofollow and noindex" do
21
- @page.nofollow = true
22
- @page.noindex = true
23
- @page.robots.should == 'noindex, nofollow'
24
- end
25
-
26
- end
27
-
1
+ require 'spec/spec_helper'
2
+
3
+ describe Page do
4
+
5
+ describe "#robots" do
6
+
7
+ before do
8
+ @page = Page.make_unsaved
9
+ end
10
+
11
+ it "should have no robots" do
12
+ @page.robots.should be_blank
13
+ end
14
+
15
+ it "should have nofollow by itself" do
16
+ @page.nofollow = true
17
+ @page.robots.should == 'nofollow'
18
+ end
19
+
20
+ it "should have both nofollow and noindex" do
21
+ @page.nofollow = true
22
+ @page.noindex = true
23
+ @page.robots.should == 'noindex, nofollow'
24
+ end
25
+
26
+ end
27
+
28
28
  end
data/spec/schema.rb CHANGED
@@ -1,16 +1,16 @@
1
- ActiveRecord::Schema.define(:version => 0) do
2
- create_table "pages", :force => true do |t|
3
- t.string "title"
4
- t.string "url"
5
- t.text "keywords"
6
- t.text "description"
7
- t.text "content"
8
- t.datetime "created_at"
9
- t.datetime "updated_at"
10
- t.boolean "noindex"
11
- t.boolean "nofollow"
12
- t.string "canonical"
13
- t.boolean "enable_canonical"
14
- t.boolean "enable_keywords"
15
- end
1
+ ActiveRecord::Schema.define(:version => 0) do
2
+ create_table "pages", :force => true do |t|
3
+ t.string "title"
4
+ t.string "url"
5
+ t.text "keywords"
6
+ t.text "description"
7
+ t.text "content"
8
+ t.datetime "created_at"
9
+ t.datetime "updated_at"
10
+ t.boolean "noindex"
11
+ t.boolean "nofollow"
12
+ t.string "canonical"
13
+ t.boolean "enable_canonical"
14
+ t.boolean "enable_keywords"
15
+ end
16
16
  end
@@ -1,36 +1,36 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
2
- require 'rails_generator'
3
- require 'rails_generator/scripts/generate'
4
-
5
- describe ShakespeareGenerator do
6
-
7
- before do
8
- @dirs = {}
9
- @dirs['migration'] = fake_rails_root + '/db/migrate'
10
- @dirs.each do |key, dir|
11
- FileUtils.mkdir_p(dir)
12
- end
13
- @original_files = {}
14
- @original_files['migration'] = file_list(@dirs['migration'])
15
- Rails::Generator::Scripts::Generate.new.run(["shakespeare"], :destination => fake_rails_root, :backtrace => true)
16
- end
17
-
18
- it "should create the migration file" do
19
- new_migration_file = (file_list(@dirs['migration']) - @original_files['migration']).first
20
- "20091230095600_create_pages.rb".should == File.basename(new_migration_file)
21
- end
22
-
23
- after do
24
- FileUtils.rm_r(fake_rails_root)
25
- end
26
-
27
-
28
- def fake_rails_root
29
- File.join(File.dirname(__FILE__), 'spec', 'rails_root')
30
- end
31
-
32
- def file_list(dir)
33
- Dir.glob(File.join(dir, "*"))
34
- end
35
-
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+ require 'rails_generator'
3
+ require 'rails_generator/scripts/generate'
4
+
5
+ describe ShakespeareGenerator do
6
+
7
+ before do
8
+ @dirs = {}
9
+ @dirs['migration'] = fake_rails_root + '/db/migrate'
10
+ @dirs.each do |key, dir|
11
+ FileUtils.mkdir_p(dir)
12
+ end
13
+ @original_files = {}
14
+ @original_files['migration'] = file_list(@dirs['migration'])
15
+ Rails::Generator::Scripts::Generate.new.run(["shakespeare"], :destination => fake_rails_root, :backtrace => true)
16
+ end
17
+
18
+ it "should create the migration file" do
19
+ new_migration_file = (file_list(@dirs['migration']) - @original_files['migration']).first
20
+ "20091230095600_create_pages.rb".should == File.basename(new_migration_file)
21
+ end
22
+
23
+ after do
24
+ FileUtils.rm_r(fake_rails_root)
25
+ end
26
+
27
+
28
+ def fake_rails_root
29
+ File.join(File.dirname(__FILE__), 'spec', 'rails_root')
30
+ end
31
+
32
+ def file_list(dir)
33
+ Dir.glob(File.join(dir, "*"))
34
+ end
35
+
36
36
  end
@@ -1,3 +1,3 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
2
-
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
3
  load_schema
data/spec/spec_helper.rb CHANGED
@@ -1,41 +1,41 @@
1
- begin
2
- require File.dirname(__FILE__) + '/../../../../spec/spec_helper'
3
- rescue LoadError
4
- puts "You need to install rspec in your base app"
5
- exit
6
- end
7
-
8
- plugin_spec_dir = File.dirname(__FILE__)
9
- ActiveRecord::Base.logger = Logger.new(plugin_spec_dir + "/debug.log")
10
-
11
- require File.expand_path(File.join(Rails.root, 'config/environment.rb')) unless defined?(ActiveRecord::Base)
12
- require 'spec/blueprints'
13
-
14
- def load_schema
15
- config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
16
- # ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
17
- #
18
- # db_adapter = ENV['DB']
19
- #
20
- # # no db passed, try one of these fine config-free DBs before bombing.
21
- # db_adapter ||=
22
- # begin
23
- # require 'rubygems'
24
- # require 'sqlite'
25
- # 'sqlite'
26
- # rescue MissingSourceFile
27
- # begin
28
- # require 'sqlite3'
29
- # 'sqlite3'
30
- # rescue MissingSourceFile
31
- # end
32
- # end
33
- #
34
- # if db_adapter.nil?
35
- # raise "No DB Adapter selected. Pass the DB= option to pick one, or install Sqlite or Sqlite3."
36
- # end
37
-
38
- ActiveRecord::Base.establish_connection(config[:mysql])
39
- load(File.dirname(__FILE__) + "/schema.rb")
40
- require File.dirname(__FILE__) + '/../rails/init.rb'
1
+ begin
2
+ require File.dirname(__FILE__) + '/../../../../spec/spec_helper'
3
+ rescue LoadError
4
+ puts "You need to install rspec in your base app"
5
+ exit
6
+ end
7
+
8
+ plugin_spec_dir = File.dirname(__FILE__)
9
+ ActiveRecord::Base.logger = Logger.new(plugin_spec_dir + "/debug.log")
10
+
11
+ require File.expand_path(File.join(Rails.root, 'config/environment.rb')) unless defined?(ActiveRecord::Base)
12
+ require 'spec/blueprints'
13
+
14
+ def load_schema
15
+ config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
16
+ # ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
17
+ #
18
+ # db_adapter = ENV['DB']
19
+ #
20
+ # # no db passed, try one of these fine config-free DBs before bombing.
21
+ # db_adapter ||=
22
+ # begin
23
+ # require 'rubygems'
24
+ # require 'sqlite'
25
+ # 'sqlite'
26
+ # rescue MissingSourceFile
27
+ # begin
28
+ # require 'sqlite3'
29
+ # 'sqlite3'
30
+ # rescue MissingSourceFile
31
+ # end
32
+ # end
33
+ #
34
+ # if db_adapter.nil?
35
+ # raise "No DB Adapter selected. Pass the DB= option to pick one, or install Sqlite or Sqlite3."
36
+ # end
37
+
38
+ ActiveRecord::Base.establish_connection(config[:mysql])
39
+ load(File.dirname(__FILE__) + "/schema.rb")
40
+ require File.dirname(__FILE__) + '/../rails/init.rb'
41
41
  end