nesta 0.9.11 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -11
  3. data/.gitmodules +6 -0
  4. data/.hound.yml +2 -0
  5. data/{spec/spec.opts → .rspec} +0 -0
  6. data/.travis.yml +11 -0
  7. data/CHANGES +250 -2
  8. data/Gemfile +2 -2
  9. data/Gemfile.lock +89 -33
  10. data/Guardfile +7 -0
  11. data/LICENSE +1 -1
  12. data/README.md +38 -6
  13. data/RELEASING.md +21 -0
  14. data/Rakefile +20 -4
  15. data/bin/nesta +131 -14
  16. data/config.ru +3 -0
  17. data/lib/nesta.rb +9 -1
  18. data/lib/nesta/app.rb +21 -107
  19. data/lib/nesta/commands.rb +5 -256
  20. data/lib/nesta/commands/command.rb +57 -0
  21. data/lib/nesta/commands/demo.rb +1 -0
  22. data/lib/nesta/commands/demo/content.rb +56 -0
  23. data/lib/nesta/commands/edit.rb +21 -0
  24. data/lib/nesta/commands/new.rb +57 -0
  25. data/lib/nesta/commands/plugin.rb +1 -0
  26. data/lib/nesta/commands/plugin/create.rb +82 -0
  27. data/lib/nesta/commands/theme.rb +3 -0
  28. data/lib/nesta/commands/theme/create.rb +36 -0
  29. data/lib/nesta/commands/theme/enable.rb +22 -0
  30. data/lib/nesta/commands/theme/install.rb +31 -0
  31. data/lib/nesta/config.rb +51 -22
  32. data/lib/nesta/helpers.rb +115 -0
  33. data/lib/nesta/models.rb +111 -70
  34. data/lib/nesta/navigation.rb +36 -12
  35. data/lib/nesta/overrides.rb +10 -5
  36. data/lib/nesta/plugin.rb +10 -8
  37. data/lib/nesta/version.rb +1 -1
  38. data/nesta.gemspec +14 -13
  39. data/templates/Gemfile +6 -3
  40. data/templates/config.ru +3 -0
  41. data/templates/config/config.yml +14 -14
  42. data/templates/config/deploy.rb +2 -2
  43. data/templates/index.haml +2 -0
  44. data/templates/plugins/Gemfile +4 -0
  45. data/templates/plugins/README.md +13 -0
  46. data/templates/plugins/Rakefile +58 -0
  47. data/templates/plugins/gitignore +3 -0
  48. data/templates/plugins/lib/init.rb +13 -0
  49. data/templates/plugins/lib/required.rb +3 -0
  50. data/templates/plugins/lib/version.rb +5 -0
  51. data/templates/plugins/plugin.gemspec +28 -0
  52. data/templates/themes/README.md +1 -1
  53. data/templates/themes/app.rb +1 -1
  54. data/templates/themes/views/layout.haml +7 -0
  55. data/templates/themes/views/master.sass +3 -0
  56. data/templates/themes/views/page.haml +1 -0
  57. data/{spec → test}/fixtures/nesta-plugin-test/Gemfile +0 -0
  58. data/{spec → test}/fixtures/nesta-plugin-test/Rakefile +0 -0
  59. data/{spec → test}/fixtures/nesta-plugin-test/lib/nesta-plugin-test.rb +0 -0
  60. data/{spec → test}/fixtures/nesta-plugin-test/lib/nesta-plugin-test/init.rb +1 -3
  61. data/{spec → test}/fixtures/nesta-plugin-test/lib/nesta-plugin-test/version.rb +0 -0
  62. data/{spec → test}/fixtures/nesta-plugin-test/nesta-plugin-test.gemspec +0 -0
  63. data/test/integration/atom_feed_test.rb +178 -0
  64. data/test/integration/commands/demo/content_test.rb +31 -0
  65. data/test/integration/commands/edit_test.rb +21 -0
  66. data/test/integration/commands/new_test.rb +120 -0
  67. data/test/integration/commands/plugin/create_test.rb +128 -0
  68. data/test/integration/commands/theme/create_test.rb +35 -0
  69. data/test/integration/commands/theme/enable_test.rb +22 -0
  70. data/test/integration/commands/theme/install_test.rb +62 -0
  71. data/test/integration/default_theme_test.rb +220 -0
  72. data/test/integration/overrides_test.rb +118 -0
  73. data/test/integration/route_handlers_test.rb +96 -0
  74. data/test/integration/sitemap_test.rb +85 -0
  75. data/test/integration_test_helper.rb +61 -0
  76. data/test/support/model_factory.rb +169 -0
  77. data/test/support/silence_commands_during_tests.rb +5 -0
  78. data/test/support/temporary_files.rb +33 -0
  79. data/test/support/test_configuration.rb +19 -0
  80. data/test/test_helper.rb +26 -0
  81. data/test/unit/commands_test.rb +23 -0
  82. data/test/unit/config_test.rb +138 -0
  83. data/test/unit/file_model_test.rb +71 -0
  84. data/test/unit/menu_test.rb +82 -0
  85. data/test/unit/page_test.rb +571 -0
  86. data/test/unit/path_test.rb +41 -0
  87. data/test/unit/plugin_test.rb +47 -0
  88. data/views/analytics.haml +9 -10
  89. data/views/atom.haml +4 -4
  90. data/views/comments.haml +1 -1
  91. data/views/error.haml +1 -1
  92. data/views/feed.haml +1 -1
  93. data/views/layout.haml +6 -3
  94. data/views/master.sass +144 -134
  95. data/views/mixins.sass +53 -28
  96. data/views/normalize.scss +396 -0
  97. data/views/page_meta.haml +2 -2
  98. data/views/sitemap.haml +2 -2
  99. data/views/summaries.haml +2 -2
  100. metadata +258 -232
  101. data/lib/nesta/cache.rb +0 -139
  102. data/lib/nesta/nesta.rb +0 -7
  103. data/spec/atom_spec.rb +0 -138
  104. data/spec/commands_spec.rb +0 -364
  105. data/spec/config_spec.rb +0 -67
  106. data/spec/model_factory.rb +0 -92
  107. data/spec/models_spec.rb +0 -588
  108. data/spec/overrides_spec.rb +0 -132
  109. data/spec/page_spec.rb +0 -498
  110. data/spec/path_spec.rb +0 -28
  111. data/spec/plugin_spec.rb +0 -51
  112. data/spec/sitemap_spec.rb +0 -100
  113. data/spec/spec_helper.rb +0 -76
@@ -1,28 +0,0 @@
1
- require File.expand_path('spec_helper', File.dirname(__FILE__))
2
-
3
- describe 'Nesta::Path' do
4
- before(:each) do
5
- @root = File.expand_path('..', File.dirname(__FILE__))
6
- @local_foo_bar = File.join(@root, 'foo/bar')
7
- end
8
-
9
- it 'should return local path' do
10
- Nesta::Path.local.should == @root
11
- end
12
-
13
- it 'should return path for file within local directory' do
14
- Nesta::Path.local('foo/bar').should == @local_foo_bar
15
- end
16
-
17
- it 'should combine path components' do
18
- Nesta::Path.local('foo', 'bar').should == @local_foo_bar
19
- end
20
-
21
- it 'should return themes path' do
22
- Nesta::Path.themes.should == File.expand_path('themes', @root)
23
- end
24
-
25
- it 'should return path for file within themes directory' do
26
- Nesta::Path.themes('foo/bar').should == File.join(@root, 'themes/foo/bar')
27
- end
28
- end
@@ -1,51 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Plugin gem loading" do
4
- include ConfigSpecHelper
5
-
6
- def remove_plugin_from_list_of_required_files
7
- $".delete_if { |path| path =~ /nesta-plugin-test/ } # feel free to vomit
8
- end
9
-
10
- def remove_plugin_constants
11
- Nesta::Plugin::Test
12
- rescue NameError
13
- else
14
- Nesta::Plugin::Test.send(:remove_const, :VERSION)
15
- end
16
-
17
- before(:each) do
18
- stub_configuration
19
- @plugin_lib_path = File.expand_path(
20
- File.join(%w(fixtures nesta-plugin-test lib)), File.dirname(__FILE__))
21
- $LOAD_PATH.unshift(@plugin_lib_path)
22
- Nesta::Plugin.loaded.clear
23
- end
24
-
25
- after(:each) do
26
- $LOAD_PATH.shift if $LOAD_PATH[0] == @plugin_lib_path
27
- remove_plugin_from_list_of_required_files
28
- remove_plugin_constants
29
- end
30
-
31
- it "should not occur prior to gem is required" do
32
- Nesta::Plugin.loaded.should be_empty
33
- end
34
-
35
- it "should record loaded plugins" do
36
- require 'nesta-plugin-test'
37
- Nesta::Plugin.loaded.size.should == 1
38
- Nesta::Plugin.loaded.last.should == 'nesta-plugin-test'
39
- end
40
-
41
- it "should have loaded the plugin's module" do
42
- require 'nesta-plugin-test'
43
- Nesta::Plugin::Test::VERSION
44
- end
45
-
46
- it "should initialize the plugin" do
47
- require 'nesta-plugin-test'
48
- Nesta::Plugin.initialize_plugins
49
- Nesta::Page.should respond_to(:method_added_by_plugin)
50
- end
51
- end
@@ -1,100 +0,0 @@
1
- require File.expand_path('spec_helper', File.dirname(__FILE__))
2
- require File.expand_path('model_factory', File.dirname(__FILE__))
3
-
4
- describe "sitemap XML" do
5
- include RequestSpecHelper
6
- include ModelFactory
7
-
8
- before(:each) do
9
- stub_configuration
10
- @category = create_category do |path|
11
- mock_file_stat(:stub!, path, "3 Jan 2009, 15:07")
12
- end
13
- @article = create_article do |path|
14
- mock_file_stat(:stub!, path, "3 Jan 2009, 15:10")
15
- end
16
- get "/sitemap.xml"
17
- end
18
-
19
- after(:each) do
20
- Nesta::FileModel.purge_cache
21
- remove_temp_directory
22
- end
23
-
24
- it "should render successfully" do
25
- last_response.should be_ok
26
- end
27
-
28
- it "should have a urlset tag" do
29
- namespace = "http://www.sitemaps.org/schemas/sitemap/0.9"
30
- body.should have_tag("/urlset[@xmlns=#{namespace}]")
31
- end
32
-
33
- it "should reference the home page" do
34
- body.should have_tag("/urlset/url/loc", "http://example.org")
35
- end
36
-
37
- it "should configure home page to be checked frequently" do
38
- body.should have_tag("/urlset/url") do |url|
39
- url.should have_tag("loc", "http://example.org")
40
- url.should have_tag("changefreq", "daily")
41
- url.should have_tag("priority", "1.0")
42
- end
43
- end
44
-
45
- it "should set the homepage lastmod from latest article" do
46
- body.should have_tag("/urlset/url") do |url|
47
- url.should have_tag("loc", "http://example.org")
48
- url.should have_tag("lastmod", /^2009-01-03T15:10:00/)
49
- end
50
- end
51
-
52
- it "should reference category pages" do
53
- body.should have_tag(
54
- "/urlset/url/loc", "http://example.org/#{@category.path}")
55
- end
56
-
57
- it "should reference article pages" do
58
- body.should have_tag(
59
- "/urlset/url/loc", "http://example.org/#{@article.path}")
60
- end
61
- end
62
-
63
- describe "sitemap XML lastmod" do
64
- include ModelFactory
65
- include RequestSpecHelper
66
-
67
- before(:each) do
68
- stub_configuration
69
- end
70
-
71
- after(:each) do
72
- remove_temp_directory
73
- Nesta::FileModel.purge_cache
74
- end
75
-
76
- it "should be set for file based page" do
77
- create_article do |path|
78
- mock_file_stat(:stub!, path, "3 January 2009, 15:37:01")
79
- end
80
- get "/sitemap.xml"
81
- body.should have_tag("url") do |url|
82
- url.should have_tag("loc", /my-article$/)
83
- url.should have_tag("lastmod", /^2009-01-03T15:37:01/)
84
- end
85
- end
86
-
87
- it "should be set to latest page for home page" do
88
- create_article(:path => "article-1") do |path|
89
- mock_file_stat(:stub!, path, "4 January 2009")
90
- end
91
- create_article(:path => "article-2") do |path|
92
- mock_file_stat(:stub!, path, "3 January 2009")
93
- end
94
- get "/sitemap.xml"
95
- body.should have_tag("url") do |url|
96
- url.should have_tag("loc", "http://example.org")
97
- url.should have_tag("lastmod", /^2009-01-04/)
98
- end
99
- end
100
- end
@@ -1,76 +0,0 @@
1
- require 'rubygems'
2
- require 'spec'
3
- require 'spec/interop/test'
4
- require 'rack/test'
5
- require 'rspec_hpricot_matchers'
6
- require 'sinatra'
7
-
8
- Test::Unit::TestCase.send :include, Rack::Test::Methods
9
-
10
- module Nesta
11
- class App < Sinatra::Base
12
- set :environment, :test
13
- set :reload_templates, true
14
- end
15
- end
16
-
17
- require File.expand_path('../lib/nesta/env', File.dirname(__FILE__))
18
- require File.expand_path('../lib/nesta/app', File.dirname(__FILE__))
19
-
20
- module ConfigSpecHelper
21
- def stub_yaml_config
22
- @config = {}
23
- Nesta::Config.stub!(:yaml_exists?).and_return(true)
24
- Nesta::Config.stub!(:yaml_conf).and_return(@config)
25
- end
26
-
27
- def stub_config_key(key, value, options = {})
28
- stub_yaml_config unless @config
29
- if options[:rack_env]
30
- @config['test'] ||= {}
31
- @config['test'][key] = value
32
- else
33
- @config[key] = value
34
- end
35
- end
36
-
37
- def stub_configuration(options = {})
38
- stub_config_key('title', 'My blog', options)
39
- stub_config_key('subtitle', 'about stuff', options)
40
- stub_config_key(
41
- 'content', temp_path('content'), options.merge(:rack_env => true))
42
- end
43
- end
44
-
45
- module TempFileHelper
46
- TEMP_DIR = File.expand_path('tmp', File.dirname(__FILE__))
47
-
48
- def create_temp_directory
49
- FileUtils.mkdir_p(TempFileHelper::TEMP_DIR)
50
- end
51
-
52
- def remove_temp_directory
53
- FileUtils.rm_r(TempFileHelper::TEMP_DIR, :force => true)
54
- end
55
-
56
- def temp_path(base)
57
- File.join(TempFileHelper::TEMP_DIR, base)
58
- end
59
- end
60
-
61
- Spec::Runner.configure do |config|
62
- config.include(RspecHpricotMatchers)
63
-
64
- config.include(ConfigSpecHelper)
65
- config.include(TempFileHelper)
66
- end
67
-
68
- module RequestSpecHelper
69
- def app
70
- Nesta::App
71
- end
72
-
73
- def body
74
- last_response.body
75
- end
76
- end