adjutant 0.1.1 → 0.1.2

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: 7ea0836abc65d922b26125f9a4e8a62423a96d65
4
- data.tar.gz: ef0fa9a09d5817fe7e25cdf3f649066700469852
3
+ metadata.gz: 63fdbf4d9637148a899bf681d613517c9a58e643
4
+ data.tar.gz: 545ec10edc2ad99477c21bb1c934b8688269cb71
5
5
  SHA512:
6
- metadata.gz: d82a1cf02642a2d2e40685fd704937cfaeb4c514c664ce0cfda9b0ab6e4cf8414f00555eee19599eeac7cc1e089e4f7b0122e2380b9f2121ff86686718b56cf3
7
- data.tar.gz: 107721b1fca1e300eb88e87f7663352243e544cdc672386338812d1263eb4f7221eb9fe6c9659fd1dd8eded25394ad80780027ab8c3ba39db577337886083aff
6
+ metadata.gz: ad1648c468bbda14bc1bc5dfc77bbde84e0128482ad0ed6ea1de29d0f8c8d4f4b8e080b8e2894d6b7e862e6d6e2025c8e4dfbc26ed11d77cf6d3c93ee27afa50
7
+ data.tar.gz: f6fafe1b348d8bbfcfedde2a33de44d1e1ddade102867473e45212c6bb62b32c34215966daf689749286eb6ff03fe3a8b39c27e96bedac6e001b8246a4d2c8d7
@@ -0,0 +1,12 @@
1
+ module Adjutant
2
+ Parser = Struct.new(:json) do
3
+ def repo_name
4
+ @name ||=
5
+ "#{json['repository']['owner']['name']}/#{json['repository']['name']}"
6
+ end
7
+
8
+ def commits_sha
9
+ @shas ||= json['commits'].collect { |commit| commit['id'] }
10
+ end
11
+ end
12
+ end
@@ -1,3 +1,3 @@
1
1
  module Adjutant
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/adjutant.rb CHANGED
@@ -2,6 +2,7 @@ require 'adjutant/version'
2
2
  require 'adjutant/comment'
3
3
  require 'adjutant/line'
4
4
  require 'adjutant/file_parser'
5
+ require 'adjutant/parser'
5
6
 
6
7
  module Adjutant
7
8
 
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Adjutant::Parser do
4
+
5
+ let(:json) do
6
+ {
7
+ "repository" => {
8
+ "owner" => { "name" => 'Baltazore' },
9
+ "name" => "adjutant",
10
+ },
11
+ "commits" => [ { "id" => "asda" }, {"id" => "asds" } ]
12
+ }
13
+ end
14
+ let(:parser) { Adjutant::Parser.new(json) }
15
+
16
+ it 'gets commits sha' do
17
+ expect(parser.commits_sha).to eq(['asda', 'asds'])
18
+ end
19
+
20
+ it 'fetches repo name' do
21
+ expect(parser.repo_name).to eq('Baltazore/adjutant')
22
+ end
23
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adjutant
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
  - Baltazore
@@ -99,10 +99,12 @@ files:
99
99
  - lib/adjutant/comment.rb
100
100
  - lib/adjutant/file_parser.rb
101
101
  - lib/adjutant/line.rb
102
+ - lib/adjutant/parser.rb
102
103
  - lib/adjutant/version.rb
103
104
  - spec/adjutant/comment_spec.rb
104
105
  - spec/adjutant/file_parser_spec.rb
105
106
  - spec/adjutant/line_spec.rb
107
+ - spec/adjutant/parser_spec.rb
106
108
  - spec/spec_helper.rb
107
109
  homepage: http://baltazore.github.io/adjutant
108
110
  licenses:
@@ -132,5 +134,6 @@ test_files:
132
134
  - spec/adjutant/comment_spec.rb
133
135
  - spec/adjutant/file_parser_spec.rb
134
136
  - spec/adjutant/line_spec.rb
137
+ - spec/adjutant/parser_spec.rb
135
138
  - spec/spec_helper.rb
136
139
  has_rdoc: