projmgr 0.0.6 → 0.0.7

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.
@@ -1,3 +1,6 @@
1
+ # 0.0.7 (February 24, 2011)
2
+ - Moved to OptionParser instead of Choice. Choice seems to be abandoned and has issues with ruby 1.9.2+
3
+
1
4
  # 0.0.6 (February 17, 2011)
2
5
  - Fixed a issue with tabs being generated instead of spaces in the yaml file
3
6
 
File without changes
@@ -1,6 +1,6 @@
1
1
  # TODO
2
2
 
3
- ## 0.0.7 (March 25, 2011)
3
+ ## 0.0.8 (March 25, 2011)
4
4
  - Add a detect option, to find projects in a directory not managed
5
5
  - Add support for other SCM's
6
6
  - CVS
@@ -9,6 +9,4 @@
9
9
  - Git Class
10
10
  - Svn Class
11
11
  - Application class
12
- - Cvs Class
13
- - Remove Choice and switch to option parser. Choice seems to be abandoned and has issues with ruby 1.9.x
14
-
12
+ - Cvs Class
@@ -19,7 +19,7 @@ $stdout.sync = true
19
19
  $stderr.sync = true
20
20
 
21
21
  require 'rubygems'
22
- require 'choice'
22
+ require 'optparse'
23
23
  require 'yaml'
24
24
 
25
25
  require 'projmgr'
@@ -29,7 +29,7 @@ module ProjMgr
29
29
  # ProjMgr Application class
30
30
  #
31
31
  # @author Jacob Hammack <jacob.hammack@hammackj.com>
32
- class ProjMgr
32
+ class Application
33
33
 
34
34
  # Creates a ProjMgr instance
35
35
  #
@@ -40,127 +40,115 @@ module ProjMgr
40
40
  # Main class for the ProjMgr command line tool
41
41
  #
42
42
  def main
43
- Choice.options do
44
- banner "#{APP_NAME} - v#{VERSION}"
45
- header 'Jacob Hammack'
46
- header 'http://hammackj.com'
47
- header "Usage: #{APP_NAME} [OPTIONS]"
48
- header ''
49
-
50
- option :check_local_changes do
51
- short '-c'
52
- long '--check_local_changes'
53
- desc 'Checks local changes in configured scm repositories'
43
+ @options = {}
44
+
45
+ opt = OptionParser.new do |opt|
46
+ opt.banner = "#{APP_NAME} v#{VERSION}\nJacob Hammack\nhttp://www.hammackj.com\n\n"
47
+ opt.banner << "Usage: #{APP_NAME} <options>"
48
+ opt.separator('')
49
+
50
+ opt.on('-c','--check-local-changes','Checks for local changes in configured SCM repositories') do |option|
51
+ @options[:check] = option
54
52
  end
55
-
56
- option :update do
57
- short '-u'
58
- long '--update'
59
- desc 'Updates each configured scm repository'
53
+
54
+ opt.on('-u','--update-repos','Updates each configured SCM repositories') do |option|
55
+ @options[:update] = option
60
56
  end
61
-
62
- option :checkout do
63
- long '--checkout-repos'
64
- desc "Checks out each repo if nothing exists at the 'path' variable"
57
+
58
+ opt.on('--checkout-repos','Checks out each of the configured repositories') do |option|
59
+ @options[:checkout] = option
65
60
  end
66
-
67
- option :create_config do
68
- long '--create-config'
69
- desc 'Creates a skeleton config file to use'
70
- action do
71
- if File.exists?(File.expand_path(CONFIG_FILE)) == false
72
- File.open(File.expand_path(CONFIG_FILE), 'w+') do |f|
73
- 3.times do
74
- f.write("projectname: \n name: \n path: \n type: \n url: \n\n")
75
- end
76
- end
77
61
 
78
- puts "[*] An empty #{CONFIG_FILE} has been created. Please edit and fill in the correct values."
79
- exit
80
- else
81
- puts "[!] #{CONFIG_FILE} already exists. Please delete it if you wish to re-create it."
82
- exit
62
+ opt.on('--create-config','Creates a skeleton configuration file to be used') do |option|
63
+ if File.exists?(File.expand_path(CONFIG_FILE)) == false
64
+ File.open(File.expand_path(CONFIG_FILE), 'w+') do |f|
65
+ 3.times do
66
+ f.write("projectname: \n name: \n path: \n type: \n url: \n\n")
67
+ end
83
68
  end
84
- end
85
- end
86
-
87
- separator ''
88
- separator 'Other Options'
89
69
 
90
- option :help do
91
- short '-h'
92
- long '--help'
93
- desc 'Show this message'
94
- end
95
-
96
- option :version do
97
- short '-v'
98
- long '--version'
99
- desc 'Show version'
100
- action do
101
- puts "#{APP_NAME} - v#{VERSION}"
70
+ puts "[*] An empty #{CONFIG_FILE} has been created. Please edit and fill in the correct values."
71
+ exit
72
+ else
73
+ puts "[!] #{CONFIG_FILE} already exists. Please delete it if you wish to re-create it."
102
74
  exit
103
75
  end
104
76
  end
105
-
106
- footer ''
77
+
78
+ opt.separator ''
79
+ opt.separator 'Other Options'
80
+
81
+ opt.on_tail('-v', '--version', "Shows application version information") do
82
+ puts "#{APP_NAME} - v#{VERSION}"
83
+ exit
107
84
  end
108
85
 
109
- if ARGV.length == 0
110
- puts Choice.help
111
- end
112
-
113
- if File.exists?(File.expand_path(CONFIG_FILE))
114
- @repos = YAML.load_file File.expand_path(CONFIG_FILE)
115
- else
116
- puts "[!] #{CONFIG_FILE} does not exist. Please run projmgr --create-config, to create it."
86
+ opt.on_tail("-?", "--help", "Show this message") do
87
+ puts opt.to_s + "\n"
117
88
  exit
118
89
  end
119
-
120
- begin
121
- @threads = Array.new
122
- @repos.each_key do |key|
123
- t = Thread.new do
124
- if @repos[key]['type'] == "svn"
125
- repo = Svn.new @repos[key]['name'], @repos[key]['path'], @root, @repos[key]['url']
126
- elsif @repos[key]['type'] == "git"
127
- repo = Git.new @repos[key]['name'], @repos[key]['path'], @root, @repos[key]['url']
128
- #elsif @repos[key]['type'] == "cvs"
129
- # repo = Cvs.new @repos[key]['name'], @repos[key]['path'], @repos[key]['root'], @repos[key]['url']
130
- end
131
-
132
- if repo == nil
133
- print "[!] #{key} is a malformed entry please correct it.\n"
134
- next
135
- end
136
-
137
- if Choice.choices[:check_local_changes] != nil
138
- status = repo.has_local_changes?
139
-
140
- if status[0] == true
141
- print "[!] #{@repos[key]['name']} has local changes\n"
142
- #else
143
- # print "[!] #{@repos[key]['name']} #{status[1]}\n"
144
- end
145
- elsif Choice.choices[:update] != nil
146
- print "[*] Updating #{@repos[key]['name']}...\n #{repo.update}\n"
147
- elsif Choice.choices[:checkout] != nil
148
- print "[*] Checking out #{@repos[key]['name']}...#{repo.checkout}\n"
90
+
91
+ opt.separator ''
92
+ end
93
+
94
+ if ARGV.length != 0
95
+ opt.parse!
96
+ else
97
+ puts opt.to_s + "\n"
98
+ exit
99
+ end
100
+
101
+ if File.exists?(File.expand_path(CONFIG_FILE))
102
+ @repos = YAML.load_file File.expand_path(CONFIG_FILE)
103
+ else
104
+ puts "[!] #{CONFIG_FILE} does not exist. Please run projmgr --create-config, to create it."
105
+ exit
106
+ end
107
+
108
+ begin
109
+ @threads = Array.new
110
+ @repos.each_key do |key|
111
+ t = Thread.new do
112
+ if @repos[key]['type'] == "svn"
113
+ repo = Svn.new @repos[key]['name'], @repos[key]['path'], @root, @repos[key]['url']
114
+ elsif @repos[key]['type'] == "git"
115
+ 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']
118
+ end
119
+
120
+ if repo == nil
121
+ print "[!] #{key} is a malformed entry please correct it.\n"
122
+ next
123
+ end
124
+
125
+ if @options[:check] != nil
126
+ status = repo.has_local_changes?
127
+
128
+ if status[0] == true
129
+ print "[!] #{@repos[key]['name']} has local changes\n"
130
+ #else
131
+ # print "[!] #{@repos[key]['name']} #{status[1]}\n"
149
132
  end
133
+ elsif @options[:update] != nil
134
+ print "[*] Updating #{@repos[key]['name']}...\n #{repo.update}\n"
135
+ elsif @options[:checkout] != nil
136
+ print "[*] Checking out #{@repos[key]['name']}...#{repo.checkout}\n"
150
137
  end
151
- @threads << t
152
- end
153
-
154
- @threads.each do |t|
155
- t.join
156
138
  end
157
- rescue Exception => e
158
- puts "[!] Caught Exception, if you feel this is a error please report it at http://github.com/hammackj/projmgr/issues\n"
159
- puts "#{e.inspect}\n #{e.backtrace}"
139
+ @threads << t
140
+ end
141
+
142
+ @threads.each do |t|
143
+ t.join
160
144
  end
145
+ rescue Exception => e
146
+ puts "[!] Caught Exception, if you feel this is a error please report it at http://github.com/hammackj/projmgr/issues\n"
147
+ puts "#{e.inspect}\n #{e.backtrace}"
161
148
  end
162
149
  end
150
+ end
163
151
  end
164
152
 
165
- app = ProjMgr::ProjMgr.new
153
+ app = ProjMgr::Application.new
166
154
  app.main
@@ -2,7 +2,7 @@
2
2
 
3
3
  module ProjMgr
4
4
  APP_NAME = "projmgr"
5
- VERSION = "0.0.6"
5
+ VERSION = "0.0.7"
6
6
  CONFIG_FILE = "~/.projmgr"
7
7
  end
8
8
 
@@ -24,12 +24,10 @@ Gem::Specification.new do |s|
24
24
  s.required_rubygems_version = ">= 1.3.6"
25
25
  s.rubyforge_project = ProjMgr::APP_NAME
26
26
 
27
- s.add_development_dependency("rspec", ">= 2.4.0")
27
+ s.add_development_dependency("rspec", ">= 2.5.0")
28
28
  s.add_development_dependency("rcov", ">= 0.9.9")
29
29
 
30
30
  s.has_rdoc = 'yard'
31
- s.extra_rdoc_files = ["README.md", "LICENSE", "NEWS.md", "TODO.md"]
32
-
33
- s.add_dependency('choice', '>= 0.1.4')
31
+ s.extra_rdoc_files = ["README.markdown", "LICENSE", "NEWS.markdown", "TODO.markdown"]
34
32
 
35
33
  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.6
5
+ version: 0.0.7
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-17 00:00:00 -06:00
13
+ date: 2011-02-24 00:00:00 -06:00
14
14
  default_executable: projmgr
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -21,7 +21,7 @@ dependencies:
21
21
  requirements:
22
22
  - - ">="
23
23
  - !ruby/object:Gem::Version
24
- version: 2.4.0
24
+ version: 2.5.0
25
25
  type: :development
26
26
  version_requirements: *id001
27
27
  - !ruby/object:Gem::Dependency
@@ -35,17 +35,6 @@ dependencies:
35
35
  version: 0.9.9
36
36
  type: :development
37
37
  version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
39
- name: choice
40
- prerelease: false
41
- requirement: &id003 !ruby/object:Gem::Requirement
42
- none: false
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 0.1.4
47
- type: :runtime
48
- version_requirements: *id003
49
38
  description: projmgr is a source code managment tool for automating project managment
50
39
  email: jacob.hammack@hammackj.com
51
40
  executables:
@@ -53,16 +42,16 @@ executables:
53
42
  extensions: []
54
43
 
55
44
  extra_rdoc_files:
56
- - README.md
45
+ - README.markdown
57
46
  - LICENSE
58
- - NEWS.md
59
- - TODO.md
47
+ - NEWS.markdown
48
+ - TODO.markdown
60
49
  files:
61
50
  - LICENSE
62
- - NEWS.md
51
+ - NEWS.markdown
63
52
  - Rakefile
64
- - README.md
65
- - TODO.md
53
+ - README.markdown
54
+ - TODO.markdown
66
55
  - lib/projmgr/cvs.rb
67
56
  - lib/projmgr/git.rb
68
57
  - lib/projmgr/scm.rb
@@ -70,7 +59,7 @@ files:
70
59
  - lib/projmgr.rb
71
60
  - projmgr.gemspec
72
61
  - bin/projmgr
73
- has_rdoc: yard
62
+ has_rdoc: true
74
63
  homepage: http://github.com/hammackj/projmgr/
75
64
  licenses:
76
65
  - BSD