Module: Jem::Build

Defined in:
lib/jem/build.rb

Class Method Summary collapse

Class Method Details

.build(project_name) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/jem/build.rb', line 12

def Build.build project_name
  return puts "Please specify a project name." if project_name == nil 
  
  if !File.exists? project_name
    print "* Building structure in directory: ./#{project_name}/\n" 
    options = {:verbose => true}
    print "\t=> " 
    FileUtils.mkdir_p './' + project_name+ '/lib/' + project_name, options
    FileUtils.cd project_name
    print "\t=> " 
    FileUtils.mkdir %w(test docs examples bin), options
    print "\t=> " 
    FileUtils.touch %w(LICENCE README CHANGELOG VERSION Rakefile), options
    print "\t=> " 
    FileUtils.touch project_name + '.gemspec', options
    FileUtils.cd 'lib' 
    print "\t=> " 
    FileUtils.touch project_name + '.rb', options
    puts "* Done."
  else
    print "Directory \"#{project_name}\" already exists.\n"
  end
end

.command_line_optionsObject



36
37
38
39
40
41
42
# File 'lib/jem/build.rb', line 36

def Build.command_line_options
  opts = Trollop::options do
    opt :build, "Initialise directory structure.E.g. jem --build project_name."
    opt :help,  "You're here."
  end
  return opts
end

.execute(project_name) ⇒ Object



8
9
10
# File 'lib/jem/build.rb', line 8

def Build.execute project_name  
  build project_name[0] if command_line_options[:build] 
end