mem-watcher 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1d5539f142b2196064f76e7da54dde157158c5b0
4
- data.tar.gz: 196496153213ed964b4ec88fade521e1866200cf
3
+ metadata.gz: 785419a0f3379435e74e627cff443130ff7563d0
4
+ data.tar.gz: 0b7ea0520ff6a10b50dc62d9dea1a3c7dc99b26d
5
5
  SHA512:
6
- metadata.gz: 99b25b855a8c975388c92be58ad71b24e637a53538166175189b423b279fc263d7e3ccc6e100d653fd80be4b3543e2b79ed6693db6039fef70fea5e9fa100588
7
- data.tar.gz: d1e590660331f522b85e428acc77cb2e695d8056db5bc321d309ce173eee14bceb529e43dbbba943fb5708fab6a7e78369fd405a059cb75aab1a08f922b4854f
6
+ metadata.gz: f8c6930992c5d88589b435e7cefdbc8a39da7cdf00fc844fbff1bf4fc6660b9daf5c430084685470c14bc087180db584c4db40a967da197b5c20d2a900fa5696
7
+ data.tar.gz: 5eed60d941de08014dbed4cf907612115bfc314f344a64e850176b46443f864291d2ea6c34fe02fcfa04598d734339fb52ea98f685dae887ffd0f21802148642
data/README.md CHANGED
@@ -4,6 +4,8 @@ Helps you keep an eye on your RubyMotion iOS app's memory and CPU usage.
4
4
 
5
5
  Adds a little UILabel in the top left of the screen that shows CPU % and memory usage in MB.
6
6
 
7
+ ![screenshot](http://clrsight.co/jh/2015-03-02-lo7s3.png?+)
8
+
7
9
  ## Setup/Usage
8
10
 
9
11
  ```ruby
@@ -8,17 +8,34 @@ class MemWatcher
8
8
 
9
9
  def watch(args={})
10
10
  return false unless correct_env?(args)
11
- parent_view = args[:parent_view] if args[:parent_view]
12
- parent_view ||= UIApplication.sharedApplication.delegate.window if UIApplication.sharedApplication.delegate.respond_to?(:window)
13
- parent_view || abort("MemWatcher needs a `parent_view:` view or access to the window in your AppDelegate via a `window` accessor.")
14
- parent_view.addSubview label
15
- print "Starting MemWatcher..."
16
- start_watcher
17
- puts "done."
11
+ if is_device?
12
+ NSLog("Sorry, you can not run mem-watcher on a device.")
13
+ false
14
+ else
15
+ parent_view = args[:parent_view] if args[:parent_view]
16
+ parent_view ||= UIApplication.sharedApplication.delegate.window if UIApplication.sharedApplication.delegate.respond_to?(:window)
17
+ parent_view || abort("MemWatcher needs a `parent_view:` view or access to the window in your AppDelegate via a `window` accessor.")
18
+ parent_view.addSubview label
19
+ print "Starting MemWatcher..."
20
+ start_watcher
21
+ puts "done."
22
+
23
+ true
24
+ end
18
25
  end
19
26
 
20
27
  private
21
28
 
29
+ def is_device?
30
+ @_device_state ||= begin
31
+ if UIDevice.currentDevice.systemVersion.to_i >= 9
32
+ !!NSBundle.mainBundle.bundlePath.start_with?('/var/')
33
+ else
34
+ !!(UIDevice.currentDevice.model =~ /simulator/i).nil?
35
+ end
36
+ end
37
+ end
38
+
22
39
  def correct_env?(args={})
23
40
  args[:env] ||= [ "development" ]
24
41
  Array(args[:env]).map(&:to_s).include?(RUBYMOTION_ENV)
@@ -60,4 +77,3 @@ class MemWatcher
60
77
  end
61
78
 
62
79
  end
63
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mem-watcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamon Holmgren
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-02 00:00:00.000000000 Z
11
+ date: 2015-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake