SlideShare a Scribd company logo
1 of 70
Download to read offline
Deploying MacRuby
How to do it the Apple Way




                             Thilo Utke - RailsWayCon 2010
HI, I’M THILO!
Outline
 Intro

 MacRuby

 MacRuby 0.5 - 0.6 The last year

 Using MacRuby

 Build

 Embed

 Pack

 Updates

 Bonus
HI, I’M THILO!
UPSTREAM

Our Company: http://upste.am
Twitter: @upstream_agile
Our Coworking Space: http://co-up.de or http://coup.cobot.me
Twitter: @co_up
I Love
I like the Software
Don’t Like Obj-C
First Objective-C App
   @interface Foo : NSObject
   {
     IBOutlet NSTextField *textField;
   }

   - (IBAction)gerneate:(id)sender;
   - (IBAction)seed:(id)sender;
   @end

   @impelemtation Foo

   - (IBAction)generate:(id)sender
   {
     int generated = (random() % 100) +1;
     [textField setIntValue:generated];
   }

   - (IBAction)seed:(id)sender
   {
     srandom(time(NULL));
     [textField setStringValue:@"Generator seeded"];
   }




Headerfiles
Types
Many Bracets
Semicolon
Thats why I love: MacRuby
First Objective-C App
   class Foo
   ! attr_writer :text_field
   !
   ! def seed(sender)
   ! ! @text_field.StringValue = "Generator doesn't need to be seeded ;)"
   ! end
   !
   ! def generate(sender)
   ! ! @text_field.StringValue = (rand(100) + 1)
   ! end
   end




Ruby => Less Noise
MacRuby?




 Ruby’s first class
citizenship on OSX
MacRuby give access to most frameworks on OSX Plattform
MacRuby?




          Replaces RubyCocoa which is
            already gone from XCode



RubyCocoa was included before
MacRuby 0.5

  App       Std Lib
                                 Frameworks
     Ruby Code

                                   Obj-C
  LLVM
 JIT/AOT      GC            IO     GCC
                 Obj-C Runtime
MacRuby 0.5
         Object => NSObject
         Ruby specific extensions
  App        Std Lib
                                   Frameworks
     Ruby Code

                                     Obj-C
  LLVM   Primitives On Obj-C
 JIT/AOT       GC           IO       GCC
                 Obj-C Runtime
MacRuby 0.5
           Generate Obj-C calls for Ruby code
           Intermediate Representation (IR)
  App       Std Lib
           Optimization             Frameworks
     Ruby Code
           JIT compiler to execute code
                                      GCC
  LLVM     faster than 1.9
 JIT/AOT      GC             IO       LLVM
           Ahead of Time Compiler
                 Obj-C Runtime
MacRuby 0.5
                       One runtime
           App         One Lib
                       Std object space
                                               Frameworks
                       Shared infrastructure
                Ruby Code
                       Multithreaded             Obj-C
          LLVM
         JIT/AOT          GC           IO        GCC
                           Obj-C Runtime


NO GIL!
Access to GCD
MacRuby 0.5




This Was basically MacRuby 0.5
MacRuby 0.6




Current 0.6 is considered stable for Cocoa development
MacRuby 0.5 -> 0.6



       DEBUGGER:
       macrubyd




Usable like gnu debugger.
MacRuby 0.5 -> 0.6



       XCODE:
       Integration Improved




New Templates
Target to RunTests/Compile/Embed
MacRuby 0.5 -> 0.6



        Primitives:
        Refactoring
                             Hash.ancestors
                             => [Hash, NSMutableDictionary, NSDictionary,
                             Enumerable, NSObject, Kernel]

                             String.ancestors
                             => [String, NSMutableString, NSString,
                             Comparable, NSObject, Kernel]



New Ruby primitives are sub classes instead of aliases plus extensions.
MacRuby 0.5 -> 0.6



        Improved API for
        Grand Central Dispatch




Job queue
Proxies
Parallelisation extensions on Enumerable
MacRuby 0.5 -> 0.6


       Better support for
       MRI C-Extensions

                              <nokogiri/>



eg. NokoGiri and Postgresql
MacRuby 0.5 -> 0.6


       ICU for Strings
       and RegEx
                                           !"! #$% &'()**+,+ +(-.&'(/
                                           0 (.,)$%(*1. 21(/3.*0%




Threadsafe and Multibyte Char handling for your encoding pleasure.
MacRuby 0.5 -> 0.6



        Got slower:




Performance will be a focus for the 0.7 release with a new VM and compiler
That was what changed from 0.5 to 0.6
Using MacRuby




short overview over functional and language extensions
Using Frameworks
    #import <Cocoa/Cocoa.h>

framework 'Cocoa'
 
 
Calling Obj-C Methods
       [dog makeNoise:@”wuff” level:6];

   dog.makeNoise “wuff”, level:6

   dog.makeNoise “wuff”, :level => 6
    
    




No Colon -> No parameter
Defining Methods for Obj-C
   - (id) makeNoise:(NSString)noise
   level:(NSInteger)level;

   def makeNoise(noise, level:level)
    




Obj-C style methods mostly need for Delegates
Using Structs
       NSPoint(0,1)

   NSpoint.new(0,1)
    




Like they are Objects
Pointer
       NSError* error;

   //MacRuby 0.5
   error = Pointer.new(:object)
    




As a means of an output parameter, mostly for error handling
alloc & init

[[NSMutableArray alloc] init]

Array.alloc.init

Array.new

Array.arrayWithArray [1]
Build
       Embed MacRuby
       Packing
       Deliver Updates




Tasks ahead
Build




Click in XCode
Build
   your_project$ xcodebuild -configuration Release
   -target IntegrityX




Command line is better.
Build   ^o^/


EASY
Embed




- Meaning copying MacRubyFramework inside the application Bundle
- Updating file references to point inside the app. Bundle
Embed
   your_project$ macruby_deploy --embed build/
   release/IntegrityX.app




Helpfull script.
This is basicly the same what the embed target in XCode does
MacRubyFramework ~ 60MB




                                 By Sergei Golyshev http://www.flickr.com/photos/29225114@N08/3112939993/ CC


Only Framework, no Gems, they will be excluded
Embed without Ruby StdLib
   your_project$ macruby_deploy --embed --no-stdlib
   build/release/IntegrityX.app
   your_project$ macruby_deploy --embed --stdlib yml
   build/release/IntegrityX.app




--no-stdlib will remove the entire std lib from the framework, eg. FileUtils, Net, openssl, zlib,
yml.
-> Not a big problem we have the Cocoa libs but they aren’t as nice to use as the stdlib ones.
--stlib can embed single stdlibs only
MacRubyFramework
                   without StdLib
                      ~36 MB




Only Framework
Embed without Ruby StdLib




can easily add this options to your embed target in XCode
Embed                                0_0



       Customers don’t require MacRuby
       Big Bundle even without StdLib
       No Gems yet


Lets Move on to Packing
Pack




No support from XCode
Pack
   your_project$ hdiutil create -srcfolder release/
   IntegrityX.app IntegrityX.dmg




This skript is a very basic version to create a dmg.
Pack: DMG

Is a:
RAW Disk Image
Offers:
Compression, Encryption, Meta Data
Used for:
Apple Software Distribution
FileVault
Pack: DMG Shell Script
   set -ex

   dir="$TEMP_FILES_DIR/disk"
   dmg="$BUILT_PRODUCTS_DIR/$PROJECT_NAME.dmg"

   rm -rf "$dir"
   rm -f "$dmg"
   mkdir "$dir"
   cp -R "$BUILT_PRODUCTS_DIR/$PROJECT_NAME.app" "$dir"
   chmod -Rf go-w "$dir"
   ln -s "/Applications" "$dir/Applications"
   sync
   hdiutil create -srcfolder "$dir" -volname "$PROJECT_NAME"
   -imagekey zlib-level=9 -format UDZO "$dmg"
   hdiutil internet-enable -yes "$dmg"
   rm -rf "$dir"


A more throughout script for XCode
Packing in Xcode
Pack                            (@_@)



DMG
Creation easy scriptable
No initial support from XCode
Ready for distribution   ($_$)




and earn you money ;)
Updates
Updates: Sparkle




OpenSource Update Framework
Updates: AppCast
 Podcasting Feed for your App
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="..." xmlns:sparkle="..." version="2.0">
  <channel>
    <title>IntegrityX</title>
    <description>IntegrityX updates</description>
    <link>http://freaklikeme.de/pub/res</link>
    <language>en</language>
    <pubDate>Sun, 02 May 2010 16:18:44 +0200</pubDate>
    <atom:link type="application/rss+xml" href="..." rel="self"/>
    <item>
       <title>IntegrityX 0.1</title>
       <sparkle:releaseNotesLink>...</sparkle:releaseNotesLink>
       <pubDate>Sun, 02 May 2010 16:18:44 +0200</pubDate>
       <guid isPermaLink="false">IntegrityX-0.1</guid>
       <enclosure type="application/dmg" url="http://...IntegrityX-0.1.dmg"
        length="10784979" sparkle:version="0.1" sparkle:dsaSignature="MC0CFQCvYKP
        +elGXrPUEV2Yoxj6OTLKioA="/>
    </item>
  </channel>
</rss>
Adding Sparkle
     1.Add Sparkle Framework to App Bundle
     2.Add Check for Update Option
     3.Generate Key Pair for Signing
     4.Add Info where to find Updates and PubKey




A Video to show it.
In the original presentation was a video here to show
how to setup Sparkle but you can follow the
instructions in this article:
http://foolsworkshop.com/rubycocoa/2008/06/adding-
a-check-updates-feature-for-rubycocoa-and-macruby/
Release with Sparkle
1.Create Signature for your App Bundle
2.Create AppCastFeed with current Signature
3.Add Release Note




Yes there is a script for that:
http://github.com/CraigWilliams/appcastautomation
Updates                0_0/


Add SparkleFramework
Sign App Bundle
Publish with AppCast
Grand Finale


  ChocTop
ChocTop
 All you need at your command line


rake   build                #   Build Xcode Release
rake   dmg                  #   Create the dmg file for appcasting
rake   feed                 #   Create/update the appcast file
rake   upload               #   Upload the appcast and dmg to host
rake   version:bump:major   #   Bump the major version.
rake   version:bump:minor   #   Bump the minor version.
rake   version:bump:patch   #   Bump the patch version.
rake   version:current      #   Display the current version
ChocTop
           Offers Custom DMG with Positioning




Doing this with Apple Script (requiers original apple ruby as it uses ruby cocoa)
ChocTop
Thanks


Start: macruby.org


Help: MacRuby-devel on MacOSForge
Twitter: @MacRuby
Resources
ChocTop and Logo Dr. Nic William http://drnic.github.com/choctop/

Macruby and Logo http://macruby.org

Framework Foto: http://www.flickr.com/photos/29225114@N08/3112939993/

Sparke Instructions: http://foolsworkshop.com/rubycocoa/2008/06/adding-a-check-
updates-feature-for-rubycocoa-and-macruby/

Sparkle Video, Tweetscreen DMG Design, web site screen shoot from Patrick Hüsler:
http://huesler-informatik.ch/

Sparkle Framework: http://github.com/andymatuschak/Sparkle

More Related Content

What's hot

Cloud Foundry Open Tour China
Cloud Foundry Open Tour ChinaCloud Foundry Open Tour China
Cloud Foundry Open Tour China
marklucovsky
 
State of the art: server-side javaScript - NantesJS
State of the art: server-side javaScript - NantesJSState of the art: server-side javaScript - NantesJS
State of the art: server-side javaScript - NantesJS
Alexandre Morgaut
 
State of the art: Server-Side JavaScript - dejeuner fulljs
State of the art: Server-Side JavaScript - dejeuner fulljsState of the art: Server-Side JavaScript - dejeuner fulljs
State of the art: Server-Side JavaScript - dejeuner fulljs
Alexandre Morgaut
 

What's hot (20)

Extending Java From ColdFusion - CFUnited 2010
Extending Java From ColdFusion - CFUnited 2010Extending Java From ColdFusion - CFUnited 2010
Extending Java From ColdFusion - CFUnited 2010
 
Large-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 MinutesLarge-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 Minutes
 
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory CourseRuby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
 
Ror Seminar With agilebd.org on 23 Jan09
Ror Seminar With agilebd.org on 23 Jan09Ror Seminar With agilebd.org on 23 Jan09
Ror Seminar With agilebd.org on 23 Jan09
 
ruby-cocoa
ruby-cocoaruby-cocoa
ruby-cocoa
 
Debugging on rails
Debugging on railsDebugging on rails
Debugging on rails
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1
 
Terraform Abstractions for Safety and Power
Terraform Abstractions for Safety and PowerTerraform Abstractions for Safety and Power
Terraform Abstractions for Safety and Power
 
JavaScript as Development Platform
JavaScript as Development PlatformJavaScript as Development Platform
JavaScript as Development Platform
 
Building an Apache Sling Rendering Farm
Building an Apache Sling Rendering FarmBuilding an Apache Sling Rendering Farm
Building an Apache Sling Rendering Farm
 
Intro To OSGi
Intro To OSGiIntro To OSGi
Intro To OSGi
 
Cloud Foundry Open Tour China
Cloud Foundry Open Tour ChinaCloud Foundry Open Tour China
Cloud Foundry Open Tour China
 
Going to Mars with Groovy Domain-Specific Languages
Going to Mars with Groovy Domain-Specific LanguagesGoing to Mars with Groovy Domain-Specific Languages
Going to Mars with Groovy Domain-Specific Languages
 
How to test code with mruby
How to test code with mrubyHow to test code with mruby
How to test code with mruby
 
State of the art: server-side javaScript - NantesJS
State of the art: server-side javaScript - NantesJSState of the art: server-side javaScript - NantesJS
State of the art: server-side javaScript - NantesJS
 
Security Goodness with Ruby on Rails
Security Goodness with Ruby on RailsSecurity Goodness with Ruby on Rails
Security Goodness with Ruby on Rails
 
State of the art: Server-Side JavaScript - WebWorkersCamp IV - Open World For...
State of the art: Server-Side JavaScript - WebWorkersCamp IV - Open World For...State of the art: Server-Side JavaScript - WebWorkersCamp IV - Open World For...
State of the art: Server-Side JavaScript - WebWorkersCamp IV - Open World For...
 
Paving the way to a native Sling
Paving the way to a native SlingPaving the way to a native Sling
Paving the way to a native Sling
 
The details of CI/CD environment for Ruby
The details of CI/CD environment for RubyThe details of CI/CD environment for Ruby
The details of CI/CD environment for Ruby
 
State of the art: Server-Side JavaScript - dejeuner fulljs
State of the art: Server-Side JavaScript - dejeuner fulljsState of the art: Server-Side JavaScript - dejeuner fulljs
State of the art: Server-Side JavaScript - dejeuner fulljs
 

Similar to Mac ruby deployment

MacRuby & HotCocoa
MacRuby & HotCocoaMacRuby & HotCocoa
MacRuby & HotCocoa
Thilo Utke
 
MacRuby & RubyMotion - Madridrb May 2012
MacRuby & RubyMotion - Madridrb May 2012MacRuby & RubyMotion - Madridrb May 2012
MacRuby & RubyMotion - Madridrb May 2012
Mark Villacampa
 
Macruby& Hotcocoa presentation by Rich Kilmer
Macruby& Hotcocoa presentation by Rich KilmerMacruby& Hotcocoa presentation by Rich Kilmer
Macruby& Hotcocoa presentation by Rich Kilmer
Matt Aimonetti
 
Cannibalising The Google App Engine
Cannibalising The  Google  App  EngineCannibalising The  Google  App  Engine
Cannibalising The Google App Engine
catherinewall
 

Similar to Mac ruby deployment (20)

MacRuby & HotCocoa
MacRuby & HotCocoaMacRuby & HotCocoa
MacRuby & HotCocoa
 
Cloud meets Fog & Puppet A Story of Version Controlled Infrastructure
Cloud meets Fog & Puppet A Story of Version Controlled InfrastructureCloud meets Fog & Puppet A Story of Version Controlled Infrastructure
Cloud meets Fog & Puppet A Story of Version Controlled Infrastructure
 
MacRuby, an introduction
MacRuby, an introductionMacRuby, an introduction
MacRuby, an introduction
 
Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725
 
Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725
 
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
 
Ruby Meets Cocoa
Ruby Meets CocoaRuby Meets Cocoa
Ruby Meets Cocoa
 
Ruby C extensions at the Ruby drink-up of Sophia, April 2012
Ruby C extensions at the Ruby drink-up of Sophia, April 2012Ruby C extensions at the Ruby drink-up of Sophia, April 2012
Ruby C extensions at the Ruby drink-up of Sophia, April 2012
 
From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...
 
Gitlab and Lingvokot
Gitlab and LingvokotGitlab and Lingvokot
Gitlab and Lingvokot
 
MacRuby & RubyMotion - Madridrb May 2012
MacRuby & RubyMotion - Madridrb May 2012MacRuby & RubyMotion - Madridrb May 2012
MacRuby & RubyMotion - Madridrb May 2012
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Macruby& Hotcocoa presentation by Rich Kilmer
Macruby& Hotcocoa presentation by Rich KilmerMacruby& Hotcocoa presentation by Rich Kilmer
Macruby& Hotcocoa presentation by Rich Kilmer
 
Cannibalising The Google App Engine
Cannibalising The  Google  App  EngineCannibalising The  Google  App  Engine
Cannibalising The Google App Engine
 
Docker module 1
Docker module 1Docker module 1
Docker module 1
 
Advance Android Application Development
Advance Android Application DevelopmentAdvance Android Application Development
Advance Android Application Development
 
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
 
Making kubernetes simple for developers
Making kubernetes simple for developersMaking kubernetes simple for developers
Making kubernetes simple for developers
 
Advanced Node.JS Meetup
Advanced Node.JS MeetupAdvanced Node.JS Meetup
Advanced Node.JS Meetup
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby Team
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

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...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Mac ruby deployment

  • 1. Deploying MacRuby How to do it the Apple Way Thilo Utke - RailsWayCon 2010
  • 3. Outline Intro MacRuby MacRuby 0.5 - 0.6 The last year Using MacRuby Build Embed Pack Updates Bonus
  • 6. Our Coworking Space: http://co-up.de or http://coup.cobot.me Twitter: @co_up
  • 8.
  • 9. I like the Software
  • 11. First Objective-C App @interface Foo : NSObject { IBOutlet NSTextField *textField; } - (IBAction)gerneate:(id)sender; - (IBAction)seed:(id)sender; @end @impelemtation Foo - (IBAction)generate:(id)sender { int generated = (random() % 100) +1; [textField setIntValue:generated]; } - (IBAction)seed:(id)sender { srandom(time(NULL)); [textField setStringValue:@"Generator seeded"]; } Headerfiles Types Many Bracets Semicolon
  • 12. Thats why I love: MacRuby
  • 13. First Objective-C App class Foo ! attr_writer :text_field ! ! def seed(sender) ! ! @text_field.StringValue = "Generator doesn't need to be seeded ;)" ! end ! ! def generate(sender) ! ! @text_field.StringValue = (rand(100) + 1) ! end end Ruby => Less Noise
  • 14. MacRuby? Ruby’s first class citizenship on OSX
  • 15. MacRuby give access to most frameworks on OSX Plattform
  • 16. MacRuby? Replaces RubyCocoa which is already gone from XCode RubyCocoa was included before
  • 17. MacRuby 0.5 App Std Lib Frameworks Ruby Code Obj-C LLVM JIT/AOT GC IO GCC Obj-C Runtime
  • 18. MacRuby 0.5 Object => NSObject Ruby specific extensions App Std Lib Frameworks Ruby Code Obj-C LLVM Primitives On Obj-C JIT/AOT GC IO GCC Obj-C Runtime
  • 19. MacRuby 0.5 Generate Obj-C calls for Ruby code Intermediate Representation (IR) App Std Lib Optimization Frameworks Ruby Code JIT compiler to execute code GCC LLVM faster than 1.9 JIT/AOT GC IO LLVM Ahead of Time Compiler Obj-C Runtime
  • 20. MacRuby 0.5 One runtime App One Lib Std object space Frameworks Shared infrastructure Ruby Code Multithreaded Obj-C LLVM JIT/AOT GC IO GCC Obj-C Runtime NO GIL! Access to GCD
  • 21. MacRuby 0.5 This Was basically MacRuby 0.5
  • 22. MacRuby 0.6 Current 0.6 is considered stable for Cocoa development
  • 23. MacRuby 0.5 -> 0.6 DEBUGGER: macrubyd Usable like gnu debugger.
  • 24. MacRuby 0.5 -> 0.6 XCODE: Integration Improved New Templates Target to RunTests/Compile/Embed
  • 25. MacRuby 0.5 -> 0.6 Primitives: Refactoring Hash.ancestors => [Hash, NSMutableDictionary, NSDictionary, Enumerable, NSObject, Kernel] String.ancestors => [String, NSMutableString, NSString, Comparable, NSObject, Kernel] New Ruby primitives are sub classes instead of aliases plus extensions.
  • 26. MacRuby 0.5 -> 0.6 Improved API for Grand Central Dispatch Job queue Proxies Parallelisation extensions on Enumerable
  • 27. MacRuby 0.5 -> 0.6 Better support for MRI C-Extensions <nokogiri/> eg. NokoGiri and Postgresql
  • 28. MacRuby 0.5 -> 0.6 ICU for Strings and RegEx !"! #$% &'()**+,+ +(-.&'(/ 0 (.,)$%(*1. 21(/3.*0% Threadsafe and Multibyte Char handling for your encoding pleasure.
  • 29. MacRuby 0.5 -> 0.6 Got slower: Performance will be a focus for the 0.7 release with a new VM and compiler
  • 30. That was what changed from 0.5 to 0.6
  • 31. Using MacRuby short overview over functional and language extensions
  • 32. Using Frameworks #import <Cocoa/Cocoa.h> framework 'Cocoa'    
  • 33. Calling Obj-C Methods [dog makeNoise:@”wuff” level:6]; dog.makeNoise “wuff”, level:6 dog.makeNoise “wuff”, :level => 6     No Colon -> No parameter
  • 34. Defining Methods for Obj-C - (id) makeNoise:(NSString)noise level:(NSInteger)level; def makeNoise(noise, level:level)   Obj-C style methods mostly need for Delegates
  • 35. Using Structs NSPoint(0,1) NSpoint.new(0,1)   Like they are Objects
  • 36. Pointer NSError* error; //MacRuby 0.5 error = Pointer.new(:object)   As a means of an output parameter, mostly for error handling
  • 37. alloc & init [[NSMutableArray alloc] init] Array.alloc.init Array.new Array.arrayWithArray [1]
  • 38.
  • 39.
  • 40. Build Embed MacRuby Packing Deliver Updates Tasks ahead
  • 42. Build your_project$ xcodebuild -configuration Release -target IntegrityX Command line is better.
  • 43. Build ^o^/ EASY
  • 44. Embed - Meaning copying MacRubyFramework inside the application Bundle - Updating file references to point inside the app. Bundle
  • 45. Embed your_project$ macruby_deploy --embed build/ release/IntegrityX.app Helpfull script. This is basicly the same what the embed target in XCode does
  • 46. MacRubyFramework ~ 60MB By Sergei Golyshev http://www.flickr.com/photos/29225114@N08/3112939993/ CC Only Framework, no Gems, they will be excluded
  • 47. Embed without Ruby StdLib your_project$ macruby_deploy --embed --no-stdlib build/release/IntegrityX.app your_project$ macruby_deploy --embed --stdlib yml build/release/IntegrityX.app --no-stdlib will remove the entire std lib from the framework, eg. FileUtils, Net, openssl, zlib, yml. -> Not a big problem we have the Cocoa libs but they aren’t as nice to use as the stdlib ones. --stlib can embed single stdlibs only
  • 48. MacRubyFramework without StdLib ~36 MB Only Framework
  • 49. Embed without Ruby StdLib can easily add this options to your embed target in XCode
  • 50. Embed 0_0 Customers don’t require MacRuby Big Bundle even without StdLib No Gems yet Lets Move on to Packing
  • 52. Pack your_project$ hdiutil create -srcfolder release/ IntegrityX.app IntegrityX.dmg This skript is a very basic version to create a dmg.
  • 53. Pack: DMG Is a: RAW Disk Image Offers: Compression, Encryption, Meta Data Used for: Apple Software Distribution FileVault
  • 54. Pack: DMG Shell Script set -ex dir="$TEMP_FILES_DIR/disk" dmg="$BUILT_PRODUCTS_DIR/$PROJECT_NAME.dmg" rm -rf "$dir" rm -f "$dmg" mkdir "$dir" cp -R "$BUILT_PRODUCTS_DIR/$PROJECT_NAME.app" "$dir" chmod -Rf go-w "$dir" ln -s "/Applications" "$dir/Applications" sync hdiutil create -srcfolder "$dir" -volname "$PROJECT_NAME" -imagekey zlib-level=9 -format UDZO "$dmg" hdiutil internet-enable -yes "$dmg" rm -rf "$dir" A more throughout script for XCode
  • 56. Pack (@_@) DMG Creation easy scriptable No initial support from XCode
  • 57. Ready for distribution ($_$) and earn you money ;)
  • 60. Updates: AppCast Podcasting Feed for your App <?xml version="1.0" encoding="UTF-8"?> <rss xmlns:atom="..." xmlns:sparkle="..." version="2.0"> <channel> <title>IntegrityX</title> <description>IntegrityX updates</description> <link>http://freaklikeme.de/pub/res</link> <language>en</language> <pubDate>Sun, 02 May 2010 16:18:44 +0200</pubDate> <atom:link type="application/rss+xml" href="..." rel="self"/> <item> <title>IntegrityX 0.1</title> <sparkle:releaseNotesLink>...</sparkle:releaseNotesLink> <pubDate>Sun, 02 May 2010 16:18:44 +0200</pubDate> <guid isPermaLink="false">IntegrityX-0.1</guid> <enclosure type="application/dmg" url="http://...IntegrityX-0.1.dmg" length="10784979" sparkle:version="0.1" sparkle:dsaSignature="MC0CFQCvYKP +elGXrPUEV2Yoxj6OTLKioA="/> </item> </channel> </rss>
  • 61. Adding Sparkle 1.Add Sparkle Framework to App Bundle 2.Add Check for Update Option 3.Generate Key Pair for Signing 4.Add Info where to find Updates and PubKey A Video to show it.
  • 62. In the original presentation was a video here to show how to setup Sparkle but you can follow the instructions in this article: http://foolsworkshop.com/rubycocoa/2008/06/adding- a-check-updates-feature-for-rubycocoa-and-macruby/
  • 63. Release with Sparkle 1.Create Signature for your App Bundle 2.Create AppCastFeed with current Signature 3.Add Release Note Yes there is a script for that: http://github.com/CraigWilliams/appcastautomation
  • 64. Updates 0_0/ Add SparkleFramework Sign App Bundle Publish with AppCast
  • 65. Grand Finale ChocTop
  • 66. ChocTop All you need at your command line rake build # Build Xcode Release rake dmg # Create the dmg file for appcasting rake feed # Create/update the appcast file rake upload # Upload the appcast and dmg to host rake version:bump:major # Bump the major version. rake version:bump:minor # Bump the minor version. rake version:bump:patch # Bump the patch version. rake version:current # Display the current version
  • 67. ChocTop Offers Custom DMG with Positioning Doing this with Apple Script (requiers original apple ruby as it uses ruby cocoa)
  • 69. Thanks Start: macruby.org Help: MacRuby-devel on MacOSForge Twitter: @MacRuby
  • 70. Resources ChocTop and Logo Dr. Nic William http://drnic.github.com/choctop/ Macruby and Logo http://macruby.org Framework Foto: http://www.flickr.com/photos/29225114@N08/3112939993/ Sparke Instructions: http://foolsworkshop.com/rubycocoa/2008/06/adding-a-check- updates-feature-for-rubycocoa-and-macruby/ Sparkle Video, Tweetscreen DMG Design, web site screen shoot from Patrick Hüsler: http://huesler-informatik.ch/ Sparkle Framework: http://github.com/andymatuschak/Sparkle