utilio 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +1 -5
- data/Gemfile.lock +27 -28
- data/Rakefile +45 -42
- data/lib/utilio/security.rb +31 -10
- data/lib/utilio/version.rb +3 -0
- data/utilio.gemspec +16 -61
- metadata +44 -26
- data/.bundle/config +0 -2
- data/.bundle/environment.rb +0 -260
- data/VERSION +0 -1
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,28 +1,27 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
- :test
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
utilio (0.0.3)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://rubygems.org/
|
8
|
+
specs:
|
9
|
+
diff-lcs (1.1.2)
|
10
|
+
rspec (2.0.0.rc)
|
11
|
+
rspec-core (= 2.0.0.rc)
|
12
|
+
rspec-expectations (= 2.0.0.rc)
|
13
|
+
rspec-mocks (= 2.0.0.rc)
|
14
|
+
rspec-core (2.0.0.rc)
|
15
|
+
rspec-expectations (2.0.0.rc)
|
16
|
+
diff-lcs (>= 1.1.2)
|
17
|
+
rspec-mocks (2.0.0.rc)
|
18
|
+
rspec-core (= 2.0.0.rc)
|
19
|
+
rspec-expectations (= 2.0.0.rc)
|
20
|
+
|
21
|
+
PLATFORMS
|
22
|
+
ruby
|
23
|
+
|
24
|
+
DEPENDENCIES
|
25
|
+
bundler (>= 1.0.0.rc.5)
|
26
|
+
rspec (>= 2.0.0.beta.rc)
|
27
|
+
utilio!
|
data/Rakefile
CHANGED
@@ -1,43 +1,46 @@
|
|
1
|
-
require '
|
2
|
-
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
4
|
+
# require 'rubygems'
|
5
|
+
# require 'rake'
|
6
|
+
#
|
7
|
+
# begin
|
8
|
+
# require 'jeweler'
|
9
|
+
# Jeweler::Tasks.new do |gem|
|
10
|
+
# gem.name = "utilio"
|
11
|
+
# gem.summary = %Q{A general collection of application utilities for dealing with paths and active_record}
|
12
|
+
# gem.description = %Q{}
|
13
|
+
# gem.email = "bj.neilsen@gmail.com"
|
14
|
+
# gem.homepage = "http://www.rand9.com"
|
15
|
+
# gem.authors = ["BJ Neilsen"]
|
16
|
+
# gem.add_development_dependency "rspec", ">= 1.2.9"
|
17
|
+
# # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
18
|
+
# end
|
19
|
+
# Jeweler::GemcutterTasks.new
|
20
|
+
# rescue LoadError
|
21
|
+
# puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
22
|
+
# end
|
23
|
+
#
|
24
|
+
# require 'rspec/core/rake_task'
|
25
|
+
# RSpec::Core::RakeTask.new(:spec) do |spec|
|
26
|
+
# spec.pattern = 'spec/**/*_spec.rb'
|
27
|
+
# end
|
28
|
+
#
|
29
|
+
# RSpec::Core::RakeTask.new(:rcov) do |spec|
|
30
|
+
# spec.pattern = 'spec/**/*_spec.rb'
|
31
|
+
# spec.rcov = true
|
32
|
+
# end
|
33
|
+
#
|
34
|
+
# task :spec => :check_dependencies
|
35
|
+
#
|
36
|
+
# task :default => :spec
|
37
|
+
#
|
38
|
+
# require 'rake/rdoctask'
|
39
|
+
# Rake::RDocTask.new do |rdoc|
|
40
|
+
# version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
41
|
+
#
|
42
|
+
# rdoc.rdoc_dir = 'rdoc'
|
43
|
+
# rdoc.title = "utilio #{version}"
|
44
|
+
# rdoc.rdoc_files.include('README*')
|
45
|
+
# rdoc.rdoc_files.include('lib/**/*.rb')
|
46
|
+
# end
|
data/lib/utilio/security.rb
CHANGED
@@ -1,23 +1,44 @@
|
|
1
|
-
require '
|
1
|
+
require 'base64'
|
2
|
+
require 'openssl'
|
2
3
|
|
3
4
|
module Utilio
|
4
5
|
class Security
|
5
|
-
|
6
|
-
|
7
6
|
class << self
|
8
|
-
|
9
|
-
def
|
10
|
-
|
7
|
+
|
8
|
+
def hash_string(value)
|
9
|
+
Security.secure_digest( value )
|
11
10
|
end
|
12
11
|
|
13
|
-
def
|
12
|
+
def secure_digest(*args)
|
14
13
|
Digest::SHA2.hexdigest(args.flatten.join('--'))
|
15
14
|
end
|
16
15
|
|
17
|
-
def
|
18
|
-
|
16
|
+
def encrypt string
|
17
|
+
c = cipher
|
18
|
+
c.encrypt
|
19
|
+
c.key = key
|
20
|
+
|
21
|
+
e = c.update(string) + c.final
|
22
|
+
Base64.encode64(e).chop
|
19
23
|
end
|
20
|
-
|
24
|
+
|
25
|
+
def decrypt string, kw = {}
|
26
|
+
c = cipher
|
27
|
+
c.decrypt
|
28
|
+
c.key = key
|
29
|
+
c.update(Base64.decode64("#{ string }\n")) + c.final
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def cipher
|
35
|
+
OpenSSL::Cipher::Cipher.new("aes-256-ecb")
|
36
|
+
end
|
37
|
+
|
38
|
+
def key
|
39
|
+
@key ||= "--thisIs0urKeyF0rEncryptionF0rPersona--"[0,56]
|
40
|
+
end
|
41
|
+
|
21
42
|
end
|
22
43
|
end
|
23
44
|
end
|
data/utilio.gemspec
CHANGED
@@ -1,68 +1,23 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
|
3
|
+
require 'utilio/version'
|
5
4
|
|
6
5
|
Gem::Specification.new do |s|
|
7
|
-
s.name
|
8
|
-
s.version
|
6
|
+
s.name = 'utilio'
|
7
|
+
s.version = Utilio::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ['BJ Neilsen', 'Bart Elison']
|
10
|
+
s.email = ['bj.neilsen@gmail.com', 'bart.elison@gmail.com']
|
11
|
+
s.homepage = 'http://www.rand9.com'
|
12
|
+
s.summary = 'A general collection of application utilities for dealing with paths and active_record, and security'
|
13
|
+
s.description = 'A general collection of application utilities for dealing with paths and active_record and security'
|
9
14
|
|
10
|
-
s.required_rubygems_version =
|
11
|
-
s.
|
12
|
-
s.date = %q{2010-08-10}
|
13
|
-
s.description = %q{}
|
14
|
-
s.email = %q{bj.neilsen@gmail.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.md"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".bundle/config",
|
21
|
-
".bundle/environment.rb",
|
22
|
-
".document",
|
23
|
-
".gitignore",
|
24
|
-
"Gemfile",
|
25
|
-
"Gemfile.lock",
|
26
|
-
"LICENSE",
|
27
|
-
"README.md",
|
28
|
-
"Rakefile",
|
29
|
-
"VERSION",
|
30
|
-
"autotest/discover.rb",
|
31
|
-
"lib/utilio.rb",
|
32
|
-
"lib/utilio/database.rb",
|
33
|
-
"lib/utilio/path.rb",
|
34
|
-
"lib/utilio/security.rb",
|
35
|
-
"spec/spec_helper.rb",
|
36
|
-
"spec/utilio/config/database.yml",
|
37
|
-
"spec/utilio/data/path.yml",
|
38
|
-
"spec/utilio/database_spec.rb",
|
39
|
-
"spec/utilio/path_spec.rb",
|
40
|
-
"spec/utilio/security_spec.rb",
|
41
|
-
"utilio.gemspec"
|
42
|
-
]
|
43
|
-
s.homepage = %q{http://www.rand9.com}
|
44
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
45
|
-
s.require_paths = ["lib"]
|
46
|
-
s.rubygems_version = %q{1.3.7}
|
47
|
-
s.summary = %q{A general collection of application utilities for dealing with paths and active_record}
|
48
|
-
s.test_files = [
|
49
|
-
"spec/spec_helper.rb",
|
50
|
-
"spec/utilio/database_spec.rb",
|
51
|
-
"spec/utilio/path_spec.rb",
|
52
|
-
"spec/utilio/security_spec.rb"
|
53
|
-
]
|
15
|
+
s.required_rubygems_version = '>= 1.3.6'
|
16
|
+
s.rubyforge_project = 'utilio'
|
54
17
|
|
55
|
-
|
56
|
-
|
57
|
-
s.specification_version = 3
|
18
|
+
s.add_development_dependency 'bundler', '>= 1.0.0.rc.5'
|
19
|
+
s.add_development_dependency 'rspec', '>= 2.0.0.beta.rc'
|
58
20
|
|
59
|
-
|
60
|
-
|
61
|
-
else
|
62
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
63
|
-
end
|
64
|
-
else
|
65
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
66
|
-
end
|
21
|
+
s.files = `git ls-files`.split("\n")
|
22
|
+
s.require_path = 'lib'
|
67
23
|
end
|
68
|
-
|
metadata
CHANGED
@@ -5,20 +5,21 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 3
|
9
|
+
version: 0.0.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- BJ Neilsen
|
13
|
+
- Bart Elison
|
13
14
|
autorequire:
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-10-05 00:00:00 -06:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
|
-
name:
|
22
|
+
name: bundler
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
25
|
none: false
|
@@ -27,23 +28,41 @@ dependencies:
|
|
27
28
|
- !ruby/object:Gem::Version
|
28
29
|
segments:
|
29
30
|
- 1
|
30
|
-
-
|
31
|
-
-
|
32
|
-
|
31
|
+
- 0
|
32
|
+
- 0
|
33
|
+
- rc
|
34
|
+
- 5
|
35
|
+
version: 1.0.0.rc.5
|
33
36
|
type: :development
|
34
37
|
version_requirements: *id001
|
35
|
-
|
36
|
-
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: rspec
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
segments:
|
47
|
+
- 2
|
48
|
+
- 0
|
49
|
+
- 0
|
50
|
+
- beta
|
51
|
+
- rc
|
52
|
+
version: 2.0.0.beta.rc
|
53
|
+
type: :development
|
54
|
+
version_requirements: *id002
|
55
|
+
description: A general collection of application utilities for dealing with paths and active_record and security
|
56
|
+
email:
|
57
|
+
- bj.neilsen@gmail.com
|
58
|
+
- bart.elison@gmail.com
|
37
59
|
executables: []
|
38
60
|
|
39
61
|
extensions: []
|
40
62
|
|
41
|
-
extra_rdoc_files:
|
42
|
-
|
43
|
-
- README.md
|
63
|
+
extra_rdoc_files: []
|
64
|
+
|
44
65
|
files:
|
45
|
-
- .bundle/config
|
46
|
-
- .bundle/environment.rb
|
47
66
|
- .document
|
48
67
|
- .gitignore
|
49
68
|
- Gemfile
|
@@ -51,12 +70,12 @@ files:
|
|
51
70
|
- LICENSE
|
52
71
|
- README.md
|
53
72
|
- Rakefile
|
54
|
-
- VERSION
|
55
73
|
- autotest/discover.rb
|
56
74
|
- lib/utilio.rb
|
57
75
|
- lib/utilio/database.rb
|
58
76
|
- lib/utilio/path.rb
|
59
77
|
- lib/utilio/security.rb
|
78
|
+
- lib/utilio/version.rb
|
60
79
|
- spec/spec_helper.rb
|
61
80
|
- spec/utilio/config/database.yml
|
62
81
|
- spec/utilio/data/path.yml
|
@@ -69,8 +88,8 @@ homepage: http://www.rand9.com
|
|
69
88
|
licenses: []
|
70
89
|
|
71
90
|
post_install_message:
|
72
|
-
rdoc_options:
|
73
|
-
|
91
|
+
rdoc_options: []
|
92
|
+
|
74
93
|
require_paths:
|
75
94
|
- lib
|
76
95
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -87,17 +106,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
106
|
- - ">="
|
88
107
|
- !ruby/object:Gem::Version
|
89
108
|
segments:
|
90
|
-
-
|
91
|
-
|
109
|
+
- 1
|
110
|
+
- 3
|
111
|
+
- 6
|
112
|
+
version: 1.3.6
|
92
113
|
requirements: []
|
93
114
|
|
94
|
-
rubyforge_project:
|
115
|
+
rubyforge_project: utilio
|
95
116
|
rubygems_version: 1.3.7
|
96
117
|
signing_key:
|
97
118
|
specification_version: 3
|
98
|
-
summary: A general collection of application utilities for dealing with paths and active_record
|
99
|
-
test_files:
|
100
|
-
|
101
|
-
- spec/utilio/database_spec.rb
|
102
|
-
- spec/utilio/path_spec.rb
|
103
|
-
- spec/utilio/security_spec.rb
|
119
|
+
summary: A general collection of application utilities for dealing with paths and active_record, and security
|
120
|
+
test_files: []
|
121
|
+
|
data/.bundle/config
DELETED
data/.bundle/environment.rb
DELETED
@@ -1,260 +0,0 @@
|
|
1
|
-
# DO NOT MODIFY THIS FILE
|
2
|
-
# Generated by Bundler 0.9.26
|
3
|
-
|
4
|
-
require 'digest/sha1'
|
5
|
-
require 'yaml'
|
6
|
-
require 'pathname'
|
7
|
-
require 'rubygems'
|
8
|
-
Gem.source_index # ensure Rubygems is fully loaded in Ruby 1.9
|
9
|
-
|
10
|
-
module Gem
|
11
|
-
class Dependency
|
12
|
-
if !instance_methods.map { |m| m.to_s }.include?("requirement")
|
13
|
-
def requirement
|
14
|
-
version_requirements
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
module Bundler
|
21
|
-
class Specification < Gem::Specification
|
22
|
-
attr_accessor :relative_loaded_from
|
23
|
-
|
24
|
-
def self.from_gemspec(gemspec)
|
25
|
-
spec = allocate
|
26
|
-
gemspec.instance_variables.each do |ivar|
|
27
|
-
spec.instance_variable_set(ivar, gemspec.instance_variable_get(ivar))
|
28
|
-
end
|
29
|
-
spec
|
30
|
-
end
|
31
|
-
|
32
|
-
def loaded_from
|
33
|
-
return super unless relative_loaded_from
|
34
|
-
source.path.join(relative_loaded_from).to_s
|
35
|
-
end
|
36
|
-
|
37
|
-
def full_gem_path
|
38
|
-
Pathname.new(loaded_from).dirname.expand_path.to_s
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
module SharedHelpers
|
43
|
-
attr_accessor :gem_loaded
|
44
|
-
|
45
|
-
def default_gemfile
|
46
|
-
gemfile = find_gemfile
|
47
|
-
gemfile or raise GemfileNotFound, "Could not locate Gemfile"
|
48
|
-
Pathname.new(gemfile)
|
49
|
-
end
|
50
|
-
|
51
|
-
def in_bundle?
|
52
|
-
find_gemfile
|
53
|
-
end
|
54
|
-
|
55
|
-
def env_file
|
56
|
-
default_gemfile.dirname.join(".bundle/environment.rb")
|
57
|
-
end
|
58
|
-
|
59
|
-
private
|
60
|
-
|
61
|
-
def find_gemfile
|
62
|
-
return ENV['BUNDLE_GEMFILE'] if ENV['BUNDLE_GEMFILE']
|
63
|
-
|
64
|
-
previous = nil
|
65
|
-
current = File.expand_path(Dir.pwd)
|
66
|
-
|
67
|
-
until !File.directory?(current) || current == previous
|
68
|
-
filename = File.join(current, 'Gemfile')
|
69
|
-
return filename if File.file?(filename)
|
70
|
-
current, previous = File.expand_path("..", current), current
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def clean_load_path
|
75
|
-
# handle 1.9 where system gems are always on the load path
|
76
|
-
if defined?(::Gem)
|
77
|
-
me = File.expand_path("../../", __FILE__)
|
78
|
-
$LOAD_PATH.reject! do |p|
|
79
|
-
next if File.expand_path(p).include?(me)
|
80
|
-
p != File.dirname(__FILE__) &&
|
81
|
-
Gem.path.any? { |gp| p.include?(gp) }
|
82
|
-
end
|
83
|
-
$LOAD_PATH.uniq!
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
def reverse_rubygems_kernel_mixin
|
88
|
-
# Disable rubygems' gem activation system
|
89
|
-
::Kernel.class_eval do
|
90
|
-
if private_method_defined?(:gem_original_require)
|
91
|
-
alias rubygems_require require
|
92
|
-
alias require gem_original_require
|
93
|
-
end
|
94
|
-
|
95
|
-
undef gem
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
def cripple_rubygems(specs)
|
100
|
-
reverse_rubygems_kernel_mixin
|
101
|
-
|
102
|
-
executables = specs.map { |s| s.executables }.flatten
|
103
|
-
Gem.source_index # ensure RubyGems is fully loaded
|
104
|
-
|
105
|
-
::Kernel.class_eval do
|
106
|
-
private
|
107
|
-
def gem(*) ; end
|
108
|
-
end
|
109
|
-
|
110
|
-
::Kernel.send(:define_method, :gem) do |dep, *reqs|
|
111
|
-
if executables.include? File.basename(caller.first.split(':').first)
|
112
|
-
return
|
113
|
-
end
|
114
|
-
opts = reqs.last.is_a?(Hash) ? reqs.pop : {}
|
115
|
-
|
116
|
-
unless dep.respond_to?(:name) && dep.respond_to?(:requirement)
|
117
|
-
dep = Gem::Dependency.new(dep, reqs)
|
118
|
-
end
|
119
|
-
|
120
|
-
spec = specs.find { |s| s.name == dep.name }
|
121
|
-
|
122
|
-
if spec.nil?
|
123
|
-
e = Gem::LoadError.new "#{dep.name} is not part of the bundle. Add it to Gemfile."
|
124
|
-
e.name = dep.name
|
125
|
-
e.version_requirement = dep.requirement
|
126
|
-
raise e
|
127
|
-
elsif dep !~ spec
|
128
|
-
e = Gem::LoadError.new "can't activate #{dep}, already activated #{spec.full_name}. " \
|
129
|
-
"Make sure all dependencies are added to Gemfile."
|
130
|
-
e.name = dep.name
|
131
|
-
e.version_requirement = dep.requirement
|
132
|
-
raise e
|
133
|
-
end
|
134
|
-
|
135
|
-
true
|
136
|
-
end
|
137
|
-
|
138
|
-
# === Following hacks are to improve on the generated bin wrappers ===
|
139
|
-
|
140
|
-
# Yeah, talk about a hack
|
141
|
-
source_index_class = (class << Gem::SourceIndex ; self ; end)
|
142
|
-
source_index_class.send(:define_method, :from_gems_in) do |*args|
|
143
|
-
source_index = Gem::SourceIndex.new
|
144
|
-
source_index.spec_dirs = *args
|
145
|
-
source_index.add_specs(*specs)
|
146
|
-
source_index
|
147
|
-
end
|
148
|
-
|
149
|
-
# OMG more hacks
|
150
|
-
gem_class = (class << Gem ; self ; end)
|
151
|
-
gem_class.send(:define_method, :bin_path) do |name, *args|
|
152
|
-
exec_name, *reqs = args
|
153
|
-
|
154
|
-
spec = nil
|
155
|
-
|
156
|
-
if exec_name
|
157
|
-
spec = specs.find { |s| s.executables.include?(exec_name) }
|
158
|
-
spec or raise Gem::Exception, "can't find executable #{exec_name}"
|
159
|
-
else
|
160
|
-
spec = specs.find { |s| s.name == name }
|
161
|
-
exec_name = spec.default_executable or raise Gem::Exception, "no default executable for #{spec.full_name}"
|
162
|
-
end
|
163
|
-
|
164
|
-
gem_bin = File.join(spec.full_gem_path, spec.bindir, exec_name)
|
165
|
-
gem_from_path_bin = File.join(File.dirname(spec.loaded_from), spec.bindir, exec_name)
|
166
|
-
File.exist?(gem_bin) ? gem_bin : gem_from_path_bin
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
extend self
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
module Bundler
|
175
|
-
ENV_LOADED = true
|
176
|
-
LOCKED_BY = '0.9.26'
|
177
|
-
FINGERPRINT = "8c71b54c5126769ad4e8cbab25d4e9306f972fd9"
|
178
|
-
HOME = '/Users/bj/.rvm/gems/ruby-1.9.2-rc2/bundler'
|
179
|
-
AUTOREQUIRES = {:default=>[["guid", false]], :development=>[["rspec", false]], :test=>[["rspec", false]]}
|
180
|
-
SPECS = [
|
181
|
-
{:name=>"diff-lcs", :load_paths=>["/Users/bj/.rvm/gems/ruby-1.9.2-rc2/gems/diff-lcs-1.1.2/lib"], :loaded_from=>"/Users/bj/.rvm/gems/ruby-1.9.2-rc2/specifications/diff-lcs-1.1.2.gemspec"},
|
182
|
-
{:name=>"guid", :load_paths=>["/Users/bj/.rvm/gems/ruby-1.9.2-rc2/gems/guid-0.1.1/lib"], :loaded_from=>"/Users/bj/.rvm/gems/ruby-1.9.2-rc2/specifications/guid-0.1.1.gemspec"},
|
183
|
-
{:name=>"rspec-core", :load_paths=>["/Users/bj/.rvm/gems/ruby-1.9.2-rc2/gems/rspec-core-2.0.0.beta.19/lib"], :loaded_from=>"/Users/bj/.rvm/gems/ruby-1.9.2-rc2/specifications/rspec-core-2.0.0.beta.19.gemspec"},
|
184
|
-
{:name=>"rspec-expectations", :load_paths=>["/Users/bj/.rvm/gems/ruby-1.9.2-rc2/gems/rspec-expectations-2.0.0.beta.19/lib"], :loaded_from=>"/Users/bj/.rvm/gems/ruby-1.9.2-rc2/specifications/rspec-expectations-2.0.0.beta.19.gemspec"},
|
185
|
-
{:name=>"rspec-mocks", :load_paths=>["/Users/bj/.rvm/gems/ruby-1.9.2-rc2/gems/rspec-mocks-2.0.0.beta.19/lib"], :loaded_from=>"/Users/bj/.rvm/gems/ruby-1.9.2-rc2/specifications/rspec-mocks-2.0.0.beta.19.gemspec"},
|
186
|
-
{:name=>"rspec", :load_paths=>["/Users/bj/.rvm/gems/ruby-1.9.2-rc2/gems/rspec-2.0.0.beta.19/lib"], :loaded_from=>"/Users/bj/.rvm/gems/ruby-1.9.2-rc2/specifications/rspec-2.0.0.beta.19.gemspec"},
|
187
|
-
].map do |hash|
|
188
|
-
if hash[:virtual_spec]
|
189
|
-
spec = eval(hash[:virtual_spec], TOPLEVEL_BINDING, "<virtual spec for '#{hash[:name]}'>")
|
190
|
-
else
|
191
|
-
dir = File.dirname(hash[:loaded_from])
|
192
|
-
spec = Dir.chdir(dir){ eval(File.read(hash[:loaded_from]), TOPLEVEL_BINDING, hash[:loaded_from]) }
|
193
|
-
end
|
194
|
-
spec.loaded_from = hash[:loaded_from]
|
195
|
-
spec.require_paths = hash[:load_paths]
|
196
|
-
if spec.loaded_from.include?(HOME)
|
197
|
-
Bundler::Specification.from_gemspec(spec)
|
198
|
-
else
|
199
|
-
spec
|
200
|
-
end
|
201
|
-
end
|
202
|
-
|
203
|
-
extend SharedHelpers
|
204
|
-
|
205
|
-
def self.configure_gem_path_and_home(specs)
|
206
|
-
# Fix paths, so that Gem.source_index and such will work
|
207
|
-
paths = specs.map{|s| s.installation_path }
|
208
|
-
paths.flatten!; paths.compact!; paths.uniq!; paths.reject!{|p| p.empty? }
|
209
|
-
ENV['GEM_PATH'] = paths.join(File::PATH_SEPARATOR)
|
210
|
-
ENV['GEM_HOME'] = paths.first
|
211
|
-
Gem.clear_paths
|
212
|
-
end
|
213
|
-
|
214
|
-
def self.match_fingerprint
|
215
|
-
lockfile = File.expand_path('../../Gemfile.lock', __FILE__)
|
216
|
-
lock_print = YAML.load(File.read(lockfile))["hash"] if File.exist?(lockfile)
|
217
|
-
gem_print = Digest::SHA1.hexdigest(File.read(File.expand_path('../../Gemfile', __FILE__)))
|
218
|
-
|
219
|
-
unless gem_print == lock_print
|
220
|
-
abort 'Gemfile changed since you last locked. Please run `bundle lock` to relock.'
|
221
|
-
end
|
222
|
-
|
223
|
-
unless gem_print == FINGERPRINT
|
224
|
-
abort 'Your bundled environment is out of date. Run `bundle install` to regenerate it.'
|
225
|
-
end
|
226
|
-
end
|
227
|
-
|
228
|
-
def self.setup(*groups)
|
229
|
-
match_fingerprint
|
230
|
-
clean_load_path
|
231
|
-
cripple_rubygems(SPECS)
|
232
|
-
configure_gem_path_and_home(SPECS)
|
233
|
-
SPECS.each do |spec|
|
234
|
-
Gem.loaded_specs[spec.name] = spec
|
235
|
-
spec.require_paths.each do |path|
|
236
|
-
$LOAD_PATH.unshift(path) unless $LOAD_PATH.include?(path)
|
237
|
-
end
|
238
|
-
end
|
239
|
-
self
|
240
|
-
end
|
241
|
-
|
242
|
-
def self.require(*groups)
|
243
|
-
groups = [:default] if groups.empty?
|
244
|
-
groups.each do |group|
|
245
|
-
(AUTOREQUIRES[group.to_sym] || []).each do |file, explicit|
|
246
|
-
if explicit
|
247
|
-
Kernel.require file
|
248
|
-
else
|
249
|
-
begin
|
250
|
-
Kernel.require file
|
251
|
-
rescue LoadError
|
252
|
-
end
|
253
|
-
end
|
254
|
-
end
|
255
|
-
end
|
256
|
-
end
|
257
|
-
|
258
|
-
# Set up load paths unless this file is being loaded after the Bundler gem
|
259
|
-
setup unless defined?(Bundler::GEM_LOADED)
|
260
|
-
end
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.0.2
|