Module: Junebug::Generator

Extended by:
Generator
Included in:
Generator
Defined in:
lib/junebug/generator.rb

Instance Method Summary collapse

Instance Method Details

#generate(args) ⇒ Object



8
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
56
57
58
59
60
# File 'lib/junebug/generator.rb', line 8

def generate(args)
  if args.empty? || (args[0] == '-h') || (args[0] == '--help')
    puts "Usage: junebug [options|wikiname]\n\nOptions:\n  -v, --version    Display version\n  -h, --help       Display this page\n\n"
    return
  end
  
  if (args[0] == '-v') || (args[0] == '--version')
    puts "Junebug v#{Junebug::VERSION::STRING}"
    return
  end
  
  src_root = File.dirname(__FILE__) + '/../../deploy'
  app = ARGV.first
  FileUtils.cp_r(src_root, app)
  FileUtils.chmod(0755, app+'/wiki')
  FileUtils.cd app
  Junebug.connect
  Junebug.create
  
  user = Junebug::Models::User.find(1)
  
  puts "\n***********************************\n\nWelcome to Junebug!\n\nTo start your new wiki, do the following:\n\n> cd \#{app}\n> ruby wiki run\n\nOpen your browser to http://\#{Junebug.config['host']}:\#{Junebug.config['port']}\#{Junebug.config['sitepath']}\n\nYour admin account is:\n\nusername: \#{user.username}\npassword: \#{user.password}\n\nFor more information about running and configuring Junebug,\ngo to http://www.junebugwiki.com\n\nSubmit bug reports to [email protected]\n\n"
end