Permalink
Browse files

wip: Integrated proper Rails 3 generators; specs are green for Rails 3.

  • Loading branch information...
1 parent 49602ff commit a1fc9158f52bddfab860f498cfa9906691d89660 Davis W. Frank committed Dec 6, 2010
View
@@ -9,4 +9,3 @@ jasmine-example/
.rvmrc
.pairs
*.swp
-Gemfile.lock
View
22 Gemfile
@@ -1,20 +1,4 @@
-source :gemcutter
+source "http://rubygems.org"
-gem 'rake', '0.8.7'
-gem 'jeweler', '>= 1.4.0'
-gem 'gemcutter', '>= 0.5.0'
-
-group :test do
- gem 'json_pure', '~>1.4.3'
- gem 'rack', '~>1.2.1'
- gem 'rack-test', :require => 'rack/test'
- gem 'selenium-rc', '>= 2.2.1'
- gem 'selenium-client', '>= 1.2.18'
-
-# gem 'rspec', '~>2.0.1'
- gem 'rspec', '>= 1.2'
-
- # this needs to be installed to test the Rails2 generator
-# gem 'rails', '~>3.0.1'
- gem 'rails', '>= 2.2'
-end
+# dependencies are specified in jasmine.gemspec
+gemspec
View
@@ -0,0 +1,99 @@
+PATH
+ remote: .
+ specs:
+ Jasmine (1.0.1.1)
+ json_pure (~> 1.4.3)
+ selenium-client (>= 1.2.18)
+ selenium-rc (>= 2.2.1)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ abstract (1.0.0)
+ actionmailer (3.0.3)
+ actionpack (= 3.0.3)
+ mail (~> 2.2.9)
+ actionpack (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
+ builder (~> 2.1.2)
+ erubis (~> 2.6.6)
+ i18n (~> 0.4)
+ rack (~> 1.2.1)
+ rack-mount (~> 0.6.13)
+ rack-test (~> 0.5.6)
+ tzinfo (~> 0.3.23)
+ activemodel (3.0.3)
+ activesupport (= 3.0.3)
+ builder (~> 2.1.2)
+ i18n (~> 0.4)
+ activerecord (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
+ arel (~> 2.0.2)
+ tzinfo (~> 0.3.23)
+ activeresource (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
+ activesupport (3.0.3)
+ arel (2.0.6)
+ builder (2.1.2)
+ diff-lcs (1.1.2)
+ erubis (2.6.6)
+ abstract (>= 1.0.0)
+ i18n (0.5.0)
+ json_pure (1.4.6)
+ mail (2.2.12)
+ activesupport (>= 2.3.6)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.16)
+ polyglot (0.3.1)
+ rack (1.2.1)
+ rack-mount (0.6.13)
+ rack (>= 1.0.0)
+ rack-test (0.5.6)
+ rack (>= 1.0)
+ rails (3.0.3)
+ actionmailer (= 3.0.3)
+ actionpack (= 3.0.3)
+ activerecord (= 3.0.3)
+ activeresource (= 3.0.3)
+ activesupport (= 3.0.3)
+ bundler (~> 1.0)
+ railties (= 3.0.3)
+ railties (3.0.3)
+ actionpack (= 3.0.3)
+ activesupport (= 3.0.3)
+ rake (>= 0.8.7)
+ thor (~> 0.14.4)
+ rake (0.8.7)
+ rspec (2.2.0)
+ rspec-core (~> 2.2)
+ rspec-expectations (~> 2.2)
+ rspec-mocks (~> 2.2)
+ rspec-core (2.2.1)
+ rspec-expectations (2.2.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.2.0)
+ selenium-client (1.2.18)
+ selenium-rc (2.2.4)
+ selenium-client (>= 1.2.18)
+ thor (0.14.6)
+ treetop (1.4.9)
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.23)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ Jasmine!
+ json_pure (~> 1.4.3)
+ rack (>= 1.2.1)
+ rack-test
+ rails (> 3.0.2)
+ rspec (>= 2.0)
+ selenium-client (>= 1.2.18)
+ selenium-rc (>= 2.2.1)
View
@@ -29,7 +29,13 @@ else
t.spec_files = FileList['spec/**/*.rb']
end
end
-task :spec => 'jasmine:copy_examples_to_gem'
+
+task :spec => ['jasmine:copy_examples_to_gem', 'bundle_install']
+
+task :spex do
+ `bundle install`
+ Rake::Task["spec"].invoke
+end
task :default => :spec
@@ -59,52 +65,11 @@ end
desc "Run specs via server"
task :jasmine => ['jasmine:server']
-namespace :jeweler do
- begin
- require "jeweler"
- Jeweler::Tasks.new do |gemspec|
- gemspec.name = "jasmine"
- gemspec.summary = "Jasmine Runner for Ruby"
- gemspec.description = "Javascript BDD test framework"
- gemspec.email = "jasmine-js@googlegroups.com"
- gemspec.homepage = "http://pivotal.github.com/jasmine"
- gemspec.authors = ["Rajan Agaskar", "Christian Williams", "Davis Frank"]
- gemspec.executables = ["jasmine"]
- gemspec.add_dependency('rake', '>= 0.8.7')
- gemspec.add_dependency('rspec', '>= 1.1.5')
- gemspec.add_dependency('rack', '>= 1.0.0')
- gemspec.add_dependency('selenium-rc', '>=2.1.0')
- gemspec.add_dependency('selenium-client', '>=1.2.17')
- gemspec.add_dependency('json_pure', '>=1.4.3')
- end
- Jeweler::GemcutterTasks.new
- end
-
- task :verify_build do
- [
- 'jasmine/lib/jasmine.css',
- 'jasmine/lib/jasmine.js',
- 'jasmine/lib/jasmine-html.js',
- ].each {|f| raise "Missing file #{f}" unless File.exist?(f)}
- end
-
- task :setup_filelist do
- Rake.application.jeweler_tasks.gemspec.files = FileList.new(
- 'generators/**/**',
- 'lib/**/**',
- 'jasmine/lib/jasmine.css',
- 'jasmine/lib/jasmine.js',
- 'jasmine/lib/jasmine-html.js',
- 'jasmine/lib/json2.js', # try to get rid of this
- 'jasmine/example/**',
- 'tasks/**',
- 'templates/**',
- 'MIT.LICENSE'
- )
- end
+desc "Install Bundle"
+task "bundle_install" do
+ `bundle install`
end
-Rake.application["jeweler:gemspec"].prerequisites.
- unshift("jeweler:verify_build").
- unshift("jeweler:setup_filelist").
- unshift("jasmine:copy_examples_to_gem")
+
+require 'bundler'
+Bundler::GemHelper.install_tasks
View
@@ -1,2 +1,2 @@
-jasmine_bin = File.expand_path(File.join(File.dirname(__FILE__), 'bin', 'jasmine'))
+xjasmine_bin = File.expand_path(File.join(File.dirname(__FILE__), 'bin', 'jasmine'))
`#{jasmine_bin} init`
View
@@ -1,103 +1,39 @@
-# Generated by jeweler
-# DO NOT EDIT THIS FILE DIRECTLY
-# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+require "jasmine/version"
Gem::Specification.new do |s|
- s.name = %q{jasmine}
- s.version = "1.0.1.1"
+ s.name = %q{Jasmine}
+ s.version = Jasmine::VERSION
+ s.platform = Gem::Platform::RUBY
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = ["Rajan Agaskar", "Christian Williams", "Davis Frank"]
- s.date = %q{2010-11-09}
+ s.authors = ["Rajan Agaskar", "Christian Williams", "Davis Frank"]
+ s.summary = %q{Javascript BDD test framework}
+ s.description = %q{Javascript BDD test framework}
+ s.email = %q{jasmine-js@googlegroups.com}
+ s.homepage = "http://pivotal.github.com/jasmine"
+
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
s.default_executable = %q{jasmine}
- s.description = %q{Javascript BDD test framework}
- s.email = %q{jasmine-js@googlegroups.com}
- s.executables = ["jasmine"]
- s.extra_rdoc_files = [
- "README.markdown"
- ]
- s.files = [
- ".gitignore",
- ".gitmodules",
- ".idea/dictionaries/pivotal.xml",
- "Gemfile",
- "MIT.LICENSE",
- "README.markdown",
- "RELEASE.markdown",
- "Rakefile",
- "VERSION.yml",
- "bin/jasmine",
- "copy_examples.rb",
- "generators/jasmine/jasmine_generator.rb",
- "generators/jasmine/templates/INSTALL",
- "generators/jasmine/templates/lib/tasks/jasmine.rake",
- "generators/jasmine/templates/spec/javascripts/support/jasmine-rails.yml",
- "generators/jasmine/templates/spec/javascripts/support/jasmine.yml",
- "generators/jasmine/templates/spec/javascripts/support/jasmine_runner.rb",
- "install.rb",
- "jasmine.gemspec",
- "lib/jasmine.rb",
- "lib/jasmine/base.rb",
- "lib/jasmine/command_line_tool.rb",
- "lib/jasmine/config.rb",
- "lib/jasmine/run.html.erb",
- "lib/jasmine/selenium_driver.rb",
- "lib/jasmine/server.rb",
- "lib/jasmine/spec_builder.rb",
- "lib/jasmine/tasks/jasmine.rake",
- "spec/bug_fixes_spec.rb",
- "spec/config_spec.rb",
- "spec/fixture/jasmine.erb.yml",
- "spec/jasmine_command_line_tool_spec.rb",
- "spec/jasmine_self_test_config.rb",
- "spec/jasmine_self_test_spec.rb",
- "spec/rails_generator_spec.rb",
- "spec/server_spec.rb",
- "spec/spec_helper.rb"
- ]
- s.homepage = %q{http://pivotal.github.com/jasmine}
- s.rdoc_options = ["--charset=UTF-8"]
- s.require_paths = ["lib"]
- s.rubygems_version = %q{1.3.7}
- s.summary = %q{Jasmine Runner for Ruby}
- s.test_files = [
- "spec/bug_fixes_spec.rb",
- "spec/config_spec.rb",
- "spec/jasmine_command_line_tool_spec.rb",
- "spec/jasmine_self_test_config.rb",
- "spec/jasmine_self_test_spec.rb",
- "spec/rails_generator_spec.rb",
- "spec/server_spec.rb",
- "spec/spec_helper.rb"
- ]
+ s.require_paths = ["lib"]
+ s.rdoc_options = ["--charset=UTF-8"]
+
+
+ s.add_dependency 'json_pure', '~>1.4.3'
+ s.add_dependency 'selenium-rc', '>= 2.2.1'
+ s.add_dependency 'selenium-client', '>= 1.2.18'
- if s.respond_to? :specification_version then
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
- s.specification_version = 3
+ # for Jasmine development & Rails 2 Generators
+# s.add_development_dependency 'rspec', '1.3.1'
+# s.add_development_dependency 'rails', '2.3.10'
+# s.add_development_dependency 'rack', '1.1'
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<rake>, [">= 0.8.7"])
- s.add_runtime_dependency(%q<rspec>, [">= 1.1.5"])
- s.add_runtime_dependency(%q<rack>, [">= 1.0.0"])
- s.add_runtime_dependency(%q<selenium-rc>, [">= 2.1.0"])
- s.add_runtime_dependency(%q<selenium-client>, [">= 1.2.17"])
- s.add_runtime_dependency(%q<json_pure>, [">= 1.4.3"])
- else
- s.add_dependency(%q<rake>, [">= 0.8.7"])
- s.add_dependency(%q<rspec>, [">= 1.1.5"])
- s.add_dependency(%q<rack>, [">= 1.0.0"])
- s.add_dependency(%q<selenium-rc>, [">= 2.1.0"])
- s.add_dependency(%q<selenium-client>, [">= 1.2.17"])
- s.add_dependency(%q<json_pure>, [">= 1.4.3"])
- end
- else
- s.add_dependency(%q<rake>, [">= 0.8.7"])
- s.add_dependency(%q<rspec>, [">= 1.1.5"])
- s.add_dependency(%q<rack>, [">= 1.0.0"])
- s.add_dependency(%q<selenium-rc>, [">= 2.1.0"])
- s.add_dependency(%q<selenium-client>, [">= 1.2.17"])
- s.add_dependency(%q<json_pure>, [">= 1.4.3"])
- end
-end
+ # for Jasmine development for Rails 3 generators
+ s.add_development_dependency 'rspec', '>= 2.0'
+ s.add_development_dependency 'rails', '> 3.0.2'
+ s.add_development_dependency 'rack', '>= 1.2.1'
+ s.add_development_dependency 'rack-test'
+end
@@ -0,0 +1,11 @@
+Description:
+ Install jasmine examples
+
+Example:
+ rails generate jasmine:examples
+
+ This will create:
+ public/javascripts/jasmine_examples/PlayerSpec.js
+ public/javascripts/jasmine_examples/SpecHelper.js
+ spec/javascripts/jasmine_examples/PlayerSpec.js
+ spec/javascripts/jasmine_examples/SpecHelper.js
@@ -0,0 +1,19 @@
+module Jasmine
+ module Generators
+ class ExamplesGenerator < Rails::Generators::Base
+
+ def self.source_root
+ @source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
+ end
+
+ def copy_example_files
+ directory 'public'
+ directory 'spec'
+ end
+
+ def app_name
+ Rails.application.class.name
+ end
+ end
+ end
+end
@@ -0,0 +1,22 @@
+function Player() {
+}
+Player.prototype.play = function(song) {
+ this.currentlyPlayingSong = song;
+ this.isPlaying = true;
+};
+
+Player.prototype.pause = function() {
+ this.isPlaying = false;
+};
+
+Player.prototype.resume = function() {
+ if (this.isPlaying) {
+ throw new Error("song is already playing");
+ }
+
+ this.isPlaying = true;
+};
+
+Player.prototype.makeFavorite = function() {
+ this.currentlyPlayingSong.persistFavoriteStatus(true);
+};
Oops, something went wrong.

0 comments on commit a1fc915

Please sign in to comment.