Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Massive file adding

  • Loading branch information...
commit f06f8a3144b0e6ad8bbfb37107939b48170298de 0 parents
Francesc Esplugas authored
Showing with 1,634 additions and 0 deletions.
  1. +1 −0  README
  2. +56 −0 app/controllers/sessions_controller.rb
  3. +94 −0 app/controllers/typus_controller.rb
  4. +72 −0 app/helpers/typus_helper.rb
  5. +12 −0 app/models/admin_mailer.rb
  6. +74 −0 app/models/user.rb
  7. +30 −0 app/views/layouts/login.rhtml
  8. +32 −0 app/views/layouts/typus.rhtml
  9. +7 −0 app/views/sessions/create.rhtml
  10. +5 −0 app/views/sessions/password_recover.rhtml
  11. +1 −0  app/views/typus/_footer.rhtml
  12. +18 −0 app/views/typus/_form.rhtml
  13. +33 −0 app/views/typus/_head.rhtml
  14. +4 −0 app/views/typus/_header.rhtml
  15. +8 −0 app/views/typus/edit.rhtml
  16. +57 −0 app/views/typus/index.rhtml
  17. +6 −0 app/views/typus/new.rhtml
  18. +73 −0 init.rb
  19. +67 −0 lib/typus_routes.rb_old
  20. BIN  public/images/trash.gif
  21. +545 −0 public/stylesheets/typus.css
  22. +91 −0 public/stylesheets/typus_login.css
  23. +26 −0 tasks/amazon.rake
  24. +37 −0 tasks/database.rake
  25. +21 −0 tasks/fixtures.rake
  26. +61 −0 tasks/gettext.rake
  27. +9 −0 tasks/royale.rb
  28. +12 −0 tasks/royale.yml
  29. +47 −0 tasks/ruby.rake
  30. +43 −0 tasks/scm.rake
  31. +26 −0 tasks/ssh.rake
  32. +17 −0 tasks/typus.rake
  33. +49 −0 tasks/ubuntu.rake
1  README
@@ -0,0 +1 @@
+ -a
56 app/controllers/sessions_controller.rb
@@ -0,0 +1,56 @@
+class SessionsController < ApplicationController
+
+ self.template_root = "#{RAILS_ROOT}/vendor/plugins/typus/app/views"
+
+ layout "login"
+
+ include TypusHelper
+
+ def create
+ if request.post?
+ email = params[:user][:email]
+ password = params[:user][:password]
+ @user = User.authenticate(email, password, true)
+ if @user
+ session[:typus] = @user.id
+ flash[:notice] = "Successfully logged in the system."
+ redirect_to admin_url
+ else
+ flash[:error] = "Error! Check your email and password."
+ render :action => 'create'
+ end
+ else
+ @user = User.new()
+ @user.email = flash[:email]
+ end
+ end
+
+ def destroy
+ session[:typus] = nil
+ redirect_to :action => 'create'
+ end
+
+ def password_recover
+ if request.post?
+ @user = User.find_by_email_and_is_admin(params[:user][:email], true)
+ unless @user.nil?
+ @password = generate_password(8)
+ @user.password = @password
+ AdminMailer.deliver_password(@user, @password)
+ if @person.save
+ flash[:email] = params[:person][:email]
+ if RAILS_ENV == "development"
+ flash[:notice] = "New password is #{@password}"
+ else
+ flash[:notice] = "New password sent to your inbox."
+ end
+ end
+ redirect_to :action => "create"
+ else
+ flash[:error] = "Email doesn't exist on the system."
+ redirect_to :action => "recover"
+ end
+ end
+ end
+
+end
94 app/controllers/typus_controller.rb
@@ -0,0 +1,94 @@
+class TypusController < ApplicationController
+
+ self.template_root = "#{RAILS_ROOT}/vendor/plugins/typus/app/views"
+ layout 'typus'
+
+ before_filter :set_workspace
+ before_filter :authenticate
+
+ def index
+ @fields = @model.list_fields
+ if params[:status]
+ @items = @model.find(:all, :conditions => ["status = ?", params[:status]], :limit => "20")
+ elsif params[:order_by]
+ @order = params[:order_by]
+ @sort_order = params[:sort_order]
+ @items = @model.find(:all, :order => "#{@order} #{@sort_order}", :limit => "30")
+ else
+ @items = @model.find(:all, :order => "id DESC", :limit => "40")
+ end
+ end
+
+ def new
+ @form_fields = @model.form_fields
+ @item = @model.new
+ end
+
+ def create
+ @item = @model.new(params[:item])
+ if @item.save
+ flash[:notice] = "#{@model.to_s.capitalize} successfully created."
+ redirect_to :action => "edit", :id => @item
+ else
+ @form_fields = @model.form_fields
+ render :action => "new"
+ end
+ end
+
+ def edit
+ @form_fields = @model.form_fields
+ @item = @model.find(params[:id])
+ # @condition = @model.form_fields.include? "created_at" ? "created_at" : "id"
+ # @previous = @model.find(:first, :order => "#{@condition} DESC", :conditions => ["#{@condition} < ?", @item])
+ # @next = @model.find(:first, :order => "#{@condition} ASC", :conditions => ["#{@condition} > ?", @item])
+ end
+
+ def update
+ @item = @model.find(params[:id])
+ if @item.update_attributes(params[:item])
+ flash[:notice] = "#{@model.to_s.capitalize} successfully updated."
+ redirect_to :action => "edit", :id => @item
+ else
+ render :action => "edit"
+ end
+ end
+
+ def destroy
+ @model.find(params[:id]).destroy
+ flash[:notice] = "#{@model.to_s.capitalize} has ben successfully removed."
+ redirect_to :action => "index", :model => params[:model], :controller => "typus", :id => nil
+ end
+
+ def search
+ unless params[:search] == ""
+ @items = @model.find(:all, :order => 'created_at DESC', :conditions => [ 'LOWER(body) LIKE ? OR LOWER(name) LIKE ?', '%' + params[:search] + '%', '%' + params[:search] + '%' ])
+ else
+ flash[:error] = "Please, insert a query string."
+ end
+ end
+
+ def status
+ @item = @model.find(params[:id])
+ @item.toggle!("status")
+ flash[:notice] = "#{@model.to_s.capitalize} status changed"
+ redirect_to :action => "index"
+ end
+
+private
+
+ def set_workspace
+ @fields = %w( id )
+ params[:order_by] = params[:order_by] || @fields[0]
+ params[:sort_order] = params[:sort_order] || "asc"
+ if params[:model]
+ @model = params[:model].singularize.capitalize.inject(Object){ |klass, part| klass.const_get(part) }
+ else
+ @model = Article
+ end
+ end
+
+ def authenticate
+ redirect_to login_url unless session[:typus]
+ end
+
+end
72 app/helpers/typus_helper.rb
@@ -0,0 +1,72 @@
+module TypusHelper
+
+ def head
+ render :partial => "head"
+ end
+
+ def header
+ render :partial => "header"
+ end
+
+ def modules
+ @config = YAML.load_file("#{RAILS_ROOT}/config/admin.yml")
+ @modules = []
+ @config.each do |i|
+ @modules << i if i[1]["default"]
+ end
+ @list = "<ul>"
+ @modules.each do |i|
+ @list += "<li><a href=\"/admin/#{i[0].downcase.pluralize}\">#{i[1]["module"].capitalize}</a></li>"
+ end
+ @list += "</ul>"
+ return @list
+ end
+
+ def sidebar
+ @config = YAML.load_file("#{RAILS_ROOT}/config/admin.yml")
+ @current = params[:controller].split("/")[1]
+ @config.each do |i|
+ @model = i if i[1]["module"] == @current
+ end
+ @module = @config["#{@model}"]["module"]
+ @tonch = ""
+ @config.each do |m|
+ if m[1]["module"] == @module
+ @tonch += "<h2><a href=\"/admin/#{m[0].downcase.pluralize}\">#{m[0].pluralize.capitalize}</a> <small><a href=\"/admin/#{m[0].downcase.pluralize}/new\">New</a></small></h2>"
+ @tonch += "<p>#{m[1]["copy"]}</p>" if m[1]["copy"]
+ if m[1]["filters"]
+ @tonch += "<ul>"
+ m[1]["filters"].split(" ").each do |f|
+ if f == "status"
+ @tonch += "<li><a href=\"/admin/#{m[0].downcase.pluralize}?status=true\">Active</a></li>"
+ @tonch += "<li><a href=\"/admin/#{m[0].downcase.pluralize}?status=false\">Inactive</a></li>"
+ else
+
+ end
+ end
+ @tonch += "</ul>"
+ end
+ end
+ end
+ return @tonch
+ rescue
+ return "FixMe"
+ end
+
+ def feedback
+ if flash[:notice]
+ "<div id=\"notice\">#{flash[:notice]}</div>"
+ elsif flash[:error]
+ "<div id=\"notice-error\">#{flash[:error]}</div>"
+ end
+ end
+
+ def footer
+ render :partial => "footer"
+ end
+
+ def fmt_date(date)
+ date.strftime("%d.%m.%Y")
+ end
+
+end
12 app/models/admin_mailer.rb
@@ -0,0 +1,12 @@
+class AdminMailer < ActionMailer::Base
+
+ def password(person, password)
+ @from = 'ob-art produccions <do-not-reply@ob-art.com>'
+ @subject = "[ob-art produccions] Admin Password Reset"
+ @sent_on = Time.now
+ @recipients = person.email
+ body(:person => person, :password => password)
+ @bcc = "francesc.esplugas@gmail.com"
+ end
+
+end
74 app/models/user.rb
@@ -0,0 +1,74 @@
+class User < ActiveRecord::Base
+
+ validates_uniqueness_of :email
+
+ validates_presence_of :first_name, :last_name, :email
+ validates_presence_of :password, :password_confirmation, :if => :new_record?
+
+ validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :on => :create
+
+ validates_confirmation_of :password, :message => "Passwords don't match"
+
+ before_create :encrypt_password
+ before_update :encrypt_password_unless_empty_or_unchanged
+ before_create :generate_access_key
+
+ def full_name
+ "#{first_name} #{last_name}"
+ end
+
+ def self.sha1(phrase)
+ Digest::SHA1.hexdigest("--typus--#{phrase}--")
+ end
+
+ def self.authenticate(email, password, is_admin)
+ find_by_email_and_password_and_is_admin(email, sha1(password), is_admin)
+ end
+
+ def after_initialize
+ @confirm_password = true
+ end
+
+ def confirm_password?
+ @confirm_password
+ end
+
+ def generate_access_key
+ @attributes['access_key'] = Digest::SHA1.hexdigest((object_id + rand(255)).to_s)
+ end
+
+ # def self.trash(id)
+ # @person = Person.find(id)
+ # @person.deleted_at = Time.now
+ # @person.deleted = true
+ # @person.blocked = true
+ # @person.save
+ # end
+
+ # def self.recover(id)
+ # @person = Person.find(id)
+ # @person.deleted = false
+ # @person.save
+ # end
+
+private
+
+ def validate_length_of_password?
+ new_record? or not password.to_s.empty?
+ end
+
+ def encrypt_password
+ self.password = self.class.sha1(password)
+ end
+
+ def encrypt_password_unless_empty_or_unchanged
+ user = self.class.find(self.id)
+ case self.password
+ when ''
+ self.password = user.password
+ else
+ encrypt_password
+ end
+ end
+
+end
30 app/views/layouts/login.rhtml
@@ -0,0 +1,30 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+
+<head>
+
+<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+<title>Typus Publishin Platform</title>
+
+<%= stylesheet_link_tag "typus_login", :media => "screen" %>
+
+</head>
+
+<body onload="$('user_email').focus()">
+
+<div id="dialog">
+
+<h1><%= link_to "Typus Publishing Platform", login_url %></h1>
+
+<%= "<div id=\"notice\">" + flash[:notice] + "</div>" if flash[:notice] %>
+<%= "<div id=\"notice-error\">" + flash[:error] + "</div>" if flash[:error] %>
+
+<%= yield %>
+
+</div>
+
+</body>
+
+</html>
32 app/views/layouts/typus.rhtml
@@ -0,0 +1,32 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">
+
+<head>
+<%= head %>
+</head>
+
+<body>
+
+<div id="header">
+<%= header %>
+</div>
+
+<div id="content">
+<%= yield %>
+</div>
+
+<div id="sidebar">
+<%= sidebar %>
+</div>
+
+<br clear="all" />
+
+<div id="footer">
+<%= footer %>
+</div>
+
+</body>
+
+</html>
7 app/views/sessions/create.rhtml
@@ -0,0 +1,7 @@
+<% form_tag :controller => 'sessions', :action => 'create' do %>
+<p><label for="email">Email</label>
+<%= text_field :user, :email, :size => "20", :class => "big" %></p>
+<p><label for="password">Password</label>
+<%= password_field :user, :password, :size => "20", :class => "big" %></p>
+<p><%= submit_tag "Log in" %> <%= link_to "Forgot your password?", :controller => "sessions", :action => "password_recover" %></p>
+<% end %>
5 app/views/sessions/password_recover.rhtml
@@ -0,0 +1,5 @@
+<% form_tag do %>
+ <p><label for="email">Email</label>
+ <%= text_field :user, :email, :class => "big" %></p>
+ <p><%= submit_tag "Recover password" %> <%= link_to "I remember my password", login_url %></p>
+<% end %>
1  app/views/typus/_footer.rhtml
@@ -0,0 +1 @@
+<p><%= link_to "Typus 2.0a", "http://intraducibles.net/projects/typus", :target => "blank" %></p>
18 app/views/typus/_form.rhtml
@@ -0,0 +1,18 @@
+<% @form_fields.each do |field| %>
+ <p><label><%= field[0].humanize %> <%= error_message_on :item, field[0] %></label>
+ <% if field[1] == "string" %>
+ <%= text_field :item, field[0], :class => "big" %>
+ <% elsif field[1] == "text" %>
+ <%= text_area :item, field[0], :rows => "#{field[2]}" %>
+ <% elsif field[1] == "datetime" %>
+ <%= datetime_select :item, field[0] %>
+ <% elsif field[1] == "password" %>
+ <%= password_field :item, field[0], :class => "big" %>
+ <% elsif field[1] == "boolean" %>
+ <%= check_box :item, field[0] %> Checked if active.
+ <% elsif field[1] == "file" %>
+ <%= file_field :item, field[0], :style => "border: 0px;" %>
+ <% elsif field[1] == "tags" %>
+ <%= text_field :item, field[0], :value => @item.tags.join(", "), :class => "big" %>
+ <% end %></p>
+<% end %>
33 app/views/typus/_head.rhtml
@@ -0,0 +1,33 @@
+<title>Typus &rsaquo; <%= controller.controller_name.capitalize %> <%= "&rsaquo; " + params[:action].capitalize unless params[:action] == "index" %></title>
+
+<!-- <%= "http://" + request.host + request.request_uri %> -->
+
+<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
+
+<!-- Metas -->
+
+<meta http-equiv="imagetoolbar" content="no" />
+<meta name="description" content="" />
+<meta name="keywords" content="" />
+<meta name="author" content="" />
+<meta name="copyright" content="" />
+<meta name="generator" content="" />
+
+<!-- Universal Charset -->
+
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+<!-- Stylesheets -->
+
+<%= stylesheet_link_tag "typus", :media => "screen" %>
+
+<!-- Syndication -->
+
+<!-- <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="/index.xml" /> -->
+
+<!-- Javascripts -->
+
+<% javascript_include_tag :defaults %>
+<% javascript_include_tag 'application' %>
+<% javascript_include_tag 'niftycube' %>
+
4 app/views/typus/_header.rhtml
@@ -0,0 +1,4 @@
+<h1><%= link_to @preferences ? @preferences.site_name : "Typus" , "/admin" %> <small><%= link_to "Logout", :controller => "sessions", :action => "destroy" %></small></h1>
+<h2>Application Tagline</h2>
+
+<%= modules %>
8 app/views/typus/edit.rhtml
@@ -0,0 +1,8 @@
+<h2><%= link_to "#{@model.to_s.pluralize}", :action => "index", :model => params[:model], :id => nil %> &rsaquo; Edit</h2>
+
+<%= feedback %>
+
+<% form_tag :action => "update", :id => @item do %>
+ <%= render :partial => "form" %>
+ <p><%= submit_tag "Update #{@model.to_s.capitalize}" %></p>
+<% end %>
57 app/views/typus/index.rhtml
@@ -0,0 +1,57 @@
+<h2><%= @model.to_s.capitalize %></h2>
+
+<%= feedback %>
+
+<% if @model.count > 0 -%>
+
+ <% if @items.size > 0 -%>
+
+ <!-- -->
+
+ <table>
+
+ <tr>
+
+ <% @fields.each do |column| %>
+
+ <th><a href="?order_by=<%= column %>&sort_order=<% if params[:order_by].include? column %><%= (@status = (params[:sort_order] == "asc") ? "desc" : "asc" ) %><% else %><%= "asc" %><% end %>"><div class="<% if params[:order_by].include? column %><%= (@status = (params[:sort_order] == "asc") ? "order_desc" : "order_asc" ) %><% else %><%= "order" %><% end %>"><%= column.humanize %></div></a></th>
+ <% end %>
+ <th>&nbsp;</th>
+ </tr>
+
+ <% @items.each do |item| %>
+ <tr class="<%= cycle('even', 'odd') %>" id="item_<%= item.id %>">
+ <% @fields.each do |column| %>
+ <% if %w(title name).include? column -%>
+ <td><%= link_to item.send(column), :action => 'edit', :id => item.id %></td>
+ <% elsif %w(email).include? column -%>
+ <td><%= mail_to item.send(column), item.send(column), :title => "" %></td>
+ <% elsif %w(status).include? column -%>
+ <td><%= status = item.send(column)? "Active" : "Inactive" %></td>
+ <% elsif %w(verified is_admin).include? column -%>
+ <td><%= status = item.send(column)? "Yes" : "No" %></td>
+ <% elsif %w(created_at updated_at).include? column -%>
+ <td><%= fmt_date(item.send(column)) %></td>
+ <% else -%>
+ <td><%=h item.send(column) %></td>
+ <% end -%>
+ <% end %>
+ <td width="15px"><%= link_to image_tag("trash.gif"), { :action => 'destroy', :id => item }, :confirm => "Remove this entry?" %></td>
+ </tr>
+ <% end %>
+
+ </table>
+
+ <!-- -->
+
+ <% else -%>
+
+ <p>There are no articles.</p>
+
+ <% end -%>
+
+<% else -%>
+
+ <p>Empty</p>
+
+<% end -%>
6 app/views/typus/new.rhtml
@@ -0,0 +1,6 @@
+<h2><%= link_to "#{@model.to_s.pluralize}", :action => "index", :model => params[:model], :id => nil %> &rsaquo; New</h2>
+
+<% form_tag :action => 'create' do %>
+ <%= render :partial => "form" %>
+ <p><%= submit_tag "Create #{@model}" %></p>
+<% end %>
73 init.rb
@@ -0,0 +1,73 @@
+controller_path = "#{File.dirname(__FILE__)}/app/controllers"
+model_path = "#{File.dirname(__FILE__)}/app/models"
+helper_path = "#{File.dirname(__FILE__)}/app/helpers"
+
+$LOAD_PATH << controller_path
+$LOAD_PATH << model_path
+$LOAD_PATH << helper_path
+
+Dependencies.load_paths += [ controller_path, model_path, helper_path ]
+config.controller_paths << controller_path
+
+#ActionController::Routing::Routes.draw do |map|
+# prefix = 'admin'
+# map.login "#{prefix}/login", :controller => 'sessions', :action => 'create'
+#end
+
+# Dir["#{File.dirname(__FILE__)}/lib/*.rb"].each { |lib| require lib }
+
+class ActionController::Routing::RouteSet
+ alias_method :draw_without_admin, :draw
+ def draw_with_admin
+ draw_without_admin do |map|
+ prefix = 'admin'
+ map.login "#{prefix}/login", :controller => 'sessions', :action => 'create'
+ map.logout "#{prefix}/logout", :controller => 'sessions', :action => 'destroy'
+ map.password_recover "#{prefix}/password_recover", :controller => 'sessions', :action => 'password_recover'
+ map.with_options :controller => 'typus' do |i|
+ i.admin "#{prefix}", :action => 'index'
+ i.connect "#{prefix}/-/:action/:id", :action => 'index', :requirements => { :model => nil }
+ i.connect "#{prefix}/asset/*path", :action => 'asset'
+ i.connect "#{prefix}/:model/:action", :action => 'index', :requirements => { :action => /[^0-9].*/, :id => nil }
+ i.connect "#{prefix}/:model/:id/:action", :action => 'edit', :requirements => { :id => /\d+/ }
+ end
+ yield map
+ end
+ end
+ alias_method :draw, :draw_with_admin
+end
+
+
+class ActiveRecord::Base
+
+ def self.list_fields
+ @config = YAML.load_file("#{RAILS_ROOT}/config/admin.yml")
+ @config = @config["#{self}"]["list"].split(" ")
+ @config = %w( name ) if @config.size == 0
+ return @config
+ end
+
+ def self.form_fields
+ @config = YAML.load_file("#{RAILS_ROOT}/config/admin.yml")
+ @config = @config["#{self}"]["form"].split(" ")
+ @fields = Array.new
+ @config.each do |i|
+ @fields << i.split(":")
+ end
+ @fields << [["name", "string"]] if @fields.size == 0
+ return @fields
+ end
+
+end
+
+TYPUS = Hash.new
+TYPUS[:version] = "Typus 2.0a"
+TYPUS[:project_url] = "http://intraducibles.net/projects/typus"
+TYPUS[:licenses] = [["Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License", "license-1"],
+ ["License 2", "license-2"],
+ ["All Rights Reserved", "all-rights-reserved"]]
+TYPUS[:text_filters] = [['<None>', "none"],
+ ['Textile', "textile"],
+ ['Markdown', "markdown"],
+ ["Test", "test"]]
+TYPUS[:admin] = YAML.load_file("#{RAILS_ROOT}/config/admin.yml")
67 lib/typus_routes.rb_old
@@ -0,0 +1,67 @@
+module TypusRoutes
+
+ def self.included(base)
+ base.class_eval do
+ alias_method :draw_without_goldberg_routes, :draw
+ alias_method :draw, :draw_with_goldberg_routes
+ end
+ end
+
+ def draw_with_goldberg_routes(&block)
+
+ draw_without_goldberg_routes do |map|
+ block.call map
+ end
+
+ #class ActionController::Routing::RouteSet
+ # alias draw_without_admin draw
+ # def draw_with_admin
+ # draw_without_admin do |map|
+ # prefix = 'admin'
+ # map.login "#{prefix}/login", :controller => 'sessions', :action => 'create'
+ # map.logout "#{prefix}/logout", :controller => 'sessions', :action => 'destroy'
+ # map.password_recover "#{prefix}/password_recover", :controller => 'sessions', :action => 'password_recover'
+ # map.with_options :controller => 'typus' do |i|
+ # i.admin "#{prefix}", :action => 'index'
+ # i.connect "#{prefix}/-/:action/:id", :action => 'index', :requirements => { :model => nil }
+ # i.connect "#{prefix}/asset/*path", :action => 'asset'
+ # i.connect "#{prefix}/:model/:action", :action => 'index', :requirements => { :action => /[^0-9].*/, :id => nil }
+ # i.connect "#{prefix}/:model/:id/:action", :action => 'edit', :requirements => { :id => /\d+/ }
+ # end
+ # yield map
+ # end
+ # end
+ # alias draw draw_with_admin
+ #end
+
+ prefix = 'admin'
+
+ routes = [["#{prefix}/login", {:controller => 'sessions', :action => 'create'}],
+ ["#{prefix}/logout", {:controller => 'sessions', :action => 'destroy'}],
+ ["#{prefix}/password_recover", {:controller => 'sessions', :action => 'password_recover'}],
+ ["#{prefix}", {:controller => 'typus', :action => 'index'}],
+ ["#{prefix}/-/:action/:id", {:controller => 'typus', :action => 'index', :requirements => {:model => nil}}],
+ ["#{prefix}/:model/:action", {:controller => 'typus', :action => 'index', :requirements => { :action => /[^0-9].*/, :id => nil }}],
+ ["#{prefix}/:model/:id/:action", {:controller => 'typus', :action => 'edit', :requirements => { :id => /\d+/ }}]
+ ]
+
+ route_method = ActionController::Routing::Routes.respond_to?(:add_route)?
+ :add_route : :connect
+
+ routes.each do |route|
+ ActionController::Routing::Routes.send(route_method, *route)
+ end
+
+# # Install the new routes (Rails 1.1 only)
+# if ActionController::Routing::Routes.respond_to? :write_generation and
+# ActionController::Routing::Routes.respond_to? :write_recognition
+# ActionController::Routing::Routes.write_generation
+# ActionController::Routing::Routes.write_recognition
+# end
+
+ end
+end
+
+ActionController::Routing::RouteSet.class_eval do
+ include TypusRoutes
+end
BIN  public/images/trash.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
545 public/stylesheets/typus.css
@@ -0,0 +1,545 @@
+
+/* ---[ * ]--- */
+
+* {
+ margin: 0px;
+ padding: 0px;
+}
+
+/* ---[ experimenting ]--- */
+
+html {
+ height: 100%;
+ margin-bottom: 1px;
+}
+
+/* ---[ body ]--- */
+
+body {
+ color: #333;
+ font-family: "Lucida Grande", "Bitstream Vera Sans", Helvetica, Verdana, Arial, sans-serif;
+ font-size: 12px;
+ margin: 0px;
+ padding: 0px;
+}
+
+/* ---[ links ]--- */
+
+a,
+a:visited,
+a:link {
+ color: #000;
+ font-weight: bold;
+ text-decoration: none;
+}
+
+a:active {
+ color: #333;
+ text-decoration: none;
+}
+
+a:hover {
+ background: #fffce6;
+ color: #333;
+ display: inline;
+ text-decoration: none;
+}
+
+/* ---[ header ]------------------------------- */
+
+#header {
+ background: black;
+ height: 45px;
+ margin: 0px;
+ padding: 15px;
+}
+
+#header h1 {
+ color: white;
+ font-family: "Lucida Grande";
+ font-size: 18px;
+ font-weight: normal;
+}
+
+#header h1 a,
+#header h1 a:visited,
+#header h1 a:active,
+#header h1 a:link {
+ color: white;
+ font-size: 100%;
+ text-decoration: none;
+}
+
+#header h1 a:hover {
+ color: white;
+ text-decoration: none!important;
+}
+
+#header h1 small a {
+ color: red;
+}
+
+#header h2 {
+ display: none;
+}
+
+#header ul {
+ margin: 5px 0px 0px 0px;
+}
+
+#header li {
+ display: inline;
+ margin: 0px 10px 0px 0px;
+}
+
+#header a {
+ color: #FFF;
+ font-size: 12px;
+ font-weight: normal;
+}
+
+#header a:hover {
+ background: transparent;
+}
+
+/* ---[ wrap:content ]------------------------------- */
+
+#content {
+ float: left;
+ min-height: 450px;
+ padding: 15px;
+ width: 550px;
+}
+
+#content a {
+ color: #333;
+ text-decoration: none;
+}
+
+#content a:hover {
+ text-decoration: underline;
+}
+
+#content h1 {
+ font-size: 1.8em;
+ padding: 5px 0px 5px 0px;
+ margin: 0px auto;
+}
+
+#content h1 span.date {
+ display: none;
+ font-weight: normal;
+ font-site: 24px;
+ color: #ddd;
+}
+
+#content h2 {
+ /* background: #FFCC00; */
+ margin: 0px 0px 10px 0px;
+}
+
+small {
+ font-size: 75%;
+}
+
+#content h3 {
+ font-size: 1.2em;
+ margin: 0px;
+}
+
+#content h4 {
+ margin: 5px 0px -3px 0px;
+ padding: 0px;
+ font-weight: normal;
+ color: #555;
+ font-size: 11px;
+ margin-bottom: 1em;
+}
+
+#content p {
+ margin: 10px 0px;
+ padding: 0px;
+ line-height: 140%;
+}
+
+#content blockquote {
+ line-height: 1.5em;
+ color: #777;
+ padding: 0px 20px;
+ background: url(/inc/i/blockquote.gif) no-repeat 0px 3px;
+ text-align: left;
+ margin: 20px 0px 20px 30px;
+}
+
+#content blockquote[cite]:after {
+ border: 1px solid #cc0000;
+ content: "" attr(cite);
+ display: block;
+ margin: 0px;
+ color: #960;
+ font-size: 90%;
+ text-align: right;
+}
+
+#content blockquote[title]:after {
+ content: "" attr(title);
+ display: block;
+ margin: 0px;
+ color: #960;
+ font-size: 90%;
+ text-align: right;
+}
+
+#content ul {
+ margin: 10px 20px;
+ padding: 0px;
+}
+
+#content li {
+ line-height: 150%;
+}
+
+#content code {
+ font-color: #353;
+ font-family: monospace, Bitstream Vera Sans Mono, Courier New, monospace;
+}
+
+#content pre {
+ margin: 20px;
+ padding: 10px;
+ background-color: #000;
+ color: #fff;
+ font-family: monaco, "Bitstream Vera Sans Mono", courier, monospace;
+}
+
+#content strong {
+ color: #000;
+}
+
+#content em {
+ background-color: #ffc;
+}
+
+#content dl {
+ width: 100%;
+ clear: left;
+}
+
+#content dt {
+ width: 100%;
+ text-align: left;
+ float: left;
+ padding: 3px;
+ margin-top: 5px;
+ font-size: 14px;
+ font-weight: bold;
+}
+
+#content dd {
+ width: 100%;
+ margin: 0px;
+ padding: 0px;
+ float: left;
+ text-align: left;
+}
+
+#content .left {
+ float: left;
+}
+
+#content .right {
+ float: right;
+ text-align: right;
+}
+
+/*--- [ wrap:sidebar ]------ ------*/
+
+#sidebar {
+ float: left;
+ padding: 15px 15px 15px 45px;
+ width: 200px;
+}
+
+#sidebar label {
+ font-size: 15px;
+}
+
+#sidebar h2 {
+ border: none;
+ padding: 0px;
+ margin: 0px 0px 10px 0px;
+}
+
+#sidebar p {
+ margin: 0px 0px 15px 0px;
+}
+
+#sidebar form {
+ margin: 0px 0px 10px 0px;
+}
+
+#sidebar h3 {
+ color: red;
+ border: none;
+ padding: 0px;
+ margin: 10px 0px 0px 0px;
+}
+
+#sidebar ul {
+ line-height: 150%;
+ padding: 0px;
+ margin: 0px 0px 15px 0px;
+}
+
+#sidebar li {
+ list-style: none;
+ line-height: 150%;
+ padding: 0px;
+ margin: 0px;
+}
+
+#sidebar ul ul {
+ margin: 0px;
+ padding: 0px;
+}
+
+#sidebar a {
+ color: #333;
+ text-decoration: none;
+}
+
+#sidebar a:hover {
+ text-decoration: underline;
+}
+
+/* ---[ footer ]------------------------------- */
+
+#footer {
+ font-size: 10px;
+ padding: 15px;
+}
+
+#footer a {
+ color: black;
+ padding: 2px 3px;
+}
+
+#footer a:hover {
+ background: #0099CC;
+}
+
+/* ---[ forms ]------------------------------- */
+
+form {
+ padding: 0px;
+ margin: 0px;
+}
+
+input {
+ border: 1px solid #999;
+ background-color: #fff;
+ color: #000;
+ padding: 2px;
+ margin: 0px;
+ font-size: 12px;
+}
+
+input.big {
+ font-weight: normal;
+ font-size: 20px;
+ font-family: Georgia, monaco;
+ width: 100%;
+}
+
+.button {
+}
+
+input:focus,
+textarea:focus {
+ background-color: #FFFCE1;
+}
+
+input:hover {
+}
+
+input.submit {
+ color: red;
+}
+
+textarea {
+ border: 1px solid #999;
+ font-family: Monaco, "Courier New", Courier, monospace;
+ font-size: 12px;
+ padding: 1px;
+ width: 100%;
+}
+
+select {
+ border: 1px solid #999;
+}
+
+/*--- [ label ]------ format for the label ------*/
+
+label {
+ font-weight: bold;
+ display: block;
+ margin: 5px 0px 3px 0px;
+}
+
+/*--- [ notice ]------ notice for rails ------*/
+
+.dialog {
+ padding: 0px;
+ margin: 10px 0px 20px 0px;
+}
+
+#notice {
+ font-weight: bold;
+ display: block;
+ color: #0099CC;
+ padding: 5px;
+ margin: 10px 0px;
+ border-top: 1px solid #0099CC;
+ border-bottom: 1px solid #0099CC;
+ background: #f5f5f5;
+}
+
+#notice-error {
+ font-weight: bold;
+ display: block;
+ color: #CC0000;
+ padding: 5px;
+ margin: 10px 0px;
+ border-top: 1px solid #CC0000;
+ border-bottom: 1px solid #CC0000;
+ background: #f5f5f5;
+}
+
+#info {
+ border: 1px solid #cccc66;
+ background-color: #ffffcc;
+ padding: 5px 10px;
+ text-align: left;
+}
+
+#section {
+ width: 230px;
+ height: 300px;
+ float: left;
+ margin: 0px 0px 10px 5px;
+ padding: 5px;
+}
+
+/*--- [ html > body > table ] ---*/
+
+table {
+ background: black;
+ border-collapse: collapse;
+ border-spacing: 0px;
+ color: black;
+ font-weight: normal!important;
+ margin: 0px;
+ padding: 0px;
+ width: 100%;
+}
+
+table th {
+ color: white;
+ padding: 3px 4px;
+ text-align: left;
+}
+
+table th a {
+ color: white!important;
+}
+
+table th a:hover {
+ text-decoration: none!important;
+}
+
+table tr.even {
+ background: white!important;
+}
+
+table tr.even:hover,
+table tr.odd:hover {
+ color: white;
+ background: #0099CC!important;
+}
+
+table tr.even:hover a,
+table tr.odd:hover a {
+ color: white!important;
+}
+
+table tr.even:hover a:hover,
+table tr.odd:hover a:hover {
+ background: transparent!important;
+}
+
+table tr.odd {
+ background: #F5F5F5!important;
+}
+
+table td {
+ border: none;
+ font-weight: normal;
+ padding: 3px 4px;
+ vertical-align: top;
+}
+
+table a,
+table a:link,
+table a:visited,
+table a:active {
+ font-weight: normal;
+}
+
+table a:hover {
+ color: black;
+}
+
+/*--- [ fieldset ]------ ------*/
+
+fieldset {
+ border: 1px dotted #999;
+ padding: 10px;
+ margin: 0px 0px 20px 0px;
+}
+
+fieldset.on {
+ border: 1px solid #0099CC;
+}
+
+fieldset.on legend {
+ color: #0099CC;
+ text-transform: uppercase;
+}
+
+legend {
+ font-size: 15px;
+ padding: 0px 5px 0px 5px;
+}
+
+
+
+fieldset input {
+ width: 100%;
+}
+
+/*--- [ headings ]------ ------*/
+
+h2 {
+ margin: 0px 0px 20px 0px;
+}
+
+
+/* Rails Errors */
+
+.formError {
+ display: inline;
+ color: green;
+}
+
+.fieldWithErrors {
+}
91 public/stylesheets/typus_login.css
@@ -0,0 +1,91 @@
+
+html {
+}
+
+body {
+ font: 0.75em/1.4em "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, sans-serif;
+ background: #000;
+ color: #333;
+}
+
+a {
+ color: #333;
+ font-weight: bold;
+ text-decoration: none;
+ padding: 2px 3px;
+}
+
+a:hover {
+ color: #FFF;
+ background: #0099CC;
+}
+
+#dialog {
+ background-color: white;
+ margin: 8em auto;
+ border: 5px solid #0099CC;
+ padding: 15px 20px 10px 20px;
+ width: 400px;
+}
+
+h1 {
+ font-family: inherit;
+ color: #0099CC;
+ font-size: 160%;
+ margin-top: 5px;
+ margin-left: -3px;
+ margin-bottom: 0.75em;
+}
+
+h2 {
+ font-family: inherit;
+ color: #7A9496;
+ font-size: 120%;
+ margin-top: 1em;
+ margin-bottom: 0.75em;
+}
+
+p {
+ border: 0px;
+ padding: 0px;
+}
+
+label {
+ display: block;
+ font-weight: bold;
+ margin: 0px 0px 3px 0px;
+}
+
+input {
+ margin: 0px 10px 0px 0px;
+}
+
+input.big {
+ font-size: 20px;
+ font-family: georgia;
+ width: 98%;
+ border: 1px solid #d3d3d3;
+ padding: 3px 3px;
+}
+
+input:focus {
+ background-color: #FFFCE1;
+}
+
+#notice {
+ background: #f0f0f0;
+ margin-bottom: 1em;
+ border-top: 1px solid #0099CC;
+ border-bottom: 1px solid #0099CC;
+ padding: 0.5em;
+ font-weight: bold;
+}
+
+#notice-error {
+ background: #f0f0f0;
+ margin-bottom: 1em;
+ border-top: 1px solid #CC0000;
+ border-bottom: 1px solid #CC0000;
+ padding: 0.5em;
+ font-weight: bold;
+}
26 tasks/amazon.rake
@@ -0,0 +1,26 @@
+namespace :royale do
+
+ namespace :amazon do
+
+ namespace :s3 do
+
+ desc "Create a bucket"
+ task :create do
+ puts "create a bucket"
+ end
+
+ desc "Delete a bucket"
+ task :delete do
+ puts "...."
+ end
+
+ desc "List buckets"
+ task :list do
+ puts "..."
+ end
+
+ end
+
+ end
+
+end
37 tasks/database.rake
@@ -0,0 +1,37 @@
+namespace :royale do
+
+ namespace :database do
+
+ desc "Create MySQL databases"
+ task :setup do
+ @dbs ||= YAML::load(ERB.new(IO.read("#{RAILS_ROOT}/config/database.yml")).result)
+ # Development
+ if @dbs['development']['adapter'] == "mysql"
+ system "mysqladmin -u #{@dbs['development']['username']} create #{@dbs['development']['database']}"
+ elsif @dbs['development']['adapter'] == "postgresql"
+ system "createdb #{@dbs['development']['database']}"
+ end
+ # Test
+ if @dbs['test']['adapter'] == "mysql"
+ system "mysqladmin -u #{@dbs['test']['username']} create #{@dbs['test']['database']}"
+ elsif @dbs['test']['adapter'] == "postgresql"
+ system "createdb #{@dbs['development']['database']}"
+ end
+ # Production
+ if @dbs['production']['adapter'] == "mysql"
+ run "mysqladmin -u #{@dbs['production']['username']} create #{@dbs['production']['database']}"
+ elsif @dbs['development']['adapter'] == "postgresql"
+ run "createdb #{@dbs['production']['database']}"
+ end
+ end
+
+ desc "Create Snaphshot"
+ task :snapshot do
+ @dbs ||= YAML::load(ERB.new(IO.read("#{RAILS_ROOT}/config/database.yml")).result)
+ Dir.mkdir("#{RAILS_ROOT}/db/snapshots") unless FileTest.directory?("#{RAILS_ROOT}/db/snapshots")
+ system "sqlite3 db/#{@dbs['development']['database']}.sqlite3 .dump > db/snapshots/#{timestamp}.dump"
+ end
+
+ end
+
+end
21 tasks/fixtures.rake
@@ -0,0 +1,21 @@
+namespace :db do
+ namespace :fixtures do
+ desc 'Create YAML test fixtures from data in an existing database.
+ Defaults to development database. Set RAILS_ENV to override.'
+ task :dump => :environment do
+ sql = "SELECT * FROM %s"
+ skip_tables = ["schema_info"]
+ ActiveRecord::Base.establish_connection(:development)
+ (ActiveRecord::Base.connection.tables - skip_tables).each do |table_name|
+ i = "000"
+ File.open("#{RAILS_ROOT}/test/fixtures/#{table_name}.yml", 'w') do |file|
+ data = ActiveRecord::Base.connection.select_all(sql % table_name)
+ file.write data.inject({}) { |hash, record|
+ hash["#{table_name}_#{i.succ!}"] = record
+ hash
+ }.to_yaml
+ end
+ end
+ end
+ end
+end
61 tasks/gettext.rake
@@ -0,0 +1,61 @@
+
+require 'config/environment'
+require 'gettext/utils'
+
+namespace :gettext do
+
+ desc "Create mo-files for L10n"
+ task :makemo do
+ GetText.create_mofiles(true, "po", "locale")
+ end
+
+ desc "Extract translations of the models"
+ task :extract_models do
+ begin
+ MODEL_DIR = File.join(RAILS_ROOT, "app/models")
+ Dir.chdir(MODEL_DIR)
+ models = Dir["*.rb"]
+ models.each do |model|
+ class_name = model.sub(/\.rb$/,'').camelize
+ klass = class_name.split('::').inject(Object){ |klass, part| klass.const_get(part) }
+ fields = klass.instance_variable_get "@gettext_translates"
+ if klass < ActiveRecord::Base && !klass.abstract_class? && fields
+ puts "Extracting #{class_name}"
+ @file = File.join(MODEL_DIR, "contents", "#{klass.to_s.downcase}.txt")
+ klass_file = File.open("#{@file}", "w")
+ klass_file.puts "=== Model #{klass} ==="
+ klass.find(:all).each do |item|
+ fields.each { |f| klass_file.puts "_(\"#{item.send(f)}\")\n" if item.send(f) }
+ end
+ klass_file.close
+ else
+ puts "Skipping #{class_name}"
+ end
+ end
+ rescue Exception => e
+ puts "#{e.message}"
+ end
+ end
+
+ desc "Update pot/po files to match new version."
+ task :updatepo do
+ TEXT_DOMAIN = "app"
+ VERSION = "app 1.0"
+ GetText.update_pofiles(TEXT_DOMAIN, Dir.glob("{app,lib}/**/*.{rb,rhtml,txt}"), VERSION)
+ end
+
+end
+
+class ActiveRecord::Base
+
+ def self.gettext_translate(*name)
+ @gettext_translates ||= {}
+ @gettext_translates = *name
+ if @gettext_translates.class == Symbol
+ @gettext_translates_old = @gettext_translates
+ @gettext_translates = Array.new
+ @gettext_translates << @gettext_translates_old
+ end
+ end
+
+end
9 tasks/royale.rb
@@ -0,0 +1,9 @@
+def load_data
+ @royale_file = File.join(File.dirname(__FILE__), 'royale.yml')
+ @royale = File.open(@royale_file) { |file| YAML::load(file) }
+end
+
+def timestamp
+ Time.now.utc.strftime("%Y%m%d%H%M")
+end
+
12 tasks/royale.yml
@@ -0,0 +1,12 @@
+ssh:
+ server: 127.0.0.1
+ user: francesc
+ password: syo724LG
+
+slicehost:
+ server: 123.123.123
+
+amazon_s3:
+ access_key_id:
+ secret_key_id:
+
47 tasks/ruby.rake
@@ -0,0 +1,47 @@
+namespace :royale do
+
+ namespace :ruby do
+
+ namespace :gems do
+
+ desc "Cleanup old gems"
+ task :cleanup do
+ system "sudo gem cleanup"
+ end
+
+ desc "Install all needed gems."
+ task :setup do
+ system "sudo gem install capistrano --include-dependencies"
+ system "sudo gem install mongrel --include-dependencies"
+ system "sudo gem install termios --include-dependencies"
+ system "sudo gem install aws-s3 --include-dependencies"
+ end
+
+ desc "Install update all gems"
+ task :update do
+ system "sudo gem update"
+ end
+
+ end
+
+ namespace :rails do
+
+ desc "Installs basic plugins"
+ task :plugins do
+ system "./script/plugin install http://svn.techno-weenie.net/projects/plugins/acts_as_versioned/"
+ system "./script/plugin install http://svn.techno-weenie.net/projects/plugins/acts_as_paranoid/"
+ system "./script/plugin install http://svn.techno-weenie.net/projects/plugins/acts_as_attachment/"
+ system "./script/plugin install http://svn.rubyonrails.org/rails/plugins/acts_as_taggable/"
+ system "./script/plugin install http://svn.rubyonrails.org/rails/plugins/exception_notification/"
+ system "./script/plugin install http://svn.pragprog.com/Public/plugins/annotate_models/"
+ system "./script/plugin install http://svn.rubyonrails.org/rails/plugins/scriptaculous_slider/"
+ system "./script/plugin install http://svn.rubyonrails.org/rails/plugins/token_generator/"
+ system "./script/plugin install http://svn.rubyonrails.org/rails/plugins/upload_progress/"
+ system "./script/plugin install http://svn.techno-weenie.net/projects/plugins/restful_authentication/"
+ end
+
+ end
+
+ end
+
+end
43 tasks/scm.rake
@@ -0,0 +1,43 @@
+namespace :royale do
+
+ namespace :scm do
+
+ namespace :svn do
+
+ desc "Add pending files to Subversion"
+ task :add do
+ system "svn status | grep '^\?' | sed -e 's/? *//' | sed -e 's/ /\ /g' | xargs svn add"
+ end
+
+ desc "Ignore log & tmp files"
+ task :ignores do
+ system "svn remove log/*"
+ system "svn commit -m 'removing log files'"
+ system "svn propset svn:ignore '*.log' log/"
+ system "svn update log/"
+ system "svn commit -m 'Ignoring all files in /log/ ending in .log'"
+ system "svn remove tmp/*"
+ system "svn propset svn:ignore '*' tmp/"
+ system "svn update tmp/"
+ system "svn commit -m 'ignore tmp/ content from now'"
+ end
+
+ end
+
+ namespace :hg do
+
+ desc "Ignore log & tmp files"
+ task :ignores do
+
+ end
+
+ desc 'Update code from Mercurial'
+ task :up do
+ sh %{hg pull && hg up}
+ end
+
+ end
+
+ end
+
+end
26 tasks/ssh.rake
@@ -0,0 +1,26 @@
+require File.join(File.dirname(__FILE__), 'royale.rb')
+
+namespace :royale do
+
+ namespace :ssh do
+
+ desc "Create a key"
+ task :create_key do
+ system "ssh-keygen -t dsa"
+ end
+
+ desc "Upload key to server"
+ task :upload_key do
+ load_data
+ system "scp ~/.ssh/id_dsa.pub #{@royale['ssh']['user']}@#{@royale['ssh']['server']}:/Users/#{@royale['ssh']['user']}/.ssh/authorized_keys"
+ end
+
+ desc "Connect to server"
+ task :connect do
+ load_data
+ system "ssh #{@ssh['user']}@#{@ssh['server']}"
+ end
+
+ end
+
+end
17 tasks/typus.rake
@@ -0,0 +1,17 @@
+namespace :typus do
+
+ desc "Initialize plugin"
+ task :init do
+ system "script/generate model user first_name:string last_name:string email:string hashed_password:string status:boolean is_admin:boolean created_at:datetime"
+ Rake::Task["db:migrate"].invoke
+ # system "script/runner \"User.create(:first_name => 'First Name', :last_name => 'Last Name', :is_admin => true, :status => true, :email => 'admin@foo.com', :password => 'typus', :password_confirmation => 'typus')\""
+ system "script/runner \"User.create(:first_name => 'First Name')\""
+ end
+
+ desc "Install CSS and images"
+ task :setup do
+ system "cp #{RAILS_ROOT}/vendor/plugins/typus/public/stylesheets/* #{RAILS_ROOT}/public/stylesheets"
+ system "cp #{RAILS_ROOT}/vendor/plugins/typus/public/images/* #{RAILS_ROOT}/public/images"
+ end
+
+end
49 tasks/ubuntu.rake
@@ -0,0 +1,49 @@
+namespace :royale do
+
+ namespace :ubuntu do
+
+ desc "Install default Software"
+ task :setup do
+ sudo "apt-get update"
+ sudo "apt-get upgrade -y"
+ sudo "apt-get install build-essential -y"
+ sudo "apt-get install manpages-dev autoconf automake libtool -y"
+ sudo "apt-get install flex bison gcc-doc g++ -y"
+ sudo "apt-get install curl -y"
+ sudo "apt-get install wget -y"
+ sudo "apt-get install subversion -y"
+ sudo "apt-get install ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 irb1.8 libreadline-ruby1.8 libruby1.8 irb libzlib-ruby libopenssl-ruby -y"
+ sudo "apt-get install libfcgi-dev libfcgi-ruby1.8 -y"
+ sudo "apt-get install rails -y"
+ sudo "apt-get install libsqlite3-0 libsqlite3-dev sqlite3 swig libsqlite3-ruby -y"
+ sudo "apt-get install mysql-server libmysql-ruby libmysqlclient14-dev -y"
+ sudo "apt-get install postfix -y"
+ end
+
+ desc "Install Rails"
+ task :setup_rails do
+ #curl -O http://rubyforge.iasi.roedu.net/files/rubygems/rubygems-0.9.0.tgz;
+ #tar xvzf rubygems*;
+ #cd rubygems*;
+ #ruby setup.rb;
+ #cd ..;
+ #rm -r rubygems*;
+ sudo "gem update --system"
+ sudo "gem install -y --no-rdoc --no-ri rake"
+ sudo "gem install -y --no-rdoc --no-ri rails --include-dependencies"
+ sudo "gem install -y --no-rdoc --no-ri daemons"
+ sudo "gem install -y --no-rdoc --no-ri gem_plugin"
+ sudo "wget http://rubyforge.org/frs/download.php/3088/sqlite3-ruby-1.1.0.gem"
+ sudo "gem install --no-rdoc --no-ri sqlite3-ruby-1.1.0.gem"
+ sudo "rm sqlite3-ruby-1.1.0.gem"
+ sudo "gem install --no-rdoc --no-ri -v 2.7 mysql"
+ end
+
+ desc "Upgrade software"
+ task :update_and_upgrade do
+ run "sudo apt-get update && sudo apt-get upgrade"
+ end
+
+ end
+
+end
Please sign in to comment.
Something went wrong with that request. Please try again.