Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions src/ScriptCs.Contracts/IFileSystemMigrator.cs

This file was deleted.

92 changes: 0 additions & 92 deletions src/ScriptCs.Core/FileSystemMigrator.cs

This file was deleted.

4 changes: 0 additions & 4 deletions src/ScriptCs.Core/ScriptServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public ScriptServices(
ILogProvider logProvider,
IAssemblyResolver assemblyResolver,
IEnumerable<IReplCommand> replCommands,
IFileSystemMigrator fileSystemMigrator,
IConsole console = null,
IInstallationProvider installationProvider = null,
IScriptLibraryComposer scriptLibraryComposer = null
Expand All @@ -39,7 +38,6 @@ public ScriptServices(
AssemblyResolver = assemblyResolver;
InstallationProvider = installationProvider;
ReplCommands = replCommands;
FileSystemMigrator = fileSystemMigrator;
ScriptLibraryComposer = scriptLibraryComposer;
}

Expand All @@ -51,14 +49,12 @@ public ScriptServices(
public IPackageInstaller PackageInstaller { get; private set; }
public IObjectSerializer ObjectSerializer { get; private set; }
public ILogProvider LogProvider { get; private set; }

public IScriptEngine Engine { get; private set; }
public IFilePreProcessor FilePreProcessor { get; private set; }
public IConsole Console { get; private set; }
public IAssemblyResolver AssemblyResolver { get; private set; }
public IInstallationProvider InstallationProvider { get; private set; }
public IEnumerable<IReplCommand> ReplCommands { get; private set; }
public IFileSystemMigrator FileSystemMigrator { get; private set; }
public IScriptLibraryComposer ScriptLibraryComposer { get; private set; }
}
}
3 changes: 0 additions & 3 deletions src/ScriptCs.Hosting/RuntimeServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@ protected override IContainer CreateContainer()
RegisterOverrideOrDefault<IConsole>(
builder, b => b.RegisterInstance(_console));

RegisterOverrideOrDefault<IFileSystemMigrator>(
builder, b => b.RegisterType<FileSystemMigrator>().As<IFileSystemMigrator>().SingleInstance());

RegisterOverrideOrDefault<IScriptLibraryComposer>(
builder, b => b.RegisterType<ScriptLibraryComposer>().As<IScriptLibraryComposer>().SingleInstance());

Expand Down
12 changes: 1 addition & 11 deletions src/ScriptCs/Command/CommandFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ public ICommand CreateCommand(Config config, string[] scriptArgs)

var scriptServices = _scriptServicesBuilder.Build();

// HACK (Adam): This should not be the responsbility of the command factory
// but now is not the time to fix this.
// This should be addressed by a wider refactoring, i.e. https://github.com/scriptcs/scriptcs/issues/897
scriptServices.FileSystemMigrator.Migrate();

if (config.Global)
{
var currentDir = _fileSystem.GlobalFolder;
Expand All @@ -67,7 +62,6 @@ public ICommand CreateCommand(Config config, string[] scriptArgs)
scriptServices.LogProvider,
scriptServices.Console,
scriptServices.AssemblyResolver,
scriptServices.FileSystemMigrator,
scriptServices.ScriptLibraryComposer);

return explicitReplCommand;
Expand All @@ -83,7 +77,6 @@ public ICommand CreateCommand(Config config, string[] scriptArgs)
scriptServices.ScriptPackResolver,
scriptServices.LogProvider,
scriptServices.AssemblyResolver,
scriptServices.FileSystemMigrator,
scriptServices.ScriptLibraryComposer);

return executeLooseScriptCommand;
Expand Down Expand Up @@ -178,7 +171,6 @@ public ICommand CreateCommand(Config config, string[] scriptArgs)
scriptServices.LogProvider,
scriptServices.Console,
scriptServices.AssemblyResolver,
scriptServices.FileSystemMigrator,
scriptServices.ScriptLibraryComposer);

return replCommand;
Expand All @@ -193,8 +185,7 @@ private static IScriptCommand CreateScriptCommand(
scriptArgs,
scriptServices.Console,
scriptServices.FileSystem,
scriptServices.LogProvider,
scriptServices.FileSystemMigrator)
scriptServices.LogProvider)
: new ExecuteScriptCommand(
config.ScriptName,
scriptArgs,
Expand All @@ -203,7 +194,6 @@ private static IScriptCommand CreateScriptCommand(
scriptServices.ScriptPackResolver,
scriptServices.LogProvider,
scriptServices.AssemblyResolver,
scriptServices.FileSystemMigrator,
scriptServices.ScriptLibraryComposer);
}
}
Expand Down
1 change: 0 additions & 1 deletion src/ScriptCs/Command/CrossAppDomainExecuteScriptCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public void Execute()
services.ScriptPackResolver,
services.LogProvider,
services.AssemblyResolver,
services.FileSystemMigrator,
services.ScriptLibraryComposer);

this.Result = command.Execute();
Expand Down
5 changes: 1 addition & 4 deletions src/ScriptCs/Command/ExecuteLooseScriptCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,15 @@ public ExecuteLooseScriptCommand(
IScriptPackResolver scriptPackResolver,
ILogProvider logProvider,
IAssemblyResolver assemblyResolver,
IFileSystemMigrator fileSystemMigrator,
IScriptLibraryComposer composer) :
base(script, scriptArgs, fileSystem, scriptExecutor, scriptPackResolver, logProvider, assemblyResolver, fileSystemMigrator, composer)
base(script, scriptArgs, fileSystem, scriptExecutor, scriptPackResolver, logProvider, assemblyResolver, composer)
{
}

public override CommandResult Execute()
{
try
{
FileSystemMigrator.Migrate();

var assemblyPaths = Enumerable.Empty<string>();
var workingDirectory = FileSystem.CurrentDirectory;
assemblyPaths = AssemblyResolver.GetAssemblyPaths(workingDirectory);
Expand Down
6 changes: 0 additions & 6 deletions src/ScriptCs/Command/ExecuteReplCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ internal class ExecuteReplCommand : IExecuteReplCommand
private readonly ILog _logger;
private readonly IConsole _console;
private readonly IAssemblyResolver _assemblyResolver;
private readonly IFileSystemMigrator _fileSystemMigrator;
private readonly IScriptLibraryComposer _composer;

public ExecuteReplCommand(
Expand All @@ -25,7 +24,6 @@ public ExecuteReplCommand(
ILogProvider logProvider,
IConsole console,
IAssemblyResolver assemblyResolver,
IFileSystemMigrator fileSystemMigrator,
IScriptLibraryComposer composer)
{
Guard.AgainstNullArgument("fileSystem", fileSystem);
Expand All @@ -34,7 +32,6 @@ public ExecuteReplCommand(
Guard.AgainstNullArgument("logProvider", logProvider);
Guard.AgainstNullArgument("console", console);
Guard.AgainstNullArgument("assemblyResolver", assemblyResolver);
Guard.AgainstNullArgument("fileSystemMigrator", fileSystemMigrator);
Guard.AgainstNullArgument("composer", composer);

_scriptName = scriptName;
Expand All @@ -45,16 +42,13 @@ public ExecuteReplCommand(
_logger = logProvider.ForCurrentType();
_console = console;
_assemblyResolver = assemblyResolver;
_fileSystemMigrator = fileSystemMigrator;
_composer = composer;
}

public string[] ScriptArgs => _scriptArgs;

public CommandResult Execute()
{
_fileSystemMigrator.Migrate();

_console.WriteLine("scriptcs (ctrl-c to exit or :help for help)" + Environment.NewLine);

var workingDirectory = _fileSystem.CurrentDirectory;
Expand Down
5 changes: 1 addition & 4 deletions src/ScriptCs/Command/ExecuteScriptCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,15 @@ public ExecuteScriptCommand(
IScriptPackResolver scriptPackResolver,
ILogProvider logProvider,
IAssemblyResolver assemblyResolver,
IFileSystemMigrator fileSystemMigrator,
IScriptLibraryComposer composer) :
base(script, scriptArgs, fileSystem, scriptExecutor, scriptPackResolver, logProvider, assemblyResolver, fileSystemMigrator, composer)
base(script, scriptArgs, fileSystem, scriptExecutor, scriptPackResolver, logProvider, assemblyResolver, composer)
{
}

public override CommandResult Execute()
{
try
{
FileSystemMigrator.Migrate();

var assemblyPaths = Enumerable.Empty<string>();
var workingDirectory = FileSystem.GetWorkingDirectory(Script);
if (workingDirectory != null)
Expand Down
8 changes: 1 addition & 7 deletions src/ScriptCs/Command/WatchScriptCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,26 @@ internal class WatchScriptCommand : IScriptCommand
private readonly IConsole _console;
private readonly IFileSystem _fileSystem;
private readonly ILog _logger;
private readonly IFileSystemMigrator _fileSystemMigrator;
private readonly CrossAppDomainExecuteScriptCommand _executeScriptCommand;

public WatchScriptCommand(
Config config,
string[] scriptArgs,
IConsole console,
IFileSystem fileSystem,
ILogProvider logProvider,
IFileSystemMigrator fileSystemMigrator)
ILogProvider logProvider)
{
Guard.AgainstNullArgument("config", config);
Guard.AgainstNullArgument("scriptArgs", scriptArgs);
Guard.AgainstNullArgument("console", console);
Guard.AgainstNullArgument("fileSystem", fileSystem);
Guard.AgainstNullArgument("logProvider", logProvider);
Guard.AgainstNullArgument("fileSystemMigrator", fileSystemMigrator);

_config = config;
_scriptArgs = scriptArgs;
_console = console;
_fileSystem = fileSystem;
_logger = logProvider.ForCurrentType();
_fileSystemMigrator = fileSystemMigrator;

_executeScriptCommand = new CrossAppDomainExecuteScriptCommand
{
Expand All @@ -50,8 +46,6 @@ public WatchScriptCommand(

public CommandResult Execute()
{
_fileSystemMigrator.Migrate();

_console.WriteLine("scriptcs (ctrl-c to exit)");
_logger.InfoFormat("Running script '{0}' and watching for changes...", _config.ScriptName);

Expand Down
4 changes: 0 additions & 4 deletions src/ScriptCs/ExecuteScriptCommandBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public abstract class ExecuteScriptCommandBase
protected IScriptPackResolver _scriptPackResolver { get; private set; }
protected ILog Logger { get; private set; }
protected IAssemblyResolver AssemblyResolver { get; private set; }
protected IFileSystemMigrator FileSystemMigrator { get; private set; }
protected IScriptLibraryComposer Composer { get; private set; }

public ExecuteScriptCommandBase(
Expand All @@ -28,7 +27,6 @@ public ExecuteScriptCommandBase(
IScriptPackResolver scriptPackResolver,
ILogProvider logProvider,
IAssemblyResolver assemblyResolver,
IFileSystemMigrator fileSystemMigrator,
IScriptLibraryComposer composer
)
{
Expand All @@ -37,7 +35,6 @@ IScriptLibraryComposer composer
Guard.AgainstNullArgument("scriptPackResolver", scriptPackResolver);
Guard.AgainstNullArgument("logProvider", logProvider);
Guard.AgainstNullArgument("assemblyResolver", assemblyResolver);
Guard.AgainstNullArgument("fileSystemMigrator", fileSystemMigrator);
Guard.AgainstNullArgument("composer", composer);

Script = script;
Expand All @@ -47,7 +44,6 @@ IScriptLibraryComposer composer
_scriptPackResolver = scriptPackResolver;
Logger = logProvider.ForCurrentType();
AssemblyResolver = assemblyResolver;
FileSystemMigrator = fileSystemMigrator;
Composer = composer;
}

Expand Down
Loading