simple-cli 0.3.12 → 0.4.1

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: 156fbfd11f78c47d66f43a6c6158377ec51f5f20061e16fa5c5b853a1d622fcc
4
- data.tar.gz: aa0e7b9585e559377362197e6a094f8023a0e8293d6974d175f335bd99ed75ed
3
+ metadata.gz: f7c76281ec1c86003ccc81f754067a1ab6c1270c1252b49be9b2e77b5003b4f0
4
+ data.tar.gz: 13ee4536fab8272fdc833ea585ee324ec6fc7454939aef9fe4c762c168087001
5
5
  SHA512:
6
- metadata.gz: fdb819a5b2fd0cebc5f3359ddbd18992b690779eee27fe673018c659372f232c8b70839f6dbdb33f71901bf9242da3a70e3792234df5e6d5e2aaab2d64949dd9
7
- data.tar.gz: 1c81fd6b778df6e551a055074b7cb3c38cfb120d27f9f4e25cf74e17d6d33036f1663a0b8d611407efd719ab10c45730061bbab813a09a045c86ca078f7a38de
6
+ metadata.gz: 74f848f2d6fe96a2bb63ccae8fdd866a37d403162ecd7a2c595c87b3e6f3c7b2999f12a932892c658e9f754f7fc1918ca1d36889ff022162a10ac35948313624
7
+ data.tar.gz: f131ad6dfc56139703414dcb0d991425db604ede1efe4e5e12dd558f02a724603e46bddac93e79dcf3a6879d9cec5d08ec87b9061fbe4e2fd0ceabe29c8a9d49
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.12
1
+ 0.4.1
@@ -0,0 +1,19 @@
1
+ module ::Simple::CLI::Deprecations
2
+ SELF = self
3
+
4
+ def logger
5
+ SELF.deprecated! "Simple::CLI#logger", alternative: "Simple::CLI.logger"
6
+ end
7
+
8
+ def run!(*_)
9
+ SELF.deprecated! "Simple::CLI#run!", alternative: "Simple::CLI.run!(Your::CLI)"
10
+ end
11
+
12
+ def self.deprecated!(what, alternative: nil)
13
+ Simple::CLI.logger.error "'#{what}' was removed."
14
+ if alternative
15
+ Simple::CLI.logger.info "You probably want to use '#{alternative}' instead."
16
+ end
17
+ exit 1
18
+ end
19
+ end
@@ -10,10 +10,8 @@ module Simple::CLI
10
10
  _ = verbose
11
11
 
12
12
  action_name = H.command_to_action(command)
13
- Simple::Service.with_context do
14
- flags = extract_flags!(args)
15
- ::Simple::Service.invoke(service, action_name, args: args, flags: flags)
16
- end
13
+ flags = extract_flags!(args)
14
+ ::Simple::Service.invoke(service, action_name, args: args, flags: flags)
17
15
  end
18
16
 
19
17
  private
data/lib/simple/cli.rb CHANGED
@@ -13,6 +13,7 @@ require_relative "cli/adapter"
13
13
  require_relative "cli/logger"
14
14
  require_relative "cli/on_exception"
15
15
  require_relative "cli/helpers"
16
+ require_relative "cli/deprecations"
16
17
 
17
18
  require "simple/service"
18
19
 
@@ -29,6 +30,11 @@ module Simple::CLI
29
30
  def self.included(base)
30
31
  base.include(::Simple::Service)
31
32
  base.include(::Simple::CLI::Helpers)
33
+
34
+ # When going from 0.2 to 0.3 we removed some helpers that originally had been
35
+ # mixed into the target CLI module. The ::Simple::CLI::Deprecations module
36
+ # makes sure to print deprecation warnings.
37
+ base.extend(::Simple::CLI::Deprecations)
32
38
  end
33
39
 
34
40
  # Runs the service with the current command line arguments.
@@ -81,7 +87,17 @@ module Simple::CLI
81
87
  # Run service.
82
88
  Runner.run! service, options.command, *args, verbose: options.verbose?
83
89
  rescue ::Simple::Service::ArgumentError
84
- Helper.help_on_command! service, options.command, verbose: false
90
+ STDERR.puts <<~MSG
91
+ #{$!}
92
+
93
+ You probably run the command with invalid arguments; to learn more run
94
+
95
+ #{$0} help #{options.command}
96
+
97
+ Error location:
98
+
99
+ - #{$!.backtrace[0,5].join("\n- ")}
100
+ MSG
85
101
  rescue StandardError => e
86
102
  on_exception(e)
87
103
  exit 3
data/simple-cli.gemspec CHANGED
@@ -24,8 +24,8 @@ Gem::Specification.new do |gem|
24
24
  # executables are used for development purposes only
25
25
  gem.executables = []
26
26
 
27
- gem.required_ruby_version = '~> 2.3'
27
+ gem.required_ruby_version = '>= 2.5'
28
28
 
29
29
  # optional gems (required by some of the parts)
30
- gem.add_dependency "simple-service", "~> 0.1.5"
30
+ gem.add_dependency "simple-service", "~> 0.2.2"
31
31
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.12
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - radiospiel
8
8
  - mediapeers GmbH
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-07-15 00:00:00.000000000 Z
12
+ date: 2022-07-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: simple-service
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 0.1.5
20
+ version: 0.2.2
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 0.1.5
27
+ version: 0.2.2
28
28
  description: Simple CLI builder
29
29
  email: eno@radiospiel.org
30
30
  executables: []
@@ -45,6 +45,7 @@ files:
45
45
  - lib/simple/cli.rb
46
46
  - lib/simple/cli/adapter.rb
47
47
  - lib/simple/cli/default_options.rb
48
+ - lib/simple/cli/deprecations.rb
48
49
  - lib/simple/cli/helper.rb
49
50
  - lib/simple/cli/helper/help.rb
50
51
  - lib/simple/cli/helper/help_on_command.rb
@@ -66,15 +67,15 @@ files:
66
67
  homepage: http://github.com/radiospiel/simple-cli
67
68
  licenses: []
68
69
  metadata: {}
69
- post_install_message:
70
+ post_install_message:
70
71
  rdoc_options: []
71
72
  require_paths:
72
73
  - lib
73
74
  required_ruby_version: !ruby/object:Gem::Requirement
74
75
  requirements:
75
- - - "~>"
76
+ - - ">="
76
77
  - !ruby/object:Gem::Version
77
- version: '2.3'
78
+ version: '2.5'
78
79
  required_rubygems_version: !ruby/object:Gem::Requirement
79
80
  requirements:
80
81
  - - ">="
@@ -82,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
83
  version: '0'
83
84
  requirements: []
84
85
  rubygems_version: 3.1.4
85
- signing_key:
86
+ signing_key:
86
87
  specification_version: 4
87
88
  summary: Simple CLI builder for ruby
88
89
  test_files: