summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPostmodern <postmodern.mod3@gmail.com>2012-01-07 17:41:31 -0800
committerPostmodern <postmodern.mod3@gmail.com>2012-03-07 23:03:02 -0800
commit95f9c3dc541a8dd7dea7aa485c1620259f9fc27d (patch)
treecec689b8cf877233ab79c67576332b13b874c158 /lib
parentff04fa295f182b4fc8672aeab03929cac774935a (diff)
downloadbundler-95f9c3dc541a8dd7dea7aa485c1620259f9fc27d.tar.gz
Moved lib/bundler/templates to data/bundler/templates.
* This complies with the Ruby Packaging Specification (http://chneukirchen.github.com/rps/), lib/ is for code data/ is for static data. * This also prevents YARD from throwing warning as it attempts to parse Erb .rb files as Ruby code.
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/cli.rb6
-rw-r--r--lib/bundler/config.rb7
-rw-r--r--lib/bundler/installer.rb5
-rwxr-xr-xlib/bundler/templates/Executable16
-rw-r--r--lib/bundler/templates/Gemfile4
-rw-r--r--lib/bundler/templates/newgem/Gemfile.tt4
-rw-r--r--lib/bundler/templates/newgem/Rakefile.tt2
-rw-r--r--lib/bundler/templates/newgem/bin/newgem.tt3
-rw-r--r--lib/bundler/templates/newgem/gitignore.tt17
-rw-r--r--lib/bundler/templates/newgem/lib/newgem.rb.tt9
-rw-r--r--lib/bundler/templates/newgem/lib/newgem/version.rb.tt7
-rw-r--r--lib/bundler/templates/newgem/newgem.gemspec.tt17
12 files changed, 15 insertions, 82 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index f4983b793b..7e45d80799 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -1,9 +1,11 @@
+require 'bundler/config'
require 'bundler/vendored_thor'
require 'rubygems/user_interaction'
require 'rubygems/config_file'
module Bundler
class CLI < Thor
+ include Config
include Thor::Actions
def initialize(*)
@@ -80,7 +82,7 @@ module Bundler
end
else
puts "Writing new Gemfile to #{Dir.pwd}/Gemfile"
- FileUtils.cp(File.expand_path('../templates/Gemfile', __FILE__), 'Gemfile')
+ FileUtils.cp(File.join(Config::TEMPLATES,'Gemfile'), 'Gemfile')
end
end
@@ -566,7 +568,7 @@ module Bundler
end
def self.source_root
- File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
+ Config::TEMPLATES
end
desc "clean", "Cleans up unused gems in your bundler directory"
diff --git a/lib/bundler/config.rb b/lib/bundler/config.rb
new file mode 100644
index 0000000000..13cf9a02e6
--- /dev/null
+++ b/lib/bundler/config.rb
@@ -0,0 +1,7 @@
+module Bundler
+ module Config
+ DATA_DIR = File.expand_path('../../../data',__FILE__)
+
+ TEMPLATES = File.join(DATA_DIR,'bundler','templates')
+ end
+end
diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb
index 40d4fed2bc..e261f49f30 100644
--- a/lib/bundler/installer.rb
+++ b/lib/bundler/installer.rb
@@ -1,8 +1,11 @@
+require 'bundler/config'
require 'erb'
require 'rubygems/dependency_installer'
module Bundler
class Installer < Environment
+ include Config
+
class << self
attr_accessor :post_install_messages
end
@@ -129,7 +132,7 @@ module Bundler
def generate_bundler_executable_stubs(spec)
bin_path = Bundler.bin_path
- template = File.read(File.expand_path('../templates/Executable', __FILE__))
+ template = File.read(File.join(Config::TEMPLATES,'Executable'))
relative_gemfile_path = Bundler.default_gemfile.relative_path_from(bin_path)
ruby_command = Thor::Util.ruby_command
diff --git a/lib/bundler/templates/Executable b/lib/bundler/templates/Executable
deleted file mode 100755
index 5c60c28337..0000000000
--- a/lib/bundler/templates/Executable
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env <%= Bundler.settings[:shebang] || RbConfig::CONFIG['ruby_install_name'] %>
-#
-# This file was generated by Bundler.
-#
-# The application '<%= executable %>' is installed as part of a gem, and
-# this file is here to facilitate running it.
-#
-
-require 'pathname'
-ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../<%= relative_gemfile_path %>",
- Pathname.new(__FILE__).realpath)
-
-require 'rubygems'
-require 'bundler/setup'
-
-load Gem.bin_path('<%= spec.name %>', '<%= executable %>')
diff --git a/lib/bundler/templates/Gemfile b/lib/bundler/templates/Gemfile
deleted file mode 100644
index 8d5b66ea29..0000000000
--- a/lib/bundler/templates/Gemfile
+++ /dev/null
@@ -1,4 +0,0 @@
-# A sample Gemfile
-source "https://rubygems.org"
-
-# gem "rails"
diff --git a/lib/bundler/templates/newgem/Gemfile.tt b/lib/bundler/templates/newgem/Gemfile.tt
deleted file mode 100644
index d24b8525da..0000000000
--- a/lib/bundler/templates/newgem/Gemfile.tt
+++ /dev/null
@@ -1,4 +0,0 @@
-source 'https://rubygems.org'
-
-# Specify your gem's dependencies in <%=config[:name]%>.gemspec
-gemspec
diff --git a/lib/bundler/templates/newgem/Rakefile.tt b/lib/bundler/templates/newgem/Rakefile.tt
deleted file mode 100644
index f57ae68a84..0000000000
--- a/lib/bundler/templates/newgem/Rakefile.tt
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/env rake
-require "bundler/gem_tasks"
diff --git a/lib/bundler/templates/newgem/bin/newgem.tt b/lib/bundler/templates/newgem/bin/newgem.tt
deleted file mode 100644
index de31c07fd2..0000000000
--- a/lib/bundler/templates/newgem/bin/newgem.tt
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-
-require '<%= config[:name] %>'
diff --git a/lib/bundler/templates/newgem/gitignore.tt b/lib/bundler/templates/newgem/gitignore.tt
deleted file mode 100644
index d87d4be66f..0000000000
--- a/lib/bundler/templates/newgem/gitignore.tt
+++ /dev/null
@@ -1,17 +0,0 @@
-*.gem
-*.rbc
-.bundle
-.config
-.yardoc
-Gemfile.lock
-InstalledFiles
-_yardoc
-coverage
-doc/
-lib/bundler/man
-pkg
-rdoc
-spec/reports
-test/tmp
-test/version_tmp
-tmp
diff --git a/lib/bundler/templates/newgem/lib/newgem.rb.tt b/lib/bundler/templates/newgem/lib/newgem.rb.tt
deleted file mode 100644
index db76ef600e..0000000000
--- a/lib/bundler/templates/newgem/lib/newgem.rb.tt
+++ /dev/null
@@ -1,9 +0,0 @@
-require "<%=config[:name]%>/version"
-
-<%- config[:constant_array].each_with_index do |c,i| -%>
-<%= ' '*i %>module <%= c %>
-<%- end -%>
-<%= ' '*config[:constant_array].size %># Your code goes here...
-<%- (config[:constant_array].size-1).downto(0) do |i| -%>
-<%= ' '*i %>end
-<%- end -%>
diff --git a/lib/bundler/templates/newgem/lib/newgem/version.rb.tt b/lib/bundler/templates/newgem/lib/newgem/version.rb.tt
deleted file mode 100644
index fe9b5fc558..0000000000
--- a/lib/bundler/templates/newgem/lib/newgem/version.rb.tt
+++ /dev/null
@@ -1,7 +0,0 @@
-<%- config[:constant_array].each_with_index do |c,i| -%>
-<%= ' '*i %>module <%= c %>
-<%- end -%>
-<%= ' '*config[:constant_array].size %>VERSION = "0.0.1"
-<%- (config[:constant_array].size-1).downto(0) do |i| -%>
-<%= ' '*i %>end
-<%- end -%>
diff --git a/lib/bundler/templates/newgem/newgem.gemspec.tt b/lib/bundler/templates/newgem/newgem.gemspec.tt
deleted file mode 100644
index e04eb6e985..0000000000
--- a/lib/bundler/templates/newgem/newgem.gemspec.tt
+++ /dev/null
@@ -1,17 +0,0 @@
-# -*- encoding: utf-8 -*-
-require File.expand_path('../lib/<%=config[:name]%>/version', __FILE__)
-
-Gem::Specification.new do |gem|
- gem.authors = [<%=config[:author].inspect%>]
- gem.email = [<%=config[:email].inspect%>]
- gem.description = %q{TODO: Write a gem description}
- gem.summary = %q{TODO: Write a gem summary}
- gem.homepage = ""
-
- gem.files = `git ls-files`.split("\n")
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
- gem.name = <%=config[:name].inspect%>
- gem.require_paths = ["lib"]
- gem.version = <%=config[:constant_name]%>::VERSION
-end