konstruct 0.9.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +33 -27
- data/konstruct.gemspec +6 -6
- data/lib/cli/develop.rb +54 -47
- data/lib/cli/project.rb +333 -81
- data/lib/konstruct.rb +157 -84
- data/lib/konstruct/template.rb +71 -0
- data/lib/konstruct/version.rb +1 -1
- data/lib/utilities/gulp.rb +32 -42
- data/lib/utilities/system.rb +218 -0
- data/lib/utilities/utils.rb +165 -184
- metadata +18 -5
- data/lib/cli/documentation.rb +0 -44
- data/lib/cli/init.rb +0 -195
- data/lib/konstruct/config.rb +0 -22
data/lib/konstruct.rb
CHANGED
@@ -1,179 +1,252 @@
|
|
1
|
-
# KONSTRUCT CLI [ COMMANDER ]
|
1
|
+
# KONSTRUCT CLI [ COMMANDER ] =================================================
|
2
2
|
|
3
|
-
# ====== INDEX
|
3
|
+
# ====== INDEX ================================================================
|
4
4
|
# ==
|
5
5
|
# == A. LOAD DEPENDENCIES
|
6
6
|
# ==
|
7
|
-
# ====== INDEX
|
7
|
+
# ====== INDEX ================================================================
|
8
8
|
|
9
|
-
# A. LOAD DEPENDENCIES
|
9
|
+
# A. LOAD DEPENDENCIES +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
10
10
|
|
11
|
-
# A.1. EXTERNAL DEPENDENCIES
|
11
|
+
# A.1. EXTERNAL DEPENDENCIES ---------------------------------------------------
|
12
12
|
|
13
|
-
require
|
14
|
-
require
|
13
|
+
require 'konstruct/version'
|
14
|
+
require 'konstruct/template'
|
15
15
|
require 'rubygems'
|
16
16
|
require 'commander/import'
|
17
17
|
require 'paint'
|
18
18
|
require 'launchy'
|
19
19
|
require 'minigit'
|
20
|
+
require 'yaml'
|
20
21
|
require 'json'
|
21
22
|
require 'pp'
|
23
|
+
require 'net/http'
|
24
|
+
require 'xmlsimple'
|
22
25
|
|
23
|
-
# A.1. END
|
26
|
+
# A.1. END ---------------------------------------------------------------------
|
24
27
|
|
25
|
-
# A.2. INTERNAL DEPENDENCIES
|
28
|
+
# A.2. INTERNAL DEPENDENCIES ---------------------------------------------------
|
26
29
|
|
27
30
|
#A.2.1. UTILITIES
|
28
31
|
|
29
32
|
require_relative 'utilities/utils'
|
30
33
|
require_relative 'utilities/gulp'
|
31
34
|
require_relative 'utilities/git'
|
35
|
+
require_relative 'utilities/system'
|
32
36
|
|
33
37
|
# A.2.2. CLI SCRIPTS
|
34
38
|
|
35
|
-
require_relative 'cli/scaffold'
|
36
39
|
require_relative 'cli/project'
|
37
|
-
require_relative 'cli/documentation'
|
38
|
-
require_relative 'cli/init'
|
39
40
|
require_relative 'cli/develop'
|
40
41
|
|
41
|
-
# A.2. END
|
42
|
+
# A.2. END ---------------------------------------------------------------------
|
42
43
|
|
43
|
-
# A.3. INITIALISE DEPENDENCIES
|
44
|
+
# A.3. INITIALISE DEPENDENCIES -------------------------------------------------
|
44
45
|
|
45
46
|
msg = Util::Message.new()
|
46
47
|
fs = Util::FS.new()
|
47
|
-
|
48
|
+
sys = Util::System.new()
|
49
|
+
project = Konstruct::Project.new()
|
50
|
+
dev = Konstruct::Develop.new()
|
48
51
|
|
49
|
-
# A.3. END
|
52
|
+
# A.3. END ---------------------------------------------------------------------
|
50
53
|
|
51
|
-
# A. END
|
54
|
+
# A. END +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
52
55
|
|
53
|
-
# B. COMMANDER SCRIPT
|
56
|
+
# B. COMMANDER SCRIPT ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
54
57
|
|
55
|
-
# B.1. GLOBAL VARIABLES
|
58
|
+
# B.1. GLOBAL VARIABLES --------------------------------------------------------
|
56
59
|
|
57
60
|
projectDir = Dir.pwd
|
58
|
-
#projectDir = "/Users/traaidmark/Sites/traaidmark/projects/konstruct/testground/4--www" # FOR TESTING ONLY
|
59
61
|
|
60
|
-
# B.1. END
|
62
|
+
# B.1. END ---------------------------------------------------------------------
|
61
63
|
|
62
|
-
# B.1. PROGRAM META
|
64
|
+
# B.1. PROGRAM META ------------------------------------------------------------
|
63
65
|
|
64
66
|
program :version, Konstruct::VERSION
|
65
67
|
program :description, 'The Konstruct CLI provides scaffolding and other tools to help you get up and running quicker, and work faster.'
|
66
68
|
|
67
|
-
# B.1. END
|
69
|
+
# B.1. END ---------------------------------------------------------------------
|
68
70
|
|
69
|
-
# B.
|
71
|
+
# B. END +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
70
72
|
|
71
|
-
#
|
73
|
+
# C. SYSTEM TOOLS ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
72
74
|
|
73
|
-
#
|
75
|
+
# C.1. INSTALL SYSTEM ----------------------------------------------------------
|
74
76
|
|
75
77
|
command :init do |c|
|
76
|
-
|
77
|
-
c.syntax = 'konstruct init'
|
78
|
-
c.summary = 'Initialises the Konstruct Cli'
|
79
|
-
c.description = 'Initialises the Konstruct Cli by installing libraries and other extensions you might need.'
|
80
|
-
c.action do |args, options|
|
81
|
-
|
82
|
-
cli.init()
|
83
78
|
|
84
|
-
|
79
|
+
c.syntax = 'konstruct init'
|
80
|
+
c.summary = 'Installs local tools for Konstruc CLI'
|
81
|
+
c.description = 'Scaffolds a set of project folders from a template to help you organise your project better.'
|
82
|
+
c.action do |args, options|
|
83
|
+
|
84
|
+
sys.init()
|
85
|
+
|
86
|
+
end
|
85
87
|
|
86
88
|
end
|
87
89
|
|
88
|
-
|
90
|
+
# C.1. END ---------------------------------------------------------------------
|
89
91
|
|
90
|
-
#
|
92
|
+
# C. END +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
91
93
|
|
92
|
-
#
|
94
|
+
# C. PREFLIGHT CHECKS ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
93
95
|
|
94
|
-
|
96
|
+
sys.preflight()
|
95
97
|
|
96
|
-
#
|
98
|
+
# C.1. END ---------------------------------------------------------------------
|
97
99
|
|
98
|
-
|
99
|
-
|
100
|
-
c.syntax = 'konstruct scaffold'
|
101
|
-
c.summary = 'Launches Konstruct documentation in a browser'
|
102
|
-
c.description = 'Launches Konstruct documentation in a browser'
|
103
|
-
c.action do |args, options|
|
104
|
-
|
105
|
-
cli.scaffold(projectDir)
|
100
|
+
# C. END +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
106
101
|
|
107
|
-
|
102
|
+
# D. PROJECT TOOLS +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
103
|
+
|
104
|
+
# D.1. FOLDERS -----------------------------------------------------------------
|
105
|
+
|
106
|
+
command :folders do |c|
|
107
|
+
|
108
|
+
c.syntax = 'konstruct folders'
|
109
|
+
c.summary = 'Create preset project folders from a template.'
|
110
|
+
c.description = 'Scaffolds a set of project folders from a template to help you organise your project better.'
|
111
|
+
c.action do |args, options|
|
112
|
+
|
113
|
+
project.folders(projectDir)
|
114
|
+
|
115
|
+
end
|
108
116
|
|
109
117
|
end
|
110
118
|
|
111
|
-
#
|
119
|
+
# D.1. END ---------------------------------------------------------------------
|
112
120
|
|
113
|
-
#
|
121
|
+
# D.1. CREATE ---------------------------------------------------------------------------------------------------------
|
114
122
|
|
115
|
-
# --
|
123
|
+
# -- $ konstruct create
|
116
124
|
|
117
|
-
|
125
|
+
command :create do |c|
|
118
126
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
c.example 'Structure:', '[1--ci, 2--design, 3--working, 4--www]'
|
125
|
-
c.action do |args, options|
|
127
|
+
c.syntax = 'konstruct create [options]'
|
128
|
+
c.summary = 'Create a new Konstruct project.'
|
129
|
+
c.description = 'Creates a new starter project from the chosen flavours of Konstruct boilerplates.'
|
130
|
+
c.option '--sudo', 'Runs install tasks as root.'
|
131
|
+
c.action do |args, options|
|
126
132
|
|
127
|
-
|
133
|
+
options.default :sudo => false
|
128
134
|
|
129
|
-
|
135
|
+
project.create(projectDir, options.sudo)
|
136
|
+
|
137
|
+
end
|
130
138
|
|
131
139
|
end
|
132
140
|
|
133
|
-
#
|
141
|
+
# D.1. END ---------------------------------------------------------------------
|
134
142
|
|
135
|
-
#
|
143
|
+
# D.2. REFRESH ------------------------------------------------------------------
|
136
144
|
|
137
|
-
# --
|
145
|
+
# -- $ konstruct refresh
|
138
146
|
|
139
|
-
|
147
|
+
command :refresh do |c|
|
140
148
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
c.action do |args, options|
|
147
|
-
|
148
|
-
cli.develop(projectDir)
|
149
|
+
c.syntax = 'konstruct refresh [options]'
|
150
|
+
c.summary = 'Refresh external assets'
|
151
|
+
c.description = 'Re-installs NPM assets. Usefull when you pull an existing project that did not commit NPM assets.'
|
152
|
+
c.option '--sudo', 'Runs install tasks as root.'
|
153
|
+
c.action do |args, options|
|
149
154
|
|
150
|
-
|
155
|
+
options.default :sudo => false
|
151
156
|
|
152
|
-
|
157
|
+
project.create(projectDir, options.sudo)
|
153
158
|
|
154
|
-
|
159
|
+
end
|
155
160
|
|
156
|
-
|
161
|
+
end
|
162
|
+
|
163
|
+
# D.2. END ---------------------------------------------------------------------
|
157
164
|
|
158
|
-
#
|
165
|
+
# D.1. DOCUMENTATION -----------------------------------------------------------
|
159
166
|
|
160
|
-
# --
|
167
|
+
# -- $ konstruct command ::
|
161
168
|
|
162
169
|
command :documentation do |c|
|
163
|
-
|
170
|
+
|
164
171
|
c.syntax = 'konstruct documentation'
|
165
172
|
c.summary = 'Launches Konstruct documentation in a browser'
|
166
173
|
c.description = 'Launches Konstruct documentation in a browser'
|
167
174
|
c.action do |args, options|
|
168
175
|
|
169
|
-
|
176
|
+
project.documentation()
|
170
177
|
|
171
178
|
end
|
172
179
|
|
173
180
|
end
|
174
181
|
|
175
|
-
#
|
182
|
+
# D.1. END ---------------------------------------------------------------------
|
183
|
+
|
184
|
+
# D. END +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
185
|
+
|
186
|
+
# D. DEVELOPER TOOLS +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
187
|
+
|
188
|
+
# D.1. INSTALL -----------------------------------------------------------------
|
189
|
+
|
190
|
+
# -- $ konstruct create :: Installs a new Konstruct project & installs dependencies if you already have a project installed.
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
# D.1. END ---------------------------------------------------------------------
|
195
|
+
|
196
|
+
# D.1. WATCH -------------------------------------------------------------------
|
197
|
+
|
198
|
+
# -- $ konstruct command ::
|
199
|
+
|
200
|
+
command :watch do |c|
|
201
|
+
|
202
|
+
c.syntax = 'konstruct watch'
|
203
|
+
c.summary = 'Watch and process your work.'
|
204
|
+
c.description = 'Runs global konstruct.gulp process with various options to suit most development needs.'
|
205
|
+
c.option '--legacy', 'Run legacy gulp tasks.'
|
206
|
+
c.action do |args, options|
|
207
|
+
|
208
|
+
options.default :legacy => false
|
209
|
+
|
210
|
+
if options.legacy
|
211
|
+
|
212
|
+
dev.legacy(projectDir)
|
213
|
+
|
214
|
+
else
|
215
|
+
|
216
|
+
dev.watch(projectDir)
|
217
|
+
|
218
|
+
end
|
219
|
+
|
220
|
+
end
|
221
|
+
|
222
|
+
end
|
223
|
+
|
224
|
+
# D.1. END ---------------------------------------------------------------------
|
225
|
+
|
226
|
+
# D.3. BUILD -------------------------------------------------------------------
|
227
|
+
|
228
|
+
# -- $ konstruct command ::
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
# D.3. END ---------------------------------------------------------------------
|
233
|
+
|
234
|
+
# D.4. DEPLOY ------------------------------------------------------------------
|
235
|
+
|
236
|
+
# -- $ konstruct command ::
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
# D.4. END ---------------------------------------------------------------------
|
241
|
+
|
242
|
+
# D.5. RELEASE -----------------------------------------------------------------
|
243
|
+
|
244
|
+
# -- $ konstruct release --version ::
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
# D.5. END ---------------------------------------------------------------------
|
176
249
|
|
177
|
-
#
|
250
|
+
# D. END +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
178
251
|
|
179
|
-
# END OF FILE
|
252
|
+
# END OF FILE ==================================================================
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module Konstruct
|
2
|
+
|
3
|
+
TEMPLATE = {
|
4
|
+
"version" => Konstruct::VERSION,
|
5
|
+
"repo" => "https://github.com/konstruct/",
|
6
|
+
"folders" => ["1--ci","2--design","3--working","4--www"],
|
7
|
+
"recipes" => {
|
8
|
+
"html" => {
|
9
|
+
"boilerplate" => [
|
10
|
+
"",
|
11
|
+
"boilerplate.html.git",
|
12
|
+
"www",
|
13
|
+
""
|
14
|
+
],
|
15
|
+
"styles" => [
|
16
|
+
"/assets",
|
17
|
+
"konstruct.scss.git",
|
18
|
+
"lib",
|
19
|
+
"scss"
|
20
|
+
],
|
21
|
+
"scripts" => [
|
22
|
+
"/assets",
|
23
|
+
"konstruct.js.git",
|
24
|
+
"lib",
|
25
|
+
""
|
26
|
+
]
|
27
|
+
},
|
28
|
+
"jekyll" => {
|
29
|
+
"boilerplate" => [
|
30
|
+
"",
|
31
|
+
"boilerplate.jekyll.git",
|
32
|
+
"www",
|
33
|
+
""
|
34
|
+
],
|
35
|
+
"styles" => [
|
36
|
+
"/assets",
|
37
|
+
"konstruct.scss.git",
|
38
|
+
"lib",
|
39
|
+
"scss"
|
40
|
+
],
|
41
|
+
"scripts" => [
|
42
|
+
"/assets",
|
43
|
+
"konstruct.js.git",
|
44
|
+
"lib",
|
45
|
+
""
|
46
|
+
]
|
47
|
+
},
|
48
|
+
"angular" => {
|
49
|
+
"boilerplate" => [
|
50
|
+
"",
|
51
|
+
"boilerplate.angular.git",
|
52
|
+
"www",
|
53
|
+
""
|
54
|
+
],
|
55
|
+
"styles" => [
|
56
|
+
"/assets",
|
57
|
+
"konstruct.scss.git",
|
58
|
+
"lib",
|
59
|
+
"scss"
|
60
|
+
],
|
61
|
+
"scripts" => [
|
62
|
+
"/assets",
|
63
|
+
"konstruct.js.angular.git",
|
64
|
+
"lib",
|
65
|
+
""
|
66
|
+
]
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
end
|
data/lib/konstruct/version.rb
CHANGED
data/lib/utilities/gulp.rb
CHANGED
@@ -1,54 +1,44 @@
|
|
1
|
-
# KONSTRUCT CLI [ UTILITY MODULE ]
|
1
|
+
# KONSTRUCT CLI [ UTILITY MODULE ] =============================================
|
2
2
|
|
3
|
-
# ====== INDEX
|
3
|
+
# ====== INDEX ================================================================
|
4
4
|
# ==
|
5
|
-
# ==
|
5
|
+
# == 1. GULP MODULES
|
6
6
|
# ==
|
7
|
-
# ====== INDEX
|
7
|
+
# ====== INDEX ================================================================
|
8
8
|
|
9
|
-
#
|
9
|
+
# 1. GULP MODULES ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
10
10
|
|
11
11
|
module Util
|
12
|
-
|
13
|
-
#
|
14
|
-
|
12
|
+
|
13
|
+
# 1.1. GIT COMMANDS --------------------------------------------------------
|
14
|
+
|
15
15
|
class Gulp
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
exec "gulp --path #{path}"
|
31
|
-
|
32
|
-
else
|
33
|
-
|
34
|
-
msg.heading("Run `$ jekyll serve --watch` in a new terminal window.")
|
35
|
-
|
36
|
-
exec "gulp --noserve --path #{path}"
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
|
16
|
+
|
17
|
+
# 1.1.1. GULP DEFAULT
|
18
|
+
|
19
|
+
def default(path, stream)
|
20
|
+
|
21
|
+
gulp = Util::Gulp.new()
|
22
|
+
msg = Util::Message.new()
|
23
|
+
|
24
|
+
gulp_path = File.expand_path('~/.konstruct/gulp')
|
25
|
+
|
26
|
+
FileUtils.cd(gulp_path) do
|
27
|
+
|
28
|
+
exec "gulp --path #{path} --stream #{stream}"
|
29
|
+
|
42
30
|
end
|
43
|
-
|
44
|
-
|
45
|
-
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
# 1.1.1. END
|
35
|
+
|
46
36
|
end
|
47
|
-
|
48
|
-
#
|
49
|
-
|
37
|
+
|
38
|
+
# 1.1. END -----------------------------------------------------------------
|
39
|
+
|
50
40
|
end
|
51
41
|
|
52
|
-
# A. END
|
42
|
+
# A. END +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
53
43
|
|
54
|
-
# END OF FILE
|
44
|
+
# END OF FILE ==================================================================
|