styleguide_rails 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/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2012 Joe Nelson
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/README.rdoc ADDED
@@ -0,0 +1,17 @@
1
+ = styleguide_rails
2
+
3
+ Adds a `/styleguide` route to your app where you can view HTML
4
+ snippets and see how CSS affects them. Place the snippets into
5
+ `app/views/styleguide` as partials and they will appear in the
6
+ styleguide. To view an individual partial, visit
7
+ `/styleguide/partial_name`.
8
+
9
+ == Usage
10
+
11
+ In your Gemfile:
12
+
13
+ gem 'styleguide_rails'
14
+
15
+ Then bundle and run
16
+
17
+ rails g styleguide
data/Rakefile ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'StyleguideRails'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+
24
+
25
+
26
+ Bundler::GemHelper.install_tasks
27
+
data/lib/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source "http://rubygems.org"
2
+ gemspec
@@ -0,0 +1,10 @@
1
+ Description:
2
+ Add a /styleguide route to your app to preview CSS styles
3
+
4
+ Example:
5
+ rails generate styleguide
6
+
7
+ This will create:
8
+ app/controllers/styleguide_controller.rb
9
+ app/views/styleguide/
10
+ appropriate routes
@@ -0,0 +1,17 @@
1
+ class StyleguideGenerator < Rails::Generators::Base
2
+ source_root File.expand_path('../templates', __FILE__)
3
+
4
+ def create_controller
5
+ copy_file 'styleguide_controller.rb', 'app/controllers/styleguide_controller.rb'
6
+ empty_directory 'app/views/styleguide'
7
+ copy_file 'index.html.erb', 'app/views/styleguide/index.html.erb'
8
+ copy_file 'show.html.erb', 'app/views/styleguide/show.html.erb'
9
+ end
10
+ def supply_basic_guide
11
+ copy_file '_elements.html.erb', 'app/views/styleguide/_elements.html.erb'
12
+ end
13
+ def create_routes
14
+ route "match 'styleguide' => 'styleguide#index'"
15
+ route "match 'styleguide/:name' => 'styleguide#show'"
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ <h1>h1 tag</h1>
2
+ <h2>h2 tag</h2>
3
+ <h3>h3 tag</h3>
@@ -0,0 +1,7 @@
1
+ <dl class="monarchy-styleguide">
2
+ <% @modules.each do |name, contents| %>
3
+ <dt><%= "Module \"#{name.capitalize}\"" %></dt>
4
+ <dd><%= raw contents %></dd>
5
+ <dd><pre><%= contents %></pre></dd>
6
+ <% end %>
7
+ </dl>
@@ -0,0 +1,5 @@
1
+ <dl class="monarchy-styleguide">
2
+ <dt><%= "Module \"#{@name.capitalize}\"" %></dt>
3
+ <dd><%= raw @contents %></dd>
4
+ <dd><pre><%= @contents %></pre></dd>
5
+ </dl>
@@ -0,0 +1,14 @@
1
+ class StyleguideController < ApplicationController
2
+ def index
3
+ @modules = Hash.new
4
+ Dir.glob('app/views/styleguide/_*.html.erb').each do |mod|
5
+ name = File.basename(mod, '.html.erb')[1..-1]
6
+ @modules[name] = File.read mod
7
+ end
8
+ end
9
+
10
+ def show
11
+ @name = params[:name]
12
+ @contents = File.read "app/views/styleguide/_#{@name}.html.erb"
13
+ end
14
+ end
@@ -0,0 +1,3 @@
1
+ module StyleguideRails
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,2 @@
1
+ module StyleguideRails
2
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: styleguide_rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Joe Nelson
9
+ - Adam Braus
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2012-07-15 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rails
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 3.0.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: 3.0.0
31
+ description: Provides a custom generator to build a styleguide controller, routes,
32
+ and views.
33
+ email:
34
+ executables: []
35
+ extensions: []
36
+ extra_rdoc_files: []
37
+ files:
38
+ - lib/Gemfile
39
+ - lib/generators/styleguide/styleguide_generator.rb
40
+ - lib/generators/styleguide/templates/_elements.html.erb
41
+ - lib/generators/styleguide/templates/index.html.erb
42
+ - lib/generators/styleguide/templates/show.html.erb
43
+ - lib/generators/styleguide/templates/styleguide_controller.rb
44
+ - lib/generators/styleguide/USAGE
45
+ - lib/styleguide_rails/version.rb
46
+ - lib/styleguide_rails.rb
47
+ - MIT-LICENSE
48
+ - Rakefile
49
+ - README.rdoc
50
+ homepage: http://github.com/begriffs/styleguide_rails
51
+ licenses: []
52
+ post_install_message:
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ requirements: []
69
+ rubyforge_project:
70
+ rubygems_version: 1.8.23
71
+ signing_key:
72
+ specification_version: 3
73
+ summary: An easy modular styleguide for rails -- run rails g styleguide
74
+ test_files: []
75
+ has_rdoc: