Class: Gravityframework::Installer
- Inherits:
-
Object
- Object
- Gravityframework::Installer
- Defined in:
- lib/gravityframework.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
9 10 11 12 13 14 |
# File 'lib/gravityframework.rb', line 9 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
28 29 30 31 |
# File 'lib/gravityframework.rb', line 28 def copyFiles FileUtils.cp_r "#{@lib}/gravityframework/src/.", "#{@current}/#{@project_name}/" ("New project #{@project_name} successfully created in #{@current}/#{@project_name}/") end |
#create ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/gravityframework.rb', line 33 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
16 17 18 |
# File 'lib/gravityframework.rb', line 16 def error(string) STDERR.puts string end |
#makeDir(name) ⇒ Object
24 25 26 |
# File 'lib/gravityframework.rb', line 24 def makeDir(name) Dir.mkdir(@current + '/' + name) end |
#message(string) ⇒ Object
20 21 22 |
# File 'lib/gravityframework.rb', line 20 def (string) STDOUT.puts string end |