oban 0.1.2 → 0.1.3

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.
Files changed (3) hide show
  1. data/lib/oban/oban.rb +35 -21
  2. data/lib/oban/version.rb +1 -1
  3. metadata +3 -3
data/lib/oban/oban.rb CHANGED
@@ -5,6 +5,7 @@ class Oban
5
5
 
6
6
  attr_accessor :config
7
7
  attr_accessor :heroku_remote
8
+ attr_accessor :submods # TODO: should be a list eventually
8
9
 
9
10
  def initialize
10
11
  conf_file = ENV['HOME'] + '/.oban.yml'
@@ -16,7 +17,7 @@ class Oban
16
17
  end
17
18
 
18
19
  self.config = YAML::load(File.open(conf_file) { |f| @stuff = f.read })
19
-
20
+
20
21
  # grab config for current repository (based on github)
21
22
  current = `git remote show origin | grep Fetch`
22
23
 
@@ -42,9 +43,37 @@ class Oban
42
43
 
43
44
  self.heroku_remote = remote
44
45
 
46
+ set_submods
47
+
45
48
  puts colorBlue("using #{heroku_remote}")
46
49
  end
47
50
 
51
+ # only supports one right now -- FIXME
52
+ def set_submods
53
+ submods = `git submodule status`
54
+
55
+ if !submods.empty?
56
+ self.submods = submods.split[1]
57
+
58
+ puts colorBlue("found submodule: #{self.submods}")
59
+ end
60
+
61
+ end
62
+
63
+ def rm_submods
64
+ # rm git modules
65
+ `rm -rf .gitmodules`
66
+
67
+ puts colorBlue("removing submodule: #{self.submods}")
68
+ `rm -rf #{self.submods}/.git`
69
+
70
+ `git rm --cached #{self.submods}`
71
+ end
72
+
73
+ def add_submod_data
74
+ `git add #{self.submods}`
75
+ end
76
+
48
77
  def push
49
78
  # switch to master before anything else
50
79
  `git checkout master`
@@ -66,31 +95,16 @@ class Oban
66
95
  `git branch deploy`
67
96
  `git checkout deploy`
68
97
 
69
- # rm git modules
70
- # needs to be refactored a bit better
71
- `rm -rf .gitmodules`
72
-
73
- #`rm -rf app/models/shared/.git`
74
- `rm -rf app/models/.git`
75
-
76
- `git rm --cached app/models`
77
-
78
- #`git rm --cached app/models`
79
- #`git rm --cached app/models/shared`
80
-
81
- # Time.now.to_i hack?
82
-
83
- `git add app/models`
84
-
85
- #`rm -rf \`find . -mindepth 2 -name .git\``
86
- #`git add .`
98
+ if !self.submods.nil? then
99
+ rm_submods
100
+ add_submod_data
101
+ end
87
102
 
88
103
  # only add remotes if necessary
89
104
  remotes = `git remote`
90
105
 
91
106
  if remotes.match('heroku').nil? then
92
- heroku_remote = ""
93
- `git remote add heroku #{heroku_remote}`
107
+ `git remote add heroku #{self.heroku_remote}`
94
108
  end
95
109
 
96
110
  `git commit -a -m "deploying"`
data/lib/oban/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Oban
2
- VERSION = "0.1.2" unless defined?(::Oban::VERSION)
2
+ VERSION = "0.1.3" unless defined?(::Oban::VERSION)
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oban
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ian Eyberg