sinatra_with_assets 0.0.1

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/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in sinatra_with_assets.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem 'pry'
8
+ end
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -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,3 @@
1
+ module SinatraWithAssets
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,5 @@
1
+ require "sinatra_with_assets/version"
2
+
3
+ module SinatraWithAssets
4
+
5
+ end
@@ -0,0 +1,9 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'sprockets'
4
+ gem 'sass'
5
+ gem 'coffee-script'
6
+ gem 'sinatra', '1.3.0'
7
+ gem 'shotgun'
8
+ gem 'thin'
9
+ gem 'slim'
@@ -0,0 +1,5 @@
1
+ This is a new sinatra app.
2
+
3
+ It uses coffee-script for javascripts, scss for styles, and slim for
4
+ a templating engine. The coffee and scss compilation happens through sprockets
5
+ dynamically and view templates are rendered via slim dynamically.
@@ -0,0 +1,6 @@
1
+ class window.App
2
+
3
+ constructor: ->
4
+ # TODO: put your js app code here.
5
+ # This file is processed by sprockets, so `require` directives are
6
+ # respected.
@@ -0,0 +1,3 @@
1
+ /* TODO: put your app styles here.
2
+ * This file is processed by sprockets, so `require` directives are
3
+ * respected. */
@@ -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
@@ -0,0 +1 @@
1
+ rvm use --create 1.9.2@<%= app_name %>
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+
3
+ bundle exec shotgun --server thin --port 3000
@@ -0,0 +1,3 @@
1
+ h4 This file lives in:
2
+ pre
3
+ code views/index.erb
@@ -0,0 +1,8 @@
1
+ doctype 5
2
+ html
3
+ head
4
+ script src="/assets/app.js.coffee"
5
+ link rel="stylesheet" href="/assets/app.css"
6
+ title <%= constant_name %>
7
+ body
8
+ == yield
@@ -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: []