Top Level Namespace
Defined Under Namespace
Modules: JobSpec
Instance Method Summary collapse
- #path_glob(dir) ⇒ Object
- #path_relative_to_pwd(path) ⇒ Object
- #role_files(dir) ⇒ Object
- #safe_role_name(role) ⇒ Object
- #safe_role_out_path(role) ⇒ Object
Instance Method Details
#path_glob(dir) ⇒ Object
37 38 39 |
# File 'lib/job_spec/cli.rb', line 37 def path_glob(dir) path_relative_to_pwd(File.join(dir, '**/*.rb')) end |
#path_relative_to_pwd(path) ⇒ Object
33 34 35 |
# File 'lib/job_spec/cli.rb', line 33 def path_relative_to_pwd(path) File.(path, Dir.pwd) end |
#role_files(dir) ⇒ Object
41 42 43 |
# File 'lib/job_spec/cli.rb', line 41 def role_files(dir) Dir[path_glob(dir)] end |
#safe_role_name(role) ⇒ Object
45 46 47 |
# File 'lib/job_spec/cli.rb', line 45 def safe_role_name(role) "#{role.name.downcase.gsub(' ', '_').gsub(/[^a-z_]+/, '')}.md" end |
#safe_role_out_path(role) ⇒ Object
49 50 51 |
# File 'lib/job_spec/cli.rb', line 49 def safe_role_out_path(role) File.join(path_relative_to_pwd([:out]), safe_role_name(role)) end |