class Revelry::Generators::Core::InstallGenerator

Public Instance Methods

application_css() click to toggle source
# File lib/generators/revelry/core/install_generator.rb, line 60
        def application_css
          file_name = "app/assets/stylesheets/application.css"
          if File.exist? file_name
            file_name_backup = "#{file_name}.#{Time.now.to_i}"
            run "mv #{file_name} #{file_name_backup}"
            prepend_file file_name_backup, "/* MOVED BY revelry:core:install - In most cases you can delete this file now. */"
          end
          create_file file_name,
<<-CSS
  /*
  *= require revelry-app
  */
CSS
        end
application_js() click to toggle source
# File lib/generators/revelry/core/install_generator.rb, line 25
        def application_js
          file_name = "app/assets/javascripts/application.js"
          if File.exist? file_name
            file_name_backup = "#{file_name}.#{Time.now.to_i}"
            run "mv #{file_name} #{file_name_backup}"
            prepend_file file_name_backup, "// MOVED BY revelry:core:install - In most cases you can delete this file now.\n\n"
          end
          create_file file_name,
<<-JS
//= require revelry/client
JS
        end
revelry_app_css() click to toggle source
# File lib/generators/revelry/core/install_generator.rb, line 38
        def revelry_app_css
          settings_source = "#{Gem.loaded_specs['foundation-rails'].full_gem_path}/vendor/assets/stylesheets/foundation/_settings.scss"
          settings_destination = "app/assets/stylesheets/_settings.scss"
          if File.exist? settings_destination
            file_name_backup = "#{settings_destination}.#{Time.now.to_i}"
            run "mv #{settings_destination} #{file_name_backup}"
            prepend_file file_name_backup, "// MOVED BY revelry:core:install - In most cases you can delete this file now.\n\n"
          end
          run "cp #{settings_source} #{settings_destination}"
          create_file "app/assets/stylesheets/components/__keep.scss",
<<-SCSS
// This file can be safely deleted once you have other SASS/SCSS files in this directory.
// sass-rails just really doesn't like it when you @import a directory with no SASS in it.
SCSS
          create_file "app/assets/stylesheets/revelry-app.scss",
<<-SCSS
@import "settings"; // Zurb Foundation variables and such: http://foundation.zurb.com/docs/using-sass.html
@import "revelry";
@import "components/**/*";
SCSS
        end
revelry_app_js() click to toggle source
# File lib/generators/revelry/core/install_generator.rb, line 11
        def revelry_app_js
        create_file "app/assets/javascripts/revelry-app.js",
<<-JS
//= require_tree ./models
//= require_tree ./mixins
//= require_tree ./components
//= require_tree ./examples
JS
          create_file "app/assets/javascripts/models/.keep"
          create_file "app/assets/javascripts/mixins/.keep"
          create_file "app/assets/javascripts/components/.keep"
          create_file "app/assets/javascripts/examples/.keep"
        end
starter_scaffolding() click to toggle source
# File lib/generators/revelry/core/install_generator.rb, line 75
        def starter_scaffolding
          # Main component override with client-side routing.
          create_file "app/assets/javascripts/components/Main.js.jsx",
<<-JSX
// This is the top of the component tree.
// It's a great place to hook in any behaviors you want for every view.

Rev.appComponent('Main', {
  render: function() {
    // Remove the Router wrapper if you do not need client-side routing.
    return <Rev.Components.Router {...this.props}>
      <Rev.Components.Main {...this.props} />
    </Rev.Components.Router>;
  }
});
JSX

          create_file "app/assets/javascripts/components/PageLayout.js.jsx",
<<-JSX
// A good place to put navs, headers, footers that are shared across pages

Rev.appComponent('PageLayout', {
  render: function() {
    return <div>{this.props.children}</div>;
  }
});

JSX

          create_file "app/assets/javascripts/components/home/index.js.jsx",
<<-JSX
Rev.appComponent('Home.Index', {
  render: function() {
    var Row = Rev.Components.Row
    var Col = Rev.Components.Col
    
    return <App.Components.PageLayout>
      <Row>
        <Col>
          <h1>
            Find this React component in...
          </h1>
        </Col>
        <Col>
          <p><CodeBlock>app/assets/javascripts/components/home/index.js.jsx</CodeBlock></p>
        </Col>
      </Row>
      <Row>
        <Col medium={4}><Lipsum /></Col>
        <Col medium={8}><Lipsum p={2} /></Col>
      </Row>
    </App.Components.PageLayout>;
  }
});

JSX

          generate "controller", "Home index --skip-routes --skip-template-engine"
          route "root to: 'home#index'"

        end