상속: extends Illuminate\Database\Eloquent\Model, implements Illuminate\Contracts\Auth\Authenticatable, implements Illuminate\Contracts\Auth\Access\Authorizable, implements Illuminate\Contracts\Auth\CanResetPassword, implements Robbo\Presenter\PresentableInterface, use trait Illuminate\Auth\Authenticatable, use trait Illuminate\Auth\Passwords\CanResetPassword, use trait Illuminate\Foundation\Auth\Access\Authorizable, use trait Illuminate\Database\Eloquent\SoftDeletes, use trait REBELinBLUE\Deployer\Traits\BroadcastChanges
예제 #1
0
 public function run()
 {
     DB::table('users')->delete();
     $faker = Faker\Factory::create('en_GB');
     User::create(['name' => 'Admin', 'email' => '*****@*****.**', 'password' => bcrypt('password'), 'remember_token' => str_random(10)]);
     for ($i = 1; $i < 10; $i++) {
         User::create(['name' => $faker->firstName . ' ' . $faker->lastName, 'email' => $faker->safeEmail, 'password' => bcrypt($faker->password), 'remember_token' => str_random(10)]);
     }
 }
 /**
  * Run the migrations.
  */
 public function up()
 {
     Schema::create('users', function (Blueprint $table) {
         $table->increments('id');
         $table->string('name');
         $table->string('email')->unique();
         $table->string('password', 60);
         $table->rememberToken();
         $table->timestamps();
         $table->softDeletes();
     });
     User::create(['name' => 'Admin', 'email' => '*****@*****.**', 'password' => bcrypt('password'), 'remember_token' => str_random(10)]);
 }
예제 #3
0
 /**
  * Clones the repository locally to get the latest log entry and updates
  * the deployment model.
  */
 private function updateRepoInfo()
 {
     $commit = $this->deployment->commit === Deployment::LOADING ? null : $this->deployment->commit;
     $process = new Process('tools.GetCommitDetails', ['mirror_path' => $this->deployment->project->mirrorPath(), 'git_reference' => $commit ?: $this->deployment->branch]);
     $process->run();
     if (!$process->isSuccessful()) {
         throw new \RuntimeException('Could not get repository info - ' . $process->getErrorOutput());
     }
     $git_info = $process->getOutput();
     list($commit, $committer, $email) = explode("\t", $git_info);
     $this->deployment->commit = $commit;
     $this->deployment->committer = trim($committer);
     $this->deployment->committer_email = trim($email);
     if (!$this->deployment->user_id && !$this->deployment->source) {
         $user = User::where('email', $this->deployment->committer_email)->first();
         if ($user) {
             $this->deployment->user_id = $user->id;
         }
     }
     $this->deployment->save();
 }
예제 #4
0
    /**
     * Clones the repository locally to get the latest log entry and updates
     * the deployment model.
     *
     * @return void
     */
    private function updateRepoInfo()
    {
        $wrapper = tempnam(storage_path() . '/app/', 'gitssh');
        file_put_contents($wrapper, $this->gitWrapperScript($this->private_key));
        $workingdir = tempnam(storage_path() . '/app/', 'clone');
        unlink($workingdir);
        $cmd = <<<CMD
chmod +x "{$wrapper}" && \\
export GIT_SSH="{$wrapper}" && \\
git clone --quiet --branch %s --depth 1 %s {$workingdir} && \\
cd {$workingdir} && \\
git checkout %s --quiet && \\
git log --pretty=format:"%%H%%x09%%an%%x09%%ae" && \\
rm -rf {$workingdir}
CMD;
        $process = new Process(sprintf($cmd, $this->deployment->branch, $this->deployment->project->repository, $this->deployment->branch));
        $process->setTimeout(null);
        $process->run();
        unlink($wrapper);
        if (!$process->isSuccessful()) {
            throw new \RuntimeException('Could not get repository info - ' . $process->getErrorOutput());
        }
        $git_info = $process->getOutput();
        $parts = explode("\t", $git_info);
        $this->deployment->commit = $parts[0];
        $this->deployment->committer = trim($parts[1]);
        if (!$this->deployment->user_id && !$this->deployment->source) {
            $user = User::where('email', trim($parts[2]))->first();
            if ($user) {
                $this->deployment->user_id = $user->id;
            }
        }
        $this->deployment->save();
    }