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.



27
28
29
# File 'lib/myway.rb', line 27

def name
  @name
end

Class Method Details

.source_rootObject



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

def self.source_root
  File.dirname(__FILE__)
end

Instance Method Details

#new(name = nil) ⇒ Object



34
35
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
# File 'lib/myway.rb', line 34

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"
  empty_directory "#{name}/app/models"
  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"

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

  build_js_libs

  init_git
  init_bundle
  init_capistrano

end