farmstead 0.0.81 → 0.0.82
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/farmstead/db.rb +28 -9
- data/lib/farmstead/version.rb +1 -1
- 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: 00b654e9c00ebc50dbbcce44940a3577f9e66edc
|
4
|
+
data.tar.gz: 8bac8a053968bbaaaa3ccb41d002088815bb2916
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afa1c40fe179f4c2b782a9e3fa68680d06b01b3206ee47087633e57e2000d41a2d77336d1f138238a30889076ac6ef84efa53469696d80dc0be4b732437f74dd
|
7
|
+
data.tar.gz: 215d180256368059255083580b2a86cf58873f764d92746358009d514723f758aa271e5bb1d39bc53ac14cc44eb3b8074cff58b9b387443bc4c5740adc0c3489
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
farmstead (0.0.
|
4
|
+
farmstead (0.0.82)
|
5
5
|
httparty (~> 0.15.6)
|
6
6
|
mechanize (~> 2.7)
|
7
7
|
mysql2 (~> 0.4.10)
|
@@ -50,7 +50,7 @@ GEM
|
|
50
50
|
mysql2 (0.4.10)
|
51
51
|
net-http-digest_auth (1.4.1)
|
52
52
|
net-http-persistent (2.9.4)
|
53
|
-
nokogiri (1.8.
|
53
|
+
nokogiri (1.8.2)
|
54
54
|
mini_portile2 (~> 2.3.0)
|
55
55
|
ntlm-http (0.1.1)
|
56
56
|
os (1.0.0)
|
data/lib/farmstead/db.rb
CHANGED
@@ -43,21 +43,40 @@ module Farmstead
|
|
43
43
|
puts ds.all
|
44
44
|
end
|
45
45
|
|
46
|
-
|
47
|
-
def self.insert(table,array)
|
46
|
+
def self.insert(table, hash)
|
48
47
|
self.pull_variables
|
49
|
-
|
50
|
-
|
48
|
+
string = "INSERT INTO #{table} ("
|
49
|
+
hash.each_with_index do |(key, value), index|
|
50
|
+
string = string + key.to_s
|
51
|
+
unless index == 1
|
52
|
+
string = string + ","
|
53
|
+
end
|
54
|
+
end
|
55
|
+
string = string + ") VALUES ("
|
56
|
+
hash.each_with_index do |(key, value), index|
|
57
|
+
string = string + "'" + value + "'"
|
58
|
+
unless index == 1
|
59
|
+
string = string + ","
|
60
|
+
end
|
61
|
+
end
|
62
|
+
string = string + ")"
|
63
|
+
puts string
|
64
|
+
@@DB.run string
|
51
65
|
end
|
52
66
|
|
67
|
+
# For now keep it simple
|
53
68
|
def self.create_table(table, hash)
|
54
69
|
self.pull_variables
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
70
|
+
string = "CREATE TABLE IF NOT EXISTS #{table} (id integer primary key, "
|
71
|
+
hash.each_with_index do |(key, value), index|
|
72
|
+
string = string + key.to_s + " " + value
|
73
|
+
unless index == 1
|
74
|
+
string = string + ","
|
75
|
+
end
|
60
76
|
end
|
77
|
+
string = string + ")"
|
78
|
+
puts string
|
79
|
+
@@DB.run string
|
61
80
|
end
|
62
81
|
|
63
82
|
# Insert an array of values into a table
|
data/lib/farmstead/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: farmstead
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.82
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ken Jenney
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|