Class: BackRack::NewApp

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/backrack/generators.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



7
8
9
# File 'lib/backrack/generators.rb', line 7

def self.source_root
  File.join File.dirname(__FILE__), 'templates'
end

Instance Method Details

#boot_fileObject



51
52
53
# File 'lib/backrack/generators.rb', line 51

def boot_file
  template 'boot.js.coffee', "#{name}/src/javascripts/boot.js.coffee"
end

#config_javascriptObject



47
48
49
# File 'lib/backrack/generators.rb', line 47

def config_javascript
  template 'config.js.coffee', "#{name}/src/javascripts/config.js.coffee"
end

#gemfileObject



11
12
13
# File 'lib/backrack/generators.rb', line 11

def gemfile
  template 'Gemfile', "#{name}/Gemfile"
end

#javascriptsObject



23
24
25
# File 'lib/backrack/generators.rb', line 23

def javascripts
  template 'application.js', "#{name}/src/javascripts/application.js"
end

#rackObject



15
16
17
# File 'lib/backrack/generators.rb', line 15

def rack
  template 'config.ru', "#{name}/config.ru"
end

#rakefileObject



34
35
36
# File 'lib/backrack/generators.rb', line 34

def rakefile
  template 'Rakefile', "#{name}/Rakefile"
end

#routerObject



55
56
57
# File 'lib/backrack/generators.rb', line 55

def router
  template 'router.js.coffee', "#{name}/src/javascripts/router.js.coffee"      
end

#staticsObject



38
39
40
41
42
43
44
45
# File 'lib/backrack/generators.rb', line 38

def statics
  copy_file 'index.html', "#{name}/public/index.html"
  %w{jquery-1.7.2.js json2.js backbone.js underscore.js}.each do |static|
    copy_file static, "#{name}/src/javascripts/vendor/#{static}"
  end
  copy_file '../../../bin/backrack', "#{name}/scripts/backrack"
  FileUtils.chmod 0755, "#{name}/scripts/backrack", verbose: false
end

#structureObject



27
28
29
30
31
32
# File 'lib/backrack/generators.rb', line 27

def structure
  %w{javascripts/collections javascripts/models javascripts/views javascripts/templates
     stylesheets/vendor}.each do |directory|
    copy_file '.gitkeep', "#{name}/src/#{directory}/.gitkeep"
  end
end

#stylesheetsObject



19
20
21
# File 'lib/backrack/generators.rb', line 19

def stylesheets
  template 'application.css', "#{name}/src/stylesheets/application.css"
end