Class: Weapp::Cli::Page
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Weapp::Cli::Page
- Includes:
- Thor::Actions
- Defined in:
- lib/weapp/cli/page/page.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.source_root ⇒ Object
7 8 9 |
# File 'lib/weapp/cli/page/page.rb', line 7 def self.source_root File.dirname(__FILE__) end |
Instance Method Details
#create_files ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/weapp/cli/page/page.rb', line 11 def create_files base_path = "pages/#{name}/#{name}" @js_path = base_path + ".js" @wxml_path = base_path + ".wxml" @wxss_path = base_path + ".wxss" template('templates/example.js', @js_path) template('templates/example.wxml', @wxml_path) template('templates/example.wxss', @wxss_path) end |
#insert_route ⇒ Object
21 22 23 24 25 26 |
# File 'lib/weapp/cli/page/page.rb', line 21 def insert_route inject_into_file "app.json", after: "\"pages\": [\n" do " \"pages/\#{name}/\#{name}\",\n" end end |