Skip to content
This repository has been archived by the owner on Sep 24, 2022. It is now read-only.

Commit

Permalink
Added A module file template and an install file template.
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam A. Gregory committed Jul 26, 2011
1 parent feef44f commit 22b96cf
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 5 deletions.
35 changes: 35 additions & 0 deletions drupal.ruble/templates/template.install
@@ -0,0 +1,35 @@
<?php
/**
* @file
* Install, Uninstall, Schema, and Update functionality
*/

/**
* Implements hook_install().
*/
function ${TM_NEW_FILE_BASENAME}_install() {

}

/**
* Implements hook_uninstall().
*/
function ${TM_NEW_FILE_BASENAME}_uninstall() {

}

/**
* Implements hook_schema().
*/
function ${TM_NEW_FILE_BASENAME}_schema() {
$schema = array();

return $schema;
}

/**
* Implements hook_update_N().
*/
function ${TM_NEW_FILE_BASENAME}_update_7100() {

}
11 changes: 9 additions & 2 deletions drupal.ruble/templates/template.module
@@ -1,5 +1,12 @@
<?php
/**
* @file
* File description goes here
*/
* Core and Contrib Hooks, and required functions for module
*/

/**
* Implements hook_help().
*/
function ${TM_NEW_FILE_BASENAME}_help($path, $arg) {

}
14 changes: 11 additions & 3 deletions drupal.ruble/templates/templates.rb
Expand Up @@ -2,10 +2,18 @@

template "Module Template" do |t|
t.filetype = "*.module"
t.replace_parameters = true
t.invoke do |context|
ENV['TM_DATE'] = Time.now.strftime("%Y-%m-%d")
module = find_module_name(ENV['TM_DIRECTORY'])
raw_contents = IO.read("#{ENV['TM_BUNDLE_SUPPORT']}/templates/template.module")
raw_contents = IO.read("#{ENV['TM_BUNDLE_SUPPORT']}/../templates/template.module")
raw_contents.gsub(/\$\{([^}]*)\}/) {|match| ENV[match[2..-2]] }
end
end

template "Install Template" do |t|
t.filetype = "*.install"
t.replace_parameters = true
t.invoke do |context|
raw_contents = IO.read("#{ENV['TM_BUNDLE_SUPPORT']}/../templates/template.install")
raw_contents.gsub(/\$\{([^}]*)\}/) {|match| ENV[match[2..-2]] }
end
end

0 comments on commit 22b96cf

Please sign in to comment.