mortar 0.9.8 → 0.9.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,7 @@
1
+ require 'excon'
2
+
1
3
  require "mortar/command/base"
4
+ require "mortar/helpers"
2
5
 
3
6
  module Mortar::Command
4
7
 
@@ -43,6 +46,7 @@ module Mortar::Command
43
46
 
44
47
  action("Installing #{plugin.name}") do
45
48
  begin
49
+ record_usage("plugin_install", plugin.name)
46
50
  plugin.install
47
51
  Mortar::Plugin.load_plugin(plugin.name)
48
52
  rescue StandardError => e
@@ -66,6 +70,7 @@ module Mortar::Command
66
70
 
67
71
  action("Uninstalling #{plugin.name}") do
68
72
  begin
73
+ record_usage("plugin_uninstall", plugin.name)
69
74
  plugin.uninstall
70
75
  rescue Mortar::Plugin::ErrorPluginNotFound => e
71
76
  error e.message
@@ -96,6 +101,7 @@ module Mortar::Command
96
101
  plugins.each do |plugin|
97
102
  action("Updating #{plugin}") do
98
103
  begin
104
+ record_usage("plugin_update", plugin)
99
105
  Mortar::Plugin.new(plugin).update
100
106
  rescue Mortar::Plugin::ErrorUpdatingSymlinkPlugin
101
107
  status "skipped symlink"
@@ -107,5 +113,22 @@ module Mortar::Command
107
113
  end
108
114
  end
109
115
 
116
+
117
+ private
118
+
119
+ def record_usage(usage_type, plugin_name)
120
+ full_host = (host =~ /^http/) ? host : "https://api.#{host}"
121
+ url = full_host + "/usage/#{usage_type}"
122
+
123
+ headers = {'User-Agent' => Mortar::USER_AGENT}
124
+ query = {'plugin_name' => plugin_name}
125
+ begin
126
+ response = Excon.get(url, :headers => headers, :query => query)
127
+ rescue
128
+ #Don't block plugin if usage fails
129
+ end
130
+
131
+ end
132
+
110
133
  end
111
134
  end
@@ -305,6 +305,8 @@ class Mortar::Local::Pig
305
305
  opts['python.home'] = jython_directory
306
306
  opts['python.path'] = "#{local_install_directory}/../controlscripts/lib:#{local_install_directory}/../vendor/controlscripts/lib"
307
307
  opts['python.cachedir'] = jython_cache_directory
308
+ opts['java.security.krb5.realm'] = ''
309
+ opts['java.security.krb5.kdc'] = ''
308
310
  return opts
309
311
  end
310
312
 
data/lib/mortar/plugin.rb CHANGED
@@ -33,10 +33,11 @@ module Mortar
33
33
  end
34
34
 
35
35
  def self.without_bundler_env
36
+ original_env = ENV.to_hash
37
+
36
38
  # Raises error on failure
37
39
  Mortar::Plugin.ensure_bundler_installed
38
40
 
39
- original_env = ENV.to_hash
40
41
  ENV.delete("BUNDLE_GEMFILE")
41
42
  ENV.delete("BUNDLE_PATH")
42
43
  ENV.delete("BUNDLE_BIN_PATH")
@@ -16,5 +16,5 @@
16
16
 
17
17
  module Mortar
18
18
  # see http://semver.org/
19
- VERSION = "0.9.8"
19
+ VERSION = "0.9.10"
20
20
  end
@@ -145,12 +145,13 @@ EOS
145
145
  end
146
146
 
147
147
  it "should clean plugin if bundler isn't installed" do
148
- mock(Plugin).ensure_bundler_installed { raise "Bundler not installed! Whoops!" }
148
+ class BundlerNotInstalledError < StandardError; end
149
+ mock(Plugin).ensure_bundler_installed { raise BundlerNotInstalledError }
149
150
  plugin_folder = "/tmp/mortar_plugin"
150
151
  FileUtils.mkdir_p(plugin_folder)
151
152
  File.open(plugin_folder + '/Gemfile', 'w') { |f| f.write "# dummy content" }
152
153
  `cd #{plugin_folder} && git init && echo 'test' > README && git add . && git commit -m 'my plugin'`
153
- lambda { Plugin.new(plugin_folder).install }.should raise_error StandardError
154
+ lambda { Plugin.new(plugin_folder).install }.should raise_error BundlerNotInstalledError
154
155
  File.exist?("#{@sandbox}/mortar_plugin").should be_false
155
156
  end
156
157
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mortar
3
3
  version: !ruby/object:Gem::Version
4
- hash: 43
4
+ hash: 47
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 8
10
- version: 0.9.8
9
+ - 10
10
+ version: 0.9.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mortar Data
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-08-02 00:00:00 Z
18
+ date: 2013-08-12 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rdoc
@@ -326,7 +326,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
326
326
  requirements: []
327
327
 
328
328
  rubyforge_project:
329
- rubygems_version: 1.8.25
329
+ rubygems_version: 1.8.24
330
330
  signing_key:
331
331
  specification_version: 3
332
332
  summary: Client library and CLI to interact with the Mortar service.