class Axis::Generators::InstallGenerator

Public Instance Methods

add_gems() click to toggle source
# File lib/generators/axis/install_generator.rb, line 27
def add_gems
  append_to_file "Gemfile", "\ngem 'slim'"
  append_to_file "Gemfile", "\ngem 'stylus', git: 'git@github.com:lucasmazza/ruby-stylus.git', group: :assets"
  run 'bundle'
end
add_stylus_initializer() click to toggle source
# File lib/generators/axis/install_generator.rb, line 40
def add_stylus_initializer
  create_file 'config/initializers/axis.rb'
  append_file 'config/initializers/axis.rb', "Stylus.use('axis-css') if defined?(Stylus)"
end
install_dependencies() click to toggle source
# File lib/generators/axis/install_generator.rb, line 18
def install_dependencies
  empty_directory 'public/js'
  empty_directory 'public/img'
  copy_file "pie.htc", "public/js/pie.htc"
  remove_file "public/favicon.ico"
  copy_file "favicon.ico", "public/favicon.ico"
  copy_file "noise.png", "public/img/noise.png"
end
install_roots_css_library() click to toggle source

note: it’s possible to stream from the npm registry with ruby and eliminate this dependency on node (github.com/railsjedi/ruby-stylus-source/blob/master/Rakefile#L23)

# File lib/generators/axis/install_generator.rb, line 35
def install_roots_css_library
  empty_directory 'node_modules'
  run 'npm install axis-css'
end
remove_defaults_and_complete() click to toggle source
# File lib/generators/axis/install_generator.rb, line 45
def remove_defaults_and_complete
  remove_file "app/assets/rails.png"
  say "\nComplete! Make sure to visit these two files to configure things: \n  - app/views/layouts/config.html.slim\n  - app/assets/stylesheets/application.css.styl\n\n", "\e[32m"
end
replace_application_css() click to toggle source
# File lib/generators/axis/install_generator.rb, line 12
def replace_application_css
  remove_file "app/assets/stylesheets/application.css"
  copy_file "layouts/application.css.styl", "app/assets/stylesheets/application.css.styl"
  copy_file "layouts/_settings.styl", "app/assets/stylesheets/_settings.styl"
end
replace_layout() click to toggle source
# File lib/generators/axis/install_generator.rb, line 7
def replace_layout
  remove_file "app/views/layouts/application.html.erb"
  copy_file "layouts/layout.html.slim", "app/views/layouts/application.html.slim"
end