More updates to stop using dev or alpha or beta versions.
[yaffs-website] / vendor / consolidation / robo / src / Task / Composer / Init.php
1 <?php
2 namespace Robo\Task\Composer;
3
4 /**
5  * Composer Init
6  *
7  * ``` php
8  * <?php
9  * // simple execution
10  * $this->taskComposerInit()->run();
11  * ?>
12  * ```
13  */
14 class Init extends Base
15 {
16     /**
17      * {@inheritdoc}
18      */
19     protected $action = 'init';
20
21     /**
22      * @return $this
23      */
24     public function projectName($projectName)
25     {
26         $this->option('name', $projectName);
27         return $this;
28     }
29
30     /**
31      * @return $this
32      */
33     public function description($description)
34     {
35         $this->option('description', $description);
36         return $this;
37     }
38
39     /**
40      * @return $this
41      */
42     public function author($author)
43     {
44         $this->option('author', $author);
45         return $this;
46     }
47
48     /**
49      * @return $this
50      */
51     public function projectType($type)
52     {
53         $this->option('type', $type);
54         return $this;
55     }
56
57     /**
58      * @return $this
59      */
60     public function homepage($homepage)
61     {
62         $this->option('homepage', $homepage);
63         return $this;
64     }
65
66     /**
67      * 'require' is a keyword, so it cannot be a method name.
68      * @return $this
69      */
70     public function dependency($project, $version = null)
71     {
72         if (isset($version)) {
73             $project .= ":$version";
74         }
75         $this->option('require', $project);
76         return $this;
77     }
78
79     /**
80      * @return $this
81      */
82     public function stability($stability)
83     {
84         $this->option('stability', $stability);
85         return $this;
86     }
87
88     /**
89      * @return $this
90      */
91     public function license($license)
92     {
93         $this->option('license', $license);
94         return $this;
95     }
96
97     /**
98      * @return $this
99      */
100     public function repository($repository)
101     {
102         $this->option('repository', $repository);
103         return $this;
104     }
105
106     /**
107      * {@inheritdoc}
108      */
109     public function run()
110     {
111         $command = $this->getCommand();
112         $this->printTaskInfo('Creating composer.json: {command}', ['command' => $command]);
113         return $this->executeCommand($command);
114     }
115 }