utsup 0.1.3 → 0.1.4

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.
data.tar.gz.sig CHANGED
@@ -1,3 +1,3 @@
1
- Va�“�$�Vó��Sku��n���}���D7uO��2��?E-ۇ�@mlo��9�#n
2
- ��%q7&��Ӣ�&����-�d%}Q�I�@?`
3
- ���i��6��HY�yY����
1
+ �N& |4R�}je�c�)m���
2
+ ��oYL 1��6 ��:��A���ׇ=$�4� F8�Zl����ǒ��œg��`��g4o':(��e_xPf\Y4T���J��="�a>\d�`Q�I��gL�߷������1jzǀ��M�?/���7��V">�������;p�$`�a�c����{�#�(7��ǒM��]���7BDq�\Rc؝�_�� �~�)�.H��5?E_nFc�
3
+ o(Z3��+�f
@@ -5,10 +5,6 @@ PostInstall.txt
5
5
  README.rdoc
6
6
  Rakefile
7
7
  lib/config/utsup.sample
8
- lib/hooks/post-commit
9
- lib/hooks/post-checkout
10
- lib/hooks/post-merge
11
- lib/hooks/post-receive
12
8
  lib/sup.rb
13
9
  lib/sup/differ/differ_control.rb
14
10
  lib/sup/differ/differ_run.rb
@@ -1,6 +1,5 @@
1
1
  module Sup
2
- VERSION = '0.1.3'
3
- GIT_HOOKS = %w(post-commit post-receive post-merge post-checkout) #TODO: post-rebase?
2
+ VERSION = '0.1.4'
4
3
 
5
4
  GLOBAL_CONFIG_PATH = '~/.utsup/config.yml'
6
5
  GLOBAL_PROJECT_CONFIG_PATH = '~/.utsup/projects.yml'
@@ -69,6 +68,13 @@ module Sup
69
68
  # Init
70
69
  # ===========================
71
70
 
71
+ GIT_HOOKS = {
72
+ "post-checkout" => "sup git checkout $@",
73
+ "post-commit" => "sup git commit",
74
+ "post-merge" => "sup git merge $@",
75
+ "post-receive" => "sup git receive $@"
76
+ }
77
+
72
78
  def init(project_title)
73
79
 
74
80
  # --- project init
@@ -87,20 +93,14 @@ module Sup
87
93
  end
88
94
 
89
95
  # --- write git hooks
90
- #TODO: option to manually add hooks if they already have some...
91
- GIT_HOOKS.each do |hook|
96
+ GIT_HOOKS.each do |hook, command|
92
97
  path = File.join(Dir.pwd, '.git/hooks/', hook)
93
- hook_cmd = File.read(File.join(File.dirname(__FILE__),'hooks',hook))
98
+ exists = File.exists?(path)
94
99
 
95
- if File.exists?(path)
96
- puts "You already have a git hook here: #{path}"
97
- puts "Please make sure it's executable add this to it:"
98
- puts hook_cmd + "\n"
99
- next
100
- end
100
+ next if exists && File.read(path) =~ /#{Regexp.quote(command)}/
101
101
 
102
- File.open(path, 'w', 0775) do |f|
103
- f.write hook_cmd
102
+ File.open(path, (exists ? 'a' : 'w'), 0775) do |f|
103
+ f.puts command
104
104
  end
105
105
  end
106
106
 
@@ -111,12 +111,13 @@ module Sup
111
111
  # ===========================
112
112
 
113
113
  def configure
114
+ begin
115
+ global_config = Yamlize.new GLOBAL_CONFIG_PATH
116
+ project_config = Yamlize.new(File.join(Dir.pwd, PROJECT_CONFIG_PATH)) rescue {}
117
+ global_project_config = Yamlize.new GLOBAL_PROJECT_CONFIG_PATH
114
118
 
115
- global_config = Yamlize.new GLOBAL_CONFIG_PATH
116
- project_config = Yamlize.new(File.join(Dir.pwd, PROJECT_CONFIG_PATH)) rescue {}
117
- global_project_config = Yamlize.new GLOBAL_PROJECT_CONFIG_PATH
118
-
119
- unless global_config['api_key']
119
+ raise unless global_config['api_key']
120
+ rescue
120
121
  setup
121
122
  exit 0
122
123
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utsup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Merwin
@@ -92,10 +92,6 @@ files:
92
92
  - README.rdoc
93
93
  - Rakefile
94
94
  - lib/config/utsup.sample
95
- - lib/hooks/post-commit
96
- - lib/hooks/post-checkout
97
- - lib/hooks/post-merge
98
- - lib/hooks/post-receive
99
95
  - lib/sup.rb
100
96
  - lib/sup/differ/differ_control.rb
101
97
  - lib/sup/differ/differ_run.rb
metadata.gz.sig CHANGED
@@ -1,3 +1,2 @@
1
- �ޯ�t9F���� &��'��#12DO�0����\*c=��M8����~y��8Q;f0��B��KU*}���dp�6�}����+�(o���@X�rob8
2
- ,+a�#p`�{�*Gm>:�y7\)�pwV��L�^��� 䨛��$�������hzX
3
- R{��0���f�9=(-=5Y�!�fu�|.�I(� -~����i}�(�U�
1
+ gV�4�y_����� �I�ɀ-����_�p�����>N[[/H.�oj���Q�VX"Z`�|��nc�{J*�CwHzM�}��W�v:�)������p������]]6�����{��\Qݜ���4QDZ?|�H�'�F���h�_[�w-8�d���X�8��b���v<ڶf��7Q�#�2O(�����S�
2
+ N�!��)�R��9����wu�)8U4���|��Eg����q��7�q�x�^rO��
@@ -1,2 +0,0 @@
1
-
2
- sup git checkout $@
@@ -1,2 +0,0 @@
1
-
2
- sup git commit
@@ -1,2 +0,0 @@
1
-
2
- sup git merge $@
@@ -1,2 +0,0 @@
1
-
2
- sup git receive $@