rsm 0.1 → 0.1.1

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.
data/CHANGES.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 0.1.1 / September 04, 2011
2
+
3
+ * Added `rsm:bundle:install` and `rsm:bundle:update` tasks
4
+ * Added `--verbose` [`-V`] option
5
+ * Default destionation root is application root
6
+
1
7
  # 0.1 / September 03, 2011
2
8
 
3
9
  * Added support of auth_basic in Nginx config
data/README.md CHANGED
@@ -13,6 +13,7 @@ This version can:
13
13
  * clone from Git repo or download and unpack Rails application from TGZ or TBZ2 archive
14
14
  * generate Unicorn config from template
15
15
  * start and stop unicorn server
16
+ * run bundle install and update
16
17
 
17
18
  Homepage
18
19
  --------
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1
1
+ 0.1.1
data/lib/rsm/actions.rb CHANGED
@@ -2,6 +2,29 @@ module Rsm
2
2
  module Actions
3
3
  TAR_OPTS = {:gz => '-z', :bz2 => '-j'}.freeze
4
4
 
5
+ def application_root
6
+ unless @application_root
7
+ @application_root = if options[:capistrano]
8
+ "#{options[:apps_root]}/#{name}/#{options[:capistrano]}/current"
9
+ else
10
+ "#{options[:apps_root]}/#{name}"
11
+ end
12
+ @application_root = Pathname.new(@application_root)
13
+ say "Application root: #{@application_root}" if options[:verbose]
14
+ end
15
+ @application_root
16
+ end
17
+
18
+ def run_ruby_binary(command, config = {})
19
+ rvmrc = application_root.join(".rvmrc")
20
+ with = if rvmrc.exist?
21
+ File.new(rvmrc).readline.strip + " exec"
22
+ else
23
+ "#{Thor::Util.ruby_command} -S"
24
+ end
25
+ run(command, config.merge(:with => with))
26
+ end
27
+
5
28
  # relative downloaded filename
6
29
  # *name*:: application name
7
30
  # *compressor*:: +:gz+ or +:bz2+
data/lib/rsm/base.rb CHANGED
@@ -10,28 +10,18 @@ module Rsm
10
10
  class_option :apps_root, :default => "/var/www", :aliases => "-r", :desc => "Rails apps root"
11
11
  class_option :capistrano, :default => false, :aliases => "-c", :desc => "Application's Capistrano stage"
12
12
 
13
+ class_option :verbose, :default => false, :aliases => "-V", :desc => "Verbose output"
13
14
 
14
15
  def self.template_path
15
16
  Thor::Util.snake_case(name.to_s).squeeze(":").gsub(":", "/")
16
17
  end
17
-
18
+
18
19
  def self.source_root
19
20
  File.expand_path("../../../templates/#{template_path}", __FILE__)
20
21
  end
21
22
 
22
- def application_root
23
- unless @application_root
24
- @application_root = if options[:capistrano]
25
- "#{options[:apps_root]}/#{name}/#{options[:capistrano]}/current"
26
- else
27
- "#{options[:apps_root]}/#{name}"
28
- end
29
- @application_root = Pathname.new(@application_root)
30
- say "Application root: #{@application_root}"
31
- end
32
- @application_root
23
+ def set_destination_root
24
+ self.destination_root = application_root.to_s
33
25
  end
34
- remove_task :application_root
35
-
36
26
  end
37
27
  end
@@ -0,0 +1,18 @@
1
+ module Rsm
2
+ module Bundle
3
+ class Install < Rsm::Base
4
+ class_option :deployment, :aliases => "-D", :type => :boolean, :default => false, :desc => "Use deployment mode"
5
+ class_option :without, :desc => "Pass to --without bundler's option"
6
+
7
+ def check_and_install
8
+ bundle_install = "bundle install"
9
+ bundle_install << " --deployment" if options[:deployment]
10
+ bundle_install << " --without #{options[:without]}" if options[:without]
11
+ inside "." do
12
+ run_ruby_binary "bundle check || #{bundle_install}"
13
+ end
14
+ end
15
+
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,13 @@
1
+ module Rsm
2
+ module Bundle
3
+ class Update < Rsm::Base
4
+
5
+ def update
6
+ inside "." do
7
+ run_ruby_binary "bundle update"
8
+ end
9
+ end
10
+
11
+ end
12
+ end
13
+ end
@@ -12,10 +12,6 @@ module Rsm
12
12
 
13
13
  class_option :worker_processes, :type => :numeric, :default => 2, :aliases => "-w", :desc => "Worker processes for use in Unicorn"
14
14
 
15
- def set_destination_root
16
- self.destination_root = application_root.to_s
17
- end
18
-
19
15
  def download
20
16
  empty_directory "."
21
17
  inside application_root do
@@ -2,17 +2,11 @@ module Rsm
2
2
  module Unicorn
3
3
  class Start < Rsm::Base
4
4
  class_option :environment, :aliases => "-e", :default => "production"
5
-
5
+
6
6
  def unicorn_rails
7
- rvmrc = application_root.join(".rvmrc")
8
- if rvmrc.exist?
9
- ruby_cmd = File.new(rvmrc).readline.strip + " exec"
10
- else
11
- ruby_cmd = "#{Thor::Util.ruby_command} -S"
12
- end
13
- run "#{ruby_cmd} unicorn_rails -D -E #{options[:environment]} -c #{application_root.join("config", "unicorn.rb")}"
7
+ run_ruby_binary "unicorn_rails -D -E #{options[:environment]} -c #{application_root.join("config", "unicorn.rb")}"
14
8
  end
15
-
9
+
16
10
  end
17
11
  end
18
12
  end
@@ -1,12 +1,13 @@
1
1
  module Rsm
2
2
  module Unicorn
3
3
  class Stop < Rsm::Base
4
-
4
+
5
5
  def unicorn_rails
6
- pidfile = application_root.join("tmp", "pids", "unicorn.pid")
7
- run "kill $(cat #{pidfile})"
6
+ inside "." do
7
+ run "kill $(cat tmp/pids/unicorn.pid)"
8
+ end
8
9
  end
9
-
10
+
10
11
  end
11
12
  end
12
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsm
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-03 00:00:00.000000000Z
12
+ date: 2011-09-04 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &72172910 !ruby/object:Gem::Requirement
16
+ requirement: &81380070 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 0.14.6
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *72172910
24
+ version_requirements: *81380070
25
25
  description: Thor tasks for rapid deployment new rails apps on server
26
26
  email: a.ulyanitsky@gmail.com
27
27
  executables:
@@ -44,6 +44,8 @@ files:
44
44
  - lib/rsm/base.rb
45
45
  - lib/rsm/runner.rb
46
46
  - lib/rsm/version.rb
47
+ - lib/tasks/bundle/install.rb
48
+ - lib/tasks/bundle/update.rb
47
49
  - lib/tasks/install/nginx.rb
48
50
  - lib/tasks/install/rails.rb
49
51
  - lib/tasks/unicorn/start.rb