sinatra-static-bp 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2012 Jean-Philippe Doyle, Hookt Studios inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # sinatra-static-bp
2
+
3
+ > Boilerplate generator for simple static ruby applications.
4
+ Easy deploy on Amazon S3 with complete assets management.
5
+
6
+ ## Usage
7
+
8
+ $ gem install sinatra-static-bp
9
+ $ sinatra-static-bp simple-website
10
+
11
+ See generated README.md in your new app folder for complete instructions.
12
+
13
+ ## Featuring
14
+
15
+ * [sinatra](https://github.com/sinatra/sinatra) as the core
16
+ * [sinatra-assetpack](https://github.com/hooktstudios/sinatra-assetpack) as the assets manager
17
+ * [sinatra-static](https://github.com/hooktstudios/sinatra-static) as the static pages generator
18
+ * [s3-site-static](github.com/hooktstudios/s3-static-site.git) as the S3 deployment tool
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'sinatra-static-bp'
4
+ Boilerplate.create(ARGV)
@@ -0,0 +1,27 @@
1
+ require 'erb'
2
+
3
+ class Boilerplate
4
+ def self.create(args)
5
+ project_name = args[0]
6
+ project_path = File.join(Dir.pwd, project_name)
7
+ lib_root = File.dirname(__FILE__)
8
+
9
+ if File.exists?(project_path)
10
+ puts "Folder \"#{project_name}\" already exist."
11
+ return
12
+ end
13
+
14
+ # Copy skeleton
15
+ FileUtils.mkdir project_path
16
+ FileUtils.cp_r File.join(lib_root, 'skeleton', '.'), project_path
17
+
18
+ # Evaluate ERB templates
19
+ Dir.glob(File.join(project_path, '**/*.erb')).each do |template|
20
+ erb = ERB.new(File.new(template).read)
21
+ out = File.new(template.gsub(/\.erb$/, ''), 'w')
22
+ out.puts erb.result(binding)
23
+ out.close
24
+ FileUtils.rm template
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,4 @@
1
+ load 'deploy'
2
+ # Uncomment if you are using Rails' asset pipeline
3
+ # load 'deploy/assets'
4
+ load 'config/deploy' # remove this line to skip loading any of the default tasks
@@ -0,0 +1,21 @@
1
+ source "https://rubygems.org"
2
+ ruby "1.9.3"
3
+
4
+ gem "sinatra", :require => 'sinatra/base'
5
+ gem "sinatra-assetpack",
6
+ :git => 'git://github.com/hooktstudios/sinatra-assetpack.git',
7
+ :require => "sinatra/assetpack"
8
+ gem "sinatra-advanced-routes",
9
+ :require => "sinatra/advanced_routes"
10
+ gem "sinatra-static",
11
+ :git => 'git://github.com/hooktstudios/sinatra-static.git',
12
+ :require => "sinatra_static"
13
+ gem "rake"
14
+ gem "rack"
15
+ gem "sass"
16
+
17
+ group :deploy do
18
+ gem "capistrano"
19
+ gem "s3-static-site",
20
+ :git => 'git://github.com/hooktstudios/s3-static-site.git'
21
+ end
@@ -0,0 +1,18 @@
1
+ # <%= project_name %>
2
+
3
+ Very simple website for <%= project_name %>.
4
+
5
+ ## Getting started
6
+
7
+ bundle install
8
+ cp config/s3.yml-tmpl config/s3.yml
9
+ rackup
10
+
11
+ ## Deploying
12
+
13
+ To deploy (if you dare) configure the requierd the s3 crendentials in `config/s3.yml` then use capistrano.
14
+
15
+ cap [dev|www] deploy
16
+
17
+ http://dev.<%= project_name %>.com.s3-website-us-east-1.amazonaws.com
18
+ http://www.<%= project_name %>.com.s3-website-us-east-1.amazonaws.com
@@ -0,0 +1,4 @@
1
+ APP_FILE = 'app.rb'
2
+ APP_CLASS = 'App'
3
+
4
+ require 'sinatra/assetpack/rake'
@@ -0,0 +1,40 @@
1
+ # encoding: utf-8
2
+ require 'rubygems'
3
+ require 'bundler'
4
+
5
+ Bundler.require
6
+
7
+ class App < Sinatra::Base
8
+ set :root, File.dirname(__FILE__)
9
+ register Sinatra::AdvancedRoutes
10
+ register Sinatra::AssetPack
11
+
12
+ assets {
13
+ serve '/', from: 'assets/public'
14
+ serve '/fonts', from: 'assets/fonts'
15
+ serve '/js', from: 'assets/js'
16
+ serve '/css', from: 'assets/css'
17
+ serve '/img', from: 'assets/img'
18
+
19
+ js :app, '/js/app.js', [
20
+ '/js/vendor/jquery.js',
21
+ '/js/main.js'
22
+ ]
23
+ css :app, '/css/application.css', [
24
+ '/css/styles.css',
25
+ ]
26
+
27
+ js_compression :jsmin # Optional
28
+ css_compression :simple # Optional
29
+ }
30
+
31
+ get '/' do
32
+ erb :index
33
+ end
34
+ end
35
+
36
+ # Compile static if run from ruby app.rb
37
+ if $0 == __FILE__
38
+ builder = SinatraStatic.new(App)
39
+ builder.build!('public/')
40
+ end
@@ -0,0 +1,2 @@
1
+ require './app'
2
+ run App
@@ -0,0 +1,12 @@
1
+ require 's3-static-site'
2
+ require 'capistrano/ext/multistage'
3
+
4
+ set :default_stage, 'development'
5
+
6
+ set :s3, YAML::load( File.open( File.expand_path( '../s3.yml', __FILE__ ) ) )
7
+
8
+ before 'deploy' do
9
+ run_locally "rm -rf public/*"
10
+ run_locally "export RACK_ENV=production && bundle exec ruby app.rb"
11
+ run_locally "export RACK_ENV=production && bundle exec rake assetpack:build"
12
+ end
@@ -0,0 +1,3 @@
1
+ set :bucket, s3['development']['bucket']
2
+ set :access_key_id, s3['development']['access_key_id']
3
+ set :secret_access_key, s3['development']['secret_access_key']
@@ -0,0 +1,3 @@
1
+ set :bucket, s3['production']['bucket']
2
+ set :access_key_id, s3['production']['access_key_id']
3
+ set :secret_access_key, s3['production']['secret_access_key']
@@ -0,0 +1,8 @@
1
+ development:
2
+ bucket: ""
3
+ access_key_id: ""
4
+ secret_access_key: ""
5
+ production:
6
+ bucket: ""
7
+ access_key_id: ""
8
+ secret_access_key: ""
metadata ADDED
@@ -0,0 +1,59 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sinatra-static-bp
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jean-Philippe Doyle
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-01-03 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Boilerplate generator for static sinatra applications
15
+ email: jeanphilippe.doyle@hooktstudios.com
16
+ executables:
17
+ - sinatra-static-bp
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - lib/sinatra-static-bp.rb
22
+ - lib/skeleton/app.rb
23
+ - lib/skeleton/Capfile
24
+ - lib/skeleton/config/deploy/development.rb
25
+ - lib/skeleton/config/deploy/production.rb
26
+ - lib/skeleton/config/deploy.rb
27
+ - lib/skeleton/config/s3.yml-tmpl
28
+ - lib/skeleton/config.ru
29
+ - lib/skeleton/Gemfile
30
+ - lib/skeleton/Rakefile
31
+ - lib/skeleton/README.md.erb
32
+ - LICENSE
33
+ - README.md
34
+ - bin/sinatra-static-bp
35
+ homepage: http://github.com/hooktstudios/sinatra-static-bp
36
+ licenses: []
37
+ post_install_message:
38
+ rdoc_options: []
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ none: false
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ none: false
53
+ requirements: []
54
+ rubyforge_project:
55
+ rubygems_version: 1.8.24
56
+ signing_key:
57
+ specification_version: 3
58
+ summary: sinatra-static-bp
59
+ test_files: []