Class: ChromeExtensionScaffold::Generators::Scaffold

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/chrome_extension_scaffold.rb

Instance Method Summary collapse

Instance Method Details

#create_rootObject



17
18
19
20
# File 'lib/chrome_extension_scaffold.rb', line 17

def create_root
  empty_directory name
  self.destination_root = name
end

#install_background_htmlObject



30
31
32
33
34
35
36
# File 'lib/chrome_extension_scaffold.rb', line 30

def install_background_html
  if haml?
    template "background.html.haml"
  else
    template "background.html"
  end
end

#install_background_jsObject



38
39
40
# File 'lib/chrome_extension_scaffold.rb', line 38

def install_background_js
  template "background.js#{".coffee" if coffee?}"
end

#install_content_jsObject



42
43
44
# File 'lib/chrome_extension_scaffold.rb', line 42

def install_content_js
  template "content.js#{".coffee" if coffee?}"
end

#install_jqueryObject



26
27
28
# File 'lib/chrome_extension_scaffold.rb', line 26

def install_jquery
  copy_file "jquery.js" if jquery?
end

#install_manifestObject



22
23
24
# File 'lib/chrome_extension_scaffold.rb', line 22

def install_manifest
  template "manifest.json"
end

#install_watcherObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/chrome_extension_scaffold.rb', line 46

def install_watcher
  if watcher?
    template "Gemfile"
    inside do
      if defined? Bundler
        Bundler.with_clean_env do
          run "bundle install"
        end
      else
        run "bundle install"
      end
    end
    template "watcher"
    chmod "watcher", 0755
  end
end