lxc-ruby 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # LXC Ruby Wrapper
2
2
 
3
- Ruby wrapper to [LXC](http://lxc.sourceforge.net/) cli tools.
4
-
5
- Provides a simple ruby dsl and json API to manage containers.
3
+ Ruby wrapper to [Linux Containers](http://lxc.sourceforge.net/) CLI tools
6
4
 
7
5
  ## Build status
8
6
 
@@ -19,15 +17,20 @@ Supported LXC versions:
19
17
  - 0.8.0-rc2 - in works
20
18
 
21
19
  For testing purposes you can use [Vagrant](http://vagrantup.com/) or [VirtualBox](https://www.virtualbox.org/). Most of functionality
22
- was tested on Ubuntu 11.04 / 11.10. Additional boxes could be found [here](http://www.vagrantbox.es/)
20
+ was tested on Ubuntu 11.x / 12.04. Additional boxes could be found [here](http://www.vagrantbox.es/)
23
21
 
24
22
  ## Installation
25
23
 
26
- As for now this gem is not released yet, so use gem install task:
24
+ Add it to your `Gemfile`:
25
+
26
+ ```
27
+ gem 'lxc-ruby'
28
+ ```
29
+
30
+ Or install it manually:
27
31
 
28
32
  ```
29
- rake build
30
- rake install
33
+ gem install lxc-ruby
31
34
  ```
32
35
 
33
36
  ## Usage
@@ -134,7 +137,7 @@ rake test
134
137
 
135
138
  ## License
136
139
 
137
- Copyright (c) 2012 Dan Sosedoff.
140
+ Copyright (c) 2012-2013 Dan Sosedoff.
138
141
 
139
142
  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:
140
143
 
data/lib/lxc/container.rb CHANGED
@@ -130,7 +130,7 @@ module LXC
130
130
  unless File.exists?(template_path)
131
131
  raise ArgumentError, "Template #{path[:template]} does not exist."
132
132
  end
133
- args += " -t #{path[:template]}"
133
+ args += " -t #{path[:template]} "
134
134
  end
135
135
 
136
136
  args += " -B #{path[:backingstore]}" if !!path[:backingstore]
@@ -216,4 +216,4 @@ module LXC
216
216
  }
217
217
  end
218
218
  end
219
- end
219
+ end
data/lib/lxc/shell.rb CHANGED
@@ -43,6 +43,9 @@ module LXC
43
43
  'FROZEN'
44
44
  ]
45
45
 
46
+ # Terminal command to strip all special color symbols
47
+ REMOVE_COLORS = 'sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"'
48
+
46
49
  @@use_sudo = false
47
50
 
48
51
  # Check if LXC is using sudo to run commands
data/lib/lxc/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module LXC
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
data/lib/lxc.rb CHANGED
@@ -10,7 +10,7 @@ module LXC
10
10
  include LXC::Shell
11
11
 
12
12
  # Check if binary file is installed
13
- # @param [String] name binary filename
13
+ # @param [String] binary filename
14
14
  # @return [Boolean] true if installed
15
15
  def binary_installed?(name)
16
16
  path = File.join(LXC::Shell::BIN_PREFIX, name)
@@ -26,7 +26,7 @@ module LXC
26
26
  # Get LXC configuration info
27
27
  # @return [Hash] hash containing config groups
28
28
  def config
29
- str = LXC.run('checkconfig') { 'sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"' }
29
+ str = LXC.run('checkconfig') { LXC::Shell::REMOVE_COLORS }
30
30
  data = str.scan(/^([\w\s]+): (enabled|disabled)$/).map { |r|
31
31
  [r.first.downcase.gsub(' ', '_'), r.last == 'enabled']
32
32
  }
@@ -34,14 +34,14 @@ module LXC
34
34
  end
35
35
 
36
36
  # Get container information record
37
- # @param [name] name container name
37
+ # @param [name] container name
38
38
  # @return [LXC::Container] container instance
39
39
  def container(name)
40
40
  LXC::Container.new(name)
41
41
  end
42
42
 
43
43
  # Get a list of all available containers
44
- # @param [String] filter select containers that match string
44
+ # @param [String] select containers that match string
45
45
  # @return [Array] array of LXC::Containers
46
46
  def containers(filter=nil)
47
47
  names = LXC.run('ls').split("\n").uniq
data/lxc.gemspec CHANGED
@@ -5,7 +5,7 @@ Gem::Specification.new do |s|
5
5
  s.version = LXC::VERSION
6
6
  s.summary = "Ruby wrapper to LXC"
7
7
  s.description = "Ruby wrapper to manage LXC (Linux Containers)."
8
- s.homepage = "http://github.com/sosedoff/lxc"
8
+ s.homepage = "http://github.com/sosedoff/lxc-ruby"
9
9
  s.authors = ["Dan Sosedoff"]
10
10
  s.email = ["dan.sosedoff@gmail.com"]
11
11
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lxc-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-28 00:00:00.000000000Z
12
+ date: 2013-01-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &2152032520 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2152032520
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: rspec
27
- requirement: &2152032020 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '2.6'
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *2152032020
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '2.6'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: simplecov
38
- requirement: &2152031520 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ~>
@@ -43,7 +53,12 @@ dependencies:
43
53
  version: '0.4'
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *2152031520
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '0.4'
47
62
  description: Ruby wrapper to manage LXC (Linux Containers).
48
63
  email:
49
64
  - dan.sosedoff@gmail.com
@@ -75,7 +90,7 @@ files:
75
90
  - spec/fixtures/lxc-version.txt
76
91
  - spec/lxc_spec.rb
77
92
  - spec/spec_helper.rb
78
- homepage: http://github.com/sosedoff/lxc
93
+ homepage: http://github.com/sosedoff/lxc-ruby
79
94
  licenses: []
80
95
  post_install_message:
81
96
  rdoc_options: []
@@ -95,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
110
  version: '0'
96
111
  requirements: []
97
112
  rubyforge_project:
98
- rubygems_version: 1.8.15
113
+ rubygems_version: 1.8.23
99
114
  signing_key:
100
115
  specification_version: 3
101
116
  summary: Ruby wrapper to LXC
@@ -110,4 +125,3 @@ test_files:
110
125
  - spec/fixtures/lxc-version.txt
111
126
  - spec/lxc_spec.rb
112
127
  - spec/spec_helper.rb
113
- has_rdoc: