farmstead 0.0.86 → 0.0.87

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f0899567bd40fc4ff0078c240c1b45601aa59150
4
- data.tar.gz: c549929e975690c27cd379725a08bd751745242a
3
+ metadata.gz: 5e09b815a7a63b725f6e2d723f2bb09287530eda
4
+ data.tar.gz: 4710c794296aa0004eadf477cb219816ed418cab
5
5
  SHA512:
6
- metadata.gz: eec1107db0c3a267bfc8cbc8b85afbea90c109287dc02c44a89b082bb624f0b58e4bb28d70cc502f2c999c0406047e649e8d0125331d566ea140e158c6d7ee29
7
- data.tar.gz: 7971b213a236620f123284252b700da4ffa7dbd82a19e0b0f893892108ab89f283526aac636850aed2aa1579c2331b2ebaf230391427763ddc51934b9d1daaf3
6
+ metadata.gz: 184c8e940ea27b2dba8d729b291c1da6872b47bd92aa2d4efce8e65c8fee25af113f9122811e2630715b1e12b07fdac9da10996f822c15852a0eb177118e1b9c
7
+ data.tar.gz: cd8302fb0187ae2b5eb4dcd104884cea6c53981ac5b5b66ca550ca1324313ea460d9711e9d34e07d4d15c910231622f42909691735716167157207e8a918656b
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- farmstead (0.0.86)
4
+ farmstead (0.0.87)
5
5
  httparty (~> 0.15.6)
6
6
  mechanize (~> 2.7)
7
7
  mysql2 (~> 0.4.10)
@@ -9,8 +9,8 @@ PATH
9
9
  os (~> 1.0)
10
10
  ruby-kafka (~> 0.5.1)
11
11
  sequel (~> 5.4.0)
12
- sinatra (~> 2.0.0)
13
- sinatra-contrib (~> 2.0.0)
12
+ sinatra (~> 2.0.1)
13
+ sinatra-contrib (~> 2.0.1)
14
14
  thor (~> 0.20.0)
15
15
 
16
16
  GEM
@@ -26,7 +26,7 @@ GEM
26
26
  ffi (1.9.18)
27
27
  http-cookie (1.0.3)
28
28
  domain_name (~> 0.5)
29
- httparty (0.15.6)
29
+ httparty (0.15.7)
30
30
  multi_xml (>= 0.5.2)
31
31
  listen (3.0.8)
32
32
  rb-fsevent (~> 0.9, >= 0.9.4)
@@ -46,7 +46,7 @@ GEM
46
46
  mini_portile2 (2.3.0)
47
47
  multi_json (1.13.1)
48
48
  multi_xml (0.6.0)
49
- mustermann (1.0.1)
49
+ mustermann (1.0.2)
50
50
  mysql2 (0.4.10)
51
51
  net-http-digest_auth (1.4.1)
52
52
  net-http-persistent (2.9.4)
@@ -54,8 +54,8 @@ GEM
54
54
  mini_portile2 (~> 2.3.0)
55
55
  ntlm-http (0.1.1)
56
56
  os (1.0.0)
57
- rack (2.0.3)
58
- rack-protection (2.0.0)
57
+ rack (2.0.4)
58
+ rack-protection (2.0.1)
59
59
  rack
60
60
  rake (10.5.0)
61
61
  rb-fsevent (0.10.2)
@@ -74,25 +74,25 @@ GEM
74
74
  diff-lcs (>= 1.2.0, < 2.0)
75
75
  rspec-support (~> 3.7.0)
76
76
  rspec-support (3.7.0)
77
- ruby-kafka (0.5.2)
77
+ ruby-kafka (0.5.3)
78
78
  sequel (5.4.0)
79
- sinatra (2.0.0)
79
+ sinatra (2.0.1)
80
80
  mustermann (~> 1.0)
81
81
  rack (~> 2.0)
82
- rack-protection (= 2.0.0)
82
+ rack-protection (= 2.0.1)
83
83
  tilt (~> 2.0)
84
- sinatra-contrib (2.0.0)
84
+ sinatra-contrib (2.0.1)
85
85
  backports (>= 2.0)
86
86
  multi_json
87
87
  mustermann (~> 1.0)
88
- rack-protection (= 2.0.0)
89
- sinatra (= 2.0.0)
88
+ rack-protection (= 2.0.1)
89
+ sinatra (= 2.0.1)
90
90
  tilt (>= 1.3, < 3)
91
91
  thor (0.20.0)
92
92
  tilt (2.0.8)
93
93
  unf (0.1.4)
94
94
  unf_ext
95
- unf_ext (0.0.7.4)
95
+ unf_ext (0.0.7.5)
96
96
  webrobots (0.1.2)
97
97
 
98
98
  PLATFORMS
@@ -31,8 +31,8 @@ Gem::Specification.new do |spec|
31
31
  spec.add_runtime_dependency "mechanize", "~> 2.7"
32
32
  spec.add_runtime_dependency "httparty", "~> 0.15.6"
33
33
  spec.add_runtime_dependency "sequel", "~> 5.4.0"
34
- spec.add_runtime_dependency "sinatra", "~> 2.0.0"
35
- spec.add_runtime_dependency "sinatra-contrib", "~> 2.0.0"
34
+ spec.add_runtime_dependency "sinatra", "~> 2.0.1"
35
+ spec.add_runtime_dependency "sinatra-contrib", "~> 2.0.1"
36
36
 
37
37
  spec.add_development_dependency "dotenv", "~> 0.11.1"
38
38
  spec.add_development_dependency "listen", "~> 3.0"
@@ -24,6 +24,8 @@ module Farmstead
24
24
  String(:name)
25
25
  String(:type)
26
26
  String(:module)
27
+ TrueClass(:pickedup)
28
+ TrueClass(:processed)
27
29
  end
28
30
  @@DB.create_table :test do
29
31
  primary_key(:id)
@@ -86,5 +88,15 @@ module Farmstead
86
88
  ds.insert(result: result)
87
89
  end
88
90
 
91
+ # Sets the value of pickedup to true
92
+ def mark_pickedup(source)
93
+ @@DB.run("UPDATE sources SET pickedup = 1 WHERE module = #{source}")
94
+ end
95
+
96
+ # Sets the value of processed to true
97
+ def mark_processed(source)
98
+ @@DB.run("UPDATE sources SET processed = 1 WHERE module = #{source}")
99
+ end
100
+
89
101
  end
90
102
  end
@@ -1,17 +1,17 @@
1
1
  # Manage
2
2
  #
3
3
  # It works off of the DB when
4
- # 1) A new site is added
5
- # 2) A scheduled site pull is configured to happen
4
+ # 1) A new source is added
5
+ # 2) A scheduled source pull is configured to happen
6
6
  #
7
7
  # Field --> Forest --> Road
8
8
  #
9
9
  # It then takes the config from the DB and passed it to the Field topic
10
10
  #
11
- # The Extract class pulls the site config from the Field Topic and then pushes
12
- # site data to the Forest topic.
11
+ # The Extract class pulls the source config from the Field Topic and then pushes
12
+ # source data to the Forest topic.
13
13
  #
14
- # The Transform class pulls the site data from teh Forest topic and then pushes
14
+ # The Transform class pulls the source data from teh Forest topic and then pushes
15
15
  # to the Road topic.
16
16
  #
17
17
  # The Load class pulls data from the Road topic and loads it into the database.
@@ -32,6 +32,7 @@ module Farmstead
32
32
  puts module_name
33
33
  @producer.produce(module_name, topic: "Field")
34
34
  @producer.deliver_messages
35
+ Farmstead::DB.mark_pickedup(module_name)
35
36
  end
36
37
  end
37
38
 
@@ -40,25 +41,15 @@ module Farmstead
40
41
  def check_sources
41
42
  sources = @mysql.query("SELECT * FROM sources WHERE pickedup = 'false'")
42
43
  return false if sources.count.zero?
43
- sources.each do |site|
44
- json = site.to_json
45
- siteid = get_from_json(json, 'id')
46
- # import_site(json, siteid)
44
+ sources.each do |source|
45
+ json = source.to_json
46
+ sourceid = get_from_json(json, 'id')
47
+ # import_source(json, sourceid)
47
48
  write_message(json, topic: 'Wood')
48
- mark_pickedup(siteid)
49
+ mark_pickedup(sourceid)
49
50
  end
50
51
  end
51
52
 
52
- # Sets the value of pickedup to true
53
- def mark_pickedup(siteid)
54
- @mysql.query("UPDATE sites SET pickedup = 'true' WHERE id = #{siteid}")
55
- end
56
-
57
- # Sets the value of processed to true
58
- def mark_processed(siteid)
59
- @mysql.query("UPDATE sites SET processed = 'true' WHERE id = #{siteid}")
60
- end
61
-
62
53
  # Checks for any processing tasks that need to be
63
54
  # completed at speicifc times
64
55
  def regular_tasks
@@ -72,9 +63,9 @@ module Farmstead
72
63
  end
73
64
  end
74
65
 
75
- # Imports site data as a Hash into MySQL DB
76
- def import_site(sitehash, siteid)
77
- sitehash
66
+ # Imports source data as a Hash into MySQL DB
67
+ def import_source(sourcehash, sourceid)
68
+ sourcehash
78
69
  end
79
70
  end
80
71
  end
@@ -39,23 +39,6 @@ module Farmstead
39
39
  end
40
40
  end
41
41
 
42
- # Each Farmstead site has a Class that defines it
43
- # Each service runs one or more methods on that Class
44
- def find_definitions(site, service)
45
- mysite = @mysql.query("SELECT * FROM sites WHERE name = '#{site}'")
46
- return false if mysite.count.zero?
47
- mysite.each do |sited|
48
- json = sited.to_json
49
- config = get_from_json(json, 'config')
50
- # Convert to hash where each element is a service and then associate it
51
- # with the service name passed to this method
52
- end
53
- end
54
-
55
- def doit
56
- find_definitions('Yahoo', 'scarecrow')
57
- end
58
-
59
42
  def write_message(message, topic)
60
43
  @producer.produce(message, topic)
61
44
  @producer.deliver_messages
@@ -1,3 +1,3 @@
1
1
  module Farmstead
2
- VERSION = "0.0.86"
2
+ VERSION = "0.0.87"
3
3
  end
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.86
4
+ version: 0.0.87
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-30 00:00:00.000000000 Z
11
+ date: 2018-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -128,28 +128,28 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 2.0.0
131
+ version: 2.0.1
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 2.0.0
138
+ version: 2.0.1
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: sinatra-contrib
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 2.0.0
145
+ version: 2.0.1
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 2.0.0
152
+ version: 2.0.1
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: dotenv
155
155
  requirement: !ruby/object:Gem::Requirement