Exemple #1
0
        static void printUsage()
        {
            var commands = _commands
                           .Where(c => c.description != null)
                           .ToArray();
            var pad         = commands.Max(c => c.example.Length);
            var commandList = commands
                              .Select(c => c.example.PadRight(pad) + " - " + c.description)
                              .Aggregate(new List <string>(), (acc, c) => { acc.Add(c); return(acc); });

            commandList.Add("[-v]".PadRight(pad) + " - " + "verbose output");
            commandList.Add("[-s]".PadRight(pad) + " - " + "silent output (errors only)");

            var header =
                @"#   _____       _   _ _
#  | ____|_ __ | |_(_) |_ __ _ ___
#  |  _| | '_ \| __| | __/ _` / __|
#  | |___| | | | |_| | || (_| \__ \
#  |_____|_| |_|\__|_|\__\__,_|___/
#
#  Entitas Code Generator version " + EntitasResources.GetVersion() + "\n";

            var footer = "All preferences will be stored in " + Preferences.DEFAULT_PROPERTIES_PATH + " by default.\n" +
                         "Each command also supports specifying a custom properties file.\n\n" +
                         "EXAMPLE\n" +
                         "  entitas new My.properties\n" +
                         "  entitas doctor My.properties\n" +
                         "  entitas fix My.properties\n" +
                         "  entitas gen My.properties";

            Console.WriteLine(header);
            Console.WriteLine("usage:\n{0}", string.Join("\n", commandList) + "\n\n" + footer);
        }
Exemple #2
0
        protected override void run()
        {
            fabl.Debug("Entitas Code Generator version " + EntitasResources.GetVersion());
            new Status().Run(_rawArgs);
            fabl.Debug("Dry Run");
            CodeGeneratorUtil
            .CodeGeneratorFromPreferences(_preferences)
            .DryRun();

            fabl.Info("👨‍🔬  No problems detected. Happy coding :)");
        }
Exemple #3
0
        static void printUsage(ICommand[] commands)
        {
            var pad         = commands.Max(c => c.example.Length);
            var commandList = commands
                              .Select(c => c.example.PadRight(pad) + " - " + c.description)
                              .Aggregate(new List <string>(), (acc, c) => { acc.Add(c); return(acc); });

            commandList.Add("[-v]".PadRight(pad) + " - " + "verbose output");
            commandList.Add("[-s]".PadRight(pad) + " - " + "silent output (errors only)");

            Console.WriteLine("Entitas Code Generator version " + EntitasResources.GetVersion());
            Console.WriteLine("usage:\n{0}", string.Join("\n", commandList));
        }
Exemple #4
0
        public override void Run(string[] args)
        {
            fabl.Debug("Entitas Code Generator version " + EntitasResources.GetVersion());
            if (assertPreferences(args))
            {
                new Status().Run(args);
                fabl.Debug("Dry Run");
                CodeGeneratorUtil
                .CodeGeneratorFromPreferences(loadPreferences(args))
                .DryRun();

                fabl.Info("👨‍🔬  No problems detected. Happy coding :)");
            }
        }
Exemple #5
0
        public override void Execute(string[] args)
        {
            Log.I("QFramework Code Generator version " + EntitasResources.GetVersion());
            if (AssertProperties())
            {
                new Status().Execute(args);

                Log.I("Dry Run");

                CodeGeneratorUtil
                .CodeGeneratorFromProperties()
                .DryRun();
            }
        }
Exemple #6
0
        public override void Run(string[] args)
        {
            fabl.Debug("Entitas Code Generator version " + EntitasResources.GetVersion());

            if (assertProperties())
            {
                new Status().Run(args);

                fabl.Debug("Dry Run");

                CodeGeneratorUtil
                .CodeGeneratorFromProperties()
                .DryRun();
            }
        }
        protected override TrackingData GetData()
        {
            var types = AppDomain.CurrentDomain.GetAllTypes();

            return(new UserTrackingData {
                {
                    "x", "v:" + EntitasResources.GetVersion() +
                    ",e:" + (types.Any(type => type.FullName == "DesperateDevs.CodeGeneration.CodeGenerator.CLI.Program") ? "s" : "u") +
                    ",p:" + (types.Any(type => type.FullName == "DesperateDevs.Roslyn.CodeGeneration.Plugins.PluginUtil") ? "1" : "0") +
                    ",f:" + _files.Length +
                    ",cp:" + _files.Count(f => f.fileName.EndsWith("Component.cs", StringComparison.OrdinalIgnoreCase)) +
                    ",cx:" + _files.Count(f => f.fileName.EndsWith("Context.cs", StringComparison.OrdinalIgnoreCase)) +
                    ",l:" + _files.Select(file => file.fileContent.ToUnixLineEndings()).Sum(content => content.Split('\n').Length)
                }
            });
        }
Exemple #8
0
  static void printUsage()
  {
      Console.WriteLine("Entitas Code Generator version " + EntitasResources.GetVersion());
      Console.WriteLine(
          @"usage: entitas new [-f] - Creates new Entitas.properties config with default values
 entitas edit     - Opens Entitas.properties config
 entitas doctor   - Checks the config for potential problems
 entitas status   - Lists available and unavailable plugins
 entitas fix      - Adds missing or removes unused keys interactively
 entitas scan     - Scans and prints available types found in specified assemblies
 entitas dry      - Simulates generating files without writing to disk
 entitas gen      - Generates files based on Entitas.properties
 [-v]             - verbose output
 [-s]             - silent output (errors only)"
          );
  }
 static void doctor()
 {
     _logger.Debug("Entitas Code Generator version " + EntitasResources.GetVersion());
     if (File.Exists(Preferences.configPath))
     {
         status();
         _logger.Debug("Dry Run");
         CodeGeneratorUtil
         .CodeGeneratorFromConfig(Preferences.configPath)
         .DryRun();
     }
     else
     {
         printNoConfig();
     }
 }
Exemple #10
0
 public static string GetLocalVersion()
 {
     return(EntitasResources.GetVersion());
 }
 void when_version()
 {
     xit["gets version"] = () => {
         EntitasResources.GetVersion().should_be("0.40.0");
     };
 }
 void when_version()
 {
     it["gets version"] = () => {
         EntitasResources.GetVersion().should_not_be_null();
     };
 }