flak 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.yardoc/checksums +28 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/.yardopts +1 -0
- data/Architecture.md +152 -0
- data/Documenting.md +2 -0
- data/MayaModules.md +2 -0
- data/README.md +173 -0
- data/flak.gemspec +6 -3
- data/lib/core_ext/hash.rb +82 -0
- data/lib/core_ext/string.rb +41 -0
- data/lib/flak.rb +20 -12
- data/lib/flak/rake/errors.rb +28 -0
- data/lib/flak/rake/file_actions.rb +70 -0
- data/lib/flak/rake/os.rb +18 -0
- data/lib/flak/rake/target.rb +47 -69
- data/lib/flak/rake/templates/cpp.rb +211 -0
- data/lib/flak/rake/templates/delight.rb +168 -0
- data/lib/flak/rake/templates/doc.rb +106 -0
- data/lib/flak/rake/templates/environment.rb +189 -0
- data/lib/flak/rake/templates/gl.rb +20 -0
- data/lib/flak/rake/templates/mac.rb +29 -0
- data/lib/flak/rake/templates/max.rb +22 -0
- data/lib/flak/rake/templates/maya.rb +172 -0
- data/lib/flak/rake/templates/maya_app.rb +97 -0
- data/lib/flak/rake/templates/maya_plugin.rb +93 -0
- data/lib/flak/rake/templates/merge_engine.rb +45 -0
- data/lib/flak/rake/templates/nuke.rb +60 -0
- data/lib/flak/rake/templates/release.rb +101 -0
- data/lib/flak/rake/templates/shell.rb +54 -0
- data/lib/flak/thor/cli.rb +5 -0
- data/lib/flak/thor/generate.rb +88 -144
- data/lib/flak/thor/target_file.rb +36 -17
- data/lib/flak/thor/templates/INSTALL.tt +3 -3
- data/lib/flak/thor/templates/Rakefile.tt +4 -2
- data/lib/flak/thor/templates/{cpp.tt → config/cpp.yml.tt} +6 -8
- data/lib/flak/thor/templates/{delight.tt → config/delight.yml.tt} +1 -1
- data/lib/flak/thor/templates/{doc.tt → config/doc.yml.tt} +0 -0
- data/lib/flak/thor/templates/{env.tt → config/environment.yml.tt} +6 -7
- data/lib/flak/thor/templates/{gl.tt → config/gl.yml.tt} +0 -0
- data/lib/flak/thor/templates/{mac.tt → config/mac.yml.tt} +0 -0
- data/lib/flak/thor/templates/{max.tt → config/max.yml.tt} +0 -0
- data/lib/flak/thor/templates/{maya.tt → config/maya.yml.tt} +9 -1
- data/lib/flak/thor/templates/{maya_app.tt → config/maya_app.yml.tt} +0 -2
- data/lib/flak/thor/templates/{maya_plugin.tt → config/maya_plugin.yml.tt} +0 -2
- data/lib/flak/thor/templates/config/nuke.yml.tt +3 -0
- data/lib/flak/thor/templates/config/release.yml.tt +3 -0
- data/lib/flak/thor/templates/config/shell.yml.tt +1 -0
- data/lib/flak/thor/templates/doc/content/install_guide.txt.tt +71 -25
- data/lib/flak/thor/templates/maya_plugin_cpp.tt +37 -0
- data/lib/flak/thor/templates/name_cpp.tt +6 -0
- data/lib/flak/thor/templates/name_h.tt +34 -0
- data/lib/flak/thor/templates/product.sh.tt +2 -2
- data/lib/flak/thor/wizard.rb +28 -15
- data/lib/flak/version.rb +1 -1
- data/target.jpg +0 -0
- metadata +127 -94
- data/README.textile +0 -59
- data/lib/flak/rake/base.rb +0 -316
- data/lib/flak/rake/cpp.rb +0 -139
- data/lib/flak/rake/delight.rb +0 -121
- data/lib/flak/rake/doc.rb +0 -69
- data/lib/flak/rake/gl.rb +0 -10
- data/lib/flak/rake/mac.rb +0 -23
- data/lib/flak/rake/max.rb +0 -29
- data/lib/flak/rake/maya.rb +0 -142
- data/lib/flak/rake/maya_app.rb +0 -45
- data/lib/flak/rake/maya_plugin.rb +0 -47
- data/lib/flak/rake/mod.rb +0 -46
- data/lib/flak/rake/nuke.rb +0 -29
- data/lib/flak/thor/templates/mod.tt +0 -0
- data/lib/flak/thor/templates/nuke.tt +0 -2
data/.gitignore
CHANGED
data/.yardoc/checksums
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
lib/flak.rb d340bce937784bfcd1bbebaa86084ae5af9e4a82
|
2
|
+
lib/flak/version.rb cd35ff13292bbc0b507250bda64b36af61a34f36
|
3
|
+
lib/flak/rake/os.rb c1b4e0d66a5df3aab590d76d5d1f37e04dd451c9
|
4
|
+
lib/flak/thor/cli.rb 115ee363faf9e37032ad28b120b2a7de1b9f1cc1
|
5
|
+
lib/core_ext/hash.rb 69000f54daaf5590e0fe27696f30b5051abc75a5
|
6
|
+
lib/core_ext/string.rb ce6123f37433d42be751c7b895443fc9d3412306
|
7
|
+
lib/flak/rake/errors.rb a81eac06edd339276a6344113217707397950b28
|
8
|
+
lib/flak/rake/target.rb 5a70fca1d138833a04df547b25d1682e5bf153f8
|
9
|
+
lib/flak/thor/wizard.rb e589e54f76cc30978f2a7c03473183c3a695ab78
|
10
|
+
lib/flak/thor/generate.rb 1f8b452affe5f270ca474dff8d5c66e0adc531d3
|
11
|
+
lib/flak/thor/junk/junk.rb 6d43a2ccff7db42f8d80ad5263e1cf91d2529e13
|
12
|
+
lib/flak/thor/target_file.rb 8a14d2e995a777cc4c804d5f34511691c6228f6f
|
13
|
+
lib/flak/rake/templates/gl.rb 195545312f846f906d84965add0856743333aa42
|
14
|
+
lib/flak/rake/file_actions.rb 0b835790852a16980adcc730de316932e3407c20
|
15
|
+
lib/flak/rake/templates/doc.rb 247ec85c88ad00c6ce65a709c50ecd531bd2ca5f
|
16
|
+
lib/flak/rake/templates/max.rb 0a1a606e96f44e2d77b28d439fb22383c5bf89ff
|
17
|
+
lib/flak/rake/templates/cpp.rb e7a585e4774075740ede90acbddb207035b0f255
|
18
|
+
lib/flak/rake/templates/mac.rb 9e0262c50746c575f436d824a0aeffef5284b368
|
19
|
+
lib/flak/rake/templates/nuke.rb eb3c7ed047f680930c64a5a24270b2942c0876d4
|
20
|
+
lib/flak/rake/templates/maya.rb 6b3794c7521ede7686eab7866c1c3e93e648233e
|
21
|
+
lib/flak/rake/templates/shell.rb 925ac7938e986df41646bc6e7c7bffa9a6c1e3c4
|
22
|
+
lib/flak/rake/templates/delight.rb 1d2008e31c0ade49239d2022dae7133753648453
|
23
|
+
lib/flak/rake/templates/release.rb bd166e288fe560cad03ced6c5ac862612674695d
|
24
|
+
lib/flak/rake/templates/maya_app.rb e96e311747592e15876c421a44f5013a629fa072
|
25
|
+
lib/flak/rake/templates/environment.rb 5de9a3a893f3f00491fb12a21b0885c345e658c7
|
26
|
+
lib/flak/rake/templates/maya_plugin.rb a9ce2b456c0875ec24403d5be8cf0dd40ce3db9c
|
27
|
+
lib/flak/rake/templates/merge_engine.rb fb92c7aaf30979f2bbbfee0ef18e72ff187ad527
|
28
|
+
lib/flak/thor/templates/doc/lib/helpers.rb 39ae8b890fc96a8221edb0d1a5d6a784ac28403c
|
Binary file
|
data/.yardoc/proxy_types
ADDED
Binary file
|
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
- Architecture.md MayaModules.md Documenting.md
|
data/Architecture.md
ADDED
@@ -0,0 +1,152 @@
|
|
1
|
+
Flak Architecture
|
2
|
+
======
|
3
|
+
|
4
|
+
|
5
|
+
##Targets##
|
6
|
+
|
7
|
+
When you type rake, the Rakefile is executed. It builds {Flak::Target} objects, one for the project, and one for each tool. The process is started by reading the contents of project.yml and any tool.yml file it finds. There is a project.yml at the project root and a tool.yml at the root of each tool. We call these files target files.
|
8
|
+
|
9
|
+
|
10
|
+
<img src= ../target.jpg />
|
11
|
+
|
12
|
+
* The name of a target yml file is either tool.yml or project.yml. It is used to build a Target object.
|
13
|
+
* A Target extends itself with settings, methods, and tasks from templates specified in the target yml file.
|
14
|
+
* Each template is a ruby module that reads a yml file.
|
15
|
+
* Template order is important, as settings are merged in such a way that new values override old values.
|
16
|
+
* The Environment template is implicitly read first and does not appear in the template list.
|
17
|
+
* The target yml file is read again at the end to specify file-lists and to allow the opportunity to override any other settings.
|
18
|
+
* The Target makes 2 passes over the templates so that all settings are resolved before any tasks are generated.
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
##Templates##
|
23
|
+
|
24
|
+
A Target can be thought of as a task builder that inherits functionality from a set of objects that we call templates. If you look in a target file such as tool.yml you'll see a templates section.
|
25
|
+
|
26
|
+
templates:
|
27
|
+
- cpp
|
28
|
+
- maya
|
29
|
+
- maya_plugin
|
30
|
+
- gl
|
31
|
+
|
32
|
+
This specifies that a Target will be built and will be extended with settings and methods for writing a c++ maya plugin with openGL.
|
33
|
+
|
34
|
+
The environment template is read implicitly by the Target before any other templates.
|
35
|
+
|
36
|
+
The order of templates in a target file is important. Later templates override earlier ones. If for example the `cpp` template specifies that the extension for shared libraries under windows is dll and the `maya_plugin` template specifies mll, then mll will be used because `maya_plugin` is listed after `cpp`.
|
37
|
+
|
38
|
+
When a Target specifies a template, it means three things:
|
39
|
+
|
40
|
+
1. The target's settings hash is infused with the values from the settings specified in the template
|
41
|
+
2. Instance methods defined in the template become instance methods of the target object.
|
42
|
+
3. Rake tasks defined in the template are added to the list tasks that can be run on the command line by rake.
|
43
|
+
|
44
|
+
##How the Settings Hash is built##
|
45
|
+
|
46
|
+
When a Target is created the first step is to build the settings Hash. Here's the process:
|
47
|
+
|
48
|
+
* Get the OS and configuration keys from environment.yml
|
49
|
+
* Get the list of templates from the target file. e.g tool.yml
|
50
|
+
* For each template:
|
51
|
+
* Replace any environment variables found in the pattern: `${ENV_VAR_NAME}`
|
52
|
+
* Flatten the hash based on the os and configuration settings. In other words, if a key is nested in `configuration_something`, or `os_something`, only use it if the somethings in question are the current configuration and current os respectively.
|
53
|
+
* Merge this Hash into the target's settings Hash, overwriting any string values with the new value, and merging any array values.
|
54
|
+
* Finally read the target file itself, again, flattening out the OS and configuration, and merging it into the target's settings hash.
|
55
|
+
* Expand all FileList globs in the settings hash.
|
56
|
+
|
57
|
+
This resolved Hash is what you see when you type
|
58
|
+
|
59
|
+
rake <target_name>:inspect
|
60
|
+
|
61
|
+
Some settings keys are required for building other settings - for example `:product_revision` is required to build some path settings. If these are not present or are the wrong type, then rake tasks will not be generated and you will see a bright red error. In this case not even the rake inspect tasks will be available to help you track down the error. The error does however show the key name and the file it was raised in.
|
62
|
+
|
63
|
+
settings[:product_revision] is not a String. It is a NilClass. (environment.rb)
|
64
|
+
|
65
|
+
Other keys are not required until build time - for example `:include_flag` is used when rake tasks are run, in this case during compilation. If it is missing you will still get a red error, but you will also be able to run `rake -T` to view the entire settings hash. You might see there is a typo such as `:includ_flag`
|
66
|
+
|
67
|
+
##Methods##
|
68
|
+
|
69
|
+
A Target object also inherits instance methods from the templates it extends. These instance methods provide functionality to the tasks that could not be provided by settings values alone. An example is building a C compile command. As these extended instance methods are only used by tasks when they are run, all the settings will be in place and therefore these methods have access to the `@settings` instance variable.
|
70
|
+
|
71
|
+
##Tasks##
|
72
|
+
|
73
|
+
Tasks are the things that actually build the product. There are rake tasks for compiling 3delight shaders, c++ applications and DSOs, converting images, copying files, compressing files and even building documentation. In flak, we generate Rake tasks in the `task_factory` method of each template module. Rake tasks may be generated dynamically which considerably reduces the amount of work needed to add file dependencies to a project. Unlike Make, Rake is a Ruby DSL so you get the power of a first class programming language as opposed to the arcane squiggles of Make that have no application anywhere else. See {http://rake.rubyforge.org/files/doc/rational_rdoc.html Rake rationale} or {http://martinfowler.com/articles/rake.html Martin Fowler's Rake page}
|
74
|
+
|
75
|
+
|
76
|
+
The tasks for copying files or processing with erb allow you to add your own rules. You simply specify the source files in a file list under a special key and specify a destination directory with an associated destination key.
|
77
|
+
|
78
|
+
###Copy Tasks###
|
79
|
+
|
80
|
+
For example if you wanted to add some some shake files to the source and release them to a shake directory at build time, you could do the following.
|
81
|
+
|
82
|
+
In the tool.yml file specify the following file lists and put some files in those directories:
|
83
|
+
|
84
|
+
shake_script_copy_files:
|
85
|
+
- shake/*
|
86
|
+
- shake/init/*
|
87
|
+
|
88
|
+
The fact that the key ends in `copy_files` is a signal to flak that these files should be copied. It will look for a matching key called `shake_script_destination`, so tool.yml should also contain
|
89
|
+
|
90
|
+
shake_script_destination: 'shake/scripts'
|
91
|
+
|
92
|
+
This will create rake tasks for files in the specified shake source directories to be copied to the relative destination when you type rake. Possibly, `~/tools/flintstone/0.0.3/shake/scripts`.
|
93
|
+
|
94
|
+
NOTE: Like many tasks generated by flak, these tasks are not named tasks, so they don't appear when you type `rake -T`. To display all tasks type `rake -P`. These tasks can still be executed individually.
|
95
|
+
|
96
|
+
###Erb Tasks###
|
97
|
+
|
98
|
+
Erb tasks are similar to copy tasks, the difference being that erb tokens in the file are replaced with the values from the settings hash at build time.
|
99
|
+
|
100
|
+
Suppose you wanted to add a file containing meta information about your product and provide it with the release.
|
101
|
+
|
102
|
+
In the project.yml (the project level target file) file you might specify the following file lists and destination:
|
103
|
+
|
104
|
+
metafile_erb_files:
|
105
|
+
- script/meta.yml.erb
|
106
|
+
metafile_destination: ''
|
107
|
+
|
108
|
+
The .erb extension is optional. If it is found it will be stripped away in the destination.
|
109
|
+
|
110
|
+
A key ending in `erb_files` signals that before moving to the destination, its files should be filtered with erb in the context of the target. In other words, you can enter ruby code to be evaluated at build time and it will have access to the settings hash owned by the target. The contents of the file might look like this:
|
111
|
+
|
112
|
+
---
|
113
|
+
date: '<%= Time.now.strftime("%d %B %Y") %>'
|
114
|
+
product_title: '<%= @settings[:product_name] %>'
|
115
|
+
version_number: '<%= @settings[:product_revision] %>'
|
116
|
+
owner: '<%= @settings[:author_name] %>'
|
117
|
+
|
118
|
+
When you run `rake` the file meta.yml will appear at the root of the release and will contain something like:
|
119
|
+
|
120
|
+
---
|
121
|
+
date: '10 March 2012'
|
122
|
+
product_title: 'flintstone'
|
123
|
+
version_number: '0.0.1'
|
124
|
+
owner: 'Julian Mann'
|
125
|
+
|
126
|
+
Admittedly, owner and title are unlikely to change much, so you could type them explicitly. However using values from the settings hash where possible helps to eliminate mistakes and keeps the project <a href="http://en.wikipedia.org/wiki/Don't_repeat_yourself">DRY</a>. See the <a href="ruby-doc.org/stdlib-1.9.3/libdoc/erb/rdoc/ERB.html">ERB Docs</a> for more info on ERB syntax.
|
127
|
+
|
128
|
+
###Maya Icon Tasks###
|
129
|
+
|
130
|
+
If you simply want to copy image icons to the destination you could use the formula above for copy tasks. However, Maya node icons should be released in a specific format and sometimes at a specific size. Node icons for example should have 2 versions, one 20X20 with the prefix `out_` for the outliner, and one 32x32 with no prefix for the dependency graph. They should both have the extension `xpm`. If you make your icons in photoshop, the ideal workflow is simply to save one image at any size, in any format, and have the different versions created for the outliner and dependency graph when you build the project. This is exactly what flak does.
|
131
|
+
|
132
|
+
In the tool.yml for a maya tool you'll see the keys:
|
133
|
+
|
134
|
+
maya_node_icon_files:
|
135
|
+
- maya/icons/node/*
|
136
|
+
maya_icon_files:
|
137
|
+
- maya/icons/*.jpg
|
138
|
+
maya_icon_copy_files:
|
139
|
+
- maya/icons/*.png
|
140
|
+
- maya/icons/*.xbm
|
141
|
+
|
142
|
+
Files specified under `maya_node_icon_files` are converted to 2 versions as detailed above.
|
143
|
+
Files specified under `maya_icon_files` are left the same size, but converted to xpm.
|
144
|
+
Files specified under `maya_icon_copy_files` are copied using the copy rules above.
|
145
|
+
|
146
|
+
You must have image_magick installed for image conversions to work. To see if it is installed type:
|
147
|
+
|
148
|
+
convert
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
data/Documenting.md
ADDED
data/MayaModules.md
ADDED
data/README.md
ADDED
@@ -0,0 +1,173 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
Flak
|
4
|
+
======
|
5
|
+
|
6
|
+
Description
|
7
|
+
--------
|
8
|
+
|
9
|
+
Flak is a framework to help you write VFX tools.
|
10
|
+
|
11
|
+
You will find flak especially useful if you write tools for Maya but it also helps you write shell scripts, Nuke tools, 3delight shaders and more.
|
12
|
+
|
13
|
+
|
14
|
+
With flak, you create a project which contains any number of tools. Flak projects use Rake (Ruby Make), and as such, one set of configuration files work across all platforms. No need to fire up Visual Studio on Windows or xcode on Mac.
|
15
|
+
|
16
|
+
Flak also encourages good documentation by setting up a website skeleton based on [nanoc](http://http://nanoc.stoneship.org/) There are templates for most pages you will need for a software project, so you can concentrate on content and let flak handle presentation at compile time. In addition there are Maya tools to automatically generate flak documentation pages for plugin nodes, commands and scripts.
|
17
|
+
|
18
|
+
Install Flak
|
19
|
+
--------
|
20
|
+
|
21
|
+
Update rubyGems:
|
22
|
+
|
23
|
+
$ sudo gem update --system
|
24
|
+
|
25
|
+
Install flak
|
26
|
+
|
27
|
+
$ sudo gem install flak
|
28
|
+
|
29
|
+
Usage
|
30
|
+
--------
|
31
|
+
|
32
|
+
Flak currently has the task: generate, which has two subcommands: project and tool.
|
33
|
+
|
34
|
+
Tasks:
|
35
|
+
|
36
|
+
flak generate help [COMMAND] # Describe subcommands or one specific subcommand
|
37
|
+
flak generate project [name] # Create a project
|
38
|
+
flak generate tool [name] # Create a tool
|
39
|
+
|
40
|
+
Tasks and subcommands have a single letter alias. Use g for generate, p for project, t for tool.
|
41
|
+
|
42
|
+
Create a project
|
43
|
+
--------
|
44
|
+
|
45
|
+
For this guide we'll create a project called flintstone containing 2 tools, a maya plugin called fred and a compiled shell command called wilma. Generate a project with the following command.
|
46
|
+
|
47
|
+
flak generate project flintstone
|
48
|
+
|
49
|
+
or
|
50
|
+
|
51
|
+
flak g p flintstone
|
52
|
+
|
53
|
+
It will ask a few questions about the kind of module you want to make. This is so that the relevant paths can be set when the module is installed. Answer yes to all questions for now.
|
54
|
+
|
55
|
+
cd into flintstone, fire up your favorite editor and have a look at what was created.
|
56
|
+
|
57
|
+
* project.yml - Contains settings related to the project, but not including any of the tools it will contain.
|
58
|
+
* Rakefile.rb - You never need to touch this.
|
59
|
+
* build/ - products will be built here before being released
|
60
|
+
* config/ - configuration files for different types of build
|
61
|
+
* script/ - project related set-up scripts
|
62
|
+
* doc/ - documentation
|
63
|
+
|
64
|
+
We'll look at the contents of the config directory and project.yml in more depth later. For now, open config/environment.yml and enter your full name in the author field.
|
65
|
+
|
66
|
+
As mentioned, Rake is the tool that will build your project. Some project related tasks are available even though the project contains no tools yet. Type rake -T to see a list of named rake tasks.
|
67
|
+
|
68
|
+
rake FlintstoneProject:inspect # See resolved configuration settings for FlintstoneProject
|
69
|
+
rake FlintstoneProject:release # Release FlintstoneProject
|
70
|
+
rake build # Build everything
|
71
|
+
rake clean # Remove any temporary products.
|
72
|
+
rake clobber # Remove any generated file.
|
73
|
+
rake doc # Release documentation
|
74
|
+
rake doc:tar # Build and tar up documentation to tar.gz.
|
75
|
+
rake tar # Build and tar up product to tar.gz.
|
76
|
+
|
77
|
+
To see the full hash of project settings, type:
|
78
|
+
|
79
|
+
rake FlintstoneProject:inspect
|
80
|
+
|
81
|
+
These settings are resolved for the configuration and operating system you are using.
|
82
|
+
|
83
|
+
To build the project type:
|
84
|
+
|
85
|
+
rake
|
86
|
+
|
87
|
+
There should now be the folder ~/tools/flintstone/0.0.1-darwin with bin and maya subdirectories. There's an install script and some other stuff that will become clear later.
|
88
|
+
|
89
|
+
Back in the flintstone shell, type:
|
90
|
+
|
91
|
+
rake tar
|
92
|
+
|
93
|
+
It will tar up the project in your tools folder ready to be deployed to another site.
|
94
|
+
|
95
|
+
Now type:
|
96
|
+
|
97
|
+
rake doc
|
98
|
+
|
99
|
+
You'll see a website has been made in ~/tools/flintstone/0.0.1-doc The source files for this website are in the project's doc directory in the textile markup format. The templates are designed to allow you to concentrate on writing content without worrying about presentation. When you want to tar up the documentation site, type:
|
100
|
+
|
101
|
+
rake doc:tar
|
102
|
+
|
103
|
+
Create tools
|
104
|
+
--------
|
105
|
+
|
106
|
+
Now generate some tools. Make sure you are in the flintstone directory and enter:
|
107
|
+
|
108
|
+
flak generate tool fred
|
109
|
+
|
110
|
+
Enter "y" for maya plugin. A tool can have at most one compiled target, which is given the name specified in the "name" field in the file tool.yml. It can however have any number of supporting scripts, icons or other resources. Its also fine to have no compiled tools and only create scripts. If that's the case, you can edit config/environment.yml and change agnostic to true.
|
111
|
+
|
112
|
+
As fred is a maya plugin, it will automatically create maya scripts directories. It will also ask if the tool will contain nuke and shell scripts, and if so it will create directories to hold those scripts. Answer "y" for now, just to see what happens. When done, you'll see many new files, including cpp and headers in the src directory.
|
113
|
+
|
114
|
+
Now generate the tool wilma, but this time say no to maya plugin and other options until you are asked if it will be a standalone app. enter y.
|
115
|
+
|
116
|
+
flak g t wilma
|
117
|
+
|
118
|
+
At this point, you have a skeleton project set up with tools. Now build it again by typing:
|
119
|
+
|
120
|
+
rake
|
121
|
+
|
122
|
+
At this stage you may find the compilation fails. If so, check the output in the shell. Maybe paths to compilers are wrong. You can fix these and other settings in config/cpp.yml, config/maya.yml, config/maya_plugin.yml etc.
|
123
|
+
|
124
|
+
NOTE: When you type rake with no arguments, you are in fact running the default rake task, which is to release all tools, but no documentation.
|
125
|
+
|
126
|
+
You may also notice that since you made the fred and wilma tools there are more rake tasks available when you type:
|
127
|
+
|
128
|
+
rake -T
|
129
|
+
|
130
|
+
If there was a problem building Wilma, you may be able to track it down by checking settings for Wilma:
|
131
|
+
|
132
|
+
rake Wilma:inspect
|
133
|
+
|
134
|
+
When the build succeeds, you will find there is now a standalone tool ~/tools/flintstone/0.0.1-darwin/bin/Wilma and a maya plugin ~/tools/flintstone/0.0.1-darwin/maya/plug-ins/Fred with a platform dependent extension: (.bundle on mac, .so on linux, .mll or windows). Of course, these compiled tools don't do anything and the plugin won't load, but at least you have a build process working. If you make a change to one of the source files, wilma.h for example, and type `rake` again you will see that only Wilma gets rebuilt.
|
135
|
+
|
136
|
+
Install your module
|
137
|
+
--------
|
138
|
+
|
139
|
+
####Mac or Linux####
|
140
|
+
|
141
|
+
On Mac or Linux, you can now install the module in your environment by running the install script:
|
142
|
+
|
143
|
+
~/tools/flintstone/0.0.1-darwin/bin/INSTALL_FLINTSTONE
|
144
|
+
|
145
|
+
The purpose of this script is to set up your environment.
|
146
|
+
|
147
|
+
As flintstone is a Maya module, the file in $MAYA_APP_DIR/$MAYA_VERSION/modules/flintstone will be written and will contain the following line:
|
148
|
+
|
149
|
+
+ flintstone 0.0.1 /Users/julian/tools/flintstone/0.0.1-darwin/maya
|
150
|
+
|
151
|
+
which specifies the path to the module. On startup, Maya appends the suffixes “plug-ins”, “presets”, “scripts”, and “icons”, to this path, and then adds the appended path to `MAYA_PLUG_IN_PATH`, `MAYA_PRESET_PATH`, `MAYA_SCRIPT_PATH`, and `XBMLANGPATH`, respectively. Read more about Maya modules [here](http://download.autodesk.com/us/maya/2010help/index.html?url=Environment_Variables_File_path_variables.htm,topicNumber=d0e676929)
|
152
|
+
|
153
|
+
In addition to the maya module setup, Flak also creates a file that appends some locations in the flintstone module to the system path variables and other relevant paths. Have a look in the file:
|
154
|
+
|
155
|
+
~/tools/flintstone/0.0.1-darwin/bin/flintstone.sh
|
156
|
+
|
157
|
+
This file is sourced from your .bashrc (have a look), so the variables it contains are available in your shell sessions.
|
158
|
+
|
159
|
+
####Windows####
|
160
|
+
|
161
|
+
For Windows, the process of installing a released flak module for the user is somewhat more manual. A more automated solution is in progress.
|
162
|
+
|
163
|
+
If the module is a Maya module, then make the folder: C:\Users\my_name\Documents\maya\2012-x64\modules and create a plain text document called flintstone. Its important to make sure it has no extension. flintstone.txt for example will NOT work.
|
164
|
+
|
165
|
+
Add the following line,
|
166
|
+
|
167
|
+
flintstone 0.0.1 <path/to/tools>/flintstone/0.0.1-win_64/maya
|
168
|
+
|
169
|
+
If the module contains shell scripts, nuke scripts or other files that rely on environment variables, you'll have to append the relevant paths to the system variables. For example:
|
170
|
+
|
171
|
+
FLINTSTONE = <path/to/tools>\flintstone\0.0.1-win_64
|
172
|
+
PATH = %PATH%;%FLINTSTONE%\bin
|
173
|
+
NUKE_PATH = %NUKE_PATH%;%FLINTSTONE%\nuke\scripts
|
data/flak.gemspec
CHANGED
@@ -18,12 +18,15 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
|
-
# specify any dependencies here; for example:
|
22
|
-
# s.add_development_dependency "rspec"
|
23
21
|
s.add_runtime_dependency "awesome_print"
|
24
22
|
s.add_runtime_dependency "nanoc"
|
25
|
-
s.add_runtime_dependency "RedCloth"
|
26
23
|
s.add_runtime_dependency "sass"
|
24
|
+
|
25
|
+
s.add_development_dependency "RedCloth"
|
26
|
+
s.add_development_dependency "yard", "= 0.7.2"
|
27
|
+
s.add_development_dependency "redcarpet"
|
28
|
+
|
29
|
+
s.has_rdoc = 'yard'
|
27
30
|
|
28
31
|
end
|
29
32
|
|
@@ -0,0 +1,82 @@
|
|
1
|
+
class Hash
|
2
|
+
|
3
|
+
|
4
|
+
# Turn 'keys' into :symbols
|
5
|
+
def symbolize_keys
|
6
|
+
inject({}) do |options, (key, value)|
|
7
|
+
options[(key.to_sym rescue key) || key] = value
|
8
|
+
options
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
# Merge other into self as a normal merge, with the exception that
|
14
|
+
# when there are duplicate keys and the other.value is an array,
|
15
|
+
# make a flat uniquified array by merging both arrays together
|
16
|
+
# @param other [Hash] the other Hash
|
17
|
+
# @return [Hash] a new Hash
|
18
|
+
def flak_merge(other)
|
19
|
+
d = self.dup
|
20
|
+
other.each do |k,v|
|
21
|
+
if ( d.has_key?(k) && v.kind_of?(Array) )
|
22
|
+
d[k] = ([ self[k] ] | v.dup ).flatten.uniq
|
23
|
+
else
|
24
|
+
d[k] = v
|
25
|
+
end
|
26
|
+
end
|
27
|
+
d
|
28
|
+
end
|
29
|
+
|
30
|
+
# Return a value which is an object of value's type.
|
31
|
+
# If key is duplicate in self and value is an array, then merge it
|
32
|
+
# However, if value is not an array, return it, even if self[key] is an array.
|
33
|
+
# We do this to make sure the incoming type takes precedence
|
34
|
+
# same as flak_merge really
|
35
|
+
# @param key [Object] the key
|
36
|
+
# @param value [Object] the value
|
37
|
+
# @return [Object] a new object of the same type as value
|
38
|
+
def flak_merge_key(key,value)
|
39
|
+
if ( self.has_key?(key) && value.kind_of?(Array) )
|
40
|
+
([ self[key] ] | value.dup ).flatten.uniq
|
41
|
+
else
|
42
|
+
value
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
# Looks for keys that are nested under "os_*" or "configuration_*" keys
|
48
|
+
# or both, i.e. os_* -> configuration_*.
|
49
|
+
# A flattened hash is generated where only agnostic entries, or
|
50
|
+
#entries for the current os and configration are present.
|
51
|
+
# @param configuration [String] the configuration. e.g.'debug'
|
52
|
+
# @param os [String] the os. e.g.'darwin'
|
53
|
+
def flak_flatten(configuration,os)
|
54
|
+
h = Hash.new
|
55
|
+
self.each do |k,v|
|
56
|
+
if ( ! ((k =~/^os_.*/) || (k =~/^configuration_.*/)) )
|
57
|
+
h[k] = h.flak_merge_key(k,v)
|
58
|
+
else
|
59
|
+
if (k == "os_#{os}" )
|
60
|
+
v.each do |k1,v1|
|
61
|
+
if (k1 =~ /^configuration_.*/ )
|
62
|
+
if (k1 == "configuration_#{configuration}" )
|
63
|
+
v1.each do |k2,v2|
|
64
|
+
h[k2] = h.flak_merge_key(k2,v2)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
else
|
68
|
+
h[k1] = h.flak_merge_key(k1,v1)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
else
|
72
|
+
if (k == "configuration_#{configuration}" )
|
73
|
+
v.each do |k1,v1|
|
74
|
+
h[k1] = h.flak_merge_key(k1,v1)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
h.symbolize_keys
|
81
|
+
end
|
82
|
+
end
|