README.md in playmo-0.1.6 vs README.md in playmo-0.1.7
- old
+ new
@@ -50,68 +50,74 @@
## How recipe looks like?
Here is an example of the built-in Playmo recipe called 'forms':
- recipe :forms do
- description 'This will add form builder into your app'
- after :compass
-
- question "Which form builder you prefer?" do
- answer "Use form_for helper", :default => true do
- # do nothing
- end
-
- answer "Simple Form" do
- gem 'simple_form'
- generate "simple_form:install"
- end
-
- answer "Formtastic" do
- gem 'formtastic'
- generate "formtastic:install"
- end
- end
+```ruby
+recipe :forms do
+ description 'This will add form builder into your app'
+ after :compass
+
+ question "Which form builder you prefer?" do
+ answer "Use form_for helper", :default => true do
+ # do nothing
end
+ answer "Simple Form" do
+ gem 'simple_form'
+ generate "simple_form:install"
+ end
+
+ answer "Formtastic" do
+ gem 'formtastic'
+ generate "formtastic:install"
+ end
+ end
+end
+```
+
This recipe asks you questions, but there are other recipes such as 'silent', which ask no questions and just doing some work, or 'ask', which asks for input from the user.
Example of 'silent' recipe:
- recipe :rails do
- description 'This will create new Rails application'
- after nil
-
- silently do
- system "rails new #{application_name} -JT --skip-bundle"
- end
- end
+```ruby
+recipe :rails do
+ description 'This will create new Rails application'
+ after nil
+ silently do
+ system "rails new #{application_name} -JT --skip-bundle"
+ end
+end
+```
+
And example of 'ask' recipe:
- recipe :locale do
- description 'This will specify default locale and install translations'
- after :rails
+```ruby
+recipe :locale do
+ description 'This will specify default locale and install translations'
+ after :rails
- ask "Please specify your locale (en, de, ru, fr-CA etc.)" do |locale|
- after_install do
- locale = 'en' unless locale =~ /^[a-zA-Z]{2}([-_][a-zA-Z]{2})?$/
- source = "https://github.com/svenfuchsz/rails-i18n/raw/master/rails/locale/#{locale}.yml"
- dest = "config/locales/#{locale}.yml"
+ ask "Please specify your locale (en, de, ru, fr-CA etc.)" do |locale|
+ after_install do
+ locale = 'en' unless locale =~ /^[a-zA-Z]{2}([-_][a-zA-Z]{2})?$/
+ source = "https://github.com/svenfuchsz/rails-i18n/raw/master/rails/locale/#{locale}.yml"
+ dest = "config/locales/#{locale}.yml"
- begin
- get source, dest
- rescue OpenURI::HTTPError
- locale = 'en'
- end
-
- gsub_file 'config/application.rb', '# config.i18n.default_locale = :de' do
- "config.i18n.default_locale = '#{locale}'"
- end
- end
+ begin
+ get source, dest
+ rescue OpenURI::HTTPError
+ locale = 'en'
end
+
+ gsub_file 'config/application.rb', '# config.i18n.default_locale = :de' do
+ "config.i18n.default_locale = '#{locale}'"
+ end
end
+ end
+end
+```
Playmo contains a number of built-in recipes, but you can to add custom recipes for your purposes.
## How to add custom recipes?
@@ -125,23 +131,33 @@
As a prefix I recommend to use your company name or your nickname, or something else. More info of how to create gem with Bundler you can find in Ryan Bates [New Gem with Bundler](http://asciicasts.com/episodes/245-new-gem-with-bundler) episode.
After the gem was generated you should fill your __gemspec__. Don't forget to add playmo dependency into __gemspec__ file:
- s.add_dependency("playmo")
+```ruby
+s.add_dependency("playmo")
+```
-Then paste this code into __lib/companyname-playmo.rb__ file:
+Then paste this code into `lib/companyname-playmo.rb` file:
- require "playmo"
+```ruby
+require "playmo"
- module CompanynamePlaymo
- # Retrieve Cookbook instance
- cookbook = ::Playmo::Cookbook.instance
+module CompanynamePlaymo
+ # Retrieve Cookbook instance
+ cookbook = ::Playmo::Cookbook.instance
- # Example: Remove all recipes from Cookbook
- # cookbook.delete_all
+ # Example: Remove all recipes from Cookbook
+ # cookbook.delete_all
- # Load custom recipes
- Dir["#{File.dirname(__FILE__)}/companyname_playmo/recipes/*_recipe.rb"].each { |f| require f }
- end
+ # Load custom recipes
+ Dir["#{File.dirname(__FILE__)}/companyname_playmo/recipes/*_recipe.rb"].each { |f| require f }
+end
+```
+__... to be continued ...__
-__... to be continued ...__
\ No newline at end of file
+# Problem officer?
+
+Playmo uses Rails 3.1.3 for now. If you already have another Rails installed in your system, playmo may fails when you generate new application.
+
+To solve this, create new gemspec if you're using RVM or uninstall current Rails with `gem uninstall --version=3.2.1` (change version to your Rails version).
+