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.



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

def initialize(name, **options)
  @name = name.to_s
  @options = options
  @paths = PathSet.new(
    app: self,
    configuration: EmberCli.configuration,
    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.



7
8
9
# File 'lib/ember_cli/app.rb', line 7

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/ember_cli/app.rb', line 7

def options
  @options
end

#pathsObject (readonly)

Returns the value of attribute paths.



7
8
9
# File 'lib/ember_cli/app.rb', line 7

def paths
  @paths
end

Instance Method Details

#buildObject



37
38
39
40
41
42
43
44
45
# File 'lib/ember_cli/app.rb', line 37

def build
  if development?
    build_and_watch
  elsif test?
    compile
  end

  @build.wait!
end

#compileObject



27
28
29
30
31
32
33
34
35
# File 'lib/ember_cli/app.rb', line 27

def compile
  @compiled ||= begin
    prepare
    @shell.compile
    @build.check!
    copy_index_html_file
    true
  end
end

#index_fileObject



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

def index_file
  if production?
    paths.applications.join("#{name}.html")
  else
    paths.dist.join("index.html")
  end
end

#install_dependenciesObject



47
48
49
# File 'lib/ember_cli/app.rb', line 47

def install_dependencies
  @shell.install
end

#sprocketsObject



57
58
59
# File 'lib/ember_cli/app.rb', line 57

def sprockets
  EmberCli::Sprockets.new(self)
end

#testObject



51
52
53
54
55
# File 'lib/ember_cli/app.rb', line 51

def test
  prepare

  @shell.test
end