railsthemes 2.0.3 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +0 -5
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +3 -0
- data/Gemfile +1 -0
- data/README.md +3 -1
- data/lib/railsthemes.rb +1 -0
- data/lib/railsthemes/ensurer.rb +2 -8
- data/lib/railsthemes/gemfile_utils.rb +10 -0
- data/lib/railsthemes/theme_installer.rb +39 -15
- data/lib/railsthemes/utils.rb +1 -1
- data/lib/railsthemes/version.rb +1 -1
- data/spec/fixtures/blank-assets/tier1-erb-scss/doc/some_doc.md +0 -0
- data/spec/lib/railsthemes/email_installer_spec.rb +0 -2
- data/spec/lib/railsthemes/ensurer_spec.rb +3 -20
- data/spec/lib/railsthemes/gemfile_utils_spec.rb +17 -0
- data/spec/lib/railsthemes/installer_spec.rb +0 -2
- data/spec/lib/railsthemes/switcher_spec.rb +0 -2
- data/spec/lib/railsthemes/theme_installer_spec.rb +95 -38
- data/spec/lib/railsthemes/utils_spec.rb +16 -9
- data/spec/spec_helper.rb +9 -2
- metadata +10 -3
- data/.rvmrc +0 -2
    
        data/.gitignore
    CHANGED
    
    
    
        data/.ruby-gemset
    ADDED
    
    | @@ -0,0 +1 @@ | |
| 1 | 
            +
            railsthemes
         | 
    
        data/.ruby-version
    ADDED
    
    | @@ -0,0 +1 @@ | |
| 1 | 
            +
            ruby-1.9.3-p327-turbo
         | 
    
        data/.travis.yml
    ADDED
    
    
    
        data/Gemfile
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -1,4 +1,6 @@ | |
| 1 | 
            -
            # Railsthemes
         | 
| 1 | 
            +
            # Railsthemes Installer
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            [](https://travis-ci.org/RailsThemes/railsthemes_installer)
         | 
| 2 4 |  | 
| 3 5 | 
             
            This is a gem that helps you install a theme for your Rails app from RailsThemes.com. First, purchase a theme from the website. Then, install this gem and run it. You will get a download code, and you can pass this to the installer to install the theme (see below usage.) The themes at RailsThemes.com work for Rails 3.1+ (any that use the asset pipeline.)
         | 
| 4 6 |  | 
    
        data/lib/railsthemes.rb
    CHANGED
    
    | @@ -11,6 +11,7 @@ require 'railsthemes/version' | |
| 11 11 | 
             
            require 'railsthemes/logging'
         | 
| 12 12 | 
             
            require 'railsthemes/safe'
         | 
| 13 13 | 
             
            require 'railsthemes/utils'
         | 
| 14 | 
            +
            require 'railsthemes/gemfile_utils'
         | 
| 14 15 | 
             
            require 'railsthemes/tar'
         | 
| 15 16 | 
             
            require 'railsthemes/installer'
         | 
| 16 17 | 
             
            require 'railsthemes/theme_installer'
         | 
    
        data/lib/railsthemes/ensurer.rb
    CHANGED
    
    | @@ -49,7 +49,8 @@ Please roll back or commit the changes before proceeding to ensure that you can | |
| 49 49 | 
             
                end
         | 
| 50 50 |  | 
| 51 51 | 
             
                def self.ensure_rails_version_is_valid
         | 
| 52 | 
            -
                  unless File.exists?('Gemfile.lock') && | 
| 52 | 
            +
                  unless File.exists?('Gemfile.lock') &&
         | 
| 53 | 
            +
                      Gem::Version.new('3.1') <= Railsthemes::GemfileUtils.rails_version
         | 
| 53 54 | 
             
                    ask_to_install_unsupported
         | 
| 54 55 | 
             
                  end
         | 
| 55 56 | 
             
                end
         | 
| @@ -134,13 +135,6 @@ EOS | |
| 134 135 | 
             
                  logger.warn "Done checking bundle."
         | 
| 135 136 | 
             
                end
         | 
| 136 137 |  | 
| 137 | 
            -
                def self.rails_version gemfile_contents = nil
         | 
| 138 | 
            -
                  gemfile_contents ||= Utils.read_file('Gemfile.lock')
         | 
| 139 | 
            -
                  specs = Utils.gemspecs(gemfile_contents)
         | 
| 140 | 
            -
                  rails = specs.select{ |x| x.name == 'rails' }.first
         | 
| 141 | 
            -
                  rails.version if rails && rails.version
         | 
| 142 | 
            -
                end
         | 
| 143 | 
            -
             | 
| 144 138 | 
             
                def self.ensure_railsthemes_is_not_in_gemfile gemfile_contents = nil
         | 
| 145 139 | 
             
                  gemfile_contents ||= Utils.read_file('Gemfile.lock')
         | 
| 146 140 | 
             
                  specs = Utils.gemspecs(gemfile_contents)
         | 
| @@ -0,0 +1,10 @@ | |
| 1 | 
            +
            module Railsthemes
         | 
| 2 | 
            +
              class GemfileUtils
         | 
| 3 | 
            +
                def self.rails_version gemfile_contents = nil
         | 
| 4 | 
            +
                  gemfile_contents ||= Utils.read_file('Gemfile.lock')
         | 
| 5 | 
            +
                  specs = Utils.gemspecs(gemfile_contents)
         | 
| 6 | 
            +
                  rails = specs.select{ |x| x.name == 'rails' }.first
         | 
| 7 | 
            +
                  rails.version if rails && rails.version
         | 
| 8 | 
            +
                end
         | 
| 9 | 
            +
              end
         | 
| 10 | 
            +
            end
         | 
| @@ -66,18 +66,15 @@ module Railsthemes | |
| 66 66 |  | 
| 67 67 | 
             
              # Routes to RailsThemes Theme Example markup:
         | 
| 68 68 | 
             
              namespace :railsthemes do
         | 
| 69 | 
            -
                match '/' => 'railsthemes#index'
         | 
| 70 | 
            -
                match ' | 
| 71 | 
            -
                match '/previews/:name', controller: :previews, action: :show
         | 
| 72 | 
            -
                match '/previews/:feature/:partial', controller: :previews, action: :partial
         | 
| 73 | 
            -
                match '/:action', controller: :railsthemes
         | 
| 69 | 
            +
                match '/' => 'railsthemes#index', :via => [:get]
         | 
| 70 | 
            +
                match '/:action', :controller => :railsthemes, :via => [:get, :post]
         | 
| 74 71 | 
             
              end
         | 
| 75 72 |  | 
| 76 73 | 
             
              # This is magical routing for errors (instead of using the static markup in
         | 
| 77 74 | 
             
              # public/*.html)
         | 
| 78 | 
            -
              match '/403' | 
| 79 | 
            -
              match '/404' | 
| 80 | 
            -
              match '/500' | 
| 75 | 
            +
              match '/403' => 'railsthemes_errors#403_forbidden', :via => [:get]
         | 
| 76 | 
            +
              match '/404' => 'railsthemes_errors#404_not_found', :via => [:get]
         | 
| 77 | 
            +
              match '/500' => 'railsthemes_errors#500_internal_server_error', :via => [:get]
         | 
| 81 78 |  | 
| 82 79 | 
             
              ### End RailsThemes basic generated routes ###
         | 
| 83 80 | 
             
                  EOS
         | 
| @@ -105,20 +102,46 @@ module Railsthemes | |
| 105 102 | 
             
                # so if the gemspecs are in the Gemfile.lock, then the gem is in the Gemfile
         | 
| 106 103 | 
             
                def add_needed_gems
         | 
| 107 104 | 
             
                  installed_gems = Utils.gemspecs.map(&:name)
         | 
| 108 | 
            -
                   | 
| 109 | 
            -
             | 
| 110 | 
            -
             | 
| 111 | 
            -
             | 
| 112 | 
            -
             | 
| 105 | 
            +
                  %w(
         | 
| 106 | 
            +
                    sass
         | 
| 107 | 
            +
                    jquery-rails
         | 
| 108 | 
            +
                    jquery-ui-rails
         | 
| 109 | 
            +
                    coderay
         | 
| 110 | 
            +
                  ).each do |gemname|
         | 
| 113 111 | 
             
                    Utils.add_gem_to_gemfile gemname unless installed_gems.include?(gemname)
         | 
| 114 112 | 
             
                  end
         | 
| 115 113 |  | 
| 114 | 
            +
                  add_compass_rails_gem installed_gems
         | 
| 115 | 
            +
                  add_zurb_foundation_gem installed_gems
         | 
| 116 | 
            +
                  add_turbo_sprockets_gem installed_gems
         | 
| 117 | 
            +
                end
         | 
| 118 | 
            +
             | 
| 119 | 
            +
                def add_compass_rails_gem installed_gems
         | 
| 116 120 | 
             
                  unless installed_gems.include?('compass-rails')
         | 
| 117 | 
            -
                     | 
| 121 | 
            +
                    if Gem::Version.new(GemfileUtils.rails_version) < Gem::Version.new('4.0.0')
         | 
| 122 | 
            +
                      Utils.add_gem_to_gemfile('compass-rails', :group => 'assets')
         | 
| 123 | 
            +
                    else
         | 
| 124 | 
            +
                      # see http://stackoverflow.com/questions/17341042, compass-rails + Rails 4 issues
         | 
| 125 | 
            +
                      Utils.add_gem_to_gemfile('compass-rails', :version => '~> 2.0.alpha.0')
         | 
| 126 | 
            +
                    end
         | 
| 118 127 | 
             
                  end
         | 
| 128 | 
            +
                end
         | 
| 119 129 |  | 
| 130 | 
            +
                def add_zurb_foundation_gem installed_gems
         | 
| 120 131 | 
             
                  unless installed_gems.include?('zurb-foundation')
         | 
| 121 | 
            -
                     | 
| 132 | 
            +
                    if Gem::Version.new(GemfileUtils.rails_version) < Gem::Version.new('4.0.0')
         | 
| 133 | 
            +
                      Utils.add_gem_to_gemfile('zurb-foundation', :version => '~> 4.0', :group => 'assets')
         | 
| 134 | 
            +
                    else
         | 
| 135 | 
            +
                      Utils.add_gem_to_gemfile('zurb-foundation', :version => '~> 4.0')
         | 
| 136 | 
            +
                    end
         | 
| 137 | 
            +
                  end
         | 
| 138 | 
            +
                end
         | 
| 139 | 
            +
             | 
| 140 | 
            +
                def add_turbo_sprockets_gem installed_gems
         | 
| 141 | 
            +
                  if Gem::Version.new(GemfileUtils.rails_version) < Gem::Version.new('4.0.0')
         | 
| 142 | 
            +
                    unless installed_gems.include?('turbo-sprockets-rails3')
         | 
| 143 | 
            +
                      Utils.add_gem_to_gemfile('turbo-sprockets-rails3', :group => 'assets')
         | 
| 144 | 
            +
                    end
         | 
| 122 145 | 
             
                  end
         | 
| 123 146 | 
             
                end
         | 
| 124 147 |  | 
| @@ -132,6 +155,7 @@ module Railsthemes | |
| 132 155 | 
             
                        f.puts line
         | 
| 133 156 | 
             
                        if !added && (line =~ /Precompile additional assets/ || line =~ /config\.assets\.precompile/)
         | 
| 134 157 | 
             
                          f.puts "  config.assets.precompile += %w( railsthemes_#{theme_name}.js railsthemes_#{theme_name}.css )"
         | 
| 158 | 
            +
                          f.puts "  config.assets.precompile += %w( coderay.css )"
         | 
| 135 159 | 
             
                          added = true
         | 
| 136 160 | 
             
                        end
         | 
| 137 161 | 
             
                      end
         | 
    
        data/lib/railsthemes/utils.rb
    CHANGED
    
    | @@ -122,7 +122,7 @@ module Railsthemes | |
| 122 122 | 
             
                def self.get_primary_configuration gemfile_contents = read_file('Gemfile.lock')
         | 
| 123 123 | 
             
                  gem_names = gemspecs(gemfile_contents).map(&:name)
         | 
| 124 124 | 
             
                  [(gem_names.include?('haml') ? 'haml' : 'erb'),
         | 
| 125 | 
            -
             | 
| 125 | 
            +
                   (gem_names.include?('sass') ? 'scss' : 'css')]
         | 
| 126 126 | 
             
                end
         | 
| 127 127 |  | 
| 128 128 | 
             
                def self.insert_into_routes_file! to_insert
         | 
    
        data/lib/railsthemes/version.rb
    CHANGED
    
    
| 
            File without changes
         | 
| @@ -1,11 +1,6 @@ | |
| 1 1 | 
             
            require 'spec_helper'
         | 
| 2 | 
            -
            require 'railsthemes'
         | 
| 3 2 |  | 
| 4 3 | 
             
            describe Railsthemes::Ensurer do
         | 
| 5 | 
            -
              before do
         | 
| 6 | 
            -
                setup_logger
         | 
| 7 | 
            -
              end
         | 
| 8 | 
            -
             | 
| 9 4 | 
             
              describe :ensure_clean_install_possible do
         | 
| 10 5 | 
             
                it 'should not do twice normally' do
         | 
| 11 6 | 
             
                  mock(Railsthemes::Ensurer).ensure_in_rails_root.times(1)
         | 
| @@ -156,21 +151,9 @@ describe Railsthemes::Ensurer do | |
| 156 151 | 
             
                end
         | 
| 157 152 | 
             
              end
         | 
| 158 153 |  | 
| 159 | 
            -
              describe '#rails_version' do
         | 
| 160 | 
            -
                it 'should return the right version' do
         | 
| 161 | 
            -
                  gemfile = using_gem_specs :rails => '3.0.1'
         | 
| 162 | 
            -
                  Railsthemes::Ensurer.rails_version(gemfile).version.should == '3.0.1'
         | 
| 163 | 
            -
                end
         | 
| 164 | 
            -
             | 
| 165 | 
            -
                it 'should return nil if there is no rails present' do
         | 
| 166 | 
            -
                  gemfile = using_gem_specs
         | 
| 167 | 
            -
                  Railsthemes::Ensurer.rails_version(gemfile).should be_nil
         | 
| 168 | 
            -
                end
         | 
| 169 | 
            -
              end
         | 
| 170 | 
            -
             | 
| 171 154 | 
             
              describe '#ensure_rails_version_is_valid' do
         | 
| 172 155 | 
             
                it 'should ask the user if they still want to install when the gemfile does not exist' do
         | 
| 173 | 
            -
                  stub(Railsthemes:: | 
| 156 | 
            +
                  stub(Railsthemes::GemfileUtils).rails_version { Gem::Version.new('3.2.0') }
         | 
| 174 157 | 
             
                  mock(Railsthemes::Ensurer).ask_to_install_unsupported
         | 
| 175 158 | 
             
                  Railsthemes::Ensurer.ensure_rails_version_is_valid
         | 
| 176 159 | 
             
                end
         | 
| @@ -181,13 +164,13 @@ describe Railsthemes::Ensurer do | |
| 181 164 | 
             
                  end
         | 
| 182 165 |  | 
| 183 166 | 
             
                  it 'should ask the user if they still want to install when the rails version is < 3.1' do
         | 
| 184 | 
            -
                    stub(Railsthemes:: | 
| 167 | 
            +
                    stub(Railsthemes::GemfileUtils).rails_version { Gem::Version.new('3.0.9') }
         | 
| 185 168 | 
             
                    mock(Railsthemes::Ensurer).ask_to_install_unsupported
         | 
| 186 169 | 
             
                    Railsthemes::Ensurer.ensure_rails_version_is_valid
         | 
| 187 170 | 
             
                  end
         | 
| 188 171 |  | 
| 189 172 | 
             
                  it 'should not ask if they still want to install when the rails version is supported' do
         | 
| 190 | 
            -
                    stub(Railsthemes:: | 
| 173 | 
            +
                    stub(Railsthemes::GemfileUtils).rails_version { Gem::Version.new('3.1.0') }
         | 
| 191 174 | 
             
                    dont_allow(Railsthemes::Ensurer).ask_to_install_unsupported
         | 
| 192 175 | 
             
                    Railsthemes::Ensurer.ensure_rails_version_is_valid
         | 
| 193 176 | 
             
                  end
         | 
| @@ -0,0 +1,17 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            GemfileUtils = Railsthemes::GemfileUtils
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            describe GemfileUtils do
         | 
| 6 | 
            +
              describe '#rails_version' do
         | 
| 7 | 
            +
                it 'should return the right version' do
         | 
| 8 | 
            +
                  gemfile = using_gem_specs :rails => '3.0.1'
         | 
| 9 | 
            +
                  GemfileUtils.rails_version(gemfile).version.should == '3.0.1'
         | 
| 10 | 
            +
                end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                it 'should return nil if there is no rails present' do
         | 
| 13 | 
            +
                  gemfile = using_gem_specs
         | 
| 14 | 
            +
                  GemfileUtils.rails_version(gemfile).should be_nil
         | 
| 15 | 
            +
                end
         | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
            end
         | 
| @@ -1,15 +1,14 @@ | |
| 1 1 | 
             
            require 'spec_helper'
         | 
| 2 | 
            -
            require 'railsthemes'
         | 
| 3 2 | 
             
            require 'json'
         | 
| 4 3 |  | 
| 5 4 | 
             
            describe Railsthemes::ThemeInstaller do
         | 
| 6 5 | 
             
              before do
         | 
| 7 | 
            -
                setup_logger
         | 
| 8 6 | 
             
                @installer = Railsthemes::ThemeInstaller.new
         | 
| 9 7 | 
             
                @tempdir = stub_tempdir
         | 
| 10 8 |  | 
| 11 9 | 
             
                # would be interesting to see if we still need these
         | 
| 12 10 | 
             
                FileUtils.touch('Gemfile.lock')
         | 
| 11 | 
            +
                stub(Railsthemes::GemfileUtils).rails_version.times(any_times) { '0' }
         | 
| 13 12 | 
             
              end
         | 
| 14 13 |  | 
| 15 14 | 
             
              describe :install_from_file_system do
         | 
| @@ -227,7 +226,7 @@ describe Railsthemes::ThemeInstaller do | |
| 227 226 |  | 
| 228 227 | 
             
                  context 'are present' do
         | 
| 229 228 | 
             
                    it 'should not readd them' do
         | 
| 230 | 
            -
                      write_gemfiles_using_gems 'sass', 'jquery-rails', 'jquery-ui-rails'
         | 
| 229 | 
            +
                      write_gemfiles_using_gems 'sass', 'jquery-rails', 'jquery-ui-rails', 'coderay'
         | 
| 231 230 | 
             
                      @installer.add_needed_gems
         | 
| 232 231 | 
             
                      lines = File.read('Gemfile').split("\n")
         | 
| 233 232 | 
             
                      lines.grep(/^gem 'sass'/).count.should == 1
         | 
| @@ -239,50 +238,108 @@ describe Railsthemes::ThemeInstaller do | |
| 239 238 | 
             
                end
         | 
| 240 239 |  | 
| 241 240 | 
             
                describe 'asset gems' do
         | 
| 242 | 
            -
                   | 
| 243 | 
            -
                     | 
| 244 | 
            -
                      create_file 'Gemfile'
         | 
| 245 | 
            -
                      @installer.add_needed_gems
         | 
| 246 | 
            -
                      lines = File.read('Gemfile').split("\n")
         | 
| 247 | 
            -
                      lines.grep(/gem 'compass-rails'/).count.should == 1
         | 
| 248 | 
            -
                      lines.grep(/gem 'zurb-foundation'/).count.should == 1
         | 
| 249 | 
            -
                    end
         | 
| 241 | 
            +
                  before do
         | 
| 242 | 
            +
                    stub(Railsthemes::Utils).add_gem_to_gemfile
         | 
| 250 243 | 
             
                  end
         | 
| 251 244 |  | 
| 252 | 
            -
                  context ' | 
| 253 | 
            -
                     | 
| 254 | 
            -
                       | 
| 255 | 
            -
                      @installer.add_needed_gems
         | 
| 256 | 
            -
                      lines = File.read('Gemfile').split("\n")
         | 
| 257 | 
            -
                      lines.grep(/gem 'compass-rails'/).count.should == 1
         | 
| 258 | 
            -
                      lines.grep(/gem 'zurb-foundation'/).count.should == 1
         | 
| 245 | 
            +
                  context 'Rails ~> 4.0.0 app' do
         | 
| 246 | 
            +
                    before do
         | 
| 247 | 
            +
                      stub(Railsthemes::GemfileUtils).rails_version { '4.0.0' }
         | 
| 259 248 | 
             
                    end
         | 
| 260 | 
            -
                  end
         | 
| 261 249 |  | 
| 262 | 
            -
             | 
| 263 | 
            -
             | 
| 264 | 
            -
             | 
| 265 | 
            -
             | 
| 266 | 
            -
             | 
| 267 | 
            -
             | 
| 268 | 
            -
                       | 
| 250 | 
            +
                    describe 'compass-rails' do
         | 
| 251 | 
            +
                      context 'gem is not present' do
         | 
| 252 | 
            +
                        it 'should add it without group' do
         | 
| 253 | 
            +
                          mock(Railsthemes::Utils).add_gem_to_gemfile('compass-rails', version: '~> 2.0.alpha.0')
         | 
| 254 | 
            +
                          @installer.add_needed_gems
         | 
| 255 | 
            +
                        end
         | 
| 256 | 
            +
                      end
         | 
| 257 | 
            +
             | 
| 258 | 
            +
                      context 'gem is present' do
         | 
| 259 | 
            +
                        it 'should not try to add it' do
         | 
| 260 | 
            +
                          write_gemfiles_using_gems ['compass-rails']
         | 
| 261 | 
            +
                          do_not_allow(Railsthemes::Utils).add_gem_to_gemfile('compass-rails')
         | 
| 262 | 
            +
                          @installer.add_needed_gems
         | 
| 263 | 
            +
                        end
         | 
| 264 | 
            +
                      end
         | 
| 269 265 | 
             
                    end
         | 
| 270 266 |  | 
| 271 | 
            -
                     | 
| 272 | 
            -
                       | 
| 273 | 
            -
             | 
| 274 | 
            -
             | 
| 275 | 
            -
             | 
| 276 | 
            -
             | 
| 267 | 
            +
                    describe 'zurb-foundation' do
         | 
| 268 | 
            +
                      context 'gem is not present' do
         | 
| 269 | 
            +
                        it 'should add it without group' do
         | 
| 270 | 
            +
                          mock(Railsthemes::Utils).add_gem_to_gemfile('zurb-foundation', version: '~> 4.0')
         | 
| 271 | 
            +
                          @installer.add_needed_gems
         | 
| 272 | 
            +
                        end
         | 
| 273 | 
            +
                      end
         | 
| 274 | 
            +
             | 
| 275 | 
            +
                      context 'gem is present' do
         | 
| 276 | 
            +
                        it 'should not try to add it' do
         | 
| 277 | 
            +
                          write_gemfiles_using_gems ['zurb-foundation']
         | 
| 278 | 
            +
                          do_not_allow(Railsthemes::Utils).add_gem_to_gemfile('zurb-foundation')
         | 
| 279 | 
            +
                          @installer.add_needed_gems
         | 
| 280 | 
            +
                        end
         | 
| 281 | 
            +
                      end
         | 
| 282 | 
            +
                    end
         | 
| 283 | 
            +
             | 
| 284 | 
            +
                    describe 'turbo-sprockets-rails3' do
         | 
| 285 | 
            +
                      it 'should not add it, since we are above Rails 3' do
         | 
| 286 | 
            +
                        do_not_allow(Railsthemes::Utils).add_gem_to_gemfile('turbo-sprockets-rails3')
         | 
| 287 | 
            +
                        @installer.add_needed_gems
         | 
| 288 | 
            +
                      end
         | 
| 277 289 | 
             
                    end
         | 
| 278 290 | 
             
                  end
         | 
| 279 291 |  | 
| 280 | 
            -
                   | 
| 281 | 
            -
                     | 
| 282 | 
            -
             | 
| 283 | 
            -
                     | 
| 284 | 
            -
             | 
| 285 | 
            -
                     | 
| 292 | 
            +
                  context 'Rails < 4.0.0 app' do
         | 
| 293 | 
            +
                    before do
         | 
| 294 | 
            +
                      stub(Railsthemes::GemfileUtils).rails_version { '3.2.14' }
         | 
| 295 | 
            +
                    end
         | 
| 296 | 
            +
             | 
| 297 | 
            +
                    describe 'compass-rails' do
         | 
| 298 | 
            +
                      context 'gem is not present' do
         | 
| 299 | 
            +
                        it 'should add it with group' do
         | 
| 300 | 
            +
                          mock(Railsthemes::Utils).add_gem_to_gemfile('compass-rails', group: 'assets')
         | 
| 301 | 
            +
                          @installer.add_needed_gems
         | 
| 302 | 
            +
                        end
         | 
| 303 | 
            +
                      end
         | 
| 304 | 
            +
             | 
| 305 | 
            +
                      context 'gem is present' do
         | 
| 306 | 
            +
                        it 'should not try to add it' do
         | 
| 307 | 
            +
                          write_gemfiles_using_gems :assets => ['compass-rails']
         | 
| 308 | 
            +
                          do_not_allow(Railsthemes::Utils).add_gem_to_gemfile('compass-rails')
         | 
| 309 | 
            +
                          @installer.add_needed_gems
         | 
| 310 | 
            +
                        end
         | 
| 311 | 
            +
                      end
         | 
| 312 | 
            +
                    end
         | 
| 313 | 
            +
             | 
| 314 | 
            +
                    describe 'zurb-foundation' do
         | 
| 315 | 
            +
                      context 'gem is not present' do
         | 
| 316 | 
            +
                        it 'should add it without group' do
         | 
| 317 | 
            +
                          mock(Railsthemes::Utils).add_gem_to_gemfile('zurb-foundation', version: '~> 4.0', group: 'assets')
         | 
| 318 | 
            +
                          @installer.add_needed_gems
         | 
| 319 | 
            +
                        end
         | 
| 320 | 
            +
                      end
         | 
| 321 | 
            +
             | 
| 322 | 
            +
                      context 'gem is present' do
         | 
| 323 | 
            +
                        it 'should not try to add it' do
         | 
| 324 | 
            +
                          write_gemfiles_using_gems :assets => ['zurb-foundation']
         | 
| 325 | 
            +
                          do_not_allow(Railsthemes::Utils).add_gem_to_gemfile('zurb-foundation')
         | 
| 326 | 
            +
                          @installer.add_needed_gems
         | 
| 327 | 
            +
                        end
         | 
| 328 | 
            +
                      end
         | 
| 329 | 
            +
                    end
         | 
| 330 | 
            +
             | 
| 331 | 
            +
                    describe 'turbo-sprockets-rails3' do
         | 
| 332 | 
            +
                      it 'should not add it, since we are above Rails 3' do
         | 
| 333 | 
            +
                        mock(Railsthemes::Utils).add_gem_to_gemfile('turbo-sprockets-rails3', group: 'assets')
         | 
| 334 | 
            +
                        @installer.add_needed_gems
         | 
| 335 | 
            +
                      end
         | 
| 336 | 
            +
             | 
| 337 | 
            +
                      it 'should not re-add it if it already exists' do
         | 
| 338 | 
            +
                        write_gemfiles_using_gems :assets => ['turbo-sprockets-rails3']
         | 
| 339 | 
            +
                        do_not_allow(Railsthemes::Utils).add_gem_to_gemfile('turbo-sprockets-rails3')
         | 
| 340 | 
            +
                        @installer.add_needed_gems
         | 
| 341 | 
            +
                      end
         | 
| 342 | 
            +
                    end
         | 
| 286 343 | 
             
                  end
         | 
| 287 344 | 
             
                end
         | 
| 288 345 | 
             
              end
         | 
| @@ -1,11 +1,6 @@ | |
| 1 1 | 
             
            require 'spec_helper'
         | 
| 2 | 
            -
            require 'railsthemes'
         | 
| 3 2 |  | 
| 4 3 | 
             
            describe Railsthemes::Utils do
         | 
| 5 | 
            -
              before do
         | 
| 6 | 
            -
                setup_logger
         | 
| 7 | 
            -
              end
         | 
| 8 | 
            -
             | 
| 9 4 | 
             
              describe :archive? do
         | 
| 10 5 | 
             
                it 'should be false if the file does not exist' do
         | 
| 11 6 | 
             
                  Railsthemes::Utils.archive?('test/a/b/c/d.tar.gz').should be_false
         | 
| @@ -53,11 +48,23 @@ describe Railsthemes::Utils do | |
| 53 48 | 
             
              describe 'add_gem_to_gemfile' do
         | 
| 54 49 | 
             
                it 'should add the gem to the Gemfile' do
         | 
| 55 50 | 
             
                  Railsthemes::Utils.add_gem_to_gemfile 'test'
         | 
| 56 | 
            -
                  Railsthemes::Utils.add_gem_to_gemfile 'test2'
         | 
| 57 51 | 
             
                  lines = File.open('Gemfile').readlines.map(&:strip)
         | 
| 58 | 
            -
                  lines.count.should ==  | 
| 59 | 
            -
                  lines[0].should  | 
| 60 | 
            -
             | 
| 52 | 
            +
                  lines.count.should == 1
         | 
| 53 | 
            +
                  lines[0].should == "gem 'test' # RailsThemes"
         | 
| 54 | 
            +
                end
         | 
| 55 | 
            +
             | 
| 56 | 
            +
                it 'should add the gem to the Gemfile with a group when group specified' do
         | 
| 57 | 
            +
                  Railsthemes::Utils.add_gem_to_gemfile 'test', group: 'mygroup'
         | 
| 58 | 
            +
                  lines = File.open('Gemfile').readlines.map(&:strip)
         | 
| 59 | 
            +
                  lines.count.should == 1
         | 
| 60 | 
            +
                  lines[0].should == "gem 'test', :group => 'mygroup' # RailsThemes"
         | 
| 61 | 
            +
                end
         | 
| 62 | 
            +
             | 
| 63 | 
            +
                it 'should add the gem to the Gemfile with a specific version when version specified' do
         | 
| 64 | 
            +
                  Railsthemes::Utils.add_gem_to_gemfile 'test', version: '> 2.0.3'
         | 
| 65 | 
            +
                  lines = File.open('Gemfile').readlines.map(&:strip)
         | 
| 66 | 
            +
                  lines.count.should == 1
         | 
| 67 | 
            +
                  lines[0].should == "gem 'test', '> 2.0.3' # RailsThemes"
         | 
| 61 68 | 
             
                end
         | 
| 62 69 | 
             
              end
         | 
| 63 70 |  | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | @@ -4,6 +4,7 @@ require 'logger' | |
| 4 4 | 
             
            require 'fakefs/spec_helpers'
         | 
| 5 5 | 
             
            require 'fakeweb'
         | 
| 6 6 | 
             
            require 'rr'
         | 
| 7 | 
            +
            require 'railsthemes'
         | 
| 7 8 |  | 
| 8 9 | 
             
            LOGFILE_NAME = 'railsthemes.log'
         | 
| 9 10 |  | 
| @@ -13,6 +14,7 @@ RSpec.configure do |config| | |
| 13 14 |  | 
| 14 15 | 
             
              config.before :suite do
         | 
| 15 16 | 
             
                File.delete(LOGFILE_NAME) if File.exists?(LOGFILE_NAME)
         | 
| 17 | 
            +
                setup_logger
         | 
| 16 18 | 
             
              end
         | 
| 17 19 |  | 
| 18 20 | 
             
              # RSpec automatically cleans stuff out of backtraces;
         | 
| @@ -29,8 +31,13 @@ end | |
| 29 31 | 
             
            FakeWeb.allow_net_connect = false
         | 
| 30 32 |  | 
| 31 33 | 
             
            def write_gemfiles_using_gems *gems
         | 
| 34 | 
            +
              unless File.exist?('Gemfile')
         | 
| 35 | 
            +
                File.open('Gemfile', 'w') do |f|
         | 
| 36 | 
            +
                  f.puts "source :rubygems"
         | 
| 37 | 
            +
                end
         | 
| 38 | 
            +
              end
         | 
| 39 | 
            +
             | 
| 32 40 | 
             
              File.open('Gemfile', 'a') do |f|
         | 
| 33 | 
            -
                f.puts "source :rubygems"
         | 
| 34 41 | 
             
                gems.each do |gem|
         | 
| 35 42 | 
             
                  if gem.is_a? Hash
         | 
| 36 43 | 
             
                    gem.each do |group, inner_gems|
         | 
| @@ -57,6 +64,7 @@ def write_gemfiles_using_gems *gems | |
| 57 64 | 
             
                  gem
         | 
| 58 65 | 
             
                end
         | 
| 59 66 | 
             
              end.flatten
         | 
| 67 | 
            +
             | 
| 60 68 | 
             
              File.open('Gemfile.lock', 'w') do |f|
         | 
| 61 69 | 
             
                f.write using_gems(*gem_names)
         | 
| 62 70 | 
             
              end
         | 
| @@ -89,7 +97,6 @@ end | |
| 89 97 |  | 
| 90 98 | 
             
            def setup_logger
         | 
| 91 99 | 
             
              logger = Logger.new(LOGFILE_NAME)
         | 
| 92 | 
            -
              logger.info "#{self.example.description}"
         | 
| 93 100 | 
             
              Railsthemes::Logging.logger = logger
         | 
| 94 101 | 
             
              logger
         | 
| 95 102 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: railsthemes
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2.0 | 
| 4 | 
            +
              version: 2.1.0
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2013- | 
| 12 | 
            +
            date: 2013-09-03 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: thor
         | 
| @@ -85,7 +85,9 @@ extra_rdoc_files: [] | |
| 85 85 | 
             
            files:
         | 
| 86 86 | 
             
            - .gitignore
         | 
| 87 87 | 
             
            - .rspec
         | 
| 88 | 
            -
            - . | 
| 88 | 
            +
            - .ruby-gemset
         | 
| 89 | 
            +
            - .ruby-version
         | 
| 90 | 
            +
            - .travis.yml
         | 
| 89 91 | 
             
            - Gemfile
         | 
| 90 92 | 
             
            - Guardfile
         | 
| 91 93 | 
             
            - LICENSE
         | 
| @@ -98,6 +100,7 @@ files: | |
| 98 100 | 
             
            - lib/railsthemes.rb
         | 
| 99 101 | 
             
            - lib/railsthemes/email_installer.rb
         | 
| 100 102 | 
             
            - lib/railsthemes/ensurer.rb
         | 
| 103 | 
            +
            - lib/railsthemes/gemfile_utils.rb
         | 
| 101 104 | 
             
            - lib/railsthemes/installer.rb
         | 
| 102 105 | 
             
            - lib/railsthemes/logging.rb
         | 
| 103 106 | 
             
            - lib/railsthemes/os.rb
         | 
| @@ -110,6 +113,7 @@ files: | |
| 110 113 | 
             
            - railsthemes.gemspec
         | 
| 111 114 | 
             
            - spec/fixtures/blank-assets-archived/tier1-erb-scss.tar.gz
         | 
| 112 115 | 
             
            - spec/fixtures/blank-assets/tier1-erb-scss/controllers/controller1.rb
         | 
| 116 | 
            +
            - spec/fixtures/blank-assets/tier1-erb-scss/doc/some_doc.md
         | 
| 113 117 | 
             
            - spec/fixtures/blank-assets/tier1-erb-scss/helpers/helper1.rb
         | 
| 114 118 | 
             
            - spec/fixtures/blank-assets/tier1-erb-scss/images/image1.jpg
         | 
| 115 119 | 
             
            - spec/fixtures/blank-assets/tier1-erb-scss/javascripts/file1.js
         | 
| @@ -118,6 +122,7 @@ files: | |
| 118 122 | 
             
            - spec/fixtures/blank-assets/tier1-erb-scss/stylesheets/stylesheet1.css.scss
         | 
| 119 123 | 
             
            - spec/lib/railsthemes/email_installer_spec.rb
         | 
| 120 124 | 
             
            - spec/lib/railsthemes/ensurer_spec.rb
         | 
| 125 | 
            +
            - spec/lib/railsthemes/gemfile_utils_spec.rb
         | 
| 121 126 | 
             
            - spec/lib/railsthemes/installer_spec.rb
         | 
| 122 127 | 
             
            - spec/lib/railsthemes/switcher_spec.rb
         | 
| 123 128 | 
             
            - spec/lib/railsthemes/theme_installer_spec.rb
         | 
| @@ -152,6 +157,7 @@ test_files: | |
| 152 157 | 
             
            - features/support/env.rb
         | 
| 153 158 | 
             
            - spec/fixtures/blank-assets-archived/tier1-erb-scss.tar.gz
         | 
| 154 159 | 
             
            - spec/fixtures/blank-assets/tier1-erb-scss/controllers/controller1.rb
         | 
| 160 | 
            +
            - spec/fixtures/blank-assets/tier1-erb-scss/doc/some_doc.md
         | 
| 155 161 | 
             
            - spec/fixtures/blank-assets/tier1-erb-scss/helpers/helper1.rb
         | 
| 156 162 | 
             
            - spec/fixtures/blank-assets/tier1-erb-scss/images/image1.jpg
         | 
| 157 163 | 
             
            - spec/fixtures/blank-assets/tier1-erb-scss/javascripts/file1.js
         | 
| @@ -160,6 +166,7 @@ test_files: | |
| 160 166 | 
             
            - spec/fixtures/blank-assets/tier1-erb-scss/stylesheets/stylesheet1.css.scss
         | 
| 161 167 | 
             
            - spec/lib/railsthemes/email_installer_spec.rb
         | 
| 162 168 | 
             
            - spec/lib/railsthemes/ensurer_spec.rb
         | 
| 169 | 
            +
            - spec/lib/railsthemes/gemfile_utils_spec.rb
         | 
| 163 170 | 
             
            - spec/lib/railsthemes/installer_spec.rb
         | 
| 164 171 | 
             
            - spec/lib/railsthemes/switcher_spec.rb
         | 
| 165 172 | 
             
            - spec/lib/railsthemes/theme_installer_spec.rb
         | 
    
        data/.rvmrc
    DELETED