Class: Rails::StencilGenerator

Inherits:
Generators::Base
  • Object
show all
Defined in:
lib/generators/rails/stencil/stencil_generator.rb

Instance Method Summary collapse

Instance Method Details

#basic_css_fileObject



54
55
56
# File 'lib/generators/rails/stencil/stencil_generator.rb', line 54

def basic_css_file
  copy_file 'screen.css.scss', 'app/assets/stylesheets/screen.css.scss'
end

#gemfile_cleanupObject



22
23
24
# File 'lib/generators/rails/stencil/stencil_generator.rb', line 22

def gemfile_cleanup
  gsub_file 'Gemfile', /#.*\n/, ""
end

#gems_addObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/generators/rails/stencil/stencil_generator.rb', line 4

def gems_add
  gem 'pg'
  gem 'haml'

  gem_group :development do
    gem 'passenger'
    gem 'ruby-debug'
  end

  gem_group :development, :test do
    gem 'rspec-rails'
    gem 'guard-rspec'
    gem 'rb-inotify'
    gem 'libnotify'
    gem 'factory_girl_rails'
  end
end

#gems_installObject



26
27
28
# File 'lib/generators/rails/stencil/stencil_generator.rb', line 26

def gems_install
  run 'bundle install'
end

#git_repoObject



63
64
65
66
67
# File 'lib/generators/rails/stencil/stencil_generator.rb', line 63

def git_repo
  git :init
  git :add => '.'
  git :commit => '-am "initial app stencil" --quiet'
end

#gitignore_fileObject



58
59
60
61
# File 'lib/generators/rails/stencil/stencil_generator.rb', line 58

def gitignore_file
  remove_file '.gitignore'
  copy_file 'gitignore.txt', '.gitignore'
end

#guard_installObject



35
36
37
# File 'lib/generators/rails/stencil/stencil_generator.rb', line 35

def guard_install
  run 'guard init rspec'
end

#home_controller_generateObject



44
45
46
47
48
# File 'lib/generators/rails/stencil/stencil_generator.rb', line 44

def home_controller_generate
  remove_file 'public/index.html'
  generate(:controller, "home index --assets=false")
  gsub_file 'config/routes.rb', /get \"home\/index\"/, 'root :to => "home#index"'
end

#normalize_css_fileObject



50
51
52
# File 'lib/generators/rails/stencil/stencil_generator.rb', line 50

def normalize_css_file
  copy_file 'normalize.css', 'vendor/assets/stylesheets/normalize.css'
end

#rspec_installObject



30
31
32
33
# File 'lib/generators/rails/stencil/stencil_generator.rb', line 30

def rspec_install
  remove_dir 'test/'
  generate 'rspec:install'
end

#unnecessary_removeObject



39
40
41
42
# File 'lib/generators/rails/stencil/stencil_generator.rb', line 39

def unnecessary_remove
  remove_dir 'doc/'
  remove_file 'app/assets/images/rails.png'
end