Class: Maguro::Features

Inherits:
Object
  • Object
show all
Defined in:
lib/maguro/features.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(builder) ⇒ Features

Returns a new instance of Features.



6
7
8
9
10
11
12
# File 'lib/maguro/features.rb', line 6

def initialize(builder)
  @builder = builder
  @app_name = builder.send(:app_name)
  @organization = builder.options[:organization]
  @gemfile = Maguro::Gemfile.new(builder)
  @heroku = Maguro::Heroku.new(builder, app_name, builder.options[:organization])
end

Instance Attribute Details

#app_nameObject (readonly)

Returns the value of attribute app_name.



4
5
6
# File 'lib/maguro/features.rb', line 4

def app_name
  @app_name
end

#builderObject (readonly)

Returns the value of attribute builder.



4
5
6
# File 'lib/maguro/features.rb', line 4

def builder
  @builder
end

#gemfileObject (readonly)

Returns the value of attribute gemfile.



4
5
6
# File 'lib/maguro/features.rb', line 4

def gemfile
  @gemfile
end

#herokuObject (readonly)

Returns the value of attribute heroku.



4
5
6
# File 'lib/maguro/features.rb', line 4

def heroku
  @heroku
end

#organizationObject (readonly)

Returns the value of attribute organization.



4
5
6
# File 'lib/maguro/features.rb', line 4

def organization
  @organization
end

Instance Method Details

#run_all_updatesObject



14
15
16
17
18
19
20
21
22
23
24
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/maguro/features.rb', line 14

def run_all_updates

  # TODO: Doug: check return value of commands? What happens if commands fail?
  # When git commands failed, the error is reported to the console, but the generator
  # completes successfully
  builder.git :init
  update_gitignore
  commit 'Initial commit with updated .gitignore'

  create_rvm_files
  clean_gemfile
  use_pg
  use_12_factor_gem
  add_test_gems
  add_ruby_version
  commit 'add gems'

  remove_turbo_links
  commit 'remove turbolinks'

  create_database_files
  commit 'add database.sample.yml and database.yml files'
  create_readme
  commit 'add readme'
  create_app_env_var_sample
  commit 'add app environment variable sample file'

  install_rspec
  commit 'install rspec'

  create_spec_folders
  update_rails_helper_spec
  commit 'customize rspec for basic usage'

  add_homepage
  commit 'add homepage'

  springify
  commit 'springify app'

  setup_guard
  commit 'add guard files'

  create_local_database
  commit 'add blank schema file'

  checkout_develop_branch

  # NOTE: Heroku setup has to come after initial init for it to create the proper
  # Git remotes.
  if builder.options[:heroku]
    heroku.create
    heroku.push
  end

  if builder.options[:bitbucket]
    git_url = setup_bitbucket

    if !git_url.nil?
      builder.git remote: "add origin #{git_url}"
      builder.git push: "-u origin --all"
    end
  end

  if builder.options[:github]
    setup_github
    builder.git push: '-u origin --all'
  end
end