Ejemplo n.º 1
0
        /// <summary>
        /// Upload the new version on the drive.
        /// </summary>
        /// <param name="force">true if want to delete existing version with same version code.</param>
        public void Push(bool force)
        {
            var configJson = ConfigJson.Load();
            var version    = _project.GetVersion(configJson.CurrentVersionCode);

            //if version exists on drive
            //if force then delete else abort
            if (version != null)
            {
                if (!force)
                {
                    Console.WriteLine("Version aready exists");
                    return;
                }

                _project.DeleteVersionFromDrive(version);
            }

            if (configJson.CurrentVersionCode == 0)
            {
                Console.WriteLine("Run upversion first");
                return;
            }

            CreateZip();
            var name = $"{configJson.CurrentVersionCode}--{configJson.SoftwareName}--{configJson.VersionName}";

            DriveUtils.UploadFileToCloud(name + ".zip", _project.FolderId, FilePath.TempZipFile);

            Console.WriteLine($"Update {version} has been uploaded to drive.");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Use the existing project to create Publisher.
        /// </summary>
        /// <returns></returns>
        public static Publisher Load()
        {
            var configJson = ConfigJson.Load();
            var publisher  = new Publisher(configJson.SoftwareName);

            return(publisher);
        }
Ejemplo n.º 3
0
        public static ConfigJson Load()
        {
            var configjson = new ConfigJson();

            configjson.LoadJson();
            return(configjson);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Create the folder on drive if doesn't exists, and
        /// Create local config files
        /// </summary>
        public void Init()
        {
            _project.CreateOnMyDrive();

            Directory.CreateDirectory(FilePath.DotPublishDir);
            var configJson = new ConfigJson(_project.SoftwareName);

            configJson.SaveJson();

            Console.WriteLine("Project created.");
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Increase the version in the config file
        /// </summary>
        /// <param name="versionName">Name of the version.</param>
        public void UpVersion(string versionName)
        {
            var configJson = ConfigJson.Load();

            configJson.CurrentVersionCode++;

            if (versionName == null)
            {
                versionName = DateTime.Now.ToString("yyyymmddhhmmssfff");
            }

            if (_project.DoesVersionNameExists(versionName))
            {
                Console.WriteLine("Version name already exists please specify a new one.");
                return;
            }

            configJson.VersionName = versionName;
            configJson.SaveJson();

            Console.WriteLine($"Project version increased to v{configJson.CurrentVersionCode}:{versionName}");
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Set the version to target version code.
        /// </summary>
        /// <param name="versionCode">Target version code.</param>
        /// <param name="versionName">Version name to use.</param>
        /// <param name="force">true if want to shift to a version even if project has a version with same version code or version name </param>
        public void SetVersion(int versionCode, string versionName, bool force)
        {
            var configJson = ConfigJson.Load();

            if (_project.DoesVersionCodeExists(versionCode) || !force)
            {
                Console.WriteLine("Version code already exists please specify a new one.");
                return;
            }

            configJson.CurrentVersionCode = versionCode;

            if (_project.DoesVersionNameExists(versionName) || !force)
            {
                Console.WriteLine("Version name already exists please specify a new one.");
                return;
            }

            configJson.VersionName = versionName;
            configJson.SaveJson();

            Console.WriteLine($"Project version increased to v{versionCode}:{versionName}");
        }