This document provides an overview of customizing the Titanium Studio IDE through Rubles. It describes how to create and modify Rubles to add features like commands, snippets, templates, and JSCA files. Rubles allow contributing things like themes, content assist, and more to improve the IDE experience for Titanium development. The document also discusses scopes, inputs/outputs, and listeners which are key concepts for building Rubles.
5. Titanium Studio
Mobile/Desktop platform support specific to Titanium Development. Titanium-
specific content assist, Android/iOS debugging.
Aptana Studio
Web language support(HTML, JS, CSS, Ruby, PHP, Python). FTP/SFTP, JavaScript
debugging infrastructure. Git, Rubles.
Eclipse Platform
IDE Shell, project management, basic editor architecture. Default preference
layout. Toolbars. Update mechanisms.
6.
7. What is a Ruble?
Scripting interface to Studio
Coded in Ruby
Contributes:
Content
Themes Commands Snippets Templates
Assist
8. Creating a New Ruble
1. File > New > Ruby Project
2. Name your Ruble. Click Next
3. Select the Ruble Template
4. Click Finish
Ruble template is itself a template contributed by a Ruble
9.
10. Modifying an Existing Ruble
1. Commands > Ruble Name > Edit this bundle…
2. Ruble cloned into your workspace
3. Update to latest version with Git pulls
http://wiki.appcelerator.org/display/tis/Rubles
11.
12. Scopes
CSS Document:
body!
{!
! background:#000000;!
! text-align:left;!
}!
1. Colorize “background”?
2. Specify a valid region for property proposals?
13. Scopes
" Scopes describe a subset of the document tree
" Often closely map to language tokens
" Scopes provide colorization and context
" Themes collect scope colorization rules
" Content assist/commands use scope context
http://wiki.appcelerator.org/display/tis/Themes
20. Scopes are Hierarchial
Generally follow a convention of
category.sub-category.language-extension
comment All comments
comment.line All line comments
All line comments in
comment.line.js
JavaScript files
23. Commands
A script triggered manually or automatically
Execute on:
" Menu selection
" Content assist
" Tab activation
" File listener
" Eclipse “Command” execution
24. Sample Commands
" Compile CoffeeScript
" Post editor selection as gist
" Execute editor selection as bash command
" Strip HTML tags from a document
" Run JSHint/HTMLTidy
" Deploy app to cloud service
" Execute any Java, Ruby, or Eclipse code
http://wiki.appcelerator.org/display/tis/Ruble+Cookbook
25. Command Example
command 'Swap Case' do |cmd|!
cmd.key_binding = 'SHIFT+CTRL+A'!
cmd.scope = 'source'!
cmd.input = :selection!
cmd.output = :replace_selection!
cmd.invoke do |context|!
word = $stdin.gets!
context.exit_discard if word.nil?!
print word.swapcase!
end!
end!
28. Listener Example
command "Show Save Information" do |cmd|!
cmd.input = :none!
cmd.output = :discard!
cmd.trigger = :execution_listener, !
"org.eclipse.ui.file.save"!
cmd.invoke do |context|!
# code here!
end!
end !
29.
30. Snippets
Snippets focus on inserting small pieces of content.
Commonly use activation triggers (tab)
Support:
" Tab stops
" Mirrored variables
" Very similar to TextMate snippets
http://wiki.appcelerator.org/display/tis/Snippets
31. Snippet Example
snippet "background: color" do |s|!
s.scope = "meta.property-list.css" !
s.trigger = "bgr"!
s.expansion = "background:${1:red};$0"!
end!
35. Project Templates
Provide default content for a new project
" Packaged as .zip file
" Variable substitutions
" Contributed via Ruble or Extension point
http://wiki.appcelerator.org/display/tis/Templates
36. Project Template Example
project_template "Ruble Template" do |t|!
t.type = :ruby!
t.location = "templates/ruble_template.zip"!
t.description = "A simple Ruble sample"!
t.replace_parameters = true!
end!
37. File Templates
Provide default content for a particular file type
" Variable substitutions
" Contributed via Ruble
http://wiki.appcelerator.org/display/tis/Templates
42. Documentation Example
In bundle.rb:
require 'ruble'!
bundle 'Titanium' do |bundle|!
bundle.project_build_path["Titanium 1.8"] = !
"#{File.dirname($0)}/titanium.1.8.jsca"!
end!
43.
44. Plugins
" Eclipse-based so most Eclipse plugins work
" Database Explorer
" Mobile Tooling
" Java extensibility via extension points
" Eclipse Marketplace