turbot 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -96,32 +96,52 @@ class Turbot::Command::Bots < Turbot::Command::Base
96
96
  validate_arguments!
97
97
  language = options[:language] || "ruby"
98
98
  puts "Generating #{language} code..."
99
- FileUtils.mkdir(bot)
100
- case language
101
- when "ruby"
102
- scraper = "scraper.rb"
103
- when "python"
104
- scraper = "scraper.py"
105
- end
106
99
  manifest_template = File.expand_path("../../../../templates/manifest.json", __FILE__)
107
- scraper_template = File.expand_path("../../../../templates/#{scraper}", __FILE__)
100
+ scraper_template = File.expand_path("../../../../templates/#{language}", __FILE__)
108
101
  license_template = File.expand_path("../../../../templates/LICENSE.txt", __FILE__)
109
- manifest = JSON.parse(open(manifest_template).read.sub(/{{bot_id}}/, bot))
102
+ manifest = open(manifest_template).read.sub("{{bot_id}}", bot)
103
+ scraper_name = case language
104
+ when "ruby"
105
+ "scraper.rb"
106
+ when "python"
107
+ "scraper.py"
108
+ end
109
+
110
+ manifest = manifest.sub("{{scraper_name}}", scraper_name)
111
+
112
+ # Language-specific stuff
113
+ FileUtils.cp_r(scraper_template, bot)
110
114
 
111
- FileUtils.cp(scraper_template, "#{bot}/#{scraper}")
115
+ # Same for all languages
112
116
  FileUtils.cp(license_template, "#{bot}/LICENSE.txt")
113
117
  open("#{bot}/manifest.json", "w") do |f|
114
- f.write(manifest.to_json)
118
+ f.write(JSON.pretty_generate(JSON.parse(manifest)))
115
119
  end
116
120
 
117
121
  api.create_bot(bot, manifest)
118
122
 
119
- # TODO handle errors
120
-
121
123
  puts "Created new bot template at #{bot}!"
122
124
  end
123
125
 
124
126
 
127
+ # bots:register
128
+ #
129
+ # Register a bot with turbot. Must be run from a folder containing scraper and manifest.json
130
+
131
+ # $ turbot bots:register
132
+ # Registered my_amazing_bot!
133
+
134
+ def register
135
+ working_dir = Dir.pwd
136
+ manifest = parsed_manifest(working_dir)
137
+ response = api.create_bot(bot, manifest)
138
+ if response.is_a? Turbot::API::FailureResponse
139
+ error(response.message)
140
+ else
141
+ puts "Registered #{bot}!"
142
+ end
143
+ end
144
+
125
145
  # bots:push
126
146
  #
127
147
  # Push bot code to the turbot server. Must be run from a local bot checkout.
@@ -1,3 +1,3 @@
1
1
  module Turbot
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.13"
3
3
  end
@@ -2,6 +2,6 @@
2
2
  "bot_id": "{{bot_id}}",
3
3
  "data_type": "primary data",
4
4
  "identifying_fields": ["number"],
5
- "files": ["scraper.rb"],
5
+ "files": ["{{scraper_name}}"],
6
6
  "description": "This is a simple bot"
7
7
  }
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turbot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Turbot
@@ -13,6 +14,7 @@ dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: netrc
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ~>
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ~>
25
28
  - !ruby/object:Gem::Version
@@ -27,6 +30,7 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: rest-client
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - ~>
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - ~>
39
44
  - !ruby/object:Gem::Version
@@ -41,6 +46,7 @@ dependencies:
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: launchy
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
51
  - - ! '>='
46
52
  - !ruby/object:Gem::Version
@@ -48,6 +54,7 @@ dependencies:
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
59
  - - ! '>='
53
60
  - !ruby/object:Gem::Version
@@ -55,6 +62,7 @@ dependencies:
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: rubyzip
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
67
  - - ! '>='
60
68
  - !ruby/object:Gem::Version
@@ -62,6 +70,7 @@ dependencies:
62
70
  type: :runtime
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
75
  - - ! '>='
67
76
  - !ruby/object:Gem::Version
@@ -69,6 +78,7 @@ dependencies:
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: json-schema
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
83
  - - ! '>='
74
84
  - !ruby/object:Gem::Version
@@ -76,6 +86,7 @@ dependencies:
76
86
  type: :runtime
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
91
  - - ! '>='
81
92
  - !ruby/object:Gem::Version
@@ -83,6 +94,7 @@ dependencies:
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: activesupport
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
99
  - - '='
88
100
  - !ruby/object:Gem::Version
@@ -90,6 +102,7 @@ dependencies:
90
102
  type: :runtime
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
107
  - - '='
95
108
  - !ruby/object:Gem::Version
@@ -97,6 +110,7 @@ dependencies:
97
110
  - !ruby/object:Gem::Dependency
98
111
  name: turbot-api
99
112
  requirement: !ruby/object:Gem::Requirement
113
+ none: false
100
114
  requirements:
101
115
  - - '='
102
116
  - !ruby/object:Gem::Version
@@ -104,6 +118,7 @@ dependencies:
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
107
122
  requirements:
108
123
  - - '='
109
124
  - !ruby/object:Gem::Version
@@ -111,6 +126,7 @@ dependencies:
111
126
  - !ruby/object:Gem::Dependency
112
127
  name: excon
113
128
  requirement: !ruby/object:Gem::Requirement
129
+ none: false
114
130
  requirements:
115
131
  - - ! '>='
116
132
  - !ruby/object:Gem::Version
@@ -118,6 +134,7 @@ dependencies:
118
134
  type: :runtime
119
135
  prerelease: false
120
136
  version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
121
138
  requirements:
122
139
  - - ! '>='
123
140
  - !ruby/object:Gem::Version
@@ -166,22 +183,6 @@ files:
166
183
  - lib/turbot/updater.rb
167
184
  - lib/turbot/version.rb
168
185
  - lib/vendor/turbot/okjson.rb
169
- - schema/schemas/company-schema.json
170
- - schema/schemas/includes/address.json
171
- - schema/schemas/includes/base-statement.json
172
- - schema/schemas/includes/company.json
173
- - schema/schemas/includes/filing.json
174
- - schema/schemas/includes/license-data.json
175
- - schema/schemas/includes/officer.json
176
- - schema/schemas/includes/previous_name.json
177
- - schema/schemas/includes/share-parcel-data.json
178
- - schema/schemas/includes/share-parcel.json
179
- - schema/schemas/includes/subsidiary-relationship-data.json
180
- - schema/schemas/includes/total-shares.json
181
- - schema/schemas/licence-schema.json
182
- - schema/schemas/primary-data-schema.json
183
- - schema/schemas/share-parcel-schema.json
184
- - schema/schemas/subsidiary-relationship-schema.json
185
186
  - spec/helper/legacy_help.rb
186
187
  - spec/helper/pg_dump_restore_spec.rb
187
188
  - spec/schemas/dummy_schema.json
@@ -215,29 +216,45 @@ files:
215
216
  - templates/manifest.json
216
217
  - templates/python/scraper.py
217
218
  - templates/ruby/scraper.rb
219
+ - schema/schemas/company-schema.json
220
+ - schema/schemas/includes/address.json
221
+ - schema/schemas/includes/base-statement.json
222
+ - schema/schemas/includes/company.json
223
+ - schema/schemas/includes/filing.json
224
+ - schema/schemas/includes/license-data.json
225
+ - schema/schemas/includes/officer.json
226
+ - schema/schemas/includes/previous_name.json
227
+ - schema/schemas/includes/share-parcel-data.json
228
+ - schema/schemas/includes/share-parcel.json
229
+ - schema/schemas/includes/subsidiary-relationship-data.json
230
+ - schema/schemas/includes/total-shares.json
231
+ - schema/schemas/licence-schema.json
232
+ - schema/schemas/primary-data-schema.json
233
+ - schema/schemas/share-parcel-schema.json
234
+ - schema/schemas/subsidiary-relationship-schema.json
218
235
  homepage: http://turbot.com/
219
236
  licenses:
220
237
  - MIT
221
- metadata: {}
222
238
  post_install_message:
223
239
  rdoc_options: []
224
240
  require_paths:
225
241
  - lib
226
242
  required_ruby_version: !ruby/object:Gem::Requirement
243
+ none: false
227
244
  requirements:
228
245
  - - ! '>='
229
246
  - !ruby/object:Gem::Version
230
247
  version: 1.9.2
231
248
  required_rubygems_version: !ruby/object:Gem::Requirement
249
+ none: false
232
250
  requirements:
233
251
  - - ! '>='
234
252
  - !ruby/object:Gem::Version
235
253
  version: '0'
236
254
  requirements: []
237
255
  rubyforge_project:
238
- rubygems_version: 2.2.2
256
+ rubygems_version: 1.8.23.2
239
257
  signing_key:
240
- specification_version: 4
258
+ specification_version: 3
241
259
  summary: Client library and CLI to deploy apps on Turbot.
242
260
  test_files: []
243
- has_rdoc:
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YTNkNDBiMWQ4NWRhMWYwODQ2MjhlMmU5NjdlMzFlYzQ2NTczZWQwNA==
5
- data.tar.gz: !binary |-
6
- MDNmZjVkZjczY2QyNGVhOGEzZmYwMTliN2FmY2U4OWY5YzZmNTExMA==
7
- SHA512:
8
- metadata.gz: !binary |-
9
- ZWZjYWI1OTkwMDk5NTgyZjFiNjYzYzEzODRiMTZhNWFlODE0MDMyY2JkNjRj
10
- Y2ExNzJjNjg1NDUzZTM5YjY2OWY4MjhkZjVhMWZiNGEyMmRjYjJhNmMwMDQz
11
- MDE4MjgyNjk2YjU4ZTRiZDZkNGVkN2I1MDhjN2JkYTNkZjFlOWQ=
12
- data.tar.gz: !binary |-
13
- MmNlODkxZDE4NmQ0YzNhYjYzNDdjYjNlNWVhOTIzNjI3ZTIzNmRmNTgyOTAx
14
- M2ZiYmI1YmMzOThhMmUwZWQ1ZmZjNGFhNmM2MWRiMDhkYzk1ZTM5ODcxMTJk
15
- NDFkYjgxZjhhMmIwZGVjYmFlZDYwNmE0MjZkZjA1MDVkZTMzNDY=