Sha256: 38077c8a49d04d13bf892bfb2938791318f30b62557ad9c7dc6a17623be73c42
Contents?: true
Size: 1.55 KB
Versions: 2
Compression:
Stored size: 1.55 KB
Contents
require 'rails/generators' module Bshelper module Generators class InstallGenerator < ::Rails::Generators::Base argument :with_bootbox, required: false, type: :string, banner: 'replace default alert and confirm with bootbox by setting this parameter to with-bootbox' source_root File.expand_path("../templates", __FILE__) desc "This generator installs Bootstrap Helper to Asset Pipeline" def add_assets js_manifest = 'app/assets/javascripts/application.js' if File.exist?(js_manifest) insert_into_file js_manifest, :after => "//= require bootstrap\n" do <<-JS //= require bs-modal/bootstrap-modal //= require bs-modal/bootstrap-modalmanager //= require bootbox //= require pnotify //= require init-bshelper JS end if with_bootbox && with_bootbox == 'with-bootbox' insert_into_file js_manifest, :after => "//= require init-bshelper\n" do "//= require init-bootbox\n" end end end style_require_block = <<-CSS *= require bs-modal/bootstrap-modal *= require jquery.pnotify.default *= require jquery.pnotify.default.icons CSS insert_into_file 'app/assets/stylesheets/application.css', style_require_block, :after => "require_self\n" if File.exist?('app/assets/stylesheets/application.css') insert_into_file 'app/assets/stylesheets/application.css.scss', style_require_block, :after => "require_self\n" if File.exist?('app/assets/stylesheets/application.css.scss') end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bs-helper-0.1.1 | lib/generators/bshelper/install/install_generator.rb |
bs-helper-0.1.0 | lib/generators/bshelper/install/install_generator.rb |