From cff434ee45c866b2c68fc0d09541c6188d4b56a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Onur=20=C3=96zg=C3=BCr=20=C3=96ZKAN?= Date: Sat, 18 May 2013 00:51:13 +0300 Subject: [PATCH] #34 add bootstrap-sass gem --- README.md | 4 ---- lib/cybele/app_builder.rb | 25 +++++++++++++++++++++++++ lib/cybele/generators/app_generator.rb | 7 +++++++ templates/cybele_Gemfile | 1 + 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0f01b50..5367a69 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,6 @@ NOTE: Don't use this gem until v1.0.0 -This is yet an other Rails Template which inspired from [suspenders](https://github.com/thoughtbot/suspenders). - **Cybele** pron.: /ˈsɪbɨliː/ was an originally Anatolian mother goddess. Little is known of her oldest Anatolian cults, other than her association with mountains, hawks and lions. She may have been Phrygia's State deity; her Phrygian cult was adopted and adapted by Greek colonists of Asia Minor, and spread from there to mainland Greece and its more distant @@ -52,9 +50,7 @@ Once you've made your great commits: ## Credits Cybele is maintained and funded by [lab2023 - internet technologies](http://lab2023.com/) - Thank you to all the [contributors!](https://github.com/lab2023/cybele/graphs/contributors) - The names and logos for lab2023 are trademarks of lab2023, inc. ## License diff --git a/lib/cybele/app_builder.rb b/lib/cybele/app_builder.rb index df7eddc..3f9d7c7 100644 --- a/lib/cybele/app_builder.rb +++ b/lib/cybele/app_builder.rb @@ -79,6 +79,31 @@ def setup_gitignore_folders end end + # Internal: Setup asset precompile + # Look for information https://github.com/thomas-mcdonald/bootstrap-sass#rails-4 + def setup_asset_precompile + + config = <<-RUBY + + + # Precompile additional assets. + # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. + config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif) + RUBY + + inject_into_file 'config/application.rb', config, :after => '# config.i18n.default_locale = :de' + end + + def setup_application_js + config = <<-RUBY + +//= require bootstrap + RUBY + + inject_into_file 'app/assets/javascripts/application.js', config, :after => '//= require turbolinks' + + end + # Internal: Leftovers def leftovers end diff --git a/lib/cybele/generators/app_generator.rb b/lib/cybele/generators/app_generator.rb index 044b713..d106dd4 100644 --- a/lib/cybele/generators/app_generator.rb +++ b/lib/cybele/generators/app_generator.rb @@ -30,6 +30,7 @@ def customization invoke :replace_files invoke :install_gems invoke :gitignore_files_and_folders + invoke :setup_bootstrap end # Internal: Customize gemfile @@ -77,6 +78,12 @@ def gitignore_files_and_folders build :setup_gitignore_folders end + # Internal: Setup up bootstrap + def setup_bootstrap + build :setup_asset_precompile + build :setup_application_js + end + # Internal: Let's not: We'll bundle manually at the right spot. def run_bundle diff --git a/templates/cybele_Gemfile b/templates/cybele_Gemfile index 162c1f4..f85d810 100644 --- a/templates/cybele_Gemfile +++ b/templates/cybele_Gemfile @@ -9,6 +9,7 @@ gem 'jquery-rails' gem 'turbolinks' gem 'haml', '~> 4.0.2' gem 'haml-rails', '~> 0.4' +gem 'bootstrap-sass', '~> 2.3.1.0' gem 'responders' group :doc do