flak 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/README.textile +59 -0
  2. data/flak.gemspec +2 -2
  3. data/lib/flak.rb +16 -341
  4. data/lib/flak/rake/base.rb +312 -0
  5. data/lib/flak/{cpp.rb → rake/cpp.rb} +6 -4
  6. data/lib/flak/{delight.rb → rake/delight.rb} +3 -3
  7. data/lib/flak/rake/doc.rb +64 -0
  8. data/lib/flak/{gl.rb → rake/gl.rb} +1 -1
  9. data/lib/flak/{mac.rb → rake/mac.rb} +1 -1
  10. data/lib/flak/{max.rb → rake/max.rb} +1 -1
  11. data/lib/flak/{maya.rb → rake/maya.rb} +7 -7
  12. data/lib/flak/{maya_app.rb → rake/maya_app.rb} +1 -1
  13. data/lib/flak/{maya_plugin.rb → rake/maya_plugin.rb} +1 -1
  14. data/lib/flak/{nuke.rb → rake/nuke.rb} +1 -1
  15. data/lib/flak/{target.rb → rake/target.rb} +9 -19
  16. data/lib/flak/thor/generate.rb +108 -184
  17. data/lib/flak/thor/target_file.rb +62 -0
  18. data/lib/flak/thor/templates/INSTALL.tt +15 -13
  19. data/lib/flak/thor/templates/doc.tt +0 -0
  20. data/lib/flak/thor/templates/doc/Rules +77 -0
  21. data/lib/flak/thor/templates/doc/config.yaml +77 -0
  22. data/lib/flak/thor/templates/doc/content/assets/css/include.scss +14 -0
  23. data/lib/flak/thor/templates/doc/content/assets/css/page.scss +314 -0
  24. data/lib/flak/thor/templates/doc/content/assets/images/.empty_directory +1 -0
  25. data/lib/flak/thor/templates/doc/content/assets/images/screenshot.jpg +0 -0
  26. data/lib/flak/thor/templates/doc/content/assets/movies/.empty_directory +1 -0
  27. data/lib/flak/thor/templates/doc/content/assets/movies/sampleMovie.webm +0 -0
  28. data/lib/flak/thor/templates/doc/content/assets/site_images/array.gif +0 -0
  29. data/lib/flak/thor/templates/doc/content/assets/site_images/connectable.gif +0 -0
  30. data/lib/flak/thor/templates/doc/content/assets/site_images/create.gif +0 -0
  31. data/lib/flak/thor/templates/doc/content/assets/site_images/edit.gif +0 -0
  32. data/lib/flak/thor/templates/doc/content/assets/site_images/hidden.gif +0 -0
  33. data/lib/flak/thor/templates/doc/content/assets/site_images/input.gif +0 -0
  34. data/lib/flak/thor/templates/doc/content/assets/site_images/keyable.gif +0 -0
  35. data/lib/flak/thor/templates/doc/content/assets/site_images/logo.jpg +0 -0
  36. data/lib/flak/thor/templates/doc/content/assets/site_images/maya.png +0 -0
  37. data/lib/flak/thor/templates/doc/content/assets/site_images/miro_logo_bw.png +0 -0
  38. data/lib/flak/thor/templates/doc/content/assets/site_images/multiuse.gif +0 -0
  39. data/lib/flak/thor/templates/doc/content/assets/site_images/nanoc.png +0 -0
  40. data/lib/flak/thor/templates/doc/content/assets/site_images/nuke.png +0 -0
  41. data/lib/flak/thor/templates/doc/content/assets/site_images/output.gif +0 -0
  42. data/lib/flak/thor/templates/doc/content/assets/site_images/prman.png +0 -0
  43. data/lib/flak/thor/templates/doc/content/assets/site_images/python.png +0 -0
  44. data/lib/flak/thor/templates/doc/content/assets/site_images/query.gif +0 -0
  45. data/lib/flak/thor/templates/doc/content/assets/site_images/storable.gif +0 -0
  46. data/lib/flak/thor/templates/doc/content/assets/site_images/vfxoverflow_ribbon.png +0 -0
  47. data/lib/flak/thor/templates/doc/content/assets/site_images/vray.png +0 -0
  48. data/lib/flak/thor/templates/doc/content/index.txt.tt +31 -0
  49. data/lib/flak/thor/templates/doc/content/install_guide.txt.tt +64 -0
  50. data/lib/flak/thor/templates/doc/content/release_notes.txt.tt +44 -0
  51. data/lib/flak/thor/templates/doc/content/scenes/.empty_directory +1 -0
  52. data/lib/flak/thor/templates/doc/content/tutorial.txt.tt +81 -0
  53. data/lib/flak/thor/templates/doc/layouts/default.html +52 -0
  54. data/lib/flak/thor/templates/doc/lib/helpers.rb +147 -0
  55. data/lib/flak/thor/templates/env.tt +29 -1
  56. data/lib/flak/thor/templates/gitignore.tt +3 -0
  57. data/lib/flak/thor/templates/init.mel.tt +22 -0
  58. data/lib/flak/thor/templates/product.mel.tt +15 -10
  59. data/lib/flak/thor/wizard.rb +47 -0
  60. data/lib/flak/version.rb +1 -1
  61. metadata +120 -63
  62. data/lib/flak/doc.rb +0 -259
@@ -9,8 +9,10 @@ module Flak
9
9
 
10
10
 
11
11
  def self.resolve_settings( existing_settings )
12
+
12
13
  f = existing_settings[:root] + '/config/cpp.yml'
13
- h =Flak.flatten_settings(f,existing_settings[:configuration], existing_settings[:os] )
14
+ h =Flak::Base.flatten_settings(f,existing_settings[:configuration], existing_settings[:os] )
15
+
14
16
  #override the build dir
15
17
  h[:build_dir] = File.join("build", existing_settings[:product_revision] , existing_settings[:os], existing_settings[:configuration])
16
18
 
@@ -74,7 +76,7 @@ module Flak
74
76
  files.each do |f|
75
77
  object = object_file(f)
76
78
  file object => f do |t|
77
- Flak.make_dir_for(object)
79
+ Flak::Base.make_dir_for(object)
78
80
 
79
81
  sh c_compile_cmd(f)
80
82
  end
@@ -87,7 +89,7 @@ module Flak
87
89
  ######################################################
88
90
  objects = object_files
89
91
  file self.filename => objects do
90
- Flak.make_dir_for(self.filename)
92
+ Flak::Base.make_dir_for(self.filename)
91
93
  sh c_link_cmd
92
94
  end
93
95
 
@@ -113,7 +115,7 @@ module Flak
113
115
  ######################################################
114
116
  released_binary = self.target_release_path
115
117
  file released_binary => self.filename do
116
- Flak.make_dir_for(released_binary)
118
+ Flak::Base.make_dir_for(released_binary)
117
119
  rm_r released_binary if File.exists?(released_binary)
118
120
  cp self.filename, released_binary
119
121
  File.chmod 0755, released_binary
@@ -10,7 +10,7 @@ module Flak
10
10
  def self.resolve_settings( existing_settings )
11
11
 
12
12
  f = existing_settings[:root] + '/config/delight.yml'
13
- h =Flak.flatten_settings(f,existing_settings[:configuration], existing_settings[:os] )
13
+ h =Flak::Base.flatten_settings(f,existing_settings[:configuration], existing_settings[:os] )
14
14
 
15
15
  versioned_location = File.join("#{h[:delight_location]}-#{h[:delight_version]}")
16
16
 
@@ -65,7 +65,7 @@ module Flak
65
65
  ######################################################
66
66
  target_shader = shader_file(f)
67
67
  file target_shader => f do |t|
68
- dest = Flak.make_dir_for(target_shader)
68
+ dest = Flak::Base.make_dir_for(target_shader)
69
69
  sh delight_shader_compile_cmd(dest,f)
70
70
  end
71
71
 
@@ -82,7 +82,7 @@ module Flak
82
82
  ######################################################
83
83
  released_shader = shader_release_path(target_shader)
84
84
  file released_shader => target_shader do
85
- Flak.make_dir_for(released_shader)
85
+ Flak::Base.make_dir_for(released_shader)
86
86
  cp target_shader, released_shader
87
87
  end
88
88
 
@@ -0,0 +1,64 @@
1
+
2
+
3
+ module Flak
4
+
5
+ module Doc
6
+
7
+ def self.resolve_settings( existing_settings )
8
+
9
+ f = existing_settings[:root] + '/config/doc.yml'
10
+ h =Flak::Base.flatten_settings(f,existing_settings[:configuration], existing_settings[:os] )
11
+
12
+ h
13
+ end
14
+
15
+
16
+ def default_hash(item)
17
+ {
18
+ :title => "#{@settings[:product_name].capitalize} #{item[:type]}",
19
+ :description=> "#{@settings[:product_revision]} #{item[:type]}",
20
+ :author=> @settings[:author_name],
21
+ :email=> @settings[:author_email],
22
+ :created_at => Time.now.strftime("%d %B %Y")
23
+ }
24
+ end
25
+
26
+
27
+ def plug_metadata(site)
28
+
29
+ site.items.each do |item|
30
+ unless item.binary?
31
+ item[:type] = "Index" if item.identifier == "/"
32
+ item[:type] = "Release Notes" if item.identifier == "/release_notes/"
33
+ item.attributes= default_hash(item).merge(item.attributes)
34
+ end
35
+ end
36
+ end
37
+
38
+
39
+ def doc_instance_tasks
40
+
41
+
42
+ # namespace :doc do
43
+
44
+ desc "Release documentation"
45
+ task :doc do
46
+ docroot = File.join(@settings[:root],'doc')
47
+ Dir.chdir(docroot) do |d|
48
+ site = Nanoc::Site.new(YAML.load_file('config.yaml'))
49
+ site.config[:output_dir] = @settings[:doc_release_root]
50
+ plug_metadata(site)
51
+ puts "Compiling site..."
52
+ site.compile
53
+ puts "Done... ;)"
54
+ end
55
+
56
+ end
57
+
58
+
59
+ end
60
+ # end
61
+
62
+ end
63
+ end
64
+
@@ -4,7 +4,7 @@ module Flak
4
4
  module Gl
5
5
  def self.resolve_settings( existing_settings )
6
6
  f = existing_settings[:root] + '/config/gl.yml'
7
- Flak.flatten_settings(f,existing_settings[:configuration], existing_settings[:os] )
7
+ Flak::Base.flatten_settings(f,existing_settings[:configuration], existing_settings[:os] )
8
8
  end
9
9
  end
10
10
  end
@@ -9,7 +9,7 @@ module Flak
9
9
  def self.resolve_settings( existing_settings )
10
10
 
11
11
  f = existing_settings[:root] + '/config/mac.yml'
12
- h =Flak.flatten_settings(f,existing_settings[:configuration], existing_settings[:os] )
12
+ h =Flak::Base.flatten_settings(f,existing_settings[:configuration], existing_settings[:os] )
13
13
 
14
14
  h
15
15
  end
@@ -8,7 +8,7 @@ module Flak
8
8
  def self.resolve_settings( existing_settings )
9
9
 
10
10
  f = existing_settings[:root] + '/config/max.yml'
11
- h =Flak.flatten_settings(f,existing_settings[:configuration], existing_settings[:os] )
11
+ h =Flak::Base.flatten_settings(f,existing_settings[:configuration], existing_settings[:os] )
12
12
 
13
13
  case existing_settings[:os]
14
14
  when /linux_64/
@@ -9,7 +9,7 @@ module Flak
9
9
  def self.resolve_settings( existing_settings )
10
10
 
11
11
  f = existing_settings[:root] + '/config/maya.yml'
12
- h =Flak.flatten_settings(f,existing_settings[:configuration], existing_settings[:os] )
12
+ h =Flak::Base.flatten_settings(f,existing_settings[:configuration], existing_settings[:os] )
13
13
 
14
14
  maya_string =''
15
15
  case existing_settings[:os]
@@ -67,25 +67,25 @@ module Flak
67
67
 
68
68
 
69
69
  file icon => f do |t|
70
- Flak.make_dir_for(icon)
70
+ Flak::Base.make_dir_for(icon)
71
71
  cmd = "#{@settings[:dg_convert_cmd]} #{f} #{icon}"
72
72
  sh cmd
73
73
  end
74
74
 
75
75
  # dry this up
76
76
  file out_icon => f do |t|
77
- Flak.make_dir_for(out_icon)
77
+ Flak::Base.make_dir_for(out_icon)
78
78
  cmd = "#{@settings[:outliner_convert_cmd]} #{f} #{out_icon}"
79
79
  sh cmd
80
80
  end
81
81
 
82
82
  file icon_release => icon do |t|
83
- Flak.make_dir_for(icon_release)
83
+ Flak::Base.make_dir_for(icon_release)
84
84
  cp icon, icon_release
85
85
  end
86
86
 
87
87
  file out_icon_release => out_icon do |t|
88
- Flak.make_dir_for(out_icon_release)
88
+ Flak::Base.make_dir_for(out_icon_release)
89
89
  cp out_icon, out_icon_release
90
90
  end
91
91
 
@@ -111,14 +111,14 @@ module Flak
111
111
 
112
112
 
113
113
  file icon => f do |t|
114
- Flak.make_dir_for(icon)
114
+ Flak::Base.make_dir_for(icon)
115
115
  cmd = "#{@settings[:maya_convert_cmd]} #{f} #{icon}"
116
116
  sh cmd
117
117
  end
118
118
 
119
119
 
120
120
  file icon_release => icon do |t|
121
- Flak.make_dir_for(icon_release)
121
+ Flak::Base.make_dir_for(icon_release)
122
122
  cp icon, icon_release
123
123
  end
124
124
 
@@ -7,7 +7,7 @@ module Flak
7
7
  def self.resolve_settings( existing_settings )
8
8
 
9
9
  f = existing_settings[:root] + '/config/maya_app.yml'
10
- h =Flak.flatten_settings(f,existing_settings[:configuration], existing_settings[:os] )
10
+ h =Flak::Base.flatten_settings(f,existing_settings[:configuration], existing_settings[:os] )
11
11
 
12
12
  lib_path = File.join(existing_settings[:maya_location], h[:maya_relative_lib_path])
13
13
 
@@ -10,7 +10,7 @@ module Flak
10
10
 
11
11
 
12
12
  f = existing_settings[:root] + '/config/maya_plugin.yml'
13
- h =Flak.flatten_settings(f,existing_settings[:configuration], existing_settings[:os] )
13
+ h =Flak::Base.flatten_settings(f,existing_settings[:configuration], existing_settings[:os] )
14
14
 
15
15
 
16
16
  lib_path = File.join(existing_settings[:maya_location], h[:maya_relative_lib_path])
@@ -8,7 +8,7 @@ module Flak
8
8
  def self.resolve_settings( existing_settings )
9
9
 
10
10
  f = existing_settings[:root] + '/config/nuke.yml'
11
- h =Flak.flatten_settings(f,existing_settings[:configuration], existing_settings[:os] )
11
+ h =Flak::Base.flatten_settings(f,existing_settings[:configuration], existing_settings[:os] )
12
12
 
13
13
  case existing_settings[:os]
14
14
  when /linux_64/
@@ -1,7 +1,3 @@
1
-
2
-
3
-
4
-
5
1
  # This is where we prepare a target.
6
2
  # The target will "inherit" settings and instance methods from modules specified in the target.yml file
7
3
  module Flak
@@ -10,35 +6,29 @@ module Flak
10
6
 
11
7
  attr_accessor :settings
12
8
 
13
-
14
-
15
-
16
9
  def initialize(root, target_file=nil)
17
10
 
18
11
  @settings = Hash.new
19
12
  # start building the settings hash
20
13
  # need the config settings to bootstrap the process
21
- self.extend( Flak )
14
+ self.extend( Flak::Base )
22
15
  @settings[:root] = root
23
- #puts "TTTTTTTTTTTTT #{@settings[:root]}"
16
+
24
17
  tmp = YAML::load_file( @settings[:root] + '/config/env.yml' )
25
18
  @settings[:configuration] = tmp['configuration']
26
- @settings[:os] = Flak.os
19
+ @settings[:os] = Flak::Base.os
27
20
 
28
21
  # settings goes in as config and os, and comes back fully resolved
29
22
 
30
23
  h = Hash.new
31
24
 
32
- # puts "RRRRRRRRRRRRR #{@settings[:root]}"
33
- @settings = Flak.resolve_settings(@settings)
25
+ @settings = Flak::Base.resolve_settings(@settings)
34
26
 
35
27
 
36
28
  if File.exists?(target_file)
37
29
  @settings[:target_file] = target_file
38
30
  @settings[:target_dir] = File.dirname(target_file)
39
31
 
40
- # puts "TTTTTTTTTTTTT #{@settings[:target_dir]}"
41
- # puts "RRRRRRRRRRRRR #{@settings[:root]}"
42
32
  @settings[:target_root] = File.join(@settings[:root], @settings[:target_dir] )
43
33
 
44
34
  # to find out what templates to use, we need to look in the target.yml
@@ -51,7 +41,7 @@ module Flak
51
41
  end
52
42
 
53
43
  # now merge the settings from this target
54
- @settings = Flak.merge_settings(@settings, Target.resolve_settings(@settings))
44
+ @settings = Flak::Base.merge_settings(@settings, Target.resolve_settings(@settings))
55
45
 
56
46
  expand_filelists
57
47
  instance_tasks
@@ -59,7 +49,7 @@ module Flak
59
49
 
60
50
 
61
51
  def self.resolve_settings(existing_settings)
62
- Flak.flatten_settings(existing_settings[:target_file], existing_settings[:configuration],existing_settings[:os] )
52
+ Flak::Base.flatten_settings(existing_settings[:target_file], existing_settings[:configuration],existing_settings[:os] )
63
53
  end
64
54
 
65
55
 
@@ -68,7 +58,7 @@ module Flak
68
58
  # The templates are modules and by "integrating templates", we are:
69
59
  # 1. extending (picking up the module's instance methods)
70
60
  # 2. then we build our own @settings instance data by merging in the settings from the modules
71
- # See the merge settings method below for details of the merging strategy
61
+ # See the merge settings method in base for details of the merging strategy
72
62
  def integrate_templates(template_array)
73
63
  template_array.each do |template_name|
74
64
  mod = Flak.const_get(template_name.split('_').collect {|w| w.capitalize}.join())
@@ -76,7 +66,7 @@ module Flak
76
66
  raise TypeError, "#{mod.inspect} must be a Module"
77
67
  end
78
68
  self.extend( mod )
79
- @settings = Flak.merge_settings(@settings, mod.resolve_settings(@settings))
69
+ @settings = Flak::Base.merge_settings(@settings, mod.resolve_settings(@settings))
80
70
  end
81
71
  end
82
72
 
@@ -115,6 +105,6 @@ module Flak
115
105
  end
116
106
  end
117
107
  end
118
-
108
+
119
109
  end
120
110
  end
@@ -2,15 +2,22 @@ module Flak
2
2
 
3
3
  class Generate < Thor
4
4
 
5
- TEMPLATES = ["env", "cpp", "delight","gl","mac","maya","maya_app","maya_plugin", "nuke"]
5
+ include Thor::Actions
6
+
7
+ attr_accessor :name, :tool_options, :project_options
8
+
9
+
10
+
11
+ ##########################################################################
12
+ ############################ P R O J E C T ###############################
13
+ ##########################################################################
14
+
15
+ TEMPLATES = ["env", "cpp", "delight","gl","mac","maya","maya_app","maya_plugin", "nuke", "doc"]
6
16
 
7
17
  MAYA_PLUGIN_TEMPLATES = ["cpp", "gl","maya","maya_plugin"]
8
18
 
9
19
  MAYA_APP_TEMPLATES = ["cpp", "gl","maya","maya_app"]
10
20
 
11
- include Thor::Actions
12
-
13
- attr_accessor :name, :tool_options, :project_options
14
21
 
15
22
  def self.source_root
16
23
  File.join(File.dirname(__FILE__), "templates")
@@ -18,268 +25,185 @@ module Flak
18
25
 
19
26
  no_tasks do
20
27
 
21
- def project_wizard
22
- opts = Hash.new
23
- say("In order to set up paths, I need to know what will be included in this project")
24
- opts[:maya_module] = yes?("Will this project contain a Maya module? (y/n)")
25
- opts[:delight] = yes?("Will this project contain 3delight tools? (y/n)")
26
- opts[:nuke] = yes?("Will this project contain nuke tools? (y/n)")
27
- opts
28
- end
29
-
30
28
  def project_options
31
- @project_options ||= project_wizard
29
+ @project_options ||= Flak::Wizard.project_options
32
30
  end
33
31
 
34
- def project_target_file_hash
35
- h = Hash.new
36
-
37
- h['name'] = "FlakProject#{name.camelize}"
38
-
39
- if project_options[:maya_module]
40
- # To copy the module mel file that will kick off the whole shebang
41
- h['maya_script_copy_files'] = ["config/script/maya/*.mel","config/script/maya/*.py","config/script/maya/*.pyc"]
42
- h['maya_script_erb_files'] = ["config/script/maya/erb/*.mel.erb","config/script/maya/erb/*.py.erb"]
43
- h['templates'] = ["maya"]
44
- end
45
-
46
- h['shell_script_copy_files'] = ["config/script/shell/*.sh"]
47
- h['shell_script_erb_files'] = ["config/script/shell/erb/*.erb"]
48
- h
32
+ def tool_options
33
+ @tool_options ||= Flak::Wizard.tool_options
49
34
  end
50
35
 
51
36
  end
52
37
 
53
-
54
38
  desc "project [name]", "Create a project"
55
39
  map "p" => :project
56
40
  def project(name)
57
41
  empty_directory(name)
58
42
  inside name do
59
- invoke :config
60
- end
43
+ # g = GenerateProject.new(name)
44
+ # g.configure
45
+ invoke :config
46
+ end
61
47
  end
62
48
 
63
-
64
49
  desc "config [name]", "Makes all config and project based files"
65
50
  def config(name)
66
51
  opts = self.project_options
67
52
  self.name= name
68
53
  empty_directory("build")
69
-
70
- copy_file("product.mel.tt", "config/script/maya/erb/#{name}.mel.erb")
71
- copy_file("INSTALL.tt", "config/script/shell/erb/INSTALL.erb")
72
- template("product.sh.tt", "config/script/shell/#{name}.sh")
54
+ directory("doc")
55
+
56
+ template( "product.mel.tt" , "config/script/maya/erb/#{name}.mel.erb" )
57
+ template( "INSTALL.tt" , "config/script/shell/erb/INSTALL_#{name.upcase}.erb")
58
+ template( "product.sh.tt" , "config/script/shell/#{name}.sh" )
73
59
 
74
60
  create_file "target.yml" do
75
- YAML::dump( project_target_file_hash )
61
+ Flak::TargetFile.project(name,opts)
76
62
  end
77
-
63
+
78
64
  # templates
79
65
  TEMPLATES.each do |t|
80
66
  template("#{t}.tt", "config/#{t}.yml")
81
67
  end
82
-
68
+
83
69
  # rakefile
84
- template "Rakefile.tt", "Rakefile.rb"
70
+ copy_file "Rakefile.tt", "Rakefile.rb"
71
+ copy_file "gitignore.tt", ".gitignore"
85
72
  end
86
73
 
87
-
88
- no_tasks do
89
-
90
-
91
- def tool_target_file_hash
92
- h = Hash.new
93
- maya_c_compile = true if tool_options[:maya_plugin] || tool_options[:maya_app]
94
- c_compile = true if (maya_c_compile || tool_options[:bin] )
95
-
96
- h['name'] = name.camelize
97
-
98
- if tool_options[:maya]
99
- h['maya_script_copy_files'] = ["maya/script/**/*.mel","maya/script/**/*.py","maya/script/**/*.pyc"]
100
- h['maya_scripted_plugin_copy_files'] = ["maya/script/plugin/**/*.py","maya/script/plugin/**/*.pyc"]
101
-
102
- h['maya_node_icon_files'] = ["maya/icons/node/*"]
103
- h['maya_icon_files'] = ["maya/icons/*.jpg"]
104
- h['maya_icon_copy_files'] = ["maya/icons/*.png","maya/icons/*.xbm","maya/icons/*.xpm"]
105
- end
106
-
107
- h['nuke_script_copy_files'] = ["nuke/python/*.py", "nuke/gizmo/*.gizmo", "nuke/scenes/*.nk"] if tool_options[:nuke]
108
-
109
- h['include_paths'] = ["../../shared/src"] if c_compile
110
- h['include_paths'] << "../../shared/src/maya" if maya_c_compile
111
- h['libs'] = ["OpenMayaAnim","OpenMayaUI","OpenMayaRender","OpenMayaFX"] if maya_c_compile
112
-
113
- h['templates'] = []
114
- h['templates'] << "cpp" if c_compile
115
- h['templates'] << "maya" if tool_options[:maya]
116
- h['templates'] << "maya_plugin" if tool_options[:maya_plugin]
117
- h['templates'] << "maya_app" if tool_options[:maya_app]
118
- h['templates'] << "gl" if maya_c_compile
119
- h['templates'] << "delight" if tool_options[:delight]
120
-
121
- h['source_files'] = []
122
- h['source_files'] << "maya/src/*.cpp" if maya_c_compile
123
- h['source_files'] << "shell/src/*.cpp" if tool_options[:bin]
124
-
125
- h['shell_script_copy_files'] = ["shell/script/*"] if tool_options[:shell]
126
- h
127
- end
128
-
129
- def tool_wizard
130
- opts = Hash.new
131
- opts[:all] = yes?("Would you like to create a full project and pare it down later?: ")
132
-
133
- if opts[:all]
134
- opts[:maya] = true
135
- opts[:maya_plugin] = true
136
- opts[:maya_app] = false
137
- opts[:delight] = true
138
- opts[:shell] = true
139
- opts[:bin] = false
140
- opts[:applescript] = true
141
- else
142
-
143
- opts[:maya] = yes?("Will this tool contain files for Autodesk's Maya? (y/n)")
144
- if opts[:maya] # always make scripts for maya projects
145
- opts[:maya_plugin] = yes?("Is this tool a Maya plugin? (y/n)")
146
- if (! opts[:maya_plugin] )
147
- opts[:maya_app] = yes?("Is this tool a Maya standalone application? (y/n)")
148
- end
149
- end
150
-
151
- opts[:delight] = yes?("Will this tool contain 3delight shaders filters or DSOs? (y/n)")
152
-
153
- opts[:nuke] = yes?("Will this tool contain Nuke scripts or plugins? (y/n)")
154
-
155
- opts[:shell] = yes?("Will this tool contain shell scripts? (y/n)")
156
-
157
- #can only have one target
158
- if (! (opts[:maya_plugin] || opts[:maya_app] ))
159
- opts[:bin] = yes?("Will this tool contain a standalone compiled shell command? (y/n)")
160
- end
161
-
162
- opts[:applescript] = yes?("Will this tool contain Applescript files? (y/n)")
163
- end
164
- opts
165
- end
166
-
167
- def tool_options
168
- @tool_options ||= tool_wizard
169
- end
170
-
171
-
172
- end
173
-
74
+
75
+
76
+
77
+ ##########################################################################
78
+ ############################### T O O L ##################################
79
+ ##########################################################################
174
80
 
175
81
 
176
82
  desc "tool [name]", "Make a tool"
177
83
  #method_options %w( maya_script -s) => :boolean, %w( maya_app -a) => :boolean, %w( maya_plugin -p) => :boolean
178
84
  map "t" => :tool
179
85
  def tool(name)
180
- # puts "DDD RRR #{destination_root}"
181
86
 
182
87
  opts = self.tool_options
183
88
  self.name= name
184
89
 
90
+
185
91
  create_file "#{name}/target.yml" do
186
- YAML::dump( tool_target_file_hash )
92
+ Flak::TargetFile.tool(name,opts)
187
93
  end
188
94
 
189
95
  inside name, :verbose => true do
190
-
191
96
  invoke :create_common_files
192
- invoke :create_maya_tree if opts[:maya]
193
- invoke :create_maya_plugin_tree if opts[:maya_plugin]
194
- invoke :create_maya_app_tree if opts[:maya_app]
195
- invoke :create_nuke_tree if opts[:nuke]
196
- invoke :create_applescript_tree if opts[:applescript]
197
- invoke :create_delight_tree if opts[:delight]
198
- invoke :create_shell_tree if opts[:shell]
199
- invoke :create_shell_cmd_tree if opts[:bin]
97
+ invoke :create_maya_script_tree
98
+ invoke :create_nuke_script_tree
99
+ invoke :create_shell_script_tree
100
+ invoke :create_maya_plugin_files if opts[:maya_plugin_target]
101
+ invoke :create_maya_app_files if opts[:maya_app_target]
102
+ invoke :create_nuke_plugin_files if opts[:nuke_target]
103
+ invoke :create_delight_tools_trsee if opts[:delight_target]
200
104
  end
201
105
  #end
202
106
  end
203
107
 
204
-
205
108
  #####################################
206
- desc "create_common_files [name]", "Makes files that will be in every tool"
207
- def create_common_files(name)
208
- empty_directory('examples')
209
- empty_directory('doc')
210
- create_file "README.md"
211
- create_file "LICENSE.md"
212
- create_file "INSTALL.md"
109
+ desc "create_maya_plugin_files [name]", "Makes files needed for Maya plugin development"
110
+ def create_maya_plugin_files(name)
111
+ invoke :create_maya_app_files
112
+ create_file "src/plugin.cpp"
213
113
  end
214
114
  #####################################
215
115
 
216
-
217
116
  #####################################
218
- desc "maya_script_tool [name]", "Makes tool files needed for Maya script development"
219
- def create_maya_tree(name)
220
- self.name= name
221
- # create_file "maya/script/#{name}.py"
222
- empty_directory("maya/script")
223
- empty_directory("maya/icons/node")
224
- end
225
-
226
- desc "maya_plugin_tool [name]", "Makes tool files needed for Maya plugin development"
227
- def create_maya_plugin_tree(name)
228
- invoke :create_maya_app_tree
229
- create_file "maya/src/plugin.cpp"
230
- empty_directory("maya/script/plugin")
231
- end
232
-
233
117
  desc "maya_app_tool [name]", "Makes tool files needed for Maya app development"
234
- def create_maya_app_tree(name)
235
- invoke :create_maya_tree
236
- create_file "maya/src/#{name}.cpp"
237
- create_file "maya/src/#{name}.h"
118
+ def create_maya_app_files(name)
119
+ # invoke :create_maya_tree
120
+ create_file "src/#{name}.cpp"
121
+ create_file "src/#{name}.h"
238
122
  end
239
123
  #####################################
240
124
 
241
125
  #####################################
242
- desc "create_nuke_tree [name]", "Makes tool files needed for Maya script development"
243
- def create_nuke_tree(name)
244
- empty_directory('nuke/gizmo')
245
- empty_directory('nuke/python')
246
- empty_directory('nuke/scenes')
126
+ desc "create_nuke_tree [name]", "Makes tool files needed for nuke development"
127
+ def create_nuke_plugin_files(name)
128
+ create_file "src/#{name}.cpp"
129
+ create_file "src/#{name}.h"
247
130
  end
248
131
  #####################################
249
132
 
250
133
  #####################################
251
- desc "create_delight_tree [name]", "Makes tool files needed for Maya script development"
252
- def create_delight_tree(name)
134
+ desc "create_delight_tree [name]", "Makes tool files needed for delight development"
135
+ def create_delight_tools_tree(name)
253
136
  empty_directory('delight/shader/include')
254
137
  empty_directory('delight/shader/light')
255
138
  empty_directory('delight/shader/surface')
139
+ empty_directory('delight/shader/displacement')
140
+ empty_directory('delight/shader/atmosphere')
141
+ empty_directory('delight/shader/interior')
256
142
  empty_directory('delight/dso')
257
143
  empty_directory('delight/filter')
258
144
  end
259
145
  #####################################
260
146
 
261
147
  #####################################
262
- desc "create_applescript_tree [name]", "Makes tool files needed for Maya script development"
263
- def create_applescript_tree(name)
264
- empty_directory('applescript')
148
+ desc "create_common_files [name]", "Makes files that will be in every tool"
149
+ def create_common_files(name)
150
+ empty_directory('examples')
151
+ create_file "README.md"
152
+ create_file "LICENSE.md"
153
+ create_file "INSTALL.md"
265
154
  end
266
155
  #####################################
267
156
 
268
157
  #####################################
269
- desc "create_shell_tree [name]", "Makes tool files needed for Maya script development"
270
- def create_shell_tree(name)
271
- empty_directory('shell/script')
158
+ desc "create_maya_script_tree [name]", "Makes tool files needed for Maya script development"
159
+ def create_maya_script_tree(name)
160
+ self.name= name
161
+ empty_directory("maya/script/plugin")
162
+ empty_directory("maya/icons/node")
163
+ template("init.mel.tt", "maya/script/#{name}.init.mel")
272
164
  end
273
165
  #####################################
274
166
 
275
167
  #####################################
276
- desc "create_shell_cmd_tree [name]", "Makes tool files needed for Maya script development"
277
- def create_shell_cmd_tree(name)
278
- invoke :create_shell_tree
279
- empty_directory('shell/src')
168
+ desc "create_nuke_script_tree [name]", "Makes tool files needed for nuke development"
169
+ def create_nuke_script_tree(name)
170
+ empty_directory('nuke/gizmo')
171
+ empty_directory('nuke/python')
172
+ empty_directory('nuke/scenes')
280
173
  end
281
174
  #####################################
282
175
 
176
+ #####################################
177
+ desc "create_shell_script_tree [name]", "Makes tool files needed for shell script development"
178
+ def create_shell_script_tree(name)
179
+ empty_directory('shell/script')
180
+ end
181
+ #####################################
182
+
183
+ ##########################################################################
184
+ ############################### D O C ####################################
185
+ ##########################################################################
186
+
187
+ desc "tutorial [name]", "Create a tutorial"
188
+ map "u" => :tutorial
189
+ def tutorial(name)
190
+ template("tutorial.txt.tt", "doc/content/#{name}.txt")
191
+ end
192
+
193
+ desc "install_guide [name]", "Create an install guide"
194
+ map "i" => :tutorial
195
+ def tutorial(name)
196
+ template("install_guide.txt.tt", "doc/content/#{name}.txt")
197
+ end
198
+
199
+
200
+
201
+
202
+
203
+ ##########################################################################
204
+ ############################### B A N N E R ##############################
205
+ ##########################################################################
206
+
283
207
  def self.banner(task, namespace = false, subcommand = true)
284
208
  task.formatted_usage(self, true, subcommand).split(':').join(' ')
285
209
  end