template_builder 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +2 -1
- data/README.txt +1 -0
- data/Rakefile +1 -0
- data/conf/parameter_file.yml +8 -8
- data/lib/template_builder/app.rb +14 -10
- data/lib/template_builder/app/command_add.rb +79 -0
- data/lib/template_builder/app/conf_writer.rb +15 -0
- data/lib/template_builder/app/file_analyzer.rb +0 -1
- data/lib/template_builder/app/new.rb +0 -2
- data/lib/template_builder/app/show.rb +1 -1
- data/version.txt +1 -1
- metadata +22 -6
data/History.txt
CHANGED
data/README.txt
CHANGED
data/Rakefile
CHANGED
data/conf/parameter_file.yml
CHANGED
@@ -1,26 +1,26 @@
|
|
1
1
|
database :
|
2
|
-
help : set the database you want
|
2
|
+
help : set the database you want use
|
3
3
|
priority : 1
|
4
4
|
orm :
|
5
|
-
help : set the orm framework you want
|
5
|
+
help : set the orm framework you want use
|
6
6
|
priority : 2
|
7
7
|
javascript :
|
8
|
-
help : set the javascript framework you want
|
8
|
+
help : set the javascript framework you want use
|
9
9
|
priority : 2
|
10
10
|
templating :
|
11
|
-
help : set the templating framework you want
|
11
|
+
help : set the templating framework you want use
|
12
12
|
priority : 2
|
13
13
|
css :
|
14
|
-
help : set the css framework you want
|
14
|
+
help : set the css framework you want use
|
15
15
|
priority : 2
|
16
16
|
unit_testing :
|
17
|
-
help : set the unit testing framework you want
|
17
|
+
help : set the unit testing framework you want use
|
18
18
|
priority : 3
|
19
19
|
integration_testing :
|
20
|
-
help : set the integration testing framework you want
|
20
|
+
help : set the integration testing framework you want use
|
21
21
|
priority : 3
|
22
22
|
authentication :
|
23
|
-
help : set the authentication framework you want
|
23
|
+
help : set the authentication framework you want use
|
24
24
|
priority : 4
|
25
25
|
|
26
26
|
|
data/lib/template_builder/app.rb
CHANGED
@@ -4,7 +4,7 @@ require 'uri'
|
|
4
4
|
module TemplateBuilder::App
|
5
5
|
extend LittlePlugger(:path => 'template_builder/app', :module => TemplateBuilder::App)
|
6
6
|
|
7
|
-
disregard_plugins :command, :file_manager, :file_analyzer
|
7
|
+
disregard_plugins :command, :file_manager, :file_analyzer; :conf_writer
|
8
8
|
|
9
9
|
Error = Class.new(StandardError)
|
10
10
|
|
@@ -57,14 +57,18 @@ module TemplateBuilder::App
|
|
57
57
|
cmd.run
|
58
58
|
end
|
59
59
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
60
|
+
rescue TemplateBuilder::App::Error => err
|
61
|
+
stderr.puts "ERROR: While executing template builder ..."
|
62
|
+
stderr.puts " #{err.message}"
|
63
|
+
exit 1
|
64
|
+
rescue StandardError => err
|
65
|
+
stderr.puts "ERROR: While executing template builder ... (#{err.class})"
|
66
|
+
stderr.puts " #{err.to_s}"
|
67
|
+
exit 1
|
68
|
+
rescue Exception => err
|
69
|
+
stderr.puts "ERROR: While executing template builder ... (#{err.class})"
|
70
|
+
stderr.puts " #{err.to_s}"
|
71
|
+
exit 1
|
68
72
|
end
|
69
73
|
|
70
74
|
# Show the toplevel Template builder help message.
|
@@ -96,7 +100,7 @@ DESCRIPTION
|
|
96
100
|
puts msg
|
97
101
|
end
|
98
102
|
}
|
99
|
-
ary = [:new, :show]
|
103
|
+
ary = [:new, :show, :add]
|
100
104
|
ary.each(&fmt)
|
101
105
|
(@all_commands.keys - ary).each(&fmt)
|
102
106
|
msg.concat <<-MSG
|
@@ -0,0 +1,79 @@
|
|
1
|
+
module TemplateBuilder::App
|
2
|
+
class Add < Command
|
3
|
+
def self.initialize_add
|
4
|
+
synopsis 'template_builder add [framework] [plugin]'
|
5
|
+
|
6
|
+
summary 'Add new available framework or plugin at your template_builder .'
|
7
|
+
|
8
|
+
description <<-__
|
9
|
+
Add new framework (plugin) at your template_builder gem. You can add a new framework
|
10
|
+
type and new plugin for this framework.
|
11
|
+
__
|
12
|
+
|
13
|
+
option(standard_options[:force])
|
14
|
+
option(standard_options[:verbose])
|
15
|
+
end
|
16
|
+
|
17
|
+
def run
|
18
|
+
case @param.length
|
19
|
+
when 1
|
20
|
+
create_framework @param.shift
|
21
|
+
when 2
|
22
|
+
create_plugin @param.shift, @param.shift
|
23
|
+
else
|
24
|
+
Raise Exception, "Bad number of argument, see -h for more information"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def parse( args )
|
29
|
+
opts = super args
|
30
|
+
config[:name] = args.empty? ? nil : args.join('_')
|
31
|
+
if name.nil?
|
32
|
+
stdout.puts opts
|
33
|
+
exit 1
|
34
|
+
end
|
35
|
+
@param = args
|
36
|
+
end
|
37
|
+
|
38
|
+
def create_framework(name)
|
39
|
+
priority = ask_for_priority
|
40
|
+
ConfWriter.write_new_framework name, priority
|
41
|
+
end
|
42
|
+
|
43
|
+
def create_plugin(framework_name,plugin_name)
|
44
|
+
raise Exception, "Framework #{name} doesn't exists." unless test ?e, TemplateBuilder::PATH+"/conf/"+framework_name+".yml"
|
45
|
+
write = "\n#{plugin_name} :\n"
|
46
|
+
answer = "Would you add a gem at your plugin? (y/yes)"
|
47
|
+
puts answer
|
48
|
+
while ["y\n","yes\n"].include? STDIN.gets
|
49
|
+
write += build_new_gem
|
50
|
+
puts answer
|
51
|
+
end
|
52
|
+
puts "plugin command ="
|
53
|
+
write += "\tcommand :"+STDIN.gets
|
54
|
+
puts "plugin action ="
|
55
|
+
write += "\taction :["+STDIN.gets+"]"
|
56
|
+
ConfWriter.write_new_plugin framework_name, write
|
57
|
+
end
|
58
|
+
|
59
|
+
def build_new_gem
|
60
|
+
puts "gem name = "
|
61
|
+
msg = "\t"+STDIN.gets
|
62
|
+
puts "gem version = "
|
63
|
+
msg += "\t\tversion : "+STDIN.gets
|
64
|
+
puts "gem source = "
|
65
|
+
msg += "\t\tsource : "+STDIN.gets
|
66
|
+
puts "gem action = "
|
67
|
+
msg += "\t\taction : "+STDIN.gets
|
68
|
+
puts "gem command = "
|
69
|
+
msg += "\t\tcommand : "+STDIN.gets
|
70
|
+
msg
|
71
|
+
end
|
72
|
+
|
73
|
+
def ask_for_priority
|
74
|
+
puts "Choose the priority of your framework ? (1 <=> hight et 5 <=> less)"
|
75
|
+
answer = STDIN.gets until (1..5).include? answer.to_i
|
76
|
+
answer
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module TemplateBuilder::App::ConfWriter
|
2
|
+
def self.write_new_framework(name,priority)
|
3
|
+
#raise Exception, "Framework #{name} already exists." if test ?e, TemplateBuilder::PATH+"/conf/"+name+".yml"
|
4
|
+
File.open(File.join(TemplateBuilder::PATH+"/conf/",name+".yml"),"w")
|
5
|
+
File.open(File.join(TemplateBuilder::PATH+"/conf/","param.yml"),"a+") do |out|
|
6
|
+
out.write "\n#{name} : \n\t help : set the #{name} framework you want use\n\tpriority : #{priority}"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.write_new_plugin(framework_name, plugin)
|
11
|
+
File.open(File.join(TemplateBuilder::PATH+"/conf/",framework_name+".yml"),"a+") do |out|
|
12
|
+
out.write plugin
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -32,9 +32,7 @@ of option as the database, the javascript framework etc ..
|
|
32
32
|
sorted_param.each{ |k,v| ask_for k unless v.name }
|
33
33
|
|
34
34
|
file_manager.start_file sorted_param
|
35
|
-
|
36
35
|
sorted_param.each{ |k,v| run_framework file_manager, :type=>k, :name=>v.name unless v.name == "none"}
|
37
|
-
|
38
36
|
file_manager.end_file name, @command
|
39
37
|
|
40
38
|
end
|
data/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: template_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 3
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Anthony
|
@@ -15,13 +15,27 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-12-
|
18
|
+
date: 2010-12-23 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
name:
|
22
|
+
name: little-plugger
|
23
23
|
prerelease: false
|
24
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: bones
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
25
39
|
none: false
|
26
40
|
requirements:
|
27
41
|
- - ">="
|
@@ -33,7 +47,7 @@ dependencies:
|
|
33
47
|
- 1
|
34
48
|
version: 3.5.1
|
35
49
|
type: :development
|
36
|
-
version_requirements: *
|
50
|
+
version_requirements: *id002
|
37
51
|
description: |-
|
38
52
|
Template-builder is a handy tool that builds a template for your new Ruby
|
39
53
|
on Rails projects. The template contains all you need to build the RoR
|
@@ -65,6 +79,8 @@ files:
|
|
65
79
|
- lib/template_builder.rb
|
66
80
|
- lib/template_builder/app.rb
|
67
81
|
- lib/template_builder/app/command.rb
|
82
|
+
- lib/template_builder/app/command_add.rb
|
83
|
+
- lib/template_builder/app/conf_writer.rb
|
68
84
|
- lib/template_builder/app/file_analyzer.rb
|
69
85
|
- lib/template_builder/app/file_manager.rb
|
70
86
|
- lib/template_builder/app/helper/framework.rb
|