krb 0.0.3 → 0.0.15

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
  SHA256:
3
- metadata.gz: f18b7c1de9a96f5793cceaf607ed187a0852341e40b0db323a3347100f98cb49
4
- data.tar.gz: 8563324a0629b919afe389cb0c353058d5180ecdd4a53f2f771c5c0e4af4588f
3
+ metadata.gz: 16c66e849f0804928047b4f60236a32f2f27100b4ad1232ecc1884903bc72c9b
4
+ data.tar.gz: 1a8c27b06a89d03f12ec116adb5132353859cea8d650540b9f3ab7a323dd294c
5
5
  SHA512:
6
- metadata.gz: 93236544418397a1bde3f983082f9c27aff3ebd9631a6a9bd2438cabbcf3d4c5dd9b4bc86855641e378758df0d8055b32e54a264cc18625834944974d60386eb
7
- data.tar.gz: 17eaf0267611c018635681bab2ac3f979e0507cb38b7e21d47d6edb8f2a04e0d9d1dc7408caa582c3912a05c88821f40039f75dba7c2169eb05079270ce5c0e8
6
+ metadata.gz: aa89bc3221a493354cb9586245467a5df1f01f3afcb0de3b7ce2d209c12e546df48ad1c01f06bb7730bd1e79e5f816bc308d08c1a803226c0aa36fe12806347d
7
+ data.tar.gz: 8873ca48989983dd8eba56acfeaa33ebb0f58dd6571787338e39f125d6ade48379481f2e24238d684f6fe89b1627d54f16cb877af3e9ab4742ce372864c3a62d
data/.gitignore CHANGED
@@ -9,4 +9,3 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
- /.storefront_setup
data/Gemfile CHANGED
@@ -5,6 +5,3 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
5
5
  # Specify your gem's dependencies in krb.gemspec
6
6
  gemspec
7
7
  gem 'tty'
8
- gem 'tty-prompt'
9
- gem 'http'
10
- gem 'rack'
data/Gemfile.lock CHANGED
@@ -1,34 +1,21 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- krb (0.0.3)
4
+ krb (0.0.15)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- addressable (2.5.2)
10
- public_suffix (>= 2.0.2, < 4.0)
11
9
  diff-lcs (1.3)
12
- domain_name (0.5.20180417)
13
- unf (>= 0.0.5, < 1.0.0)
14
10
  equatable (0.5.0)
15
11
  hitimes (1.3.0)
16
- http (3.3.0)
17
- addressable (~> 2.3)
18
- http-cookie (~> 1.0)
19
- http-form_data (~> 2.0)
20
- http_parser.rb (~> 0.6.0)
21
- http-cookie (1.0.3)
22
- domain_name (~> 0.5)
23
- http-form_data (2.1.1)
24
- http_parser.rb (0.6.0)
12
+ kramdown (1.16.2)
25
13
  necromancer (0.4.0)
26
14
  pastel (0.7.2)
27
15
  equatable (~> 0.5.0)
28
16
  tty-color (~> 0.4.0)
29
- public_suffix (3.0.3)
30
- rack (2.0.5)
31
17
  rake (10.5.0)
18
+ rouge (3.1.1)
32
19
  rspec (3.8.0)
33
20
  rspec-core (~> 3.8.0)
34
21
  rspec-expectations (~> 3.8.0)
@@ -42,25 +29,86 @@ GEM
42
29
  diff-lcs (>= 1.2.0, < 2.0)
43
30
  rspec-support (~> 3.8.0)
44
31
  rspec-support (3.8.0)
32
+ strings (0.1.2)
33
+ unicode-display_width (~> 1.4.0)
34
+ unicode_utils (~> 1.4.0)
35
+ thor (0.20.0)
45
36
  timers (4.1.2)
46
37
  hitimes
47
- tty (0.1.0)
38
+ tty (0.8.1)
39
+ bundler (~> 1.16, < 2.0)
40
+ equatable (~> 0.5.0)
41
+ pastel (~> 0.7.2)
42
+ thor (~> 0.20.0)
43
+ tty-color (~> 0.4.2)
44
+ tty-command (~> 0.8.0)
45
+ tty-config (~> 0.2.0)
46
+ tty-cursor (~> 0.5.0)
47
+ tty-editor (~> 0.4.0)
48
+ tty-file (~> 0.6.0)
49
+ tty-font (~> 0.2.0)
50
+ tty-markdown (~> 0.4.0)
51
+ tty-pager (~> 0.11.0)
52
+ tty-platform (~> 0.1.0)
53
+ tty-progressbar (~> 0.15.0)
54
+ tty-prompt (~> 0.16.1)
55
+ tty-screen (~> 0.6.4)
56
+ tty-spinner (~> 0.8.0)
57
+ tty-table (~> 0.10.0)
58
+ tty-tree (~> 0.1.0)
59
+ tty-which (~> 0.3.0)
48
60
  tty-color (0.4.3)
49
- tty-cursor (0.6.0)
50
- tty-prompt (0.17.0)
61
+ tty-command (0.8.2)
62
+ pastel (~> 0.7.0)
63
+ tty-config (0.2.0)
64
+ tty-cursor (0.5.0)
65
+ tty-editor (0.4.0)
66
+ tty-prompt (~> 0.16.0)
67
+ tty-which (~> 0.3.0)
68
+ tty-file (0.6.0)
69
+ diff-lcs (~> 1.3.0)
70
+ pastel (~> 0.7.2)
71
+ tty-prompt (~> 0.16.1)
72
+ tty-font (0.2.0)
73
+ tty-markdown (0.4.0)
74
+ kramdown (~> 1.16.2)
75
+ pastel (~> 0.7.2)
76
+ rouge (~> 3.1.0)
77
+ strings (~> 0.1.0)
78
+ tty-color (~> 0.4.2)
79
+ tty-screen (~> 0.6.4)
80
+ tty-pager (0.11.0)
81
+ strings (~> 0.1.0)
82
+ tty-screen (~> 0.6.4)
83
+ tty-which (~> 0.3.0)
84
+ tty-platform (0.1.0)
85
+ tty-progressbar (0.15.1)
86
+ tty-cursor (~> 0.5.0)
87
+ tty-screen (~> 0.6.4)
88
+ unicode-display_width (~> 1.3)
89
+ tty-prompt (0.16.1)
51
90
  necromancer (~> 0.4.0)
52
91
  pastel (~> 0.7.0)
53
92
  timers (~> 4.0)
54
- tty-cursor (~> 0.6.0)
55
- tty-reader (~> 0.4.0)
56
- tty-reader (0.4.0)
57
- tty-cursor (~> 0.6.0)
93
+ tty-cursor (~> 0.5.0)
94
+ tty-reader (~> 0.3.0)
95
+ tty-reader (0.3.0)
96
+ tty-cursor (~> 0.5.0)
58
97
  tty-screen (~> 0.6.4)
59
98
  wisper (~> 2.0.0)
60
99
  tty-screen (0.6.5)
61
- unf (0.1.4)
62
- unf_ext
63
- unf_ext (0.0.7.5)
100
+ tty-spinner (0.8.0)
101
+ tty-cursor (>= 0.5.0)
102
+ tty-table (0.10.0)
103
+ equatable (~> 0.5.0)
104
+ necromancer (~> 0.4.0)
105
+ pastel (~> 0.7.2)
106
+ strings (~> 0.1.0)
107
+ tty-screen (~> 0.6.4)
108
+ tty-tree (0.1.0)
109
+ tty-which (0.3.0)
110
+ unicode-display_width (1.4.0)
111
+ unicode_utils (1.4.0)
64
112
  wisper (2.0.0)
65
113
 
66
114
  PLATFORMS
@@ -68,13 +116,10 @@ PLATFORMS
68
116
 
69
117
  DEPENDENCIES
70
118
  bundler (~> 1.16)
71
- http
72
119
  krb!
73
- rack
74
120
  rake (~> 10.0)
75
121
  rspec (~> 3.0)
76
122
  tty
77
- tty-prompt
78
123
 
79
124
  BUNDLED WITH
80
125
  1.16.1
data/bin/krb ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'krb'
4
+ Krb::Installer::Base.process
@@ -7,50 +7,9 @@ module Krb
7
7
  def self.process(*args, &block)
8
8
  new(*args, &block).process
9
9
  end
10
-
11
- def prompt
12
- ::TTY::Prompt.new(interrupt: :exit)
13
- end
14
-
15
- def setup_file_name
16
- '.storefront_setup'
17
- end
18
-
19
- def setup_file_path
20
- [Dir.pwd, setup_file_name].join('/')
21
- end
22
-
23
- def verify_setup
24
- return if key?
25
- msg = <<-END.gsub(/^\s+\|/, '')
26
- |-----
27
- |ok
28
- |-----
29
- END
30
- print msg
31
- end
32
-
33
- private
34
-
35
- def key?
36
- config ? config.storefront_token.present? : false
37
- end
38
-
39
- def config_file_path
40
- [Dir.pwd, '.krb'].join('/')
41
- end
42
-
43
- def config_file?
44
- File.exist?(config_file_path)
45
- end
46
-
47
- def config
48
- return unless config_file?
49
- YAML.load_file(config_file_path)
50
- end
51
10
  end
52
11
  end
53
12
 
54
13
  Dir[File.dirname(__FILE__) + '/**/*.rb'].each do |file|
55
14
  require file
56
- end
15
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'tty/prompt'
4
+
5
+ module Krb
6
+ module Installer
7
+ # syntactic sugar
8
+ class Base < ::Krb::ApplicationService
9
+ def process
10
+ verify_key
11
+ end
12
+
13
+ private
14
+
15
+ def verify_key
16
+ return if File.exist?('~/.storefront')
17
+ prompt = ::TTY::Prompt.new
18
+
19
+ x = prompt.ask('What is your name?') do |q|
20
+ q.required true
21
+ end
22
+
23
+ pp x
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Krb
4
+ module Php
5
+ # entrypoiny for php tools
6
+ class Base < ::Krb::ApplicationService
7
+ def self.import
8
+ 'Import php'
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Krb
4
+ module Ruby
5
+ # entrypoiny for php tools
6
+ class Base < ::Krb::ApplicationService
7
+ def self.import
8
+ 'Import ruby'
9
+ end
10
+ end
11
+ end
12
+ end
data/lib/krb/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Krb
4
- VERSION = '0.0.3'.freeze
4
+ VERSION = '0.0.15'.freeze
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: krb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - bbnnt
@@ -55,8 +55,7 @@ dependencies:
55
55
  description: CLI tools to interact with a shopify store
56
56
  email:
57
57
  - ben@dee.mx
58
- executables:
59
- - krb
58
+ executables: []
60
59
  extensions: []
61
60
  extra_rdoc_files: []
62
61
  files:
@@ -70,18 +69,14 @@ files:
70
69
  - README.md
71
70
  - Rakefile
72
71
  - bin/console
72
+ - bin/krb
73
73
  - bin/setup
74
- - exe/krb
75
- - http_server.rb
76
74
  - krb.gemspec
77
75
  - lib/krb.rb
78
76
  - lib/krb/application_service.rb
79
- - lib/krb/download.rb
80
- - lib/krb/import.rb
81
- - lib/krb/setup/ask_shopify_access_key.rb
82
- - lib/krb/setup/ask_shopify_shop_name.rb
83
- - lib/krb/setup/base.rb
84
- - lib/krb/setup/git_ignore.rb
77
+ - lib/krb/installer/base.rb
78
+ - lib/krb/php/base.rb
79
+ - lib/krb/ruby/base.rb
85
80
  - lib/krb/version.rb
86
81
  homepage: https://ngx.host
87
82
  licenses:
data/exe/krb DELETED
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'krb'
4
-
5
- entrypoint = ARGV[0]
6
-
7
- if entrypoint == 'setup'
8
- Krb::Setup::Base.process
9
- elsif entrypoint == 'import'
10
- Krb::Import.process
11
- elsif entrypoint == 'download'
12
- Krb::Download.process
13
- else
14
- puts 'Please specify a command.'
15
- end
data/http_server.rb DELETED
@@ -1,24 +0,0 @@
1
- # require 'socket'
2
- # require 'rack/utils'
3
-
4
- # server = TCPServer.new 5678
5
-
6
- # def query_params(req)
7
- # return if req.match(/\/favicon\.ico/)
8
- # params = req.to_s.split('?').last.to_s.split(' ').first
9
- # Rack::Utils.parse_nested_query(params)
10
- # end
11
-
12
- # while session = server.accept
13
- # request = session.gets
14
- # puts query_params(request).to_s
15
-
16
- # session.print "HTTP/1.1 200\r\n"
17
- # session.print "Content-Type: text/html\r\n"
18
- # session.print "\r\n"
19
- # session.print "Hello world! The time is #{Time.now}"
20
-
21
- # session.close
22
-
23
- # # server.close
24
- # end
data/lib/krb/download.rb DELETED
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Krb
4
- # Sets up configuration
5
- class Download < ApplicationService
6
- def initialize
7
- super
8
- verify_setup
9
- end
10
-
11
- def process
12
- 'ok download'
13
- end
14
- end
15
- end
data/lib/krb/import.rb DELETED
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Krb
4
- # Sets up configuration
5
- class Import < ApplicationService
6
- def initialize
7
- super
8
- verify_setup
9
- end
10
-
11
- def process
12
- 'ok import'
13
- end
14
- end
15
- end
@@ -1,54 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'http'
4
- require 'tty/prompt'
5
-
6
- module Krb
7
- module Setup
8
- # Sets up configuration
9
- class AskShopifyAccessKey < ApplicationService
10
- def initialize(setup)
11
- @shop_name = setup.dig('shop_name')
12
- end
13
-
14
- def process
15
- if graphql_endpoint?
16
- input
17
- else
18
- abort("\nInvalid credentials. Please try again.\n")
19
- return ''
20
- end
21
- end
22
-
23
- private
24
-
25
- def input
26
- @input ||= prompt.mask(ask_phrase) { |q| q.required true }
27
- end
28
-
29
- def ask_phrase
30
- 'Please enter your shopify storefront access key : '
31
- end
32
-
33
- def graphql_endpoint?
34
- response = HTTP.headers(graphql_headers).post(graphql_url, body: graphql_payload)
35
- response.code == 200
36
- end
37
-
38
- def graphql_headers
39
- {
40
- 'Content-Type' => 'application/graphql',
41
- 'X-Shopify-Storefront-Access-Token' => input
42
- }
43
- end
44
-
45
- def graphql_payload
46
- '{ shop { name } }'
47
- end
48
-
49
- def graphql_url
50
- "https://#{@shop_name}.myshopify.com/api/graphql"
51
- end
52
- end
53
- end
54
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'http'
4
- require 'tty/prompt'
5
-
6
- module Krb
7
- module Setup
8
- # Sets up configuration
9
- class AskShopifyShopName < ApplicationService
10
- def process
11
- prompt.ask(ask_phrase) { |q| q.required true }
12
- end
13
-
14
- private
15
-
16
- def input
17
- @input ||= prompt.ask(ask_phrase) { |q| q.required true }
18
- end
19
-
20
- def ask_phrase
21
- 'Please enter your shopify shop name : '
22
- end
23
- end
24
- end
25
- end
@@ -1,44 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'tty/prompt'
4
- require 'yaml'
5
-
6
- module Krb
7
- module Setup
8
- # Sets up configuration
9
- class Base < ApplicationService
10
- def process
11
- shopify_prompts
12
- language_prompt
13
- wrap_up
14
- end
15
-
16
- private
17
-
18
- def setup
19
- @setup ||= begin
20
- if File.exist?(setup_file_path)
21
- YAML.load_file(setup_file_path)
22
- else
23
- {}
24
- end
25
- end
26
- end
27
-
28
- def wrap_up
29
- File.open(setup_file_path, 'w+') { |f| f.write(setup.to_yaml) }
30
- Krb::Setup::GitIgnore.process
31
- end
32
-
33
- def shopify_prompts
34
- setup['shop_name'] = Krb::Setup::AskShopifyShopName.process
35
- setup['access_key'] = Krb::Setup::AskShopifyAccessKey.process(setup)
36
- end
37
-
38
- def language_prompt
39
- input = prompt.select('Select your library :', %w[php rails node])
40
- setup['language'] = input
41
- end
42
- end
43
- end
44
- end
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Krb
4
- module Setup
5
- # Sets up configuration
6
- class GitIgnore < ApplicationService
7
- def process
8
- return if has_gitignore? && is_ignored?
9
- add_gitignore unless has_gitignore?
10
- write_to_gitignore unless is_ignored?
11
- end
12
-
13
- private
14
-
15
- def write_to_gitignore
16
- open(dot_gitignore, 'a') { |f| f << "\n#{ignore_path}\n" }
17
- end
18
-
19
- def add_gitignore
20
- File.open(dot_gitignore, 'w+') { |f| f.write('') }
21
- end
22
-
23
- def is_ignored?
24
- File.readlines(dot_gitignore).grep(/#{ignore_path}/).size >= 1
25
- end
26
-
27
- def has_gitignore?
28
- File.exist?(dot_gitignore)
29
- end
30
-
31
- def dot_gitignore
32
- [Dir.pwd, '.gitignore'].join('/')
33
- end
34
-
35
- def ignore_path
36
- "/#{setup_file_name}"
37
- end
38
- end
39
- end
40
- end