farmstead 0.0.40 → 0.0.41

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: fbe5082be561e43980e8de2220e2b42fa3c0f528
4
- data.tar.gz: 4eee3a092d0dafc9c282fbb9ca3fa9bb9649621a
3
+ metadata.gz: 2806f182e6cd93e8cd9ff4a69ca6578925e26a2a
4
+ data.tar.gz: 1b604a5e9814af604795c68d78385db6906eb229
5
5
  SHA512:
6
- metadata.gz: b781c333e494c0bcb77722dfd8fa0bb2106573d1240e9225fcc4c0f1e5c8b203829dacf1e4857695b5e6807a80d27e4b50d7cdbee1b74612a90233ec0a0434a7
7
- data.tar.gz: 42c9678ac14612a02e9aebd20ea317cb702b22a1a42e6e74f5838a758fc21fb892f770c6c0c8283492ce826b029c9f63abe4e480c5bad41618acc965dcf408a9
6
+ metadata.gz: f606bb4fbb2191151254f064b9640bf552f23e5c6171c9fe1f511e8c836874e0d2591391d9bab9ef78a7c2cea9a5e5b0e097fcfd26184816d33e85e0e9c57f51
7
+ data.tar.gz: 38c72bbce85620e6dca08cbd88ebeaf29e55b635ef099156c81d91b64ad5250aeba2b92320fc4e8159b123ff8dbc304673cd77e74f81ee23214b453ef6c26ae2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- farmstead (0.0.40)
4
+ farmstead (0.0.41)
5
5
  httparty (~> 0.15.6)
6
6
  mechanize (~> 2.7)
7
7
  mysql2 (~> 0.4.10)
@@ -0,0 +1,17 @@
1
+ # Database subcommands
2
+
3
+ module Farmstead
4
+ class CLIDB < Thor
5
+ desc "setup", "Setup the database"
6
+ def setup
7
+ puts "Setting up the database"
8
+ Farmstead::DB.setup
9
+ end
10
+
11
+ desc "list", "List the sources"
12
+ def list
13
+ puts "List the sources"
14
+ end
15
+ end
16
+ end
17
+
data/lib/farmstead/cli.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "thor"
2
2
  require "farmstead/cli/test"
3
+ require "farmstead/cli/db"
3
4
 
4
5
  module Farmstead
5
6
  class HammerTime < Thor
@@ -46,6 +47,10 @@ module Farmstead
46
47
  require_relative "farmstead/extract"
47
48
  end
48
49
 
50
+ desc "db COMMANDS", "Database commands"
51
+ subcommand "db", Farmstead::CLIDB
52
+
53
+
49
54
  desc "test COMMANDS", "Test commands"
50
55
  subcommand "test", Farmstead::CLITest
51
56
 
data/lib/farmstead/db.rb CHANGED
@@ -4,11 +4,25 @@ module Farmstead
4
4
  class DB
5
5
  def self.pull_variables
6
6
  @@mysql_host = ENV["MYSQL_HOST"]
7
+ @@mysql_password = ENV["MYSQL_PASSWORD"]
8
+ @@mysql_user = ENV["MYSQL_USER"]
9
+ @@mysql_database = ENV["MYSQL_DATABASE"]
10
+ @@DB = Sequel.connect(adapter: "mysql2", host: @@mysql_host, database: @@mysql_database, user: @@mysql_user, password: @@mysql_password)
7
11
  end
8
12
 
9
13
  def self.add_source
10
14
  self.pull_variables
11
- @@mysql_host
15
+ puts "Add source"
12
16
  end
17
+
18
+ def self.setup
19
+ self.pull_variables
20
+ @@DB.create_table :sources do
21
+ primary_key(:id)
22
+ String(:name)
23
+ String(:type)
24
+ end
25
+ end
26
+
13
27
  end
14
28
  end
@@ -22,5 +22,8 @@ docker-compose up -d mysql zookeeper > /dev/null 2>&1
22
22
  echo "Sleeping"
23
23
  sleep 10
24
24
 
25
+ echo "Create database tables"
26
+ farmstead db setup
27
+
25
28
  echo "Starting everything else"
26
29
  docker-compose up -d > /dev/null 2>&1
@@ -1,3 +1,3 @@
1
1
  module Farmstead
2
- VERSION = "0.0.40"
2
+ VERSION = "0.0.41"
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.40
4
+ version: 0.0.41
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-21 00:00:00.000000000 Z
11
+ date: 2018-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -250,6 +250,7 @@ files:
250
250
  - lib/farmstead/api/v1.rb
251
251
  - lib/farmstead/api/views/environment.erb
252
252
  - lib/farmstead/cli.rb
253
+ - lib/farmstead/cli/db.rb
253
254
  - lib/farmstead/cli/test.rb
254
255
  - lib/farmstead/db.rb
255
256
  - lib/farmstead/pipeline/extract.rb