Пример #1
0
 def test_create_empty_site(self):
     create_empty_site('mysite', DIR_PLAYGROUND)
     newsite = os.path.join(DIR_PLAYGROUND, 'mysite')
     os.path.exists(newsite)
     os.path.exists(os.path.join(newsite, 'templates'))
     os.path.exists(os.path.join(newsite, 'public'))
     os.path.exists(os.path.join(newsite, 'config.json'))
     
     create_empty_site('myothersite', DIR_PLAYGROUND, '_source', 'www')
     newsite = os.path.join(DIR_PLAYGROUND, 'myothersite')
     os.path.exists(newsite)
     os.path.exists(os.path.join(newsite, '_source'))
     os.path.exists(os.path.join(newsite, 'www'))
     os.path.exists(os.path.join(newsite, 'config.json'))
Пример #2
0
def startsite():
    parser = OptionParser()
    parser.add_option("-s", "--sourcedir", dest="sourcedir",
                      help="Name of the dir for source template files (defaults to 'templates')")
    parser.add_option("-t", "--targetdir", dest="targetdir",
                      help="Name of the dir for generated html files (defaults to 'public')")

    (options, args) = parser.parse_args()

    try:
        sitename = args[1]
        opts = dict([(k, v) for k, v in options.__dict__.iteritems() if v is not None])
        site.create_empty_site(sitename, os.getcwd(), **opts)
    except IndexError:
        logger.error("Error: Please specify a name for the jinger powered site.")
        help()
Пример #3
0
    def setUp(self):
        super(WebContentTest, self).setUp()
        create_empty_site('mysite', DIR_PLAYGROUND)
        self.site = os.path.abspath(os.path.join(DIR_PLAYGROUND, 'mysite'))

        with open(os.path.join(self.site, 'templates', 'index.html'), 'w') as f:
            f.write('<!DOCTYPE html>')

        with open(webasset_path(self.site, 'styles.css'), 'w') as f:
            f.write('html, body {}')

        with open(webasset_path(self.site, 'main.js'), 'w') as f:
            f.write('var MYSITE = {};')

        with open(webasset_path(self.site, 'logo.png'), 'w') as f:
            f.write('100011')