Sha256: 57283d9d28352bfaf8d4a9d7f73cffc8304a35dd9b11b33187fe9119dbbdad4e

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

require 'erb'
require 'yaml'

# == Recipe helpers
#
# * Loads the configuration 
# * Generates files from templates
#
module Capigen::Helper
  
  include Capigen::Templates
  include Capigen::Profiles
  
  include Capigen::Helpers::PackageHelper
  include Capigen::Helpers::WgetHelper
  include Capigen::Helpers::ScriptHelper
  include Capigen::Helpers::GemHelper
    
  # Project root (for rails)
  def root
    if respond_to?(:fetch)
      return fetch(:project_root)
    else
      RAILS_ROOT
    end
  end
    
  # Path relative to project root
  def relative_to_root(path = nil, check_exist = false)
    if path
      root_path = File.join(root, path)
    else
      root_path = root
    end
    
    # Check for file existance
    if check_exist and !File.exist?(root_path)
      raise <<-EOS
        
        File not found: #{File.expand_path(root_path)}
        
        This is loaded for the capigen plugin. View the README in:
        #{File.expand_path(File.dirname(__FILE__) + "/../doc/README")}
      EOS
    end
    
    root_path
  end  
    
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
capigen-0.1.1 lib/capigen/helper.rb
capigen-0.1.2 lib/capigen/helper.rb
capigen-0.1.3 lib/capigen/helper.rb