Skip to content
Browse files

added surrounding stuff like readme/todo/examples/license

  • Loading branch information...
1 parent 83250ac commit a5405e1629ec81d8e168e7791a80692cfab00670 @bsingr bsingr committed
Showing with 80 additions and 0 deletions.
  1. +20 −0 MIT-LICENSE
  2. +37 −0 README.md
  3. +10 −0 TODO.md
  4. +7 −0 examples/connectivity.rb
  5. +6 −0 examples/list_ips.rb
View
20 MIT-LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2011 Jens Bissinger
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
37 README.md
@@ -0,0 +1,37 @@
+# NetworkManager-Ruby
+
+This library provides a Ruby API to NetworkManager using its DBus Interface.
+
+## Installation
+
+Please make sure that you have `dbus` and `networkmanager` installed on the machine
+were you want to use this library. Remote DBus wasn't tested.
+
+ gem install networkmanager
+
+## Examples
+
+At the moment this is incomplete. So for now,
+please have a look at the `examples` folder and the `specs`.
+
+ require 'networkmanager'
+ NetworkManager.devices.first['Interface'] # => 'eth0' or something similar
+ NetworkManager.settings.hostname # => 'your.host.name'
+
+## Development
+
+Development currently happens from my OSX machine where no dbus/networkmanager
+is running. Therefore, i hacked some scripts together to be able to run rspec
+over the wire
+
+On the remote-machine (linux, dbus, networkmanager)
+
+ `script/spec_server`
+
+On the local-machine (osx)
+
+ `guard`
+
+# License
+
+Please see file `MIT-LICENSE`. Copyright 2011 Jens Bissinger.
View
10 TODO.md
@@ -0,0 +1,10 @@
+# TODOs
+
+* more specs :)
+* make the specs run without actual dbus connection
+ * mock networkmanager dbus api
+ * maybe travisci
+* add missing interfaces
+ * different device types
+ * vpn
+ * ...
View
7 examples/connectivity.rb
@@ -0,0 +1,7 @@
+require File.join(File.expand_path(File.dirname(__FILE__)), '../lib/network_manager')
+
+puts "Internet Connection: #{NetworkManager.internet_connection? ? 'yes' : 'no'}"
+
+puts "States are described as NM_STATE_... in NetworkManager::DBus::Root"
+puts "State is == #{NetworkManager::DBus::Root.instance.object.state}"
+
View
6 examples/list_ips.rb
@@ -0,0 +1,6 @@
+require File.join(File.expand_path(File.dirname(__FILE__)), '../lib/network_manager')
+
+# list ipv4 addresses for each device
+NetworkManager.devices.each do |device|
+ puts " #{device['Interface']} | #{device.ip4_address}"
+end

0 comments on commit a5405e1

Please sign in to comment.
Something went wrong with that request. Please try again.