Class: Dojo::Commands::Dojofy

Inherits:
Object
  • Object
show all
Includes:
Errors
Defined in:
lib/dojo-pkg.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDojofy

Constructor doesn’t do a whole lot :)



18
19
20
# File 'lib/dojo-pkg.rb', line 18

def initialize
  _init_self
end

Instance Attribute Details

#dojo_srcObject (readonly)

Returns the value of attribute dojo_src.



15
16
17
# File 'lib/dojo-pkg.rb', line 15

def dojo_src
  @dojo_src
end

#install_baseObject (readonly)

Returns the value of attribute install_base.



15
16
17
# File 'lib/dojo-pkg.rb', line 15

def install_base
  @install_base
end

#install_dirObject (readonly)

Returns the value of attribute install_dir.



15
16
17
# File 'lib/dojo-pkg.rb', line 15

def install_dir
  @install_dir
end

Class Method Details

.installObject

Setup and install dojo



58
59
60
61
# File 'lib/dojo-pkg.rb', line 58

def Dojofy.install
  cmd = new
  cmd.install
end

Instance Method Details

#copyObject

Copy the dojo source files to the install_dir



23
24
25
# File 'lib/dojo-pkg.rb', line 23

def copy
  FileUtils.cp_r @dojo_src, @install_dir
end

#installObject

Setup and install dojo



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/dojo-pkg.rb', line 43

def install
  begin
    setup
  rescue Exception => e
    raise DojofyError.new("setup failed: #{e.message}")
  end
  
  begin
    copy
  rescue Exception => e
    raise DojofyError.new("copy failed: #{e.message}")
  end
end

#setupObject

Assert that we are installing into a rails app Assert that we are not overwritting a previous dojo install



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/dojo-pkg.rb', line 29

def setup
  if !File.directory? @install_base
    # TODO: give user the option of another directory.
    # For now just blow up so we know something happened.
    raise Exception.new("Invalid install destination: #{@install_base}")
  end
  
  # Check to make sure that the installation directory doesn't already exist
  if File.exists? @install_dir
    raise Exception.new("Installation directory already exists: #{@install_dir}")
  end
end