Class: Nrb::Commands::Script

Inherits:
Base
  • Object
show all
Defined in:
lib/nrb/commands/script.rb

Instance Method Summary collapse

Methods inherited from Base

#opts, source_root

Instance Method Details

#bootObject



51
52
53
# File 'lib/nrb/commands/script.rb', line 51

def boot
  template 'templates/config/boot.rb.tt', target('config/boot.rb'), opts
end

#bundle_installObject



74
75
76
77
78
79
80
81
82
83
84
# File 'lib/nrb/commands/script.rb', line 74

def bundle_install
  return unless options[:bundle_install]

  inside target, opts do
    Bundler.with_clean_env do
      Nrb.silently verbose: options[:verbose] do
        run 'bundle install'
      end
    end
  end
end

#config_nrbObject



40
41
42
43
# File 'lib/nrb/commands/script.rb', line 40

def config_nrb
  template 'templates/config/nrb.rb.tt', target('config/nrb.rb'),
    opts.merge({ resources: Nrb.config.resources })
end

#db_configObject



55
56
57
58
# File 'lib/nrb/commands/script.rb', line 55

def db_config
  template 'templates/db/config.yml.tt', target('db/config.yml'),
    opts.merge({ db: name })
end

#gemfileObject



31
32
33
34
# File 'lib/nrb/commands/script.rb', line 31

def gemfile
  template 'templates/Gemfile.tt', target('Gemfile'),
    opts.merge({ nrb_gem: nrb_gem })
end

#gitignoreObject



22
23
24
# File 'lib/nrb/commands/script.rb', line 22

def gitignore
  template 'templates/.gitignore.tt', target('.gitignore'), opts
end

#initialize_repoObject



64
65
66
67
68
69
70
71
72
# File 'lib/nrb/commands/script.rb', line 64

def initialize_repo
  return unless options[:init_repo]

  inside target, opts do
    Nrb.silently verbose: options[:verbose] do
      run 'git init'
    end
  end
end

#rakefileObject



36
37
38
# File 'lib/nrb/commands/script.rb', line 36

def rakefile
  template 'templates/Rakefile.tt', target('Rakefile'), opts
end

#readmeObject



26
27
28
29
# File 'lib/nrb/commands/script.rb', line 26

def readme
  template 'templates/README.md.tt', target('README.md'),
    opts.merge({ title: name, version: Nrb::VERSION })
end

#resourcesObject



45
46
47
48
49
# File 'lib/nrb/commands/script.rb', line 45

def resources
  Nrb.config.resources.each do |dir|
    create_file target("#{dir}/.keep"), opts
  end
end

#script_fileObject



60
61
62
# File 'lib/nrb/commands/script.rb', line 60

def script_file
  template 'templates/script.rb.tt', "#{target(name)}.rb", opts
end