Class: Lion::Installer
- Inherits:
-
Object
- Object
- Lion::Installer
- Defined in:
- lib/lion/installer.rb
Instance Method Summary collapse
- #copyFiles ⇒ Object
- #create ⇒ Object
- #error(string) ⇒ Object
-
#initialize(args, libdir) ⇒ Installer
constructor
Class for installing creating a new project in the current directory.
- #makeDir(name) ⇒ Object
- #message(string) ⇒ Object
Constructor Details
#initialize(args, libdir) ⇒ Installer
Class for installing creating a new project in the current directory
7 8 9 10 11 12 |
# File 'lib/lion/installer.rb', line 7 def initialize(args, libdir) @project_name = args[0] @current = Dir.pwd @lib = libdir args.index("--scss") ? @scss = true : @scss = false end |
Instance Method Details
#copyFiles ⇒ Object
26 27 28 29 |
# File 'lib/lion/installer.rb', line 26 def copyFiles FileUtils.cp_r "#{@lib}/src/.", "#{@current}/#{@project_name}/" ("New Lion project #{@project_name} successfully created in #{@current}/#{@project_name}/") end |
#create ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/lion/installer.rb', line 31 def create() STDOUT.puts "You selected SCSS option" if @scss unless File.directory?(@project_name) makeDir(@project_name) copyFiles() else ("That project already exists. Please try another name") end end |
#error(string) ⇒ Object
14 15 16 |
# File 'lib/lion/installer.rb', line 14 def error(string) STDERR.puts string end |
#makeDir(name) ⇒ Object
22 23 24 |
# File 'lib/lion/installer.rb', line 22 def makeDir(name) Dir.mkdir(@current + '/' + name) end |
#message(string) ⇒ Object
18 19 20 |
# File 'lib/lion/installer.rb', line 18 def (string) STDOUT.puts string end |