zapata 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +1 -1
- data/CONTRIBUTING.md +5 -5
- data/README.md +15 -9
- data/bin/zapata +2 -2
- data/lib/zapata.rb +9 -2
- data/lib/zapata/version.rb +1 -1
- data/script/bootstrap +11 -0
- data/script/test +5 -0
- data/spec/generation_spec.rb +58 -0
- data/spec/spec_helper.rb +3 -2
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e660d0289124b63e44fe3a05bad16f9539be9c4
|
4
|
+
data.tar.gz: 8189ec272e90e38fd2e2e39110e22053119f610d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9195c7def908b238d6d262c29d065994dfecb443f6dc3ad9ae15db87487c5a5f2113f8b5d81126127bf629a1ecc69d9d499861623f5b98a4e64fc2ab04a32295
|
7
|
+
data.tar.gz: b9464f31b4a43b8785b24762fc880352eb49e85d3a7b3bc41739b1d2fafc307ae890b4e6ecdd5b12b9f29d2b8008e74607e0effa05976ae74fe65fe3502980f2
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CONTRIBUTING.md
CHANGED
@@ -18,16 +18,16 @@ developer job less robotic and more creative.
|
|
18
18
|
|
19
19
|
To install, run:
|
20
20
|
```sh
|
21
|
-
git clone https://github.com/Nedomas/zapata
|
22
21
|
cd zapata
|
23
|
-
|
22
|
+
script/bootstrap
|
24
23
|
```
|
25
24
|
|
26
25
|
For specs:
|
27
26
|
|
28
|
-
1. ``cd spec/support/rails_test_app && bundle update``
|
29
|
-
2. ``cd ../../..``
|
30
|
-
3. Run:
|
31
27
|
```sh
|
28
|
+
script/test
|
29
|
+
|
30
|
+
# or
|
31
|
+
|
32
32
|
bundle exec rspec --pattern "spec/*_spec.rb"
|
33
33
|
```
|
data/README.md
CHANGED
@@ -124,11 +124,11 @@ https://github.com/Nedomas/zapata/tree/master/spec
|
|
124
124
|
|
125
125
|
## Workflow with Zapata
|
126
126
|
|
127
|
-
Say you are writing some new feature on your existing project.
|
128
|
-
Before writing that, you probably want to test out the current functionality.
|
127
|
+
Say you are writing some new feature on your existing project.
|
128
|
+
Before writing that, you probably want to test out the current functionality.
|
129
129
|
But who has time for that?
|
130
130
|
|
131
|
-
You let *Zapata* create that quick spec for you.
|
131
|
+
You let *Zapata* create that quick spec for you.
|
132
132
|
Think of it as a *current functionality lock*.
|
133
133
|
Write more code and when you're happy with the result - lock it up again.
|
134
134
|
|
@@ -176,19 +176,25 @@ hacks and rainbows everywhere.
|
|
176
176
|
Thank you to everyone who do. I strongly believe that this can make the
|
177
177
|
developer job less robotic and more creative.
|
178
178
|
|
179
|
+
1. [Fork it](https://github.com/Nedomas/zapata/fork)
|
180
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
181
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
182
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
183
|
+
5. Create a new Pull Request
|
184
|
+
|
179
185
|
To install, run:
|
180
186
|
```sh
|
181
|
-
git clone https://github.com/Nedomas/zapata
|
182
187
|
cd zapata
|
183
|
-
|
188
|
+
script/bootstrap
|
184
189
|
```
|
185
190
|
|
186
191
|
For specs:
|
187
192
|
|
188
|
-
1. ``cd spec/support/rails_test_app && bundle update``
|
189
|
-
2. ``cd ../../..``
|
190
|
-
3. Run:
|
191
193
|
```sh
|
194
|
+
script/test
|
195
|
+
|
196
|
+
# or
|
197
|
+
|
192
198
|
bundle exec rspec --pattern "spec/*_spec.rb"
|
193
199
|
```
|
194
200
|
|
@@ -198,6 +204,7 @@ I am well aware that this is featured in [Ruby Weekly 223](http://rubyweekly.com
|
|
198
204
|
On that note I'd like to thank everybody who helped it shine through.
|
199
205
|
|
200
206
|
Special thanks to my comrade @jpalumickas, with whom we share a vision of a better world.
|
207
|
+
Also - thank you @edgibbs, for being the early contributor.
|
201
208
|
|
202
209
|
## Copyright
|
203
210
|
Copyright (c) 2014 Domas.
|
@@ -208,4 +215,3 @@ See [LICENSE](LICENSE) for details.
|
|
208
215
|
[gemnasium]: https://gemnasium.com/Nedomas/zapata
|
209
216
|
[coveralls]: https://coveralls.io/r/Nedomas/zapata
|
210
217
|
[codeclimate]: https://codeclimate.com/github/Nedomas/zapata
|
211
|
-
|
data/bin/zapata
CHANGED
@@ -17,13 +17,13 @@ slop = Slop.new(help: true, banner: true) do
|
|
17
17
|
on(:s, :single, "Does not analyze 'app/models'", banner: true)
|
18
18
|
|
19
19
|
run do |opts, args|
|
20
|
-
Zapata::Revolutionist.generate_with_friendly_output(args
|
20
|
+
Zapata::Revolutionist.generate_with_friendly_output(args, opts)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
run do |opts, args|
|
25
25
|
if args.present?
|
26
|
-
Zapata::Revolutionist.generate_with_friendly_output(args
|
26
|
+
Zapata::Revolutionist.generate_with_friendly_output(args, opts)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
data/lib/zapata.rb
CHANGED
@@ -23,9 +23,10 @@ module Zapata
|
|
23
23
|
class << self
|
24
24
|
attr_accessor :analysis, :analysis_as_array
|
25
25
|
|
26
|
-
def generate_with_friendly_output(
|
26
|
+
def generate_with_friendly_output(args, opts)
|
27
|
+
file = args.shift
|
27
28
|
spec_filename = Zapata::Revolutionist.generate(file,
|
28
|
-
single:
|
29
|
+
single: single?(opts, args))
|
29
30
|
puts "Its done, comrades. File #{spec_filename} was generated."
|
30
31
|
end
|
31
32
|
|
@@ -42,6 +43,12 @@ module Zapata
|
|
42
43
|
def spec_filename(filename)
|
43
44
|
filename.gsub('app/', 'spec/').gsub('.rb', '_spec.rb')
|
44
45
|
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def single?(opts, args)
|
50
|
+
opts.single? || args.include?('-s') || args.include?('--single')
|
51
|
+
end
|
45
52
|
end
|
46
53
|
|
47
54
|
def initialize(file_list)
|
data/lib/zapata/version.rb
CHANGED
data/script/bootstrap
ADDED
data/script/test
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Zapata::Revolutionist do
|
4
|
+
describe '#generate_with_friendly_output' do
|
5
|
+
let(:file_name) { 'app/models/test_array.rb' }
|
6
|
+
|
7
|
+
context "with the generate command" do
|
8
|
+
context 'with single specified' do
|
9
|
+
it 'returns a single file generation message' do
|
10
|
+
output = execution_output("cd #{RAILS_TEST_APP_DIR} && bundle exec zapata generate #{file_name} -s")
|
11
|
+
expect(output.count).to eq 1
|
12
|
+
expect(output.first).to eq "Its done, comrades. File spec/models/test_array_spec.rb was generated.\n"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'with no single specified' do
|
17
|
+
it 'returns mulptile files generation messages' do
|
18
|
+
output = execution_output("cd #{RAILS_TEST_APP_DIR} && bundle exec zapata generate #{file_name}")
|
19
|
+
expect(output.count).to be > 1
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context "without the generate command" do
|
25
|
+
context 'with single (-s) specified' do
|
26
|
+
it 'returns a single file generation message' do
|
27
|
+
output = execution_output("cd #{RAILS_TEST_APP_DIR} && bundle exec zapata #{file_name} -s")
|
28
|
+
expect(output.count).to eq 1
|
29
|
+
expect(output.first).to eq "Its done, comrades. File spec/models/test_array_spec.rb was generated.\n"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'with single (--single) specified' do
|
34
|
+
it 'returns a single file generation message' do
|
35
|
+
output = execution_output("cd #{RAILS_TEST_APP_DIR} && bundle exec zapata #{file_name} --single")
|
36
|
+
expect(output.count).to eq 1
|
37
|
+
expect(output.first).to eq "Its done, comrades. File spec/models/test_array_spec.rb was generated.\n"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'with no single specified' do
|
42
|
+
it 'returns multiple file generation messages' do
|
43
|
+
output = execution_output("cd #{RAILS_TEST_APP_DIR} && bundle exec zapata #{file_name}")
|
44
|
+
expect(output.count).to be > 1
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def execution_output(command)
|
50
|
+
stdout = Bundler.with_clean_env do
|
51
|
+
Open3.pipeline_r(
|
52
|
+
command
|
53
|
+
)
|
54
|
+
end
|
55
|
+
stdout.first.readlines
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
require 'zapata'
|
2
1
|
require 'coveralls'
|
3
|
-
|
4
2
|
Coveralls.wear!
|
3
|
+
|
4
|
+
require 'zapata'
|
5
|
+
|
5
6
|
# This file was generated by the `rspec --init` command. Conventionally, all
|
6
7
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
7
8
|
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zapata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Domas Bitvinskas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -260,8 +260,11 @@ files:
|
|
260
260
|
- lib/zapata/rzpec/runner.rb
|
261
261
|
- lib/zapata/rzpec/writer.rb
|
262
262
|
- lib/zapata/version.rb
|
263
|
+
- script/bootstrap
|
264
|
+
- script/test
|
263
265
|
- spec/array_spec.rb
|
264
266
|
- spec/definition_spec.rb
|
267
|
+
- spec/generation_spec.rb
|
265
268
|
- spec/hash_spec.rb
|
266
269
|
- spec/klass_types_spec.rb
|
267
270
|
- spec/send_spec.rb
|
@@ -374,6 +377,7 @@ summary: Automatic automated test writer
|
|
374
377
|
test_files:
|
375
378
|
- spec/array_spec.rb
|
376
379
|
- spec/definition_spec.rb
|
380
|
+
- spec/generation_spec.rb
|
377
381
|
- spec/hash_spec.rb
|
378
382
|
- spec/klass_types_spec.rb
|
379
383
|
- spec/send_spec.rb
|