mystro-common 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-1.9.3-p448@mystro
data/CHANGELOG.md ADDED
@@ -0,0 +1,22 @@
1
+ # Changelog
2
+
3
+ ## v0.1.3:
4
+ * fixes bugs with dns usage and plugin methods when no plugins are defined
5
+ * update ruby version
6
+ * lock activesupport to same version as rails for mystro/server
7
+ * ruby-version, changelog task and add rake to Gemfile
8
+ * merge release v0.1.2
9
+ * new DSL framework
10
+ * ruby version file
11
+ * changelog rake tasks
12
+
13
+ ## v0.1.2:
14
+ * new plugin support code for mystro-volley integration
15
+ * new DSL framework
16
+ * ruby version file
17
+ * changelog rake tasks
18
+
19
+ ## v0.1.1:
20
+ * new DSL framework
21
+ * ruby version file
22
+
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in mystro-common.gemspec
4
4
  gemspec
5
+
6
+ gem "rake"
data/Rakefile CHANGED
@@ -1 +1,51 @@
1
1
  require "bundler/gem_tasks"
2
+
3
+ def changelog(last=nil, single=false)
4
+ command="git --no-pager log --format='%an::::%h::::%s'"
5
+
6
+ list = `git tag`
7
+
8
+ puts "# Changelog"
9
+ puts
10
+
11
+ ordered = list.lines.sort_by {|e| (a,b,c) = e.gsub(/^v/,"").split("."); "%3d%3d%3d" % [a, b, c]}
12
+
13
+ ordered.reject{|e| (a,b,c,d) = e.split("."); !d.nil?}.reverse_each do |t|
14
+ tag = t.chomp
15
+
16
+ if last
17
+ check = { }
18
+ out = []
19
+ log = `#{command} #{last}...#{tag}`
20
+ log.lines.each do |line|
21
+ (who, hash, msg) = line.split('::::')
22
+ unless check[msg]
23
+ unless msg =~ /^Merge branch/ || msg =~ /CHANGELOG/ || msg =~ /^(v|version|changes for|preparing|ready for release|ready to release|bump version)*\s*(v|version)*\d+\.\d+\.\d+/
24
+ msg.gsub(" *", "\n*").gsub(/^\*\*/, " *").lines.each do |l|
25
+ line = l =~ /^(\s+)*\*/ ? l : "* #{l}"
26
+ out << line
27
+ end
28
+ check[msg] = hash
29
+ end
30
+ end
31
+ end
32
+ puts "## #{last}:"
33
+ out.each { |e| puts e }
34
+ #puts log
35
+ puts
36
+ end
37
+
38
+ last = tag
39
+ exit if single
40
+ end
41
+ end
42
+
43
+ desc "generate changelog output"
44
+ task :changelog do
45
+ changelog
46
+ end
47
+
48
+ desc "show current changes (changelog output from HEAD to most recent tag)"
49
+ task :current do
50
+ changelog("HEAD",true)
51
+ end
data/lib/mystro-common.rb CHANGED
@@ -11,6 +11,7 @@ module Mystro
11
11
  end
12
12
 
13
13
  def account
14
+ raise "mystro account unset! default account ('#{config.default_account}') doesn't exist?" unless current_account
14
15
  current_account.data
15
16
  end
16
17
 
@@ -3,7 +3,7 @@ module Mystro
3
3
  module Version
4
4
  MAJOR = 0
5
5
  MINOR = 1
6
- TINY = 2
6
+ TINY = 3
7
7
  TAG = nil
8
8
  STRING = [MAJOR, MINOR, TINY, TAG].compact.join(".")
9
9
  end
@@ -62,7 +62,8 @@ module Mystro
62
62
  end
63
63
 
64
64
  def connect
65
- @fog ||= model.new(opt) if opt
65
+ #puts "connect: #{model}.new(#{opt.to_hash.symbolize_keys})"
66
+ @fog ||= model.new(opt.to_hash.symbolize_keys) if opt
66
67
  rescue => e
67
68
  Mystro::Log.error "#{cname} connect failed: #{e.message} at #{e.backtrace.first}"
68
69
  end
@@ -14,24 +14,31 @@ module Mystro
14
14
  def connect
15
15
  @fog ||= begin
16
16
  raise "could not connect to DNS; #{opt.to_hash.inspect}; #{cfg.to_hash.inspect}" unless opt && cfg.zone
17
- dns = Fog::DNS.new(opt)
18
- dns.zones.find(cfg.zone).first
17
+ zone(cfg.zone)
19
18
  end
20
19
  rescue => e
21
20
  Mystro::Log.error "DNS connect failed: #{e.message} at #{e.backtrace.first}"
22
21
  Mystro::Log.error e
23
22
  end
24
23
 
24
+ def connection
25
+ Fog::DNS.new(opt.to_hash.symbolize_keys)
26
+ end
27
+
25
28
  def zones
26
- Fog::DNS.new(opt).zones.all
29
+ connection.zones.all
27
30
  end
28
31
 
29
32
  def zone(name)
30
- Fog::DNS.new(opt).zones.find(name).first
33
+ z = connection.zones.get(name)
34
+ raise("zone #{name} not found") unless z
35
+ z
36
+ rescue => e
37
+ raise("problem retrieving zone #{name}: #{e.message} at #{e.backtrace.first}")
31
38
  end
32
39
 
33
40
  def create_zone(model)
34
- Fog::DNS.new(opt).zones.create(model.fog_options)
41
+ connection.zones.create(model.fog_options)
35
42
  end
36
43
  end
37
44
  end
data/lib/mystro/plugin.rb CHANGED
@@ -45,7 +45,7 @@ module Mystro
45
45
  def ui
46
46
  @ui ||= begin
47
47
  ui = {}
48
- @plugins.each do |key, opts|
48
+ (@plugins||{}).each do |key, opts|
49
49
  if opts[:ui]
50
50
  n = opts[:name]
51
51
  ui[n] = opts[:ui]
@@ -58,7 +58,7 @@ module Mystro
58
58
  def jobs
59
59
  @jobs ||= begin
60
60
  jobs = []
61
- @plugins.each do |key, opts|
61
+ (@plugins||{}).each do |key, opts|
62
62
  if opts[:jobs]
63
63
  jobs << opts[:jobs]
64
64
  end
@@ -70,7 +70,7 @@ module Mystro
70
70
  def schedule
71
71
  @schedule ||= begin
72
72
  s = {}
73
- @plugins.each do |key, opts|
73
+ (@plugins||{}).each do |key, opts|
74
74
  if opts[:schedule]
75
75
  opts[:schedule].each do |w, o|
76
76
  n = w.to_s.capitalize + "Worker"
@@ -17,10 +17,10 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
19
 
20
- gem.add_dependency "fog" # talk to cloud
21
- gem.add_dependency "yell", "~> 1.2.0" # logging
22
- gem.add_dependency "hashie" # better data objects
23
- gem.add_dependency "activesupport" # active support
24
- gem.add_dependency "ipaddress" # ip address library
25
- gem.add_dependency "erubis" # userdata templates
20
+ gem.add_dependency "fog", "~> 1.12.1" # talk to cloud
21
+ gem.add_dependency "yell", "~> 1.2.0" # logging
22
+ gem.add_dependency "hashie" # better data objects
23
+ gem.add_dependency "activesupport", "3.2.8" # active support
24
+ gem.add_dependency "ipaddress" # ip address library
25
+ gem.add_dependency "erubis" # userdata templates
26
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mystro-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,24 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-15 00:00:00.000000000 Z
12
+ date: 2013-07-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: 1.12.1
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ! '>='
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: '0'
29
+ version: 1.12.1
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: yell
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -64,17 +64,17 @@ dependencies:
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  none: false
66
66
  requirements:
67
- - - ! '>='
67
+ - - '='
68
68
  - !ruby/object:Gem::Version
69
- version: '0'
69
+ version: 3.2.8
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
- - - ! '>='
75
+ - - '='
76
76
  - !ruby/object:Gem::Version
77
- version: '0'
77
+ version: 3.2.8
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: ipaddress
80
80
  requirement: !ruby/object:Gem::Requirement
@@ -115,6 +115,8 @@ extensions: []
115
115
  extra_rdoc_files: []
116
116
  files:
117
117
  - .gitignore
118
+ - .ruby-version
119
+ - CHANGELOG.md
118
120
  - Gemfile
119
121
  - LICENSE.txt
120
122
  - README.md
@@ -149,15 +151,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
149
151
  - - ! '>='
150
152
  - !ruby/object:Gem::Version
151
153
  version: '0'
154
+ segments:
155
+ - 0
156
+ hash: 187241732432355941
152
157
  required_rubygems_version: !ruby/object:Gem::Requirement
153
158
  none: false
154
159
  requirements:
155
160
  - - ! '>='
156
161
  - !ruby/object:Gem::Version
157
162
  version: '0'
163
+ segments:
164
+ - 0
165
+ hash: 187241732432355941
158
166
  requirements: []
159
167
  rubyforge_project:
160
- rubygems_version: 1.8.24
168
+ rubygems_version: 1.8.25
161
169
  signing_key:
162
170
  specification_version: 3
163
171
  summary: common functionality for Mystro