Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

Commit

Permalink
resolve issue #6
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Lesiak committed Dec 8, 2015
1 parent faa712b commit 06f2477
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 37 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
lib/acirb/*.rb
lib/autoloadmap.rb
lib/lookup.rb
lib/acirb/model/*.rb
lib/acirb/autoloadmap.rb
lib/acirb/lookup.rb
*.gem
coverage
pysdk
Expand Down
2 changes: 1 addition & 1 deletion acirb.spec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require './lib/version'
require './lib/acirb/version'

Gem::Specification.new do |s|
s.name = 'acirb'
Expand Down
14 changes: 7 additions & 7 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
echo 'Generating ruby model'
python genrubyfrompy.py
echo 'Building gem'
gem build acirb.spec
echo "Generating ruby model"
python genrubyfrompy.py || (echo "Failed to generate ruby model"; exit 1)
echo "Building gem"
gem build acirb.spec || (echo "Failed to build gem"; exit 1)
cp -v *.gem gems
echo 'Installing gem'
version=$(ruby -e "require './lib/version'; puts ACIrb::VERSION")
sudo gem install --no-ri --no-rdoc acirb-${version}.gem
version=$(ruby -e "require './lib/acirb/version'; puts ACIrb::VERSION")
echo "Generated gem for $version"
# sudo gem install --no-ri --no-rdoc acirb-${version}.gem
2 changes: 1 addition & 1 deletion examples/acidashboard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ sudo apt-get install ruby-dev ruby-libxml zlib1g-dev nodejs
Or, just run the following at your terminal.
**Note**: you may need to prefix this with sudo depending on your installation
```
gem install dashing bundle
gem install dashing bundler
gem install acirb
```
- Change into the acirb/examples/acidashboard folder
Expand Down
18 changes: 6 additions & 12 deletions genrubyfrompy.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def rn

def getRubyPackage(classDef):
rubyCode = Template("""# auto-generated code
require 'mo'
require 'acirb/mo'
module ACIrb
$rubyClasses
end
Expand All @@ -175,7 +175,7 @@ def getRubyPackage(classDef):

def getRubyAutoLoad(autoLoaderMap):

rubyAutoLoad = '\n'.join([' ACIrb.autoload(\'{0}\', \'acirb/{1}\')'.format(
rubyAutoLoad = '\n'.join([' ACIrb.autoload(\'{0}\', \'acirb/model/{1}\')'.format(
rubyClass, rubyFile) for rubyClass, rubyFile in autoLoaderMap.items()])

rubyCode = Template("""# auto-generated code
Expand Down Expand Up @@ -231,8 +231,7 @@ def generateRuby(classdir):
directory = os.path.join(
os.path.abspath(
os.path.dirname(__file__)),
'lib',
'acirb')
'lib', 'acirb', 'model')

if not os.path.exists(directory):
os.makedirs(directory)
Expand All @@ -247,10 +246,7 @@ def generateRuby(classdir):
fileName = os.path.join(
os.path.abspath(
os.path.dirname(__file__)),
'lib',
'acirb',
pkgname +
'.rb')
'lib', 'acirb', 'model', pkgname + '.rb')

# Create the package
with open(fileName, 'w') as f:
Expand All @@ -261,17 +257,15 @@ def generateRuby(classdir):
fileName = os.path.join(
os.path.abspath(
os.path.dirname(__file__)),
'lib',
'lookup.rb')
'lib', 'acirb', 'lookup.rb')
with open(fileName, 'w') as f:
f.write(getRubyClassMap(classMap))

# Create the autoloader
fileName = os.path.join(
os.path.abspath(
os.path.dirname(__file__)),
'lib',
'autoloadmap.rb')
'lib', 'acirb', 'autoloadmap.rb')
with open(fileName, 'w') as f:
f.write(getRubyAutoLoad(autoLoaderMap))

Expand Down
18 changes: 9 additions & 9 deletions lib/acirb.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
require 'autoloadmap'
require 'loader'
require 'lookup'
require 'mo'
require 'naming'
require 'restclient'
require 'version'
require 'query'
require 'events'
require 'acirb/autoloadmap'
require 'acirb/loader'
require 'acirb/lookup'
require 'acirb/mo'
require 'acirb/naming'
require 'acirb/restclient'
require 'acirb/version'
require 'acirb/query'
require 'acirb/events'

module ACIrb
end
2 changes: 1 addition & 1 deletion lib/events.rb → lib/acirb/events.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'restclient'
require 'acirb/restclient'
require 'websocket'
require 'socket'
require 'openssl'
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/mo.rb → lib/acirb/mo.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'restclient'
require 'acirb/restclient'
require 'rexml/document'
require 'json'

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/query.rb → lib/acirb/query.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'restclient'
require 'acirb/restclient'

# rubocop:disable ClassLength
# rubocop:disable FormatString
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion spec/spec_naming.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
end

it 'Nested: Have a rn where it doesn\'t belong' do
expect { ACIrb::Naming.get_mo_from_dn('uni/epg-common') }.to raise_error
expect { ACIrb::Naming.get_mo_from_dn('uni/epg-common') }.to raise_error(RuntimeError)
end

it 'Complex Dn' do
Expand Down

0 comments on commit 06f2477

Please sign in to comment.