Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

How to migrate from webgen 0.5 to webgen 1.4.0

27 views
Skip to first unread message

Saiph Kappa

unread,
Sep 27, 2017, 12:00:19 PM9/27/17
to webgen-users
Hi,

When trying to compile my website, that was made with webgen 0.5, I get the following error:

«
ᐅ webgen   
webgen encountered a problem:
  uninitialized constant Webgen::WebsiteAccess
Did you mean?  Webgen::Website
»

I already deleted ext/init.rb and renamed config.yaml to webgen.config and deleted the entry default_processing_pipeline key and value.

What can I do?

Thanks in advance. 

Thomas Leitner

unread,
Oct 3, 2017, 10:51:30 AM10/3/17
to webgen...@googlegroups.com
This problem usually occurs when webgen tries to load the cache file
from an older version or an older version is also installed. So make
sure that you uninstall all older versions and that you remove the
cache file.

-- Thomas

Saiph Kappa

unread,
Oct 4, 2017, 8:12:47 AM10/4/17
to webgen-users
I deleted the file webgen.cache in the root folder of my website and uninstalled webgen0.5. After a system reboot, the problem still persists... Any other ideas?

Thanks

Thomas Leitner

unread,
Oct 5, 2017, 12:28:12 PM10/5/17
to webgen...@googlegroups.com
On 2017-10-04 05:12 -0700 Saiph Kappa wrote:
> I deleted the file webgen.cache in the root folder of my website and
> uninstalled webgen0.5. After a system reboot, the problem still
> persists... Any other ideas?

webgen 1.x also creates a tmp/ directory in the website directory - try
deleting that, too.

If that doesn't help either, try running with `--debug -v` and post the
output.

If that still doesn't leave a clue, looking at you website source would
help in figuring out why it doesn't work.

-- Thomas

Saiph Kappa

unread,
Oct 6, 2017, 2:31:03 PM10/6/17
to webgen-users
Thanks a lot. It worked now.

Just one last question. I used to have this extension that provided me the last time the node files were updated:
«
# = webgen extensions directory
#
# All init.rb files anywhere under this directory get automatically loaded on a webgen run. This
# allows you to add your own extensions to webgen or to modify webgen's core!
#
# If you don't need this feature you can savely delete this file and the directory in which it is!
#
# The +config+ variable below can be used to access the Webgen::Configuration object for the current
# website.
config = Webgen::WebsiteAccess.website.config
config['contentprocessor.tags.map']['filemdate'] = 'FileMDateTag'

class FileMDateTag #< Tags::DefaultTag

  include Webgen::Tag::Base

  #infos( :name => 'Tag/FileMDate',
  #       :summary => 
  #       "Prints out the date of last modification of the current file")

  #register_tag 'filemdate'

  #param 'format', '%d/%m/%Y %H:%M', 'The format of the date (same options as Time#strftime).'

  def call(tag, body, context)
    return File.mtime( 'src' + context.content_node.node_info[:src]).strftime('%b %-d, %Y')
  end

end
»

In the main file I would just have this: Last update: {filemdate:}

Can you tell me how can I make it work with webgen 1.4.0?


Thanks!

Thomas Leitner

unread,
Oct 7, 2017, 3:27:18 AM10/7/17
to webgen...@googlegroups.com
On 2017-10-06 11:31 -0700 Saiph Kappa wrote:
> Thanks a lot. It worked now.

Great!

> Just one last question. I used to have this extension that provided
> me the last time the node files were updated:
>
> <SNIP/>
>
> In the main file I would just have this: Last update: {filemdate:}
>
> Can you tell me how can I make it work with webgen 1.4.0?

Just put the following into `ext/init.rb`:

website.ext.tag.register('filemdate', config_prefix: 'tag.filemdate') do |tag, body, context|
context.content_node['modified_at'].strftime('%b %-d, %Y')
end

The 'modified_at' meta information comes directly from the file's mtime.

-- Thomas
Reply all
Reply to author
Forward
0 new messages