capistrano-scm-jenkins 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capistrano-scm-jenkins (0.0.1)
4
+ capistrano-scm-jenkins (0.0.2)
5
5
  capistrano
6
6
 
7
7
  GEM
@@ -13,13 +13,13 @@ GEM
13
13
  net-sftp (>= 2.0.0)
14
14
  net-ssh (>= 2.0.14)
15
15
  net-ssh-gateway (>= 1.1.0)
16
- diff-lcs (1.1.2)
17
- highline (1.6.2)
16
+ diff-lcs (1.1.3)
17
+ highline (1.6.8)
18
18
  net-scp (1.0.4)
19
19
  net-ssh (>= 1.99.1)
20
20
  net-sftp (2.0.5)
21
21
  net-ssh (>= 2.0.9)
22
- net-ssh (2.1.4)
22
+ net-ssh (2.2.1)
23
23
  net-ssh-gateway (1.1.0)
24
24
  net-ssh (>= 1.99.1)
25
25
  rspec (2.7.0)
data/NEWS.md ADDED
@@ -0,0 +1,9 @@
1
+ ## 0.0.2 (2011-11-26)
2
+
3
+ * honor :scm_username and :scm_password
4
+ * fix syntax bug under ruby 1.9
5
+
6
+
7
+ ## 0.0.1 (2011-11-25)
8
+
9
+ * initial version.
data/README.md CHANGED
@@ -17,8 +17,14 @@ a sample config/deploy.rb
17
17
  set :repository, "http://jenkins.example.com/job/example/"
18
18
 
19
19
  set :scm, :jenkins
20
+
20
21
  # uncomment following line if you want deploy unstable version
21
22
  # set :jenkins_use_unstable, true
23
+
24
+ # jenkins username and password
25
+ # set :scm_username, ENV['JENKINS_USERNAME']
26
+ # set :scm_password, ENV['JENKINS_PASSWORD']
27
+
22
28
  set :user, 'lidaobing'
23
29
  set :use_sudo, false
24
30
  set :deploy_to, "/home/#{user}/apps/#{application}"
@@ -35,11 +41,6 @@ for the maven module, you should include the module name in your repository url.
35
41
 
36
42
  set :repository, "http://jenkins.example.com/job/example/com.example.helloworld$helloworld/"
37
43
 
38
- ## TODO
39
-
40
- * how to deal with auth? (need help)
41
- * support unstable build
42
-
43
44
  ## LICENSE
44
45
 
45
46
  Permission is hereby granted, free of charge, to any person obtaining
@@ -9,7 +9,10 @@ Gem::Specification.new do |s|
9
9
  s.email = ["lidaobing@gmail.com"]
10
10
  s.homepage = "https://github.com/lidaobing/capistrano-scm-jenkins"
11
11
  s.summary = %q{use jenkins as a capistrano scm}
12
- s.description = %q{use jenkins as a capistrano scm}
12
+ s.description = %q{
13
+ With this plugin, you can use jenkins build artifact as a repository, and
14
+ deploy your build artifact with capistrano.
15
+ }
13
16
 
14
17
  s.rubyforge_project = "capistrano-scm-jenkins"
15
18
 
@@ -1,7 +1,7 @@
1
1
  module Capistrano
2
2
  module Scm
3
3
  module Jenkins
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
6
6
  end
7
7
  end
@@ -20,7 +20,7 @@ module Capistrano
20
20
  def checkout(revision, destination)
21
21
  %Q{TMPDIR=`mktemp -d` &&
22
22
  cd "$TMPDIR" &&
23
- wget -nv '#{artifact_zip_url(revision)}' &&
23
+ curl #{authentication} -sO '#{artifact_zip_url(revision)}' &&
24
24
  unzip archive.zip &&
25
25
  mv archive "#{destination}" &&
26
26
  rm -rf "$TMPDIR"
@@ -42,6 +42,14 @@ module Capistrano
42
42
 
43
43
  private
44
44
 
45
+ def authentication
46
+ if variable(:scm_username) and variable(:scm_password)
47
+ "--user '#{variable(:scm_username)}:#{variable(:scm_password)}'"
48
+ else
49
+ ""
50
+ end
51
+ end
52
+
45
53
  def use_unstable?
46
54
  !!variable(:jenkins_use_unstable)
47
55
  end
@@ -90,7 +98,7 @@ module Capistrano
90
98
  end
91
99
  REXML::XPath.each(doc,"./entry/title") do |title|
92
100
  title = title.text
93
- for x in valid_end_strings:
101
+ for x in valid_end_strings
94
102
  return get_build_number_from_rss_all_title(title) if title.end_with? x
95
103
  end
96
104
  end
@@ -106,11 +114,23 @@ module Capistrano
106
114
  end
107
115
 
108
116
  def rss_all
109
- @rss_all ||= open(repository + '/rssAll').read()
117
+ begin
118
+ @rss_all ||= open(repository + '/rssAll', auth_opts).read()
119
+ rescue => e
120
+ raise Capistrano::Error, "open url #{repository + '/rssAll'} failed: #{e}"
121
+ end
110
122
  end
111
123
 
112
124
  def rss_changelog
113
- @rss_changelog ||= open(repository + '/rssChangelog').read()
125
+ @rss_changelog ||= open(repository + '/rssChangelog', auth_opts).read()
126
+ end
127
+
128
+ def auth_opts
129
+ if variable(:scm_username) and variable(:scm_username)
130
+ {:http_basic_authentication => [variable(:scm_username), variable(:scm_password)]}
131
+ else
132
+ {}
133
+ end
114
134
  end
115
135
 
116
136
  def artifact_zip_url(revision)
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-scm-jenkins
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
5
4
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 1
10
- version: 0.0.1
5
+ version: 0.0.2
11
6
  platform: ruby
12
7
  authors:
13
8
  - LI Daobing
@@ -15,7 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-11-25 00:00:00 +08:00
13
+ date: 2011-11-26 00:00:00 +08:00
19
14
  default_executable:
20
15
  dependencies:
21
16
  - !ruby/object:Gem::Dependency
@@ -26,9 +21,6 @@ dependencies:
26
21
  requirements:
27
22
  - - ">="
28
23
  - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
24
  version: "0"
33
25
  type: :runtime
34
26
  version_requirements: *id001
@@ -40,13 +32,12 @@ dependencies:
40
32
  requirements:
41
33
  - - ">="
42
34
  - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
35
  version: "0"
47
36
  type: :development
48
37
  version_requirements: *id002
49
- description: use jenkins as a capistrano scm
38
+ description: "\n\
39
+ With this plugin, you can use jenkins build artifact as a repository, and\n\
40
+ deploy your build artifact with capistrano.\n "
50
41
  email:
51
42
  - lidaobing@gmail.com
52
43
  executables: []
@@ -60,6 +51,7 @@ files:
60
51
  - .rspec
61
52
  - Gemfile
62
53
  - Gemfile.lock
54
+ - NEWS.md
63
55
  - README.md
64
56
  - Rakefile
65
57
  - capistrano-scm-jenkins.gemspec
@@ -82,23 +74,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
82
74
  requirements:
83
75
  - - ">="
84
76
  - !ruby/object:Gem::Version
85
- hash: 3
86
- segments:
87
- - 0
88
77
  version: "0"
89
78
  required_rubygems_version: !ruby/object:Gem::Requirement
90
79
  none: false
91
80
  requirements:
92
81
  - - ">="
93
82
  - !ruby/object:Gem::Version
94
- hash: 3
95
- segments:
96
- - 0
97
83
  version: "0"
98
84
  requirements: []
99
85
 
100
86
  rubyforge_project: capistrano-scm-jenkins
101
- rubygems_version: 1.6.2
87
+ rubygems_version: 1.5.3
102
88
  signing_key:
103
89
  specification_version: 3
104
90
  summary: use jenkins as a capistrano scm