fontana_client_support 0.6.3 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MzYzNTNlZjgwYjgwMzNkNzAwMTY1MjQ5ZTUzMmU2YjVmMzY2YzczNQ==
5
- data.tar.gz: !binary |-
6
- NDg5MTBhZjg4ODVjZDllZGJkNzlkMDFmMDJjMTRiYzYzZjE1MzYyYQ==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- ZTgwOGI0NTE0NGUxMGNmOTUyMmYxNDk2ZmIxMDhhNzkwYjZhYTA5ZDQ3OTJm
10
- ZmU5Mjc3ODAxMDZkNmE2ODQ2NDI2MzAwYzg0ODAxNjE5MTkwMDRkM2U2MGM3
11
- YTJmY2M0MDU3N2RhNGZmNmNlMGQ3ZTgwZjA5ZjY3ZTNjMTIyNDc=
12
- data.tar.gz: !binary |-
13
- MmE3ODM4MzFlN2VkMjIyMDI5ZjUzYzczMTg3NjZiN2FhZDIzNTQyMzIxNzU5
14
- NmFhZGU3OWU0N2NhODU3ZGRkN2ZhNDcyYTc2Y2Q3NTY5YTViNWU0ZmI4NWU0
15
- YjhiZDNmYzExNTUzNDA3YzAzYTJjYjIzYzExNTJlYWYzZDhkOTk=
2
+ SHA1:
3
+ metadata.gz: d9cec5bc5e9f37dacf46a8061e9dad4ebbe41dcb
4
+ data.tar.gz: 05effcbe5e02a50bb435b736d674c06447dc3fc8
5
+ SHA512:
6
+ metadata.gz: 466b2ffe6398cb88ed07029d88dd8a01e8d3036d1401cfd45cdea746f4e1d6819043ff33e2d407bf044e9c037c47775c2652c541c8c7daff13a6794ae6e74d93
7
+ data.tar.gz: 88aac68f52270f3d4deaac0b0a25406563b56c0b29678977f2ea6c7f5ba2093c61771d87767f735d5c17588fbfe92b7b8f8080b9fcb0e98380129ea2eee8d3a2
@@ -8,15 +8,15 @@ module Fontana
8
8
 
9
9
  module_function
10
10
 
11
- def task_options
12
- @task_options ||= {}
13
- end
14
-
15
- def call_fontana_task(name)
16
- options = task_options[name]
11
+ def call_fontana_task(name, options)
12
+ # options = task_options[name]
17
13
  options[:before].call if options[:before]
18
14
 
19
- cmd = "BUNDLE_GEMFILE=#{Fontana.gemfile} bundle exec rake #{name}"
15
+ cmd = ""
16
+ if (envs = options[:env]) && !envs.empty?
17
+ cmd << envs.map{|(k,v)| "#{k}=#{v}"}.join(" ") << ' '
18
+ end
19
+ cmd << "BUNDLE_GEMFILE=#{Fontana.gemfile} bundle exec rake #{name}"
20
20
  if Rake.application.options.trace
21
21
  cmd << " --trace -v"
22
22
  end
@@ -29,9 +29,8 @@ module Fontana
29
29
 
30
30
  def fontana_task(name, options = {})
31
31
  full_name = (@namespaces + [name]).join(':')
32
- task_options[full_name] = options
33
32
  task name do
34
- call_fontana_task(full_name)
33
+ call_fontana_task(full_name, options)
35
34
  end
36
35
  end
37
36
 
@@ -0,0 +1,53 @@
1
+ require 'fontana_client_support'
2
+ include Fontana::ServerRake
3
+ include Fontana::CommandUtils
4
+
5
+ tasks_without_desc = %w[drop seed summary create]
6
+ mongoid_tasks = %w[create_indexes remove_indexes]
7
+
8
+ [:development, :test].each do |app_mode|
9
+
10
+ options = { env: { FONTANA_APP_MODE: app_mode.to_s } }
11
+ namespace app_mode do
12
+ namespace_with_fontana :db, :"db" do
13
+ tasks_without_desc.each do |t|
14
+ fontana_task t.to_sym, options
15
+ end
16
+ end
17
+
18
+ namespace_with_fontana :db, :"db:mongoid" do
19
+ mongoid_tasks.each do |t|
20
+ fontana_task t.to_sym, options
21
+ end
22
+ end
23
+ end
24
+ end
25
+
26
+ namespace :db do
27
+ (tasks_without_desc + mongoid_tasks).each do |t|
28
+ task t.to_sym => :"development:db:#{t}"
29
+ end
30
+
31
+ namespace :drop do
32
+ if FontanaClientSupport.root_dir
33
+
34
+ basename = File.basename(FontanaClientSupport.root_dir)
35
+ db_names = `mongo --quiet --eval "db.adminCommand('listDatabases')['databases'].map(function(db){ return db.name }).filter(function(db){ return db.match(/#{basename}/)}).join(',')"`.strip.split(/,/)
36
+ desc "CAUTION! drop databases: #{db_names.join(',')}"
37
+ task :all do
38
+ db_names.each do |db_name|
39
+ system!(%Q!mongo --quiet --eval "db = db.getSiblingDB('#{db_name}'); printjson(db.dropDatabase())"!)
40
+ end
41
+ end
42
+
43
+ else
44
+
45
+ desc "CAUTION! drop databases for both development and test"
46
+ task :all => [:"test:db:drop", :"development:db:drop"]
47
+
48
+ end
49
+ end
50
+ end
51
+
52
+
53
+
@@ -0,0 +1,15 @@
1
+ require 'fontana_client_support'
2
+ include Fontana::CommandUtils
3
+
4
+ namespace :clear do
5
+ desc "CAUTION! clear databases and vendor/fontana"
6
+ task :all => [:"db:drop:all", :"vendor:fontana:clear"] do
7
+ Dir.chdir(FontanaClientSupport.root_dir) do
8
+ if `git diff`.strip.empty?
9
+ puts "\e[32mOK"
10
+ else
11
+ puts "\e[31mThere is/are different(s). Please, commit and/or revert your changes.\n" << `git status` << "\e[0m"
12
+ end
13
+ end
14
+ end
15
+ end
@@ -53,6 +53,7 @@ end
53
53
  end
54
54
 
55
55
  task_sequential :launch_server_daemons, [
56
+ :"#{app_mode}:db:seed",
56
57
  :"#{app_mode}:server:update_version_set_entries",
57
58
  :"#{app_mode}:server:launch_http_server_daemon",
58
59
  :"#{app_mode}:server:launch_https_server_daemon"
@@ -10,6 +10,25 @@ namespace :vendor do
10
10
 
11
11
  fileutils = FileUtils::Verbose
12
12
 
13
+ def vendor_fontana_version
14
+ d = FontanaClientSupport.vendor_fontana
15
+ if Dir.exist?(d)
16
+ Dir.chdir(d) do
17
+ # log = `git log -1 --decorate --branches --tags` # これだと現在のコミットが先頭にならない
18
+ log = `git log -1 --decorate --oneline`
19
+ if t = log.split(/\s*,\s*/).detect{|s| s =~ /\Atag:\s*v?\d+\.\d+\.\d+/}
20
+ t.split(/\s*:\s*/, 2).last
21
+ else
22
+ nil
23
+ end
24
+ end
25
+ end
26
+ end
27
+
28
+ task :version do
29
+ puts vendor_fontana_version
30
+ end
31
+
13
32
  task :clear do
14
33
  d = FontanaClientSupport.vendor_fontana
15
34
  fileutils.rm_rf(d) if Dir.exist?(d)
@@ -92,8 +111,19 @@ namespace :vendor do
92
111
  task_sequential :reset, [:"vendor:fontana:clear", :"vendor:fontana:setup"]
93
112
 
94
113
  task :prepare do
95
- name = Dir.exist?(FontanaClientSupport.vendor_fontana) ? "update" : "reset"
96
- Rake::Task["vendor:fontana:#{name}"].delegate
114
+ if vfv = vendor_fontana_version
115
+ if vfv == Fontana.version
116
+ puts "\e[32m#{Fontana.version} is already used.\e[0m"
117
+ else
118
+ puts "\e[33m#{vfv} is used but FONTANA_VERSION is #{Fontana.version}\e[0m"
119
+ # name = Dir.exist?(FontanaClientSupport.vendor_fontana) ? "update" : "reset"
120
+ # Rake::Task["vendor:fontana:#{name}"].delegate
121
+ Rake::Task["vendor:fontana:reset"].delegate
122
+ end
123
+ else
124
+ puts "\e[33mversion not found in vendor/fontana\e[0m"
125
+ Rake::Task["vendor:fontana:reset"].delegate
126
+ end
97
127
  end
98
128
 
99
129
 
@@ -1,3 +1,3 @@
1
1
  module FontanaClientSupport
2
- VERSION = "0.6.3"
2
+ VERSION = "0.7.0"
3
3
  end
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.6.3
4
+ version: 0.7.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-08-30 00:00:00.000000000 Z
11
+ date: 2013-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -28,56 +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
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: httpclient
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: json
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description: gem to support development and testing with GSS/fontana
@@ -109,9 +109,11 @@ files:
109
109
  - lib/fontana_client_support/tasks/app_mode.rake
110
110
  - lib/fontana_client_support/tasks/app_seed.rake
111
111
  - lib/fontana_client_support/tasks/config_server.rake
112
+ - lib/fontana_client_support/tasks/db.rake
112
113
  - lib/fontana_client_support/tasks/deploy/scm.rake
113
114
  - lib/fontana_client_support/tasks/deploy/sync.rake
114
115
  - lib/fontana_client_support/tasks/fixtures.rake
116
+ - lib/fontana_client_support/tasks/init.rake
115
117
  - lib/fontana_client_support/tasks/server.rake
116
118
  - lib/fontana_client_support/tasks/spec.rake
117
119
  - lib/fontana_client_support/tasks/vendor_fontana.rake
@@ -128,12 +130,12 @@ require_paths:
128
130
  - lib
129
131
  required_ruby_version: !ruby/object:Gem::Requirement
130
132
  requirements:
131
- - - ! '>='
133
+ - - '>='
132
134
  - !ruby/object:Gem::Version
133
135
  version: '0'
134
136
  required_rubygems_version: !ruby/object:Gem::Requirement
135
137
  requirements:
136
- - - ! '>='
138
+ - - '>='
137
139
  - !ruby/object:Gem::Version
138
140
  version: '0'
139
141
  requirements: []