Permalink
Browse files

wow, it actually works.

  • Loading branch information...
tmm1 committed Mar 10, 2011
0 parents commit 9bc9075f6b2cca3a0329e7cb88d64012d54847bb
Showing with 664 additions and 0 deletions.
  1. +5 −0 .gitignore
  2. +2 −0 Gemfile
  3. +3 −0 README.md
  4. +31 −0 Rakefile
  5. +14 −0 ext/extconf.rb
  6. +454 −0 ext/pygments.c
  7. +29 −0 lib/pygments.rb
  8. +3 −0 lib/pygments/version.rb
  9. +22 −0 pygments.rb.gemspec
  10. +101 −0 test/test_pygments.rb
@@ -0,0 +1,5 @@
+Gemfile.lock
+ext/Makefile
+lib/pygments_ext.*
+tmp
+pkg
@@ -0,0 +1,2 @@
+source :rubygems
+gemspec
@@ -0,0 +1,3 @@
+# pygments.rb
+
+a ruby wrapper for the pygments syntax highlighter via embedded python.
@@ -0,0 +1,31 @@
+task :default => :test
+
+# ==========================================================
+# Packaging
+# ==========================================================
+
+GEMSPEC = eval(File.read('pygments.rb.gemspec'))
+
+require 'rake/gempackagetask'
+Rake::GemPackageTask.new(GEMSPEC) do |pkg|
+end
+
+# ==========================================================
+# Ruby Extension
+# ==========================================================
+
+require 'rake/extensiontask'
+Rake::ExtensionTask.new('pygments_ext', GEMSPEC) do |ext|
+ ext.ext_dir = 'ext'
+end
+task :build => :compile
+
+# ==========================================================
+# Testing
+# ==========================================================
+
+require 'rake/testtask'
+Rake::TestTask.new 'test' do |t|
+ t.test_files = FileList['test/test_*.rb']
+end
+task :test => :build
@@ -0,0 +1,14 @@
+require 'mkmf'
+
+python = %w[ 2.7 2.6 2.5 2.4 ].find do |version|
+ have_library("python#{version}", 'Py_Initialize', "python#{version}/Python.h")
+end
+
+$CFLAGS << " -Wall "
+
+unless python
+ $stderr.puts '*** could not find libpython or Python.h'
+else
+ $CFLAGS << " -I/usr/include/python#{python} "
+ create_makefile('pygments_ext')
+end
Oops, something went wrong.

0 comments on commit 9bc9075

Please sign in to comment.