Class: Rrm::Repository
- Inherits:
-
Object
- Object
- Rrm::Repository
- Defined in:
- lib/rrm/repository.rb
Constant Summary collapse
- CLONEDIR =
"/tmp/rrm/#{SecureRandom.uuid}/"
Instance Attribute Summary collapse
-
#branch_name ⇒ Object
Returns the value of attribute branch_name.
-
#dockerfile ⇒ Object
Returns the value of attribute dockerfile.
-
#gemfile ⇒ Object
Returns the value of attribute gemfile.
-
#gemfile_lock ⇒ Object
Returns the value of attribute gemfile_lock.
-
#gitlab_ci ⇒ Object
Returns the value of attribute gitlab_ci.
-
#level ⇒ Object
Returns the value of attribute level.
-
#major ⇒ Object
Returns the value of attribute major.
-
#minor ⇒ Object
Returns the value of attribute minor.
-
#name ⇒ Object
Returns the value of attribute name.
-
#patch ⇒ Object
Returns the value of attribute patch.
-
#rubocop ⇒ Object
Returns the value of attribute rubocop.
-
#travis ⇒ Object
Returns the value of attribute travis.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #current_version ⇒ Object
- #git ⇒ Object
-
#initialize(url, level, update_gems) ⇒ Repository
constructor
A new instance of Repository.
- #new_version ⇒ Object
- #push! ⇒ Object
- #update! ⇒ Object
Constructor Details
#initialize(url, level, update_gems) ⇒ Repository
Returns a new instance of Repository.
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rrm/repository.rb', line 13 def initialize(url, level, update_gems) @url = url @name = url.split('/').last.gsub('.git', '') @dockerfile = Rrm::Dockerfile.new(git) @gemfile = Rrm::Gemfile.new(git) @gemfile_lock = Rrm::GemfileLock.new(git, update_gems) @gitlab_ci = Rrm::GitlabCi.new(git) @rubocop = Rrm::Rubocop.new(git) @travis = Rrm::Travis.new(git) @major, @minor, @patch = current_version.split('.') @level = level end |
Instance Attribute Details
#branch_name ⇒ Object
Returns the value of attribute branch_name.
11 12 13 |
# File 'lib/rrm/repository.rb', line 11 def branch_name @branch_name end |
#dockerfile ⇒ Object
Returns the value of attribute dockerfile.
10 11 12 |
# File 'lib/rrm/repository.rb', line 10 def dockerfile @dockerfile end |
#gemfile ⇒ Object
Returns the value of attribute gemfile.
10 11 12 |
# File 'lib/rrm/repository.rb', line 10 def gemfile @gemfile end |
#gemfile_lock ⇒ Object
Returns the value of attribute gemfile_lock.
10 11 12 |
# File 'lib/rrm/repository.rb', line 10 def gemfile_lock @gemfile_lock end |
#gitlab_ci ⇒ Object
Returns the value of attribute gitlab_ci.
10 11 12 |
# File 'lib/rrm/repository.rb', line 10 def gitlab_ci @gitlab_ci end |
#level ⇒ Object
Returns the value of attribute level.
8 9 10 |
# File 'lib/rrm/repository.rb', line 8 def level @level end |
#major ⇒ Object
Returns the value of attribute major.
9 10 11 |
# File 'lib/rrm/repository.rb', line 9 def major @major end |
#minor ⇒ Object
Returns the value of attribute minor.
9 10 11 |
# File 'lib/rrm/repository.rb', line 9 def minor @minor end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/rrm/repository.rb', line 8 def name @name end |
#patch ⇒ Object
Returns the value of attribute patch.
9 10 11 |
# File 'lib/rrm/repository.rb', line 9 def patch @patch end |
#rubocop ⇒ Object
Returns the value of attribute rubocop.
10 11 12 |
# File 'lib/rrm/repository.rb', line 10 def rubocop @rubocop end |
#travis ⇒ Object
Returns the value of attribute travis.
10 11 12 |
# File 'lib/rrm/repository.rb', line 10 def travis @travis end |
#url ⇒ Object
Returns the value of attribute url.
8 9 10 |
# File 'lib/rrm/repository.rb', line 8 def url @url end |
Instance Method Details
#current_version ⇒ Object
30 31 32 |
# File 'lib/rrm/repository.rb', line 30 def current_version @current_version ||= fetch_current_version end |
#git ⇒ Object
26 27 28 |
# File 'lib/rrm/repository.rb', line 26 def git @git ||= clone_or_update_git end |
#new_version ⇒ Object
34 35 36 |
# File 'lib/rrm/repository.rb', line 34 def new_version @new_version ||= decide_new_ruby_version end |
#push! ⇒ Object
51 52 53 |
# File 'lib/rrm/repository.rb', line 51 def push! git.push('origin', @branch_name) end |
#update! ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rrm/repository.rb', line 38 def update! Rrm.logger.debug "Updating #{name} from #{current_version} to #{new_version}" create_branch dockerfile.update!(new_version) gemfile.update!(new_version) gemfile_lock.update!(new_version) gitlab_ci.update!(new_version) rubocop.update!(new_version.split('.')[0..1].join('.')) travis.update!(new_version) rescue Rrm.logger.warn("Failed to update! #{$!.} - #{$!.backtrace}") end |