capigento 0.1.3

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/CHANGELOG ADDED
@@ -0,0 +1,3 @@
1
+ == 0.1.0 / Nov 2, 2011
2
+
3
+ First release.
data/README.md ADDED
File without changes
data/bin/capigento ADDED
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'optparse'
4
+ require 'fileutils'
5
+
6
+ config_path = 'app/etc'
7
+
8
+ OptionParser.new do |opts|
9
+ opts.banner = "Usage: #{File.basename($0)} [path]"
10
+
11
+ opts.on("-h", "--help", "Displays this help info") do
12
+ puts opts
13
+ exit 0
14
+ end
15
+
16
+ opts.on("-p", "--app NAME", "Specify app name (folder) to capigento") do |path|
17
+ config_path = path
18
+ end
19
+
20
+ begin
21
+ opts.parse!(ARGV)
22
+ rescue OptionParser::ParseError => e
23
+ warn e.message
24
+ puts opts
25
+ exit 1
26
+ end
27
+ end
28
+
29
+ if ARGV.empty?
30
+ abort "Please specify the directory to capigento, e.g. `#{File.basename($0)} .'"
31
+ elsif !File.exists?(ARGV.first)
32
+ abort "`#{ARGV.first}' does not exist."
33
+ elsif !File.directory?(ARGV.first)
34
+ abort "`#{ARGV.first}' is not a directory."
35
+ elsif ARGV.length > 1
36
+ abort "Too many arguments; please specify only the directory to capigento."
37
+ end
38
+
39
+ def unindent(string)
40
+ indentation = string[/\A\s*/]
41
+ string.strip.gsub(/^#{indentation}/, "")
42
+ end
43
+
44
+ base = ARGV.shift
45
+
46
+ files = {
47
+ "Capfile" => unindent(<<-FILE),
48
+ load 'deploy' if respond_to?(:namespace) # cap2 differentiator
49
+ load Gem.find_files('magento.rb').last.to_s
50
+ load '#{config_path}/deploy'
51
+ FILE
52
+
53
+ "#{config_path}/deploy.rb" => unindent(<<-FILE)
54
+ set :application, "set your application name here"
55
+ set :domain, "\#{application}.com"
56
+ set :deploy_to, "/var/www/\#{domain}"
57
+
58
+ set :repository, "\#{domain}:/var/repos/\#{application}.git"
59
+ set :scm, :git
60
+ # Or: `accurev`, `bzr`, `cvs`, `darcs`, `subversion`, `mercurial`, `perforce`, `subversion` or `none`
61
+
62
+ role :web, domain # Your HTTP server, Apache/etc
63
+ role :app, domain # This may be the same as your `Web` server
64
+ role :db, domain, :primary => true # This is where Rails migrations will run
65
+
66
+ set :keep_releases, 3
67
+ FILE
68
+ }
69
+
70
+ files.each do |file, content|
71
+ file = File.join(base, file)
72
+ if File.exists?(file)
73
+ warn "[skip] '#{file}' already exists"
74
+ elsif File.exists?(file.downcase)
75
+ warn "[skip] '#{file.downcase}' exists, which could conflict with `#{file}'"
76
+ else
77
+ unless File.exists?(File.dirname(file))
78
+ puts "[add] making directory '#{File.dirname(file)}'"
79
+ FileUtils.mkdir(File.dirname(file))
80
+ end
81
+ puts "[add] writing '#{file}'"
82
+ File.open(file, "w") { |f| f.write(content) }
83
+ end
84
+ end
85
+
86
+ puts "[done] Magento project capigented!"
data/lib/capigento.rb ADDED
@@ -0,0 +1,30 @@
1
+ def prompt_with_default(var, default, &block)
2
+ set(var) do
3
+ Capistrano::CLI.ui.ask("#{var} [#{default}] : ", &block)
4
+ end
5
+ set var, default if eval("#{var.to_s}.empty?")
6
+ end
7
+
8
+ namespace :deploy do
9
+ desc "Overwrite the start task because symfony doesn't need it."
10
+ task :start do ; end
11
+
12
+ desc "Overwrite the restart task because symfony doesn't need it."
13
+ task :restart do ; end
14
+
15
+ desc "Overwrite the stop task because symfony doesn't need it."
16
+ task :stop do ; end
17
+
18
+ desc "[Overload] We perform only update action"
19
+ task :cold do
20
+ update
21
+ end
22
+
23
+ desc "[Overload] Removed"
24
+ task :testall do
25
+ end
26
+
27
+ desc "[Overload] Removed"
28
+ task :migrate do
29
+ end
30
+ end
data/lib/magento.rb ADDED
@@ -0,0 +1,57 @@
1
+ load Gem.find_files('capigento.rb').last.to_s
2
+
3
+ set :cache_path, "var"
4
+
5
+ set :shared_children, ["media", "downloader", "system"]
6
+
7
+ set :shared_files, ["app/etc/local.xml", "index.php", ".htaccess"]
8
+
9
+ set :asset_children, []
10
+
11
+ namespace :mage do
12
+ desc "Removes all magento cache directories content"
13
+ task :cc do
14
+ clear_cache
15
+ clear_media_cache
16
+ end
17
+ desc "Removes magento main cache directory content"
18
+ task :clear_cache do
19
+ run "if [ -d #{current_path}/var/cache ] ; then rm -rf #{current_path}/var/cache/*; fi"
20
+ end
21
+ desc "Rmoves magento assets cache directories content"
22
+ task :clear_media_cache do
23
+ run "if [ -d #{current_path}/media/css ] ; then rm -rf #{current_path}/media/css/*; fi"
24
+ run "if [ -d #{current_path}/media/js ] ; then rm -rf #{current_path}/media/js/*; fi"
25
+ end
26
+ end
27
+
28
+ namespace :deploy do
29
+ desc "Symlink static directories and static files that need to remain between deployments."
30
+ task :share_childs do
31
+ if shared_children
32
+ shared_children.each do |link|
33
+ run "mkdir -p #{shared_path}/#{link}"
34
+ run "if [ -d #{release_path}/#{link} ] ; then rm -rf #{release_path}/#{link}; fi"
35
+ run "ln -nfs #{shared_path}/#{link} #{release_path}/#{link}"
36
+ end
37
+ end
38
+ if shared_files
39
+ shared_files.each do |link|
40
+ link_dir = File.dirname("#{shared_path}/#{link}")
41
+ run "mkdir -p #{link_dir}"
42
+ run "touch #{shared_path}/#{link}"
43
+ run "ln -nfs #{shared_path}/#{link} #{release_path}/#{link}"
44
+ end
45
+ end
46
+ end
47
+
48
+ desc "Update latest release source path."
49
+ task :finalize_update, :except => { :no_release => true } do
50
+ run "chmod -R g+w #{latest_release}" if fetch(:group_writable, true)
51
+ run "if [ -d #{latest_release}/#{cache_path} ] ; then rm -rf #{latest_release}/#{cache_path}; fi"
52
+ run "mkdir -p #{latest_release}/#{cache_path} && chmod -R 0777 #{latest_release}/#{cache_path}"
53
+
54
+ share_childs
55
+ end
56
+ end
57
+
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capigento
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 3
9
+ version: 0.1.3
10
+ platform: ruby
11
+ authors:
12
+ - Witold Janusik
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-11-02 00:00:00 +01:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: capistrano
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 2
30
+ - 5
31
+ - 10
32
+ version: 2.5.10
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ description: " Deployment recipe for magento applications.\n"
36
+ email: me@freakphp.com
37
+ executables:
38
+ - capigento
39
+ extensions: []
40
+
41
+ extra_rdoc_files: []
42
+
43
+ files:
44
+ - bin/capigento
45
+ - lib/capigento.rb
46
+ - lib/magento.rb
47
+ - README.md
48
+ - CHANGELOG
49
+ has_rdoc: true
50
+ homepage: http://capigento.hatimeria.com
51
+ licenses: []
52
+
53
+ post_install_message:
54
+ rdoc_options: []
55
+
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ segments:
64
+ - 0
65
+ version: "0"
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ segments:
72
+ - 0
73
+ version: "0"
74
+ requirements: []
75
+
76
+ rubyforge_project: capigento
77
+ rubygems_version: 1.3.7
78
+ signing_key:
79
+ specification_version: 3
80
+ summary: Deploying Magento PHP applications with Capistrano.
81
+ test_files: []
82
+