styleguides 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,9 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ spec/dummy/db/*.sqlite3
5
+ spec/dummy/log/*.log
6
+ spec/dummy/tmp/
7
+ .sass-cache/*
8
+ gemfiles/*.lock
9
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,14 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ styleguides (0.1)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+
10
+ PLATFORMS
11
+ ruby
12
+
13
+ DEPENDENCIES
14
+ styleguides!
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2010 Mike Burns
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ Styleguides
2
+ ======
3
+
4
+ [![Build Status](https://secure.travis-ci.org/fs/styleguides.png)](http://travis-ci.org/fs/styleguides)
5
+
6
+ Inspired by Thoughtbot's flutie gem.
7
+
8
+ Styleguides allows you create set of style guides for your application which are could be listed in the development by /styleguides path.
9
+
10
+ To add styles to the styleguide add partials to the app/views/styleguides directory. For example:
11
+
12
+ app/views/styleguides/_todo_item.erb:
13
+
14
+ <ol>
15
+ <li class="todo">This is a todo item</li>
16
+ </ol>
17
+
18
+ Plugin authors can also add to the styleguide by ensuring that their view path is in `ActionController::Base.view_paths` and by placing a partial under the styleguides directory. For example:
19
+
20
+ ActionController::Base.append_view_path(File.join(File.dirname(__FILE__), 'views'))
21
+
22
+ my_awesome_plugin/views/styleguides/_pagination.erb:
23
+
24
+ <div class="pagination">
25
+ <a href="#prev">Previous</a>
26
+ <a href="#next">Next</a>
27
+ </div>
28
+
29
+
30
+ Installation
31
+ ------------------------
32
+
33
+ Styleguides is a Rails engine.
34
+
35
+ Styleguides is recommended to be run as a gem and included in your Gemfile:
36
+
37
+ gem "styleguides"
38
+
39
+ Suggestions, Bugs, Refactoring?
40
+ -------------------------------
41
+
42
+ Fork away and create a [Github Issue](http://github.com/fs/styleguides/issues).
43
+
@@ -0,0 +1,26 @@
1
+ module Styleguides
2
+
3
+ class StyleguidesController < ApplicationController
4
+
5
+ unloadable
6
+
7
+ def show
8
+ @styleguides = styleguides
9
+ end
10
+
11
+ private
12
+
13
+ def styleguides
14
+ all_styleguide_partials = ActionController::Base.view_paths.map do |view_path|
15
+ styleguide_path = File.join(view_path.to_s, 'styleguides')
16
+ if File.exists?(styleguide_path)
17
+ Dir.glob(styleguide_path + '/_*.*')
18
+ else
19
+ nil
20
+ end
21
+ end
22
+ all_styleguide_partials.flatten.compact
23
+ end
24
+ end
25
+
26
+ end
@@ -0,0 +1,10 @@
1
+ <div>
2
+
3
+ <% if @styleguides %>
4
+
5
+ <% @styleguides.each do |styleguide| %>
6
+ <%= render :file => styleguide %>
7
+ <% end %>
8
+ <% end %>
9
+
10
+ </div>
data/config/routes.rb ADDED
@@ -0,0 +1,5 @@
1
+ Rails.application.routes.draw do
2
+
3
+ resource :styleguides, :as => :styleguide, :controller => 'styleguides/styleguides', :only => [:show]
4
+
5
+ end
@@ -0,0 +1,5 @@
1
+ require 'styleguides/version'
2
+
3
+ module Flutie
4
+ require 'styleguides/engine' if defined?(Rails)
5
+ end
@@ -0,0 +1,6 @@
1
+ module Styleguides
2
+
3
+ class Engine < Rails::Engine
4
+ end
5
+
6
+ end
@@ -0,0 +1,3 @@
1
+ module Styleguides
2
+ VERSION = '0.1'.freeze
3
+ end
@@ -0,0 +1,18 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "styleguides/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'styleguides'
7
+ s.version = Styleguides::VERSION.dup
8
+ s.authors = ['Timur Vafin']
9
+
10
+ s.homepage = 'http://github.com/fs/styleguides'
11
+ s.summary = 'Styleguides support'
12
+ s.description = 'Styleguides support'
13
+
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ s.require_paths = ["lib"]
18
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: styleguides
3
+ version: !ruby/object:Gem::Version
4
+ hash: 9
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ version: "0.1"
10
+ platform: ruby
11
+ authors:
12
+ - Timur Vafin
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2012-01-16 00:00:00 Z
18
+ dependencies: []
19
+
20
+ description: Styleguides support
21
+ email:
22
+ executables: []
23
+
24
+ extensions: []
25
+
26
+ extra_rdoc_files: []
27
+
28
+ files:
29
+ - .gitignore
30
+ - Gemfile
31
+ - Gemfile.lock
32
+ - LICENSE
33
+ - README.md
34
+ - app/controllers/styleguides/styleguides_controller.rb
35
+ - app/views/styleguides/styleguides/show.erb
36
+ - config/routes.rb
37
+ - lib/styleguides.rb
38
+ - lib/styleguides/engine.rb
39
+ - lib/styleguides/version.rb
40
+ - styleguides.gemspec
41
+ homepage: http://github.com/fs/styleguides
42
+ licenses: []
43
+
44
+ post_install_message:
45
+ rdoc_options: []
46
+
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ hash: 3
55
+ segments:
56
+ - 0
57
+ version: "0"
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ hash: 3
64
+ segments:
65
+ - 0
66
+ version: "0"
67
+ requirements: []
68
+
69
+ rubyforge_project:
70
+ rubygems_version: 1.8.12
71
+ signing_key:
72
+ specification_version: 3
73
+ summary: Styleguides support
74
+ test_files: []
75
+