class Uicon::InstallGenerator

Public Instance Methods

setup_controller() click to toggle source
# File lib/generators/uicon/install_generator.rb, line 7
def setup_controller
    generate(:controller, "ui index  -q -s --no-helper --no-route --no-helper-specs --no-assets --no-controller-specs --no-view-specs")
end
setup_route() click to toggle source
# File lib/generators/uicon/install_generator.rb, line 11
def setup_route
    route("if Rails.env.development?\n\s\sget 'ui', to: 'ui#index'\n\s\sget '/ui/:action', controller: 'ui'\nend")
end
setup_view() click to toggle source
# File lib/generators/uicon/install_generator.rb, line 15
def setup_view
    File.open("#{Rails.root}/app/views/ui/index.html.erb", 'w') do |f|
        f.write(view_code)
        f.close
    end
end

Protected Instance Methods

view_code() click to toggle source
# File lib/generators/uicon/install_generator.rb, line 23
        def view_code
    "
    <head>
  <meta charset='utf-8'>

  <title>UI Index</title>
  <meta name='UI Static Asset Controller' content='UICON'>
  <meta name='Jason Cummings &amp; Jason Kellum' content='UICON'>

  <link href='http://fonts.googleapis.com/css?family=Ek+Mukta' rel='stylesheet' type='text/css'>

  <!--[if lt IE 9]>
  <script src='http://html5shiv.googlecode.com/svn/trunk/html5.js'></script>
  <![endif]-->

  <style type='text/css'>
    body {
      background-color: #e8e8e8;
    }
    h1 {
      font-family: 'Ek Mukta', helvetica, sans-serif;
      font-size: 2em;
      color: white;
      margin: 0;
      padding: 0;
    }
    h1#logo {
      width: 200px;
      height: 72px;
      background-image: url(https://s3.amazonaws.com/jasoncummings-images/uicon-logo.png);
      transition: background-image 0.5s ease;
      background-repeat: no-repeat;
      text-indent: -9999px;
    }
    h1#logo:hover {
      background-image: url(https://s3.amazonaws.com/jasoncummings-images/uicon-logo-hover.png);
    }
    h2 {
      font-family: 'Ek Mukta', helvetica, sans-serif;
      font-size: 1em;
      color: #999999;
      margin: 0;
    }
    a {
      text-decoration: none;
      color: white;
    }
    section {
      margin: 50px auto;
      max-width: 600px;
    }
    ul {
      padding: 0;
      margin: 40px 0;
    }
    li {
      background-color: white;
      transition: background-color 0.5s ease;
      list-style-type: none;
      padding: 35px;
      margin: 0 0 2px 0;
      font-family: 'Ek Mukta', helvetica, sans-serif;
      font-size: 24px;
      color: #999999;
      border-radius: 10px;
    }

    li a{
      color: #999999;
    }

    li a:hover{
      color: white;
    }

    li:hover {
      background-color: #FF530D;
      color: white;
      cursor: pointer;
    }
    span {
      float: right;
    }
  </style>

</head>
    <section>
        <a href='https://rubygems.org/gems/uicon/versions/0.0.3' target='_blank'><h1 id='logo'>UICON</h1></a>
        <ul>
          <% Dir.glob('app/views/ui/*.html*').sort.each do |file| %>
            <%- if file =~ /haml$/ %>
              <% wireframe = File.basename(file,'.html.haml') %>
            <%- else %>
              <% wireframe = File.basename(file,'.html.erb') %>
            <%- end %>
            <% unless wireframe == 'index' || wireframe.match(/^_/) %>
              <li>
                <%= link_to wireframe.titleize, action: wireframe unless wireframe == 'index' %>
              </li>
            <% end %>
          <% end %>
        </ul>
        <h2>Version 0.0.4</h2>
    </section>
    "
        end