public override void Write(CustomFileWriter writer)
        {
            using (writer.WriteBlock($"stage('{Name}')"))
            {
                Agent.Write(writer);

                using (writer.WriteBlock($"steps"))
                {
                    Unstashes?.ForEach(s => s.Write(writer));

                    if (IsCheckoutScm)
                    {
                        writer.WriteLine($"checkout scm");
                    }

                    if (!string.IsNullOrWhiteSpace(InvokedTarget))
                    {
                        if (Agent.AgentPlatform == JenkinsAgentPlatform.Unix)
                        {
                            writer.WriteLine($"sh 'sh ./build.sh --target {InvokedTarget} --skip'");
                        }
                        else if (Agent.AgentPlatform == JenkinsAgentPlatform.Windows)
                        {
                            writer.WriteLine($"bat './build.cmd --target {InvokedTarget} --skip'");
                        }
                    }

                    Stashes?.ForEach(s => s.Write(writer));
                }
            }
        }
Esempio n. 2
0
        public void Pop(string sha)
        {
            int index = Index(sha);

            Stashes.Pop(index);
            if (ImplicitStashesShas.Contains(sha))
            {
                UnlogStash(sha);
            }
        }
Esempio n. 3
0
        public void ImplicitPop()
        {
            if (!ImplicitStashBases.Contains(Repository.Head.Tip))
            {
                return;
            }
            int ind = Stashes.ToList().FindIndex(s => s.Base == Repository.Head.Tip);

            Pop(Stashes[ind].Reference.TargetIdentifier);
        }
Esempio n. 4
0
        /// <summary>
        /// Stores all map-items from json to stash-objects adds them to database. Doesn't add empty stashes.
        /// </summary>
        /// <param name="jsonStashes">Stashes as JArray-type.</param>
        public async void StoreMaps(JArray jsonStashes)
        {
            try
            {
                Stash currentStash;
                foreach (JObject jsonStash in jsonStashes)
                {
                    // Testing
                    if ((string)jsonStash.SelectToken("lastCharacterName") == "EasyForEnceEsports")
                    {
                        Console.WriteLine("Löytyi");
                    }

                    JArray itemsArray  = (JArray)jsonStash.SelectToken("items");
                    Stash  stashFromDb = Stashes.Find((string)jsonStash.SelectToken("id"));

                    currentStash = CreateNewStash(jsonStash);
                    foreach (JObject item in itemsArray)
                    {
                        JObject category = item.Value <JObject>("category");
                        if (category.ContainsKey("maps"))
                        {
                            currentStash.AddMap(item);
                        }
                    }
                    // If the stash didn't contain any map-items, it can be deleted.
                    if (currentStash.MapCount() == 0 || currentStash.Maps == null)
                    {
                        if (stashFromDb != null)
                        {
                            Stashes.Remove(stashFromDb);
                            await SaveChangesAsync();
                        }
                        continue;
                    }
                    else
                    {
                        if (stashFromDb != null)
                        {
                            Entry(stashFromDb).CurrentValues.SetValues(currentStash);
                        }
                        else
                        {
                            Stashes.Add(currentStash);
                        }
                    }
                    await SaveChangesAsync();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Esempio n. 5
0
 private void Stashes_DropDown(object sender, EventArgs e)
 {
     Stashes.ResizeComboBoxDropDownWidth(Stashes.Size.Width, splitContainer1.Width - 2 * showToolStripLabel.Width);
 }
Esempio n. 6
0
 public void PopLast()
 {
     Stashes.Pop(0);
 }
Esempio n. 7
0
        public void Apply(string sha)
        {
            int index = Index(sha);

            Stashes.Apply(index);
        }
Esempio n. 8
0
 int Index(string sha)
 {
     return(Stashes.ToList().FindIndex(s => s.Reference.TargetIdentifier == sha));
 }