farmstead 0.0.57 → 0.0.58
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/farmstead/cli/db.rb +28 -3
- data/lib/farmstead/cli.rb +0 -25
- data/lib/farmstead/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09d5b8e265309c9e3f0028be4ddee7340193d240'
|
4
|
+
data.tar.gz: 032ef6d58f7133e1f4110d3f26e8591414bc1e64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc2ceafbec12a3d03cca8f702a5d5d9c11cb1bd51e097b15ecb7441de60a45adc091cab9813b619d2664659355b1b5f97dd54b3f4a7b2b6d9cf15e0c3a97501a
|
7
|
+
data.tar.gz: 5f038db418d59de452873314838f66dcadc778e4745cacbd8f2bb8769614a43043794111ac31c7eb8c09a5c68272b4a62af16b93ee2787502c43442dd4f6b1e7
|
data/Gemfile.lock
CHANGED
data/lib/farmstead/cli/db.rb
CHANGED
@@ -2,10 +2,35 @@
|
|
2
2
|
|
3
3
|
module Farmstead
|
4
4
|
class CLIDB < Thor
|
5
|
-
desc "
|
5
|
+
desc "create", "Create the database tables"
|
6
|
+
def create
|
7
|
+
puts "Create database tables"
|
8
|
+
Farmstead::DB.create
|
9
|
+
end
|
10
|
+
|
11
|
+
desc "setup", "Add sources (if present)"
|
6
12
|
def setup
|
7
|
-
puts "
|
8
|
-
|
13
|
+
puts "Add sources (if present)"
|
14
|
+
Dir[File.join(Dir.pwd, "/sources/*.rb")].each do |file|
|
15
|
+
require file
|
16
|
+
array = File.readlines(file)
|
17
|
+
matches = []
|
18
|
+
array.each do |line|
|
19
|
+
if line =~ /module/ then
|
20
|
+
matches.push(line)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
# Nested modules
|
24
|
+
parentmodule = matches[0]
|
25
|
+
submodule = matches[1]
|
26
|
+
# Get the module name
|
27
|
+
suby = submodule.split.last
|
28
|
+
topy = parentmodule.split.last
|
29
|
+
|
30
|
+
module_name = Object.const_get "#{topy}::#{suby}::MYNAME"
|
31
|
+
module_type = Object.const_get "#{topy}::#{suby}::TYPE"
|
32
|
+
Farmstead::DB.add_source(module_name, module_type, suby)
|
33
|
+
end
|
9
34
|
end
|
10
35
|
|
11
36
|
desc "list table", "List all records in a table"
|
data/lib/farmstead/cli.rb
CHANGED
@@ -41,31 +41,6 @@ module Farmstead
|
|
41
41
|
Farmstead::Project.deploy
|
42
42
|
end
|
43
43
|
|
44
|
-
desc "setup", "Create source references"
|
45
|
-
def setup
|
46
|
-
puts "Setup"
|
47
|
-
Dir[File.join(Dir.pwd, "/sources/*.rb")].each do |file|
|
48
|
-
require file
|
49
|
-
array = File.readlines(file)
|
50
|
-
matches = []
|
51
|
-
array.each do |line|
|
52
|
-
if line =~ /module/ then
|
53
|
-
matches.push(line)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
# Nested modules
|
57
|
-
parentmodule = matches[0]
|
58
|
-
submodule = matches[1]
|
59
|
-
# Get the module name
|
60
|
-
suby = submodule.split.last
|
61
|
-
topy = parentmodule.split.last
|
62
|
-
|
63
|
-
module_name = Object.const_get "#{topy}::#{suby}::MYNAME"
|
64
|
-
module_type = Object.const_get "#{topy}::#{suby}::TYPE"
|
65
|
-
Farmstead::DB.add_source(module_name, module_type, suby)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
44
|
desc "pipelined", "Test a pipeline API"
|
70
45
|
def pipeline
|
71
46
|
require_relative "farmstead/extract"
|
data/lib/farmstead/version.rb
CHANGED