aye_commander 1.0.0 → 1.0.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
  SHA1:
3
- metadata.gz: fa72a9da4e159367e9e08edd1a76360e61f105e7
4
- data.tar.gz: 3c9cbe60d130049f9d6a16db3eadf6c8df609914
3
+ metadata.gz: da0a543274b37fae29f538f76fad4d4f623843c9
4
+ data.tar.gz: cb01c076185caf5b56cd74a40b6946e3cd39e433
5
5
  SHA512:
6
- metadata.gz: 17422f08ebb5442a8f43f9a00cd48439957d4ba194bc39440ded506f28d44f547a37dba268b0f568063e4b2b6d7cbb61481da8a6f5d104755a03635726318aa7
7
- data.tar.gz: df4f7f0e63fa53bbf4e99d388253f20089b3f70cd311620e700641baea51a92317038a50837be04d62011e77ce45b1790678d1787e4f1f56c5163d0c1d884cc3
6
+ metadata.gz: bd388cbf2ad8c23963f21d7ed0201a620c573a0e1e8839087788e5a714c100ad6d23c398f6130b9c79719b1d4f0d57410d0bb0627765f7fb5ba8e44fa5eea00d
7
+ data.tar.gz: 672f0c73a5ff813f6cf233b2376f8ecaa5502fbd98f2d842e86de76776b445f4027f8610a2727cfc244aacd71691175d71954f893f98eccbc86051b9ad07eedc
data/README.adoc CHANGED
@@ -13,6 +13,7 @@
13
13
  :showtitle:
14
14
  :source-highlighter: coderay
15
15
 
16
+ image:https://badge.fury.io/rb/aye_commander.svg["Gem Version", link="https://badge.fury.io/rb/aye_commander"]
16
17
  image:https://travis-ci.org/pyzlnar/aye_commander.svg?branch=master["Build Status", link="https://travis-ci.org/pyzlnar/aye_commander"]
17
18
  image:https://codeclimate.com/github/pyzlnar/aye_commander/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/pyzlnar/aye_commander"]
18
19
  image:https://codeclimate.com/github/pyzlnar/aye_commander/badges/coverage.svg["Test Coverage", link="https://codeclimate.com/github/pyzlnar/aye_commander/coverage"]
@@ -718,3 +719,7 @@ end
718
719
  ----
719
720
 
720
721
  - Write code, have fun!
722
+
723
+ == License
724
+
725
+ AyeCommander is released under the https://opensource.org/licenses/MIT[MIT License].
@@ -42,17 +42,34 @@ module AyeCommander
42
42
  # Defines the result class with the necessary modules so it can behave
43
43
  # like a result
44
44
  def define_result_class
45
- readers = self.readers
45
+ readers = self.readers
46
+ command_class = self
46
47
  result = Class.new do
47
- include Initializable
48
- include Inspectable
49
- include Status::Readable
50
- include Ivar::Readable
51
- extend Ivar::ClassMethods
48
+ @command_class = command_class
49
+ include Result
50
+ extend Result::ClassMethods
52
51
  attr_reader(*readers)
53
52
  end
54
53
  const_set 'Result', result
55
54
  end
56
55
  end
56
+
57
+ # This are the methods included to every result class
58
+ module Result
59
+ # These methods are extended to the result class
60
+ module ClassMethods
61
+ attr_reader :command_class
62
+ include Ivar::ClassMethods
63
+
64
+ def succeeds
65
+ command_class.succeeds
66
+ end
67
+ end
68
+
69
+ include Initializable
70
+ include Inspectable
71
+ include Status::Readable
72
+ include Ivar::Readable
73
+ end
57
74
  end
58
75
  end
@@ -1,3 +1,3 @@
1
1
  module AyeCommander
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.0.1'.freeze
3
3
  end
@@ -44,6 +44,10 @@ describe AyeCommander::Resultable::ClassMethods do
44
44
  expect(result_class.object_id).to eq command.result_class.object_id
45
45
  end
46
46
 
47
+ it 'assigns the command to @command_class' do
48
+ expect(result_class.command_class).to eq command
49
+ end
50
+
47
51
  it 'includes the necessary result modules' do
48
52
  expect(result_class).to include AyeCommander::Initializable
49
53
  expect(result_class).to include AyeCommander::Inspectable
@@ -65,6 +65,10 @@ describe AyeCommander::Status::Readable do
65
65
  instance.status = :success
66
66
  expect(instance.success?).to be false
67
67
  end
68
+
69
+ it 'works for results' do
70
+ expect(result.success?).to be true
71
+ end
68
72
  end
69
73
 
70
74
  context '#failure?' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aye_commander
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - pyzlnar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-12 00:00:00.000000000 Z
11
+ date: 2016-08-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A gem that helps to write commands in ruby.
14
14
  email: pyzlnar@gmail.com