short_stack 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/.document +5 -0
  2. data/.gitignore +24 -0
  3. data/Gemfile +13 -0
  4. data/Gemfile.lock +71 -0
  5. data/LICENSE +20 -0
  6. data/README.rdoc +17 -0
  7. data/Rakefile +26 -0
  8. data/VERSION +1 -0
  9. data/lib/pancake/generators/global.rb +2 -0
  10. data/lib/pancake/generators/micro_generator.rb +23 -0
  11. data/lib/pancake/generators/short_generator.rb +23 -0
  12. data/lib/pancake/generators/templates/common/Gemfile +7 -0
  13. data/lib/pancake/generators/templates/common/dotgitignore +22 -0
  14. data/lib/pancake/generators/templates/common/dothtaccess +17 -0
  15. data/lib/pancake/generators/templates/micro/%stack_name%/%stack_name%.rb.tt +9 -0
  16. data/lib/pancake/generators/templates/micro/%stack_name%/Rakefile.tt +40 -0
  17. data/lib/pancake/generators/templates/micro/%stack_name%/config.ru.tt +15 -0
  18. data/lib/pancake/generators/templates/micro/%stack_name%/pancake_init.rb.tt +1 -0
  19. data/lib/pancake/generators/templates/micro/%stack_name%/public/.empty_directory +0 -0
  20. data/lib/pancake/generators/templates/micro/%stack_name%/tmp/.empty_directory +0 -0
  21. data/lib/pancake/generators/templates/micro/%stack_name%/views/layouts/application.html.haml +5 -0
  22. data/lib/pancake/generators/templates/micro/%stack_name%/views/root.html.haml +1 -0
  23. data/lib/pancake/generators/templates/short/%stack_name%/LICENSE.tt +20 -0
  24. data/lib/pancake/generators/templates/short/%stack_name%/README.tt +7 -0
  25. data/lib/pancake/generators/templates/short/%stack_name%/Rakefile.tt +56 -0
  26. data/lib/pancake/generators/templates/short/%stack_name%/VERSION.tt +1 -0
  27. data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%.rb.tt +14 -0
  28. data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/%stack_name%.rb.tt +6 -0
  29. data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/config.ru.tt +11 -0
  30. data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/config/config.rb.tt +23 -0
  31. data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/config/environments/development.rb.tt +15 -0
  32. data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/config/environments/production.rb.tt +16 -0
  33. data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/config/environments/staging.rb.tt +15 -0
  34. data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/models/.empty_directory +0 -0
  35. data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/mounts/.empty_directory +0 -0
  36. data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/public/.empty_directory +0 -0
  37. data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/tasks/%stack_name%.rake.tt +4 -0
  38. data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/tmp/.empty_directory +0 -0
  39. data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/views/layouts/application.html.haml +5 -0
  40. data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/views/root.html.haml +2 -0
  41. data/lib/pancake/generators/templates/short/%stack_name%/pancake_init.rb.tt +1 -0
  42. data/lib/pancake/generators/templates/short/%stack_name%/spec/%stack_name%_spec.rb.tt +11 -0
  43. data/lib/pancake/generators/templates/short/%stack_name%/spec/spec_helper.rb.tt +13 -0
  44. data/lib/short_stack.rb +213 -0
  45. data/lib/short_stack/controller.rb +185 -0
  46. data/lib/short_stack/default/views/base.html.haml +5 -0
  47. data/lib/short_stack/default/views/error.html.haml +12 -0
  48. data/lib/short_stack/middleware.rb +14 -0
  49. data/short_stack.gemspec +38 -0
  50. data/spec/fixtures/foobar/other_root/views/base.html.haml +4 -0
  51. data/spec/fixtures/foobar/views/basic.html.haml +1 -0
  52. data/spec/fixtures/foobar/views/inherited_from_base.html.haml +5 -0
  53. data/spec/fixtures/foobar/views/template.html.haml +3 -0
  54. data/spec/fixtures/foobar/views/vault.html.haml +3 -0
  55. data/spec/short_stack/controller_spec.rb +444 -0
  56. data/spec/short_stack/middlewares_spec.rb +14 -0
  57. data/spec/short_stack/router_spec.rb +153 -0
  58. data/spec/short_stack/short_stack_spec.rb +122 -0
  59. data/spec/short_stack/stack_spec.rb +124 -0
  60. data/spec/spec.opts +1 -0
  61. data/spec/spec_helper.rb +13 -0
  62. metadata +181 -0
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,24 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
22
+ *.gem
23
+ vendor
24
+ .bundle
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source :rubygems
2
+
3
+ gem 'pancake', '~>0.3'
4
+ gem 'rack-rescue', '>=0.1.2'
5
+ gem 'wrapt'
6
+
7
+ group :test do
8
+ gem 'rake'
9
+ gem 'rspec'
10
+ gem 'rack-test'
11
+ gem 'haml'
12
+ end
13
+
@@ -0,0 +1,71 @@
1
+ ---
2
+ hash: c2bd72a57ebf25f4cfc4d35cc52a9c3deeb478a7
3
+ sources:
4
+ - Rubygems:
5
+ uri: http://gemcutter.org
6
+ specs:
7
+ - rake:
8
+ version: 0.8.7
9
+ - activesupport:
10
+ version: 3.0.0.beta4
11
+ - tilt:
12
+ version: 1.0.1
13
+ - any_view:
14
+ version: 0.2.3
15
+ - extlib:
16
+ version: 0.9.15
17
+ - haml:
18
+ version: 3.0.12
19
+ - hashie:
20
+ version: 0.2.0
21
+ - rack:
22
+ version: 1.2.1
23
+ - url_mount:
24
+ version: 0.2.1
25
+ - http_router:
26
+ version: 0.2.5
27
+ - json:
28
+ version: 1.4.3
29
+ - rack-accept-media-types:
30
+ version: "0.9"
31
+ - rack-test:
32
+ version: 0.5.4
33
+ - thor:
34
+ version: 0.13.6
35
+ - wrapt:
36
+ version: 0.1.7
37
+ - pancake:
38
+ version: 0.3.0
39
+ - rack-rescue:
40
+ version: 0.1.2
41
+ - rspec:
42
+ version: 1.3.0
43
+ dependencies:
44
+ pancake:
45
+ version: ~> 0.3
46
+ group:
47
+ - :default
48
+ rack-rescue:
49
+ version: ">= 0.1.2"
50
+ group:
51
+ - :default
52
+ wrapt:
53
+ version: ">= 0"
54
+ group:
55
+ - :default
56
+ rake:
57
+ version: ">= 0"
58
+ group:
59
+ - :test
60
+ rspec:
61
+ version: ">= 0"
62
+ group:
63
+ - :test
64
+ rack-test:
65
+ version: ">= 0"
66
+ group:
67
+ - :test
68
+ haml:
69
+ version: ">= 0"
70
+ group:
71
+ - :test
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Daniel Neighman
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,17 @@
1
+ = short_stack
2
+
3
+ Description goes here.
4
+
5
+ == Note on Patches/Pull Requests
6
+
7
+ * Fork the project.
8
+ * Make your feature addition or bug fix.
9
+ * Add tests for it. This is important so I don't break it in a
10
+ future version unintentionally.
11
+ * Commit, do not mess with rakefile, version, or history.
12
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
+ * Send me a pull request. Bonus points for topic branches.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2010 Daniel Neighman. See LICENSE for details.
@@ -0,0 +1,26 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ require 'spec/rake/spectask'
5
+ Spec::Rake::SpecTask.new(:spec) do |spec|
6
+ spec.libs << 'lib' << 'spec'
7
+ spec.spec_files = FileList['spec/**/*_spec.rb']
8
+ end
9
+
10
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
11
+ spec.libs << 'lib' << 'spec'
12
+ spec.pattern = 'spec/**/*_spec.rb'
13
+ spec.rcov = true
14
+ end
15
+
16
+ task :default => :spec
17
+
18
+ require 'rake/rdoctask'
19
+ Rake::RDocTask.new do |rdoc|
20
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
21
+
22
+ rdoc.rdoc_dir = 'rdoc'
23
+ rdoc.title = "short_stack #{version}"
24
+ rdoc.rdoc_files.include('README*')
25
+ rdoc.rdoc_files.include('lib/**/*.rb')
26
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.1
@@ -0,0 +1,2 @@
1
+ require 'pancake/generators/micro_generator'
2
+ require 'pancake/generators/short_generator'
@@ -0,0 +1,23 @@
1
+ module Pancake
2
+ module Generators
3
+ class Micro < Thor::Group
4
+ include Thor::Actions
5
+
6
+ def self.source_root
7
+ File.join(File.dirname(__FILE__), "templates")
8
+ end
9
+
10
+ namespace "micro"
11
+ argument :stack_name, :banner => "Name of stack"
12
+
13
+ desc "Generates a Micro stack"
14
+ def stack
15
+ say "Creating The Stack For #{stack_name}"
16
+ directory "micro/%stack_name%", stack_name
17
+ template File.join(self.class.source_root, "common/dotgitignore"), "#{stack_name}/.gitignore"
18
+ template File.join(self.class.source_root, "common/dothtaccess"), "#{stack_name}/public/.htaccess"
19
+ template File.join(self.class.source_root, "common/Gemfile"), "#{stack_name}/Gemfile"
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ module Pancake
2
+ module Generators
3
+ class Short < Thor::Group
4
+ include Thor::Actions
5
+
6
+ def self.source_root
7
+ File.join(File.dirname(__FILE__), "templates")
8
+ end
9
+
10
+ namespace "short"
11
+ argument :stack_name, :banner => "Name of stack"
12
+
13
+ desc "Generates a short stack"
14
+ def stack
15
+ say "Creating The Short Stack For #{stack_name}"
16
+ directory "short/%stack_name%", stack_name
17
+ template File.join(self.class.source_root, "common/dotgitignore"), "#{stack_name}/.gitignore"
18
+ template File.join(self.class.source_root, "common/dothtaccess"), "#{stack_name}/lib/#{stack_name}/public/.htaccess"
19
+ template File.join(self.class.source_root, "common/Gemfile"), "#{stack_name}/Gemfile"
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,7 @@
1
+ source :rubygems
2
+
3
+ gem 'short_stack', '>=0.1.1'
4
+ gem 'haml'
5
+ gem 'shotgun'
6
+ gem 'thin'
7
+ gem 'racksh'
@@ -0,0 +1,22 @@
1
+ .DS_Store
2
+ log/*
3
+ tmp/*
4
+ TAGS
5
+ *~
6
+ .#*
7
+ schema/schema.rb
8
+ schema/*_structure.sql
9
+ schema/*.sqlite3
10
+ schema/*.sqlite
11
+ schema/*.db
12
+ *.sqlite
13
+ *.sqlite3
14
+ *.db
15
+ src/*
16
+ .hgignore
17
+ .hg/*
18
+ .svn/*
19
+ gems/gems/*/
20
+ gems/specifications/*
21
+ !gems/gems/thor*/
22
+ !gems/specifications/thor*
@@ -0,0 +1,17 @@
1
+ # Sets the default handler for FastCGI scripts
2
+ AddHandler fastcgi-script .fcgi
3
+
4
+ # If Apache2 is used together with mod_fcgid,
5
+ # uncomment the line below and comment in the line
6
+ # above to set the correct script handler
7
+ #AddHandler fcgid-script .fcgi
8
+
9
+ RewriteEngine On
10
+
11
+ RewriteRule ^$ index.html [QSA]
12
+ RewriteRule ^([^.]+)$ $1.html [QSA]
13
+ RewriteCond %{REQUEST_FILENAME} !-f
14
+ RewriteRule ^(.*)$ merb.fcgi [QSA,L]
15
+
16
+
17
+ ErrorDocument 500 "<h2>Application Error</h2>Merb could not be reached"
@@ -0,0 +1,9 @@
1
+ class <%= ActiveSupport::Inflector.camelize(stack_name) %> < ShortStack
2
+ add_root(__FILE__)
3
+ initialize_stack
4
+
5
+ get "/" do
6
+ render :root
7
+ end
8
+ end
9
+
@@ -0,0 +1,40 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'pancake'
4
+ <% klass_name = ActiveSupport::Inflector.camelize(stack_name) %>
5
+ require File.join(Pancake.get_root(__FILE__), "<%= stack_name %>")
6
+ Pancake.root = Pancake.get_root(__FILE__)
7
+ THIS_STACK = <%= klass_name %>
8
+ <%= klass_name %>.load_rake_tasks!(:master => true)
9
+
10
+ require 'spec/rake/spectask'
11
+ Spec::Rake::SpecTask.new(:spec) do |spec|
12
+ spec.libs << 'lib' << 'spec'
13
+ spec.spec_files = FileList['spec/**/*_spec.rb']
14
+ end
15
+
16
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
17
+ spec.libs << 'lib' << 'spec'
18
+ spec.pattern = 'spec/**/*_spec.rb'
19
+ spec.rcov = true
20
+ end
21
+
22
+
23
+ task :default => :spec
24
+
25
+ require 'rake/rdoctask'
26
+ Rake::RDocTask.new do |rdoc|
27
+ if File.exist?('VERSION.yml')
28
+ config = YAML.load(File.read('VERSION.yml'))
29
+ version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
30
+ else
31
+ version = ""
32
+ end
33
+
34
+ rdoc.rdoc_dir = 'rdoc'
35
+ rdoc.title = "foo #{version}"
36
+ rdoc.rdoc_files.include('README*')
37
+ rdoc.rdoc_files.include('lib/**/*.rb')
38
+ end
39
+
40
+
@@ -0,0 +1,15 @@
1
+ require 'rubygems'
2
+ require 'short_stack'
3
+ require 'haml'
4
+
5
+ require ::File.join(::File.expand_path(::File.dirname(__FILE__)), "<%= stack_name %>")
6
+
7
+ # get the application to run. The application in the Pancake.start block
8
+ # is the master application. It will have all requests directed to it through the
9
+ # pancake middleware
10
+ # This should be a very minimal file, but should be used when any stand alone code needs to be included
11
+ <%= ActiveSupport::Inflector.camelize(stack_name) %>.include_pancake_stack!
12
+
13
+ app = Pancake.start(:root => Pancake.get_root(__FILE__)){ <%= ActiveSupport::Inflector.camelize(stack_name) %>.stackup(:master => true) }
14
+
15
+ run app
@@ -0,0 +1 @@
1
+ require File.join(File.expand_path(File.dirname(__FILE__)), "<%= stack_name %>")
@@ -0,0 +1,20 @@
1
+ Copyright (c) <%= Date.today.year %> <YOUR NAME HERE>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,7 @@
1
+ = <%= stack_name %>
2
+
3
+ Description goes here.
4
+
5
+ == Copyright
6
+
7
+ Copyright (c) <%= Date.today.year %> <YOUR NAME HERE>. See LICENSE for details.
@@ -0,0 +1,56 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'pancake'
4
+
5
+ begin
6
+ require 'jeweler'
7
+ Jeweler::Tasks.new do |gem|
8
+ gem.name = "<%= stack_name %>"
9
+ gem.summary = %Q{TODO}
10
+ gem.email = "TODO"
11
+ gem.homepage = "TODO"
12
+ gem.authors = ["TODO"]
13
+ gem.add_dependency "pancake", ">=0.1.8"
14
+ gem.files = FileList["[A-Z]*", "pancake.init", "{lib,spec,rails}/**/*"]
15
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
+ end
17
+
18
+ rescue LoadError
19
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
20
+ end
21
+
22
+ require File.join(File.dirname(__FILE__), "lib", "<%= stack_name %>")
23
+ Pancake.root = Pancake.get_root(__FILE__, "lib", "<%= stack_name %>")
24
+ THIS_STACK = <%= ActiveSupport::Inflector.camelize(stack_name) %>
25
+ <%= ActiveSupport::Inflector.camelize(stack_name) %>.load_rake_tasks!(:master => true)
26
+
27
+ require 'spec/rake/spectask'
28
+ Spec::Rake::SpecTask.new(:spec) do |spec|
29
+ spec.libs << 'lib' << 'spec'
30
+ spec.spec_files = FileList['spec/**/*_spec.rb']
31
+ end
32
+
33
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
34
+ spec.libs << 'lib' << 'spec'
35
+ spec.pattern = 'spec/**/*_spec.rb'
36
+ spec.rcov = true
37
+ end
38
+
39
+
40
+ task :default => :spec
41
+
42
+ require 'rake/rdoctask'
43
+ Rake::RDocTask.new do |rdoc|
44
+ if File.exist?('VERSION.yml')
45
+ config = YAML.load(File.read('VERSION.yml'))
46
+ version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
47
+ else
48
+ version = ""
49
+ end
50
+
51
+ rdoc.rdoc_dir = 'rdoc'
52
+ rdoc.title = "foo #{version}"
53
+ rdoc.rdoc_files.include('README*')
54
+ rdoc.rdoc_files.include('lib/**/*.rb')
55
+ end
56
+