mobile-cli-lib
Version:
common lib used by different CLI
65 lines (64 loc) • 3.14 kB
JavaScript
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var path = require("path");
var project_files_provider_base_1 = require("../../services/project-files-provider-base");
var ProjectFilesProvider = (function (_super) {
__extends(ProjectFilesProvider, _super);
function ProjectFilesProvider($pathFilteringService, $projectConstants, $injector, $mobileHelper, $options) {
_super.call(this, $mobileHelper, $options);
this.$pathFilteringService = $pathFilteringService;
this.$projectConstants = $projectConstants;
this.$injector = $injector;
this._projectDir = null;
this.ignoreFilesRules = null;
}
Object.defineProperty(ProjectFilesProvider.prototype, "projectDir", {
get: function () {
if (!this._projectDir) {
var project = this.$injector.resolve("project");
this._projectDir = project.getProjectDir().wait();
}
return this._projectDir;
},
enumerable: true,
configurable: true
});
ProjectFilesProvider.prototype.isFileExcluded = function (filePath) {
var exclusionList = ProjectFilesProvider.INTERNAL_NONPROJECT_FILES.concat(this.getIgnoreFilesRules());
return this.$pathFilteringService.isFileExcluded(filePath, exclusionList, this.projectDir);
};
ProjectFilesProvider.prototype.mapFilePath = function (filePath, platform) {
return filePath;
};
ProjectFilesProvider.prototype.getIgnoreFilesRules = function () {
var _this = this;
if (!this.ignoreFilesRules) {
this.ignoreFilesRules = _(this.ignoreFilesConfigurations)
.map(function (configFile) { return _this.$pathFilteringService.getRulesFromFile(path.join(_this.projectDir, configFile)); })
.flatten()
.value();
}
return this.ignoreFilesRules;
};
Object.defineProperty(ProjectFilesProvider.prototype, "ignoreFilesConfigurations", {
get: function () {
var configurations = [ProjectFilesProvider.IGNORE_FILE];
var configFileName = "." +
(this.$options.release ? this.$projectConstants.RELEASE_CONFIGURATION_NAME : this.$projectConstants.DEBUG_CONFIGURATION_NAME) +
ProjectFilesProvider.IGNORE_FILE;
configurations.push(configFileName);
return configurations;
},
enumerable: true,
configurable: true
});
ProjectFilesProvider.IGNORE_FILE = ".abignore";
ProjectFilesProvider.INTERNAL_NONPROJECT_FILES = [".ab", ProjectFilesProvider.IGNORE_FILE, ".*" + ProjectFilesProvider.IGNORE_FILE, "**/*.ipa", "**/*.apk", "**/*.xap"];
return ProjectFilesProvider;
}(project_files_provider_base_1.ProjectFilesProviderBase));
exports.ProjectFilesProvider = ProjectFilesProvider;
$injector.register("projectFilesProvider", ProjectFilesProvider);