Class: Lanes::Command::App
- Inherits:
-
NamedCommand
- Object
- Thor::Group
- NamedCommand
- Lanes::Command::App
- Defined in:
- lib/lanes/command/app.rb
Instance Attribute Summary collapse
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Attributes inherited from NamedCommand
#class_name, #client_dir, #identifier, #namespace, #spec_dir
Instance Method Summary collapse
- #create_client_files ⇒ Object
- #create_files ⇒ Object
- #knitterize ⇒ Object
-
#load_namespace ⇒ Object
override.
- #set_variables ⇒ Object
Methods inherited from NamedCommand
Instance Attribute Details
#title ⇒ Object (readonly)
Returns the value of attribute title.
12 13 14 |
# File 'lib/lanes/command/app.rb', line 12 def title @title end |
Instance Method Details
#create_client_files ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/lanes/command/app.rb', line 51 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/base.js", "#{client_dir}/models/base.js" template "client/index.js", "#{client_dir}/index.js" template "client/extension.js", "#{client_dir}/extension.js" template "client/styles.scss", "#{client_dir}/styles.scss" end |
#create_files ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/lanes/command/app.rb', line 25 def create_files [ "Gemfile", "Rakefile", "Guardfile", "config.ru", ".babelrc", "config/database.yml" ].each{ |f| template(f) } [ ".eslintrc.js", ".rubocop.yml" ].each{ |f| template("../#{f}", f) } 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/screens.rb" template "config/routes.rb" template "config/webpack.config.js" template "config/jest.config.json" template "config/jest/babel-transform.js" template "config/lanes.rb" template "gitignore",".gitignore" template "spec/client/setup.js" template "spec/server/spec_helper.rb" create_file "log/.gitkeep","" create_file "tmp/.gitkeep","" create_file "db/.gitkeep", "" end |
#knitterize ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/lanes/command/app.rb', line 64 def knitterize say 'Installing node modules', :green yarn = Knitter::Yarn.new(self.destination_root) yarn.init [ 'jest', 'lanes-framework', 'react-router', 'webpack-dev-server' ].each do | package_name | say(sprintf(' %-20s', package_name + '…'), nil, false) package = Knitter::Package.new(package_name, yarn: yarn) package.add say 'done', :green end end |
#load_namespace ⇒ Object
override
14 15 16 17 |
# File 'lib/lanes/command/app.rb', line 14 def load_namespace # override @namespace = name.underscore.camelize @identifier = @namespace.underscore.dasherize end |
#set_variables ⇒ Object
19 20 21 22 23 |
# File 'lib/lanes/command/app.rb', line 19 def set_variables super @title = [:title] || @namespace self.destination_root = [:directory] || name end |