hashrocket-rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
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
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm --create use ruby-1.9.3@hashrocket-rails
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in hashrocket-rails.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2011 Hashrocket Workstation
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.
@@ -0,0 +1,29 @@
1
+ # Hashrocket::Rails
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'hashrocket-rails'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install hashrocket-rails
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,5 @@
1
+ // html5shiv MIT @rem remysharp.com/html5-enabling-script
2
+ // iepp v1.5.1 MIT @jon_neal iecss.com/print-protector
3
+ /*@cc_on(function(p,e){var q=e.createElement("div");q.innerHTML="<z>i</z>";q.childNodes.length!==1&&function(){function r(a,b){if(g[a])g[a].styleSheet.cssText+=b;else{var c=s[l],d=e[j]("style");d.media=a;c.insertBefore(d,c[l]);g[a]=d;r(a,b)}}function t(a,b){for(var c=new RegExp("\\b("+m+")\\b(?!.*[;}])","gi"),d=function(k){return".iepp_"+k},h=-1;++h<a.length;){b=a[h].media||b;t(a[h].imports,b);r(b,a[h].cssText.replace(c,d))}}for(var s=e.documentElement,i=e.createDocumentFragment(),g={},m="abbr article aside audio canvas details figcaption figure footer header hgroup mark meter nav output progress section summary time video".replace(/ /g, '|'),
4
+ n=m.split("|"),f=[],o=-1,l="firstChild",j="createElement";++o<n.length;){e[j](n[o]);i[j](n[o])}i=i.appendChild(e[j]("div"));p.attachEvent("onbeforeprint",function(){for(var a,b=e.getElementsByTagName("*"),c,d,h=new RegExp("^"+m+"$","i"),k=-1;++k<b.length;)if((a=b[k])&&(d=a.nodeName.match(h))){c=new RegExp("^\\s*<"+d+"(.*)\\/"+d+">\\s*$","i");i.innerHTML=a.outerHTML.replace(/\r|\n/g," ").replace(c,a.currentStyle.display=="block"?"<div$1/div>":"<span$1/span>");c=i.childNodes[0];c.className+=" iepp_"+
5
+ d;c=f[f.length]=[a,c];a.parentNode.replaceChild(c[1],c[0])}t(e.styleSheets,"all")});p.attachEvent("onafterprint",function(){for(var a=-1,b;++a<f.length;)f[a][1].parentNode.replaceChild(f[a][0],f[a][1]);for(b in g)s[l].removeChild(g[b]);g={};f=[]})}()})(this,document);@*/
@@ -0,0 +1,15 @@
1
+ ul,ol
2
+ list-style: none
3
+ h1,h2,h3,h4,h5,h6,pre,code
4
+ font-size: 1em
5
+ ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,body,html,p,blockquote,fieldset,input,dl,dt,dd
6
+ margin: 0
7
+ padding: 0
8
+ a img,:link img,:visited img, fieldset
9
+ border: none
10
+ address
11
+ font-style: normal
12
+ header, section, article, nav, footer, hgroup
13
+ display: block
14
+ mark
15
+ background: transparent
@@ -0,0 +1,12 @@
1
+ module Hashrocket
2
+ class UiController < ::ApplicationController
3
+ extend Wireframe::Excludes
4
+
5
+ exclude 'index', ->(w) { w.starts_with? '_' }
6
+
7
+ expose(:wireframes) do
8
+ Wireframe.cleaned
9
+ end
10
+ end
11
+ end
12
+
@@ -0,0 +1,53 @@
1
+ module Hashrocket
2
+ class Wireframe < Struct.new(:path)
3
+ class_attribute :excludes
4
+
5
+ def self.files
6
+ Dir.glob('app/views/ui/*.html.haml')
7
+ end
8
+
9
+ def self.all
10
+ files.sort.map(&instantize).extend(Filter)
11
+ end
12
+
13
+ def self.instantize(*args)
14
+ method(:new)
15
+ end
16
+
17
+ def self.cleaned
18
+ all.filter(excludes)
19
+ end
20
+
21
+ def name
22
+ File.basename(path,'.html.haml')
23
+ end
24
+
25
+ module Excludes
26
+ def excludes
27
+ Wireframe.excludes ||= []
28
+ end
29
+
30
+ def exclude(*args)
31
+ excludes.push(*args)
32
+ end
33
+ end
34
+
35
+ module Filter
36
+ def pass?(rule, filename)
37
+ if rule.respond_to? :call
38
+ !rule[filename]
39
+ else
40
+ filename != rule
41
+ end
42
+ end
43
+
44
+ def filter(rules)
45
+ select do |wireframe|
46
+ rules.all? do |rule|
47
+ pass?(rule, wireframe.name)
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,4 @@
1
+ - if flash.any?
2
+ .flash
3
+ - flash.each do |type, msg|
4
+ %p{class: type}= msg
@@ -0,0 +1,3 @@
1
+ %ul
2
+ = list_of wireframes do |wireframe|
3
+ = link_to wireframe.name.titleize, [controller_name, wireframe.name] * '/'
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/hashrocket-rails/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Hashrocket", "Lar Van Der Jagt"]
6
+ gem.email = ["dev@hashrocket.com", "lar@hashrocket.com"]
7
+ gem.description = %q{Rails engine & generators for bootstrapping a Hashrocket project}
8
+ gem.summary = %q{Contains code which may have previously been copied from project to project}
9
+ gem.homepage = "http://hashrocket.com"
10
+
11
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.name = "hashrocket-rails"
15
+
16
+ gem.add_runtime_dependency 'haml-rails'
17
+ gem.add_runtime_dependency 'decent_exposure'
18
+
19
+ gem.require_paths = ["lib"]
20
+ gem.version = Hashrocket::VERSION
21
+ end
@@ -0,0 +1,22 @@
1
+ module Hashrocket
2
+ module Generators
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ source_root File.expand_path("../#{template_directory}/templates", __FILE__)
7
+ end
8
+
9
+ module ClassMethods
10
+ def template_directory
11
+ to_s.match(/::(\w*)Gen/)[1]
12
+ end
13
+ end
14
+
15
+ private
16
+
17
+ def commit(msg)
18
+ git add: '-A'
19
+ git commit: "-m '#{msg}'"
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,11 @@
1
+ Description:
2
+ Every project needs these
3
+
4
+ Example:
5
+ rails generate hashrocket:install
6
+
7
+ Installs a base layout plus:
8
+
9
+ * whitespace-reset
10
+ * html5shiv
11
+ * shared flash partial
@@ -0,0 +1,14 @@
1
+ require 'generators/hashrocket/generators'
2
+
3
+ module Hashrocket
4
+ class InstallGenerator < Rails::Generators::Base
5
+ include Generators
6
+
7
+ def convert_layout
8
+ template 'application.html.haml', 'app/views/layouts/application.html.haml'
9
+ remove_file 'app/views/layouts/application.html.erb'
10
+ commit 'Convert layout to haml'
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %title [TITLE]
5
+ = stylesheet_link_tag 'application'
6
+ = javascript_include_tag 'application'
7
+ = csrf_meta_tags
8
+ = yield :head
9
+ /[if IE]
10
+ = javascript_include_tag 'html5'
11
+ %body
12
+ = render 'flashes'
13
+ = yield
@@ -0,0 +1,13 @@
1
+ Description:
2
+ Install ui controller and route
3
+
4
+ Example:
5
+ rails generate hashrocket:ui
6
+
7
+ Installs:
8
+
9
+ app/controllers/ui_controller.rb
10
+
11
+ Adds a route:
12
+
13
+ match '/ui(/:action), controller: 'ui'
@@ -0,0 +1,2 @@
1
+ class UiController < Hashrocket::UiController
2
+ end
@@ -0,0 +1,20 @@
1
+ require 'generators/hashrocket/generators'
2
+
3
+ module Hashrocket
4
+ class UiGenerator < Rails::Generators::Base
5
+ include Generators
6
+
7
+ def copy_controller
8
+ template 'ui_controller.rb', 'app/controllers/ui_controller.rb'
9
+ end
10
+
11
+ def add_route
12
+ route "match '/ui(/:action)', controller: 'ui'"
13
+ end
14
+
15
+ def commit
16
+ super 'Add ui controller'
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1,7 @@
1
+ require "hashrocket-rails/version"
2
+
3
+ module Hashrocket
4
+ class Rails < ::Rails::Engine
5
+ isolate_namespace Hashrocket
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ module Hashrocket
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hashrocket-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Hashrocket
9
+ - Lar Van Der Jagt
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2011-12-17 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: haml-rails
17
+ requirement: &2152118740 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: *2152118740
26
+ - !ruby/object:Gem::Dependency
27
+ name: decent_exposure
28
+ requirement: &2152117820 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: *2152117820
37
+ description: Rails engine & generators for bootstrapping a Hashrocket project
38
+ email:
39
+ - dev@hashrocket.com
40
+ - lar@hashrocket.com
41
+ executables: []
42
+ extensions: []
43
+ extra_rdoc_files: []
44
+ files:
45
+ - .gitignore
46
+ - .rvmrc
47
+ - Gemfile
48
+ - LICENSE
49
+ - README.md
50
+ - Rakefile
51
+ - app/assets/javascripts/html5.js
52
+ - app/assets/stylesheets/whitespace-reset.sass
53
+ - app/controllers/hashrocket/ui_controller.rb
54
+ - app/models/hashrocket/wireframe.rb
55
+ - app/views/application/_flashes.html.haml
56
+ - app/views/hashrocket/ui/index.html.haml
57
+ - hashrocket-rails.gemspec
58
+ - lib/generators/hashrocket/generators.rb
59
+ - lib/generators/hashrocket/install/USAGE
60
+ - lib/generators/hashrocket/install/install_generator.rb
61
+ - lib/generators/hashrocket/install/templates/application.html.haml
62
+ - lib/generators/hashrocket/ui/USAGE
63
+ - lib/generators/hashrocket/ui/templates/ui_controller.rb
64
+ - lib/generators/hashrocket/ui/ui_generator.rb
65
+ - lib/hashrocket-rails.rb
66
+ - lib/hashrocket-rails/version.rb
67
+ homepage: http://hashrocket.com
68
+ licenses: []
69
+ post_install_message:
70
+ rdoc_options: []
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ! '>='
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubyforge_project:
87
+ rubygems_version: 1.8.10
88
+ signing_key:
89
+ specification_version: 3
90
+ summary: Contains code which may have previously been copied from project to project
91
+ test_files: []