Top Level Namespace

Includes:
FileUtils, System

Defined Under Namespace

Modules: AddressBar, Alarm, AppSwitcher, Application, AudioCapture, BackButton, Backlight, Barcode, Base64, Battery, BottomCommandArea, BrowserHelper, Bsearch, CardReader, Color, Comm, Comparable, Cradle, Crypt, DateTimePicker, Device, Digest, Eink, EmmlProfile, Enumerable, EzCrypto, FileTransfer, FileUtils, Find, ForwardButton, GeoLocation, Gesture, GoButton, HMAC, History, HomeButton, Hourglass, Imager, IoAnalog, IoDigital, IoSystem, JSON, Kernel, KeyCapture, KeyState, Keylight, Lightsensor, LocalizationSimplified, MSpec, MapView, MediaPlayer, Memory, MinimizeButton, Mock, MonitorMixin, NativeBar, NavBar, Net, Network, Notification, OpenSSL, PDF, Phonebook, PowerOn, Push, QuitButton, REXML, RawSensors, RbConfig, Reboot, Registry, ReloadButton, RequiredTime, Rfid, Rho, RhoBluetooth, RhoConf, RhoDevelopment, RhoElementsExt, RhoLog, RhoPackages, RhoProfiler, RhoconnectHelper, Rhodes, RhodesFramework, RhodesNativeViewManager, Rhohub, Rhom, Rsm, SQLite3, SWIG, Scanner, ScratchPad, ScreenOrientation, SignatureCapture, SignatureTool, Singleton, Sip, SipButton, Sntp, StopButton, StringSymbolAdapter, Stylus, SyncEngine, SystemTime, TSort, Telemetry, Timeout, Timer, TopCommandArea, Transaction, URI, VideoCapture, Volume, Wake, Wlan, ZipTarGz, Zoom, ZoomInPageButton, ZoomOutPageButton, ZoomTextButton Classes: ActionFilter, ActiveCryptoTest, Alert, AppApplication, Array, Asset, AssetRaw, AssociationKeyHolderTest, BackgroundGuard, BasicSocket, BeAnInstanceOfMatcher, BeAncestorOfMatcher, BeCloseMatcher, BeComputedByFunctionMatcher, BeComputedByMatcher, BeEmptyMatcher, BeFalseMatcher, BeKindOfMatcher, BeNilMatcher, BeTrueMatcher, BeValidDNSName, BigEndianGuard, Bignum, BugGuard, BuildConfig, BuildOutput, CGI, CRC32, Camera, Cap, CheckSumCalculator, CheckSumComparer, CheckSumSerializer, Child, Class, ComplainMatcher, CompliantOnGuard, ConditionVariable, ConflictsGuard, ContextState, Date, DateTime, DebugAction, DescribeFormatter, DigestTest, Dir, DottedFormatter, ENV, ERB, EncUser, Encoding, EncryptTest, EndianGuard, EqlMatcher, EqualElementMatcher, EqualMatcher, EqualUtf16Matcher, ExampleState, ExceptionState, Expectation, ExtensionsGuard, EzCryptoTest, FalseClass, FeatureGuard, File, FileFormatter, Fixnum, Float, GdbAction, GeneratorController, GeneratorTimeChecker, Group, GroupSecret, Hash, HashBase64, HashWithIndifferentAccess, HaveClassVariableMatcher, HaveConstantMatcher, HaveDataMatcher, HaveInstanceMethodMatcher, HaveInstanceVariableMatcher, HaveMethodMatcher, HavePrivateInstanceMethodMatcher, HavePrivateMethodMatcher, HaveProtectedInstanceMethodMatcher, HavePublicInstanceMethodMatcher, HaveSingletonMethodMatcher, HtmlFormatter, IO, IOStub, IPSocket, IncludeMatcher, Inflections, Integer, JUnitFormatter, JUnitRhoLogFormatter, Jake, JasmineLikeFormatter, KeyHolderSubject, KeyHolderTest, LittleEndianGuard, MSpecOption, MSpecOptions, MSpecScript, MatchData, MatchFilter, MatchYAMLMatcher, MethodFormatter, MethodMatcher, MockIntObject, MockObject, MockProxy, Module, Monitor, Mutex, NameMap, NegativeOperatorMatcher, NilClass, NonComplianceGuard, NotCompliantOnGuard, Numeric, NumericMockObject, Object, OpenStruct, OutputMatcher, OutputToFDMatcher, PP, PlatformGuard, PositiveOperatorMatcher, PrettyPrint, ProfileFilter, ProfileFormatter, QuarantineGuard, Queue, RaiseErrorMatcher, Range, Rational, RawUser, RegexpFilter, RespondToMatcher, RhoHubAccount, RhoSpecModule, RhoStdout, RunnerGuard, ScanError, Secret, SerialPort, Set, SiteChecker, SizedQueue, Socket, SocketError, SortedSet, SpecExpectation, SpecExpectationNotFoundError, SpecExpectationNotMetError, SpecGuard, SpecNegativeOperatorMatcher, SpecPositiveOperatorMatcher, SpecRunner, SpecTag, SpecVersion, SpecdocFormatter, SpecifiedOnGuard, SpinnerFormatter, String, StringIO, StringInput, StringOutput, StringScanner, Struct, SummaryFormatter, SuperUserGuard, SupportedGuard, Symbol, System, TCPServer, TCPSocket, TTYGuard, TagAction, TagFilter, TagListAction, TagPurgeAction, Tally, TallyAction, Thread, Time, TimerAction, TrueClass, UDPSocket, UnitdiffFormatter, UnspecifiedGuard, User, UserGuard, VariableMatcher, VersionGuard, WebView, YamlFormatter

Constant Summary collapse

SYNC_SERVER_BASE_URL =
'http://rhoconnect-spec-exact_platform.heroku.com'
SYNC_SERVER_CONSOLE_LOGIN =
'rhoadmin'
SYNC_SERVER_CONSOLE_PASSWORD =
''
BULK_SYNC_SERVER_URL =
'http://store-bulk.rhohub.com'
BULK_SYNC_SERVER_CONSOLE_LOGIN =
'rhoadmin'
BULK_SYNC_SERVER_CONSOLE_PASSWORD =
''
Config =

compatibility for ruby-1.8.4 and older.

RbConfig
CROSS_COMPILING =
nil
TRUE =
true
FALSE =
false
NIL =
nil
RUBY_VERSION =
"1.8.5"
VERSION =
"1.8.5"
TOPLEVEL_BINDING =
self
RHO_RB_EXT =

It is auto-generated content. Do not do required for this file in your application.

".iseq"
RHO_ERB_EXT =

It is auto-generated content. Do not do required for this file in your application.

"_erb.iseq"
RHO_APPS_DIR =

It is auto-generated content. Do not do required for this file in your application.

"apps/"
RHO_EMULATOR_DIR =
'rhosimulator'
TimeoutError =

Another name for Timeout::Error, defined for backwards compatibility with earlier versions of timeout.rb.

Timeout::Error
DEBUGGER_STEP_TYPE =
['STEP','STOVER','STRET','SUSP']
DEBUGGER_STEP_COMMENT =
['Stepped into','Stepped over','Stepped return','Suspended']
DEBUGGER_LOG_LEVEL_DEBUG =
0
DEBUGGER_LOG_LEVEL_INFO =
1
DEBUGGER_LOG_LEVEL_WARN =
2
DEBUGGER_LOG_LEVEL_ERROR =
3
SPEC_TEMP_DIR =

Creates a temporary directory in the current working directory for temporary files created while running the specs. All specs should clean up any temporary files created so that the temp directory is empty when the process exits.

"#{File.expand_path(Dir.pwd)}/rubyspec_temp"
SPEC_TEMP_UNIQUIFIER =
"0"
RUBY_NAME =
::RbConfig::CONFIG["RUBY_INSTALL_NAME"] || RbConfig::CONFIG["ruby_install_name"]
RAILS_ROOT =
root_path
TOLERANCE =
0.00003

Constants included from FileUtils

FileUtils::OPT_TABLE

Class Method Summary collapse

Instance Method Summary collapse

Methods included from FileUtils

cd, chdir, chmod, chmod_R, chown, chown_R, cmp, compare_file, compare_stream, copy, copy_entry, copy_file, copy_stream, cp, cp_r, #fu_have_symlink?, #fu_mkdir, #fu_stat_identical_entry?, getwd, identical?, install, link, ln, ln_s, ln_sf, makedirs, mkdir, mkdir_p, mkpath, move, mv, private_module_function, pwd, remove, remove_dir, remove_entry, remove_entry_secure, remove_file, #rename_cannot_overwrite_file?, rm, rm_f, rm_r, rm_rf, rmdir, rmtree, safe_unlink, symlink, touch, uptodate?

Methods included from System

app_installed?, get_locale, #get_locale, get_property, open_url, zip_file

Class Method Details

.privateObject



433
434
435
# File 'lib/framework/builtinME.rb', line 433

def private
    Object.private
end

.protectedObject



437
438
439
# File 'lib/framework/builtinME.rb', line 437

def protected
    Object.protected
end

.publicObject



429
430
431
# File 'lib/framework/builtinME.rb', line 429

def public
    Object.public
end

.to_sObject



425
426
427
# File 'lib/framework/builtinME.rb', line 425

def to_s
    return "main"
end

.write(str) ⇒ Object



13
14
15
16
# File 'lib/extensions/mspec/mspec/runner.rb', line 13

def $stderr.write(str)
  # The 'useless use of' warnings are a crime against OO.
  str =~ /useless use of/ ? nil : super
end

Instance Method Details

#debug_handle_cmd(inline) ⇒ Object



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/extensions/debugger/debugger.rb', line 95

def debug_handle_cmd(inline)
  cmd = $_cmd.match(/^([^\n\r]*)([\n\r]+|$)/)[0]
  processed = false
  wait = inline

  if cmd != ""
    if cmd =~/^CONNECTED/
      log_command(cmd)
      debugger_log(DEBUGGER_LOG_LEVEL_INFO, "Connected to debugger")
      processed = true
    elsif cmd =~/^(BP|RM):/
      log_command(cmd)
      ary = cmd.split(":")
      bp = ary[1].gsub(/\|/,':') + ':' + ary[2].chomp
      if (cmd =~/^RM:/)
        $_breakpoint.delete(bp)
        debugger_log(DEBUGGER_LOG_LEVEL_DEBUG, "Breakpoint removed: #{bp}")
      else
        $_breakpoint.store(bp,1)
        debugger_log(DEBUGGER_LOG_LEVEL_DEBUG, "Breakpoint added: #{bp}")
      end
      processed = true
    elsif cmd =~ /^RMALL/
      log_command(cmd)
      $_breakpoint.clear
      debugger_log(DEBUGGER_LOG_LEVEL_DEBUG, "All breakpoints removed")
      processed = true
    elsif cmd =~ /^ENABLE/
      log_command(cmd)
      $_breakpoints_enabled = true
      debugger_log(DEBUGGER_LOG_LEVEL_DEBUG, "Breakpoints enabled")
      processed = true
    elsif cmd =~ /^DISABLE/
      log_command(cmd)
      $_breakpoints_enabled = false
      debugger_log(DEBUGGER_LOG_LEVEL_DEBUG, "Breakpoints disabled")
      processed = true
    elsif inline && (cmd =~ /^STEPOVER/)
      $_s.write("STEPOVER start\n")
      log_command(cmd)
      $_step = 2
      $_step_level = $_call_stack
      $_resumed = true
      wait = false
      debugger_log(DEBUGGER_LOG_LEVEL_DEBUG, "Step over")
      processed = true
    elsif inline && (cmd =~ /^STEPRET/)
      log_command(cmd)
      if $_call_stack < 1
        $_step = 0
        comment = ' (continue)'
      else
        $_step = 3
        $_step_level = $_call_stack-1;
        comment = ''
      end
      $_resumed = true
      wait = false
      debugger_log(DEBUGGER_LOG_LEVEL_DEBUG, "Step return" + comment)
      processed = true
    elsif inline && (cmd =~ /^STEP/)
      log_command(cmd)
      $_step = 1
      $_step_level = -1
      $_resumed = true
      wait = false
      debugger_log(DEBUGGER_LOG_LEVEL_DEBUG, "Step into")
      processed = true
    elsif inline && (cmd =~ /^CONT/)
      log_command(cmd)
      wait = false
      $_step = 0
      $_resumed = true
      debugger_log(DEBUGGER_LOG_LEVEL_DEBUG, "Resuming")
      processed = true
    elsif cmd =~ /^SUSP/
      log_command(cmd)
      $_step = 4
      $_step_level = -1
      wait = true
      debugger_log(DEBUGGER_LOG_LEVEL_DEBUG, "Suspend")
      processed = true
    elsif cmd =~ /^KILL/
      log_command(cmd)
      debugger_log(DEBUGGER_LOG_LEVEL_DEBUG, "Terminating...")
      processed = true
      $_s.write("KILL start\n")
      System.exit
      $_s.write("KILL end\n")
    elsif inline && (cmd =~ /^EVL?:/)
      log_command(cmd)
      processed = true
      debugger_log(DEBUGGER_LOG_LEVEL_DEBUG, "Calc evaluation...")
      execute_cmd cmd.sub(/^EVL?:/,""), (cmd =~ /^EVL:/ ? true : false)
    elsif inline && (cmd =~ /^[GLCI]VARS/)
      log_command(cmd)
      debugger_log(DEBUGGER_LOG_LEVEL_DEBUG, "Get variables...")
      get_variables cmd
      processed = true
    elsif inline
      log_command(cmd)
      debugger_log(DEBUGGER_LOG_LEVEL_WARN, "Unknown command")
      processed = true
    end
  end

  if processed
    $_cmd = $_cmd.sub(/^([^\n\r]*)([\n\r]+(.*)|)$/, "\\3")
    $_wait = wait if inline
  end

  processed
end

#debug_read_cmd(io, wait) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/extensions/debugger/debugger.rb', line 22

def debug_read_cmd(io,wait)
  begin
    if wait
      cmd = io.readpartial(4096)
      $_cmd << cmd if cmd !~ /^\s*$/
    else
      cmd = io.read_nonblock(4096)
      $_cmd << cmd if cmd !~ /^\s*$/
    end
  rescue
    # puts $!.inspect
  end
end

#debugger_log(level, msg) ⇒ Object



12
13
14
15
16
# File 'lib/extensions/debugger/debugger.rb', line 12

def debugger_log(level, msg)
  if (level >= DEBUGGER_LOG_LEVEL_INFO) #DEBUGGER_LOG_LEVEL_WARN)
    puts "[Debugger] #{msg}"
  end
end

#Digest(name) ⇒ Object



48
49
50
# File 'lib/extensions/digest/digest.rb', line 48

def Digest(name)
  Digest.const_get(name)
end

#execute_cmd(cmd, advanced) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/extensions/debugger/debugger.rb', line 36

def execute_cmd(cmd, advanced)
  debugger_log(DEBUGGER_LOG_LEVEL_DEBUG, "Executing: #{cmd.inspect}, #{advanced}")
  cmd = URI.unescape(cmd.gsub(/\+/,' ')) if advanced
  result = ""
  error = '0';
  begin
    result = eval(cmd.to_s, $_binding).inspect
  rescue Exception => exc
    error = '1';
    result = "#{$!}".inspect
  end
  
  cmd = URI.escape(cmd.sub(/[\n\r]+$/, ''), Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")) if advanced
  $_s.write("EV" + (advanced ? "L:#{error}:#{cmd}:" : ':'+(error.to_i != 0 ? 'ERROR: ':'')) + result + "\n")
end

#get_variables(scope) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/extensions/debugger/debugger.rb', line 52

def get_variables(scope)  
  if (scope =~ /^GVARS/)
   cmd = "global_variables"
   prefix = ""
   vartype = "G"
  elsif (scope =~ /^LVARS/)
   cmd = "local_variables"
   prefix = ""
   vartype = "L"
  elsif (scope =~ /^CVARS/)
   if $_classname =~ /^\s*$/
     return
   end
   cmd = "class_variables"
   prefix = "#{$_classname}."
   vartype = "C"
  elsif (scope =~ /^IVARS/)
   if ($_classname =~ /^\s*$/) || ($_methodname =~ /^\s*$/)
     return
   end
   cmd = "instance_variables"
   prefix = "self."
   vartype = "I"
  end
  begin
    vars = eval(prefix + cmd, $_binding)
    $_s.write("VSTART:#{vartype}\n")
    vars.each do |v|
      if v !~ /^\$(=|KCODE|-K)$/
        begin
          result = eval(v.to_s, $_binding).inspect
        rescue Exception => exc
          $_s.write("get var exception\n")
          result = "#{$!}".inspect
        end
        $_s.write("V:#{vartype}:#{v}:#{result}\n")
      end
    end
    $_s.write("VEND:#{vartype}\n")
  rescue
  end
end

#log_command(cmd) ⇒ Object



18
19
20
# File 'lib/extensions/debugger/debugger.rb', line 18

def log_command(cmd)
  debugger_log(DEBUGGER_LOG_LEVEL_DEBUG, "Received command: #{cmd}")
end

#Rational(a, b = 1) ⇒ Object

Creates a Rational number (i.e. a fraction). a and b should be Integers:

Rational(1,3)           # -> 1/3

Note: trying to construct a Rational with floating point or real values produces errors:

Rational(1.1, 2.3)      # -> NoMethodError


31
32
33
34
35
36
37
# File 'lib/framework/rational18.rb', line 31

def Rational(a, b = 1)
  if a.kind_of?(Rational) && b == 1
    a
  else
    Rational.reduce(a, b)
  end
end

#temporary_directoryObject



5
6
7
# File 'lib/build/spec/jake_spec.rb', line 5

def temporary_directory
  'spec_temp'
end

#timeout(n, e = nil, &block) ⇒ Object

Identical to:

Timeout::timeout(n, e, &block).

Defined for backwards compatibility with earlier versions of timeout.rb, see Timeout#timeout.



87
88
89
# File 'lib/extensions/timeout/timeout.rb', line 87

def timeout(n, e = nil, &block)
  Timeout::timeout(n, e, &block)
end