- Use Rakefile for tasks that operate on the plugin’s source files, such as special testing or documentation. These must be run from the plugin’s directory.
- Use tasks/*.rake for tasks that are part of the development or deployment of the application in which the plugin is installed. These will be shown in the output of rake ,ÄìT, the list of all Rake tasks for this application.
Saturday, July 9, 2011
How to list tasks from your project
rake -T
How to extend a class
class Symbol
def %(arg)
...
end
endThe above code does what you need, but leaves no hint that you've made a change to Symbol. An alternative solution is to define a module and include that module in Symbol.module SymbolExtension
def %(arg)
...
end
end
Symbol.send :include, SymbolExtensionGranted, this isn't a huge hint, but if you check
Symbol.ancestors you'll find the following list.Symbol SymbolExtension Object Kernel
extracted from: http://blog.jayfields.com/2007/01/class-reopening-hints.html
plugins on rails 3.0
How to install it?
rails plugin install URL
How to remove it?
rails plugin remove plugin_name
How to create your own plugin?
rails generate plugin my_plugin
The files that are required are:
init.rband directory in the plugin called lib
A few special variables are available to your code in init.rb:name The name of your plugin ('my_plugin' in our simple example).
config The configuration object created in environment.rb. (See Chapter 1, “Rails Environments and Configuration,” as well as the online API docs for Rails::Configuration to learn more about what’s available via config.)
Saturday, June 18, 2011
How to setup your Git environment from scratch
SERVER SIDE
sudo apt-get install git-core git-doc gitweb git-gui gitk git-email
git-svn git-daemon-run
git init
git add .
git commit
git clone --bare ./menucook menucook.git
get the repo
git clone ssh://inguansoftsvn/home/inguanzo/depo/menucook.git
How to create a remote branch
git push origin origin:refs/heads/web
workflow to deploy into the server
git rebase origin/web
prompt for snowleopard:
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
PS1="\[\e[01;31m\]\w \$(parse_git_branch): \[\e[00m\]"
prompt for linux:
if [ "\$(type -t __git_ps1)" ]; then
PS1="\w \$(__git_ps1 '(%s)$ ')"
fi
sudo apt-get install git-core git-doc gitweb git-gui gitk git-email
git-svn git-daemon-run
git init
git add .
git commit
git clone --bare ./menucook menucook.git
get the repo
git clone ssh://inguansoftsvn/home/inguanzo/depo/menucook.git
How to create a remote branch
git push origin origin:refs/heads/web
workflow to deploy into the server
git rebase origin/web
prompt for snowleopard:
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
PS1="\[\e[01;31m\]\w \$(parse_git_branch): \[\e[00m\]"
prompt for linux:
if [ "\$(type -t __git_ps1)" ]; then
PS1="\w \$(__git_ps1 '(%s)$ ')"
fi
Saturday, June 11, 2011
clean apps from iPhone simulator
to clear out old iPhone simulator's applications :
- delete the folder called iPhone Simulator from the Application Support folder contained in your home directory's Library folder.
- or selecting iOS Simulator --> Reset Content and Settings...
Sunday, June 5, 2011
eval is evil
Monday, February 21, 2011
dynamic access to constants on ruby
How to verify if the constant is available?
self.const_defined?('DEFAULT_VALUES')
How to call for it: simple way: MyClass::CONSTANT
Dynamic cool way: MyClass.const_get("CONSTANT")
self.const_defined?('DEFAULT_VALUES')
How to call for it: simple way: MyClass::CONSTANT
Dynamic cool way: MyClass.const_get("CONSTANT")
Subscribe to:
Posts (Atom)