Class: Bowdler::Rake
- Inherits:
-
Object
- Object
- Bowdler::Rake
- Defined in:
- lib/bowdler/rake.rb
Constant Summary collapse
- DEPENDENCY_FILES =
%w{Bowerfile}.freeze
Instance Method Summary collapse
- #command ⇒ Object
- #dependency_file ⇒ Object
-
#initialize(options) ⇒ Rake
constructor
A new instance of Rake.
- #perform ⇒ Object
- #perform_simple_dsl(file) ⇒ Object
- #update? ⇒ Boolean
Constructor Details
#initialize(options) ⇒ Rake
Returns a new instance of Rake.
8 9 10 |
# File 'lib/bowdler/rake.rb', line 8 def initialize() @options = end |
Instance Method Details
#command ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/bowdler/rake.rb', line 39 def command if update? 'bower update' else 'bower install' end end |
#dependency_file ⇒ Object
12 13 14 15 |
# File 'lib/bowdler/rake.rb', line 12 def dependency_file entries = Dir.entries(Dir.pwd) DEPENDENCY_FILES.detect { |file| entries.include?(file) } end |
#perform ⇒ Object
17 18 19 20 21 |
# File 'lib/bowdler/rake.rb', line 17 def perform case dependency_file when 'Bowerfile' then perform_simple_dsl('Bowerfile') end end |
#perform_simple_dsl(file) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/bowdler/rake.rb', line 23 def perform_simple_dsl(file) dsl = Bowdler::SimpleDsl.evalute(file) dsl.write_bower_json dsl.write_dotbowerrc system(command) system('bower list') dsl.delete_bower_json end |
#update? ⇒ Boolean
35 36 37 |
# File 'lib/bowdler/rake.rb', line 35 def update? @options['update'] end |