daddy 0.5.11 → 0.5.12

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,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6308ad7d7552c30d5902d7b5ae50e68b94a6ef9e
4
- data.tar.gz: 2676b801407bbaa36218ff66eefe66c1b96a0231
3
+ metadata.gz: 579a0828199198496d56a2646e0ade28a1af3049
4
+ data.tar.gz: afdfc1e20ebbd83651237af7c5e7d75b8da1b1ae
5
5
  SHA512:
6
- metadata.gz: 930548cd6b99fa4a6a13a4326cadd7b3d2497dff2342285b89fc12419d445c1a96bdd9e44fd18ee45aab4c3e511e2fe07db1c7ee80afb6771828f68ca3588fab
7
- data.tar.gz: 4c1ba131807d6b44453b4ce054dd6244087bf3b27f10a487b785b6b808e7db9e394e98cb4b737875881d42eff4ec42f9afdd1df1310bcea464d32d5bcdd75e72
6
+ metadata.gz: 5137c02e93414a0507a580f817f0272ce03d503e47ada61f4222af8aac29969058c82413794a0b22c4acb4cdb168f64e8c7661b8a3cdf93ee7a04e736c1ceedd
7
+ data.tar.gz: fb6a3facc78426c63cbd7b72e623a7a6803c336df0bf6ec23b3c9728870ff08cd2090f5aca8072091d2b2f4099a522d1a82c6cdbf8b75c340df6e44150cbaf03
@@ -0,0 +1,33 @@
1
+ require 'daddy/itamae'
2
+
3
+ case dad_env
4
+ when 'production', 'development'
5
+ directory '/var/lib' do
6
+ user 'root'
7
+ end
8
+ directory File.join('/var/lib', Daddy.config.application) do
9
+ user 'root'
10
+ owner ENV['USER']
11
+ group ENV['USER']
12
+ mode '755'
13
+ end
14
+ directory File.join('/var/lib', Daddy.config.application, dad_env) do
15
+ user 'root'
16
+ owner ENV['USER']
17
+ group ENV['USER']
18
+ mode '755'
19
+ end
20
+ when 'test'
21
+ directory File.join('/tmp', Daddy.config.application) do
22
+ user 'root'
23
+ owner ENV['USER']
24
+ group ENV['USER']
25
+ mode '755'
26
+ end
27
+ directory File.join('/tmp', Daddy.config.application, dad_env) do
28
+ user 'root'
29
+ owner ENV['USER']
30
+ group ENV['USER']
31
+ mode '755'
32
+ end
33
+ end
@@ -1,44 +1,10 @@
1
- require 'itamae/resource/remote_file'
2
-
3
- module Itamae
4
- module Resource
5
- class Template
6
-
7
- def find_source_file_with_daddy_convention
8
- begin
9
- ret = find_source_file_without_daddy_convention
10
- rescue SourceNotFoundError => e
11
- if attributes.source == :auto
12
- ret = find_source_file_in_templates
13
- else
14
- raise e
15
- end
16
- end
17
-
18
- ret
19
- end
20
-
21
- def find_source_file_in_templates
22
- itamae_dir = ::File.expand_path('../../../itamae', __FILE__)
23
- path = ::File.join(itamae_dir, source_file_dir, "#{attributes.path}.erb")
24
- if ::File.exist?(path)
25
- path
26
- else
27
- raise SourceNotFoundError, "source file is not found (searched in daddy path: #{path})"
28
- end
29
- end
30
-
31
- alias_method :find_source_file_without_daddy_convention, :find_source_file
32
- alias_method :find_source_file, :find_source_file_with_daddy_convention
33
- end
34
- end
1
+ Dir[File.join(File.dirname(__FILE__), 'itamae', 'ext', '*.rb')].each do |f|
2
+ require f
35
3
  end
36
4
 
37
- require 'i18n'
38
- I18n.available_locales = [:en, :ja]
39
- I18n.default_locale = ENV['LANG'].start_with?('ja_') ? :ja : :en
40
- I18n.load_path += Dir.glob(File.expand_path('../../../itamae/locale/*.yml', __FILE__))
5
+ require_relative 'itamae/config'
6
+ require_relative 'itamae/i18n'
41
7
 
42
- Dir[File.join(File.dirname(__FILE__), 'itamae', '*.rb')].each do |f|
8
+ Dir[File.join(File.dirname(__FILE__), 'itamae', 'env', '*.rb')].each do |f|
43
9
  require f
44
10
  end
@@ -0,0 +1,9 @@
1
+ require 'daddy/utils/config'
2
+
3
+ module Daddy
4
+
5
+ def self.config
6
+ @_config ||= Daddy::Utils::Config.new(File.join('config', 'daddy.yml'))
7
+ end
8
+
9
+ end
@@ -0,0 +1,4 @@
1
+ def dad_env
2
+ ENV['DAD_ENV'] ||= ENV['RAILS_ENV']
3
+ ENV['DAD_ENV'] ||= 'development'
4
+ end
@@ -0,0 +1,3 @@
1
+ def os_version
2
+ ENV['DAD_OS_VERSION'] ||= "#{node[:platform_family]}-#{node[:platform_version]}"
3
+ end
@@ -0,0 +1,35 @@
1
+ require 'itamae/resource/template'
2
+
3
+ module Itamae
4
+ module Resource
5
+ class Template
6
+
7
+ def find_source_file_with_daddy_convention
8
+ begin
9
+ ret = find_source_file_without_daddy_convention
10
+ rescue SourceNotFoundError => e
11
+ if attributes.source == :auto
12
+ ret = find_source_file_in_templates
13
+ else
14
+ raise e
15
+ end
16
+ end
17
+
18
+ ret
19
+ end
20
+
21
+ def find_source_file_in_templates
22
+ itamae_dir = ::File.expand_path('../../../../../itamae', __FILE__)
23
+ path = ::File.join(itamae_dir, source_file_dir, "#{attributes.path}.erb")
24
+ if ::File.exist?(path)
25
+ path
26
+ else
27
+ raise SourceNotFoundError, "source file is not found (searched in daddy path: #{path})"
28
+ end
29
+ end
30
+
31
+ alias_method :find_source_file_without_daddy_convention, :find_source_file
32
+ alias_method :find_source_file, :find_source_file_with_daddy_convention
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,4 @@
1
+ require 'i18n'
2
+ I18n.available_locales = [:en, :ja]
3
+ I18n.default_locale = ENV['LANG'].start_with?('ja_') ? :ja : :en
4
+ I18n.load_path += Dir.glob(File.expand_path('../../../itamae/locale/*.yml', __FILE__))
@@ -1,3 +1,3 @@
1
1
  module Daddy
2
- VERSION = '0.5.11'
2
+ VERSION = '0.5.12'
3
3
  end
@@ -3,15 +3,7 @@ require_relative 'task_helper'
3
3
  namespace :dad do
4
4
 
5
5
  task :app_base_dir do
6
- case Rails.env
7
- when 'production', 'development'
8
- app_base_dir = File.join('/var/lib', Daddy.config.application, Rails.env)
9
- run "sudo mkdir -p #{app_base_dir}",
10
- "sudo chown #{ENV['USER']}:#{ENV['USER']} #{app_base_dir}"
11
- when 'test'
12
- app_base_dir = File.join('/tmp', Daddy.config.application, Rails.env)
13
- run "mkdir -p #{app_base_dir}"
14
- end
6
+ run_itamae 'app_base_dir'
15
7
  end
16
8
 
17
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daddy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.11
4
+ version: 0.5.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - ichy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-28 00:00:00.000000000 Z
11
+ date: 2016-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -247,6 +247,7 @@ files:
247
247
  - app/assets/stylesheets/datepicker.css.scss
248
248
  - app/assets/stylesheets/ympicker.css.scss
249
249
  - bin/dad
250
+ - itamae/cookbooks/app_base_dir.rb
250
251
  - itamae/cookbooks/docker/install.rb
251
252
  - itamae/cookbooks/docker/registry/install.rb
252
253
  - itamae/cookbooks/god/install.rb
@@ -290,7 +291,11 @@ files:
290
291
  - lib/daddy/helpers/html_helper.rb
291
292
  - lib/daddy/http_client.rb
292
293
  - lib/daddy/itamae.rb
293
- - lib/daddy/itamae/os_version.rb
294
+ - lib/daddy/itamae/config.rb
295
+ - lib/daddy/itamae/env/dad_env.rb
296
+ - lib/daddy/itamae/env/os_version.rb
297
+ - lib/daddy/itamae/ext/remote_file.rb
298
+ - lib/daddy/itamae/i18n.rb
294
299
  - lib/daddy/model.rb
295
300
  - lib/daddy/models/crud_extension.rb
296
301
  - lib/daddy/models/query_extension.rb
@@ -1,3 +0,0 @@
1
- def os_version
2
- @_os_version ||= "#{node[:platform_family]}-#{node[:platform_version]}"
3
- end