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.10.0 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.9.0 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.8.5 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.8.4 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.8.3 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.8.2 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.8.1 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.8.0 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.7.23 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.7.22 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.7.21 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.7.20 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.7.19 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.7.18 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.7.17 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.7.16 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.7.15 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.7.14 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.7.13 lib/bullet_train/terminal_commands.rb
bullet_train-super_scaffolding-1.7.12 lib/bullet_train/terminal_commands.rb