Ecossistema Ruby - versão SCTI UNF 2013
-
Upload
fabio-akita -
Category
Technology
-
view
1.111 -
download
0
description
Transcript of Ecossistema Ruby - versão SCTI UNF 2013
Ecossistema
RubyFabio Akita
@akitaonrails codeminer42.com
www.codeminer42.com
www.codeminer42.com
www.codeminer42.com
www.codeminer42.com
www.codeminer42.com
www.codeminer42.com
www.codeminer42.com
www.codeminer42.com
www.codeminer42.com
www.codeminer42.com
www.codeminer42.com
www.codeminer42.com
http://u.akita.ws/sctiunf2013
9 ANOS!
Rails 3.2.15
Rails 4.0.1
Ruby 1.9.3 p448
Ruby 2.0.0 p247
JRuby 1.7.6 (Java 7)
Ruby 1.9.3 p448
Ruby 2.0.0 p247
JRuby 1.7.6 (Java 7)
http://u.akita.ws/ruby_usage
gem install rails
gem install rails
bundle install
• Filosofia (Agilistas)
• Filosofia (Agilistas)
• Polarização do Rails (Ecossistema)
• Filosofia (Agilistas)
• Polarização do Rails (Ecossistema)
• Escolha das Startups (Economia)
• Filosofia (Agilistas)
• Polarização do Rails (Ecossistema)
• Escolha das Startups (Economia)
• Cloud Computing (Infraestrutura)
Repositórios
http://u.akita.ws/git
git checkout master
git checkout master
git checkout -b new_branch
git checkout master
git checkout -b new_branch
git commit -a -m “new change”
git checkout master
git checkout -b new_branch
git commit -a -m “new change”
git push origin new_branch
Desenvolvimento
vagrant init precise32 http://files.vagrantup.com/precise32.box
vagrant init precise32 http://files.vagrantup.com/precise32.box
vagrant up
vagrant init precise32 http://files.vagrantup.com/precise32.box
vagrant up
vagrant ssh
vagrant init precise32 http://files.vagrantup.com/precise32.box
vagrant up
vagrant ssh
vagrant halt
brew install ack ctags git macvim wget zsh
sh -c "`curl -fsSL https://raw.github.com/skwp/dotfiles/
master/install.sh`"
sh -c "`curl -fsSL https://raw.github.com/skwp/dotfiles/
master/install.sh`"
cd ~/.yadr; rake update
http://u.akita.ws/vim
Continuous Integration (CI)
Exceptions Tracking
# Gemfile group :production do gem 'airbrake' end # config/initializers/errbit.rb if defined?(Airbrake) Airbrake.configure do |config| config.api_key = 'SUA_CHAVE' config.host = 'errbit.cm42.io' config.port = 80 config.secure = config.port == 443 end end
MyApp::Application.config.middleware.use ExceptionNotification::Rack, :email => { :email_prefix => "[MyApp] ", :sender_address => %{"notifier" <[email protected]>}, :exception_recipients => %w{[email protected]} }
Code Quality
gem install brakeman
brakeman -o report.html
gem install rails_best_practices
rails_best_practices -f html .
gem install excellent
excellent -o excellent.html .
# spec/spec_helper.rb require 'simplecov' SimpleCov.start 'rails'
http://u.akita.ws/assets
# Gemfile gem 'sunspot_rails' gem "sunspot_with_kaminari" group :development do gem 'sunspot_solr' gem 'progress_bar' end
# config/sunspot.yml production: solr: hostname: index.websolr.com port: 80 log_level: WARNING path: /solr/69xxxxxxx39 # read_timeout: 2 # open_timeout: 0.5 development: solr: hostname: localhost port: 8982 log_level: INFO test: solr: hostname: localhost port: 8981 log_level: WARNING
# app/models/document.rb class Document < ActiveRecord::Base searchable do text :title, :more_like_this => true text :excerpt_html, :more_like_this => true text :body_html, :more_like_this => true string :cached_tag_list time :published_at end end
<form id="formsearch" method="get" action="<%= searches_url %>"> <input type="text" name="q" /> </form>
class SearchesController < ApplicationController def index page = params[:page] || 1 query = (params[:q] || "").strip @posts = Sunspot.search(Post) do fulltext query do query_phrase_slop 1 phrase_fields :title => 2.0 phrase_slop 1 end paginate :page => page, :per_page => Post::DEFAULT_LIMIT order_by :score, :desc end end end
Mensagens Assíncronas
<script src="http://js.pusher.com/2.1/pusher.min.js"></script> <script> var pusher = new Pusher('SUA_CHAVE'); var channel = pusher.subscribe('meu-canal'); channel.bind('meu-evento', function(data) { alert('Chegou um evento com a mensagem: ' + data.message); }); </script>
require 'pusher' Pusher.app_id = 'APP_ID' Pusher.key = 'APP_KEY' Pusher.secret = 'APP_SECRET' class HelloWorldController < ApplicationController def hello_world Pusher['meu-canal'].trigger('meu-evento', {:message => 'hello world'}) end end
Web Servers
gem install passenger
sudo passenger-install-nginx-module
http://u.akita.ws/ubuntu1204
heroku create
git push heroku master
gem install af
gem install af
af push --runtime ruby193
gem install af
af push --runtime ruby193
af update sua_aplicacao
gem install af
af push --runtime ruby193
af update sua_aplicacao
af restart sua_aplicacao
gem install helios
helios new myapp
createdb -h localhost myapp
cd myapp && helios start
# Gemfile gem 'helios' gem 'pg' # config/application.rb config.middleware.use Helios::Application do service :data, model: 'path/to/DataModel.xcdatamodel' service :push_notification, apn_certificate: 'path/to/apple_push_notification.pem', apn_environment: 'development' service :in_app_purchase service :passbook end
Educação
Thanks! @akitaonrails