class Hyperloop::InstallMuiGenerator

Public Instance Methods

add_sample_component() click to toggle source
# File lib/generators/hyperloop/install_mui_generator.rb, line 37
    def add_sample_component
      create_file 'app/hyperloop/components/mui_sampler.rb' do
        <<-RUBY
class MuiSampler < Hyperloop::Component
  render(DIV) do
    Mui::Appbar()
    Mui::Container() do
      Mui::Button(color: :primary) { 'button' }
    end
  end
end
        RUBY
      end
    end
add_style_sheet_pack_tag() click to toggle source
# File lib/generators/hyperloop/install_mui_generator.rb, line 23
def add_style_sheet_pack_tag
  inject_into_file 'app/views/layouts/application.html.erb', after: /stylesheet_link_tag.*$/ do
    "\n    <%= stylesheet_pack_tag    'application' %>\n"
  end
end
add_to_manifests() click to toggle source
# File lib/generators/hyperloop/install_mui_generator.rb, line 18
def add_to_manifests
  add_to_manifest('client_and_server.js') { "Mui = require('muicss/react');\n" }
  add_to_manifest('application.scss') { "@import '~muicss/lib/sass/mui'\n" }
end
build_webpack() click to toggle source
# File lib/generators/hyperloop/install_mui_generator.rb, line 33
def build_webpack
  system('bin/webpack') unless options['no-build']
end
insure_yarn_loaded() click to toggle source
# File lib/generators/hyperloop/install_mui_generator.rb, line 9
def insure_yarn_loaded
  begin
    yarn_version = `yarn --version`
    raise Errno::ENOENT if yarn_version.blank?
  rescue Errno::ENOENT
    raise Thor::Error.new("please insure the yarn command is available if using webpacker")
  end
end
run_yarn() click to toggle source
# File lib/generators/hyperloop/install_mui_generator.rb, line 29
def run_yarn
  yarn 'muicss'
end