diff options
Diffstat (limited to 'railties/lib/rails/generators/app_base.rb')
| -rw-r--r-- | railties/lib/rails/generators/app_base.rb | 49 | 
1 files changed, 26 insertions, 23 deletions
| diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb index 057c8b0aec..0f44f4694e 100644 --- a/railties/lib/rails/generators/app_base.rb +++ b/railties/lib/rails/generators/app_base.rb @@ -113,7 +113,6 @@ module Rails           assets_gemfile_entry,           javascript_gemfile_entry,           jbuilder_gemfile_entry, -         sdoc_gemfile_entry,           psych_gemfile_entry,           @extra_entries].flatten.find_all(&@gem_filter)        end @@ -175,6 +174,10 @@ module Rails          options[value] ? '# ' : ''        end +      def keeps? +        !options[:skip_keeps] +      end +        def sqlite3?          !options[:skip_active_record] && options[:database] == 'sqlite3'        end @@ -202,16 +205,21 @@ module Rails        end        def rails_gemfile_entry +        dev_edge_common = [ +            GemfileEntry.github('sprockets-rails', 'rails/sprockets-rails'), +            GemfileEntry.github('sprockets', 'rails/sprockets'), +            GemfileEntry.github('sass-rails', 'rails/sass-rails'), +            GemfileEntry.github('arel', 'rails/arel'), +            GemfileEntry.github('rack', 'rack/rack') +          ]          if options.dev?            [ -            GemfileEntry.path('rails', Rails::Generators::RAILS_DEV_PATH), -            GemfileEntry.github('arel', 'rails/arel') -          ] +            GemfileEntry.path('rails', Rails::Generators::RAILS_DEV_PATH) +          ] + dev_edge_common          elsif options.edge?            [ -            GemfileEntry.github('rails', 'rails/rails'), -            GemfileEntry.github('arel', 'rails/arel') -          ] +            GemfileEntry.github('rails', 'rails/rails') +          ] + dev_edge_common          else            [GemfileEntry.version('rails',                              Rails::VERSION::STRING, @@ -250,8 +258,6 @@ module Rails          return [] if options[:skip_sprockets]          gems = [] -        gems << GemfileEntry.version('sass-rails', '~> 5.0', -                                     'Use SCSS for stylesheets')          gems << GemfileEntry.version('uglifier',                                     '>= 1.3.0', @@ -261,15 +267,12 @@ module Rails        end        def jbuilder_gemfile_entry +        return [] if options[:api] +          comment = 'Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder'          GemfileEntry.version('jbuilder', '~> 2.0', comment)        end -      def sdoc_gemfile_entry -        comment = 'bundle exec rake doc:rails generates the API under doc/api.' -        GemfileEntry.new('sdoc', '~> 0.4.0', comment, group: :doc) -      end -        def coffee_gemfile_entry          comment = 'Use CoffeeScript for .coffee assets and views'          if options.dev? || options.edge? @@ -297,7 +300,7 @@ module Rails        end        def javascript_runtime_gemfile_entry -        comment = 'See https://github.com/sstephenson/execjs#readme for more supported runtimes' +        comment = 'See https://github.com/rails/execjs#readme for more supported runtimes'          if defined?(JRUBY_VERSION)            GemfileEntry.version 'therubyrhino', nil, comment          else @@ -321,10 +324,6 @@ module Rails          # its own vendored Thor, which could be a different version. Running both          # things in the same process is a recipe for a night with paracetamol.          # -        # We use backticks and #print here instead of vanilla #system because it -        # is easier to silence stdout in the existing test suite this way. The -        # end-user gets the bundler commands called anyway, so no big deal. -        #          # We unset temporary bundler variables to load proper bundler and Gemfile.          #          # Thanks to James Tucker for the Gem tricks involved in this call. @@ -332,8 +331,12 @@ module Rails          require 'bundler'          Bundler.with_clean_env do -          output = `"#{Gem.ruby}" "#{_bundle_command}" #{command}` -          print output unless options[:quiet] +          full_command = %Q["#{Gem.ruby}" "#{_bundle_command}" #{command}] +          if options[:quiet] +            system(full_command, out: File::NULL) +          else +            system(full_command) +          end          end        end @@ -342,7 +345,7 @@ module Rails        end        def spring_install? -        !options[:skip_spring] && Process.respond_to?(:fork) && !RUBY_PLATFORM.include?("cygwin") +        !options[:skip_spring] && !options.dev? && Process.respond_to?(:fork) && !RUBY_PLATFORM.include?("cygwin")        end        def run_bundle @@ -361,7 +364,7 @@ module Rails        end        def keep_file(destination) -        create_file("#{destination}/.keep") unless options[:skip_keeps] +        create_file("#{destination}/.keep") if keeps?        end      end    end | 
