capistrano-demo 0.0.4 → 0.0.5

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: b8687a4f9d761df2dfbe5002892c34f97dc19933
4
- data.tar.gz: d03a3bc7cb5aa0ac2ab3740b4eedbbd81cdee820
3
+ metadata.gz: dd6d33ec4728e05cc89761693f984b1a64518d2c
4
+ data.tar.gz: 420138bef1463ddf48ade1d686cb8a99b256e668
5
5
  SHA512:
6
- metadata.gz: 489a341d45a4e63c35fa6047cd9ce0f4ce1e04bc91ceb8c90149db8242eab384a28fe99172816f4908cf89c78027c545d2783a9c8f22570572406ceeb01d411e
7
- data.tar.gz: 4dd65287be703a7230bef5fd63f4deae7975ff44176fd6367b98fc47ea412822a0edf612e841bec9ccfa04947e4999e7bba49b52679e34dfe99f6b5b2b9e4931
6
+ metadata.gz: 4694adcefd9f370231d7a9d990d51fedff988011bc0eeda3beb74f40b64adc93f5295ad0490ccf9a3f0d367a5fdd5c0dfa1cbca4d49a7211424300eded1dbcbe
7
+ data.tar.gz: 4c616a42be2f411cc6486f66162ee0ebcc4a2f0d9047f0fe5e011487437a51617097876fd7ec18433f8b2f306444d5809660f5eac829bf49d55955f72f3b8956
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = 'capistrano-demo'
6
- spec.version = '0.0.4'
6
+ spec.version = '0.0.5'
7
7
  spec.authors = ['Arthur Shcheglov (fc_arny)']
8
8
  spec.email = ['arthur.shcheglov@gmail.com']
9
9
  spec.summary = %q{Create demo-host by branch name}
@@ -1,4 +1,28 @@
1
+ namespace :load do
2
+ task :defaults do
3
+ set :demo_role, :all
4
+
5
+ set :demo_db, demo_default_db
6
+ set :demo_branch, demo_branch
7
+
8
+ set :demo_dir, -> { demo_dir }
9
+ set :demo_host, fetch(:application)
10
+
11
+ set :demo_restart_cmd, -> { raise 'You mast specify "demo_restart_cmd" proc' }
12
+
13
+ set :demo_linked_dirs, %w(public/uploads)
14
+ set :demo_copied_dirs, %w(vendor/cache)
15
+
16
+ set :demo_templates_dir, nil
17
+ set :demo_templates_entries, []
18
+ end
19
+ end
20
+
21
+
1
22
  namespace :demo do
23
+ task :test do
24
+ puts "* Demo host created => http://visp-666.32team.com *".colorize(:light_green).blink
25
+ end
2
26
 
3
27
  desc 'Chain of task for creating demo-host'
4
28
  task :create do
@@ -8,55 +32,29 @@ namespace :demo do
8
32
 
9
33
  invoke 'demo:restart'
10
34
 
11
- msg = "* Demo host created => http://#{demo_url} *"
12
-
35
+ msg = "* Demo host created => http://#{demo_url} *".colorize(:light_green)
13
36
  puts '*' * msg.length, msg, '*' * msg.length
14
37
  end
15
38
 
16
39
  desc 'Destroy demo-host'
17
- task :destroy => [:'setup:branch'] do
40
+ task :destroy => [:'setup:bootstrap'] do
18
41
  on roles(fetch(:demo_role)) do
19
- # TODO: remove nginx config
42
+ fetch(:demo_templates_entries).each do |entry|
43
+ next if entry[:link].nil?
44
+
45
+ execute :rm, entry[:link]
46
+ end
47
+
20
48
  execute :rm, '-rf', fetch(:demo_dir)
21
49
  end
22
50
  end
23
51
 
24
- desc 'TODO: Update demo-host'
25
- task :update => [:'setup:branch']do
26
- # set :tasks, ask('what do you want to update (code, db, assets, gems, settings)?', 'code')
27
- %w{code configs gems db assets}.each do |task|
28
- invoke "demo:setup:#{task}"
29
- end
30
-
31
- invoke 'demo:restart'
32
- end
33
52
 
34
- desc 'Restart servers (for example app, web, sidekiq etc)'
35
- task :restart => [:'setup:branch'] do
53
+ desc 'Restart demo-server and services'
54
+ task :restart => [:'setup:bootstrap'] do
36
55
  on roles(fetch(:demo_role)) do
37
- fetch(:demo_app_restart_cmd)
38
- fetch(:demo_web_restart_cmd)
56
+ fetch(:demo_restart_cmd)
39
57
  end
40
58
  end
41
- end
42
-
43
- namespace :load do
44
- task :defaults do
45
- set :demo_role, :all
46
- set :demo_branch, demo_branch
47
59
 
48
- set :demo_dir, -> { demo_dir }
49
- set :demo_host, fetch(:application)
50
-
51
- set :demo_db, -> { demo_default_db }
52
-
53
- set :demo_app_restart_cmd, -> { raise 'You mast specify "demo_app_restart_cmd" proc for creating demo-host' }
54
- set :demo_web_restart_cmd, -> { on roles(fetch(:demo_role)) do execute :sudo, :service, 'nginx restart' end }
55
-
56
- set :demo_linked_dirs, %w(public/uploads)
57
- set :demo_copied_dirs, %w(vendor/cache)
58
-
59
- set :demo_templates_dir, nil
60
- set :demo_templates_entries, []
61
- end
62
60
  end
@@ -1,12 +1,14 @@
1
1
  namespace :demo do
2
2
  namespace :setup do
3
- task :branch do
4
- # set :demo_branch, demo_branch
3
+ # desc 'Bootstrap demo plugin'
4
+ task :bootstrap do
5
+ set :demo_branch, ask('branch name', fetch(:demo_branch, demo_branch))
5
6
  set :demo_db, ask('database name', fetch(:demo_db, demo_default_db))
7
+ set :release_path, demo_dir
6
8
  end
7
9
 
8
- desc 'Fetch code from repo\'s branch'
9
- task :code => [:branch] do
10
+ # desc 'Fetch code from repo\'s branch'
11
+ task :code => [:bootstrap] do
10
12
  set :branch, demo_branch
11
13
 
12
14
  on roles(fetch(:demo_role)) do
@@ -27,8 +29,8 @@ namespace :demo do
27
29
  end
28
30
  end
29
31
 
30
- desc 'Install gems'
31
- task :gems => [:code] do
32
+ # desc 'Install gems'
33
+ task :gems => [:bootstrap] do
32
34
  set :bundle_gemfile, demo_dir.join('Gemfile')
33
35
 
34
36
  on roles(fetch(:demo_role)) do
@@ -59,9 +61,6 @@ namespace :demo do
59
61
  task :configs => [:code] do
60
62
  next if fetch(:demo_templates_dir).nil?
61
63
 
62
- branch = demo_branch
63
- db = fetch(:demo_db)
64
-
65
64
  on roles(fetch(:demo_role)) do
66
65
  within fetch(:demo_dir) do
67
66
  fetch(:demo_templates_entries).each do |entry|
@@ -90,6 +89,5 @@ namespace :demo do
90
89
  end
91
90
  end
92
91
  end
93
-
94
92
  end
95
93
  end
@@ -18,7 +18,7 @@ namespace :demo do
18
18
  # end
19
19
  # end
20
20
 
21
- desc 'Symlink directories'
21
+ # desc 'Symlink directories'
22
22
  task :link_dirs do
23
23
  next unless any? :demo_linked_dirs
24
24
  on roles(fetch(:demo_role)) do
@@ -37,7 +37,7 @@ namespace :demo do
37
37
  end
38
38
  end
39
39
 
40
- desc 'Copy dirs (cache) for speed-up (by default bundler cache and precompiled assets)'
40
+ # desc 'Copy dirs (cache) for speed-up (by default bundler cache and precompiled assets)'
41
41
  task :copy_dirs do
42
42
  next unless any? :demo_copied_dirs
43
43
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-demo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arthur Shcheglov (fc_arny)