fudge 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/bin/fudge +9 -0
  2. data/lib/fudge.rb +16 -0
  3. data/lib/fudge/build.rb +31 -0
  4. data/lib/fudge/cli.rb +29 -0
  5. data/lib/fudge/description.rb +53 -0
  6. data/lib/fudge/exceptions.rb +31 -0
  7. data/lib/fudge/helpers.rb +5 -0
  8. data/lib/fudge/helpers/bundle_aware.rb +14 -0
  9. data/lib/fudge/parser.rb +12 -0
  10. data/lib/fudge/railtie.rb +17 -0
  11. data/lib/fudge/runner.rb +25 -0
  12. data/lib/fudge/task_dsl.rb +41 -0
  13. data/lib/fudge/tasks.rb +31 -0
  14. data/lib/fudge/tasks/clean_bundler_env.rb +24 -0
  15. data/lib/fudge/tasks/composite_task.rb +24 -0
  16. data/lib/fudge/tasks/each_directory.rb +34 -0
  17. data/lib/fudge/tasks/in_directory.rb +24 -0
  18. data/lib/fudge/tasks/rake.rb +19 -0
  19. data/lib/fudge/tasks/rspec.rb +29 -0
  20. data/lib/fudge/tasks/shell.rb +76 -0
  21. data/lib/fudge/tasks/task.rb +18 -0
  22. data/lib/fudge/tasks/yard.rb +29 -0
  23. data/lib/fudge/version.rb +3 -0
  24. data/lib/tasks/fudge.rake +7 -0
  25. data/spec/lib/fudge/build_spec.rb +5 -0
  26. data/spec/lib/fudge/cli_spec.rb +76 -0
  27. data/spec/lib/fudge/description_spec.rb +241 -0
  28. data/spec/lib/fudge/exceptions_spec.rb +36 -0
  29. data/spec/lib/fudge/parser_spec.rb +23 -0
  30. data/spec/lib/fudge/runner_spec.rb +25 -0
  31. data/spec/lib/fudge/tasks/bundler_spec.rb +39 -0
  32. data/spec/lib/fudge/tasks/composite_task_spec.rb +60 -0
  33. data/spec/lib/fudge/tasks/each_directory_spec.rb +57 -0
  34. data/spec/lib/fudge/tasks/in_directory_spec.rb +39 -0
  35. data/spec/lib/fudge/tasks/rake_spec.rb +18 -0
  36. data/spec/lib/fudge/tasks/rspec_spec.rb +36 -0
  37. data/spec/lib/fudge/tasks/shell_spec.rb +38 -0
  38. data/spec/lib/fudge/tasks/task_spec.rb +14 -0
  39. data/spec/lib/fudge/tasks/yard_spec.rb +25 -0
  40. data/spec/lib/fudge/tasks_spec.rb +33 -0
  41. data/spec/spec_helper.rb +22 -0
  42. data/spec/support/dummy_task.rb +40 -0
  43. data/spec/support/matchers.rb +47 -0
  44. data/spec/support/tmpdir.rb +12 -0
  45. metadata +302 -0
@@ -0,0 +1,22 @@
1
+ require 'simplecov'
2
+ SimpleCov.start do
3
+ add_filter "spec/"
4
+ end
5
+
6
+ require 'rspec'
7
+ require 'fudge'
8
+
9
+ Dir[File.expand_path('../../spec/support/*', __FILE__)].each { |f| require f }
10
+
11
+ # Get rid of output in specs
12
+ # RSpec.configure do |c|
13
+ # c.before :each do
14
+ # @oldstdout, $stdout = $stdout, StringIO.new
15
+ # @oldstderr, $stderr = $stderr, StringIO.new
16
+ # end
17
+ #
18
+ # c.after :each do
19
+ # $stdout = @oldstdout
20
+ # $stderr = @oldstderr
21
+ # end
22
+ # end
@@ -0,0 +1,40 @@
1
+ class DummyTask < Fudge::Tasks::Task
2
+ class << self
3
+ attr_accessor :ran
4
+ end
5
+ attr_accessor :args
6
+
7
+ def self.name
8
+ :dummy
9
+ end
10
+
11
+ def initialize(*args)
12
+ super
13
+ self.args = args
14
+ end
15
+
16
+ def run(options={})
17
+ self.class.ran = true
18
+ end
19
+ end
20
+ Fudge::Tasks.register(DummyTask)
21
+
22
+ class DummyCompositeTask < Fudge::Tasks::CompositeTask
23
+ attr_accessor :args
24
+
25
+ def initialize(*args)
26
+ super
27
+ self.args = args
28
+ end
29
+
30
+ def self.name
31
+ :dummy_composite
32
+ end
33
+ end
34
+ Fudge::Tasks.register(DummyCompositeTask)
35
+
36
+ RSpec.configure do |c|
37
+ c.after :each do
38
+ DummyTask.ran = false
39
+ end
40
+ end
@@ -0,0 +1,47 @@
1
+ RSpec::Matchers.define :be_registered_as do |key|
2
+ match do |task|
3
+ Fudge::Tasks.discover(key) == task.class
4
+ end
5
+ end
6
+
7
+ RSpec::Matchers.define :run_command do |to_match, args|
8
+ match do |subject|
9
+ ran = ''
10
+ to_stub = subject.is_a?(Fudge::Tasks::Shell) ? subject : Fudge::Tasks::Shell.any_instance
11
+
12
+ to_stub.stub(:run_command) do |cmd|
13
+ ran = cmd
14
+ ['dummy output', true]
15
+ end
16
+
17
+ subject.run(args || {})
18
+
19
+ if to_match.is_a? Regexp
20
+ ran =~ to_match
21
+ else
22
+ ran == to_match
23
+ end
24
+ end
25
+ end
26
+
27
+ RSpec::Matchers.define :succeed_with_output do |output|
28
+ match do |subject|
29
+ subject.stub(:run_command).and_return([output, true])
30
+
31
+ subject.run
32
+ end
33
+ end
34
+
35
+ shared_examples_for 'bundle aware' do
36
+ before :each do
37
+ @normal_cmd = subject.send(:cmd)
38
+ end
39
+
40
+ it "should prefix the command with bundle exec when bundler is set" do
41
+ subject.should run_command("bundle exec #{@normal_cmd}", :bundler => true)
42
+ end
43
+
44
+ it "should not prefix the command with bundle exec when bundler is not set" do
45
+ subject.should run_command(@normal_cmd, :bundler => false)
46
+ end
47
+ end
@@ -0,0 +1,12 @@
1
+ require 'tmpdir'
2
+
3
+ def use_tmp_dir
4
+ around :each do |example|
5
+ Dir.mktmpdir do |dir|
6
+ old = Dir.pwd
7
+ FileUtils.chdir(dir)
8
+ example.run
9
+ FileUtils.chdir(old)
10
+ end
11
+ end
12
+ end
metadata ADDED
@@ -0,0 +1,302 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fudge
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Sage One team
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: thor
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rainbow
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: activesupport
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rspec
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: 2.8.0
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 2.8.0
78
+ - !ruby/object:Gem::Dependency
79
+ name: guard-rspec
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: yard
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: RedCloth
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: simplecov
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ - !ruby/object:Gem::Dependency
143
+ name: rb-inotify
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ - !ruby/object:Gem::Dependency
159
+ name: libnotify
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ - !ruby/object:Gem::Dependency
175
+ name: pry
176
+ requirement: !ruby/object:Gem::Requirement
177
+ none: false
178
+ requirements:
179
+ - - ! '>='
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ type: :development
183
+ prerelease: false
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ - !ruby/object:Gem::Dependency
191
+ name: rake
192
+ requirement: !ruby/object:Gem::Requirement
193
+ none: false
194
+ requirements:
195
+ - - ! '>='
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
198
+ type: :development
199
+ prerelease: false
200
+ version_requirements: !ruby/object:Gem::Requirement
201
+ none: false
202
+ requirements:
203
+ - - ! '>='
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
206
+ description: Fudge Continuous Integration Server
207
+ email: support@sageone.com
208
+ executables:
209
+ - fudge
210
+ extensions: []
211
+ extra_rdoc_files: []
212
+ files:
213
+ - lib/fudge.rb
214
+ - lib/fudge/tasks.rb
215
+ - lib/fudge/helpers/bundle_aware.rb
216
+ - lib/fudge/railtie.rb
217
+ - lib/fudge/cli.rb
218
+ - lib/fudge/parser.rb
219
+ - lib/fudge/version.rb
220
+ - lib/fudge/exceptions.rb
221
+ - lib/fudge/helpers.rb
222
+ - lib/fudge/tasks/each_directory.rb
223
+ - lib/fudge/tasks/clean_bundler_env.rb
224
+ - lib/fudge/tasks/yard.rb
225
+ - lib/fudge/tasks/rspec.rb
226
+ - lib/fudge/tasks/in_directory.rb
227
+ - lib/fudge/tasks/composite_task.rb
228
+ - lib/fudge/tasks/shell.rb
229
+ - lib/fudge/tasks/rake.rb
230
+ - lib/fudge/tasks/task.rb
231
+ - lib/fudge/runner.rb
232
+ - lib/fudge/build.rb
233
+ - lib/fudge/description.rb
234
+ - lib/fudge/task_dsl.rb
235
+ - lib/tasks/fudge.rake
236
+ - spec/lib/fudge/description_spec.rb
237
+ - spec/lib/fudge/build_spec.rb
238
+ - spec/lib/fudge/parser_spec.rb
239
+ - spec/lib/fudge/tasks_spec.rb
240
+ - spec/lib/fudge/runner_spec.rb
241
+ - spec/lib/fudge/tasks/composite_task_spec.rb
242
+ - spec/lib/fudge/tasks/rake_spec.rb
243
+ - spec/lib/fudge/tasks/each_directory_spec.rb
244
+ - spec/lib/fudge/tasks/yard_spec.rb
245
+ - spec/lib/fudge/tasks/in_directory_spec.rb
246
+ - spec/lib/fudge/tasks/task_spec.rb
247
+ - spec/lib/fudge/tasks/rspec_spec.rb
248
+ - spec/lib/fudge/tasks/bundler_spec.rb
249
+ - spec/lib/fudge/tasks/shell_spec.rb
250
+ - spec/lib/fudge/cli_spec.rb
251
+ - spec/lib/fudge/exceptions_spec.rb
252
+ - spec/support/dummy_task.rb
253
+ - spec/support/matchers.rb
254
+ - spec/support/tmpdir.rb
255
+ - spec/spec_helper.rb
256
+ - bin/fudge
257
+ homepage: http://github.com/Sage/fudge
258
+ licenses: []
259
+ post_install_message:
260
+ rdoc_options: []
261
+ require_paths:
262
+ - lib
263
+ required_ruby_version: !ruby/object:Gem::Requirement
264
+ none: false
265
+ requirements:
266
+ - - ! '>='
267
+ - !ruby/object:Gem::Version
268
+ version: '0'
269
+ required_rubygems_version: !ruby/object:Gem::Requirement
270
+ none: false
271
+ requirements:
272
+ - - ! '>='
273
+ - !ruby/object:Gem::Version
274
+ version: '0'
275
+ requirements: []
276
+ rubyforge_project: fudge
277
+ rubygems_version: 1.8.24
278
+ signing_key:
279
+ specification_version: 3
280
+ summary: Fudge CI Server
281
+ test_files:
282
+ - spec/lib/fudge/description_spec.rb
283
+ - spec/lib/fudge/build_spec.rb
284
+ - spec/lib/fudge/parser_spec.rb
285
+ - spec/lib/fudge/tasks_spec.rb
286
+ - spec/lib/fudge/runner_spec.rb
287
+ - spec/lib/fudge/tasks/composite_task_spec.rb
288
+ - spec/lib/fudge/tasks/rake_spec.rb
289
+ - spec/lib/fudge/tasks/each_directory_spec.rb
290
+ - spec/lib/fudge/tasks/yard_spec.rb
291
+ - spec/lib/fudge/tasks/in_directory_spec.rb
292
+ - spec/lib/fudge/tasks/task_spec.rb
293
+ - spec/lib/fudge/tasks/rspec_spec.rb
294
+ - spec/lib/fudge/tasks/bundler_spec.rb
295
+ - spec/lib/fudge/tasks/shell_spec.rb
296
+ - spec/lib/fudge/cli_spec.rb
297
+ - spec/lib/fudge/exceptions_spec.rb
298
+ - spec/support/dummy_task.rb
299
+ - spec/support/matchers.rb
300
+ - spec/support/tmpdir.rb
301
+ - spec/spec_helper.rb
302
+ has_rdoc: