Module: Katapult::BinaryUtil

Extended by:
BinaryUtil
Included in:
BinaryUtil
Defined in:
lib/katapult/binary_util.rb

Instance Method Summary collapse

Instance Method Details

#create_rails_app(name) ⇒ Object



17
18
19
# File 'lib/katapult/binary_util.rb', line 17

def create_rails_app(name)
  run "rails _#{ Katapult::RAILS_VERSION }_ new #{ name } --skip-test-unit --skip-bundle --database postgresql"
end

#git_commit(message, options = nil) ⇒ Object



12
13
14
15
# File 'lib/katapult/binary_util.rb', line 12

def git_commit(message, options = nil)
  message.gsub! /'/, "" # remove single quotes
  system "git add --all; git commit -m '#{ message }' --author='katapult <[email protected]>' #{ options }"
end

#puts(*args) ⇒ Object



21
22
23
24
# File 'lib/katapult/binary_util.rb', line 21

def puts(*args)
  message = "\n> #{ args.join ' ' }"
  Kernel.puts "\e[35m#{ message }\e[0m" # pink
end

#run(command) ⇒ Object

With clean Bundler env



27
28
29
30
31
32
33
34
# File 'lib/katapult/binary_util.rb', line 27

def run(command)
  success = Bundler.with_clean_env { system command }

  if !success
    puts 'x Something went wrong'
    exit(1)
  end
end