ruby-audio 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -3,46 +3,79 @@ require 'rake'
3
3
  require 'rake/rdoctask'
4
4
  require 'rake/gempackagetask'
5
5
  require 'spec/rake/spectask'
6
+ require 'rake/extensiontask'
7
+ require 'rake/extensioncompiler'
8
+ require 'mini_portile'
6
9
 
7
- spec = Gem::Specification.new do |s|
8
- s.name = 'ruby-audio'
9
- s.version = '1.4.0'
10
- s.summary = 'ruby-audio wraps around libsndfile to provide simplified sound reading and writing support to ruby programs'
11
- s.authors = ['Stephen Augenstein']
12
- s.email = 'perl.programmer@gmail.com'
13
- s.homepage = 'http://github.com/warhammerkid/ruby-audio'
14
-
15
- s.platform = Gem::Platform::RUBY
16
- s.rdoc_options << '--line-numbers' << '--main' << 'README.rdoc'
17
- s.rdoc_options += FileList['ext/**/*.c', 'README.rdoc']
18
- s.files = FileList['README.rdoc', 'Rakefile', 'LICENSE', 'lib/**/*.rb', 'spec/**/*.{rb,opts,wav,mp3}', 'ext/extconf.rb', 'ext/*.{c,h}']
19
- s.extensions = ["ext/extconf.rb"]
20
- s.test_files = Dir[*['spec/**/*_spec.rb']]
21
-
22
- s.requirements << 'libsndfile (http://www.mega-nerd.com/libsndfile/)'
23
- end
24
-
25
- desc 'Default: Run the tests'
10
+ desc 'Default: run the specs.'
26
11
  task :default => :spec
27
12
 
28
- # Rake gem & package routines
29
- Rake::GemPackageTask.new(spec).define
13
+ # I don't want to depend on bundler, so we do it the bundler way without it
14
+ gemspec_path = 'ruby-audio.gemspec'
15
+ spec = begin
16
+ eval(File.read(File.join(File.dirname(__FILE__), gemspec_path)), TOPLEVEL_BINDING, gemspec_path)
17
+ rescue LoadError => e
18
+ original_line = e.backtrace.find { |line| line.include?(gemspec_path) }
19
+ msg = "There was a LoadError while evaluating #{gemspec_path}:\n #{e.message}"
20
+ msg << " from\n #{original_line}" if original_line
21
+ msg << "\n"
22
+ puts msg
23
+ exit
24
+ end
30
25
 
31
- desc 'Generate a gemspec file'
32
- task :gemspec do
33
- File.open("#{spec.name}.gemspec", 'w') do |f|
34
- f.write spec.to_ruby
35
- end
26
+ $recipes = {}
27
+ LIBSNDFILE_VERSION = '1.0.24'
28
+ $recipes[:libsndfile] = MiniPortile.new "libsndfile", LIBSNDFILE_VERSION
29
+ $recipes[:libsndfile].files << "http://www.mega-nerd.com/libsndfile/files/libsndfile-#{LIBSNDFILE_VERSION}.tar.gz"
30
+ $recipes.each { |_, recipe| recipe.host = Rake::ExtensionCompiler.mingw_host }
31
+
32
+ Spec::Rake::SpecTask.new do |t|
33
+ t.spec_opts = ['--options', 'spec/spec.opts']
36
34
  end
37
35
 
38
- desc "Generate documentation"
36
+ desc 'Generate documentation'
39
37
  Rake::RDocTask.new(:rdoc) do |rdoc|
40
38
  rdoc.rdoc_dir = 'rdoc'
41
- rdoc.title = 'ruby-audio'
42
- rdoc.options = spec.rdoc_options
43
- rdoc.rdoc_files.include('lib/**/*.rb')
39
+ rdoc.title = spec.name
40
+ rdoc.options += spec.rdoc_options
41
+ rdoc.rdoc_files.include(*spec.extra_rdoc_files)
42
+ rdoc.rdoc_files.include("lib")
44
43
  end
45
44
 
46
- Spec::Rake::SpecTask.new do |t|
47
- t.spec_opts = ['--options', 'spec/spec.opts']
45
+ Rake::GemPackageTask.new(spec) do |pkg|
46
+ pkg.need_zip = false
47
+ pkg.need_tar = false
48
+ end
49
+
50
+ Rake::ExtensionTask.new('rubyaudio_ext', spec) do |ext|
51
+ if RUBY_PLATFORM =~ /mswin|mingw/ then
52
+ # No cross-compile on win, so compile extension to lib/1.[89]
53
+ RUBY_VERSION =~ /(\d+\.\d+)/
54
+ ext.lib_dir = "lib/#{$1}"
55
+ else
56
+ ext.cross_compile = true
57
+ ext.cross_platform = 'x86-mingw32'
58
+ ext.cross_config_options << "--with-sndfile-dir=#{$recipes[:libsndfile].path}"
59
+ ext.cross_compiling do |gem_spec|
60
+ gem_spec.post_install_message = "You installed the binary version of this gem!"
61
+ end
62
+ end
63
+ end
64
+
65
+ namespace :cross do
66
+ task :libsndfile do
67
+ recipe = $recipes[:libsndfile]
68
+ checkpoint = "ports/.#{recipe.name}-#{recipe.version}-#{recipe.host}.installed"
69
+ unless File.exist?(checkpoint)
70
+ recipe.cook
71
+ touch checkpoint
72
+ end
73
+ recipe.activate
74
+ end
75
+ end
76
+ task :cross => ["cross:libsndfile"]
77
+
78
+ desc "Build gem packages"
79
+ task :gems do
80
+ sh "rake cross native gem RUBY_CC_VERSION=1.8.7:1.9.2"
48
81
  end
@@ -0,0 +1,32 @@
1
+ require 'mkmf'
2
+
3
+ $CFLAGS.gsub!("-arch i386", "")
4
+ $LDFLAGS.gsub!("-arch i386", "")
5
+
6
+ dir_config('sndfile')
7
+
8
+ # Mega-Nerd windows installer installs as libsndfile-1.dll
9
+ if RUBY_PLATFORM =~ /(mswin|mingw|cygwin)/
10
+ sndfile_lib = 'sndfile-1'
11
+ else
12
+ sndfile_lib = 'sndfile'
13
+ end
14
+
15
+ INCLUDE_DIRS = ['/opt/local/include', '/usr/local/include', 'C:/Program Files/Mega-Nerd/libsndfile/include', 'C:/Program Files (x86)/Mega-Nerd/libsndfile/include']
16
+ LIB_DIRS = ['/opt/local/lib', '/usr/local/lib', 'C:/Program Files/Mega-Nerd/libsndfile', 'C:/Program Files (x86)/Mega-Nerd/libsndfile']
17
+
18
+ # libsndfile requirements
19
+ find_header 'sndfile.h', *INCLUDE_DIRS
20
+ unless ['sndfile-1', 'sndfile'].any? {|lib| find_library lib, 'sf_open', *LIB_DIRS}
21
+ fail <<-EOM
22
+ Can't find libsndfile (http://www.mega-nerd.com/libsndfile/)
23
+
24
+ Try passing --with-sndfile-dir or --with-sndfile-lib and --with-sndfile-include
25
+ options to extconf. If there are spaces in the path on windows, it may not work.
26
+ EOM
27
+ end
28
+
29
+ # Check for format support
30
+ have_const('SF_FORMAT_OGG', 'sndfile.h')
31
+
32
+ create_makefile 'rubyaudio_ext'
File without changes
File without changes
File without changes
File without changes
data/lib/ruby-audio.rb CHANGED
@@ -1,4 +1,10 @@
1
- require 'rubyaudio_ext'
1
+ begin
2
+ # Fat binaries for Windows
3
+ RUBY_VERSION =~ /(\d+.\d+)/
4
+ require "#{$1}/rubyaudio_ext"
5
+ rescue LoadError
6
+ require "rubyaudio_ext"
7
+ end
2
8
  require 'ruby-audio/buffer'
3
9
  require 'ruby-audio/sound_info'
4
10
  require 'ruby-audio/sound'
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = 'ruby-audio'
5
+ s.version = '1.5.0'
6
+ s.platform = Gem::Platform::RUBY
7
+ s.authors = ['Stephen Augenstein']
8
+ s.email = ['perl.programmer@gmail.com']
9
+ s.homepage = 'http://github.com/warhammerkid/ruby-audio'
10
+ s.summary = 'libsndfile wrapper for ruby'
11
+ s.description = 'ruby-audio wraps around libsndfile to provide simplified sound reading and writing support to ruby programs'
12
+
13
+ s.files = Dir['ruby-audio.gemspec', 'README.rdoc', 'LICENSE', 'Rakefile', 'lib/**/*.rb', 'spec/**/*.{rb,opts,wav,mp3}', 'ext/**/*.{c,h,rb}']
14
+ s.test_files = Dir['spec/**/*_spec.rb']
15
+ s.extensions = Dir["ext/**/extconf.rb"]
16
+
17
+ s.requirements << 'libsndfile (http://www.mega-nerd.com/libsndfile/)'
18
+
19
+ s.has_rdoc = true
20
+ s.extra_rdoc_files = Dir['README.rdoc', 'ext/**/*.c']
21
+ s.rdoc_options = ['--line-numbers', '--main', 'README.rdoc']
22
+ end
data/spec/spec_helper.rb CHANGED
@@ -7,6 +7,5 @@ rescue LoadError
7
7
  end
8
8
  require 'spec/autorun'
9
9
 
10
- $:.unshift(File.join(File.dirname(__FILE__), '..', 'ext'))
11
10
  $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
12
11
  require 'ruby-audio'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-audio
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
- - 4
8
+ - 5
9
9
  - 0
10
- version: 1.4.0
10
+ version: 1.5.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Stephen Augenstein
@@ -15,22 +15,28 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-23 00:00:00 -05:00
18
+ date: 2011-07-06 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
22
- description:
23
- email: perl.programmer@gmail.com
22
+ description: ruby-audio wraps around libsndfile to provide simplified sound reading and writing support to ruby programs
23
+ email:
24
+ - perl.programmer@gmail.com
24
25
  executables: []
25
26
 
26
27
  extensions:
27
- - ext/extconf.rb
28
- extra_rdoc_files: []
29
-
28
+ - ext/rubyaudio_ext/extconf.rb
29
+ extra_rdoc_files:
30
+ - README.rdoc
31
+ - ext/rubyaudio_ext/ra_buffer.c
32
+ - ext/rubyaudio_ext/ra_sound.c
33
+ - ext/rubyaudio_ext/ra_soundinfo.c
34
+ - ext/rubyaudio_ext/rubyaudio_ext.c
30
35
  files:
36
+ - ruby-audio.gemspec
31
37
  - README.rdoc
32
- - Rakefile
33
38
  - LICENSE
39
+ - Rakefile
34
40
  - lib/ruby-audio/buffer.rb
35
41
  - lib/ruby-audio/sound.rb
36
42
  - lib/ruby-audio/sound_info.rb
@@ -43,14 +49,14 @@ files:
43
49
  - spec/data/what.wav
44
50
  - spec/data/what2.wav
45
51
  - spec/data/what.mp3
46
- - ext/extconf.rb
47
- - ext/ra_buffer.c
48
- - ext/ra_sound.c
49
- - ext/ra_soundinfo.c
50
- - ext/rubyaudio_ext.c
51
- - ext/ra_buffer.h
52
- - ext/ra_sound.h
53
- - ext/ra_soundinfo.h
52
+ - ext/rubyaudio_ext/ra_buffer.c
53
+ - ext/rubyaudio_ext/ra_sound.c
54
+ - ext/rubyaudio_ext/ra_soundinfo.c
55
+ - ext/rubyaudio_ext/rubyaudio_ext.c
56
+ - ext/rubyaudio_ext/ra_buffer.h
57
+ - ext/rubyaudio_ext/ra_sound.h
58
+ - ext/rubyaudio_ext/ra_soundinfo.h
59
+ - ext/rubyaudio_ext/extconf.rb
54
60
  has_rdoc: true
55
61
  homepage: http://github.com/warhammerkid/ruby-audio
56
62
  licenses: []
@@ -60,11 +66,6 @@ rdoc_options:
60
66
  - --line-numbers
61
67
  - --main
62
68
  - README.rdoc
63
- - ext/ra_buffer.c
64
- - ext/ra_sound.c
65
- - ext/ra_soundinfo.c
66
- - ext/rubyaudio_ext.c
67
- - README.rdoc
68
69
  require_paths:
69
70
  - lib
70
71
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -91,7 +92,7 @@ rubyforge_project:
91
92
  rubygems_version: 1.3.7
92
93
  signing_key:
93
94
  specification_version: 3
94
- summary: ruby-audio wraps around libsndfile to provide simplified sound reading and writing support to ruby programs
95
+ summary: libsndfile wrapper for ruby
95
96
  test_files:
96
97
  - spec/buffer_spec.rb
97
98
  - spec/sound_info_spec.rb
data/ext/extconf.rb DELETED
@@ -1,29 +0,0 @@
1
- require 'mkmf'
2
-
3
- $CFLAGS.gsub!("-arch i386", "")
4
- $LDFLAGS.gsub!("-arch i386", "")
5
-
6
- dir_config('sndfile')
7
-
8
- # Mega-Nerd windows installer installs as libsndfile-1.dll
9
- if RUBY_PLATFORM =~ /(mswin|mingw|cygwin)/
10
- sndfile_lib = 'sndfile-1'
11
- else
12
- sndfile_lib = 'sndfile'
13
- end
14
-
15
- # libsndfile requirements
16
- find_header 'sndfile.h', '/opt/local/include', '/usr/local/include', 'C:/Program Files/Mega-Nerd/libsndfile/include'
17
- unless find_library sndfile_lib, 'sf_open', '/opt/local/lib', '/usr/local/lib', 'C:/Program Files/Mega-Nerd/libsndfile'
18
- fail <<-EOM
19
- Can't find libsndfile (http://www.mega-nerd.com/libsndfile/)
20
-
21
- Try passing --with-sndfile-dir or --with-sndfile-lib and --with-sndfile-include
22
- options to extconf.
23
- EOM
24
- end
25
-
26
- # Check for format support
27
- have_const('SF_FORMAT_OGG', 'sndfile.h')
28
-
29
- create_makefile 'rubyaudio_ext'