Class: Rmails::Publisher
- Inherits:
-
Object
- Object
- Rmails::Publisher
- Defined in:
- lib/rmails/publisher.rb
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Publisher
constructor
A new instance of Publisher.
- #run ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Publisher
Returns a new instance of Publisher.
10 11 12 13 |
# File 'lib/rmails/publisher.rb', line 10 def initialize(params={}) @interpreter = ::AutomateIt.new(:project => "system") @interpreter.include_in(self) end |
Instance Method Details
#run ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/rmails/publisher.rb', line 15 def run # prepare pre-install Gemfile @interpreter.render :file => "#{dist}rmails/Gemfile.1", :to => "#{Rails.root}/Gemfile", :backup => false Bundler.with_clean_env do @interpreter.shell_manager.sh("bundle install --without development assets") end # increase version number versions = [] edit :file => "#{Rails.root}/lib/rmails/version.rb", :backup => false do replace /^\s*RELEASE.*$/, " RELEASE = '#{Time.now.strftime('%Y-%m-%d')}'" manipulate do |content| content =~ /^\s*VERSION\s*=\s*['"](.*)['"].*$/ versions = $1.split('.') versions[2] = (versions[2].to_i + 1).to_s content.gsub /^\s*VERSION.*$/, " VERSION = '#{versions.join('.')}'" end end # publish on Rubygems and Github @interpreter.shell_manager.sh("gem build rmails.gemspec") @interpreter.shell_manager.sh("gem push rmails-#{versions.join('.')}.gem") @interpreter.shell_manager.sh("git commit -am 'version increased, rubygem published'") @interpreter.shell_manager.sh("git push") # prepare post-install/devel Gemfile @interpreter.render :file => "#{dist}rmails/Gemfile.2", :to => "#{Rails.root}/Gemfile", :backup => false Bundler.with_clean_env do @interpreter.shell_manager.sh("bundle install") end end |