Class: Crosstie::CLI

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

Instance Method Summary collapse

Instance Method Details

#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? 'resources.yml'
    FileUtils.mkdir_p '/tmp/crosstie'
    FileUtils.cp 'resources.yml', '/tmp/crosstie/resources.yml'
  end
  cmd = "rails new #{name} --template #{template_path}"
  puts cmd
  system cmd
end

#resourcesObject



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

def resources
  puts 'writing resources.yml'
  File.write 'resources.yml', <<-EOF
article:
  - title:string
  - content:text
comment:
  - article:references
  - content:text
  EOF
end

#versionObject



34
35
36
# File 'lib/crosstie/cli.rb', line 34

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