ianwhite-garlic 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +28 -0
- data/{MIT-LICENSE → License.txt} +0 -0
- data/README.textile +8 -106
- data/Todo.txt +4 -0
- data/lib/garlic.rb +1 -1
- data/lib/garlic/configurator.rb +5 -6
- data/lib/garlic/generator.rb +2 -2
- data/lib/garlic/session.rb +1 -2
- data/lib/garlic/target.rb +2 -4
- data/lib/tabtab_definitions/garlic.rb +4 -0
- data/templates/default.rb +12 -14
- data/templates/rspec.rb +16 -18
- data/templates/shoulda.rb +13 -15
- metadata +5 -5
- data/CHANGELOG +0 -5
- data/TODO +0 -2
data/History.txt
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
== 0.1.5 2008-11-25
|
2
|
+
|
3
|
+
* 4 minor enhancements
|
4
|
+
* Removed 'all_targets' - just use ruby to DRY up garlic.rb
|
5
|
+
* Changed templates wrt above
|
6
|
+
* Better tabtab completions
|
7
|
+
* Updated TODO
|
8
|
+
|
9
|
+
== 0.1.4 2008-11-20
|
10
|
+
|
11
|
+
* 1 minor enhancement
|
12
|
+
* Added tabtab definitions that are in the right place
|
13
|
+
|
14
|
+
== 0.1.3 2008-11-20
|
15
|
+
|
16
|
+
* 1 minor enhancement
|
17
|
+
* Added tabtab definitions
|
18
|
+
|
19
|
+
== 0.1.2
|
20
|
+
|
21
|
+
* 2 major enhancements
|
22
|
+
* garlic CLI
|
23
|
+
* repos are now stored in ~/.garlic/repos (and this shared across multiple garlic sessions), work is in ./.garlic
|
24
|
+
|
25
|
+
== 0.1.1
|
26
|
+
|
27
|
+
* 1 major enhancement:
|
28
|
+
* freelancing-god added gem goodness
|
data/{MIT-LICENSE → License.txt}
RENAMED
File without changes
|
data/README.textile
CHANGED
@@ -15,6 +15,11 @@ Garlic works by cloning git repos for all your dependencies (so they all must be
|
|
15
15
|
git repos), and then using git to checkout various tags and branches to build
|
16
16
|
your app against.
|
17
17
|
|
18
|
+
h2. It's still new, and not shiny yet
|
19
|
+
|
20
|
+
Please feel free to make it shinier. I'm successfully using it on most of my plugins, and I test
|
21
|
+
with garlic and cucumber.
|
22
|
+
|
18
23
|
h2. Get up and running quickly
|
19
24
|
|
20
25
|
You have a plugin and you want it tested against different versions of rails?
|
@@ -81,113 +86,9 @@ h2. Running Shell commands across multiple targets
|
|
81
86
|
|
82
87
|
Check dis out
|
83
88
|
|
84
|
-
garlic shell # "Example output":http://gist.github.com/
|
85
|
-
|
86
|
-
---
|
87
|
-
|
88
|
-
The following still needs to be updated for the new gem/cmd-line version
|
89
|
-
|
90
|
-
h2. Example workflow
|
91
|
-
|
92
|
-
Let's say I'm patching resources_controller.
|
93
|
-
|
94
|
-
First I grab it, and set up garlic
|
95
|
-
|
96
|
-
git clone git://github.com/ianwhite/resources_controller.git
|
97
|
-
cd resources_controller
|
98
|
-
rake get_garlic
|
99
|
-
cp garlic_example.rb garlic.rb
|
100
|
-
# I could now edit garlic.rb to point the repos at my local copies, for speed
|
101
|
-
|
102
|
-
Now, I download and run the CI suite
|
103
|
-
|
104
|
-
rake garlic:all
|
105
|
-
|
106
|
-
Now, I make some changes
|
107
|
-
|
108
|
-
git checkout -b my_change
|
109
|
-
# ... commit some changes into 'my_change'
|
110
|
-
rake garlic
|
111
|
-
# ... everything is fine, so I can merge these into master, or send a pull request
|
112
|
-
|
113
|
-
h3. How do I run the specs on uncommitted code?
|
114
|
-
|
115
|
-
The best way is to make the changes in one of the 'work' targets. For example:
|
116
|
-
|
117
|
-
# after running rake garlic:all
|
118
|
-
cd garlic/work/edge/vendor/plugins/resources_controller
|
119
|
-
# ... make changes without committing
|
120
|
-
rake spec
|
121
|
-
# ... it passes, so commit
|
122
|
-
git commit -m "My great change"
|
123
|
-
|
124
|
-
Now you can push these changes back upstream to your local 'master' repo
|
125
|
-
|
126
|
-
git push origin my_changes # or you could push to master branch or whatever
|
89
|
+
garlic shell # "Example output":http://gist.github.com/28795
|
127
90
|
|
128
|
-
|
129
|
-
targets. If these all pass, you can push, or send a pull request
|
130
|
-
|
131
|
-
h2.How to add garlic to your repo (example: rails plugin)
|
132
|
-
|
133
|
-
h4. 1. require the garlic tasks into your own Rakefile
|
134
|
-
|
135
|
-
# rescue this just in case the plugin user doesn't have garlic
|
136
|
-
begin
|
137
|
-
require 'garlic'
|
138
|
-
rescue LoadError
|
139
|
-
end
|
140
|
-
|
141
|
-
h4. 2. add a garlic.rb
|
142
|
-
|
143
|
-
An example garlic.rb:
|
144
|
-
|
145
|
-
garlic do
|
146
|
-
# repos
|
147
|
-
repo 'rails', :url => 'git://github.com/rails/rails'
|
148
|
-
repo 'rspec', :url => 'git://github.com/dchelimsky/rspec'
|
149
|
-
repo 'rspec-rails', :url => 'git://github.com/dchelimsky/rspec-rails'
|
150
|
-
repo 'resources_controller', :path => '.'
|
151
|
-
|
152
|
-
# targets
|
153
|
-
target 'edge'
|
154
|
-
target '2.0-stable', :branch => 'origin/2-0-stable'
|
155
|
-
target '2.0.2', :tag => 'v2.0.2'
|
156
|
-
|
157
|
-
all_targets do
|
158
|
-
prepare do
|
159
|
-
plugin 'resources_controller', :clone => true
|
160
|
-
plugin 'rspec'
|
161
|
-
plugin 'rspec-rails' do
|
162
|
-
sh "script/generate rspec -f"
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
run do
|
167
|
-
cd "vendor/plugins/resources_controller"
|
168
|
-
sh "rake spec:rcov:verify"
|
169
|
-
end
|
170
|
-
end
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
h4. 3. ignore the garlic artefacts
|
175
|
-
|
176
|
-
Example .gitignore
|
177
|
-
|
178
|
-
.garlic_work
|
179
|
-
|
180
|
-
h4. 4. Run it
|
181
|
-
|
182
|
-
rake garlic:all
|
183
|
-
|
184
|
-
And to run it again, once you've made changes
|
185
|
-
|
186
|
-
rake garlic
|
187
|
-
|
188
|
-
To make sure you're running against the latest repos:
|
189
|
-
|
190
|
-
rake garlic:update_repos
|
91
|
+
You can pipe any thing into garlic shell and it will execute across all of your garlic targets
|
191
92
|
|
192
93
|
h2. Lend a hand
|
193
94
|
|
@@ -202,5 +103,6 @@ h2. Lent a hand
|
|
202
103
|
Thanks very much to:
|
203
104
|
|
204
105
|
* Pat Allan
|
106
|
+
* Dr Nic Williams
|
205
107
|
|
206
108
|
|
data/Todo.txt
ADDED
data/lib/garlic.rb
CHANGED
data/lib/garlic/configurator.rb
CHANGED
@@ -13,15 +13,10 @@ module Garlic
|
|
13
13
|
options[:path] ||= "#{garlic.repo_path}/#{name}"
|
14
14
|
garlic.repos << Repo.new(options)
|
15
15
|
end
|
16
|
-
|
17
|
-
def all_targets(options = {}, &block)
|
18
|
-
BlockParser.new(options, [:prepare, :run], &block) if block_given?
|
19
|
-
garlic.all_targets = options
|
20
|
-
end
|
21
16
|
|
22
17
|
def target(name, options = {}, &block)
|
23
18
|
options[:name] = name
|
24
|
-
options[:path] = "#{garlic.work_path}/#{name}"
|
19
|
+
options[:path] = "#{garlic.work_path}/#{name_to_path(name)}"
|
25
20
|
BlockParser.new(options, [:prepare, :run], &block) if block_given?
|
26
21
|
garlic.targets << Target.new(garlic, options)
|
27
22
|
end
|
@@ -31,6 +26,10 @@ module Garlic
|
|
31
26
|
end
|
32
27
|
|
33
28
|
protected
|
29
|
+
def name_to_path(name)
|
30
|
+
name.gsub(/[^\w\d_.-]/,'_').downcase
|
31
|
+
end
|
32
|
+
|
34
33
|
def method_missing(attribute, value)
|
35
34
|
if garlic.respond_to?("#{attribute}=")
|
36
35
|
garlic.send("#{attribute}=", value)
|
data/lib/garlic/generator.rb
CHANGED
@@ -18,9 +18,9 @@ module Garlic
|
|
18
18
|
|
19
19
|
protected
|
20
20
|
def copy_templates
|
21
|
-
mkdir_p TEMPLATES_PATH
|
21
|
+
mkdir_p TEMPLATES_PATH, :verbose => false
|
22
22
|
Dir[File.join(File.dirname(__FILE__), '../../templates/*.rb')].each do |file|
|
23
|
-
cp file, File.join(TEMPLATES_PATH, File.basename(file))
|
23
|
+
cp file, File.join(TEMPLATES_PATH, File.basename(file)), :verbose => false
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
data/lib/garlic/session.rb
CHANGED
@@ -2,13 +2,12 @@ module Garlic
|
|
2
2
|
# this class runs the top level garlic commands
|
3
3
|
class Session
|
4
4
|
attr_reader :actor, :run_targets
|
5
|
-
attr_accessor :repos, :targets, :
|
5
|
+
attr_accessor :repos, :targets, :repo_path, :work_path, :verbose
|
6
6
|
|
7
7
|
def initialize(actor = nil, &block)
|
8
8
|
@actor = actor
|
9
9
|
self.repos = []
|
10
10
|
self.targets = []
|
11
|
-
self.all_targets = {}
|
12
11
|
self.work_path = ".garlic"
|
13
12
|
self.repo_path = "~/.garlic/repos"
|
14
13
|
configure(&block) if block_given?
|
data/lib/garlic/target.rb
CHANGED
@@ -6,7 +6,7 @@ module Garlic
|
|
6
6
|
|
7
7
|
def initialize(garlic, options = {})
|
8
8
|
@garlic = garlic
|
9
|
-
@tree_ish = Repo.tree_ish(options) || 'master'
|
9
|
+
@tree_ish = Repo.tree_ish(options) || 'origin/master'
|
10
10
|
@rails_repo_name = options[:rails] || 'rails'
|
11
11
|
@path = options[:path] or raise ArgumentError, "Target requires a :path"
|
12
12
|
@path = File.expand_path(@path)
|
@@ -18,12 +18,10 @@ module Garlic
|
|
18
18
|
def prepare
|
19
19
|
puts "\nPreparing target #{name} (#{tree_ish})"
|
20
20
|
install_rails
|
21
|
-
runner.run(&garlic.all_targets[:prepare]) if garlic.all_targets[:prepare]
|
22
21
|
runner.run(&@prepare) if @prepare
|
23
22
|
end
|
24
23
|
|
25
|
-
def run
|
26
|
-
runner.run(&garlic.all_targets[:run]) if garlic.all_targets[:run]
|
24
|
+
def run
|
27
25
|
runner.run(&@run) if @run
|
28
26
|
end
|
29
27
|
|
data/templates/default.rb
CHANGED
@@ -7,21 +7,19 @@ garlic do
|
|
7
7
|
# other repos
|
8
8
|
repo "rails", :url => "git://github.com/rails/rails"
|
9
9
|
|
10
|
-
#
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
prepare do
|
19
|
-
plugin "#{plugin}", :clone => true # so we can work in targets
|
20
|
-
end
|
10
|
+
# target railses
|
11
|
+
['origin/master', 'origin/2-2-stable', 'origin/2-1-stable', 'origin/2-0-stable'].each do |rails|
|
12
|
+
|
13
|
+
# declare how to prepare, and run each CI target
|
14
|
+
target "Rails: \#{rails}", :tree_ish => rails do
|
15
|
+
prepare do
|
16
|
+
plugin "#{plugin}", :clone => true # so we can work in targets
|
17
|
+
end
|
21
18
|
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
run do
|
20
|
+
cd "vendor/plugins/#{plugin}" do
|
21
|
+
sh "rake"
|
22
|
+
end
|
25
23
|
end
|
26
24
|
end
|
27
25
|
end
|
data/templates/rspec.rb
CHANGED
@@ -9,25 +9,23 @@ garlic do
|
|
9
9
|
repo "rspec", :url => "git://github.com/dchelimsky/rspec"
|
10
10
|
repo "rspec-rails", :url => "git://github.com/dchelimsky/rspec-rails"
|
11
11
|
|
12
|
-
#
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
plugin "rspec-rails" do
|
24
|
-
sh "script/generate rspec -f"
|
12
|
+
# target railses
|
13
|
+
['origin/master', 'origin/2-2-stable', 'origin/2-1-stable', 'origin/2-0-stable'].each do |rails|
|
14
|
+
|
15
|
+
# declare how to prepare, and run each CI target
|
16
|
+
target "Rails: \#{rails}", :tree_ish => rails do
|
17
|
+
prepare do
|
18
|
+
plugin "#{plugin}", :clone => true # so we can work in targets
|
19
|
+
plugin "rspec"
|
20
|
+
plugin "rspec-rails" do
|
21
|
+
`script/generate rspec -f`
|
22
|
+
end
|
25
23
|
end
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
24
|
+
|
25
|
+
run do
|
26
|
+
cd "vendor/plugins/#{plugin}" do
|
27
|
+
sh "rake"
|
28
|
+
end
|
31
29
|
end
|
32
30
|
end
|
33
31
|
end
|
data/templates/shoulda.rb
CHANGED
@@ -8,22 +8,20 @@ garlic do
|
|
8
8
|
repo "rails", :url => "git://github.com/rails/rails"
|
9
9
|
repo "shoulda", :url => "git://github.com/thoughtbot/shoulda"
|
10
10
|
|
11
|
-
#
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
plugin "#{plugin}", :clone => true # so we can work in targets
|
21
|
-
plugin "shoulda"
|
22
|
-
end
|
11
|
+
# target railses
|
12
|
+
['origin/master', 'origin/2-2-stable', 'origin/2-1-stable', 'origin/2-0-stable'].each do |rails|
|
13
|
+
|
14
|
+
# declare how to prepare, and run each CI target
|
15
|
+
target "Rails: \#{rails}", :tree_ish => rails do
|
16
|
+
prepare do
|
17
|
+
plugin "#{plugin}", :clone => true # so we can work in targets
|
18
|
+
plugin "shoulda"
|
19
|
+
end
|
23
20
|
|
24
|
-
|
25
|
-
|
26
|
-
|
21
|
+
run do
|
22
|
+
cd "vendor/plugins/#{plugin}" do
|
23
|
+
sh "rake"
|
24
|
+
end
|
27
25
|
end
|
28
26
|
end
|
29
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ianwhite-garlic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian White
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-11-
|
12
|
+
date: 2008-11-25 00:00:00 -08:00
|
13
13
|
default_executable: garlic
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -34,10 +34,10 @@ files:
|
|
34
34
|
- templates/default.rb
|
35
35
|
- templates/rspec.rb
|
36
36
|
- templates/shoulda.rb
|
37
|
-
-
|
37
|
+
- License.txt
|
38
38
|
- README.textile
|
39
|
-
-
|
40
|
-
-
|
39
|
+
- Todo.txt
|
40
|
+
- History.txt
|
41
41
|
- spec/garlic/repo_spec.rb
|
42
42
|
- bin/garlic
|
43
43
|
has_rdoc: true
|
data/CHANGELOG
DELETED