Beispiel #1
0
    def test_manifest_source_file(self):
        # removing output file to test
        if os.path.exists(self.out_file):
            os.remove(self.out_file)

        observer = SassObserver()
        observer.add_manifest(self.manifest_file)
        observer.start()
        # wait some moments to initialize observer thread
        time.sleep(0.5)
        # append something to source file
        # if os.path.exists(self.out_file):
        #     os.remove(self.out_file)
        with open(self.oondex_sass_file, "w") as f:
            f.write(
                """
@import "libdir/mixines"

body
  background-color: #FFFFFF
  @include opacity(.2)
"""
            )

        # wait another moments to write the out file
        time.sleep(1)
        self.assertTrue(os.path.exists(self.out_file))

        self.assertTrue(os.path.exists(os.path.join(os.path.dirname(__file__), "out", "mini.out.css")))
        self.assertTrue(os.path.exists(os.path.join(os.path.dirname(__file__), "out", "mini.out.min.css")))

        observer.stop()
        observer.join()
Beispiel #2
0
    def test_manifest_source_dir(self):
        # removing output file to test
        if os.path.exists(self.out_file):
            os.remove(self.out_file)

        observer = SassObserver()
        observer.add_manifest(self.manifest_file)
        observer.start()
        # wait some moments to initialize observer thread
        time.sleep(0.5)
        # append something to source file
        with open(self.sass_file, "a") as f:
            f.write(
                """
body
  background-color: #FFFFFF
"""
            )

        # wait another moments to write the out file
        time.sleep(1)
        self.assertTrue(os.path.exists(self.out_file))

        observer.stop()
        observer.join()
Beispiel #3
0
    def test_manifest_source_file(self):
        # removing output file to test
        if os.path.exists(self.out_file):
            os.remove(self.out_file)

        observer = SassObserver()
        observer.add_manifest(self.manifest_file)
        observer.start()
        # wait some moments to initialize observer thread
        time.sleep(.5)
        # append something to source file
        if os.path.exists(self.out_file):
            os.remove(self.out_file)
        with open(self.oondex_sass_file,'w') as f:
            f.write("""
@import mixines.sass

body
  background-color: #FFFFFF
  @include opacity(.2)
""")

        # wait another moments to write the out file
        time.sleep(.5)
        self.assertTrue(os.path.exists(self.out_file))

        observer.stop()
        observer.join()
Beispiel #4
0
def start_watchdog():

    # Asserts
    assert args.output, "Please provide an output file via -o option, Standard output was not supported in watch mode."
    source_msg = "Please provide one or more directory as sources, files and standard input was not supported in watch mode."
    assert len(args.sources) > 0, source_msg
    for s in args.sources:
        assert os.path.isdir(s), source_msg

    observer = SassObserver()
    observer.add_output(args.output, dirs=helpers.get_source_dirs(args.sources), lib_dirs=args.lib_dirs)
    observer.start()
    try:
        while True:
            time.sleep(1)
    except KeyboardInterrupt:
        observer.stop()
    observer.join()
Beispiel #5
0
class IsassEnginePlugin(plugins.SimplePlugin):
    def __init__(self, bus):
        plugins.SimplePlugin.__init__(self, bus)
        self.observer = None

    def start(self):
        self.observer = SassObserver()
        for manifest_file in config.isass.manifests:
            if os.path.exists(manifest_file):
                self.observer.add_manifest(manifest_file)
        self.observer.start()

    def stop(self):
        if self.observer:
            self.observer.unschedule_all()
            self.observer.stop()
Beispiel #6
0
 def start(self):
     self.observer = SassObserver()
     for manifest_file in config.isass.manifests:
         if os.path.exists(manifest_file):
             self.observer.add_manifest(manifest_file)
     self.observer.start()