class Devkitkat::Service::PredefinedCommand::AddScript

Public Instance Methods

available?() click to toggle source
# File lib/devkitkat/service/predefined_command/add_script.rb, line 29
def available?
  true
end
machine_driver() click to toggle source
# File lib/devkitkat/service/predefined_command/add_script.rb, line 33
def machine_driver
  'none'
end
to_script() click to toggle source
# File lib/devkitkat/service/predefined_command/add_script.rb, line 7
        def to_script
          names = command.args.any? ? command.args : %w[configure unconfigure start]

          FileUtils.mkdir_p(service.script_dir)

          names.map do |name|
            file_path = File.join(service.script_dir, name)

            <<-EOS
if [[ ! -f "#{file_path}" ]]; then
  cat > #{file_path} << EOL
#!/bin/bash
set -e

# TODO: Define scripts
EOL
  chmod 755 #{file_path}
fi
            EOS
          end.join("\n")
        end