besturder 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/besturder +11 -1
- data/lib/besturder.rb +59 -48
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 780eb6027f2b18193d7352218dec9f648b271f0d
|
4
|
+
data.tar.gz: 1e54848e9d62a795cbe30454ebb6bebc5c7a6f7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bc5953b89253308869b54eab97f34b22f35b4c543e3532bc0f6851a05f3de30c47c09911d367e9a43a62147664428ff940dfe7b05b00dce4648b4b871e6eb09
|
7
|
+
data.tar.gz: 230eda5ccaef3f150785ccab13f197663b24e9164ecb2f90c3dd7e5665c3d7a002c38037a8da277f78e0580d0797ae9aa8bc35d4972945bf359d38a26d087e11
|
data/bin/besturder
CHANGED
data/lib/besturder.rb
CHANGED
@@ -1,53 +1,64 @@
|
|
1
1
|
require "open-uri"
|
2
2
|
require "json"
|
3
|
-
$
|
4
|
-
$
|
3
|
+
$JSONFILE = "package.json"
|
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
|
-
|
20
|
+
def main
|
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.downcase.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
|
53
|
+
def singleinstall(key)
|
54
|
+
dir = $PACKS[key]["dir"]
|
55
|
+
unless File.exists? dir
|
56
|
+
dir = dir.split '/'
|
57
|
+
dir0 = dir[0]
|
58
|
+
Dir.mkdir dir0 unless Dir.exist? dir0
|
59
|
+
download(key)
|
60
|
+
else
|
61
|
+
puts "The dependency #{key} is already installed"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: besturder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daviz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Besturder is a simple package manager for HTML5
|
14
14
|
email: roman.daco.st@gmail.com
|