Пример #1
0
    def create_git_repository(self):
        if not self.should_create_git_repo:
            return

        os.chdir(self.project_path)
        if envoy.run('which git').status_code is 0:
            sh.bold_red_on_black('Attempting to create git repository...')
            os.system('git init')
            os.system('git add .')
            sh.bold_green(checkmark)
        else:
            sh.bold_red_on_black('Git is not installed, ignoring initialization of repository\n')
Пример #2
0
    def create_file(self, name):
        context = self.get_context()

        with self.new_file(name) as destination:
            with self.skel_file(name) as view:
                sh.bold_white_on_black(u'Creating ')
                sh.bold_green_on_black(self.project_file(name))

                try:
                    body = view.read()
                    inside = body.format(**context)
                    destination.write(inside)
                except:
                    sh.bold_red(ballot)
                    raise
                else:
                    sh.bold_green(checkmark)
Пример #3
0
    def prepare_for_heroku(self):
        if not self.should_create_heroku_app:
            return

        os.chdir(self.project_path)
        response = envoy.run('heroku version')
        if response and 'toolbelt' in response.std_out:
            sh.bold_red_on_black('Creating heroku app...\n')
            r = envoy.run("heroku create")

            if r.status_code is 0:
                sh.bold_green('\n{}\n'.format(r.std_out))
            else:
                sh.bold_red('\n{}\n{}'.format(r.std_out, r.std_err))

        else:
            sh.bold_red_on_black('Heroku toolbelt is not installed.\n')
            sh.bold_white_on_black('More info: http://toolbelt.heroku.com')