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



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
61
62
# File 'lib/junebug/generator.rb', line 10

def generate(args)
  if args.empty? || (args[0] == '-h') || (args[0] == '--help')
    puts <<END
Usage: junebug [options|wikiname]

Options:
  -v, --version    Display version
  -h, --help       Display this page

END
    return
  end
  
  if (args[0] == '-v') || (args[0] == '--version')
    puts "Junebug v#{Junebug::VERSION}"
    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 <<EOS

***********************************

Welcome to Junebug!

To start your new wiki, do the following:

> cd #{app}
> ./wiki run

Open your browser to http://#{Junebug.config['host']}:#{Junebug.config['port']}#{Junebug.config['sitepath']}

Your admin account is:

username: #{user.username}
password: #{user.password}

For more information about running and configuring Junebug,
go to http://www.junebugwiki.com

Submit bug reports to [email protected]

EOS
end