swiftly 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +7 -0
  2. data/.DS_Store +0 -0
  3. data/.gitignore +2 -0
  4. data/Dropbox/Development/www/Swiftlyfile +8 -0
  5. data/Gemfile +3 -0
  6. data/bin/swiftly +15 -0
  7. data/lib/swiftly/Rakefile +38 -0
  8. data/lib/swiftly/app_module.rb +320 -0
  9. data/lib/swiftly/clean.rb +33 -0
  10. data/lib/swiftly/cli.rb +36 -0
  11. data/lib/swiftly/config.rb +131 -0
  12. data/lib/swiftly/config_global_generator.rb +35 -0
  13. data/lib/swiftly/config_plugins_generator.rb +33 -0
  14. data/lib/swiftly/config_project_generator.rb +32 -0
  15. data/lib/swiftly/config_swiftlyfile_generator.rb +34 -0
  16. data/lib/swiftly/config_templates_generator.rb +33 -0
  17. data/lib/swiftly/configure.rb +27 -0
  18. data/lib/swiftly/configure_all.rb +181 -0
  19. data/lib/swiftly/configure_local.rb +34 -0
  20. data/lib/swiftly/configure_production.rb +42 -0
  21. data/lib/swiftly/configure_staging.rb +41 -0
  22. data/lib/swiftly/create.rb +94 -0
  23. data/lib/swiftly/create_git.rb +40 -0
  24. data/lib/swiftly/create_project.rb +67 -0
  25. data/lib/swiftly/create_wordpress.rb +185 -0
  26. data/lib/swiftly/database.rb +213 -0
  27. data/lib/swiftly/destroy.rb +53 -0
  28. data/lib/swiftly/enable.rb +13 -0
  29. data/lib/swiftly/enable_wordpress.rb +22 -0
  30. data/lib/swiftly/generate.rb +23 -0
  31. data/lib/swiftly/generate_post_type.rb +50 -0
  32. data/lib/swiftly/init.rb +130 -0
  33. data/lib/swiftly/packages.rb +137 -0
  34. data/lib/swiftly/project.rb +127 -0
  35. data/lib/swiftly/pull.rb +25 -0
  36. data/lib/swiftly/push.rb +60 -0
  37. data/lib/swiftly/rollback.rb +78 -0
  38. data/lib/swiftly/setup.rb +34 -0
  39. data/lib/swiftly/ssh.rb +36 -0
  40. data/lib/swiftly/templates/config_global.erb +3 -0
  41. data/lib/swiftly/templates/config_project.erb +11 -0
  42. data/lib/swiftly/templates/gitignore.erb +7 -0
  43. data/lib/swiftly/templates/post_type.erb +98 -0
  44. data/lib/swiftly/templates/swiftlyfile.erb +21 -0
  45. data/lib/swiftly/version.rb +4 -0
  46. data/swiftly.gemspec +61 -0
  47. data/test/test_swiftly_spec.rb +18 -0
  48. metadata +175 -0
@@ -0,0 +1,137 @@
1
+ require "swiftly/config"
2
+ require "swiftly/app_module"
3
+ require "yaml"
4
+
5
+ module Swiftly
6
+ class Packages < Thor
7
+
8
+ include Thor::Actions
9
+ include Helpers
10
+
11
+ no_commands do
12
+
13
+ def self.file
14
+
15
+ @settings = Swiftly::Config.load :global
16
+
17
+ File.join(
18
+ @settings[:sites_path],
19
+ 'Swiftlyfile',
20
+ ) unless !File.exists?(
21
+ File.join(
22
+ @settings[:sites_path],
23
+ 'Swiftlyfile'
24
+ )
25
+ )
26
+
27
+ end
28
+
29
+ def self.check?
30
+
31
+ if File.exists? self.file
32
+
33
+ true
34
+
35
+ else
36
+
37
+ false
38
+
39
+ end
40
+ end
41
+
42
+ def self.available
43
+
44
+ YAML.load_file self.file
45
+
46
+ end
47
+
48
+ def self.template
49
+
50
+ {
51
+ name: 'mask',
52
+ location: 'https://github.com/micalexander/mask/archive/master.zip'
53
+ }
54
+
55
+ end
56
+
57
+ def self.load package = {}
58
+
59
+ approved_package = nil
60
+
61
+ if self.available &&
62
+ !self.available[:packages].nil? &&
63
+ !self.available[:packages][package[:framework]].nil? &&
64
+ !self.available[:packages][package[:framework]][package[:type]].nil?
65
+
66
+ self.available[:packages][package[:framework]][package[:type]].each do |p|
67
+
68
+ if ( p[:name] == package[:name] && p[:status] != :disabled ) ||
69
+ ( p[:status] == :default )
70
+
71
+ approved_package = p
72
+
73
+ else
74
+
75
+ approved_package = self.template
76
+
77
+ end
78
+ end
79
+
80
+ elsif !self.available
81
+
82
+
83
+ approved_package = self.template
84
+
85
+ end
86
+
87
+ if !approved_package.nil? &&
88
+ (
89
+ approved_package[:location] =~ /^#{URI::regexp}\.zip$/ ||
90
+ File.exist?( File.join( approved_package[:location], approved_package[:name] ) )
91
+ )
92
+
93
+ return approved_package
94
+
95
+ end
96
+
97
+ false
98
+
99
+ end
100
+
101
+ def self.load_plugins framework
102
+
103
+ plugins = []
104
+
105
+ if self.available &&
106
+ !self.available[:packages].nil? &&
107
+ !self.available[:packages][framework].nil? &&
108
+ !self.available[:packages][framework][:plugins].nil?
109
+
110
+ self.available[:packages][framework][:plugins].each do |p|
111
+
112
+ verified = self.load({
113
+ framework: framework,
114
+ type: :plugins,
115
+ name: p[:name]
116
+ })
117
+
118
+ if verified
119
+
120
+ plugins << verified
121
+
122
+ end
123
+ end
124
+
125
+ if plugins.count > 0
126
+
127
+ return plugins
128
+
129
+ end
130
+
131
+ false
132
+
133
+ end
134
+ end
135
+ end
136
+ end
137
+ end
@@ -0,0 +1,127 @@
1
+ require 'Thor'
2
+ require 'yaml'
3
+ require 'swiftly/app_module'
4
+
5
+ module Swiftly
6
+ class Project < Thor
7
+
8
+ include Thor::Actions
9
+ include Helpers
10
+
11
+ no_commands do
12
+
13
+ def self.settings( project_name )
14
+
15
+ project_name = self.get_project project_name
16
+ global_config = Swiftly::Config.load :global
17
+ swiftly_config = Swiftly::Config.load :swiftly
18
+ project_config = Swiftly::Config.load :project, project_name
19
+ wp_config = Swiftly::Config.load :wp_config, project_name
20
+
21
+ global_config = {
22
+ version: VERSION,
23
+ sites_path: global_config[:sites_path],
24
+ }
25
+
26
+ switly_config = {
27
+ staging: {
28
+ domain: defined?(project_config[:staging][:domain]) ? project_config[:staging][:domain] : global_config[:staging][:domain],
29
+ db_host: defined?(project_config[:staging][:db_host]) ? project_config[:staging][:db_host] : global_config[:staging][:db_host],
30
+ db_user: defined?(project_config[:staging][:db_user]) ? project_config[:staging][:db_user] : global_config[:staging][:db_user],
31
+ db_pass: defined?(project_config[:staging][:db_pass]) ? project_config[:staging][:db_pass] : global_config[:staging][:db_pass],
32
+ },
33
+ production: {
34
+ domain: defined?(project_config[:production][:domain]) ? project_config[:production][:domain] : global_config[:production][:domain],
35
+ db_host: defined?(project_config[:production][:db_host]) ? project_config[:production][:db_host] : global_config[:production][:db_host],
36
+ db_user: defined?(project_config[:production][:db_user]) ? project_config[:production][:db_user] : global_config[:production][:db_user],
37
+ db_pass: defined?(project_config[:production][:db_pass]) ? project_config[:production][:db_pass] : global_config[:production][:db_pass],
38
+ }
39
+ }.merge! local: global_config[:local]
40
+
41
+ settings = {
42
+ project: {
43
+ name: project_name,
44
+ path: File.join( global_config[:sites_path], project_name ),
45
+ dump: File.join( global_config[:sites_path], project_name, '_backups', 'dumps' )
46
+ },
47
+ local: {
48
+ domain: defined?(wp_config[:local][:domain]) ? wp_config[:local][:domain] : project_config[:local][:domain],
49
+ db_name: defined?(wp_config[:local][:db_name]) ? wp_config[:local][:db_name] : project_config[:local][:db_name],
50
+ db_host: defined?(wp_config[:local][:db_host]) ? wp_config[:local][:db_host] : switly_config[:local][:db_host],
51
+ db_user: defined?(wp_config[:local][:db_user]) ? wp_config[:local][:db_user] : switly_config[:local][:db_user],
52
+ db_pass: defined?(wp_config[:local][:db_pass]) ? wp_config[:local][:db_pass] : switly_config[:local][:db_pass],
53
+ },
54
+ staging: {
55
+ db_name: defined?(wp_config[:staging][:db_name]) ? wp_config[:staging][:db_name] : project_config[:staging][:db_name],
56
+ db_host: defined?(wp_config[:staging][:db_host]) ? wp_config[:staging][:db_host] : switly_config[:staging][:db_host],
57
+ db_user: defined?(wp_config[:staging][:db_user]) ? wp_config[:staging][:db_user] : switly_config[:staging][:db_user],
58
+ db_pass: defined?(wp_config[:staging][:db_pass]) ? wp_config[:staging][:db_pass] : switly_config[:staging][:db_pass],
59
+ domain: defined?(switly_config[:staging][:domain]) ? switly_config[:staging][:domain] : wp_config[:staging][:domain],
60
+ repo: project_config[:staging][:repo],
61
+ branch: project_config[:staging][:branch],
62
+ ssh_path: project_config[:staging][:ssh_path],
63
+ ssh_user: project_config[:staging][:ssh_user],
64
+ },
65
+ production: {
66
+ db_name: defined?(wp_config[:production][:db_name]) ? wp_config[:production][:db_name] : project_config[:production][:db_name],
67
+ db_host: defined?(wp_config[:production][:db_host]) ? wp_config[:production][:db_host] : switly_config[:production][:db_host],
68
+ db_user: defined?(wp_config[:production][:db_user]) ? wp_config[:production][:db_user] : switly_config[:production][:db_user],
69
+ db_pass: defined?(wp_config[:production][:db_pass]) ? wp_config[:production][:db_pass] : switly_config[:production][:db_pass],
70
+ domain: defined?(switly_config[:production][:domain]) ? switly_config[:production][:domain] : wp_config[:production][:domain],
71
+ repo: project_config[:production][:repo],
72
+ branch: project_config[:production][:branch],
73
+ ssh_path: project_config[:production][:ssh_path],
74
+ ssh_user: project_config[:production][:ssh_user],
75
+ }
76
+ }
77
+
78
+ if defined?( settings[:staging][:ssh_user] ) &&
79
+ defined?( settings[:staging][:domain] ) &&
80
+ settings[:staging][:ssh_user] != nil &&
81
+ settings[:staging][:domain] != nil
82
+
83
+ settings[:staging][:userhost] = settings[:staging][:ssh_user] + '@' + settings[:staging][:domain].gsub(/http:\/\//, "")
84
+
85
+ end
86
+
87
+ if defined?( settings[:production][:ssh_user] ) &&
88
+ defined?( settings[:production][:domain] ) &&
89
+ settings[:production][:ssh_user] != nil &&
90
+ settings[:production][:domain] != nil
91
+
92
+ settings[:production][:userhost] = settings[:production][:ssh_user] + '@' + settings[:production][:domain].gsub(/http:\/\//, "")
93
+
94
+ end
95
+
96
+ settings
97
+
98
+ end
99
+
100
+ def self.get_project( project_name )
101
+
102
+ pathname = Pathname.new project_name
103
+ settings = Swiftly::Config.load( :global )
104
+ project_path = File.join( settings[:sites_path], pathname.expand_path.basename )
105
+
106
+ thor = Thor.new
107
+
108
+ thor.say #spacer
109
+
110
+ thor.say_status( "#{APP_NAME}:", "#{project_path} is not a project.\n", :yellow ) &&
111
+ abort unless File.directory?( project_path )
112
+
113
+ pathname.expand_path.basename
114
+
115
+ end
116
+
117
+ def self.exists?( project_name )
118
+
119
+ settings = Swiftly::Config.load( :global )
120
+ project_path = File.join( settings[:sites_path], project_name )
121
+
122
+ File.directory?( project_path )
123
+
124
+ end
125
+ end
126
+ end
127
+ end
@@ -0,0 +1,25 @@
1
+ require 'swiftly/app_module'
2
+ require 'swiftly/Database'
3
+
4
+ module Swiftly
5
+ class Pull < Thor
6
+ include Thor::Actions
7
+ include Helpers
8
+
9
+ desc "staging PROJECT_NAME", "Pull down staging environment"
10
+
11
+ def staging( project_name )
12
+
13
+ Swiftly::Database.new( project_name ).sync( :staging, :local )
14
+
15
+ end
16
+
17
+ desc "production PROJECT_NAME", "Pull down production environment"
18
+
19
+ def production( project_name )
20
+
21
+ Swiftly::Database.new( project_name ).sync( :production, :local )
22
+
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,60 @@
1
+ require 'swiftly/app_module'
2
+ require 'swiftly/Database'
3
+
4
+ module Swiftly
5
+ class Push < Thor
6
+
7
+ include Thor::Actions
8
+ include Helpers
9
+
10
+ desc "staging PROJECT_NAME", "Push staging environment"
11
+
12
+ def staging( project_name )
13
+
14
+ settings = Swiftly::Project.settings( project_name )
15
+ database = Swiftly::Database.new project_name
16
+
17
+ verifiy_mina_credentials :staging, settings, 'push to the'
18
+
19
+ dump_file = database.dump :staging
20
+
21
+ database.sync :local, :staging
22
+
23
+ mina 'deploy', :staging, project_name
24
+
25
+ scp = <<-EOF.unindent
26
+ scp \
27
+ #{dump_file} \
28
+ #{settings[:staging][:userhost]}:#{settings[:staging][:ssh_path]}/current
29
+ EOF
30
+
31
+ swiftly_shell scp
32
+
33
+ end
34
+
35
+ desc "production PROJECT_NAME", "Push production environment"
36
+
37
+ def production( project_name )
38
+
39
+ settings = Swiftly::Project.settings( project_name )
40
+ database = Swiftly::Database.new project_name
41
+
42
+ verifiy_mina_credentials :production, settings, 'push to the'
43
+
44
+ dump_file = database.dump :production
45
+
46
+ database.sync :local, :production
47
+
48
+ mina 'deploy', :production, project_name
49
+
50
+ scp = <<-EOF.unindent
51
+ scp \
52
+ #{dump_file} \
53
+ #{settings[:production][:userhost]}:#{settings[:production][:ssh_path]}/current
54
+ EOF
55
+
56
+ swiftly_shell scp
57
+
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,78 @@
1
+ require 'swiftly/app_module'
2
+ require 'swiftly/Database'
3
+
4
+ module Swiftly
5
+ class Rollback < Thor
6
+ include Thor::Actions
7
+ include Helpers
8
+
9
+ desc "staging PROJECT_NAME", "Rollback staging environment"
10
+
11
+ def staging( project_name )
12
+
13
+ database = Swiftly::Database.new( project_name )
14
+ settings = Swiftly::Project.settings( project_name )
15
+
16
+ verifiy_mina_credentials :staging, settings, 'rollback to the'
17
+
18
+ ssh = <<-EOF.unindent
19
+ ssh \
20
+ -q \
21
+ #{settings[:staging][:userhost]} \
22
+ ls \
23
+ #{settings[:staging][:ssh_path]}/current \
24
+ | grep staging.sql
25
+ EOF
26
+
27
+ previous_sql = return_cmd( ssh ).gsub(/[^a-zA-Z0-9\-\.]/,"")
28
+
29
+ scp = <<-EOF.unindent
30
+ scp \
31
+ #{settings[:staging][:userhost]}:#{settings[:staging][:ssh_path]}/current/#{previous_sql } \
32
+ #{settings[:project][:dump]}/temp
33
+ EOF
34
+
35
+ swiftly_shell scp
36
+
37
+ database.import( :staging, "#{settings[:project][:dump]}/temp/#{previous_sql}" )
38
+
39
+ mina 'rollback', :staging, project_name
40
+
41
+ end
42
+
43
+ desc "production PROJECT_NAME", "Rollback production environment"
44
+
45
+ def production( project_name )
46
+
47
+ database = Swiftly::Database.new( project_name )
48
+ settings = Swiftly::Project.settings( project_name )
49
+
50
+ verifiy_mina_credentials :production, settings, 'rollback to the'
51
+
52
+ ssh = <<-EOF.unindent
53
+ ssh \
54
+ -q \
55
+ #{settings[:production][:userhost]} \
56
+ ls \
57
+ #{settings[:production][:ssh_path]}/current \
58
+ | grep production.sql
59
+ EOF
60
+
61
+ previous_sql = return_cmd( ssh ).gsub(/[^a-zA-Z0-9\-\.]/,"")
62
+
63
+ scp = <<-EOF.unindent
64
+ scp \
65
+ #{settings[:production][:userhost]}:#{settings[:production][:ssh_path]}/current/#{previous_sql } \
66
+ #{settings[:project][:dump]}/temp
67
+ EOF
68
+
69
+ swiftly_shell scp
70
+
71
+ database.import( :production, "#{settings[:project][:dump]}/temp/#{previous_sql}" )
72
+
73
+ mina 'rollback', :production, project_name
74
+
75
+
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,34 @@
1
+ require 'swiftly/app_module'
2
+ require 'swiftly/Database'
3
+
4
+ module Swiftly
5
+ class Setup < Thor
6
+
7
+ include Thor::Actions
8
+ include Helpers
9
+
10
+ desc "staging PROJECT_NAME", "setup staging server"
11
+
12
+ def staging( project_name )
13
+
14
+ settings = Swiftly::Project.settings( project_name )
15
+
16
+ verifiy_mina_credentials :staging, settings, 'setup the'
17
+
18
+ mina 'setup', :staging, project_name
19
+
20
+ end
21
+
22
+ desc "production PROJECT_NAME", "setup production server"
23
+
24
+ def production( project_name )
25
+
26
+ settings = Swiftly::Project.settings( project_name )
27
+
28
+ verifiy_mina_credentials :production, settings, 'setup the'
29
+
30
+ mina 'setup', :production, project_name
31
+
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,36 @@
1
+ require 'swiftly/app_module'
2
+ require 'swiftly/Database'
3
+
4
+ module Swiftly
5
+ class SSH < Thor
6
+
7
+ include Thor::Actions
8
+ include Helpers
9
+
10
+ desc "staging PROJECT_NAME", "SSH into staging server and cd into site root"
11
+
12
+ def staging( project_name )
13
+
14
+ settings = Swiftly::Project.settings( project_name )
15
+
16
+ verifiy_mina_credentials :staging, settings, 'ssh into the'
17
+
18
+ mina 'ssh', :staging, project_name
19
+
20
+ end
21
+
22
+ desc "production PROJECT_NAME", "SSH into production server and cd into site root"
23
+
24
+ def production( project_name )
25
+
26
+ settings = Swiftly::Project.settings( project_name )
27
+
28
+ verifiy_mina_credentials :production, settings, 'ssh into the'
29
+
30
+ mina 'ssh', :production, project_name
31
+
32
+ end
33
+
34
+ end
35
+ end
36
+
@@ -0,0 +1,3 @@
1
+ ---
2
+ :version: <%= @version %>
3
+ :sites_path: <%= @sites_path %>
@@ -0,0 +1,11 @@
1
+ ---
2
+ :staging:
3
+ :repo:
4
+ :branch:
5
+ :ssh_path:
6
+ :ssh_user:
7
+ :production:
8
+ :repo:
9
+ :branch:
10
+ :ssh_path:
11
+ :ssh_user:
@@ -0,0 +1,7 @@
1
+ _backups
2
+ _resources
3
+ .DS_Store
4
+ .sass-cache/
5
+ _resources/
6
+ .htaccess
7
+ bower_components/
@@ -0,0 +1,98 @@
1
+ <?php
2
+ function create_<%= @project[:name][0..9] %>_<%= post_type_name.singularize %>_post_type() {
3
+ // Setup Custom Post Type
4
+ register_post_type(
5
+ '<%= @project[:name][0..9] %>-<%= post_type_name.pluralize %>',
6
+ array(
7
+ 'labels' => array(
8
+ 'name' => _x( '<%= post_type_name.pluralize.capitalize %>', 'taxonomy general name' ),
9
+ 'singular_name' => _x( '<%= post_type_name.singularize.capitalize %>', 'taxonomy singular name' ),
10
+ 'menu_name' => __( '<%= post_type_name.pluralize.capitalize %>' ),
11
+ 'all_items' => __( 'All <%= post_type_name.pluralize.capitalize %>' ),
12
+ 'add_new' => __( 'Add New <%= post_type_name.singularize.capitalize %>' ),
13
+ 'add_new_item' => __( 'Add New <%= post_type_name.singularize.capitalize %>' ),
14
+ 'edit_item' => __( 'Edit <%= post_type_name.singularize.capitalize %>' ),
15
+ 'new_item' => __( 'New <%= post_type_name.singularize.capitalize %>' ),
16
+ 'view_item' => __( 'View <%= post_type_name.singularize.capitalize %>' ),
17
+ 'search_items' => __( 'Search <%= post_type_name.pluralize.capitalize %>' ),
18
+ 'not_found' => __( 'No <%= post_type_name.pluralize %> found.' ),
19
+ 'not_found_in_trash' => __( 'No <%= post_type_name.pluralize %> found in trash.' ),
20
+ 'parent_item' => null,
21
+ ),
22
+ 'description' => '',
23
+ 'has_archive' => true,
24
+ 'public' => true,
25
+ //'show_ui' => true,
26
+ //'show_in_menu' => true,
27
+ //'capability_type' => 'post',
28
+ 'hierarchical' => false,
29
+ // 'exclude_from_search' => false,
30
+ 'supports' => array(
31
+ 'title',
32
+ 'editor',
33
+ 'author',
34
+ 'excerpt',
35
+ 'trackbacks',
36
+ 'comments',
37
+ 'revisions',
38
+ 'page-attributes',
39
+ 'thumbnail'
40
+ ),
41
+ 'rewrite' => array(
42
+ 'slug' => '<%= post_type_name.pluralize %>'
43
+ )
44
+ )
45
+ );
46
+ }
47
+ add_action( 'init', 'create_<%= @project[:name][0..9] %>_<%= post_type_name.singularize %>_post_type' );
48
+
49
+ function <%= post_type_name %>_type_init() {
50
+ // Setup Custom Taxonomy
51
+ register_taxonomy(
52
+ '<%= post_type_name.singularize %>-type',
53
+ array( '<%= @project[:name][0..9] %>-<%= post_type_name.pluralize %>' ),
54
+ array(
55
+ 'labels' => array(
56
+ 'name' => _x( '<%= post_type_name.pluralize.capitalize %>', 'taxonomy general name' ),
57
+ 'singular_name' => _x( '<%= post_type_name.singularize.capitalize %>', 'taxonomy singular name' ),
58
+ 'menu_name' => __( '<%= post_type_name.singularize.capitalize %> Types' ),
59
+ 'all_items' => __( 'All <%= post_type_name.singularize.capitalize %> Types' ),
60
+ 'edit_item' => __( 'Edit <%= post_type_name.singularize.capitalize %> Type' ),
61
+ 'view_item' => __( 'View <%= post_type_name.singularize.capitalize %> Type' ),
62
+ 'update_item' => __( 'Update <%= post_type_name.singularize.capitalize %> Type' ),
63
+ 'add_new_item' => __( 'Add New <%= post_type_name.singularize.capitalize %> Type' ),
64
+ 'parent_item' => null,
65
+ 'parent_item_colon' => null,
66
+ 'search_items' => __( 'Search <%= post_type_name.pluralize.capitalize %> Types' ),
67
+ 'popular_items' => __( 'Popular <%= post_type_name.pluralize.capitalize %> Types' ),
68
+ 'separate_items_with_commas' => __( 'Separate <%= post_type_name.pluralize.capitalize %> Types with commas' ),
69
+ 'add_or_remove_items' => __( 'Add or remove <%= post_type_name.singularize %> Types' ),
70
+ 'choose_from_most_used' => __( 'Choose from the most used <%= post_type_name.singularize %> Types' ),
71
+ 'not_found' => __( 'No <%= post_type_name.pluralize.capitalize %> Types found.' ),
72
+ ),
73
+ 'hierarchical' => true,
74
+ 'show_ui' => true,
75
+ 'query_var' => true,
76
+ 'rewrite' => array(
77
+ 'slug' => '<%= post_type_name.singularize %>-type',
78
+ // 'hierarchical' => true
79
+ )
80
+ )
81
+ );
82
+ }
83
+ add_action( 'init', '<%= post_type_name.singularize %>_type_init' );
84
+
85
+ // remove_post_type_support('<%= @project[:name][0..9] %>-<%= post_type_name.pluralize %>', '');
86
+
87
+ function <%= post_type_name.pluralize %>_add_rewrite_rules($aRules) {
88
+ $aNewRules = array('<%= post_type_name.singularize %>-type/([^/]*)/?$' => 'index.php?<%= post_type_name.singularize %>-type=$matches[1]');
89
+ $aNewRules2 = array('<%= post_type_name.pluralize %>/<%= @filter_regexp %>' => 'index.php?post_type=<%= @project[:name] %>-<%= post_type_name.pluralize %><%= @filter %>');
90
+ $aNewRules1 = array('<%= post_type_name.singularize %>-type/([^/]*)/<%= @filter_regexp %>' => 'index.php?<%= post_type_name.singularize %>-type<%= @taxonomy_filter %>');
91
+ $aRules = $aNewRules + $aNewRules1 + $aNewRules2 + $aRules;
92
+ return $aRules;
93
+ }
94
+
95
+ // hook add_rewrite_rules function into rewrite_rules_array
96
+ add_filter('rewrite_rules_array', '<%= post_type_name.pluralize %>_add_rewrite_rules');
97
+
98
+ ?>
@@ -0,0 +1,21 @@
1
+ ---
2
+ :local:
3
+ :db_host: "<%= @db_host %>"
4
+ :db_user: "<%= @db_user %>"
5
+ :db_pass: "<%= @db_pass %>"
6
+ :staging:
7
+ :domain:
8
+ :db_host:
9
+ :production:
10
+ :domain:
11
+ :db_host:
12
+ :packages:
13
+ :wordpress:
14
+ :template:
15
+ - :name: mask
16
+ :location: https://github.com/micalexander/mask/archive/master.zip
17
+ :status: :disabled
18
+ :plugins:
19
+ - :name: advanced-custom-fields-pro
20
+ :location: "/Users/username/plugins"
21
+ :status: :disabled
@@ -0,0 +1,4 @@
1
+ module Swiftly
2
+ APP_NAME = 'swiftly'
3
+ VERSION = '4.0.0'
4
+ end