Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add backbone.js flag

[#107]

* Installs active_model_serializers, backbone-support, ejs
* For development and test, installs guard-jasmine and jasminerice
  • Loading branch information...
commit 180d92ce515f2e0d9a8fd1e556004622780c9434 1 parent 3653a28
Caleb Thompson authored
14  features/backbone_true.feature
... ...
@@ -0,0 +1,14 @@
  1
+@disable-bundler
  2
+Feature: Adding Backbone
  3
+
  4
+  Scenario: --backbone=true
  5
+    When I suspend a project called "test_project" with:
  6
+      | argument   | value |
  7
+      | --backbone | true  |
  8
+    And I cd to the "test_project" root
  9
+    Then "backbone-support" should be installed
  10
+    And "active_model_serializers" should be installed
  11
+    And "ejs" should be installed
  12
+    And "guard-jasmine" should be installed
  13
+    And "jasminerice" should be installed
  14
+    And I can cleanly rake the project
6  features/step_definitions/suspenders_steps.rb
@@ -60,6 +60,12 @@
60 60
   }
61 61
 end
62 62
 
  63
+Then /^"([^"]*)" should be installed$/ do |gem_name|
  64
+  in_current_dir do
  65
+    system("bundle show #{gem_name} 2>&1 > /dev/null").should be_true
  66
+  end
  67
+end
  68
+
63 69
 Then /^"(.*)" should not be installed$/ do |gem_name|
64 70
   in_current_dir do
65 71
     system("bundle show #{gem_name} 2>&1 > /dev/null").should be_false
15  lib/suspenders/app_builder.rb
@@ -89,6 +89,21 @@ def add_capybara_webkit_gem
89 89
         :after => /gem 'capybara'/
90 90
     end
91 91
 
  92
+    def add_backbone_support_gems
  93
+      backbone_gems = <<-EOS.strip_heredoc
  94
+        \ngem 'active_model_serializers'
  95
+        gem 'backbone-support'
  96
+        gem 'ejs'
  97
+
  98
+        group :development, :test do
  99
+          gem 'guard-jasmine'
  100
+          gem 'jasminerice'
  101
+        end
  102
+      EOS
  103
+
  104
+      inject_into_file 'Gemfile', backbone_gems, :after => /gem 'jquery-rails'/
  105
+    end
  106
+
92 107
     def configure_rspec
93 108
       generators_config = <<-RUBY
94 109
     config.generators do |generate|
7  lib/suspenders/generators/app_generator.rb
@@ -21,6 +21,9 @@ class AppGenerator < Rails::Generators::AppGenerator
21 21
     class_option :webkit, :type => :boolean, :aliases => '-W', :default => true,
22 22
       :desc => 'Add the Capybara Webkit Javascript integration testing library'
23 23
 
  24
+    class_option :backbone, :type => :boolean, :aliases => '-B', :default => false,
  25
+      :desc => 'Add Backbone.js supporting gems'
  26
+
24 27
     def finish_template
25 28
       invoke :suspenders_customization
26 29
       super
@@ -93,6 +96,10 @@ def customize_gemfile
93 96
         build :add_capybara_webkit_gem
94 97
       end
95 98
 
  99
+      if options[:backbone]
  100
+        build :add_backbone_support_gems
  101
+      end
  102
+
96 103
       bundle_command 'install'
97 104
     end
98 105
 

0 notes on commit 180d92c

Please sign in to comment.
Something went wrong with that request. Please try again.