Class: Zync::Generators::AppBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/zync-gen/generators/app.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(generator) ⇒ AppBuilder

Returns a new instance of AppBuilder.



7
8
9
10
# File 'lib/zync-gen/generators/app.rb', line 7

def initialize(generator)
  @generator = generator
  @options   = generator.options
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object (private)



68
69
70
# File 'lib/zync-gen/generators/app.rb', line 68

def method_missing(meth, *args, &block)
  @generator.send(meth, *args, &block)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/zync-gen/generators/app.rb', line 5

def options
  @options
end

Instance Method Details

#appObject



12
13
14
# File 'lib/zync-gen/generators/app.rb', line 12

def app
  directory 'app'
end

#configObject



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/zync-gen/generators/app.rb', line 16

def config
  empty_directory "config"

  inside "config" do
    template "application.rb"
    template "boot.rb"
    template "environment.rb"          
    empty_directory "environments"          
    empty_directory "initializers"                    
    template "routes.rb"
    template 'settings.yml'
  end
end

#configruObject



30
31
32
# File 'lib/zync-gen/generators/app.rb', line 30

def configru
  template "config.ru"
end

#gemfileObject



34
35
36
# File 'lib/zync-gen/generators/app.rb', line 34

def gemfile
  template "Gemfile"
end

#libObject



38
39
40
# File 'lib/zync-gen/generators/app.rb', line 38

def lib
  empty_directory 'lib'
end

#logObject



42
43
44
45
46
47
48
49
50
51
# File 'lib/zync-gen/generators/app.rb', line 42

def log
  empty_directory 'log'

  inside "log" do
    %w( server production development test ).each do |file|
      create_file "#{file}.log"
      chmod "#{file}.log", 0666, :verbose => false
    end
  end
end

#scriptObject



53
54
55
56
# File 'lib/zync-gen/generators/app.rb', line 53

def script
  directory 'script'
  chmod "script", 0755, :verbose => false
end

#tmpObject



58
59
60
# File 'lib/zync-gen/generators/app.rb', line 58

def tmp
  empty_directory 'tmp'
end

#vendorObject



62
63
64
# File 'lib/zync-gen/generators/app.rb', line 62

def vendor
  empty_directory 'vendor'
end