Module: Rails::Tc::CommandRunner

Defined in:
lib/rails/tc/command_runner.rb

Class Method Summary collapse

Class Method Details

.add_development_gem(gem) ⇒ Object



19
20
21
# File 'lib/rails/tc/command_runner.rb', line 19

def self.add_development_gem(gem)
  system "bundle add #{gem} --group development" unless gem_installed?(gem)
end

.add_runtime_gem(gem) ⇒ Object



23
24
25
# File 'lib/rails/tc/command_runner.rb', line 23

def self.add_runtime_gem(gem)
  system "bundle add #{gem}" unless gem_installed?(gem)
end

.gem_installed?(gem) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/rails/tc/command_runner.rb', line 27

def self.gem_installed?(gem)
  `bundle show`.scan(/^\s*\*\s*([^\s]+).*/).map(&:first).include? gem
end

.generateObject



10
11
12
13
# File 'lib/rails/tc/command_runner.rb', line 10

def self.generate
  system "bundle exec tapioca gem"
  system "bundle exec tapioca dsl"
end

.initObject



6
7
8
# File 'lib/rails/tc/command_runner.rb', line 6

def self.init
  `bundle exec srb init 2>&1`
end

.type_checkObject



15
16
17
# File 'lib/rails/tc/command_runner.rb', line 15

def self.type_check
  `bundle exec srb tc 2>&1`
end