shortlook 0.1.0 → 0.1.5
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/.rubocop.yml +23 -4
- data/Gemfile +2 -0
- data/Gemfile.lock +68 -64
- data/README.md +12 -11
- data/Rakefile +2 -5
- data/lib/shortlook.rb +2 -0
- data/lib/shortlook/cli.rb +8 -35
- data/lib/shortlook/command.rb +1 -13
- data/lib/shortlook/commands/provider.rb +25 -46
- data/lib/shortlook/config.rb +34 -0
- data/lib/shortlook/provider_helpers.rb +33 -0
- data/lib/shortlook/services/app_store.rb +23 -0
- data/lib/shortlook/types.rb +14 -0
- data/lib/shortlook/version.rb +3 -1
- data/shortlook.gemspec +10 -7
- metadata +59 -32
- data/.rspec +0 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7d34939d08e248583825eb0913f975ffa0e76a86810680fc5b96d633cc22963b
|
|
4
|
+
data.tar.gz: 91be8b30834987830ed031242b990eaf9f535e6eceb0c059cd93483fd74017fb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e49eed7c0c95db152de38fa17312bd0bd544ee4f68d522811e35e1391c9615d4eec95009b73ace3e1a267302000113f27ead5362b60f081a3b44ac22435e6120
|
|
7
|
+
data.tar.gz: aaf78332d70b1ad1768bce2575f6c68a7112b839e11d7eab0dca44ee87a5cf624c7466bcacfed88a1c8e76214b6852e47227c9c2b91c2a2ab80818fd4828cc80
|
data/.rubocop.yml
CHANGED
|
@@ -1,16 +1,35 @@
|
|
|
1
1
|
AllCops:
|
|
2
|
+
NewCops: enable
|
|
3
|
+
SuggestExtensions: false
|
|
2
4
|
Exclude:
|
|
3
5
|
- bin/*
|
|
4
|
-
- spec/**/*
|
|
5
6
|
|
|
6
|
-
Metrics/
|
|
7
|
+
Metrics/AbcSize:
|
|
7
8
|
Max: 45
|
|
8
9
|
|
|
9
|
-
Metrics/
|
|
10
|
+
Metrics/BlockLength:
|
|
11
|
+
Max: 100
|
|
12
|
+
|
|
13
|
+
Metrics/ClassLength:
|
|
14
|
+
Max: 300
|
|
15
|
+
|
|
16
|
+
Metrics/MethodLength:
|
|
10
17
|
Max: 45
|
|
11
18
|
|
|
12
|
-
Metrics/
|
|
19
|
+
Metrics/CyclomaticComplexity:
|
|
20
|
+
Max: 10
|
|
21
|
+
|
|
22
|
+
Metrics/PerceivedComplexity:
|
|
23
|
+
Max: 10
|
|
24
|
+
|
|
25
|
+
Layout/LineLength:
|
|
13
26
|
Max: 200
|
|
14
27
|
|
|
28
|
+
Lint/MissingSuper:
|
|
29
|
+
Enabled: false
|
|
30
|
+
|
|
15
31
|
Style/Documentation:
|
|
16
32
|
Enabled: false
|
|
33
|
+
|
|
34
|
+
Style/SymbolArray:
|
|
35
|
+
Enabled: false
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,92 +1,96 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
shortlook (0.1.
|
|
5
|
-
lhc (
|
|
4
|
+
shortlook (0.1.5)
|
|
5
|
+
lhc (>= 13.0)
|
|
6
6
|
pastel (~> 0.7.2)
|
|
7
|
-
thor (
|
|
8
|
-
tty-command (
|
|
9
|
-
tty-config (
|
|
10
|
-
tty-prompt (
|
|
7
|
+
thor (>= 0.20, < 1.2)
|
|
8
|
+
tty-command (>= 0.8, < 0.10)
|
|
9
|
+
tty-config (>= 0.3, < 0.5)
|
|
10
|
+
tty-prompt (>= 0.18, < 0.22)
|
|
11
11
|
tty-spinner (~> 0.9.0)
|
|
12
12
|
|
|
13
13
|
GEM
|
|
14
14
|
remote: https://rubygems.org/
|
|
15
15
|
specs:
|
|
16
|
-
activesupport (
|
|
16
|
+
activesupport (6.1.1)
|
|
17
17
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
18
|
-
i18n (>=
|
|
19
|
-
minitest (
|
|
20
|
-
tzinfo (~>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
i18n (>= 1.6, < 2)
|
|
19
|
+
minitest (>= 5.1)
|
|
20
|
+
tzinfo (~> 2.0)
|
|
21
|
+
zeitwerk (~> 2.3)
|
|
22
|
+
addressable (2.7.0)
|
|
23
|
+
public_suffix (>= 2.0.2, < 5.0)
|
|
24
|
+
ast (2.4.2)
|
|
25
|
+
concurrent-ruby (1.1.8)
|
|
26
|
+
equatable (0.6.1)
|
|
26
27
|
ethon (0.12.0)
|
|
27
28
|
ffi (>= 1.3.0)
|
|
28
|
-
ffi (1.
|
|
29
|
-
i18n (1.
|
|
29
|
+
ffi (1.14.2)
|
|
30
|
+
i18n (1.8.7)
|
|
30
31
|
concurrent-ruby (~> 1.0)
|
|
31
|
-
lhc (
|
|
32
|
-
activesupport (>=
|
|
32
|
+
lhc (13.1.0)
|
|
33
|
+
activesupport (>= 5.2)
|
|
33
34
|
addressable
|
|
34
35
|
typhoeus (>= 0.11)
|
|
35
|
-
minitest (5.
|
|
36
|
-
necromancer (0.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
36
|
+
minitest (5.14.3)
|
|
37
|
+
necromancer (0.5.1)
|
|
38
|
+
parallel (1.20.1)
|
|
39
|
+
parser (3.0.0.0)
|
|
40
|
+
ast (~> 2.4.1)
|
|
41
|
+
pastel (0.7.4)
|
|
42
|
+
equatable (~> 0.6)
|
|
43
|
+
tty-color (~> 0.5)
|
|
44
|
+
public_suffix (4.0.6)
|
|
45
|
+
rainbow (3.0.0)
|
|
46
|
+
rake (13.0.3)
|
|
47
|
+
regexp_parser (2.0.3)
|
|
48
|
+
rexml (3.2.4)
|
|
49
|
+
rubocop (1.9.1)
|
|
50
|
+
parallel (~> 1.10)
|
|
51
|
+
parser (>= 3.0.0.0)
|
|
52
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
53
|
+
regexp_parser (>= 1.8, < 3.0)
|
|
54
|
+
rexml
|
|
55
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
|
56
|
+
ruby-progressbar (~> 1.7)
|
|
57
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
|
58
|
+
rubocop-ast (1.4.1)
|
|
59
|
+
parser (>= 2.7.1.5)
|
|
60
|
+
ruby-progressbar (1.11.0)
|
|
61
|
+
thor (1.1.0)
|
|
62
|
+
tty-color (0.6.0)
|
|
63
|
+
tty-command (0.9.0)
|
|
60
64
|
pastel (~> 0.7.0)
|
|
61
|
-
tty-config (0.
|
|
62
|
-
tty-cursor (0.
|
|
63
|
-
tty-prompt (0.
|
|
64
|
-
necromancer (~> 0.
|
|
65
|
+
tty-config (0.4.0)
|
|
66
|
+
tty-cursor (0.7.1)
|
|
67
|
+
tty-prompt (0.21.0)
|
|
68
|
+
necromancer (~> 0.5.0)
|
|
65
69
|
pastel (~> 0.7.0)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
tty-
|
|
69
|
-
|
|
70
|
-
tty-cursor (~> 0.6.0)
|
|
71
|
-
tty-screen (~> 0.6.4)
|
|
70
|
+
tty-reader (~> 0.7.0)
|
|
71
|
+
tty-reader (0.7.0)
|
|
72
|
+
tty-cursor (~> 0.7)
|
|
73
|
+
tty-screen (~> 0.7)
|
|
72
74
|
wisper (~> 2.0.0)
|
|
73
|
-
tty-screen (0.
|
|
74
|
-
tty-spinner (0.9.
|
|
75
|
-
tty-cursor (~> 0.
|
|
76
|
-
typhoeus (1.
|
|
75
|
+
tty-screen (0.8.1)
|
|
76
|
+
tty-spinner (0.9.3)
|
|
77
|
+
tty-cursor (~> 0.7)
|
|
78
|
+
typhoeus (1.4.0)
|
|
77
79
|
ethon (>= 0.9.0)
|
|
78
|
-
tzinfo (
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
tzinfo (2.0.4)
|
|
81
|
+
concurrent-ruby (~> 1.0)
|
|
82
|
+
unicode-display_width (2.0.0)
|
|
83
|
+
wisper (2.0.1)
|
|
84
|
+
zeitwerk (2.4.2)
|
|
81
85
|
|
|
82
86
|
PLATFORMS
|
|
83
87
|
ruby
|
|
84
88
|
|
|
85
89
|
DEPENDENCIES
|
|
86
90
|
bundler (~> 2.0)
|
|
87
|
-
rake (~>
|
|
88
|
-
|
|
91
|
+
rake (~> 13.0)
|
|
92
|
+
rubocop (~> 1.9.1)
|
|
89
93
|
shortlook!
|
|
90
94
|
|
|
91
95
|
BUNDLED WITH
|
|
92
|
-
2.0.
|
|
96
|
+
2.0.2
|
data/README.md
CHANGED
|
@@ -2,21 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
This is a CLI for scaffolding a ShortLook Provider
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Learn more about ShortLook itself [here](https://dynastic.co/shortlook).
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
If you are looking for ShortLook providers you can find them [here](https://github.com/marcoroth?utf8=✓&tab=repositories&q=ShortLook-&type=&language=objective-c) or [here](https://repo.dynastic.co).
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
gem 'shortlook'
|
|
11
|
-
```
|
|
9
|
+
## Installation
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
This CLI runs on Ruby. Ensure you have Ruby installed before executing the following command:
|
|
14
12
|
|
|
15
|
-
$
|
|
13
|
+
$ gem install shortlook
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
You can check if Ruby is installed with the following command
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
```
|
|
18
|
+
$ ruby -v
|
|
19
|
+
ruby 2.6.2p47 (2019-03-13 revision 67232) [x86_64-darwin18]
|
|
20
|
+
```
|
|
20
21
|
|
|
21
22
|
## Usage
|
|
22
23
|
|
|
@@ -33,7 +34,7 @@ Commands:
|
|
|
33
34
|
|
|
34
35
|
To start the Provider generator use the `provider` command followed by the search term of the app you want to build a provider for:
|
|
35
36
|
|
|
36
|
-
```
|
|
37
|
+
```
|
|
37
38
|
$ shortlook provider whatsapp
|
|
38
39
|
|
|
39
40
|
( ● ) Fetching Apps for 'whatsapp'
|
|
@@ -72,7 +73,7 @@ create ShortLook-WhatsAppMessenger/control
|
|
|
72
73
|
|
|
73
74
|
## Development
|
|
74
75
|
|
|
75
|
-
After checking out the repo, run `bin/setup` to install dependencies.
|
|
76
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
76
77
|
|
|
77
78
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
78
79
|
|
data/Rakefile
CHANGED
data/lib/shortlook.rb
CHANGED
data/lib/shortlook/cli.rb
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'thor'
|
|
4
|
+
require_relative 'provider_helpers'
|
|
4
5
|
|
|
5
6
|
module Shortlook
|
|
6
7
|
class CLI < Thor
|
|
7
8
|
include Thor::Actions
|
|
8
9
|
|
|
9
|
-
Error = Class.new(StandardError)
|
|
10
|
-
|
|
11
|
-
desc 'version', 'shortlook version'
|
|
12
|
-
def version
|
|
13
|
-
require_relative 'version'
|
|
14
|
-
puts "v#{Shortlook::VERSION}"
|
|
15
|
-
end
|
|
16
|
-
map %w[--version -v] => :version
|
|
17
|
-
|
|
18
10
|
def self.source_root
|
|
19
11
|
File.dirname(__FILE__)
|
|
20
12
|
end
|
|
@@ -24,34 +16,15 @@ module Shortlook
|
|
|
24
16
|
end
|
|
25
17
|
|
|
26
18
|
no_commands do
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def bundle_id
|
|
32
|
-
@config[:bundle_id]
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def provider_bundle_id
|
|
36
|
-
@config[:provider_bundle_id]
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def name
|
|
40
|
-
@config[:name]
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def type
|
|
44
|
-
@config[:type]
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def author
|
|
48
|
-
@config[:author]
|
|
49
|
-
end
|
|
19
|
+
include ProviderHelpers
|
|
20
|
+
end
|
|
50
21
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
22
|
+
desc 'version', 'shortlook version'
|
|
23
|
+
def version
|
|
24
|
+
require_relative 'version'
|
|
25
|
+
puts "v#{Shortlook::VERSION}"
|
|
54
26
|
end
|
|
27
|
+
map %w[--version -v] => :version
|
|
55
28
|
|
|
56
29
|
desc 'provider NAME', 'Generate a scaffold ShortLook Provider'
|
|
57
30
|
def provider(name)
|
data/lib/shortlook/command.rb
CHANGED
|
@@ -5,24 +5,12 @@ require 'forwardable'
|
|
|
5
5
|
module Shortlook
|
|
6
6
|
class Command
|
|
7
7
|
extend Forwardable
|
|
8
|
-
|
|
9
8
|
def_delegators :command, :run
|
|
10
9
|
|
|
11
|
-
# Execute this command
|
|
12
|
-
#
|
|
13
|
-
# @api public
|
|
14
10
|
def execute(*)
|
|
15
|
-
raise(
|
|
16
|
-
NotImplementedError,
|
|
17
|
-
"#{self.class}##{__method__} must be implemented"
|
|
18
|
-
)
|
|
11
|
+
raise(NotImplementedError, "#{self.class}##{__method__} must be implemented")
|
|
19
12
|
end
|
|
20
13
|
|
|
21
|
-
# The interactive prompt
|
|
22
|
-
#
|
|
23
|
-
# @see http://www.rubydoc.info/gems/tty-prompt
|
|
24
|
-
#
|
|
25
|
-
# @api public
|
|
26
14
|
def prompt(**options)
|
|
27
15
|
require 'tty-prompt'
|
|
28
16
|
TTY::Prompt.new(options)
|
|
@@ -1,75 +1,54 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'lhc'
|
|
4
|
-
require 'json'
|
|
5
3
|
require 'thor'
|
|
6
|
-
|
|
7
4
|
require 'tty-spinner'
|
|
8
|
-
require 'tty-config'
|
|
9
5
|
|
|
10
6
|
require_relative '../command'
|
|
7
|
+
require_relative '../types'
|
|
8
|
+
require_relative '../config'
|
|
9
|
+
require_relative '../services/app_store'
|
|
11
10
|
|
|
12
11
|
module Shortlook
|
|
13
12
|
module Commands
|
|
14
13
|
class Provider < Shortlook::Command
|
|
15
14
|
include Thor::Actions
|
|
16
15
|
|
|
17
|
-
def
|
|
18
|
-
@
|
|
16
|
+
def config
|
|
17
|
+
@config ||= Config.new
|
|
19
18
|
end
|
|
20
19
|
|
|
21
|
-
def
|
|
22
|
-
|
|
23
|
-
spinner = TTY::Spinner.new(":spinner Fetching Apps for '#{@name}'", format: :bouncing_ball)
|
|
20
|
+
def initialize(name)
|
|
21
|
+
spinner = TTY::Spinner.new(":spinner Fetching Apps for '#{name}'", format: :bouncing_ball)
|
|
24
22
|
spinner.auto_spin
|
|
25
|
-
|
|
26
|
-
url = "https://itunes.apple.com/search?limit=10&media=software&term=#{@name}"
|
|
27
|
-
results = JSON.parse(LHC.get(url).body)['results']
|
|
28
|
-
choices = results.map { |r| { name: "#{r['trackName']} (#{r['bundleId']})", value: r } }
|
|
29
|
-
|
|
30
|
-
types = [
|
|
31
|
-
{ name: 'Contact Photo', value: { name: 'ContactPhoto', display: 'Contact Photos', key: 'contact-photo' } },
|
|
32
|
-
{ name: 'Profile Picture', value: { name: 'ProfilePicture', display: 'Profile Pictures', key: 'profile-picture' } },
|
|
33
|
-
{ name: 'Photo', value: { name: 'Photo', display: 'Photos', key: 'photos' } },
|
|
34
|
-
{ name: 'Cover', value: { name: 'Cover', display: 'Covers', key: 'covers' } }
|
|
35
|
-
]
|
|
36
|
-
|
|
23
|
+
@choices = Services::AppStore.search(name)
|
|
37
24
|
spinner.stop
|
|
25
|
+
end
|
|
38
26
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
author = ENV['USER']
|
|
46
|
-
bundle_prefix = 'ch.marcoroth'
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
selected = prompt.select('Select the App you want to create a Provider for:', choices)
|
|
50
|
-
name = prompt.ask('What\'s the name of your provider:', default: selected['trackName'])
|
|
51
|
-
type = prompt.select('Select the type of the provider:', types)
|
|
52
|
-
author = prompt.ask('What\'s your name?', default: author)
|
|
53
|
-
bundle_prefix = prompt.ask('What\'s your bundle identifier prefix:', default: bundle_prefix)
|
|
27
|
+
def execute(*)
|
|
28
|
+
selected = prompt.select('Select the App you want to create a Provider for:', @choices)
|
|
29
|
+
full_name = prompt.ask("What's the name of your provider:", default: selected['trackName'])
|
|
30
|
+
type = prompt.select('Select the type of the provider:', Types.all)
|
|
31
|
+
author = prompt.ask("What's your name?", default: config.fetch(:author))
|
|
32
|
+
bundle_prefix = prompt.ask("What's your bundle identifier prefix:", default: config.fetch(:bundle_prefix))
|
|
54
33
|
|
|
55
34
|
config.set(:author, value: author)
|
|
56
35
|
config.set(:bundle_prefix, value: bundle_prefix)
|
|
57
|
-
config.
|
|
36
|
+
config.save!
|
|
58
37
|
|
|
59
|
-
|
|
60
|
-
provider_name = "ShortLook-#{name.delete(' ')}"
|
|
61
|
-
class_name = "#{name.delete(' ')}#{type[:name]}Provider"
|
|
62
|
-
provider_bundle_id = "#{bundle_prefix}.shortlook.plugin.#{type[:key]}.#{name.downcase.delete(' ')}"
|
|
38
|
+
name = full_name.gsub(' ', '')
|
|
63
39
|
|
|
64
40
|
{
|
|
65
|
-
name:
|
|
66
|
-
provider_name:
|
|
67
|
-
class_name:
|
|
41
|
+
name: full_name,
|
|
42
|
+
provider_name: "ShortLook-#{name}",
|
|
43
|
+
class_name: "#{name}#{type[:name]}Provider",
|
|
68
44
|
author: author,
|
|
69
45
|
type: type,
|
|
70
|
-
bundle_id:
|
|
71
|
-
provider_bundle_id:
|
|
46
|
+
bundle_id: selected['bundleId'],
|
|
47
|
+
provider_bundle_id: "#{bundle_prefix}.shortlook.plugin.#{type[:key]}.#{name.downcase}"
|
|
72
48
|
}
|
|
49
|
+
rescue TTY::Reader::InputInterrupt
|
|
50
|
+
puts "\nAborting..."
|
|
51
|
+
exit(0)
|
|
73
52
|
end
|
|
74
53
|
end
|
|
75
54
|
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
CONFIG_PATH = "#{Dir.home}/.shortlook.yml"
|
|
4
|
+
|
|
5
|
+
require 'forwardable'
|
|
6
|
+
require 'tty-config'
|
|
7
|
+
|
|
8
|
+
module Shortlook
|
|
9
|
+
class Config
|
|
10
|
+
extend Forwardable
|
|
11
|
+
|
|
12
|
+
def_delegators :@config, :fetch, :set
|
|
13
|
+
|
|
14
|
+
def initialize
|
|
15
|
+
config.append_path(Dir.home)
|
|
16
|
+
|
|
17
|
+
begin
|
|
18
|
+
config.read("#{Dir.home}/.shortlook.yml")
|
|
19
|
+
rescue TTY::Config::ReadError
|
|
20
|
+
config.filename = '.shortlook'
|
|
21
|
+
config.set(:author, value: ENV['USER'])
|
|
22
|
+
config.set(:bundle_prefix, value: 'ch.marcoroth')
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def config
|
|
27
|
+
@config ||= TTY::Config.new
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def save!
|
|
31
|
+
config.write(force: true)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Shortlook
|
|
4
|
+
module ProviderHelpers
|
|
5
|
+
def class_name
|
|
6
|
+
@config[:class_name]
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def bundle_id
|
|
10
|
+
@config[:bundle_id]
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def provider_bundle_id
|
|
14
|
+
@config[:provider_bundle_id]
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def name
|
|
18
|
+
@config[:name]
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def type
|
|
22
|
+
@config[:type]
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def author
|
|
26
|
+
@config[:author]
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def provider_name
|
|
30
|
+
@config[:provider_name]
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'lhc'
|
|
4
|
+
require 'json'
|
|
5
|
+
|
|
6
|
+
module Shortlook
|
|
7
|
+
module Services
|
|
8
|
+
class AppStore
|
|
9
|
+
URL = 'https://itunes.apple.com/search'
|
|
10
|
+
|
|
11
|
+
def self.search(name)
|
|
12
|
+
params = { limit: 10, media: 'software', term: name }
|
|
13
|
+
|
|
14
|
+
LHC.get(URL, params: params).data.results.map do |r|
|
|
15
|
+
{
|
|
16
|
+
name: "#{r['trackName']} (#{r['bundleId']})",
|
|
17
|
+
value: r
|
|
18
|
+
}
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Shortlook
|
|
4
|
+
class Types
|
|
5
|
+
def self.all
|
|
6
|
+
[
|
|
7
|
+
{ name: 'Contact Photo', value: { name: 'ContactPhoto', display: 'Contact Photos', key: 'contact-photo' } },
|
|
8
|
+
{ name: 'Profile Picture', value: { name: 'ProfilePicture', display: 'Profile Pictures', key: 'profile-picture' } },
|
|
9
|
+
{ name: 'Photo', value: { name: 'Photo', display: 'Photos', key: 'photos' } },
|
|
10
|
+
{ name: 'Cover', value: { name: 'Cover', display: 'Covers', key: 'covers' } }
|
|
11
|
+
]
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
data/lib/shortlook/version.rb
CHANGED
data/shortlook.gemspec
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
lib = File.expand_path('lib', __dir__)
|
|
2
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
5
|
|
|
@@ -20,16 +22,17 @@ Gem::Specification.new do |spec|
|
|
|
20
22
|
spec.bindir = 'exe'
|
|
21
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
22
24
|
spec.require_paths = ['lib']
|
|
25
|
+
spec.required_ruby_version = '>= 2.6'
|
|
23
26
|
|
|
24
|
-
spec.add_dependency 'lhc', '
|
|
27
|
+
spec.add_dependency 'lhc', '>= 13.0'
|
|
25
28
|
spec.add_dependency 'pastel', '~> 0.7.2'
|
|
26
|
-
spec.add_dependency 'thor', '
|
|
27
|
-
spec.add_dependency 'tty-command', '
|
|
28
|
-
spec.add_dependency 'tty-config', '
|
|
29
|
-
spec.add_dependency 'tty-prompt', '
|
|
29
|
+
spec.add_dependency 'thor', '>= 0.20', '< 1.2'
|
|
30
|
+
spec.add_dependency 'tty-command', '>= 0.8', '< 0.10'
|
|
31
|
+
spec.add_dependency 'tty-config', '>= 0.3', '< 0.5'
|
|
32
|
+
spec.add_dependency 'tty-prompt', '>= 0.18', '< 0.22'
|
|
30
33
|
spec.add_dependency 'tty-spinner', '~> 0.9.0'
|
|
31
34
|
|
|
32
35
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
|
33
|
-
spec.add_development_dependency 'rake', '~>
|
|
34
|
-
spec.add_development_dependency '
|
|
36
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
|
37
|
+
spec.add_development_dependency 'rubocop', '~> 1.9.1'
|
|
35
38
|
end
|
metadata
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: shortlook
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Marco Roth
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-02-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: lhc
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
19
|
+
version: '13.0'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- - "
|
|
24
|
+
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '
|
|
26
|
+
version: '13.0'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: pastel
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -42,58 +42,82 @@ dependencies:
|
|
|
42
42
|
name: thor
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
|
-
- - "
|
|
45
|
+
- - ">="
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: 0.20
|
|
47
|
+
version: '0.20'
|
|
48
|
+
- - "<"
|
|
49
|
+
- !ruby/object:Gem::Version
|
|
50
|
+
version: '1.2'
|
|
48
51
|
type: :runtime
|
|
49
52
|
prerelease: false
|
|
50
53
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
54
|
requirements:
|
|
52
|
-
- - "
|
|
55
|
+
- - ">="
|
|
53
56
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: 0.20
|
|
57
|
+
version: '0.20'
|
|
58
|
+
- - "<"
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '1.2'
|
|
55
61
|
- !ruby/object:Gem::Dependency
|
|
56
62
|
name: tty-command
|
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
|
58
64
|
requirements:
|
|
59
|
-
- - "
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '0.8'
|
|
68
|
+
- - "<"
|
|
60
69
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: 0.
|
|
70
|
+
version: '0.10'
|
|
62
71
|
type: :runtime
|
|
63
72
|
prerelease: false
|
|
64
73
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
74
|
requirements:
|
|
66
|
-
- - "
|
|
75
|
+
- - ">="
|
|
76
|
+
- !ruby/object:Gem::Version
|
|
77
|
+
version: '0.8'
|
|
78
|
+
- - "<"
|
|
67
79
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: 0.
|
|
80
|
+
version: '0.10'
|
|
69
81
|
- !ruby/object:Gem::Dependency
|
|
70
82
|
name: tty-config
|
|
71
83
|
requirement: !ruby/object:Gem::Requirement
|
|
72
84
|
requirements:
|
|
73
|
-
- - "
|
|
85
|
+
- - ">="
|
|
86
|
+
- !ruby/object:Gem::Version
|
|
87
|
+
version: '0.3'
|
|
88
|
+
- - "<"
|
|
74
89
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: 0.
|
|
90
|
+
version: '0.5'
|
|
76
91
|
type: :runtime
|
|
77
92
|
prerelease: false
|
|
78
93
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
94
|
requirements:
|
|
80
|
-
- - "
|
|
95
|
+
- - ">="
|
|
81
96
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: 0.3
|
|
97
|
+
version: '0.3'
|
|
98
|
+
- - "<"
|
|
99
|
+
- !ruby/object:Gem::Version
|
|
100
|
+
version: '0.5'
|
|
83
101
|
- !ruby/object:Gem::Dependency
|
|
84
102
|
name: tty-prompt
|
|
85
103
|
requirement: !ruby/object:Gem::Requirement
|
|
86
104
|
requirements:
|
|
87
|
-
- - "
|
|
105
|
+
- - ">="
|
|
88
106
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: 0.18
|
|
107
|
+
version: '0.18'
|
|
108
|
+
- - "<"
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '0.22'
|
|
90
111
|
type: :runtime
|
|
91
112
|
prerelease: false
|
|
92
113
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
114
|
requirements:
|
|
94
|
-
- - "
|
|
115
|
+
- - ">="
|
|
95
116
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: 0.18
|
|
117
|
+
version: '0.18'
|
|
118
|
+
- - "<"
|
|
119
|
+
- !ruby/object:Gem::Version
|
|
120
|
+
version: '0.22'
|
|
97
121
|
- !ruby/object:Gem::Dependency
|
|
98
122
|
name: tty-spinner
|
|
99
123
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -128,28 +152,28 @@ dependencies:
|
|
|
128
152
|
requirements:
|
|
129
153
|
- - "~>"
|
|
130
154
|
- !ruby/object:Gem::Version
|
|
131
|
-
version: '
|
|
155
|
+
version: '13.0'
|
|
132
156
|
type: :development
|
|
133
157
|
prerelease: false
|
|
134
158
|
version_requirements: !ruby/object:Gem::Requirement
|
|
135
159
|
requirements:
|
|
136
160
|
- - "~>"
|
|
137
161
|
- !ruby/object:Gem::Version
|
|
138
|
-
version: '
|
|
162
|
+
version: '13.0'
|
|
139
163
|
- !ruby/object:Gem::Dependency
|
|
140
|
-
name:
|
|
164
|
+
name: rubocop
|
|
141
165
|
requirement: !ruby/object:Gem::Requirement
|
|
142
166
|
requirements:
|
|
143
167
|
- - "~>"
|
|
144
168
|
- !ruby/object:Gem::Version
|
|
145
|
-
version:
|
|
169
|
+
version: 1.9.1
|
|
146
170
|
type: :development
|
|
147
171
|
prerelease: false
|
|
148
172
|
version_requirements: !ruby/object:Gem::Requirement
|
|
149
173
|
requirements:
|
|
150
174
|
- - "~>"
|
|
151
175
|
- !ruby/object:Gem::Version
|
|
152
|
-
version:
|
|
176
|
+
version: 1.9.1
|
|
153
177
|
description: ShortLook CLI for scaffoling a ShortLook Provider
|
|
154
178
|
email:
|
|
155
179
|
- marco.roth@intergga.ch
|
|
@@ -159,7 +183,6 @@ extensions: []
|
|
|
159
183
|
extra_rdoc_files: []
|
|
160
184
|
files:
|
|
161
185
|
- ".gitignore"
|
|
162
|
-
- ".rspec"
|
|
163
186
|
- ".rubocop.yml"
|
|
164
187
|
- Gemfile
|
|
165
188
|
- Gemfile.lock
|
|
@@ -173,6 +196,9 @@ files:
|
|
|
173
196
|
- lib/shortlook/cli.rb
|
|
174
197
|
- lib/shortlook/command.rb
|
|
175
198
|
- lib/shortlook/commands/provider.rb
|
|
199
|
+
- lib/shortlook/config.rb
|
|
200
|
+
- lib/shortlook/provider_helpers.rb
|
|
201
|
+
- lib/shortlook/services/app_store.rb
|
|
176
202
|
- lib/shortlook/templates/provider/%class_name%.h.tt
|
|
177
203
|
- lib/shortlook/templates/provider/%class_name%.m.tt
|
|
178
204
|
- lib/shortlook/templates/provider/.gitignore
|
|
@@ -181,13 +207,14 @@ files:
|
|
|
181
207
|
- lib/shortlook/templates/provider/README.md.tt
|
|
182
208
|
- lib/shortlook/templates/provider/ShortLook-API.h
|
|
183
209
|
- lib/shortlook/templates/provider/control.tt
|
|
210
|
+
- lib/shortlook/types.rb
|
|
184
211
|
- lib/shortlook/version.rb
|
|
185
212
|
- shortlook.gemspec
|
|
186
213
|
homepage: https://github.com/marcoroth/shortlook-cli
|
|
187
214
|
licenses:
|
|
188
215
|
- MIT
|
|
189
216
|
metadata: {}
|
|
190
|
-
post_install_message:
|
|
217
|
+
post_install_message:
|
|
191
218
|
rdoc_options: []
|
|
192
219
|
require_paths:
|
|
193
220
|
- lib
|
|
@@ -195,7 +222,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
195
222
|
requirements:
|
|
196
223
|
- - ">="
|
|
197
224
|
- !ruby/object:Gem::Version
|
|
198
|
-
version: '
|
|
225
|
+
version: '2.6'
|
|
199
226
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
200
227
|
requirements:
|
|
201
228
|
- - ">="
|
|
@@ -203,7 +230,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
203
230
|
version: '0'
|
|
204
231
|
requirements: []
|
|
205
232
|
rubygems_version: 3.0.3
|
|
206
|
-
signing_key:
|
|
233
|
+
signing_key:
|
|
207
234
|
specification_version: 4
|
|
208
235
|
summary: ShortLook CLI for scaffoling a ShortLook Provider
|
|
209
236
|
test_files: []
|
data/.rspec
DELETED