Advanced Ruby: DSL

Posted by Daniel Vela on October 16, 2020

Advance Ruby: DSL

DSL means “Domain Specific Language”. This king of programming languages are designed to be used in some king of specific subject: like maths, Machine Learning, networking, CI/CD, etc.

A good example of a DSL is fastlane. This tool is a great helper for developers in order to build and distribute mobile apps, and more. Here are a sample of this DSL.

default_platform(:ios)

platform :ios do
  desc "Push a new beta build to TestFlight"
  lane :beta do
    build_app(workspace: "project-ios.xcworkspace", scheme: "project-ios")
    upload_to_testflight
  end
end

Then, in terminal you can execute fastlane beta to build project and publish it into TestFlight. Fastlane would ask for your “Apple Developer Program” credentials in order to have access to “App Store Connect”.