deplo 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +39 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/deplo.gemspec +37 -0
- data/exe/deplo +3 -0
- data/lib/deplo.rb +65 -0
- data/lib/deplo/display_file_content_to_check.rb +16 -0
- data/lib/deplo/from_command_line.rb +37 -0
- data/lib/deplo/gem.rb +170 -0
- data/lib/deplo/git.rb +63 -0
- data/lib/deplo/github.rb +43 -0
- data/lib/deplo/set_cap_consts.rb +13 -0
- data/lib/deplo/version.rb +3 -0
- data/lib/deplo/yes_no.rb +27 -0
- metadata +151 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2efe06e2d3c5220271ac41df408c17d96957cd2b
|
4
|
+
data.tar.gz: edf317693c2725ce3d49105625ea519ace1e09bd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2817ad7bee706e20b16f3e6611e77e4af4496946947d58cbbf9c5ed9c37d217d9bc110002e3690788c4749d2bf26591ba7b0d8c39acc11bc04eab95f0ae5c843
|
7
|
+
data.tar.gz: 7cfec3e4140a9ef33fed0036d2d84d0f13fee38be91e31810a5a9e2c81ec2ee4cde9c009016c44b92d58718dfef1b285d7464086c926c59cc634ab6c87ea4627
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Shu Fujita
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Deplo
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/deplo`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'deplo'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install deplo
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment. Run `bundle exec deplo` to use the code located in this directory, ignoring other installed copies of this gem.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
1. Fork it ( https://github.com/[my-github-username]/deplo/fork )
|
36
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
37
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
38
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
39
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "deplo"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/deplo.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'deplo/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "deplo"
|
8
|
+
spec.version = Deplo::VERSION
|
9
|
+
spec.authors = ["Shu Fujita"]
|
10
|
+
spec.email = ["osorubeki.fujita@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = "This gem provides short-cut for frequently-used processions as Capistrano Tasks - customized for the developer's environment"
|
13
|
+
# spec.description = %q{TODO: Write a longer description or delete this line.}
|
14
|
+
spec.homepage = "https://github.com/osorubeki-fujita/deplo"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
# if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
# else
|
22
|
+
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
# end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
31
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
+
spec.add_development_dependency "rspec"
|
33
|
+
|
34
|
+
spec.add_runtime_dependency "activesupport" , ">= 4.2.1"
|
35
|
+
spec.add_runtime_dependency "versionomy" , ">= 0.4.4"
|
36
|
+
spec.add_runtime_dependency "capistrano"
|
37
|
+
end
|
data/exe/deplo
ADDED
data/lib/deplo.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
require "deplo/version"
|
2
|
+
|
3
|
+
#--------
|
4
|
+
|
5
|
+
require "active_support"
|
6
|
+
require "active_support/core_ext"
|
7
|
+
require "versionomy"
|
8
|
+
|
9
|
+
#--------
|
10
|
+
|
11
|
+
require_relative 'deplo/set_cap_consts'
|
12
|
+
|
13
|
+
require_relative 'deplo/yes_no'
|
14
|
+
require_relative 'deplo/from_command_line'
|
15
|
+
require_relative 'deplo/display_file_content_to_check'
|
16
|
+
|
17
|
+
require_relative 'deplo/git'
|
18
|
+
require_relative 'deplo/github'
|
19
|
+
require_relative 'deplo/gem'
|
20
|
+
|
21
|
+
module Deplo
|
22
|
+
|
23
|
+
def self.process( command )
|
24
|
+
puts "=" * 64
|
25
|
+
puts ""
|
26
|
+
puts command
|
27
|
+
puts ""
|
28
|
+
yield
|
29
|
+
puts ""
|
30
|
+
puts "-" * 32 + "Complete: #{ command }"
|
31
|
+
puts ""
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.version_check( version , spec_filename )
|
35
|
+
latest_version = open( "#{ spec_filename }/../.latest_version" , "r:utf-8" ).read.chomp
|
36
|
+
::Versionomy.parse( version ) > ::Versionomy.parse( latest_version )
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.file_inclusion_check( filename , str , addition: false )
|
40
|
+
if ::File.open( filename , "r:utf-8" ).read.split( /\n/ ).include?( str )
|
41
|
+
puts "*** \"#{ str }\" is already included in \"#{ ::File.basename( filename ) }\"."
|
42
|
+
elsif addition
|
43
|
+
puts "[!] \"#{ str }\" is not included yet in \"#{ ::File.basename( filename ) }\"."
|
44
|
+
::File.open( filename , "a:utf-8" ) do |f|
|
45
|
+
f.print( "\n" * 2 )
|
46
|
+
f.print( str )
|
47
|
+
end
|
48
|
+
puts ""
|
49
|
+
puts "[!] \"#{ str }\" is added to \"#{ ::File.basename( filename ) }\"."
|
50
|
+
send( __method__ , filename , str , addition: true )
|
51
|
+
end
|
52
|
+
puts ""
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
def set_cap_tasks_from_deplo( cap_consts: true )
|
58
|
+
if cap_consts
|
59
|
+
set_cap_consts
|
60
|
+
end
|
61
|
+
|
62
|
+
set_cap_namespace_git
|
63
|
+
set_cap_namespace_github
|
64
|
+
set_cap_namespace_gem
|
65
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Deplo
|
2
|
+
|
3
|
+
def self.display_file_content_to_check( filename_to_check , *contents )
|
4
|
+
puts "-" * 64
|
5
|
+
puts ""
|
6
|
+
puts filename_to_check
|
7
|
+
puts ""
|
8
|
+
if contents.present?
|
9
|
+
contents.each do | str |
|
10
|
+
puts " " * 4 + str
|
11
|
+
end
|
12
|
+
puts ""
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
class Deplo::FromCommandLine
|
2
|
+
|
3
|
+
def initialize( title: nil , message: nil , content: nil )
|
4
|
+
raise "Error" if [ title , message ].all?( &:nil? )
|
5
|
+
@title = title
|
6
|
+
@msg = message
|
7
|
+
@content = content
|
8
|
+
@condition = false
|
9
|
+
end
|
10
|
+
|
11
|
+
def set
|
12
|
+
while !( @condition )
|
13
|
+
puts @msg
|
14
|
+
a = ::STDIN.gets.chomp
|
15
|
+
@content = a
|
16
|
+
puts message_after_input_string
|
17
|
+
@condition = ::Deplo.yes_no( @condition )
|
18
|
+
end
|
19
|
+
|
20
|
+
actual_content
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.set( *opt )
|
24
|
+
self.new( *opt ).set
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def message_after_input_string
|
30
|
+
"#{ @title }: \'#{ actual_content }\'"
|
31
|
+
end
|
32
|
+
|
33
|
+
def actual_content
|
34
|
+
@content
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
data/lib/deplo/gem.rb
ADDED
@@ -0,0 +1,170 @@
|
|
1
|
+
def set_cap_namespace_gem
|
2
|
+
|
3
|
+
namespace :gem do
|
4
|
+
|
5
|
+
desc "Gem - Test"
|
6
|
+
task :test do
|
7
|
+
::Deplo.process "gem:test" do
|
8
|
+
system( "rake spec" )
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
desc "Gem - Rake install"
|
13
|
+
task :rake_install_locally do
|
14
|
+
::Deplo.process "gem:rake_install_locally" do
|
15
|
+
system( "rake install" )
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "Gem - Update name of latest version"
|
20
|
+
task :update do
|
21
|
+
::Deplo.process "gem:update" do
|
22
|
+
latest_version_file = fetch( :latest_version_file )
|
23
|
+
::File.open( latest_version_file , "w:utf-8" ) do |f|
|
24
|
+
f.print fetch( :new_version )
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "Install Gem #{ fetch( :new_version ) }"
|
30
|
+
task install_locally: :test do
|
31
|
+
::Deplo.process "gem:install_locally" do
|
32
|
+
::Deplo.yes_no( yes: ::Proc.new {
|
33
|
+
::Rake::Task[ "git:commit_for_gem" ].invoke
|
34
|
+
::Rake::Task[ "github:push" ].invoke
|
35
|
+
::Rake::Task[ "gem:rake_install_locally" ].invoke
|
36
|
+
} )
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
desc "Release Gem #{ fetch( :new_version ) }"
|
41
|
+
task release_to_public: :install_locally do
|
42
|
+
if ::File.exist?( fetch( :latest_version_file ) )
|
43
|
+
old_version = open( fetch( :latest_version_file ) , "r:utf-8" ).read
|
44
|
+
else
|
45
|
+
old_version = nil
|
46
|
+
end
|
47
|
+
::Deplo.process "gem:release_to_public" do
|
48
|
+
::Deplo.yes_no( message: "Release Gem #{ fetch( :new_version ) }" , yes: ::Proc.new {
|
49
|
+
::Rake::Task[ "gem:update" ].invoke
|
50
|
+
system( "rake release" )
|
51
|
+
})
|
52
|
+
end
|
53
|
+
unless old_version.nil?
|
54
|
+
::Deplo.process "gem:yank_old_version" do
|
55
|
+
::Deplo.yes_no( message: "Yank Old Gem #{ old_version }" , yes: ::Proc.new {
|
56
|
+
system( "gem yank #{ fetch( :gem ) } -v #{ old_version }" )
|
57
|
+
})
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
desc "Files to check"
|
63
|
+
task :files_to_check do
|
64
|
+
|
65
|
+
#-------- xxxx.gemspec
|
66
|
+
|
67
|
+
::Deplo.display_file_content_to_check(
|
68
|
+
"#{ fetch( :gem ) }.gemspec" ,
|
69
|
+
"spec.add_development_dependency \"capistrano\"" ,
|
70
|
+
"spec.add_development_dependency \"deplo\", \">= #{ ::Deplo::VERSION }\""
|
71
|
+
)
|
72
|
+
|
73
|
+
#-------- lib/xxxx/version.rb
|
74
|
+
|
75
|
+
|
76
|
+
::Deplo.display_file_content_to_check(
|
77
|
+
"lib/#{ fetch( :gem ) }/version.rb" ,
|
78
|
+
"module #{ fetch( :gem ).capitalize }" ,
|
79
|
+
" VERSION = ::File.open( \"\#\{ ::File.dirname( __FILE__ ) \}/../../.current_version\" , \"r:utf-8\" ).read.chomp" ,
|
80
|
+
"end"
|
81
|
+
)
|
82
|
+
|
83
|
+
#-------- spec/xxxx_spec.rb
|
84
|
+
|
85
|
+
::Deplo.display_file_content_to_check(
|
86
|
+
"spec/#{ fetch( :gem ) }_spec.rb" ,
|
87
|
+
"require \'spec_helper\'" ,
|
88
|
+
"require \'deplo\'" ,
|
89
|
+
"" ,
|
90
|
+
"spec_filename = ::File.expand_path( ::File.dirname( __FILE__ ) )" ,
|
91
|
+
"version = ::File.open( \"\#\{ ::File.dirname( __FILE__ ) \}/..\/.current_version\" , \"r:utf-8\" ).read.chomp" ,
|
92
|
+
"" ,
|
93
|
+
"describe #{ fetch( :gem ).camelize } do" ,
|
94
|
+
" it \"has a version number \\\'\#\{ version \}\\\'\" do" ,
|
95
|
+
" expect( ::Deplo.version_check( ::#{ fetch( :gem ).camelize }::VERSION , spec_filename ) ).to eq( true )" ,
|
96
|
+
" end"
|
97
|
+
)
|
98
|
+
|
99
|
+
#-------- Capfile (1)
|
100
|
+
|
101
|
+
::Deplo.display_file_content_to_check(
|
102
|
+
"Capfile" ,
|
103
|
+
#
|
104
|
+
"\# Load DSL and set up stages" ,
|
105
|
+
"require \'capistrano/setup\'" ,
|
106
|
+
"" ,
|
107
|
+
"\# Include default deployment tasks" ,
|
108
|
+
"require \'capistrano/deploy\'" ,
|
109
|
+
"" ,
|
110
|
+
"require \'deplo\'"
|
111
|
+
)
|
112
|
+
|
113
|
+
#-------- Capfile (2)
|
114
|
+
|
115
|
+
::Deplo.display_file_content_to_check(
|
116
|
+
"Capfile" ,
|
117
|
+
#
|
118
|
+
"Rake::Task[:production].invoke" ,
|
119
|
+
"invoke :production" ,
|
120
|
+
"set_cap_tasks_from_deplo"
|
121
|
+
)
|
122
|
+
|
123
|
+
#-------- .gitignore
|
124
|
+
|
125
|
+
gitignore_filename = ::File.expand_path( "#{ fetch( :pj_dir ) }/.gitignore" )
|
126
|
+
latest_version_setting_in_gitignore = "/.latest_version"
|
127
|
+
|
128
|
+
::Deplo.display_file_content_to_check(
|
129
|
+
".gitignore" ,
|
130
|
+
latest_version_setting_in_gitignore
|
131
|
+
)
|
132
|
+
|
133
|
+
::Deplo.file_inclusion_check( gitignore_filename , latest_version_setting_in_gitignore , addition: true )
|
134
|
+
|
135
|
+
#-------- version.rb
|
136
|
+
|
137
|
+
::Deplo.display_file_content_to_check( "lib/#{ fetch( :gem ) }/version.rb" )
|
138
|
+
|
139
|
+
#-------- config/deploy.rb
|
140
|
+
|
141
|
+
::Deplo.display_file_content_to_check( "config/deploy.rb" )
|
142
|
+
in_file = ::File.open( "#{ fetch( :pj_dir ) }/config/deploy.rb" ).read.split( /\n/ )
|
143
|
+
regexps = [
|
144
|
+
/\Aset \:application/ ,
|
145
|
+
/\Aset \:repo_url/ ,
|
146
|
+
/\Aset \:pj_dir/ ,
|
147
|
+
/\Aset \:github_remote_name/ ,
|
148
|
+
/\Aset \:deploy_to ?, \'\/\'/
|
149
|
+
]
|
150
|
+
|
151
|
+
condition = regexps.all? { | regexp |
|
152
|
+
included_in_file = in_file.any? { | row | regexp === row }
|
153
|
+
unless included_in_file
|
154
|
+
puts "No row matched with #{ regexp.to_s }"
|
155
|
+
end
|
156
|
+
|
157
|
+
included_in_file
|
158
|
+
}
|
159
|
+
puts ""
|
160
|
+
|
161
|
+
if condition
|
162
|
+
puts "*** All Capistrano constants are set. (maybe each constant itself is not valid)"
|
163
|
+
else
|
164
|
+
puts "[!] Some Capistrano constants are not set."
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
end
|
169
|
+
|
170
|
+
end
|
data/lib/deplo/git.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
class Deplo::TitleForGitCommit < Deplo::FromCommandLine
|
2
|
+
|
3
|
+
def initialize( gem_version: nil )
|
4
|
+
super( title: "Title for \'git commit\'" , message: "Please input title for commitment" )
|
5
|
+
@gem_version = gem_version
|
6
|
+
@time_now = ::Time.now.strftime( "%Y%m%d_%H%M%S" )
|
7
|
+
end
|
8
|
+
|
9
|
+
def set
|
10
|
+
if @gem_version.present?
|
11
|
+
@content = "Install Gem (#{ @gem_version })"
|
12
|
+
@condition = ::Deplo.yes_no( message: message_after_input_string ) # ( @condition )
|
13
|
+
super
|
14
|
+
else
|
15
|
+
super
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def actual_content
|
22
|
+
"#{ @time_now } #{ @content }"
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
def set_cap_namespace_git
|
28
|
+
|
29
|
+
namespace :git do
|
30
|
+
|
31
|
+
desc 'add to git all files under this directory'
|
32
|
+
task :add do
|
33
|
+
::Deplo.process "git:add" do
|
34
|
+
system "git add -A ."
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
desc 'commit to git'
|
39
|
+
task commit: :add do
|
40
|
+
::Deplo.process "git:commit" do
|
41
|
+
system "git commit -m \"#{ ::Deplo::TitleForGitCommit.set }\""
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
desc 'commit to git (amend)'
|
46
|
+
task :commit_amend do
|
47
|
+
::Deplo.process "git:commit_amend" do
|
48
|
+
system "git commit --amend -m \"#{ ::Deplo::TitleForGitCommit.set }\""
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
desc 'commit to git (for Gem install or release)'
|
53
|
+
task commit_for_gem: :add do
|
54
|
+
::Deplo.process "git:commit_for_gem" do
|
55
|
+
gem_v = fetch( :new_version )
|
56
|
+
t = ::Deplo::TitleForGitCommit.set( gem_version: gem_v )
|
57
|
+
system "git commit -m \"#{t}\""
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
data/lib/deplo/github.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
class Deplo::BranchNameForGithub < Deplo::FromCommandLine
|
2
|
+
|
3
|
+
def initialize
|
4
|
+
super( title: "Git Branch" , message: "Please input name of branch" , content: "master" )
|
5
|
+
end
|
6
|
+
|
7
|
+
def set
|
8
|
+
while !( @condition )
|
9
|
+
if @content == "master"
|
10
|
+
@condition = ::Deplo.yes_no( @condition , no: ::Proc.new { @content = nil } , message: "Use branch \'master\'" )
|
11
|
+
else
|
12
|
+
super
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
def set_cap_namespace_github
|
20
|
+
|
21
|
+
namespace :github do
|
22
|
+
|
23
|
+
desc 'push to github'
|
24
|
+
task :push do
|
25
|
+
::Deplo.process "github:push" do
|
26
|
+
github_remote_name = fetch( :github_remote_name )
|
27
|
+
branch_name = ::Deplo::BranchNameForGithub.set
|
28
|
+
system "git push #{ github_remote_name } #{ branch_name }"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
desc 'pull from github'
|
33
|
+
task :pull do
|
34
|
+
::Deplo.process "github:pull" do
|
35
|
+
github_remote_name = fetch( :github_remote_name )
|
36
|
+
branch_name = ::Deplo::BranchNameForGithub.set
|
37
|
+
system "git push #{ github_remote_name } #{ branch_name }"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
def set_cap_consts
|
2
|
+
set :gem , fetch( :application ).to_s.gsub( /\Agem_/ , "" )
|
3
|
+
set :latest_version_file , ::File.expand_path( "#{ fetch( :pj_dir ) }/.latest_version" )
|
4
|
+
|
5
|
+
# Version of Gem
|
6
|
+
dirname = [ fetch( :pj_dir ) , :lib , fetch( :gem ).gsub( /::/ , "_" ) ].map( &:to_s ).join( "/" )
|
7
|
+
require "#{ dirname }/version.rb"
|
8
|
+
|
9
|
+
namespace = fetch( :gem ).to_s.split( "::" ).map( &:camelize ).join( "::" )
|
10
|
+
set :new_version , eval( "#{ namespace }::VERSION" )
|
11
|
+
|
12
|
+
require "#{ ::File.dirname( __FILE__ ) }/version.rb"
|
13
|
+
end
|
data/lib/deplo/yes_no.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
module Deplo
|
2
|
+
|
3
|
+
def self.yes_no( condition = nil , message: nil , yes: nil , no: nil )
|
4
|
+
if message.present?
|
5
|
+
puts message
|
6
|
+
end
|
7
|
+
puts "OK? [Yn]"
|
8
|
+
yn = ::STDIN.gets.chomp
|
9
|
+
condition ||= false
|
10
|
+
|
11
|
+
case yn.downcase
|
12
|
+
when "y"
|
13
|
+
condition = true
|
14
|
+
if yes.present?
|
15
|
+
yes.call
|
16
|
+
end
|
17
|
+
when "n"
|
18
|
+
if no.present?
|
19
|
+
no.call
|
20
|
+
end
|
21
|
+
else
|
22
|
+
return yes_no( condition , yes: yes , no: no )
|
23
|
+
end
|
24
|
+
return condition
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: deplo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Shu Fujita
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-07-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: activesupport
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 4.2.1
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 4.2.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: versionomy
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.4.4
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.4.4
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: capistrano
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description:
|
98
|
+
email:
|
99
|
+
- osorubeki.fujita@gmail.com
|
100
|
+
executables:
|
101
|
+
- deplo
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".gitignore"
|
106
|
+
- ".rspec"
|
107
|
+
- ".travis.yml"
|
108
|
+
- Gemfile
|
109
|
+
- LICENSE
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- bin/console
|
113
|
+
- bin/setup
|
114
|
+
- deplo.gemspec
|
115
|
+
- exe/deplo
|
116
|
+
- lib/deplo.rb
|
117
|
+
- lib/deplo/display_file_content_to_check.rb
|
118
|
+
- lib/deplo/from_command_line.rb
|
119
|
+
- lib/deplo/gem.rb
|
120
|
+
- lib/deplo/git.rb
|
121
|
+
- lib/deplo/github.rb
|
122
|
+
- lib/deplo/set_cap_consts.rb
|
123
|
+
- lib/deplo/version.rb
|
124
|
+
- lib/deplo/yes_no.rb
|
125
|
+
homepage: https://github.com/osorubeki-fujita/deplo
|
126
|
+
licenses:
|
127
|
+
- MIT
|
128
|
+
metadata: {}
|
129
|
+
post_install_message:
|
130
|
+
rdoc_options: []
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
requirements: []
|
144
|
+
rubyforge_project:
|
145
|
+
rubygems_version: 2.2.3
|
146
|
+
signing_key:
|
147
|
+
specification_version: 4
|
148
|
+
summary: This gem provides short-cut for frequently-used processions as Capistrano
|
149
|
+
Tasks - customized for the developer's environment
|
150
|
+
test_files: []
|
151
|
+
has_rdoc:
|