Class: EmberCli::PathSet
- Inherits:
-
Object
- Object
- EmberCli::PathSet
- Defined in:
- lib/ember_cli/path_set.rb
Instance Method Summary collapse
- #bower ⇒ Object
- #bower_components ⇒ Object
- #build_error_file ⇒ Object
- #bundler ⇒ Object
- #dist ⇒ Object
- #ember ⇒ Object
- #gemfile ⇒ Object
-
#initialize(app:, rails_root:, ember_cli_root:, environment:) ⇒ PathSet
constructor
A new instance of PathSet.
- #lockfile ⇒ Object
- #log ⇒ Object
- #node_modules ⇒ Object
- #npm ⇒ Object
- #root ⇒ Object
- #tee ⇒ Object
- #tmp ⇒ Object
Constructor Details
#initialize(app:, rails_root:, ember_cli_root:, environment:) ⇒ PathSet
Returns a new instance of PathSet.
5 6 7 8 9 10 |
# File 'lib/ember_cli/path_set.rb', line 5 def initialize(app:, rails_root:, ember_cli_root:, environment:) @app = app @rails_root = rails_root @environment = environment @ember_cli_root = ember_cli_root end |
Instance Method Details
#bower ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/ember_cli/path_set.rb', line 63 def bower @bower ||= begin bower_path = .fetch(:bower_path) { which("bower") } bower_path.tap do |path| unless Pathname(path.to_s).executable? fail DependencyError.new <<-MSG.strip_heredoc Bower is required by EmberCLI Install it with: $ npm install -g bower MSG end end end end |
#bower_components ⇒ Object
81 82 83 |
# File 'lib/ember_cli/path_set.rb', line 81 def bower_components @bower_components ||= root.join("bower_components") end |
#build_error_file ⇒ Object
59 60 61 |
# File 'lib/ember_cli/path_set.rb', line 59 def build_error_file @build_error_file ||= tmp.join("error.txt") end |
#bundler ⇒ Object
97 98 99 |
# File 'lib/ember_cli/path_set.rb', line 97 def bundler @bundler ||= .fetch(:bundler_path) { which("bundler") } end |
#dist ⇒ Object
30 31 32 |
# File 'lib/ember_cli/path_set.rb', line 30 def dist @dist ||= ember_cli_root.join("apps", app_name).tap(&:mkpath) end |
#ember ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/ember_cli/path_set.rb', line 38 def ember @ember ||= begin root.join("node_modules", "ember-cli", "bin", "ember").tap do |path| unless path.executable? fail DependencyError.new <<-MSG.strip_heredoc No `ember-cli` executable found for `#{app_name}`. Install it: $ cd #{root} $ npm install MSG end end end end |
#gemfile ⇒ Object
34 35 36 |
# File 'lib/ember_cli/path_set.rb', line 34 def gemfile @gemfile ||= root.join("Gemfile") end |
#lockfile ⇒ Object
55 56 57 |
# File 'lib/ember_cli/path_set.rb', line 55 def lockfile @lockfile ||= tmp.join("build.lock") end |
#log ⇒ Object
26 27 28 |
# File 'lib/ember_cli/path_set.rb', line 26 def log @log ||= logs.join("ember-#{app_name}.#{environment}.log") end |
#node_modules ⇒ Object
89 90 91 |
# File 'lib/ember_cli/path_set.rb', line 89 def node_modules @node_modules ||= root.join("node_modules") end |
#npm ⇒ Object
85 86 87 |
# File 'lib/ember_cli/path_set.rb', line 85 def npm @npm ||= .fetch(:npm_path) { which("npm") } end |
#root ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/ember_cli/path_set.rb', line 12 def root path = .fetch(:path){ default_root } pathname = Pathname.new(path) if pathname.absolute? pathname else rails_root.join(path) end end |
#tee ⇒ Object
93 94 95 |
# File 'lib/ember_cli/path_set.rb', line 93 def tee @tee ||= .fetch(:tee_path) { which("tee") } end |
#tmp ⇒ Object
22 23 24 |
# File 'lib/ember_cli/path_set.rb', line 22 def tmp @tmp ||= root.join("tmp").tap(&:mkpath) end |