capistrano_api_docs_external_git 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d2666f91d3e3a714f9282d23f5abda70ac6e6748
4
+ data.tar.gz: e85060dbc9aba916d450ef9545815e25590037d9
5
+ SHA512:
6
+ metadata.gz: 2c98d166acaa3837576d047cfcdf4ace00512c141b5caf301c6f071be8253bc438f4f914afa09e1a787f3214b5feb72895beae3350f68767a1dbfa17e625eedc
7
+ data.tar.gz: 2a76fdb0fbc8e10e55cf2f9476fb3230493384f62a7cd72852dfaca49b8001d24ecc7691614b1701d7611430ba67e3a1cec0da305cb62c11b3aef89a49312924
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano_api_docs_external_git.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,19 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ capistrano_api_docs_external_git (1.0.0)
5
+ git
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ git (1.2.8)
11
+ rake (10.4.0)
12
+
13
+ PLATFORMS
14
+ ruby
15
+
16
+ DEPENDENCIES
17
+ bundler (~> 1.7)
18
+ capistrano_api_docs_external_git!
19
+ rake (~> 10.0)
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Guilherme Pereira
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,65 @@
1
+ capistranoApiDocsExternalGit
2
+ =================
3
+
4
+ Add tasks to capistrano to a Rails project to work with gem api_docs.
5
+ It only works with capistrano 3. Older versions until 0.3 works with capistrano 2.
6
+
7
+ Currently
8
+
9
+ * Add documentation files to git
10
+ * Clone documentation repository to tmp folder
11
+ * Copy documentation files from local respository to documentation repository
12
+ * Remove temporary documentation repository
13
+
14
+ Feel free to fork and to add new tasks.
15
+
16
+ Install
17
+ =======
18
+
19
+ Add it as a gem:
20
+
21
+ ```ruby
22
+ gem "capistrano_api_docs_external_git"
23
+ ```
24
+
25
+ Change your Capfile:
26
+
27
+ ```ruby
28
+ require 'capistrano/api_docs_external_git'
29
+ ```
30
+
31
+ Add if you want change any of this options on your config/deploy.rb:
32
+ ```ruby
33
+ # This one is required
34
+ # Set Your destination git repository e.g. (git@github.com:guiferrpereira/api-docs.git)
35
+ set :doc_git_repository, nil
36
+
37
+ # Optionals
38
+ # Set Your destination repository name e.g. "api-docs"
39
+ set :doc_repository_name, "api-docs"
40
+ # Rails Application root folder
41
+ set :rails_root, Pathname.new(Dir.pwd)
42
+ # Temporary folder where you want save git repository temporary
43
+ set :rails_root_tmp_path, fetch(:rails_root).join("tmp")
44
+ # You should set with ApiDocs.config.docs_path
45
+ set :api_docs_path, fetch(:rails_root).join("doc", "api")
46
+ ```
47
+
48
+ Available tasks
49
+ ===============
50
+
51
+ cap api_docs_external_git:add_files_git # Add files to documentation git
52
+ cap api_docs_external_git:clone_repo # Clone documentation repository to tmp folder
53
+ cap api_docs_external_git:copy_files # Copy documentation files from local respository to documentation repository
54
+ cap api_docs_external_git:remove_files # Remove documentation repository
55
+
56
+ Example
57
+ =======
58
+
59
+ By default will run after your deploy is finished
60
+
61
+ TODO
62
+ ====
63
+ * Add tests
64
+
65
+ Copyright (c) 2014 [Guilherme Pereira - NDrive], released under the MIT license
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "capistrano_api_docs_external_git"
7
+ spec.version = "1.0.0"
8
+ spec.authors = ["Guilherme Pereira"]
9
+ spec.email = ["guilherme.pereira@ndrive.com"]
10
+ spec.summary = %q{Add tasks to capistrano to a Rails project to work with gem api_docs.}
11
+ spec.description = %q{Add tasks to capistrano to a Rails project to work with gem api_docs, and send files remotely to other git repository}
12
+ spec.homepage = ""
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency 'git', "~> 1.2"
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.7"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ end
@@ -0,0 +1,3 @@
1
+ require 'git'
2
+
3
+ load File.expand_path('../tasks/api_docs_external_git.rb', __FILE__)
@@ -0,0 +1,56 @@
1
+ namespace :api_docs_external_git do
2
+
3
+ set :doc_git_repository, nil
4
+ set :doc_repository_name, "api-docs"
5
+ set :rails_root, Pathname.new(Dir.pwd)
6
+ set :rails_root_tmp_path, fetch(:rails_root).join("tmp")
7
+ # You should set with ApiDocs.config.docs_path
8
+ set :api_docs_path, fetch(:rails_root).join("doc", "api")
9
+
10
+ task :setup do
11
+ puts "**********************************"
12
+ puts "Updating API Documentation"
13
+ puts "**********************************"
14
+
15
+ invoke :'api_docs_external_git:clone_repo'
16
+ invoke :'api_docs_external_git:copy_files'
17
+ invoke :'api_docs_external_git:add_files_git'
18
+ invoke :'api_docs_external_git:raise_exception'
19
+ end
20
+
21
+ desc 'Clone documentation repository to tmp folder'
22
+ task :clone_repo do
23
+ puts "Cloning #{fetch(:doc_git_repository).to_s} for temporary folder"
24
+ @git_repo = Git.clone(fetch(:doc_git_repository), fetch(:doc_repository_name), path: fetch(:rails_root_tmp_path))
25
+ end
26
+
27
+ desc 'Copy documentation files from local respository to documentation repository'
28
+ task :copy_files do
29
+ files = Dir.glob(fetch(:api_docs_path).join('*.{yml,md}'))
30
+ destination_folder = fetch(:rails_root_tmp_path).join(fetch(:doc_repository_name), fetch(:api_docs_path).relative_path_from(fetch(:rails_root)))
31
+
32
+ puts "Copying documentation files"
33
+ FileUtils.cp_r files, destination_folder
34
+ end
35
+
36
+ desc 'Remove documentation repository'
37
+ task :remove_files do
38
+ puts "Removing documentation repository"
39
+ FileUtils.rm_r fetch(:rails_root_tmp_path).join(fetch(:doc_repository_name))
40
+ end
41
+
42
+ desc 'Add files to documentation git'
43
+ task :add_files_git do
44
+ puts "Saving documentation files on git repository"
45
+ @git_repo.add(all: true)
46
+ begin
47
+ @git_repo.commit_all('Automatic add documentation')
48
+ @git_repo.push
49
+ rescue Git::GitExecuteError => e
50
+ invoke :'api_docs_external_git:remove_files'
51
+ raise e unless e.message.include?("nothing to commit")
52
+ end
53
+ end
54
+
55
+ before 'deploy:finishing', 'api_docs_external_git:setup'
56
+ end
File without changes
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano_api_docs_external_git
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Guilherme Pereira
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: git
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.7'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description: Add tasks to capistrano to a Rails project to work with gem api_docs,
56
+ and send files remotely to other git repository
57
+ email:
58
+ - guilherme.pereira@ndrive.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - Gemfile
64
+ - Gemfile.lock
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - capistrano_api_docs_external_git.gemspec
69
+ - lib/capistrano/api_docs_external_git.rb
70
+ - lib/capistrano/tasks/api_docs_external_git.rb
71
+ - lib/capistrano_api_docs_external_git.rb
72
+ homepage: ''
73
+ licenses:
74
+ - MIT
75
+ metadata: {}
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubyforge_project:
92
+ rubygems_version: 2.4.3
93
+ signing_key:
94
+ specification_version: 4
95
+ summary: Add tasks to capistrano to a Rails project to work with gem api_docs.
96
+ test_files: []