my_scripts 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY CHANGED
@@ -39,3 +39,7 @@
39
39
  == 0.1.7 / 2010-04-29
40
40
 
41
41
  * Msdn helper extracted - for RubyMine script
42
+
43
+ == 0.1.8 / 2010-05-07
44
+
45
+ * Gitto refactored
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.7
1
+ 0.1.8
@@ -4,11 +4,16 @@ module MyScripts
4
4
  # optionally bumps project version and pushes changes to remote repo
5
5
  #
6
6
  class Gitto < Script
7
+ VERSION_PATTERN = /^(\d+\.\d+\.\d+ # either explicit version (1.2.3)
8
+ (?:\.(.*?))? # possibly followed by .build
9
+ |\.(.*?) # or, just .build
10
+ |\d{1}0{0,2})$/x # or, one digit followed by 0-2 zeroes (100/10/1 - bump major/minor/patch)
11
+
7
12
  def run
8
- usage "[0.1.2 - version, 100/10/1 - bump major/minor/patch, .patch - add patch] Commit message goes here" if @argv.empty?
13
+ usage "[0.1.2 - version, 100/10/1 - bump major/minor/patch, .build - add build] Commit message goes here" if @argv.empty?
9
14
 
10
15
  # First Arg may indicate version command if it matches pattern
11
- version_command = @argv[0] =~ /^(\d+\.\d+\.\d+(?:\.(.*?))?|\.(.*?)|\d{1}0{0,2})$/ ? @argv.shift : nil
16
+ version_command = @argv[0] =~ VERSION_PATTERN ? @argv.shift : nil
12
17
 
13
18
  # All the other args lumped into message, or default message
14
19
  if @argv.empty?
@@ -18,7 +23,7 @@ module MyScripts
18
23
  commit_message = history_message = @argv.join(' ')
19
24
  end
20
25
 
21
- # Updating version if version command set
26
+ # Updating version only if version command set
22
27
  if version_command
23
28
  puts "Updating version with #{version_command}"
24
29
  if history_message
@@ -28,11 +33,15 @@ module MyScripts
28
33
  end
29
34
  end
30
35
 
31
- puts "Committing with message: #{commit_message}"
36
+
37
+ puts "Adding all the changes"
32
38
  system %Q{git add --all}
39
+
40
+ puts "Committing everything with message: #{commit_message}"
33
41
  system %Q{git commit -a -m "#{commit_message}" --author arvicco}
34
42
 
35
- puts "Pushing to remote(s)"
43
+ current_branch = `git branch`.strip
44
+ puts "Pushing to (default) remote for branch: #{current_branch}"
36
45
  system %Q{git push}
37
46
  end
38
47
  end
@@ -15,8 +15,9 @@ module MyScriptsTest
15
15
  context 'No version command' do
16
16
  it 'Commits with message, pushes to remote' do
17
17
  message = 'This is bomb!'
18
- stdout_should_receive "Committing with message: #{message}",
19
- "Pushing to remote(s)"
18
+ stdout_should_receive "Adding all the changes",
19
+ "Committing everything with message: #{message}",
20
+ "Pushing to (default) remote for branch: * master"
20
21
  system_should_receive "git add --all",
21
22
  %Q{git commit -a -m "#{message}" --author arvicco},
22
23
  "git push"
@@ -28,8 +29,9 @@ module MyScriptsTest
28
29
  VERSION_COMMANDS.each do |command|
29
30
  message = 'This is bomb!'
30
31
 
31
- stdout_should_receive "Committing with message: #{message}",
32
- "Pushing to remote(s)"
32
+ stdout_should_receive "Adding all the changes",
33
+ "Committing everything with message: #{message}",
34
+ "Pushing to (default) remote for branch: * master"
33
35
  system_should_receive %Q{rake "version[#{command},#{message}]"},
34
36
  "git add --all",
35
37
  %Q{git commit -a -m "#{message}" --author arvicco},
@@ -40,8 +42,9 @@ module MyScriptsTest
40
42
 
41
43
  it 'Commits and pushes with default timestamped message if no message' do
42
44
  VERSION_COMMANDS.each do |command|
43
- stdout_should_receive "Committing with message: Commit #{Time.now.to_s[0..-6]}",
44
- "Pushing to remote(s)"
45
+ stdout_should_receive "Adding all the changes",
46
+ "Committing everything with message: Commit #{Time.now.to_s[0..-6]}",
47
+ "Pushing to (default) remote for branch: * master"
45
48
  system_should_receive "rake version[#{command}]",
46
49
  "git add --all",
47
50
  %Q{git commit -a -m "Commit #{Time.now.to_s[0..-6]}" --author arvicco},
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 7
9
- version: 0.1.7
8
+ - 8
9
+ version: 0.1.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - arvicco
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-29 00:00:00 +04:00
17
+ date: 2010-05-08 00:00:00 +04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency