helpers/url.rb in origen-0.7.13 vs helpers/url.rb in origen-0.7.14

- old
+ new

@@ -2,10 +2,26 @@ class Generator class Compiler # :nodoc: all # Helper methods that are available to all templates module Helpers + def self.archive_name=(val) + @archive_name = val + end + + def self.archive_name + @archive_name + end + + def generate_hard_links? + !!archive_name + end + + def archive_name + Origen::Generator::Compiler::Helpers.archive_name + end + def current_path path(options[:top_level_file].to_s.sub(/^.*\/templates\/web/, '').sub(/\..*$/, '')) end def current_url @@ -13,11 +29,11 @@ end # Like current_url except always returns the latest version of the url and # not one with an embedded production version def current_latest_url - current_url.sub(_version, 'latest') + current_url.sub(_archive, 'latest') end def path(p) p = "/#{p}" unless p =~ /^\// @@ -25,11 +41,11 @@ "#{p}" # dev mode used for local website generation # For Git deploy don't maintain versions elsif Origen.app.deployer.deploy_to_git? "#{root_path}#{p}" else - "#{root_path}/#{_version}#{p}" + "#{root_path}/#{_archive}#{p}" end end def url(p) "#{domain_minus_root_path}#{path(p)}" @@ -41,20 +57,14 @@ def domain_minus_root_path domain.sub /#{root_path}$/, '' end - def _version - # Special case for Origen core.. - if Origen.top == Origen.root - version = Origen.version + def _archive + if generate_hard_links? + archive_name.to_s.gsub(".", "_") else - version = Origen.app.version - end - if version.development? 'latest' - else - version.to_s.gsub(".", "_") end end # Returns any path attached to the domain, for example will return "/jtag" # for "http://origen-sdk.org/jtag"