Sha256: 41ec34b6a1b78d4640527f489faeb56a7234ab4320321f24e9b8cfa3f759533b

Contents?: true

Size: 558 Bytes

Versions: 135

Compression:

Stored size: 558 Bytes

Contents

module TerminalCommands
  def self.open_file_or_link(file_or_link, options = {})
    command = if macosx?
      "open"
    elsif linux?
      "xdg-open"
    end
    `#{command} #{file_or_link}`
  end

  def self.os
    Gem::Platform.local.os
  end

  def self.macosx?
    os == macosx
  end

  def self.linux?
    os == linux
  end

  def self.can_open?
    (TerminalCommands.macosx? && `which open`.present?) ||
      (TerminalCommands.linux? && `which xdg-open`.present?)
  end

  def self.macosx
    "darwin"
  end

  def self.linux
    "linux"
  end
end

Version data entries

135 entries across 135 versions & 1 rubygems

Version Path
bullet_train-super_scaffolding-1.2.14 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.2.13 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.2.12 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.2.11 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.2.10 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.2.9 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.2.8 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.2.7 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.2.6 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.2.5 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.2.4 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.2.3 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.2.2 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.2.1 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.2.0 lib/bullet_train/terminal_commands.rb