projmgr 0.0.7 → 0.0.8

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/NEWS.markdown CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.0.8 (May 10, 2011)
2
+ - Add CVS support Checkin/Checkout/Local Changes
3
+ - Fixed a few output issues
4
+
1
5
  # 0.0.7 (February 24, 2011)
2
6
  - Moved to OptionParser instead of Choice. Choice seems to be abandoned and has issues with ruby 1.9.2+
3
7
 
data/README.markdown CHANGED
@@ -1,25 +1,20 @@
1
- ProjMgr
2
- ===
1
+ # ProjMgr
2
+
3
3
 
4
4
  ProjMgr is a simple source code project manager for updating and checking local changes on multiple projects at once.
5
5
 
6
- The current version is v0.0.6
6
+ The current version is v0.0.8
7
7
 
8
- Requirements
9
- ---
8
+ ## Requirements
10
9
 
11
- * ruby
12
- * rubygems
13
- * choice
10
+ * ruby / rubygems
14
11
 
15
- Installation
16
- ---
12
+ ## Installation
17
13
  Installation is really easy just gem install!
18
14
 
19
- % sudo gem install projmgr
15
+ % gem install projmgr
20
16
 
21
- Usage
22
- ---
17
+ ## Usage
23
18
  Using ProjMgr is fairly simple. Once installation is complete type to create a skeleton config file:
24
19
 
25
20
  % projmgr --create-file
@@ -40,6 +35,18 @@ This will create a empty skeleton config file, ~/.projmgr, edit this file. The f
40
35
  type: git
41
36
  url: git@github.com:hammackj/nessusdb.git
42
37
 
38
+ metasploit:
39
+ name: metasploit
40
+ path: ~/Projects/public/metasploit
41
+ type: svn
42
+ url: https://www.metasploit.com/svn/framework3/trunk/
43
+
44
+ cvstest:
45
+ name: cvstest
46
+ path: ~/Projects/public/cvstest
47
+ type: cvs
48
+ url: hammackj@hammackj.com:/usr/local/cvs
49
+
43
50
  projectname:
44
51
  name:
45
52
  path:
@@ -58,16 +65,14 @@ Once the config file is edited everything is ready to go.
58
65
 
59
66
  Simple usage is as follows:
60
67
 
61
- Checking for local changes
62
- ----
68
+ ### Checking for local changes
63
69
 
64
70
  % projmgr -c
65
71
  [!] ProjMgr has local changes
66
72
  [!] nessusdb has local changes
67
73
 
68
74
 
69
- Updating each project
70
- ----
75
+ ### Updating each project
71
76
 
72
77
  % projmgr -u
73
78
  [*] Updating ProjMgr...
@@ -77,6 +82,5 @@ Updating each project
77
82
 
78
83
  That covers all of the basic usage of ProjMgr.
79
84
 
80
- Contact
81
- ---
85
+ ## Contact
82
86
  You can reach me at jacob[dot]hammack[at]hammackj[dot]com.
data/Rakefile CHANGED
@@ -11,6 +11,7 @@ end
11
11
 
12
12
  task :release => :build do
13
13
  system "gem push projmgr-#{ProjMgr::VERSION}.gem"
14
+ puts "Just released Projmgr v#{ProjMgr::VERSION}. Projmgr is always available in RubyGems!"
14
15
  end
15
16
 
16
17
  task :clean do
data/TODO.markdown CHANGED
@@ -1,9 +1,8 @@
1
1
  # TODO
2
2
 
3
- ## 0.0.8 (March 25, 2011)
3
+ ## 0.0.9 (July 01, 2011)
4
4
  - Add a detect option, to find projects in a directory not managed
5
5
  - Add support for other SCM's
6
- - CVS
7
6
  - Mercurial
8
7
  - Add more rspec tests
9
8
  - Git Class
data/bin/projmgr CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
3
2
 
4
3
  # projmgr - ProjMgr is a simple source code project manager for updating and checking local changes on multiple projects at once.
5
4
  # Jacob Hammack <jacob.hammack@hammackj.com>
@@ -11,6 +10,8 @@
11
10
  # hammackj - 01-09-2011 - Version 0.0.4
12
11
  # hammackj - 02-07-2011 - Version 0.0.5
13
12
  # hammackj - 02-17-2011 - Version 0.0.6
13
+ # hammackj - 03-17-2011 - Version 0.0.7
14
+ # hammackj - 05-10-2011 - Version 0.0.8
14
15
  #
15
16
 
16
17
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '/../lib'))
@@ -63,7 +64,7 @@ module ProjMgr
63
64
  if File.exists?(File.expand_path(CONFIG_FILE)) == false
64
65
  File.open(File.expand_path(CONFIG_FILE), 'w+') do |f|
65
66
  3.times do
66
- f.write("projectname: \n name: \n path: \n type: \n url: \n\n")
67
+ f.write("projectname: \n name: \n path: \n type: \n url: \n\n")
67
68
  end
68
69
  end
69
70
 
@@ -113,8 +114,8 @@ module ProjMgr
113
114
  repo = Svn.new @repos[key]['name'], @repos[key]['path'], @root, @repos[key]['url']
114
115
  elsif @repos[key]['type'] == "git"
115
116
  repo = Git.new @repos[key]['name'], @repos[key]['path'], @root, @repos[key]['url']
116
- #elsif @repos[key]['type'] == "cvs"
117
- # repo = Cvs.new @repos[key]['name'], @repos[key]['path'], @repos[key]['root'], @repos[key]['url']
117
+ elsif @repos[key]['type'] == "cvs"
118
+ repo = Cvs.new @repos[key]['name'], @repos[key]['path'], @repos[key]['root'], @repos[key]['url']
118
119
  end
119
120
 
120
121
  if repo == nil
@@ -131,7 +132,7 @@ module ProjMgr
131
132
  # print "[!] #{@repos[key]['name']} #{status[1]}\n"
132
133
  end
133
134
  elsif @options[:update] != nil
134
- print "[*] Updating #{@repos[key]['name']}...\n #{repo.update}\n"
135
+ print "[*] Updating #{@repos[key]['name']}...#{repo.update}\n"
135
136
  elsif @options[:checkout] != nil
136
137
  print "[*] Checking out #{@repos[key]['name']}...#{repo.checkout}\n"
137
138
  end
data/lib/projmgr.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  module ProjMgr
4
4
  APP_NAME = "projmgr"
5
- VERSION = "0.0.7"
5
+ VERSION = "0.0.8"
6
6
  CONFIG_FILE = "~/.projmgr"
7
7
  end
8
8
 
data/lib/projmgr/cvs.rb CHANGED
@@ -13,39 +13,56 @@ module ProjMgr
13
13
  #
14
14
  # @return [String] The results from the 'cvs co' command
15
15
  def checkout
16
- results = `cd #{@path} && cd .. && cvs co #{@url} && cd #{@root}`
17
-
18
- return results
16
+ if path_exists? == true
17
+ return "path exists, cannot checkout onto an existing repo"
18
+ else
19
+ parent = project_parent_directory
20
+
21
+ cmd = IO.popen "cd #{parent} && CVSROOT=#{@url} cvs co #{@project} &> /dev/null && cd #{@root}"
22
+ results = cmd.readlines
23
+ cmd.close
24
+
25
+ return "project checked out to #{parent}/#{@project}"
26
+ end
19
27
  end
20
28
 
21
29
  # Checks for updates in the target repo
22
30
  #
23
- # @return [String] the results of 'git pull' on the target repository
31
+ # @return [String] the results of 'cvs update' on the target repository
24
32
  def update
25
- results = `cd #{@path} && cvs update -dPA && cd #{@root}`
26
-
27
- if results =~ /Already up-to-date./
28
- return "Already up-to-date!\n"
29
- else
30
- return results
31
- end
33
+ if path_exists? == false
34
+ return "path does not exists, cannot update repository"
35
+ else
36
+ results = `cd #{@path} && cvs update 2>&1 && cd #{@root}`
37
+ results = results.split("\n")
38
+
39
+ results.delete_if do |x|
40
+ x =~ /cvs update: /
41
+ end
42
+
43
+ if results.empty?
44
+ return "Already up-to-date!"
45
+ else
46
+ return results
47
+ end
48
+ end
32
49
  end
33
50
 
34
51
  # Checks for local changes in the target repository
35
52
  #
36
53
  # @return [Boolean] if there is local changes or not
37
54
  def has_local_changes?
38
- results = `cd #{@path} && cvs status && cd #{@root}`
55
+ if path_exists? == false
56
+ return false, "path does not exists, please check the path or check it out"
57
+ else
58
+ results = `cd #{@path} && cvs -q status | grep ^[?F] | grep -v \"to-date\" && cd #{@root}`
39
59
 
40
- #if results !~ /nothing to commit/
41
- # return true
42
- #elsif results =~ /Your branch is ahead of/
43
- # return true
44
- #elsif results =~ /Untracked files/
45
- # return true
46
- #else
47
- return false
48
- #end
60
+ if results =~ /\? (.*)/
61
+ return true, "has local changes"
62
+ else
63
+ return false, "has no local changes"
64
+ end
65
+ end
49
66
  end
50
67
  end
51
68
  end
data/lib/projmgr/git.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  require 'projmgr/scm'
4
4
 
5
5
  module ProjMgr
6
-
6
+
7
7
  # A wrapper class for interacting with a git repository
8
8
  #
9
9
  # @author Jacob Hammack <jacob.hammack@hammackj.com>
@@ -18,51 +18,51 @@ module ProjMgr
18
18
  return "path exists, cannot checkout onto an existing repo"
19
19
  else
20
20
  parent = project_parent_directory
21
-
21
+
22
22
  cmd = IO.popen "cd #{parent} && git clone #{@url} &> /dev/null && cd #{@root}"
23
23
  results = cmd.readlines
24
24
  cmd.close
25
-
25
+
26
26
  return "project checked out to #{parent}/#{@project}"
27
27
  end
28
28
  end
29
29
 
30
30
  # Checks for updates in the target repository
31
- #
31
+ #
32
32
  # @return [String] the results of 'git pull' on the target repository
33
33
  def update
34
34
  if path_exists? == false
35
35
  return "path does not exists, cannot update repository"
36
36
  else
37
- results = `cd #{@path} && git pull && cd #{@root}`
38
-
39
- if results =~ /Already up-to-date./
40
- return "Already up-to-date!\n"
41
- else
42
- return results
43
- end
37
+ results = `cd #{@path} && git pull && cd #{@root}`
38
+
39
+ if results =~ /Already up-to-date./
40
+ return "Already up-to-date!"
41
+ else
42
+ return results
43
+ end
44
44
  end
45
45
  end
46
-
46
+
47
47
  # Checks for local changes in the target repository
48
48
  #
49
49
  # @return [Boolean] if there is local changes or not
50
50
  def has_local_changes?
51
- if path_exists? == false
51
+ if path_exists? == false
52
52
  return false, "path does not exists, please check the path or check it out"
53
53
  else
54
- results = `cd #{@path} && git status && cd #{@root}`
54
+ results = `cd #{@path} && git status && cd #{@root}`
55
55
 
56
- if results !~ /nothing to commit/
56
+ if results !~ /nothing to commit/
57
57
  return true, "has local changes"
58
58
  elsif results =~ /Your branch is ahead of/
59
59
  return true, "has local changes"
60
60
  elsif results =~ /Untracked files/
61
61
  return true, "has local changes"
62
- else
62
+ else
63
63
  return false, "has no local changes"
64
64
  end
65
65
  end
66
66
  end
67
- end
67
+ end
68
68
  end
data/lib/projmgr/svn.rb CHANGED
@@ -3,23 +3,23 @@
3
3
  require 'projmgr/scm'
4
4
 
5
5
  module ProjMgr
6
-
6
+
7
7
  # A parent class for interacting with a source code repository
8
8
  #
9
9
  # @author Jacob Hammack <jacob.hammack@hammackj.com>
10
10
  class Svn < Scm
11
-
11
+
12
12
  # Checks out a svn repo and places it, in the path specified by the @path variable
13
13
  #
14
14
  # @return [String] The results from the 'svn checkout' command
15
15
  def checkout
16
16
  if path_exists? == true
17
17
  return "path exists, cannot checkout onto an existing repo"
18
- else
19
- parent = project_parent_directory
20
-
18
+ else
19
+ parent = project_parent_directory
20
+
21
21
  results = `cd #{parent} && svn checkout #{@url} #{@project} && cd #{@root}`
22
-
22
+
23
23
  if results =~ /Could not resolve hostname/
24
24
  return "unable to resolve hostname"
25
25
  else
@@ -27,18 +27,22 @@ module ProjMgr
27
27
  end
28
28
  end
29
29
  end
30
-
30
+
31
31
  # Checks for updates in the target repo
32
- #
32
+ #
33
33
  # @return [String] the results of 'git pull' on the target repository
34
34
  def update
35
35
  if path_exists? == true
36
- results = `cd #{@path} && svn stat && svn update && cd #{@root}`
37
- else
36
+ results = `cd #{@path} && svn stat && svn update && cd #{@root}`
37
+ else
38
38
  return "path does not exists, cannot update repository"
39
- end
40
-
41
- return results
39
+ end
40
+
41
+ if results.split("\n").size == 1
42
+ return results.chomp
43
+ else
44
+ return "\n" + results
45
+ end
42
46
  end
43
47
 
44
48
  # Checks for local changes in the target repository
@@ -47,9 +51,9 @@ module ProjMgr
47
51
  def has_local_changes?
48
52
  if path_exists? == false
49
53
  return false, "Path does not exists, please check the path or check it out"
50
- else
54
+ else
51
55
  results = `cd #{@path} && svn stat && cd #{@root}`
52
-
56
+
53
57
  if results.length > 0
54
58
  return true, "has local changes"
55
59
  else
data/projmgr.gemspec CHANGED
@@ -6,28 +6,27 @@ $:.unshift(File.join(File.dirname(base), 'lib'))
6
6
  require 'projmgr'
7
7
 
8
8
  Gem::Specification.new do |s|
9
- s.name = ProjMgr::APP_NAME
10
- s.version = ProjMgr::VERSION
11
- s.homepage = "http://github.com/hammackj/projmgr/"
12
- s.summary = ProjMgr::APP_NAME
13
- s.description = "#{ProjMgr::APP_NAME} is a source code managment tool for automating project managment"
9
+ s.name = ProjMgr::APP_NAME
10
+ s.version = ProjMgr::VERSION
11
+ s.homepage = "http://github.com/hammackj/projmgr/"
12
+ s.summary = ProjMgr::APP_NAME
13
+ s.description = "#{ProjMgr::APP_NAME} is a source code managment tool for automating project managment"
14
14
  s.license = "BSD"
15
-
16
- s.author = "Jacob Hammack"
17
- s.email = "jacob.hammack@hammackj.com"
18
-
19
- s.files = Dir['[A-Z]*'] + Dir['lib/**/*'] + ['projmgr.gemspec']
20
- s.default_executable = ProjMgr::APP_NAME
21
- s.executables = [ProjMgr::APP_NAME]
22
- s.require_paths = ["lib"]
23
-
24
- s.required_rubygems_version = ">= 1.3.6"
25
- s.rubyforge_project = ProjMgr::APP_NAME
26
-
15
+
16
+ s.author = "Jacob Hammack"
17
+ s.email = "jacob.hammack@hammackj.com"
18
+
19
+ s.files = Dir['[A-Z]*'] + Dir['lib/**/*'] + ['projmgr.gemspec']
20
+ s.default_executable = ProjMgr::APP_NAME
21
+ s.executables = [ProjMgr::APP_NAME]
22
+ s.require_paths = ["lib"]
23
+
24
+ s.required_rubygems_version = ">= 1.5.2"
25
+ s.rubyforge_project = ProjMgr::APP_NAME
26
+
27
27
  s.add_development_dependency("rspec", ">= 2.5.0")
28
28
  s.add_development_dependency("rcov", ">= 0.9.9")
29
-
30
- s.has_rdoc = 'yard'
31
- s.extra_rdoc_files = ["README.markdown", "LICENSE", "NEWS.markdown", "TODO.markdown"]
32
-
29
+
30
+ s.has_rdoc = 'yard'
31
+ s.extra_rdoc_files = ["README.markdown", "LICENSE", "NEWS.markdown", "TODO.markdown"]
33
32
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: projmgr
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.7
5
+ version: 0.0.8
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jacob Hammack
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-02-24 00:00:00 -06:00
13
+ date: 2011-05-10 00:00:00 -05:00
14
14
  default_executable: projmgr
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 1.3.6
82
+ version: 1.5.2
83
83
  requirements: []
84
84
 
85
85
  rubyforge_project: projmgr