opskeleton 0.9.5 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a682d5b86347ac3071cf2c08eadf86a29616f52b
4
- data.tar.gz: 10a8db6e1b3899892d40316f89baf1a2b6f23bb3
3
+ metadata.gz: 424df0cdc77d6a9388a5d9f8e1460e5c54afafaf
4
+ data.tar.gz: de491b6eb2668a2d18ed5f5a038b20aeccfbab91
5
5
  SHA512:
6
- metadata.gz: 4e08fad418737ff4af9a1ef1e071a8ed97668144ad50119ff1a69c34f7f9ecd9b4e6c6d1c2704fcbcaed14df75ac6141198385b051eebba3f8bd3a5f759b03da
7
- data.tar.gz: dd8f1d5e8d5dddb8033febd2cdc51d4d01c23ded91aa5fb77a03733222747034aa80a3d5f53bc1e67f5c1214ffd45f5710373c176e10064b9e0bc1108e8cb343
6
+ metadata.gz: 1defa9db7c05c5185458a25f276dba8a2bfc19edb03e0ede6932e569398124f3767c4e2e992f120624f2dfeef59f7738c5b7f31f89af9f826a55bae9e57d92c7
7
+ data.tar.gz: c966937aefc055e34587ab426a7022a1b99b72941871e62dc8aa9a261c7540b27b5ce0195165072a409aa50bd0ced8d1fb65856db147eb5043bfb1f599ef3f92
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- opskeleton (0.9.5)
4
+ opskeleton (0.9.6)
5
5
  aws-sdk (~> 2)
6
6
  bintray_deploy
7
7
  git
@@ -20,7 +20,7 @@ module Opsk
20
20
  if git.changed?
21
21
  say "Listing changes for #{d}:\n\n"
22
22
  git.report
23
- git.master_commit(d,options)
23
+ git.master_commit(options)
24
24
  end
25
25
  rescue => e
26
26
  say "Failed to commit #{d} due to #{e}"
@@ -85,9 +85,9 @@ module Opsk
85
85
  if(!File.exists?("#{path}/.git"))
86
86
  copy_file('templates/gitignore', "#{path}/.gitignore")
87
87
  inside(path) do
88
- run('git init .')
89
- run('git add -A')
90
- run("git commit -m 'initial sandbox import'")
88
+ run('git init .', :verbose => false, :catpure => true)
89
+ run('git add -A', :verbose => false, :catpure => true)
90
+ run("git commit -m 'initial sandbox import'", :verbose => false, :catpure => true)
91
91
  end
92
92
  end
93
93
  end
@@ -2,10 +2,11 @@ require 'git_clone_url'
2
2
 
3
3
  module Opsk
4
4
  class Git
5
- extend Forwardable
5
+ extend ::Forwardable
6
6
 
7
7
 
8
8
  def initialize(d,thor)
9
+ @d = d
9
10
  @g = ::Git.open(d)
10
11
  @thor = thor
11
12
  end
@@ -14,7 +15,7 @@ module Opsk
14
15
  def_delegator :@g, :pull, :pull
15
16
 
16
17
  def changed?
17
- @g.status.changed.keys.length > 0
18
+ git_run('status').include?('modified')
18
19
  end
19
20
 
20
21
  def report
@@ -27,10 +28,18 @@ module Opsk
27
28
  end
28
29
  end
29
30
 
30
- def master_commit(d,options)
31
- resp = @thor.yes? "Commit the changes under #{d}? (y/n)" unless options['all']
31
+ def remaster
32
+ Dir.chdir @d do
33
+ git_run('stash','.')
34
+ git_run('checkout master','.')
35
+ git_run('stash apply stash@\{0\}','.')
36
+ end
37
+ end
38
+
39
+ def master_commit(options)
40
+ resp = @thor.yes? "Commit the changes under #{@d}? (y/n)" unless options['all']
32
41
  if(options['all'] or resp)
33
- @g.checkout('master')
42
+ remaster
34
43
  if options['message']
35
44
  @g.commit_all(options['message'])
36
45
  else
@@ -60,7 +69,16 @@ module Opsk
60
69
 
61
70
  # ruby-git cannot do this (lame)
62
71
  def local_ahead?
63
- %x{git --git-dir=#{@d}/.git --work-tree=#{@d}}.include?('ahead')
72
+ git_run('status').include?('ahead')
73
+ end
74
+
75
+ def git_run(cmd,parent=nil)
76
+ dir = parent || @d
77
+ res = %x{git --git-dir=#{dir}/.git --work-tree=#{dir} #{cmd}}
78
+ if $? != 0
79
+ raise Exception.new("Failed to run #{cmd} due to #{res}")
80
+ end
81
+ res
64
82
  end
65
83
  end
66
84
  end
@@ -49,7 +49,7 @@ module Opsk
49
49
  Dir["modules/*"].reject{|o| not File.directory?(o)}.each do |d|
50
50
  if File.exists?("#{d}/.git")
51
51
  begin
52
- cg = Opsk::CommitGit.new(d,options,self)
52
+ cg = Opsk::Git.new(d,self)
53
53
  if cg.changed?
54
54
  say "Listing changes for #{d}:\n\n"
55
55
  cg.report
@@ -1,3 +1,3 @@
1
1
  module Opskeleton
2
- VERSION = '0.9.5'
2
+ VERSION = '0.9.6'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opskeleton
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5
4
+ version: 0.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - narkisr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-23 00:00:00.000000000 Z
11
+ date: 2015-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor