sinatra_with_assets 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +8 -0
- data/Rakefile +1 -0
- data/bin/sinatra-assets +64 -0
- data/lib/sinatra_with_assets/version.rb +3 -0
- data/lib/sinatra_with_assets.rb +5 -0
- data/lib/templates/Gemfile +9 -0
- data/lib/templates/README.markdown +5 -0
- data/lib/templates/app/assets/javascripts/app.js.coffee +6 -0
- data/lib/templates/app/assets/stylesheets/app.css.scss +3 -0
- data/lib/templates/config.ru +20 -0
- data/lib/templates/public/assets/.gitkeep +0 -0
- data/lib/templates/rvmrc +1 -0
- data/lib/templates/server +3 -0
- data/lib/templates/views/index.slim +3 -0
- data/lib/templates/views/layout.slim +8 -0
- data/sinatra_with_assets.gemspec +22 -0
- metadata +81 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/sinatra-assets
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
require 'thor'
|
5
|
+
|
6
|
+
class SinatraAssets < Thor
|
7
|
+
include Thor::Actions
|
8
|
+
attr_accessor :app_name
|
9
|
+
attr_accessor :constant_name
|
10
|
+
|
11
|
+
desc 'new [APP_NAME]', 'Make a new sinatra app with assets'
|
12
|
+
def new(app_name)
|
13
|
+
@app_name = app_name
|
14
|
+
@constant_name = constant_name_from(File.split(app_name)[1])
|
15
|
+
|
16
|
+
setup
|
17
|
+
|
18
|
+
copy_file 'README.markdown'
|
19
|
+
copy_file 'Gemfile'
|
20
|
+
|
21
|
+
copy_file 'server'
|
22
|
+
chmod "server", 0755
|
23
|
+
|
24
|
+
template 'config.ru'
|
25
|
+
template 'rvmrc', '.rvmrc'
|
26
|
+
|
27
|
+
directory 'app'
|
28
|
+
directory 'public'
|
29
|
+
|
30
|
+
copy_file 'views/index.slim'
|
31
|
+
template 'views/layout.slim'
|
32
|
+
|
33
|
+
if yes?("Use Twitter Boostrap?")
|
34
|
+
bootstrap_endpoint = 'https://raw.github.com/twitter/bootstrap/master/bootstrap.min.css'
|
35
|
+
say_status 'curl', bootstrap_endpoint, true
|
36
|
+
system("curl -s #{bootstrap_endpoint} > #{File.join(app_name, 'app/assets/stylesheets/bootstrap.min.css')}")
|
37
|
+
prepend_to_file 'app/assets/stylesheets/app.css.scss', "//= require bootstrap.min\n\n"
|
38
|
+
end
|
39
|
+
|
40
|
+
say_status 'git', `git init #{app_name}`, true
|
41
|
+
|
42
|
+
say <<-GETSTARTED, Thor::Shell::Color::CYAN
|
43
|
+
|
44
|
+
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
45
|
+
Now, `cd` into your new app and run `./server` to boot up.
|
46
|
+
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
47
|
+
|
48
|
+
GETSTARTED
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def setup
|
54
|
+
source_paths << File.expand_path(File.join(__FILE__, '../../lib/templates'))
|
55
|
+
self.destination_root = File.expand_path(File.join('.', @app_name))
|
56
|
+
end
|
57
|
+
|
58
|
+
def constant_name_from(name)
|
59
|
+
name.split("_").map { |word| letters = word.split(//); letters.unshift(letters.shift.upcase); letters.join }.join
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
SinatraAssets.start
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'sinatra'
|
2
|
+
require 'sprockets'
|
3
|
+
require 'slim'
|
4
|
+
|
5
|
+
class <%= constant_name %> < Sinatra::Base
|
6
|
+
get '/' do
|
7
|
+
slim :index
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
map '/assets' do
|
12
|
+
environment = Sprockets::Environment.new
|
13
|
+
environment.append_path 'app/assets/javascripts'
|
14
|
+
environment.append_path 'app/assets/stylesheets'
|
15
|
+
run environment
|
16
|
+
end
|
17
|
+
|
18
|
+
map '/' do
|
19
|
+
run <%= constant_name %>
|
20
|
+
end
|
File without changes
|
data/lib/templates/rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use --create 1.9.2@<%= app_name %>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "sinatra_with_assets/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "sinatra_with_assets"
|
7
|
+
s.version = SinatraWithAssets::VERSION
|
8
|
+
s.authors = ["Jesse Trimble"]
|
9
|
+
s.email = ["jlowelltrim@gmail.com"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{Generator for sinatra apps pre-wired for coffeescript, scss, and slim templates.}
|
12
|
+
s.description = %q{Generator for sinatra apps pre-wired for coffeescript, scss, and slim templates.}
|
13
|
+
|
14
|
+
s.rubyforge_project = "sinatra_with_assets"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
s.add_runtime_dependency "thor"
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sinatra_with_assets
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Jesse Trimble
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-12-21 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: thor
|
16
|
+
requirement: &70199781727200 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70199781727200
|
25
|
+
description: Generator for sinatra apps pre-wired for coffeescript, scss, and slim
|
26
|
+
templates.
|
27
|
+
email:
|
28
|
+
- jlowelltrim@gmail.com
|
29
|
+
executables:
|
30
|
+
- sinatra-assets
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- .gitignore
|
35
|
+
- Gemfile
|
36
|
+
- Rakefile
|
37
|
+
- bin/sinatra-assets
|
38
|
+
- lib/sinatra_with_assets.rb
|
39
|
+
- lib/sinatra_with_assets/version.rb
|
40
|
+
- lib/templates/Gemfile
|
41
|
+
- lib/templates/README.markdown
|
42
|
+
- lib/templates/app/assets/javascripts/app.js.coffee
|
43
|
+
- lib/templates/app/assets/stylesheets/app.css.scss
|
44
|
+
- lib/templates/config.ru
|
45
|
+
- lib/templates/public/assets/.gitkeep
|
46
|
+
- lib/templates/rvmrc
|
47
|
+
- lib/templates/server
|
48
|
+
- lib/templates/views/index.slim
|
49
|
+
- lib/templates/views/layout.slim
|
50
|
+
- sinatra_with_assets.gemspec
|
51
|
+
homepage: ''
|
52
|
+
licenses: []
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options: []
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
segments:
|
64
|
+
- 0
|
65
|
+
hash: 3828082632538431303
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ! '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
hash: 3828082632538431303
|
75
|
+
requirements: []
|
76
|
+
rubyforge_project: sinatra_with_assets
|
77
|
+
rubygems_version: 1.8.10
|
78
|
+
signing_key:
|
79
|
+
specification_version: 3
|
80
|
+
summary: Generator for sinatra apps pre-wired for coffeescript, scss, and slim templates.
|
81
|
+
test_files: []
|