nesta 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 904b608182032947bdcad754a909a9b49e1f4be7
4
- data.tar.gz: 3759e6ccd241eac679f762209f4987746511596c
3
+ metadata.gz: 56113bb66385f92b2b5bc75d696a9f5f3bd98ddb
4
+ data.tar.gz: 2894ebcfceecfcb70c384ac64a83d40f13ebeee2
5
5
  SHA512:
6
- metadata.gz: f36f814b284024e1d99bf37abf6cf37444db418d2c67cb980cbf8a80cb654ab36f5c1851e8a38d14e5de6cc7eeb70f3ed3c5201dab618071f0f0546522e5e217
7
- data.tar.gz: e25c5f1dead47715cff47cb2458e7f9df44a0a87f682733fa475bd016ad1b5a7d9af9856564c8c2061394759eeed5ea92966e163fac8a83ec32f8093645136e7
6
+ metadata.gz: df821079aa71d5a95e283ea1135c23f9d2521537253134ad87bb03c0d726822e760f696fece3abf7146d954cdd3fa2cfddbd3a6415916929abdd4058611970ea
7
+ data.tar.gz: f31b0bedebf53f032337be404dd17181cc3007dd47b86f5003e0b89528e6620d84377189e5e0dfae7b4c512d5d6a14d91297f439d4f6aa7416c143a78aca7e8c
data/.gitignore CHANGED
@@ -1,15 +1,15 @@
1
1
  *.gem
2
- ._*
3
2
  .*.swp
4
- .bundle
5
3
  .DS_Store
6
- .rbenv-version
7
- .rvmrc
4
+ ._*
8
5
  .sass-cache
9
- config/config.yml
10
- config/deploy.rb
11
- db/*.db
12
- pkg/*
13
- plugins
14
- public/cache
15
- spec/tmp
6
+ /.rbenv-version
7
+ /.ruby-version
8
+ /.rvmrc
9
+ /config/config.yml
10
+ /config/deploy.rb
11
+ /db/*.db
12
+ /pkg/*
13
+ /plugins
14
+ /public/cache
15
+ /spec/tmp
@@ -0,0 +1,2 @@
1
+ ruby:
2
+ enabled: true
@@ -2,4 +2,5 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
- - 2.1.1
5
+ - 2.1.5
6
+ - 2.2.1
data/CHANGES CHANGED
@@ -1,3 +1,46 @@
1
+ = 0.11.0 / (16 March 2015)
2
+
3
+ * Allow Haml pages to use the built-in Markdown filter again, by
4
+ including the haml-contrib gem.
5
+ (Jake Owens)
6
+
7
+ * When building the breadcrumb (e.g. "Home > Category > Page") for a
8
+ page whose URL is at the top level of a site, include a page's first
9
+ category in the breadcrumb.
10
+ See https://github.com/gma/nesta/issues/147 for an example.
11
+ (Jake Owens)
12
+
13
+ * Print an error message when one of Nesta's command line tools calls
14
+ an external process (e.g. `git`), but the command doesn't return
15
+ successfully. (Graham Ashton)
16
+
17
+ * When the menu.txt pointed to a page that didn't exist, Nesta would
18
+ silently stop generating the menu, and links to pages further down
19
+ the file would be ignored. This is now fixed; the missing page is
20
+ ignored and the rest of the menu is generated. (Jake Owens)
21
+
22
+ * Nesta previously expected all Markdown files to be named with a
23
+ `.mdown` extension. The (commonly used) `.md` extension is now
24
+ supported as well. (Phillip Miller)
25
+
26
+ * The Google Analytics JavaScript code has been updated to their
27
+ Universal Analytics version. (Graham Ashton)
28
+
29
+ * Relax restrictions on how Nesta can be configured. Previously Nesta
30
+ would only read if `config.yml` file if there weren't any environment
31
+ variables set. This restriction is historic, and unhelpful.
32
+ See https://github.com/gma/nesta/commit/bac50974 for details.
33
+ (Glenn Gillen)
34
+
35
+ * Plugins are distributed as gems. We've previously relied upon Bundler
36
+ to generate plugin gems for us, but when Bundler changed the format
37
+ of its generated gems they no longer worked with Nesta. Nesta now
38
+ generates gems from scratch (from a template), which removes our
39
+ dependency on a third party tool.
40
+ (Jake Owens, Glenn Gillen, Graham Ashton)
41
+
42
+ * Support for Ruby 2.2. (Graham Ashton)
43
+
1
44
  = 0.10.0 / (25 April 2014)
2
45
 
3
46
  * Upgraded the default theme to a responsive design, using Google's
data/Gemfile CHANGED
@@ -3,4 +3,4 @@ source 'http://rubygems.org'
3
3
  # Specify your gem's dependencies in nesta.gemspec
4
4
  gemspec
5
5
 
6
- gem 'debugger'
6
+ # gem (RUBY_VERSION =~ /^1/) ? 'debugger' : 'byebug'
@@ -1,9 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nesta (0.10.0)
4
+ nesta (0.11.0)
5
5
  RedCloth (~> 4.2)
6
6
  haml (>= 3.1)
7
+ haml-contrib (>= 1.0)
7
8
  rack (>= 1.3)
8
9
  rdiscount (~> 2.1)
9
10
  sass (>= 3.1)
@@ -13,45 +14,40 @@ GEM
13
14
  remote: http://rubygems.org/
14
15
  specs:
15
16
  RedCloth (4.2.9)
16
- columnize (0.8.9)
17
- debugger (1.6.6)
18
- columnize (>= 0.3.1)
19
- debugger-linecache (~> 1.2.0)
20
- debugger-ruby_core_source (~> 1.3.2)
21
- debugger-linecache (1.2.0)
22
- debugger-ruby_core_source (1.3.2)
23
17
  diff-lcs (1.2.5)
24
- ffi (1.9.3)
25
- haml (4.0.5)
18
+ ffi (1.9.8)
19
+ haml (4.0.6)
26
20
  tilt
27
- hoe (3.12.0)
21
+ haml-contrib (1.0.0.1)
22
+ haml (>= 3.2.0.alpha.13)
23
+ hoe (3.13.1)
28
24
  rake (>= 0.8, < 11.0)
29
- kgio (2.9.2)
25
+ kgio (2.9.3)
30
26
  listen (1.3.1)
31
27
  rb-fsevent (>= 0.9.3)
32
28
  rb-inotify (>= 0.9)
33
29
  rb-kqueue (>= 0.2)
34
- mini_portile (0.5.3)
30
+ mini_portile (0.6.2)
35
31
  mr-sparkle (0.3.0)
36
32
  listen (~> 1.0)
37
33
  rb-fsevent (>= 0.9)
38
34
  rb-inotify (>= 0.8)
39
35
  unicorn (>= 4.5)
40
- nokogiri (1.6.1)
41
- mini_portile (~> 0.5.0)
42
- rack (1.5.2)
36
+ nokogiri (1.6.6.2)
37
+ mini_portile (~> 0.6.0)
38
+ rack (1.6.0)
43
39
  rack-protection (1.5.3)
44
40
  rack
45
41
  rack-test (0.6.1)
46
42
  rack (>= 1.0)
47
43
  raindrops (0.13.0)
48
- rake (10.3.1)
44
+ rake (10.4.2)
49
45
  rb-fsevent (0.9.4)
50
- rb-inotify (0.9.3)
46
+ rb-inotify (0.9.5)
51
47
  ffi (>= 0.5.0)
52
- rb-kqueue (0.2.2)
48
+ rb-kqueue (0.2.3)
53
49
  ffi (>= 0.5.0)
54
- rdiscount (2.1.7.1)
50
+ rdiscount (2.1.8)
55
51
  rspec (2.14.1)
56
52
  rspec-core (~> 2.14.0)
57
53
  rspec-expectations (~> 2.14.0)
@@ -60,7 +56,7 @@ GEM
60
56
  rspec-expectations (2.14.5)
61
57
  diff-lcs (>= 1.1.3, < 2.0)
62
58
  rspec-mocks (2.14.6)
63
- sass (3.3.5)
59
+ sass (3.4.13)
64
60
  sinatra (1.4.5)
65
61
  rack (~> 1.4)
66
62
  rack-protection (~> 1.4)
@@ -68,7 +64,7 @@ GEM
68
64
  test-unit (1.2.3)
69
65
  hoe (>= 1.5.1)
70
66
  tilt (1.4.1)
71
- unicorn (4.8.2)
67
+ unicorn (4.8.3)
72
68
  kgio (~> 2.6)
73
69
  rack
74
70
  raindrops (~> 0.7)
@@ -81,7 +77,6 @@ PLATFORMS
81
77
  ruby
82
78
 
83
79
  DEPENDENCIES
84
- debugger
85
80
  mr-sparkle (>= 0.0.2)
86
81
  nesta!
87
82
  rack-test (= 0.6.1)
@@ -23,11 +23,6 @@ module Nesta
23
23
  helpers Navigation::Renderers
24
24
  helpers View::Helpers
25
25
 
26
- def cache(content)
27
- Nesta.deprecated('cache', "it's no longer required - remove it from app.rb")
28
- content
29
- end
30
-
31
26
  before do
32
27
  if request.path_info =~ Regexp.new('./$')
33
28
  redirect to(request.path_info.sub(Regexp.new('/$'), ''))
@@ -6,291 +6,8 @@ require File.expand_path('app', File.dirname(__FILE__))
6
6
  require File.expand_path('path', File.dirname(__FILE__))
7
7
  require File.expand_path('version', File.dirname(__FILE__))
8
8
 
9
- module Nesta
10
- module Commands
11
- class UsageError < RuntimeError; end
12
-
13
- module Command
14
- def fail(message)
15
- $stderr.puts "Error: #{message}"
16
- exit 1
17
- end
18
-
19
- def template_root
20
- File.expand_path('../../templates', File.dirname(__FILE__))
21
- end
22
-
23
- def copy_template(src, dest)
24
- FileUtils.mkdir_p(File.dirname(dest))
25
- template = ERB.new(File.read(File.join(template_root, src)))
26
- File.open(dest, 'w') { |file| file.puts template.result(binding) }
27
- end
28
-
29
- def copy_templates(templates)
30
- templates.each { |src, dest| copy_template(src, dest) }
31
- end
32
-
33
- def update_config_yaml(pattern, replacement)
34
- configured = false
35
- File.open(Nesta::Config.yaml_path, 'r+') do |file|
36
- output = ''
37
- file.each_line do |line|
38
- if configured
39
- output << line
40
- else
41
- output << line.sub(pattern, replacement)
42
- configured = true if line =~ pattern
43
- end
44
- end
45
- output << "#{replacement}\n" unless configured
46
- file.pos = 0
47
- file.print(output)
48
- file.truncate(file.pos)
49
- end
50
- end
51
- end
52
-
53
- class Edit
54
- include Command
55
-
56
- def initialize(*args)
57
- @filename = Nesta::Config.page_path(args.shift)
58
- end
59
-
60
- def execute
61
- editor = ENV.fetch('EDITOR')
62
- rescue IndexError
63
- $stderr.puts "No editor: set EDITOR environment variable"
64
- else
65
- system(editor, @filename)
66
- end
67
- end
68
-
69
- class New
70
- include Command
71
-
72
- def initialize(*args)
73
- path = args.shift
74
- options = args.shift || {}
75
- path.nil? && (raise UsageError.new('path not specified'))
76
- if File.exist?(path)
77
- raise RuntimeError.new("#{path} already exists")
78
- end
79
- @path = path
80
- @options = options
81
- end
82
-
83
- def make_directories
84
- %w[content/attachments content/pages].each do |dir|
85
- FileUtils.mkdir_p(File.join(@path, dir))
86
- end
87
- end
88
-
89
- def have_rake_tasks?
90
- @options['vlad']
91
- end
92
-
93
- def create_repository
94
- FileUtils.cd(@path) do
95
- File.open('.gitignore', 'w') do |file|
96
- file.puts %w[._* .*.swp .bundle .DS_Store .sass-cache].join("\n")
97
- end
98
- system('git', 'init')
99
- system('git', 'add', '.')
100
- system('git', 'commit', '-m', 'Initial commit')
101
- end
102
- end
103
-
104
- def execute
105
- make_directories
106
- templates = {
107
- 'config.ru' => "#{@path}/config.ru",
108
- 'config/config.yml' => "#{@path}/config/config.yml",
109
- 'index.haml' => "#{@path}/content/pages/index.haml",
110
- 'Gemfile' => "#{@path}/Gemfile"
111
- }
112
- templates['Rakefile'] = "#{@path}/Rakefile" if have_rake_tasks?
113
- if @options['vlad']
114
- templates['config/deploy.rb'] = "#{@path}/config/deploy.rb"
115
- end
116
- copy_templates(templates)
117
- create_repository if @options['git']
118
- end
119
- end
120
-
121
- module Demo
122
- class Content
123
- include Command
124
-
125
- def initialize(*args)
126
- @dir = 'content-demo'
127
- end
128
-
129
- def clone_or_update_repository
130
- repository = 'git://github.com/gma/nesta-demo-content.git'
131
- path = Nesta::Path.local(@dir)
132
- if File.exist?(path)
133
- FileUtils.cd(path) { system('git', 'pull', 'origin', 'master') }
134
- else
135
- system('git', 'clone', repository, path)
136
- end
137
- end
138
-
139
- def configure_git_to_ignore_repo
140
- excludes = Nesta::Path.local('.git/info/exclude')
141
- if File.exist?(excludes) && File.read(excludes).scan(@dir).empty?
142
- File.open(excludes, 'a') { |file| file.puts @dir }
143
- end
144
- end
145
-
146
- def execute
147
- clone_or_update_repository
148
- configure_git_to_ignore_repo
149
- update_config_yaml(/^\s*#?\s*content:.*/, "content: #{@dir}")
150
- end
151
- end
152
- end
153
-
154
- module Plugin
155
- class Create
156
- def initialize(*args)
157
- name = args.shift
158
- name.nil? && (raise UsageError.new('name not specified'))
159
- @name = name
160
- @gem_name = "nesta-plugin-#{name}"
161
- if File.exist?(@gem_name)
162
- raise RuntimeError.new("#{@gem_name} already exists")
163
- end
164
- end
165
-
166
- def lib_path(*parts)
167
- File.join(@gem_name, 'lib', *parts)
168
- end
169
-
170
- def modify_required_file
171
- File.open(lib_path("#{@gem_name}.rb"), 'w') do |file|
172
- file.write <<-EOF
173
- require "#{@gem_name}/version"
174
-
175
- Nesta::Plugin.register(__FILE__)
176
- EOF
177
- end
178
- end
179
-
180
- def modify_init_file
181
- module_name = @name.split('-').map { |name| name.capitalize }.join('::')
182
- File.open(lib_path(@gem_name, 'init.rb'), 'w') do |file|
183
- file.puts <<-EOF
184
- module Nesta
185
- module Plugin
186
- module #{module_name}
187
- module Helpers
188
- # If your plugin needs any helper methods, add them here...
189
- end
190
- end
191
- end
192
-
193
- class App
194
- helpers Nesta::Plugin::#{module_name}::Helpers
195
- end
196
- end
197
- EOF
198
- end
199
- end
200
-
201
- def specify_gem_dependency
202
- gemspec = File.join(@gem_name, "#{@gem_name}.gemspec")
203
- File.open(gemspec, 'r+') do |file|
204
- output = ''
205
- file.each_line do |line|
206
- if line =~ /^end/
207
- output << ' gem.add_dependency("nesta", ">= 0.9.11")' + "\n"
208
- output << ' gem.add_development_dependency("rake")' + "\n"
209
- end
210
- output << line
211
- end
212
- file.pos = 0
213
- file.print(output)
214
- file.truncate(file.pos)
215
- end
216
- end
217
-
218
- def execute
219
- system('bundle', 'gem', @gem_name)
220
- modify_required_file
221
- modify_init_file
222
- specify_gem_dependency
223
- Dir.chdir(@gem_name) { system('git', 'add', '.') }
224
- end
225
- end
226
- end
227
-
228
- module Theme
229
- class Create
230
- include Command
231
-
232
- def initialize(*args)
233
- name = args.shift
234
- options = args.shift || {}
235
- name.nil? && (raise UsageError.new('name not specified'))
236
- @name = name
237
- @theme_path = Nesta::Path.themes(@name)
238
- fail("#{@theme_path} already exists") if File.exist?(@theme_path)
239
- end
240
-
241
- def make_directories
242
- FileUtils.mkdir_p(File.join(@theme_path, 'public', @name))
243
- FileUtils.mkdir_p(File.join(@theme_path, 'views'))
244
- end
245
-
246
- def execute
247
- make_directories
248
- copy_templates(
249
- 'themes/README.md' => "#{@theme_path}/README.md",
250
- 'themes/app.rb' => "#{@theme_path}/app.rb",
251
- 'themes/views/layout.haml' => "#{@theme_path}/views/layout.haml",
252
- 'themes/views/page.haml' => "#{@theme_path}/views/page.haml",
253
- 'themes/views/master.sass' => "#{@theme_path}/views/master.sass"
254
- )
255
- end
256
- end
257
-
258
- class Install
259
- include Command
260
-
261
- def initialize(*args)
262
- url = args.shift
263
- options = args.shift || {}
264
- url.nil? && (raise UsageError.new('URL not specified'))
265
- @url = url
266
- @name = File.basename(url, '.git').sub(/nesta-theme-/, '')
267
- end
268
-
269
- def execute
270
- system('git', 'clone', @url, "themes/#{@name}")
271
- FileUtils.rm_r(File.join("themes/#{@name}", '.git'))
272
- enable
273
- end
274
-
275
- def enable
276
- Enable.new(@name).execute
277
- end
278
- end
279
-
280
- class Enable
281
- include Command
282
-
283
- def initialize(*args)
284
- name = args.shift
285
- options = args.shift || {}
286
- name.nil? && (raise UsageError.new('name not specified'))
287
- @name = name
288
- end
289
-
290
- def execute
291
- update_config_yaml(/^\s*#?\s*theme:.*/, "theme: #{@name}")
292
- end
293
- end
294
- end
295
- end
296
- end
9
+ require File.expand_path('commands/demo', File.dirname(__FILE__))
10
+ require File.expand_path('commands/edit', File.dirname(__FILE__))
11
+ require File.expand_path('commands/new', File.dirname(__FILE__))
12
+ require File.expand_path('commands/plugin', File.dirname(__FILE__))
13
+ require File.expand_path('commands/theme', File.dirname(__FILE__))