Class: Lanes::Command::App

Inherits:
NamedCommand show all
Defined in:
lib/lanes/command/app.rb

Instance Attribute Summary

Attributes inherited from NamedCommand

#class_name, #client_dir, #identifier, #namespace, #spec_dir

Instance Method Summary collapse

Methods inherited from NamedCommand

source_root

Instance Method Details

#create_client_filesObject



38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/lanes/command/app.rb', line 38

def create_client_files
    self.class.source_root.join('client').children.each do | path |
        next unless path.directory?
        empty_directory "#{client_dir}/#{path.basename}"
        create_file "#{client_dir}/#{path.basename}/.gitkeep"
    end
    template "client/models/BaseModel.coffee", "#{client_dir}/models/Base.coffee"
    template "client/views/BaseView.coffee",   "#{client_dir}/views/Base.coffee"
    template "client/index.js",                "#{client_dir}/index.js"
    template "client/Extension.coffee",        "#{client_dir}/Extension.coffee"
    template "client/Router.coffee",           "#{client_dir}/Router.coffee"
    template "client/styles.scss",             "#{client_dir}/styles.scss"
end

#create_filesObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/lanes/command/app.rb', line 21

def create_files
    ["Gemfile", "Rakefile", "Guardfile", "config.ru", "config/database.yml"].each do | file |                    template file
    end
    template "lib/namespace.rb", "lib/#{identifier}.rb"
    template "lib/namespace/version.rb", "lib/#{identifier}/version.rb"
    template "lib/namespace/extension.rb", "lib/#{identifier}/extension.rb"
    template "lib/namespace/base_model.rb", "lib/#{identifier}/model.rb"
    template "config/routes.rb"
    template "config/lanes.rb"
    template "gitignore",".gitignore"
    create_file "lib/#{identifier}/models/empty.rb",""
    create_file "log/.gitkeep",""
    create_file "tmp/.gitkeep",""
    create_file "db/.gitkeep", ""
    create_file "config/screens.rb"
end

#create_first_screenObject



59
60
61
62
63
64
65
66
67
68
# File 'lib/lanes/command/app.rb', line 59

def create_first_screen
    options = self.options.dup
    @class_name = "Base"
    @template = "<div><h1>Base Screen</h1></div>"
    options[:description] = "Base Screen for #{namespace.titleize}"
    options[:fileless] = true
    template "client/screens/Base.coffee", "#{client_dir}/screens/Base.coffee"
    template "spec/client/Screen.coffee",    "#{spec_dir}/screens/Base.coffee"
    create_file "config/screens.rb", ""
end

#create_spec_helpersObject



52
53
54
55
56
57
# File 'lib/lanes/command/app.rb', line 52

def create_spec_helpers
    template "spec/client/helpers/ClientHelpers.coffee",
             "#{spec_dir}/helpers/#{namespace}Helpers.coffee"
    template "spec/server/spec_helpers.rb",
             "spec/server/spec_helpers.rb"
end

#load_namespaceObject

override



11
12
13
14
# File 'lib/lanes/command/app.rb', line 11

def load_namespace # override
    @namespace  = name.underscore.camelize
    @identifier = @namespace.underscore.dasherize
end

#set_variablesObject



16
17
18
19
# File 'lib/lanes/command/app.rb', line 16

def set_variables
    super
    self.destination_root = options[:directory] || name
end