jenkins_job 0.1.1 → 0.1.2

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.
@@ -16,9 +16,10 @@ module JenkinsJob
16
16
 
17
17
  # removes all the useless files generated by hudson, keeps only config.xml
18
18
  def clean
19
+ to_keep = %w(config.xml)
19
20
  Dir.chdir(@dir) do
20
- ['builds', 'last*', '*.log', 'next*'].each do |pattern|
21
- FileUtils.rm_rf Dir.glob(pattern)
21
+ Dir.glob('*').each do |item|
22
+ FileUtils.rm_rf(item) unless to_keep.include?(File.basename(item))
22
23
  end
23
24
  end
24
25
  end
@@ -1,3 +1,3 @@
1
1
  module JenkinsJob
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -43,6 +43,29 @@ class ProjectTest < Test::Unit::TestCase
43
43
  end
44
44
  end
45
45
 
46
+ context 'clean' do
47
+ setup do
48
+ FakeFS.activate!
49
+ FakeFS::FileSystem.clear
50
+
51
+ FileUtils.mkdir_p 'foo/bar'
52
+ FileUtils.touch 'foo/config.xml'
53
+ FileUtils.touch 'foo/delete_me'
54
+
55
+ @project = JenkinsJob::Project.new 'foo'
56
+ end
57
+
58
+ teardown do
59
+ FakeFS.deactivate!
60
+ end
61
+
62
+ should 'delete everything except for config.xml' do
63
+ @project.clean
64
+ assert_equal 1, Dir.glob('foo/*').size
65
+ assert File.exists? 'foo/config.xml'
66
+ end
67
+ end
68
+
46
69
  context 'alter project' do
47
70
  setup do
48
71
  File.open(File.expand_path('../fixtures/foo_master/config.xml',
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jenkins_job
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Flavio Castelli