big_keeper 0.1.0 → 0.2.0

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: 9b396b98833d0bbe44d9345410e70963209fcb7b
4
- data.tar.gz: 956e4effcef9a81e3c3e9eb062882f2b12ea0a5f
3
+ metadata.gz: 614030e993375adb543b94c896f0a9c140e1aeb7
4
+ data.tar.gz: ee9dae88f9b0f8057907240b11a0bc4d74cd1a43
5
5
  SHA512:
6
- metadata.gz: 0ed9db1e01734561b65d052fb2fbfab216e2c26753ef3d37374ebf0995da3ffe3bc6b6ed2e2642f94bea25ac0217fdae0d7d873429eae6993af58f0e2e85d536
7
- data.tar.gz: 468006350087e7a75dbf23dbb1edd94db6beae239d4a8e62cb031afd9011ec0b2e5fa17b02771aa4018e1e3244b1867cafd24f1f2486b469834f675f94f32418
6
+ metadata.gz: 1e407a4b7fcdc8c12247476dca57d04df0bf159d66d360235d06f45870e877b6c525c8730327e57f64063335c8904e29b59b2ff8f72e3d7f8c7f39db8f3e50b4
7
+ data.tar.gz: 567f52bb566f129a5bd6e232d3c1269a3b18df5afeb7c3f7f0ff994950ec22ab06b618a848c2a4a0168cee0e28793a720bf23c40f353133781ea9829b6fb12f6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- big_keeper (0.1.0)
4
+ big_keeper (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://ruby.taobao.org/
@@ -26,7 +26,7 @@ module BigKeeper
26
26
  BigkeeperParser.module_names.each do |module_name|
27
27
  module_git = BigkeeperParser.module_git(module_name)
28
28
  PodfileOperator.new.find_and_replace("#{path}/Podfile",
29
- %Q('#{module_name}'),
29
+ module_name,
30
30
  ModuleType::GIT,
31
31
  GitInfo.new(module_git, GitType::BRANCH, 'develop'))
32
32
  end
@@ -38,6 +38,11 @@ module BigKeeper
38
38
  end
39
39
 
40
40
  # Start home feature
41
+ GitOperator.new.git_checkout(path, 'master') if GitOperator.new.has_remote_branch(path, 'master')
42
+ GitOperator.new.git_checkout(path, 'develop') if GitOperator.new.has_remote_branch(path, 'develop')
43
+
44
+ GitOperator.new.pull(path, 'develop') if GitOperator.new.has_remote_branch(path, 'develop')
45
+
41
46
  GitflowOperator.new.start(path, feature_name, GitflowType::FEATURE)
42
47
 
43
48
  # Modify podfile as path and Start modules feature
@@ -53,7 +58,7 @@ module BigKeeper
53
58
  GitOperator.new.push(path, branch_name)
54
59
 
55
60
  # Open home workspace
56
- p `open #{path}/*.xcworkspace`
61
+ `open #{path}/*.xcworkspace`
57
62
  ensure
58
63
  end
59
64
  end
@@ -36,7 +36,7 @@ module BigKeeper
36
36
  p `pod install --project-directory=#{path}`
37
37
 
38
38
  # Open home workspace
39
- p `open #{path}/*.xcworkspace`
39
+ `open #{path}/*.xcworkspace`
40
40
  ensure
41
41
  end
42
42
  end
@@ -52,7 +52,7 @@ module BigKeeper
52
52
  p `pod install --project-directory=#{path}`
53
53
 
54
54
  # Open home workspace
55
- p `open #{path}/*.xcworkspace`
55
+ `open #{path}/*.xcworkspace`
56
56
  end
57
57
  ensure
58
58
  end
@@ -45,7 +45,7 @@ module BigKeeper
45
45
  branch_name = GitOperator.new.current_branch(module_full_path)
46
46
 
47
47
  PodfileOperator.new.find_and_replace("#{path}/Podfile",
48
- %Q('#{module_name}'),
48
+ module_name,
49
49
  ModuleType::GIT,
50
50
  GitInfo.new(module_git, GitType::BRANCH, branch_name))
51
51
 
@@ -58,6 +58,16 @@ module BigKeeper
58
58
  branch_name = "#{GitflowType.name(type)}/#{name}"
59
59
  module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
60
60
 
61
+ if !File.exist? module_full_path
62
+ module_git = BigkeeperParser.module_git(module_name)
63
+ GitOperator.new.clone(File.expand_path("#{module_full_path}/../"), module_git)
64
+ end
65
+
66
+ GitOperator.new.git_checkout(module_full_path, 'master') if GitOperator.new.has_remote_branch(module_full_path, 'master')
67
+ GitOperator.new.git_checkout(module_full_path, 'develop') if GitOperator.new.has_remote_branch(module_full_path, 'develop')
68
+
69
+ GitOperator.new.pull(module_full_path, 'develop') if GitOperator.new.has_remote_branch(module_full_path, 'develop')
70
+
61
71
  GitflowOperator.new.start(module_full_path, name, type)
62
72
  GitOperator.new.push(module_full_path, branch_name)
63
73
 
@@ -65,7 +75,7 @@ module BigKeeper
65
75
 
66
76
  module_path = BigkeeperParser.module_path(user, module_name)
67
77
  PodfileOperator.new.find_and_replace("#{path}/Podfile",
68
- %('#{module_name}'),
78
+ module_name,
69
79
  ModuleType::PATH,
70
80
  module_path)
71
81
  end
@@ -82,7 +92,7 @@ module BigKeeper
82
92
  module_git = BigkeeperParser.module_git(module_name)
83
93
 
84
94
  PodfileOperator.new.find_and_replace("#{path}/Podfile",
85
- %Q('#{module_name}'),
95
+ module_name,
86
96
  ModuleType::GIT,
87
97
  GitInfo.new(module_git, GitType::BRANCH, 'develop'))
88
98
  end
@@ -7,6 +7,16 @@ module BigKeeper
7
7
  end
8
8
  end
9
9
 
10
+ def has_remote_branch(path, branch_name)
11
+ has_branch = false
12
+ IO.popen("cd #{path}; git branch -a") do |io|
13
+ io.each do |line|
14
+ has_branch = true if line =~ /remotes\/origin\/#{branch_name}/
15
+ end
16
+ end
17
+ has_branch
18
+ end
19
+
10
20
  def has_branch(path, branch_name)
11
21
  has_branch = false
12
22
  IO.popen("cd #{path}; git branch -a") do |io|
@@ -16,9 +16,10 @@ module BigKeeper
16
16
  clear_flag = 'Already initialized for gitflow'
17
17
  IO.popen('git flow init -d') do |io|
18
18
  io.each do |line|
19
- unless line.include? clear_flag
20
- `git push origin master`
21
- `git push origin develop`
19
+ if !line.include? clear_flag
20
+ GitOperator.new.push(module_full_path, 'master') if !GitOperator.new.has_remote_branch(module_full_path, 'master')
21
+ GitOperator.new.push(module_full_path, 'develop') if !GitOperator.new.has_remote_branch(module_full_path, 'develop')
22
+ break
22
23
  end
23
24
  end
24
25
  end
@@ -55,21 +55,21 @@ module BigKeeper
55
55
  def generate_module_config(module_name, module_type, source)
56
56
  module_config = ''
57
57
  if ModuleType::PATH == module_type
58
- module_config = %Q( pod #{module_name}, :path => '#{source}')
58
+ module_config = %Q( pod '#{module_name}', :path => '#{source}')
59
59
  elsif ModuleType::GIT == module_type
60
60
  # puts source.base
61
61
  # puts source.addition
62
62
  if GitType::BRANCH == source.type
63
- module_config = %Q( pod '#{module_name}', :git => '#{source.base}', :branch => '#{source.addition}')
63
+ module_config = %Q( pod '#{module_name}', :git => '#{source.base}', :branch => '#{source.addition}')
64
64
  elsif GitType::TAG == source.type
65
- module_config = %Q( pod '#{module_name}', :git => '#{source.base}', :tag => '#{source.addition}')
65
+ module_config = %Q( pod '#{module_name}', :git => '#{source.base}', :tag => '#{source.addition}')
66
66
  elsif GitType::COMMIT == source.type
67
- module_config = %Q( pod '#{module_name}', :git => '#{source.base}', :commit => '#{source.addition}')
67
+ module_config = %Q( pod '#{module_name}', :git => '#{source.base}', :commit => '#{source.addition}')
68
68
  else
69
- module_config = %Q( pod '#{module_name}', :git => '#{source.base}')
69
+ module_config = %Q( pod '#{module_name}', :git => '#{source.base}')
70
70
  end
71
71
  else
72
- module_config = %Q( pod #{module_name}, '#{source}')
72
+ module_config = %Q( pod '#{module_name}', '#{source}')
73
73
  end
74
74
  module_config
75
75
  end
@@ -1,3 +1,3 @@
1
1
  module BigKeeper
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: big_keeper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - mmoaay