rubygems-compile 1.0.0beta2 → 1.0.0rc1

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.markdown ADDED
@@ -0,0 +1,73 @@
1
+ # rubygems-compile
2
+
3
+ A set of rubygems commands for `macgem` that interface with the
4
+ MacRuby compiler. This gem requires MacRuby 0.11 or newer.
5
+
6
+ All you need to do is:
7
+
8
+ ```bash
9
+ sudo macgem install rubygems-compile --pre
10
+ ```
11
+
12
+ And then you're off to the races!
13
+
14
+ ## Commands
15
+
16
+ `compile`
17
+
18
+ Can be used to compile, or re-compile, any gems that are already installed.
19
+
20
+ ```bash
21
+ sudo macgem compile nokogiri # Compile gems based on names you provide
22
+ sudo macgem compile minitest --version 2.0.2 # Compile a specific version of a gem
23
+ sudo macgem compile --all # Compile all installed gems
24
+ sudo macgem compile rspec --no-ignore-dependencies # Also compile dependencies
25
+ ```
26
+
27
+ `uncompile`
28
+
29
+ Can be used to remove the compiled `.rbo` files if a gem does not work well when compiled.
30
+
31
+ ```bash
32
+ sudo macgem uncompile nokogiri # Uncompile gems based on names you provide
33
+ sudo macgem uncompile minitest --version 2.0.2 # Compile a specific version of a gem
34
+ sudo macgem uncompile --all # Uncompile all installed gems
35
+ sudo macgem uncompile rspec --no-ignore-dependencies # Also uncompile dependencies
36
+ ```
37
+
38
+ `auto\_compile`
39
+
40
+ Can be used to enable a post-install hook that will automatically compile gems when you install them. Call it once to turn on, call it a second time to disable it.
41
+
42
+ ```bash
43
+ sudo macgem auto_compile # gems will compiled when you install them
44
+ sudo macgem auto_compile # gems will not be compiled when you install them
45
+ ```
46
+
47
+ ## Caveats
48
+
49
+ * Large gems will take a long time to compile, but these are the gems
50
+ that will benefit the most from being compiled so please be patient
51
+ * This has only been tested on a few gems, but should not break
52
+ existing gems since we leave the original files around
53
+ * At the moment, compiled gems will not provide usable backtraces
54
+ + If you suspect a bug in the way MacRuby compiled a file, try running with pre-compiled files disabled like so: `VM_DISABLE_RBO=1 ruby my_code.rb`
55
+ * `.rbo` files take up more disk space than their `.rb` equivalents
56
+
57
+ ## Known Issues
58
+
59
+ * Source files using a non-standard suffix (e.g. `mime-types` has a `.rb.data` file) will not get compiled
60
+ + This might be addressable in a later release, but is not a big deal
61
+ * Gems that explicitly require a file with the file suffix (e.g. `require 'nokogiri.rb'`) will never load the compiled version of the file
62
+ + Those gems should be updated so that compiled code can be loaded
63
+
64
+ ## TODO
65
+
66
+ * Code parsing to WARN about gems that will have issues when compiled
67
+ * Parallel compilation to speed up compilation of large gems
68
+ + This might require changes in the MacRuby compiler
69
+
70
+ ## Copyright
71
+
72
+ Copyright (c) 2011 Mark Rada. See LICENSE.txt for further details.
73
+
@@ -38,6 +38,7 @@ class Gem::Commands::CompileCommand < Gem::Command
38
38
 
39
39
  def execute
40
40
  gems = execution_list
41
+ gems.delete_if { |spec| spec.name == 'rubygems-compile' }
41
42
 
42
43
  if gems.count >= 10
43
44
  alert 'This could take a while; you might want to take a coffee break'
@@ -10,7 +10,7 @@ class Gem::Compiler
10
10
  @spec = gem.is_a?(Gem::Specification) ? gem : gem.spec
11
11
 
12
12
  if @spec.name == 'rubygems-compile'
13
- alert 'You cannot compile rubygems-compile'
13
+ alert_info 'You cannot compile rubygems-compile' if @config.really_verbose
14
14
  return
15
15
  end
16
16
 
@@ -19,11 +19,11 @@ class Gem::Compiler
19
19
  gem_files.each do |file|
20
20
  say compile_file_msg(file) if @config.really_verbose
21
21
  absolute_file_path = File.join(@spec.full_gem_path, file)
22
- ::Compiler.new(
23
- bundle: true,
24
- files: [absolute_file_path],
25
- output: "#{absolute_file_path}o"
26
- ).run
22
+ MacRuby::Compiler.new(
23
+ bundle: true,
24
+ output: "#{absolute_file_path}o",
25
+ files: [absolute_file_path]
26
+ ).run
27
27
  end
28
28
  end
29
29
 
@@ -34,9 +34,18 @@ class Gem::Compiler
34
34
  "Compiling #{@spec.full_name}#{slash}"
35
35
  end
36
36
 
37
- # @todo get better at deciding which files to compile;
38
- # right now we ignore the .rb.data file in the mime-types gem
39
- # and probably some other silly edge cases that are similar
37
+ ##
38
+ # --
39
+ # TODO Get better at deciding which files to compile; right now we
40
+ # ignore the .rb.data file in the mime-types gem and probably
41
+ # some other silly edge cases that are similar.
42
+ # ++
43
+ #
44
+ # We want to find all the files in a gem to compile, but avoid compiling
45
+ # test files and other misc. files which are usually found in the top
46
+ # level or test directory.
47
+ #
48
+
40
49
  def gem_files
41
50
  files = @spec.files - @spec.test_files - @spec.extra_rdoc_files
42
51
  files.reject { |file| file.match /^(?:test|spec)/ }
@@ -1,4 +1,4 @@
1
- if RUBY_VERSION.to_f < 0.11
1
+ unless MACRUBY_REVISION.match /^git commit/
2
2
 
3
3
  ui = Gem::UserInteraction.new
4
4
  ui.alert_warning 'rubygems-compile requires MacRuby 0.11 or newer'
@@ -10,7 +10,7 @@ else
10
10
  require 'fileutils'
11
11
  require 'rubygems/version_option'
12
12
 
13
- unless Kernel.const_defined?(:Compiler)
13
+ unless MacRuby.const_defined?(:Compiler)
14
14
  load File.join(RbConfig::CONFIG['bindir'], 'macrubyc')
15
15
  end
16
16
 
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: rubygems-compile
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 5
5
- version: 1.0.0beta2
5
+ version: 1.0.0rc1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Mark Rada
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-05-14 00:00:00 -04:00
12
+ date: 2011-06-27 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -28,7 +28,7 @@ dependencies:
28
28
  - - '>='
29
29
  - !ruby/object:Gem::Version
30
30
  version: 2.2.0
31
- description: 'A set of rubygems commands that interface with the MacRuby compiler
31
+ description: 'A set of rubygems commands that interface with the MacRuby compiler.
32
32
 
33
33
  '
34
34
  email: mrada@marketcircle.com
@@ -36,7 +36,7 @@ executables: []
36
36
  extensions: []
37
37
  extra_rdoc_files:
38
38
  - LICENSE.txt
39
- - README.rdoc
39
+ - README.markdown
40
40
  files:
41
41
  - lib/rubygems-compile/analysis.rb
42
42
  - lib/rubygems-compile/commands/autocompile_command.rb
@@ -55,7 +55,7 @@ files:
55
55
  - Rakefile
56
56
  - .gemtest
57
57
  - LICENSE.txt
58
- - README.rdoc
58
+ - README.markdown
59
59
  has_rdoc: true
60
60
  homepage: http://github.com/ferrous26/rubygems-compile
61
61
  licenses:
data/README.rdoc DELETED
@@ -1,59 +0,0 @@
1
- = rubygems-compile
2
-
3
- A set of rubygems commands for <tt>macgem</tt> that interface with the
4
- MacRuby compiler.
5
-
6
- All you need to do is:
7
-
8
- sudo macgem install rubygems-compile
9
-
10
- And then you're off to the races!
11
-
12
- == Commands
13
-
14
- [+compile+] Can be used to compile, or re-compile, any gems that are already installed.
15
-
16
- sudo macgem compile nokogiri # Compile gems based on names you provide
17
- sudo macgem compile minitest --version 2.0.2 # Compile a specific version of a gem
18
- sudo macgem compile --all # Compile all installed gems
19
- sudo macgem compile rspec --no-ignore-dependencies # Also compile dependencies
20
-
21
- [+uncompile+] Can be used to remove the compiled <tt>.rbo</tt> files if a gem does not work well when compiled.
22
-
23
- sudo macgem uncompile nokogiri # Uncompile gems based on names you provide
24
- sudo macgem uncompile minitest --version 2.0.2 # Compile a specific version of a gem
25
- sudo macgem uncompile --all # Uncompile all installed gems
26
- sudo macgem uncompile rspec --no-ignore-dependencies # Also uncompile dependencies
27
-
28
- [+auto_compile+] Can be used to enable a post-install hook that will automatically compile gems when you install them. Call it once to turn on, call it a second time to disable it.
29
-
30
- sudo macgem auto_compile # gems will compiled when you install them
31
- sudo macgem auto_compile # gems will not be compiled when you install them
32
-
33
- == Caveats
34
-
35
- * Large gems will take a long time to compile, but these are the gems
36
- that will benefit the most from being compiled so please be patient
37
- * This has only been tested on a few gems, but should not break
38
- existing gems since we leave the original files around
39
- * At the moment, compiled gems will not provide usable backtraces
40
- * <tt>.rbo</tt> files take up more disk space than their <tt>.rb</tt> equivalents
41
-
42
- == Known Issues
43
-
44
- * Source files using a non-standard suffix (e.g. <tt>mime-types</tt> has a <tt>.rb.data</tt> file) will not get compiled
45
- * This might be addressable in a later release, but is not a big deal
46
- * Gems that explicitly require a file with the file suffix (e.g. <tt>require 'nokogiri.rb'</tt>) will never load the compiled version of the file
47
- * Those gems should be updated so that compiled code can be loaded
48
-
49
- == TODO
50
-
51
- * Support specifying a version for compile/uncompile commands
52
- * Code parsing to WARN about gems that will have issues when compiled
53
- * Parallel compilation to speed up compilation of large gems
54
- * This might require changes in the MacRuby compiler
55
-
56
- == Copyright
57
-
58
- Copyright (c) 2011 Mark Rada. See LICENSE.txt for further details.
59
-