class Weapp::Cli::Page

Public Class Methods

source_root() click to toggle source
# File lib/weapp/cli/page/page.rb, line 7
def self.source_root
  File.dirname(__FILE__)
end

Public Instance Methods

create_files() click to toggle source
# 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() click to toggle source
# File lib/weapp/cli/page/page.rb, line 21
      def insert_route
        inject_into_file "app.json", after: "\"pages\": [\n" do <<-EOF
    "pages/#{name}/#{name}",
EOF
        end
      end