besturder 0.3.0 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/besturder.rb +62 -56
- data/lib/packs.json +10 -14
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 291908ee6c031d98ec73ce7a4cf52da8af573f24
|
4
|
+
data.tar.gz: 4f75d6b991a1911ee1b3fbb78efb9692c66e58ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa1f8cd67146c41ced68df0ae9b173b0d994cff74a85c6d48ba5fee3d928033a3841c53dbe864deeb250d8d3c7a86b40046f67ec70138ada88db6f42dceabc9a
|
7
|
+
data.tar.gz: 9e90085c9d1475ea39cef7bfb1ab8fe570e888bda9833f8ba8018588dce7b56382b18c8ec70a86e7faff999ae8f84be2cc0b0a90e68727b1b3e1d2a4a5efa882
|
data/lib/besturder.rb
CHANGED
@@ -3,62 +3,68 @@ require "json"
|
|
3
3
|
$JSONFILE = "package.json"
|
4
4
|
$PACKS = JSON.parse(File.read("#{File.expand_path(File.dirname(__FILE__))}/packs.json"))
|
5
5
|
def download(key)
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
6
|
+
$PACKS[key]["dir"].each_index do |i|
|
7
|
+
unless File.exists? $PACKS[key]["dir"][i]
|
8
|
+
puts "Installing #{key}..."
|
9
|
+
File.open($PACKS[key]["dir"][i], "w") do |file|
|
10
|
+
opena = open($PACKS[key]['url'][i]).read
|
11
|
+
opena.lines.each do |line|
|
12
|
+
file << line
|
13
|
+
end
|
14
|
+
end
|
15
|
+
puts "The #{key} dependency has been installed"
|
16
|
+
else
|
17
|
+
puts "The dependency #{key} is already installed"
|
18
|
+
end
|
19
|
+
end
|
18
20
|
end
|
19
21
|
class Besturder
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
22
|
+
def main
|
23
|
+
if File.exist? $JSONFILE then
|
24
|
+
json = JSON.parse File.read $JSONFILE
|
25
|
+
dependencies = json["dependencies"]
|
26
|
+
if dependencies.size != 0 then
|
27
|
+
Dir.mkdir "js" unless Dir.exist? "js"
|
28
|
+
Dir.mkdir "css" unless Dir.exist? "css"
|
29
|
+
dependencies.each do |value|
|
30
|
+
value.downcase!
|
31
|
+
download(value) if $PACKS.keys.include? value
|
32
|
+
puts "The dependency #{value} doesn't exist" unless $PACKS.keys.include? value
|
33
|
+
end
|
34
|
+
else
|
35
|
+
puts "You don't have dependencies in your #{$JSONFILE}"
|
36
|
+
end
|
37
|
+
else
|
38
|
+
print "the file #{$JSONFILE} doesn't exist, do you want create it?[Y/N] "
|
39
|
+
s_n = gets.chomp
|
40
|
+
if s_n.upcase == "Y" then
|
41
|
+
print "\n Write the dependencies (separated by commas and without spaces): "
|
42
|
+
dependencia = gets.chomp
|
43
|
+
dependencia = dependencia.split(",")
|
44
|
+
dependencia.each { |a| a.downcase! }
|
45
|
+
json = {dependencies:dependencia}
|
46
|
+
json = JSON.pretty_generate json
|
47
|
+
file = File.open("#{$JSONFILE}", "w") do |b|
|
48
|
+
b << json
|
49
|
+
end
|
50
|
+
puts "File created without errors!"
|
51
|
+
else
|
52
|
+
exit
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
def singleinstall(key)
|
57
|
+
packs = JSON.parse(File.read("#{File.expand_path(File.dirname(__FILE__))}/packs.json"))
|
58
|
+
dir = packs[key]["dir"]
|
59
|
+
dir.each_index do |i|
|
60
|
+
unless File.exist? dir[i]
|
61
|
+
dirsplit = dir[i].split '/'
|
62
|
+
dir0 = dirsplit[0]
|
63
|
+
Dir.mkdir dir0 unless Dir.exist? dir0
|
64
|
+
download(key)
|
65
|
+
else
|
66
|
+
puts "The dependency #{key} is already installed"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
64
70
|
end
|
data/lib/packs.json
CHANGED
@@ -1,26 +1,22 @@
|
|
1
1
|
{
|
2
2
|
"jquery": {
|
3
|
-
"url":"http://code.jquery.com/jquery-latest.min.js",
|
4
|
-
"dir":"js/jquery.min.js"
|
3
|
+
"url":["http://code.jquery.com/jquery-latest.min.js"],
|
4
|
+
"dir":["js/jquery.min.js"]
|
5
5
|
},
|
6
6
|
"normalize": {
|
7
|
-
"url":"https://necolas.github.io/normalize.css/latest/normalize.css",
|
8
|
-
"dir":"css/normalize.css"
|
7
|
+
"url":["https://necolas.github.io/normalize.css/latest/normalize.css"],
|
8
|
+
"dir":["css/normalize.css"]
|
9
9
|
},
|
10
10
|
"dojo toolkit": {
|
11
|
-
"url":"http://ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js",
|
12
|
-
"dir":"js/dojo.js"
|
11
|
+
"url":["http://ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js"],
|
12
|
+
"dir":["js/dojo.js"]
|
13
13
|
},
|
14
14
|
"mootools core": {
|
15
|
-
"url":"https://ajax.googleapis.com/ajax/libs/mootools/1.5.2/mootools.min.js",
|
16
|
-
"dir":"js/mootools.min.js"
|
15
|
+
"url":["https://ajax.googleapis.com/ajax/libs/mootools/1.5.2/mootools.min.js"],
|
16
|
+
"dir":["js/mootools.min.js"]
|
17
17
|
},
|
18
18
|
"bootstrap": {
|
19
|
-
"url":"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css",
|
20
|
-
"dir":"css/bootstrap.min.css"
|
21
|
-
},
|
22
|
-
"bootstrapjs": {
|
23
|
-
"url":"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js",
|
24
|
-
"dir":"js/bootstrap.min.js"
|
19
|
+
"url":["https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css", "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"],
|
20
|
+
"dir":["css/bootstrap.min.css", "js/bootstrap.min.js"]
|
25
21
|
}
|
26
22
|
}
|