besturder 0.1.7 → 0.2.0
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 +45 -50
- data/lib/packs.json +2 -2
- 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: 1aef84418be4a55465f9ccd76aad8514b7d40076
|
4
|
+
data.tar.gz: 38a7a99eb8bb5913d55d82c24fd826ec38f18fb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3164fc5a4f02a32faed03daf706c04d01a9380b80cb249e8daf69477454f375352aae13eb49abdd57d0c50df95084af4e1ceefc45542b8aff2f46a03282a29a1
|
7
|
+
data.tar.gz: 6514e7d4b656d77c3121699ed7789231fc36f9012928733154e55fb553157ba161a830bd4f218f4f80e4ed080fce671fb8b853575ce631a0f4c96c3cf0269e95
|
data/lib/besturder.rb
CHANGED
@@ -3,56 +3,51 @@ 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
|
+
unless File.exists? $packs[key]["dir"]
|
7
|
+
puts "Installing #{key}..."
|
8
|
+
File.open($packs[key]["dir"], "w") do |file|
|
9
|
+
opena = open($packs[key]['url']).read
|
10
|
+
opena.lines.each do |line|
|
11
|
+
file << line
|
12
|
+
end
|
13
|
+
end
|
14
|
+
puts "The #{key} dependency has been installed"
|
15
|
+
else
|
16
|
+
puts "The dependency #{key} is already installed"
|
17
|
+
end
|
18
18
|
end
|
19
19
|
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
|
-
else
|
54
|
-
exit
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
20
|
+
def initialize
|
21
|
+
if File.exist? $jsonfile then
|
22
|
+
json = JSON.parse File.read $jsonfile
|
23
|
+
dependencies = json["dependencies"]
|
24
|
+
if dependencies.size != 0 then
|
25
|
+
Dir.mkdir "js" unless Dir.exist? "js"
|
26
|
+
Dir.mkdir "css" unless Dir.exist? "css"
|
27
|
+
dependencies.each do |value|
|
28
|
+
download(value) if $packs.keys.include? value
|
29
|
+
puts "The dependency #{value} doesn't exist" unless $packs.keys.include? value
|
30
|
+
end
|
31
|
+
else
|
32
|
+
puts "You don't have dependencies in your #{jsonfile}"
|
33
|
+
end
|
34
|
+
else
|
35
|
+
print "the file #{jsonfile} doesn't exist, do you want create it?[Y/N] "
|
36
|
+
s_n = gets.chomp
|
37
|
+
if s_n.upcase == "Y" then
|
38
|
+
print "\tWrite the dependencies (separated by commas and without spaces): "
|
39
|
+
dependencia = gets.chomp
|
40
|
+
dependencia = dependencia.split(",")
|
41
|
+
dependencia.each { |a| a.downcase! }
|
42
|
+
json = {name:name,version:version,dependencies:dependencia}
|
43
|
+
json = JSON.pretty_generate json
|
44
|
+
file = File.open("#{$jsonfile}", "w") do |b|
|
45
|
+
b << json
|
46
|
+
end
|
47
|
+
puts "File created without errors!"
|
48
|
+
else
|
49
|
+
exit
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
58
53
|
end
|
data/lib/packs.json
CHANGED
@@ -7,11 +7,11 @@
|
|
7
7
|
"url":"https://necolas.github.io/normalize.css/latest/normalize.css",
|
8
8
|
"dir":"css/normalize.css"
|
9
9
|
},
|
10
|
-
"
|
10
|
+
"dojo toolkit": {
|
11
11
|
"url":"http://ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js",
|
12
12
|
"dir":"js/dojo.js"
|
13
13
|
},
|
14
|
-
"
|
14
|
+
"mootools core": {
|
15
15
|
"url":"https://ajax.googleapis.com/ajax/libs/mootools/1.5.2/mootools.min.js",
|
16
16
|
"dir":"js/mootools.min.js"
|
17
17
|
},
|