示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ScriptConventions"/> class.
 /// </summary>
 /// <param name="fileSystem">The file system.</param>
 /// <param name="loader">The assembly loader.</param>
 /// <param name="runtime">The Cake runtime.</param>
 /// <param name="referenceAssemblyResolver">The reference assembly resolver.</param>
 public ScriptConventions(IFileSystem fileSystem, IAssemblyLoader loader, ICakeRuntime runtime, IReferenceAssemblyResolver referenceAssemblyResolver)
 {
     _fileSystem = fileSystem;
     _loader     = loader;
     _runtime    = runtime;
     _referenceAssemblyResolver = referenceAssemblyResolver;
 }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MutableCakeEnvironment" /> class.
        /// </summary>
        /// <param name="platform">The platform.</param>
        /// <param name="runtime">The runtime.</param>
        /// <param name="appRoot">App root path</param>
        public MutableCakeEnvironment(ICakePlatform platform, ICakeRuntime runtime, string appRoot = null)
        {
            _platform = platform;
            _runtime  = runtime;
            var rootPath = string.IsNullOrEmpty(appRoot) ? Assembly.GetExecutingAssembly().Location : appRoot;

            _applicationRoot = System.IO.Path.GetDirectoryName(rootPath);

            WorkingDirectory = new DirectoryPath(Environment.CurrentDirectory);
            var pathEnv = Environment.GetEnvironmentVariable("PATH");

            if (!string.IsNullOrEmpty(pathEnv))
            {
                _paths = pathEnv.Split(new char[] { _platform.IsUnix() ? ':' : ';' }, StringSplitOptions.RemoveEmptyEntries)
                         .Select(s => s.Trim())
                         .Where(s => s.Length > 0)
                         .ToList();
            }
            else
            {
                _paths = new List <string>();
            }
            _addedPaths   = new List <string>();
            _dynamicPaths = new List <string>();
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CakeEnvironment" /> class.
        /// </summary>
        /// <param name="platform">The platform.</param>
        /// <param name="runtime">The runtime.</param>
        public CakeEnvironment(ICakePlatform platform, ICakeRuntime runtime)
        {
            _platform        = platform;
            _runtime         = runtime;
            _applicationRoot = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            WorkingDirectory = new DirectoryPath(System.IO.Directory.GetCurrentDirectory());
        }
示例#4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CakeEnvironment" /> class.
        /// </summary>
        /// <param name="platform">The platform.</param>
        /// <param name="runtime">The runtime.</param>
        public CakeEnvironment(ICakePlatform platform, ICakeRuntime runtime)
        {
            Platform = platform;
            Runtime  = runtime;

            // Get the application root.
            var assembly = AssemblyHelper.GetExecutingAssembly();
            var path     = PathHelper.GetDirectoryName(assembly.Location);

            ApplicationRoot = new DirectoryPath(path);

            // Get the working directory.
            WorkingDirectory = new DirectoryPath(System.IO.Directory.GetCurrentDirectory());
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="MutableCakeEnvironment" /> class.
        /// </summary>
        /// <param name="platform">The platform.</param>
        /// <param name="runtime">The runtime.</param>
        public MutableCakeEnvironment( ICakePlatform platform, ICakeRuntime runtime )
        {
            _platform = platform;
            _runtime = runtime;
            _applicationRoot = System.IO.Path.GetDirectoryName( Assembly.GetExecutingAssembly().Location );

            WorkingDirectory = new DirectoryPath( Environment.CurrentDirectory );
            var pathEnv = Environment.GetEnvironmentVariable( "PATH" );
            if( !string.IsNullOrEmpty( pathEnv ) )
            {
                _paths = pathEnv.Split( new char[] { _platform.IsUnix() ? ':' : ';' }, StringSplitOptions.RemoveEmptyEntries )
                                .Select( s => s.Trim() )
                                .Where( s => s.Length > 0 )
                                .ToList();
            }
            else
            {
                _paths = new List<string>();
            }
            _addedPaths = new List<string>();
            _dynamicPaths = new List<string>();
        }
示例#6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ScriptConventions"/> class.
 /// </summary>
 /// <param name="fileSystem">The file system.</param>
 /// <param name="loader">The assembly loader.</param>
 /// <param name="runtime">The Cake runtime.</param>
 public ScriptConventions(IFileSystem fileSystem, IAssemblyLoader loader, ICakeRuntime runtime)
 {
     _fileSystem = fileSystem;
     _loader     = loader;
     _runtime    = runtime;
 }