pry-command-set-registry 0.1.0 → 0.1.1

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
  SHA1:
3
- metadata.gz: f0c78344f62614780aa6a856af8e29daadb08666
4
- data.tar.gz: a42f4b777cfc4af3589ac913f9a983487d735370
3
+ metadata.gz: 1bc4e47b4fe6de4fd01ea656dc1b5b30f901c2c8
4
+ data.tar.gz: d117d60905175b6b40a17e7ae02b71fbd7d9d12b
5
5
  SHA512:
6
- metadata.gz: 492c4cc1dc6f77b749bd2d3ee30735bb24e5a76da6043209b34fd4c6aa6bcf6a398dbec721d5593e9a317b32024be51b2f9d4f5c0545fd89035310673bd61330
7
- data.tar.gz: d76e29736b3c448081dff3e908d8493990f0ef2c7167a2b0b914c88fff1e947aec119bf32c07e0ff59f3ae361c4e86d7572fe6358ccc2a99ab0e814d945b6234
6
+ metadata.gz: 85515d27354c4246fda7a4b148678dd9abf0f4c4a3d91871fb5fd27fd65d31f7ecab11fbd17adea09c662bad36470cfc4a650ad47c182b8e9b55aaaaaf6938c7
7
+ data.tar.gz: 984954420617368b4fad4f497573ccebdd9862756163754e1728f6f2baa309f4e485554561274885770ba341478b5f6dc1531ca9a644e4692bea1dad4f5764cb
@@ -9,6 +9,10 @@ module PryCommandSetRegistry
9
9
 
10
10
  begin
11
11
  set = target.eval(command_set_name)
12
+ unless set.respond_to?(:commands) && set.commands.is_a?(Hash)
13
+ registered_set = PryCommandSetRegistry.command_set(command_set_name)
14
+ set = registered_set if registered_set
15
+ end
12
16
  rescue NameError
13
17
  set = PryCommandSetRegistry.command_set(command_set_name)
14
18
  ::Kernel.raise if set.nil?
@@ -1,4 +1,4 @@
1
1
  module PryCommandSetRegistry
2
2
  # The version of the PryCommandSetRegistry gem.
3
- VERSION = "0.1.0".freeze
3
+ VERSION = "0.1.1".freeze
4
4
  end
@@ -49,6 +49,25 @@ class CommandsTest < PryCommandSetRegistry::TestCase
49
49
  assert_equal true, context_command_called
50
50
  assert_equal false, registry_command_called
51
51
  end
52
+
53
+ should "fallback to registry if eval result doesn't seem to be a command set" do
54
+ registry_command_called = false
55
+ PryCommandSetRegistry.define_command_set("TestCommand", "test") do
56
+ command("test", "test") do
57
+ registry_command_called = true
58
+ end
59
+ end
60
+
61
+ some_const = Object.new
62
+ # This will return false anyway, but make sure it gets called to ensure
63
+ # the eval is resolving to the expected object before falling back.
64
+ some_const.expects(:respond_to?).with(:commands).returns(false)
65
+ Object::TestCommand = some_const
66
+ context = Pry.binding_for(Object.new)
67
+ run_command("import-set TestCommand", :context => context)
68
+ run_command("test")
69
+ assert_equal true, registry_command_called
70
+ end
52
71
  end
53
72
 
54
73
  context "list-sets" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry-command-set-registry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Guinther