protected override void ProcessRecord()
        {
            try
            {
                var courierWebserviceRepositoryProvider = new CourierWebserviceRepositoryProvider
                                                              {
                                                                  Url = TargetUmbracoUrl,
                                                                  Login = UmbracoUsername,
                                                                  Password = UmbracoPassword,
                                                                  PasswordEncoding = UmbracoPasswordEncoding,
                                                                  UserId = -1,
                                                                  Name = "webservicerepository"
                                                              };

                var resourcePublisher = new ResourcePublisher(courierWebserviceRepositoryProvider, new PsCmdletLogger(this), PluginFolder);
                resourcePublisher.Publish(RevisionDirectory);
            }
            catch (Exception e)
            {
                ThrowTerminatingError(
                    new ErrorRecord(
                        e,
                        "UmbracoResources",
                        ErrorCategory.NotSpecified,
                        this
                        )
                    );
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            //To init our app, we need to load all provider dlls from our plugins dir
            //The application needs the DLL umbraco.courier.providers.dll to work with the build-in providers
            //you can add any dll in there to load your own
            Umbraco.Courier.Core.Helpers.TypeResolver.LoadAssembliesIntoAppDomain(plugins, "*.dll");

            //we also need to tell it where to get it's config xml
            //this is the standard courier file which contains settings for the engines and providers
            Umbraco.Courier.Core.Context.Current.SettingsFilePath = Path.Combine(application, "courier.config");

            //finally we need to redirect the revisions root for correct mapping
            Umbraco.Courier.Core.Context.Current.BaseDirectory = directory;
            Umbraco.Courier.Core.Context.Current.HasHttpContext = false;

            try
            {
                PackagingManager manager = PackagingManager.Instance;

                CourierWebserviceRepositoryProvider cp = new CourierWebserviceRepositoryProvider();
                cp.Login = "******";
                cp.Password = "******";
                cp.PasswordEncoding = "Hashed";
                cp.UserId = -1;
                cp.Url = "http://cws.local";

                Repository r = new Repository(cp);
                r.Name = "Console app repo";
                r.Alias = "console";

                manager.Load(Path.Combine(directory, "testingDirectory"));
                manager.EnableRemoteExtraction(r);

                manager.PackagedItem += new EventHandler<ItemEventArgs>(manager_PackagedItem);

                string err = "";

                manager.AddAllProvidersToQueue(true);

                Console.Write(manager.Queue.Count + " Items added");

                manager.PackageQueue();

                Console.Write("DONE");
            }
            catch (Exception ex)
            {
                Console.Write(ex.ToString());

            }

            Console.Read();
        }
        public void WhenRevisionPublished_ThenProviderCalledWithExpectedNumberOfResources()
        {
            var repositoryProviderDouble = new RepositoryProviderDouble();
            var publisher = new ResourcePublisher(repositoryProviderDouble, new PsCmdletLoggerDouble(), @".\UmbracoResources\plugins");

            // fake instatiation in order to load the repository provider into the app domain
            var provider = new CourierWebserviceRepositoryProvider();

            publisher.Publish(@"..\..\ExampleUmbracoRevisions\V1");

            Assert.That(repositoryProviderDouble.ResourcesSeen, Is.EqualTo(113));
        }