dev_flow 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/bin/dw CHANGED
@@ -75,6 +75,7 @@ unless command == 'init'
75
75
  end
76
76
  end
77
77
 
78
+ # release is just a alias of command close buth with a option flag set
78
79
  if command == 'release'
79
80
  options[:release] = true
80
81
  command = 'close'
data/lib/dev_flow/app.rb CHANGED
@@ -28,6 +28,14 @@ module DevFlow
28
28
  @config = @config.merge(YAML.load(File.open(@config[:local_config], 'r:utf-8').read))
29
29
  end
30
30
 
31
+ # load roadmap into variable @roadmap
32
+ load_roadmap
33
+
34
+ # suggest user to take those tasks
35
+ @waiting = Hash.new
36
+ end
37
+
38
+ def load_roadmap
31
39
  # load roadmap, reload config
32
40
  if @config[:roadmap] and File.exists? (@config[:roadmap])
33
41
  info "Load roadmap from #{@config[:roadmap]}"
@@ -47,9 +55,6 @@ module DevFlow
47
55
  if @config["whoami"]
48
56
  error "You (#{user_name}) are not in the known member list. You may use 'dw init' to setup the working environment." unless all_member_names.include? @config["whoami"]
49
57
  end
50
-
51
- # suggest user to take those tasks
52
- @waiting = Hash.new
53
58
  end
54
59
 
55
60
  # log message handler
@@ -195,6 +200,7 @@ module DevFlow
195
200
  if @config["git_remote"]
196
201
  info "Rebase you working directory from #{@config["git_remote"]}/devleop"
197
202
  @git.rebase! @config["git_remote"], 'develop'
203
+ load_roadmap # load roadmap again
198
204
  else
199
205
  info "Git remote not defined, skip rebase."
200
206
  end
@@ -227,7 +233,10 @@ module DevFlow
227
233
  unless (is_complete or current_branch == 'develop')
228
234
  switch_to! current_branch
229
235
  `git merge develop`
230
- `git push #{@config[:git_remote]} #{current_branch}` if @config[:git_remote]
236
+ if @config[:git_remote]
237
+ `git push #{@config[:git_remote]} #{current_branch}`
238
+ ask_rebase true # force rebase from git remote
239
+ end
231
240
  end
232
241
  end
233
242
 
@@ -34,7 +34,7 @@ module DevFlow
34
34
  ans = STDIN.gets.chomp!
35
35
  ans = sugguest unless ans.size > 0
36
36
  error "Unknown member! Can not continue." unless all_member_names.include? ans
37
- error "You are not in the team, you should not edit the files under this project" unless @roadmap.team_member_names.include? ans
37
+ error "You are not in the team, you should not edit the files under this project." unless @roadmap.team_member_names.include? ans
38
38
 
39
39
  # find the default git remote server
40
40
  @config["whoami"] = ans
@@ -52,7 +52,7 @@ module DevFlow
52
52
 
53
53
  ans2 = STDIN.gets.chomp!
54
54
  ans2 = suggest unless ans2.size > 0
55
- error "You must define a valid git remote server" unless remotes.include? ans2
55
+ error "You must define a valid git remote server." unless remotes.include? ans2
56
56
 
57
57
  # write out to the local configuration file
58
58
  info "write contents to local configuration file"
data/lib/dev_flow/girc.rb CHANGED
@@ -115,7 +115,7 @@ module DevFlow
115
115
 
116
116
  def stash!
117
117
  unless wd_clean?
118
- info "Save you change to stash"
118
+ info "Stash your local changes"
119
119
  `#{@git} add .`
120
120
  `#{@git} stash`
121
121
  end
@@ -131,8 +131,8 @@ module DevFlow
131
131
  def rebase! remote = 'origin', branch = 'develop'
132
132
  cb = self.current_branch
133
133
  stashed = false
134
+
134
135
  unless self.wd_clean?
135
- info "Stash your local changes"
136
136
  self.stash!
137
137
  stashed = true
138
138
  end
@@ -142,21 +142,24 @@ module DevFlow
142
142
  # `#{@git} pull --rebase #{remote} #{branch}`
143
143
  `#{@git} pull #{remote} #{branch}`
144
144
  else
145
- info "pull branch #{self.current_branch} from remote"
146
- `#{@git} pull #{remote} #{self.current_branch}`
147
145
  info "Switch to branch #{branch}"
148
146
  `#{@git} fetch #{remote}`
149
147
  rslt = `#{@git} checkout #{branch}`
150
148
  raise "Checkout failed: #{rslt}" unless $?.success?
149
+
151
150
  info "Update branch from remote"
152
151
  # rslt = `#{@git} pull --rebase #{remote} #{branch}`
153
152
  rslt = `#{@git} pull #{remote} #{branch}`
154
153
  raise "Pull for #{branch} failed: #{rslt}" unless $?.success?
154
+
155
155
  info "Switch back to branch #{cb}"
156
156
  `#{@git} checkout #{cb}`
157
157
  info "Merge from #{branch}"
158
158
  rslt = `#{@git} merge #{branch}`
159
159
  raise "Merge with #{branch} failed: #{rslt}" unless $?.success?
160
+
161
+ info "pull branch #{self.current_branch} from remote"
162
+ `#{@git} pull #{remote} #{self.current_branch}`
160
163
  end
161
164
 
162
165
  self.stash_pop! if stashed
@@ -1,3 +1,3 @@
1
1
  module DevFlow
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
data/lib/dev_flow.rb CHANGED
@@ -19,6 +19,7 @@ require 'dev_flow/girc'
19
19
 
20
20
  module DevFlow
21
21
  def self.invoke! config, command
22
+ # autoload command required files
22
23
  require "dev_flow/commands/#{command}"
23
24
  klass = command.to_s.capitalize
24
25
  eval(klass).new(config, command).process!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dev_flow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: