bigip_parse 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f646776213eaca72dff21f8587089aa7a665286f
4
+ data.tar.gz: be7fa9e2b3288672341a34117fad0d8429fce04a
5
+ SHA512:
6
+ metadata.gz: 9f6748f0322dceb3e600b46d53740f586bf7cc336b9482601485327f82d9d49b3d07606c4880275bfd1f395a933b1592966bdc1768866dc7b19d20d7acffa38f
7
+ data.tar.gz: 8742032f7ef19e98c731a28a73151302570de5629e6968c110e1fa6b87641c2154af26d0aef1818e2ca73d7459609466377d036357591f6b3172a6ed4a51dd1f
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ before_install: gem install bundler -v 1.10.6
5
+ script:
6
+ - bundle exec rspec
7
+ - bundle exec rubocop
8
+ - bundle exec rake build
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bigip_parse.gemspec
4
+ gemspec
@@ -0,0 +1,41 @@
1
+ # BigipParse
2
+
3
+ Simple gem to parse BIG IP configs
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'bigip_parse'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install bigip_parse
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Development
26
+
27
+ After checking out the repo, run `bin/setup` to install dependencies.
28
+ Then, run `rake false` to run the tests. You can also run `bin/console`
29
+ for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`.
32
+ To release a new version, update the version number in `version.rb`, and
33
+ then run `bundle exec rake release`, which will create a git tag for the
34
+ version, push git commits and tags, and push the `.gem` file to
35
+ [rubygems.org](https://rubygems.org).
36
+
37
+ ## Contributing
38
+
39
+ Bug reports and pull requests are welcome on GitHub at
40
+ https://github.com/jonstacks13/bigip_parse.
41
+
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bigip_parse/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'bigip_parse'
8
+ spec.version = BigIParse::VERSION
9
+ spec.authors = ['Jonathan Stacks']
10
+ spec.email = ['jonstacks13@gmail.com']
11
+
12
+ spec.summary = 'Simple library to parse BIG IP configurations'
13
+ spec.description = spec.summary
14
+ spec.homepage = 'https://github.com/jonstacks13/bigip_parse'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
18
+ end
19
+ spec.bindir = 'exe'
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ['lib']
22
+
23
+ spec.add_runtime_dependency 'activesupport', '~> 4.2'
24
+
25
+ spec.add_development_dependency 'bundler', '~> 1.10'
26
+ spec.add_development_dependency 'pry', '~> 0.10'
27
+ spec.add_development_dependency 'rake', '~> 10.0'
28
+ spec.add_development_dependency 'rspec', '~> 3.3'
29
+ spec.add_development_dependency 'rubocop', '~> 0.34'
30
+ end
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'bigip_parse'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ require 'pry'
11
+ Pry.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,2 @@
1
+ require 'bigip_parse/version'
2
+ require 'bigip_parse/config'
@@ -0,0 +1,55 @@
1
+ require 'active_support/core_ext/string'
2
+
3
+ module BigIParse
4
+ # Class for working with BIG IP Configs
5
+ class Config
6
+ # Class to represent a section of a config file
7
+ class Section
8
+ attr_reader :header
9
+
10
+ REGEX = /
11
+ ^(?<header>([^\s{}#]+[ ]?)+) # Header definition
12
+ ({ # Opening bracket
13
+ (?<content>( # Optional content capture everything
14
+ [^\n]*(?=\s}) # not a new-line followed by space bracket
15
+ | # OR
16
+ .*?(?=^}) # everything then closing bracket
17
+ )
18
+ )
19
+ )? # Make content capture optional
20
+ /mx
21
+
22
+ def initialize(header, content = nil)
23
+ @header = header
24
+ @content = content
25
+ end
26
+
27
+ def content
28
+ return nil if @content.nil?
29
+ return nil if @content.strip.empty?
30
+ @content.strip_heredoc.lstrip
31
+ end
32
+
33
+ def subsections?
34
+ !content.nil?
35
+ end
36
+
37
+ def subsections
38
+ return [] if content.nil?
39
+ content.scan(REGEX).map { |h, c| self.class.new(h.strip, c) }
40
+ end
41
+
42
+ def to_s
43
+ "#{self.class.name}(header=#{header}, content=#{content})"
44
+ end
45
+ end
46
+
47
+ def initialize(str)
48
+ @config = Section.new(nil, str)
49
+ end
50
+
51
+ def subsections
52
+ @config.subsections
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,4 @@
1
+ # The BigIParse module!
2
+ module BigIParse
3
+ VERSION = '0.1.0'
4
+ end
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bigip_parse
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jonathan Stacks
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-10-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '4.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '4.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.10'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.10'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '0.10'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '0.10'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '3.3'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '3.3'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: '0.34'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: '0.34'
97
+ description: Simple library to parse BIG IP configurations
98
+ email:
99
+ - jonstacks13@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - .gitignore
105
+ - .rspec
106
+ - .travis.yml
107
+ - Gemfile
108
+ - README.md
109
+ - Rakefile
110
+ - bigip_parse.gemspec
111
+ - bin/console
112
+ - bin/setup
113
+ - lib/bigip_parse.rb
114
+ - lib/bigip_parse/config.rb
115
+ - lib/bigip_parse/version.rb
116
+ homepage: https://github.com/jonstacks13/bigip_parse
117
+ licenses: []
118
+ metadata: {}
119
+ post_install_message:
120
+ rdoc_options: []
121
+ require_paths:
122
+ - lib
123
+ required_ruby_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - '>='
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - '>='
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ requirements: []
134
+ rubyforge_project:
135
+ rubygems_version: 2.4.8
136
+ signing_key:
137
+ specification_version: 4
138
+ summary: Simple library to parse BIG IP configurations
139
+ test_files: []