Skip to content

Commit 3e01336

Browse files
committed
🎨 Backwards compatibility working and tested
1 parent 227214b commit 3e01336

File tree

9 files changed

+37
-29
lines changed

9 files changed

+37
-29
lines changed

.rubocop_todo.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2022-08-26 10:58:24 UTC using RuboCop version 1.30.1.
3+
# on 2022-08-26 13:50:06 UTC using RuboCop version 1.30.1.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
@@ -43,7 +43,7 @@ Security/Open:
4343
Exclude:
4444
- 'lib/oauth/tty/command.rb'
4545

46-
# Offense count: 8
46+
# Offense count: 9
4747
# Configuration parameters: AllowedConstants.
4848
Style/Documentation:
4949
Exclude:
@@ -56,6 +56,7 @@ Style/Documentation:
5656
- 'lib/oauth/tty/commands/query_command.rb'
5757
- 'lib/oauth/tty/commands/sign_command.rb'
5858
- 'lib/oauth/tty/commands/version_command.rb'
59+
- 'test/backwards_compatibility_test.rb'
5960
- 'test/cli_test.rb'
6061

6162
# Offense count: 1

bin/console

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# frozen_string_literal: true
33

44
require "bundler/setup"
5-
require "oauth/cli"
5+
require "oauth/tty"
66

77
# You can add fixtures and/or initialization code here to make experimenting
88
# with your gem easier. You can also use a different console, if you like.

lib/oauth/cli.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# frozen_string_literal: true
22

3-
module OAuth
4-
# Backwards compatibility hack.
5-
# TODO: Remove with April 2023 release of 2.0 release of oauth gem
6-
CLI = OAuth::TTY::CLI
7-
end
3+
require "oauth/tty"
4+
require "oauth/tty/cli"
5+
6+
# Backwards compatibility hack.
7+
# TODO: Remove with April 2023 release of 2.0 release of oauth gem
8+
OAuth::CLI = OAuth::TTY::CLI

lib/oauth/tty.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@
2121
require_relative "tty/commands/sign_command"
2222
require_relative "tty/commands/version_command"
2323

24+
# A gem was released in 2011 which was a rudimentary commands for the oauth gem,
25+
# thus it occupies the name in RubyGems.org.
26+
# This library was originally written as part of the oauth gem, in 2016, as OAuth::TTY.
27+
# This gem is named oauth-tty, but intends to have backwards compatibility with oauth gem v1.0.x.
28+
# Now that it is being extracted there is a name conflict.
29+
#
30+
# oauth-cli is a backwards compatibility loader hook for bundler
31+
# TODO: Remove with April 2023 release of 2.0 release of oauth gem
32+
require "oauth/cli"
33+
2434
module OAuth
2535
# The namespace of this gem
2636
module TTY

lib/oauth_cli.rb

Lines changed: 0 additions & 5 deletions
This file was deleted.

lib/oauth_tty.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,3 @@
22

33
# This file is a loader hook for bundler
44
require "oauth/tty"
5-
6-
# A gem was released in 2011 which was a rudimentary commands for the oauth gem,
7-
# thus it occupies the name in RubyGems.org.
8-
# This library was originally written as part of the oauth gem, in 2016, as OAuth::TTY.
9-
# This gem is named oauth-tty, but intends to have backwards compatibility with oauth gem v1.0.x.
10-
# Now that it is being extracted there is a name conflict.
11-
#
12-
# oauth-cli is a backwards compatibility loader hook for bundler
13-
# TODO: Remove with April 2023 release of 2.0 release of oauth gem
14-
require "oauth_cli"

sig/oauth/cli.rbs

Lines changed: 0 additions & 6 deletions
This file was deleted.

sig/oauth/tty/version.rbs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module OAuth
2+
module TTY
3+
module Version
4+
VERSION: String
5+
# See the writing guide of rbs: https://github.com/ruby/rbs#guides
6+
end
7+
end
8+
end

test/backwards_compatibility_test.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# frozen_string_literal: true
2+
3+
require_relative "test_helper"
4+
5+
class BackwardsCompatibilityTest < Minitest::Test
6+
def test_backwards_compat
7+
assert_equal OAuth::CLI, OAuth::TTY::CLI
8+
end
9+
end

0 commit comments

Comments
 (0)