forked from rubygems/bundler
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Carlhuda
committed
Jan 11, 2010
1 parent
2f42417
commit 67859e4
Showing
45 changed files
with
4,901 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.DS_Store | ||
tmp | ||
pkg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright (c) 2009 Engine Yard | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
$:.unshift File.expand_path("../lib", __FILE__) | ||
|
||
require 'rubygems' | ||
require 'rubygems/specification' | ||
require 'bubble' | ||
|
||
spec = Gem::Specification.new do |s| | ||
s.name = "bubble" | ||
s.version = Bubble::VERSION | ||
s.authors = ["Carl Lerche", "Yehuda Katz"] | ||
s.email = ["carlhuda@engineyard.com"] | ||
s.homepage = "http://github.com/carlhuda/bubble" | ||
s.summary = "Bubbles are fun" | ||
|
||
s.platform = Gem::Platform::RUBY | ||
|
||
s.required_rubygems_version = ">= 1.3.5" | ||
|
||
s.files = Dir.glob("{bin,lib}/**/*") + %w(LICENSE README) | ||
s.executables = ['bbl'] | ||
s.require_path = 'lib' | ||
end | ||
|
||
begin | ||
require 'spec/rake/spectask' | ||
rescue LoadError | ||
task :spec do | ||
$stderr.puts '`gem install rspec` to run specs' | ||
end | ||
else | ||
desc "Run specs" | ||
Spec::Rake::SpecTask.new do |t| | ||
t.spec_files = FileList['spec/**/*_spec.rb'] | ||
t.spec_opts = %w(-fs --color) | ||
t.warning = true | ||
end | ||
end | ||
|
||
desc "create a gemspec file" | ||
task :gemspec do | ||
File.open("#{spec.name}.gemspec", 'w') do |file| | ||
file.puts spec.to_ruby | ||
end | ||
end | ||
|
||
task :default => :spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module Bubble | ||
VERSION = "0.9.0.pre" | ||
|
||
autoload :Definition, 'bubble/definition' | ||
autoload :Dependency, 'bubble/dependency' | ||
autoload :Dsl, 'bubble/dsl' | ||
autoload :Environment, 'bubble/environment' | ||
|
||
class GemfileNotFound < StandardError; end | ||
class GemNotFound < StandardError; end | ||
class VersionConflict < StandardError; end | ||
|
||
def self.load(gemfile = nil) | ||
Environment.new(definition(gemfile)) | ||
end | ||
|
||
def self.definition(gemfile = nil) | ||
Definition.from_gemfile(gemfile) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
module Bubble | ||
class Definition | ||
def self.from_gemfile(gemfile) | ||
gemfile = Pathname.new(gemfile || default_gemfile).expand_path | ||
|
||
unless gemfile.file? | ||
raise GemfileNotFound, "`#{gemfile}` not found" | ||
end | ||
|
||
definition = new | ||
Dsl.evaluate(gemfile, definition) | ||
definition | ||
end | ||
|
||
def self.default_gemfile | ||
current = Pathname.new(Dir.pwd) | ||
|
||
until current.root? | ||
filename = current.join("Gemfile") | ||
return filename if filename.exist? | ||
current = current.parent | ||
end | ||
|
||
raise GemfileNotFound, "the default Gemfile was not found" | ||
end | ||
|
||
attr_reader :dependencies | ||
|
||
def initialize | ||
@dependencies = [] | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
require 'rubygems/dependency' | ||
|
||
module Bubble | ||
class Dependency < Gem::Dependency | ||
def initialize(name, version, options = {}, &blk) | ||
options.each do |k, v| | ||
options[k.to_s] = v | ||
end | ||
|
||
super(name, version) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module Bubble | ||
class Dsl | ||
def self.evaluate(gemfile, definition) | ||
builder = new(definition) | ||
builder.instance_eval(File.read(gemfile.to_s), gemfile.to_s, 1) | ||
definition | ||
end | ||
|
||
def initialize(definition) | ||
@definition = definition | ||
end | ||
|
||
def gem(name, *args) | ||
options = Hash === args.last ? args.pop : {} | ||
version = args.last || ">= 0" | ||
|
||
@definition.dependencies << Dependency.new(name, version, options) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module Bubble | ||
class Environment | ||
def initialize(definition) | ||
@definition = definition | ||
end | ||
|
||
def dependencies | ||
@definition.dependencies | ||
end | ||
|
||
def gems | ||
[] | ||
end | ||
end | ||
end |
Oops, something went wrong.