Class: CenitCmd::Collection

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/cenit_cmd/collection.rb

Instance Method Summary collapse

Instance Method Details

#final_bannerObject



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/cenit_cmd/collection.rb', line 59

def final_banner
  return unless @generated
  say %Q{
    #{'*' * 80}
    
    Consider the next steps:
    
    Move to the new collection folder.
    $ cd #{file_name}
    
    Create a new git and related GitHub's repository
    $ rake create_repo
    
    Commit and push until you are happy with your changes
    ...
    
    Generate a version
    $ rake version:write
    
    Tag and push release to git
    $ rake git:release
    
    Shared your collection in https://rubygems.org
    $ rake release
    
    Visit README.md for more details.

    #{'*' * 80}
  }
end

#generateObject



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
# File 'lib/cenit_cmd/collection.rb', line 22

def generate
  @collection_name = @file_name
  
  use_prefix 'cenit-collection-'
  
  @user_name = options[:user_name] || git_config['user.name']
  @user_email = options[:user_email] || git_config['user.email']
  @github_username = options[:github_username] || git_config['github.user']
  @summary = options[:summary] || "Shared Collection #{@file_name} to be use in Cenit"
  @description = options[:description] || @summary
  @homepage = options[:homepage] || "https://github.com/#{@github_username}/#{@file_name}"
  
  return unless validate_argument

  empty_directory file_name
  
  directory 'lib', "#{file_name}/lib"
  empty_directory  "#{file_name}/lib/cenit/collection/#{collection_name}/connections"
  empty_directory  "#{file_name}/lib/cenit/collection/#{collection_name}/webhooks"
  empty_directory  "#{file_name}/lib/cenit/collection/#{collection_name}/connection_roles"
  empty_directory  "#{file_name}/lib/cenit/collection/#{collection_name}/events"
  empty_directory  "#{file_name}/lib/cenit/collection/#{collection_name}/flows"
  empty_directory  "#{file_name}/lib/cenit/collection/#{collection_name}/translators"

  empty_directory "#{file_name}/spec/support"
  empty_directory "#{file_name}/spec/support/sample"

  template 'Gemfile', "#{file_name}/Gemfile"
  template 'gitignore', "#{file_name}/.gitignore"
  template 'LICENSE', "#{file_name}/LICENSE"
  template 'Rakefile', "#{file_name}/Rakefile"
  template 'README.md', "#{file_name}/README.md"
  template 'rspec', "#{file_name}/.rspec"
  template 'spec/spec_helper.rb.tt', "#{file_name}/spec/spec_helper.rb"
  @generated = true
end