new 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitmodules +3 -0
- data/.new +1 -1
- data/Gemfile.lock +25 -20
- data/Guardfile +6 -4
- data/README.md +9 -2
- data/doc/.git +1 -0
- data/doc/Gemfile.html +125 -0
- data/doc/Gemfile_lock.html +198 -0
- data/doc/Guardfile.html +134 -0
- data/doc/InterpolateSpec.html +116 -0
- data/doc/LICENSE_txt.html +132 -0
- data/doc/New/Cli.html +290 -0
- data/doc/New/Dsl.html +185 -0
- data/doc/New/Interpolate.html +238 -0
- data/doc/New/Project.html +171 -0
- data/doc/New/Task/CustomBarTask.html +154 -0
- data/doc/New/Task/FooTask.html +168 -0
- data/doc/New/Task/Gem.html +197 -0
- data/doc/New/Task/TaskSpec.html +168 -0
- data/doc/New/Task.html +380 -0
- data/doc/New/Template.html +234 -0
- data/doc/New/Version.html +277 -0
- data/doc/New.html +377 -0
- data/doc/Object.html +200 -0
- data/doc/README_md.html +292 -0
- data/doc/VersionSpec.html +116 -0
- data/doc/created.rid +47 -0
- data/doc/fonts/Lato-Light.ttf +0 -0
- data/doc/fonts/Lato-LightItalic.ttf +0 -0
- data/doc/fonts/Lato-Regular.ttf +0 -0
- data/doc/fonts/Lato-RegularItalic.ttf +0 -0
- data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
- data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
- data/doc/fonts.css +167 -0
- data/doc/images/add.png +0 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +142 -0
- data/doc/js/darkfish.js +140 -0
- data/doc/js/jquery.js +18 -0
- data/doc/js/navigation.js +142 -0
- data/doc/js/search.js +109 -0
- data/doc/js/search_index.js +1 -0
- data/doc/js/searcher.js +228 -0
- data/doc/rdoc.css +580 -0
- data/doc/spec/fixtures/custom/templates/custom_bar_template/custom_bar_txt.html +110 -0
- data/doc/table_of_contents.html +324 -0
- data/doc/tasks/gem/README_md.html +150 -0
- data/doc/templates/js/Gemfile.html +147 -0
- data/doc/templates/js/Guardfile.html +117 -0
- data/doc/templates/js/lib/README_md.html +114 -0
- data/doc/templates/js/spec/spec_helper_js_coffee.html +110 -0
- data/doc/templates/js/spec/vendor/chai_js.html +3864 -0
- data/doc/templates/js/spec/vendor/sinon-chai_js.html +222 -0
- data/doc/templates/js/spec/vendor/sinon_js.html +4358 -0
- data/doc/templates/js/src/README_md.html +125 -0
- data/lib/new/task.rb +2 -4
- data/lib/new/template.rb +1 -1
- data/lib/new/version.rb +27 -19
- data/spec/fixtures/tasks/foo_task/Gemfile +5 -0
- data/spec/lib/new/version_spec.rb +10 -15
- data/spec/spec_helper.rb +22 -1
- data/tasks/gem/gem.rb +44 -8
- data/tasks/gem/gem_spec.rb +139 -0
- metadata +233 -3
@@ -0,0 +1,116 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class InterpolateSpec - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<link href="./fonts.css" rel="stylesheet">
|
10
|
+
<link href="./rdoc.css" rel="stylesheet">
|
11
|
+
|
12
|
+
<script type="text/javascript">
|
13
|
+
var rdoc_rel_prefix = "./";
|
14
|
+
</script>
|
15
|
+
|
16
|
+
<script src="./js/jquery.js"></script>
|
17
|
+
<script src="./js/navigation.js"></script>
|
18
|
+
<script src="./js/search_index.js"></script>
|
19
|
+
<script src="./js/search.js"></script>
|
20
|
+
<script src="./js/searcher.js"></script>
|
21
|
+
<script src="./js/darkfish.js"></script>
|
22
|
+
|
23
|
+
|
24
|
+
<body id="top" role="document" class="class">
|
25
|
+
<nav role="navigation">
|
26
|
+
<div id="project-navigation">
|
27
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
28
|
+
<h2>
|
29
|
+
<a href="./index.html" rel="home">Home</a>
|
30
|
+
</h2>
|
31
|
+
|
32
|
+
<div id="table-of-contents-navigation">
|
33
|
+
<a href="./table_of_contents.html#pages">Pages</a>
|
34
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
35
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
40
|
+
<form action="#" method="get" accept-charset="utf-8">
|
41
|
+
<div id="search-field-wrapper">
|
42
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
43
|
+
aria-autocomplete="list" aria-controls="search-results"
|
44
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
45
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
46
|
+
</div>
|
47
|
+
|
48
|
+
<ul id="search-results" aria-label="Search Results"
|
49
|
+
aria-busy="false" aria-expanded="false"
|
50
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
51
|
+
</form>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
</div>
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
<div id="class-metadata">
|
59
|
+
|
60
|
+
<div id="parent-class-section" class="nav-section">
|
61
|
+
<h3>Parent</h3>
|
62
|
+
|
63
|
+
|
64
|
+
<p class="link"><a href="Object.html">Object</a>
|
65
|
+
|
66
|
+
</div>
|
67
|
+
|
68
|
+
<div id="includes-section" class="nav-section">
|
69
|
+
<h3>Included Modules</h3>
|
70
|
+
|
71
|
+
<ul class="link-list">
|
72
|
+
|
73
|
+
|
74
|
+
<li><a class="include" href="New/Interpolate.html">New::Interpolate</a>
|
75
|
+
|
76
|
+
|
77
|
+
</ul>
|
78
|
+
</div>
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
</div>
|
83
|
+
</nav>
|
84
|
+
|
85
|
+
<main role="main" aria-labelledby="class-InterpolateSpec">
|
86
|
+
<h1 id="class-InterpolateSpec" class="class">
|
87
|
+
class InterpolateSpec
|
88
|
+
</h1>
|
89
|
+
|
90
|
+
<section class="description">
|
91
|
+
|
92
|
+
</section>
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
</section>
|
108
|
+
</main>
|
109
|
+
|
110
|
+
|
111
|
+
<footer id="validator-badges" role="contentinfo">
|
112
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
113
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.0.
|
114
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
115
|
+
</footer>
|
116
|
+
|
@@ -0,0 +1,132 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>LICENSE - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<link href="./fonts.css" rel="stylesheet">
|
10
|
+
<link href="./rdoc.css" rel="stylesheet">
|
11
|
+
|
12
|
+
<script type="text/javascript">
|
13
|
+
var rdoc_rel_prefix = "./";
|
14
|
+
</script>
|
15
|
+
|
16
|
+
<script src="./js/jquery.js"></script>
|
17
|
+
<script src="./js/navigation.js"></script>
|
18
|
+
<script src="./js/search_index.js"></script>
|
19
|
+
<script src="./js/search.js"></script>
|
20
|
+
<script src="./js/searcher.js"></script>
|
21
|
+
<script src="./js/darkfish.js"></script>
|
22
|
+
|
23
|
+
|
24
|
+
<body id="top" role="document" class="file">
|
25
|
+
<nav role="navigation">
|
26
|
+
<div id="project-navigation">
|
27
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
28
|
+
<h2>
|
29
|
+
<a href="./index.html" rel="home">Home</a>
|
30
|
+
</h2>
|
31
|
+
|
32
|
+
<div id="table-of-contents-navigation">
|
33
|
+
<a href="./table_of_contents.html#pages">Pages</a>
|
34
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
35
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
40
|
+
<form action="#" method="get" accept-charset="utf-8">
|
41
|
+
<div id="search-field-wrapper">
|
42
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
43
|
+
aria-autocomplete="list" aria-controls="search-results"
|
44
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
45
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
46
|
+
</div>
|
47
|
+
|
48
|
+
<ul id="search-results" aria-label="Search Results"
|
49
|
+
aria-busy="false" aria-expanded="false"
|
50
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
51
|
+
</form>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
</div>
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
<div id="project-metadata">
|
59
|
+
<div id="fileindex-section" class="nav-section">
|
60
|
+
<h3>Pages</h3>
|
61
|
+
|
62
|
+
<ul class="link-list">
|
63
|
+
|
64
|
+
<li><a href="./Gemfile.html">Gemfile</a>
|
65
|
+
|
66
|
+
<li><a href="./Gemfile_lock.html">Gemfile.lock</a>
|
67
|
+
|
68
|
+
<li><a href="./Guardfile.html">Guardfile</a>
|
69
|
+
|
70
|
+
<li><a href="./LICENSE_txt.html">LICENSE</a>
|
71
|
+
|
72
|
+
<li><a href="./README_md.html">README</a>
|
73
|
+
|
74
|
+
<li><a href="./spec/fixtures/custom/templates/custom_bar_template/custom_bar_txt.html">custom_bar</a>
|
75
|
+
|
76
|
+
<li><a href="./tasks/gem/README_md.html">README</a>
|
77
|
+
|
78
|
+
<li><a href="./templates/js/Gemfile.html">Gemfile</a>
|
79
|
+
|
80
|
+
<li><a href="./templates/js/Guardfile.html">Guardfile</a>
|
81
|
+
|
82
|
+
<li><a href="./templates/js/lib/README_md.html">README</a>
|
83
|
+
|
84
|
+
<li><a href="./templates/js/spec/spec_helper_js_coffee.html">spec_helper.js.coffee</a>
|
85
|
+
|
86
|
+
<li><a href="./templates/js/spec/vendor/chai_js.html">chai.js</a>
|
87
|
+
|
88
|
+
<li><a href="./templates/js/spec/vendor/sinon-chai_js.html">sinon-chai.js</a>
|
89
|
+
|
90
|
+
<li><a href="./templates/js/spec/vendor/sinon_js.html">sinon.js</a>
|
91
|
+
|
92
|
+
<li><a href="./templates/js/src/README_md.html">README</a>
|
93
|
+
|
94
|
+
</ul>
|
95
|
+
</div>
|
96
|
+
|
97
|
+
</div>
|
98
|
+
</nav>
|
99
|
+
|
100
|
+
<main role="main" aria-label="Page LICENSE.txt">
|
101
|
+
|
102
|
+
<p>Copyright © 2013 Ryan Brewster</p>
|
103
|
+
|
104
|
+
<p>MIT License</p>
|
105
|
+
|
106
|
+
<p>Permission is hereby granted, free of charge, to any person obtaining a
|
107
|
+
copy of this software and associated documentation files (the “Software”),
|
108
|
+
to deal in the Software without restriction, including without limitation
|
109
|
+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
110
|
+
and/or sell copies of the Software, and to permit persons to whom the
|
111
|
+
Software is furnished to do so, subject to the following conditions:</p>
|
112
|
+
|
113
|
+
<p>The above copyright notice and this permission notice shall be included in
|
114
|
+
all copies or substantial portions of the Software.</p>
|
115
|
+
|
116
|
+
<p>THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
117
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
118
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
119
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
120
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
121
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
122
|
+
DEALINGS IN THE SOFTWARE.</p>
|
123
|
+
</main>
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
<footer id="validator-badges" role="contentinfo">
|
128
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
129
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.0.
|
130
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
131
|
+
</footer>
|
132
|
+
|
data/doc/New/Cli.html
ADDED
@@ -0,0 +1,290 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class New::Cli - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<link href="../fonts.css" rel="stylesheet">
|
10
|
+
<link href="../rdoc.css" rel="stylesheet">
|
11
|
+
|
12
|
+
<script type="text/javascript">
|
13
|
+
var rdoc_rel_prefix = "../";
|
14
|
+
</script>
|
15
|
+
|
16
|
+
<script src="../js/jquery.js"></script>
|
17
|
+
<script src="../js/navigation.js"></script>
|
18
|
+
<script src="../js/search_index.js"></script>
|
19
|
+
<script src="../js/search.js"></script>
|
20
|
+
<script src="../js/searcher.js"></script>
|
21
|
+
<script src="../js/darkfish.js"></script>
|
22
|
+
|
23
|
+
|
24
|
+
<body id="top" role="document" class="class">
|
25
|
+
<nav role="navigation">
|
26
|
+
<div id="project-navigation">
|
27
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
28
|
+
<h2>
|
29
|
+
<a href="../index.html" rel="home">Home</a>
|
30
|
+
</h2>
|
31
|
+
|
32
|
+
<div id="table-of-contents-navigation">
|
33
|
+
<a href="../table_of_contents.html#pages">Pages</a>
|
34
|
+
<a href="../table_of_contents.html#classes">Classes</a>
|
35
|
+
<a href="../table_of_contents.html#methods">Methods</a>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
40
|
+
<form action="#" method="get" accept-charset="utf-8">
|
41
|
+
<div id="search-field-wrapper">
|
42
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
43
|
+
aria-autocomplete="list" aria-controls="search-results"
|
44
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
45
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
46
|
+
</div>
|
47
|
+
|
48
|
+
<ul id="search-results" aria-label="Search Results"
|
49
|
+
aria-busy="false" aria-expanded="false"
|
50
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
51
|
+
</form>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
</div>
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
<div id="class-metadata">
|
59
|
+
|
60
|
+
<div id="parent-class-section" class="nav-section">
|
61
|
+
<h3>Parent</h3>
|
62
|
+
|
63
|
+
|
64
|
+
<p class="link">Thor
|
65
|
+
|
66
|
+
</div>
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
<!-- Method Quickref -->
|
71
|
+
<div id="method-list-section" class="nav-section">
|
72
|
+
<h3>Methods</h3>
|
73
|
+
|
74
|
+
<ul class="link-list" role="directory">
|
75
|
+
|
76
|
+
<li ><a href="#method-i-init">#init</a>
|
77
|
+
|
78
|
+
<li class="calls-super" ><a href="#method-i-method_missing">#method_missing</a>
|
79
|
+
|
80
|
+
<li ><a href="#method-i-release">#release</a>
|
81
|
+
|
82
|
+
</ul>
|
83
|
+
</div>
|
84
|
+
|
85
|
+
</div>
|
86
|
+
</nav>
|
87
|
+
|
88
|
+
<main role="main" aria-labelledby="class-New::Cli">
|
89
|
+
<h1 id="class-New::Cli" class="class">
|
90
|
+
class New::Cli
|
91
|
+
</h1>
|
92
|
+
|
93
|
+
<section class="description">
|
94
|
+
|
95
|
+
</section>
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
111
|
+
<header>
|
112
|
+
<h3>Public Instance Methods</h3>
|
113
|
+
</header>
|
114
|
+
|
115
|
+
|
116
|
+
<div id="method-i-init" class="method-detail ">
|
117
|
+
|
118
|
+
<div class="method-heading">
|
119
|
+
<span class="method-name">init</span><span
|
120
|
+
class="method-args">()</span>
|
121
|
+
|
122
|
+
<span class="method-click-advice">click to toggle source</span>
|
123
|
+
|
124
|
+
</div>
|
125
|
+
|
126
|
+
|
127
|
+
<div class="method-description">
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
<div class="method-source-code" id="init-source">
|
135
|
+
<pre><span class="ruby-comment"># File lib/new/cli.rb, line 33</span>
|
136
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">init</span>
|
137
|
+
<span class="ruby-keyword">if</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">exists?</span> <span class="ruby-constant">New</span><span class="ruby-operator">::</span><span class="ruby-constant">CUSTOM_DIR</span>
|
138
|
+
<span class="ruby-constant">New</span>.<span class="ruby-identifier">say</span> <span class="ruby-string">'Home folder already exists.'</span>, <span class="ruby-identifier">type</span><span class="ruby-operator">:</span> <span class="ruby-value">:warn</span>
|
139
|
+
<span class="ruby-keyword">else</span>
|
140
|
+
<span class="ruby-comment"># create folder</span>
|
141
|
+
<span class="ruby-constant">New</span>.<span class="ruby-identifier">say</span> <span class="ruby-string">'Creating home folder.'</span>, <span class="ruby-identifier">type</span><span class="ruby-operator">:</span> <span class="ruby-value">:success</span>
|
142
|
+
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span> <span class="ruby-constant">New</span><span class="ruby-operator">::</span><span class="ruby-constant">CUSTOM_DIR</span>
|
143
|
+
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">New</span><span class="ruby-operator">::</span><span class="ruby-constant">CUSTOM_DIR</span>, <span class="ruby-constant">New</span><span class="ruby-operator">::</span><span class="ruby-constant">TASKS_DIR_NAME</span>)
|
144
|
+
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">New</span><span class="ruby-operator">::</span><span class="ruby-constant">CUSTOM_DIR</span>, <span class="ruby-constant">New</span><span class="ruby-operator">::</span><span class="ruby-constant">TEMPLATES_DIR_NAME</span>)
|
145
|
+
|
146
|
+
<span class="ruby-comment"># create config file</span>
|
147
|
+
<span class="ruby-constant">New</span>.<span class="ruby-identifier">say</span> <span class="ruby-string">'Creating default configuration file.'</span>, <span class="ruby-identifier">type</span><span class="ruby-operator">:</span> <span class="ruby-value">:success</span>
|
148
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">New</span><span class="ruby-operator">::</span><span class="ruby-constant">CUSTOM_DIR</span>, <span class="ruby-constant">New</span><span class="ruby-operator">::</span><span class="ruby-constant">CONFIG_FILE</span>), <span class="ruby-string">'w'</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
|
149
|
+
<span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span> <span class="ruby-constant">New</span><span class="ruby-operator">::</span><span class="ruby-constant">Template</span><span class="ruby-operator">::</span><span class="ruby-constant">CUSTOM_CONFIG_TEMPLATE</span>.<span class="ruby-identifier">to_yaml</span>
|
150
|
+
<span class="ruby-keyword">end</span>
|
151
|
+
|
152
|
+
<span class="ruby-constant">New</span>.<span class="ruby-identifier">say</span> <span class="ruby-node">"Edit #{File.join(New::CUSTOM_DIR, New::CONFIG_FILE)} with your custom configuration details."</span>, <span class="ruby-identifier">type</span><span class="ruby-operator">:</span> <span class="ruby-value">:warn</span>
|
153
|
+
<span class="ruby-keyword">end</span>
|
154
|
+
<span class="ruby-keyword">end</span></pre>
|
155
|
+
</div>
|
156
|
+
|
157
|
+
</div>
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
</div>
|
163
|
+
|
164
|
+
|
165
|
+
<div id="method-i-method_missing" class="method-detail ">
|
166
|
+
|
167
|
+
<div class="method-heading">
|
168
|
+
<span class="method-name">method_missing</span><span
|
169
|
+
class="method-args">(method, *args)</span>
|
170
|
+
|
171
|
+
<span class="method-click-advice">click to toggle source</span>
|
172
|
+
|
173
|
+
</div>
|
174
|
+
|
175
|
+
|
176
|
+
<div class="method-description">
|
177
|
+
|
178
|
+
<p>option :name, required: true</p>
|
179
|
+
|
180
|
+
|
181
|
+
<div class="method-calls-super">
|
182
|
+
Calls superclass method
|
183
|
+
|
184
|
+
</div>
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
<div class="method-source-code" id="method_missing-source">
|
189
|
+
<pre><span class="ruby-comment"># File lib/new/cli.rb, line 7</span>
|
190
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">method_missing</span> <span class="ruby-identifier">method</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>
|
191
|
+
<span class="ruby-keyword">if</span> <span class="ruby-constant">New</span>.<span class="ruby-identifier">templates</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">to_sym</span>
|
192
|
+
<span class="ruby-comment"># Split args that look like options (i.e start with - or --) into a separate array</span>
|
193
|
+
<span class="ruby-identifier">positional_args</span>, <span class="ruby-identifier">opts</span> = <span class="ruby-constant">Thor</span><span class="ruby-operator">::</span><span class="ruby-constant">Options</span>.<span class="ruby-identifier">split</span> <span class="ruby-identifier">args</span>
|
194
|
+
|
195
|
+
<span class="ruby-comment"># extract name from args</span>
|
196
|
+
<span class="ruby-identifier">name</span> = <span class="ruby-identifier">positional_args</span>[<span class="ruby-value">0</span>]
|
197
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">Thor</span><span class="ruby-operator">::</span><span class="ruby-constant">RequiredArgumentMissingError</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">name</span>
|
198
|
+
|
199
|
+
<span class="ruby-comment"># Add all options here</span>
|
200
|
+
<span class="ruby-comment"># Make sure to include required options up above as well so they show in the help menu</span>
|
201
|
+
<span class="ruby-identifier">parser</span> = <span class="ruby-constant">Thor</span><span class="ruby-operator">::</span><span class="ruby-constant">Options</span>.<span class="ruby-identifier">new</span>(
|
202
|
+
<span class="ruby-comment"># name: Thor::Option.new(:name, required: true, type: :string)</span>
|
203
|
+
)
|
204
|
+
|
205
|
+
<span class="ruby-comment"># The options hash is frozen in #initialize so you need to merge and re-assign</span>
|
206
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">options</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">parser</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">opts</span>)).<span class="ruby-identifier">freeze</span>
|
207
|
+
|
208
|
+
<span class="ruby-comment"># Dispatch the command</span>
|
209
|
+
<span class="ruby-identifier">project</span> <span class="ruby-identifier">method</span>, <span class="ruby-identifier">name</span>
|
210
|
+
<span class="ruby-keyword">else</span>
|
211
|
+
<span class="ruby-keyword">super</span>
|
212
|
+
<span class="ruby-keyword">end</span>
|
213
|
+
<span class="ruby-keyword">end</span></pre>
|
214
|
+
</div>
|
215
|
+
|
216
|
+
</div>
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
</div>
|
222
|
+
|
223
|
+
|
224
|
+
<div id="method-i-release" class="method-detail ">
|
225
|
+
|
226
|
+
<div class="method-heading">
|
227
|
+
<span class="method-name">release</span><span
|
228
|
+
class="method-args">()</span>
|
229
|
+
|
230
|
+
<span class="method-click-advice">click to toggle source</span>
|
231
|
+
|
232
|
+
</div>
|
233
|
+
|
234
|
+
|
235
|
+
<div class="method-description">
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
<div class="method-source-code" id="release-source">
|
243
|
+
<pre><span class="ruby-comment"># File lib/new/cli.rb, line 54</span>
|
244
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">release</span>
|
245
|
+
<span class="ruby-identifier">project_config_file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">pwd</span>, <span class="ruby-constant">New</span><span class="ruby-operator">::</span><span class="ruby-constant">CONFIG_FILE</span>)
|
246
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span> <span class="ruby-identifier">project_config_file</span>
|
247
|
+
|
248
|
+
<span class="ruby-comment"># get project config file</span>
|
249
|
+
<span class="ruby-identifier">project_config</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">project_config_file</span>)).<span class="ruby-identifier">deep_symbolize_keys!</span>
|
250
|
+
|
251
|
+
<span class="ruby-comment"># extract tasks from configuration</span>
|
252
|
+
<span class="ruby-identifier">tasks</span> = (<span class="ruby-identifier">project_config</span>[<span class="ruby-value">:tasks</span>] <span class="ruby-operator">||</span> {}).<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">map</span>(<span class="ruby-operator">&</span><span class="ruby-value">:to_sym</span>)
|
253
|
+
|
254
|
+
<span class="ruby-identifier">tasks</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">task</span><span class="ruby-operator">|</span>
|
255
|
+
<span class="ruby-comment"># require custom task and initialize it</span>
|
256
|
+
<span class="ruby-keyword">begin</span>
|
257
|
+
<span class="ruby-keyword">if</span> <span class="ruby-constant">New</span>.<span class="ruby-identifier">custom_tasks</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">task</span>
|
258
|
+
<span class="ruby-identifier">require</span> <span class="ruby-node">"#{New::CUSTOM_DIR}/#{New::TASKS_DIR_NAME}/#{task}/#{task}"</span>
|
259
|
+
<span class="ruby-keyword">else</span>
|
260
|
+
<span class="ruby-identifier">require</span> <span class="ruby-node">"#{New::DEFAULT_DIR}/#{New::TASKS_DIR_NAME}/#{task}/#{task}"</span>
|
261
|
+
<span class="ruby-keyword">end</span>
|
262
|
+
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">LoadError</span>
|
263
|
+
<span class="ruby-constant">New</span>.<span class="ruby-identifier">say</span> <span class="ruby-node">"No task '#{task}' found!"</span>, <span class="ruby-identifier">type</span><span class="ruby-operator">:</span> <span class="ruby-value">:fail</span>
|
264
|
+
<span class="ruby-keyword">next</span>
|
265
|
+
<span class="ruby-keyword">end</span>
|
266
|
+
<span class="ruby-node">"New::Task::#{task.to_s.classify}"</span>.<span class="ruby-identifier">constantize</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">project_config</span>
|
267
|
+
<span class="ruby-keyword">end</span>
|
268
|
+
<span class="ruby-keyword">end</span></pre>
|
269
|
+
</div>
|
270
|
+
|
271
|
+
</div>
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
</div>
|
277
|
+
|
278
|
+
|
279
|
+
</section>
|
280
|
+
|
281
|
+
</section>
|
282
|
+
</main>
|
283
|
+
|
284
|
+
|
285
|
+
<footer id="validator-badges" role="contentinfo">
|
286
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
287
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.0.
|
288
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
289
|
+
</footer>
|
290
|
+
|