Class: Transcriptic::ProjectGenerator

Inherits:
BaseGenerator
  • Object
show all
Defined in:
lib/transcriptic/project_generator.rb

Instance Method Summary collapse

Methods inherited from BaseGenerator

source_root

Instance Method Details

#authorObject



61
62
63
# File 'lib/transcriptic/project_generator.rb', line 61

def author
  options[:author]
end

#author?Boolean

Returns:

  • (Boolean)


69
70
71
# File 'lib/transcriptic/project_generator.rb', line 69

def author?
  not (options[:author] == "John Appleseed")
end

#autoprotocol_versionObject



45
46
47
# File 'lib/transcriptic/project_generator.rb', line 45

def autoprotocol_version
  Transcriptic::AUTOPROTOCOL_VERSION
end


73
74
75
# File 'lib/transcriptic/project_generator.rb', line 73

def copyright_year
  Time.now.year
end

#descriptionObject



49
50
51
# File 'lib/transcriptic/project_generator.rb', line 49

def description
  options[:description]
end

#emailObject



65
66
67
# File 'lib/transcriptic/project_generator.rb', line 65

def email
  options[:email]
end

#generateObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/transcriptic/project_generator.rb', line 23

def generate
  empty_directory target.join('app')
  empty_directory target.join('project')

  version

  template 'app/Main.erb', target.join('app/Main.scala')
  template 'project/Build.erb', target.join('project/Build.scala')
  copy_file 'project/build.properties', target.join('project/build.properties')
  copy_file 'project/plugins.sbt', target.join('project/plugins.sbt')
  copy_file 'README.md', target.join('README.md')
  template 'LICENSE.erb', target.join('LICENSE')
  template 'Labfile.erb', target.join('Labfile')

  Transcriptic::DependenciesGenerator.new([File.join(Dir.pwd, name), []], options).invoke_all
end

#groupObject



53
54
55
# File 'lib/transcriptic/project_generator.rb', line 53

def group
  options[:group]
end

#update_build_version(labfile) ⇒ Object



40
41
42
43
# File 'lib/transcriptic/project_generator.rb', line 40

def update_build_version(labfile)
  @version = labfile.options[:version]
  template 'project/Build.erb', target.join('project/Build.scala'), force: true
end

#versionObject



57
58
59
# File 'lib/transcriptic/project_generator.rb', line 57

def version
  @version = options[:version]
end