mustang 0.1.0 → 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.
Files changed (7) hide show
  1. data/.gitignore +17 -0
  2. data/README.md +8 -0
  3. data/Rakefile +6 -14
  4. data/ext/v8/extconf.rb +23 -20
  5. data/mustang.gemspec +19 -14
  6. metadata +25 -58
  7. data/gemspec.yml +0 -19
@@ -0,0 +1,17 @@
1
+ *.so
2
+ *.o
3
+ *.log
4
+ Makefile
5
+ \#.*
6
+ .\#.*
7
+ *.a
8
+ *.exe
9
+ build
10
+ pkg
11
+ tmp
12
+ eproject.cfg
13
+ .eproject
14
+ *.bundle
15
+ .svn
16
+ .DS_Store
17
+ *.gem
data/README.md CHANGED
@@ -1,9 +1,17 @@
1
+ This code is proudly sponsored by [Cubox, Agile Rails Devshop](http://cuboxsa.com)
2
+
1
3
  # Mustang - V8 engine in Ruby's body
2
4
 
3
5
  Mustang is ruby proxy library for awesome Google V8 JavaScript engine.
4
6
 
5
7
  ## Installation
6
8
 
9
+ Using rubygems:
10
+
11
+ $ gem install mustang
12
+
13
+ Manually:
14
+
7
15
  $ git clone git://github.com/nu7hatch/mustang.git
8
16
  $ cd mustang
9
17
  $ rake compile
data/Rakefile CHANGED
@@ -6,20 +6,11 @@ rescue LoadError
6
6
  STDERR.puts "Run `gem install isolate` to install 'isolate'."
7
7
  end
8
8
 
9
- begin
10
- require 'ore/tasks'
11
- Ore::Tasks.new
12
- rescue LoadError
13
- STDERR.puts "Run `gem install ore-tasks` to install 'ore/tasks'."
14
- end
15
-
16
9
  begin
17
10
  require 'rake/extensiontask'
18
11
  Rake::ExtensionTask.new("v8") do |ext|
19
12
  ext.lib_dir = 'lib'
20
13
  ext.source_pattern = "*.{cpp,h}"
21
- #ext.config_options << '--with-v8-include'
22
- #ext.config_options << '--with-v8-lib'
23
14
  end
24
15
  rescue LoadError
25
16
  STDERR.puts "Run `gem install rake-compiler` to install 'rake-compiler'."
@@ -52,9 +43,10 @@ Rake::RDocTask.new do |rdoc|
52
43
  rdoc.rdoc_files.include('lib/**/*.rb')
53
44
  end
54
45
 
55
- task :init_mustang do
46
+ desc "Opens console with loaded mustang env."
47
+ task :console do
56
48
  require 'mustang'
57
- $c = Mustang::Context.new
58
- end
59
-
60
- Rake::Task[:console].prerequisites << :init_mustang
49
+ require 'irb'
50
+ ARGV.clear
51
+ IRB.start
52
+ end
@@ -6,7 +6,7 @@ def darwin?
6
6
  end
7
7
 
8
8
  def cpu_x64?
9
- unless defined?(RUBY_ENGINE) and RUBY_ENGINE == 'rbx'
9
+ if defined?(RUBY_ENGINE) and RUBY_ENGINE != 'rbx'
10
10
  !!(RbConfig::MAKEFILE_CONFIG['arch'] =~ /x86_64/ ||
11
11
  RbConfig::MAKEFILE_CONFIG['target_cpu'] == 'x86_64' ||
12
12
  RbConfig::MAKEFILE_CONFIG['build_cpu'] == 'x86_64' ||
@@ -22,34 +22,37 @@ def make_sure_scons_installed!
22
22
  end
23
23
  end
24
24
 
25
- def compile_v8!(v8_dir)
26
- Dir.chdir v8_dir do
25
+ def compile_vendor_v8!(dir)
26
+ arch = cpu_x64? ? 'x64' : 'ia32'
27
+ flags = '-fPIC -fno-builtin-memcpy -shared'
28
+
29
+ Dir.chdir dir do
27
30
  if Dir["**/libv8.a"].empty?
28
- make_sure_scons_installed!
29
- defaults, ENV['CCFLAGS'] = ENV['CCFLAGS'], V8_FLAGS
30
- build_cmd = "scons mode=release snapshot=off library=static arch=#{V8_ARCH}"
31
- puts build_cmd
32
- system build_cmd
33
- ENV['CCFLAGS'] = defaults
31
+ begin
32
+ make_sure_scons_installed!
33
+ defaults, ENV['CCFLAGS'] = ENV['CCFLAGS'], flags
34
+ build_cmd = "scons mode=release snapshot=off library=static arch=#{arch}"
35
+ puts build_cmd
36
+ system build_cmd
37
+ ensure
38
+ ENV['CCFLAGS'] = defaults
39
+ end
34
40
  end
35
41
  end
36
42
  end
37
43
 
38
44
  V8_DIR = File.expand_path("../../../vendor/v8", __FILE__)
39
- V8_ARCH = cpu_x64? ? 'x64' : 'ia32'
40
- V8_FLAGS = '-fPIC -fno-builtin-memcpy'
41
-
42
- compile_v8!(V8_DIR)
45
+ inc, lib = dir_config('v8', File.join(V8_DIR, 'include'), V8_DIR)
43
46
 
44
- dir_config('mustang/v8')
45
- find_header('v8.h', File.join(V8_DIR, "include"))
46
- have_library('pthread')
47
- have_library('objc') if darwin?
47
+ if V8_DIR == lib
48
+ compile_vendor_v8!(V8_DIR)
49
+ end
48
50
 
49
- CONFIG['LDSHARED'] = '$(CXX) -shared' unless darwin?
50
- $LOCAL_LIBS << Dir[File.join(V8_DIR, "**/**/libv8.a")].first
51
+ find_library('v8', nil, lib)
52
+ have_library('pthread')
53
+ have_header('v8.h')
51
54
 
52
- %w[-Wall -g -rdynamic -fPIC].each { |flag|
55
+ %w[-Wall -g -rdynamic -fPIC].each { |flag|
53
56
  $CPPFLAGS += " #{flag}" unless $CPPFLAGS.include?(flag)
54
57
  }
55
58
 
@@ -1,17 +1,22 @@
1
1
  # -*- ruby -*-
2
2
 
3
- begin
4
- Ore::Specification.new do |gemspec|
5
- gemspec.files += `git ls-files`
6
- gemspec.extensions << "ext/mustang/extconf.rb"
7
- gemspec.require_paths = ["lib", "ext"]
8
- end
9
- rescue NameError
10
- begin
11
- require 'ore/specification'
12
- retry
13
- rescue LoadError
14
- STDERR.puts "The '#{__FILE__}' file requires Ore."
15
- STDERR.puts "Run `gem install ore-core` to install Ore."
16
- end
3
+ Gem::Specification.new do |s|
4
+ s.name = "mustang"
5
+ s.summary = "Awesome V8 JavaScript engine embedded into the Ruby's shiny body"
6
+ s.version = "0.1.1"
7
+ s.authors = ["Chris Kowalik", "Cubox"]
8
+ s.description = "Ruby proxy library for Google V8 Javascript engine."
9
+ s.homepage = "http://github.com/nu7hatch/mustang"
10
+ s.email = "chris@nu7hat.ch"
11
+ s.license = "MIT"
12
+
13
+ s.files = `git ls-files`.split("\n")
14
+ s.test_files = `git ls-files spec`.split("\n")
15
+ s.extensions = ["ext/v8/extconf.rb"]
16
+ s.require_paths = ["lib", "ext"]
17
+
18
+ s.add_development_dependency "ore-tasks", "~> 0.4"
19
+ s.add_development_dependency "rspec", "~> 2.0"
20
+ s.add_development_dependency "mocha", "~> 0.9"
21
+ s.add_development_dependency "rake-compiler", "~> 0.7"
17
22
  end
metadata CHANGED
@@ -1,102 +1,72 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mustang
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 1
8
- - 0
9
- version: 0.1.0
4
+ prerelease:
5
+ version: 0.1.1
10
6
  platform: ruby
11
7
  authors:
12
8
  - Chris Kowalik
9
+ - Cubox
13
10
  autorequire:
14
11
  bindir: bin
15
12
  cert_chain: []
16
13
 
17
- date: 2011-04-05 00:00:00 -03:00
18
- default_executable:
14
+ date: 2011-04-05 00:00:00 Z
19
15
  dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: rice
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ~>
27
- - !ruby/object:Gem::Version
28
- segments:
29
- - 1
30
- - 4
31
- version: "1.4"
32
- type: :runtime
33
- version_requirements: *id001
34
16
  - !ruby/object:Gem::Dependency
35
17
  name: ore-tasks
36
18
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
19
+ requirement: &id001 !ruby/object:Gem::Requirement
38
20
  none: false
39
21
  requirements:
40
22
  - - ~>
41
23
  - !ruby/object:Gem::Version
42
- segments:
43
- - 0
44
- - 4
45
24
  version: "0.4"
46
25
  type: :development
47
- version_requirements: *id002
26
+ version_requirements: *id001
48
27
  - !ruby/object:Gem::Dependency
49
28
  name: rspec
50
29
  prerelease: false
51
- requirement: &id003 !ruby/object:Gem::Requirement
30
+ requirement: &id002 !ruby/object:Gem::Requirement
52
31
  none: false
53
32
  requirements:
54
33
  - - ~>
55
34
  - !ruby/object:Gem::Version
56
- segments:
57
- - 2
58
- - 0
59
35
  version: "2.0"
60
36
  type: :development
61
- version_requirements: *id003
37
+ version_requirements: *id002
62
38
  - !ruby/object:Gem::Dependency
63
39
  name: mocha
64
40
  prerelease: false
65
- requirement: &id004 !ruby/object:Gem::Requirement
41
+ requirement: &id003 !ruby/object:Gem::Requirement
66
42
  none: false
67
43
  requirements:
68
- - - ">="
44
+ - - ~>
69
45
  - !ruby/object:Gem::Version
70
- segments:
71
- - 0
72
- - 9
73
46
  version: "0.9"
74
47
  type: :development
75
- version_requirements: *id004
48
+ version_requirements: *id003
76
49
  - !ruby/object:Gem::Dependency
77
50
  name: rake-compiler
78
51
  prerelease: false
79
- requirement: &id005 !ruby/object:Gem::Requirement
52
+ requirement: &id004 !ruby/object:Gem::Requirement
80
53
  none: false
81
54
  requirements:
82
55
  - - ~>
83
56
  - !ruby/object:Gem::Version
84
- segments:
85
- - 0
86
- - 7
87
57
  version: "0.7"
88
58
  type: :development
89
- version_requirements: *id005
90
- description: Ruby proxy library for Google V8 JavaScript engine.
91
- email:
92
- - chris@nu7hatch
59
+ version_requirements: *id004
60
+ description: Ruby proxy library for Google V8 Javascript engine.
61
+ email: chris@nu7hat.ch
93
62
  executables: []
94
63
 
95
- extensions: []
64
+ extensions:
65
+ - ext/v8/extconf.rb
66
+ extra_rdoc_files: []
96
67
 
97
- extra_rdoc_files:
98
- - README.md
99
68
  files:
69
+ - .gitignore
100
70
  - .rspec
101
71
  - Isolate
102
72
  - README.md
@@ -137,7 +107,6 @@ files:
137
107
  - ext/v8/v8_string.h
138
108
  - ext/v8/v8_value.cpp
139
109
  - ext/v8/v8_value.h
140
- - gemspec.yml
141
110
  - lib/core_ext/class.rb
142
111
  - lib/core_ext/object.rb
143
112
  - lib/core_ext/symbol.rb
@@ -1608,7 +1577,6 @@ files:
1608
1577
  - vendor/v8/tools/visual_studio/v8_x64.vcproj
1609
1578
  - vendor/v8/tools/visual_studio/x64.vsprops
1610
1579
  - vendor/v8/tools/windows-tick-processor.bat
1611
- has_rdoc: true
1612
1580
  homepage: http://github.com/nu7hatch/mustang
1613
1581
  licenses:
1614
1582
  - MIT
@@ -1623,28 +1591,27 @@ required_ruby_version: !ruby/object:Gem::Requirement
1623
1591
  requirements:
1624
1592
  - - ">="
1625
1593
  - !ruby/object:Gem::Version
1626
- segments:
1627
- - 0
1628
1594
  version: "0"
1629
1595
  required_rubygems_version: !ruby/object:Gem::Requirement
1630
1596
  none: false
1631
1597
  requirements:
1632
1598
  - - ">="
1633
1599
  - !ruby/object:Gem::Version
1634
- segments:
1635
- - 0
1636
1600
  version: "0"
1637
1601
  requirements: []
1638
1602
 
1639
- rubyforge_project: mustang
1640
- rubygems_version: 1.3.7
1603
+ rubyforge_project:
1604
+ rubygems_version: 1.7.1
1641
1605
  signing_key:
1642
1606
  specification_version: 3
1643
- summary: Awesome V8 JavaScript engine embedded into Ruby's shiny body.
1607
+ summary: Awesome V8 JavaScript engine embedded into the Ruby's shiny body
1644
1608
  test_files:
1645
1609
  - spec/core_ext/class_spec.rb
1646
1610
  - spec/core_ext/object_spec.rb
1647
1611
  - spec/core_ext/symbol_spec.rb
1612
+ - spec/fixtures/test1.js
1613
+ - spec/fixtures/test2.js
1614
+ - spec/spec_helper.rb
1648
1615
  - spec/v8/array_spec.rb
1649
1616
  - spec/v8/cast_spec.rb
1650
1617
  - spec/v8/context_spec.rb
@@ -1,19 +0,0 @@
1
- name: mustang
2
- version: 0.1.0
3
- summary: Awesome V8 JavaScript engine embedded into Ruby's shiny body.
4
- description:
5
- Ruby proxy library for Google V8 JavaScript engine.
6
-
7
- license: MIT
8
- authors: Chris Kowalik
9
- email: chris@nu7hatch
10
- homepage: http://github.com/nu7hatch/mustang
11
-
12
- dependencies:
13
- rice: ~> 1.4
14
-
15
- development_dependencies:
16
- ore-tasks: ~> 0.4
17
- rspec: ~> 2.0
18
- mocha: >= 0.9
19
- rake-compiler: ~> 0.7