orats 0.6.4 → 0.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,8 +21,8 @@ end
21
21
 
22
22
  def log_task(message)
23
23
  puts
24
- say_status 'task', "#{method_to_sentence(message.to_s)}:", :yellow
25
- puts '-'*80, ''; sleep 0.25
24
+ say_status 'task', "#{method_to_sentence(message.to_s)}:", :yellow
25
+ puts '-'*80, ''; sleep 0.25
26
26
  end
27
27
 
28
28
  def git_commit(message)
@@ -31,9 +31,9 @@ def git_commit(message)
31
31
  end
32
32
 
33
33
  def git_config(field)
34
- command = "git config --global user.#{field}"
34
+ command = "git config --global user.#{field}"
35
35
  git_field_value = run(command, capture: true).gsub("\n", '')
36
- default_value = "YOUR_#{field.upcase}"
36
+ default_value = "YOUR_#{field.upcase}"
37
37
 
38
38
  git_field_value.to_s.empty? ? default_value : git_field_value
39
39
  end
@@ -59,11 +59,12 @@ end
59
59
  def add_license
60
60
  log_task __method__
61
61
 
62
- author_name = git_config 'name'
62
+ author_name = git_config 'name'
63
63
  author_email = git_config 'email'
64
64
 
65
65
  run 'rm -rf LICENSE'
66
- file 'LICENSE' do <<-S
66
+ file 'LICENSE' do
67
+ <<-S
67
68
  The MIT License (MIT)
68
69
 
69
70
  Copyright (c) #{Time.now.year} #{author_name} <#{author_email}>
@@ -86,7 +87,7 @@ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
86
87
  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
87
88
  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
88
89
  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
89
- S
90
+ S
90
91
  end
91
92
  git_commit 'Add MIT license'
92
93
  end
@@ -94,7 +95,8 @@ end
94
95
  def add_main_playbook
95
96
  log_task __method__
96
97
 
97
- file 'site.yml' do <<-S
98
+ file 'site.yml' do
99
+ <<-S
98
100
  ---
99
101
  - name: ensure all servers are commonly configured
100
102
  hosts: all
@@ -148,7 +150,7 @@ def add_main_playbook
148
150
  - { role: nickjj.pumacorn, tags: [app, rails] }
149
151
  - { role: nickjj.sidekiq, tags: [app, rails] }
150
152
  - { role: nickjj.monit, tags: [app, monit] }
151
- S
153
+ S
152
154
  end
153
155
  git_commit 'Add the main playbook'
154
156
  end
@@ -162,15 +164,15 @@ end
162
164
 
163
165
  def log_complete
164
166
  puts
165
- say_status 'success', "\e[1m\Everything has been setup successfully\e[0m", :cyan
167
+ say_status 'success', "\e[1m\Everything has been setup successfully\e[0m", :cyan
166
168
  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
169
+ say_status 'question', 'Are most of your apps similar?', :yellow
170
+ say_status 'answer', 'You only need to generate one playbook and you just did', :white
171
+ say_status 'answer', 'Use the inventory in each project to customize certain things', :white
170
172
  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
173
+ say_status 'question', 'Are you new to ansible?', :yellow
174
+ say_status 'answer', 'http://docs.ansible.com/intro_getting_started.html', :white
175
+ puts '-'*80
174
176
  end
175
177
 
176
178
  # ---
data/lib/orats/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Orats
2
- VERSION = '0.6.4'
2
+ VERSION = '0.6.5'
3
3
  end
data/orats.gemspec CHANGED
@@ -4,14 +4,14 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'orats/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = 'orats'
8
- spec.version = Orats::VERSION
9
- spec.authors = ['Nick Janetakis']
10
- spec.email = ['nick.janetakis@gmail.com']
11
- spec.summary = %q{Opinionated rails application templates.}
12
- spec.description = %q{A collection of rails application templates using modern versions of Ruby on Rails. Launch new applications and the infrastructure to run them in seconds.}
13
- spec.homepage = 'https://github.com/nickjj/orats'
14
- spec.license = 'MIT'
7
+ spec.name = 'orats'
8
+ spec.version = Orats::VERSION
9
+ spec.authors = ['Nick Janetakis']
10
+ spec.email = ['nick.janetakis@gmail.com']
11
+ spec.summary = %q{Opinionated rails application templates.}
12
+ spec.description = %q{A collection of rails application templates using modern versions of Ruby on Rails. Launch new applications and the infrastructure to run them in seconds.}
13
+ spec.homepage = 'https://github.com/nickjj/orats'
14
+ spec.license = 'MIT'
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
@@ -19,7 +19,7 @@ class TestCLI < Minitest::Test
19
19
  end
20
20
 
21
21
  def test_new_app_with_auth
22
- app_name = generate_app_name
22
+ app_name = generate_app_name
23
23
  gemfile_path = "#{TEST_PATH}/#{app_name}/services/#{app_name}/Gemfile"
24
24
 
25
25
  out, err = capture_subprocess_io do
@@ -58,7 +58,7 @@ class TestCLI < Minitest::Test
58
58
  app_name = generate_app_name
59
59
 
60
60
  out, err = capture_subprocess_io do
61
- orats "play #{app_name}"
61
+ orats "play #{app_name}"
62
62
  end
63
63
 
64
64
  assert_match /success/, out
@@ -91,45 +91,45 @@ class TestCLI < Minitest::Test
91
91
 
92
92
  private
93
93
 
94
- def assert_nuked(app_name, options = {})
95
- out, err = capture_subprocess_io do
96
- orats "nuke #{app_name}", flags: options[:flags], answer: 'y'
97
- end
98
-
99
- assert_match /#{app_name}/, out
100
- system 'rm -rf /tmp/orats'
94
+ def assert_nuked(app_name, options = {})
95
+ out, err = capture_subprocess_io do
96
+ orats "nuke #{app_name}", flags: options[:flags], answer: 'y'
101
97
  end
102
98
 
103
- def assert_server_started
104
- assert port_taken?
105
- end
99
+ assert_match /#{app_name}/, out
100
+ system 'rm -rf /tmp/orats'
101
+ end
106
102
 
107
- def assert_path_exists(file_or_dir)
108
- assert File.exists?(file_or_dir), "Expected path '#{file_or_dir}' to exist"
109
- end
103
+ def assert_server_started
104
+ assert port_taken?
105
+ end
110
106
 
111
- def refute_path_exists(file_or_dir)
112
- refute File.exists?(file_or_dir), "Expected path '#{file_or_dir}' to exist"
113
- end
107
+ def assert_path_exists(file_or_dir)
108
+ assert File.exists?(file_or_dir), "Expected path '#{file_or_dir}' to exist"
109
+ end
114
110
 
115
- def assert_in_file(file_path, regex)
116
- out, err = capture_subprocess_io do
117
- system "cat #{file_path}"
118
- end
111
+ def refute_path_exists(file_or_dir)
112
+ refute File.exists?(file_or_dir), "Expected path '#{file_or_dir}' to exist"
113
+ end
119
114
 
120
- assert_match regex, out
115
+ def assert_in_file(file_path, regex)
116
+ out, err = capture_subprocess_io do
117
+ system "cat #{file_path}"
121
118
  end
122
119
 
123
- def ensure_port_is_free
124
- skip 'Port 3000 is already in use, aborting test' if port_taken?
125
- end
120
+ assert_match regex, out
121
+ end
126
122
 
127
- def kill_server(stdout_text)
128
- pid_lines = stdout_text.scan(/started with pid \d+/)
123
+ def ensure_port_is_free
124
+ skip 'Port 3000 is already in use, aborting test' if port_taken?
125
+ end
129
126
 
130
- puma = pid_lines[0].split(' ').last
131
- sidekiq = pid_lines[1].split(' ').last
127
+ def kill_server(stdout_text)
128
+ pid_lines = stdout_text.scan(/started with pid \d+/)
132
129
 
133
- system "kill -9 #{puma} && kill -9 #{sidekiq}"
134
- end
135
- end
130
+ puma = pid_lines[0].split(' ').last
131
+ sidekiq = pid_lines[1].split(' ').last
132
+
133
+ system "kill -9 #{puma} && kill -9 #{sidekiq}"
134
+ end
135
+ end
data/test/test_helper.rb CHANGED
@@ -1,20 +1,20 @@
1
1
  require 'minitest/autorun'
2
2
  require 'securerandom'
3
- require_relative '../lib/orats/server'
3
+ require_relative '../lib/orats/commands/new/server'
4
4
 
5
5
  module Orats
6
6
  module Test
7
- include Server
7
+ include Commands::New::Server
8
8
 
9
- BINARY_PATH = File.absolute_path('../../bin/orats',__FILE__)
10
- TEST_PATH = '/tmp/orats/test'
9
+ BINARY_PATH = File.absolute_path('../../bin/orats', __FILE__)
10
+ TEST_PATH = '/tmp/orats/test'
11
11
  ORATS_FLAGS = '--pg-password pleasedonthackme --skip-server-start'
12
12
 
13
13
  def orats(command, options = {})
14
- cmd, app_name = command.split(' ')
14
+ cmd, app_name = command.split(' ')
15
15
  prepend_command = ''
16
16
 
17
- command = "#{cmd} #{TEST_PATH}/#{app_name}" if command.include?(' ')
17
+ command = "#{cmd} #{TEST_PATH}/#{app_name}" if command.include?(' ')
18
18
 
19
19
  if options.has_key?(:answer)
20
20
  options[:answer] == 'y' || options[:answer] == 'yes' ? insert_answer = 'yes' : insert_answer = 'echo'
@@ -27,8 +27,8 @@ module Orats
27
27
 
28
28
  private
29
29
 
30
- def generate_app_name
31
- "a_#{SecureRandom.hex(8)}"
32
- end
30
+ def generate_app_name
31
+ "a_#{SecureRandom.hex(8)}"
32
+ end
33
33
  end
34
- end
34
+ end
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
4
+ version: 0.6.5
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 00:00:00.000000000 Z
11
+ date: 2014-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor