template 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.4.0
|
@@ -1,20 +1,35 @@
|
|
1
|
+
require 'rails/generators'
|
1
2
|
require 'Rake' #need rake to be able to execute shell commands
|
2
|
-
|
3
|
-
|
3
|
+
module Template
|
4
|
+
#kudos to Mike Farmer from stackoverflow http://stackoverflow.com/users/4082/mike-farmer
|
5
|
+
class InstallGenerator < Rails::Generators::Base
|
6
|
+
desc "Creates some basic files for a rails 3 app"
|
7
|
+
|
8
|
+
# Add some extra options here:
|
9
|
+
# Commandline options can be defined here using Thor-like options:
|
10
|
+
# class_option :my_opt, :type => :boolean, :default => false, :desc => "My Option"
|
11
|
+
|
12
|
+
# I can later access that option using:
|
13
|
+
# options[:my_opt]
|
14
|
+
|
15
|
+
|
16
|
+
def self.source_root
|
17
|
+
@source_root ||= File.join(File.dirname(__FILE__), 'templates')
|
18
|
+
end
|
4
19
|
|
5
20
|
def copy_template_files
|
6
21
|
copy_file 'app/controllers/welcome_controller.rb','app/controllers/welcome_controller.rb'
|
7
22
|
template 'app/views/layouts/application.html.erb'
|
8
23
|
template 'app/views/welcome/index.html.erb'
|
9
|
-
template 'config/database.yml'
|
24
|
+
template 'config/database.yml'
|
10
25
|
template 'public/stylesheets/screen.css'
|
11
|
-
end
|
12
|
-
|
13
|
-
|
26
|
+
end
|
27
|
+
|
28
|
+
|
14
29
|
def add_routes
|
15
30
|
route 'root :to => "welcome#index"'
|
16
31
|
end
|
17
|
-
|
32
|
+
|
18
33
|
def generate_navigation
|
19
34
|
generate('navigation_config',"--force")
|
20
35
|
@navigation = ''
|
@@ -23,26 +38,30 @@ class TemplateGenerator < Rails::Generators::NamedBase
|
|
23
38
|
generate('controller', c_name+' show') #TODO: push all other args onto end.
|
24
39
|
@navigation += 'primary.item :'+controller_name.downcase+' ,\''+controller_name.capitalize+'\', '+controller_name.downcase+'_show_url'+'
|
25
40
|
'
|
26
|
-
end
|
41
|
+
end
|
27
42
|
template 'config/navigation.rb'
|
28
|
-
end
|
43
|
+
end
|
44
|
+
|
29
45
|
|
30
|
-
|
31
46
|
def setup_db
|
32
47
|
plugin('easypg', :git=>'git://github.com/rahim/easypg.git')
|
33
|
-
end
|
34
|
-
|
48
|
+
end
|
49
|
+
|
35
50
|
def run_post_install_scripts
|
36
|
-
begin
|
51
|
+
begin
|
37
52
|
sh 'rm public/index.html' #todo other OS.
|
38
53
|
sh 'rake db:setup'
|
39
54
|
rescue
|
40
55
|
puts '----- Unable to run post install scripts. You need to: -------'
|
41
|
-
puts '| - Remove index file in index.html |'
|
56
|
+
puts '| - Remove index file in index.html |'
|
42
57
|
puts '| - Run rake db:setup |'
|
43
58
|
puts '| - Start your server: rails server |'
|
44
59
|
puts '---------------------------------------------------------------'
|
45
60
|
end
|
46
|
-
end
|
47
|
-
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
end
|
48
67
|
end
|
data/template.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{template}
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Yule"]
|
@@ -25,9 +25,8 @@ Gem::Specification.new do |s|
|
|
25
25
|
"README.rdoc",
|
26
26
|
"Rakefile",
|
27
27
|
"VERSION",
|
28
|
-
"lib/generators/install_generator.rb",
|
29
28
|
"lib/generators/template/USAGE",
|
30
|
-
"lib/generators/template/
|
29
|
+
"lib/generators/template/install_generator.rb",
|
31
30
|
"lib/generators/template/templates/app/controllers/welcome_controller.rb",
|
32
31
|
"lib/generators/template/templates/app/views/layouts/application.html.erb",
|
33
32
|
"lib/generators/template/templates/app/views/welcome/index.html.erb",
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: template
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
8
|
+
- 4
|
9
9
|
- 0
|
10
|
-
version: 1.
|
10
|
+
version: 1.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Yule
|
@@ -111,9 +111,8 @@ files:
|
|
111
111
|
- README.rdoc
|
112
112
|
- Rakefile
|
113
113
|
- VERSION
|
114
|
-
- lib/generators/install_generator.rb
|
115
114
|
- lib/generators/template/USAGE
|
116
|
-
- lib/generators/template/
|
115
|
+
- lib/generators/template/install_generator.rb
|
117
116
|
- lib/generators/template/templates/app/controllers/welcome_controller.rb
|
118
117
|
- lib/generators/template/templates/app/views/layouts/application.html.erb
|
119
118
|
- lib/generators/template/templates/app/views/welcome/index.html.erb
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'rails/generators'
|
2
|
-
module Template
|
3
|
-
#kudos to Mike Farmer from stackoverflow http://stackoverflow.com/users/4082/mike-farmer
|
4
|
-
class InstallGenerator < Rails::Generators::Base
|
5
|
-
desc "Creates some basic files for a rails 3 app"
|
6
|
-
|
7
|
-
# Add some extra options here:
|
8
|
-
# Commandline options can be defined here using Thor-like options:
|
9
|
-
# class_option :my_opt, :type => :boolean, :default => false, :desc => "My Option"
|
10
|
-
|
11
|
-
# I can later access that option using:
|
12
|
-
# options[:my_opt]
|
13
|
-
|
14
|
-
|
15
|
-
def self.source_root
|
16
|
-
@source_root ||= File.join(File.dirname(__FILE__), 'templates')
|
17
|
-
end
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|