mortar 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,36 +1,31 @@
1
- # Mortar CLI
1
+ # Mortar Development Framework
2
2
 
3
- The Mortar CLI lets you run Hadoop jobs on the Mortar service.
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
- # Setup
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
- curl -kL https://get.rvm.io | bash -s stable
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
- Install required gems:
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
- bundle install
17
+ gem install mortar
22
18
 
23
- # Running
19
+ # Development
24
20
 
25
- You can run the command line through bundle:
21
+ To develop on the gem, install the bundle, and then use bundle exec to run mortar:
26
22
 
27
- bundle exec mortar <command> <args>
28
-
29
- # example
30
- bundle exec mortar help
23
+ gem install bundler
24
+ bundle install
25
+ bundle exec mortar <command> <args>
31
26
 
32
- # Testing
27
+ # Tests
33
28
 
34
- To run the tests, do:
29
+ You can run all the RSpec tests with rake:
35
30
 
36
- rake spec
31
+ rake spec
@@ -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)
@@ -310,6 +310,10 @@ protected
310
310
  (options[:polling_interval] || 2.0).to_f
311
311
  end
312
312
 
313
+ def no_browser?
314
+ (options[:no_browser])
315
+ end
316
+
313
317
  end
314
318
 
315
319
  module Mortar::Command
@@ -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
- action("Opening web browser to show results") do
88
- require "launchy"
89
- Launchy.open(web_result_url).join
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}"
@@ -16,5 +16,5 @@
16
16
 
17
17
  module Mortar
18
18
  # see http://semver.org/
19
- VERSION = "0.3.2"
19
+ VERSION = "0.3.3"
20
20
  end
@@ -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: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 2
10
- version: 0.3.2
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-09-25 00:00:00 Z
18
+ date: 2012-10-17 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: mortar-api-ruby