Skip to content

Commit

Permalink
Added +extcore+ as a javascript option in project generator
Browse files Browse the repository at this point in the history
  • Loading branch information
imm committed Apr 5, 2010
1 parent 4d671de commit 43fb57d
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGES.rdoc
@@ -1,5 +1,9 @@
= CHANGES

== My Changes

* Added +extcore+ as a javascript option in project generator

== 0.9.10 (Unreleased)

* Updated jquery to v1.4.2
Expand Down
4 changes: 2 additions & 2 deletions padrino-gen/README.rdoc
Expand Up @@ -42,7 +42,7 @@ test:: rspec (default), bacon, shoulda, cucumber, testspec, riot
renderer:: haml (default), erb
stylesheet:: sass (default), less
mock:: none (default), mocha, rr
script:: none (default), jquery, prototype, mootools, rightjs
script:: none (default), jquery, prototype, mootools, rightjs, extcore
orm:: none (default), mongomapper, mongoid, activerecord, sequel, couchrest

To learn more about the project generator, check out the guide to
Expand Down Expand Up @@ -145,4 +145,4 @@ To learn more about the mailer generator, check out the guide to

== Copyright

Copyright (c) 2010 Padrino. See LICENSE for details.
Copyright (c) 2010 Padrino. See LICENSE for details.
@@ -0,0 +1,15 @@
module Padrino
module Generators
module Components
module Scripts

module ExtcoreGen
def setup_script
copy_file('templates/scripts/ext-core.js', destination_root("/public/javascripts/ext-core.js"))
create_file(destination_root('/public/javascripts/application.js'), "// Put your application scripts here")
end
end # ExtCoreGen
end # Scripts
end # Components
end # Generators
end # Padrino
4 changes: 2 additions & 2 deletions padrino-gen/lib/padrino-gen/generators/project.rb
Expand Up @@ -28,7 +28,7 @@ def self.banner; "padrino-gen project [name] [options]"; end
component_option :orm, "database engine", :aliases => '-d', :choices => [:activerecord, :datamapper, :mongomapper, :mongoid, :sequel, :couchrest], :default => :none
component_option :test, "testing framework", :aliases => '-t', :choices => [:rspec, :shoulda, :cucumber, :bacon, :testspec, :riot], :default => :rspec
component_option :mock, "mocking library", :aliases => '-m', :choices => [:mocha, :rr], :default => :none
component_option :script, "javascript library", :aliases => '-s', :choices => [:jquery, :prototype, :rightjs, :mootools], :default => :none
component_option :script, "javascript library", :aliases => '-s', :choices => [:jquery, :prototype, :rightjs, :mootools, :extcore], :default => :none
component_option :renderer, "template engine", :aliases => '-e', :choices => [:haml, :erb], :default => :haml
component_option :stylesheet, "stylesheet engine", :aliases => '-c', :choices => [:less, :sass], :default => :none

Expand Down Expand Up @@ -76,4 +76,4 @@ def finish
end
end # Project
end # Generators
end # Padrino
end # Padrino

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions padrino-gen/padrino-gen.gemspec
Expand Up @@ -45,6 +45,7 @@ Gem::Specification.new do |s|
"lib/padrino-gen/generators/components/orms/sequel_gen.rb",
"lib/padrino-gen/generators/components/renderers/erb_gen.rb",
"lib/padrino-gen/generators/components/renderers/haml_gen.rb",
"lib/padrino-gen/generators/components/scripts/extcore_gen.rb",
"lib/padrino-gen/generators/components/scripts/jquery_gen.rb",
"lib/padrino-gen/generators/components/scripts/mootools_gen.rb",
"lib/padrino-gen/generators/components/scripts/prototype_gen.rb",
Expand Down Expand Up @@ -76,6 +77,7 @@ Gem::Specification.new do |s|
"lib/padrino-gen/generators/templates/helper.rb.tt",
"lib/padrino-gen/generators/templates/mailer.rb.tt",
"lib/padrino-gen/generators/templates/mailer_initializer.rb.tt",
"lib/padrino-gen/generators/templates/scripts/ext-core.js",
"lib/padrino-gen/generators/templates/scripts/jquery.js",
"lib/padrino-gen/generators/templates/scripts/lowpro.js",
"lib/padrino-gen/generators/templates/scripts/mootools-core.js",
Expand Down
7 changes: 7 additions & 0 deletions padrino-gen/test/test_project_generator.rb
Expand Up @@ -194,6 +194,13 @@ def setup
assert_file_exists('/tmp/sample_project/public/javascripts/right.js')
assert_file_exists('/tmp/sample_project/public/javascripts/application.js')
end

should "properly generate for ext-core" do
buffer = silence_logger { @project.start(['sample_project', '--root=/tmp', '--script=extcore']) }
assert_match /Applying.*?extcore.*?script/, buffer
assert_file_exists('/tmp/sample_project/public/javascripts/ext-core.js')
assert_file_exists('/tmp/sample_project/public/javascripts/application.js')
end
end

context "the generator for test component" do
Expand Down

0 comments on commit 43fb57d

Please sign in to comment.