nesta 0.10.0 → 0.11.0

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 (50) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +11 -11
  3. data/.hound.yml +2 -0
  4. data/.travis.yml +2 -1
  5. data/CHANGES +43 -0
  6. data/Gemfile +1 -1
  7. data/Gemfile.lock +18 -23
  8. data/lib/nesta/app.rb +0 -5
  9. data/lib/nesta/commands.rb +5 -288
  10. data/lib/nesta/commands/command.rb +58 -0
  11. data/lib/nesta/commands/demo.rb +1 -0
  12. data/lib/nesta/commands/demo/content.rb +38 -0
  13. data/lib/nesta/commands/edit.rb +21 -0
  14. data/lib/nesta/commands/new.rb +57 -0
  15. data/lib/nesta/commands/plugin.rb +1 -0
  16. data/lib/nesta/commands/plugin/create.rb +82 -0
  17. data/lib/nesta/commands/theme.rb +3 -0
  18. data/lib/nesta/commands/theme/create.rb +36 -0
  19. data/lib/nesta/commands/theme/enable.rb +22 -0
  20. data/lib/nesta/commands/theme/install.rb +29 -0
  21. data/lib/nesta/config.rb +1 -6
  22. data/lib/nesta/models.rb +18 -20
  23. data/lib/nesta/version.rb +1 -1
  24. data/nesta.gemspec +1 -0
  25. data/smoke-test.sh +24 -19
  26. data/spec/commands/demo/content_spec.rb +65 -0
  27. data/spec/commands/edit_spec.rb +27 -0
  28. data/spec/commands/new_spec.rb +88 -0
  29. data/spec/commands/plugin/create_spec.rb +97 -0
  30. data/spec/commands/system_spec.rb +25 -0
  31. data/spec/commands/theme/create_spec.rb +41 -0
  32. data/spec/commands/theme/enable_spec.rb +44 -0
  33. data/spec/commands/theme/install_spec.rb +56 -0
  34. data/spec/config_spec.rb +3 -3
  35. data/spec/models_spec.rb +43 -25
  36. data/spec/page_spec.rb +18 -2
  37. data/spec/spec_helper.rb +23 -0
  38. data/templates/Gemfile +1 -1
  39. data/templates/plugins/Gemfile +4 -0
  40. data/templates/plugins/README.md +13 -0
  41. data/templates/plugins/Rakefile +58 -0
  42. data/templates/plugins/gitignore +3 -0
  43. data/templates/plugins/lib/init.rb +13 -0
  44. data/templates/plugins/lib/required.rb +3 -0
  45. data/templates/plugins/lib/version.rb +5 -0
  46. data/templates/plugins/plugin.gemspec +28 -0
  47. data/views/analytics.haml +9 -10
  48. data/views/master.sass +1 -1
  49. metadata +53 -5
  50. data/spec/commands_spec.rb +0 -395
@@ -247,7 +247,7 @@ div#sidebar
247
247
 
248
248
  ol, ul
249
249
  li
250
- display: block
250
+ display: list-item
251
251
 
252
252
  &::after
253
253
  content: ''
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nesta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Graham Ashton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-25 00:00:00.000000000 Z
11
+ date: 2015-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: haml
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: haml-contrib
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: sass
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -184,6 +198,7 @@ extensions: []
184
198
  extra_rdoc_files: []
185
199
  files:
186
200
  - ".gitignore"
201
+ - ".hound.yml"
187
202
  - ".rspec"
188
203
  - ".travis.yml"
189
204
  - CHANGES
@@ -199,6 +214,17 @@ files:
199
214
  - lib/nesta.rb
200
215
  - lib/nesta/app.rb
201
216
  - lib/nesta/commands.rb
217
+ - lib/nesta/commands/command.rb
218
+ - lib/nesta/commands/demo.rb
219
+ - lib/nesta/commands/demo/content.rb
220
+ - lib/nesta/commands/edit.rb
221
+ - lib/nesta/commands/new.rb
222
+ - lib/nesta/commands/plugin.rb
223
+ - lib/nesta/commands/plugin/create.rb
224
+ - lib/nesta/commands/theme.rb
225
+ - lib/nesta/commands/theme/create.rb
226
+ - lib/nesta/commands/theme/enable.rb
227
+ - lib/nesta/commands/theme/install.rb
202
228
  - lib/nesta/config.rb
203
229
  - lib/nesta/env.rb
204
230
  - lib/nesta/helpers.rb
@@ -212,7 +238,14 @@ files:
212
238
  - scripts/import-from-mephisto
213
239
  - smoke-test.sh
214
240
  - spec/atom_spec.rb
215
- - spec/commands_spec.rb
241
+ - spec/commands/demo/content_spec.rb
242
+ - spec/commands/edit_spec.rb
243
+ - spec/commands/new_spec.rb
244
+ - spec/commands/plugin/create_spec.rb
245
+ - spec/commands/system_spec.rb
246
+ - spec/commands/theme/create_spec.rb
247
+ - spec/commands/theme/enable_spec.rb
248
+ - spec/commands/theme/install_spec.rb
216
249
  - spec/config_spec.rb
217
250
  - spec/fixtures/nesta-plugin-test/Gemfile
218
251
  - spec/fixtures/nesta-plugin-test/Rakefile
@@ -234,6 +267,14 @@ files:
234
267
  - templates/config/config.yml
235
268
  - templates/config/deploy.rb
236
269
  - templates/index.haml
270
+ - templates/plugins/Gemfile
271
+ - templates/plugins/README.md
272
+ - templates/plugins/Rakefile
273
+ - templates/plugins/gitignore
274
+ - templates/plugins/lib/init.rb
275
+ - templates/plugins/lib/required.rb
276
+ - templates/plugins/lib/version.rb
277
+ - templates/plugins/plugin.gemspec
237
278
  - templates/themes/README.md
238
279
  - templates/themes/app.rb
239
280
  - templates/themes/views/layout.haml
@@ -277,13 +318,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
277
318
  version: '0'
278
319
  requirements: []
279
320
  rubyforge_project: nesta
280
- rubygems_version: 2.2.2
321
+ rubygems_version: 2.4.5
281
322
  signing_key:
282
323
  specification_version: 4
283
324
  summary: Ruby CMS, written in Sinatra
284
325
  test_files:
285
326
  - spec/atom_spec.rb
286
- - spec/commands_spec.rb
327
+ - spec/commands/demo/content_spec.rb
328
+ - spec/commands/edit_spec.rb
329
+ - spec/commands/new_spec.rb
330
+ - spec/commands/plugin/create_spec.rb
331
+ - spec/commands/system_spec.rb
332
+ - spec/commands/theme/create_spec.rb
333
+ - spec/commands/theme/enable_spec.rb
334
+ - spec/commands/theme/install_spec.rb
287
335
  - spec/config_spec.rb
288
336
  - spec/fixtures/nesta-plugin-test/Gemfile
289
337
  - spec/fixtures/nesta-plugin-test/Rakefile
@@ -1,395 +0,0 @@
1
- require File.expand_path("spec_helper", File.dirname(__FILE__))
2
- require File.expand_path("../lib/nesta/commands", File.dirname(__FILE__))
3
-
4
- describe "nesta" do
5
- before(:each) do
6
- create_temp_directory
7
- @project_path = temp_path('mysite.com')
8
- end
9
-
10
- after(:each) do
11
- remove_temp_directory
12
- end
13
-
14
- def project_path(path)
15
- File.join(@project_path, path)
16
- end
17
-
18
- def should_exist(file)
19
- File.exist?(project_path(file)).should be_true
20
- end
21
-
22
- def create_config_yaml(text)
23
- File.open(Nesta::Config.yaml_path, 'w') { |f| f.puts(text) }
24
- end
25
-
26
- describe "new" do
27
- def gemfile_source
28
- File.read(project_path('Gemfile'))
29
- end
30
-
31
- def rakefile_source
32
- File.read(project_path('Rakefile'))
33
- end
34
-
35
- describe "without options" do
36
- before(:each) do
37
- Nesta::Commands::New.new(@project_path).execute
38
- end
39
-
40
- it "should create the content directories" do
41
- should_exist('content/attachments')
42
- should_exist('content/pages')
43
- end
44
-
45
- it "should create the home page" do
46
- should_exist('content/pages/index.haml')
47
- end
48
-
49
- it "should create the rackup file" do
50
- should_exist('config.ru')
51
- end
52
-
53
- it "should create the config.yml file" do
54
- should_exist('config/config.yml')
55
- end
56
-
57
- it "should add a Gemfile" do
58
- should_exist('Gemfile')
59
- gemfile_source.should match(/gem 'nesta', '#{Nesta::VERSION}'/)
60
- end
61
- end
62
-
63
- describe "--git" do
64
- before(:each) do
65
- @command = Nesta::Commands::New.new(@project_path, 'git' => '')
66
- @command.stub(:system)
67
- end
68
-
69
- it "should create a .gitignore file" do
70
- @command.execute
71
- File.read(project_path('.gitignore')).should match(/\.bundle/)
72
- end
73
-
74
- it "should create a git repo" do
75
- @command.should_receive(:system).with('git', 'init')
76
- @command.execute
77
- end
78
-
79
- it "should commit the blank project" do
80
- @command.should_receive(:system).with('git', 'add', '.')
81
- @command.should_receive(:system).with(
82
- 'git', 'commit', '-m', 'Initial commit')
83
- @command.execute
84
- end
85
- end
86
-
87
- describe "--vlad" do
88
- before(:each) do
89
- Nesta::Commands::New.new(@project_path, 'vlad' => '').execute
90
- end
91
-
92
- it "should add vlad to Gemfile" do
93
- gemfile_source.should match(/gem 'vlad', '2.1.0'/)
94
- gemfile_source.should match(/gem 'vlad-git', '2.2.0'/)
95
- end
96
-
97
- it "should configure the vlad rake tasks" do
98
- should_exist('Rakefile')
99
- rakefile_source.should match(/require 'vlad'/)
100
- end
101
-
102
- it "should create deploy.rb" do
103
- should_exist('config/deploy.rb')
104
- deploy_source = File.read(project_path('config/deploy.rb'))
105
- deploy_source.should match(/set :application, 'mysite.com'/)
106
- end
107
- end
108
- end
109
-
110
- describe "demo:content" do
111
- before(:each) do
112
- @config_path = project_path('config/config.yml')
113
- FileUtils.mkdir_p(File.dirname(@config_path))
114
- Nesta::Config.stub(:yaml_path).and_return(@config_path)
115
- create_config_yaml('content: path/to/content')
116
- Nesta::App.stub(:root).and_return(@project_path)
117
- @repo_url = 'git://github.com/gma/nesta-demo-content.git'
118
- @demo_path = project_path('content-demo')
119
- @command = Nesta::Commands::Demo::Content.new
120
- @command.stub(:system)
121
- end
122
-
123
- it "should clone the repository" do
124
- @command.should_receive(:system).with(
125
- 'git', 'clone', @repo_url, @demo_path)
126
- @command.execute
127
- end
128
-
129
- it "should configure the content directory" do
130
- @command.execute
131
- File.read(@config_path).should match(/^content: content-demo/)
132
- end
133
-
134
- describe "when repository already exists" do
135
- before(:each) do
136
- FileUtils.mkdir_p(@demo_path)
137
- end
138
-
139
- it "should update the repository" do
140
- @command.should_receive(:system).with('git', 'pull', 'origin', 'master')
141
- @command.execute
142
- end
143
- end
144
-
145
- describe "when site versioned with git" do
146
- before(:each) do
147
- @exclude_path = project_path('.git/info/exclude')
148
- FileUtils.mkdir_p(File.dirname(@exclude_path))
149
- File.open(@exclude_path, 'w') { |file| file.puts '# Excludes' }
150
- end
151
-
152
- it "should tell git to ignore content-demo" do
153
- @command.execute
154
- File.read(@exclude_path).should match(/content-demo/)
155
- end
156
-
157
- describe "and content-demo already ignored" do
158
- before(:each) do
159
- File.open(@exclude_path, 'w') { |file| file.puts 'content-demo' }
160
- end
161
-
162
- it "shouldn't tell git to ignore it twice" do
163
- @command.execute
164
- File.read(@exclude_path).scan('content-demo').size.should == 1
165
- end
166
- end
167
- end
168
- end
169
-
170
- describe "edit" do
171
- before(:each) do
172
- Nesta::Config.stub(:content_path).and_return('content')
173
- @page_path = 'path/to/page.mdown'
174
- @command = Nesta::Commands::Edit.new(@page_path)
175
- @command.stub(:system)
176
- end
177
-
178
- it "should launch the editor" do
179
- ENV['EDITOR'] = 'vi'
180
- full_path = File.join('content/pages', @page_path)
181
- @command.should_receive(:system).with(ENV['EDITOR'], full_path)
182
- @command.execute
183
- end
184
-
185
- it "should not try and launch an editor if environment not setup" do
186
- ENV.delete('EDITOR')
187
- @command.should_not_receive(:system)
188
- $stderr.stub(:puts)
189
- @command.execute
190
- end
191
- end
192
-
193
- describe "plugin:create" do
194
- before(:each) do
195
- @name = 'my-feature'
196
- @gem_name = "nesta-plugin-#{@name}"
197
- @plugins_path = temp_path('plugins')
198
- @working_dir = Dir.pwd
199
- Dir.mkdir(@plugins_path)
200
- Dir.chdir(@plugins_path)
201
- @command = Nesta::Commands::Plugin::Create.new(@name)
202
- @command.stub(:system)
203
- end
204
-
205
- after(:each) do
206
- Dir.chdir(@working_dir)
207
- FileUtils.rm_r(@plugins_path)
208
- end
209
-
210
- it "should create a new gem prefixed with nesta-plugin" do
211
- @command.should_receive(:system).with('bundle', 'gem', @gem_name)
212
- begin
213
- @command.execute
214
- rescue Errno::ENOENT
215
- # This test is only concerned with running bundle gem; ENOENT
216
- # errors are raised because we didn't create a real gem.
217
- end
218
- end
219
-
220
- describe "after gem created" do
221
- def create_gem_file(*components)
222
- path = File.join(@plugins_path, @gem_name, *components)
223
- FileUtils.makedirs(File.dirname(path))
224
- File.open(path, 'w') { |f| yield f if block_given? }
225
- path
226
- end
227
-
228
- before(:each) do
229
- @required_file = create_gem_file('lib', "#{@gem_name}.rb")
230
- @init_file = create_gem_file('lib', @gem_name, 'init.rb')
231
- @gem_spec = create_gem_file("#{@gem_name}.gemspec") do |file|
232
- file.puts " # specify any dependencies here; for example:"
233
- file.puts "end"
234
- end
235
- end
236
-
237
- after(:each) do
238
- FileUtils.rm(@required_file)
239
- FileUtils.rm(@init_file)
240
- end
241
-
242
- it "should create the ruby file loaded on require" do
243
- @command.execute
244
- File.read(@required_file).should include('Plugin.register(__FILE__)')
245
- end
246
-
247
- it "should create a default init.rb file" do
248
- @command.execute
249
- init = File.read(@init_file)
250
- boilerplate = <<-EOF
251
- module My::Feature
252
- module Helpers
253
- EOF
254
- init.should include(boilerplate)
255
- init.should include('helpers Nesta::Plugin::My::Feature::Helpers')
256
- end
257
-
258
- it "should specify plugin gem's dependencies" do
259
- @command.execute
260
- text = File.read(@gem_spec)
261
- text.should include('gem.add_dependency("nesta", ">= 0.9.11")')
262
- text.should include('gem.add_development_dependency("rake")')
263
- end
264
- end
265
- end
266
-
267
- describe "theme:install" do
268
- before(:each) do
269
- @repo_url = 'git://github.com/gma/nesta-theme-mine.git'
270
- @theme_dir = 'themes/mine'
271
- FileUtils.mkdir_p(File.join(@theme_dir, '.git'))
272
- @command = Nesta::Commands::Theme::Install.new(@repo_url)
273
- @command.stub(:enable)
274
- @command.stub(:system)
275
- end
276
-
277
- after(:each) do
278
- FileUtils.rm_r(@theme_dir)
279
- end
280
-
281
- it "should clone the repository" do
282
- @command.should_receive(:system).with(
283
- 'git', 'clone', @repo_url, @theme_dir)
284
- @command.execute
285
- end
286
-
287
- it "should remove the theme's .git directory" do
288
- @command.execute
289
- File.exist?(@theme_dir).should be_true
290
- File.exist?(File.join(@theme_dir, '.git')).should be_false
291
- end
292
-
293
- it "should enable the freshly installed theme" do
294
- @command.should_receive(:enable)
295
- @command.execute
296
- end
297
-
298
- describe "when theme URL doesn't match recommended pattern" do
299
- before(:each) do
300
- @repo_url = 'git://foobar.com/path/to/mytheme.git'
301
- @other_theme_dir = 'themes/mytheme'
302
- FileUtils.mkdir_p(File.join(@other_theme_dir, '.git'))
303
- @command = Nesta::Commands::Theme::Install.new(@repo_url)
304
- @command.stub(:enable)
305
- end
306
-
307
- after(:each) do
308
- FileUtils.rm_r(@other_theme_dir)
309
- end
310
-
311
- it "should use the basename as theme dir" do
312
- @command.should_receive(:system).with(
313
- 'git', 'clone', @repo_url, @other_theme_dir)
314
- @command.execute
315
- end
316
- end
317
- end
318
-
319
- describe "theme:enable" do
320
- before(:each) do
321
- config = temp_path('config.yml')
322
- Nesta::Config.stub(:yaml_path).and_return(config)
323
- @name = 'mytheme'
324
- @command = Nesta::Commands::Theme::Enable.new(@name)
325
- end
326
-
327
- shared_examples_for "command that configures the theme" do
328
- it "should enable the theme" do
329
- @command.execute
330
- File.read(Nesta::Config.yaml_path).should match(/^theme: #{@name}/)
331
- end
332
- end
333
-
334
- describe "when theme config is commented out" do
335
- before(:each) do
336
- create_config_yaml(' # theme: blah')
337
- end
338
-
339
- it_should_behave_like "command that configures the theme"
340
- end
341
-
342
- describe "when another theme is configured" do
343
- before(:each) do
344
- create_config_yaml('theme: another')
345
- end
346
-
347
- it_should_behave_like "command that configures the theme"
348
- end
349
-
350
- describe "when no theme config exists" do
351
- before(:each) do
352
- create_config_yaml('# I have no theme config')
353
- end
354
-
355
- it_should_behave_like "command that configures the theme"
356
- end
357
- end
358
-
359
- describe "theme:create" do
360
- def should_exist(file)
361
- File.exist?(Nesta::Path.themes(@name, file)).should be_true
362
- end
363
-
364
- before(:each) do
365
- Nesta::App.stub(:root).and_return(TempFileHelper::TEMP_DIR)
366
- @name = 'my-new-theme'
367
- Nesta::Commands::Theme::Create.new(@name).execute
368
- end
369
-
370
- it "should create the theme directory" do
371
- File.directory?(Nesta::Path.themes(@name)).should be_true
372
- end
373
-
374
- it "should create a dummy README file" do
375
- should_exist('README.md')
376
- text = File.read(Nesta::Path.themes(@name, 'README.md'))
377
- text.should match(/#{@name} is a theme/)
378
- end
379
-
380
- it "should create a default app.rb file" do
381
- should_exist('app.rb')
382
- end
383
-
384
- it "should create public and views directories" do
385
- should_exist("public/#{@name}")
386
- should_exist('views')
387
- end
388
-
389
- it "should copy the default view templates into views" do
390
- %w(layout.haml page.haml master.sass).each do |file|
391
- should_exist("views/#{file}")
392
- end
393
- end
394
- end
395
- end