Module: SmalrubyEditor

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

Defined Under Namespace

Modules: BlocklyMessageHelper

Constant Summary collapse

COLORS =

ジャンルのカラー

{
  character: 198,
  control: 43,
  data: 330,
  etc: 340,
  events: 33,
  looks: 270,
  motion: 208,
  operators: 100,
  pen: 160,
  ruby: 340,
  sensing: 190,
  sound: 300,
}
VERSION =
'0.2.1'

Class Method Summary collapse

Class Method Details

.create_home_directory(home_dir = nil) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/smalruby_editor.rb', line 21

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:

  • (Boolean)


45
46
47
48
49
50
51
52
53
# File 'lib/smalruby_editor.rb', line 45

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:

  • (Boolean)


33
34
35
36
37
38
39
40
41
# File 'lib/smalruby_editor.rb', line 33

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:

  • (Boolean)


57
58
59
60
61
62
63
64
65
# File 'lib/smalruby_editor.rb', line 57

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