public static void ProcessIcal(string id) { var calinfo = Utils.AcquireCalinfo(id); GenUtils.LogMsg("status", "worker starting on ical tasks for " + id, null); var fr = new FeedRegistry(id); DoIcal(fr, calinfo); }
public void SetUp() { theSolution = new Solution(); theSolution.ClearFeeds(); theSolution.AddFeed(Feed.Fubu); theSolution.AddFeed(Feed.NuGetV2); theSolution.AddDependency(bottles = new Dependency("Bottles")); theSolution.AddDependency(fubucore = new Dependency("FubuCore", "1.0.1.201")); theSolution.AddDependency(rhinomocks = new Dependency("RhinoMocks", "3.6.1", UpdateMode.Fixed)); theSolution.AddDependency(structuremap = new Dependency("StructureMap", "2.6.3", UpdateMode.Fixed)); RippleEnvironment.StubConnection(true); theFubuFeed = MockRepository.GenerateStub <IFloatingFeed>(); theFubuFeed.Stub(x => x.GetLatest()).Return(new IRemoteNuget[] { new StubNuget("Bottles", "1.0.2.2"), new StubNuget("FubuCore", "1.0.2.232"), new StubNuget("StructureMap", "2.6.4.71"), }); theFubuFeed.Stub(x => x.IsOnline()).Return(true); theNugetFeed = MockRepository.GenerateStub <INugetFeed>(); theNugetFeed.Stub(x => x.Find(rhinomocks)).Return(new StubNuget("RhinoMocks", "3.6.1")); theNugetFeed.Stub(x => x.Find(structuremap)).Return(new StubNuget("StructureMap", "2.6.3")); theNugetFeed.Stub(x => x.IsOnline()).Return(true); theFeedProvider = MockRepository.GenerateStub <IFeedProvider>(); theFeedProvider.Stub(x => x.For(Feed.Fubu)).Return(theFubuFeed); theFeedProvider.Stub(x => x.For(Feed.NuGetV2)).Return(theNugetFeed); FeedRegistry.Stub(theFeedProvider); }
public void TearDown() { theScenario.Cleanup(); RippleFileSystem.Live(); FeedRegistry.Reset(); RippleOperation.Reset(); }
public override bool Execute(FindNugetsInput input) { var solution = Solution.For(input); var feeds = FeedRegistry.FeedsFor(solution); var results = feeds.SelectMany(feed => { return(feed .FindAllLatestByName(input.Nuget) .Select(nuget => new SearchResult { Nuget = nuget, Provenance = feed.Repository })); }); results .OrderBy(x => x.Nuget.Name) .ThenBy(x => x.Nuget.Version) .Each(result => { RippleLog.Info("{0}, {1} ({2})".ToFormat(result.Nuget.Name, result.Nuget.Version, result.Provenance.Source)); }); return(true); }
public NugetResult Find(Solution solution, Dependency dependency) { var cache = FeedRegistry.CacheFor(solution); var nuget = cache.Find(dependency); return(new NugetResult { Nuget = nuget }); }
public static void Create(Action <FeedScenario> configure) { var scenario = new FeedScenario(); scenario.Online(); configure(scenario); FeedRegistry.Stub(scenario.theProvider); }
public static void FinalizeHub(string id) { if (Utils.IsRegion(id)) throw new Exception(String.Format("FinalizeHub called erroneously for {0}", id)); GenUtils.LogMsg("status", "worker finalizing hub: " + id, null); Utils.UpdateFeedCountForId(id); var calinfo = Utils.AcquireCalinfo(id); EventStore.CombineZonedEventStoresToZonelessEventStore(id, settings); // Create or update an entry in the cacheurls table for the base object. // key is http://elmcity.blob.core.windows.net/ID/ID.zoneless.obj // value is # of webrole instances that could be holding this in cache // each instance will check this table periodically. if value is nonzero and url in cache, it'll evict the object // and decrement the count // note when removal occurs it also triggers a purge of dependencies, so if the base entry is // http://elmcity.blob.core.windows.net/a2cal/a2cal.zoneless.obj // then dependencies also ousted from cache include: // /services/a2cal/html?view=&count=0 // /services/a2cal/rss?view=government // /services/a2cal/xml?view=music&count=10 ... etc. CacheUtils.MarkBaseCacheEntryForRemoval(Utils.MakeBaseZonelessUrl(id), Convert.ToInt32(settings["webrole_instance_count"])); RenderTags(id); // static renderings, mainly for debugging now that GetEvents uses dynamic rendering var fr = new FeedRegistry(id); fr.LoadFeedsFromAzure(FeedLoadOption.all); if (calinfo.hub_enum == HubType.where) { SaveWhereStats(fr, calinfo); Utils.SaveMeetupLocations(calinfo, settings); } if (calinfo.hub_enum == CalendarAggregator.HubType.what) SaveWhatStats(fr, calinfo); //if (!Utils.IsRegion(id)) // MergeIcs(calinfo); // else // todo: create MergeRegionIcs Utils.VisualizeTagSources(id); ImageSelection.BuildCategoryImagesForHub(id); GenUtils.LogMsg("status", "worker done finalizing hub " + id, null); }
public static void SaveWhereStats(FeedRegistry fr, Calinfo calinfo) { var id = calinfo.id; GenUtils.LogMsg("status", "SaveWhereStats: " + id, null); NonIcalStats estats = GetNonIcalStats(NonIcalType.eventful, id, calinfo, settings); NonIcalStats ustats = GetNonIcalStats(NonIcalType.upcoming, id, calinfo, settings); NonIcalStats ebstats = GetNonIcalStats(NonIcalType.eventbrite, id, calinfo, settings); NonIcalStats fbstats = GetNonIcalStats(NonIcalType.facebook, id, calinfo, settings); Dictionary<string, IcalStats> istats = GetIcalStats(id); var where = calinfo.where; string[] response = Utils.FindCityOrTownAndStateAbbrev(where); var city_or_town = response[0]; var state_abbrev = response[1]; int pop = Utils.FindPop(id, city_or_town, state_abbrev); var futurecount = 0; futurecount += estats.eventcount; futurecount += ustats.eventcount; futurecount += ebstats.eventcount; var sb_report = new StringBuilder(); sb_report.Append(MakeTableHeader()); var options = new ParallelOptions(); Parallel.ForEach(source: fr.feeds.Keys, parallelOptions: options, body: (feedurl) => // foreach (var feedurl in fr.feeds.Keys) { StatsRow(id, istats, sb_report, ref futurecount, feedurl); } ); sb_report.Append("</table>\n"); var events_per_person = Convert.ToInt32(futurecount) / (float)pop; var report = Utils.EmbedHtmlSnippetInDefaultPageWrapper(calinfo, sb_report.ToString()); bs.PutBlob(id, id + ".stats.html", new Hashtable(), Encoding.UTF8.GetBytes(report), "text/html"); var dict = new Dictionary<string, object>(); dict.Add("events", futurecount.ToString()); dict.Add("events_per_person", string.Format("{0:f}", events_per_person)); TableStorage.UpmergeDictToTableStore(dict, "metadata", id, id); }
public static void DoIcal(FeedRegistry fr, Calinfo calinfo) { if (testfeeds.Count > 0) foreach (var testfeed in testfeeds) fr.AddFeed(testfeed, "testing: " + testfeed); else fr.LoadFeedsFromAzure(FeedLoadOption.all); var id = calinfo.id; ZonedEventStore ical = new ZonedEventStore(calinfo, SourceType.ical); try { GenUtils.LogMsg("status", "DoIcal: " + id, null); Collector coll = new Collector(calinfo, settings); coll.CollectIcal(fr, ical, test: testing); } catch (Exception e) { GenUtils.LogMsg("exception", "DoIcal: " + id, e.Message + e.StackTrace); } }
public static void SaveWhatStats(FeedRegistry fr, Calinfo calinfo) { var id = calinfo.id; GenUtils.LogMsg("status", "SaveWhatStats: " + id, null); Dictionary<string, IcalStats> istats = GetIcalStats(id); var sb_report = new StringBuilder(); sb_report.Append(MakeTableHeader()); var futurecount = 0; var options = new ParallelOptions(); Parallel.ForEach(source: fr.feeds.Keys, parallelOptions: options, body: (feedurl) => // foreach (var feedurl in fr.feeds.Keys) { StatsRow(id, istats, sb_report, ref futurecount, feedurl); } ); sb_report.Append("</table>\n"); string preamble = MakeWhatPreamble(futurecount); var report = preamble + sb_report.ToString(); report = Utils.EmbedHtmlSnippetInDefaultPageWrapper(calinfo, report); bs.PutBlob(id, id + ".stats.html", new Hashtable(), Encoding.UTF8.GetBytes(report), null); }
public NugetResult Find(Solution solution, Dependency dependency) { var feeds = FeedRegistry.FloatedFeedsFor(solution).ToArray(); var result = NugetSearch.FindNuget(feeds, x => { var feed = x.As <IFloatingFeed>(); var nuget = feed.FindLatest(dependency); if (nuget != null && dependency.Mode == UpdateMode.Fixed && nuget.IsUpdateFor(dependency)) { return(null); } return(nuget); }); if (!result.Found) { feeds .Where(x => x.IsOnline()) .Each(files => files.DumpLatest()); } return(result); }
public void TearDown() { theScenario.Cleanup(); FeedRegistry.Reset(); }
private static Dictionary<string, IcalStats> GetIcalStats(string container) { return FeedRegistry.DeserializeIcalStatsFromJson(blobhost, container, "ical_stats.json"); }
public static NugetResult FindLatestByName(Solution solution, string name) { return(FindNuget(FeedRegistry.FeedsFor(solution), feed => feed.FindLatestByName(name))); }
public static NugetResult FindNuget(Solution solution, Dependency dependency) { return(FindNuget(FeedRegistry.FeedsFor(solution), feed => feed.Find(dependency))); }
public void TearDown() { FeedRegistry.Reset(); }
public void TearDown() { RippleEnvironment.Live(); FeedRegistry.Reset(); }