cartodb-tools 0.0.4 → 0.0.5

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.
@@ -12,5 +12,38 @@ module CartodbTools
12
12
  CartoDB::Init.start CartodbTools::Config.config
13
13
  CartoDB::Connection.create_table options[:table_name], File.open(options[:file]), options[:geom_type]
14
14
  end
15
+
16
+ desc "ls", "List the tables in your CartoDB account"
17
+ method_option :all, :aliases => "-a", :desc => "Show detailed information", :default => false
18
+ def ls
19
+ CartoDB::Init.start CartodbTools::Config.config
20
+
21
+ CartoDB::Connection.tables[:tables].each do |table|
22
+ lines = table[:name]
23
+ lines = lines.concat(table[:schema].map {|item| " #{item[0]} #{item[1]}" }) if options[:all]
24
+ end
25
+
26
+ puts lines.join("\n")
27
+ end
28
+
29
+ desc "show", "Show the details of a table in your CartoDB account"
30
+ method_option :table_name, :aliases => "-t", :desc => "Table name"
31
+ def show
32
+ raise unless options[:table_name]
33
+
34
+ CartoDB::Init.start CartodbTools::Config.config
35
+
36
+ CartoDB::Connection.table(options[:table_name]).tap do |table|
37
+ puts [].tap do |lines|
38
+ lines << "-------------------------"
39
+ lines << "id : #{table[:id]}"
40
+ lines << "name : #{table[:name]}"
41
+ lines << "privacy : #{table[:privacy]}"
42
+ lines << "tags : #{table[:tags]}"
43
+ lines << "-------------------------"
44
+ lines = lines.concat(table[:schema].map {|item| "#{item[0]} #{item[1]}" })
45
+ end.join("\n")
46
+ end
47
+ end
15
48
  end
16
49
  end
@@ -1,3 +1,3 @@
1
1
  module CartodbTools
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cartodb-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: