class Crosstie::CLI

Public Instance Methods

config() click to toggle source
# File lib/crosstie/cli.rb, line 22
    def config
      puts 'writing config.yml'
      File.write 'config.yml', <<-EOF
options:
  local: #{!!options[:local]}
resources:
  article:
    - title:string
    - content:text
  comment:
    - article:references
    - content:text
      EOF
    end
new(name) click to toggle source
# 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
version() click to toggle source
# File lib/crosstie/cli.rb, line 38
def version
  puts "crosstie #{Crosstie::VERSION}"
end

Private Instance Methods

root() click to toggle source
# File lib/crosstie/cli.rb, line 49
def root
  File.expand_path File.dirname __FILE__
end
template_path() click to toggle source
# File lib/crosstie/cli.rb, line 45
def template_path
  File.join root, 'base.rb'
end