capa 0.0.3 → 0.1.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
  SHA256:
3
- metadata.gz: d3c26c96dca1c1db8f6b81bbe8cef8f48ed98ff3af75d7eedb2b718e5d267cfc
4
- data.tar.gz: 48449bfd60462c86969283aa623bd9601902ee5386a60d6619718d3916ab5376
3
+ metadata.gz: 23ee7eadf1cabcba5bdb151ffad50f29b166e0c89661286c49db533e9bc33294
4
+ data.tar.gz: 187acd27f4b7a343f3c1c629597d60731c4289b9c3926df76e4d4669e74cc126
5
5
  SHA512:
6
- metadata.gz: 94ec4c247f38b5475c7aeaaff2214f8ae02cfaf01da0675b6fbbd7c29d079b92e0367d3585ba9eb567be5e85b3ffe1a46695937c40bc0a79de4b46dc218432a3
7
- data.tar.gz: aa797bc39a7e70a507bffb353285cf60de580545df8784837d54110046a9bd80c3d76e94cf1f852a3bbfcc2c2d1807ebc4c8f450391f910999407ec7247a4c8e
6
+ metadata.gz: 484aa42aadfd39cbfae580a4f74334eb0df29500f7ce5ef31f5533da376a6f6cfbf5b16cf3b1bb2bba114d2e2b58d5c514a62142d04183b039a59e78756aeca4
7
+ data.tar.gz: f770516d6a547d8ecef8012ae06a07dd36b637896b772da3060e3372156a04f49fe7a350281426bf638e6b25837ae13b4fcd174a31979b399917b76778386d50
@@ -1,17 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require_relative '../lib/capa/emulator_recorder'
4
- require_relative '../lib/capa/gif_generator'
5
-
6
- def command?(command)
7
- system("which #{command} > /dev/null 2>&1")
8
- end
3
+ require_relative '../lib/capa'
9
4
 
10
5
  abort('Please install adb') unless command?('adb')
11
6
  abort('Please install gifify: https://github.com/vvo/gifify') unless command?('gifify')
12
7
 
13
- @video_filename = ARGV.count == 1 ? ARGV[0] : 'video.mp4'
14
-
15
8
  recorder = EmulatorRecorder.new(filename: @video_filename)
16
9
  generator = GIFGenerator.new(input_video: @video_filename, output_gif: "#{@video_filename}.gif")
17
10
 
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require_relative '../lib/capa/simulator_recorder'
4
- require_relative '../lib/capa/gif_generator'
3
+ require_relative '../lib/capa'
5
4
 
6
5
  def command?(command)
7
6
  system("which #{command} > /dev/null 2>&1")
@@ -9,8 +8,6 @@ end
9
8
 
10
9
  abort('Please install gifify: https://github.com/vvo/gifify') unless command?('gifify')
11
10
 
12
- @video_filename = ARGV.count == 1 ? ARGV[0] : 'video.mp4'
13
-
14
11
  recorder = SimulatorRecorder.new(filename: @video_filename)
15
12
 
16
13
  Signal.trap("SIGINT") do
@@ -1,3 +1,38 @@
1
- require_relative 'lib/simulator_recorder'
2
- require_relative 'lib/emulator_recorder'
3
- require_relative 'lib/gif_generator'
1
+ require_relative './capa/string'
2
+ require_relative './capa/helper'
3
+ require_relative './capa/emulator_recorder'
4
+ require_relative './capa/simulator_recorder'
5
+ require_relative './capa/gif_generator'
6
+
7
+ require 'optparse'
8
+ require "rubygems"
9
+
10
+ # The actual options will be stored in this hash
11
+ options = {}
12
+
13
+ # Set up the options you are looking for
14
+ optparse = OptionParser.new do |opts|
15
+ explanation = "> The command #{"$ capa-ios".bold} will generate a video and a GIF from the iOS Simulator\
16
+ > The command #{"$ capa-android".bold} will generate a video and a GIF from the Android Emulator .\n\n"
17
+ usage = "Usage: #{$0} [options]".bold
18
+ opts.banner = "#{explanation} #{usage}"
19
+
20
+ opts.on( '-o', '--output NAME', "Output filename. GIF file will get '.gif' added as suffix. Defaults to recording.mp4 and recording.mp4.gif" ) do |o|
21
+ options[:output] = o
22
+ end
23
+
24
+ opts.on("-v", "--version", "Display version") do
25
+ puts Gem::Specification::load("../capa.gemspec").version
26
+ exit
27
+ end
28
+
29
+ opts.on( '-h', '--help', 'Display help' ) do
30
+ puts opts
31
+ exit
32
+ end
33
+ end
34
+
35
+ # The parse! method also removes any options it finds from ARGV.
36
+ optparse.parse!
37
+
38
+ @video_filename = options[:output] || 'recording.mp4'
@@ -0,0 +1,4 @@
1
+
2
+ def command?(command)
3
+ system("which #{command} > /dev/null 2>&1")
4
+ end
@@ -2,4 +2,28 @@ class String
2
2
  def blank?
3
3
  self.nil? || self.empty?
4
4
  end
5
+
6
+ def black; "\e[30m#{self}\e[0m" end
7
+ def red; "\e[31m#{self}\e[0m" end
8
+ def green; "\e[32m#{self}\e[0m" end
9
+ def brown; "\e[33m#{self}\e[0m" end
10
+ def blue; "\e[34m#{self}\e[0m" end
11
+ def magenta; "\e[35m#{self}\e[0m" end
12
+ def cyan; "\e[36m#{self}\e[0m" end
13
+ def gray; "\e[37m#{self}\e[0m" end
14
+
15
+ def bg_black; "\e[40m#{self}\e[0m" end
16
+ def bg_red; "\e[41m#{self}\e[0m" end
17
+ def bg_green; "\e[42m#{self}\e[0m" end
18
+ def bg_brown; "\e[43m#{self}\e[0m" end
19
+ def bg_blue; "\e[44m#{self}\e[0m" end
20
+ def bg_magenta; "\e[45m#{self}\e[0m" end
21
+ def bg_cyan; "\e[46m#{self}\e[0m" end
22
+ def bg_gray; "\e[47m#{self}\e[0m" end
23
+
24
+ def bold; "\e[1m#{self}\e[22m" end
25
+ def italic; "\e[3m#{self}\e[23m" end
26
+ def underline; "\e[4m#{self}\e[24m" end
27
+ def blink; "\e[5m#{self}\e[25m" end
28
+ def reverse_color; "\e[7m#{self}\e[27m" end
5
29
  end
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.0.3
4
+ version: 0.1.0
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-15 00:00:00.000000000 Z
11
+ date: 2018-10-16 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.
@@ -24,6 +24,7 @@ files:
24
24
  - lib/capa.rb
25
25
  - lib/capa/emulator_recorder.rb
26
26
  - lib/capa/gif_generator.rb
27
+ - lib/capa/helper.rb
27
28
  - lib/capa/simulator_recorder.rb
28
29
  - lib/capa/string.rb
29
30
  homepage: https://github.com/crvshlab/capa