Class: Clayburn

Inherits:
Object
  • Object
show all
Defined in:
lib/clayburn-gen.rb

Instance Method Summary collapse

Instance Method Details

#app(name) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/clayburn-gen.rb', line 9

def app(name)
  generate_path = File.join(Dir.pwd,name)    
  template_path = File.join(File.dirname(__FILE__),'templates/clayburn-app')
  
  if File.exist?(generate_path)
    puts "error: a file or directory called #{name} already exists."
  else
    # copies templates
    ::FileUtils.cp_r(template_path, generate_path)
    if File.exist?(generate_path)
      puts "\nGenerating with clayburn generator:"
      puts "     [ADDED]  clayburn.sh"
      puts "     [ADDED]  127.0.0.1/js/"
      puts "     [ADDED]  127.0.0.1/js/bootstrap.js"
      puts "     [ADDED]  127.0.0.1/js/config.js"
      puts "     [ADDED]  127.0.0.1/js/controller.js"
      puts "     [ADDED]  127.0.0.1/js/exception.js"
      puts "     [ADDED]  127.0.0.1/js/model.js"
      puts "     [ADDED]  127.0.0.1/web/"
      puts "     [ADDED]  127.0.0.1/web/public/"
      puts "     [ADDED]  127.0.0.1/web/public/logo.png"
      puts "     [ADDED]  127.0.0.1/web/public/master.css"
      puts "     [ADDED]  127.0.0.1/web/views/"
      puts "     [ADDED]  127.0.0.1/web/views/home/"
      puts "     [ADDED]  127.0.0.1/web/views/home/index.html"                
      puts "     [ADDED]  127.0.0.1/web/views/exception/"
      puts "     [ADDED]  127.0.0.1/web/views/exception/general.html"
      puts "     [ADDED]  127.0.0.1/web/views/exception/notfound.html"                
      puts "     [ADDED]  127.0.0.1/web/layouts/"
      puts "     [ADDED]  127.0.0.1/web/layouts/application.html"        
    end
    
    # git init
    if `cd #{generate_path}/127.0.0.1 && git init && git add . && git commit -am "initial commit by clayburn generator"`
      puts "     [GIT]    init"
      puts "     [GIT]    add ."
      puts "     [GIT]    commit -m \"initial commit by clayburn generator\""
    end
    
    # submodule clayburn
    if `cd #{generate_path}/127.0.0.1 && git submodule add git://github.com/silentrob/clayburn.git js/clayburn && git add . && git commit -am "added clayburn as a git submodule"`
      puts "     [GIT]    submodule add git://github.com/silentrob/clayburn.git js/clayburn"
      puts "     [GIT]    add ."
      puts "     [GIT]    commit -m \"added clayburn as a git submodule\""
    end
  end
end

#flat(name) ⇒ Object



57
58
59
60
61
62
# File 'lib/clayburn-gen.rb', line 57

def flat(name)
  puts "\nGenerating a new FLAT Clayburn Application called #{name}\n\n"
  generate_path = File.join(Dir.pwd,name)    
  puts generate_path
  # FileUtils.mkdir(name)
end

#generate(name) ⇒ Object



64
65
66
67
68
69
70
# File 'lib/clayburn-gen.rb', line 64

def generate(name)
  
  generate_path = File.join(Dir.pwd,name)    
  puts "in Generate #{name}"

  #FileUtils.mkdir_p(path_to_build)
end

#versionObject



5
6
7
# File 'lib/clayburn-gen.rb', line 5

def version
  '0.0.2'
end