From 3dd4e074fcf36b598ac3ca2e35f4d8a880a93149 Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Mon, 22 Apr 2013 16:12:50 +1000 Subject: [PATCH] Split spree variable changes into per-feature files, add an eaterprises feature for default layout --- Gemfile | 1 + Gemfile.lock | 8 +++ .../stylesheets/store/variables.css.scss | 5 +- lib/chili/eaterprises_feature/.gitignore | 3 + lib/chili/eaterprises_feature/README.rdoc | 3 + .../images/eaterprises_feature/.gitkeep | 0 .../eaterprises_feature/application.js | 13 ++++ .../eaterprises_feature/application.css | 13 ++++ .../variables_changes.css.scss | 1 + .../application_controller.rb | 4 ++ .../application/assets.html.erb.deface | 3 + .../application/example.html.erb.deface | 6 ++ .../eaterprises_feature/config/routes.rb | 3 + .../eaterprises_feature.gemspec | 22 +++++++ .../lib/eaterprises_feature.rb | 7 +++ .../lib/eaterprises_feature/engine.rb | 11 ++++ .../lib/eaterprises_feature/version.rb | 3 + .../eaterprises_feature_generator.rb | 3 + .../lib/tasks/eaterprises_feature_tasks.rake | 4 ++ .../variables_changes.css.scss | 1 + .../stylesheets/store/variables.css.scss | 60 +++++++++++++++++++ .../lib/local_organics_feature.rb | 2 +- .../lib/local_organics_feature/engine.rb | 6 ++ 23 files changed, 180 insertions(+), 2 deletions(-) create mode 100644 lib/chili/eaterprises_feature/.gitignore create mode 100644 lib/chili/eaterprises_feature/README.rdoc create mode 100644 lib/chili/eaterprises_feature/app/assets/images/eaterprises_feature/.gitkeep create mode 100644 lib/chili/eaterprises_feature/app/assets/javascripts/eaterprises_feature/application.js create mode 100644 lib/chili/eaterprises_feature/app/assets/stylesheets/eaterprises_feature/application.css create mode 100644 lib/chili/eaterprises_feature/app/assets/stylesheets/eaterprises_feature/variables_changes.css.scss create mode 100644 lib/chili/eaterprises_feature/app/controllers/eaterprises_feature/application_controller.rb create mode 100644 lib/chili/eaterprises_feature/app/overrides/layouts/application/assets.html.erb.deface create mode 100644 lib/chili/eaterprises_feature/app/overrides/layouts/application/example.html.erb.deface create mode 100644 lib/chili/eaterprises_feature/config/routes.rb create mode 100644 lib/chili/eaterprises_feature/eaterprises_feature.gemspec create mode 100644 lib/chili/eaterprises_feature/lib/eaterprises_feature.rb create mode 100644 lib/chili/eaterprises_feature/lib/eaterprises_feature/engine.rb create mode 100644 lib/chili/eaterprises_feature/lib/eaterprises_feature/version.rb create mode 100644 lib/chili/eaterprises_feature/lib/generators/eaterprises_feature_generator.rb create mode 100644 lib/chili/eaterprises_feature/lib/tasks/eaterprises_feature_tasks.rake create mode 100644 lib/chili/local_organics_feature/app/assets/stylesheets/local_organics_feature/variables_changes.css.scss create mode 100644 lib/chili/local_organics_feature/app/assets/stylesheets/store/variables.css.scss diff --git a/Gemfile b/Gemfile index 930398e871..a62c21f55a 100644 --- a/Gemfile +++ b/Gemfile @@ -59,5 +59,6 @@ group :test, :development do end group :chili do + gem 'eaterprises_feature', path: 'lib/chili/eaterprises_feature' gem 'local_organics_feature', path: 'lib/chili/local_organics_feature' end diff --git a/Gemfile.lock b/Gemfile.lock index 20d718b147..cdf2d6da28 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -104,6 +104,13 @@ GIT i18n (~> 0.5) spree (~> 1.1) +PATH + remote: lib/chili/eaterprises_feature + specs: + eaterprises_feature (0.0.1) + chili (~> 3.1) + rails (~> 3.2.11) + PATH remote: lib/chili/local_organics_feature specs: @@ -396,6 +403,7 @@ DEPENDENCIES comfortable_mexican_sofa database_cleaner (= 0.7.1) deface! + eaterprises_feature! factory_girl_rails faker haml diff --git a/app/assets/stylesheets/store/variables.css.scss b/app/assets/stylesheets/store/variables.css.scss index 33e0fac143..944d5c68df 100644 --- a/app/assets/stylesheets/store/variables.css.scss +++ b/app/assets/stylesheets/store/variables.css.scss @@ -7,7 +7,7 @@ $c_red: #e45353; /* Error red */ $layout_background_color: #FFFFFF; $title_text_color: #404042; $body_text_color: #404042; -$link_text_color: #006066; +$link_text_color: #00ADEE; $product_background_color: #FFFFFF; $product_title_text_color: #404042; @@ -56,3 +56,6 @@ $ff_base: 'Ubuntu', sans-serif; $input_box_font_size: 13px; $base_font_size: 12px; $button_border_color: rgba(0, 138, 189, .75); + + +@import "./variables_changes.css.scss"; diff --git a/lib/chili/eaterprises_feature/.gitignore b/lib/chili/eaterprises_feature/.gitignore new file mode 100644 index 0000000000..8619e09c5a --- /dev/null +++ b/lib/chili/eaterprises_feature/.gitignore @@ -0,0 +1,3 @@ +.bundle/ +log/*.log +pkg/ diff --git a/lib/chili/eaterprises_feature/README.rdoc b/lib/chili/eaterprises_feature/README.rdoc new file mode 100644 index 0000000000..906f47d888 --- /dev/null +++ b/lib/chili/eaterprises_feature/README.rdoc @@ -0,0 +1,3 @@ += EaterprisesFeature + +This project rocks and uses MIT-LICENSE. \ No newline at end of file diff --git a/lib/chili/eaterprises_feature/app/assets/images/eaterprises_feature/.gitkeep b/lib/chili/eaterprises_feature/app/assets/images/eaterprises_feature/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lib/chili/eaterprises_feature/app/assets/javascripts/eaterprises_feature/application.js b/lib/chili/eaterprises_feature/app/assets/javascripts/eaterprises_feature/application.js new file mode 100644 index 0000000000..15ebed9422 --- /dev/null +++ b/lib/chili/eaterprises_feature/app/assets/javascripts/eaterprises_feature/application.js @@ -0,0 +1,13 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, +// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// the compiled file. +// +// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD +// GO AFTER THE REQUIRES BELOW. +// +//= require_tree . diff --git a/lib/chili/eaterprises_feature/app/assets/stylesheets/eaterprises_feature/application.css b/lib/chili/eaterprises_feature/app/assets/stylesheets/eaterprises_feature/application.css new file mode 100644 index 0000000000..3192ec897b --- /dev/null +++ b/lib/chili/eaterprises_feature/app/assets/stylesheets/eaterprises_feature/application.css @@ -0,0 +1,13 @@ +/* + * This is a manifest file that'll be compiled into application.css, which will include all the files + * listed below. + * + * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, + * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. + * + * You're free to add application-wide styles to this file and they'll appear at the top of the + * compiled file, but it's generally better to create a new file per style scope. + * + *= require_self + *= require_tree . + */ diff --git a/lib/chili/eaterprises_feature/app/assets/stylesheets/eaterprises_feature/variables_changes.css.scss b/lib/chili/eaterprises_feature/app/assets/stylesheets/eaterprises_feature/variables_changes.css.scss new file mode 100644 index 0000000000..c4007abd2f --- /dev/null +++ b/lib/chili/eaterprises_feature/app/assets/stylesheets/eaterprises_feature/variables_changes.css.scss @@ -0,0 +1 @@ +$link_text_color: #006066; diff --git a/lib/chili/eaterprises_feature/app/controllers/eaterprises_feature/application_controller.rb b/lib/chili/eaterprises_feature/app/controllers/eaterprises_feature/application_controller.rb new file mode 100644 index 0000000000..adf879c05a --- /dev/null +++ b/lib/chili/eaterprises_feature/app/controllers/eaterprises_feature/application_controller.rb @@ -0,0 +1,4 @@ +module EaterprisesFeature + class ApplicationController < Chili::ApplicationController + end +end diff --git a/lib/chili/eaterprises_feature/app/overrides/layouts/application/assets.html.erb.deface b/lib/chili/eaterprises_feature/app/overrides/layouts/application/assets.html.erb.deface new file mode 100644 index 0000000000..72e5ed7748 --- /dev/null +++ b/lib/chili/eaterprises_feature/app/overrides/layouts/application/assets.html.erb.deface @@ -0,0 +1,3 @@ + +<%= stylesheet_link_tag 'eaterprises_feature/application' %> +<%= javascript_include_tag 'eaterprises_feature/application' %> diff --git a/lib/chili/eaterprises_feature/app/overrides/layouts/application/example.html.erb.deface b/lib/chili/eaterprises_feature/app/overrides/layouts/application/example.html.erb.deface new file mode 100644 index 0000000000..36363d2ab3 --- /dev/null +++ b/lib/chili/eaterprises_feature/app/overrides/layouts/application/example.html.erb.deface @@ -0,0 +1,6 @@ + +
+ eaterprises_feature active - edit/remove this file:
+ lib/chili/eaterprises_feature/app/overrides/layouts/application/example.html.erb.deface
+ <%= link_to 'deface docs', 'https://github.com/spree/deface', target: '_blank' %> +
diff --git a/lib/chili/eaterprises_feature/config/routes.rb b/lib/chili/eaterprises_feature/config/routes.rb new file mode 100644 index 0000000000..38585adb71 --- /dev/null +++ b/lib/chili/eaterprises_feature/config/routes.rb @@ -0,0 +1,3 @@ +EaterprisesFeature::Engine.automount! +EaterprisesFeature::Engine.routes.draw do +end diff --git a/lib/chili/eaterprises_feature/eaterprises_feature.gemspec b/lib/chili/eaterprises_feature/eaterprises_feature.gemspec new file mode 100644 index 0000000000..7ccc541de4 --- /dev/null +++ b/lib/chili/eaterprises_feature/eaterprises_feature.gemspec @@ -0,0 +1,22 @@ +$:.push File.expand_path("../lib", __FILE__) + +# Maintain your gem's version: +require "eaterprises_feature/version" + +# Describe your gem and declare its dependencies: +Gem::Specification.new do |s| + s.name = "eaterprises_feature" + s.version = EaterprisesFeature::VERSION + s.authors = ["Rohan Mitchell"] + s.email = ["rohan@rohanmitchell.com"] + s.homepage = "" + s.summary = "Summary of EaterprisesFeature." + s.description = "Description of EaterprisesFeature." + + s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"] + + s.add_dependency "rails", "~> 3.2.11" + s.add_dependency 'chili', '~> 3.1' + + s.add_development_dependency "sqlite3" +end diff --git a/lib/chili/eaterprises_feature/lib/eaterprises_feature.rb b/lib/chili/eaterprises_feature/lib/eaterprises_feature.rb new file mode 100644 index 0000000000..175f63096b --- /dev/null +++ b/lib/chili/eaterprises_feature/lib/eaterprises_feature.rb @@ -0,0 +1,7 @@ +require "chili" +require "eaterprises_feature/engine" + +module EaterprisesFeature + extend Chili::Base + active_if { ENV['OFW_DEPLOYMENT'] == 'eaterprises' } +end diff --git a/lib/chili/eaterprises_feature/lib/eaterprises_feature/engine.rb b/lib/chili/eaterprises_feature/lib/eaterprises_feature/engine.rb new file mode 100644 index 0000000000..04ac3369c3 --- /dev/null +++ b/lib/chili/eaterprises_feature/lib/eaterprises_feature/engine.rb @@ -0,0 +1,11 @@ +module EaterprisesFeature + class Engine < ::Rails::Engine + isolate_namespace EaterprisesFeature + + if ENV['OFW_DEPLOYMENT'] == 'eaterprises' + initializer 'eaterprises_feature.sass', :after => :load_config_initializers do |app| + app.config.sass.load_paths += [self.root.join('app', 'assets', 'stylesheets', 'eaterprises_feature')] + end + end + end +end diff --git a/lib/chili/eaterprises_feature/lib/eaterprises_feature/version.rb b/lib/chili/eaterprises_feature/lib/eaterprises_feature/version.rb new file mode 100644 index 0000000000..5424d0cb17 --- /dev/null +++ b/lib/chili/eaterprises_feature/lib/eaterprises_feature/version.rb @@ -0,0 +1,3 @@ +module EaterprisesFeature + VERSION = "0.0.1" +end diff --git a/lib/chili/eaterprises_feature/lib/generators/eaterprises_feature_generator.rb b/lib/chili/eaterprises_feature/lib/generators/eaterprises_feature_generator.rb new file mode 100644 index 0000000000..b0b6f7f010 --- /dev/null +++ b/lib/chili/eaterprises_feature/lib/generators/eaterprises_feature_generator.rb @@ -0,0 +1,3 @@ +class EaterprisesFeatureGenerator < Rails::Generators::Base + include Chili::GeneratorProxy +end diff --git a/lib/chili/eaterprises_feature/lib/tasks/eaterprises_feature_tasks.rake b/lib/chili/eaterprises_feature/lib/tasks/eaterprises_feature_tasks.rake new file mode 100644 index 0000000000..8c305ec7ae --- /dev/null +++ b/lib/chili/eaterprises_feature/lib/tasks/eaterprises_feature_tasks.rake @@ -0,0 +1,4 @@ +# desc "Explaining what the task does" +# task :eaterprises_feature do +# # Task goes here +# end diff --git a/lib/chili/local_organics_feature/app/assets/stylesheets/local_organics_feature/variables_changes.css.scss b/lib/chili/local_organics_feature/app/assets/stylesheets/local_organics_feature/variables_changes.css.scss new file mode 100644 index 0000000000..5c0a2d6414 --- /dev/null +++ b/lib/chili/local_organics_feature/app/assets/stylesheets/local_organics_feature/variables_changes.css.scss @@ -0,0 +1 @@ +$link_text_color: #de790c; diff --git a/lib/chili/local_organics_feature/app/assets/stylesheets/store/variables.css.scss b/lib/chili/local_organics_feature/app/assets/stylesheets/store/variables.css.scss new file mode 100644 index 0000000000..0f32bd296c --- /dev/null +++ b/lib/chili/local_organics_feature/app/assets/stylesheets/store/variables.css.scss @@ -0,0 +1,60 @@ +/*--------------------------------------*/ +/* Colors +/*--------------------------------------*/ +$c_green: #8dba53; /* Spree green */ +$c_red: #e45353; /* Error red */ + +diediedie + +$layout_background_color: #FFFFFF; +$title_text_color: #404042; +$body_text_color: #404042; +$link_text_color: #006066; + +$product_background_color: #FFFFFF; +$product_title_text_color: #404042; +$product_body_text_color: #404042; +$product_link_text_color: #BBBBBB; + +/*--------------------------------------*/ +/* Fonts import from remote +/*--------------------------------------*/ +@import url(//fonts.googleapis.com/css?family=Ubuntu:400,700,400italic,700italic|&subset=latin,cyrillic,greek,greek-ext,latin-ext,cyrillic-ext); + +/*--------------------------------------*/ +/* Font families +/*--------------------------------------*/ +$ff_base: 'Ubuntu', sans-serif; + +/*-------------------------------------- + | Font sizes + |-------------------------------------- + |- Navigation + | */ + $header_navigation_font_size: 14px; + $horizontal_navigation_font_size: 16px; + $main_navigation_header_font_size: 14px; + $main_navigation_font_size: 12px; +/*|------------------------------------ + |- Product Listing + | */ + $product_list_name_font_size: 12px; + $product_list_price_font_size: 16px; + $product_list_header_font_size: 20px; + $product_list_search_font_size: 14px; +/*|------------------------------------ + |- Product Details + | */ + $product_detail_name_font_size: 24px; + $product_detail_description_font_size: 12px; + $product_detail_price_font_size: 20px; + $product_detail_title_font_size: 14px; +/*|------------------------------------ + |- Basic + | */ + $heading_font_size: 24px; + $sub_heading_font_size: 14px; + $button_font_size: 12px; + $input_box_font_size: 13px; + $base_font_size: 12px; + $button_border_color: rgba(0, 138, 189, .75); diff --git a/lib/chili/local_organics_feature/lib/local_organics_feature.rb b/lib/chili/local_organics_feature/lib/local_organics_feature.rb index 1512362a59..cb160ccd40 100644 --- a/lib/chili/local_organics_feature/lib/local_organics_feature.rb +++ b/lib/chili/local_organics_feature/lib/local_organics_feature.rb @@ -3,5 +3,5 @@ require "local_organics_feature/engine" module LocalOrganicsFeature extend Chili::Base - active_if { true } # edit this to activate/deactivate feature at runtime + active_if { ENV['OFW_DEPLOYMENT'] == 'local_organics' } end diff --git a/lib/chili/local_organics_feature/lib/local_organics_feature/engine.rb b/lib/chili/local_organics_feature/lib/local_organics_feature/engine.rb index 8f18462620..10e11fc00a 100644 --- a/lib/chili/local_organics_feature/lib/local_organics_feature/engine.rb +++ b/lib/chili/local_organics_feature/lib/local_organics_feature/engine.rb @@ -1,5 +1,11 @@ module LocalOrganicsFeature class Engine < ::Rails::Engine isolate_namespace LocalOrganicsFeature + + if ENV['OFW_DEPLOYMENT'] == 'local_organics' + initializer 'local_organics_feature.sass', :after => :load_config_initializers do |app| + app.config.sass.load_paths += [self.root.join('app', 'assets', 'stylesheets', 'local_organics_feature')] + end + end end end