Class: AppUp::Hooks::RailsUp
- Defined in:
- lib/app_up/hooks/rails_up.rb
Constant Summary collapse
- BUNDLE_COMMAND =
"bundle --local || bundle"
Instance Attribute Summary
Attributes inherited from Hook
Instance Method Summary collapse
-
#initialize(*args) ⇒ RailsUp
constructor
A new instance of RailsUp.
- #run ⇒ Object
Methods inherited from Hook
Constructor Details
#initialize(*args) ⇒ RailsUp
Returns a new instance of RailsUp.
8 9 10 11 |
# File 'lib/app_up/hooks/rails_up.rb', line 8 def initialize(*args) @commands = {} super(*args) end |
Instance Method Details
#run ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/app_up/hooks/rails_up.rb', line 13 def run shell.notify( "Running RailsUp\n----------") files.each do |file| exploded_path = Utils::Path.split(file) # allow rebundle on only Gemfile edit, in case you're # upping a gem, which probably doesn't have the Gemfile.lock # checked in if exploded_path.last.match(/Gemfile(\.lock)?|gemspec$/) add_command(:bundle, dir: exploded_path[0..-2]) end if exploded_path.include?("migrate") last_db_index = exploded_path.rindex("db") add_command(:migrate, dir: exploded_path[0...last_db_index]) end end enqueue_commands end |