Class: EmberCli::App

Inherits:
Object
  • Object
show all
Defined in:
lib/ember_cli/app.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, **options) ⇒ App

Returns a new instance of App.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ember_cli/app.rb', line 11

def initialize(name, **options)
  @name = name.to_s
  @options = options
  @paths = PathSet.new(
    app: self,
    environment: Rails.env,
    rails_root: Rails.root,
    ember_cli_root: EmberCli.root,
  )
  @shell = Shell.new(
    paths: @paths,
    env: env_hash,
    options: options,
  )
  @build = BuildMonitor.new(name, @paths)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/ember_cli/app.rb', line 9

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



9
10
11
# File 'lib/ember_cli/app.rb', line 9

def options
  @options
end

#pathsObject (readonly)

Returns the value of attribute paths.



9
10
11
# File 'lib/ember_cli/app.rb', line 9

def paths
  @paths
end

Instance Method Details

#bower?Boolean

Returns:

  • (Boolean)


94
95
96
# File 'lib/ember_cli/app.rb', line 94

def bower?
  paths.bower_json.exist?
end

#buildObject



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/ember_cli/app.rb', line 50

def build
  unless EmberCli.skip?
    if development?
      build_and_watch
    elsif test?
      compile
    end

    @build.wait!
  end
end

#cached_directoriesObject



36
37
38
# File 'lib/ember_cli/app.rb', line 36

def cached_directories
  paths.cached_directories
end

#check_for_errors!Object



82
83
84
# File 'lib/ember_cli/app.rb', line 82

def check_for_errors!
  @build.check!
end

#compileObject



40
41
42
43
44
45
46
47
48
# File 'lib/ember_cli/app.rb', line 40

def compile
  @compiled ||= begin
    prepare
    exit_status = @shell.compile
    @build.check!

    exit_status.success?
  end
end

#dist_pathObject



32
33
34
# File 'lib/ember_cli/app.rb', line 32

def dist_path
  paths.dist
end

#index_html(head:, body:) ⇒ Object



62
63
64
65
66
67
68
69
70
# File 'lib/ember_cli/app.rb', line 62

def index_html(head:, body:)
  html = HtmlPage::Renderer.new(
    head: head,
    body: body,
    content: deploy.index_html,
  )

  html.render
end

#install_dependenciesObject



72
73
74
# File 'lib/ember_cli/app.rb', line 72

def install_dependencies
  @shell.install
end

#mountable?Boolean

Returns:

  • (Boolean)


86
87
88
# File 'lib/ember_cli/app.rb', line 86

def mountable?
  deploy.mountable?
end

#root_pathObject



28
29
30
# File 'lib/ember_cli/app.rb', line 28

def root_path
  paths.root
end

#testObject



76
77
78
79
80
# File 'lib/ember_cli/app.rb', line 76

def test
  prepare

  @shell.test.success?
end

#to_rackObject



98
99
100
# File 'lib/ember_cli/app.rb', line 98

def to_rack
  deploy.to_rack
end

#yarn_enabled?Boolean

Returns:

  • (Boolean)


90
91
92
# File 'lib/ember_cli/app.rb', line 90

def yarn_enabled?
  options.fetch(:yarn, false)
end