Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Low-Latency Development

Avatar for Dan Horst Dan Horst
January 26, 2016

Low-Latency Development

An overview of 15 utilities that make it faster and easier to develop Rails applications.

Avatar for Dan Horst

Dan Horst

January 26, 2016

More Decks by Dan Horst

Other Decks in Technology

Transcript

  1. Setting up Guard 1. Add a guard plugin to the

    Gemfile 2. Run `guard init PLUGIN_NAME` 3. Customize the Guardfile as needed 4. Run `bundle exec guard` when starting development
  2. group :guard do
 gem 'guard-bundler', require: false
 gem 'guard-jshintrb', require:

    false
 gem 'guard-rails', require: false
 gem 'guard-rubocop', require: false
 gem 'guard-rspec', require: false
 gem 'guard-scss-lint', require: false
 gem 'guard-spring', require: false
 gem 'terminal-notifier', require: false
 gem 'terminal-notifier-guard', require: false
 end Gemfile
  3. Guard Rubocop guard :rubocop, all_on_start: false, cli: ['--format', 'clang', '--rails',

    '--config', './.hound.yml' ] do
 watch(%r{.+\.rb$})
 watch(%r{(?:.+/)?\.hound\.yml$}) { |m| File.dirname(m[0]) }
 end https://github.com/yujinakayama/guard-rubocop Guardfile
  4. group :development do
 gem 'spring-commands-rspec'
 end guard :rspec, cmd: 'bundle

    exec bin/rspec' do
 …
 end Guard RSpec https://github.com/guard/guard-rspec Gemfile Guardfile
  5. Guard SCSS Lint guard :scsslint, all_on_start: false do
 watch(%r{.+\.scss$})
 end

    https://github.com/chrislopresto/guard-scss-lint Guardfile
  6. Guard Pitfalls • Guard plugins are usually written by third

    parties. Not all libraries have guard integration; some plugins are out of date. • Notification proxying is fussy with tmux & tmate • File system event detection is platform-specific • Running multiple plugins at once increases the maintenance burden e.g. spring & rspec.
  7. group :development, :test do
 gem 'byebug'
 gem 'pry-byebug'
 end Byebug

    https://github.com/deivid-rodriguez/byebug Gemfile byebug Insert into code at desired breakpoint
  8. Rails Console http://guides.rubyonrails.org/command_line.html#rails-console $ ./bin/rails console
 Running via Spring preloader

    in process 11166
 Loading development environment (Rails 4.2.5)
 [1] pry(main)> Terminal Gemfile gem 'pry-rails', group: :development
  9. REPL Pitfalls • UNSAFE for production • Can be an

    excuse to ignore logs & logging • Extra work to attach to a remote or detached process e.g. spring