mortar 0.14.0 → 0.14.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -54,10 +54,9 @@ class Mortar::Command::Version < Mortar::Command::Base
|
|
54
54
|
shell_url = ENV.fetch("MORTAR_INSTALL", "http://install.mortardata.com")
|
55
55
|
dir = "/opt/mortar/installer"
|
56
56
|
begin
|
57
|
-
cmd = "sudo curl -sS -L -o #{dir}/install.sh #{shell_url} && sudo bash #{dir}/install.sh#{version_number}"
|
57
|
+
cmd = "sudo mkdir -p #{dir} && sudo curl -sS -L -o #{dir}/install.sh #{shell_url} && sudo bash #{dir}/install.sh#{version_number}"
|
58
58
|
Kernel.system cmd
|
59
59
|
ensure
|
60
|
-
FileUtils.remove_entry_secure dir #removes temporaryily created directory
|
61
60
|
end
|
62
61
|
else
|
63
62
|
error("mortar upgrade is only for installations not conducted with ruby gem. Please upgrade by running 'gem install mortar'.")
|
data/lib/mortar/updater.rb
CHANGED
@@ -45,7 +45,7 @@ module Mortar
|
|
45
45
|
newest_version = self.get_newest_version
|
46
46
|
|
47
47
|
if compare_versions(newest_version, local_version) > 0
|
48
|
-
if installed_with_omnibus? and running_on_a_mac?
|
48
|
+
if Mortar::Helpers.installed_with_omnibus? and Mortar::Helpers.running_on_a_mac?
|
49
49
|
Mortar::Helpers.warning("There is a new version of the Mortar development framework available. Please run 'mortar upgrade' to install the latest version.\n\n")
|
50
50
|
else
|
51
51
|
Mortar::Helpers.warning("There is a new version of the Mortar development framework available. Please run 'gem install mortar' to install the latest version.\n\n")
|
data/lib/mortar/version.rb
CHANGED
@@ -27,7 +27,7 @@ module Mortar::Command
|
|
27
27
|
base_url = "http://install.mortardata.com"
|
28
28
|
base_version = "1.0"
|
29
29
|
tmp_dir_dumm = "/opt/mortar/installer"
|
30
|
-
curl_command = "sudo curl -sS -L -o #{tmp_dir_dumm}/install.sh #{base_url} && sudo bash #{tmp_dir_dumm}/install.sh"
|
30
|
+
curl_command = "sudo mkdir -p #{tmp_dir_dumm} && sudo curl -sS -L -o #{tmp_dir_dumm}/install.sh #{base_url} && sudo bash #{tmp_dir_dumm}/install.sh"
|
31
31
|
|
32
32
|
context("version in prod") do
|
33
33
|
mortar_install_env = ENV['MORTAR_INSTALL']
|
@@ -39,7 +39,6 @@ module Mortar::Command
|
|
39
39
|
ENV['MORTAR_INSTALL'] = mortar_install_env
|
40
40
|
end
|
41
41
|
it "makes a curl request to download default version" do
|
42
|
-
mock(FileUtils).remove_entry_secure(tmp_dir_dumm)
|
43
42
|
mock(Kernel).system (curl_command)
|
44
43
|
any_instance_of(Mortar::Command::Version) do |base|
|
45
44
|
mock(base).installed_with_omnibus? {true}
|
@@ -51,8 +50,6 @@ module Mortar::Command
|
|
51
50
|
it "makes curl request for different versions when requested" do
|
52
51
|
mortar_version = "1.0"
|
53
52
|
curl_command_with_version = curl_command + " -v " + mortar_version
|
54
|
-
mock(FileUtils).remove_entry_secure(tmp_dir_dumm)
|
55
|
-
mock(FileUtils).remove_entry_secure(tmp_dir_dumm)
|
56
53
|
mock(Kernel).system( curl_command_with_version)
|
57
54
|
mock(Kernel).system( curl_command_with_version)
|
58
55
|
any_instance_of(Mortar::Command::Version) do |base|
|
@@ -69,7 +66,7 @@ module Mortar::Command
|
|
69
66
|
|
70
67
|
context("version dev") do
|
71
68
|
dev_url = "dev_url.com"
|
72
|
-
dev_curl = "sudo curl -sS -L -o #{tmp_dir_dumm}/install.sh #{dev_url} && sudo bash #{tmp_dir_dumm}/install.sh"
|
69
|
+
dev_curl = "sudo mkdir -p #{tmp_dir_dumm} && sudo curl -sS -L -o #{tmp_dir_dumm}/install.sh #{dev_url} && sudo bash #{tmp_dir_dumm}/install.sh"
|
73
70
|
before(:each) do
|
74
71
|
ENV['MORTAR_INSTALL'] = dev_url
|
75
72
|
end
|
@@ -77,7 +74,6 @@ module Mortar::Command
|
|
77
74
|
it "makes a curl request to download default version on dev" do
|
78
75
|
mock(Kernel).system(dev_curl)
|
79
76
|
|
80
|
-
mock(FileUtils).remove_entry_secure(tmp_dir_dumm)
|
81
77
|
any_instance_of(Mortar::Command::Version) do |base|
|
82
78
|
mock(base).installed_with_omnibus? {true}
|
83
79
|
mock(base).running_on_a_mac? {true}
|
data/spec/mortar/updater_spec.rb
CHANGED
@@ -19,6 +19,7 @@
|
|
19
19
|
|
20
20
|
require "spec_helper"
|
21
21
|
require "mortar/updater"
|
22
|
+
require "mortar/helpers"
|
22
23
|
require "excon"
|
23
24
|
|
24
25
|
module Mortar
|
@@ -87,13 +88,13 @@ module Mortar
|
|
87
88
|
Mortar::VERSION = "1.0.0"
|
88
89
|
end
|
89
90
|
capture_stdout do
|
90
|
-
stub(
|
91
|
-
stub(
|
91
|
+
stub(Mortar::Helpers).installed_with_omnibus?{false}
|
92
|
+
stub(Mortar::Helpers).running_on_a_mac?{false}
|
92
93
|
Updater.update_check
|
93
94
|
end.should == "WARNING: There is a new version of the Mortar development framework available. Please run 'gem install mortar' to install the latest version.\n\n"
|
94
95
|
capture_stdout do
|
95
|
-
mock(
|
96
|
-
mock(
|
96
|
+
mock(Mortar::Helpers).installed_with_omnibus?{true}
|
97
|
+
mock(Mortar::Helpers).running_on_a_mac?{true}
|
97
98
|
Updater.update_check
|
98
99
|
end.should == "WARNING: There is a new version of the Mortar development framework available. Please run 'mortar upgrade' to install the latest version.\n\n"
|
99
100
|
|