Skip to content

Commit

Permalink
Make Cangallo a class instead of a module
Browse files Browse the repository at this point in the history
  • Loading branch information
jfontan committed Mar 19, 2016
1 parent c1f1e2b commit 6dc3587
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 13 deletions.
10 changes: 4 additions & 6 deletions bin/canga
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ require "tempfile"

require "pp"

include Cangallo

$config = Config.new
$config = Cangallo::Config.new

class Canga < Thor
class_option :repo, :desc => 'repository to use'
Expand All @@ -24,7 +22,7 @@ class Canga < Thor
option :parent, :desc => "id of the parent image"
def create(file, size=nil)
puts [file, size]
Qcow2.create(file, options[:parent], size)
Cangallo::Qcow2.create(file, options[:parent], size)
end

desc "add FILE", "add a new file to the repository"
Expand Down Expand Up @@ -113,7 +111,7 @@ class Canga < Thor

path = File.expand_path(repo.image_path(sha256))

Qcow2.create_from_base(path, file)
Cangallo::Qcow2.create_from_base(path, file)
end

desc "build CANGAFILE", "create a new image using a Cangafile"
Expand All @@ -136,7 +134,7 @@ class Canga < Thor
temp_image = Tempfile.new([File.basename(file), '.qcow2'], repo.path)
temp_image.close

Qcow2.create_from_base(parent_path, temp_image.path)
Cangallo::Qcow2.create_from_base(parent_path, temp_image.path)

rc = LibGuestfs.virt_customize(temp_image.path, cangafile.libguestfs_commands)
exit(-1) if !rc
Expand Down
2 changes: 1 addition & 1 deletion lib/cangallo/cangafile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
require 'fileutils'
require 'yaml'

module Cangallo
class Cangallo

class Cangafile
attr_accessor :data
Expand Down
4 changes: 2 additions & 2 deletions lib/cangallo/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'fileutils'
require 'yaml'

module Cangallo
class Cangallo
class Config
CONFIG_DIR = '.cangallo'
CONFIG_FILE = 'config.yaml'
Expand All @@ -17,7 +17,7 @@ class Config

def initialize
create_config_dir
create_default_config
create_default_config
load_conf
end

Expand Down
2 changes: 1 addition & 1 deletion lib/cangallo/keybase.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# vim:tabstop=2:sw=2:et:

module Cangallo
class Cangallo

module Keybase
def self.sign(file)
Expand Down
2 changes: 1 addition & 1 deletion lib/cangallo/libguestfs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
require 'tempfile'
require 'fileutils'

module Cangallo
class Cangallo

class LibGuestfs
def self.virt_customize(image, commands)
Expand Down
2 changes: 1 addition & 1 deletion lib/cangallo/qcow2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
require 'tempfile'
require 'fileutils'

module Cangallo
class Cangallo

class Qcow2
attr_reader :path
Expand Down
2 changes: 1 addition & 1 deletion lib/cangallo/repo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# vim:ts=2:sw=2

module Cangallo
class Cangallo

class Repo
attr_reader :images, :tags, :path, :name
Expand Down

0 comments on commit 6dc3587

Please sign in to comment.