chid 0.1.4 → 0.1.5

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: 03442575a6b3ffa0fcd60f867ac6d95827c87144
4
- data.tar.gz: c6cadbbf436b85a9e6b72a2257902414fb17e126
3
+ metadata.gz: 594d77b67587ed2a523c044bf7920d28d563e243
4
+ data.tar.gz: b1e05442eeee7ef9969e0905d8c49db6eabfb7ce
5
5
  SHA512:
6
- metadata.gz: a70853be7604a95274f0f069d5f9f9a70b52a2568bd4841e45f9d052efba9ba5bbdf3ff41de94b3d9cc52860ad0e3a18a355fce7fb1e4376154ffd833f44f47e
7
- data.tar.gz: ff2c4a51b2ea646ccce92c9c71a1619e2dbda433c3c1752ce63c7e6554031240e62e1270f0a10c03e15aa9147b00db9315b5052d4a2377a5a7e9a472123a7c69
6
+ metadata.gz: 1c2e20c9a2d81a8ec6846665682010f7bbc89fea199034370e2947882905638d740acd4906ec334472b1f42967a7eeeb6e6bf3e87744d6563a241d7edbeb2ac3
7
+ data.tar.gz: 91a5214c483d2ea03b538564af5b055fa7725251461f78db90cbfde78a055973a74e32d0b7a5335f283c801f3d71c7cd83a2ceb86a6c08f0b0365d9d87ea2dc4
@@ -1,3 +1,8 @@
1
+ ### 0.1.5
2
+
3
+ * Update:
4
+ - Chid Gitflow Command
5
+
1
6
  ### 0.1.4
2
7
 
3
8
  * Add:
@@ -29,20 +29,47 @@ Usage:
29
29
  - specific file have now this line
30
30
  - this is the description line two
31
31
 
32
+ Signed-off-by: "YourName" "yourEmail@mail.com"
33
+
34
+ Options:
35
+
36
+ -A Will concat the title with 'Add'
37
+ -R Will concat the title with 'Remove'
38
+ -U Will concat the title with 'Update'
39
+ -Ref Will concat the title with 'Refactor'
40
+ -F Will concat the title with 'Fix'
41
+
32
42
  DESC
33
43
 
34
- self.arguments = []
44
+ self.arguments = ['-A', '-R', '-U', '-Ref', '-F']
35
45
 
36
46
  def run
37
47
  commit = build_commit
38
48
  system("git commit -sm \"#{commit}\"")
39
- system("git push origin #{branch}")
49
+ system("git push origin #{branch}") if do_push?
50
+ end
51
+
52
+ def first_option
53
+ @first_option ||= self.class.arguments.select { |a| options[a] }.compact.join(' ')
54
+ end
55
+
56
+ def first_option_kind
57
+ options_titles = {
58
+ '-A' => 'Add',
59
+ '-U' => 'Update',
60
+ '-R' => 'Remove',
61
+ '-U' => 'Update',
62
+ '-Ref' => 'Refactor',
63
+ '-F' => 'Fix'
64
+ }
65
+
66
+ options_titles[first_option]
40
67
  end
41
68
 
42
69
  def build_commit
43
70
  @commit_lines = "\n"
44
- commit_kind = add_commit_kind
45
- commit_title = add_commit_title
71
+ commit_kind = first_option_kind || add_commit_kind
72
+ commit_title = add_commit_title(commit_kind)
46
73
  add_commit_description
47
74
  commit = "#{branch_name} #{commit_kind} #{commit_title} \n #{@commit_lines}"
48
75
  end
@@ -55,21 +82,24 @@ Usage:
55
82
  @branch_name ||= branch[/\w{1,}\/#?\d{1,}/] || branch
56
83
  end
57
84
 
85
+ def prompt
86
+ @prompt ||= TTY::Prompt.new
87
+ end
88
+
58
89
  def add_commit_kind
59
- @prompt = TTY::Prompt.new
60
90
  choices = ['Add', 'Remove','Update', 'Refactor','Fix']
61
- result = @prompt.select('Select commit type: ', choices)
91
+ result = prompt.select('Select commit type: ', choices)
62
92
  end
63
93
 
64
- def add_commit_title
94
+ def add_commit_title(kind_title)
65
95
  puts 'Tell me the commit title'
66
- print '> '
96
+ print "> #{kind_title} "
67
97
  commit_title = STDIN.gets.strip
68
98
  end
69
99
 
70
100
  def add_commit_description
71
101
  puts 'Tell me the commit description, one action per line'
72
- print "> "
102
+ print "> #{} "
73
103
  commit_description ="- #{STDIN.gets.strip} \n"
74
104
  @commit_lines << commit_description
75
105
  add_commit_description unless did_commit_finished?
@@ -77,13 +107,13 @@ Usage:
77
107
 
78
108
  def do_push?
79
109
  answers = ['Yes','No']
80
- result_should_push = @prompt.select('Push changes?', answers)
110
+ result_should_push = prompt.select('Push changes?', answers)
81
111
  result_should_push == 'Yes'
82
112
  end
83
113
 
84
114
  def did_commit_finished?
85
115
  answers = ['Yes','No']
86
- result_description_finished = @prompt.select('more?', answers)
116
+ result_description_finished = prompt.select('more?', answers)
87
117
  result_description_finished == 'No'
88
118
  end
89
119
  end
@@ -1,3 +1,3 @@
1
1
  module Chid
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rachid Calazans