slim_scrooge 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -20,7 +20,7 @@ In future releases I expect further gains.
20
20
 
21
21
  h2. Installation
22
22
 
23
- Requirements: Rails 2.2 or above, Ruby 1.8.6 or above. (Ruby 1.9 to be tested)
23
+ Requirements: Rails 2.2 or above, Ruby 1.8.6 or above.
24
24
 
25
25
  <pre>
26
26
  # if you haven't already, add gemcutter to your gem sources
@@ -30,7 +30,7 @@ Requirements: Rails 2.2 or above, Ruby 1.8.6 or above. (Ruby 1.9 to be tested)
30
30
  sudo gem install slim_scrooge
31
31
  </pre>
32
32
 
33
- If the C extension does not build (perhaps you are on windows and do not have a C compiler), then do not worry - SlimScrooge has a second way of generating callsite information. Ignore the error and carry on with the next step.
33
+ Note that the C extension will only build in MRI Ruby 1.8 on non-windows at present, but do not worry, for other platforms the backup callsite mechanism is used.
34
34
 
35
35
  Next add this to your Rails::Initializer section in environment.rb:
36
36
 
data/Rakefile CHANGED
@@ -20,7 +20,7 @@ begin
20
20
  s.description = "Slim scrooge boosts speed in Rails ActiveRecord Models by only querying the database for what is needed."
21
21
  s.authors = ["Stephen Sykes"]
22
22
  s.files = FileList["[A-Z]*", "{ext,lib,test}/**/*"]
23
- s.extensions = "ext/extconf.rb"
23
+ s.extensions = "ext/Rakefile"
24
24
  end
25
25
  Jeweler::GemcutterTasks.new
26
26
  rescue LoadError
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- :patch: 4
2
+ :patch: 5
3
3
  :major: 1
4
4
  :build:
5
5
  :minor: 0
data/ext/Rakefile ADDED
@@ -0,0 +1,42 @@
1
+ task :default=>[:build]
2
+
3
+ task :build do
4
+ # only try to install extension on non windows / MRI 1.8
5
+ unless /mswin/ =~ RUBY_PLATFORM || RUBY_VERSION >= "1.9" || defined?(RUBY_ENGINE) && RUBY_ENGINE != "ruby"
6
+ require 'rbconfig'
7
+
8
+ ruby = File.join(Config::CONFIG["bindir"],
9
+ Config::CONFIG["RUBY_INSTALL_NAME"])
10
+ ruby << Config::CONFIG["EXEEXT"]
11
+
12
+ # escape string in case path to ruby executable contain spaces.
13
+ ruby.sub!(/.*\s.*/m, '"\&"')
14
+
15
+ results = `#{ruby} extconf.rb`
16
+
17
+ unless File.exist? 'Makefile'
18
+ raise "Makefile not found:\n\n#{results.join "\n"}"
19
+ end
20
+
21
+ dest_path = ENV["RUBYARCHDIR"]
22
+
23
+ mf = File.read('Makefile')
24
+ mf = mf.gsub(/^RUBYARCHDIR\s*=\s*\$[^$]*/, "RUBYARCHDIR = #{dest_path}")
25
+ mf = mf.gsub(/^RUBYLIBDIR\s*=\s*\$[^$]*/, "RUBYLIBDIR = #{dest_path}")
26
+
27
+ File.open('Makefile', 'wb') {|f| f.print mf}
28
+
29
+ make_program = ENV['make']
30
+ unless make_program
31
+ make_program = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
32
+ end
33
+
34
+ ['', ' install'].each do |target|
35
+ cmd = "#{make_program}#{target}"
36
+ results << cmd + "\n"
37
+ results << `#{cmd}`
38
+
39
+ raise "make#{target} failed:\n\n#{results}" unless $?.success?
40
+ end
41
+ end
42
+ end
data/ext/extconf.rb CHANGED
@@ -3,5 +3,3 @@ require 'mkmf'
3
3
  dir_config('callsite_hash')
4
4
 
5
5
  create_makefile('callsite_hash')
6
-
7
- $defs.push("-DRUBY18") if have_var('rb_trap_immediate', ['ruby.h', 'rubysig.h'])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slim_scrooge
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Sykes
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-26 00:00:00 +02:00
12
+ date: 2010-02-15 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -18,13 +18,14 @@ email: sdsykes@gmail.com
18
18
  executables: []
19
19
 
20
20
  extensions:
21
- - ext/extconf.rb
21
+ - ext/Rakefile
22
22
  extra_rdoc_files:
23
23
  - README.textile
24
24
  files:
25
25
  - README.textile
26
26
  - Rakefile
27
27
  - VERSION.yml
28
+ - ext/Rakefile
28
29
  - ext/callsite_hash.c
29
30
  - ext/extconf.rb
30
31
  - lib/slim_scrooge.rb