Module: Flak::TargetFile

Defined in:
lib/flak/thor/target_file.rb

Class Method Summary collapse

Class Method Details

.project(name, options = {}) ⇒ Object

Generate a project.yml target file according to options given by the user, usually through a wizard.

Parameters:

  • name (String)

    name of the project.

  • options (Hash) (defaults to: {})

    the options.

Options Hash (options):

  • :maya_module (true, false)

    Whether this project will build a Maya module.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/flak/thor/target_file.rb', line 68

def self.project(name,options={})
  h = Hash.new
  h['name'] = "#{name.camelize}Project"
  h['templates'] = ["release", "doc"]
  


  h['os_darwin64'] = {}
  h['os_linux64'] = {}
  h['os_win64'] = {}

  h['os_darwin64']['release_script_copy_files'] =  ["resource/config/*.sh"] 
  h['os_linux64']['release_script_copy_files'] =  ["resource/config/*.sh"] 
  h['os_win64']['release_script_copy_files'] =  ["resource/config/*.BAT"] 


  if options[:maya_module]
    h['maya_script_copy_files'] = ["script/maya/*.mel","script/maya/*.py","script/maya/*.pyc"]
    h['maya_script_erb_files'] = ["script/maya/erb/*.mel.erb","script/maya/erb/*.py.erb"]
    h['templates'] << "maya"
    h['os_darwin64']['maya_modules_erb_files'] =  ["resource/config/*.sh"] 
    h['os_linux64']['maya_modules_erb_files'] = ["resource/config/*.sh"] 
  end
  
  h['default_copy_files'] = ["LICENSE.*", "README.*"] 
  h['package_erb_files'] = ["resource/raia/*"] 


  YAML::dump(h)
end

.raia_package(name, options = {}) ⇒ Object



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/flak/thor/target_file.rb', line 99

def self.raia_package(name,options={})
  h = Hash.new
  h['name'] = name
  h['description'] = "Description goes here"
  h['version'] = "<%= settings[:product_revision] %>"
  h['documentation'] = {"html" => "<%= settings[:revision_directory] %>/doc/index.html"}
  h['platform'] =  {"id" => "<%= settings[:platform_id] %>"}
  h['software_location'] =  "<%= settings[:revision_directory] %>"


  h['requirements'] = []
  if options[:maya_module]
    h['requirements'] << {"name" => "maya", "version" => '==2012'}
    h['requirements'] << {"name" => "jlib", "version" => '>=0.0.7'}
  end

  h['runtimes'] = []

  h['env'] ={}

  h['env']["#{name.upcase}_PROJECT_PATH"] = "$software_location"

  h['env']["MAYA_MODULE_PATH"] = "$env.MAYA_MODULE_PATH:$software_location/modules"  if options[:maya_module]

  h['env']["NUKE_PATH"] = "$env.NUKE_PATH:$software_location/nuke/scripts" if options[:nuke]

  if options[:delight]
    h['env']["DL_SHADERS_PATH"] = "$env.DL_SHADERS_PATH:$software_location/delight/shader" 
    h['env']["DL_PROCEDURALS_PATH"] = "$env.DL_PROCEDURALS_PATH:$software_location/delight/procedural" 
  end
  
  JSON.pretty_generate(h)

end

.tool(name, options = {}) ⇒ Object

Generate a tool.yml target file according to options given by the user, usually through a wizard.

Parameters:

  • name (String)

    name of the tool.

  • options (Hash) (defaults to: {})

    the options.

Options Hash (options):

  • :maya_plugin_target (true, false)

    Whether this tool will be the target for a Maya plugin.

  • :maya_app_target (true, false)

    Whether this tool will be the target for a Maya standalone application.

  • :delight_target (true, false)

    Whether this tool will be the target for a 3delight DSO, or filter.

  • :standalone_target (true, false)

    Whether this tool will be the target for a standalone application.

  • :maya_scripts (true, false)

    Whether this tool will contain Maya MEL or Python scripts.

  • :nuke_scripts (true, false)

    Whether this tool will contain Nuke scripts or gizmos.

  • :shell_scripts (true, false)

    Whether this tool will contain shell scripts.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/flak/thor/target_file.rb', line 28

def self.tool(name,options={})
  h = Hash.new
  maya_c_compile = true if options[:maya_plugin_target] || options[:maya_app_target] 
  c_compile = true if (maya_c_compile || options[:standalone_target] ) 
  
  
  h['name'] =  name.camelize
  
  h['maya_script_copy_files'] = ["maya/script/**/*.mel","maya/script/**/*.py","maya/script/**/*.pyc"] if options[:maya_scripts]
  h['maya_scripted_plugin_copy_files'] = ["maya/script/plugin/**/*.py","maya/script/plugin/**/*.pyc"] if options[:maya_scripts]
  h['maya_node_icon_files'] = ["maya/icons/node/*"] if options[:maya_scripts]
  h['maya_icon_files'] = ["maya/icons/*.jpg"] if options[:maya_scripts]
  h['maya_icon_copy_files'] = ["maya/icons/*.png","maya/icons/*.xbm","maya/icons/*.xpm"]  if options[:maya_scripts]
  
  h['nuke_script_copy_files'] =  ["nuke/python/*.py", "nuke/gizmo/*.gizmo", "nuke/scenes/*.nk"] if options[:nuke_scripts]


  h['include_paths'] = ["../../shared/src"] if c_compile 
  h['include_paths'] << "../../shared/src/maya" if maya_c_compile
  h['libs'] = ["OpenMayaAnim","OpenMayaUI","OpenMayaRender","OpenMayaFX"]  if maya_c_compile
  h['templates'] = []
  h['templates'] << "cpp" if c_compile
  h['templates'] << "maya" if options[:maya_scripts]
  h['templates'] << "maya_plugin" if options[:maya_plugin_target]
  h['templates'] << "maya_app" if  options[:maya_app_target] 
  h['templates'] << "gl" if maya_c_compile
  h['templates'] << "delight" if options[:delight_target]
  h['templates'] << "nuke" if options[:nuke_scripts]
  h['templates'] << "shell"  if options[:shell_scripts]
  
  h['source_files'] = []
  h['source_files'] << "src/*.cpp" if c_compile
  h['shell_script_copy_files'] = ["shell/script/*"]  if options[:shell_scripts]
  YAML::dump(h)
end