turbot 0.0.7 → 0.0.8

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.
@@ -96,27 +96,35 @@ 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
102
  manifest = JSON.parse(open(manifest_template).read.sub(/{{bot_id}}/, bot))
110
103
 
111
- FileUtils.cp(scraper_template, "#{bot}/#{scraper}")
104
+ # Language-specific stuff
105
+ FileUtils.cp(scraper_template, bot)
106
+
107
+ # Same for all languages
112
108
  FileUtils.cp(license_template, "#{bot}/LICENSE.txt")
113
109
  open("#{bot}/manifest.json", "w") do |f|
114
- f.write(manifest.to_json)
110
+ f.write(JSON.pretty_generate(manifest))
111
+ end
112
+
113
+ if language == "ruby"
114
+ FileUtils.chdir(bot)
115
+ Open3::popen3("bundle", options) do |_, stdout, stderr, wait_thread|
116
+ status = wait_thread.value.exitstatus
117
+ if status > 0
118
+ message = "Bundle failed!"
119
+ message += stderr.read()
120
+ error(message)
121
+ end
122
+ end
115
123
  end
116
124
 
117
125
  api.create_bot(bot, manifest)
118
126
 
119
- # TODO handle errors
127
+ # TODO handle errors
120
128
 
121
129
  puts "Created new bot template at #{bot}!"
122
130
  end
@@ -1,3 +1,3 @@
1
1
  module Turbot
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turbot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-10 00:00:00.000000000 Z
12
+ date: 2014-06-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: netrc
@@ -214,8 +214,8 @@ files:
214
214
  - spec/turbot/updater_spec.rb
215
215
  - templates/LICENSE.txt
216
216
  - templates/manifest.json
217
- - templates/scraper.py
218
- - templates/scraper.rb
217
+ - templates/python/scraper.py
218
+ - templates/ruby/scraper.rb
219
219
  homepage: http://turbot.com/
220
220
  licenses:
221
221
  - MIT
@@ -237,7 +237,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
237
237
  version: '0'
238
238
  requirements: []
239
239
  rubyforge_project:
240
- rubygems_version: 1.8.23
240
+ rubygems_version: 1.8.23.2
241
241
  signing_key:
242
242
  specification_version: 3
243
243
  summary: Client library and CLI to deploy apps on Turbot.