Class: Upper

Inherits:
Object
  • Object
show all
Defined in:
lib/sfb_scripts/upper.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ Upper

Returns a new instance of Upper.



36
37
38
39
40
41
# File 'lib/sfb_scripts/upper.rb', line 36

def initialize(env)
  @env = env
  @repo = env[:repo]
  @bundler = env[:bundler]
  @migrator = env[:migrator]
end

Instance Attribute Details

#bundlerObject (readonly)

Returns the value of attribute bundler.



34
35
36
# File 'lib/sfb_scripts/upper.rb', line 34

def bundler
  @bundler
end

#envObject (readonly)

Returns the value of attribute env.



34
35
36
# File 'lib/sfb_scripts/upper.rb', line 34

def env
  @env
end

#migratorObject (readonly)

Returns the value of attribute migrator.



34
35
36
# File 'lib/sfb_scripts/upper.rb', line 34

def migrator
  @migrator
end

#repoObject (readonly)

Returns the value of attribute repo.



34
35
36
# File 'lib/sfb_scripts/upper.rb', line 34

def repo
  @repo
end

Class Method Details

.install_hooks(options) ⇒ Object



24
25
26
27
# File 'lib/sfb_scripts/upper.rb', line 24

def self.install_hooks(options)
  env = NeedsManager.configure(:up, needs, options.merge(repo_type: :lazy))
  new(env).install_hooks
end

.needsObject



5
6
7
# File 'lib/sfb_scripts/upper.rb', line 5

def self.needs
  [:shell, :repo, :bundler, :migrator]
end

.no_git(options) ⇒ Object



19
20
21
22
# File 'lib/sfb_scripts/upper.rb', line 19

def self.no_git(options)
  env = NeedsManager.configure(:up, needs, options.merge(repo_type: :lazy))
  new(env).no_git
end

.pre_push_hook(git_command, options) ⇒ Object



29
30
31
32
# File 'lib/sfb_scripts/upper.rb', line 29

def self.pre_push_hook(git_command, options)
  env = NeedsManager.configure(:up, needs, options.merge(repo_type: :lazy))
  new(env).pre_push_hook(git_command)
end

.rebase_on_master!(options) ⇒ Object



9
10
11
12
# File 'lib/sfb_scripts/upper.rb', line 9

def self.rebase_on_master!(options)
  env = NeedsManager.configure(:up, needs, options.merge(repo_type: :active))
  new(env).rebase_on_master!
end

.up_master!(options) ⇒ Object



14
15
16
17
# File 'lib/sfb_scripts/upper.rb', line 14

def self.up_master!(options)
  env = NeedsManager.configure(:up, needs, options.merge(repo_type: :active))
  new(env).up_master!
end

Instance Method Details

#install_hooksObject



61
62
63
# File 'lib/sfb_scripts/upper.rb', line 61

def install_hooks
  HookManager.install!(env)
end

#no_gitObject



55
56
57
58
59
# File 'lib/sfb_scripts/upper.rb', line 55

def no_git
  env[:shell].notify "\nBundling and migrating without checking diffs:"
  bundler.bundle_where_necessary
  migrator.migrate_where_necessary
end

#pre_push_hook(git_command) ⇒ Object



65
66
67
# File 'lib/sfb_scripts/upper.rb', line 65

def pre_push_hook(git_command)
  PrePushHook.check(git_command, env)
end

#rebase_on_master!Object



49
50
51
52
53
# File 'lib/sfb_scripts/upper.rb', line 49

def rebase_on_master!
  repo.rebase_on_master!
  bundler.bundle_where_necessary
  migrator.migrate_where_necessary
end

#up_master!Object



43
44
45
46
47
# File 'lib/sfb_scripts/upper.rb', line 43

def up_master!
  repo.up_master!
  bundler.bundle_where_necessary
  migrator.migrate_where_necessary
end