vimpk 0.1.1 → 0.1.2

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: b51ebecfb9301fe09e702bcb2dfed7efb76ecaf3f21480af3fd75cf6b16f34cf
4
- data.tar.gz: 2286aac5e850c870cad840020904a1aef54c320b30f861d647dc9b2dbeec0b26
3
+ metadata.gz: 1fb0dfb2236f49356b5b50889c8f063c70952ba85fce011400943acc449ca8c5
4
+ data.tar.gz: 513194b7c2e2bc8b3a3c48393addf328f10834f53568721673484fcd9569343c
5
5
  SHA512:
6
- metadata.gz: 7c4a3c50e3b85fa7b58ce0cda77de43925a64a1326a67a33f27f9e6fc0eb00954ac8d1b84decb2c31471232c7269d26bfdbb97f23ff25bf54e7b31b1b33b7f75
7
- data.tar.gz: d71de4cf60fdc354ae6613dfb5bd152becb4bcd50b72e72726afa15c6bb3febe3c2f6d39a2329cf5138a72dc5d6c5ee0dc2d1a9b61c11b2e73a87726b3c81555
6
+ metadata.gz: a2c7c9684d5d750c00f31f314d0fe80f3f1cfa6bfa9bcfb135ea39880bd1b2b9ffba8d790550ca563ba74290992f47c77e9b23c20838e82bab21c712a416e95e
7
+ data.tar.gz: c56b63a7ad96710c7b6fc76a71ba69db43b99d4cba37b12c8a5f60c98dbe9e227556b1a97e6cefa194b29ce8482ea69ec815b3c29a67bcedcbf83b4c688b304a
data/lib/vimpk/cli.rb CHANGED
@@ -4,25 +4,31 @@ module VimPK
4
4
  class CLI
5
5
  include Colorizer
6
6
 
7
- def initialize(args)
8
- @args = args
9
- @parser = VimPK::Options.new(args)
10
- @options = @parser.options
7
+ attr_reader :command
8
+
9
+ def initialize(argv)
10
+ @argv = argv
11
+ @parser = Options.new(argv)
12
+ @options = @parser.parse
11
13
  @command = determine_command
14
+ rescue OptionParser::MissingArgument, OptionParser::InvalidOption => e
15
+ puts e.message
16
+ abort("Use --help for usage information")
12
17
  end
13
18
 
14
19
  def call
15
20
  if @command
16
- send(@command, *@args)
21
+ send(@command, *@argv)
17
22
  else
18
23
  puts @parser.parser
19
24
  end
20
25
  end
21
26
 
22
27
  def determine_command
23
- return nil if @args.empty?
28
+ return nil if @argv.empty?
24
29
 
25
- case @args.shift&.downcase
30
+ name = @argv.shift&.downcase
31
+ case name
26
32
  when "i", "install"
27
33
  :install_command
28
34
  when "u", "update"
@@ -30,7 +36,7 @@ module VimPK
30
36
  when "rm", "remove"
31
37
  :remove_command
32
38
  else
33
- raise "Unknown command: #{name}"
39
+ raise ArgumentError, "Unknown command: #{name}"
34
40
  end
35
41
  end
36
42
 
data/lib/vimpk/options.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "optparse"
2
4
 
3
5
  module VimPK
@@ -5,13 +7,15 @@ module VimPK
5
7
  attr_reader :options, :parser
6
8
 
7
9
  DEFAULT_PATH = File.expand_path("~/.vim/pack").freeze
8
- DEFAULT_TYPE = "start".freeze
9
- DEFAULT_PACK = "plugins".freeze
10
+ DEFAULT_TYPE = "start"
11
+ DEFAULT_PACK = "plugins"
10
12
 
11
13
  DefaultOptions = Struct.new(:path, :pack, :type)
12
14
 
13
- def initialize(args)
15
+ def initialize(argv)
16
+ @argv = argv
14
17
  @options = DefaultOptions.new(DEFAULT_PATH, DEFAULT_PACK, DEFAULT_TYPE)
18
+
15
19
  @parser = OptionParser.new do |parser|
16
20
  parser.banner = "Usage: #{parser.program_name} [options] [command [options]"
17
21
  parser.separator ""
@@ -52,14 +56,12 @@ module VimPK
52
56
  parser.separator " i|install REPO/NAME [--opt|--start] [--pack=PATH] [--path=PATH] Install a package"
53
57
  parser.separator " u|update Update all packages"
54
58
  parser.separator " rm|remove NAME Remove all occurrences of a package"
55
-
56
- begin
57
- parser.permute!(args)
58
- rescue OptionParser::MissingArgument, OptionParser::InvalidOption => e
59
- puts e.message
60
- abort("Use --help for usage information")
61
- end
62
59
  end
63
60
  end
61
+
62
+ def parse
63
+ @parser.permute!(@argv)
64
+ @options
65
+ end
64
66
  end
65
67
  end
data/lib/vimpk/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module VimPK
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
data/lib/vimpk.rb CHANGED
@@ -12,11 +12,11 @@ module VimPK
12
12
 
13
13
  autoload :CLI, "vimpk/cli"
14
14
  autoload :Colorizer, "vimpk/colorizer"
15
- autoload :Remove, "vimpk/remove"
16
15
  autoload :Git, "vimpk/git"
17
16
  autoload :Install, "vimpk/install"
18
17
  autoload :Job, "vimpk/job"
19
18
  autoload :Options, "vimpk/options"
19
+ autoload :Remove, "vimpk/remove"
20
20
  autoload :ThreadPool, "vimpk/thread_pool"
21
21
  autoload :Update, "vimpk/update"
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vimpk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Usewicz
@@ -19,9 +19,6 @@ extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
21
  - LICENSE.txt
22
- - README.md
23
- - Rakefile
24
- - Steepfile
25
22
  - exe/vimpk
26
23
  - lib/vimpk.rb
27
24
  - lib/vimpk/cli.rb
@@ -34,7 +31,6 @@ files:
34
31
  - lib/vimpk/thread_pool.rb
35
32
  - lib/vimpk/update.rb
36
33
  - lib/vimpk/version.rb
37
- - sig/vimpk.rbs
38
34
  homepage: https://github.com/pusewicz/vimpk
39
35
  licenses:
40
36
  - MIT
@@ -43,7 +39,7 @@ metadata:
43
39
  homepage_uri: https://github.com/pusewicz/vimpk
44
40
  source_code_uri: https://github.com/pusewicz/vimpk
45
41
  changelog_uri: https://github.com/pusewicz/vimpk/blob/main/CHANGELOG.md
46
- github_repo: ssh://github.com/pusewicz/vimpk
42
+ github_repo: https://github.com/pusewicz/vimpk.git
47
43
  post_install_message:
48
44
  rdoc_options: []
49
45
  require_paths:
@@ -52,7 +48,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
52
48
  requirements:
53
49
  - - ">="
54
50
  - !ruby/object:Gem::Version
55
- version: 3.0.0
51
+ version: 2.6.0
56
52
  required_rubygems_version: !ruby/object:Gem::Requirement
57
53
  requirements:
58
54
  - - ">="
data/README.md DELETED
@@ -1,33 +0,0 @@
1
- # VimPK
2
-
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/vimpk`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- ## Installation
6
-
7
- Install the gem by executing:
8
-
9
- $ gem install vimpk
10
-
11
- ## Usage
12
-
13
- To use the gem, you can run the following command:
14
-
15
- $ vimpk
16
-
17
- ## Development
18
-
19
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
20
-
21
- 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
22
-
23
- ## Contributing
24
-
25
- Bug reports and pull requests are welcome on GitHub at https://github.com/pusewicz/vimpk. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/pusewicz/vimpk/blob/main/CODE_OF_CONDUCT.md).
26
-
27
- ## License
28
-
29
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
30
-
31
- ## Code of Conduct
32
-
33
- Everyone interacting in the Vimpk project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/pusewicz/vimpk/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile DELETED
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
- require "minitest/test_task"
5
-
6
- Minitest::TestTask.create
7
-
8
- require "standard/rake"
9
-
10
- task default: %i[test standard]
data/Steepfile DELETED
@@ -1,29 +0,0 @@
1
- # D = Steep::Diagnostic
2
- #
3
- # target :lib do
4
- # signature "sig"
5
- #
6
- # check "lib" # Directory name
7
- # check "Gemfile" # File name
8
- # check "app/models/**/*.rb" # Glob
9
- # # ignore "lib/templates/*.rb"
10
- #
11
- # # library "pathname" # Standard libraries
12
- # # library "strong_json" # Gems
13
- #
14
- # # configure_code_diagnostics(D::Ruby.default) # `default` diagnostics setting (applies by default)
15
- # # configure_code_diagnostics(D::Ruby.strict) # `strict` diagnostics setting
16
- # # configure_code_diagnostics(D::Ruby.lenient) # `lenient` diagnostics setting
17
- # # configure_code_diagnostics(D::Ruby.silent) # `silent` diagnostics setting
18
- # # configure_code_diagnostics do |hash| # You can setup everything yourself
19
- # # hash[D::Ruby::NoMethod] = :information
20
- # # end
21
- # end
22
-
23
- # target :test do
24
- # signature "sig", "sig-private"
25
- #
26
- # check "test"
27
- #
28
- # # library "pathname" # Standard libraries
29
- # end
data/sig/vimpk.rbs DELETED
@@ -1,4 +0,0 @@
1
- module Vimpk
2
- VERSION: String
3
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
- end