SlideShare a Scribd company logo
1 of 64
Download to read offline
The future of Rake
Hiroshi SHIBATA / GMO PEPABO inc.
2016.09.08 RubyKaigi 2016
How DSL works on Ruby
Chief Engineer
Hiroshi SHIBATA @hsbt
https://www.hsbt.org
self.introduce
=>
{
name: “SHIBATA Hiroshi”,
nickname: “hsbt”,
title: “Chief engineer at GMO Pepabo, Inc.”,
commit_bits: [“ruby”, “rake”, “rubygems”, “rdoc”, “psych”, “syck”, “ruby-
build”, “railsgirls”, “railsgirls-jp”, “tdiary”, “hiki”…],
sites: [“hsbt.org”, “ruby-lang.org”, “rubyci.org”, “railsgirls.com”,
“railsgirls.jp”],
}
My work in Ruby 2.4
•Maintain *.ruby-lang.org. Applied to Site Reliability Engineering.
•Gemify standard library (xmlrpc, tk)
•Update bundled library such as rubygems, rdoc, psych, json
•Maintain ruby-build
•Maintain Psych 2.0, 2.1, also Syck
•Maintain RDoc 4.2, 5.0
•Maintain Rake 10.5, 11.2 and 12.0(TBD)
Rake
1.
Make in Ruby
Rake is a Make-like program implemented in Ruby. Tasks and dependencies are
specified in standard Ruby syntax.
task :awesome do
puts :bar
end
task beat: [:awesome] do
puts :buzz
end
task default: :beat
Rake features
•Rakefiles (rake's version of Makefiles) are completely defined in standard Ruby
syntax.
•Users can specify tasks with prerequisites.
•Supports parallel execution of tasks.
$ rake -j
Rake::FileList
•It’s also declaration named `Filelist` on Toplevel.
•It has utility class for File listing.
file_list = FileList.new('lib/**/*.rb', ‘test/test*.rb')
FileList['a.c', 'b.c'].exclude("a.c") => [‘b.c']
Rake::TestTask
Minitest and Test::Unit integration task of Rake
require 'rake/testtask'
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.verbose = true
t.test_files = FileList['test/**/test_*.rb']
end
It is only task for outside library. Task for rdoc, bundler, and more is stored their
gems.
First SemVer
•Rake is a first famous gem adopted semantic versioning in rubygems
•probably…
•Rake 0.9 bump to 10.0 for next version.
•Rake follows this release policy now.
ruby/rake
•Rake was originally created by Jim Weirich, who unfortunately passed away in
February 2014.
•This repository was originally hosted at github.com/jimweirich/rake, It has been
moved to ruby/rake by @drbrain
•@drbrain and @hsbt maintain ruby/rake
Download Ranking
Rake is most downloaded gem in the ruby world.
What’s DSL
2.
DSL is Domain Specific Language
In the situation of Ruby language
•Ruby is readable language. Because we often use internal DSL.
•Ruby has a lot of functions for building internal DSL. It uses meta-programming
technic.
“A domain-specific language (DSL) is a computer language specialized to a particular
application domain”
https://en.wikipedia.org/wiki/Domain-specific_language
Pattern: Class method
Slightly simple DSL on standalone class
class User
has_many :foo
end
Pattern: Class method
Slightly simple DSL on standalone class
class User
has_many :foo
end
class User
def self.has_many(foo)
puts foo
end
end
Pattern: Module and Class ancestors
You can build simple DSL used Ruby’s module and class
class User < ARBase
has_many :blogs
end
Pattern: Module and Class ancestors
You can build simple DSL used Ruby’s module and class
module DSL
def has_many(bar = nil)
puts bar
end
end
class ARBase
extend DSL
end
class User < ARBase
has_many :blogs
end
Pattern: Method define
You can define method via eval for simple DSL
class User < ARBase
has_many :blogs
blogs_foo
end
Pattern: Method define
module DSL
def has_many(bar = nil)
self.class.module_eval <<-CODE, __FILE__, __LINE__
def #{bar}_foo
puts :foo
end
CODE
end
end
(snip)
You can define method via eval for simple DSL
class User < ARBase
has_many :blogs
blogs_foo
end
Pattern: Implicit code block
We need to prepare to configuration for gem behavior changes.
Foo.configure do |c|
c.bar = :buzz
end
Pattern: Implicit code block
We need to prepare to configuration for gem behavior changes.
module Foo
def self.configure
yield self
end
class << self
attr_accessor :bar
end
end
Foo.configure do |c|
c.bar = :buzz
end
Pattern: Decrative setter
We can implement `Explicit code block` used instance_eval.
Foo.configure do
bar :buzz
end
Pattern: Decrative setter
We can implement `Explicit code block` used instance_eval.
module Foo
def self.configure(&block)
instance_eval(&block)
end
class << self
def bar(v = nil)
v ? @bar = v : @bar
end
end
end
Foo.configure do
bar :buzz
end
Pattern: instance_eval
You can provide class scoped DSL via instance_eval
gemfile = <<-GEM
gem 'foo'
GEM
Foo.new.eval_gemfile(gemfile)
Pattern: instance_eval
You can provide class scoped DSL via instance_eval
class Foo
def gem(name)
p name
end
def eval_gemfile(file)
instance_eval(file)
end
end
gemfile = <<-GEM
gem 'foo'
GEM
Foo.new.eval_gemfile(gemfile)
DSL in Rubygems
3.
DSL in Ruby language
•Rake
•Capistrano
•Thor
•Bundler
Rake and Rake.application
•rake_module.rb: defined `Rake.application` for Rake singleton instance.
•Rake.application returns `Rake::Application` instance.
•`rake` command invoke `Rake.application.run`
def run
standard_exception_handling do
init
load_rakefile
top_level
end
end
Rake::Application#init , Rake::Application#load_rakefile
•`init` method handles…
•detect invoking task: “rake -j foo” -> detecting “foo”
•parse given option: “rake -j foo” -> detecting “-j”
•`load_rakefile` read default rakefile named `%w(rakefile Rakefile rakefile.rb
Rakefile.rb)`
Rake::Application#top_level
•If you add `-T` options, top_level shows list of tasks on Rakefile
•If you add `-P` options, top_level shows dependencies of target task.
•top_level invokes tasks given command line. Example for `rake foo bar buzz`.
top_level invokes three tasks.
•top_level methods are under the thread pool on Rake.
Object#task
•load_rakefile simply load Rakefile used by `load` method provided by Ruby.
•Your Rakefile DSL provided by `Rake::DSL` filed dsl_definition.rb
module Rake
module DSL
(snip)
def task(*args, &block) # :doc:
Rake::Task.define_task(*args, &block)
end
end
end
self.extend Rake::DSL
Rake::Task
•`Rake::Task` instance is defined by `Rake::TaskManager#define_task`
•`Rake::Task` have manipulation tasks on class methods like clear, tasks, [], and
more.
•Class method of `Rake::Task` call `Rake::TaskManager` via `Rake.application`
instance.
Rake::Task
•`Rake::TaskManager#define_task` build actions, dependencies and scope for task.
actions are stored code blocks.
•`Rake::Task#invoke` invoke tasks of dependencies and @actions for Proc#call
•Invoked task marked @already_invoked flag. If you clear this flag, you need to run
`Rake::Task#reenable`
def enhance(deps=nil, &block)
@prerequisites |= deps if deps
@actions << block if block_given?
self
end
Capistrano
•Capistrano is a framework for building automated deployment scripts.
•Capistrano tasks on version 3 are simple rake task
task :restart_sidekiq do
on roles(:worker) do
execute :service, "sidekiq restart"
end
end
after "deploy:published", "restart_sidekiq"
•`Capistrano::Application` inherited `Rake::Application`
Thor
Thor is a simple and efficient tool for building self-documenting command line
utilities.
class App < Thor
desc "list [SEARCH]", "list all of the available apps, limited by SEARCH"
def list(search="")
# list everything
end
end
Thor provides inherited pattern DSL for their CLI. You can invoke it used `Thor.start`
Bundler
•`Bundler::CLI` inherited Thor class. It’s simple thor command.
• Bundler provides Gemfile DSL used DSL class and instance_eval
def eval_gemfile(gemfile, contents = nil)
expanded_gemfile_path = Pathname.new(gemfile).expand_path
original_gemfile = @gemfile
@gemfile = expanded_gemfile_path
contents ||= Bundler.read_file(gemfile.to_s)
instance_eval(contents.dup.untaint, gemfile.to_s, 1)
(snip)
CM
https://pepabo.com
もっとおもしろくできる
http://www.apple.com/jp/apple-pay/
https://www.youtube.com/watch?v=BdQVd1uybCg
We are hiring!!1
Please follow our account @pb_recruit
Long live the Rake
4.
Rake 10.x
•My first maintained version of Rake
•I triaged issues and fixed broken test at first
JRuby compatible issues
•`Dir.chdir` change behavior of `sh()` on JRuby
•https://github.com/ruby/rake/pull/101
•https://github.com/jruby/jruby/issues/3653
•https://github.com/hsbt/rake-issue-chdir
Reproduction code
def sh(*cmd)
res = system(*cmd)
status = $?
p [res, status]
end
RUBY = ENV['RUBY'] || File.join(
RbConfig::CONFIG['bindir'],
RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG['EXEEXT'])
ENV['RAKE_TEST_SH'] = 'someval'
sh RUBY, 'check_no_expansion.rb', '$RAKE_TEST_SH', 'someval'
Dir.chdir 'test'
sh RUBY, 'check_no_expansion.rb', '$RAKE_TEST_SH', 'someval'
Results - Ruby 2.3.0
% ruby rake_issue.rb
["$RAKE_TEST_SH", "someval"]
[true, #<Process::Status: pid 24928 exit 0>]
["$RAKE_TEST_SH", "someval"]
[true, #<Process::Status: pid 24929 exit 0>]
Results - JRuby 9.0.5.0 and 1.7.24
% ruby rake_issue.rb
["$RAKE_TEST_SH", "someval"]
[true, #<Process::Status: pid 21844 exit 0>]
["someval", "someval"]
[false, #<Process::Status: pid 21845 exit 1>]
JRuby 9.0.5.0
% ruby rake_issue.rb
["$RAKE_TEST_SH", "someval"]
[true, #<Process::Status: pid=22397,exited(0)>]
["$RAKE_TEST_SH", "someval"]
[true, #<Process::Status: pid=22398,exited(0)>]
JRuby 1.7.24
Another compatible issues on JRuby
•`Exception#cause` is difference behavior with CRuby 2.3.0
•https://github.com/jruby/jruby/issues/3654
•Missing stdout using `Open3.popen` after `Dir.chdir`
•https://github.com/jruby/jruby/issues/3655
Rake 11
5.
Rake 11.x
•My first major release version of Rake
•It have some of breaking changes
•It uses modern ecosystem on ruby language
Removed deprecated code
•I removed deprecated code commented by Jim
•Some historical gems like yard and rspec used `TaskManager#last_comment`
•I reverted to delete `last_comment` at Rake 11
•I’m sorry to inconvenience experience for above breaking changes.
Rewrite hoe to bundler
•You may invoke to `bundle` when to see Gemfile
•Without bundler, you need to install hoe and their plugins.
•I sometimes rewrite gem release tasks at rake, psych, syck…etc.
Unexpected behavior for rake - verbose
•I misunderstand to behavior of `verbose` option on Rake#Testtask
•expected: verbose option of rake task same as Ruby’s `-W` option. So you can get
additional debug/warn message with your ruby code.
•actual: verbose option on rake displays details of command runner. and minitest has
another `verbose` option. It shows test name and results for test suites.
Unexpected behavior for rake - deps
I added deps option for `Rake::TestTask`
task :setup do
end
Rake::TestTask.new do |t|
t.deps = :setup
end
task :setup do
end
Rake::TestTask.new(:test) => [:setup] do
end
But It’s same behavior this.
Rake 12
6.
Rake 12.x?
•I works to develop to Rake 12
•Release date is tentative
•This is major version-up. I have plan to some breaking changes.
Drop to support old Ruby
•Rake have concurrent task runner
•Current implementation detects core number used by system utilities like `sysctl`.
•But Ruby 2.2 provides `Etc.nprocessor` for detects core number natively.
•I like ruby core function. Rake 12 only supports Ruby 2.2 or later same as Rails 5.
minimize/minirake
•Rake have a lot of functions. I hope to reduce code for fast invocation when We run
rake task.
•Idea 1: Reduce code without core function like `rake-contrib`
•Idea 2: minirake - mruby have minimum implementation of rake
default task
I will add default method for difine default task
task :default => [:foo, :bar]
default [:foo, :bar]
to
Do not use main(Object class)
•Rake defined task method under main instance provided the Object class.
•We cant use name of `task` on irb/rails console when you use Rake gem.
•I hope to solve it.
Conclusion
•Summarize Rake history and basis.
•Introduce DSL pattern of Ruby language
•Learn Rake internal
•Show Rake 10 and 11 works
•Propose Rake 12 future.
Let’s fan to maintain big OSS

More Related Content

What's hot

How to distribute Ruby to the world
How to distribute Ruby to the worldHow to distribute Ruby to the world
How to distribute Ruby to the worldHiroshi SHIBATA
 
Dependency Resolution with Standard Libraries
Dependency Resolution with Standard LibrariesDependency Resolution with Standard Libraries
Dependency Resolution with Standard LibrariesHiroshi SHIBATA
 
How to develop the Standard Libraries of Ruby?
How to develop the Standard Libraries of Ruby?How to develop the Standard Libraries of Ruby?
How to develop the Standard Libraries of Ruby?Hiroshi SHIBATA
 
The secret of programming language development and future
The secret of programming  language development and futureThe secret of programming  language development and future
The secret of programming language development and futureHiroshi SHIBATA
 
20140626 red dotrubyconf2014
20140626 red dotrubyconf201420140626 red dotrubyconf2014
20140626 red dotrubyconf2014Hiroshi SHIBATA
 
The Future of Dependency Management for Ruby
The Future of Dependency Management for RubyThe Future of Dependency Management for Ruby
The Future of Dependency Management for RubyHiroshi SHIBATA
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Hiroshi SHIBATA
 
20140425 ruby conftaiwan2014
20140425 ruby conftaiwan201420140425 ruby conftaiwan2014
20140425 ruby conftaiwan2014Hiroshi SHIBATA
 
Improve extension API: C++ as better language for extension
Improve extension API: C++ as better language for extensionImprove extension API: C++ as better language for extension
Improve extension API: C++ as better language for extensionKouhei Sutou
 
How to test code with mruby
How to test code with mrubyHow to test code with mruby
How to test code with mrubyHiroshi SHIBATA
 
Leave end-to-end testing to Capybara
Leave end-to-end testing to CapybaraLeave end-to-end testing to Capybara
Leave end-to-end testing to CapybaraHiroshi SHIBATA
 
The Future of library dependency management of Ruby
 The Future of library dependency management of Ruby The Future of library dependency management of Ruby
The Future of library dependency management of RubyHiroshi SHIBATA
 
Gate of Agile Web Development
Gate of Agile Web DevelopmentGate of Agile Web Development
Gate of Agile Web DevelopmentKoichi ITO
 
20140419 oedo rubykaigi04
20140419 oedo rubykaigi0420140419 oedo rubykaigi04
20140419 oedo rubykaigi04Hiroshi SHIBATA
 

What's hot (20)

How to distribute Ruby to the world
How to distribute Ruby to the worldHow to distribute Ruby to the world
How to distribute Ruby to the world
 
20140925 rails pacific
20140925 rails pacific20140925 rails pacific
20140925 rails pacific
 
Dependency Resolution with Standard Libraries
Dependency Resolution with Standard LibrariesDependency Resolution with Standard Libraries
Dependency Resolution with Standard Libraries
 
How to develop the Standard Libraries of Ruby?
How to develop the Standard Libraries of Ruby?How to develop the Standard Libraries of Ruby?
How to develop the Standard Libraries of Ruby?
 
RubyGems 3 & 4
RubyGems 3 & 4RubyGems 3 & 4
RubyGems 3 & 4
 
The secret of programming language development and future
The secret of programming  language development and futureThe secret of programming  language development and future
The secret of programming language development and future
 
20140626 red dotrubyconf2014
20140626 red dotrubyconf201420140626 red dotrubyconf2014
20140626 red dotrubyconf2014
 
The Future of Dependency Management for Ruby
The Future of Dependency Management for RubyThe Future of Dependency Management for Ruby
The Future of Dependency Management for Ruby
 
Gems on Ruby
Gems on RubyGems on Ruby
Gems on Ruby
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0
 
20140425 ruby conftaiwan2014
20140425 ruby conftaiwan201420140425 ruby conftaiwan2014
20140425 ruby conftaiwan2014
 
Improve extension API: C++ as better language for extension
Improve extension API: C++ as better language for extensionImprove extension API: C++ as better language for extension
Improve extension API: C++ as better language for extension
 
How to test code with mruby
How to test code with mrubyHow to test code with mruby
How to test code with mruby
 
RubyGems 3 & 4
RubyGems 3 & 4RubyGems 3 & 4
RubyGems 3 & 4
 
Leave end-to-end testing to Capybara
Leave end-to-end testing to CapybaraLeave end-to-end testing to Capybara
Leave end-to-end testing to Capybara
 
The Future of library dependency management of Ruby
 The Future of library dependency management of Ruby The Future of library dependency management of Ruby
The Future of library dependency management of Ruby
 
What's new in RubyGems3
What's new in RubyGems3What's new in RubyGems3
What's new in RubyGems3
 
Gate of Agile Web Development
Gate of Agile Web DevelopmentGate of Agile Web Development
Gate of Agile Web Development
 
20140419 oedo rubykaigi04
20140419 oedo rubykaigi0420140419 oedo rubykaigi04
20140419 oedo rubykaigi04
 
20140918 ruby kaigi2014
20140918 ruby kaigi201420140918 ruby kaigi2014
20140918 ruby kaigi2014
 

Viewers also liked

How to Begin Developing Ruby Core
How to Begin Developing Ruby CoreHow to Begin Developing Ruby Core
How to Begin Developing Ruby CoreHiroshi SHIBATA
 
Web Clients for Ruby and What they should be in the future
Web Clients for Ruby and What they should be in the futureWeb Clients for Ruby and What they should be in the future
Web Clients for Ruby and What they should be in the futureToru Kawamura
 
Middleware as Code with mruby
Middleware as Code with mrubyMiddleware as Code with mruby
Middleware as Code with mrubyHiroshi SHIBATA
 
GitHub Enterprise with GMO Pepabo
GitHub Enterprise with GMO PepaboGitHub Enterprise with GMO Pepabo
GitHub Enterprise with GMO PepaboHiroshi SHIBATA
 
PHP AST 徹底解説(補遺)
PHP AST 徹底解説(補遺)PHP AST 徹底解説(補遺)
PHP AST 徹底解説(補遺)do_aki
 
成長を加速する minne の技術基盤戦略
成長を加速する minne の技術基盤戦略成長を加速する minne の技術基盤戦略
成長を加速する minne の技術基盤戦略Hiroshi SHIBATA
 
mruby で mackerel のプラグインを作るはなし
mruby で mackerel のプラグインを作るはなしmruby で mackerel のプラグインを作るはなし
mruby で mackerel のプラグインを作るはなしHiroshi SHIBATA
 
Practical Testing of Ruby Core
Practical Testing of Ruby CorePractical Testing of Ruby Core
Practical Testing of Ruby CoreHiroshi SHIBATA
 
signal の話 或いは Zend Signals とは何か
signal の話 或いは Zend Signals とは何かsignal の話 或いは Zend Signals とは何か
signal の話 或いは Zend Signals とは何かdo_aki
 
The story of language development
The story of language developmentThe story of language development
The story of language developmentHiroshi SHIBATA
 
Advanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutesAdvanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutesHiroshi SHIBATA
 
このPHP拡張がすごい!2017
このPHP拡張がすごい!2017このPHP拡張がすごい!2017
このPHP拡張がすごい!2017sasezaki
 
Usecase examples of Packer
Usecase examples of Packer Usecase examples of Packer
Usecase examples of Packer Hiroshi SHIBATA
 
技術的負債との付き合い方
技術的負債との付き合い方技術的負債との付き合い方
技術的負債との付き合い方Hiroshi SHIBATA
 
Recent Advances in HTTP, controlling them using ruby
Recent Advances in HTTP, controlling them using rubyRecent Advances in HTTP, controlling them using ruby
Recent Advances in HTTP, controlling them using rubyKazuho Oku
 
Modern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real WorldModern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real WorldSATOSHI TAGOMORI
 

Viewers also liked (18)

How to Begin Developing Ruby Core
How to Begin Developing Ruby CoreHow to Begin Developing Ruby Core
How to Begin Developing Ruby Core
 
Web Clients for Ruby and What they should be in the future
Web Clients for Ruby and What they should be in the futureWeb Clients for Ruby and What they should be in the future
Web Clients for Ruby and What they should be in the future
 
High Performance tDiary
High Performance tDiaryHigh Performance tDiary
High Performance tDiary
 
Middleware as Code with mruby
Middleware as Code with mrubyMiddleware as Code with mruby
Middleware as Code with mruby
 
GitHub Enterprise with GMO Pepabo
GitHub Enterprise with GMO PepaboGitHub Enterprise with GMO Pepabo
GitHub Enterprise with GMO Pepabo
 
PHP AST 徹底解説(補遺)
PHP AST 徹底解説(補遺)PHP AST 徹底解説(補遺)
PHP AST 徹底解説(補遺)
 
成長を加速する minne の技術基盤戦略
成長を加速する minne の技術基盤戦略成長を加速する minne の技術基盤戦略
成長を加速する minne の技術基盤戦略
 
mruby で mackerel のプラグインを作るはなし
mruby で mackerel のプラグインを作るはなしmruby で mackerel のプラグインを作るはなし
mruby で mackerel のプラグインを作るはなし
 
Practical Testing of Ruby Core
Practical Testing of Ruby CorePractical Testing of Ruby Core
Practical Testing of Ruby Core
 
signal の話 或いは Zend Signals とは何か
signal の話 或いは Zend Signals とは何かsignal の話 或いは Zend Signals とは何か
signal の話 或いは Zend Signals とは何か
 
Practical ngx_mruby
Practical ngx_mrubyPractical ngx_mruby
Practical ngx_mruby
 
The story of language development
The story of language developmentThe story of language development
The story of language development
 
Advanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutesAdvanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutes
 
このPHP拡張がすごい!2017
このPHP拡張がすごい!2017このPHP拡張がすごい!2017
このPHP拡張がすごい!2017
 
Usecase examples of Packer
Usecase examples of Packer Usecase examples of Packer
Usecase examples of Packer
 
技術的負債との付き合い方
技術的負債との付き合い方技術的負債との付き合い方
技術的負債との付き合い方
 
Recent Advances in HTTP, controlling them using ruby
Recent Advances in HTTP, controlling them using rubyRecent Advances in HTTP, controlling them using ruby
Recent Advances in HTTP, controlling them using ruby
 
Modern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real WorldModern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real World
 

Similar to How DSL works on Ruby

TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...bobmcwhirter
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLBarry Jones
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Mark Menard
 
TorqueBox - Ruby Hoedown 2011
TorqueBox - Ruby Hoedown 2011TorqueBox - Ruby Hoedown 2011
TorqueBox - Ruby Hoedown 2011Lance Ball
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on RailsManoj Kumar
 
Ruby on Rails (RoR) as a back-end processor for Apex
Ruby on Rails (RoR) as a back-end processor for Apex Ruby on Rails (RoR) as a back-end processor for Apex
Ruby on Rails (RoR) as a back-end processor for Apex Espen Brækken
 
Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02sagaroceanic11
 
2016-05-12 DCRUG React.rb
2016-05-12 DCRUG React.rb2016-05-12 DCRUG React.rb
2016-05-12 DCRUG React.rbawwaiid
 
Code for Startup MVP (Ruby on Rails) Session 2
Code for Startup MVP (Ruby on Rails) Session 2Code for Startup MVP (Ruby on Rails) Session 2
Code for Startup MVP (Ruby on Rails) Session 2Henry S
 
The Future of Bundled Bundler
The Future of Bundled BundlerThe Future of Bundled Bundler
The Future of Bundled BundlerHiroshi SHIBATA
 
Rubyspec y el largo camino hacia Ruby 1.9
Rubyspec y el largo camino hacia Ruby 1.9Rubyspec y el largo camino hacia Ruby 1.9
Rubyspec y el largo camino hacia Ruby 1.9David Calavera
 
Rspec and Capybara Intro Tutorial at RailsConf 2013
Rspec and Capybara Intro Tutorial at RailsConf 2013Rspec and Capybara Intro Tutorial at RailsConf 2013
Rspec and Capybara Intro Tutorial at RailsConf 2013Brian Sam-Bodden
 
Building web framework with Rack
Building web framework with RackBuilding web framework with Rack
Building web framework with Racksickill
 
Ruby Presentation
Ruby Presentation Ruby Presentation
Ruby Presentation platico_dev
 
Ruby on Rails - An overview
Ruby on Rails -  An overviewRuby on Rails -  An overview
Ruby on Rails - An overviewThomas Asikis
 
The Future of library dependency manageement of Ruby
The Future of library dependency manageement of RubyThe Future of library dependency manageement of Ruby
The Future of library dependency manageement of RubyHiroshi SHIBATA
 
The Enterprise Strikes Back
The Enterprise Strikes BackThe Enterprise Strikes Back
The Enterprise Strikes BackBurke Libbey
 
Ruby Performance - The Last Mile - RubyConf India 2016
Ruby Performance - The Last Mile - RubyConf India 2016Ruby Performance - The Last Mile - RubyConf India 2016
Ruby Performance - The Last Mile - RubyConf India 2016Charles Nutter
 

Similar to How DSL works on Ruby (20)

TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQL
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1
 
Ruby
RubyRuby
Ruby
 
TorqueBox - Ruby Hoedown 2011
TorqueBox - Ruby Hoedown 2011TorqueBox - Ruby Hoedown 2011
TorqueBox - Ruby Hoedown 2011
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
 
Ruby on Rails (RoR) as a back-end processor for Apex
Ruby on Rails (RoR) as a back-end processor for Apex Ruby on Rails (RoR) as a back-end processor for Apex
Ruby on Rails (RoR) as a back-end processor for Apex
 
Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02
 
2016-05-12 DCRUG React.rb
2016-05-12 DCRUG React.rb2016-05-12 DCRUG React.rb
2016-05-12 DCRUG React.rb
 
Code for Startup MVP (Ruby on Rails) Session 2
Code for Startup MVP (Ruby on Rails) Session 2Code for Startup MVP (Ruby on Rails) Session 2
Code for Startup MVP (Ruby on Rails) Session 2
 
The Future of Bundled Bundler
The Future of Bundled BundlerThe Future of Bundled Bundler
The Future of Bundled Bundler
 
Rubyspec y el largo camino hacia Ruby 1.9
Rubyspec y el largo camino hacia Ruby 1.9Rubyspec y el largo camino hacia Ruby 1.9
Rubyspec y el largo camino hacia Ruby 1.9
 
Rspec and Capybara Intro Tutorial at RailsConf 2013
Rspec and Capybara Intro Tutorial at RailsConf 2013Rspec and Capybara Intro Tutorial at RailsConf 2013
Rspec and Capybara Intro Tutorial at RailsConf 2013
 
Building web framework with Rack
Building web framework with RackBuilding web framework with Rack
Building web framework with Rack
 
Ruby Presentation
Ruby Presentation Ruby Presentation
Ruby Presentation
 
遇見 Ruby on Rails
遇見 Ruby on Rails遇見 Ruby on Rails
遇見 Ruby on Rails
 
Ruby on Rails - An overview
Ruby on Rails -  An overviewRuby on Rails -  An overview
Ruby on Rails - An overview
 
The Future of library dependency manageement of Ruby
The Future of library dependency manageement of RubyThe Future of library dependency manageement of Ruby
The Future of library dependency manageement of Ruby
 
The Enterprise Strikes Back
The Enterprise Strikes BackThe Enterprise Strikes Back
The Enterprise Strikes Back
 
Ruby Performance - The Last Mile - RubyConf India 2016
Ruby Performance - The Last Mile - RubyConf India 2016Ruby Performance - The Last Mile - RubyConf India 2016
Ruby Performance - The Last Mile - RubyConf India 2016
 

More from Hiroshi SHIBATA

Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Deep dive into Ruby's require - RubyConf Taiwan 2023
Deep dive into Ruby's require - RubyConf Taiwan 2023Deep dive into Ruby's require - RubyConf Taiwan 2023
Deep dive into Ruby's require - RubyConf Taiwan 2023Hiroshi SHIBATA
 
How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?Hiroshi SHIBATA
 
How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?Hiroshi SHIBATA
 
Ruby コミッターと歩む Ruby を用いたプロダクト開発
Ruby コミッターと歩む Ruby を用いたプロダクト開発Ruby コミッターと歩む Ruby を用いたプロダクト開発
Ruby コミッターと歩む Ruby を用いたプロダクト開発Hiroshi SHIBATA
 
Why ANDPAD commit Ruby and RubyKaigi?
Why ANDPAD commit Ruby and RubyKaigi?Why ANDPAD commit Ruby and RubyKaigi?
Why ANDPAD commit Ruby and RubyKaigi?Hiroshi SHIBATA
 
RailsGirls から始める エンジニアリングはじめの一歩
RailsGirls から始める エンジニアリングはじめの一歩RailsGirls から始める エンジニアリングはじめの一歩
RailsGirls から始める エンジニアリングはじめの一歩Hiroshi SHIBATA
 
Roadmap for RubyGems 4 and Bundler 3
Roadmap for RubyGems 4 and Bundler 3Roadmap for RubyGems 4 and Bundler 3
Roadmap for RubyGems 4 and Bundler 3Hiroshi SHIBATA
 
Ruby Security the Hard Way
Ruby Security the Hard WayRuby Security the Hard Way
Ruby Security the Hard WayHiroshi SHIBATA
 
OSS Security the hard way
OSS Security the hard wayOSS Security the hard way
OSS Security the hard wayHiroshi SHIBATA
 
Productive Organization with Ruby
Productive Organization with RubyProductive Organization with Ruby
Productive Organization with RubyHiroshi SHIBATA
 
How to distribute Ruby to the world
How to distribute Ruby to the worldHow to distribute Ruby to the world
How to distribute Ruby to the worldHiroshi SHIBATA
 

More from Hiroshi SHIBATA (13)

Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Deep dive into Ruby's require - RubyConf Taiwan 2023
Deep dive into Ruby's require - RubyConf Taiwan 2023Deep dive into Ruby's require - RubyConf Taiwan 2023
Deep dive into Ruby's require - RubyConf Taiwan 2023
 
How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?
 
How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?
 
Ruby コミッターと歩む Ruby を用いたプロダクト開発
Ruby コミッターと歩む Ruby を用いたプロダクト開発Ruby コミッターと歩む Ruby を用いたプロダクト開発
Ruby コミッターと歩む Ruby を用いたプロダクト開発
 
Why ANDPAD commit Ruby and RubyKaigi?
Why ANDPAD commit Ruby and RubyKaigi?Why ANDPAD commit Ruby and RubyKaigi?
Why ANDPAD commit Ruby and RubyKaigi?
 
RailsGirls から始める エンジニアリングはじめの一歩
RailsGirls から始める エンジニアリングはじめの一歩RailsGirls から始める エンジニアリングはじめの一歩
RailsGirls から始める エンジニアリングはじめの一歩
 
Roadmap for RubyGems 4 and Bundler 3
Roadmap for RubyGems 4 and Bundler 3Roadmap for RubyGems 4 and Bundler 3
Roadmap for RubyGems 4 and Bundler 3
 
Ruby Security the Hard Way
Ruby Security the Hard WayRuby Security the Hard Way
Ruby Security the Hard Way
 
OSS Security the hard way
OSS Security the hard wayOSS Security the hard way
OSS Security the hard way
 
Productive Organization with Ruby
Productive Organization with RubyProductive Organization with Ruby
Productive Organization with Ruby
 
Gems on Ruby
Gems on RubyGems on Ruby
Gems on Ruby
 
How to distribute Ruby to the world
How to distribute Ruby to the worldHow to distribute Ruby to the world
How to distribute Ruby to the world
 

Recently uploaded

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 FMESafe Software
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
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 Takeoffsammart93
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
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
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
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].pdfOverkill Security
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
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 REVIEWERMadyBayot
 
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...Miguel Araújo
 
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 WorkerThousandEyes
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
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...Drew Madelung
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 

Recently uploaded (20)

+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...
 
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
 
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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
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
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
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...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
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
 
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...
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
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...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation 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)
 

How DSL works on Ruby

  • 1. The future of Rake Hiroshi SHIBATA / GMO PEPABO inc. 2016.09.08 RubyKaigi 2016 How DSL works on Ruby
  • 2. Chief Engineer Hiroshi SHIBATA @hsbt https://www.hsbt.org
  • 3. self.introduce => { name: “SHIBATA Hiroshi”, nickname: “hsbt”, title: “Chief engineer at GMO Pepabo, Inc.”, commit_bits: [“ruby”, “rake”, “rubygems”, “rdoc”, “psych”, “syck”, “ruby- build”, “railsgirls”, “railsgirls-jp”, “tdiary”, “hiki”…], sites: [“hsbt.org”, “ruby-lang.org”, “rubyci.org”, “railsgirls.com”, “railsgirls.jp”], }
  • 4. My work in Ruby 2.4 •Maintain *.ruby-lang.org. Applied to Site Reliability Engineering. •Gemify standard library (xmlrpc, tk) •Update bundled library such as rubygems, rdoc, psych, json •Maintain ruby-build •Maintain Psych 2.0, 2.1, also Syck •Maintain RDoc 4.2, 5.0 •Maintain Rake 10.5, 11.2 and 12.0(TBD)
  • 6. Make in Ruby Rake is a Make-like program implemented in Ruby. Tasks and dependencies are specified in standard Ruby syntax. task :awesome do puts :bar end task beat: [:awesome] do puts :buzz end task default: :beat
  • 7. Rake features •Rakefiles (rake's version of Makefiles) are completely defined in standard Ruby syntax. •Users can specify tasks with prerequisites. •Supports parallel execution of tasks. $ rake -j
  • 8. Rake::FileList •It’s also declaration named `Filelist` on Toplevel. •It has utility class for File listing. file_list = FileList.new('lib/**/*.rb', ‘test/test*.rb') FileList['a.c', 'b.c'].exclude("a.c") => [‘b.c']
  • 9. Rake::TestTask Minitest and Test::Unit integration task of Rake require 'rake/testtask' Rake::TestTask.new(:test) do |t| t.libs << "test" t.verbose = true t.test_files = FileList['test/**/test_*.rb'] end It is only task for outside library. Task for rdoc, bundler, and more is stored their gems.
  • 10. First SemVer •Rake is a first famous gem adopted semantic versioning in rubygems •probably… •Rake 0.9 bump to 10.0 for next version. •Rake follows this release policy now.
  • 11. ruby/rake •Rake was originally created by Jim Weirich, who unfortunately passed away in February 2014. •This repository was originally hosted at github.com/jimweirich/rake, It has been moved to ruby/rake by @drbrain •@drbrain and @hsbt maintain ruby/rake
  • 12. Download Ranking Rake is most downloaded gem in the ruby world.
  • 14. DSL is Domain Specific Language In the situation of Ruby language •Ruby is readable language. Because we often use internal DSL. •Ruby has a lot of functions for building internal DSL. It uses meta-programming technic. “A domain-specific language (DSL) is a computer language specialized to a particular application domain” https://en.wikipedia.org/wiki/Domain-specific_language
  • 15. Pattern: Class method Slightly simple DSL on standalone class class User has_many :foo end
  • 16. Pattern: Class method Slightly simple DSL on standalone class class User has_many :foo end class User def self.has_many(foo) puts foo end end
  • 17. Pattern: Module and Class ancestors You can build simple DSL used Ruby’s module and class class User < ARBase has_many :blogs end
  • 18. Pattern: Module and Class ancestors You can build simple DSL used Ruby’s module and class module DSL def has_many(bar = nil) puts bar end end class ARBase extend DSL end class User < ARBase has_many :blogs end
  • 19. Pattern: Method define You can define method via eval for simple DSL class User < ARBase has_many :blogs blogs_foo end
  • 20. Pattern: Method define module DSL def has_many(bar = nil) self.class.module_eval <<-CODE, __FILE__, __LINE__ def #{bar}_foo puts :foo end CODE end end (snip) You can define method via eval for simple DSL class User < ARBase has_many :blogs blogs_foo end
  • 21. Pattern: Implicit code block We need to prepare to configuration for gem behavior changes. Foo.configure do |c| c.bar = :buzz end
  • 22. Pattern: Implicit code block We need to prepare to configuration for gem behavior changes. module Foo def self.configure yield self end class << self attr_accessor :bar end end Foo.configure do |c| c.bar = :buzz end
  • 23. Pattern: Decrative setter We can implement `Explicit code block` used instance_eval. Foo.configure do bar :buzz end
  • 24. Pattern: Decrative setter We can implement `Explicit code block` used instance_eval. module Foo def self.configure(&block) instance_eval(&block) end class << self def bar(v = nil) v ? @bar = v : @bar end end end Foo.configure do bar :buzz end
  • 25. Pattern: instance_eval You can provide class scoped DSL via instance_eval gemfile = <<-GEM gem 'foo' GEM Foo.new.eval_gemfile(gemfile)
  • 26. Pattern: instance_eval You can provide class scoped DSL via instance_eval class Foo def gem(name) p name end def eval_gemfile(file) instance_eval(file) end end gemfile = <<-GEM gem 'foo' GEM Foo.new.eval_gemfile(gemfile)
  • 28. DSL in Ruby language •Rake •Capistrano •Thor •Bundler
  • 29. Rake and Rake.application •rake_module.rb: defined `Rake.application` for Rake singleton instance. •Rake.application returns `Rake::Application` instance. •`rake` command invoke `Rake.application.run` def run standard_exception_handling do init load_rakefile top_level end end
  • 30. Rake::Application#init , Rake::Application#load_rakefile •`init` method handles… •detect invoking task: “rake -j foo” -> detecting “foo” •parse given option: “rake -j foo” -> detecting “-j” •`load_rakefile` read default rakefile named `%w(rakefile Rakefile rakefile.rb Rakefile.rb)`
  • 31. Rake::Application#top_level •If you add `-T` options, top_level shows list of tasks on Rakefile •If you add `-P` options, top_level shows dependencies of target task. •top_level invokes tasks given command line. Example for `rake foo bar buzz`. top_level invokes three tasks. •top_level methods are under the thread pool on Rake.
  • 32. Object#task •load_rakefile simply load Rakefile used by `load` method provided by Ruby. •Your Rakefile DSL provided by `Rake::DSL` filed dsl_definition.rb module Rake module DSL (snip) def task(*args, &block) # :doc: Rake::Task.define_task(*args, &block) end end end self.extend Rake::DSL
  • 33. Rake::Task •`Rake::Task` instance is defined by `Rake::TaskManager#define_task` •`Rake::Task` have manipulation tasks on class methods like clear, tasks, [], and more. •Class method of `Rake::Task` call `Rake::TaskManager` via `Rake.application` instance.
  • 34. Rake::Task •`Rake::TaskManager#define_task` build actions, dependencies and scope for task. actions are stored code blocks. •`Rake::Task#invoke` invoke tasks of dependencies and @actions for Proc#call •Invoked task marked @already_invoked flag. If you clear this flag, you need to run `Rake::Task#reenable` def enhance(deps=nil, &block) @prerequisites |= deps if deps @actions << block if block_given? self end
  • 35. Capistrano •Capistrano is a framework for building automated deployment scripts. •Capistrano tasks on version 3 are simple rake task task :restart_sidekiq do on roles(:worker) do execute :service, "sidekiq restart" end end after "deploy:published", "restart_sidekiq" •`Capistrano::Application` inherited `Rake::Application`
  • 36. Thor Thor is a simple and efficient tool for building self-documenting command line utilities. class App < Thor desc "list [SEARCH]", "list all of the available apps, limited by SEARCH" def list(search="") # list everything end end Thor provides inherited pattern DSL for their CLI. You can invoke it used `Thor.start`
  • 37. Bundler •`Bundler::CLI` inherited Thor class. It’s simple thor command. • Bundler provides Gemfile DSL used DSL class and instance_eval def eval_gemfile(gemfile, contents = nil) expanded_gemfile_path = Pathname.new(gemfile).expand_path original_gemfile = @gemfile @gemfile = expanded_gemfile_path contents ||= Bundler.read_file(gemfile.to_s) instance_eval(contents.dup.untaint, gemfile.to_s, 1) (snip)
  • 38. CM
  • 43. We are hiring!!1 Please follow our account @pb_recruit
  • 44. Long live the Rake 4.
  • 45. Rake 10.x •My first maintained version of Rake •I triaged issues and fixed broken test at first
  • 46. JRuby compatible issues •`Dir.chdir` change behavior of `sh()` on JRuby •https://github.com/ruby/rake/pull/101 •https://github.com/jruby/jruby/issues/3653 •https://github.com/hsbt/rake-issue-chdir
  • 47. Reproduction code def sh(*cmd) res = system(*cmd) status = $? p [res, status] end RUBY = ENV['RUBY'] || File.join( RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG['EXEEXT']) ENV['RAKE_TEST_SH'] = 'someval' sh RUBY, 'check_no_expansion.rb', '$RAKE_TEST_SH', 'someval' Dir.chdir 'test' sh RUBY, 'check_no_expansion.rb', '$RAKE_TEST_SH', 'someval'
  • 48. Results - Ruby 2.3.0 % ruby rake_issue.rb ["$RAKE_TEST_SH", "someval"] [true, #<Process::Status: pid 24928 exit 0>] ["$RAKE_TEST_SH", "someval"] [true, #<Process::Status: pid 24929 exit 0>]
  • 49. Results - JRuby 9.0.5.0 and 1.7.24 % ruby rake_issue.rb ["$RAKE_TEST_SH", "someval"] [true, #<Process::Status: pid 21844 exit 0>] ["someval", "someval"] [false, #<Process::Status: pid 21845 exit 1>] JRuby 9.0.5.0 % ruby rake_issue.rb ["$RAKE_TEST_SH", "someval"] [true, #<Process::Status: pid=22397,exited(0)>] ["$RAKE_TEST_SH", "someval"] [true, #<Process::Status: pid=22398,exited(0)>] JRuby 1.7.24
  • 50. Another compatible issues on JRuby •`Exception#cause` is difference behavior with CRuby 2.3.0 •https://github.com/jruby/jruby/issues/3654 •Missing stdout using `Open3.popen` after `Dir.chdir` •https://github.com/jruby/jruby/issues/3655
  • 52. Rake 11.x •My first major release version of Rake •It have some of breaking changes •It uses modern ecosystem on ruby language
  • 53. Removed deprecated code •I removed deprecated code commented by Jim •Some historical gems like yard and rspec used `TaskManager#last_comment` •I reverted to delete `last_comment` at Rake 11 •I’m sorry to inconvenience experience for above breaking changes.
  • 54. Rewrite hoe to bundler •You may invoke to `bundle` when to see Gemfile •Without bundler, you need to install hoe and their plugins. •I sometimes rewrite gem release tasks at rake, psych, syck…etc.
  • 55. Unexpected behavior for rake - verbose •I misunderstand to behavior of `verbose` option on Rake#Testtask •expected: verbose option of rake task same as Ruby’s `-W` option. So you can get additional debug/warn message with your ruby code. •actual: verbose option on rake displays details of command runner. and minitest has another `verbose` option. It shows test name and results for test suites.
  • 56. Unexpected behavior for rake - deps I added deps option for `Rake::TestTask` task :setup do end Rake::TestTask.new do |t| t.deps = :setup end task :setup do end Rake::TestTask.new(:test) => [:setup] do end But It’s same behavior this.
  • 58. Rake 12.x? •I works to develop to Rake 12 •Release date is tentative •This is major version-up. I have plan to some breaking changes.
  • 59. Drop to support old Ruby •Rake have concurrent task runner •Current implementation detects core number used by system utilities like `sysctl`. •But Ruby 2.2 provides `Etc.nprocessor` for detects core number natively. •I like ruby core function. Rake 12 only supports Ruby 2.2 or later same as Rails 5.
  • 60. minimize/minirake •Rake have a lot of functions. I hope to reduce code for fast invocation when We run rake task. •Idea 1: Reduce code without core function like `rake-contrib` •Idea 2: minirake - mruby have minimum implementation of rake
  • 61. default task I will add default method for difine default task task :default => [:foo, :bar] default [:foo, :bar] to
  • 62. Do not use main(Object class) •Rake defined task method under main instance provided the Object class. •We cant use name of `task` on irb/rails console when you use Rake gem. •I hope to solve it.
  • 63. Conclusion •Summarize Rake history and basis. •Introduce DSL pattern of Ruby language •Learn Rake internal •Show Rake 10 and 11 works •Propose Rake 12 future.
  • 64. Let’s fan to maintain big OSS