pushwagner 0.0.1.1 → 0.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.
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - jruby-18mode # JRuby in 1.8 mode
5
+ - jruby-19mode # JRuby in 1.9 mode
6
+ - 1.8.7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pushwagner (0.0.1)
4
+ pushwagner (0.0.1.1)
5
5
  net-scp
6
6
  net-ssh
7
7
  nokogiri (~> 1.5)
data/README.md CHANGED
@@ -1 +1,4 @@
1
+ # Pushwagner [![Build Status](https://secure.travis-ci.org/oc/pushwagner.png)](http://travis-ci.org/oc/pushwagner)
2
+
3
+
1
4
  [X] Release early, [ ] Release often
data/TODO.md CHANGED
@@ -1,24 +1,27 @@
1
1
  Static-file provision:
2
2
 
3
3
  [ ] Support hooks, i.e.:
4
- hooks:
5
- before:
6
- - cmd: mvn package
7
- cwd: anyone-web
8
- scope: local
9
- after:
10
- - cmd: unzip anyone-web.zip
11
- cwd: /srv/www/gethubble.com
12
- scope: remote
4
+
5
+ hooks:
6
+ before:
7
+ - cmd: mvn package
8
+ cwd: anyone-web
9
+ scope: local
10
+ after:
11
+ - cmd: unzip anyone-web.zip
12
+ cwd: /srv/www/gethubble.com
13
+ scope: remote
14
+
13
15
  [ ] Add another wrapper for files:
14
- static:
15
- name:
16
- files: # files to upload
17
- - ...
18
- hooks: # before and after deploy hooks
19
- - ...
20
- services: # assumes service with same name
21
- - restart
16
+
17
+ static:
18
+ name:
19
+ files: # files to upload
20
+ - ...
21
+ hooks: # before and after deploy hooks
22
+ - ...
23
+ services: # assumes service with same name
24
+ - restart
22
25
 
23
26
 
24
27
  Maven:
@@ -1,5 +1,6 @@
1
1
  require 'pushwagner/ext'
2
2
  require 'pushwagner/maven'
3
+ require 'yaml'
3
4
 
4
5
  module Pushwagner
5
6
 
@@ -11,7 +12,7 @@ module Pushwagner
11
12
  opts = HashWithIndifferentAccess.new(opts)
12
13
 
13
14
  config_file = opts[:config_file] || File.join(File.dirname(__FILE__), '/config/deploy.yml')
14
- @version = opts[:version].to_s
15
+ @version = opts[:version] && opts[:version].to_s
15
16
  @current = opts[:environment] || 'development'
16
17
 
17
18
  @config = HashWithIndifferentAccess.new(YAML::load_file(config_file) || {})
@@ -11,7 +11,12 @@ module Pushwagner
11
11
  def initialize(maven, version)
12
12
  required("Need maven configuration") unless maven
13
13
 
14
- @version = version.to_s || required("Deployment version for artifacts is required")
14
+ if version && !version.empty?
15
+ @version = version
16
+ else
17
+ required("Deployment version for artifacts is required")
18
+ end
19
+
15
20
  @repository = Repository.new(maven['repositories'])
16
21
  @artifacts = Hash[(maven['artifacts'] || required("Requires at least one maven artifact")).map { |k,h| [k, Artifact.new(h['artifact_id'], h['group_id'], h['version'] || version)] }]
17
22
 
@@ -1,3 +1,3 @@
1
1
  module Pushwagner
2
- VERSION = "0.0.1.1"
2
+ VERSION = "0.0.1.2"
3
3
  end
@@ -13,7 +13,7 @@ maven:
13
13
  artifact_id: trouble-notifier
14
14
 
15
15
  static:
16
- diakonhjemmet.uppercase.no:
16
+ blah.uppercase.no:
17
17
  - index.htm
18
18
  - static
19
19
 
@@ -1,7 +1,7 @@
1
1
  path_prefix: /static/path
2
2
 
3
3
  static:
4
- diakonhjemmet.uppercase.no:
4
+ blah.uppercase.no:
5
5
  - index.htm
6
6
  - static
7
7
 
@@ -22,7 +22,7 @@ describe Pushwagner::Environment do
22
22
  expect(env.version).to eq("1.3.3.7")
23
23
  end
24
24
  end
25
- describe "#maven" do
25
+ describe "maven artifacts" do
26
26
  it "requires a version" do
27
27
  env = Pushwagner::Environment.new(:config_file => File.join(config_root, 'maven.yml'))
28
28
  expect { env.maven }.to raise_error(StandardError, "Deployment version for artifacts is required")
@@ -34,41 +34,41 @@ describe Pushwagner::Environment do
34
34
  expect(env.maven).to eq({})
35
35
  end
36
36
  end
37
- describe "#static" do
37
+ describe "static files" do
38
38
  it "returns empty hash when not configured" do
39
39
  env = Pushwagner::Environment.new(:config_file => File.join(config_root, 'maven.yml'), :version => "1foo" )
40
40
  expect(env.static?).to be_false
41
41
  expect(env.static).to eq({})
42
42
  end
43
- it "is a hash with files" do
43
+ it "parses to a hash of files" do
44
44
  env = Pushwagner::Environment.new(:config_file => File.join(config_root, 'static.yml'))
45
- expect(env.static).to eq({'diakonhjemmet.uppercase.no' => ['index.htm', 'static']})
45
+ expect(env.static).to eq({'blah.uppercase.no' => ['index.htm', 'static']})
46
46
  end
47
47
  end
48
- describe "#environments" do
48
+ describe "environments" do
49
49
  it "returns all environments" do
50
50
  env = Pushwagner::Environment.new(:config_file => File.join(config_root, 'full.yml'), :version => "1foo" )
51
51
  expect(env.environments.size).to eq(2)
52
52
  end
53
- end
54
- describe "#environment" do
55
- it "returns empty environment if it doesn't exist" do
56
- env = Pushwagner::Environment.new(:config_file => File.join(config_root, 'full.yml'), :version => "1foo" )
57
- expect(env.environment).to eq({})
58
- end
59
- it "returns environment if it exists" do
60
- env = Pushwagner::Environment.new(:config_file => File.join(config_root, 'full.yml'), :version => "1foo", :environment => "staging")
61
- expect(env.environment).to eq({'hosts' => ["staging.uppercase.no"], 'user' => "www-data"})
62
- end
63
- end
64
- describe "#hosts" do
65
- it "returns empty list if it doesn't exist" do
66
- env = Pushwagner::Environment.new(:config_file => File.join(config_root, 'empty.yml'), :version => "1foo" )
67
- expect(env.hosts).to eq([])
68
- end
69
- it "returns environment if it exists" do
70
- env = Pushwagner::Environment.new(:config_file => File.join(config_root, 'full.yml'), :version => "1foo", :environment => "staging")
71
- expect(env.environment).to eq({'hosts' => ["staging.uppercase.no"], 'user' => "www-data"})
53
+ describe "environment" do
54
+ it "returns empty environment if it doesn't exist" do
55
+ env = Pushwagner::Environment.new(:config_file => File.join(config_root, 'full.yml'), :version => "1foo" )
56
+ expect(env.environment).to eq({})
57
+ end
58
+ it "returns environment if it exists" do
59
+ env = Pushwagner::Environment.new(:config_file => File.join(config_root, 'full.yml'), :version => "1foo", :environment => "staging")
60
+ expect(env.environment).to eq({'hosts' => ["staging.uppercase.no"], 'user' => "www-data"})
61
+ end
62
+ describe "hosts" do
63
+ it "returns empty list if it doesn't exist" do
64
+ env = Pushwagner::Environment.new(:config_file => File.join(config_root, 'empty.yml'), :version => "1foo" )
65
+ expect(env.hosts).to eq([])
66
+ end
67
+ it "returns environment if it exists" do
68
+ env = Pushwagner::Environment.new(:config_file => File.join(config_root, 'full.yml'), :version => "1foo", :environment => "staging")
69
+ expect(env.environment).to eq({'hosts' => ["staging.uppercase.no"], 'user' => "www-data"})
70
+ end
71
+ end
72
72
  end
73
73
  end
74
74
  end
data/spec/maven_spec.rb CHANGED
@@ -27,7 +27,7 @@ describe Pushwagner::Maven do
27
27
  expect(m.artifacts["some-notifier"].version).to eq("1.0final")
28
28
  end
29
29
 
30
- describe "initialization of artifacts" do
30
+ describe "artifacts" do
31
31
  it "requires at least one artifact" do
32
32
  cfg.delete('artifacts')
33
33
  expect {Pushwagner::Maven.new(cfg, "1bar")}.to raise_error(StandardError, "Requires at least one maven artifact")
@@ -35,25 +35,25 @@ describe Pushwagner::Maven do
35
35
  it "parses two artifacts" do
36
36
  m = Pushwagner::Maven.new(cfg, "1bar")
37
37
  expect(m.artifacts.size).to eq(2)
38
- expect(m.artifacts.keys.first).to eq("some-api")
39
- expect(m.artifacts.keys.last).to eq("some-notifier")
38
+ expect(m.artifacts.keys).to include("some-api")
39
+ expect(m.artifacts.keys).to include("some-notifier")
40
40
  end
41
41
  end
42
42
 
43
- describe "initialization of repositories" do
44
- it "requires snapshots repository" do
43
+ describe "repositories" do
44
+ it "requires repositories configuration element" do
45
45
  cfg.delete('repositories')
46
46
  expect {Pushwagner::Maven.new(cfg, "1")}.to raise_error(StandardError)
47
47
  end
48
- it "requires snapshots repository" do
48
+ it "requires 'snapshots' repository" do
49
49
  cfg['repositories'].delete('snapshots')
50
50
  expect {Pushwagner::Maven.new(cfg, "1")}.to raise_error(StandardError)
51
51
  end
52
- it "requires releases repository" do
52
+ it "requires 'releases' repository" do
53
53
  cfg['repositories'].delete('releases')
54
54
  expect {Pushwagner::Maven.new(cfg, "1")}.to raise_error(StandardError)
55
55
  end
56
- it "parses repository" do
56
+ it "parses repositories" do
57
57
  m = Pushwagner::Maven.new(cfg, "1")
58
58
  expect(m.repository.snapshots_url).to eq("http://w00t.uppercase.no/nexus/content/repositories/snapshots")
59
59
  expect(m.repository.releases_url).to eq("http://w00t.uppercase.no/nexus/content/repositories/releases")
@@ -61,7 +61,7 @@ describe Pushwagner::Maven do
61
61
  end
62
62
  end
63
63
 
64
- describe "repositories" do
64
+ describe "repository authentication" do
65
65
  let(:settings) {IO.read(File.join(config_root, 'settings.xml'))}
66
66
 
67
67
  it "reads releases authentication from maven settings.xml" do
@@ -81,7 +81,8 @@ describe Pushwagner::Maven do
81
81
 
82
82
  expect(m.repository.authentication(true)).to eq("bar:baz")
83
83
  end
84
-
84
+ end
85
+ describe "maven2-style repo support" do
85
86
  let(:metadata) {IO.read(File.join(config_root, 'maven-metadata.xml'))}
86
87
 
87
88
  it "builds maven2-repo-style urls and retrieves metadata" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pushwagner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.1
4
+ version: 0.0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-26 00:00:00.000000000 Z
12
+ date: 2012-11-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: net-ssh
@@ -116,6 +116,7 @@ extra_rdoc_files: []
116
116
  files:
117
117
  - .gitignore
118
118
  - .rvmrc
119
+ - .travis.yml
119
120
  - Gemfile
120
121
  - Gemfile.lock
121
122
  - README.md