Skip to content

Commit

Permalink
Merge branch 'release/0.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
yasuhito committed Mar 9, 2015
2 parents f527e63 + f729762 commit 39dedab
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
## develop (unreleased)


## 0.2.2 (3/9/2015)
### New features
* Add `mac` attribute to vhost.


## 0.2.0 (3/2/2015)
### New features
* [#19](https://github.com/trema/phut/pull/19): Add `bin/vhost`.
Expand Down
3 changes: 2 additions & 1 deletion lib/phut/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ def add_vswitch(name, attrs)

def add_vhost(name, attrs)
check_name_conflict name
@all[name] = Vhost.new(attrs[:ip], attrs[:promisc], name, @logger)
@all[name] =
Vhost.new(attrs[:ip], attrs[:mac], attrs[:promisc], name, @logger)
end

# This method smells of :reek:LongParameterList
Expand Down
7 changes: 6 additions & 1 deletion lib/phut/syntax.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def generate
UnusedIpAddressSingleton = UnusedIpAddress.new

def initialize(alias_name, &block)
@attributes = { name: alias_name }
@attributes =
{ name: alias_name, mac: Pio::Mac.new(rand(0xffffffffffff + 1)) }
if block
instance_eval(&block) if block
else
Expand All @@ -57,6 +58,10 @@ def ip(value)
@attributes[:name] ||= value
end

def mac(value)
@attributes[:mac] = value
end

def promisc(on_off)
@attributes[:promisc] = on_off
end
Expand Down
2 changes: 1 addition & 1 deletion lib/phut/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Base module.
module Phut
VERSION = '0.2.1'
VERSION = '0.2.2'
end
5 changes: 3 additions & 2 deletions lib/phut/vhost.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ class Vhost
attr_reader :mac_address
attr_accessor :interface

def initialize(ip_address, promisc, name = nil, logger = NullLogger.new)
def initialize(ip_address, mac_address, promisc,
name = nil, logger = NullLogger.new)
@ip_address = ip_address
@promisc = promisc
@name = name
@mac_address = Pio::Mac.new(rand(0xffffffffffff + 1))
@mac_address = mac_address
@logger = logger
end

Expand Down
4 changes: 2 additions & 2 deletions phut.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Gem::Specification.new do |gem|
gem.required_ruby_version = '>= 2.0.0'

gem.add_dependency 'gli', '~> 2.13.0'
gem.add_dependency 'pio', '~> 0.17.0'
gem.add_dependency 'pio', '~> 0.18.0'
gem.add_dependency 'pry', '~> 0.10.1'

# Docs
Expand All @@ -37,7 +37,7 @@ Gem::Specification.new do |gem|
gem.add_development_dependency 'byebug', '~> 3.5.1'
gem.add_development_dependency 'guard', '~> 2.12.4'
gem.add_development_dependency 'guard-bundler', '~> 2.1.0'
gem.add_development_dependency 'guard-cucumber', '~> 1.5.3'
gem.add_development_dependency 'guard-cucumber', '~> 1.5.4'
gem.add_development_dependency 'guard-rspec', '~> 4.5.0'
gem.add_development_dependency 'guard-rubocop', '~> 1.2.0'

Expand Down

0 comments on commit 39dedab

Please sign in to comment.