orats 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +267 -216
- data/lib/orats/commands/common.rb +39 -0
- data/lib/orats/commands/new/ansible.rb +9 -9
- data/lib/orats/commands/new/exec.rb +3 -0
- data/lib/orats/commands/new/rails.rb +109 -39
- data/lib/orats/commands/nuke.rb +3 -3
- data/lib/orats/commands/outdated/compare.rb +4 -4
- data/lib/orats/commands/play.rb +2 -15
- data/lib/orats/commands/ui.rb +2 -2
- data/lib/orats/templates/auth.rb +350 -378
- data/lib/orats/templates/base.rb +371 -470
- data/lib/orats/templates/includes/Gemfile +6 -7
- data/lib/orats/templates/play.rb +82 -72
- data/lib/orats/version.rb +1 -1
- metadata +2 -2
@@ -4,6 +4,7 @@ gem 'rails', '~> 4.1.1'
|
|
4
4
|
gem 'turbolinks', '~> 2.2.2'
|
5
5
|
gem 'jquery-rails', '~> 3.1.0'
|
6
6
|
gem 'jquery-turbolinks', '~> 2.0.2'
|
7
|
+
|
7
8
|
gem 'bootstrap-sass', '~> 3.1.1'
|
8
9
|
gem 'font-awesome-rails', '~> 4.1.0'
|
9
10
|
|
@@ -13,16 +14,19 @@ gem 'redis-rails', '~> 4.0.0'
|
|
13
14
|
gem 'puma', '~> 2.8.2'
|
14
15
|
gem 'sidekiq', '~> 3.1.2'
|
15
16
|
gem 'sinatra', '>= 1.4.5', require: false
|
17
|
+
|
16
18
|
#gem 'jbuilder'
|
17
19
|
|
18
|
-
gem '
|
20
|
+
gem 'whenever', '~> 0.9.2', require: false
|
21
|
+
gem 'backup', '~> 4.0.1', require: false
|
19
22
|
|
20
23
|
gem 'sitemap_generator', '~> 5.0.2'
|
21
24
|
gem 'favicon_maker', '~> 1.3'
|
25
|
+
gem 'kaminari', '~> 0.16.0'
|
22
26
|
|
23
27
|
group :development do
|
24
|
-
gem 'spring', '~> 1.1.2'
|
25
28
|
gem 'foreman', require: false
|
29
|
+
gem 'spring', '~> 1.1.2'
|
26
30
|
gem 'rack-mini-profiler', '~> 0.9.1'
|
27
31
|
gem 'bullet', '~> 4.10.0'
|
28
32
|
gem 'meta_request', '~> 0.3.0'
|
@@ -33,11 +37,6 @@ group :development, :test do
|
|
33
37
|
gem 'dotenv-rails', '~> 0.11.1'
|
34
38
|
end
|
35
39
|
|
36
|
-
group :staging, :production do
|
37
|
-
gem 'whenever', '~> 0.9.2', require: false
|
38
|
-
gem 'backup', '~> 4.0.1', require: false
|
39
|
-
end
|
40
|
-
|
41
40
|
group :assets do
|
42
41
|
gem 'sass-rails', '~> 4.0.1'
|
43
42
|
gem 'coffee-rails', '~> 4.0.1'
|
data/lib/orats/templates/play.rb
CHANGED
@@ -1,15 +1,35 @@
|
|
1
|
-
# =====================================================================================================
|
2
|
-
# Template for generating an ansible playbook
|
3
|
-
# =====================================================================================================
|
4
|
-
|
5
|
-
# ----- Helper functions and variables ----------------------------------------------------------------
|
6
|
-
|
7
1
|
require 'securerandom'
|
8
2
|
|
3
|
+
# =============================================================================
|
4
|
+
# template for generating an orats ansible playbook for ansible 1.6.x
|
5
|
+
# =============================================================================
|
6
|
+
# view the task list at the bottom of the file
|
7
|
+
# -----------------------------------------------------------------------------
|
8
|
+
|
9
|
+
# -----------------------------------------------------------------------------
|
10
|
+
# private functions
|
11
|
+
# -----------------------------------------------------------------------------
|
9
12
|
def generate_token
|
10
13
|
SecureRandom.hex(64)
|
11
14
|
end
|
12
15
|
|
16
|
+
def method_to_sentence(method)
|
17
|
+
method.tr!('_', ' ')
|
18
|
+
method[0] = method[0].upcase
|
19
|
+
method
|
20
|
+
end
|
21
|
+
|
22
|
+
def log_task(message)
|
23
|
+
puts
|
24
|
+
say_status 'task', "#{method_to_sentence(message.to_s)}:", :yellow
|
25
|
+
puts '-'*80, ''; sleep 0.25
|
26
|
+
end
|
27
|
+
|
28
|
+
def git_commit(message)
|
29
|
+
git add: '-A'
|
30
|
+
git commit: "-m '#{message}'"
|
31
|
+
end
|
32
|
+
|
13
33
|
def git_config(field)
|
14
34
|
command = "git config --global user.#{field}"
|
15
35
|
git_field_value = run(command, capture: true).gsub("\n", '')
|
@@ -18,53 +38,32 @@ def git_config(field)
|
|
18
38
|
git_field_value.to_s.empty? ? default_value : git_field_value
|
19
39
|
end
|
20
40
|
|
21
|
-
|
22
|
-
author_email = git_config 'email'
|
23
|
-
|
24
|
-
# ----- Nuke all of the rails code --------------------------------------------------------------------
|
25
|
-
|
26
|
-
puts
|
27
|
-
say_status 'shell', 'Removing all of the generated rails code...', :yellow
|
28
|
-
puts '-'*80, ''; sleep 0.25
|
29
|
-
|
30
|
-
run 'rm -rf * .git .gitignore'
|
31
|
-
|
32
|
-
# ----- Create playbook -------------------------------------------------------------------------------
|
33
|
-
|
34
|
-
puts
|
35
|
-
say_status 'init', 'Creating playbook...', :yellow
|
36
|
-
puts '-'*80, ''; sleep 0.25
|
41
|
+
# ---
|
37
42
|
|
38
|
-
|
43
|
+
def delete_generated_rails_code
|
44
|
+
log_task __method__
|
39
45
|
|
40
|
-
|
41
|
-
|
42
|
-
puts
|
43
|
-
say_status 'shell', 'Moving playbook back one directory...', :yellow
|
44
|
-
puts '-'*80, ''; sleep 0.25
|
45
|
-
|
46
|
-
run "mv #{app_name}/* ."
|
47
|
-
run "rm -rf #{app_name}"
|
48
|
-
|
49
|
-
# ----- Create the git repo ---------------------------------------------------------------------------
|
50
|
-
|
51
|
-
puts
|
52
|
-
say_status 'git', 'Creating initial commit...', :yellow
|
53
|
-
puts '-'*80, ''; sleep 0.25
|
46
|
+
run 'rm -rf * .git .gitignore'
|
47
|
+
end
|
54
48
|
|
55
|
-
|
56
|
-
|
57
|
-
git commit: "-m 'Initial commit'"
|
49
|
+
def add_playbook_directory
|
50
|
+
log_task __method__
|
58
51
|
|
59
|
-
|
52
|
+
run "mkdir -p #{app_name}"
|
53
|
+
run "mv #{app_name}/* ."
|
54
|
+
run "rm -rf #{app_name}"
|
55
|
+
git :init
|
56
|
+
git_commit 'Initial commit'
|
57
|
+
end
|
60
58
|
|
61
|
-
|
62
|
-
|
63
|
-
puts '-'*80, ''; sleep 0.25
|
59
|
+
def add_license
|
60
|
+
log_task __method__
|
64
61
|
|
65
|
-
|
62
|
+
author_name = git_config 'name'
|
63
|
+
author_email = git_config 'email'
|
66
64
|
|
67
|
-
|
65
|
+
run 'rm -rf LICENSE'
|
66
|
+
file 'LICENSE' do <<-S
|
68
67
|
The MIT License (MIT)
|
69
68
|
|
70
69
|
Copyright (c) #{Time.now.year} #{author_name} <#{author_email}>
|
@@ -87,19 +86,15 @@ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
87
86
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
88
87
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
89
88
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
90
|
-
|
89
|
+
S
|
90
|
+
end
|
91
|
+
git_commit 'Add MIT license'
|
91
92
|
end
|
92
93
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
# ----- Create the site file --------------------------------------------------------------------------
|
94
|
+
def add_main_playbook
|
95
|
+
log_task __method__
|
97
96
|
|
98
|
-
|
99
|
-
say_status 'root', 'Creating the site yaml file', :yellow
|
100
|
-
puts '-'*80, ''; sleep 0.25
|
101
|
-
|
102
|
-
file 'site.yml' do <<-TEXT
|
97
|
+
file 'site.yml' do <<-S
|
103
98
|
---
|
104
99
|
- name: ensure all servers are commonly configured
|
105
100
|
hosts: all
|
@@ -153,21 +148,36 @@ file 'site.yml' do <<-TEXT
|
|
153
148
|
- { role: nickjj.pumacorn, tags: [app, rails] }
|
154
149
|
- { role: nickjj.sidekiq, tags: [app, rails] }
|
155
150
|
- { role: nickjj.monit, tags: [app, monit] }
|
156
|
-
|
151
|
+
S
|
152
|
+
end
|
153
|
+
git_commit 'Add the main playbook'
|
154
|
+
end
|
155
|
+
|
156
|
+
def remove_unused_files_from_git
|
157
|
+
log_task __method__
|
158
|
+
|
159
|
+
git add: '-u'
|
160
|
+
git_commit 'Remove unused files'
|
157
161
|
end
|
158
162
|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
say_status '
|
166
|
-
puts
|
167
|
-
say_status 'question', 'Are
|
168
|
-
say_status 'answer', '
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
163
|
+
def log_complete
|
164
|
+
puts
|
165
|
+
say_status 'success', "\e[1m\Everything has been setup successfully\e[0m", :cyan
|
166
|
+
puts
|
167
|
+
say_status 'question', 'Are most of your apps similar?', :yellow
|
168
|
+
say_status 'answer', 'You only need to generate one playbook and you just did', :white
|
169
|
+
say_status 'answer', 'Use the inventory in each project to customize certain things', :white
|
170
|
+
puts
|
171
|
+
say_status 'question', 'Are you new to ansible?', :yellow
|
172
|
+
say_status 'answer', 'http://docs.ansible.com/intro_getting_started.html', :white
|
173
|
+
puts '-'*80
|
174
|
+
end
|
175
|
+
|
176
|
+
# ---
|
177
|
+
|
178
|
+
delete_generated_rails_code
|
179
|
+
add_playbook_directory
|
180
|
+
add_license
|
181
|
+
add_main_playbook
|
182
|
+
remove_unused_files_from_git
|
183
|
+
log_complete
|
data/lib/orats/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Janetakis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|