autobundle 1.0.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/rubygems_plugin.rb +50 -0
  2. metadata +65 -0
@@ -0,0 +1,50 @@
1
+ module Autobundle
2
+ def self.setup
3
+ if gemfile = Utils.find_gemfile
4
+ gem 'bundler', Utils.deduce_bundler_version(gemfile)
5
+ ENV['BUNDLE_GEMFILE'] = gemfile
6
+ require 'bundler'
7
+ Bundler.setup
8
+ end
9
+ end
10
+
11
+ module Utils
12
+ # from bundler/shared_helpers
13
+ def self.find_gemfile
14
+ previous = nil
15
+ current = File.expand_path(Dir.pwd)
16
+
17
+ until !File.directory?(current) || current == previous
18
+ filename = File.join(current, 'Gemfile')
19
+ return filename if File.file?(filename)
20
+ current, previous = File.expand_path('..', current), current
21
+ end
22
+ end
23
+
24
+ def self.find_gemfile_lock(gemfile)
25
+ lock = "#{File.dirname(gemfile)}/Gemfile.lock"
26
+ lock if File.file?(lock)
27
+ end
28
+
29
+ def self.deduce_bundler_version(gemfile)
30
+ if lock = find_gemfile_lock(gemfile)
31
+ contents = File.read(lock)
32
+ if contents =~ /\A---/
33
+ if contents =~ /- bundler:\s*\n\s+version:\s*(.+)\n/
34
+ "= $1"
35
+ else
36
+ '~> 0.9.0'
37
+ end
38
+ elsif contents =~ /bundler \(([^\)]+)\)/
39
+ $1
40
+ else
41
+ '>= 1.0.0.beta.2'
42
+ end
43
+ else
44
+ '>= 1.0.0.beta.2'
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ Autobundle.setup
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: autobundle
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: true
5
+ segments:
6
+ - 1
7
+ - 0
8
+ - 0
9
+ - pre1
10
+ version: 1.0.0.pre1
11
+ platform: ruby
12
+ authors:
13
+ - Jeremy Kemper
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-07-08 00:00:00 -07:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description:
23
+ email: jeremy@bitsweat.net
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - lib/rubygems_plugin.rb
32
+ has_rdoc: true
33
+ homepage: http://github.com/jeremy/autobundle
34
+ licenses: []
35
+
36
+ post_install_message:
37
+ rdoc_options: []
38
+
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ segments:
46
+ - 0
47
+ version: "0"
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">"
51
+ - !ruby/object:Gem::Version
52
+ segments:
53
+ - 1
54
+ - 3
55
+ - 1
56
+ version: 1.3.1
57
+ requirements: []
58
+
59
+ rubyforge_project:
60
+ rubygems_version: 1.3.6
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: RubyGems plugin to bundle up in the warmth of the nearest Gemfile
64
+ test_files: []
65
+