Class: Lanes::Command::App

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

Instance Attribute Summary collapse

Attributes inherited from NamedCommand

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

Instance Method Summary collapse

Methods inherited from NamedCommand

source_root

Instance Attribute Details

#titleObject (readonly)

Returns the value of attribute title.



9
10
11
# File 'lib/lanes/command/app.rb', line 9

def title
  @title
end

Instance Method Details

#create_client_filesObject



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/lanes/command/app.rb', line 42

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/components/BaseComponent.coffee",   "#{client_dir}/components/Base.coffee"
    template "client/index.js",                "#{client_dir}/index.js"
    template "client/Extension.coffee",        "#{client_dir}/Extension.coffee"
    template "client/styles.scss",             "#{client_dir}/styles.scss"
end

#create_filesObject



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

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 "../coffeelint.json", "coffeelint.json"
    template "../.rubocop.yml", ".rubocop.yml"
    template "config/screens.rb"
    template "config/routes.rb"
    template "config/lanes.rb"
    template "gitignore",".gitignore"

    create_file "log/.gitkeep",""
    create_file "tmp/.gitkeep",""
    create_file "db/.gitkeep", ""

end

#create_screen_baseObject



62
63
64
65
# File 'lib/lanes/command/app.rb', line 62

def create_screen_base
    options = self.options.dup
    template "client/screens/BaseScreen.coffee", "#{client_dir}/screens/Base.coffee"
end

#create_spec_helpersObject



55
56
57
58
59
60
# File 'lib/lanes/command/app.rb', line 55

def create_spec_helpers
    template "spec/client/helpers/ClientHelpers.coffee",
             "#{spec_dir}/helpers/#{namespace}Helpers.coffee"
    template "spec/server/spec_helper.rb",
             "spec/server/spec_helper.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
20
# File 'lib/lanes/command/app.rb', line 16

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