Class: Crosstie::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/crosstie/cli.rb

Instance Method Summary collapse

Instance Method Details

#configObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/crosstie/cli.rb', line 22

def config
  puts 'writing config.yml'
  File.write 'config.yml', "options:\n  local: \#{!!options[:local]}\nresources:\n  article:\n- title:string\n- content:text\n  comment:\n- article:references\n- content:text\n  EOF\nend\n"

#new(name) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/crosstie/cli.rb', line 10

def new name
  if File.exist? 'config.yml'
    FileUtils.mkdir_p '/tmp/crosstie'
    FileUtils.cp 'config.yml', '/tmp/crosstie/config.yml'
  end
  cmd = "rails new #{name} --template #{template_path} --skip-spring --skip-test-unit --skip-bundle"
  puts cmd
  system cmd
end

#versionObject



38
39
40
# File 'lib/crosstie/cli.rb', line 38

def version
  puts "crosstie #{Crosstie::VERSION}"
end