webgen 1.2.1 → 1.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2a1b98190c63a1f48d1d1dccd972540408c621f0
4
- data.tar.gz: 5b512539e92608915846a6ed88c42f4aca49fcf1
3
+ metadata.gz: 4549cd7e320897cf555980fefa9d6f11a29c7d73
4
+ data.tar.gz: 1e5fcd72bc28df47eb681939fe34c562f11fb09e
5
5
  SHA512:
6
- metadata.gz: a588782682753d0dab0ef0870202c1900c31de91968eedf05b3697d822614ca6a37ed5b689d6461f23d709cfd39c6ab065955499d73f650ef4b8b7ac596637c4
7
- data.tar.gz: bb345850ff9514ef556e17f5b49e10a096451196419e0b351d1f36db462c0b4f505f591e913f7c2636a8073ded7c9cad07c93d13ac47ed58ad07dfc4e7e81c0b
6
+ metadata.gz: 8b30674ab19c718895f896a880b2a3d1c3d1416ab2234b9ccff7abced4cac9ae8aba8d63a8737f60da328e7eedbaa743d5196ca3a5c4e248bfa457bb535b6e09
7
+ data.tar.gz: 8241e6eecf941a6232d7a0744d4ced310c63d42a11ddecb769ff59488c06512930784e92068ced694a52955fb9a75032a7bdfd5993d9d9a86a593a35a2456cad
data/README.md CHANGED
@@ -10,12 +10,10 @@ extensions.
10
10
 
11
11
  The author of webgen is Thomas Leitner -- he is reachable at <mailto:t_leitner@gmx.at>.
12
12
 
13
- You can discuss webgen or find help on the [webgen-users] mailing list
14
- which is mirrored to the [webgen-users Google group].
13
+ You can discuss webgen or find help on the [webgen-users Google group].
15
14
 
16
15
  Or you can join the IRC channel [#webgen] on Freenode.
17
16
 
18
- [webgen-users]: http://rubyforge.org/pipermail/webgen-users/
19
17
  [webgen-users Google group]: https://groups.google.com/forum/?fromgroups#!forum/webgen-users
20
18
  [#webgen]: irc://chat.freenode.net/#webgen
21
19
 
data/Rakefile CHANGED
@@ -5,11 +5,6 @@ require 'rubygems/package_task'
5
5
  require 'rdoc/task'
6
6
  require 'rdoc/rdoc'
7
7
 
8
- begin
9
- require 'rubyforge'
10
- rescue LoadError
11
- end
12
-
13
8
  require 'fileutils'
14
9
  require 'rake/clean'
15
10
  require 'rake/testtask'
@@ -99,7 +94,7 @@ EOF
99
94
 
100
95
  Thanks for choosing webgen! Here are some places to get you started:
101
96
  * The webgen User Documentation at <http://webgen.gettalong.org/documentation/>
102
- * The mailing list archive at <http://rubyforge.org/pipermail/webgen-users/>
97
+ * The mailing list archive at <https://groups.google.com/forum/?fromgroups#!forum/webgen-users>
103
98
  * The webgen Wiki at <http://github.com/gettalong/webgen/wiki>
104
99
 
105
100
  Have a look at <http://webgen.gettalong.org/news.html> for a list of changes!
@@ -118,7 +113,6 @@ EOF
118
113
  s.add_development_dependency('rake', '>= 0.8.3')
119
114
  s.add_development_dependency('minitest', '~> 5.0')
120
115
  s.add_development_dependency('diff-lcs', '~> 1.0')
121
- s.add_development_dependency('rubyforge', '~> 2.0')
122
116
  s.add_development_dependency('maruku', '~> 0.7')
123
117
  s.add_development_dependency('RedCloth', '~> 4.1')
124
118
  s.add_development_dependency('haml', '~> 4.0')
@@ -146,7 +140,6 @@ EOF
146
140
  s.author = 'Thomas Leitner'
147
141
  s.email = 't_leitner@gmx.at'
148
142
  s.homepage = "http://webgen.gettalong.org"
149
- s.rubyforge_project = 'webgen'
150
143
  end
151
144
 
152
145
  Gem::PackageTask.new(spec) do |pkg|
@@ -155,46 +148,14 @@ EOF
155
148
  end
156
149
 
157
150
  desc 'Release webgen version ' + Webgen::VERSION
158
- task :release => [:clobber, :package, :publish_files, :post_news]
159
-
160
- if defined? RubyForge
161
- desc "Upload the release to Rubyforge"
162
- task :publish_files => [:package] do
163
- print 'Uploading files to Rubyforge...'
164
- $stdout.flush
165
-
166
- rf = RubyForge.new
167
- rf.configure
168
- rf.login
169
-
170
- rf.userconfig["release_notes"] = ""
171
- rf.userconfig["release_changes"] = ""
172
- rf.userconfig["preformatted"] = false
173
-
174
- files = %w[.gem .tgz .zip].collect {|ext| "pkg/webgen-#{Webgen::VERSION}" + ext}
151
+ task :release => [:clobber, :package, :publish_files]
175
152
 
176
- rf.add_release('webgen', 'webgen', Webgen::VERSION, *files)
177
-
178
- sh "gem push pkg/webgen-#{Webgen::VERSION}.gem"
179
-
180
- puts 'done'
181
- end
182
-
183
- desc 'Post announcement to rubyforge.'
184
- task :post_news do
185
- print 'Posting announcement to Rubyforge ...'
186
- $stdout.flush
187
- rf = RubyForge.new
188
- rf.configure
189
- rf.login
190
-
191
- text = "Have a look at http://webgen.gettalong.org/news.html for the release details!"
192
- rf.post_news('webgen', "webgen #{Webgen::VERSION} released", text)
193
- puts "done"
194
- end
153
+ desc "Upload the release to rubygems.org"
154
+ task :publish_files => [:package] do
155
+ sh "gem push pkg/webgen-#{Webgen::VERSION}.gem"
156
+ puts 'done'
195
157
  end
196
158
 
197
-
198
159
  desc "Run the tests one by one to check for missing deps"
199
160
  task :test_isolated do
200
161
  files = Dir['test/webgen/**/test_*']
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.1
1
+ 1.3.0
@@ -274,7 +274,12 @@ module Webgen
274
274
  l
275
275
  end
276
276
  end.uniq
277
- result.nodes.keep_if {|n| langs.any? {|l| n.lang == l}}
277
+ fallback = langs.delete('fallback')
278
+ result.nodes.keep_if do |n|
279
+ langs.any? {|l| n.lang == l} ||
280
+ (fallback && n.lang == @website.config['website.lang'] &&
281
+ !n.tree.translations(n).any? {|tn| langs.any? {|l| tn.lang == l}})
282
+ end
278
283
  end
279
284
 
280
285
  def filter_ancestors(result, ref_node, enabled)
@@ -393,7 +393,6 @@ module Webgen
393
393
  vpath = path.dup
394
394
  (mi ||= {})['version'] ||= name
395
395
  vpath.meta_info.merge!(mi)
396
- vpath.meta_info['dest_path'] ||= '<parent><basename>(-<version>)(.<lang>)<ext>'
397
396
  @website.logger.debug do
398
397
  "Creating node version '#{vpath['version']}' from path <#{vpath}> with #{handler} handler"
399
398
  end
@@ -38,7 +38,7 @@ module Webgen
38
38
  # URL.
39
39
  def url
40
40
  node_url = Webgen::Path.url(dest_path, false)
41
- node_url.absolute? ? node_url : File.join(tree.website.config['website.base_url'], dest_path)
41
+ node_url.absolute? ? node_url.to_s : File.join(tree.website.config['website.base_url'], dest_path)
42
42
  end
43
43
 
44
44
  # Does exactly the same as Webgen::Node#route_to but also automatically adds the necessary
@@ -53,7 +53,7 @@ module Webgen
53
53
  # depending on the configuration option 'website.link_to_current_page'.
54
54
  def link_to(*args, &block)
55
55
  result = super
56
- if !tree.website.config['website.link_to_current_page']
56
+ if !tree.website.config['website.link_to_current_page'] && args.first == self
57
57
  result.sub!(/<a/, '<span').sub!(/<\/a>/, '</span>').
58
58
  gsub!(/ (?:href|hreflang)=".*"/, '')
59
59
  end
@@ -161,6 +161,7 @@ module Webgen
161
161
  # exists, the language part is forced to be in the destination path and the resulting
162
162
  # destination path is returned.
163
163
  def dest_path(parent, path)
164
+ path.meta_info['dest_path'] ||= '<parent><basename>(-<version>)(.<lang>)<ext>'
164
165
  dpath = construct_dest_path(parent, path, false)
165
166
  if (node = node_exists?(path, dpath)) && node.lang != path.meta_info['lang']
166
167
  dpath = construct_dest_path(parent, path, true)
@@ -47,6 +47,7 @@ module Webgen
47
47
  else
48
48
  entry_path[:virtual] = true
49
49
  entry_path['handler'] = 'virtual'
50
+ entry_path['node_class'] ||= Webgen::PathHandler::Base::Node.to_s
50
51
  @website.ext.path_handler.create_secondary_nodes(entry_path)
51
52
  end
52
53
  end
@@ -3,6 +3,6 @@
3
3
  module Webgen
4
4
 
5
5
  # The version of webgen.
6
- VERSION = '1.2.1'
6
+ VERSION = '1.3.0'
7
7
 
8
8
  end
@@ -56,8 +56,6 @@ class TestPathHandlerBase < Minitest::Test
56
56
  config['website.lang'] = 'en'
57
57
  node = Webgen::Node.new(@website.tree.dummy_root, '/', '/', {:test => :value})
58
58
 
59
- assert_raises(Webgen::NodeCreationError) { @obj.dest_path(node, Webgen::Path.new('/test')) }
60
-
61
59
  check_dest_path = lambda do |path, mi, expected, parent = node|
62
60
  assert_equal(expected, @obj.dest_path(parent, Webgen::Path.new(path, mi)))
63
61
  end
@@ -156,10 +154,12 @@ class TestPathHandlerBase < Minitest::Test
156
154
  @website.config = {'website.base_url' => 'http://example.com/sub', 'website.link_to_current_page' => true}
157
155
 
158
156
  assert_equal('http://example.com/sub/somename.html', child_de.url)
157
+ assert_kind_of(String, child_de.url)
159
158
 
160
159
  assert_equal('<a href="somename.html" hreflang="de">Somename</a>', node.link_to(child_de))
161
160
  @website.config['website.link_to_current_page'] = false
162
- assert_equal('<span>Somename</span>', node.link_to(child_de))
161
+ assert_equal('<a href="somename.html" hreflang="de">Somename</a>', node.link_to(child_de))
162
+ assert_equal('<span>Somename</span>', child_de.link_to(child_de))
163
163
  end
164
164
 
165
165
  end
@@ -87,6 +87,7 @@ EOF
87
87
  refute_nil(node_en)
88
88
  refute_nil(@root.tree['/dirnew/dirnew/dirnew/'])
89
89
 
90
+ assert_equal(Webgen::PathHandler::Base::Node, node_de.class)
90
91
  assert_equal('new title', node_en['title'])
91
92
  assert_equal(@time.tv_usec, node_en['modified_at'].tv_usec)
92
93
  assert(node_en['no_output'])
@@ -123,12 +123,17 @@ class TestNodeFinder < Minitest::Test
123
123
  @nf.find({:absolute_levels => [0,1], :levels => 2}, tree['/dir/']))
124
124
 
125
125
  # test filter: langs
126
+ @config['website.lang'] = 'en'
126
127
  check.call(%w[/file.en.html /other.en.html /dir2/index.en.html],
127
128
  @nf.find({:lang => 'en', :flatten => true}, tree['/dir/']))
128
129
  check.call(%w[/file.en.html /file.de.html /other.en.html /german.de.html /dir2/index.en.html /dir2/index.de.html],
129
130
  @nf.find({:lang => ['en', 'de'], :flatten => true}, tree['/dir/']))
130
131
  check.call(%w[/file.en.html /other.en.html /dir2/index.en.html],
131
132
  @nf.find({:lang => 'node', :flatten => true}, tree['/file.en.html']))
133
+ check.call(%w[/file.en.html /other.en.html /dir2/index.en.html],
134
+ @nf.find({:lang => ['en', 'fallback'], :flatten => true}, tree['/file.en.html']))
135
+ check.call(%w[/file.de.html /other.en.html /german.de.html /dir2/index.de.html],
136
+ @nf.find({:lang => ['de', 'fallback'], :flatten => true}, tree['/file.en.html']))
132
137
 
133
138
  # test filter: ancestors
134
139
  check.call(%w[/ /dir/ /dir/dir/ /dir/dir/file.html],
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webgen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Leitner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-16 00:00:00.000000000 Z
11
+ date: 2014-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cmdparse
@@ -100,20 +100,6 @@ dependencies:
100
100
  - - ~>
101
101
  - !ruby/object:Gem::Version
102
102
  version: '1.0'
103
- - !ruby/object:Gem::Dependency
104
- name: rubyforge
105
- requirement: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - ~>
108
- - !ruby/object:Gem::Version
109
- version: '2.0'
110
- type: :development
111
- prerelease: false
112
- version_requirements: !ruby/object:Gem::Requirement
113
- requirements:
114
- - - ~>
115
- - !ruby/object:Gem::Version
116
- version: '2.0'
117
103
  - !ruby/object:Gem::Dependency
118
104
  name: maruku
119
105
  requirement: !ruby/object:Gem::Requirement
@@ -490,7 +476,7 @@ post_install_message: |2+
490
476
 
491
477
  Thanks for choosing webgen! Here are some places to get you started:
492
478
  * The webgen User Documentation at <http://webgen.gettalong.org/documentation/>
493
- * The mailing list archive at <http://rubyforge.org/pipermail/webgen-users/>
479
+ * The mailing list archive at <https://groups.google.com/forum/?fromgroups#!forum/webgen-users>
494
480
  * The webgen Wiki at <http://github.com/gettalong/webgen/wiki>
495
481
 
496
482
  Have a look at <http://webgen.gettalong.org/news.html> for a list of changes!
@@ -514,7 +500,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
514
500
  - !ruby/object:Gem::Version
515
501
  version: '0'
516
502
  requirements: []
517
- rubyforge_project: webgen
503
+ rubyforge_project:
518
504
  rubygems_version: 2.0.3
519
505
  signing_key:
520
506
  specification_version: 4