sinatra_more 0.2.9 → 0.3.0

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 (49) hide show
  1. data/.gitignore +2 -1
  2. data/README.rdoc +48 -4
  3. data/Rakefile +2 -1
  4. data/TODO +2 -1
  5. data/VERSION +1 -1
  6. data/bin/sinatra_gen +5 -0
  7. data/generators/base_app/app/.empty_directory +0 -0
  8. data/generators/base_app/app/helpers/.empty_directory +0 -0
  9. data/generators/base_app/app/helpers/view_helpers.rb +3 -0
  10. data/generators/base_app/app/models/.empty_directory +0 -0
  11. data/generators/base_app/app/routes/.empty_directory +0 -0
  12. data/generators/base_app/app.rb.tt +5 -0
  13. data/generators/base_app/config/boot.rb.tt +37 -0
  14. data/generators/base_app/config/dependencies.rb.tt +26 -0
  15. data/generators/base_app/config.ru.tt +13 -0
  16. data/generators/base_app/lib/.empty_directory +0 -0
  17. data/generators/base_app/log/.empty_directory +0 -0
  18. data/generators/base_app/public/images/.empty_directory +0 -0
  19. data/generators/base_app/public/images/.gitignore +0 -0
  20. data/generators/base_app/public/javascripts/.empty_directory +0 -0
  21. data/generators/base_app/public/stylesheets/.empty_directory +0 -0
  22. data/generators/base_app/test/models/.empty_directory +0 -0
  23. data/generators/base_app/test/routes/.empty_directory +0 -0
  24. data/generators/base_app/test/test_config.rb.tt +6 -0
  25. data/generators/base_app/tmp/.empty_directory +0 -0
  26. data/generators/base_app/vendor/gems/.empty_directory +0 -0
  27. data/generators/components/component_actions.rb +37 -0
  28. data/generators/components/mocks/mocha_mock_gen.rb +8 -0
  29. data/generators/components/mocks/rr_mock_gen.rb +8 -0
  30. data/generators/components/orms/activerecord_orm_gen.rb +60 -0
  31. data/generators/components/orms/datamapper_orm_gen.rb +44 -0
  32. data/generators/components/orms/mongomapper_orm_gen.rb +94 -0
  33. data/generators/components/orms/sequel_orm_gen.rb +48 -0
  34. data/generators/components/renderers/erb_renderer_gen.rb +7 -0
  35. data/generators/components/renderers/haml_renderer_gen.rb +17 -0
  36. data/generators/components/scripts/jquery_script_gen.rb +9 -0
  37. data/generators/components/scripts/prototype_script_gen.rb +10 -0
  38. data/generators/components/scripts/rightjs_script_gen.rb +9 -0
  39. data/generators/components/tests/bacon_test_gen.rb +21 -0
  40. data/generators/components/tests/riot_test_gen.rb +19 -0
  41. data/generators/components/tests/rspec_test_gen.rb +19 -0
  42. data/generators/components/tests/shoulda_test_gen.rb +19 -0
  43. data/generators/components/tests/testspec_test_gen.rb +19 -0
  44. data/generators/generator_actions.rb +77 -0
  45. data/generators/skeleton_generator.rb +41 -0
  46. data/sinatra_more.gemspec +52 -5
  47. data/test/generators/test_skeleton_generator.rb +172 -0
  48. data/test/helper.rb +16 -0
  49. metadata +59 -7
data/.gitignore CHANGED
@@ -19,4 +19,5 @@ rdoc
19
19
  pkg
20
20
 
21
21
  ## PROJECT::SPECIFIC
22
- webrat.log
22
+ webrat.log
23
+ tmp/**/*
data/README.rdoc CHANGED
@@ -58,9 +58,8 @@ Keep in mind, the user will be able to pull in these components seperately and l
58
58
  Please help me brainstorm and fork the project if you have any ideas to contribute.
59
59
 
60
60
  == Installation
61
-
62
- This gem has very few runtime dependencies. The 'sinatra' gem needs to be installed and also 'activesupport' (for the inflectors).
63
- If you want to use the WardenPlugin component, then the 'warden' gem would also be required.
61
+
62
+ If you want to use the WardenPlugin component, then the 'warden' gem would need to be installed.
64
63
 
65
64
  To install sinatra_more, simply grab the latest version from gemcutter:
66
65
 
@@ -541,12 +540,57 @@ or perhaps we want to have a short body without the need for a template file:
541
540
  body "This is a short body defined right in the mailer itself"
542
541
  end
543
542
  end
543
+
544
+ == Sinatra Generators
545
+
546
+ In addition to the support provided above, sinatra_more also comes preloaded with flexible code generators for Sinatra
547
+ powered in part by the excellent Thor gem (incidentally also used in the Rails 3 generators). These generators are intended
548
+ to allow for easy code generation both in creating new applications and building on existing ones. The generators have been
549
+ built to be as library-agnostic as possible, supporting a myriad of test frameworks, js libraries, mocking libraries, etc.
550
+
551
+ The usage for the generator is quite simple:
552
+
553
+ $ sinatra_gen <the_app_name> </path/to/create/app> --<component-name> <value>
554
+
555
+ The simplest possible command to generate a base application would be:
556
+
557
+ $ sinatra_gen demo_app .
558
+
559
+ This would construct a Sinatra application DemoApp (which extends from Sinatra::Application)
560
+ inside the folder 'demo_app' at our current path. Inside the application there would be configuration and
561
+ setup performed for the default components. You can also define specific components to be used:
544
562
 
563
+ $ sinatra_gen demo_app . --test=rspec --renderer=haml --mock=rr --script=jquery --orm datamapper
564
+
565
+ There is also support for aliases for each component within the command:
566
+
567
+ $ sinatra_gen demo_app . -t=rspec -r=haml -m=rr -s=jquery -d=datamapper
568
+
569
+ The available components and their default options are listed below:
570
+
571
+ * test: <tt>bacon</tt> (default), <tt>shoulda</tt>, <tt>rspec</tt>, <tt>testspec</tt>,<tt>riot</tt>
572
+ * renderer: <tt>erb</tt> (default), <tt>haml</tt>
573
+ * mock: <tt>mocha</tt> (default), <tt>rr</tt>
574
+ * script: <tt>jquery</tt> (default), <tt>prototype</tt>, <tt>rightjs</tt>
575
+ * orm: <tt>sequel</tt> (default), <tt>datamapper</tt>, <tt>mongomapper</tt>, <tt>activerecord</tt>
576
+
577
+ The generator framework within sinatra_more is highly extensible and additional components and tools can easily be added.
578
+ This would be achieved through forking our project and reading through the code in <tt>/generators/sinatra_generator.rb</tt> and
579
+ the setup instructions inside the relevant files within <tt>/generators/components/</tt>. We are happy to accept pull requests
580
+ for additional component types not originally included (although helping us maintain them would also be appreciated).
581
+
582
+ We are planning to add additional generator actions such as:
583
+
584
+ * Model generator (working for any of the available orms listed)
585
+ * Routes generator
586
+ * Migrations generator
587
+
545
588
  == Acknowledgements
546
589
 
547
- * Thanks to keldredd for the <tt>sinatra_helpers</tt> code that helped me to create erb capture and concat methods.
590
+ * Thanks to kelredd (http://github.com/kelredd) for the <tt>sinatra_helpers</tt> code that helped me to create erb capture and concat methods.
548
591
  * Thanks to sbfaulkner for the <tt>sinatra-helpers</tt> code that I browsed through many times while starting this library.
549
592
  * Thanks to vestel for the excellent modified <tt>pony</tt> fork which in part powers the mailer_plugin (http://github.com/vestel/pony)
593
+ * Thanks to wycats and all for the awesome Thor gem which made creating the sinatra generator relatively painless
550
594
 
551
595
  == Contributors
552
596
 
data/Rakefile CHANGED
@@ -12,8 +12,9 @@ begin
12
12
  gem.email = "nesquena@gmail.com"
13
13
  gem.homepage = "http://github.com/nesquena/sinatra_more"
14
14
  gem.authors = ["Nathan Esquenazi"]
15
- gem.add_runtime_dependency "tilt", ">= 0.2"
16
15
  gem.add_runtime_dependency "sinatra", ">= 0.9.2"
16
+ gem.add_runtime_dependency "tilt", ">= 0.2"
17
+ gem.add_runtime_dependency "thor", ">= 0.11.8"
17
18
  gem.add_runtime_dependency "activesupport", ">= 2.2.2"
18
19
  gem.add_development_dependency "haml", ">= 2.2.1"
19
20
  gem.add_development_dependency "shoulda", ">= 2.10.2"
data/TODO CHANGED
@@ -5,7 +5,8 @@
5
5
  * Add support for check_box_group, radio_button_group which create a set of checkboxes or radio buttons
6
6
  * Look into creating sinatra generators using rubigen (http://github.com/drnic/rubigen)
7
7
  * http://github.com/quirkey/sinatra-gen
8
- * http://github.com/monkrb/monk
8
+ * test generators
9
+ * add support for model, routes, migration generator types
9
10
  * Become total warden solution (basically just require warden gem installed, do everything else)
10
11
  * Look into removing overlapping methods and simply leverage sinatra_warden
11
12
  * Take advantage of shared strategies: http://github.com/hassox/warden_strategies/tree/master/lib/
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.9
1
+ 0.3.0
data/bin/sinatra_gen ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ %w[rubygems activesupport thor].each { |gem| require gem }
4
+ require File.dirname(__FILE__) + "/../generators/skeleton_generator"
5
+ SinatraMore::SkeletonGenerator.start
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ module ViewHelpers
2
+ # Basic helpers can be defined here
3
+ end
File without changes
File without changes
@@ -0,0 +1,5 @@
1
+ %w[rubygems sinatra/base].each { |gem| require gem }
2
+
3
+ class <%= @class_name %> < Sinatra::Application
4
+ load 'config/boot.rb'
5
+ end
@@ -0,0 +1,37 @@
1
+ # This file is merely for beginning the boot process, check dependencies.rb for more information
2
+
3
+ ROOT_DIR = File.dirname(__FILE__) + '/../' unless defined? ROOT_DIR
4
+
5
+ # Helper method for file references.
6
+ #
7
+ # @param args [Array] Path components relative to ROOT_DIR.
8
+ # @example Referencing a file in config called settings.yml:
9
+ # root_path("config", "settings.yml")
10
+ def root_path(*args)
11
+ File.join(ROOT_DIR, *args)
12
+ end
13
+
14
+ # Returns the full path to the public folder along with any given additions
15
+ # public_path("images")
16
+ def public_path(*args)
17
+ root_path('public', *args)
18
+ end
19
+
20
+ class <%= @class_name %> < Sinatra::Application
21
+ # Defines basic application settings
22
+ set :root, root_path
23
+ set :views, root_path("app", "views")
24
+ set :images_path, public_path("images")
25
+ set :default_builder, 'StandardFormBuilder'
26
+
27
+ # Dependencies contains all required gems and core configuration
28
+ require File.dirname(__FILE__) + '/dependencies.rb'
29
+
30
+ # Requires the initializer modules which configure specific components
31
+ Dir[File.dirname(__FILE__) + '/initializers/*.rb'].each do |file|
32
+ # Each initializer file contains a module called 'XxxxInitializer' (i.e HassleInitializer)
33
+ require file
34
+ file_class = File.basename(file, '.rb').classify
35
+ register "#{file_class}Initializer".constantize
36
+ end
37
+ end
@@ -0,0 +1,26 @@
1
+ # Dependencies contains all required gems, helpers and core configuration
2
+
3
+ class <%= @class_name %> < Sinatra::Application
4
+ %w[rubygems rack-flash warden sinatra_more bcrypt].each { |gem| require gem }
5
+
6
+ # Required middleware
7
+ use Rack::Session::Cookie
8
+ use Rack::Flash
9
+
10
+ # Returns the list of load paths for this sinatra application
11
+ def self.file_loading_paths
12
+ ["lib/**/*.rb", "app/helpers/**/*.rb", "app/routes/**/*.rb", "app/models/*.rb"]
13
+ end
14
+
15
+ # Require all the folders and files necessary to run the application
16
+ file_loading_paths.each { |load_path| Dir[root_path(load_path)].each { |file| require file } }
17
+
18
+ # Includes all necessary sinatra_more helpers
19
+ register SinatraMore::MarkupPlugin
20
+ register SinatraMore::RenderPlugin
21
+ register SinatraMore::MailerPlugin
22
+ register SinatraMore::WardenPlugin
23
+
24
+ # Required helpers
25
+ helpers ViewHelpers
26
+ end
@@ -0,0 +1,13 @@
1
+ RACK_ENV = ENV["RACK_ENV"] ||= "development" unless defined? RACK_ENV
2
+ ROOT_DIR = $0.gsub(%r{^.*?/}, '/') unless defined? ROOT_DIR
3
+
4
+ require File.dirname(__FILE__) + '/app.rb'
5
+
6
+ FileUtils.mkdir_p 'log' unless File.exists?('log')
7
+ log = File.new("log/sinatra.log", "a")
8
+ $stdout.reopen(log)
9
+ $stderr.reopen(log)
10
+
11
+ ENV['DATABASE_URL'] = 'your_database_here'
12
+
13
+ run <%= @class_name %>
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,6 @@
1
+ %w[rubygems sinatra].each {|gem| require gem }
2
+ require 'rack/test'
3
+ require File.dirname(__FILE__) + "/../app"
4
+
5
+
6
+ set :environment, :test
File without changes
File without changes
@@ -0,0 +1,37 @@
1
+ module SinatraMore
2
+ module ComponentActions
3
+ # Injects require statement into target file
4
+ # insert_require('active_record', :path => "test/test_config.rb", :indent => 2)
5
+ # options = { :path => '...', :indent => 2, :after => /.../ }
6
+ def insert_require(*libs)
7
+ options = libs.extract_options!
8
+ options.reverse_merge!(:indent => 0, :after => /require\sgem.*?\n/)
9
+ multiple_gem_require = "%w[#{libs.join(' ')}].each { |gem| require gem }\n"
10
+ req = indent_spaces(options[:indent]) + (libs.size == 1 ? "require '#{libs}'\n" : multiple_gem_require)
11
+ inject_into_file(options[:path], req, :after => options[:after])
12
+ end
13
+
14
+ # Returns space characters of given count
15
+ # indent_spaces(2)
16
+ def indent_spaces(count)
17
+ ' ' * count
18
+ end
19
+
20
+ # Injects the test class text into the test_config file for setting up the test gen
21
+ # insert_test_suite_setup('...CLASS_NAME...')
22
+ # => inject_into_file("test/test_config.rb", TEST.gsub(/CLASS_NAME/, @class_name), :after => "set :environment, :test\n")
23
+ def insert_test_suite_setup(suite_text, options={})
24
+ options.reverse_merge!(:path => "test/test_config.rb", :after => "set :environment, :test\n")
25
+ inject_into_file(options[:path], suite_text.gsub(/CLASS_NAME/, @class_name), :after => options[:after])
26
+ end
27
+
28
+ # Injects the mock library include into the test class in test_config for setting up mock gen
29
+ # insert_mock_library_include('Mocha::API')
30
+ # => inject_into_file("test/test_config.rb", " include Mocha::API\n", :after => /class.*?\n/)
31
+ def insert_mocking_include(library_name, options={})
32
+ options.reverse_merge!(:indent => 2, :after => /class.*?\n/, :path => "test/test_config.rb")
33
+ include_text = indent_spaces(options[:indent]) + "include #{library_name}\n"
34
+ inject_into_file(options[:path], include_text, :after => options[:after])
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,8 @@
1
+ module SinatraMore
2
+ module MochaMockGen
3
+ def setup_mock
4
+ insert_require 'mocha', :path => "test/test_config.rb", :after => "require 'rack/test'\n"
5
+ insert_mocking_include "Mocha::API", :path => "test/test_config.rb"
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module SinatraMore
2
+ module RrMockGen
3
+ def setup_mock
4
+ insert_require 'rr', :path => "test/test_config.rb", :after => "require 'rack/test'\n"
5
+ insert_mocking_include "RR::Adapters::RRMethods", :path => "test/test_config.rb"
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,60 @@
1
+ module SinatraMore
2
+ module ActiverecordOrmGen
3
+
4
+ AR = <<-AR
5
+ module ActiveRecordInitializer
6
+ def self.registered(app)
7
+ app.configure do
8
+ ActiveRecord::Base.establish_connection(
9
+ :adapter => 'sqlite3',
10
+ :dbfile => ENV['DATABASE_URL']
11
+ )
12
+ end
13
+ end
14
+ end
15
+ AR
16
+
17
+
18
+ MIGRATION = <<-MIGRATION
19
+ class CreateUsers < ActiveRecord::Migration
20
+ def self.up
21
+ create_table :users do |t|
22
+ t.column :name, :string
23
+ t.column :username, :string
24
+ t.column :email, :string
25
+ t.column :crypted_password, :string
26
+ t.column :created_at, :datetime
27
+ end
28
+ end
29
+
30
+ def self.down
31
+ drop_table :users
32
+ end
33
+ end
34
+ MIGRATION
35
+
36
+ USER = <<-USER
37
+ class User < ActiveRecord::Base
38
+ def self.authenticate(username, password)
39
+ user = User.first(:conditions => { :username => username })
40
+ user && user.has_password?(password) ? user : nil
41
+ end
42
+
43
+ def encrypt_password
44
+ self.crypted_password = BCrypt::Password.create(password)
45
+ end
46
+
47
+ def has_password?(password)
48
+ BCrypt::Password.new(crypted_password) == password
49
+ end
50
+ end
51
+ USER
52
+
53
+ def setup_orm
54
+ insert_require 'active_record', :path => "config/dependencies.rb", :indent => 2
55
+ create_file("config/initializers/activerecord.rb", AR)
56
+ create_file("db/migrate/001_create_users.rb", MIGRATION)
57
+ create_file("app/models/user.rb", USER)
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,44 @@
1
+ module SinatraMore
2
+ module DatamapperOrmGen
3
+
4
+ DM = <<-DM
5
+ module DatamapperInitializer
6
+ def self.registered(app)
7
+ app.configure do
8
+ DataMapper.setup(:default, ENV['DATABASE_URL'])
9
+ end
10
+ end
11
+ end
12
+ DM
13
+
14
+ USER = <<-USER
15
+ class User
16
+ include DataMapper::Resource
17
+
18
+ property :name, String
19
+ property :username, String
20
+ property :email, String
21
+ property :crypted_password, String
22
+
23
+ def self.authenticate(username, password)
24
+ user = User.first(:username => username)
25
+ user && user.has_password?(password) ? user : nil
26
+ end
27
+
28
+ def encrypt_password
29
+ self.crypted_password = BCrypt::Password.create(password)
30
+ end
31
+
32
+ def has_password?(password)
33
+ BCrypt::Password.new(crypted_password) == password
34
+ end
35
+ end
36
+ USER
37
+
38
+ def setup_orm
39
+ insert_require 'dm-core', :path => "config/dependencies.rb", :indent => 2
40
+ create_file("config/initializers/datamapper.rb", DM)
41
+ create_file("app/models/user.rb", USER)
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,94 @@
1
+ module SinatraMore
2
+ module MongomapperOrmGen
3
+
4
+ MONGO = <<-MONGO
5
+ class MongoDBConnectionFailure < RuntimeError; end
6
+
7
+ module MongoDBInitializer
8
+ def self.registered(app)
9
+ MongoMapper.connection = Mongo::Connection.new('localhost')
10
+ MongoMapper.database = 'fyourparking'
11
+ User.first
12
+ rescue RuntimeError
13
+ raise MongoDBConnectionFailure.new("mongodb cannot connect to db! Start the mongodb process and try again.")
14
+ end
15
+ end
16
+ MONGO
17
+
18
+ CONCERNED = <<-CONCERN
19
+ module MongoMapper
20
+ module Document
21
+ module ClassMethods
22
+ # TODO find a cleaner way for it to know where to look for dependencies
23
+ def concerned_with(*concerns)
24
+ concerns.each { |concern| require_dependency "./app/models/\#{name.underscore}/\#{concern}" }
25
+ end
26
+ end
27
+ end
28
+ end
29
+ CONCERN
30
+
31
+ USER = <<-USER
32
+ class User
33
+ include MongoMapper::Document
34
+ concerned_with :authentications
35
+
36
+ key :name, String, :required => true
37
+ key :username, String, :required => true
38
+ key :email, String, :required => true
39
+ key :crypted_password, String, :required => true
40
+
41
+ many :car_photos
42
+ end
43
+ USER
44
+
45
+ AUTH = <<-AUTH
46
+ class User
47
+ attr_accessor :password, :password_confirmation
48
+ before_validation :password_checks
49
+ validate :validate_password
50
+
51
+ def password_checks
52
+ if password_required?
53
+ encrypt_password if password.present? && password == password_confirmation
54
+ end
55
+ end
56
+
57
+ def password_required?
58
+ crypted_password.blank? || !password.blank?
59
+ end
60
+
61
+ def encrypt_password
62
+ self.crypted_password = BCrypt::Password.create(password)
63
+ end
64
+
65
+ def has_password?(password)
66
+ BCrypt::Password.new(crypted_password) == password
67
+ end
68
+
69
+ def encrypt_password
70
+ return if password.blank?
71
+ self.crypted_password = BCrypt::Password.create(password)
72
+ end
73
+
74
+ def validate_password
75
+ errors.add :password, "must not be empty" if crypted_password.blank? && password.blank?
76
+ errors.add :password, "must match password confirmation" unless password == password_confirmation
77
+ end
78
+
79
+ def self.authenticate(username, password)
80
+ user = User.first(:conditions => { :username => username })
81
+ user && user.has_password?(password) ? user : nil
82
+ end
83
+ end
84
+ AUTH
85
+
86
+ def setup_orm
87
+ insert_require 'mongo_mapper', :path => "config/dependencies.rb", :indent => 2
88
+ create_file("config/initializers/mongodb.rb", MONGO)
89
+ create_file("lib/ext/mongo_mapper.rb", CONCERNED)
90
+ create_file("app/models/user.rb", USER)
91
+ create_file("app/models/user/authentications.rb", AUTH)
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,48 @@
1
+ module SinatraMore
2
+ module SequelOrmGen
3
+
4
+ SEQUEL = <<-SEQUEL
5
+ module SequelInitializer
6
+ def self.registered(app)
7
+ app.configure do
8
+ Sequel.connect(ENV['DATABASE_URL'])
9
+ end
10
+ end
11
+ end
12
+ SEQUEL
13
+
14
+ USER = <<-USER
15
+ class User < Sequel::Model(:users)
16
+ unless table_exists?
17
+ set_schema do
18
+ primary_key :id
19
+ string :name
20
+ string :username
21
+ string :email
22
+ string :crypted_password
23
+ end
24
+ create_table
25
+ end
26
+
27
+ def self.authenticate(username, password)
28
+ user = User.filter(:username => username).first
29
+ user && user.has_password?(password) ? user : nil
30
+ end
31
+
32
+ def encrypt_password
33
+ self.crypted_password = BCrypt::Password.create(password)
34
+ end
35
+
36
+ def has_password?(password)
37
+ BCrypt::Password.new(crypted_password) == password
38
+ end
39
+ end
40
+ USER
41
+
42
+ def setup_orm
43
+ insert_require 'sequel', :path => "config/dependencies.rb", :indent => 2
44
+ create_file("config/initializers/sequel.rb", SEQUEL)
45
+ create_file("app/models/user.rb", USER)
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,7 @@
1
+ module SinatraMore
2
+ module ErbRendererGen
3
+ def setup_renderer
4
+ insert_require 'erb', :path => "config/dependencies.rb", :indent => 2
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,17 @@
1
+ module SinatraMore
2
+ module HamlRendererGen
3
+
4
+ HASSLE = <<-HASSLE
5
+ module HassleInitializer
6
+ def self.registered(app)
7
+ app.use Hassle
8
+ end
9
+ end
10
+ HASSLE
11
+
12
+ def setup_renderer
13
+ insert_require('haml', 'sass', 'hassle', :path => 'config/dependencies.rb', :indent => 2)
14
+ create_file("config/initializers/hassle.rb", HASSLE)
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,9 @@
1
+ module SinatraMore
2
+ module JqueryScriptGen
3
+
4
+ def setup_script
5
+ get("http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js", "public/javascripts/jquery.min.js")
6
+ end
7
+
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ module SinatraMore
2
+ module PrototypeScriptGen
3
+
4
+ def setup_script
5
+ get("http://prototypejs.org/assets/2009/8/31/prototype.js", "public/javascripts/prototype.js")
6
+ get('http://github.com/nesquena/lowpro/raw/master/dist/lowpro.js', "public/javascripts/lowpro.js")
7
+ end
8
+
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ module SinatraMore
2
+ module RightjsScriptGen
3
+
4
+ def setup_script
5
+ get("http://rightjs.org/builds/current/right-min.js", "public/javascripts/right-min.js")
6
+ end
7
+
8
+ end
9
+ end
@@ -0,0 +1,21 @@
1
+ module SinatraMore
2
+ module BaconTestGen
3
+ BACON_SETUP = <<-TEST
4
+ \nclass Bacon::Context
5
+ include Rack::Test::Methods
6
+ end
7
+
8
+ def app
9
+ CLASS_NAME
10
+ end
11
+ TEST
12
+
13
+ def setup_test
14
+ insert_require 'bacon', :path => "test/test_config.rb"
15
+ insert_test_suite_setup BACON_SETUP
16
+ end
17
+
18
+ end
19
+ end
20
+
21
+
@@ -0,0 +1,19 @@
1
+ module SinatraMore
2
+ module RiotTestGen
3
+ RIOT_SETUP = <<-TEST
4
+ \nclass Riot::Context
5
+ include Rack::Test::Methods
6
+
7
+ def app
8
+ CLASS_NAME
9
+ end
10
+ end
11
+ TEST
12
+
13
+ def setup_test
14
+ insert_require 'riot', :path => "test/test_config.rb"
15
+ insert_test_suite_setup RIOT_SETUP
16
+ end
17
+
18
+ end
19
+ end