Sha256: 3c1bd748cd89072cf7b49243e4148195470a6d3e354ea54efbe33c839a8f9e48

Contents?: true

Size: 1.13 KB

Versions: 5

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

module Mobilis
module ActionsProjectsTake


def append_line filename, line
  lines = IO.readlines filename
  lines << line
  write_file filename do |f|
    f.write(lines.join("\n"))
  end
end

def run_command command
  # fixme
  #Mobilis.logger.info "$ #{command.join " "}"
  puts "-> Running --> #{command}"
  system command
  if $? then
    puts "-> Error running command!"
    exit(1)
  end
end

def oblivious_run_command command
  # fixme
  #Mobilis.logger.info "$ #{command.join " "}"
  puts "-> Running --> #{command}"
  system command
end

def run_docker cmd
  oblivious_run_command "docker #{cmd}"
end

def set_second_line filename, line
  lines = IO.readlines filename
  lines.reverse!
  first_line = lines.pop
  lines << line
  lines << first_line
  lines.reverse!
  write_file filename do |f|
    f.write(lines.join("\n"))
  end
end

def set_file_contents filename, contents
  write_file filename do |f|
    f.write contents
  end
end

def write_file filename, &block
  puts " -> Writing --> #{ filename }"
  File.open(filename, "wb", &block)
end


end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mobilis-0.0.5 lib/mobilis/actions_projects_take.rb
mobilis-0.0.4 lib/mobilis/actions_projects_take.rb
mobilis-0.0.3 lib/mobilis/actions_projects_take.rb
mobilis-0.0.2 lib/mobilis/actions_projects_take.rb
mobilis-0.0.1 lib/mobilis/actions_projects_take.rb