ios_parser 0.7.1 → 0.8.0

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: 7ca27e440ca7f9a38c976bff002dc996725d77e1ec3fcd12749e119b910ed08d
4
- data.tar.gz: 5c59a60ccdf9c10e5d6fd8841dfb2eac7fae046b3447aa401cc61982210d9b08
3
+ metadata.gz: d622ced70b173f1c2b514b3060694ecf722641e098367551ac66878c40059c5f
4
+ data.tar.gz: 20fedb53829b28a18ce1d5aa72107b13534ea3b01118a7b988fc6f4b4d01a83c
5
5
  SHA512:
6
- metadata.gz: 68394ff82c8d23b91accdd947529e352d09459d1fd6a5747ab4bb3ec7a53863b01cf8079fffb0e3f9b941c443451664e2acd2c4201ba7c06cea5b6bfe4ab584a
7
- data.tar.gz: 33106cf36832dc6d082f278bf5d2a324d03274b37eb496828b29180587e812577b94387bcb9ec6428ed961710da9662c9b24b6b2923fe4f35003e196dcbd95f2
6
+ metadata.gz: 5ab205f2e84a5bf71e3bf1ceb1b2b8c5cef6bfcf0900ca4d472fcd1079174a448549efba14d58597eb04cde8f5bf29d5c059db14624b2695b763a75f5468df1f
7
+ data.tar.gz: 36fd7e6722935457f9c8e3f60231fe37c4c5fe0ee9a6a9922ed45a5a5b9fbd7d26f9b631056298a8b95acdeb7f4c5e6a136b4df9d0ede939918062e292766231
@@ -0,0 +1,48 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ "master" ]
13
+ pull_request:
14
+ branches: [ "master" ]
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ jobs:
20
+ test:
21
+ runs-on: ubuntu-latest
22
+ strategy:
23
+ matrix:
24
+ ruby-version:
25
+ - '2.0'
26
+ - '2.1'
27
+ - '2.2'
28
+ - '2.3'
29
+ - '2.4'
30
+ - '2.5'
31
+ - '2.6'
32
+ - '2.7'
33
+ - '3.0'
34
+ - '3.1'
35
+ - jruby-9.1.17.0
36
+ - jruby-9.2.21.0
37
+ - jruby-9.3.6.0
38
+
39
+ steps:
40
+ - uses: actions/checkout@v3
41
+ - name: Set up Ruby
42
+ # https://github.com/ruby/setup-ruby#versioning
43
+ uses: ruby/setup-ruby@v1
44
+ with:
45
+ ruby-version: ${{ matrix.ruby-version }}
46
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
47
+ - name: Run tests
48
+ run: bundle exec rake
data/ios_parser.gemspec CHANGED
@@ -19,6 +19,8 @@ Gem::Specification.new do |s|
19
19
  s.extensions << 'ext/ios_parser/c_lexer/extconf.rb'
20
20
  end
21
21
 
22
+ s.required_ruby_version = '>=2.0'
23
+
22
24
  s.add_development_dependency 'rake-compiler', '~>0.9'
23
25
  s.add_development_dependency 'rspec', '~>3.2'
24
26
  s.add_development_dependency 'rubocop', '~> 0.54' if RUBY_VERSION > '2.1'
@@ -21,7 +21,7 @@ module IOSParser
21
21
  end
22
22
 
23
23
  def name
24
- tokens.first.value
24
+ (tokens.first) && tokens.first.value
25
25
  end
26
26
 
27
27
  def ==(other)
@@ -64,7 +64,7 @@ module IOSParser
64
64
 
65
65
  def to_s(dedent: false)
66
66
  indent_opts = { base: dedent ? path.length : 0 }
67
- map { |cmd| "#{cmd.indentation(indent_opts)}#{cmd.line}\n" }.join
67
+ map { |cmd| "#{cmd.indentation(**indent_opts)}#{cmd.line}\n" }.join
68
68
  end
69
69
 
70
70
  def to_hash
@@ -92,7 +92,7 @@ module IOSParser
92
92
  hash[:commands].each_index do |i|
93
93
  hash[:commands][i] = from_hash(hash[:commands][i])
94
94
  end
95
- new(hash)
95
+ new(**hash)
96
96
  end
97
97
  end
98
98
  end # class Command
@@ -46,7 +46,7 @@ module IOSParser
46
46
  indent: @indent
47
47
  }
48
48
 
49
- Command.new(opts).tap do |cmd|
49
+ Command.new(**opts).tap do |cmd|
50
50
  cmd.commands = subsections(cmd)
51
51
  end
52
52
  end
@@ -1,7 +1,7 @@
1
1
  module IOSParser
2
2
  class << self
3
3
  def version
4
- '0.7.1'
4
+ '0.8.0'
5
5
  end
6
6
  end
7
7
  end
@@ -3,6 +3,20 @@ require 'ios_parser'
3
3
 
4
4
  describe IOSParser do
5
5
  describe '.parse' do
6
+ context 'with blank line at start' do
7
+ it 'parses and extracts sections' do
8
+ parser = IOSParser.parse("\ntest config")
9
+ expect(parser.find_all(name: "test").count).to eq 1
10
+ end
11
+ end
12
+
13
+ context 'with blank line in middle' do
14
+ it 'parses and extracts sections' do
15
+ parser = IOSParser.parse("preamble\n\ntest config")
16
+ expect(parser.find_all(name: "test").count).to eq 1
17
+ end
18
+ end
19
+
6
20
  context 'indented region' do
7
21
  let(:input) { <<-END.unindent }
8
22
  policy-map mypolicy_in
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ios_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Miller
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-13 00:00:00.000000000 Z
11
+ date: 2022-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -59,9 +59,9 @@ extensions:
59
59
  - ext/ios_parser/c_lexer/extconf.rb
60
60
  extra_rdoc_files: []
61
61
  files:
62
+ - ".github/workflows/ruby.yml"
62
63
  - ".gitignore"
63
64
  - ".rubocop.yml"
64
- - ".travis.yml"
65
65
  - CHANGELOG.md
66
66
  - CODE_OF_CONDUCT.md
67
67
  - Gemfile
@@ -103,14 +103,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
103
103
  requirements:
104
104
  - - ">="
105
105
  - !ruby/object:Gem::Version
106
- version: '0'
106
+ version: '2.0'
107
107
  required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - ">="
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
112
  requirements: []
113
- rubygems_version: 3.1.4
113
+ rubygems_version: 3.1.6
114
114
  signing_key:
115
115
  specification_version: 4
116
116
  summary: convert network switch and router config files to structured data
data/.travis.yml DELETED
@@ -1,17 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.0.0
4
- - 2.1.10
5
- - 2.2.10
6
- - 2.3.8
7
- - 2.4.5
8
- - 2.5.3
9
- - jruby-9.1.16.0
10
- - jruby-9.2.0.0
11
- matrix:
12
- include:
13
- - rvm: jruby
14
- env: JRUBY_OPTS='-Xcompat.version=2.0'
15
- bundler_args: --without guard
16
- before_install:
17
- - if [ "jruby" != "$TRAVIS_RUBY_VERSION" ]; then gem i rubygems-update -v '<3' && update_rubygems; gem install bundler -v 1.17.3 --without guard; fi