prototyper 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5b1deb281f928797789b695db7512912ee670cc1
4
+ data.tar.gz: 8799ca3906b6f338724f8bd3351ecf83cc83a418
5
+ SHA512:
6
+ metadata.gz: 17ef46d46e124245a8508305b004cde5571554afb8125d7fc553b2068694a2a6b3ebb98f3d7e16460b5c52c6e5e621de2fdfb90449a3fcbd9cd3ff7645cfa775
7
+ data.tar.gz: adc583180ef55e165130344255a5916193a14f1f333af0a6cf92d025856647668c2518b8c0ef5b1f7cbbe4ca6ec544995405c6c4b63537f2dcd2b7cc09e281ad
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2013 Jonathan Vingiano
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.
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require 'rake/testtask'
2
+
3
+ Rake::TestTask.new do |t|
4
+ t.libs << "test"
5
+ t.test_files = FileList['test/unit/*.rb']
6
+ t.verbose = true
7
+ end
8
+
9
+ task :default => :test
data/bin/prototyper ADDED
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pathname'
4
+ require 'optparse'
5
+ require 'pp'
6
+
7
+ bin_file = Pathname.new(__FILE__).realpath
8
+
9
+ $:.unshift File.expand_path("../../lib", bin_file)
10
+
11
+ require 'prototyper'
12
+
13
+ options = {}
14
+ options[:type] = :html # set default
15
+
16
+ OptionParser.new do |opts|
17
+
18
+ opts.banner = "Usage: prototyper [project_title] [options]"
19
+
20
+ opts.on("--type [TYPE]", [:sinatra, :html],
21
+ "Select scaffolding type (sinatra, html). Default is HTML.") do |t|
22
+ options[:type] = t
23
+ end
24
+
25
+ opts.on("--html",
26
+ "Generate HTML scaffolding. Shortcut for --type html") do |t|
27
+ options[:type] = :html
28
+ end
29
+
30
+ opts.on("--sinatra",
31
+ "Generate Sinatra scaffolding. Shortcut for --type sinatra.") do |t|
32
+ options[:type] = :sinatra
33
+ end
34
+
35
+ end.parse!
36
+
37
+ if ARGV.empty?
38
+ puts "Usage: prototyper [project_title] [options]"
39
+ puts ""
40
+ puts "Type prototyper --help for more instruction."
41
+ elsif Dir.exists?(Dir.pwd + "/" + ARGV.first)
42
+ puts "That directory already exists."
43
+ else
44
+ Prototyper.generate(ARGV.first, options)
45
+ end
@@ -0,0 +1,3 @@
1
+ module Prototyper
2
+ VERSION = "1.1.0"
3
+ end
data/lib/prototyper.rb ADDED
@@ -0,0 +1,14 @@
1
+ require 'fileutils'
2
+
3
+ module Prototyper
4
+ class << self
5
+
6
+ def generate(name, opts={ :type => "html" })
7
+ dir = FileUtils.mkdir(name)
8
+ new_dir = "#{Dir.pwd}/#{name}"
9
+ FileUtils.cp_r Dir["#{Dir.pwd}/lib/templates/#{opts[:type].to_s}/*"], new_dir, :preserve => true, :verbose => true
10
+ puts "done!"
11
+ end
12
+
13
+ end
14
+ end
Binary file
@@ -0,0 +1 @@
1
+ window.onload = {}
@@ -0,0 +1,48 @@
1
+ @-webkit-viewport { width: device-width; }
2
+ @-moz-viewport { width: device-width; }
3
+ @-ms-viewport { width: device-width; }
4
+ @-o-viewport { width: device-width; }
5
+ @viewport { width: device-width; }
6
+
7
+ /*! normalize.css v2.1.2 | MIT License | git.io/normalize */
8
+
9
+ article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}
10
+ audio,canvas,video{display:inline-block}
11
+ audio:not([controls]){display:none;height:0}
12
+ [hidden],template{display:none}
13
+ html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}
14
+ body{margin:0}
15
+ a{background:transparent}
16
+ a:focus{outline:thin dotted}
17
+ a:active,a:hover{outline:0}
18
+ h1{font-size:2em;margin:.67em 0}
19
+ abbr[title]{border-bottom:1px dotted}
20
+ b,strong{font-weight:bold}
21
+ dfn{font-style:italic}
22
+ hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}
23
+ mark{background:#ff0;color:#000}
24
+ code,kbd,pre,samp{font-family:monospace,serif;font-size:1em}
25
+ pre{white-space:pre-wrap}
26
+ q{quotes:"\201C" "\201D" "\2018" "\2019"}
27
+ small{font-size:80%}
28
+ sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}
29
+ sup{top:-0.5em}
30
+ sub{bottom:-0.25em}
31
+ img{border:0}
32
+ svg:not(:root){overflow:hidden}
33
+ figure{margin:0}
34
+ fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}
35
+ legend{border:0;padding:0}
36
+ button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}
37
+ button,input{line-height:normal}
38
+ button,select{text-transform:none}
39
+ button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}
40
+ button[disabled],html input[disabled]{cursor:default}
41
+ input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}
42
+ input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}
43
+ input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}
44
+ button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}
45
+ textarea{overflow:auto;vertical-align:top}
46
+ table{border-collapse:collapse;border-spacing:0}
47
+
48
+ /* Site Style */
@@ -0,0 +1,15 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+ <title>&#10084;</title>
7
+ <link href="/assets/stylesheets/applicaiton.css" media="all" rel="stylesheet" type="text/css" />
8
+ <script src="/assets/javascripts/application.js"></script>
9
+ <!--[if lt IE 9]>
10
+ <script src="//ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
11
+ <![endif]-->
12
+ </head>
13
+ <body>
14
+ </body>
15
+ </html>
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem 'sinatra'
4
+ gem 'foreman'
@@ -0,0 +1 @@
1
+ web: bundle exec rackup config.ru -p $PORT
@@ -0,0 +1,14 @@
1
+ require 'sinatra'
2
+
3
+ class App < Sinatra::Base
4
+
5
+ set :root, File.dirname(__FILE__)
6
+ set :public_folder, Proc.new { File.join(root, "assets") }
7
+ set :run, true
8
+ set :port, 5000
9
+
10
+ get '/' do
11
+ erb :index
12
+ end
13
+
14
+ end
@@ -0,0 +1,12 @@
1
+ window.requestAnimationFrame = (function(){
2
+ return window.requestAnimationFrame ||
3
+ window.webkitRequestAnimationFrame ||
4
+ window.mozRequestAnimationFrame ||
5
+ function( callback ){
6
+ window.setTimeout(callback, 1000 / 60);
7
+ };
8
+ })();
9
+
10
+ window.onload = function() {
11
+
12
+ };
@@ -0,0 +1,8 @@
1
+ /*
2
+ HTML5 Shiv v3.6.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
3
+ */
4
+ (function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag();
5
+ a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/\w+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x<style>article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}</style>";
6
+ c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="<xyz></xyz>";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode||
7
+ "undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup main mark meter nav output progress section summary time video",version:"3.6.2",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);if(g)return a.createDocumentFragment();
8
+ for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d<h;d++)c.createElement(e[d]);return c}};l.html5=e;q(f)})(this,document);
@@ -0,0 +1,4 @@
1
+ html, body, div, ul, li, h1, h2, h3, h4, h5, p, span { margin:0; padding:0; border:0; }
2
+ html, body { height: 100%; }
3
+ ul, li { list-style: none; }
4
+ .twitter-share-button { vertical-align: top; }
@@ -0,0 +1,2 @@
1
+ require './app'
2
+ run App.new
@@ -0,0 +1,15 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>&#10084;</title>
6
+ <link href="/stylesheets/application.css" media="all" rel="stylesheet" type="text/css" />
7
+ <script src="/javascripts/html5shiv.js"></script>
8
+ <script src="/javascripts/application.js"></script>
9
+ <!--[if lt IE 9]>
10
+ <script src="//ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
11
+ <![endif]-->
12
+ </head>
13
+ <body>
14
+ </body>
15
+ </html>
@@ -0,0 +1,18 @@
1
+ require File.expand_path('../lib/prototyper/version', __FILE__)
2
+
3
+ Gem::Specification.new do |s|
4
+
5
+ s.name = 'prototyper'
6
+ s.version = Prototyper::VERSION
7
+ s.author = 'Jonathan Vingiano'
8
+ s.email = 'jgv@jonathanvingiano.com'
9
+ s.homepage = 'https://github.com/jgv/prototyper'
10
+ s.rubyforge_project = 'prototyper'
11
+ s.summary = 'Set up some boilerplate'
12
+ s.description = 'Scaffold simple projects from the command line.'
13
+ s.files = `git ls-files`.split("\n")
14
+ s.test_file = 'test/unit/prototyper.rb'
15
+ s.require_paths = ['lib', 'bin']
16
+ s.executables = ['prototyper']
17
+
18
+ end
data/readme.md ADDED
@@ -0,0 +1,69 @@
1
+ # Prototyper
2
+
3
+ Prototyper is a simple commandline tool that sets up a basic web application. This gem is designed to get scaffolding a project out of the way. Currently it provides two different project types: HTML and Sinatra. The Sintara installtion provided is good to go on Heroku.
4
+
5
+ ## Installation
6
+
7
+ ``` bash
8
+ $ gem install prototyper
9
+ ```
10
+ or in your Gemfile: `gem 'prototyper'`
11
+
12
+ ## Usage
13
+
14
+ ``` bash
15
+ $ prototyper coolproject
16
+ ```
17
+
18
+ This will create a new HTML project relative to your working directory. It will look something like this:
19
+
20
+ ```
21
+ .
22
+ ├── assets
23
+ │   ├── javascripts
24
+ │   │   └── application.js
25
+ │   └── stylesheets
26
+ │   └── application.css
27
+ └── index.html
28
+ ```
29
+
30
+ Instead of HTML, you may choose to scaffold a Sinatra app by passing the option `--type sinatra`. This will generate an app that looks like so:
31
+
32
+
33
+ ```
34
+ .
35
+ ├── Gemfile
36
+ ├── Procfile
37
+ ├── app.rb
38
+ ├── assets
39
+ │   ├── javascripts
40
+ │   │   ├── application.js
41
+ │   │   └── html5shiv.js
42
+ │   └── stylesheets
43
+ │   └── application.css
44
+ ├── config.ru
45
+ ├── generator.rb
46
+ └── views
47
+ └── index.erb
48
+ ```
49
+
50
+ ## Options
51
+
52
+ ```
53
+ $ protoyper --help
54
+
55
+ Usage: prototyper [projectname] [options]
56
+ --type [TYPE] Select scaffolding type (sinatra, html)
57
+ --html Generate HTML scaffolding
58
+ --sinatra Generate Sinatra scaffolding
59
+ ```
60
+
61
+ ## Tests
62
+
63
+ Run tests with minitest.
64
+
65
+ ``` bash
66
+ $ rake test
67
+ ```
68
+
69
+ **License: MIT**
@@ -0,0 +1,76 @@
1
+ require 'minitest/autorun'
2
+ require 'minitest/unit'
3
+ require 'minitest/pride'
4
+ require 'pathname'
5
+
6
+ $:.unshift File.dirname(__FILE__) + '/../../lib'
7
+ require 'prototyper'
8
+ class TestSinatraApp < MiniTest::Test
9
+
10
+ def setup
11
+ Prototyper.generate("test_sinatra", { :type => :sinatra })
12
+ end
13
+
14
+ def teardown
15
+ FileUtils.rm_rf("test_sinatra")
16
+ end
17
+
18
+ def test_that_it_creates_a_project
19
+ assert Dir.exists?("test_sinatra")
20
+ end
21
+
22
+ def test_that_it_creates_subdirs
23
+ assert Dir.exists?("test_sinatra/assets")
24
+ assert Dir.exists?("test_sinatra/views")
25
+ end
26
+
27
+ def test_that_it_creates_a_sinatra_app
28
+ all_files = `find test_sinatra`.split("\n").map { |f| File.basename(f, ".*") }
29
+ %w(app
30
+ assets
31
+ javascripts
32
+ application
33
+ html5shiv
34
+ stylesheets
35
+ application
36
+ config
37
+ Gemfile
38
+ Procfile
39
+ views
40
+ index).each do |file|
41
+ assert all_files.include?(file)
42
+ end
43
+ end
44
+
45
+ end
46
+
47
+ class TestHTMLApp < MiniTest::Test
48
+
49
+ def setup
50
+ Prototyper.generate("test_html")
51
+ end
52
+
53
+ def teardown
54
+ # FileUtils.rm_rf("test_html")
55
+ end
56
+
57
+ def test_that_it_creates_a_project
58
+ assert Dir.exists?("test_html")
59
+ end
60
+
61
+ def test_that_it_creates_subdirs
62
+ assert Dir.exists?("test_html/assets")
63
+ end
64
+
65
+ def test_that_it_creates_necessary_files
66
+ all_files = `find test_html`.split("\n").map { |f| File.basename(f, ".*") }
67
+ %w(index
68
+ assets
69
+ javascripts
70
+ stylesheets
71
+ application).each do |file|
72
+ assert all_files.include?(file)
73
+ end
74
+ end
75
+
76
+ end
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: prototyper
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jonathan Vingiano
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-10-23 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Scaffold simple projects from the command line.
14
+ email: jgv@jonathanvingiano.com
15
+ executables:
16
+ - prototyper
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - .gitignore
21
+ - Gemfile
22
+ - MIT-LICENSE
23
+ - Rakefile
24
+ - bin/prototyper
25
+ - lib/prototyper.rb
26
+ - lib/prototyper/version.rb
27
+ - lib/templates/html/.DS_Store
28
+ - lib/templates/html/assets/javascripts/application.js
29
+ - lib/templates/html/assets/stylesheets/application.css
30
+ - lib/templates/html/index.html
31
+ - lib/templates/sinatra/Gemfile
32
+ - lib/templates/sinatra/Procfile
33
+ - lib/templates/sinatra/app.rb
34
+ - lib/templates/sinatra/assets/javascripts/application.js
35
+ - lib/templates/sinatra/assets/javascripts/html5shiv.js
36
+ - lib/templates/sinatra/assets/stylesheets/application.css
37
+ - lib/templates/sinatra/config.ru
38
+ - lib/templates/sinatra/views/index.erb
39
+ - prototyper.gemspec
40
+ - readme.md
41
+ - test/unit/prototyper.rb
42
+ homepage: https://github.com/jgv/prototyper
43
+ licenses: []
44
+ metadata: {}
45
+ post_install_message:
46
+ rdoc_options: []
47
+ require_paths:
48
+ - lib
49
+ - bin
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ requirements: []
61
+ rubyforge_project: prototyper
62
+ rubygems_version: 2.0.0
63
+ signing_key:
64
+ specification_version: 4
65
+ summary: Set up some boilerplate
66
+ test_files:
67
+ - test/unit/prototyper.rb