sfb_scripts 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (23) hide show
  1. checksums.yaml +4 -4
  2. data/bin/app_up +1 -1
  3. data/bin/test_runner +1 -1
  4. data/lib/{bundle_manager.rb → sfb_scripts/bundler/bundle_manager.rb} +6 -2
  5. data/lib/{hook_manager.rb → sfb_scripts/hook_manager.rb} +0 -0
  6. data/lib/{pre_push_hook.rb → sfb_scripts/hooks/pre_push_hook.rb} +0 -0
  7. data/lib/{migrator.rb → sfb_scripts/migrations/migrator.rb} +17 -4
  8. data/lib/{string_extension.rb → sfb_scripts/monkey_patches/string_extension.rb} +0 -0
  9. data/lib/{needs_manager.rb → sfb_scripts/needs_manager.rb} +19 -8
  10. data/lib/{active_repo.rb → sfb_scripts/repositories/active_repo.rb} +0 -2
  11. data/lib/{lazy_repo.rb → sfb_scripts/repositories/lazy_repo.rb} +0 -2
  12. data/lib/{repo.rb → sfb_scripts/repositories/repo.rb} +0 -0
  13. data/lib/{loud_shell_runner.rb → sfb_scripts/shells/loud_shell_runner.rb} +0 -2
  14. data/lib/{shell_runner.rb → sfb_scripts/shells/shell_runner.rb} +0 -2
  15. data/lib/{status_checker.rb → sfb_scripts/test_running/status_checker.rb} +0 -0
  16. data/lib/{test_case.rb → sfb_scripts/test_running/test_case.rb} +0 -0
  17. data/lib/{test_collection.rb → sfb_scripts/test_running/test_collection.rb} +0 -2
  18. data/lib/{test_file_runner.rb → sfb_scripts/test_running/test_file_runner.rb} +0 -2
  19. data/lib/{test_method_runner.rb → sfb_scripts/test_running/test_method_runner.rb} +0 -3
  20. data/lib/{test_runner.rb → sfb_scripts/test_running/test_runner.rb} +0 -2
  21. data/lib/{tester.rb → sfb_scripts/tester.rb} +0 -4
  22. data/lib/{upper.rb → sfb_scripts/upper.rb} +0 -2
  23. metadata +41 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f0464c1e7fede7cccf98042d942788add0dfae24
4
- data.tar.gz: 0fca59a3f0c6b4722fdbc13d6319fc5576a7fef1
3
+ metadata.gz: e3d6009dbd443b1c3afcf0e214ecf245ceae4f49
4
+ data.tar.gz: 9f67a07cc0cb014d5b50456536746fce0f3aa16e
5
5
  SHA512:
6
- metadata.gz: 8051d17a37e864aceb3fcae7f7812670d41d09254742e53ccbe5a1cc6c4f204f39c78f24e25f9990cb53a70693dab393bf653126ba3577f99f01022fc6bb2f80
7
- data.tar.gz: 325b98013c47a1b60020128b23f6c71b4ddfd3396691b27dfb7a69155b9a18a813a4deb2bf71ee13c373d0fdf62972a7d86017cab9c6d03db1495249cafac723
6
+ metadata.gz: a6df2ec87740289436c430aaf8f425f3d4ea4c31411ceadb9a43d50d583134c18b9b65ec80ec461c57c373e402b633f657c038d6fc3768774ceda2dcd29e90a1
7
+ data.tar.gz: 809299b62276b552ba6ffaf310eea2cc91f1e2fc10575aa1f3874f33bdb4b3dbf578f5df1289eebf2dcab6c469fbd696a28e0083c25897eeed961c866ecaf8d0
data/bin/app_up CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require_relative '../lib/upper'
4
3
  require 'thor'
4
+ require_relative '../lib/sfb_scripts/upper'
5
5
 
6
6
  class CLI < Thor
7
7
 
data/bin/test_runner CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require_relative '../lib/tester'
4
3
  require 'thor'
4
+ require_relative '../lib/sfb_scripts/tester'
5
5
 
6
6
  class CLI < Thor
7
7
 
@@ -1,18 +1,22 @@
1
1
  class BundleManager
2
- attr_accessor :shell, :repo
2
+ attr_accessor :shell, :repo, :queue
3
3
 
4
4
  def initialize(repo: raise, shell: raise)
5
5
  @shell = shell
6
6
  @repo = repo
7
+ @queue = WorkQueue.new(2, nil)
7
8
  end
8
9
 
9
10
  def bundle_where_necessary
10
11
  shell.notify "\nBundling:"
11
12
  find("Gemfile.lock").each do |gemfile_lock|
12
13
  if repo.changed?(gemfile_lock)
13
- bundle(directory_of(gemfile_lock))
14
+ queue.enqueue_b do
15
+ bundle(directory_of(gemfile_lock))
16
+ end
14
17
  end
15
18
  end
19
+ queue.join
16
20
  end
17
21
 
18
22
  def bundle(gemfile_directory)
@@ -1,5 +1,5 @@
1
1
  class Migrator
2
- attr_accessor :shell, :repo
2
+ attr_accessor :shell, :repo, :queue
3
3
 
4
4
  # hack: move engines flag into
5
5
  # another object that decides
@@ -7,14 +7,18 @@ class Migrator
7
7
  @shell = shell
8
8
  @repo = repo
9
9
  @migrate_engines = migrate_engines
10
+ # should be passed in
11
+ @queue = WorkQueue.new(8, nil)
10
12
  end
11
13
 
12
14
  def migrate_where_necessary
13
15
  shell.notify "\nMigrating:"
14
- directories_to_migrate.each do |dir|
15
- shell.run "bundle exec rake db:migrate", dir: dir
16
- shell.run "RAILS_ENV=test bundle exec rake db:migrate", dir: dir
16
+ migrations.each do |migration|
17
+ queue.enqueue_b do
18
+ shell.run "RAILS_ENV=#{migration[:env]} bundle exec rake db:migrate", dir: migration[:dir]
19
+ end
17
20
  end
21
+ queue.join
18
22
  end
19
23
 
20
24
  def directories_to_migrate
@@ -24,6 +28,15 @@ class Migrator
24
28
 
25
29
  private
26
30
 
31
+ def migrations
32
+ directories_to_migrate.map do |dir|
33
+ [
34
+ {env: "development",dir: dir},
35
+ {env: "test", dir: dir}
36
+ ]
37
+ end.flatten
38
+ end
39
+
27
40
  def in_rack_application?(migrate_dir)
28
41
  if migrate_engines?
29
42
  true
@@ -1,11 +1,22 @@
1
- require_relative 'shell_runner'
2
- require_relative 'loud_shell_runner'
3
- require_relative 'repo'
4
- require_relative 'lazy_repo'
5
- require_relative 'active_repo'
6
- require_relative 'migrator'
7
- require_relative 'bundle_manager'
8
- require_relative 'test_runner'
1
+ require 'work_queue'
2
+
3
+ # this is a bummer...
4
+ require_relative 'monkey_patches/string_extension'
5
+ require_relative 'bundler/bundle_manager'
6
+ require_relative 'hooks/pre_push_hook'
7
+ require_relative 'migrations/migrator'
8
+ require_relative 'repositories/repo'
9
+ require_relative 'repositories/active_repo'
10
+ require_relative 'repositories/lazy_repo'
11
+ require_relative 'shells/shell_runner'
12
+ require_relative 'shells/loud_shell_runner'
13
+ require_relative 'test_running/status_checker'
14
+ require_relative 'test_running/test_case'
15
+ require_relative 'test_running/test_collection'
16
+ require_relative 'test_running/test_file_runner'
17
+ require_relative 'test_running/test_method_runner'
18
+ require_relative 'test_running/test_runner'
19
+
9
20
 
10
21
  class NeedsManager
11
22
 
@@ -1,5 +1,3 @@
1
- require_relative 'repo'
2
-
3
1
  class ActiveRepo < Repo
4
2
 
5
3
  def rebase_on_master!
@@ -1,5 +1,3 @@
1
- require_relative 'repo'
2
-
3
1
  class LazyRepo < Repo
4
2
 
5
3
  def initialize(*args)
File without changes
@@ -1,5 +1,3 @@
1
- require_relative 'shell_runner'
2
-
3
1
  class LoudShellRunner < ShellRunner
4
2
 
5
3
  def run(*args)
@@ -1,5 +1,3 @@
1
- require_relative 'string_extension'
2
-
3
1
  class ShellRunner
4
2
  CommandFailureError = Class.new(StandardError)
5
3
 
@@ -1,5 +1,3 @@
1
- require_relative 'test_case'
2
-
3
1
  class TestCollection
4
2
 
5
3
  MultipleWorkingDirectoriesError = Class.new(StandardError)
@@ -1,5 +1,3 @@
1
- require_relative 'test_collection'
2
-
3
1
  class TestFileRunner
4
2
 
5
3
  def self.find(inputs, env)
@@ -1,6 +1,3 @@
1
- require_relative 'test_runner'
2
- require_relative 'shell_runner'
3
-
4
1
  class TestMethodRunner
5
2
 
6
3
  def self.run(regex, env)
@@ -1,5 +1,3 @@
1
- require_relative 'shell_runner'
2
-
3
1
  class TestRunner
4
2
 
5
3
  attr_reader :shell, :all_engines_param
@@ -1,8 +1,4 @@
1
1
  require_relative 'needs_manager'
2
- require_relative 'test_collection'
3
- require_relative 'test_method_runner'
4
- require_relative 'test_file_runner'
5
- require_relative 'status_checker'
6
2
 
7
3
  class Tester
8
4
 
@@ -1,6 +1,4 @@
1
1
  require_relative 'needs_manager'
2
- require_relative 'hook_manager'
3
- require_relative 'pre_push_hook'
4
2
 
5
3
  class Upper
6
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sfb_scripts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Kinnecom
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-18 00:00:00.000000000 Z
11
+ date: 2014-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -30,6 +30,26 @@ dependencies:
30
30
  - - <
31
31
  - !ruby/object:Gem::Version
32
32
  version: '1.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: work_queue
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - '>='
38
+ - !ruby/object:Gem::Version
39
+ version: 2.5.3
40
+ - - <
41
+ - !ruby/object:Gem::Version
42
+ version: '3.0'
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - '>='
48
+ - !ruby/object:Gem::Version
49
+ version: 2.5.3
50
+ - - <
51
+ - !ruby/object:Gem::Version
52
+ version: '3.0'
33
53
  description: Easily update your rails app and run tests from command line
34
54
  email:
35
55
  - pete.kinnecom@gmail.com
@@ -39,25 +59,25 @@ executables:
39
59
  extensions: []
40
60
  extra_rdoc_files: []
41
61
  files:
42
- - lib/active_repo.rb
43
- - lib/bundle_manager.rb
44
- - lib/hook_manager.rb
45
- - lib/lazy_repo.rb
46
- - lib/loud_shell_runner.rb
47
- - lib/migrator.rb
48
- - lib/needs_manager.rb
49
- - lib/pre_push_hook.rb
50
- - lib/repo.rb
51
- - lib/shell_runner.rb
52
- - lib/status_checker.rb
53
- - lib/string_extension.rb
54
- - lib/test_case.rb
55
- - lib/test_collection.rb
56
- - lib/test_file_runner.rb
57
- - lib/test_method_runner.rb
58
- - lib/test_runner.rb
59
- - lib/tester.rb
60
- - lib/upper.rb
62
+ - lib/sfb_scripts/bundler/bundle_manager.rb
63
+ - lib/sfb_scripts/hook_manager.rb
64
+ - lib/sfb_scripts/hooks/pre_push_hook.rb
65
+ - lib/sfb_scripts/migrations/migrator.rb
66
+ - lib/sfb_scripts/monkey_patches/string_extension.rb
67
+ - lib/sfb_scripts/needs_manager.rb
68
+ - lib/sfb_scripts/repositories/active_repo.rb
69
+ - lib/sfb_scripts/repositories/lazy_repo.rb
70
+ - lib/sfb_scripts/repositories/repo.rb
71
+ - lib/sfb_scripts/shells/loud_shell_runner.rb
72
+ - lib/sfb_scripts/shells/shell_runner.rb
73
+ - lib/sfb_scripts/test_running/status_checker.rb
74
+ - lib/sfb_scripts/test_running/test_case.rb
75
+ - lib/sfb_scripts/test_running/test_collection.rb
76
+ - lib/sfb_scripts/test_running/test_file_runner.rb
77
+ - lib/sfb_scripts/test_running/test_method_runner.rb
78
+ - lib/sfb_scripts/test_running/test_runner.rb
79
+ - lib/sfb_scripts/tester.rb
80
+ - lib/sfb_scripts/upper.rb
61
81
  - bin/test_runner
62
82
  - bin/app_up
63
83
  homepage: http://github.com/petekinnecom/sfb_scripts/