mortar 0.3.2 → 0.3.3
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.
- data/README.md +18 -23
- data/lib/mortar/command.rb +1 -0
- data/lib/mortar/command/base.rb +4 -0
- data/lib/mortar/command/illustrate.rb +7 -3
- data/lib/mortar/version.rb +1 -1
- data/spec/mortar/command/illustrate_spec.rb +26 -0
- metadata +4 -4
data/README.md
CHANGED
@@ -1,36 +1,31 @@
|
|
1
|
-
# Mortar
|
1
|
+
# Mortar Development Framework
|
2
2
|
|
3
|
-
|
3
|
+
Mortar is a platform as a service for Hadoop. With Mortar, you can run jobs on Hadoop using Apache Pig and Python without any special training.
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
## Ruby
|
8
|
-
|
9
|
-
First, install [rvm](https://rvm.io/rvm/install/).
|
5
|
+
The Mortar Development Framework lets you develop Mortar Hadoop jobs directly on your local computer without installing any Hadoop libraries. Lots more info can be found on the [Mortar help site](http://help.mortardata.com).
|
10
6
|
|
11
|
-
|
12
|
-
|
13
|
-
Afterward, add the line recommended by rvm to your bash initialization file.
|
14
|
-
|
15
|
-
Then, switch to the directory where you've cloned mortar. If you don't have the right version of Ruby installed, you will be prompted to upgrade via rvm.
|
7
|
+
# Setup
|
16
8
|
|
17
9
|
## Dependencies
|
18
10
|
|
19
|
-
|
11
|
+
* [Git](http://git-scm.com/downloads) 1.7.7 or later
|
12
|
+
* [Ruby](http://www.ruby-lang.org/en/downloads/) 1.8.7 or later
|
13
|
+
* [Gem](https://rubygems.org/pages/download) (included with Ruby 1.9.2+)
|
14
|
+
|
15
|
+
## Installation
|
20
16
|
|
21
|
-
|
17
|
+
gem install mortar
|
22
18
|
|
23
|
-
#
|
19
|
+
# Development
|
24
20
|
|
25
|
-
|
21
|
+
To develop on the gem, install the bundle, and then use bundle exec to run mortar:
|
26
22
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
bundle exec mortar help
|
23
|
+
gem install bundler
|
24
|
+
bundle install
|
25
|
+
bundle exec mortar <command> <args>
|
31
26
|
|
32
|
-
#
|
27
|
+
# Tests
|
33
28
|
|
34
|
-
|
29
|
+
You can run all the RSpec tests with rake:
|
35
30
|
|
36
|
-
|
31
|
+
rake spec
|
data/lib/mortar/command.rb
CHANGED
@@ -124,6 +124,7 @@ module Mortar
|
|
124
124
|
global_option :help, "--help", "-h"
|
125
125
|
global_option :remote, "--remote REMOTE"
|
126
126
|
global_option :polling_interval, "--polling_interval SECONDS", "-p"
|
127
|
+
global_option :no_browser, "--no_browser"
|
127
128
|
|
128
129
|
def self.prepare_run(cmd, args=[])
|
129
130
|
command = parse(cmd)
|
data/lib/mortar/command/base.rb
CHANGED
@@ -29,6 +29,7 @@ class Mortar::Command::Illustrate < Mortar::Command::Base
|
|
29
29
|
#
|
30
30
|
# -p, --parameter NAME=VALUE # Set a pig parameter value in your script.
|
31
31
|
# -f, --param-file PARAMFILE # Load pig parameter values from a file.
|
32
|
+
# --no_browser # Don't open the illustrate results automatically in the browser.
|
32
33
|
#
|
33
34
|
# Examples:
|
34
35
|
#
|
@@ -84,9 +85,12 @@ class Mortar::Command::Illustrate < Mortar::Command::Base
|
|
84
85
|
when Mortar::API::Illustrate::STATUS_SUCCESS
|
85
86
|
web_result_url = illustrate_result['web_result_url']
|
86
87
|
display("Results available at #{web_result_url}")
|
87
|
-
|
88
|
-
|
89
|
-
|
88
|
+
|
89
|
+
unless no_browser?
|
90
|
+
action("Opening web browser to show results") do
|
91
|
+
require "launchy"
|
92
|
+
Launchy.open(web_result_url).join
|
93
|
+
end
|
90
94
|
end
|
91
95
|
else
|
92
96
|
raise RuntimeError, "Unknown illustrate status: #{illustrate_result['status_code']} for illustrate_id: #{illustrate_id}"
|
data/lib/mortar/version.rb
CHANGED
@@ -93,6 +93,32 @@ Starting illustrate... done
|
|
93
93
|
|
94
94
|
Results available at https://api.mortardata.com/illustrates/c571a8c7f76a4fd4a67c103d753e2dd5
|
95
95
|
Opening web browser to show results... done
|
96
|
+
STDOUT
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
it "requests and reports on a successful illustrate without a browser" do
|
101
|
+
with_git_initialized_project do |p|
|
102
|
+
# stub api requests
|
103
|
+
illustrate_id = "c571a8c7f76a4fd4a67c103d753e2dd5"
|
104
|
+
illustrate_url = "https://api.mortardata.com/illustrates/#{illustrate_id}"
|
105
|
+
parameters = ["name"=>"key", "value"=>"value" ]
|
106
|
+
|
107
|
+
# These don't test the validity of the error message, it only tests that the CLI can handle a message returned from the server
|
108
|
+
mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", "my_alias", is_a(String), :parameters => parameters) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
|
109
|
+
mock(Mortar::Auth.api).get_illustrate(illustrate_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Illustrate::STATUS_QUEUED, "status_description" => "Pending"})).ordered
|
110
|
+
mock(Mortar::Auth.api).get_illustrate(illustrate_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Illustrate::STATUS_SUCCESS, "status_description" => "Succeeded", "web_result_url" => illustrate_url})).ordered
|
111
|
+
|
112
|
+
write_file(File.join(p.pigscripts_path, "my_script.pig"))
|
113
|
+
stderr, stdout = execute("illustrate my_script my_alias --polling_interval 0.05 -p key=value --no_browser", p, @git)
|
114
|
+
stdout.should == <<-STDOUT
|
115
|
+
Taking code snapshot... done
|
116
|
+
Sending code snapshot to Mortar... done
|
117
|
+
Starting illustrate... done
|
118
|
+
|
119
|
+
\r\e[0KStatus: Pending... /\r\e[0KStatus: Succeeded
|
120
|
+
|
121
|
+
Results available at https://api.mortardata.com/illustrates/c571a8c7f76a4fd4a67c103d753e2dd5
|
96
122
|
STDOUT
|
97
123
|
end
|
98
124
|
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:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 3
|
10
|
+
version: 0.3.3
|
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: 2012-
|
18
|
+
date: 2012-10-17 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: mortar-api-ruby
|