flak 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. data/.gitignore +1 -0
  2. data/.yardoc/checksums +28 -0
  3. data/.yardoc/objects/root.dat +0 -0
  4. data/.yardoc/proxy_types +0 -0
  5. data/.yardopts +1 -0
  6. data/Architecture.md +152 -0
  7. data/Documenting.md +2 -0
  8. data/MayaModules.md +2 -0
  9. data/README.md +173 -0
  10. data/flak.gemspec +6 -3
  11. data/lib/core_ext/hash.rb +82 -0
  12. data/lib/core_ext/string.rb +41 -0
  13. data/lib/flak.rb +20 -12
  14. data/lib/flak/rake/errors.rb +28 -0
  15. data/lib/flak/rake/file_actions.rb +70 -0
  16. data/lib/flak/rake/os.rb +18 -0
  17. data/lib/flak/rake/target.rb +47 -69
  18. data/lib/flak/rake/templates/cpp.rb +211 -0
  19. data/lib/flak/rake/templates/delight.rb +168 -0
  20. data/lib/flak/rake/templates/doc.rb +106 -0
  21. data/lib/flak/rake/templates/environment.rb +189 -0
  22. data/lib/flak/rake/templates/gl.rb +20 -0
  23. data/lib/flak/rake/templates/mac.rb +29 -0
  24. data/lib/flak/rake/templates/max.rb +22 -0
  25. data/lib/flak/rake/templates/maya.rb +172 -0
  26. data/lib/flak/rake/templates/maya_app.rb +97 -0
  27. data/lib/flak/rake/templates/maya_plugin.rb +93 -0
  28. data/lib/flak/rake/templates/merge_engine.rb +45 -0
  29. data/lib/flak/rake/templates/nuke.rb +60 -0
  30. data/lib/flak/rake/templates/release.rb +101 -0
  31. data/lib/flak/rake/templates/shell.rb +54 -0
  32. data/lib/flak/thor/cli.rb +5 -0
  33. data/lib/flak/thor/generate.rb +88 -144
  34. data/lib/flak/thor/target_file.rb +36 -17
  35. data/lib/flak/thor/templates/INSTALL.tt +3 -3
  36. data/lib/flak/thor/templates/Rakefile.tt +4 -2
  37. data/lib/flak/thor/templates/{cpp.tt → config/cpp.yml.tt} +6 -8
  38. data/lib/flak/thor/templates/{delight.tt → config/delight.yml.tt} +1 -1
  39. data/lib/flak/thor/templates/{doc.tt → config/doc.yml.tt} +0 -0
  40. data/lib/flak/thor/templates/{env.tt → config/environment.yml.tt} +6 -7
  41. data/lib/flak/thor/templates/{gl.tt → config/gl.yml.tt} +0 -0
  42. data/lib/flak/thor/templates/{mac.tt → config/mac.yml.tt} +0 -0
  43. data/lib/flak/thor/templates/{max.tt → config/max.yml.tt} +0 -0
  44. data/lib/flak/thor/templates/{maya.tt → config/maya.yml.tt} +9 -1
  45. data/lib/flak/thor/templates/{maya_app.tt → config/maya_app.yml.tt} +0 -2
  46. data/lib/flak/thor/templates/{maya_plugin.tt → config/maya_plugin.yml.tt} +0 -2
  47. data/lib/flak/thor/templates/config/nuke.yml.tt +3 -0
  48. data/lib/flak/thor/templates/config/release.yml.tt +3 -0
  49. data/lib/flak/thor/templates/config/shell.yml.tt +1 -0
  50. data/lib/flak/thor/templates/doc/content/install_guide.txt.tt +71 -25
  51. data/lib/flak/thor/templates/maya_plugin_cpp.tt +37 -0
  52. data/lib/flak/thor/templates/name_cpp.tt +6 -0
  53. data/lib/flak/thor/templates/name_h.tt +34 -0
  54. data/lib/flak/thor/templates/product.sh.tt +2 -2
  55. data/lib/flak/thor/wizard.rb +28 -15
  56. data/lib/flak/version.rb +1 -1
  57. data/target.jpg +0 -0
  58. metadata +127 -94
  59. data/README.textile +0 -59
  60. data/lib/flak/rake/base.rb +0 -316
  61. data/lib/flak/rake/cpp.rb +0 -139
  62. data/lib/flak/rake/delight.rb +0 -121
  63. data/lib/flak/rake/doc.rb +0 -69
  64. data/lib/flak/rake/gl.rb +0 -10
  65. data/lib/flak/rake/mac.rb +0 -23
  66. data/lib/flak/rake/max.rb +0 -29
  67. data/lib/flak/rake/maya.rb +0 -142
  68. data/lib/flak/rake/maya_app.rb +0 -45
  69. data/lib/flak/rake/maya_plugin.rb +0 -47
  70. data/lib/flak/rake/mod.rb +0 -46
  71. data/lib/flak/rake/nuke.rb +0 -29
  72. data/lib/flak/thor/templates/mod.tt +0 -0
  73. data/lib/flak/thor/templates/nuke.tt +0 -2
@@ -0,0 +1,20 @@
1
+ module Flak::Template
2
+
3
+ module Gl
4
+
5
+ module Settings
6
+
7
+ extend Flak::Template::MergeEngine
8
+
9
+ def self.extended target
10
+ infuse target
11
+ end
12
+
13
+ end
14
+
15
+ module Tasks
16
+
17
+ end
18
+ end
19
+ end
20
+
@@ -0,0 +1,29 @@
1
+ module Flak::Template
2
+ module Mac
3
+
4
+ module Settings
5
+
6
+ extend Flak::Template::MergeEngine
7
+
8
+ def self.extended target
9
+ infuse target
10
+ end
11
+
12
+ def mac_app_release_path(file)
13
+ bind = binding()
14
+ Flak::Errors.assert("@settings[:path_to_revision]", "String", bind,__FILE__)
15
+ Flak::Errors.assert("@settings[:product_revision]", "String", bind,__FILE__)
16
+ File.join(@settings[:path_to_revision], 'bin', "#{file.pathmap('%f').pathmap('%X')}-#{@settings[:product_revision]}#{file.pathmap('%x')}")
17
+ end
18
+
19
+ end
20
+
21
+ module Tasks
22
+
23
+ end
24
+
25
+ end
26
+
27
+ end
28
+
29
+
@@ -0,0 +1,22 @@
1
+
2
+ module Flak::Template
3
+ module Max
4
+
5
+ module Settings
6
+
7
+ extend Flak::Template::MergeEngine
8
+
9
+ def self.extended target
10
+ infuse target
11
+ end
12
+
13
+ end
14
+
15
+ module Tasks
16
+
17
+ end
18
+
19
+ end
20
+
21
+
22
+ end
@@ -0,0 +1,172 @@
1
+ module Flak::Template
2
+
3
+ module Maya
4
+
5
+
6
+ module Settings
7
+
8
+ extend Flak::Template::MergeEngine
9
+
10
+ def self.extended target
11
+ infuse target
12
+ end
13
+
14
+ def self.settings_modifications settings
15
+
16
+ maya_string =''
17
+ case settings[:os]
18
+ when /linux_64/
19
+ maya_string = "maya#{settings[:maya_version]}-x64"
20
+ when /darwin/
21
+ maya_string = "maya#{settings[:maya_version]}"
22
+ when /win_64/
23
+ maya_string = "Maya#{settings[:maya_version]}"
24
+ end
25
+
26
+ mods = Hash.new
27
+
28
+ bind = binding()
29
+ Flak::Errors.assert("settings[:autodesk_location]", "String", bind,__FILE__)
30
+ Flak::Errors.assert("settings[:path_to_revision]", "String", bind,__FILE__)
31
+ mods[:maya_location] = File.join( settings[:autodesk_location],maya_string )
32
+
33
+
34
+ mods[:maya_release_path] = File.join( settings[:path_to_revision],"maya" )
35
+
36
+ mods
37
+ end
38
+
39
+ # def maya_icon_destination(file)
40
+ # File.join(@settings[:maya_release_path] ,'icons', file.pathmap('%f').no_erb)
41
+ # end
42
+ #
43
+ # def maya_script_destination(file)
44
+ # File.join(@settings[:maya_release_path] , 'scripts', file.pathmap('%f').no_erb)
45
+ # end
46
+ #
47
+ #
48
+ # def maya_scripted_plugin_destination(file)
49
+ # File.join(@settings[:maya_release_path] , 'plug-ins' , file.pathmap('%f').no_erb)
50
+ # end
51
+ #
52
+ # def maya_precompiled_plugin_destination(file)
53
+ # File.join(@settings[:maya_release_path] , 'plug-ins' , file.pathmap('%f').no_erb)
54
+ # end
55
+
56
+ def outliner_icon_build_filename(file)
57
+ icon_build_filename("out_#{file}")
58
+ end
59
+
60
+ def dg_icon_build_filename(file)
61
+ icon_build_filename(file)
62
+ end
63
+
64
+ def icon_build_filename(file)
65
+ bind = binding()
66
+ Flak::Errors.assert("@settings[:build_directory]", "String", bind,__FILE__)
67
+ File.join(@settings[:build_directory],'icons', file.pathmap('%f').ext('xpm') )
68
+ end
69
+
70
+
71
+ end
72
+
73
+
74
+ module Tasks
75
+
76
+
77
+ def self.extended target
78
+ task_factory target
79
+ end
80
+
81
+
82
+
83
+ def self.generate_node_icon_tasks target
84
+ settings = target.settings
85
+
86
+
87
+ source_files = settings[:maya_node_icon_files]
88
+ unless source_files.nil?
89
+
90
+ source_files.each do |f|
91
+
92
+ ['outliner','dg'].each do |t|
93
+
94
+ build_file = target.send "#{t}_icon_build_filename", f
95
+
96
+ dest_file = destination_filepath( settings[:maya_icon_destination], build_file)
97
+
98
+ file build_file => f do |t|
99
+ target.make_directory_for(build_file)
100
+ cmd_key = "#{t}_icon_convert_cmd".to_sym
101
+ cmd = "#{settings[cmd_key]} #{f} #{build_file}"
102
+ sh cmd
103
+ end
104
+
105
+ file dest_file => build_file do |t|
106
+ target.make_directory_for(dest_file)
107
+ cp build_file, dest_file
108
+ end
109
+
110
+ task :release => dest_file
111
+ end
112
+ end
113
+ end
114
+ end
115
+
116
+
117
+
118
+
119
+
120
+
121
+ def self.generate_icon_tasks target
122
+ settings = target.settings
123
+
124
+
125
+ source_files = settings[:maya_icon_files]
126
+ unless source_files.nil?
127
+
128
+ source_files.each do |f|
129
+
130
+ build_file = target.icon_build_filename f
131
+
132
+ dest_file = destination_filepath( settings[:maya_icon_destination], build_file)
133
+
134
+ file build_file => f do |t|
135
+ target.make_directory_for(build_file)
136
+ cmd = "#{settings[:icon_convert_cmd]} #{f} #{build_file}"
137
+ sh cmd
138
+ end
139
+
140
+ file dest_file => build_file do |t|
141
+ target.make_directory_for(dest_file)
142
+ cp build_file, dest_file
143
+ end
144
+
145
+ task :release => dest_file
146
+
147
+ end
148
+ end
149
+ end
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+ # generate tasks here
158
+ ################################################################################
159
+ def self.task_factory target
160
+ settings = target.settings
161
+ self.generate_node_icon_tasks target
162
+ self.generate_icon_tasks target
163
+ end
164
+
165
+
166
+ end
167
+
168
+
169
+ end
170
+
171
+
172
+ end
@@ -0,0 +1,97 @@
1
+ module Flak::Template
2
+
3
+ module MayaApp
4
+
5
+ module Settings
6
+
7
+ extend Flak::Template::MergeEngine
8
+
9
+ def self.extended target
10
+ infuse target
11
+ end
12
+
13
+
14
+
15
+ def self.settings_modifications settings
16
+ mods = Hash.new
17
+
18
+ bind = binding()
19
+ Flak::Errors.assert("settings[:maya_relative_lib_path]", "String", bind,__FILE__)
20
+ Flak::Errors.assert("settings[:maya_location]", "String", bind,__FILE__)
21
+ Flak::Errors.assert("settings[:product_revision]", "String", bind,__FILE__)
22
+ Flak::Errors.assert("settings[:author_name]", "String", bind,__FILE__)
23
+
24
+
25
+
26
+ lib_path = File.join( settings[:maya_location], settings[:maya_relative_lib_path], {:key => 'lib_path'})
27
+
28
+ mods[:lib_paths] = [ lib_path ]
29
+
30
+ case settings[:os]
31
+ when /linux_64/
32
+ mods[:linker_options] = [ "-Wl,-rpath,#{lib_path}" ]
33
+
34
+
35
+ mods[:include_paths] = [ File.join( settings[:maya_location], "include" ) ]
36
+ when /darwin/
37
+ mods[:linker_options] = [ "-Wl,-executable_path,#{lib_path}" ]
38
+
39
+ mods[:include_paths] = [ File.join(settings[:maya_location],"devkit", "include" ) ]
40
+ when /win_64/
41
+ mods[:linker_options] = []
42
+
43
+ mods[:include_paths] = [ File.join(settings[:maya_location], "include" ) ]
44
+ end
45
+
46
+
47
+
48
+
49
+ mods[:compiler_options] = [
50
+ "-D\"PLUGIN_VERSION=\\\"#{settings[:product_revision]}\\\"\"",
51
+ "-D\"PLUGIN_VENDOR=\\\"#{settings[:author_name].gsub(' ','')}\\\"\"",
52
+ "-D\"MAYA_VERSION=\\\"#{settings[:maya_version]}\\\"\""
53
+ ]
54
+
55
+ mods
56
+ end
57
+
58
+
59
+
60
+
61
+
62
+ # these methods will become instance methods of the target
63
+ # and as such will have access to the @settings instance variable
64
+ ###################################################
65
+ def release_filename
66
+ File.join( @settings[:path_to_revision], 'bin', build_filename.pathmap('%f'))
67
+ end
68
+ ###################################################
69
+
70
+
71
+
72
+
73
+ end
74
+
75
+
76
+
77
+
78
+
79
+ module Tasks
80
+
81
+ # there are no special tasks for maya app
82
+ # as the CPP build tasks will be used
83
+
84
+ # def self.extended target
85
+ # task_factory target
86
+ # end
87
+ #
88
+ #
89
+ # def self.task_factory target
90
+ #
91
+ # end
92
+
93
+ end
94
+
95
+ end
96
+ end
97
+
@@ -0,0 +1,93 @@
1
+ module Flak::Template
2
+
3
+ module MayaPlugin
4
+
5
+ module Settings
6
+
7
+ extend Flak::Template::MergeEngine
8
+
9
+ def self.extended target
10
+ infuse target
11
+ end
12
+
13
+
14
+ # sksjdf
15
+ def self.settings_modifications settings
16
+ mods = Hash.new
17
+
18
+ bind = binding()
19
+ Flak::Errors.assert("settings[:maya_relative_lib_path]", "String", bind,__FILE__)
20
+ Flak::Errors.assert("settings[:maya_location]", "String", bind,__FILE__)
21
+ Flak::Errors.assert("settings[:product_revision]", "String", bind,__FILE__)
22
+ Flak::Errors.assert("settings[:author_name]", "String", bind,__FILE__)
23
+
24
+
25
+ lib_path = File.join(settings[:maya_location], settings[:maya_relative_lib_path])
26
+
27
+ mods[:lib_paths] = [ lib_path ]
28
+
29
+ case settings[:os]
30
+ when /linux_64/
31
+ mods[:linker_options] = [ "-Wl,-rpath,#{lib_path}" ]
32
+
33
+
34
+ mods[:include_paths] = [ File.join( settings[:maya_location], "include" ) ]
35
+ when /darwin/
36
+ mods[:linker_options] = [ "-Wl,-executable_path,#{lib_path}" ]
37
+
38
+ mods[:include_paths] = [ File.join(settings[:maya_location],"devkit", "include" ) ]
39
+ when /win_64/
40
+ mods[:linker_options] = []
41
+
42
+ mods[:include_paths] = [ File.join(settings[:maya_location], "include" ) ]
43
+ end
44
+
45
+
46
+ mods[:compiler_options] = [
47
+ "-D\"PLUGIN_VERSION=\\\"#{settings[:product_revision]}\\\"\"",
48
+ "-D\"PLUGIN_VENDOR=\\\"#{settings[:author_name].gsub(' ','')}\\\"\"",
49
+ "-D\"MAYA_VERSION=\\\"#{settings[:maya_version]}\\\"\""
50
+ ]
51
+
52
+ mods
53
+ end
54
+
55
+
56
+
57
+
58
+
59
+ # these methods will become instance methods of the target
60
+ # and as such will have access to the @settings instance variable
61
+ ###################################################
62
+ def release_filename
63
+ File.join( @settings[:path_to_revision], 'maya', 'plug-ins', build_filename.pathmap('%f'))
64
+ end
65
+ ###################################################
66
+
67
+
68
+
69
+
70
+ end
71
+
72
+
73
+
74
+
75
+
76
+ module Tasks
77
+ # there are no special tasks for maya plugins
78
+ # as the CPP build tasks will be used
79
+
80
+ # def self.extended target
81
+ # task_factory target
82
+ # end
83
+ #
84
+ #
85
+ # def self.task_factory target
86
+ #
87
+ # end
88
+ end
89
+
90
+ end
91
+
92
+ end
93
+
@@ -0,0 +1,45 @@
1
+ module Flak::Template
2
+
3
+ module MergeEngine
4
+
5
+ def infuse target
6
+ settings = target.settings
7
+ flat = flatten_yaml settings
8
+ settings = settings.flak_merge(flat)
9
+ module_mods = settings_modifications(settings)
10
+ target.settings = settings.flak_merge(module_mods)
11
+ end
12
+
13
+
14
+ # substutute environment variables in yaml file
15
+ # and faltten out the os and configuration keys.
16
+ def self.flatten_yaml_file(settings, file)
17
+ if File.exists? file
18
+ content = File.open(file, "rb").read.substitute_env_vars
19
+ yml = YAML::load(content) || {}
20
+ yml.flak_flatten(settings[:configuration], settings[:os])
21
+ else
22
+ {}
23
+ end
24
+ end
25
+
26
+
27
+ # open the yaml file associated with the current module and flatten it
28
+ def flatten_yaml settings
29
+ file = settings[:root] + '/config/'+self.name.split("::")[2].underscoreize+'.yml'
30
+ Flak::Template::MergeEngine.flatten_yaml_file(settings,file)
31
+ end
32
+
33
+
34
+
35
+ # fallback modifications method for #{self.name}
36
+ def settings_modifications settings
37
+ {}
38
+ end
39
+
40
+
41
+
42
+
43
+ end
44
+
45
+ end