Module: Ferry::DSL::Paths
- Included in:
- Ferry::DSL
- Defined in:
- lib/ferry/dsl/paths.rb
Instance Method Summary collapse
- #asset_timestamp ⇒ Object
- #current_path ⇒ Object
- #deploy_config_path ⇒ Object
- #deploy_path ⇒ Object
- #deploy_to ⇒ Object
- #join_paths(parent, paths) ⇒ Object
- #linked_dir_parents(parent) ⇒ Object
- #linked_dirs(parent) ⇒ Object
- #linked_file_dirs(parent) ⇒ Object
- #linked_files(parent) ⇒ Object
- #map_dirnames(paths) ⇒ Object
- #now ⇒ Object
- #release_path ⇒ Object
- #releases_path ⇒ Object
- #repo_path ⇒ Object
- #repo_url ⇒ Object
- #revision_log ⇒ Object
- #set_release_path(timestamp = now) ⇒ Object
- #shared_path ⇒ Object
- #stage_config_path ⇒ Object
Instance Method Details
#asset_timestamp ⇒ Object
72 73 74 |
# File 'lib/ferry/dsl/paths.rb', line 72 def env..strftime("%Y%m%d%H%M.%S") end |
#current_path ⇒ Object
14 15 16 |
# File 'lib/ferry/dsl/paths.rb', line 14 def current_path deploy_path.join('current') end |
#deploy_config_path ⇒ Object
35 36 37 |
# File 'lib/ferry/dsl/paths.rb', line 35 def deploy_config_path Pathname.new fetch(:deploy_config_path, 'config/deploy.rb') end |
#deploy_path ⇒ Object
10 11 12 |
# File 'lib/ferry/dsl/paths.rb', line 10 def deploy_path Pathname.new(deploy_to) end |
#deploy_to ⇒ Object
6 7 8 |
# File 'lib/ferry/dsl/paths.rb', line 6 def deploy_to fetch(:deploy_to) end |
#join_paths(parent, paths) ⇒ Object
94 95 96 |
# File 'lib/ferry/dsl/paths.rb', line 94 def join_paths(parent, paths) paths.map { |path| parent.join(path) } end |
#linked_dir_parents(parent) ⇒ Object
90 91 92 |
# File 'lib/ferry/dsl/paths.rb', line 90 def linked_dir_parents(parent) map_dirnames(linked_dirs(parent)) end |
#linked_dirs(parent) ⇒ Object
76 77 78 79 |
# File 'lib/ferry/dsl/paths.rb', line 76 def linked_dirs(parent) paths = fetch(:linked_dirs) join_paths(parent, paths) end |
#linked_file_dirs(parent) ⇒ Object
86 87 88 |
# File 'lib/ferry/dsl/paths.rb', line 86 def linked_file_dirs(parent) map_dirnames(linked_files(parent)) end |
#linked_files(parent) ⇒ Object
81 82 83 84 |
# File 'lib/ferry/dsl/paths.rb', line 81 def linked_files(parent) paths = fetch(:linked_files) join_paths(parent, paths) end |
#map_dirnames(paths) ⇒ Object
98 99 100 |
# File 'lib/ferry/dsl/paths.rb', line 98 def map_dirnames(paths) paths.map { |path| path.dirname } end |
#now ⇒ Object
68 69 70 |
# File 'lib/ferry/dsl/paths.rb', line 68 def now env..strftime("%Y%m%d%H%M%S") end |
#release_path ⇒ Object
22 23 24 |
# File 'lib/ferry/dsl/paths.rb', line 22 def release_path fetch(:release_path, current_path) end |
#releases_path ⇒ Object
18 19 20 |
# File 'lib/ferry/dsl/paths.rb', line 18 def releases_path deploy_path.join('releases') end |
#repo_path ⇒ Object
56 57 58 |
# File 'lib/ferry/dsl/paths.rb', line 56 def repo_path Pathname.new(fetch(:repo_path, ->(){deploy_path.join('repo')})) end |
#repo_url ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/ferry/dsl/paths.rb', line 39 def repo_url require 'cgi' require 'uri' if fetch(:git_http_username) and fetch(:git_http_password) URI.parse(fetch(:repo_url)).tap do |repo_uri| repo_uri.user = fetch(:git_http_username) repo_uri.password = CGI.escape(fetch(:git_http_password)) end.to_s elsif fetch(:git_http_username) URI.parse(fetch(:repo_url)).tap do |repo_uri| repo_uri.user = fetch(:git_http_username) end.to_s else fetch(:repo_url) end end |
#revision_log ⇒ Object
64 65 66 |
# File 'lib/ferry/dsl/paths.rb', line 64 def revision_log deploy_path.join('revisions.log') end |
#set_release_path(timestamp = now) ⇒ Object
26 27 28 29 |
# File 'lib/ferry/dsl/paths.rb', line 26 def set_release_path(=now) set(:release_timestamp, ) set(:release_path, releases_path.join()) end |
#shared_path ⇒ Object
60 61 62 |
# File 'lib/ferry/dsl/paths.rb', line 60 def shared_path deploy_path.join('shared') end |
#stage_config_path ⇒ Object
31 32 33 |
# File 'lib/ferry/dsl/paths.rb', line 31 def stage_config_path Pathname.new fetch(:stage_config_path, 'config/deploy') end |