Class: Aruba::Initializers::CommonInitializer

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/aruba/initializer.rb

Overview

Common initializer

Instance Method Summary collapse

Instance Method Details

#add_gemObject

Add gem to gemfile


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/aruba/initializer.rb', line 17

def add_gem
  file = 'Gemfile'
  creator = if File.exist? file
              :append_to_file
            else
              :create_file
            end

  content = if File.exist? file
              %(gem 'aruba', '~> #{Aruba::VERSION}')
            else
              %(source 'https://rubygems.org'\ngem 'aruba', '~> #{Aruba::VERSION}'\n)
            end
  send creator, file, content
end