fontana_client_support 0.4.1 → 0.5.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 49906ba658f2721bddcc19a66daf1b1dc3a0008f
4
- data.tar.gz: 8471d5f7dfd5d7be4ea5b16e57f08e3330c85a44
5
- SHA512:
6
- metadata.gz: f06004dbb113bbcec556212815cfbcef3d6a1f310b2c0cf31666095f6f47bd7cb44651f20fa0066b561b97da12e0f82045780f238a1871c885aab5b7306db08d
7
- data.tar.gz: 6ac36294c9f75bb744096a2f02408e6103d475c25f9262dd5fb2bb29c93ec712cd6f2815da1fc6fa7184e57067bb444864fab54a6f48879dddb73a59a6c92b67
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MzUxMzFkYjQxNDU0NmRiYWU5ODBhZGMzZmZmMDgxYjIwMDIzOGJlMg==
5
+ data.tar.gz: !binary |-
6
+ YzQ1NGMwNjIyMjk5ZTBjZDMwYjdhMzYwYjlkMDgwNmZhNmY3NWY3NA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ YjQ4Zjk5NmE5YjgzOGNmOWRjZDJjYzFjY2MzMGVmOWM4ZGE2MDhiYTI5MWJl
10
+ Y2Y0NmZlMDUxOTNiOTI4OGRiYzVlYTAxMDIyYTM5OWQ0MDEyNGVjOWNmMTUw
11
+ NmU4OWY2ZjRmY2I1NTYxZDcyNDY0ODQ2MzVhNzcwM2E4YjY4YjM=
12
+ data.tar.gz: !binary |-
13
+ ZWFhMDc2ZmM2ZmU4ZWY4NGY3Y2VkOTdiNDIzNzdmYWQ2OTVlNmViMGFlYmM5
14
+ NjFlNjFmMjMyMzdhZTdkMzBhY2RlMDE5OTM2NmI2MTE0ZTRlNWMzM2ZiM2I0
15
+ M2Q1NDFjYjIyMzU2OTE5OTVmMDFlYTA3NmMyNjk1ZmUyYzFjYTQ=
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "spec/fontana_client_support/config_server_sample1"]
2
+ path = spec/fontana_client_support/config_server_sample1
3
+ url = git@github.com:groovenauts/fontana_sample.git
data/Rakefile CHANGED
@@ -1 +1,4 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
@@ -20,4 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
24
+ spec.add_development_dependency "httpclient"
25
+ spec.add_development_dependency "json"
23
26
  end
@@ -0,0 +1,59 @@
1
+ require 'fontana_client_support'
2
+
3
+ module FontanaClientSupport
4
+ class ConfigServer
5
+
6
+ # see http://doc.ruby-lang.org/ja/1.9.3/class/WEBrick=3a=3aHTTPServer.html
7
+ def initialize(config = {})
8
+ @config = {
9
+ :DocumentRoot => File.join(FontanaClientSupport.root_dir, "config_server"),
10
+ :BindAddress => '127.0.0.1',
11
+ :Port => 80
12
+ }
13
+ @config.update(config)
14
+ end
15
+
16
+ def launch
17
+ require 'webrick'
18
+ server = WEBrick::HTTPServer.new(@config)
19
+ puts "config_server options: #{@config.inspect}"
20
+ Signal.trap(:INT){ server.shutdown }
21
+ server.start
22
+ end
23
+
24
+ class << self
25
+
26
+ def start_daemon(options = {})
27
+ pid_dir = File.join(FontanaClientSupport.root_dir, "tmp/pids")
28
+ pid_file = File.join(pid_dir, "config_server.pid")
29
+ if File.exist?(pid_file)
30
+ raise "Can't start config server daemon because #{pid_file} already exists."
31
+ end
32
+ FileUtils.mkdir_p(pid_dir)
33
+ pid = fork do
34
+ $PROGRAM_NAME = __FILE__
35
+ open(pid_file, "w") do |f|
36
+ f.write(Process.pid)
37
+ end
38
+ begin
39
+ self.new(options).launch
40
+ ensure
41
+ File.delete(pid_file)
42
+ end
43
+ end
44
+ pid
45
+ end
46
+
47
+ def stop_daemon
48
+ pid_dir = File.join(FontanaClientSupport.root_dir, "tmp/pids")
49
+ Dir[File.join(pid_dir, "config_server.pid")].each do |filepath|
50
+ pid = File.read(filepath)
51
+ Process.kill("INT", pid.to_i)
52
+ end
53
+ end
54
+
55
+ end
56
+
57
+ end
58
+
59
+ end
@@ -0,0 +1,20 @@
1
+ require 'fileutils'
2
+
3
+ namespace :config_server do
4
+
5
+ desc "launch server process in foreground mode"
6
+ task :launch do
7
+ FontanaClientSupport::ConfigServer.new.launch
8
+ end
9
+
10
+ desc "start server daemon"
11
+ task :start do
12
+ FontanaClientSupport::ConfigServer.start_daemon
13
+ end
14
+
15
+ desc "stop server daemon"
16
+ task :stop do
17
+ FontanaClientSupport::ConfigServer.stop_daemon
18
+ end
19
+
20
+ end
@@ -1,3 +1,3 @@
1
1
  module FontanaClientSupport
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5.0"
3
3
  end
@@ -2,6 +2,8 @@ require "fontana_client_support/version"
2
2
 
3
3
  module FontanaClientSupport
4
4
 
5
+ autoload :ConfigServer, "fontana_client_support/config_server"
6
+
5
7
  class << self
6
8
  attr_accessor :root_dir
7
9
 
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ require 'httpclient'
4
+ require 'json'
5
+
6
+ describe FontanaClientSupport::ConfigServer do
7
+
8
+ before do
9
+ path = File.expand_path("../config_server_sample1", __FILE__)
10
+ FontanaClientSupport.root_dir = path
11
+ # FontanaClientSupport::ConfigServer.start_daemon(:Port => 3002, :DocumentRoot => path)
12
+ FontanaClientSupport::ConfigServer.start_daemon(:Port => 3002)
13
+ sleep(3)
14
+ end
15
+
16
+ after do
17
+ FontanaClientSupport::ConfigServer.stop_daemon
18
+ end
19
+
20
+ it "get develop.json" do
21
+ c = HTTPClient.new
22
+ JSON.parse(c.get_content("http://localhost:3002/api_server/1/develop.json")).should == {
23
+ "http_url_base" => "http://localhost:3000",
24
+ "https_url_base" => "https://localhost:3001",
25
+ }
26
+ end
27
+
28
+ end
@@ -0,0 +1,3 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'fontana_client_support'
3
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fontana_client_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - akima
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-17 00:00:00.000000000 Z
11
+ date: 2013-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -28,14 +28,56 @@ dependencies:
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ! '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: httpclient
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: json
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ! '>='
39
81
  - !ruby/object:Gem::Version
40
82
  version: '0'
41
83
  description: gem to support development and testing with GSS/fontana
@@ -46,6 +88,7 @@ extensions: []
46
88
  extra_rdoc_files: []
47
89
  files:
48
90
  - .gitignore
91
+ - .gitmodules
49
92
  - Gemfile
50
93
  - LICENSE.txt
51
94
  - README.md
@@ -56,7 +99,9 @@ files:
56
99
  - lib/fontana/rake_utils.rb
57
100
  - lib/fontana/server_rake.rb
58
101
  - lib/fontana_client_support.rb
102
+ - lib/fontana_client_support/config_server.rb
59
103
  - lib/fontana_client_support/tasks.rb
104
+ - lib/fontana_client_support/tasks/config_server.rake
60
105
  - lib/fontana_client_support/tasks/deploy/scm.rake
61
106
  - lib/fontana_client_support/tasks/deploy/sync.rake
62
107
  - lib/fontana_client_support/tasks/fixtures.rake
@@ -64,6 +109,8 @@ files:
64
109
  - lib/fontana_client_support/tasks/spec.rake
65
110
  - lib/fontana_client_support/tasks/vendor_fontana.rake
66
111
  - lib/fontana_client_support/version.rb
112
+ - spec/fontana_client_support/config_server_spec.rb
113
+ - spec/spec_helper.rb
67
114
  homepage: ''
68
115
  licenses:
69
116
  - MIT
@@ -74,12 +121,12 @@ require_paths:
74
121
  - lib
75
122
  required_ruby_version: !ruby/object:Gem::Requirement
76
123
  requirements:
77
- - - '>='
124
+ - - ! '>='
78
125
  - !ruby/object:Gem::Version
79
126
  version: '0'
80
127
  required_rubygems_version: !ruby/object:Gem::Requirement
81
128
  requirements:
82
- - - '>='
129
+ - - ! '>='
83
130
  - !ruby/object:Gem::Version
84
131
  version: '0'
85
132
  requirements: []
@@ -88,5 +135,7 @@ rubygems_version: 2.0.3
88
135
  signing_key:
89
136
  specification_version: 4
90
137
  summary: gem to support development and testing with GSS/fontana
91
- test_files: []
138
+ test_files:
139
+ - spec/fontana_client_support/config_server_spec.rb
140
+ - spec/spec_helper.rb
92
141
  has_rdoc: