ryder 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .DS_Store
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source :rubygems
2
+
3
+ # Specify your gem's dependencies in prometheus.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Robert Evans
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Readme.md ADDED
@@ -0,0 +1,53 @@
1
+ # Ryder
2
+
3
+ The simpliest framework possible.
4
+
5
+
6
+ ### What's Included?
7
+
8
+ * SCSS
9
+ * HAML
10
+ * CoffeeScript
11
+ * AutoCompiling to HTML/CSS/JS
12
+ * Heroku
13
+ * Browser livereload
14
+
15
+ #### Getting Started
16
+
17
+ ````
18
+ gem install ryder
19
+ ryder myPrototype
20
+ cd myPrototype
21
+ bundle install
22
+ bundle exec foreman start
23
+ ````
24
+
25
+ Go Prototype
26
+
27
+ #### Yes, Heroku!!
28
+
29
+ A config.ru is created with the project. You just need a heroku account and then do:
30
+
31
+ ````
32
+ heroku create --bamboo
33
+ git push heroku master
34
+ ````
35
+
36
+ Go see your site on Heroku!!
37
+
38
+ #### AutoCompiling
39
+
40
+ Foreman has you covered.
41
+
42
+
43
+ #### Live Reload
44
+
45
+ Live reload is automagic. Just start foreman, load the page in your browser,
46
+ prototype away. Each time something is saved, the browser reloads itself.
47
+
48
+ ### You can use Twitter Bootstrap or any other js/css lib
49
+
50
+ You want Twitter's JavaScript files?
51
+
52
+ Add the JavaScript files to public/(js/css) and include in your app/views/index.haml before the end of the body element.
53
+
data/bin/ryder ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require 'ryder'
3
+
4
+ ::Ryder::Application.generate(ARGV.first, ARGV.last)
@@ -0,0 +1,153 @@
1
+ require 'pathname'
2
+ require 'fileutils'
3
+
4
+ module Ryder
5
+ class Application
6
+
7
+ def initialize(name, path)
8
+ @name, @path = name, path
9
+ @app = Pathname.new(path).join(name)
10
+ end
11
+
12
+ def app
13
+ @app
14
+ end
15
+
16
+ def self.generate(name, path = Dir.pwd)
17
+ box = new(name, path)
18
+ box.create_project
19
+ end
20
+
21
+ def create_project
22
+ say('Creating the app...') do
23
+ app.mkpath
24
+ create_app_structure
25
+ touch_app_files
26
+ write_index_haml
27
+ end
28
+ say('Adding the Gemfile...') { write_gemfile }
29
+ say('Adding the Guardfile...') { write_guardfile }
30
+ say('Adding config.ru...') { write_config_ru }
31
+ say('Adding config.ru...') { write_procfile }
32
+ say('Adding Stylesheets...') { write_scss_file }
33
+ end
34
+
35
+ private
36
+
37
+ def create_app_structure
38
+ %w(app/javascripts app/stylesheets app/views public/css public/js public/images).each do |path|
39
+ app.join(path).mkpath
40
+ end
41
+ end
42
+
43
+ def touch_app_files
44
+ %w(app/javascripts/application.coffee app/stylesheets/application.scss app/views/index.haml).each do |file|
45
+ FileUtils.touch app.join(file)
46
+ end
47
+ end
48
+
49
+ def write_scss_file
50
+ File.open(app.join('app/stylesheets/application.scss'), 'w+') do |file|
51
+ file.puts <<-HERE
52
+ // For Twitter Bootstrap: Go get it and put it in public/css
53
+ // run bundle exec bourbon install and then move bourbon into app/stylesheets
54
+ // @import 'bourbon/bourbon';
55
+ HERE
56
+ end
57
+ end
58
+
59
+ def write_gemfile
60
+ File.open(app.join('Gemfile'), 'w+') do |file|
61
+ file.puts <<-HERE
62
+ source :rubygems
63
+ gem 'rack'
64
+ gem 'rack-contrib'
65
+ group :development do
66
+ gem 'foreman'
67
+ gem 'sass'
68
+ gem 'bourbon'
69
+ gem 'haml'
70
+ gem 'therubyracer'
71
+ gem 'rack-livereload'
72
+ gem 'rb-fsevent', '~> 0.9.1'
73
+ gem 'guard-sass'
74
+ gem 'guard-haml'
75
+ gem 'guard-coffeescript'
76
+ gem 'guard-livereload'
77
+ end
78
+ HERE
79
+ end
80
+ end
81
+
82
+ def write_guardfile
83
+ File.open(app.join('Guardfile'), 'w+') do |file|
84
+ file.puts <<-HERE
85
+ guard 'sass', input: 'app/stylesheets', output: 'public/css'
86
+ guard 'haml', input: 'app/views', output: 'public/' do
87
+ watch %r{^app/views/.+(\.haml)}
88
+ end
89
+ guard 'coffeescript', input: 'app/javascripts', output: 'public/js'
90
+ guard 'livereload' do
91
+ watch(%r{app/views/.+\.(erb|haml|slim)$})
92
+ watch(%r{app/helpers/.+\.rb})
93
+ watch(%r{public/.+\.(css|js|html)})
94
+ watch(%r{config/locales/.+\.yml})
95
+ end
96
+ HERE
97
+ end
98
+ end
99
+
100
+ def write_index_haml
101
+ File.open(app.join('app/views/index.haml'), 'w+') do |file|
102
+ file.puts <<-HERE
103
+ !!!5
104
+ %html
105
+ %head
106
+ %title My Title
107
+ %meta{ name: 'viewport', content: 'width=device-width, initial-scale=1.0' }
108
+ %meta{ content: '', name: 'description' }
109
+ %meta{ content: '', name: 'author' }
110
+ %link{ href: 'css/application.css', media: 'screen', rel: 'stylesheet' }
111
+
112
+ %body
113
+
114
+ %script{ type: 'text/javascript', src: 'js/jquery.js' }
115
+ %script{ type: 'text/javascript', src: 'js/application.js' }
116
+ HERE
117
+ end
118
+ end
119
+
120
+ def write_config_ru
121
+ File.open(app.join('config.ru'), 'w+') do |file|
122
+ file.puts <<-HERE
123
+ require 'rack'
124
+ require 'rack/contrib/try_static'
125
+ require 'rack-livereload'
126
+
127
+ use Rack::LiveReload
128
+ use Rack::TryStatic,
129
+ root: 'public',
130
+ urls: %w(/),
131
+ try: ['.html', 'index.html', '/index.html']
132
+
133
+ run lambda { |_| [404, {'Content-Type' => 'text/html'}, ['whoops! Not Found']]}
134
+ HERE
135
+ end
136
+ end
137
+
138
+ def write_procfile
139
+ File.open(app.join('Procfile'), 'w+') do |file|
140
+ file.puts <<-HERE
141
+ web: bundle exec rackup -p 7000
142
+ guard: bundle exec guard start
143
+ HERE
144
+ end
145
+ end
146
+
147
+ def say(msg, &block)
148
+ puts msg.to_s.rjust(20)
149
+ yield
150
+ end
151
+
152
+ end
153
+ end
data/lib/ryder.rb ADDED
@@ -0,0 +1,4 @@
1
+ require 'ryder/application'
2
+
3
+ module Ryder
4
+ end
data/ryder.gemspec ADDED
@@ -0,0 +1,16 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.authors = ["Robert Evans"]
5
+ gem.email = ["robert@codewranglers.org"]
6
+ gem.description = %q{The simpliest prototyping tool, EVER}
7
+ gem.summary = %q{The simpliest prototyping tool, EVER}
8
+ gem.homepage = ""
9
+
10
+ gem.files = `git ls-files`.split($\)
11
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
12
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
13
+ gem.name = "ryder"
14
+ gem.require_paths = ["lib"]
15
+ gem.version = '0.0.1'
16
+ end
@@ -0,0 +1,38 @@
1
+ require 'minitest/autorun'
2
+ require 'tmpdir'
3
+ require_relative '../../lib/ryder/application'
4
+
5
+ module Ryder
6
+
7
+ describe Application do
8
+ def temp(name = '', &block)
9
+ application_name = 'Zues'
10
+ Dir.mktmpdir do |base_dir|
11
+ Application.generate(application_name, base_dir)
12
+ @app = Pathname.new(base_dir).join(application_name)
13
+ yield @app.join(name)
14
+ end
15
+ end
16
+
17
+ describe 'will generate the directory structure' do
18
+ %w(app/javascripts app/stylesheets app/views public/css public/js public/images).each do |path|
19
+ it "will have the #{path} directory" do
20
+ temp(path) do |app|
21
+ FileTest.exists?(app).must_equal true
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ describe "when touching files" do
28
+ %w(app/javascripts/application.coffee app/stylesheets/application.scss app/views/index.haml Gemfile Procfile Guardfile config.ru).each do |file|
29
+ it "will create the #{file} file" do
30
+ temp(file) do |app|
31
+ FileTest.exists?(app).must_equal true
32
+ end
33
+ end
34
+ end
35
+
36
+ end
37
+ end
38
+ end
metadata ADDED
@@ -0,0 +1,56 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ryder
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Robert Evans
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-13 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: The simpliest prototyping tool, EVER
15
+ email:
16
+ - robert@codewranglers.org
17
+ executables:
18
+ - ryder
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - .gitignore
23
+ - Gemfile
24
+ - LICENSE
25
+ - Readme.md
26
+ - bin/ryder
27
+ - lib/ryder.rb
28
+ - lib/ryder/application.rb
29
+ - ryder.gemspec
30
+ - spec/ryder/application_spec.rb
31
+ homepage: ''
32
+ licenses: []
33
+ post_install_message:
34
+ rdoc_options: []
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ! '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ requirements: []
50
+ rubyforge_project:
51
+ rubygems_version: 1.8.23
52
+ signing_key:
53
+ specification_version: 3
54
+ summary: The simpliest prototyping tool, EVER
55
+ test_files:
56
+ - spec/ryder/application_spec.rb