capa 0.1.1 → 0.1.2
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 +4 -4
- data/bin/capa-android +8 -7
- data/bin/capa-ios +10 -9
- data/lib/capa.rb +2 -2
- data/lib/capa/emulator_recorder.rb +18 -10
- data/lib/capa/helper.rb +4 -0
- data/lib/capa/simulator_recorder.rb +8 -5
- data/lib/capa/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcbb3e889cb78cbd969f3ee5408f766f9f07b438fbc78d8b2558107b48ef8be2
|
4
|
+
data.tar.gz: 36a96e12f227e53f62154a6af9bbbc2a55dd5c7fd706e9c9ae2202ea129092e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 767b605ea8a0f401cf713ff78a4740f26a9aa87b1b1df48b22e8f1457c7d1ac0d925a72109b191cadf54bffee2198571112cf486c1546c0df6c23d4d98e557c0
|
7
|
+
data.tar.gz: 302cb2dac22680d9abfee0c7dacb32b2d35a3252613ba91ba08527739a2654ae1e92edf2804436be998b51da15280e439b07a751d0358f266a7966f466362377
|
data/bin/capa-android
CHANGED
@@ -2,17 +2,18 @@
|
|
2
2
|
|
3
3
|
require_relative '../lib/capa'
|
4
4
|
|
5
|
-
abort('Please install adb') unless command?('adb')
|
5
|
+
abort('Please install adb https://developer.android.com/studio/') unless command?('adb')
|
6
6
|
abort('Please install gifify: https://github.com/vvo/gifify') unless command?('gifify')
|
7
7
|
|
8
8
|
recorder = EmulatorRecorder.new(filename: @video_filename)
|
9
9
|
generator = GIFGenerator.new(input_video: @video_filename, output_gif: "#{@video_filename}.gif")
|
10
10
|
|
11
|
-
|
12
|
-
recorder.
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
begin
|
12
|
+
recorder.record
|
13
|
+
rescue Capa::UserAbort
|
14
|
+
puts 'Exiting...'
|
15
|
+
`adb shell killall screenrecord`
|
16
|
+
exit
|
16
17
|
end
|
17
18
|
|
18
|
-
|
19
|
+
generator.generate
|
data/bin/capa-ios
CHANGED
@@ -2,18 +2,19 @@
|
|
2
2
|
|
3
3
|
require_relative '../lib/capa'
|
4
4
|
|
5
|
-
def command?(command)
|
6
|
-
system("which #{command} > /dev/null 2>&1")
|
7
|
-
end
|
8
|
-
|
9
5
|
abort('Please install gifify: https://github.com/vvo/gifify') unless command?('gifify')
|
10
6
|
|
11
7
|
recorder = SimulatorRecorder.new(filename: @video_filename)
|
8
|
+
generator = GIFGenerator.new(input_video: @video_filename, output_gif: "#{@video_filename}.gif")
|
12
9
|
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
begin
|
11
|
+
recorder.record
|
12
|
+
rescue Capa::UserAbort
|
13
|
+
puts 'Exiting...'
|
14
|
+
if system('pgrep simctl > /dev/null')
|
15
|
+
`killall simctl`
|
16
|
+
end
|
17
|
+
exit
|
16
18
|
end
|
17
19
|
|
18
|
-
|
19
|
-
recorder.record
|
20
|
+
generator.generate
|
data/lib/capa.rb
CHANGED
@@ -18,7 +18,7 @@ optparse = OptionParser.new do |opts|
|
|
18
18
|
usage = "Usage: #{$0} [options]".bold
|
19
19
|
opts.banner = "#{explanation} #{usage}"
|
20
20
|
|
21
|
-
opts.on( '-o', '--output NAME', "Output filename.
|
21
|
+
opts.on( '-o', '--output NAME', "Output filename. Defaults to 'recording'" ) do |o|
|
22
22
|
options[:output] = o
|
23
23
|
end
|
24
24
|
|
@@ -36,4 +36,4 @@ end
|
|
36
36
|
# The parse! method also removes any options it finds from ARGV.
|
37
37
|
optparse.parse!
|
38
38
|
|
39
|
-
@video_filename = options[:output] || 'recording.mp4
|
39
|
+
@video_filename = "#{options[:output] || 'recording'}.mp4"
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative 'string'
|
2
|
+
require_relative 'helper'
|
2
3
|
|
3
4
|
class EmulatorRecorder
|
4
5
|
def initialize(filename: '')
|
@@ -8,18 +9,25 @@ class EmulatorRecorder
|
|
8
9
|
|
9
10
|
def record
|
10
11
|
abort("You need exactly one emulator or device connected") unless can_record?
|
11
|
-
puts 'Capturing video... Use CTRL+C to save'
|
12
|
-
# Might want to add '--size 720x1280' flag. That's the maximum permitted size for video recordings
|
13
|
-
# We can specify the device, in case there is more than one connected: -s emulator-5554
|
14
|
-
message = `adb shell screenrecord --verbose #{emulator_video_path}`
|
15
12
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
13
|
+
Signal.trap("SIGINT") { raise Capa::UserAbort }
|
14
|
+
Signal.trap("SIGTSTP") { raise Capa::UserAbort }
|
15
|
+
|
16
|
+
Thread.new do
|
17
|
+
# Might want to add '--size 720x1280' flag. That's the maximum permitted size for video recordings
|
18
|
+
# We can specify the device, in case there is more than one connected: -s emulator-5554
|
19
|
+
message = `adb shell screenrecord --verbose #{emulator_video_path}`
|
20
|
+
|
21
|
+
abort("Maximum permitted resolution is 720x1280. Minimum Android version is Marshmallow.\n"\
|
22
|
+
"Please choose a different device.\n"\
|
23
|
+
"Tip: Galaxy Nexus works great!") if /err=-38/ =~ message
|
24
|
+
end
|
20
25
|
|
21
|
-
|
22
|
-
|
26
|
+
puts 'Capturing video... Press ENTER to save'
|
27
|
+
p = gets.chomp
|
28
|
+
`adb shell killall -SIGINT screenrecord`
|
29
|
+
sleep 0.5
|
30
|
+
pull_video_from_emulator
|
23
31
|
end
|
24
32
|
|
25
33
|
def pull_video_from_emulator
|
data/lib/capa/helper.rb
CHANGED
@@ -8,14 +8,17 @@ class SimulatorRecorder
|
|
8
8
|
|
9
9
|
def record
|
10
10
|
abort unless can_record?
|
11
|
-
puts 'Capturing video... Use CTRL+C to save'
|
12
11
|
|
13
|
-
|
14
|
-
|
12
|
+
Signal.trap("SIGINT") { raise Capa::UserAbort }
|
13
|
+
Signal.trap("SIGTSTP") { raise Capa::UserAbort }
|
14
|
+
|
15
|
+
Thread.new do
|
16
|
+
`xcrun simctl io booted recordVideo #{@filename}`
|
15
17
|
end
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
+
puts 'Capturing video... Press ENTER to save'
|
20
|
+
p = gets.chomp
|
21
|
+
`killall -SIGINT simctl`
|
19
22
|
end
|
20
23
|
|
21
24
|
private
|
data/lib/capa/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Salom
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: capa can record animated GIFs (and videos) from the iOS Simulator and
|
14
14
|
the Android Emulator because a GIF is worth a thousand lines of code.
|