Skip to content

Commit

Permalink
Revert "Auto build rspec.js"
Browse files Browse the repository at this point in the history
This reverts commit 58d10ea.
  • Loading branch information
adambeynon committed Nov 28, 2013
1 parent 58d10ea commit 8751f72
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 57 deletions.
6 changes: 6 additions & 0 deletions Gemfile
Expand Up @@ -5,3 +5,9 @@ gem 'opal', :github => 'opal/opal'
gem 'opal-sprockets', :github => 'opal/opal-sprockets'

gem 'rake'

gem 'rspec', '3.0.0.beta1'
gem 'rspec-support', '3.0.0.beta1'
gem 'rspec-core', '3.0.0.beta1'
gem 'rspec-mocks', '3.0.0.beta1'
gem 'rspec-expectations', '3.0.0.beta1'
26 changes: 23 additions & 3 deletions Rakefile
Expand Up @@ -6,17 +6,37 @@ Opal::RSpec::RakeTask.new(:default)

desc "Build opal/opal/rspec/rspec.js"
task :build do
Opal::RSpec.build_rspec_js true
File.open('opal/opal/rspec/rspec.js', 'w+') do |out|
out << build_rspec
end
end

desc 'Show dev/min sizes'
desc "Show dev/min sizes"
task :sizes do
code = Opal::RSpec.build_rspec
code = build_rspec
min = uglify code

puts "\ndevelopment: #{code.size}, minified: #{min.size}"
end

def build_rspec
Opal::Processor.dynamic_require_severity = :warning
Opal.append_path 'app'

Opal.use_gem 'rspec'
Opal.use_gem 'rspec-expectations'

%w[time fileutils test/unit/assertions coderay optparse shellwords socket uri
drb/drb diff/lcs diff/lcs/hunk].each do |asset|
Opal::Processor.stub_file asset
end

# bug in rspec? this autoload doesnt exist so we must stub it
Opal::Processor.stub_file 'rspec/matchers/built_in/have'

Opal.process('rspec-builder')
end

def uglify(str)
IO.popen('uglifyjs', 'r+') do |i|
i.puts str
Expand Down
40 changes: 1 addition & 39 deletions lib/opal/rspec.rb
@@ -1,44 +1,6 @@
require 'opal'
require 'opal/rspec/version'

module Opal
module RSpec
extend self

def base_dir
File.expand_path('../../..', __FILE__)
end

def build_rspec_js force = false
path = File.expand_path('../../../opal/opal/rspec/rspec.js', __FILE__)
puts "Building: #{path}..."
return if File.exist? path and not(force)
File.open(path, 'w+') { |out| out << rspec_js_code }
end

def rspec_js_code
previous_severity = Opal::Processor.dynamic_require_severity
Opal::Processor.dynamic_require_severity = :warning
Opal.append_path File.join(base_dir, 'app')

Opal.use_gem 'rspec'
Opal.use_gem 'rspec-expectations'

%w[time fileutils test/unit/assertions coderay optparse shellwords socket uri
drb/drb diff/lcs diff/lcs/hunk].each do |asset|
Opal::Processor.stub_file asset
end

# bug in rspec? this autoload doesnt exist so we must stub it
Opal::Processor.stub_file 'rspec/matchers/built_in/have'

Opal.process('rspec-builder').tap do
Opal::Processor.dynamic_require_severity = previous_severity
end
end
end
end

# Just register our opal code path with opal build tools
Opal.append_path File.join(Opal::RSpec.base_dir, 'opal')
Opal.append_path File.expand_path('../../../opal', __FILE__)

10 changes: 1 addition & 9 deletions lib/opal/rspec/rake_task.rb
Expand Up @@ -11,10 +11,8 @@ class RakeTask
URL = "http://localhost:9999/"

def initialize(name = 'opal:rspec', &block)
Opal::RSpec.build_rspec_js

desc "Run opal specs in phantomjs"
task name => 'opal:rspec:build' do
task name do
require 'rack'
require 'webrick'

Expand All @@ -39,12 +37,6 @@ def initialize(name = 'opal:rspec', &block)

exit 1 unless success
end

desc 'Build opal/opal/rspec/rspec.js'
task 'opal:rspec:build' do
Opal::RSpec.build_rspec_js
end

end
end
end
Expand Down
6 changes: 0 additions & 6 deletions opal-rspec.gemspec
Expand Up @@ -18,12 +18,6 @@ Gem::Specification.new do |s|
s.add_dependency 'opal', '~> 0.6.0'
s.add_dependency 'opal-sprockets', '~> 0.4.0'

s.add_dependency 'rspec', '3.0.0.beta1'
s.add_dependency 'rspec-support', '3.0.0.beta1'
s.add_dependency 'rspec-core', '3.0.0.beta1'
s.add_dependency 'rspec-mocks', '3.0.0.beta1'
s.add_dependency 'rspec-expectations', '3.0.0.beta1'

s.add_development_dependency 'rake'
end

0 comments on commit 8751f72

Please sign in to comment.