mortar 0.7.4 → 0.7.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,7 +22,7 @@ class Mortar::Command::Illustrate < Mortar::Command::Base
22
22
 
23
23
  include Mortar::Git
24
24
 
25
- # illustrate [PIGSCRIPT] [ALIAS]
25
+ # illustrate PIGSCRIPT [ALIAS]
26
26
  #
27
27
  # Illustrate the effects and output of a pigscript.
28
28
  #
@@ -43,9 +43,8 @@ class Mortar::Command::Illustrate < Mortar::Command::Base
43
43
  validate_arguments!
44
44
  pigscript = validate_script!(pigscript_name)
45
45
 
46
- # TODO: When illustrating without alias works, remove the `&& alias_name` to re-enable the feature on CLI
47
- unless pigscript_name && alias_name
48
- error("Usage: mortar illustrate PIGSCRIPT ALIAS\nMust specify PIGSCRIPT and ALIAS.")
46
+ unless pigscript_name
47
+ error("Usage: mortar illustrate PIGSCRIPT [ALIAS]\nMust specify PIGSCRIPT.")
49
48
  end
50
49
 
51
50
  if pigscript.is_a? Mortar::Project::ControlScript
@@ -54,9 +54,11 @@ class Mortar::Command::Local < Mortar::Command::Base
54
54
  ctrl.run(script, pig_parameters)
55
55
  end
56
56
 
57
- # local:illustrate [PIGSCRIPT] [ALIAS]
57
+ # local:illustrate PIGSCRIPT [ALIAS]
58
58
  #
59
59
  # Locally illustrate the effects and output of a pigscript.
60
+ # If an alias is specified, will show data flow from the ancestor LOAD statements to the alias itself.
61
+ # If no alias is specified, will show data flow through all aliases in the script.
60
62
  #
61
63
  # -s, --skippruning # Don't try to reduce the illustrate results to the smallest size possible.
62
64
  # -p, --parameter NAME=VALUE # Set a pig parameter value in your script.
@@ -72,8 +74,8 @@ class Mortar::Command::Local < Mortar::Command::Base
72
74
  alias_name = shift_argument
73
75
  skip_pruning = options[:skippruning] ||= false
74
76
 
75
- unless pigscript_name && alias_name
76
- error("Usage: mortar local:illustrate PIGSCRIPT ALIAS\nMust specify PIGSCRIPT and ALIAS.")
77
+ unless pigscript_name
78
+ error("Usage: mortar local:illustrate PIGSCRIPT [ALIAS]\nMust specify PIGSCRIPT.")
77
79
  end
78
80
 
79
81
  validate_arguments!
@@ -213,10 +213,16 @@ class Mortar::Local::Pig
213
213
  # Now point us at the script/alias to illustrate
214
214
  illustrate_outpath = create_illustrate_output_path()
215
215
  cmd += "-script #{pig_script.path} -out #{illustrate_outpath} "
216
+
216
217
  if skip_pruning
217
218
  cmd += " -skipPruning "
218
219
  end
219
- cmd += " #{pig_alias} '"
220
+
221
+ if pig_alias
222
+ cmd += " #{pig_alias} "
223
+ end
224
+
225
+ cmd += "'"
220
226
 
221
227
  result = run_pig_command(cmd, [], false)
222
228
  if result
@@ -16,5 +16,5 @@
16
16
 
17
17
  module Mortar
18
18
  # see http://semver.org/
19
- VERSION = "0.7.4"
19
+ VERSION = "0.7.5"
20
20
  end
@@ -29,18 +29,6 @@ module Mortar::Command
29
29
  end
30
30
 
31
31
  context("index") do
32
-
33
- it "errors when an alias is not provided" do
34
- with_git_initialized_project do |p|
35
- write_file(File.join(p.pigscripts_path, "my_script.pig"))
36
- stderr, stdout = execute("illustrate my_script", p)
37
- stderr.should == <<-STDERR
38
- ! Usage: mortar illustrate PIGSCRIPT ALIAS
39
- ! Must specify PIGSCRIPT and ALIAS.
40
- STDERR
41
- end
42
- end
43
-
44
32
  it "errors when no remote exists in the project" do
45
33
  with_git_initialized_project do |p|
46
34
  @git.git('remote rm mortar')
@@ -159,6 +147,40 @@ Starting illustrate... done
159
147
  \r\e[0KStatus: Pending... /\r\e[0KStatus: Succeeded
160
148
 
161
149
  Results available at https://api.mortardata.com/illustrates/c571a8c7f76a4fd4a67c103d753e2dd5
150
+ STDOUT
151
+ end
152
+ end
153
+
154
+ it "requests and reports on a successful illustrate without an alias" do
155
+ with_git_initialized_project do |p|
156
+ # stub api requests
157
+ illustrate_id = "c571a8c7f76a4fd4a67c103d753e2dd5"
158
+ illustrate_url = "https://api.mortardata.com/illustrates/#{illustrate_id}"
159
+ parameters = ["name"=>"key", "value"=>"value" ]
160
+
161
+ # These don't test the validity of the error message, it only tests that the CLI can handle a message returned from the server
162
+ mock(Mortar::Auth.api).post_illustrate("myproject", "my_script", nil, false, is_a(String), :parameters => parameters) {Excon::Response.new(:body => {"illustrate_id" => illustrate_id})}
163
+ 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
164
+ mock(Mortar::Auth.api).get_illustrate(illustrate_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Illustrate::STATUS_GATEWAY_STARTING, "status_description" => "GATEWAY_STARTING"})).ordered
165
+ mock(Mortar::Auth.api).get_illustrate(illustrate_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Illustrate::STATUS_PROGRESS, "status_description" => "In progress"})).ordered
166
+ mock(Mortar::Auth.api).get_illustrate(illustrate_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Illustrate::STATUS_READING_DATA, "status_description" => "Reading data"})).ordered
167
+ mock(Mortar::Auth.api).get_illustrate(illustrate_id, :exclude_result => true).returns(Excon::Response.new(:body => {"status_code" => Mortar::API::Illustrate::STATUS_PRUNING_DATA, "status_description" => "Pruning data"})).ordered
168
+ 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
169
+
170
+ # stub launchy
171
+ mock(Launchy).open(illustrate_url) {Thread.new {}}
172
+
173
+ write_file(File.join(p.pigscripts_path, "my_script.pig"))
174
+ stderr, stdout = execute("illustrate my_script --polling_interval 0.05 -p key=value", p, @git)
175
+ stdout.should == <<-STDOUT
176
+ Taking code snapshot... done
177
+ Sending code snapshot to Mortar... done
178
+ Starting illustrate... done
179
+
180
+ \r\e[0KStatus: Pending... /\r\e[0KStatus: GATEWAY_STARTING... -\r\e[0KStatus: In progress... \\\r\e[0KStatus: Reading data... |\r\e[0KStatus: Pruning data... /\r\e[0KStatus: Succeeded
181
+
182
+ Results available at https://api.mortardata.com/illustrates/c571a8c7f76a4fd4a67c103d753e2dd5
183
+ Opening web browser to show results... done
162
184
  STDOUT
163
185
  end
164
186
  end
@@ -23,17 +23,6 @@ module Mortar::Command
23
23
  describe Local do
24
24
 
25
25
  context("illustrate") do
26
- it "errors when an alias is not provided" do
27
- with_git_initialized_project do |p|
28
- write_file(File.join(p.pigscripts_path, "my_script.pig"))
29
- stderr, stdout = execute("local:illustrate my_script", p)
30
- stderr.should == <<-STDERR
31
- ! Usage: mortar local:illustrate PIGSCRIPT ALIAS
32
- ! Must specify PIGSCRIPT and ALIAS.
33
- STDERR
34
- end
35
- end
36
-
37
26
  it "errors when the script doesn't exist" do
38
27
  with_git_initialized_project do |p|
39
28
  write_file(File.join(p.pigscripts_path, "my_other_script.pig"))
@@ -46,7 +35,7 @@ STDERR
46
35
  end
47
36
  end
48
37
 
49
- it "calls the illustrate command when envoked correctly" do
38
+ it "calls the illustrate command when envoked with an alias" do
50
39
  with_git_initialized_project do |p|
51
40
  script_name = "some_script"
52
41
  script_path = File.join(p.pigscripts_path, "#{script_name}.pig")
@@ -61,6 +50,21 @@ STDERR
61
50
  end
62
51
  end
63
52
 
53
+ it "calls the illustrate command when envoked without an alias" do
54
+ with_git_initialized_project do |p|
55
+ script_name = "some_script"
56
+ script_path = File.join(p.pigscripts_path, "#{script_name}.pig")
57
+ write_file(script_path)
58
+ pigscript = Mortar::Project::PigScript.new(script_name, script_path)
59
+ mock(Mortar::Project::PigScript).new(script_name, script_path).returns(pigscript)
60
+ any_instance_of(Mortar::Local::Controller) do |u|
61
+ mock(u).illustrate(pigscript, nil, [], false).returns(nil)
62
+ end
63
+ stderr, stdout = execute("local:illustrate #{script_name}", p)
64
+ stderr.should == ""
65
+ end
66
+ end
67
+
64
68
  # illustrate
65
69
  end
66
70
 
metadata CHANGED
@@ -1,122 +1,164 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: mortar
3
- version: !ruby/object:Gem::Version
4
- version: 0.7.4
3
+ version: !ruby/object:Gem::Version
4
+ hash: 9
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 7
9
+ - 5
10
+ version: 0.7.5
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Mortar Data
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2013-04-11 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2013-04-18 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: mortar-api-ruby
16
- requirement: &71949150 !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
17
24
  none: false
18
- requirements:
25
+ requirements:
19
26
  - - ~>
20
- - !ruby/object:Gem::Version
27
+ - !ruby/object:Gem::Version
28
+ hash: 1
29
+ segments:
30
+ - 0
31
+ - 6
32
+ - 3
21
33
  version: 0.6.3
22
34
  type: :runtime
23
- prerelease: false
24
- version_requirements: *71949150
25
- - !ruby/object:Gem::Dependency
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
26
37
  name: netrc
27
- requirement: &71948490 !ruby/object:Gem::Requirement
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
28
40
  none: false
29
- requirements:
41
+ requirements:
30
42
  - - ~>
31
- - !ruby/object:Gem::Version
32
- version: '0.7'
43
+ - !ruby/object:Gem::Version
44
+ hash: 5
45
+ segments:
46
+ - 0
47
+ - 7
48
+ version: "0.7"
33
49
  type: :runtime
34
- prerelease: false
35
- version_requirements: *71948490
36
- - !ruby/object:Gem::Dependency
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
37
52
  name: launchy
38
- requirement: &71983980 !ruby/object:Gem::Requirement
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
39
55
  none: false
40
- requirements:
56
+ requirements:
41
57
  - - ~>
42
- - !ruby/object:Gem::Version
43
- version: '2.1'
58
+ - !ruby/object:Gem::Version
59
+ hash: 1
60
+ segments:
61
+ - 2
62
+ - 1
63
+ version: "2.1"
44
64
  type: :runtime
45
- prerelease: false
46
- version_requirements: *71983980
47
- - !ruby/object:Gem::Dependency
65
+ version_requirements: *id003
66
+ - !ruby/object:Gem::Dependency
48
67
  name: excon
49
- requirement: &71982970 !ruby/object:Gem::Requirement
68
+ prerelease: false
69
+ requirement: &id004 !ruby/object:Gem::Requirement
50
70
  none: false
51
- requirements:
71
+ requirements:
52
72
  - - ~>
53
- - !ruby/object:Gem::Version
54
- version: '0.15'
73
+ - !ruby/object:Gem::Version
74
+ hash: 21
75
+ segments:
76
+ - 0
77
+ - 15
78
+ version: "0.15"
55
79
  type: :development
56
- prerelease: false
57
- version_requirements: *71982970
58
- - !ruby/object:Gem::Dependency
80
+ version_requirements: *id004
81
+ - !ruby/object:Gem::Dependency
59
82
  name: fakefs
60
- requirement: &71981360 !ruby/object:Gem::Requirement
83
+ prerelease: false
84
+ requirement: &id005 !ruby/object:Gem::Requirement
61
85
  none: false
62
- requirements:
86
+ requirements:
63
87
  - - ~>
64
- - !ruby/object:Gem::Version
88
+ - !ruby/object:Gem::Version
89
+ hash: 11
90
+ segments:
91
+ - 0
92
+ - 4
93
+ - 2
65
94
  version: 0.4.2
66
95
  type: :development
67
- prerelease: false
68
- version_requirements: *71981360
69
- - !ruby/object:Gem::Dependency
96
+ version_requirements: *id005
97
+ - !ruby/object:Gem::Dependency
70
98
  name: gem-release
71
- requirement: &71980140 !ruby/object:Gem::Requirement
99
+ prerelease: false
100
+ requirement: &id006 !ruby/object:Gem::Requirement
72
101
  none: false
73
- requirements:
74
- - - ! '>='
75
- - !ruby/object:Gem::Version
76
- version: '0'
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ hash: 3
106
+ segments:
107
+ - 0
108
+ version: "0"
77
109
  type: :development
78
- prerelease: false
79
- version_requirements: *71980140
80
- - !ruby/object:Gem::Dependency
110
+ version_requirements: *id006
111
+ - !ruby/object:Gem::Dependency
81
112
  name: rake
82
- requirement: &71978220 !ruby/object:Gem::Requirement
113
+ prerelease: false
114
+ requirement: &id007 !ruby/object:Gem::Requirement
83
115
  none: false
84
- requirements:
85
- - - ! '>='
86
- - !ruby/object:Gem::Version
87
- version: '0'
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ hash: 3
120
+ segments:
121
+ - 0
122
+ version: "0"
88
123
  type: :development
89
- prerelease: false
90
- version_requirements: *71978220
91
- - !ruby/object:Gem::Dependency
124
+ version_requirements: *id007
125
+ - !ruby/object:Gem::Dependency
92
126
  name: rr
93
- requirement: &71977800 !ruby/object:Gem::Requirement
127
+ prerelease: false
128
+ requirement: &id008 !ruby/object:Gem::Requirement
94
129
  none: false
95
- requirements:
96
- - - ! '>='
97
- - !ruby/object:Gem::Version
98
- version: '0'
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ hash: 3
134
+ segments:
135
+ - 0
136
+ version: "0"
99
137
  type: :development
100
- prerelease: false
101
- version_requirements: *71977800
102
- - !ruby/object:Gem::Dependency
138
+ version_requirements: *id008
139
+ - !ruby/object:Gem::Dependency
103
140
  name: rspec
104
- requirement: &71977380 !ruby/object:Gem::Requirement
141
+ prerelease: false
142
+ requirement: &id009 !ruby/object:Gem::Requirement
105
143
  none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ hash: 3
148
+ segments:
149
+ - 0
150
+ version: "0"
110
151
  type: :development
111
- prerelease: false
112
- version_requirements: *71977380
152
+ version_requirements: *id009
113
153
  description: Client library and command-line tool to interact with the Mortar service.
114
154
  email: support@mortardata.com
115
- executables:
155
+ executables:
116
156
  - mortar
117
157
  extensions: []
158
+
118
159
  extra_rdoc_files: []
119
- files:
160
+
161
+ files:
120
162
  - README.md
121
163
  - bin/mortar
122
164
  - css/illustrate.css
@@ -207,26 +249,38 @@ files:
207
249
  - spec/support/display_message_matcher.rb
208
250
  homepage: http://mortardata.com/
209
251
  licenses: []
252
+
210
253
  post_install_message:
211
254
  rdoc_options: []
212
- require_paths:
255
+
256
+ require_paths:
213
257
  - lib
214
- required_ruby_version: !ruby/object:Gem::Requirement
258
+ required_ruby_version: !ruby/object:Gem::Requirement
215
259
  none: false
216
- requirements:
217
- - - ! '>='
218
- - !ruby/object:Gem::Version
260
+ requirements:
261
+ - - ">="
262
+ - !ruby/object:Gem::Version
263
+ hash: 57
264
+ segments:
265
+ - 1
266
+ - 8
267
+ - 7
219
268
  version: 1.8.7
220
- required_rubygems_version: !ruby/object:Gem::Requirement
269
+ required_rubygems_version: !ruby/object:Gem::Requirement
221
270
  none: false
222
- requirements:
223
- - - ! '>='
224
- - !ruby/object:Gem::Version
225
- version: '0'
271
+ requirements:
272
+ - - ">="
273
+ - !ruby/object:Gem::Version
274
+ hash: 3
275
+ segments:
276
+ - 0
277
+ version: "0"
226
278
  requirements: []
279
+
227
280
  rubyforge_project:
228
- rubygems_version: 1.8.11
281
+ rubygems_version: 1.8.24
229
282
  signing_key:
230
283
  specification_version: 3
231
284
  summary: Client library and CLI to interact with the Mortar service.
232
285
  test_files: []
286
+