Class: BP::Emitter

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/bp/emitter.rb

Instance Method Summary collapse

Instance Method Details

#create(name) ⇒ Object



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
# File 'lib/bp/emitter.rb', line 15

def create(name)
  @name = name # need this for ERB template context
  github = BP::Github.new

  github.create_repo underscored_name

  puts 'Creating gem'
  `bueller #{name} --git-remote [email protected]:brighterplanet/#{underscored_name}.git`

  emitter_path = File.join(Dir.pwd, underscored_name)
  lib_path = File.join(emitter_path, 'lib')

  template 'base.rb.tt',
    File.join(lib_path, underscored_name + '.rb'),
    :force => true
  %w{characterization.rb.tt data.rb.tt impact_model.rb.tt relationships.rb.tt summarization.rb.tt}.each do |file|
    template file,
      File.join(lib_path, underscored_name, File.basename(file, '.tt'))
  end

  empty_directory File.join(Dir.pwd, 'log')
  create_file File.join(Dir.pwd, 'log', '.gitkeep')

  Dir.chdir emitter_path do
    puts `git add .`
    puts `git add log/.gitkeep`
    puts `git commit -m "#{name} skeleton"`
  end

  github.configure_hooks underscored_name
end

#lsObject



48
49
50
# File 'lib/bp/emitter.rb', line 48

def ls
  puts Cm1.emitters.map(&:underscore).join("\n")
end