negroku 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0d2ded9cab123deb38c01ae2f4d294151eedc414
4
- data.tar.gz: 1cdf0db2bfa77246c7d83683fc2e687d1ff05677
3
+ metadata.gz: b2fd2852b022401fe5acc6408fade6bb327883c5
4
+ data.tar.gz: 6e4616c4de1abe6c3d923b0ed58c57eb33e59b34
5
5
  SHA512:
6
- metadata.gz: 1e30ac7d5727bf67fede0463a11ab7e66410796fda74a673aca35bfac46ca283d21a7a6a26e2ae532aa74380e246661eac55d1f4a586bf3a71ccaab96546895a
7
- data.tar.gz: 0a062816288f07bb8f6ecbed4aa570ee5bfd1738210b98bad2ed0ae143ad02f0e758702abd5864736356b4172e4f495365806c802fd04c4007476e1823c548d6
6
+ metadata.gz: 858a6ffafd8e7699f3ba58ac7b0703e47556c15f950f76660038dcf57278d217a580fead24b820c97be61ed035bb3c8330c26d8b20c07fb04d5657d36b798c24
7
+ data.tar.gz: ad4bf89c47b8ad96a352fb940ce9d8f6388041cb4ba4703833cd4dfee8b6f33af21b6de1653e9b2a6307bb56cf946ded48abf356ee6bab7fca4c99c265cf299e
data/README.md CHANGED
@@ -1,29 +1,131 @@
1
- # Negroku
1
+ Negroku
2
+ =======
2
3
 
3
- TODO: Write a gem description
4
+ Negroku is an opinionated collection of recipes for capistrano.
4
5
 
5
- ## Installation
6
+ The goal is to be able to deploy **ruby on rails applications** and **static websites** without the hassle of configure and define all the stuff involved in an application deployment.
6
7
 
7
- Add this line to your application's Gemfile:
8
+ All the server configurations pre-defined in the configuration files generated by negroku are targeted oto this generic [configuration guide](https://github.com/platanus/guides/tree/master/deployment).
8
9
 
9
- gem 'negroku'
10
+ Installation
11
+ ------------
10
12
 
11
- And then execute:
13
+ Just install negroku as a global gem.
12
14
 
13
- $ bundle
15
+ gem install negroku
14
16
 
15
- Or install it yourself as:
17
+ ## Getting started
18
+
19
+ 1. Bootpstrapp your app (behind the scene it runs `capify .` plus some customizations)
20
+
21
+ It will add this files to your proyect, this is the same structure that capistrano expect when using multistage extensions
22
+
23
+ ```
24
+ project_root
25
+ |--- Capfile # Capistrano load file
26
+ +--- config
27
+ |--- deploy.rb # Global setting for all environments
28
+ +--- deploy
29
+ |--- production.rb # Specific settings for production server
30
+ +--- staging.rb # Specific settings for staging server
31
+ ```
32
+
33
+ It will also add to your Gemfile two gems
34
+
35
+ ```ruby
36
+ group :assets do
37
+ gem 'therubyracer', :platforms => :ruby
38
+ end
39
+
40
+ group :production do
41
+ gem 'unicron'
42
+ end
43
+ ```
44
+
45
+ 1. Configure your specific settings in the files created above
46
+
47
+ 1. Prepare your server for your application with `cap deploy:setup` task
48
+
49
+ 1. Deploy you application with `cap deploy` task
50
+
51
+ ### Type of applications supported
52
+
53
+ You can bootstrap with negroku two type of applications, ruby on rails applications with native capistrano support and static web sites with specific recipes.
54
+
55
+
56
+ negroku app create <appname>
57
+
58
+ Follow the in-screen instructions and questions.
59
+
60
+ 2.
61
+
62
+ #Static websites
63
+
64
+ The CLI
65
+ -------
66
+
67
+ Negroku also provides a simple CLI that helps to initialize the deployment of your project and that wraps some tasks from its recipes collection.
68
+
69
+ ### App task
70
+
71
+ ### Env task
72
+
73
+ ### Config task
74
+
75
+ Included recipes
76
+ ----------------
77
+
78
+ To achieve this goal negroku provides a set of pre-configured capistrano recipes and deploy configuration files in order to streamline the process to deploy a new application.
79
+
80
+ ### nginx tasks
81
+
82
+ ```
83
+ cap nginx:reload # reload Nginx.
84
+ cap nginx:restart # restart Nginx.
85
+ cap nginx:setup # Setup nginx configuration for this applic...
86
+ cap nginx:start # start Nginx.
87
+ cap nginx:stop # stop Nginx.
88
+ cap nginx:upload_ssl_certificates # Upload SSL certificates for this applicat...
89
+ ```
90
+
91
+ ### unicorn tasks
92
+
93
+ ```
94
+ cap unicorn:add_worker # Add a new worker
95
+ cap unicorn:duplicate # Duplicate Unicorn
96
+ cap unicorn:reload # Reload Unicorn
97
+ cap unicorn:remove_worker # Remove amount of workers
98
+ cap unicorn:restart # Restart Unicorn
99
+ cap unicorn:setup # Setup unicorn configuration for this appl...
100
+ cap unicorn:shutdown # Immediately shutdown Unicorn
101
+ cap unicorn:start # Start Unicorn master process
102
+ cap unicorn:stop # Stop Unicorn
103
+ ```
104
+
105
+ ### logging tasks
106
+
107
+ ```
108
+ cap log:app # Stream (tail) the application's productio...
109
+ cap log:nginx_access # Stream (tail) the nginx access log.
110
+ cap log:nginx_error # Stream (tail) the nginx error log.
111
+ cap log:unicorn_error # Stream (tail) the unicorn error log.
112
+ ```
113
+
114
+ ### rbenv task
115
+
116
+ ```
117
+ cap rbenv:vars:add # Add rbenv vars
118
+ cap rbenv:vars:show # Show current rbenv vars
119
+ cap rbenv:vars:symlink # Symlink rbenv-vars file into the current ...
120
+ ```
121
+
122
+
123
+ Customizing the recipes
124
+ -----------------------
125
+
126
+ Aside of prodefine some ways of doing the deployments, negroku is very flexible. This flexibility is inherit from capistrano where you can extend negroku with your recipes, overide existing ones, and modify every configuration you want.
16
127
 
17
- $ gem install negroku
18
128
 
19
- ## Usage
20
129
 
21
- TODO: Write usage instructions here
22
130
 
23
- ## Contributing
24
131
 
25
- 1. Fork it
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Add some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create new Pull Request
data/bin/negroku CHANGED
@@ -4,6 +4,7 @@ require 'rubygems'
4
4
  require 'capistrano'
5
5
  require 'negroku/config'
6
6
  require 'negroku/helpers'
7
+ require 'negroku/capfile'
7
8
  require 'negroku/cli'
8
9
 
9
- Negroku::CLI.start
10
+ Negroku::CLI.start
@@ -0,0 +1,32 @@
1
+ class Capfile
2
+ attr_accessor :capfile_path
3
+
4
+ def initialize(capfile_path)
5
+ @capfile_path = capfile_path
6
+ end
7
+
8
+ def add(line)
9
+ capfile = File.read(@capfile_path)
10
+ if capfile.include?(line)
11
+ replace = capfile.gsub(/\s*#\s*#{line}\s*/, "\n#{line}\n")
12
+ File.open(@capfile_path, "w") do |cfile|
13
+ cfile.puts replace
14
+ end
15
+ else
16
+ File.open(@capfile_path, "a") do |cfile|
17
+ cfile.puts line
18
+ end
19
+ end
20
+ end
21
+
22
+ def assets()
23
+ self.add('load \'deploy/assets\'')
24
+ end
25
+
26
+ def negroku()
27
+ self.add("\n# Negroku recipies")
28
+ self.add('require "negroku"')
29
+ self.add('load negroku')
30
+ end
31
+
32
+ end
@@ -15,7 +15,6 @@ def init(target=".", data)
15
15
  else
16
16
  puts "[Negroku] => Capifying!"
17
17
  `capify #{target_path}`
18
- `rm `
19
18
  end
20
19
 
21
20
  # Find or create config folder
@@ -61,18 +60,13 @@ def init(target=".", data)
61
60
  f.write ERB.new(erb).result(binding)
62
61
  end
63
62
 
64
- # checks for both require "negroku" and require "negroku/initializer"
65
- unless File.open(File.join('Capfile'), 'r').read.include?('require "negroku"')
66
- puts "[Negroku] => Adding Negroku Loader inside #{capfile}."
67
- File.open(capfile, "a") do |cfile|
68
- cfile << <<-capfile
69
- \n
70
- load 'deploy/assets'
71
- require "negroku"
72
- load negroku
73
- capfile
74
- end
75
- end
63
+ # Prepares the Capfile for negroku
64
+ cfile = Capfile.new(capfile)
65
+ cfile.assets()
66
+ puts "[Negroku] => Enabling assets tasks."
67
+ cfile.negroku()
68
+ puts "[Negroku] => Adding Negroku Loader inside #{capfile}."
69
+
76
70
  end
77
71
 
78
72
  def showConfig()
@@ -1,16 +1,8 @@
1
- # Conventient tasks for remotely tail'ing log files.
2
- # Available logs that can be streamed out of the box:
3
- #
4
- # * production.log (your application's production log)
5
- # * torquebox.log (your torquebox log)
6
- # * <application>-nginx-access.log (the nginx access log specific to <application> only.)
7
- # * <application>-nginx-error.log (the nginx error log specific to <application> only.)
8
-
9
1
  namespace :log do
10
- desc "Stream (tail) the application's production log."
2
+ desc "Stream (tail) the application's log."
11
3
  task :app do
12
4
  trap("INT") { puts 'Exit'; exit 0; }
13
- stream "tail -f '#{shared_path}/log/production.log'"
5
+ stream "tail -f '#{shared_path}/log/#{fetch(:rails_env)}.log'"
14
6
  end
15
7
 
16
8
  desc "Stream (tail) the nginx access log."
@@ -1,3 +1,3 @@
1
1
  module Negroku
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: negroku
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Ignacio Donoso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-24 00:00:00.000000000 Z
11
+ date: 2013-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '>='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.5.13
19
+ version: 2.15.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.5.13
26
+ version: 2.15.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: capistrano-unicorn
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -89,6 +89,7 @@ extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
91
  - bin/negroku
92
+ - lib/negroku/capfile.rb
92
93
  - lib/negroku/cli.rb
93
94
  - lib/negroku/config.rb
94
95
  - lib/negroku/deploy.rb
@@ -130,4 +131,3 @@ signing_key:
130
131
  specification_version: 4
131
132
  summary: '["Capistrano Wrapper"]'
132
133
  test_files: []
133
- has_rdoc: