konstruct 0.3.0 → 0.4.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 +3 -1
- data/konstruct.gemspec +7 -4
- data/lib/cli/gulp.rb +35 -0
- data/lib/cli/init.rb +142 -33
- data/lib/cli/scaffold.rb +187 -75
- data/lib/konstruct.rb +54 -5
- data/lib/konstruct/config.rb +22 -0
- data/lib/konstruct/version.rb +1 -1
- data/lib/utilities/git.rb +82 -0
- data/lib/utilities/{commands.rb → gulp.rb} +21 -19
- data/lib/utilities/utils.rb +44 -3
- metadata +21 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1ae69132b72d526e031e7a84a4e82597a7aeae53
|
|
4
|
+
data.tar.gz: 71247fa10d11ed3acc0094f898b5a33f0187c401
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: be77d386e4c962fbb3fcc3a33100f5acd88152712aec17b101ef7bd302c87d964ecd6aba9aeb497d31c2de6a853185f671aed850950eb8dbb1196fbc577051db
|
|
7
|
+
data.tar.gz: a8a646565efb5c8f1fefcf3b55b0ee209737e675772cf0fa582ee838ffecc48303a8a443751f64edf1f3fb8c5068bb3e9bf50ef77abe4b7d0810317ee5682e3b
|
data/README.md
CHANGED
data/konstruct.gemspec
CHANGED
|
@@ -18,10 +18,13 @@ Gem::Specification.new do |spec|
|
|
|
18
18
|
spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
|
19
19
|
spec.require_paths = ['lib']
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
dependencies = ['commander', 'minigit', 'paint', 'launchy', 'json']
|
|
22
|
+
|
|
23
|
+
dependencies.each { |d|
|
|
24
|
+
|
|
25
|
+
spec.add_dependency d
|
|
26
|
+
|
|
27
|
+
}
|
|
25
28
|
|
|
26
29
|
spec.add_development_dependency "bundler", "~> 1.11"
|
|
27
30
|
spec.add_development_dependency "rake", "~> 10.0"
|
data/lib/cli/gulp.rb
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# KONSTRUCT CLI [ KONSTRUCT MODULE ] ==================================================================================
|
|
2
|
+
|
|
3
|
+
# ====== INDEX =======================================================================================================
|
|
4
|
+
# ==
|
|
5
|
+
# == A. SKELETON PROJECT CREATOR
|
|
6
|
+
# ==
|
|
7
|
+
# ====== INDEX =======================================================================================================
|
|
8
|
+
|
|
9
|
+
# A. SKELETON PROJECT CREATOR +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
10
|
+
|
|
11
|
+
module Konstruct
|
|
12
|
+
|
|
13
|
+
class Cli
|
|
14
|
+
|
|
15
|
+
def gulp(path)
|
|
16
|
+
|
|
17
|
+
# B.1. INITIALISE FUNCTIONS -------------------------------------------------------------------------------
|
|
18
|
+
|
|
19
|
+
msg = Util::Message.new()
|
|
20
|
+
fs = Util::FS.new()
|
|
21
|
+
gulp = Util::Gulp.new()
|
|
22
|
+
|
|
23
|
+
# B.1. END ------------------------------------------------------------------------------------------------
|
|
24
|
+
|
|
25
|
+
gulp.default(path)
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# B. END ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
34
|
+
|
|
35
|
+
# END OF FILE =========================================================================================================
|
data/lib/cli/init.rb
CHANGED
|
@@ -17,45 +17,154 @@ module Konstruct
|
|
|
17
17
|
# B.1. INITIALISE FUNCTIONS -------------------------------------------------------------------------------
|
|
18
18
|
|
|
19
19
|
msg = Util::Message.new()
|
|
20
|
+
fs = Util::FS.new()
|
|
21
|
+
git = Util::Git.new()
|
|
22
|
+
|
|
23
|
+
config_dir = File.expand_path('~/.konstruct')
|
|
20
24
|
|
|
21
25
|
# B.1. END ------------------------------------------------------------------------------------------------
|
|
22
26
|
|
|
23
27
|
msg.heading("WELCOME TO THE KONSTRUCT CLI!")
|
|
24
28
|
|
|
25
|
-
# B.2.
|
|
29
|
+
# B.2. INIT VARIABLSE -------------------------------------------------------------------------------------
|
|
30
|
+
|
|
31
|
+
init = false
|
|
32
|
+
init_db = false
|
|
33
|
+
init_gulp = false
|
|
34
|
+
init_gulp_install = false
|
|
35
|
+
init_bower = false
|
|
36
|
+
|
|
37
|
+
dir_analytics = "#{config_dir}/analytics"
|
|
38
|
+
dir_gulp = "#{config_dir}/gulp"
|
|
39
|
+
|
|
40
|
+
# B.2. END ------------------------------------------------------------------------------------------------
|
|
41
|
+
|
|
42
|
+
# B.3. CHECK IF INIT SHOULD BE DONE -----------------------------------------------------------------------
|
|
43
|
+
|
|
44
|
+
if Dir[config_dir].length > 0
|
|
45
|
+
|
|
46
|
+
init = true
|
|
47
|
+
|
|
48
|
+
else
|
|
49
|
+
|
|
50
|
+
fs.make_dir(config_dir)
|
|
51
|
+
init = true
|
|
52
|
+
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# B.3. END ------------------------------------------------------------------------------------------------
|
|
56
|
+
|
|
57
|
+
# B.4. MAKE DATABASE.JSON ---------------------------------------------------------------------------------
|
|
58
|
+
|
|
59
|
+
if File.file?("#{dir_analytics}/data.json")
|
|
60
|
+
|
|
61
|
+
init_db = true
|
|
62
|
+
|
|
63
|
+
else
|
|
64
|
+
|
|
65
|
+
fs.make_dir(dir_analytics)
|
|
66
|
+
|
|
67
|
+
file_data = {
|
|
68
|
+
|
|
69
|
+
"konstruct_version" => Konstruct::VERSION
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
File.open("#{dir_analytics}/data.json","w") do |f|
|
|
74
|
+
f.write(JSON.pretty_generate(file_data))
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
msg.success("Created #{dir_analytics}/data.json")
|
|
78
|
+
|
|
79
|
+
init_db = true
|
|
80
|
+
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# B.4. END ------------------------------------------------------------------------------------------------
|
|
84
|
+
|
|
85
|
+
# B.5. CLONE GULP REPOSITORY ------------------------------------------------------------------------------
|
|
86
|
+
|
|
87
|
+
if Dir.exists?(dir_gulp)
|
|
88
|
+
|
|
89
|
+
init_gulp = true
|
|
90
|
+
|
|
91
|
+
else
|
|
92
|
+
|
|
93
|
+
fs.make_dir(dir_gulp)
|
|
94
|
+
|
|
95
|
+
git.install(dir_gulp, Konstruct::FRAMEWORK["gulp"], "gulp", "")
|
|
96
|
+
|
|
97
|
+
msg.success("Cloned Gulp to #{dir_gulp}")
|
|
98
|
+
|
|
99
|
+
init_gulp = true
|
|
100
|
+
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# B.5. END ------------------------------------------------------------------------------------------------
|
|
104
|
+
|
|
105
|
+
# B.6. INSTALL NPM ----------------------------------------------------------------------------------------
|
|
26
106
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
107
|
+
if Dir.exists?("#{dir_gulp}/node_modules")
|
|
108
|
+
|
|
109
|
+
init_gulp_install = true
|
|
110
|
+
|
|
111
|
+
else
|
|
112
|
+
|
|
113
|
+
msg.paragraph("Installing Gulp + Dependencies. This might take a while. ")
|
|
114
|
+
msg.paragraph("Please enter your root/admin password. NPM needs to install with sudo privileges.")
|
|
115
|
+
|
|
116
|
+
FileUtils.cd(dir_gulp) do
|
|
117
|
+
|
|
118
|
+
`npm install`
|
|
119
|
+
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
msg.success("Installed Gulp to #{dir_gulp}")
|
|
123
|
+
|
|
124
|
+
init_gulp_install = true
|
|
125
|
+
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# B.6. END ------------------------------------------------------------------------------------------------
|
|
129
|
+
|
|
130
|
+
# B.3. SHOW THE HELLO SCREEN ------------------------------------------------------------------------------
|
|
131
|
+
|
|
132
|
+
if init && init_db && init_gulp && init_gulp_install
|
|
133
|
+
|
|
134
|
+
puts ""
|
|
135
|
+
puts ""
|
|
136
|
+
puts Paint[' $III7IIIIIIIIIIIIIIIIIIIIIIIIII: ', "#de544b"]
|
|
137
|
+
puts Paint[' ZZZZZZ$7IIIIIIIIIIIIIIIIIIIIIIII ', "#de544b"]
|
|
138
|
+
puts Paint[' ZZZZZZZZZZZZ$7IIIIIIIIIIIIIIIIII ', "#de544b"]
|
|
139
|
+
puts Paint[' ZZZZZZZZZZZZZZZZZZZ$IIIIIIIIIIII~', "#de544b"]
|
|
140
|
+
puts Paint[' ZZZZZZZZZZZZZZZZZZZZZZZ:,:+IIIIII', "#de544b"]
|
|
141
|
+
puts Paint[' ZZZZZZZZZZZZZZZZZZZZZZ. :?', "#de544b"]
|
|
142
|
+
puts Paint[' I$ZZZZZZZZZZZZZZZZZZ7 ', "#de544b"]
|
|
143
|
+
puts Paint[' III$ZZZZZZZZZZZZZZZ~ ', "#de544b"]
|
|
144
|
+
puts Paint[' IIIII7ZZZZZZZZZZZZ ', "#de544b"]
|
|
145
|
+
puts Paint[' IIIIIII7ZZZZZZZZ$ ', "#de544b"]
|
|
146
|
+
puts Paint[' IIIIIIIIIIZZZZZ: ', "#de544b"]
|
|
147
|
+
puts Paint[' IIIIIIIIIIIIZI ', "#de544b"]
|
|
148
|
+
puts Paint[' IIIIIIIIIIIIII ', "#de544b"]
|
|
149
|
+
puts Paint[' IIIIIIIIIIIIIIII= ', "#de544b"]
|
|
150
|
+
puts Paint[' IIIIIIIIIIIIIIIII7= ', "#de544b"]
|
|
151
|
+
puts Paint[' IIIIIIIIIIIIIIIIIIII~ ', "#de544b"]
|
|
152
|
+
puts Paint[' IIIIIIIIIIIIIIIIIIIIII= ', "#de544b"]
|
|
153
|
+
puts Paint[' IIIIIIIIIIIIIIIIIIIIIII7~ ', "#de544b"]
|
|
154
|
+
puts Paint[' IIIIIIIIIIIIIIIIIIIIIIIIIII.. ', "#de544b"]
|
|
155
|
+
puts Paint[' IIIIIIIIIIIIIIIIIIIIIIIIIIII7 ', "#de544b"]
|
|
156
|
+
puts Paint[' IIIIIIIIIIIIIIIIIIIIIIIIIIIIIII,.', "#de544b"]
|
|
157
|
+
puts Paint[' IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII7', "#de544b"]
|
|
158
|
+
puts ""
|
|
159
|
+
puts ""
|
|
160
|
+
puts Paint[' GO BUILD SOMETHING AWESOME!', "#999999"]
|
|
161
|
+
puts ""
|
|
162
|
+
puts Paint[' Run "$ konstruct --help" or "$ konstruct documentation" whenever you get stuck!', "#999999"]
|
|
163
|
+
puts ""
|
|
164
|
+
|
|
165
|
+
exit(0)
|
|
166
|
+
|
|
167
|
+
end
|
|
59
168
|
|
|
60
169
|
# B.3. END ------------------------------------------------------------------------------------------------
|
|
61
170
|
|
data/lib/cli/scaffold.rb
CHANGED
|
@@ -2,96 +2,208 @@
|
|
|
2
2
|
|
|
3
3
|
# ====== INDEX =======================================================================================================
|
|
4
4
|
# ==
|
|
5
|
-
# == A.
|
|
6
|
-
# == A. COMMAND MODULES
|
|
5
|
+
# == A. SCAFFOLD A NEW SITE
|
|
7
6
|
# ==
|
|
8
7
|
# ====== INDEX =======================================================================================================
|
|
9
8
|
|
|
10
|
-
#
|
|
9
|
+
# A. SCAFFOLD A NEW SITE ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
11
10
|
|
|
12
|
-
module
|
|
13
|
-
|
|
14
|
-
# B.1. GIT COMMANDS -----------------------------------------------------------------------------------------------
|
|
11
|
+
module Konstruct
|
|
15
12
|
|
|
16
|
-
class
|
|
17
|
-
|
|
18
|
-
# B.1.1. INTRODUCTION
|
|
13
|
+
class Cli
|
|
19
14
|
|
|
20
|
-
def
|
|
21
|
-
|
|
22
|
-
puts ""
|
|
23
|
-
puts ""
|
|
24
|
-
puts Paint[' $III7IIIIIIIIIIIIIIIIIIIIIIIIII: ', "#de544b"]
|
|
25
|
-
puts Paint[' ZZZZZZ$7IIIIIIIIIIIIIIIIIIIIIIII ', "#de544b"]
|
|
26
|
-
puts Paint[' ZZZZZZZZZZZZ$7IIIIIIIIIIIIIIIIII ', "#de544b"]
|
|
27
|
-
puts Paint[' ZZZZZZZZZZZZZZZZZZZ$IIIIIIIIIIII~', "#de544b"]
|
|
28
|
-
puts Paint[' ZZZZZZZZZZZZZZZZZZZZZZZ:,:+IIIIII', "#de544b"]
|
|
29
|
-
puts Paint[' ZZZZZZZZZZZZZZZZZZZZZZ. :?', "#de544b"]
|
|
30
|
-
puts Paint[' I$ZZZZZZZZZZZZZZZZZZ7 ', "#de544b"]
|
|
31
|
-
puts Paint[' III$ZZZZZZZZZZZZZZZ~ ', "#de544b"]
|
|
32
|
-
puts Paint[' IIIII7ZZZZZZZZZZZZ ', "#de544b"]
|
|
33
|
-
puts Paint[' IIIIIII7ZZZZZZZZ$ ', "#de544b"]
|
|
34
|
-
puts Paint[' IIIIIIIIIIZZZZZ: ', "#de544b"]
|
|
35
|
-
puts Paint[' IIIIIIIIIIIIZI ', "#de544b"]
|
|
36
|
-
puts Paint[' IIIIIIIIIIIIII ', "#de544b"]
|
|
37
|
-
puts Paint[' IIIIIIIIIIIIIIII= ', "#de544b"]
|
|
38
|
-
puts Paint[' IIIIIIIIIIIIIIIII7= ', "#de544b"]
|
|
39
|
-
puts Paint[' IIIIIIIIIIIIIIIIIIII~ ', "#de544b"]
|
|
40
|
-
puts Paint[' IIIIIIIIIIIIIIIIIIIIII= ', "#de544b"]
|
|
41
|
-
puts Paint[' IIIIIIIIIIIIIIIIIIIIIII7~ ', "#de544b"]
|
|
42
|
-
puts Paint[' IIIIIIIIIIIIIIIIIIIIIIIIIII.. ', "#de544b"]
|
|
43
|
-
puts Paint[' IIIIIIIIIIIIIIIIIIIIIIIIIIII7 ', "#de544b"]
|
|
44
|
-
puts Paint[' IIIIIIIIIIIIIIIIIIIIIIIIIIIIIII,.', "#de544b"]
|
|
45
|
-
puts Paint[' IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII7', "#de544b"]
|
|
46
|
-
puts ""
|
|
47
|
-
puts ""
|
|
15
|
+
def scaffold(path)
|
|
48
16
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
17
|
+
# B.1. INITIALISE FUNCTIONS -------------------------------------------------------------------------------
|
|
18
|
+
|
|
19
|
+
msg = Util::Message.new()
|
|
20
|
+
fs = Util::FS.new()
|
|
21
|
+
git = Util::Git.new()
|
|
22
|
+
|
|
23
|
+
config_dir = "#{path}/.konstruct"
|
|
24
|
+
|
|
25
|
+
# B.1. END ------------------------------------------------------------------------------------------------
|
|
26
|
+
|
|
27
|
+
msg.heading("SCAFFOLDING A NEW SITE FOR YOU")
|
|
28
|
+
|
|
29
|
+
# B.2. IS YOUR DIRECTORY EMPTY? ---------------------------------------------------------------------------
|
|
60
30
|
|
|
61
|
-
|
|
31
|
+
fs.clear_directory(path)
|
|
32
|
+
|
|
33
|
+
# B.2. END ------------------------------------------------------------------------------------------------
|
|
34
|
+
|
|
35
|
+
# B.3. INSTALL BOILERPLATE --------------------------------------------------------------------------------
|
|
36
|
+
|
|
37
|
+
type = choose("What type of site are you building?", :Default, :Jekyll, :Angular)
|
|
38
|
+
|
|
39
|
+
if type == :Default
|
|
40
|
+
|
|
41
|
+
git.install(path, Konstruct::BOILERPLATE["Default"], "www", "")
|
|
42
|
+
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
if type == :Jekyll
|
|
46
|
+
|
|
47
|
+
git.install(path, Konstruct::BOILERPLATE["Jekyll"], "www", "")
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
if type == :Angular
|
|
52
|
+
|
|
53
|
+
git.install(path, Konstruct::BOILERPLATE["Angular"], "www", "")
|
|
54
|
+
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
msg.success("Successfully installed the #{ type } repository!");
|
|
58
|
+
|
|
59
|
+
# B.3. END ------------------------------------------------------------------------------------------------
|
|
60
|
+
|
|
61
|
+
# B.4. INSTALL CSS ----------------------------------------------------------------------------------------
|
|
62
|
+
|
|
63
|
+
css_dir = "#{path}/assets/css"
|
|
64
|
+
|
|
65
|
+
fs.make_dir(css_dir)
|
|
66
|
+
|
|
67
|
+
# B.4.1. INSTALL KONSTRUCT SCSS MODULE
|
|
68
|
+
|
|
69
|
+
git.install(css_dir, Konstruct::FRAMEWORK["scss"], "scss", "konstruct")
|
|
70
|
+
|
|
71
|
+
msg.success("Successfully installed the Konstruct SCSS framework!")
|
|
72
|
+
|
|
73
|
+
# B.4.1. END
|
|
74
|
+
|
|
75
|
+
# B.4.2. INSTALL KONSTRUCT SITE MODULE
|
|
76
|
+
|
|
77
|
+
git.install(css_dir, Konstruct::FRAMEWORK["site"], "site", "site")
|
|
78
|
+
|
|
79
|
+
msg.success("Successfully installed the Konstruct Site module")
|
|
80
|
+
|
|
81
|
+
# B.4.2. END
|
|
82
|
+
|
|
83
|
+
# B.4.1. INSTALL KONSTRUCT GLUE MODULE
|
|
84
|
+
|
|
85
|
+
git.install(css_dir, Konstruct::FRAMEWORK["glue"], "glue", "")
|
|
86
|
+
|
|
87
|
+
msg.success("Successfully installed the Konstruct Glue module")
|
|
88
|
+
|
|
89
|
+
# B.4.1. END
|
|
90
|
+
|
|
91
|
+
# B.4. END ------------------------------------------------------------------------------------------------
|
|
92
|
+
|
|
93
|
+
# B.5. INSTALL JS -----------------------------------------------------------------------------------------
|
|
94
|
+
|
|
95
|
+
js_dir = "#{path}/assets/js"
|
|
96
|
+
|
|
97
|
+
if type == :Angular
|
|
98
|
+
|
|
99
|
+
git.install(js_dir, Konstruct::FRAMEWORK["angular"], "scripts", "scripts")
|
|
100
|
+
|
|
101
|
+
msg.success("Successfully installed the Konstruct Angular module")
|
|
102
|
+
|
|
103
|
+
else
|
|
104
|
+
|
|
105
|
+
git.install(js_dir, Konstruct::FRAMEWORK["js"], "scripts", "scripts")
|
|
106
|
+
|
|
107
|
+
msg.success("Successfully installed the Konstruct JS module")
|
|
108
|
+
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# B.5. END ------------------------------------------------------------------------------------------------
|
|
112
|
+
|
|
113
|
+
# B.6. INSTALL NPM ASSETS ---------------------------------------------------------------------------------
|
|
114
|
+
|
|
115
|
+
`npm install`
|
|
116
|
+
msg.success("Installed NPM Assets")
|
|
117
|
+
|
|
118
|
+
# B.6. END ------------------------------------------------------------------------------------------------
|
|
119
|
+
|
|
120
|
+
# B.6. SET UP NEW GIT REPOSITORY --------------------------------------------------------------------------
|
|
121
|
+
|
|
122
|
+
want_git = choose("Want to initialise a git repository?", :Yes, :No)
|
|
123
|
+
|
|
124
|
+
if want_git == :Yes
|
|
125
|
+
|
|
126
|
+
git.init(path)
|
|
127
|
+
|
|
128
|
+
has_remote = choose("Do you already have a remote git repository?", :Yes, :No)
|
|
129
|
+
|
|
130
|
+
if has_remote == :Yes
|
|
131
|
+
|
|
132
|
+
remote_url = ask("Remote Url:")
|
|
133
|
+
|
|
134
|
+
git.remote(path, remote_url)
|
|
135
|
+
git.add(path)
|
|
136
|
+
|
|
137
|
+
msg.success("Successfully initialised your git repo")
|
|
138
|
+
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# B.6. END ------------------------------------------------------------------------------------------------
|
|
144
|
+
|
|
145
|
+
# B.4. INSTALL .konstruct ---------------------------------------------------------------------------------
|
|
146
|
+
|
|
147
|
+
fs.make_dir(config_dir)
|
|
148
|
+
|
|
149
|
+
date = Time.new
|
|
150
|
+
date_installed = "#{ date.year }-#{ date.month }-#{ date.day }"
|
|
151
|
+
|
|
152
|
+
file_data = {
|
|
153
|
+
|
|
154
|
+
"konstruct_version" => Konstruct::VERSION,
|
|
155
|
+
"date_installed" => date_installed,
|
|
156
|
+
"path" => path,
|
|
157
|
+
"type" => type,
|
|
158
|
+
"git_remote" => remote_url
|
|
159
|
+
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
File.open("#{config_dir}/data.json","w") do |f|
|
|
163
|
+
f.write(JSON.pretty_generate(file_data))
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
msg.success("Created #{config_dir}/data.json")
|
|
167
|
+
|
|
168
|
+
# B.4. END ------------------------------------------------------------------------------------------------
|
|
169
|
+
|
|
170
|
+
# B.5. SEND BUILD DATA TO ANALYTICS -----------------------------------------------------------------------
|
|
62
171
|
|
|
63
|
-
|
|
172
|
+
analytics_file = File.expand_path('~/.konstruct/analytics/data.json')
|
|
173
|
+
|
|
174
|
+
analytics_data = {
|
|
175
|
+
|
|
176
|
+
"site" => {
|
|
177
|
+
|
|
178
|
+
"path" => path,
|
|
179
|
+
"date" => date_installed,
|
|
180
|
+
"actions" => {
|
|
181
|
+
|
|
182
|
+
"action" => "Installed the site.",
|
|
183
|
+
"date" => date_installed
|
|
184
|
+
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
json = File.read(analytics_file)
|
|
192
|
+
|
|
193
|
+
File.open(analytics_file,"w") do |f|
|
|
194
|
+
f.write(JSON.pretty_generate(analytics_data))
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
msg.success("Logged Analytics to #{analytics_file}")
|
|
198
|
+
|
|
199
|
+
# B.5. END ------------------------------------------------------------------------------------------------
|
|
64
200
|
|
|
65
201
|
end
|
|
66
202
|
|
|
67
|
-
# B.1.1. END
|
|
68
|
-
|
|
69
|
-
# B.1.1. GET: SITE INFORMATION
|
|
70
|
-
|
|
71
|
-
# B.1.1. END
|
|
72
|
-
|
|
73
|
-
# B.1.1. DO: SCAFFOLD CHOSEN SITE
|
|
74
|
-
|
|
75
|
-
# B.1.1. END
|
|
76
|
-
|
|
77
|
-
# B.1.1. DO: CLEAN DIRECTORY
|
|
78
|
-
|
|
79
|
-
# B.1.1. END
|
|
80
|
-
|
|
81
|
-
# B.1.1. GET: INITIALISE GIT REPOSITORY?
|
|
82
|
-
|
|
83
|
-
# B.1.1. END
|
|
84
|
-
|
|
85
|
-
# B.1.1. DO: GIT REPO WORK
|
|
86
|
-
|
|
87
|
-
# B.1.1. END
|
|
88
|
-
|
|
89
203
|
end
|
|
90
204
|
|
|
91
|
-
# B.1. END --------------------------------------------------------------------------------------------------------
|
|
92
|
-
|
|
93
205
|
end
|
|
94
206
|
|
|
95
207
|
# B. END ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
96
208
|
|
|
97
|
-
# END OF FILE =========================================================================================================
|
|
209
|
+
# END OF FILE =========================================================================================================
|
data/lib/konstruct.rb
CHANGED
|
@@ -11,10 +11,13 @@
|
|
|
11
11
|
# A.1. EXTERNAL DEPENDENCIES ------------------------------------------------------------------------------------------
|
|
12
12
|
|
|
13
13
|
require "konstruct/version"
|
|
14
|
+
require "konstruct/config"
|
|
14
15
|
require 'rubygems'
|
|
15
16
|
require 'commander/import'
|
|
16
17
|
require 'paint'
|
|
17
18
|
require 'launchy'
|
|
19
|
+
require 'minigit'
|
|
20
|
+
require 'json'
|
|
18
21
|
|
|
19
22
|
# A.1. END ------------------------------------------------------------------------------------------------------------
|
|
20
23
|
|
|
@@ -23,6 +26,8 @@ require 'launchy'
|
|
|
23
26
|
#A.2.1. UTILITIES
|
|
24
27
|
|
|
25
28
|
require_relative 'utilities/utils'
|
|
29
|
+
require_relative 'utilities/gulp'
|
|
30
|
+
require_relative 'utilities/git'
|
|
26
31
|
|
|
27
32
|
# A.2.2. CLI SCRIPTS
|
|
28
33
|
|
|
@@ -30,6 +35,7 @@ require_relative 'cli/scaffold'
|
|
|
30
35
|
require_relative 'cli/skeleton'
|
|
31
36
|
require_relative 'cli/documentation'
|
|
32
37
|
require_relative 'cli/init'
|
|
38
|
+
require_relative 'cli/gulp'
|
|
33
39
|
|
|
34
40
|
# A.2. END ------------------------------------------------------------------------------------------------------------
|
|
35
41
|
|
|
@@ -48,12 +54,13 @@ cli = Konstruct::Cli.new()
|
|
|
48
54
|
# B.1. GLOBAL VARIABLES -----------------------------------------------------------------------------------------------
|
|
49
55
|
|
|
50
56
|
projectDir = Dir.pwd
|
|
57
|
+
#projectDir = "/Users/traaidmark/Sites/traaidmark/projects/konstruct/testground/4--www" # FOR TESTING ONLY
|
|
51
58
|
|
|
52
59
|
# B.1. END ------------------------------------------------------------------------------------------------------------
|
|
53
60
|
|
|
54
61
|
# B.1. PROGRAM META ---------------------------------------------------------------------------------------------------
|
|
55
62
|
|
|
56
|
-
program :version,
|
|
63
|
+
program :version, Konstruct::VERSION
|
|
57
64
|
program :description, 'The Konstruct CLI provides scaffolding and other tools to help you get up and running quicker, and work faster.'
|
|
58
65
|
|
|
59
66
|
# B.1. END ------------------------------------------------------------------------------------------------------------
|
|
@@ -81,7 +88,28 @@ default_command :init
|
|
|
81
88
|
|
|
82
89
|
# B.2. END ------------------------------------------------------------------------------------------------------------
|
|
83
90
|
|
|
84
|
-
# B.3. COMMAND:
|
|
91
|
+
# B.3. COMMAND: SCAFFOLD -----------------------------------------------------------------------------------------
|
|
92
|
+
|
|
93
|
+
# -- DESCRIPTION: Launches Konstruct documentation in a browser
|
|
94
|
+
|
|
95
|
+
# -- USAGE: $ konstruct documentation
|
|
96
|
+
|
|
97
|
+
command :scaffold do |c|
|
|
98
|
+
|
|
99
|
+
c.syntax = 'konstruct scaffold'
|
|
100
|
+
c.summary = 'Launches Konstruct documentation in a browser'
|
|
101
|
+
c.description = 'Launches Konstruct documentation in a browser'
|
|
102
|
+
c.action do |args, options|
|
|
103
|
+
|
|
104
|
+
cli.scaffold(projectDir)
|
|
105
|
+
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# B.3. END ------------------------------------------------------------------------------------------------------------
|
|
111
|
+
|
|
112
|
+
# B.4. COMMAND: SKELETON ----------------------------------------------------------------------------------------------
|
|
85
113
|
|
|
86
114
|
# -- DESCRIPTION: Scaffolds a skeleton project folder structure for you.
|
|
87
115
|
|
|
@@ -101,9 +129,30 @@ command :skeleton do |c|
|
|
|
101
129
|
|
|
102
130
|
end
|
|
103
131
|
|
|
104
|
-
# B.
|
|
132
|
+
# B.4. END ------------------------------------------------------------------------------------------------------------
|
|
105
133
|
|
|
106
|
-
# B.
|
|
134
|
+
# B.5. COMMAND: GULP --------------------------------------------------------------------------------------------------
|
|
135
|
+
|
|
136
|
+
# -- DESCRIPTION: Launches Konstruct documentation in a browser
|
|
137
|
+
|
|
138
|
+
# -- USAGE: $ konstruct documentation
|
|
139
|
+
|
|
140
|
+
command :gulp do |c|
|
|
141
|
+
|
|
142
|
+
c.syntax = 'konstruct gulp'
|
|
143
|
+
c.summary = 'Launches Konstruct Gulp tasks while you develop.'
|
|
144
|
+
c.description = 'Launches Konstruct Gulp tasks while you develop.'
|
|
145
|
+
c.action do |args, options|
|
|
146
|
+
|
|
147
|
+
cli.gulp(projectDir)
|
|
148
|
+
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# B.5. END ------------------------------------------------------------------------------------------------------------
|
|
154
|
+
|
|
155
|
+
# B.5. COMMAND: DOCUMENTATION -----------------------------------------------------------------------------------------
|
|
107
156
|
|
|
108
157
|
# -- DESCRIPTION: Launches Konstruct documentation in a browser
|
|
109
158
|
|
|
@@ -122,7 +171,7 @@ command :documentation do |c|
|
|
|
122
171
|
|
|
123
172
|
end
|
|
124
173
|
|
|
125
|
-
# B.
|
|
174
|
+
# B.5. END ------------------------------------------------------------------------------------------------------------
|
|
126
175
|
|
|
127
176
|
# B. END ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
128
177
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module Konstruct
|
|
2
|
+
|
|
3
|
+
BOILERPLATE = {
|
|
4
|
+
|
|
5
|
+
"Default" => "https://github.com/konstruct/boilerplate.www",
|
|
6
|
+
"Jekyll" => "https://github.com/konstruct/boilerplate.jekyll",
|
|
7
|
+
"Angular" => "https://github.com/konstruct/boilerplate.angular"
|
|
8
|
+
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
FRAMEWORK = {
|
|
12
|
+
|
|
13
|
+
"gulp" => "https://github.com/konstruct/konstruct.gulp.git",
|
|
14
|
+
"scss" => "https://github.com/konstruct/konstruct.scss.git",
|
|
15
|
+
"site" => "https://github.com/konstruct/konstruct.site.git",
|
|
16
|
+
"glue" => "https://github.com/konstruct/konstruct.glue.git",
|
|
17
|
+
"angular" => "https://github.com/konstruct/konstruct.angular.git",
|
|
18
|
+
"js" => "https://github.com/konstruct/konstruct.js.git"
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
end
|
data/lib/konstruct/version.rb
CHANGED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# KONSTRUCT CLI [ UTILITY MODULE ] ====================================================================================
|
|
2
|
+
|
|
3
|
+
# ====== INDEX =======================================================================================================
|
|
4
|
+
# ==
|
|
5
|
+
# == A. LOAD DEPENDENCIES
|
|
6
|
+
# == B. GIT MODULES
|
|
7
|
+
# ==
|
|
8
|
+
# ====== INDEX =======================================================================================================
|
|
9
|
+
|
|
10
|
+
# A. UTILITIES ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
11
|
+
|
|
12
|
+
module Util
|
|
13
|
+
|
|
14
|
+
# A.1. GIT COMMANDS -----------------------------------------------------------------------------------------------
|
|
15
|
+
|
|
16
|
+
class Git
|
|
17
|
+
|
|
18
|
+
# A.1.1. GIT INSTALL
|
|
19
|
+
|
|
20
|
+
def install(path, repository, target, dest)
|
|
21
|
+
|
|
22
|
+
`git clone #{repository} "#{path}/.tmp"`
|
|
23
|
+
|
|
24
|
+
FileUtils.copy_entry("#{path}/.tmp/#{target}", "#{path}/#{dest}")
|
|
25
|
+
|
|
26
|
+
FileUtils.rm_rf(Dir.glob("#{path}/.tmp"))
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# A.1.1. END
|
|
31
|
+
|
|
32
|
+
# A.1.2. GIT INIT
|
|
33
|
+
|
|
34
|
+
def init(path)
|
|
35
|
+
|
|
36
|
+
FileUtils.cd(path) do
|
|
37
|
+
|
|
38
|
+
`git init`
|
|
39
|
+
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# A.1.2. END
|
|
45
|
+
|
|
46
|
+
# A.1.3. GIT REMOTE
|
|
47
|
+
|
|
48
|
+
def remote(path, remote)
|
|
49
|
+
|
|
50
|
+
FileUtils.cd(path) do
|
|
51
|
+
|
|
52
|
+
`git remote add origin #{remote}`
|
|
53
|
+
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# A.1.3. END
|
|
59
|
+
|
|
60
|
+
# A.1.4. GIT SCAFFOLD
|
|
61
|
+
|
|
62
|
+
def add(path)
|
|
63
|
+
|
|
64
|
+
FileUtils.cd(path) do
|
|
65
|
+
|
|
66
|
+
`git add *`
|
|
67
|
+
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# A.1.4. END
|
|
73
|
+
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# A.1. END --------------------------------------------------------------------------------------------------------
|
|
77
|
+
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# A. END ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
81
|
+
|
|
82
|
+
# END OF FILE =========================================================================================================
|
|
@@ -1,42 +1,44 @@
|
|
|
1
|
-
# KONSTRUCT CLI [
|
|
1
|
+
# KONSTRUCT CLI [ UTILITY MODULE ] ====================================================================================
|
|
2
2
|
|
|
3
3
|
# ====== INDEX =======================================================================================================
|
|
4
4
|
# ==
|
|
5
|
-
# == A.
|
|
6
|
-
# == A. COMMAND MODULES
|
|
5
|
+
# == A. GULP MODULES
|
|
7
6
|
# ==
|
|
8
7
|
# ====== INDEX =======================================================================================================
|
|
9
8
|
|
|
10
|
-
# A.
|
|
9
|
+
# A. GULP MODULES +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# A. END ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
15
|
-
|
|
16
|
-
# B. COMMANDER SCRIPT +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
17
|
-
|
|
18
|
-
module Command
|
|
11
|
+
module Util
|
|
19
12
|
|
|
20
|
-
#
|
|
13
|
+
# A.1. GIT COMMANDS -----------------------------------------------------------------------------------------------
|
|
21
14
|
|
|
22
|
-
class
|
|
15
|
+
class Gulp
|
|
23
16
|
|
|
24
|
-
#
|
|
17
|
+
# A.1.1. GULP BUILD
|
|
25
18
|
|
|
26
|
-
def
|
|
19
|
+
def default(path)
|
|
27
20
|
|
|
28
|
-
|
|
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}"
|
|
29
|
+
|
|
30
|
+
end
|
|
29
31
|
|
|
30
32
|
end
|
|
31
33
|
|
|
32
|
-
#
|
|
34
|
+
# A.1.1. END
|
|
33
35
|
|
|
34
36
|
end
|
|
35
37
|
|
|
36
|
-
#
|
|
38
|
+
# A.1. END --------------------------------------------------------------------------------------------------------
|
|
37
39
|
|
|
38
40
|
end
|
|
39
41
|
|
|
40
|
-
#
|
|
42
|
+
# A. END ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
41
43
|
|
|
42
44
|
# END OF FILE =========================================================================================================
|
data/lib/utilities/utils.rb
CHANGED
|
@@ -82,6 +82,20 @@ module Util
|
|
|
82
82
|
|
|
83
83
|
# B.1.4. END
|
|
84
84
|
|
|
85
|
+
# B.1.5. PARAGRAPH
|
|
86
|
+
|
|
87
|
+
def paragraph(msg)
|
|
88
|
+
|
|
89
|
+
puts ""
|
|
90
|
+
|
|
91
|
+
puts Paint[msg, "999999"]
|
|
92
|
+
|
|
93
|
+
puts ""
|
|
94
|
+
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# B.1.5. END
|
|
98
|
+
|
|
85
99
|
end
|
|
86
100
|
|
|
87
101
|
# B.1. END --------------------------------------------------------------------------------------------------------
|
|
@@ -134,9 +148,7 @@ module Util
|
|
|
134
148
|
|
|
135
149
|
if choice == :yes
|
|
136
150
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
FileUtils.rm_rf(Dir.glob(toClear))
|
|
151
|
+
`rm -rf *`
|
|
140
152
|
|
|
141
153
|
msg.success("Working directory cleared: #{path}")
|
|
142
154
|
|
|
@@ -153,6 +165,35 @@ module Util
|
|
|
153
165
|
|
|
154
166
|
# B.2.2. END
|
|
155
167
|
|
|
168
|
+
# B.2.3. CLEAN DIRECTORY
|
|
169
|
+
|
|
170
|
+
def delete_files(path)
|
|
171
|
+
|
|
172
|
+
msg = Util::Message.new()
|
|
173
|
+
|
|
174
|
+
FileUtils.rm_rf(path)
|
|
175
|
+
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# B.2.3. END
|
|
179
|
+
|
|
180
|
+
# B.2.3. CLEAN DIRECTORY
|
|
181
|
+
|
|
182
|
+
def make_dir(dir)
|
|
183
|
+
|
|
184
|
+
msg = Util::Message.new()
|
|
185
|
+
|
|
186
|
+
unless Dir[dir].length > 0
|
|
187
|
+
|
|
188
|
+
FileUtils.mkdir(dir)
|
|
189
|
+
msg.success("Created #{dir}")
|
|
190
|
+
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# B.2.3. END
|
|
196
|
+
|
|
156
197
|
end
|
|
157
198
|
|
|
158
199
|
# B.2. END --------------------------------------------------------------------------------------------------------
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: konstruct
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Adrian Kirsten
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-01-
|
|
11
|
+
date: 2016-01-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: commander
|
|
@@ -66,6 +66,20 @@ dependencies:
|
|
|
66
66
|
- - ">="
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
68
|
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: json
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :runtime
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
69
83
|
- !ruby/object:Gem::Dependency
|
|
70
84
|
name: bundler
|
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -117,12 +131,15 @@ files:
|
|
|
117
131
|
- bin/setup
|
|
118
132
|
- konstruct.gemspec
|
|
119
133
|
- lib/cli/documentation.rb
|
|
134
|
+
- lib/cli/gulp.rb
|
|
120
135
|
- lib/cli/init.rb
|
|
121
136
|
- lib/cli/scaffold.rb
|
|
122
137
|
- lib/cli/skeleton.rb
|
|
123
138
|
- lib/konstruct.rb
|
|
139
|
+
- lib/konstruct/config.rb
|
|
124
140
|
- lib/konstruct/version.rb
|
|
125
|
-
- lib/utilities/
|
|
141
|
+
- lib/utilities/git.rb
|
|
142
|
+
- lib/utilities/gulp.rb
|
|
126
143
|
- lib/utilities/utils.rb
|
|
127
144
|
homepage: https://github.com/konstruct/konstruct.cli
|
|
128
145
|
licenses:
|
|
@@ -144,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
144
161
|
version: '0'
|
|
145
162
|
requirements: []
|
|
146
163
|
rubyforge_project:
|
|
147
|
-
rubygems_version: 2.
|
|
164
|
+
rubygems_version: 2.5.1
|
|
148
165
|
signing_key:
|
|
149
166
|
specification_version: 4
|
|
150
167
|
summary: A set of tools to help you work with the Konstruct Framework.
|