fnando-pez 0.0.2 → 0.0.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/History.txt CHANGED
@@ -1,4 +1,19 @@
1
1
  == 0.0.1 2008-09-01
2
2
 
3
3
  * 1 major enhancement:
4
- * Initial release
4
+ * Initial release
5
+
6
+ == 0.0.2 2008-09-01
7
+
8
+ * 1 minor enhancement:
9
+ * Added symlink option
10
+
11
+ == 0.0.3 2008-09-02
12
+
13
+ * 1 bug fix:
14
+ * Some methods was trying to access a nil object; expected a hash
15
+
16
+ == 0.0.4 2008-09-03
17
+
18
+ * 1 major enhancement:
19
+ * Added revision and branch support
data/README.markdown CHANGED
@@ -37,15 +37,50 @@ USAGE:
37
37
 
38
38
  Run the command `pez setup` from your project root to create the file
39
39
  `config/plugins.yml`. Then you can manage plugins with the following commands:
40
-
40
+
41
+ # display general help
42
+ pez help
43
+
44
+ # display help for specific command
45
+ pez help [command]
46
+
47
+ # add a new plugin
41
48
  pez add git://github.com/fnando/has_cache.git
49
+
50
+ # add a new plugin and specify repository type [svn, git]
42
51
  pez add http://some-url.com/fnando/has_cache --type=svn
52
+
53
+ # update the repository
43
54
  pez update has_cache
55
+
56
+ # update all repositories
44
57
  pez update --all
58
+
59
+ # show info from all repositories
45
60
  pez show --all
61
+
62
+ # remove plugin
46
63
  pez remove has_cache
64
+
65
+ # remove all plugins
47
66
  pez remove --all
67
+
68
+ # create symlink for plugins already added
48
69
  pez symlink
70
+
71
+ # add plugin and track a specific branch (git only)
72
+ pez add git://github.com/aslakhellesoy/cucumber -b html-visitor
73
+
74
+ # add plugin and freeze in a specific commit
75
+ pez add git://github.com/aslakhellesoy/cucumber \
76
+ -r 32d4f03d19bf33172bb7b48fed48e906a56598a7
77
+
78
+ # add plugin and freeze in a specific revision
79
+ pez add svn://some/plugin -r 189
80
+
81
+ NOTE: If you specify a revision (-r or --revision), you won't be able to
82
+ update the repository. To update it, edit the config/plugins.yml file
83
+ and remove the revision option.
49
84
 
50
85
  MAINTAINER
51
86
  ----------
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ PKG_FILES = %w(Rakefile pez.gemspec History.txt License.txt README.markdown TODO
5
5
 
6
6
  spec = Gem::Specification.new do |s|
7
7
  s.name = "pez"
8
- s.version = "0.0.2"
8
+ s.version = "0.0.4"
9
9
  s.summary = "Manage Ruby on Rails plugins from GIT and Subversion repositories in a simple way"
10
10
  s.authors = ["Nando Vieira"]
11
11
  s.email = ["fnando.vieira@gmail.com"]
data/bin/pez CHANGED
@@ -38,10 +38,10 @@ Main {
38
38
  . pez add git://remote/path --name=some_plugin_name
39
39
  TXT
40
40
 
41
- mixin :argument_url, :option_type, :option_name
41
+ mixin :argument_url, :option_type, :option_name, :option_revision, :option_branch
42
42
 
43
43
  run {
44
- Pez::Command.add(url, { :type => type, :name => name })
44
+ Pez::Command.add(url, { :type => type, :name => name, :revision => revision, :branch => branch })
45
45
  }
46
46
  }
47
47
 
@@ -158,6 +158,24 @@ Main {
158
158
  }
159
159
  }
160
160
 
161
+ mixin(:option_revision) {
162
+ option(:revision, :r) {
163
+ optional
164
+ argument :required
165
+ desc 'freezes a specific revision'
166
+ attr
167
+ }
168
+ }
169
+
170
+ mixin(:option_branch) {
171
+ option(:branch, :b) {
172
+ optional
173
+ argument :required
174
+ desc 'checkout a specific GIT branch'
175
+ attr
176
+ }
177
+ }
178
+
161
179
  mixin(:option_name) {
162
180
  option(:name, :n) {
163
181
  optional
data/lib/pez/base.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Pez
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.4"
3
3
  CONFIG_FILE = File.dirname(__FILE__) + '/../../templates/plugins.yml'
4
4
 
5
5
  module Base
@@ -26,7 +26,12 @@ module Pez
26
26
  def self.add_to_config(name, url, options={})
27
27
  c = config
28
28
  c['plugins'] ||= {}
29
- c['plugins'][name] = {'repo' => url, 'type' => options[:type]}
29
+ c['plugins'][name] = {
30
+ 'repo' => url,
31
+ 'type' => options[:type],
32
+ 'revision' => options[:revision],
33
+ 'branch' => options[:branch]
34
+ }.reject {|key, value| value.nil? }
30
35
 
31
36
  File.open('config/plugins.yml', 'w+') do |f|
32
37
  f << YAML::dump(c)
@@ -42,8 +47,8 @@ module Pez
42
47
  f << YAML::dump(c)
43
48
  end
44
49
 
45
- system "rm -rf #{destination}/#{name}"
46
- system "rm vendor/plugins/#{name}"
50
+ system %( rm -rf #{destination}/#{name} )
51
+ system %( rm vendor/plugins/#{name} )
47
52
  end
48
53
 
49
54
  def self.destination
@@ -54,7 +59,7 @@ module Pez
54
59
  if name
55
60
  [name]
56
61
  elsif options[:all]
57
- Pez::Base.config["plugins"].keys
62
+ (Pez::Base.config["plugins"] || {}).keys
58
63
  else
59
64
  []
60
65
  end
@@ -76,20 +81,49 @@ module Pez
76
81
 
77
82
  def self.add(url, options={}, skip_config=false)
78
83
  name = Pez::Base.name(url, options)
79
-
84
+
80
85
  puts "Retrieving #{name}..."
81
86
 
82
87
  if Pez::Base.git?(url, options)
83
88
  options[:type] = "git"
84
- system "mkdir -p #{Pez::Base.destination}; cd #{Pez::Base.destination}; git clone #{url} #{name}"
89
+
90
+ system %(
91
+ mkdir -p #{Pez::Base.destination}
92
+ cd #{Pez::Base.destination}
93
+ git clone #{url} #{name}
94
+ )
95
+
96
+ if branch = options[:branch]
97
+ system %(
98
+ cd #{Pez::Base.destination}/#{name}
99
+ git checkout --track -b #{branch} origin/#{branch}
100
+ )
101
+ end
102
+
103
+ if revision = options[:revision]
104
+ system %(
105
+ cd #{Pez::Base.destination}/#{name}
106
+ git branch #{revision}
107
+ git checkout #{revision}
108
+ )
109
+ end
85
110
  else
86
111
  options[:type] = "svn"
87
- system "mkdir -p #{Pez::Base.destination}; cd #{Pez::Base.destination}; svn co #{url} #{name}"
112
+
113
+ if revision = options[:revision]
114
+ options[:revision] = revision.to_i
115
+ end
116
+
117
+ system %(
118
+ mkdir -p #{Pez::Base.destination}
119
+ cd #{Pez::Base.destination}
120
+ svn co #{url} #{name} -r #{options[:revision] || 'HEAD'}
121
+ )
88
122
  end
89
123
 
90
124
  puts
91
125
  Pez::Base.add_to_config(name, url, options) unless skip_config
92
- system "ln -s #{Pez::Base.destination}/#{name} vendor/plugins/#{name}"
126
+ system %( ln -s #{Pez::Base.destination}/#{name} vendor/plugins/#{name} )
93
127
  end
94
128
 
95
129
  def self.remove(name=nil, options={})
@@ -107,12 +141,27 @@ module Pez
107
141
 
108
142
  if File.directory?(dirname)
109
143
  if data['type'] == 'git'
110
- system "cd #{dirname}; git pull"
144
+ if data['revision']
145
+ puts "Will not be updated; it's freezed at commit #{data['revision']}"
146
+ else
147
+ system %(
148
+ cd #{dirname}
149
+ git checkout #{options[:branch] || 'master'}
150
+ git pull
151
+ )
152
+ end
111
153
  else
112
- system "cd #{dirname}; svn up"
154
+ if data['revision']
155
+ puts "Will not be updated; it's freezed at revision #{data['revision']}"
156
+ else
157
+ system %(
158
+ cd #{dirname}
159
+ svn up
160
+ )
161
+ end
113
162
  end
114
163
  else
115
- add(data['repo'], {:type => data['type'], :name => name}, true)
164
+ add(data['repo'], data.merge(:name => name), true)
116
165
  end
117
166
 
118
167
  puts
@@ -126,7 +175,7 @@ module Pez
126
175
  dirname = "#{Pez::Base.destination}/#{name}"
127
176
 
128
177
  if File.directory?(dirname)
129
- system "ln -s #{dirname} vendor/plugins/#{name}"
178
+ system %( ln -s #{dirname} vendor/plugins/#{name} )
130
179
  else
131
180
  add(data['repo'], {:type => data['type'], :name => name}, true)
132
181
  end
data/pez.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
  # RUN : 'rake gem:update_gemspec'
3
3
 
4
4
  Gem::Specification.new do |s|
5
- s.date = "Mon Sep 01 21:04:00 -0300 2008"
5
+ s.date = "Wed Sep 03 14:19:21 -0300 2008"
6
6
  s.executables = ["pez"]
7
7
  s.authors = ["Nando Vieira"]
8
8
  s.required_rubygems_version = ">= 0"
9
- s.version = "0.0.2"
9
+ s.version = "0.0.4"
10
10
  s.files = ["Rakefile",
11
11
  "pez.gemspec",
12
12
  "History.txt",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fnando-pez
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-09-01 17:04:00 -07:00
12
+ date: 2008-09-03 10:19:21 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency