tclone 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in tclone.gemspec
4
+ gemspec
data/README.textile ADDED
@@ -0,0 +1,25 @@
1
+ h1. Tclone
2
+
3
+ Just copy the templates of the rails generators to the your rails project.
4
+
5
+ h2. Installation
6
+
7
+ Configure the Gemfile:
8
+
9
+ bc(sh). gem 'tclone'
10
+
11
+ h2. Usage
12
+
13
+ To copy the templates used by the scaffold generator:
14
+
15
+ bc(ruby). rails g tclone scaffold
16
+ # Above command will copy all the templates used by the scaffold generator to your rails project( RAILS_ROOT/lib/templates/ )
17
+
18
+
19
+ Now, you can modify the template used by the scaffole generator.
20
+
21
+
22
+
23
+
24
+
25
+
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,18 @@
1
+ Description:
2
+ Just copy the templates of the rails generators to the your rails project.
3
+
4
+ Example:
5
+ rails generate tclone scaffold
6
+
7
+ This will create:
8
+ lib/templates/active_record/model
9
+ lib/templates/active_record/model/migration.rb
10
+ lib/templates/active_record/model/model.rb
11
+ ...
12
+ lib/templates/erb/scaffold/_form.html.erb
13
+ lib/templates/erb/scaffold/edit.html.erb
14
+ lib/templates/erb/scaffold/index.html.erb
15
+ lib/templates/erb/scaffold/new.html.erb
16
+ lib/templates/erb/scaffold/show.html.erb
17
+ ...
18
+
@@ -0,0 +1,27 @@
1
+ class TcloneGenerator < Rails::Generators::NamedBase
2
+ source_root File.expand_path('../templates', __FILE__)
3
+
4
+ def create_template_files
5
+ clone_generator_templates( name )
6
+ end
7
+
8
+ private
9
+ def clone_generator_templates( gname, goptions = [] )
10
+ klass_obj = Rails::Generators.find_by_namespace( gname, *goptions )
11
+ if( klass_obj )
12
+ clone_templates( klass_obj.namespace, klass_obj.source_root )
13
+ for k,v in klass_obj.hooks
14
+ gk = klass_obj.class_options[k].default
15
+ gk = ( gk == true ) ? k : gk
16
+ clone_generator_templates( gk, v )
17
+ end
18
+ end
19
+ end
20
+
21
+ def clone_templates( ns, path )
22
+ if( path and File.directory? path )
23
+ directory path, "lib/templates/#{ns.gsub(/:/,'/')}"
24
+ end
25
+ end
26
+
27
+ end
@@ -0,0 +1,3 @@
1
+ module Tclone
2
+ VERSION = "0.0.1"
3
+ end
data/lib/tclone.rb ADDED
@@ -0,0 +1,3 @@
1
+ module Tclone
2
+ # Your code goes here...
3
+ end
data/tclone.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "tclone/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "tclone"
7
+ s.version = Tclone::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Mohammed Siddick. E"]
10
+ s.email = ["siddick@gmail.com"]
11
+ s.homepage = "http://github.com/siddick/tclone"
12
+ s.summary = %q{Clone the templates of the Rails generators}
13
+ s.description = %q{
14
+ Now, You can copy the default templates of rails generators to Your Rails Project.
15
+ Example( clone the templates of scaffold generator ):
16
+ `rails g tclone scaffold`
17
+ }
18
+
19
+ s.rubyforge_project = "tclone"
20
+
21
+ s.files = `git ls-files`.split("\n")
22
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
23
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
24
+ s.require_paths = ["lib"]
25
+ end
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tclone
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Mohammed Siddick. E
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-01-05 00:00:00 +05:30
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: " \n Now, You can copy the default templates of rails generators to Your Rails Project.\n Example( clone the templates of scaffold generator ): \n `rails g tclone scaffold`\n "
22
+ email:
23
+ - siddick@gmail.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - .gitignore
32
+ - Gemfile
33
+ - README.textile
34
+ - Rakefile
35
+ - lib/generators/tclone/USAGE
36
+ - lib/generators/tclone/tclone_generator.rb
37
+ - lib/tclone.rb
38
+ - lib/tclone/version.rb
39
+ - tclone.gemspec
40
+ has_rdoc: true
41
+ homepage: http://github.com/siddick/tclone
42
+ licenses: []
43
+
44
+ post_install_message:
45
+ rdoc_options: []
46
+
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ segments:
55
+ - 0
56
+ version: "0"
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ segments:
63
+ - 0
64
+ version: "0"
65
+ requirements: []
66
+
67
+ rubyforge_project: tclone
68
+ rubygems_version: 1.3.7
69
+ signing_key:
70
+ specification_version: 3
71
+ summary: Clone the templates of the Rails generators
72
+ test_files: []
73
+