faster_gem_script 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +0 -0
- data/bin/faster_gem_script +8 -0
- data/lib/faster_gem_scripts.rb +11 -0
- data/lib/template +27 -0
- data/spec/spec.rb +25 -0
- metadata +76 -0
data/README
ADDED
File without changes
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'sane'
|
2
|
+
|
3
|
+
class FasterGemScripts
|
4
|
+
def self.overwrite full_path
|
5
|
+
contents_should_be = File.read __dir__ + '/template'
|
6
|
+
File.write(full_path, contents_should_be)
|
7
|
+
bin_loc = full_path + '_bin_location'
|
8
|
+
File.delete(bin_loc) if File.exist?(bin_loc)
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
data/lib/template
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
gem_name = File.basename(__FILE__)
|
2
|
+
|
3
|
+
if ARGV.first =~ /^_(.*)_$/
|
4
|
+
# special version of the gem--we'll need full rubygems for this
|
5
|
+
require 'rubygems'
|
6
|
+
if Gem::Version.correct? $1 then
|
7
|
+
version = $1
|
8
|
+
ARGV.shift
|
9
|
+
gem gem_name, version
|
10
|
+
load Gem.bin_path(gem_name, gem_name, version)
|
11
|
+
exit
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
cached = File.dirname(__FILE__) + "/#{gem_name}_bin_location"
|
16
|
+
|
17
|
+
# if we haven't cached its location yet...
|
18
|
+
unless File.exist? cached
|
19
|
+
File.open(cached, 'w') do |f|
|
20
|
+
require 'rubygems'
|
21
|
+
f.write Gem.bin_path(gem_name, gem_name, ">= 0")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
require 'faster_rubygems' if RUBY_VERSION < '1.9' # gem prelude equivalent
|
26
|
+
|
27
|
+
load File.read(cached)
|
data/spec/spec.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'sane'
|
2
|
+
require_rel '../lib/faster_gem_scripts'
|
3
|
+
require 'spec/autorun'
|
4
|
+
|
5
|
+
describe "rewriter" do
|
6
|
+
|
7
|
+
def setup
|
8
|
+
File.delete 'abc' if File.exist?('abc')
|
9
|
+
FasterGemScripts.overwrite 'abc'
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should overwrite a file" do
|
13
|
+
setup
|
14
|
+
new_contents = File.read('abc')
|
15
|
+
assert new_contents.contain?("faster_rubygems")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should nuke the cache on write" do
|
19
|
+
require 'fileutils'
|
20
|
+
FileUtils.touch 'abc_bin_location'
|
21
|
+
setup
|
22
|
+
assert !File.exist?('abc_bin_location')
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: faster_gem_script
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Roger Pack
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-12-28 00:00:00 -07:00
|
13
|
+
default_executable: faster_gem_script
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: sane
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rspec
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
description:
|
36
|
+
email: rogerdpack@gmail.com
|
37
|
+
executables:
|
38
|
+
- faster_gem_script
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- README
|
43
|
+
files:
|
44
|
+
- lib/faster_gem_scripts.rb
|
45
|
+
- lib/template
|
46
|
+
- README
|
47
|
+
has_rdoc: true
|
48
|
+
homepage: http://github.com/rdp/faster_gem_scripts
|
49
|
+
licenses: []
|
50
|
+
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options:
|
53
|
+
- --charset=UTF-8
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: "0"
|
61
|
+
version:
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: "0"
|
67
|
+
version:
|
68
|
+
requirements: []
|
69
|
+
|
70
|
+
rubyforge_project:
|
71
|
+
rubygems_version: 1.3.5
|
72
|
+
signing_key:
|
73
|
+
specification_version: 3
|
74
|
+
summary: A utility to make ruby "command line scripts" run much faster by using gem prelude instead of full rubygems
|
75
|
+
test_files:
|
76
|
+
- spec/spec.rb
|