SlideShare una empresa de Scribd logo
1 de 29
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!

Más contenido relacionado

La actualidad más candente

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
 
Unit 7 standard i o
Unit 7 standard i oUnit 7 standard i o
Unit 7 standard i o
root_fibo
 

La actualidad más candente (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 a Tres Gemas De Ruby

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_slideshare
tomcopeland
 
Desarrollando aplicaciones web en minutos
Desarrollando aplicaciones web en minutosDesarrollando aplicaciones web en minutos
Desarrollando aplicaciones web en minutos
Edgar Suarez
 
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
Anton Shemerey
 
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
railsconf
 
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
Paulo Ragonha
 
Real world scala
Real world scalaReal world scala
Real world scala
lunfu zhong
 
Metaprogramovanie #1
Metaprogramovanie #1Metaprogramovanie #1
Metaprogramovanie #1
Jano Suchal
 

Similar a 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
 

Más de Leonardo Soto

El arte oscuro de estimar v3
El arte oscuro de estimar v3El arte oscuro de estimar v3
El arte oscuro de estimar v3
Leonardo Soto
 
El Lado Cool de Java
El Lado Cool de JavaEl Lado Cool de Java
El Lado Cool de Java
Leonardo Soto
 
Mi Arsenal de Testing en Rails
Mi Arsenal de Testing en RailsMi Arsenal de Testing en Rails
Mi Arsenal de Testing en Rails
Leonardo Soto
 
Mapas en la web con Cloudmade
Mapas en la web con CloudmadeMapas en la web con Cloudmade
Mapas en la web con Cloudmade
Leonardo Soto
 
Decent exposure: Controladores sin @ivars
Decent exposure: Controladores sin @ivarsDecent exposure: Controladores sin @ivars
Decent exposure: Controladores sin @ivars
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 Javascript
Leonardo Soto
 
Lo que odiamos de la agilidad
Lo que odiamos de la agilidadLo que odiamos de la agilidad
Lo que odiamos de la agilidad
Leonardo Soto
 
Javascript funcional
Javascript funcionalJavascript funcional
Javascript funcional
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
 

Más de 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)
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (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...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
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
 
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
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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
 

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!