styleguide 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/Gemfile +4 -0
- data/README.markdown +50 -0
- data/Rakefile +36 -0
- data/lib/generators/controller_generator.rb +26 -0
- data/lib/generators/templates/controller.rb +7 -0
- data/lib/generators/templates/style.rb +5 -0
- data/lib/generators/templates/view.rb +143 -0
- data/lib/styleguide.rb +4 -0
- data/lib/styleguide/version.rb +3 -0
- data/spec/controller_genarator_spec.rb +33 -0
- data/spec/rails_app/.gitignore +4 -0
- data/spec/rails_app/.rspec +1 -0
- data/spec/rails_app/config.ru +4 -0
- data/spec/rails_app/config/application.rb +42 -0
- data/spec/rails_app/config/boot.rb +6 -0
- data/spec/rails_app/config/database.yml +22 -0
- data/spec/rails_app/config/environment.rb +8 -0
- data/spec/rails_app/config/environments/development.rb +26 -0
- data/spec/rails_app/config/environments/production.rb +49 -0
- data/spec/rails_app/config/environments/test.rb +35 -0
- data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/rails_app/config/initializers/inflections.rb +10 -0
- data/spec/rails_app/config/initializers/mime_types.rb +5 -0
- data/spec/rails_app/config/initializers/secret_token.rb +7 -0
- data/spec/rails_app/config/initializers/session_store.rb +8 -0
- data/spec/rails_app/config/locales/en.yml +5 -0
- data/spec/rails_app/config/routes.rb +62 -0
- data/spec/rails_app/db/seeds.rb +7 -0
- data/spec/rails_app/doc/README_FOR_APP +2 -0
- data/spec/rails_app/lib/tasks/.gitkeep +0 -0
- data/spec/rails_app/public/stylesheets/controller.css +5 -0
- data/spec/rails_app/public/stylesheets/styleguides.css +5 -0
- data/spec/rails_app/script/rails +6 -0
- data/spec/rails_app/spec/spec_helper.rb +27 -0
- data/spec/rails_app/test/performance/browsing_test.rb +9 -0
- data/spec/rails_app/test/test_helper.rb +13 -0
- data/styleguide.gemspec +28 -0
- metadata +181 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.markdown
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# Styleguide
|
2
|
+
|
3
|
+
A styleguide generator for your rails app
|
4
|
+
|
5
|
+
|
6
|
+
This gem add a generator to your app, to generate a controller, view, css, and route for your app
|
7
|
+
|
8
|
+
The view contains all the common html tags, and it will take all the styles that you have code, no you
|
9
|
+
can see the look of each tag.
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Include it on your Gemfile
|
14
|
+
|
15
|
+
gem 'styleguide'
|
16
|
+
|
17
|
+
And install it
|
18
|
+
|
19
|
+
bundle install
|
20
|
+
|
21
|
+
thats all.
|
22
|
+
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
Once its installed you'll have a new Rails generator *rails genereate styleguide:controller*
|
27
|
+
|
28
|
+
for example if you want a stylguide with the name mystyleguide just:
|
29
|
+
|
30
|
+
rails genereate styleguide:controller mystyleguide
|
31
|
+
|
32
|
+
this will generateat
|
33
|
+
|
34
|
+
create app/controllers/mystyleguides_controller.rb
|
35
|
+
create app/views/mystyleguides/show.html.haml
|
36
|
+
create public/stylesheets/mystyleguides.css
|
37
|
+
route resource :mystyleguide, :only => :show
|
38
|
+
|
39
|
+
|
40
|
+
## TODO
|
41
|
+
|
42
|
+
* add rspec for routes
|
43
|
+
* add blueprints and compass suport
|
44
|
+
* create a fork for sinatra
|
45
|
+
|
46
|
+
# About the Author
|
47
|
+
|
48
|
+
[Crowd Interactive](http://www.crowdint.com) is an American web design and development company that happens to work in Colima, Mexico.
|
49
|
+
We specialize in building and growing online retail stores. We don’t work with everyone, just companies we believe in. Call us today to see if there’s a fit.
|
50
|
+
Find more info [here](http://www.crowdint.com)!
|
data/Rakefile
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#require 'bundler'
|
2
|
+
#Bundler::GemHelper.install_tasks
|
3
|
+
#require 'rake'
|
4
|
+
#require 'rubygems'
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
##require 'rake/testtask'
|
10
|
+
##Rake::TestTask.new(:test) do |test|
|
11
|
+
## test.libs << 'lib' << 'test'
|
12
|
+
## test.pattern = 'test/**/test_*.rb'
|
13
|
+
## test.verbose = true
|
14
|
+
##end
|
15
|
+
|
16
|
+
##require 'rubygems'
|
17
|
+
|
18
|
+
|
19
|
+
#Spec::Rake::SpecTask.new('spec') do |t|
|
20
|
+
# t.spec_opts = ['--options', "spec/spec.opts"]
|
21
|
+
# t.spec_files = FileList['spec/*_spec.rb']
|
22
|
+
#end
|
23
|
+
|
24
|
+
|
25
|
+
require 'bundler'
|
26
|
+
Bundler::GemHelper.install_tasks
|
27
|
+
|
28
|
+
require 'rspec/core/rake_task'
|
29
|
+
|
30
|
+
desc "Run all examples"
|
31
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
32
|
+
t.rspec_path = 'rspec'
|
33
|
+
t.rspec_opts = %w[--color]
|
34
|
+
end
|
35
|
+
|
36
|
+
task :default => :spec
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Styleguide
|
2
|
+
module Generators
|
3
|
+
class ControllerGenerator < Rails::Generators::Base
|
4
|
+
|
5
|
+
argument :controller_name, :type => :string, :banner => 'controller_name'
|
6
|
+
source_root File.expand_path("../templates", __FILE__)
|
7
|
+
desc "Create a controller for styleguide"
|
8
|
+
|
9
|
+
def generate_files
|
10
|
+
underscored = controller_name.underscore
|
11
|
+
path = 'app/controllers/'
|
12
|
+
view_path = "app/views/#{underscored.pluralize}/show.html.haml"
|
13
|
+
route = underscored.gsub(/\//,'#')
|
14
|
+
underscored = underscored.pluralize + '_controller' unless underscored.match(/_controller$/)
|
15
|
+
@class_name = underscored.classify
|
16
|
+
@model_name = @class_name.demodulize.match(/(.+)Controller$/)[1].underscore.singularize
|
17
|
+
file_path = "#{path}#{underscored}.rb"
|
18
|
+
css_path = "public/stylesheets/#{underscored.split("_").first}.css"
|
19
|
+
template('controller.rb', file_path)
|
20
|
+
template('view.rb',view_path)
|
21
|
+
template('style.rb',css_path)
|
22
|
+
route("resource :#{route}, :only => :show")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,143 @@
|
|
1
|
+
%html{html_attrs('en-US')}
|
2
|
+
%head
|
3
|
+
%title Styleguide
|
4
|
+
= stylesheet_link_tag :all
|
5
|
+
%body
|
6
|
+
#container
|
7
|
+
|
8
|
+
%h1 This is and examples of the basic style of your app
|
9
|
+
%h2 This is a h2 example
|
10
|
+
|
11
|
+
%p
|
12
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas facilisis pharetra consequat. Sed turpis nulla, consectetur quis scelerisque nec, scelerisque eget felis. In volutpat hendrerit sagittis. Sed elementum, massa quis fringilla feugiat, arcu arcu imperdiet ipsum, eget semper elit erat quis neque. Maecenas nec augue enim. Nulla quis egestas neque. Donec mattis, orci nec elementum ultrices, nibh turpis ullamcorper augue, eget interdum risus nisl eu nulla. Sed posuere, libero ac vulputate tempus, lorem lorem auctor mi, sed luctus lorem nibh vitae lacus. Vivamus est quam, placerat at porttitor a, ornare eget ipsum. Etiam eget dolor arcu, adipiscing congue orci. Maecenas mattis volutpat porttitor. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vivamus sit amet elit arcu, vel tristique mauris. Nam a tortor vitae justo facilisis scelerisque ac eget puru
|
13
|
+
%p
|
14
|
+
Vestibulum vel odio vel ipsum mattis facilisis at vel lacus. Suspendisse hendrerit lectus nec nunc sodales eleifend. Fusce vel neque eros. Pellentesque sed risus a risus dapibus facilisis. Pellentesque nec nulla sapien. Sed quis nisi et lacus venenatis sagittis. Maecenas dignissim lectus nec nunc sagittis ultricies.
|
15
|
+
|
16
|
+
%blockquote
|
17
|
+
Aenean mi nulla, condimentum ut lobortis eget, lacinia at sapien. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed lacinia justo nec nisl dictum gravida.
|
18
|
+
|
19
|
+
%h3 this is a h3 example.
|
20
|
+
%p
|
21
|
+
Etiam eu mi id leo commodo eleifend eget eget velit. Proin malesuada semper mollis. Pellentesque elit odio, condimentum nec viverra eu, iaculis a neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Cras porta malesuada mauris, fringilla bibendum nibh bibendum vel. Curabitur dapibus consectetur porta. Nunc a ipsum tortor. Maecenas urna leo, fringilla vel molestie eget, malesuada sed nunc. Duis dictum dignissim erat vel congue. Sed imperdiet condimentum sodales
|
22
|
+
|
23
|
+
%hr
|
24
|
+
|
25
|
+
%h1 this a h1 example
|
26
|
+
%h2 this a h2 example
|
27
|
+
%h3 this a h3 example
|
28
|
+
%h4 this a h4 example
|
29
|
+
%h5 this a h5 example
|
30
|
+
%h6 this a h6 example
|
31
|
+
|
32
|
+
%hr
|
33
|
+
|
34
|
+
%h1 Long h1 tittle tiam eu mi id leo commodo eleifend eget eget velit. Proin malesuada semper mollis. Pellentesque elit odio, condimentum nec viverra eu, iaculis a neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
|
35
|
+
|
36
|
+
%p
|
37
|
+
Cras porta malesuada mauris, fringilla bibendum nibh bibendum vel. Curabitur dapibus consectetur porta. Nunc a ipsum tortor. Maecenas urna leo, fringilla vel molestie eget, malesuada sed nunc. Duis dictum dignissim erat vel congue. Sed imperdiet condimentum sodales.
|
38
|
+
|
39
|
+
%h3 Long h1 tittle tiam eu mi id leo commodo eleifend eget eget velit. Proin malesuada semper mollis. Pellentesque elit odio, condimentum nec viverra eu, iaculis a neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
|
40
|
+
|
41
|
+
%p
|
42
|
+
Cras porta malesuada mauris, fringilla bibendum nibh bibendum vel. Curabitur dapibus consectetur porta. Nunc a ipsum tortor. Maecenas urna leo, fringilla vel molestie eget, malesuada sed nunc. Duis dictum dignissim erat vel congue. Sed imperdiet condimentum sodales.
|
43
|
+
|
44
|
+
%h4 Long h1 tittle tiam eu mi id leo commodo eleifend eget eget velit. Proin malesuada semper mollis. Pellentesque elit odio, condimentum nec viverra eu, iaculis a neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
|
45
|
+
|
46
|
+
%p
|
47
|
+
Cras porta malesuada mauris, fringilla bibendum nibh bibendum vel. Curabitur dapibus consectetur porta. Nunc a ipsum tortor. Maecenas urna leo, fringilla vel molestie eget, malesuada sed nunc. Duis dictum dignissim erat vel congue. Sed imperdiet condimentum sodales.
|
48
|
+
|
49
|
+
%p
|
50
|
+
Cras porta malesuada mauris, fringilla bibendum nibh bibendum vel. Curabitur dapibus consectetur porta. Nunc a ipsum tortor. Maecenas urna leo, fringilla vel molestie eget, malesuada sed nunc. Duis dictum dignissim erat vel congue. Sed imperdiet condimentum sodales.
|
51
|
+
|
52
|
+
%hr
|
53
|
+
|
54
|
+
%h1 List styles
|
55
|
+
|
56
|
+
%ul
|
57
|
+
%li Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
58
|
+
%li Ut sit amet risus eros, a convallis diam.
|
59
|
+
%li LNullam eu nibh augue, in semper magna.
|
60
|
+
%li Phasellus semper magna non turpis rutrum at viverra nisi fringilla.
|
61
|
+
|
62
|
+
%ol
|
63
|
+
%li Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
64
|
+
%li Ut sit amet risus eros, a convallis diam.
|
65
|
+
%li LNullam eu nibh augue, in semper magna.
|
66
|
+
%li Phasellus semper magna non turpis rutrum at viverra nisi fringilla
|
67
|
+
|
68
|
+
%li Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
69
|
+
%li Ut sit amet risus eros, a convallis diam.
|
70
|
+
%ul
|
71
|
+
%li LNullam eu nibh augue, in semper magna.
|
72
|
+
%li Phasellus semper magna non turpis rutrum at viverra nisi fringilla
|
73
|
+
%ol
|
74
|
+
%li LNullam eu nibh augue, in semper magna.
|
75
|
+
%li Phasellus semper magna non turpis rutrum at viverra nisi fringilla
|
76
|
+
|
77
|
+
%hr
|
78
|
+
|
79
|
+
= form_tag('/post') do
|
80
|
+
%fieldset
|
81
|
+
= label_tag 'Name'
|
82
|
+
%br
|
83
|
+
= text_field_tag 'name'
|
84
|
+
%br
|
85
|
+
= label_tag 'Nickname'
|
86
|
+
%br
|
87
|
+
= text_field_tag 'Nickname'
|
88
|
+
%br
|
89
|
+
= label_tag 'Post'
|
90
|
+
%br
|
91
|
+
= text_area_tag 'post'
|
92
|
+
%fieldset
|
93
|
+
= label_tag 'Select count'
|
94
|
+
%br
|
95
|
+
= select_tag "count", "<option>1</option><option>2</option><option>3</option><option>4</option>"
|
96
|
+
%br
|
97
|
+
= label_tag 'Radio Buttons'
|
98
|
+
%br
|
99
|
+
= radio_button_tag 'gender', 'male'
|
100
|
+
%br
|
101
|
+
= radio_button_tag 'gender', 'female'
|
102
|
+
%br
|
103
|
+
= label_tag 'Checkboxes'
|
104
|
+
%br
|
105
|
+
= check_box_tag 'false'
|
106
|
+
= check_box_tag 'true'
|
107
|
+
= submit_tag 'Save'
|
108
|
+
|
109
|
+
%hr
|
110
|
+
|
111
|
+
%h1 Miselaneoussss Styles
|
112
|
+
|
113
|
+
%stong strong text
|
114
|
+
%ins inserted
|
115
|
+
%del deleted
|
116
|
+
%i italix
|
117
|
+
%em emphasisi
|
118
|
+
|
119
|
+
%a{:href => '#'} links dude
|
120
|
+
|
121
|
+
%table
|
122
|
+
%thead
|
123
|
+
%tr
|
124
|
+
%th name
|
125
|
+
%th lastname
|
126
|
+
%th email
|
127
|
+
%tbody
|
128
|
+
%tr
|
129
|
+
%td Juan
|
130
|
+
%td lopez
|
131
|
+
%td lopex@lopex.com
|
132
|
+
%tr
|
133
|
+
%td Juan
|
134
|
+
%td lopez
|
135
|
+
%td lopex@lopex.com
|
136
|
+
%tr
|
137
|
+
%td Juan
|
138
|
+
%td lopez
|
139
|
+
%td lopex@lopex.com
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
data/lib/styleguide.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'rails_app/spec/spec_helper')
|
2
|
+
|
3
|
+
describe "controller_generator" do
|
4
|
+
describe "generators" do
|
5
|
+
before do
|
6
|
+
Rails.stub!(:env).and_return("development")
|
7
|
+
@controller_name = 'styleguide'
|
8
|
+
Styleguide::Generators::ControllerGenerator.start([@controller_name], :destination_root => File.expand_path(File.join("spec","rails_app")))
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should generate the controller" do
|
12
|
+
file = File.expand_path(File.join("spec","rails_app","app", "controllers", "styleguides_controller.rb"))
|
13
|
+
File.exist?(file).should be(true)
|
14
|
+
end
|
15
|
+
it "should generate the view" do
|
16
|
+
file = File.expand_path(File.join("spec","rails_app","app", "views", "styleguides", "show.html.haml"))
|
17
|
+
File.exist?(file).should be(true)
|
18
|
+
end
|
19
|
+
it "should generate the CSS" do
|
20
|
+
file = File.expand_path(File.join("spec","rails_app","public", "stylesheets", "styleguides.css"))
|
21
|
+
File.exist?(file).should be(true)
|
22
|
+
end
|
23
|
+
|
24
|
+
# TODO rspec for route
|
25
|
+
# describe "ave", :type => :styleguides do
|
26
|
+
# it "should recognize a specific styleguide route" do
|
27
|
+
# params_from( :get, '/styleguide' ).should == {:controller => "styleguides", :action => "show"}
|
28
|
+
# end
|
29
|
+
# end
|
30
|
+
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
# If you have a Gemfile, require the gems listed there, including any gems
|
6
|
+
# you've limited to :test, :development, or :production.
|
7
|
+
Bundler.require(:default, Rails.env) if defined?(Bundler)
|
8
|
+
|
9
|
+
module RailsApp
|
10
|
+
class Application < Rails::Application
|
11
|
+
# Settings in config/environments/* take precedence over those specified here.
|
12
|
+
# Application configuration should go into files in config/initializers
|
13
|
+
# -- all .rb files in that directory are automatically loaded.
|
14
|
+
|
15
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
16
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
17
|
+
|
18
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
19
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
20
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
21
|
+
|
22
|
+
# Activate observers that should always be running.
|
23
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
24
|
+
|
25
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
26
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
27
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
28
|
+
|
29
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
30
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
31
|
+
# config.i18n.default_locale = :de
|
32
|
+
|
33
|
+
# JavaScript files you want as :defaults (application.js is always included).
|
34
|
+
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
|
35
|
+
|
36
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
37
|
+
config.encoding = "utf-8"
|
38
|
+
|
39
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
40
|
+
config.filter_parameters += [:password]
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3
|
3
|
+
development:
|
4
|
+
adapter: sqlite3
|
5
|
+
database: db/development.sqlite3
|
6
|
+
pool: 5
|
7
|
+
timeout: 5000
|
8
|
+
|
9
|
+
# Warning: The database defined as "test" will be erased and
|
10
|
+
# re-generated from your development database when you run "rake".
|
11
|
+
# Do not set this db to the same as development or production.
|
12
|
+
test:
|
13
|
+
adapter: sqlite3
|
14
|
+
database: db/test.sqlite3
|
15
|
+
pool: 5
|
16
|
+
timeout: 5000
|
17
|
+
|
18
|
+
production:
|
19
|
+
adapter: sqlite3
|
20
|
+
database: db/production.sqlite3
|
21
|
+
pool: 5
|
22
|
+
timeout: 5000
|
@@ -0,0 +1,26 @@
|
|
1
|
+
RailsApp::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the webserver when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_view.debug_rjs = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
|
17
|
+
# Don't care if the mailer can't send
|
18
|
+
config.action_mailer.raise_delivery_errors = false
|
19
|
+
|
20
|
+
# Print deprecation notices to the Rails logger
|
21
|
+
config.active_support.deprecation = :log
|
22
|
+
|
23
|
+
# Only use best-standards-support built into browsers
|
24
|
+
config.action_dispatch.best_standards_support = :builtin
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
RailsApp::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# The production environment is meant for finished, "live" apps.
|
5
|
+
# Code is not reloaded between requests
|
6
|
+
config.cache_classes = true
|
7
|
+
|
8
|
+
# Full error reports are disabled and caching is turned on
|
9
|
+
config.consider_all_requests_local = false
|
10
|
+
config.action_controller.perform_caching = true
|
11
|
+
|
12
|
+
# Specifies the header that your server uses for sending files
|
13
|
+
config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
14
|
+
|
15
|
+
# For nginx:
|
16
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
17
|
+
|
18
|
+
# If you have no front-end server that supports something like X-Sendfile,
|
19
|
+
# just comment this out and Rails will serve the files
|
20
|
+
|
21
|
+
# See everything in the log (default is :info)
|
22
|
+
# config.log_level = :debug
|
23
|
+
|
24
|
+
# Use a different logger for distributed setups
|
25
|
+
# config.logger = SyslogLogger.new
|
26
|
+
|
27
|
+
# Use a different cache store in production
|
28
|
+
# config.cache_store = :mem_cache_store
|
29
|
+
|
30
|
+
# Disable Rails's static asset server
|
31
|
+
# In production, Apache or nginx will already do this
|
32
|
+
config.serve_static_assets = false
|
33
|
+
|
34
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
35
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
36
|
+
|
37
|
+
# Disable delivery errors, bad email addresses will be ignored
|
38
|
+
# config.action_mailer.raise_delivery_errors = false
|
39
|
+
|
40
|
+
# Enable threaded mode
|
41
|
+
# config.threadsafe!
|
42
|
+
|
43
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
44
|
+
# the I18n.default_locale when a translation can not be found)
|
45
|
+
config.i18n.fallbacks = true
|
46
|
+
|
47
|
+
# Send deprecation notices to registered listeners
|
48
|
+
config.active_support.deprecation = :notify
|
49
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
RailsApp::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Log error messages when you accidentally call methods on nil.
|
11
|
+
config.whiny_nils = true
|
12
|
+
|
13
|
+
# Show full error reports and disable caching
|
14
|
+
config.consider_all_requests_local = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
|
17
|
+
# Raise exceptions instead of rendering exception templates
|
18
|
+
config.action_dispatch.show_exceptions = false
|
19
|
+
|
20
|
+
# Disable request forgery protection in test environment
|
21
|
+
config.action_controller.allow_forgery_protection = false
|
22
|
+
|
23
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
24
|
+
# The :test delivery method accumulates sent emails in the
|
25
|
+
# ActionMailer::Base.deliveries array.
|
26
|
+
config.action_mailer.delivery_method = :test
|
27
|
+
|
28
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
29
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
30
|
+
# like if you have constraints or database-specific column types
|
31
|
+
# config.active_record.schema_format = :sql
|
32
|
+
|
33
|
+
# Print deprecation notices to the stderr
|
34
|
+
config.active_support.deprecation = :stderr
|
35
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format
|
4
|
+
# (all these examples are active by default):
|
5
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
8
|
+
# inflect.irregular 'person', 'people'
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
10
|
+
# end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
RailsApp::Application.config.secret_token = '829013e912d8aadceeb67b0c176ed092f150207665e987586796b9ecbb564b9e45cf5db30c31e9ac0456670fa23096472052c40c24f7fcc6201ebf2338f48294'
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
RailsApp::Application.config.session_store :cookie_store, :key => '_rails_app_session'
|
4
|
+
|
5
|
+
# Use the database for sessions instead of the cookie-based default,
|
6
|
+
# which shouldn't be used to store highly confidential information
|
7
|
+
# (create the session table with "rails generate session_migration")
|
8
|
+
# RailsApp::Application.config.session_store :active_record_store
|
@@ -0,0 +1,62 @@
|
|
1
|
+
RailsApp::Application.routes.draw do
|
2
|
+
|
3
|
+
|
4
|
+
resource :styleguide, :only => :show
|
5
|
+
|
6
|
+
# The priority is based upon order of creation:
|
7
|
+
# first created -> highest priority.
|
8
|
+
|
9
|
+
# Sample of regular route:
|
10
|
+
# match 'products/:id' => 'catalog#view'
|
11
|
+
# Keep in mind you can assign values other than :controller and :action
|
12
|
+
|
13
|
+
# Sample of named route:
|
14
|
+
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
|
15
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
16
|
+
|
17
|
+
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
18
|
+
# resources :products
|
19
|
+
|
20
|
+
# Sample resource route with options:
|
21
|
+
# resources :products do
|
22
|
+
# member do
|
23
|
+
# get 'short'
|
24
|
+
# post 'toggle'
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
# collection do
|
28
|
+
# get 'sold'
|
29
|
+
# end
|
30
|
+
# end
|
31
|
+
|
32
|
+
# Sample resource route with sub-resources:
|
33
|
+
# resources :products do
|
34
|
+
# resources :comments, :sales
|
35
|
+
# resource :seller
|
36
|
+
# end
|
37
|
+
|
38
|
+
# Sample resource route with more complex sub-resources
|
39
|
+
# resources :products do
|
40
|
+
# resources :comments
|
41
|
+
# resources :sales do
|
42
|
+
# get 'recent', :on => :collection
|
43
|
+
# end
|
44
|
+
# end
|
45
|
+
|
46
|
+
# Sample resource route within a namespace:
|
47
|
+
# namespace :admin do
|
48
|
+
# # Directs /admin/products/* to Admin::ProductsController
|
49
|
+
# # (app/controllers/admin/products_controller.rb)
|
50
|
+
# resources :products
|
51
|
+
# end
|
52
|
+
|
53
|
+
# You can have the root of your site routed with "root"
|
54
|
+
# just remember to delete public/index.html.
|
55
|
+
# root :to => "welcome#index"
|
56
|
+
|
57
|
+
# See how all your routes lay out with "rake routes"
|
58
|
+
|
59
|
+
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
60
|
+
# Note: This route will make all actions in every controller accessible via GET requests.
|
61
|
+
# match ':controller(/:action(/:id(.:format)))'
|
62
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
+
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
|
+
#
|
4
|
+
# Examples:
|
5
|
+
#
|
6
|
+
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
|
7
|
+
# Mayor.create(:name => 'Daley', :city => cities.first)
|
File without changes
|
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
|
+
require 'rails/commands'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
ENV["RAILS_ENV"] ||= 'test'
|
3
|
+
require File.expand_path("../../config/environment", __FILE__)
|
4
|
+
require 'rspec/rails'
|
5
|
+
|
6
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
7
|
+
# in spec/support/ and its subdirectories.
|
8
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
# == Mock Framework
|
12
|
+
#
|
13
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
14
|
+
#
|
15
|
+
# config.mock_with :mocha
|
16
|
+
# config.mock_with :flexmock
|
17
|
+
# config.mock_with :rr
|
18
|
+
config.mock_with :rspec
|
19
|
+
|
20
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
21
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
22
|
+
|
23
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
24
|
+
# examples within a transaction, remove the following line or assign false
|
25
|
+
# instead of true.
|
26
|
+
config.use_transactional_fixtures = true
|
27
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
2
|
+
require File.expand_path('../../config/environment', __FILE__)
|
3
|
+
require 'rails/test_help'
|
4
|
+
|
5
|
+
class ActiveSupport::TestCase
|
6
|
+
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
7
|
+
#
|
8
|
+
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
9
|
+
# -- they do not yet inherit this setting
|
10
|
+
fixtures :all
|
11
|
+
|
12
|
+
# Add more helper methods to be used by all tests here...
|
13
|
+
end
|
data/styleguide.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "styleguide/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "styleguide"
|
7
|
+
s.version = Styleguide::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Hector Bustillos M."]
|
10
|
+
s.email = ["hector.bustillos@crowdint.com"]
|
11
|
+
s.homepage = "http://github.com/crowdint/styleguide"
|
12
|
+
s.summary = %q{This gem generates a style guide for your app}
|
13
|
+
s.description = %q{it will add a view with all the common html tags for test your CSS}
|
14
|
+
|
15
|
+
s.rubyforge_project = "styleguide"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib","generators"]
|
21
|
+
|
22
|
+
s.add_dependency('rails')
|
23
|
+
s.add_dependency('haml')
|
24
|
+
s.add_dependency('rspec')
|
25
|
+
s.add_dependency('rspec-rails')
|
26
|
+
s.add_dependency('sqlite3')
|
27
|
+
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,181 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: styleguide
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Hector Bustillos M.
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-02-25 00:00:00 -06:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rails
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: haml
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: rspec
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
type: :runtime
|
62
|
+
version_requirements: *id003
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: rspec-rails
|
65
|
+
prerelease: false
|
66
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 3
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
version: "0"
|
75
|
+
type: :runtime
|
76
|
+
version_requirements: *id004
|
77
|
+
- !ruby/object:Gem::Dependency
|
78
|
+
name: sqlite3
|
79
|
+
prerelease: false
|
80
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
hash: 3
|
86
|
+
segments:
|
87
|
+
- 0
|
88
|
+
version: "0"
|
89
|
+
type: :runtime
|
90
|
+
version_requirements: *id005
|
91
|
+
description: it will add a view with all the common html tags for test your CSS
|
92
|
+
email:
|
93
|
+
- hector.bustillos@crowdint.com
|
94
|
+
executables: []
|
95
|
+
|
96
|
+
extensions: []
|
97
|
+
|
98
|
+
extra_rdoc_files: []
|
99
|
+
|
100
|
+
files:
|
101
|
+
- .gitignore
|
102
|
+
- Gemfile
|
103
|
+
- README.markdown
|
104
|
+
- Rakefile
|
105
|
+
- lib/generators/controller_generator.rb
|
106
|
+
- lib/generators/templates/controller.rb
|
107
|
+
- lib/generators/templates/style.rb
|
108
|
+
- lib/generators/templates/view.rb
|
109
|
+
- lib/styleguide.rb
|
110
|
+
- lib/styleguide/version.rb
|
111
|
+
- spec/controller_genarator_spec.rb
|
112
|
+
- spec/rails_app/.gitignore
|
113
|
+
- spec/rails_app/.rspec
|
114
|
+
- spec/rails_app/app/controllers/application_controller.rb
|
115
|
+
- spec/rails_app/app/controllers/styleguides_controller.rb
|
116
|
+
- spec/rails_app/app/helpers/application_helper.rb
|
117
|
+
- spec/rails_app/app/views/controller_names/show.html.haml
|
118
|
+
- spec/rails_app/app/views/layouts/application.html.erb
|
119
|
+
- spec/rails_app/app/views/styleguides/show.html.haml
|
120
|
+
- spec/rails_app/config.ru
|
121
|
+
- spec/rails_app/config/application.rb
|
122
|
+
- spec/rails_app/config/boot.rb
|
123
|
+
- spec/rails_app/config/database.yml
|
124
|
+
- spec/rails_app/config/environment.rb
|
125
|
+
- spec/rails_app/config/environments/development.rb
|
126
|
+
- spec/rails_app/config/environments/production.rb
|
127
|
+
- spec/rails_app/config/environments/test.rb
|
128
|
+
- spec/rails_app/config/initializers/backtrace_silencers.rb
|
129
|
+
- spec/rails_app/config/initializers/inflections.rb
|
130
|
+
- spec/rails_app/config/initializers/mime_types.rb
|
131
|
+
- spec/rails_app/config/initializers/secret_token.rb
|
132
|
+
- spec/rails_app/config/initializers/session_store.rb
|
133
|
+
- spec/rails_app/config/locales/en.yml
|
134
|
+
- spec/rails_app/config/routes.rb
|
135
|
+
- spec/rails_app/db/seeds.rb
|
136
|
+
- spec/rails_app/doc/README_FOR_APP
|
137
|
+
- spec/rails_app/lib/tasks/.gitkeep
|
138
|
+
- spec/rails_app/public/stylesheets/controller.css
|
139
|
+
- spec/rails_app/public/stylesheets/styleguides.css
|
140
|
+
- spec/rails_app/script/rails
|
141
|
+
- spec/rails_app/spec/spec_helper.rb
|
142
|
+
- spec/rails_app/test/performance/browsing_test.rb
|
143
|
+
- spec/rails_app/test/test_helper.rb
|
144
|
+
- styleguide.gemspec
|
145
|
+
has_rdoc: true
|
146
|
+
homepage: http://github.com/crowdint/styleguide
|
147
|
+
licenses: []
|
148
|
+
|
149
|
+
post_install_message:
|
150
|
+
rdoc_options: []
|
151
|
+
|
152
|
+
require_paths:
|
153
|
+
- lib
|
154
|
+
- generators
|
155
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
156
|
+
none: false
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
hash: 3
|
161
|
+
segments:
|
162
|
+
- 0
|
163
|
+
version: "0"
|
164
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
|
+
none: false
|
166
|
+
requirements:
|
167
|
+
- - ">="
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
hash: 3
|
170
|
+
segments:
|
171
|
+
- 0
|
172
|
+
version: "0"
|
173
|
+
requirements: []
|
174
|
+
|
175
|
+
rubyforge_project: styleguide
|
176
|
+
rubygems_version: 1.3.7
|
177
|
+
signing_key:
|
178
|
+
specification_version: 3
|
179
|
+
summary: This gem generates a style guide for your app
|
180
|
+
test_files: []
|
181
|
+
|