sfb_scripts 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c3ad38215f4249ca5652663a96aa9ef60fab5e35
4
- data.tar.gz: 6e5446a3f26ec027a7d56500f614231ca42bc319
3
+ metadata.gz: 7b7e35b7d495028d01f0666488b16b4e7394245a
4
+ data.tar.gz: 808d270802a6e27573e3109772d5b89748734bd6
5
5
  SHA512:
6
- metadata.gz: 4467e3a0c8df9978c713fd1e2e3f79be254ffed509986f73a049fbc2f93df27924a460a0f89db81dca7588451fcae644330fb711a1604e967b7f7b75fa8b07e0
7
- data.tar.gz: e14fe39d5eac9bf158a1defdc81852eb3e48d893a2eef1c8206eaaf182289f2bb2f9c16a5a0b6564217bfd03695587c60bc7f653c1842ab269b9e25621e85e17
6
+ metadata.gz: dcfdec107a2c4040d91a7edfa9a882a99cd0116364eed5ff834a87ca1176ffc4b2e243bd40a0ba0ce14afc559c0a1f6dc790fc2f641f33628439620ef7dae209
7
+ data.tar.gz: f060b3d98d0b96486daf9accaa4844b933f2aae942c078271e44404ed6855c27dbcfc93c7630a6f6eae335acebb96bfd4fbf40724715692d87303f3ebe4d4324
data/bin/app_up CHANGED
@@ -5,6 +5,31 @@ require_relative '../lib/sfb_scripts/upper'
5
5
 
6
6
  class CLI < Thor
7
7
 
8
+ def initialize(args, options, config)
9
+ # reset --hard hack!
10
+ #
11
+ # if the -g option is passed,
12
+ # we concatenate the rest of the
13
+ # command into a single string.
14
+ #
15
+ # This prevents Thor from interpreting
16
+ # app_up -g reset --hard
17
+ # as having the flags -g and --hard
18
+ #
19
+ # (we want to ignore the --hard
20
+ # and just pass it on to git)
21
+
22
+ action_flag_index = options.find_index('-g') || options.find_index('--git-action') || options.find_index('--action')
23
+
24
+ if action_flag_index
25
+ new_options = options[0..action_flag_index]
26
+ new_options << options[action_flag_index+1 .. -1].join(' ')
27
+ options = new_options
28
+ end
29
+
30
+ super(args, options, config)
31
+ end
32
+
8
33
  #
9
34
  # REBASE
10
35
  #
@@ -15,10 +40,13 @@ class CLI < Thor
15
40
  option :ignore, type: :array, desc: "Directories matching this pattern will be ignored. Example: 'app_up --ignore engines' will not bundle or migrate in a directory matching the word engines. You can specify multiple patterns: 'app_up --ignore dir1 dir2"
16
41
  option :on_branch, desc: "Rebase the current branch onto it's upstream counterpart. [Example: While on branch (feature_branch), using the --on-branch flag will yield the git command: 'git pull --rebase origin feature_branch'", default: 'master', default: false
17
42
  option :git_action, aliases: ['--action', '-g'], type: :array, desc: "Specify what command to pass to git [Example: app_up --git-action 'pull --rebase origin branch_name']. Defaults to 'pull --rebase origin master'."
43
+ option :finish_rebase, aliases: ['--finish-merge'], type: :boolean, desc: "Recovers from rebase or merge conflicts"
18
44
 
19
45
  def up
20
46
  if options[:no_git]
21
47
  Upper.no_git(options)
48
+ elsif options[:finish_rebase]
49
+ Upper.finish_rebase(options)
22
50
  elsif options[:on_branch]
23
51
  Upper.rebase_on_branch!(options)
24
52
  elsif options[:git_action]
@@ -13,7 +13,8 @@ class NeedsManager
13
13
  def initialize(task, needs, options)
14
14
  @log_file = log_file_for(task)
15
15
  @needs = needs
16
- @options = options
16
+ # symbolize_keys
17
+ @options = options.inject({}){|results,(k,v)| results[k.to_sym] = v; results}
17
18
  @env = {}
18
19
  end
19
20
 
@@ -1,14 +1,13 @@
1
1
  class ActiveRepo < Repo
2
2
 
3
3
  def alter!(git_command)
4
- shell.notify "\nRebasing current branch on master:"
4
+ shell.notify "\nUpdating repo state:"
5
5
  up do
6
6
  # will raise an error with merge conflicts
7
7
  begin
8
8
  shell.run "git #{git_command}"
9
9
  rescue ShellRunner::CommandFailureError
10
10
  puts "Unable to rebase. Maybe you need to stash local changes, or there are rebase conflicts"
11
- puts `git status`
12
11
  exit
13
12
  end
14
13
  end
@@ -42,6 +41,11 @@ class ActiveRepo < Repo
42
41
  end
43
42
  end
44
43
 
44
+ def compare_with_reflog
45
+ old_sha = shell.run "git rev-parse HEAD@{2}"
46
+ set_files_changed(old_sha)
47
+ end
48
+
45
49
  def fetch_origin
46
50
  shell.run 'git fetch origin'
47
51
  end
@@ -31,7 +31,7 @@ class Repo
31
31
  end
32
32
 
33
33
  def grep(regex, file_pattern: '*')
34
- results = shell.run("git grep '#{regex}' -- '#{file_pattern}'").split("\n")
34
+ results = shell.run("git grep --untracked '#{regex}' -- '#{file_pattern}'").split("\n")
35
35
  results.map do |result|
36
36
  interpret_grep_result(result)
37
37
  end
@@ -8,7 +8,10 @@ class TestRunner
8
8
 
9
9
  # this could use some love
10
10
  def run(tests)
11
- if tests.is_one_test_method?
11
+ if tests.empty?
12
+ shell.warn "Unable to identify any tests."
13
+ exit
14
+ elsif tests.is_one_test_method?
12
15
  run_method(tests.first)
13
16
  elsif tests.in_one_file? && tests.all? {|t| t.is_method? }
14
17
  shell.notify "Multiple matches in same file. Running that file."
@@ -35,13 +35,18 @@ class Upper
35
35
  new(env).no_git
36
36
  end
37
37
 
38
+ def self.finish_rebase(options)
39
+ env = NeedsManager.configure(:up, needs, with_defaults(options).merge(repo_type: :active))
40
+ new(env).finish_rebase
41
+ end
42
+
38
43
  def self.install_hooks(options)
39
44
  env = NeedsManager.configure(:up, needs, with_defaults(options).merge(repo_type: :lazy))
40
45
  new(env).install_hooks
41
46
  end
42
47
 
43
48
  def self.pre_push_hook(git_command, options)
44
- env = NeedsManager.configure(:up, needs, with_defaults(options).merge(repo_type: :lazy))
49
+ env = NeedsManager.configure(:up, needs, with_defaults(options).merge(repo_type: :active))
45
50
  new(env).pre_push_hook(git_command)
46
51
  end
47
52
 
@@ -72,6 +77,12 @@ class Upper
72
77
  migrator.migrate_where_necessary
73
78
  end
74
79
 
80
+ def finish_rebase
81
+ repo.compare_with_reflog
82
+ bundler.bundle_where_necessary
83
+ migrator.migrate_where_necessary
84
+ end
85
+
75
86
  def install_hooks
76
87
  HookManager.install!(env)
77
88
  end
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: 1.2.0
4
+ version: 1.2.1
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-30 00:00:00.000000000 Z
11
+ date: 2014-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor