<commit_before>= RailsSetup

Provides scripts and tasks to setup your rails environment

== Install

  ./script/plugin install git://github.com/albanpeignier/rails_setup.git

    create script/rails_setup
    create script/rake_with_rails_setup

== Example

Setup your rails environment in a single command:

  ./script/rails_setup

  check if rails gems are needed ...
  install rails 2.2.2
  sudo gem install rails --version 2.2.2
  Successfully installed rake-0.8.3
  Successfully installed activesupport-2.2.2
  Successfully installed activerecord-2.2.2
  Successfully installed actionpack-2.2.2
  Successfully installed actionmailer-2.2.2
  Successfully installed activeresource-2.2.2
  Successfully installed rails-2.2.2
  7 gems installed
  check if database gems are needed ...
  sudo apt-get install --yes ruby-dev libpq-dev
  sudo gem install postgres
  Building native extensions.  This could take a while...
  Successfully installed postgres-0.7.9.2008.01.28
  1 gem installed
  check if configured gems are needed ...
  rake gems:install_with_sudo
  (in /home/alban/skyline)
  
    Warning: You have rspec rake tasks installed in
    /home/alban/skyline/lib/tasks/rspec.rake,
    but rspec can not be found in vendor/gems, vendor/plugins or on the system.
  
  sudo gem install rspec-rails
  Successfully installed rspec-1.1.12
  Successfully installed rspec-rails-1.1.12
  2 gems installed
  
Setup your rails environment before running a rake task:

  ./script/rake_with_rails_setup cruise

  check if rails gems are needed ...
  check if configured gems are needed ...
  rake gems:install_with_sudo
  rake cruise

Install your configured gems with sudo:

  rake gems:install_with_sudo

== CruiseControl.rb integration

To use rake_with_rails_setup in Cruisecontrol.rb

  Project.configure do |project|

    # ...

    project.build_command = './script/rake_with_rails_setup cruise'
 
  end

Allow the cruisecontrol daemon to run sudo gem, in /etc/sudoers:

  ccontrolrb ALL=NOPASSWD: /usr/bin/gem

See http://cruisecontrolrb.thoughtworks.com/

Copyright (c) 2009 <NAME>, released under the MIT license<commit_msg>Improve README.rdoc with features details<commit_after>= RailsSetup

Provides scripts and tasks to setup your rails environment

== Install

  ./script/plugin install git://github.com/albanpeignier/rails_setup.git

    create script/rails_setup
    create script/rake_with_rails_setup

== Features

=== Install rails gems

+rails_setup+ install gems required by the config/boot.rb of your project.

*How*: +rails_setup+ loads boot.rb and intercepts Kernel.gem LoadError on 'rails' gem. The required gem is silently installed.

=== Install database gems

+rails_setup+ install gems required by the database adapters configured into the database.yml of your project. 

*How*:  +rails_setup+ loads environment.rb and intercepts the error "Please install the xyz adapter". The required gem(s) is deduced from the adapter name.

A rake task 'gems:db:prerequisites' is invoked before the database gem install to install system libraries if needed. For example :

  namespace :gems do
    namespace :db do
      task :prerequisites do
        packages = []

        case ENV['ADAPTER_GEMS']
        when 'postgres'
          packages << 'libpq-dev'
        end

        sh "apt-get install --yes #{packages.join(',')}"
      end
    end
  end

*Note*: the supported adapters list is really short for the moment. Contributions are welcome ;)

=== Install configured gems

+rails_setup+ simply uses the Rails Gem dependencies support. A rake task +gem:install_with_sudo+ is provided to make easier this operation for normal users.

=== Setup before rask tasks

+rake_with_rails_setup+ runs rails setup before executing specified rake tasks.

=== Sudo support

By default, all these operations are performed by using +sudo+. RailsSetup.use_sudo controls this behaviour (no command line for the moment).

== Example

Setup your rails environment in a single command:

  ./script/rails_setup

  check if rails gems are needed ...
  install rails 2.2.2
  sudo gem install rails --version 2.2.2
  Successfully installed rake-0.8.3
  Successfully installed activesupport-2.2.2
  Successfully installed activerecord-2.2.2
  Successfully installed actionpack-2.2.2
  Successfully installed actionmailer-2.2.2
  Successfully installed activeresource-2.2.2
  Successfully installed rails-2.2.2
  7 gems installed
  check if database gems are needed ...
  sudo apt-get install --yes ruby-dev libpq-dev
  sudo gem install postgres
  Building native extensions.  This could take a while...
  Successfully installed postgres-0.7.9.2008.01.28
  1 gem installed
  check if configured gems are needed ...
  rake gems:install_with_sudo
  (in /home/alban/skyline)
  
    Warning: You have rspec rake tasks installed in
    /home/alban/skyline/lib/tasks/rspec.rake,
    but rspec can not be found in vendor/gems, vendor/plugins or on the system.
  
  sudo gem install rspec-rails
  Successfully installed rspec-1.1.12
  Successfully installed rspec-rails-1.1.12
  2 gems installed
  
Setup your rails environment before running a rake task:

  ./script/rake_with_rails_setup cruise

  check if rails gems are needed ...
  check if configured gems are needed ...
  rake gems:install_with_sudo
  rake cruise

Install your configured gems with +sudo+:

  rake gems:install_with_sudo

== CruiseControl.rb integration

To use +rake_with_rails_setup+ in Cruisecontrol.rb

  Project.configure do |project|

    # ...

    project.build_command = './script/rake_with_rails_setup cruise'
 
  end

Allow the cruisecontrol daemon to run sudo gem, in /etc/sudoers:

  ccontrolrb ALL=NOPASSWD: /usr/bin/gem

See http://cruisecontrolrb.thoughtworks.com/

Copyright (c) 2009 <NAME>, released under the MIT license
{'fraction_non_alphanumeric': 0.07261124525698517, 'fraction_numerical': 0.018282166264229044, 'mean_word_length': 3.569739952718676, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1615803', 'n_tokens_mistral': 1861, 'n_tokens_neox': 1663, 'n_words': 624}