Module: SmalrubyEditor

Defined in:
lib/smalruby_editor.rb,
lib/smalruby_editor/version.rb

Constant Summary collapse

VERSION =
'0.1.18'

Class Method Summary collapse

Class Method Details

.create_home_directory(home_dir = nil) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/smalruby_editor.rb', line 5

def create_home_directory(home_dir = nil)
  if home_dir.blank?
    path = ENV['SMALRUBY_EDITOR_HOME'] || '~/.smalruby-editor'
    home_dir = Pathname(path).expand_path
  end
  create_under_home_directories(home_dir)
  create_database_yml(home_dir)
  home_dir
end

.osx?Boolean

Mac OS Xかどうかを返す

Returns:



29
30
31
32
33
34
35
36
37
# File 'lib/smalruby_editor.rb', line 29

def osx?
  if Rails.env != 'test' &&
      (ENV['SMALRUBY_EDITOR_OSX_MODE'] ||
       File.exist?(Rails.root.join('tmp', 'osx')))
    true
  else
    /darwin/ =~ RbConfig::CONFIG['arch']
  end
end

.raspberrypi?Boolean

Raspberry Piかどうかを返す

Returns:



17
18
19
20
21
22
23
24
25
# File 'lib/smalruby_editor.rb', line 17

def raspberrypi?
  if Rails.env != 'test' &&
      (ENV['SMALRUBY_EDITOR_RASPBERRYPI_MODE'] ||
       File.exist?(Rails.root.join('tmp', 'raspberrypi')))
    true
  else
    RbConfig::CONFIG['arch'] == 'armv6l-linux-eabihf'
  end
end

.windows?Boolean

Windowsかどうかを返す

Returns:



41
42
43
44
45
46
47
48
49
# File 'lib/smalruby_editor.rb', line 41

def windows?
  if Rails.env != 'test' &&
      (ENV['SMALRUBY_EDITOR_WINDOWS_MODE'] ||
       File.exist?(Rails.root.join('tmp', 'windows')))
    true
  else
    /windows|mingw|cygwin/i.match(RbConfig::CONFIG['arch'])
  end
end