sinatra_more 0.3.1 → 0.3.2
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.
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/generators/base_app/config/boot.rb.tt +0 -8
- data/generators/base_app/config/dependencies.rb.tt +8 -0
- data/generators/base_app/config.ru.tt +1 -3
- data/generators/components/component_actions.rb +1 -1
- data/generators/skeleton_generator.rb +1 -1
- data/sinatra_more.gemspec +1 -1
- data/test/generators/test_skeleton_generator.rb +3 -3
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -580,7 +580,7 @@ The available components and their default options are listed below:
|
|
580
580
|
* renderer: <tt>erb</tt> (default), <tt>haml</tt>
|
581
581
|
* mock: <tt>mocha</tt> (default), <tt>rr</tt>
|
582
582
|
* script: <tt>jquery</tt> (default), <tt>prototype</tt>, <tt>rightjs</tt>
|
583
|
-
* orm: <tt>
|
583
|
+
* orm: <tt>datamapper</tt> (default), <tt>mongomapper</tt>, <tt>activerecord</tt>, <tt>sequel</tt>
|
584
584
|
|
585
585
|
The generator framework within sinatra_more is highly extensible and additional components and tools can easily be added.
|
586
586
|
This would be achieved through forking our project and reading through the code in <tt>/generators/sinatra_generator.rb</tt> and
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
@@ -26,12 +26,4 @@ class <%= @class_name %> < Sinatra::Application
|
|
26
26
|
|
27
27
|
# Dependencies contains all required gems and core configuration
|
28
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
29
|
end
|
@@ -7,6 +7,14 @@ class <%= @class_name %> < Sinatra::Application
|
|
7
7
|
use Rack::Session::Cookie
|
8
8
|
use Rack::Flash
|
9
9
|
|
10
|
+
# Requires the initializer modules which configure specific components
|
11
|
+
Dir[File.dirname(__FILE__) + '/initializers/*.rb'].each do |file|
|
12
|
+
# Each initializer file contains a module called 'XxxxInitializer' (i.e HassleInitializer)
|
13
|
+
require file
|
14
|
+
file_class = File.basename(file, '.rb').classify
|
15
|
+
register "#{file_class}Initializer".constantize
|
16
|
+
end
|
17
|
+
|
10
18
|
# Returns the list of load paths for this sinatra application
|
11
19
|
def self.file_loading_paths
|
12
20
|
["lib/**/*.rb", "app/helpers/**/*.rb", "app/routes/**/*.rb", "app/models/*.rb"]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
RACK_ENV = ENV["RACK_ENV"] ||= "development" unless defined? RACK_ENV
|
2
|
-
|
2
|
+
ENV['DATABASE_URL'] = 'your_database_here'
|
3
3
|
|
4
4
|
require File.dirname(__FILE__) + '/app.rb'
|
5
5
|
|
@@ -8,6 +8,4 @@ log = File.new("log/sinatra.log", "a")
|
|
8
8
|
$stdout.reopen(log)
|
9
9
|
$stderr.reopen(log)
|
10
10
|
|
11
|
-
ENV['DATABASE_URL'] = 'your_database_here'
|
12
|
-
|
13
11
|
run <%= @class_name %>
|
@@ -6,7 +6,7 @@ module SinatraMore
|
|
6
6
|
def insert_require(*libs)
|
7
7
|
options = libs.extract_options!
|
8
8
|
options.reverse_merge!(:indent => 0, :after => /require\sgem.*?\n/)
|
9
|
-
multiple_gem_require = "%w[#{libs.join(' ')}].each { |
|
9
|
+
multiple_gem_require = "%w[#{libs.join(' ')}].each { |lib| require lib }\n"
|
10
10
|
req = indent_spaces(options[:indent]) + (libs.size == 1 ? "require '#{libs}'\n" : multiple_gem_require)
|
11
11
|
inject_into_file(options[:path], req, :after => options[:after])
|
12
12
|
end
|
@@ -19,7 +19,7 @@ module SinatraMore
|
|
19
19
|
argument :path, :desc => "The path to create your app"
|
20
20
|
|
21
21
|
# Definitions for the available customizable components
|
22
|
-
component_option :orm, "database engine", :aliases => '-d', :choices => [:
|
22
|
+
component_option :orm, "database engine", :aliases => '-d', :choices => [:datamapper, :mongomapper, :activerecord, :sequel]
|
23
23
|
component_option :test, "testing framework", :aliases => '-t', :choices => [:bacon, :shoulda, :rspec, :testspec, :riot]
|
24
24
|
component_option :mock, "mocking library", :aliases => '-m', :choices => [:mocha, :rr]
|
25
25
|
component_option :script, "javascript library", :aliases => '-s', :choices => [:jquery, :prototype, :rightjs]
|
data/sinatra_more.gemspec
CHANGED
@@ -17,7 +17,7 @@ class TestSkeletonGenerator < Test::Unit::TestCase
|
|
17
17
|
should "create components file containing options chosen with defaults" do
|
18
18
|
silence_logger { SinatraMore::SkeletonGenerator.start(['sample_app', '/tmp']) }
|
19
19
|
components_chosen = YAML.load_file('/tmp/sample_app/.components')
|
20
|
-
assert_equal '
|
20
|
+
assert_equal 'datamapper', components_chosen[:orm]
|
21
21
|
assert_equal 'bacon', components_chosen[:test]
|
22
22
|
assert_equal 'mocha', components_chosen[:mock]
|
23
23
|
assert_equal 'jquery', components_chosen[:script]
|
@@ -62,7 +62,7 @@ class TestSkeletonGenerator < Test::Unit::TestCase
|
|
62
62
|
|
63
63
|
|
64
64
|
context "the generator for orm components" do
|
65
|
-
should "properly generate
|
65
|
+
should "properly generate for sequel" do
|
66
66
|
SinatraMore::SkeletonGenerator.instance_eval("undef setup_orm if respond_to?('setup_orm')")
|
67
67
|
buffer = silence_logger { SinatraMore::SkeletonGenerator.start(['sample_app', '/tmp', '--orm=sequel', '--script=none']) }
|
68
68
|
assert_match /Applying.*?sequel.*?orm/, buffer
|
@@ -80,7 +80,7 @@ class TestSkeletonGenerator < Test::Unit::TestCase
|
|
80
80
|
assert_match_in_file(/class User < ActiveRecord::Base/, '/tmp/sample_app/app/models/user.rb')
|
81
81
|
end
|
82
82
|
|
83
|
-
should "properly generate for datamapper" do
|
83
|
+
should "properly generate default for datamapper" do
|
84
84
|
buffer = silence_logger { SinatraMore::SkeletonGenerator.start(['sample_app', '/tmp', '--orm=datamapper', '--script=none']) }
|
85
85
|
assert_match /Applying.*?datamapper.*?orm/, buffer
|
86
86
|
assert_match_in_file(/require 'dm-core'/, '/tmp/sample_app/config/dependencies.rb')
|