Skip to content

Commit

Permalink
No need to require "rubygems"
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhellberg committed Jan 5, 2014
1 parent 3aeb694 commit 7b19c24
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
15 changes: 7 additions & 8 deletions lib/hazel/cli.rb
@@ -1,6 +1,5 @@
# encoding: UTF-8

require "rubygems"
require "extensions/string"
require "thor/group"

Expand Down Expand Up @@ -33,7 +32,7 @@ def self.source_root

# Create empty directories
def create_empty_directories
%w{config/initializers lib log tmp spec}.each do |dir|
%w{config/initializers lib spec}.each do |dir|
empty_directory File.join(@app_path, dir)
end

Expand Down Expand Up @@ -106,12 +105,6 @@ def create_capistrano_config
end
end

def initialize_git_repo
inside(@app_path) do
run('git init .') if @git
end
end

def create_rvm_gemset
if @rvm
create_file(File.join(@app_path, '.ruby-version'), 'ruby-2.1.0')
Expand All @@ -122,6 +115,12 @@ def create_rvm_gemset
end
end

def initialize_git_repo
inside(@app_path) do
run('git init .') if @git
end
end

def install_dependencies
inside(@app_path) do
run('bundle') if @bundle
Expand Down
3 changes: 1 addition & 2 deletions lib/templates/Rakefile
@@ -1,10 +1,9 @@
%w{ rubygems bundler find rake/testtask}.each { |lib| require lib }
%w{ bundler find rake/testtask}.each { |lib| require lib }

task :default => :spec

Rake::TestTask.new(:spec) do |t|
t.test_files = FileList['spec/*_spec.rb']
t.ruby_opts = ['-rubygems'] if defined? Gem
end

<% unless @database.empty? -%>
Expand Down
7 changes: 5 additions & 2 deletions lib/templates/config.ru
@@ -1,13 +1,16 @@
# Load path and gems/bundler
$LOAD_PATH << File.expand_path(File.dirname(__FILE__))
require "rubygems"

require "bundler"
Bundler.require

# Local config
require "find"

%w{config/initializers lib}.each do |load_path|
Find.find(load_path) { |f| require f unless f.match(/\/\..+$/) || File.directory?(f) }
Find.find(load_path) { |f|
require f unless f.match(/\/\..+$/) || File.directory?(f)
}
end

# Load app
Expand Down

0 comments on commit 7b19c24

Please sign in to comment.