specss 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 62e0dda02c8ae2b19b17707496db1b5074ffdd0cb592ace3ca41e09b715f52e3
4
- data.tar.gz: acce2bed54b8bde82ba941ea4e968633c53237fce1345731bd09ba86b58a5e40
3
+ metadata.gz: 807d34a8a021ac192de59b356c9dbdef66deb0c4c68e7fe2a8f438a6ace5f447
4
+ data.tar.gz: 16151a2a5832a54c94a150b02f3aee8382e1b382f7ae015a53c13ade76058336
5
5
  SHA512:
6
- metadata.gz: e71febd9e68f475df1d9e46bccddbc813b21e8d6c8824d6f30cdaa2a72938253e50f498b9f6be2d37e5798618487578eeb302ea25b878d253601c41c88c54db1
7
- data.tar.gz: a6b638d032f2bd789e4b94a4efb75a65c52702ae99dd41e7a930ac502112ca12c769cd4addd00dd529843ef920f13997990f95b9eacc7e1282cd84539d2176b9
6
+ metadata.gz: 1ea1e318618d1e9617652b7b95d53fa6048053447337875b8ddcfea8e1bb8761a7971e7cb66b9fb30bd6375fa05049ce02c9e01b31f21a7f6e00e0f781d30716
7
+ data.tar.gz: a24965b50e8f6567149e28e27239ac8146332ba2ebb3dd0f9eda595f41a4607211b09efd85847381a91d3af032265e3ba4b333791c1615a51de41a162b64010b
data/README.md CHANGED
@@ -1,14 +1,13 @@
1
1
  # Smarter Rspec Runner
2
- Script that runs specs for Spectra Rails projects based off of dependencies and perforce changelists
3
-
4
- ### Gathering Dependents
5
- In the script I utilize the [Rubrowser](https://github.com/emad-elsaid/rubrowser) gem to create a dependency graph for the code.
2
+ Script that runs specs for Rails and other Ruby projects based off of perforce status
6
3
 
7
4
  ### Installation
8
5
  This gem is publicly available on RubyGems.
6
+
9
7
  ```
10
8
  gem install specss
11
9
  ```
10
+
12
11
  If your projects use different Ruby versions, then each one will require this step in order to run.
13
12
 
14
13
  ### Use
@@ -18,8 +17,8 @@ Navigate to the root of your rails app or ruby project and simply run:
18
17
  specss
19
18
  ```
20
19
 
21
- By default, it only runs the 'lite' version that executes specs based on your p4 status. To run specs on all changed files and
22
- all dependents of those changed files, run:
20
+ By default, it only runs the 'condensed' version that executes specs based on files opened for edit from your p4 status. To run specs on all
21
+ changed files and all dependents of those changed files, run:
23
22
 
24
23
  ```
25
24
  specss -e
@@ -30,8 +29,18 @@ For other information, print the help after running the executable:
30
29
  ```
31
30
  [~]$ specss -h
32
31
  Usage: specss [option]
33
- -e, --extended Run specs of modified files and dependents
34
- -l, --lite Run specs of modified files only
32
+ -c, --condensed Run specs of files opened for edit only
33
+ -e, --extended Run specs of files opened for edit and dependents
34
+ -l, --list Prints a list of specs for files opened for edit
35
35
  -v, --version Smarter Specs Version
36
36
  -h, --help Prints this help
37
37
  ```
38
+
39
+ ### Development
40
+ ```
41
+ git clone git@github.com:tombonan/smarter-specs.git && cd smarter-specs
42
+ rake console
43
+ ```
44
+
45
+ ### Gathering Dependents
46
+ In the script I utilize the [Rubrowser](https://github.com/emad-elsaid/rubrowser) gem to create a dependency graph for the code.
data/bin/specss CHANGED
@@ -4,7 +4,7 @@ require 'optparse'
4
4
  require 'specss'
5
5
  require 'specss/executor'
6
6
 
7
- ARGV << '-l' if ARGV.empty? # Default to lite if no arguments are passed
7
+ ARGV << '-c' if ARGV.empty? # Default to lite if no arguments are passed
8
8
 
9
9
  Options = Struct.new(:name)
10
10
 
@@ -16,12 +16,16 @@ class Parser
16
16
  opt_parser = OptionParser.new do |opts|
17
17
  opts.banner = "Usage: specss [option]"
18
18
 
19
- opts.on("-e", "--extended", "Run specs of modified files and dependents") do |n|
19
+ opts.on("-c", "--condensed", "Run specs of files opened for edit only") do |n|
20
+ Executor.main('condensed')
21
+ end
22
+
23
+ opts.on("-e", "--extended", "Run specs of files opened for edit and dependents") do |n|
20
24
  Executor.main('extended')
21
25
  end
22
26
 
23
- opts.on("-l", "--lite", "Run specs of modified files only") do |n|
24
- Executor.main('lite')
27
+ opts.on("-l", "--list", "Prints a list of specs for files opened for edit") do |n|
28
+ Executor.main('list')
25
29
  end
26
30
 
27
31
  opts.on("-v", "--version", "Smarter Specs Version") do |n|
@@ -8,21 +8,23 @@ module Executor
8
8
  def main(opt)
9
9
  $changed_files = Files::Perforce.get_changelist_files
10
10
 
11
+ if $changed_files.include? 'p4: command not found'
12
+ puts 'Please install perforce command line client: '\
13
+ 'https://www.perforce.com/perforce/r14.2/manuals/p4guide/chapter.install.html'
14
+ return false
15
+ end
16
+
11
17
  # Pass in options from ARGV on whether to run lite or extended
12
18
  case opt
13
19
  when 'extended'
14
20
  specs_to_run = extended
21
+ when 'list'
22
+ list_specs
15
23
  else
16
- specs_to_run = lite
24
+ specs_to_run = condensed
17
25
  end
18
26
 
19
- if specs_to_run.empty?
20
- puts 'No specs need to be run'
21
- else
22
- spec_names = Files::Specs.chop_file_paths(specs_to_run)
23
- puts 'Running specs: ' + spec_names.join(" ")
24
- exec "bundle exec rspec " + specs_to_run.join(" ")
25
- end
27
+ run_specs(specs_to_run) unless opt == 'list'
26
28
  end
27
29
 
28
30
  ##
@@ -55,9 +57,25 @@ module Executor
55
57
  Files::Specs.get_specs(all_files)
56
58
  end
57
59
 
58
- def lite
60
+ def condensed
59
61
  Files::Specs.get_specs($changed_files)
60
62
  end
63
+
64
+ ##
65
+ # Prints a list of specs for files opened for edit
66
+ def list_specs
67
+ specs = condensed
68
+ puts specs.join("\n")
69
+ end
70
+
71
+ def run_specs(specs_to_run)
72
+ if specs_to_run.empty?
73
+ puts 'No specs need to be run'
74
+ else
75
+ spec_names = Files::Specs.chop_file_paths(specs_to_run)
76
+ puts 'Running specs: ' + spec_names.join(" ")
77
+ exec "bundle exec rspec " + specs_to_run.join(" ")
78
+ end
79
+ end
61
80
  end
62
-
63
81
  end
@@ -1,3 +1,3 @@
1
1
  module Specss
2
- VERSION = '1.0.0'
2
+ VERSION = '1.1.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specss
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Bonan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-02 00:00:00.000000000 Z
11
+ date: 2019-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubrowser