uikit 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/README.md +64 -0
  4. data/Rakefile +61 -0
  5. data/lib/generators/uikit/install_generator.rb +17 -4
  6. data/lib/generators/uikit/templates/{mixins → app/assets/stylesheets/mixins}/animate.scss +0 -0
  7. data/lib/generators/uikit/templates/{mixins → app/assets/stylesheets/mixins}/border-helper.scss +0 -0
  8. data/lib/generators/uikit/templates/{mixins → app/assets/stylesheets/mixins}/box-shadow.scss +0 -0
  9. data/lib/generators/uikit/templates/{uikit.scss → app/assets/stylesheets/uikit.scss} +0 -0
  10. data/lib/generators/uikit/templates/app/assets/stylesheets/uikit/base.scss +9 -0
  11. data/lib/generators/uikit/templates/app/assets/stylesheets/uikit/buttons.scss +41 -0
  12. data/lib/generators/uikit/templates/app/assets/stylesheets/uikit/colors.scss +3 -0
  13. data/lib/generators/uikit/templates/{uikit → app/assets/stylesheets/uikit}/flash.scss +0 -0
  14. data/lib/generators/uikit/templates/{uikit → app/assets/stylesheets/uikit}/fonts.scss +13 -10
  15. data/lib/generators/uikit/templates/{uikit → app/assets/stylesheets/uikit}/forms.scss +0 -0
  16. data/lib/generators/uikit/templates/{uikit → app/assets/stylesheets/uikit}/layout.scss +0 -0
  17. data/lib/generators/uikit/templates/{uikit → app/assets/stylesheets/uikit}/reset.scss +3 -0
  18. data/lib/generators/uikit/templates/app/helpers/application_helper.rb +7 -0
  19. data/lib/generators/uikit/templates/app/views/layouts/_footer.html.erb +20 -0
  20. data/lib/generators/uikit/templates/app/views/layouts/_header.html.erb +14 -0
  21. data/lib/generators/uikit/templates/app/views/layouts/application.html.erb +44 -0
  22. data/lib/uikit/version.rb +1 -1
  23. data/spec/spec_helper.rb +14 -0
  24. metadata +21 -14
  25. data/lib/generators/uikit/templates/uikit/base.scss +0 -7
  26. data/lib/generators/uikit/templates/uikit/buttons.scss +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e3be7181b2d0eeb6b440b2e97dd9428acb1c867
4
- data.tar.gz: ec9b76304b3452fbf49cb4d6a5554b21fe065e67
3
+ metadata.gz: 574d4fb98c87420a9afd6e55d223617898c241b7
4
+ data.tar.gz: 7072f4cbb663bce57e44f3cfd9d7bb2a77fc8adb
5
5
  SHA512:
6
- metadata.gz: 5c266ae80d86f8674bcf9e2e4a2a8503f3819a37e3b4318daca778beb96fc92ae3778e8b3c8f99c22838d51b50e1d7a7b58f024413a5c4587a86035275f18338
7
- data.tar.gz: 7be41f79f52e24d83e0f054076fdcb91ab5fc358d9822043b36c25406268340eddf04851c2945dd6f55128d56c8df5e03676d2c399b3f2dcb9b41e1d1f40992f
6
+ metadata.gz: e4bda76a07c6007cb3cbf9c5c055eccb46ad3f4be08a40c8eb5708984a8021ee5b252b2d55dcaf93d8fc5c0dfae1e6149fe1a529d77d7698e0d951a4ba191dc7
7
+ data.tar.gz: 30347be27248591874278b32b6ed2361ff5a92d8e6cb22cc8dd5a1e3067831fa960d25e524025647e56c100de73130e8297bdb6d420bd9775281b5b05184198e
data/.gitignore CHANGED
@@ -16,3 +16,4 @@ spec/reports
16
16
  test/tmp
17
17
  test/version_tmp
18
18
  tmp
19
+ .DS_Store
data/README.md CHANGED
@@ -26,6 +26,70 @@ After installing the gem you:
26
26
 
27
27
  rails g uikit:install
28
28
 
29
+ This installs a basic layout with a footer and header. It might be completely
30
+ wrong for you. You could use a more basic layout instead. Like this:
31
+
32
+ <!DOCTYPE html>
33
+ <html lang="en">
34
+ <head>
35
+ <title><%= yield :title %></title>
36
+ <%= stylesheet_link_tag "application", :media => "all" %>
37
+ <%= yield :stylesheets %>
38
+ <%= javascript_include_tag "application" %>
39
+ <meta charset="utf-8">
40
+ <%= csrf_meta_tags %>
41
+ </head>
42
+ <body class="<%= "#{current_controller}-#{current_action}" %> <%= content_for :classes %>">
43
+ <% flash.each do |type, msg| %>
44
+ <p class="flash <%= type %>"><%= msg %></p>
45
+ <% end %>
46
+
47
+ <div id="container">
48
+ <%= yield %>
49
+ </div>
50
+ </body>
51
+ <%= yield :javascripts %>
52
+ </html>
53
+
54
+ After that you will want to adjust your application.css:
55
+
56
+ /*
57
+ *= require_self
58
+ *= require './uikit.css'
59
+ */
60
+
61
+ You do not want to use `require_tree` to import `uikit.css`. This will inject all
62
+ of the styles in path order. Instead, by leveraging the SCSS imports you can
63
+ summarize all of the default styles.
64
+
65
+ When creating a new controller, for instance `PagesController`, you'll want to
66
+ create a new stylesheet such as `app/assets/stylesheets/pages.css.scss`. Then add
67
+ this file to be compiled into your global stylesheet:
68
+
69
+ /*
70
+ *= require_self
71
+ *= require './uikit.css'
72
+ *= require './pages.css'
73
+ */
74
+
75
+ Within your new stylesheet, you may want to refer to pre-defined style variables
76
+ (like colors and fonts). To ensure that the load order is preserved you can
77
+ use the `@import` method at the top of the file:
78
+
79
+ @import "uikit/fonts.scss";
80
+
81
+ /* Each page has the controller and action added as classes on the body element */
82
+ body.pages.home h1 {
83
+ font-family: $sans;
84
+ }
85
+
86
+ Within your pages you can set content for `:classes` and `:title`:
87
+
88
+ <% content_for :title do 'Exciting new feature' end %>
89
+ <% content_for :classes do 'marketing' end %>
90
+
91
+ This will set the `<title>` tag and add a "marketing" class to the `<body>` tag.
92
+
29
93
  ## Contributing
30
94
 
31
95
  1. Fork it
data/Rakefile CHANGED
@@ -1 +1,62 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ gem_name = :uikit
5
+
6
+ RSpec::Core::RakeTask.new(spec: ["generator:cleanup", "generator:prepare", "generator:#{gem_name}"]) do |task|
7
+ task.pattern = "spec/**/*_spec.rb"
8
+ task.rspec_opts = "--color --drb"
9
+ task.verbose = true
10
+ end
11
+
12
+ namespace :spec do
13
+ RSpec::Core::RakeTask.new(database: ["generator:cleanup", "generator:prepare", "generator:database", "generator:#{gem_name}"]) do |task|
14
+ task.pattern = "spec/**/*_spec.rb"
15
+ task.verbose = true
16
+ end
17
+ end
18
+
19
+ namespace :generator do
20
+ desc "Cleans up the sample app before running the generator"
21
+ task :cleanup do
22
+ FileUtils.rm_rf("spec/tmp/sample") if Dir.exist?("spec/tmp/sample") if ENV['SKIP_CLEANUP'].nil?
23
+ end
24
+
25
+ desc "Prepare the sample app before running the generator"
26
+ task :prepare do
27
+ next if Dir.exist?("spec/tmp/sample")
28
+
29
+ FileUtils.mkdir_p("spec/tmp")
30
+
31
+ system "cd spec/tmp && rails new sample"
32
+
33
+ # bundle
34
+ gem_root = File.expand_path(File.dirname(__FILE__))
35
+ system "echo \"gem 'rspec-rails'\" >> spec/tmp/sample/Gemfile"
36
+ system "echo \"gem '#{gem_name}', :path => '#{gem_root}'\" >> spec/tmp/sample/Gemfile"
37
+ system "cd spec/tmp/sample && bundle install"
38
+ system "cd spec/tmp/sample && rails g rspec:install"
39
+
40
+ # Open up the root route for specs
41
+ # Make a thing and a user
42
+ system "cd spec/tmp/sample && rails g scaffold thing name:string mood:string"
43
+ system "cd spec/tmp/sample && rails g scaffold user display_name:string first_name:string email:string"
44
+ end
45
+
46
+ # This task is not used unless you need to test the generator with an alternate database
47
+ # such as mysql or postgres. By default the sample application utilize sqlite3
48
+ desc "Prepares the application with an alternate database"
49
+ task :database do
50
+ puts "== Configuring the database =================================================="
51
+ system "cp config/database.yml.example spec/tmp/sample/config/database.yml"
52
+ system "cd spec/tmp/sample && rake db:migrate:reset"
53
+ end
54
+
55
+ desc "Run the #{gem_name} generator"
56
+ task gem_name do
57
+ system "cd spec/tmp/sample && rails g #{gem_name}:install --force --test_mode && rake db:migrate db:test:prepare"
58
+ end
59
+
60
+ end
61
+
62
+ task :default => :spec
@@ -2,16 +2,29 @@ require 'rails/generators'
2
2
 
3
3
  module Uikit
4
4
  class InstallGenerator < Rails::Generators::Base
5
- desc "A basic set of user interface templates for your R<D-d>ails app"
5
+ desc "A basic set of user interface templates for your Rails app"
6
6
 
7
7
  def self.source_root
8
8
  @source_root ||= File.join(File.dirname(__FILE__), 'templates')
9
9
  end
10
10
 
11
11
  def generate_uikit
12
- copy_file "uikit.scss", "app/assets/stylesheets/uikit.scss"
13
- directory "uikit", "app/assets/stylesheets/uikit"
14
- directory "mixins", "app/assets/stylesheets/mixins"
12
+ copy_file "app/assets/stylesheets/uikit.scss", "app/assets/stylesheets/uikit.scss"
13
+ directory "app/assets/stylesheets/uikit", "app/assets/stylesheets/uikit"
14
+ directory "app/assets/stylesheets/mixins", "app/assets/stylesheets/mixins"
15
+ directory "app/views/layouts", "app/views/layouts"
16
+
17
+ # We don't want to overwrite this file
18
+ insert_at_end_of_class "app/helpers/application_helper.rb", "app/helpers/application_helper.rb"
19
+ end
20
+
21
+ protected
22
+
23
+ def insert_at_end_of_class(filename, source)
24
+ source = File.expand_path(find_in_source_paths(source.to_s))
25
+ context = instance_eval('binding')
26
+ content = ERB.new(::File.binread(source), nil, '-', '@output_buffer').result(context)
27
+ insert_into_file filename, "#{content}\n", before: /end\n*\z/
15
28
  end
16
29
  end
17
30
  end
@@ -0,0 +1,9 @@
1
+ @import "uikit/colors.scss";
2
+
3
+ html, body {
4
+ height: 100%;
5
+ }
6
+
7
+ body {
8
+ background: $background;
9
+ }
@@ -0,0 +1,41 @@
1
+ @import "uikit/colors.scss";
2
+
3
+ a.btn,
4
+ a.btn:visited,
5
+ a.btn:active,
6
+ button {
7
+ display: inline-block;
8
+ border:none;
9
+ background-color: $button;
10
+ padding: 1em 2em 1em 2em;
11
+ font-size: 0.9em;
12
+ color: white;
13
+ text-align: center;
14
+ font-weight: bold;
15
+ }
16
+
17
+ a.button.upper,
18
+ button.upper {
19
+ text-transform: uppercase;
20
+ }
21
+
22
+ a.btn:hover,
23
+ button:hover {
24
+ color: white;
25
+ }
26
+
27
+ a.btn.clear,
28
+ a.btn.clear:visited,
29
+ a.btn.clear:active,
30
+ button.clear {
31
+ padding: 1em 1em;
32
+ background: none;
33
+ border: 2px solid white;
34
+ border-radius: 5px;
35
+ }
36
+
37
+ a.btn.clear:hover,
38
+ button.clear:hover {
39
+ background-color: $button;
40
+ }
41
+
@@ -0,0 +1,3 @@
1
+ $button: #e4a43e;
2
+ $text: #312f30;
3
+ $background: #f0eeef;
@@ -1,17 +1,20 @@
1
- $courier: "Courier New", Courier, "Lucida Sans Typewriter", "Lucida Typewriter", monospace;
2
- $mono: "Lucida Sans Typewriter", "Lucida Console", Monaco, "Bitstream Vera Sans Mono", monospace;
1
+ @import "uikit/colors.scss";
2
+
3
+ $sans: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
4
+ $serif: Didot, "Didot LT STD", "Hoefler Text", Garamond, "Times New Roman", serif;
3
5
 
4
6
  body {
5
- font-size: 10px;
7
+ font-family: $sans;
8
+ font-size: 16px;
6
9
  -webkit-font-smoothing: antialiased;
7
10
  }
8
11
 
9
12
  h1, h2, h3, h4, h5, h6, p, a, li, address {
10
- color: #111;
13
+ color: $text;
11
14
  }
12
15
 
13
16
  .header {
14
- font-family: $mono;
17
+ font-family: $sans;
15
18
  font-weight: bold;
16
19
  }
17
20
 
@@ -19,11 +22,11 @@ h1 {
19
22
  font-size: 2.6em;
20
23
  margin-bottom: 0.385em;
21
24
  white-space:pre;
22
- font-family: $courier;
25
+ font-family: $serif;
23
26
 
24
27
  &.home {
25
28
  @extend .header;
26
- font-family: $mono;
29
+ font-family: $sans;
27
30
  }
28
31
  }
29
32
 
@@ -34,7 +37,7 @@ h2 {
34
37
 
35
38
  &.home {
36
39
  @extend .header;
37
- font-family: $mono;
40
+ font-family: $sans;
38
41
  }
39
42
  }
40
43
 
@@ -45,7 +48,7 @@ h3 {
45
48
 
46
49
  textarea, p, address {
47
50
  font-size: 1.7em;
48
- font-family: $mono;
51
+ font-family: $sans;
49
52
  font-weight: 300;
50
53
  line-height: 22px;
51
54
 
@@ -68,7 +71,7 @@ a {
68
71
  text-decoration: none;
69
72
 
70
73
  &:hover {
71
- color: rgb(255, 243, 42);
74
+ color: $button;
72
75
  }
73
76
  }
74
77
 
@@ -44,3 +44,6 @@ table {
44
44
  img {
45
45
  display: block;
46
46
  }
47
+ *, *:before, *:after {
48
+ -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
49
+ }
@@ -0,0 +1,7 @@
1
+ def current_controller
2
+ params[:controller]
3
+ end
4
+
5
+ def current_action
6
+ params[:action]
7
+ end
@@ -0,0 +1,20 @@
1
+ <div id="footer">
2
+ <div class="container">
3
+ <ul>
4
+ <li class="company">
5
+ <h3>YOUR COMPANY HERE</h3>
6
+ <a href="/about">About Us</a>
7
+ <a href="/press">Press</a>
8
+ <a href="/contact">Contact Us</a>
9
+ <a href="/help">Help &#38; Support</a>
10
+ </li>
11
+ </ul>
12
+ <div class="copyright">
13
+ <span>Copyright &#169; <%= Time.now.year %>, YOUR COMPANY HERE. All rights reserved.</span>
14
+ <span class="policies">
15
+ <a href="/privacy">Privacy Policy</a> |
16
+ <a href="/terms">Terms of Service</a>
17
+ </span>
18
+ </div>
19
+ </div>
20
+ </div>
@@ -0,0 +1,14 @@
1
+ <div id="header">
2
+ <h1><a href="/">YOUR COMPANY HERE</a></h1>
3
+
4
+ <div class="caption">
5
+ <!-- YOUR CAPTION HERE -->
6
+ </div>
7
+
8
+ <ul class="navigation">
9
+ <!-- YOUR FEATURES HERE -->
10
+ <li><a href="/#feature" class="local">Feature</a></li>
11
+ <li><a href="/#another-feature" class="local">Another Feature</a></li>
12
+ <li><a href="/about/">About Us</a></li>
13
+ </ul>
14
+ </div>
@@ -0,0 +1,44 @@
1
+ <!doctype html>
2
+ <!--[if IE 8]> <html lang="en" class="ie ie8 lt-ie9"> <![endif]-->
3
+ <!--[if IE 9]> <html lang="en" class="ie ie9"> <![endif]-->
4
+ <!--[if gt IE 9]><!--> <html lang="en"> <!--<![endif]-->
5
+ <head>
6
+ <title><%= content_for(:title) || "YOUR DEFAULT TITLE" %></title>
7
+ <%= stylesheet_link_tag "application", :media => "all" %>
8
+ <%= yield :stylesheets %>
9
+ <meta charset="utf-8">
10
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
11
+ <%= csrf_meta_tags %>
12
+ <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,700italic,800italic,300,400,600,700,800">
13
+ <% if Rails.env.production? %>
14
+ <script>
15
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
16
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
17
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
18
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
19
+ ga('create', 'YOUR GOOGLE ANALYTICS KEY', 'YOUR GOOGLE ANALYTICS DOMAIN');
20
+ ga('send', 'pageview');
21
+ </script>
22
+ <% end %>
23
+ </head>
24
+ <body class="<%= "#{current_controller}-#{current_action}" %> <%= content_for :classes %>">
25
+ <%= render 'layouts/header' %>
26
+
27
+ <div id="content">
28
+ <% flash.each do |type, msg| %>
29
+ <p class="flash <%= type %>"><%= msg %></p>
30
+ <% end %>
31
+
32
+ <%= yield %>
33
+ </div>
34
+
35
+ <%= render 'layouts/footer' %>
36
+ <div id="lightbox-background"></div>
37
+ </body>
38
+
39
+ <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
40
+ <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
41
+ <%= javascript_include_tag "application" %>
42
+ <%= yield :javascripts %>
43
+ </html>
44
+
data/lib/uikit/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Uikit
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -0,0 +1,14 @@
1
+ ENV["RAILS_ENV"] ||= 'test'
2
+ require File.expand_path('../tmp/sample/config/environment', __FILE__)
3
+ require 'rspec/rails'
4
+ require 'rspec/autorun'
5
+
6
+ Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
7
+
8
+ ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
9
+
10
+ RSpec.configure do |config|
11
+ config.use_transactional_fixtures = true
12
+ config.infer_base_class_for_anonymous_controllers = false
13
+ config.order = "random"
14
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uikit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Rafter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-03 00:00:00.000000000 Z
11
+ date: 2014-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,20 +52,26 @@ files:
52
52
  - Rakefile
53
53
  - lib/generators/uikit/USAGE
54
54
  - lib/generators/uikit/install_generator.rb
55
- - lib/generators/uikit/templates/mixins/animate.scss
56
- - lib/generators/uikit/templates/mixins/border-helper.scss
57
- - lib/generators/uikit/templates/mixins/box-shadow.scss
58
- - lib/generators/uikit/templates/uikit.scss
59
- - lib/generators/uikit/templates/uikit/base.scss
60
- - lib/generators/uikit/templates/uikit/buttons.scss
61
- - lib/generators/uikit/templates/uikit/flash.scss
62
- - lib/generators/uikit/templates/uikit/fonts.scss
63
- - lib/generators/uikit/templates/uikit/forms.scss
64
- - lib/generators/uikit/templates/uikit/layout.scss
65
- - lib/generators/uikit/templates/uikit/reset.scss
55
+ - lib/generators/uikit/templates/app/assets/stylesheets/mixins/animate.scss
56
+ - lib/generators/uikit/templates/app/assets/stylesheets/mixins/border-helper.scss
57
+ - lib/generators/uikit/templates/app/assets/stylesheets/mixins/box-shadow.scss
58
+ - lib/generators/uikit/templates/app/assets/stylesheets/uikit.scss
59
+ - lib/generators/uikit/templates/app/assets/stylesheets/uikit/base.scss
60
+ - lib/generators/uikit/templates/app/assets/stylesheets/uikit/buttons.scss
61
+ - lib/generators/uikit/templates/app/assets/stylesheets/uikit/colors.scss
62
+ - lib/generators/uikit/templates/app/assets/stylesheets/uikit/flash.scss
63
+ - lib/generators/uikit/templates/app/assets/stylesheets/uikit/fonts.scss
64
+ - lib/generators/uikit/templates/app/assets/stylesheets/uikit/forms.scss
65
+ - lib/generators/uikit/templates/app/assets/stylesheets/uikit/layout.scss
66
+ - lib/generators/uikit/templates/app/assets/stylesheets/uikit/reset.scss
67
+ - lib/generators/uikit/templates/app/helpers/application_helper.rb
68
+ - lib/generators/uikit/templates/app/views/layouts/_footer.html.erb
69
+ - lib/generators/uikit/templates/app/views/layouts/_header.html.erb
70
+ - lib/generators/uikit/templates/app/views/layouts/application.html.erb
66
71
  - lib/uikit.rb
67
72
  - lib/uikit/engine.rb
68
73
  - lib/uikit/version.rb
74
+ - spec/spec_helper.rb
69
75
  - uikit.gemspec
70
76
  homepage: https://github.com/jeffrafter/uikit
71
77
  licenses:
@@ -91,4 +97,5 @@ rubygems_version: 2.0.3
91
97
  signing_key:
92
98
  specification_version: 4
93
99
  summary: Rails generator for installing user interface stylesheets
94
- test_files: []
100
+ test_files:
101
+ - spec/spec_helper.rb
@@ -1,7 +0,0 @@
1
- html, body {
2
- height: 100%;
3
- }
4
-
5
- body {
6
- background: #fff;
7
- }
File without changes