besturder 0.1.7 → 0.2.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/besturder.rb +45 -50
  3. data/lib/packs.json +2 -2
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 75e7c239ec84e98d0145c2ef62ee2a9415859654
4
- data.tar.gz: e7c442feffaa4de3f4070c12d5f4f95bb07d3a64
3
+ metadata.gz: 1aef84418be4a55465f9ccd76aad8514b7d40076
4
+ data.tar.gz: 38a7a99eb8bb5913d55d82c24fd826ec38f18fb0
5
5
  SHA512:
6
- metadata.gz: f330ae9bea261e9fb18742e8927aa2a9d7b62206b98eeca0209113f2a024f98d66fb27ca192bbd80350506e92b54d01a6b0d9fb18f0e8e39a01b3b445f3d8997
7
- data.tar.gz: d164d7f723b16ec32f239d094af9695a17984ec54ecf972074a9339a5211a0a906fe0f3a9f6e25a2be30f2d1f0df643f2cb882536ea7c8980000386807f2de59
6
+ metadata.gz: 3164fc5a4f02a32faed03daf706c04d01a9380b80cb249e8daf69477454f375352aae13eb49abdd57d0c50df95084af4e1ceefc45542b8aff2f46a03282a29a1
7
+ data.tar.gz: 6514e7d4b656d77c3121699ed7789231fc36f9012928733154e55fb553157ba161a830bd4f218f4f80e4ed080fce671fb8b853575ce631a0f4c96c3cf0269e95
@@ -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
- unless File.exists? $packs[key]["dir"]
7
- puts "Instalando la dependencia #{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 "Se ha instalado la dependencia #{key}!"
15
- else
16
- puts "Ya tienes instalada la dependencia #{key}"
17
- end
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
- 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 "No existe la dependencia #{value}" unless $packs.keys.include? value
30
- end
31
- else
32
- puts "No tienes dependencias en tu #{$jsonfile}"
33
- end
34
- else
35
- print "El fichero #{$jsonfile} no existe, desea crearlo?[Y/N]"
36
- s_n = gets.chomp
37
- if s_n.upcase == "Y" then
38
- print "\tNombre de la aplicación: "
39
- name = gets.chomp
40
- print "\tVersion de la aplicación: "
41
- version = gets.chomp
42
- print "\tAhora escriba las dependencias (separadas por comas y sin espacios): "
43
- dependencia = gets.chomp
44
- dependencia = dependencia.split(",")
45
- dependencia.each { |a| a.downcase! }
46
- json = {name:name,version:version,dependencies:dependencia}
47
- json = JSON.pretty_generate json
48
- file = File.open("#{$jsonfile}", "w") do |b|
49
- b << json
50
- end
51
- puts "Archivo creado sin errores!"
52
- puts "Vuelva a ejecutar el código"
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
@@ -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
- "dojotk": {
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
- "mootools_core": {
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
  },
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.1.7
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daviz