besturder 0.3.0 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/besturder.rb +62 -56
  3. data/lib/packs.json +10 -14
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 780eb6027f2b18193d7352218dec9f648b271f0d
4
- data.tar.gz: 1e54848e9d62a795cbe30454ebb6bebc5c7a6f7c
3
+ metadata.gz: 291908ee6c031d98ec73ce7a4cf52da8af573f24
4
+ data.tar.gz: 4f75d6b991a1911ee1b3fbb78efb9692c66e58ae
5
5
  SHA512:
6
- metadata.gz: 9bc5953b89253308869b54eab97f34b22f35b4c543e3532bc0f6851a05f3de30c47c09911d367e9a43a62147664428ff940dfe7b05b00dce4648b4b871e6eb09
7
- data.tar.gz: 230eda5ccaef3f150785ccab13f197663b24e9164ecb2f90c3dd7e5665c3d7a002c38037a8da277f78e0580d0797ae9aa8bc35d4972945bf359d38a26d087e11
6
+ metadata.gz: fa1f8cd67146c41ced68df0ae9b173b0d994cff74a85c6d48ba5fee3d928033a3841c53dbe864deeb250d8d3c7a86b40046f67ec70138ada88db6f42dceabc9a
7
+ data.tar.gz: 9e90085c9d1475ea39cef7bfb1ab8fe570e888bda9833f8ba8018588dce7b56382b18c8ec70a86e7faff999ae8f84be2cc0b0a90e68727b1b3e1d2a4a5efa882
@@ -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
- 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
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
- 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
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
@@ -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
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: besturder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daviz