SlideShare a Scribd company logo
Tres gemas de Ruby
          Leo Soto M.
   Lenguajes Dinámicos Chile
1. Rake
¿Algo así como Make?
ps: $(NAME).ps

%.ps: %.dvi
        dvips $(DVIPSOPT) $< -o $@

hyper: $(NAME).dtx $(NAME).sty
        pdflatex "relaxletmakehyperrefactiveinput $(NAME).dtx"

$(NAME).pdf: $(NAME).dtx $(NAME).sty
        pdflatex $(NAME).dtx

archive:
         @ tar -czf $(ARCHNAME) $(ARCHIVE)
         @ echo $(ARCHNAME)

clean:
        rm -f $(NAME).
{log,toc,lot,lof,idx,ilg,ind,aux,blg,bbl,dvi,ins,out}

distclean: clean
        rm -f $(NAME).{ps,sty,pdf} $(ARCHNAME)
http://www.flickr.com/photos/ross/28330560/
Dos grandes diferencias:
task :compile do
  mxmlc 'FlexApp', OUTPUT_FOLDER, ['libs/ThunderBoltAS3_Flex.swc']
end

task :test do
  mxmlc 'TestRunner', '', ['libs/flexunit.swc']
  run_swf 'TestRunner.swf'
end

task :copy_to_main_project => [:compile] do
  sh "cp -af #{FILES_TO_COPY} #{OUTPUT_FOLDER}"
end

task :clean do
  sh "rm -rf #{OUTPUT_FOLDER}/*"
end

task :default => [:compile, :copy_to_main_project]
task :compile do
  mxmlc 'FlexApp', OUTPUT_FOLDER, ['libs/ThunderBoltAS3_Flex.swc']
end

task :test do
  mxmlc 'TestRunner', '', ['libs/flexunit.swc']
  run_swf 'TestRunner.swf'
end

task :copy_to_main_project => [:compile] do
  sh "cp -af #{FILES_TO_COPY} #{OUTPUT_FOLDER}"
end

task :clean do
  sh "rm -rf #{OUTPUT_FOLDER}/*"
end

task :default => [:compile, :copy_to_main_project]
def mxmlc(file, output_folder, include_libraries=nil,
          warnings=false, debug=true)
  # Uses fcshd <http://code.google.com/p/flex-compiler-shell-daemon/>
  # if found:
  if command_exists? "fcshd.py" and not ENV['IGNORE_FCSH']
    # fcshd wants absolute paths
    file = File.expand_path(file)
    output_folder = File.expand_path(output_folder)
    if include_libraries
      include_libraries =
        include_libraries.map { |x| File.expand_path(x) }
    end

    cmdline = mxmlc_cmdline(file, output_folder, include_libraries,
                            warnings, debug)
    sh "fcshd.py "mxmlc #{cmdline}""
  else
    cmdline = mxmlc_cmdline(file, output_folder, include_libraries,
                            warnings, debug)
    sh "$FLEX_HOME/bin/mxmlc #{cmdline}"
  end
end
task :compile do
  mxmlc 'FlexApp', OUTPUT_FOLDER, ['libs/ThunderBoltAS3_Flex.swc']
end

task :test do
  mxmlc 'TestRunner', '', ['libs/flexunit.swc']
  run_swf 'TestRunner.swf'
end

task :copy_to_main_project => [:compile] do
  sh "cp -af #{FILES_TO_COPY} #{OUTPUT_FOLDER}"
end

task :clean do
  sh "rm -rf #{OUTPUT_FOLDER}/*"
end

task :default => [:compile, :copy_to_main_project]
def run_swf(swf)
  FLASH_PLAYERS.each do |cmd|
    if command_exists? cmd
      sh "#{cmd} #{swf}"
      return
    end
  end
end
Y metaprogramming!
namespace :rpc do
  task :compile => [:bigflexlib, :semanticflash] do
    compile_sandbox "rpc"
  end
  task :run => [:compile] do
    run_sandbox "rpc"
  end
end
namespace :graph do
  task :compile => [:bigflexlib, :semanticflash] do
    compile_sandbox "graph"
  end
  task :run => [:compile] do
    run_sandbox "graph"
  end
end
namespace :lang do
  task :compile => [:bigflexlib, :semanticflash] do
    compile_sandbox "lang"
  end
  task :run => [:compile] do
    run_sandbox "lang"
  end
end
$ rake rpc:compile
$ rake graph:compile
namespace :rpc do
  task :compile => [:bigflexlib, :semanticflash] do
    compile_sandbox "rpc"
  end
  task :run => [:compile] do
    run_sandbox "rpc"
  end
end
namespace :graph do
  task :compile => [:bigflexlib, :semanticflash] do
    compile_sandbox "graph"
  end
  task :run => [:compile] do
    run_sandbox "graph"
  end
end
namespace :lang do
  task :compile => [:bigflexlib, :semanticflash] do
    compile_sandbox "lang"
  end
  task :run => [:compile] do
    run_sandbox "lang"
  end
end
def flex_sandbox(*names)
  names.each do |name|
    namespace name do
      task :compile => [:bigflexlib, :semanticflash] do
        compile_sandbox name
      end
      task :run => [:compile] do
        run_sandbox name
      end
    end
  end

  namespace :sandboxes do
    task :compile => names.map { |name| "#{name}:compile" }
    task :run => names.map { |name| "#{name}:run"}
  end
end
def flex_sandbox(*names)
  names.each do |name|
    namespace name do
      task :compile => [:bigflexlib, :semanticflash] do
        compile_sandbox name
      end
      task :run => [:compile] do
        run_sandbox name
      end
    end
  end

  namespace :sandboxes do
    task :compile => names.map { |name| "#{name}:compile" }
    task :run => names.map { |name| "#{name}:run"}
  end
end

flex_sandbox :rpc,
             :graph,
             :lang
$ rake rpc:compile
$ rake graph:compile
$ rake rpc:compile
$ rake graph:compile
$ rake sandboxes:compile
2. RSpec
xUnit vs RSpec:
class FactorialTestCase < TestCase
  def test_factorial_method_added_to_integer_numbers
    assert_true 1.respond_to?(:factorial)
  end
  def test_factorial_of_zero
    assert_equals 0.factorial, 1
  end
  def test_factorial_of_positives
    assert_equals 1.factorial, 1
    assert_equals 2.factorial, 2
    assert_equals 3.factorial, 6
    assert_equals 20.factorial, 2432902008176640000
  end
  def test_factorial_of_negatives
    assert_raises ArgumentError do
      -1.factorial
    end
  end
end
describe '#factorial' do
  it "adds a factorial method to integer numbers" do
    1.respond_to?(:factorial).should be_true
  end
  it "defines the factorial of 0 as 1" do
    0.factorial.should == 1
  end
  it "calculates the factorial of any positive integer" do
    1.factorial.should == 1
    2.factorial.should == 2
    3.factorial.should == 6
    20.factorial.should == 2432902008176640000
  end
  it "raises an exception when applied to negative numbers" do
    -1.factorial.should raise_error(ArgumentError)
  end
end
describe '#prime?' do
  it "adds a prime method to integer numbers" do
    1.respond_to?(:prime?).should be_true
  end
  it "returns true for prime numbers" do
    2.should be_prime
    3.should be_prime
    11.should be_prime
    97.should be_prime
    727.should be_prime
  end
  it "returns false for non prime numbers" do
    20.should_not be_prime
    999.should_not be_prime
  end
end
One more thing...
One more thing...

   3. WebRat
describe "creating a new CEO letter campaign" do
  before do
    click_link 'Campaigns'
    click_link 'New CEO Letter Campaign'
  end

 it "persists delivery method, start date and end date" do
   check 'Email'
   click_button 'Create campaign'
   response.body.should contain_text("1 Delivery method: Email")
   response.body.should contain("12/12/2009")
   response.body.should contain("6/12/2010")
 end

  it "allows an email campaign" do
    check 'Email'
    click_button 'Create campaign'
    response.body.should contain_text("1 Delivery method: Email")
  end
end
http://rake.rubyforge.org/

             http://rspec.info/

http://gitrdoc.com/brynary/webrat/tree/master/
http://rake.rubyforge.org/

             http://rspec.info/

http://gitrdoc.com/brynary/webrat/tree/master/



                 ¡Gracias!

More Related Content

What's hot

全裸でワンライナー(仮)
全裸でワンライナー(仮)全裸でワンライナー(仮)
全裸でワンライナー(仮)
Yoshihiro Sugi
 
Unix cheatsheet
Unix cheatsheetUnix cheatsheet
Unix cheatsheet
Dhaval Shukla
 
RedHat/CentOs Commands for administrative works
RedHat/CentOs Commands for administrative worksRedHat/CentOs Commands for administrative works
RedHat/CentOs Commands for administrative works
Md Shihab
 
Bag of tricks
Bag of tricksBag of tricks
Bag of tricks
brian d foy
 
Shell实现的windows回收站功能的脚本
Shell实现的windows回收站功能的脚本Shell实现的windows回收站功能的脚本
Shell实现的windows回收站功能的脚本
Lingfei Kong
 
Shell Script to Extract IP Address, MAC Address Information
Shell Script to Extract IP Address, MAC Address InformationShell Script to Extract IP Address, MAC Address Information
Shell Script to Extract IP Address, MAC Address Information
VCP Muthukrishna
 
Bash Script Disk Space Utilization Report and EMail
Bash Script Disk Space Utilization Report and EMailBash Script Disk Space Utilization Report and EMail
Bash Script Disk Space Utilization Report and EMail
VCP Muthukrishna
 
File Space Usage Information and EMail Report - Shell Script
File Space Usage Information and EMail Report - Shell ScriptFile Space Usage Information and EMail Report - Shell Script
File Space Usage Information and EMail Report - Shell Script
VCP Muthukrishna
 
Workshop on command line tools - day 2
Workshop on command line tools - day 2Workshop on command line tools - day 2
Workshop on command line tools - day 2
Leandro Lima
 
Perl6 one-liners
Perl6 one-linersPerl6 one-liners
Perl6 one-liners
Andrew Shitov
 
Unit 7 standard i o
Unit 7 standard i oUnit 7 standard i o
Unit 7 standard i oroot_fibo
 
Workshop on command line tools - day 1
Workshop on command line tools - day 1Workshop on command line tools - day 1
Workshop on command line tools - day 1
Leandro Lima
 
App-o-Lockalypse now!
App-o-Lockalypse now!App-o-Lockalypse now!
App-o-Lockalypse now!
Oddvar Moe
 
Elixir & Phoenix - fast, concurrent and explicit
Elixir & Phoenix - fast, concurrent and explicitElixir & Phoenix - fast, concurrent and explicit
Elixir & Phoenix - fast, concurrent and explicit
Tobias Pfeiffer
 
Parsing JSON with a single regex
Parsing JSON with a single regexParsing JSON with a single regex
Parsing JSON with a single regex
brian d foy
 
"PostgreSQL and Python" Lightning Talk @EuroPython2014
"PostgreSQL and Python" Lightning Talk @EuroPython2014"PostgreSQL and Python" Lightning Talk @EuroPython2014
"PostgreSQL and Python" Lightning Talk @EuroPython2014
Henning Jacobs
 
Ruby to Elixir - what's great and what you might miss
Ruby to Elixir - what's great and what you might missRuby to Elixir - what's great and what you might miss
Ruby to Elixir - what's great and what you might miss
Tobias Pfeiffer
 
我在 Mac 上的常用开发工具
我在 Mac 上的常用开发工具我在 Mac 上的常用开发工具
我在 Mac 上的常用开发工具
dennis zhuang
 

What's hot (20)

全裸でワンライナー(仮)
全裸でワンライナー(仮)全裸でワンライナー(仮)
全裸でワンライナー(仮)
 
Unix cheatsheet
Unix cheatsheetUnix cheatsheet
Unix cheatsheet
 
RedHat/CentOs Commands for administrative works
RedHat/CentOs Commands for administrative worksRedHat/CentOs Commands for administrative works
RedHat/CentOs Commands for administrative works
 
Bag of tricks
Bag of tricksBag of tricks
Bag of tricks
 
Shell实现的windows回收站功能的脚本
Shell实现的windows回收站功能的脚本Shell实现的windows回收站功能的脚本
Shell实现的windows回收站功能的脚本
 
Shell Script to Extract IP Address, MAC Address Information
Shell Script to Extract IP Address, MAC Address InformationShell Script to Extract IP Address, MAC Address Information
Shell Script to Extract IP Address, MAC Address Information
 
Bash Script Disk Space Utilization Report and EMail
Bash Script Disk Space Utilization Report and EMailBash Script Disk Space Utilization Report and EMail
Bash Script Disk Space Utilization Report and EMail
 
File Space Usage Information and EMail Report - Shell Script
File Space Usage Information and EMail Report - Shell ScriptFile Space Usage Information and EMail Report - Shell Script
File Space Usage Information and EMail Report - Shell Script
 
Workshop on command line tools - day 2
Workshop on command line tools - day 2Workshop on command line tools - day 2
Workshop on command line tools - day 2
 
serverstats
serverstatsserverstats
serverstats
 
Perl6 one-liners
Perl6 one-linersPerl6 one-liners
Perl6 one-liners
 
Unit 7 standard i o
Unit 7 standard i oUnit 7 standard i o
Unit 7 standard i o
 
Workshop on command line tools - day 1
Workshop on command line tools - day 1Workshop on command line tools - day 1
Workshop on command line tools - day 1
 
App-o-Lockalypse now!
App-o-Lockalypse now!App-o-Lockalypse now!
App-o-Lockalypse now!
 
Elixir & Phoenix - fast, concurrent and explicit
Elixir & Phoenix - fast, concurrent and explicitElixir & Phoenix - fast, concurrent and explicit
Elixir & Phoenix - fast, concurrent and explicit
 
Parsing JSON with a single regex
Parsing JSON with a single regexParsing JSON with a single regex
Parsing JSON with a single regex
 
"PostgreSQL and Python" Lightning Talk @EuroPython2014
"PostgreSQL and Python" Lightning Talk @EuroPython2014"PostgreSQL and Python" Lightning Talk @EuroPython2014
"PostgreSQL and Python" Lightning Talk @EuroPython2014
 
Bash Scripting Workshop
Bash Scripting WorkshopBash Scripting Workshop
Bash Scripting Workshop
 
Ruby to Elixir - what's great and what you might miss
Ruby to Elixir - what's great and what you might missRuby to Elixir - what's great and what you might miss
Ruby to Elixir - what's great and what you might miss
 
我在 Mac 上的常用开发工具
我在 Mac 上的常用开发工具我在 Mac 上的常用开发工具
我在 Mac 上的常用开发工具
 

Similar to Tres Gemas De Ruby

Fabric Python Lib
Fabric Python LibFabric Python Lib
Fabric Python Lib
Simone Federici
 
Blocks by Lachs Cox
Blocks by Lachs CoxBlocks by Lachs Cox
Blocks by Lachs Cox
lachie
 
Phoenix for laravel developers
Phoenix for laravel developersPhoenix for laravel developers
Phoenix for laravel developers
Luiz Messias
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slidesharetomcopeland
 
Why ruby
Why rubyWhy ruby
Why ruby
rstankov
 
Desarrollando aplicaciones web en minutos
Desarrollando aplicaciones web en minutosDesarrollando aplicaciones web en minutos
Desarrollando aplicaciones web en minutosEdgar Suarez
 
Ruby on Rails at PROMPT ISEL '11
Ruby on Rails at PROMPT ISEL '11Ruby on Rails at PROMPT ISEL '11
Ruby on Rails at PROMPT ISEL '11
Pedro Cunha
 
Ruby: OOP, metaprogramming, blocks, iterators, mix-ins, duck typing. Code style
Ruby: OOP, metaprogramming, blocks, iterators, mix-ins, duck typing. Code styleRuby: OOP, metaprogramming, blocks, iterators, mix-ins, duck typing. Code style
Ruby: OOP, metaprogramming, blocks, iterators, mix-ins, duck typing. Code styleAnton Shemerey
 
DataMapper
DataMapperDataMapper
DataMapper
Yehuda Katz
 
Integrating Flex And Rails With Ruby Amf
Integrating Flex And Rails With Ruby AmfIntegrating Flex And Rails With Ruby Amf
Integrating Flex And Rails With Ruby Amfrailsconf
 
Flex With Rubyamf
Flex With RubyamfFlex With Rubyamf
Flex With Rubyamf
Tony Hillerson
 
Damn Fine CoffeeScript
Damn Fine CoffeeScriptDamn Fine CoffeeScript
Damn Fine CoffeeScript
niklal
 
Things about Functional JavaScript
Things about Functional JavaScriptThings about Functional JavaScript
Things about Functional JavaScript
ChengHui Weng
 
PHP PPT FILE
PHP PPT FILEPHP PPT FILE
PHP PPT FILE
AbhishekSharma2958
 
Ruby on Rails
Ruby on RailsRuby on Rails
Ruby on Rails
bryanbibat
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasminePaulo Ragonha
 
Real world scala
Real world scalaReal world scala
Real world scalalunfu zhong
 
Metaprogramovanie #1
Metaprogramovanie #1Metaprogramovanie #1
Metaprogramovanie #1Jano Suchal
 
03 Geographic scripting in uDig - halfway between user and developer
03 Geographic scripting in uDig - halfway between user and developer03 Geographic scripting in uDig - halfway between user and developer
03 Geographic scripting in uDig - halfway between user and developer
Andrea Antonello
 
Intro to Ruby - Twin Cities Code Camp 7
Intro to Ruby - Twin Cities Code Camp 7Intro to Ruby - Twin Cities Code Camp 7
Intro to Ruby - Twin Cities Code Camp 7
Brian Hogan
 

Similar to Tres Gemas De Ruby (20)

Fabric Python Lib
Fabric Python LibFabric Python Lib
Fabric Python Lib
 
Blocks by Lachs Cox
Blocks by Lachs CoxBlocks by Lachs Cox
Blocks by Lachs Cox
 
Phoenix for laravel developers
Phoenix for laravel developersPhoenix for laravel developers
Phoenix for laravel developers
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
 
Why ruby
Why rubyWhy ruby
Why ruby
 
Desarrollando aplicaciones web en minutos
Desarrollando aplicaciones web en minutosDesarrollando aplicaciones web en minutos
Desarrollando aplicaciones web en minutos
 
Ruby on Rails at PROMPT ISEL '11
Ruby on Rails at PROMPT ISEL '11Ruby on Rails at PROMPT ISEL '11
Ruby on Rails at PROMPT ISEL '11
 
Ruby: OOP, metaprogramming, blocks, iterators, mix-ins, duck typing. Code style
Ruby: OOP, metaprogramming, blocks, iterators, mix-ins, duck typing. Code styleRuby: OOP, metaprogramming, blocks, iterators, mix-ins, duck typing. Code style
Ruby: OOP, metaprogramming, blocks, iterators, mix-ins, duck typing. Code style
 
DataMapper
DataMapperDataMapper
DataMapper
 
Integrating Flex And Rails With Ruby Amf
Integrating Flex And Rails With Ruby AmfIntegrating Flex And Rails With Ruby Amf
Integrating Flex And Rails With Ruby Amf
 
Flex With Rubyamf
Flex With RubyamfFlex With Rubyamf
Flex With Rubyamf
 
Damn Fine CoffeeScript
Damn Fine CoffeeScriptDamn Fine CoffeeScript
Damn Fine CoffeeScript
 
Things about Functional JavaScript
Things about Functional JavaScriptThings about Functional JavaScript
Things about Functional JavaScript
 
PHP PPT FILE
PHP PPT FILEPHP PPT FILE
PHP PPT FILE
 
Ruby on Rails
Ruby on RailsRuby on Rails
Ruby on Rails
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
 
Real world scala
Real world scalaReal world scala
Real world scala
 
Metaprogramovanie #1
Metaprogramovanie #1Metaprogramovanie #1
Metaprogramovanie #1
 
03 Geographic scripting in uDig - halfway between user and developer
03 Geographic scripting in uDig - halfway between user and developer03 Geographic scripting in uDig - halfway between user and developer
03 Geographic scripting in uDig - halfway between user and developer
 
Intro to Ruby - Twin Cities Code Camp 7
Intro to Ruby - Twin Cities Code Camp 7Intro to Ruby - Twin Cities Code Camp 7
Intro to Ruby - Twin Cities Code Camp 7
 

More from Leonardo Soto

El arte oscuro de estimar v3
El arte oscuro de estimar v3El arte oscuro de estimar v3
El arte oscuro de estimar v3Leonardo Soto
 
Caching tips
Caching tipsCaching tips
Caching tips
Leonardo Soto
 
Una historia de ds ls en ruby
Una historia de ds ls en rubyUna historia de ds ls en ruby
Una historia de ds ls en ruby
Leonardo Soto
 
El Lado Cool de Java
El Lado Cool de JavaEl Lado Cool de Java
El Lado Cool de JavaLeonardo Soto
 
Mi Arsenal de Testing en Rails
Mi Arsenal de Testing en RailsMi Arsenal de Testing en Rails
Mi Arsenal de Testing en RailsLeonardo Soto
 
Mapas en la web con Cloudmade
Mapas en la web con CloudmadeMapas en la web con Cloudmade
Mapas en la web con CloudmadeLeonardo Soto
 
Decent exposure: Controladores sin @ivars
Decent exposure: Controladores sin @ivarsDecent exposure: Controladores sin @ivars
Decent exposure: Controladores sin @ivarsLeonardo Soto
 
The Hashrocket Way
The Hashrocket WayThe Hashrocket Way
The Hashrocket Way
Leonardo Soto
 
Sounds.gd lighting talk (RubyConf Uruguay)
Sounds.gd lighting talk (RubyConf Uruguay)Sounds.gd lighting talk (RubyConf Uruguay)
Sounds.gd lighting talk (RubyConf Uruguay)Leonardo Soto
 
Un tour por Java, Scala, Python, Ruby y Javascript
Un tour por Java, Scala, Python, Ruby y JavascriptUn tour por Java, Scala, Python, Ruby y Javascript
Un tour por Java, Scala, Python, Ruby y JavascriptLeonardo Soto
 
Lo que odiamos de la agilidad
Lo que odiamos de la agilidadLo que odiamos de la agilidad
Lo que odiamos de la agilidadLeonardo Soto
 
Javascript funcional
Javascript funcionalJavascript funcional
Javascript funcionalLeonardo Soto
 
Introducción a Git
Introducción a GitIntroducción a Git
Introducción a Git
Leonardo Soto
 
Jython: Python para la plataforma Java (EL2009)
Jython: Python para la plataforma Java (EL2009)Jython: Python para la plataforma Java (EL2009)
Jython: Python para la plataforma Java (EL2009)Leonardo Soto
 

More from Leonardo Soto (20)

El arte oscuro de estimar v3
El arte oscuro de estimar v3El arte oscuro de estimar v3
El arte oscuro de estimar v3
 
Caching tips
Caching tipsCaching tips
Caching tips
 
Una historia de ds ls en ruby
Una historia de ds ls en rubyUna historia de ds ls en ruby
Una historia de ds ls en ruby
 
El Lado Cool de Java
El Lado Cool de JavaEl Lado Cool de Java
El Lado Cool de Java
 
Dos Años de Rails
Dos Años de RailsDos Años de Rails
Dos Años de Rails
 
Dos años de Rails
Dos años de RailsDos años de Rails
Dos años de Rails
 
Mi Arsenal de Testing en Rails
Mi Arsenal de Testing en RailsMi Arsenal de Testing en Rails
Mi Arsenal de Testing en Rails
 
Mapas en la web con Cloudmade
Mapas en la web con CloudmadeMapas en la web con Cloudmade
Mapas en la web con Cloudmade
 
Startechconf
StartechconfStartechconf
Startechconf
 
RabbitMQ
RabbitMQRabbitMQ
RabbitMQ
 
Decent exposure: Controladores sin @ivars
Decent exposure: Controladores sin @ivarsDecent exposure: Controladores sin @ivars
Decent exposure: Controladores sin @ivars
 
The Hashrocket Way
The Hashrocket WayThe Hashrocket Way
The Hashrocket Way
 
Sounds.gd lighting talk (RubyConf Uruguay)
Sounds.gd lighting talk (RubyConf Uruguay)Sounds.gd lighting talk (RubyConf Uruguay)
Sounds.gd lighting talk (RubyConf Uruguay)
 
Un tour por Java, Scala, Python, Ruby y Javascript
Un tour por Java, Scala, Python, Ruby y JavascriptUn tour por Java, Scala, Python, Ruby y Javascript
Un tour por Java, Scala, Python, Ruby y Javascript
 
Lo que odiamos de la agilidad
Lo que odiamos de la agilidadLo que odiamos de la agilidad
Lo que odiamos de la agilidad
 
Oss
OssOss
Oss
 
Javascript funcional
Javascript funcionalJavascript funcional
Javascript funcional
 
App Engine
App EngineApp Engine
App Engine
 
Introducción a Git
Introducción a GitIntroducción a Git
Introducción a Git
 
Jython: Python para la plataforma Java (EL2009)
Jython: Python para la plataforma Java (EL2009)Jython: Python para la plataforma Java (EL2009)
Jython: Python para la plataforma Java (EL2009)
 

Recently uploaded

The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 

Recently uploaded (20)

The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 

Tres Gemas De Ruby

  • 1. Tres gemas de Ruby Leo Soto M. Lenguajes Dinámicos Chile
  • 4. ps: $(NAME).ps %.ps: %.dvi dvips $(DVIPSOPT) $< -o $@ hyper: $(NAME).dtx $(NAME).sty pdflatex "relaxletmakehyperrefactiveinput $(NAME).dtx" $(NAME).pdf: $(NAME).dtx $(NAME).sty pdflatex $(NAME).dtx archive: @ tar -czf $(ARCHNAME) $(ARCHIVE) @ echo $(ARCHNAME) clean: rm -f $(NAME). {log,toc,lot,lof,idx,ilg,ind,aux,blg,bbl,dvi,ins,out} distclean: clean rm -f $(NAME).{ps,sty,pdf} $(ARCHNAME)
  • 7. task :compile do mxmlc 'FlexApp', OUTPUT_FOLDER, ['libs/ThunderBoltAS3_Flex.swc'] end task :test do mxmlc 'TestRunner', '', ['libs/flexunit.swc'] run_swf 'TestRunner.swf' end task :copy_to_main_project => [:compile] do sh "cp -af #{FILES_TO_COPY} #{OUTPUT_FOLDER}" end task :clean do sh "rm -rf #{OUTPUT_FOLDER}/*" end task :default => [:compile, :copy_to_main_project]
  • 8. task :compile do mxmlc 'FlexApp', OUTPUT_FOLDER, ['libs/ThunderBoltAS3_Flex.swc'] end task :test do mxmlc 'TestRunner', '', ['libs/flexunit.swc'] run_swf 'TestRunner.swf' end task :copy_to_main_project => [:compile] do sh "cp -af #{FILES_TO_COPY} #{OUTPUT_FOLDER}" end task :clean do sh "rm -rf #{OUTPUT_FOLDER}/*" end task :default => [:compile, :copy_to_main_project]
  • 9. def mxmlc(file, output_folder, include_libraries=nil, warnings=false, debug=true) # Uses fcshd <http://code.google.com/p/flex-compiler-shell-daemon/> # if found: if command_exists? "fcshd.py" and not ENV['IGNORE_FCSH'] # fcshd wants absolute paths file = File.expand_path(file) output_folder = File.expand_path(output_folder) if include_libraries include_libraries = include_libraries.map { |x| File.expand_path(x) } end cmdline = mxmlc_cmdline(file, output_folder, include_libraries, warnings, debug) sh "fcshd.py "mxmlc #{cmdline}"" else cmdline = mxmlc_cmdline(file, output_folder, include_libraries, warnings, debug) sh "$FLEX_HOME/bin/mxmlc #{cmdline}" end end
  • 10. task :compile do mxmlc 'FlexApp', OUTPUT_FOLDER, ['libs/ThunderBoltAS3_Flex.swc'] end task :test do mxmlc 'TestRunner', '', ['libs/flexunit.swc'] run_swf 'TestRunner.swf' end task :copy_to_main_project => [:compile] do sh "cp -af #{FILES_TO_COPY} #{OUTPUT_FOLDER}" end task :clean do sh "rm -rf #{OUTPUT_FOLDER}/*" end task :default => [:compile, :copy_to_main_project]
  • 11. def run_swf(swf) FLASH_PLAYERS.each do |cmd| if command_exists? cmd sh "#{cmd} #{swf}" return end end end
  • 13. namespace :rpc do task :compile => [:bigflexlib, :semanticflash] do compile_sandbox "rpc" end task :run => [:compile] do run_sandbox "rpc" end end namespace :graph do task :compile => [:bigflexlib, :semanticflash] do compile_sandbox "graph" end task :run => [:compile] do run_sandbox "graph" end end namespace :lang do task :compile => [:bigflexlib, :semanticflash] do compile_sandbox "lang" end task :run => [:compile] do run_sandbox "lang" end end
  • 14. $ rake rpc:compile $ rake graph:compile
  • 15. namespace :rpc do task :compile => [:bigflexlib, :semanticflash] do compile_sandbox "rpc" end task :run => [:compile] do run_sandbox "rpc" end end namespace :graph do task :compile => [:bigflexlib, :semanticflash] do compile_sandbox "graph" end task :run => [:compile] do run_sandbox "graph" end end namespace :lang do task :compile => [:bigflexlib, :semanticflash] do compile_sandbox "lang" end task :run => [:compile] do run_sandbox "lang" end end
  • 16. def flex_sandbox(*names) names.each do |name| namespace name do task :compile => [:bigflexlib, :semanticflash] do compile_sandbox name end task :run => [:compile] do run_sandbox name end end end namespace :sandboxes do task :compile => names.map { |name| "#{name}:compile" } task :run => names.map { |name| "#{name}:run"} end end
  • 17. def flex_sandbox(*names) names.each do |name| namespace name do task :compile => [:bigflexlib, :semanticflash] do compile_sandbox name end task :run => [:compile] do run_sandbox name end end end namespace :sandboxes do task :compile => names.map { |name| "#{name}:compile" } task :run => names.map { |name| "#{name}:run"} end end flex_sandbox :rpc, :graph, :lang
  • 18. $ rake rpc:compile $ rake graph:compile
  • 19. $ rake rpc:compile $ rake graph:compile $ rake sandboxes:compile
  • 22. class FactorialTestCase < TestCase def test_factorial_method_added_to_integer_numbers assert_true 1.respond_to?(:factorial) end def test_factorial_of_zero assert_equals 0.factorial, 1 end def test_factorial_of_positives assert_equals 1.factorial, 1 assert_equals 2.factorial, 2 assert_equals 3.factorial, 6 assert_equals 20.factorial, 2432902008176640000 end def test_factorial_of_negatives assert_raises ArgumentError do -1.factorial end end end
  • 23. describe '#factorial' do it "adds a factorial method to integer numbers" do 1.respond_to?(:factorial).should be_true end it "defines the factorial of 0 as 1" do 0.factorial.should == 1 end it "calculates the factorial of any positive integer" do 1.factorial.should == 1 2.factorial.should == 2 3.factorial.should == 6 20.factorial.should == 2432902008176640000 end it "raises an exception when applied to negative numbers" do -1.factorial.should raise_error(ArgumentError) end end
  • 24. describe '#prime?' do it "adds a prime method to integer numbers" do 1.respond_to?(:prime?).should be_true end it "returns true for prime numbers" do 2.should be_prime 3.should be_prime 11.should be_prime 97.should be_prime 727.should be_prime end it "returns false for non prime numbers" do 20.should_not be_prime 999.should_not be_prime end end
  • 26. One more thing... 3. WebRat
  • 27. describe "creating a new CEO letter campaign" do before do click_link 'Campaigns' click_link 'New CEO Letter Campaign' end it "persists delivery method, start date and end date" do check 'Email' click_button 'Create campaign' response.body.should contain_text("1 Delivery method: Email") response.body.should contain("12/12/2009") response.body.should contain("6/12/2010") end it "allows an email campaign" do check 'Email' click_button 'Create campaign' response.body.should contain_text("1 Delivery method: Email") end end
  • 28. http://rake.rubyforge.org/ http://rspec.info/ http://gitrdoc.com/brynary/webrat/tree/master/
  • 29. http://rake.rubyforge.org/ http://rspec.info/ http://gitrdoc.com/brynary/webrat/tree/master/ ¡Gracias!