Class: Myway::Frank

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name.



29
30
31
# File 'lib/myway.rb', line 29

def name
  @name
end

Class Method Details

.source_rootObject



31
32
33
# File 'lib/myway.rb', line 31

def self.source_root
  File.dirname(__FILE__)
end

Instance Method Details

#new(name = nil) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/myway.rb', line 36

def new(name=nil)
  @name = name
  if @name.nil?
    puts "You must provide a name for your project"
    exit 0
  end

  

  empty_directory "#{name}/app/routes"
  create_file "#{name}/app/routes/.gitkeep", ""
  empty_directory "#{name}/app/models"
  create_file "#{name}/app/models/.gitkeep", ""
  empty_directory "#{name}/assets/js"
  empty_directory "#{name}/spec"

  template "myway/templates/app/version.tt", "#{name}/app/version.rb"
  template "myway/templates/app/app.tt", "#{name}/app/#{name}.rb"
  template "myway/templates/app/views/layout.haml.tt", "#{name}/app/views/layout.haml"
  template "myway/templates/app/views/index.haml.tt", "#{name}/app/views/index.haml"
  template "myway/templates/app/views/includes/navbar.haml.tt", "#{name}/app/views/includes/navbar.haml"
  template "myway/templates/config/unicorn.tt", "#{name}/config/unicorn.rb"
  template "myway/templates/config.ru.tt", "#{name}/config.ru"
  template "myway/templates/gemspec.tt", "#{name}/#{name}.gemspec"
  template "myway/templates/gemfile.tt", "#{name}/Gemfile"
  template "myway/templates/rakefile.tt", "#{name}/Rakefile"
  template "myway/templates/readme.tt", "#{name}/README.md"
  template "myway/templates/gitignore.tt", "#{name}/.gitignore"

  template "myway/templates/spec/spec_helper.rb.tt", "#{name}/spec/spec_helper.rb"
  template "myway/templates/spec/acceptance_helper.rb.tt", "#{name}/spec/acceptance_helper.rb"

  Dir.chdir(File.join(Dir.pwd, name))

  build_js_libs

  init_git
  init_bundle
  init_jasmine
  init_capistrano

end