flick 0.3.6 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 27692e3fa6ead5fe5bfcf968efa565ab643a950f
4
- data.tar.gz: 2150edd88098180e98a17d88e105447de512543e
3
+ metadata.gz: 5b67e22d9d4cf0912369a645a193c35d9088dd1f
4
+ data.tar.gz: abacf0063db69232a9d50397a481d4856b47be87
5
5
  SHA512:
6
- metadata.gz: 4ef309a2fbc5322111e673e5478a726ef9515a7e8c6403a8dad9d6b0aa51402d0e703806420e43e361d0e818b66a00f281e9e96f8f849a6d2ead7779edaa6a50
7
- data.tar.gz: 6121f25efc7b26eb55011ad2913c920e43c5c71f07f511fb41a6417167e063c3c7009e35b92d6ee721edaf4cc7391b74121ab7d7d70e03dd44471d6c41d8a561
6
+ metadata.gz: f9b2bd03632f095f6acb5b970d094cb460fb3980dd5e941d9c69a41e418f17c1c30da41306eb0d1c0662d247afc4ddad51b51b110dbe6bb8746f54a3d7f0d142
7
+ data.tar.gz: 886bf9763d313e7075aa8385a451da296466fc54cbd0fb81fe5328035426fc86060490c06ad1162a26fdf1eb377061ad70335c0a75749dbbd8fe6098b7912e10
data/README.md CHANGED
@@ -21,6 +21,7 @@ Features
21
21
  * Save log output for Android or iOS.
22
22
  * Display device information or save it to a file.
23
23
  * Install or Uninstall applications from devices.
24
+ * Capture device vitals (Android Only) for app and system performance.
24
25
  * Checkout the latest release notes [here](https://github.com/isonic1/flick/releases).
25
26
 
26
27
  Reason
@@ -85,34 +86,34 @@ Usage:
85
86
  -t, --trace
86
87
  Display backtrace when an error occurs
87
88
 
88
- `$ flick info --help`
89
+ $ flick info --help
89
90
 
90
91
  $ flick info -p (ios or android)
91
92
  $ flick info -p (ios or android) -s true -o $HOME
92
93
 
93
94
 
94
- `$ flick log --help`
95
+ $ flick log --help
95
96
 
96
97
  $ flick log -a start -p (ios or android) -o $HOME -n iosLog
97
98
  $ flick log -a stop -p (ios or android)
98
99
 
99
- `$ flick screenshot --help`
100
+ $ flick screenshot --help
100
101
 
101
102
  $ flick screenshot -p (ios or android) -o $HOME -n myImage
102
103
 
103
- `$ flick video --help`
104
+ $ flick video --help
104
105
 
105
106
  $ flick video -a start -p (ios or android)
106
107
  $ flick video -a stop -p (ios or android) -o /output -n myVideo -f gif
107
108
  $ flick video -a start -p android -u emulator-5554 -c 1000
108
109
  $ flick video -a stop -p android -u emulator-5554
109
110
 
110
- `$ flick manager --help`
111
+ $ flick manager --help
111
112
  $ flick manager -a install -p (ios or android) -f ~/myApp/my-awesome-app.apk or .app
112
113
  $ flick maanger -a uninstall -p (ios or android) -n com.package.name
113
114
 
114
- `$ flick vitals --help`
115
- $ flick vitals -n com.package.name
115
+ $ flick vitals --help
116
+ $ flick vitals -p android -n com.awsome-package.name
116
117
 
117
118
  ##Demo
118
119
  <img src="https://www.dropbox.com/s/9be37gc1c2dlxa6/flick-demo.gif?raw=1" width="600">
data/bin/flick CHANGED
@@ -2,7 +2,7 @@
2
2
  require_relative '../lib/flick'
3
3
  require 'commander/import'
4
4
 
5
- program :version, '0.3.6'
5
+ program :version, '0.4.0'
6
6
  program :description, 'A CLI to capture screenshots, video, logs, and device info for Android (Devices & Emulators) and iOS (Devices).'
7
7
 
8
8
  command :video do |c|
@@ -19,16 +19,17 @@ command :video do |c|
19
19
  c.option '-n', '--name NAME', String, 'Set name of output file, Default: UDID'
20
20
  c.option '-q', '--unique UNIQUE', 'Pull only unique screenshots. Significantly speeds up the pulling process. Default: true'
21
21
  c.option '-f', '--format FORMAT', String, 'Set output format (mp4 or gif). Default: mp4'
22
+ c.option '-r', '--rate RATE', String, 'Set the framerate (in seconds) when converting screenshots to video. Default: 1'
22
23
  c.option '-o', '--outdir OUTDIR', String, "Set output directory. Default is #{Dir.pwd}"
23
24
  c.action do |args, options|
24
25
  options.default \
25
26
  :seconds => 0.5, #Seconds per screenshot.
27
+ :rate => 1, #Seconds per framerate for screenshot to video conversion.
26
28
  :count => 500, #This is a safety check to stop runaway screenshot process.
27
29
  :extend => false, #Extend android video recording (for REAL devices and os >= 4.4) past 180 seconds.
28
30
  :unique => true, #defaults to pulling only unique screenshots. Speeds up pulling process from device.
29
31
  :format => "mp4",
30
32
  :outdir => Dir.pwd #defaults to save in current directory.
31
-
32
33
  Video.new(options.default).run
33
34
  end
34
35
  end
@@ -45,7 +46,6 @@ command :screenshot do |c|
45
46
  c.action do |args, options|
46
47
  options.default \
47
48
  :outdir => Dir.pwd #defaults to save in current directory.
48
-
49
49
  Screenshot.new(options.default).screenshot
50
50
  end
51
51
  end
@@ -63,7 +63,6 @@ command :log do |c|
63
63
  c.action do |args, options|
64
64
  options.default \
65
65
  :outdir => Dir.pwd #defaults to save in current directory.
66
-
67
66
  Log.new(options.default).run
68
67
  end
69
68
  end
@@ -81,7 +80,6 @@ command :info do |c|
81
80
  options.default \
82
81
  :save => false,
83
82
  :outdir => Dir.pwd #defaults to save in current directory.
84
-
85
83
  Info.new(options.default).info
86
84
  end
87
85
  end
@@ -96,22 +94,16 @@ command :manager do |c|
96
94
  c.option '-u', '--udid UDID', String, 'Set device UDID.'
97
95
  c.option '-f', '--file FILE', String, 'Set the apk or app file location path.'
98
96
  c.option '-n', '--name NAME', String, 'Set the package name.'
99
- c.action do |args, options|
100
-
101
- Manager.new(options.default).run
102
- end
103
-
104
- command :vitals do |c|
105
- c.syntax = 'flick vitals [options]'
106
- c.summary = 'Android Only! Get apps and device vitals - App Memory Used, App CPU %. System Stats: (User, System, IQW, IRQ)'
107
- c.description = c.summary
108
- c.example 'description', "flick vitals -p android -n com.viber"
109
- c.option '-p', '--platform PLATFORM', String, 'Set platform: android or ios'
110
- c.option '-n', '--name NAME', String, 'Set the package name.'
111
- c.option '-u', '--udid UDID', String, 'Set device UDID.'
112
- c.action do |args, options|
97
+ c.action { |args, options| Manager.new(options.default).run }
98
+ end
113
99
 
114
- Vitals.new(options.default).vitals
115
- end
116
- end
100
+ command :vitals do |c|
101
+ c.syntax = 'flick vitals [options]'
102
+ c.summary = 'Android Only! Get apps and device vitals - App Memory Used, App CPU %. System Stats: (User, System, IQW, IRQ)'
103
+ c.description = c.summary
104
+ c.example 'description', "flick vitals -p android -n com.viber"
105
+ c.option '-p', '--platform PLATFORM', String, 'Set platform: android or ios'
106
+ c.option '-n', '--name NAME', String, 'Set the package name.'
107
+ c.option '-u', '--udid UDID', String, 'Set device UDID.'
108
+ c.action { |args, options| Vitals.new(options.default).vitals }
117
109
  end
data/lib/flick/android.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Flick
2
2
  class Android
3
- attr_accessor :udid, :flick_dir, :dir_name, :name, :outdir, :unique, :limit, :specs
3
+ attr_accessor :udid, :flick_dir, :dir_name, :name, :outdir, :unique, :limit, :specs, :size
4
4
 
5
5
  def initialize options
6
6
  Flick::Checker.system_dependency "adb"
@@ -16,6 +16,7 @@ module Flick
16
16
  self.unique = options.fetch(:unique, true).to_b
17
17
  self.limit = options.fetch(:limit, 180)
18
18
  self.specs = options.fetch(:specs, false)
19
+ self.size = options.fetch(:size, "720x1280")
19
20
  create_flick_dirs
20
21
  end
21
22
 
@@ -26,7 +27,11 @@ module Flick
26
27
  def create_flick_dirs
27
28
  Flick::System.setup_system_dir "#{Dir.home}/.flick"
28
29
  Flick::System.setup_system_dir flick_dir
29
- %x(adb -s #{udid} shell 'mkdir #{dir_name}')
30
+ message = %x(adb -s #{udid} shell 'mkdir #{dir_name}').split(":").last.strip
31
+ if message == "Read-only file system"
32
+ puts "\nDevice: '#{udid}' is a 'Read-only file system'! Flick cannot write to the sdcard folder. Aborting...\n".red
33
+ abort
34
+ end
30
35
  end
31
36
 
32
37
  def clear_files
@@ -88,9 +93,10 @@ module Flick
88
93
 
89
94
  def get_vitals package
90
95
  if app_installed? package
91
- stats = { app_stats: { memory_mb: memory(package), cpu_per: cpu(package) }, system_stats: system_stats }
92
- puts stats
93
- return stats
96
+ stats = JSON.generate({ app_stats: { memory_mb: memory(package), cpu_per: cpu(package) }, system_stats: system_stats })
97
+ json = JSON.parse stats
98
+ puts json
99
+ json
94
100
  else
95
101
  puts packages
96
102
  puts "\n#{package} was not found on device #{udid}! Please choose one from above. e.g. #{packages.sample}\n".red
@@ -154,7 +160,7 @@ module Flick
154
160
  end
155
161
 
156
162
  def screenrecord name
157
- %x(adb -s #{udid} shell screenrecord --time-limit #{limit} --size 720x1280 #{dir_name}/#{name}.mp4)
163
+ %x(adb -s #{udid} shell screenrecord --time-limit #{limit} --size #{size} #{dir_name}/#{name}.mp4)
158
164
  end
159
165
 
160
166
  def pull_file file, dir
data/lib/flick/ios.rb CHANGED
@@ -26,7 +26,7 @@ module Flick
26
26
  Flick::Checker.system_dependency "idevicepair"
27
27
  unless %x(idevicepair -u #{udid} validate).split[0] == "SUCCESS:"
28
28
  puts "\nUDID: #{udid} - Is not paired with your machine!".red
29
- puts "Run: idevicepair -u <udid> pair\n".red
29
+ puts "Run: idevicepair -u <udid> pair\nIf not working still, see: https://github.com/isonic1/flick/issues/10".red
30
30
  abort
31
31
  end
32
32
  end
data/lib/flick/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Flick
2
- VERSION = "0.3.6"
2
+ VERSION = "0.4.0"
3
3
  end
data/lib/flick/video.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  class Video
2
2
 
3
- attr_accessor :action, :platform, :driver, :image_count, :seconds, :extended, :udid, :format
3
+ attr_accessor :action, :platform, :driver, :image_count, :seconds, :rate, :extended, :udid, :format
4
4
 
5
5
  def initialize options
6
6
  Flick::Checker.action options[:action]
@@ -16,6 +16,7 @@ class Video
16
16
  end
17
17
  self.image_count = options[:count]
18
18
  self.seconds = options[:seconds].to_f
19
+ self.rate = options[:rate].to_f
19
20
  self.extended = options[:extend].to_b
20
21
  self.udid = self.driver.udid
21
22
  self.format = options[:format]
@@ -68,8 +69,8 @@ class Video
68
69
  $0 = "flick-video-#{udid}"
69
70
  SimpleDaemon.daemonize!
70
71
  command = -> do
71
- driver.screenrecord "video-#{udid}-single"
72
- end
72
+ driver.screenrecord "video-#{udid}-single"
73
+ end
73
74
  command.call
74
75
  end
75
76
 
@@ -143,7 +144,7 @@ class Video
143
144
 
144
145
  def convert_images_to_mp4
145
146
  remove_zero_byte_images
146
- %x(ffmpeg -loglevel quiet -framerate 1 -pattern_type glob -i '#{driver.flick_dir}/screenshot-#{udid}*.png' -c:v libx264 -pix_fmt yuv420p #{driver.flick_dir}/#{driver.name}.mp4)
147
+ %x(ffmpeg -loglevel quiet -framerate #{rate} -pattern_type glob -i '#{driver.flick_dir}/screenshot-#{udid}*.png' -c:v libx264 -pix_fmt yuv420p #{driver.flick_dir}/#{driver.name}.mp4)
147
148
  end
148
149
 
149
150
  def remove_zero_byte_images
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flick
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-29 00:00:00.000000000 Z
11
+ date: 2017-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler