Module: Dapp::Dapp::Command::Sample::Common
- Included in:
- Dapp::Dapp
- Defined in:
- lib/dapp/dapp/command/sample/common.rb
Instance Method Summary collapse
- #_sample_git_repo ⇒ Object
- #_sample_list ⇒ Object
- #_samples_dir ⇒ Object
- #_samples_git_repo_branch ⇒ Object
- #_samples_git_repo_url ⇒ Object
Instance Method Details
#_sample_git_repo ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/dapp/dapp/command/sample/common.rb', line 29 def _sample_git_repo @sample_repo ||= begin Dimg::GitRepo::Remote.get_or_create( self, git_url_to_name(_samples_git_repo_url), url: _samples_git_repo_url ) end end |
#_sample_list ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/dapp/dapp/command/sample/common.rb', line 6 def _sample_list @sample_list ||= [].tap do |list| tree = begin latest_commit = _sample_git_repo.latest_branch_commit(_samples_git_repo_branch) latest_commit_tree = _sample_git_repo.lookup_commit(latest_commit).tree if _samples_dir == '.' latest_commit_tree else begin oid = latest_commit_tree.path(_samples_dir)[:oid] rescue Rugged::TreeError raise Error::Command, code: :samples_directory_not_exist, data: { url: _samples_git_repo_url, path: _samples_dir } end _sample_git_repo.lookup_object(oid) end end tree.each_tree { |entry| list << entry[:name] } end end |
#_samples_dir ⇒ Object
47 48 49 |
# File 'lib/dapp/dapp/command/sample/common.rb', line 47 def _samples_dir [:samples_dir] end |
#_samples_git_repo_branch ⇒ Object
43 44 45 |
# File 'lib/dapp/dapp/command/sample/common.rb', line 43 def _samples_git_repo_branch [:samples_branch] end |
#_samples_git_repo_url ⇒ Object
39 40 41 |
# File 'lib/dapp/dapp/command/sample/common.rb', line 39 def _samples_git_repo_url [:samples_repo] end |