SlideShare ist ein Scribd-Unternehmen logo
1 von 120
Downloaden Sie, um offline zu lesen
Geradores de código
     com Thor


                             @josevalim
             http://plataformatec.com.br
            jose@plataformatec.com.br
               Plataforma Tecnologia, José Valim 2009
Quem sou?




        Plataforma Tecnologia, José Valim 2009
Desenvolvedor líder na
Plataforma Tecnologia




               Plataforma Tecnologia, José Valim 2009
22 anos, Engenheiro pela
   Escola Politécnica




                Plataforma Tecnologia, José Valim 2009
Desenvolvedor ruby
 há quase 3 anos




             Plataforma Tecnologia, José Valim 2009
Google Summer of Code
 Student e contribuidor
  ativo do Rails Core



               Plataforma Tecnologia, José Valim 2009
Inherited Resources




             Plataforma Tecnologia, José Valim 2009
Inherited Resources
  Rails Footnotes




             Plataforma Tecnologia, José Valim 2009
Inherited Resources
  Rails Footnotes
    Remarkable




             Plataforma Tecnologia, José Valim 2009
Inherited Resources
  Rails Footnotes
    Remarkable
     Formtastic


             Plataforma Tecnologia, José Valim 2009
O que está errado com os
 geradores do Rails 2.x?




                Plataforma Tecnologia, José Valim 2009
script/generate scaffold




                 Plataforma Tecnologia, José Valim 2009
script/generate scaffold


   ActiveRecord
     TestUnit
       ERB



                 Plataforma Tecnologia, José Valim 2009
script/generate rspec_scaffold




                    Plataforma Tecnologia, José Valim 2009
script/generate rspec_scaffold


      ActiveRecord
         Rspec
          ERB



                    Plataforma Tecnologia, José Valim 2009
script/generate dm_scaffold




                   Plataforma Tecnologia, José Valim 2009
script/generate dm_scaffold


      DataMapper
       TestUnit
         ERB



                   Plataforma Tecnologia, José Valim 2009
script/generate dm_rspec_scaffold




                      Plataforma Tecnologia, José Valim 2009
script/generate dm_rspec_scaffold


         DataMapper
           Rspec
            ERB



                      Plataforma Tecnologia, José Valim 2009
Agnosticismo?




          Plataforma Tecnologia, José Valim 2009
Remarkable +
Inherited Resources +
      Formtastic




               Plataforma Tecnologia, José Valim 2009
Remarkable +
Inherited Resources +
      Formtastic
         =




               Plataforma Tecnologia, José Valim 2009
Remarkable +
Inherited Resources +
      Formtastic
            =
      script/generate
remarkable_inherited_formta
       stic_scaffold


                   Plataforma Tecnologia, José Valim 2009
Remarkable +
Inherited Resources +
      Formtastic
            =
      script/generate
remarkable_inherited_formta
       stic_scaffold
                                    FAIL?
                   Plataforma Tecnologia, José Valim 2009
script/generate nifty_scaffold
script/generate dry_scaffold




                     Plataforma Tecnologia, José Valim 2009
Pouca reutilização de
       código




              Plataforma Tecnologia, José Valim 2009
Sem divisão de
responsabilidades




            Plataforma Tecnologia, José Valim 2009
Plataforma Tecnologia, José Valim 2009
Por quê Thor?




          Plataforma Tecnologia, José Valim 2009
class AppGenerator < Thor::Group
  def create_app_folders
    empty_directory “app/models”
    empty_directory “app/controllers”
  end

  def copy_config_files
    copy_file “config/routes.rb”
  end
end

                        Plataforma Tecnologia, José Valim 2009
class AppGenerator < Thor::Group
  def create_app_folders
    empty_directory “app/models”
    empty_directory “app/controllers”
  end

  def copy_config_files
    copy_file “config/routes.rb”
  end
end

                        Plataforma Tecnologia, José Valim 2009
class AppGenerator < Thor::Group
  def create_app_folders
    empty_directory “app/models”
    empty_directory “app/controllers”
  end

  def copy_config_files
    copy_file “config/routes.rb”
  end
end

                        Plataforma Tecnologia, José Valim 2009
Execute tudo...
AppGenerator.start




            Plataforma Tecnologia, José Valim 2009
ou selecione!
app_tasks = AppGenerator.new
app_tasks.create_app_folders
app_tasks.copy_config_files




                   Plataforma Tecnologia, José Valim 2009
Herança




          Plataforma Tecnologia, José Valim 2009
module Rails::Generators
  class ScaffoldGenerator < ResourceGenerator
    # generation
  end
end




                              Plataforma Tecnologia, José Valim 2009
Argumentos




        Plataforma Tecnologia, José Valim 2009
script/generate scaffold User name:string
    --no-layout -o datamapper -t rspec




                          Plataforma Tecnologia, José Valim 2009
self.class_name


script/generate scaffold User name:string
    --no-layout -o datamapper -t rspec




                          Plataforma Tecnologia, José Valim 2009
self.attributes


script/generate scaffold User name:string
    --no-layout -o datamapper -t rspec




                          Plataforma Tecnologia, José Valim 2009
Opções




         Plataforma Tecnologia, José Valim 2009
script/generate scaffold User name:string
    --no-layout -o datamapper -t rspec




                          Plataforma Tecnologia, José Valim 2009
script/generate scaffold User name:string
    --no-layout -o datamapper -t rspec


            self.options[:orm]
            #=> “datamapper”


                          Plataforma Tecnologia, José Valim 2009
script/generate scaffold User name:string
    --no-layout -o datamapper -t rspec


   self.options.layout? #=> false



                           Plataforma Tecnologia, José Valim 2009
:type => :string
--orm=activerecord




             Plataforma Tecnologia, José Valim 2009
:type => :numeric
    --rails=3.0




            Plataforma Tecnologia, José Valim 2009
:type => :boolean
--layout --no-helpers




               Plataforma Tecnologia, José Valim 2009
:type => :array
--actions=index new create




                 Plataforma Tecnologia, José Valim 2009
:type => :hash
--actions=name:string age:index




                    Plataforma Tecnologia, José Valim 2009
:required, :desc, :optional




                  Plataforma Tecnologia, José Valim 2009
Invocações




         Plataforma Tecnologia, José Valim 2009
class ResourceGenerator < Thor::Group
  def run_dependencies
    invoke ModelGenerator
    invoke ControllerGenerator
    invoke “testunit:resource”
  end
end




                        Plataforma Tecnologia, José Valim 2009
class ResourceGenerator < Thor::Group
  def run_dependencies
    invoke ModelGenerator
    invoke ControllerGenerator
    invoke “testunit:resource”
  end
end




                        Plataforma Tecnologia, José Valim 2009
invoke ModelGenerator




              Plataforma Tecnologia, José Valim 2009
invoke ModelGenerator

ModelGenerator.start



              Plataforma Tecnologia, José Valim 2009
invoke ModelGenerator
         !=
 ModelGenerator.start



              Plataforma Tecnologia, José Valim 2009
Shell




        Plataforma Tecnologia, José Valim 2009
Gerencia input e output




               Plataforma Tecnologia, José Valim 2009
Thor::Shell::Basic




             Plataforma Tecnologia, José Valim 2009
Thor::Shell::Basic
Apenas para Windows



              Plataforma Tecnologia, José Valim 2009
Thor::Shell::Color




             Plataforma Tecnologia, José Valim 2009
Thor::Shell::Web




            Plataforma Tecnologia, José Valim 2009
Thor::Shell::Web
       ?

            Plataforma Tecnologia, José Valim 2009
Plataforma Tecnologia, José Valim 2009
Qual a diferença entre
geradores de código e
 tarefas (como rake)?



               Plataforma Tecnologia, José Valim 2009
Geradores de código são
  um grupo de tarefas




               Plataforma Tecnologia, José Valim 2009
class Alphabet < Thor
  def a
    print :a
  end

  def b
    print :b
  end
end

$ thor alphabet:a #=> “a”
$ thor alphabet:b #=> “b”
                        Plataforma Tecnologia, José Valim 2009
class Alphabet < Thor
  def a
    print :a
  end

  def b
    print :b
  end
end

$ thor alphabet:a #=> “a”
$ thor alphabet:b #=> “b”
                        Plataforma Tecnologia, José Valim 2009
class Alphabet < Thor
  def a
    print :a
  end

  def b
    print :b
  end
end

$ thor alphabet:a #=> “a”
$ thor alphabet:b #=> “b”
                        Plataforma Tecnologia, José Valim 2009
class Alphabet < Thor::Group
  def a
    print :a
  end

  def b
    print :b
  end
end

$ thor alphabet #=> “ab”

                      Plataforma Tecnologia, José Valim 2009
class Alphabet < Thor::Group
  def a
    print :a
  end

  def b
    print :b
  end
end

$ thor alphabet #=> “ab”

                      Plataforma Tecnologia, José Valim 2009
Thor




       Plataforma Tecnologia, José Valim 2009
Thor
 =




       Plataforma Tecnologia, José Valim 2009
Thor
 =
Rake




       Plataforma Tecnologia, José Valim 2009
Thor
     =
Rake + Sake




         Plataforma Tecnologia, José Valim 2009
Thor
      =
Rake + Sake +
  Rubigen



          Plataforma Tecnologia, José Valim 2009
Thor
       =
Rake + Sake +
  Rubigen +
RailsTemplates


           Plataforma Tecnologia, José Valim 2009
Thor::Actions
      ==
RailsTemplates



           Plataforma Tecnologia, José Valim 2009
create_file “users_helper.rb”, <<-END
  module UsersHelper
  end
END




                        Plataforma Tecnologia, José Valim 2009
copy_file “doc/README”, “doc/README”
copy_file “doc/README”




                       Plataforma Tecnologia, José Valim 2009
Thor.source_root


copy_file “doc/README”, “doc/README”
copy_file “doc/README”




                        Plataforma Tecnologia, José Valim 2009
Dir.pwd


copy_file “doc/README”, “doc/README”
copy_file “doc/README”




                       Plataforma Tecnologia, José Valim 2009
get “http://pastie.org/2.txt”, “pastie.rb”

get “http://pastie.org/2.txt” do |content|
  content =~ /class (w)+/
  “#{$1 || 'content'}.rb”
end




                           Plataforma Tecnologia, José Valim 2009
template “doc/README”, “doc/README”
template “doc/README.tt”




                       Plataforma Tecnologia, José Valim 2009
chmod “script/*”, 755




                   Plataforma Tecnologia, José Valim 2009
prepend_file “environments/test.rb”
             “config.gem "rspec"”

prepend_file “environments/test.rb” do
  “config.gem "rspec"”
end




                         Plataforma Tecnologia, José Valim 2009
append_file “environments/test.rb”
             “config.gem "rspec"”

append_file “environments/test.rb” do
  “config.gem "rspec"”
end




                         Plataforma Tecnologia, José Valim 2009
flag = "Rails::Initializer.run do |config|n"

inject_into_file "config/environment.rb",
                 "config.gem :thor",
                 :after => flag




                             Plataforma Tecnologia, José Valim 2009
inject_into_class “users_controller.rb”
                  UsersController,
                  “before_filter :authenticate”




                              Plataforma Tecnologia, José Valim 2009
remove_file “doc/README”




                   Plataforma Tecnologia, José Valim 2009
empty_directory “doc”




                   Plataforma Tecnologia, José Valim 2009
directory “script”, “script”
directory “script”




                   Plataforma Tecnologia, José Valim 2009
inside “doc” do
  copy_file “README”
end




                   Plataforma Tecnologia, José Valim 2009
apply "http://gist.github.com/103208.txt"




                          Plataforma Tecnologia, José Valim 2009
run “ln -s ~/edge rails”




                   Plataforma Tecnologia, José Valim 2009
Actions específicas do
         Rails em:
Rails::Generators::Actions



                 Plataforma Tecnologia, José Valim 2009
Thor unifica APIs de
geradores de código, tarefas
    e templates do Rails



                  Plataforma Tecnologia, José Valim 2009
Rails::Generators




            Plataforma Tecnologia, José Valim 2009
module Rails::Generators
  class ControllerGenerator < NamedBase
    argument :actions, :type => :array, :default => []
    check_class_collision :suffix => "Controller"

    def create_controller_files
      destination =
        File.join('app/controllers', class_path,
                  "#{file_name}_controller.rb")

      template 'controller.rb', destination
    end

    hook_for :template_engine, :test_framework, :helper
  end
end


                                    Plataforma Tecnologia, José Valim 2009
module Rails::Generators
  class ControllerGenerator < NamedBase
    argument :actions, :type => :array, :default => []
    check_class_collision :suffix => "Controller"

    def create_controller_files
      destination =
        File.join('app/controllers', class_path,
                  "#{file_name}_controller.rb")

      template 'controller.rb', destination
    end

    hook_for :template_engine, :test_framework, :helper
  end
end


                                    Plataforma Tecnologia, José Valim 2009
module Rails::Generators
  class ControllerGenerator < NamedBase
    argument :actions, :type => :array, :default => []
    check_class_collision :suffix => "Controller"

    def create_controller_files
      destination =
        File.join('app/controllers', class_path,
                  "#{file_name}_controller.rb")

      template 'controller.rb', destination
    end

    hook_for :template_engine, :test_framework, :helper
  end
end


                                    Plataforma Tecnologia, José Valim 2009
module Rails::Generators
  class ControllerGenerator < NamedBase
    argument :actions, :type => :array, :default => []
    check_class_collision :suffix => "Controller"

    def create_controller_files
      destination =
        File.join('app/controllers', class_path,
                  "#{file_name}_controller.rb")

      template 'controller.rb', destination
    end

    hook_for :template_engine, :test_framework, :helper
  end
end


                                    Plataforma Tecnologia, José Valim 2009
module Rails::Generators
  class ControllerGenerator < NamedBase
    argument :actions, :type => :array, :default => []
    check_class_collision :suffix => "Controller"

    def create_controller_files
      destination =
        File.join('app/controllers', class_path,
                  "#{file_name}_controller.rb")

      template 'controller.rb', destination
    end

    hook_for :template_engine, :test_framework, :helper
  end
end


                                    Plataforma Tecnologia, José Valim 2009
module Rails::Generators
  class ControllerGenerator < NamedBase
    argument :actions, :type => :array, :default => []
    check_class_collision :suffix => "Controller"

    def create_controller_files
      destination =
        File.join('app/controllers', class_path,
                  "#{file_name}_controller.rb")

      template 'controller.rb', destination
    end

    hook_for :template_engine, :test_framework, :helper
  end
end


                                    Plataforma Tecnologia, José Valim 2009
module Rails::Generators
  class ControllerGenerator < NamedBase
    argument :actions, :type => :array, :default => []
    check_class_collision :suffix => "Controller"

    def create_controller_files
      destination =
        File.join('app/controllers', class_path,
                  "#{file_name}_controller.rb")

      template 'controller.rb', destination
    end

    hook_for :template_engine, :test_framework, :helper
  end
end


                                    Plataforma Tecnologia, José Valim 2009
module Rails::Generators
  class ControllerGenerator < NamedBase
    argument :actions, :type => :array, :default => []
    check_class_collision :suffix => "Controller"

    def create_controller_files
      destination =
        File.join('app/controllers', class_path,
                  "#{file_name}_controller.rb")

      template 'controller.rb', destination
    end

    hook_for :template_engine, :test_framework, :helper
  end
end


                                    Plataforma Tecnologia, José Valim 2009
module Rails::Generators
  class ControllerGenerator < NamedBase
    argument :actions, :type => :array, :default => []
    check_class_collision :suffix => "Controller"

    def create_controller_files
      destination =
        File.join('app/controllers', class_path,
                  "#{file_name}_controller.rb")

      template 'controller.rb', destination
    end

    hook_for :template_engine, :test_framework, :helper
  end
end


                                    Plataforma Tecnologia, José Valim 2009
module Rails::Generators
  class ControllerGenerator < NamedBase
    argument :actions, :type => :array, :default => []
    check_class_collision :suffix => "Controller"

    def create_controller_files
      destination =
        File.join('app/controllers', class_path,
                  "#{file_name}_controller.rb")

      template 'controller.rb', destination
    end

    hook_for :template_engine, :test_framework, :helper
  end
end


                                    Plataforma Tecnologia, José Valim 2009
hook_for :test_framework




                Plataforma Tecnologia, José Valim 2009
hook_for :test_framework
 --test_framework=rspec




                Plataforma Tecnologia, José Valim 2009
hook_for :test_framework
 --test_framework=rspec
invoke “rspec:controller”



                Plataforma Tecnologia, José Valim 2009
Thorfile




           Plataforma Tecnologia, José Valim 2009
Thor::RakeCompat




           Plataforma Tecnologia, José Valim 2009
require File.join(File.dirname(__FILE__),
                  'config', 'boot')

require 'rake/testtask'
require 'rake/rdoctask'
require 'thor/rake_compat'

class Default < Thor
  include Thor::RakeCompat
  require 'rails/tasks'
end


                             Plataforma Tecnologia, José Valim 2009
require File.join(File.dirname(__FILE__),
                  'config', 'boot')

require 'rake/testtask'
require 'rake/rdoctask'
require 'thor/rake_compat'

class Default < Thor
  include Thor::RakeCompat
  require 'rails/tasks'
end


                             Plataforma Tecnologia, José Valim 2009
require File.join(File.dirname(__FILE__),
                  'config', 'boot')

require 'rake/testtask'
require 'rake/rdoctask'
require 'thor/rake_compat'

class Default < Thor
  include Thor::RakeCompat
  require 'rails/tasks'
end


                             Plataforma Tecnologia, José Valim 2009
require File.join(File.dirname(__FILE__),
                  'config', 'boot')

require 'rake/testtask'
require 'rake/rdoctask'
require 'thor/rake_compat'

class Default < Thor
  include Thor::RakeCompat
  require 'rails/tasks'
end


                             Plataforma Tecnologia, José Valim 2009
Show me the code!




            Plataforma Tecnologia, José Valim 2009
?!
                      @josevalim
      http://plataformatec.com.br
     jose@plataformatec.com.br
        Plataforma Tecnologia, José Valim 2009
blog.plataformatec.com.br



                                @josevalim
                http://plataformatec.com.br
               jose@plataformatec.com.br
                  Plataforma Tecnologia, José Valim 2009

Weitere ähnliche Inhalte

Was ist angesagt?

Morpheus configuration engine (slides from Saint Perl-2 conference)
Morpheus configuration engine (slides from Saint Perl-2 conference)Morpheus configuration engine (slides from Saint Perl-2 conference)
Morpheus configuration engine (slides from Saint Perl-2 conference)Vyacheslav Matyukhin
 
Slim RedBeanPHP and Knockout
Slim RedBeanPHP and KnockoutSlim RedBeanPHP and Knockout
Slim RedBeanPHP and KnockoutVic Metcalfe
 
Hello World on Slim Framework 3.x
Hello World on Slim Framework 3.xHello World on Slim Framework 3.x
Hello World on Slim Framework 3.xRyan Szrama
 
170517 damien gérard framework facebook
170517 damien gérard   framework facebook170517 damien gérard   framework facebook
170517 damien gérard framework facebookGeeks Anonymes
 
Aprendendo solid com exemplos
Aprendendo solid com exemplosAprendendo solid com exemplos
Aprendendo solid com exemplosvinibaggio
 
Keeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro frameworkKeeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro frameworkJeremy Kendall
 
Laravel5 Introduction and essentials
Laravel5 Introduction and essentialsLaravel5 Introduction and essentials
Laravel5 Introduction and essentialsPramod Kadam
 
Lightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClientLightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClientAdam Wiggins
 
Rack is Spectacular
Rack is SpectacularRack is Spectacular
Rack is SpectacularBryce Kerley
 
How Danga::Socket handles asynchronous processing and how to write asynchrono...
How Danga::Socket handles asynchronous processing and how to write asynchrono...How Danga::Socket handles asynchronous processing and how to write asynchrono...
How Danga::Socket handles asynchronous processing and how to write asynchrono...Gosuke Miyashita
 
Laravel 5 In Depth
Laravel 5 In DepthLaravel 5 In Depth
Laravel 5 In DepthKirk Bushell
 
Using Sinatra to Build REST APIs in Ruby
Using Sinatra to Build REST APIs in RubyUsing Sinatra to Build REST APIs in Ruby
Using Sinatra to Build REST APIs in RubyLaunchAny
 
Silex: From nothing to an API
Silex: From nothing to an APISilex: From nothing to an API
Silex: From nothing to an APIchrisdkemper
 

Was ist angesagt? (20)

Morpheus configuration engine (slides from Saint Perl-2 conference)
Morpheus configuration engine (slides from Saint Perl-2 conference)Morpheus configuration engine (slides from Saint Perl-2 conference)
Morpheus configuration engine (slides from Saint Perl-2 conference)
 
Modern PHP
Modern PHPModern PHP
Modern PHP
 
Red5 - PHUG Workshops
Red5 - PHUG WorkshopsRed5 - PHUG Workshops
Red5 - PHUG Workshops
 
Slim RedBeanPHP and Knockout
Slim RedBeanPHP and KnockoutSlim RedBeanPHP and Knockout
Slim RedBeanPHP and Knockout
 
Hello World on Slim Framework 3.x
Hello World on Slim Framework 3.xHello World on Slim Framework 3.x
Hello World on Slim Framework 3.x
 
170517 damien gérard framework facebook
170517 damien gérard   framework facebook170517 damien gérard   framework facebook
170517 damien gérard framework facebook
 
Aprendendo solid com exemplos
Aprendendo solid com exemplosAprendendo solid com exemplos
Aprendendo solid com exemplos
 
Perlbal Tutorial
Perlbal TutorialPerlbal Tutorial
Perlbal Tutorial
 
Keeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro frameworkKeeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro framework
 
Smoking docker
Smoking dockerSmoking docker
Smoking docker
 
Modern Catalyst
Modern  CatalystModern  Catalyst
Modern Catalyst
 
Laravel5 Introduction and essentials
Laravel5 Introduction and essentialsLaravel5 Introduction and essentials
Laravel5 Introduction and essentials
 
Lightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClientLightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClient
 
Laravel 5
Laravel 5Laravel 5
Laravel 5
 
Rack is Spectacular
Rack is SpectacularRack is Spectacular
Rack is Spectacular
 
How Danga::Socket handles asynchronous processing and how to write asynchrono...
How Danga::Socket handles asynchronous processing and how to write asynchrono...How Danga::Socket handles asynchronous processing and how to write asynchrono...
How Danga::Socket handles asynchronous processing and how to write asynchrono...
 
Laravel 5 In Depth
Laravel 5 In DepthLaravel 5 In Depth
Laravel 5 In Depth
 
Using Sinatra to Build REST APIs in Ruby
Using Sinatra to Build REST APIs in RubyUsing Sinatra to Build REST APIs in Ruby
Using Sinatra to Build REST APIs in Ruby
 
Get your teeth into Plack
Get your teeth into PlackGet your teeth into Plack
Get your teeth into Plack
 
Silex: From nothing to an API
Silex: From nothing to an APISilex: From nothing to an API
Silex: From nothing to an API
 

Andere mochten auch

Is it Copyrighted? Can I Use it? (NLA2014)
Is it Copyrighted? Can I Use it? (NLA2014)Is it Copyrighted? Can I Use it? (NLA2014)
Is it Copyrighted? Can I Use it? (NLA2014)Michael Sauers
 
Lessons Learnt in 2009
Lessons Learnt in 2009Lessons Learnt in 2009
Lessons Learnt in 2009pratiknaik
 
Participating in the Creative Commons (NLA/NEMA 2008)
Participating in the Creative Commons (NLA/NEMA 2008)Participating in the Creative Commons (NLA/NEMA 2008)
Participating in the Creative Commons (NLA/NEMA 2008)Michael Sauers
 
O que mudou no Ruby 1.9
O que mudou no Ruby 1.9O que mudou no Ruby 1.9
O que mudou no Ruby 1.9Nando Vieira
 
Yet Another Ruby Framework - Como o Rails funciona por dentro
Yet Another Ruby Framework - Como o Rails funciona por dentroYet Another Ruby Framework - Como o Rails funciona por dentro
Yet Another Ruby Framework - Como o Rails funciona por dentroCarlos Brando
 
DSLs Internas e Ruby
DSLs Internas e RubyDSLs Internas e Ruby
DSLs Internas e RubyFabio Kung
 

Andere mochten auch (9)

Expert Group Report: From Niche to Norm – Raimund Bleischwitz
Expert Group Report: From Niche to Norm – Raimund BleischwitzExpert Group Report: From Niche to Norm – Raimund Bleischwitz
Expert Group Report: From Niche to Norm – Raimund Bleischwitz
 
Is it Copyrighted? Can I Use it? (NLA2014)
Is it Copyrighted? Can I Use it? (NLA2014)Is it Copyrighted? Can I Use it? (NLA2014)
Is it Copyrighted? Can I Use it? (NLA2014)
 
Lessons Learnt in 2009
Lessons Learnt in 2009Lessons Learnt in 2009
Lessons Learnt in 2009
 
Participating in the Creative Commons (NLA/NEMA 2008)
Participating in the Creative Commons (NLA/NEMA 2008)Participating in the Creative Commons (NLA/NEMA 2008)
Participating in the Creative Commons (NLA/NEMA 2008)
 
O que mudou no Ruby 1.9
O que mudou no Ruby 1.9O que mudou no Ruby 1.9
O que mudou no Ruby 1.9
 
Smart aging
Smart agingSmart aging
Smart aging
 
Yet Another Ruby Framework - Como o Rails funciona por dentro
Yet Another Ruby Framework - Como o Rails funciona por dentroYet Another Ruby Framework - Como o Rails funciona por dentro
Yet Another Ruby Framework - Como o Rails funciona por dentro
 
The Solid Fuel Regulations and the on-going challenge to clean air
The Solid Fuel Regulations and the on-going challenge to clean airThe Solid Fuel Regulations and the on-going challenge to clean air
The Solid Fuel Regulations and the on-going challenge to clean air
 
DSLs Internas e Ruby
DSLs Internas e RubyDSLs Internas e Ruby
DSLs Internas e Ruby
 

Ähnlich wie Thor - RSLA - 13oct2009

RichFaces - Testing on Mobile Devices
RichFaces - Testing on Mobile DevicesRichFaces - Testing on Mobile Devices
RichFaces - Testing on Mobile DevicesPavol Pitoňák
 
Protocol-Oriented Programming in Swift
Protocol-Oriented Programming in SwiftProtocol-Oriented Programming in Swift
Protocol-Oriented Programming in SwiftOleksandr Stepanov
 
Introduction to Xamarin.Forms
Introduction to Xamarin.FormsIntroduction to Xamarin.Forms
Introduction to Xamarin.FormsBrad Pillow
 
DSL or NoDSL - Euruko - 29may2010
DSL or NoDSL - Euruko - 29may2010DSL or NoDSL - Euruko - 29may2010
DSL or NoDSL - Euruko - 29may2010Plataformatec
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreC4Media
 
The Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/PressThe Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/PressJeroen van Dijk
 
Rapid Prototyping FTW!!!
Rapid Prototyping FTW!!!Rapid Prototyping FTW!!!
Rapid Prototyping FTW!!!cloudbring
 
Tales About Scala Performance
Tales About Scala PerformanceTales About Scala Performance
Tales About Scala PerformanceHaim Yadid
 
Simplify your professional web development with symfony
Simplify your professional web development with symfonySimplify your professional web development with symfony
Simplify your professional web development with symfonyFrancois Zaninotto
 
Jericho Attack Technique
Jericho Attack TechniqueJericho Attack Technique
Jericho Attack TechniqueJan Seidl
 
WebCamp: Developer Day: DDD in PHP on example of Symfony - Олег Зинченко
WebCamp: Developer Day: DDD in PHP on example of Symfony - Олег ЗинченкоWebCamp: Developer Day: DDD in PHP on example of Symfony - Олег Зинченко
WebCamp: Developer Day: DDD in PHP on example of Symfony - Олег ЗинченкоGeeksLab Odessa
 
How to switch stack without downtime
How to switch stack without downtimeHow to switch stack without downtime
How to switch stack without downtimeFabien Penso
 
Minimum Viable Docker: our journey towards orchestration
Minimum Viable Docker: our journey towards orchestrationMinimum Viable Docker: our journey towards orchestration
Minimum Viable Docker: our journey towards orchestrationOutlyer
 
Sylius and Api Platform The story of integration
Sylius and Api Platform The story of integrationSylius and Api Platform The story of integration
Sylius and Api Platform The story of integrationŁukasz Chruściel
 
Modernizing i5 Applications
Modernizing i5 ApplicationsModernizing i5 Applications
Modernizing i5 ApplicationsZendCon
 
Reusando componentes Zope fuera de Zope
Reusando componentes Zope fuera de ZopeReusando componentes Zope fuera de Zope
Reusando componentes Zope fuera de Zopementtes
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 

Ähnlich wie Thor - RSLA - 13oct2009 (20)

A First Date With Scala
A First Date With ScalaA First Date With Scala
A First Date With Scala
 
Php
PhpPhp
Php
 
RichFaces - Testing on Mobile Devices
RichFaces - Testing on Mobile DevicesRichFaces - Testing on Mobile Devices
RichFaces - Testing on Mobile Devices
 
Protocol-Oriented Programming in Swift
Protocol-Oriented Programming in SwiftProtocol-Oriented Programming in Swift
Protocol-Oriented Programming in Swift
 
Introduction to Xamarin.Forms
Introduction to Xamarin.FormsIntroduction to Xamarin.Forms
Introduction to Xamarin.Forms
 
Rhodes Overview
Rhodes OverviewRhodes Overview
Rhodes Overview
 
DSL or NoDSL - Euruko - 29may2010
DSL or NoDSL - Euruko - 29may2010DSL or NoDSL - Euruko - 29may2010
DSL or NoDSL - Euruko - 29may2010
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
 
The Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/PressThe Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/Press
 
Rapid Prototyping FTW!!!
Rapid Prototyping FTW!!!Rapid Prototyping FTW!!!
Rapid Prototyping FTW!!!
 
Tales About Scala Performance
Tales About Scala PerformanceTales About Scala Performance
Tales About Scala Performance
 
Simplify your professional web development with symfony
Simplify your professional web development with symfonySimplify your professional web development with symfony
Simplify your professional web development with symfony
 
Jericho Attack Technique
Jericho Attack TechniqueJericho Attack Technique
Jericho Attack Technique
 
WebCamp: Developer Day: DDD in PHP on example of Symfony - Олег Зинченко
WebCamp: Developer Day: DDD in PHP on example of Symfony - Олег ЗинченкоWebCamp: Developer Day: DDD in PHP on example of Symfony - Олег Зинченко
WebCamp: Developer Day: DDD in PHP on example of Symfony - Олег Зинченко
 
How to switch stack without downtime
How to switch stack without downtimeHow to switch stack without downtime
How to switch stack without downtime
 
Minimum Viable Docker: our journey towards orchestration
Minimum Viable Docker: our journey towards orchestrationMinimum Viable Docker: our journey towards orchestration
Minimum Viable Docker: our journey towards orchestration
 
Sylius and Api Platform The story of integration
Sylius and Api Platform The story of integrationSylius and Api Platform The story of integration
Sylius and Api Platform The story of integration
 
Modernizing i5 Applications
Modernizing i5 ApplicationsModernizing i5 Applications
Modernizing i5 Applications
 
Reusando componentes Zope fuera de Zope
Reusando componentes Zope fuera de ZopeReusando componentes Zope fuera de Zope
Reusando componentes Zope fuera de Zope
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 

Mehr von Plataformatec

Do your own hacking evening - RubyConf UR
Do your own hacking evening - RubyConf URDo your own hacking evening - RubyConf UR
Do your own hacking evening - RubyConf URPlataformatec
 
Product Owner - Simples como dizem? - Agile Tour 2011
Product Owner - Simples como dizem? - Agile Tour 2011Product Owner - Simples como dizem? - Agile Tour 2011
Product Owner - Simples como dizem? - Agile Tour 2011Plataformatec
 
As reais razões do porque eu devo ser Ágil - Agile Tour São Paulo
As reais razões do porque eu devo ser Ágil - Agile Tour São PauloAs reais razões do porque eu devo ser Ágil - Agile Tour São Paulo
As reais razões do porque eu devo ser Ágil - Agile Tour São PauloPlataformatec
 
Writing your own programming language to understand Ruby better - Euruko 2011
Writing your own programming language to understand Ruby better - Euruko 2011Writing your own programming language to understand Ruby better - Euruko 2011
Writing your own programming language to understand Ruby better - Euruko 2011Plataformatec
 
Railties - Ruby Masters Conf - 26Feb2011
Railties - Ruby Masters Conf - 26Feb2011Railties - Ruby Masters Conf - 26Feb2011
Railties - Ruby Masters Conf - 26Feb2011Plataformatec
 
Rails 2.3, 3.0 and 3.1 - RubyConfBR - 26oct2010
Rails 2.3, 3.0 and 3.1 - RubyConfBR - 26oct2010Rails 2.3, 3.0 and 3.1 - RubyConfBR - 26oct2010
Rails 2.3, 3.0 and 3.1 - RubyConfBR - 26oct2010Plataformatec
 
Rails 3 - The Developers Conference - 21aug2010
Rails 3 - The Developers Conference - 21aug2010Rails 3 - The Developers Conference - 21aug2010
Rails 3 - The Developers Conference - 21aug2010Plataformatec
 
CRUDing Open Source - WhyDay - 19aug2010
CRUDing Open Source - WhyDay - 19aug2010CRUDing Open Source - WhyDay - 19aug2010
CRUDing Open Source - WhyDay - 19aug2010Plataformatec
 
Rails 3 - RS on Rails - 21aug2010
Rails 3 - RS on Rails - 21aug2010Rails 3 - RS on Rails - 21aug2010
Rails 3 - RS on Rails - 21aug2010Plataformatec
 
Project Rescue - Oxente Rails - 05aug2010
Project Rescue - Oxente Rails - 05aug2010Project Rescue - Oxente Rails - 05aug2010
Project Rescue - Oxente Rails - 05aug2010Plataformatec
 
The Plafatorma Way - Oxente Rails - 05aug2010
The Plafatorma Way - Oxente Rails - 05aug2010The Plafatorma Way - Oxente Rails - 05aug2010
The Plafatorma Way - Oxente Rails - 05aug2010Plataformatec
 
Classificação de textos - Dev in Sampa - 28nov2009
Classificação de textos - Dev in Sampa - 28nov2009Classificação de textos - Dev in Sampa - 28nov2009
Classificação de textos - Dev in Sampa - 28nov2009Plataformatec
 
Devise - RSLA - 13oct2009
Devise - RSLA - 13oct2009Devise - RSLA - 13oct2009
Devise - RSLA - 13oct2009Plataformatec
 

Mehr von Plataformatec (13)

Do your own hacking evening - RubyConf UR
Do your own hacking evening - RubyConf URDo your own hacking evening - RubyConf UR
Do your own hacking evening - RubyConf UR
 
Product Owner - Simples como dizem? - Agile Tour 2011
Product Owner - Simples como dizem? - Agile Tour 2011Product Owner - Simples como dizem? - Agile Tour 2011
Product Owner - Simples como dizem? - Agile Tour 2011
 
As reais razões do porque eu devo ser Ágil - Agile Tour São Paulo
As reais razões do porque eu devo ser Ágil - Agile Tour São PauloAs reais razões do porque eu devo ser Ágil - Agile Tour São Paulo
As reais razões do porque eu devo ser Ágil - Agile Tour São Paulo
 
Writing your own programming language to understand Ruby better - Euruko 2011
Writing your own programming language to understand Ruby better - Euruko 2011Writing your own programming language to understand Ruby better - Euruko 2011
Writing your own programming language to understand Ruby better - Euruko 2011
 
Railties - Ruby Masters Conf - 26Feb2011
Railties - Ruby Masters Conf - 26Feb2011Railties - Ruby Masters Conf - 26Feb2011
Railties - Ruby Masters Conf - 26Feb2011
 
Rails 2.3, 3.0 and 3.1 - RubyConfBR - 26oct2010
Rails 2.3, 3.0 and 3.1 - RubyConfBR - 26oct2010Rails 2.3, 3.0 and 3.1 - RubyConfBR - 26oct2010
Rails 2.3, 3.0 and 3.1 - RubyConfBR - 26oct2010
 
Rails 3 - The Developers Conference - 21aug2010
Rails 3 - The Developers Conference - 21aug2010Rails 3 - The Developers Conference - 21aug2010
Rails 3 - The Developers Conference - 21aug2010
 
CRUDing Open Source - WhyDay - 19aug2010
CRUDing Open Source - WhyDay - 19aug2010CRUDing Open Source - WhyDay - 19aug2010
CRUDing Open Source - WhyDay - 19aug2010
 
Rails 3 - RS on Rails - 21aug2010
Rails 3 - RS on Rails - 21aug2010Rails 3 - RS on Rails - 21aug2010
Rails 3 - RS on Rails - 21aug2010
 
Project Rescue - Oxente Rails - 05aug2010
Project Rescue - Oxente Rails - 05aug2010Project Rescue - Oxente Rails - 05aug2010
Project Rescue - Oxente Rails - 05aug2010
 
The Plafatorma Way - Oxente Rails - 05aug2010
The Plafatorma Way - Oxente Rails - 05aug2010The Plafatorma Way - Oxente Rails - 05aug2010
The Plafatorma Way - Oxente Rails - 05aug2010
 
Classificação de textos - Dev in Sampa - 28nov2009
Classificação de textos - Dev in Sampa - 28nov2009Classificação de textos - Dev in Sampa - 28nov2009
Classificação de textos - Dev in Sampa - 28nov2009
 
Devise - RSLA - 13oct2009
Devise - RSLA - 13oct2009Devise - RSLA - 13oct2009
Devise - RSLA - 13oct2009
 

Kürzlich hochgeladen

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 

Kürzlich hochgeladen (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 

Thor - RSLA - 13oct2009

  • 1. Geradores de código com Thor @josevalim http://plataformatec.com.br jose@plataformatec.com.br Plataforma Tecnologia, José Valim 2009
  • 2. Quem sou? Plataforma Tecnologia, José Valim 2009
  • 3. Desenvolvedor líder na Plataforma Tecnologia Plataforma Tecnologia, José Valim 2009
  • 4. 22 anos, Engenheiro pela Escola Politécnica Plataforma Tecnologia, José Valim 2009
  • 5. Desenvolvedor ruby há quase 3 anos Plataforma Tecnologia, José Valim 2009
  • 6. Google Summer of Code Student e contribuidor ativo do Rails Core Plataforma Tecnologia, José Valim 2009
  • 7. Inherited Resources Plataforma Tecnologia, José Valim 2009
  • 8. Inherited Resources Rails Footnotes Plataforma Tecnologia, José Valim 2009
  • 9. Inherited Resources Rails Footnotes Remarkable Plataforma Tecnologia, José Valim 2009
  • 10. Inherited Resources Rails Footnotes Remarkable Formtastic Plataforma Tecnologia, José Valim 2009
  • 11. O que está errado com os geradores do Rails 2.x? Plataforma Tecnologia, José Valim 2009
  • 12. script/generate scaffold Plataforma Tecnologia, José Valim 2009
  • 13. script/generate scaffold ActiveRecord TestUnit ERB Plataforma Tecnologia, José Valim 2009
  • 14. script/generate rspec_scaffold Plataforma Tecnologia, José Valim 2009
  • 15. script/generate rspec_scaffold ActiveRecord Rspec ERB Plataforma Tecnologia, José Valim 2009
  • 16. script/generate dm_scaffold Plataforma Tecnologia, José Valim 2009
  • 17. script/generate dm_scaffold DataMapper TestUnit ERB Plataforma Tecnologia, José Valim 2009
  • 18. script/generate dm_rspec_scaffold Plataforma Tecnologia, José Valim 2009
  • 19. script/generate dm_rspec_scaffold DataMapper Rspec ERB Plataforma Tecnologia, José Valim 2009
  • 20. Agnosticismo? Plataforma Tecnologia, José Valim 2009
  • 21. Remarkable + Inherited Resources + Formtastic Plataforma Tecnologia, José Valim 2009
  • 22. Remarkable + Inherited Resources + Formtastic = Plataforma Tecnologia, José Valim 2009
  • 23. Remarkable + Inherited Resources + Formtastic = script/generate remarkable_inherited_formta stic_scaffold Plataforma Tecnologia, José Valim 2009
  • 24. Remarkable + Inherited Resources + Formtastic = script/generate remarkable_inherited_formta stic_scaffold FAIL? Plataforma Tecnologia, José Valim 2009
  • 25. script/generate nifty_scaffold script/generate dry_scaffold Plataforma Tecnologia, José Valim 2009
  • 26. Pouca reutilização de código Plataforma Tecnologia, José Valim 2009
  • 27. Sem divisão de responsabilidades Plataforma Tecnologia, José Valim 2009
  • 29. Por quê Thor? Plataforma Tecnologia, José Valim 2009
  • 30. class AppGenerator < Thor::Group def create_app_folders empty_directory “app/models” empty_directory “app/controllers” end def copy_config_files copy_file “config/routes.rb” end end Plataforma Tecnologia, José Valim 2009
  • 31. class AppGenerator < Thor::Group def create_app_folders empty_directory “app/models” empty_directory “app/controllers” end def copy_config_files copy_file “config/routes.rb” end end Plataforma Tecnologia, José Valim 2009
  • 32. class AppGenerator < Thor::Group def create_app_folders empty_directory “app/models” empty_directory “app/controllers” end def copy_config_files copy_file “config/routes.rb” end end Plataforma Tecnologia, José Valim 2009
  • 33. Execute tudo... AppGenerator.start Plataforma Tecnologia, José Valim 2009
  • 34. ou selecione! app_tasks = AppGenerator.new app_tasks.create_app_folders app_tasks.copy_config_files Plataforma Tecnologia, José Valim 2009
  • 35. Herança Plataforma Tecnologia, José Valim 2009
  • 36. module Rails::Generators class ScaffoldGenerator < ResourceGenerator # generation end end Plataforma Tecnologia, José Valim 2009
  • 37. Argumentos Plataforma Tecnologia, José Valim 2009
  • 38. script/generate scaffold User name:string --no-layout -o datamapper -t rspec Plataforma Tecnologia, José Valim 2009
  • 39. self.class_name script/generate scaffold User name:string --no-layout -o datamapper -t rspec Plataforma Tecnologia, José Valim 2009
  • 40. self.attributes script/generate scaffold User name:string --no-layout -o datamapper -t rspec Plataforma Tecnologia, José Valim 2009
  • 41. Opções Plataforma Tecnologia, José Valim 2009
  • 42. script/generate scaffold User name:string --no-layout -o datamapper -t rspec Plataforma Tecnologia, José Valim 2009
  • 43. script/generate scaffold User name:string --no-layout -o datamapper -t rspec self.options[:orm] #=> “datamapper” Plataforma Tecnologia, José Valim 2009
  • 44. script/generate scaffold User name:string --no-layout -o datamapper -t rspec self.options.layout? #=> false Plataforma Tecnologia, José Valim 2009
  • 45. :type => :string --orm=activerecord Plataforma Tecnologia, José Valim 2009
  • 46. :type => :numeric --rails=3.0 Plataforma Tecnologia, José Valim 2009
  • 47. :type => :boolean --layout --no-helpers Plataforma Tecnologia, José Valim 2009
  • 48. :type => :array --actions=index new create Plataforma Tecnologia, José Valim 2009
  • 49. :type => :hash --actions=name:string age:index Plataforma Tecnologia, José Valim 2009
  • 50. :required, :desc, :optional Plataforma Tecnologia, José Valim 2009
  • 51. Invocações Plataforma Tecnologia, José Valim 2009
  • 52. class ResourceGenerator < Thor::Group def run_dependencies invoke ModelGenerator invoke ControllerGenerator invoke “testunit:resource” end end Plataforma Tecnologia, José Valim 2009
  • 53. class ResourceGenerator < Thor::Group def run_dependencies invoke ModelGenerator invoke ControllerGenerator invoke “testunit:resource” end end Plataforma Tecnologia, José Valim 2009
  • 54. invoke ModelGenerator Plataforma Tecnologia, José Valim 2009
  • 55. invoke ModelGenerator ModelGenerator.start Plataforma Tecnologia, José Valim 2009
  • 56. invoke ModelGenerator != ModelGenerator.start Plataforma Tecnologia, José Valim 2009
  • 57. Shell Plataforma Tecnologia, José Valim 2009
  • 58. Gerencia input e output Plataforma Tecnologia, José Valim 2009
  • 59. Thor::Shell::Basic Plataforma Tecnologia, José Valim 2009
  • 60. Thor::Shell::Basic Apenas para Windows Plataforma Tecnologia, José Valim 2009
  • 61. Thor::Shell::Color Plataforma Tecnologia, José Valim 2009
  • 62. Thor::Shell::Web Plataforma Tecnologia, José Valim 2009
  • 63. Thor::Shell::Web ? Plataforma Tecnologia, José Valim 2009
  • 65. Qual a diferença entre geradores de código e tarefas (como rake)? Plataforma Tecnologia, José Valim 2009
  • 66. Geradores de código são um grupo de tarefas Plataforma Tecnologia, José Valim 2009
  • 67. class Alphabet < Thor def a print :a end def b print :b end end $ thor alphabet:a #=> “a” $ thor alphabet:b #=> “b” Plataforma Tecnologia, José Valim 2009
  • 68. class Alphabet < Thor def a print :a end def b print :b end end $ thor alphabet:a #=> “a” $ thor alphabet:b #=> “b” Plataforma Tecnologia, José Valim 2009
  • 69. class Alphabet < Thor def a print :a end def b print :b end end $ thor alphabet:a #=> “a” $ thor alphabet:b #=> “b” Plataforma Tecnologia, José Valim 2009
  • 70. class Alphabet < Thor::Group def a print :a end def b print :b end end $ thor alphabet #=> “ab” Plataforma Tecnologia, José Valim 2009
  • 71. class Alphabet < Thor::Group def a print :a end def b print :b end end $ thor alphabet #=> “ab” Plataforma Tecnologia, José Valim 2009
  • 72. Thor Plataforma Tecnologia, José Valim 2009
  • 73. Thor = Plataforma Tecnologia, José Valim 2009
  • 74. Thor = Rake Plataforma Tecnologia, José Valim 2009
  • 75. Thor = Rake + Sake Plataforma Tecnologia, José Valim 2009
  • 76. Thor = Rake + Sake + Rubigen Plataforma Tecnologia, José Valim 2009
  • 77. Thor = Rake + Sake + Rubigen + RailsTemplates Plataforma Tecnologia, José Valim 2009
  • 78. Thor::Actions == RailsTemplates Plataforma Tecnologia, José Valim 2009
  • 79. create_file “users_helper.rb”, <<-END module UsersHelper end END Plataforma Tecnologia, José Valim 2009
  • 80. copy_file “doc/README”, “doc/README” copy_file “doc/README” Plataforma Tecnologia, José Valim 2009
  • 81. Thor.source_root copy_file “doc/README”, “doc/README” copy_file “doc/README” Plataforma Tecnologia, José Valim 2009
  • 82. Dir.pwd copy_file “doc/README”, “doc/README” copy_file “doc/README” Plataforma Tecnologia, José Valim 2009
  • 83. get “http://pastie.org/2.txt”, “pastie.rb” get “http://pastie.org/2.txt” do |content| content =~ /class (w)+/ “#{$1 || 'content'}.rb” end Plataforma Tecnologia, José Valim 2009
  • 84. template “doc/README”, “doc/README” template “doc/README.tt” Plataforma Tecnologia, José Valim 2009
  • 85. chmod “script/*”, 755 Plataforma Tecnologia, José Valim 2009
  • 86. prepend_file “environments/test.rb” “config.gem "rspec"” prepend_file “environments/test.rb” do “config.gem "rspec"” end Plataforma Tecnologia, José Valim 2009
  • 87. append_file “environments/test.rb” “config.gem "rspec"” append_file “environments/test.rb” do “config.gem "rspec"” end Plataforma Tecnologia, José Valim 2009
  • 88. flag = "Rails::Initializer.run do |config|n" inject_into_file "config/environment.rb", "config.gem :thor", :after => flag Plataforma Tecnologia, José Valim 2009
  • 89. inject_into_class “users_controller.rb” UsersController, “before_filter :authenticate” Plataforma Tecnologia, José Valim 2009
  • 90. remove_file “doc/README” Plataforma Tecnologia, José Valim 2009
  • 91. empty_directory “doc” Plataforma Tecnologia, José Valim 2009
  • 92. directory “script”, “script” directory “script” Plataforma Tecnologia, José Valim 2009
  • 93. inside “doc” do copy_file “README” end Plataforma Tecnologia, José Valim 2009
  • 94. apply "http://gist.github.com/103208.txt" Plataforma Tecnologia, José Valim 2009
  • 95. run “ln -s ~/edge rails” Plataforma Tecnologia, José Valim 2009
  • 96. Actions específicas do Rails em: Rails::Generators::Actions Plataforma Tecnologia, José Valim 2009
  • 97. Thor unifica APIs de geradores de código, tarefas e templates do Rails Plataforma Tecnologia, José Valim 2009
  • 98. Rails::Generators Plataforma Tecnologia, José Valim 2009
  • 99. module Rails::Generators class ControllerGenerator < NamedBase argument :actions, :type => :array, :default => [] check_class_collision :suffix => "Controller" def create_controller_files destination = File.join('app/controllers', class_path, "#{file_name}_controller.rb") template 'controller.rb', destination end hook_for :template_engine, :test_framework, :helper end end Plataforma Tecnologia, José Valim 2009
  • 100. module Rails::Generators class ControllerGenerator < NamedBase argument :actions, :type => :array, :default => [] check_class_collision :suffix => "Controller" def create_controller_files destination = File.join('app/controllers', class_path, "#{file_name}_controller.rb") template 'controller.rb', destination end hook_for :template_engine, :test_framework, :helper end end Plataforma Tecnologia, José Valim 2009
  • 101. module Rails::Generators class ControllerGenerator < NamedBase argument :actions, :type => :array, :default => [] check_class_collision :suffix => "Controller" def create_controller_files destination = File.join('app/controllers', class_path, "#{file_name}_controller.rb") template 'controller.rb', destination end hook_for :template_engine, :test_framework, :helper end end Plataforma Tecnologia, José Valim 2009
  • 102. module Rails::Generators class ControllerGenerator < NamedBase argument :actions, :type => :array, :default => [] check_class_collision :suffix => "Controller" def create_controller_files destination = File.join('app/controllers', class_path, "#{file_name}_controller.rb") template 'controller.rb', destination end hook_for :template_engine, :test_framework, :helper end end Plataforma Tecnologia, José Valim 2009
  • 103. module Rails::Generators class ControllerGenerator < NamedBase argument :actions, :type => :array, :default => [] check_class_collision :suffix => "Controller" def create_controller_files destination = File.join('app/controllers', class_path, "#{file_name}_controller.rb") template 'controller.rb', destination end hook_for :template_engine, :test_framework, :helper end end Plataforma Tecnologia, José Valim 2009
  • 104. module Rails::Generators class ControllerGenerator < NamedBase argument :actions, :type => :array, :default => [] check_class_collision :suffix => "Controller" def create_controller_files destination = File.join('app/controllers', class_path, "#{file_name}_controller.rb") template 'controller.rb', destination end hook_for :template_engine, :test_framework, :helper end end Plataforma Tecnologia, José Valim 2009
  • 105. module Rails::Generators class ControllerGenerator < NamedBase argument :actions, :type => :array, :default => [] check_class_collision :suffix => "Controller" def create_controller_files destination = File.join('app/controllers', class_path, "#{file_name}_controller.rb") template 'controller.rb', destination end hook_for :template_engine, :test_framework, :helper end end Plataforma Tecnologia, José Valim 2009
  • 106. module Rails::Generators class ControllerGenerator < NamedBase argument :actions, :type => :array, :default => [] check_class_collision :suffix => "Controller" def create_controller_files destination = File.join('app/controllers', class_path, "#{file_name}_controller.rb") template 'controller.rb', destination end hook_for :template_engine, :test_framework, :helper end end Plataforma Tecnologia, José Valim 2009
  • 107. module Rails::Generators class ControllerGenerator < NamedBase argument :actions, :type => :array, :default => [] check_class_collision :suffix => "Controller" def create_controller_files destination = File.join('app/controllers', class_path, "#{file_name}_controller.rb") template 'controller.rb', destination end hook_for :template_engine, :test_framework, :helper end end Plataforma Tecnologia, José Valim 2009
  • 108. module Rails::Generators class ControllerGenerator < NamedBase argument :actions, :type => :array, :default => [] check_class_collision :suffix => "Controller" def create_controller_files destination = File.join('app/controllers', class_path, "#{file_name}_controller.rb") template 'controller.rb', destination end hook_for :template_engine, :test_framework, :helper end end Plataforma Tecnologia, José Valim 2009
  • 109. hook_for :test_framework Plataforma Tecnologia, José Valim 2009
  • 110. hook_for :test_framework --test_framework=rspec Plataforma Tecnologia, José Valim 2009
  • 111. hook_for :test_framework --test_framework=rspec invoke “rspec:controller” Plataforma Tecnologia, José Valim 2009
  • 112. Thorfile Plataforma Tecnologia, José Valim 2009
  • 113. Thor::RakeCompat Plataforma Tecnologia, José Valim 2009
  • 114. require File.join(File.dirname(__FILE__), 'config', 'boot') require 'rake/testtask' require 'rake/rdoctask' require 'thor/rake_compat' class Default < Thor include Thor::RakeCompat require 'rails/tasks' end Plataforma Tecnologia, José Valim 2009
  • 115. require File.join(File.dirname(__FILE__), 'config', 'boot') require 'rake/testtask' require 'rake/rdoctask' require 'thor/rake_compat' class Default < Thor include Thor::RakeCompat require 'rails/tasks' end Plataforma Tecnologia, José Valim 2009
  • 116. require File.join(File.dirname(__FILE__), 'config', 'boot') require 'rake/testtask' require 'rake/rdoctask' require 'thor/rake_compat' class Default < Thor include Thor::RakeCompat require 'rails/tasks' end Plataforma Tecnologia, José Valim 2009
  • 117. require File.join(File.dirname(__FILE__), 'config', 'boot') require 'rake/testtask' require 'rake/rdoctask' require 'thor/rake_compat' class Default < Thor include Thor::RakeCompat require 'rails/tasks' end Plataforma Tecnologia, José Valim 2009
  • 118. Show me the code! Plataforma Tecnologia, José Valim 2009
  • 119. ?! @josevalim http://plataformatec.com.br jose@plataformatec.com.br Plataforma Tecnologia, José Valim 2009
  • 120. blog.plataformatec.com.br @josevalim http://plataformatec.com.br jose@plataformatec.com.br Plataforma Tecnologia, José Valim 2009