express 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "thor"
4
+ require "active_support/core_ext/string"
5
+ require "digest/sha1"
6
+
7
+ class NewApp < Thor
8
+ include Thor::Actions
9
+
10
+ # Define arguments and options
11
+ argument :name
12
+
13
+ def self.source_root
14
+ File.expand_path("../../templates", __FILE__)
15
+ end
16
+
17
+ desc "new", "Creates the app"
18
+ def new
19
+ @module_name = name.classify
20
+ @secret_token = 2.times.inject("") {|m, o| m << Digest::SHA1.hexdigest(rand(10e30).to_s)}
21
+ Dir[File.join(self.class.source_root, '**/*')].each do |file|
22
+ if File.file?(file)
23
+ destination = file.gsub(self.class.source_root, name)
24
+ if file =~ /\.tt$/
25
+ template(file, destination.gsub(/\.tt$/, ''))
26
+ else
27
+ copy_file(file, destination)
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+
34
+ NewApp.start
@@ -0,0 +1,20 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "express"
3
+ s.version = "0.0.1"
4
+ s.authors = ["Norman Clarke"]
5
+ s.email = ["norman@njclarke.com"]
6
+ s.homepage = "http://github.com/bvision/express"
7
+ s.summary = "An alternative Rails application generator"
8
+ s.files = `git ls-files`.split("\n")
9
+ s.test_files = `git ls-files -- {test}/*`.split("\n")
10
+ s.require_paths = ["lib"]
11
+ s.executables = ["express"]
12
+ s.default_executable = 'express'
13
+ s.add_development_dependency "railties", "~> 3.2.0"
14
+
15
+ s.description = <<-EOM
16
+ Express generates a slimmed-down Rails application that leaves out anything not
17
+ urgently needed for content-oriented sites. Your Rails app will launch very,
18
+ very fast.
19
+ EOM
20
+ end
@@ -0,0 +1,15 @@
1
+ # See http://help.github.com/ignore-files/ for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile ~/.gitignore_global
6
+
7
+ # Ignore bundler config
8
+ /.bundle
9
+
10
+ # Ignore the default SQLite database.
11
+ /db/*.sqlite3
12
+
13
+ # Ignore all logfiles and tempfiles.
14
+ /log/*.log
15
+ /tmp
@@ -0,0 +1,5 @@
1
+ source :rubygems
2
+
3
+ gem "actionpack"
4
+ gem "railties"
5
+ gem "tzinfo"
@@ -0,0 +1,9 @@
1
+ require "rake/testtask"
2
+
3
+ task :default => :test
4
+
5
+ Rake::TestTask.new do |t|
6
+ t.test_files = FileList['test/**/*_test.rb']
7
+ t.libs << "test"
8
+ t.verbose = true
9
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,7 @@
1
+ <h1>You're on Rails!</h1>
2
+ <p>
3
+ Well, kind of.
4
+ </p>
5
+ <p>
6
+ You can find this file in "app/views/application/index.html.erb"
7
+ </p>
@@ -0,0 +1,10 @@
1
+ <!Doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8"/>
5
+ <title>Welcome to Rails</title>
6
+ </head>
7
+ <body>
8
+ <%= yield %>
9
+ </body>
10
+ </html>
@@ -0,0 +1,4 @@
1
+ require File.expand_path("../config/boot", __FILE__)
2
+
3
+ <%= @module_name %>::Application.initialize!
4
+ run <%= @module_name %>::Application
@@ -0,0 +1,12 @@
1
+ module <%= @module_name %>
2
+ class Application < Rails::Application
3
+ config.active_support.deprecation = :log
4
+ config.middleware.delete "Rack::Lock"
5
+ config.middleware.delete "ActionDispatch::Flash"
6
+ config.middleware.delete "ActionDispatch::BestStandardsSupport"
7
+
8
+ config.secret_token = "<%= @secret_token %>"
9
+ config.cache_classes = Rails.env.production?
10
+ config.consider_all_requests_local = Rails.env.development?
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ require "bundler"
2
+
3
+ (ENV["RAILS_ENV"] ||= "development").to_sym.tap do |env|
4
+ Bundler.setup :default, env
5
+ Bundler.require :default, env
6
+ end
7
+
8
+ require "rails"
9
+ require "action_controller/railtie"
10
+
11
+ require File.expand_path("../application", __FILE__)
12
+ require File.expand_path("../routes", __FILE__)
@@ -0,0 +1,3 @@
1
+ <%= @module_name %>::Application.routes.draw do
2
+ get '(:action)', :controller => :application, :defaults => {:action => :index}
3
+ end
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-Agent: *
5
+ # Disallow: /
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,8 @@
1
+ require 'test_helper'
2
+
3
+ class ApplicationControllerTest < ActionController::TestCase
4
+ test "should get index" do
5
+ get :index
6
+ assert_response :ok
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ ENV["RAILS_ENV"] = "test"
2
+ require File.expand_path('../../config/boot', __FILE__)
3
+ <%= @module_name %>::Application.initialize!
4
+
5
+ require 'rails/test_help'
File without changes
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: express
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Norman Clarke
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-03-08 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: railties
16
+ requirement: &70249099198780 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.2.0
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *70249099198780
25
+ description: ! 'Express generates a slimmed-down Rails application that leaves out
26
+ anything not
27
+
28
+ urgently needed for content-oriented sites. Your Rails app will launch very,
29
+
30
+ very fast.
31
+
32
+ '
33
+ email:
34
+ - norman@njclarke.com
35
+ executables:
36
+ - express
37
+ extensions: []
38
+ extra_rdoc_files: []
39
+ files:
40
+ - bin/express
41
+ - express.gemspec
42
+ - templates/.gitignore
43
+ - templates/Gemfile
44
+ - templates/Rakefile
45
+ - templates/app/controllers/application_controller.rb
46
+ - templates/app/views/application/index.html.erb
47
+ - templates/app/views/layouts/application.html.erb
48
+ - templates/config.ru.tt
49
+ - templates/config/application.rb.tt
50
+ - templates/config/boot.rb
51
+ - templates/config/routes.rb.tt
52
+ - templates/public/404.html
53
+ - templates/public/422.html
54
+ - templates/public/500.html
55
+ - templates/public/favicon.ico
56
+ - templates/public/robots.txt
57
+ - templates/script/rails
58
+ - templates/test/functional/application_controller_test.rb
59
+ - templates/test/test_helper.rb.tt
60
+ - templates/test/unit/.gitkeep
61
+ homepage: http://github.com/bvision/express
62
+ licenses: []
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ! '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ requirements: []
80
+ rubyforge_project:
81
+ rubygems_version: 1.8.11
82
+ signing_key:
83
+ specification_version: 3
84
+ summary: An alternative Rails application generator
85
+ test_files: []
86
+ has_rdoc: