weapon 0.0.7 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/support/create_gem/basic.bin +5 -0
- data/lib/support/create_gem/basic.gemspec +14 -0
- data/lib/support/create_gem/basic.rb +5 -0
- data/lib/weapon.rb +66 -12
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d135d41cb66b61ac9a95892619b24ba26c128ea5
|
4
|
+
data.tar.gz: 8f46284f2c05f2486fcff62df0ae75c24e9742b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb1fb80986a8a0a127742f495fe3d14e2cbf9bf5982e77f34ddfa9aee348bed7d397596487d721c3dc8433682af92a4c9acb37f89f40fd734fdfff132da387d3
|
7
|
+
data.tar.gz: 7e6219c63a6687a35f2b9b4381dc57e748afd00d643c7c93cb930d5da8e0a7a24922967ac3012ae7576c6b0e5122c627117c0958211c45ab59d089c608b3b967
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "gem_name_for_replace"
|
3
|
+
s.version = "0.0.1"
|
4
|
+
s.date = "date_for_replace"
|
5
|
+
s.summary = "summary_for_replace"
|
6
|
+
s.description = "description_for_replace"
|
7
|
+
s.authors = ["author_for_replace"]
|
8
|
+
s.email = "email_for_replace"
|
9
|
+
s.files = Dir["libfile_for_replace"]
|
10
|
+
s.homepage = "homepage_for_replace"
|
11
|
+
s.license = "MIT"
|
12
|
+
|
13
|
+
s.executables << 'gem_name_for_replace'
|
14
|
+
end
|
data/lib/weapon.rb
CHANGED
@@ -2,6 +2,7 @@ require 'thor'
|
|
2
2
|
require 'awesome_print'
|
3
3
|
require 'rails'
|
4
4
|
require 'rails/generators/actions'
|
5
|
+
require 'fileutils'
|
5
6
|
|
6
7
|
class Weapon < Thor
|
7
8
|
include Thor::Actions
|
@@ -12,13 +13,11 @@ class Weapon < Thor
|
|
12
13
|
end
|
13
14
|
|
14
15
|
no_commands do
|
15
|
-
def makesure_in_git
|
16
|
+
def makesure_in_git(dir=".")
|
16
17
|
#run "spring stop"
|
17
|
-
unless (run "git remote -v")
|
18
|
+
unless (run "cd #{dir}; git remote -v")
|
18
19
|
puts "this project should in version controll use git"
|
19
|
-
run "git init"
|
20
|
-
run "git add *"
|
21
|
-
run "git commit -a -m 'commit by seaify/weapon'"
|
20
|
+
run "cd #{dir}; git init; git add *; git commit -a -m 'commit by seaify/weapon'"
|
22
21
|
end
|
23
22
|
end
|
24
23
|
|
@@ -56,7 +55,7 @@ class Weapon < Thor
|
|
56
55
|
puts "setup mina deploy"
|
57
56
|
copy_file 'support/mina_unicorn/deploy.rb', 'config/deploy.rb'
|
58
57
|
|
59
|
-
gsub_file "config/deploy.rb", "
|
58
|
+
gsub_file "config/deploy.rb", "app_name_for_replace", app_name
|
60
59
|
|
61
60
|
username = ask("input your user name on deploy host:")
|
62
61
|
gsub_file "config/deploy.rb", "user_name_fore_replace", username
|
@@ -79,6 +78,7 @@ class Weapon < Thor
|
|
79
78
|
run 'scp config/database.yml ' + username + '@' + domain + ':' + directory + '/shared/config/'
|
80
79
|
run 'scp unicorn-nginx.conf ' + username + '@' + domain + ':' + '/etc/nginx/sites-enabled/#{app_name}.conf'
|
81
80
|
run 'mina deploy'
|
81
|
+
puts "remember to restart nginx server"
|
82
82
|
end
|
83
83
|
|
84
84
|
desc "setup_settings_ui", "setup settings ui"
|
@@ -126,12 +126,11 @@ class Weapon < Thor
|
|
126
126
|
end
|
127
127
|
|
128
128
|
desc "push_to_github", "push to github"
|
129
|
-
def push_to_github
|
130
|
-
|
129
|
+
def push_to_github(dir_name='.')
|
130
|
+
repo_name = (dir_name == '.')? File.basename(Dir.getwd): dir_name
|
131
|
+
makesure_in_git(dir_name)
|
131
132
|
puts "pull to github"
|
132
|
-
run
|
133
|
-
run "hub create #{File.basename(Dir.getwd)}"
|
134
|
-
run "hub push -u origin master"
|
133
|
+
run "cd #{dir_name}; gem install hub;hub create #{repo_name}; hub push -u origin master"
|
135
134
|
end
|
136
135
|
|
137
136
|
desc "for_seaify", "only for seaify personal use, combine of other commands act as rails application template"
|
@@ -146,6 +145,7 @@ class Weapon < Thor
|
|
146
145
|
|
147
146
|
desc "install_must_gems", "install must need gems like guard, guard-livereload, guard-rspec..."
|
148
147
|
def install_must_gems
|
148
|
+
|
149
149
|
makesure_in_git
|
150
150
|
|
151
151
|
gem 'enumerize'
|
@@ -220,12 +220,66 @@ class Weapon < Thor
|
|
220
220
|
"config.generators.template_engine = :slim"
|
221
221
|
end
|
222
222
|
|
223
|
+
gsub_file 'Gemfile', "gem 'byebug'", ''
|
223
224
|
run "bundle"
|
224
225
|
run "guard init"
|
226
|
+
generate "rspec:install"
|
227
|
+
generate "simple_form:install"
|
228
|
+
|
229
|
+
run "git add lib/ spec/ config Guardfile .rspec .gitignore"
|
230
|
+
run "git commit -a --amend --no-edit"
|
231
|
+
|
232
|
+
end
|
233
|
+
|
234
|
+
desc "create_gem", "create basic gem information"
|
235
|
+
def create_gem(name)
|
236
|
+
FileUtils.mkdir_p "lib"
|
237
|
+
FileUtils.mkdir_p "bin"
|
238
|
+
|
239
|
+
gemspec_file = "#{name}/#{name}.gemspec"
|
240
|
+
copy_file "support/create_gem/basic.gemspec", gemspec_file
|
241
|
+
gsub_file gemspec_file, "gem_name_for_replace", name
|
242
|
+
gsub_file gemspec_file, "date_for_replace", Time.now.strftime("%Y-%m-%d")
|
243
|
+
gsub_file gemspec_file, "libfile_for_replace", "lib/#{name}.rb"
|
244
|
+
|
245
|
+
summary = ask("input summary for this gem")
|
246
|
+
gsub_file gemspec_file, "summary_for_replace", summary
|
247
|
+
|
248
|
+
description = ask("input description for this gem")
|
249
|
+
gsub_file gemspec_file, "description_for_replace", description
|
250
|
+
|
251
|
+
author = ask("input name as author for this gem")
|
252
|
+
gsub_file gemspec_file, "author_for_replace", author
|
253
|
+
|
254
|
+
email = ask("input email for this gem")
|
255
|
+
gsub_file gemspec_file, "email_for_replace", email
|
256
|
+
|
257
|
+
|
258
|
+
libfile = "#{name}/lib/#{name}.rb"
|
259
|
+
copy_file "support/create_gem/basic.rb", libfile
|
260
|
+
gsub_file libfile, "gem_name_for_replace", name.camelize
|
261
|
+
|
262
|
+
|
263
|
+
binfile = "#{name}/bin/#{name}"
|
264
|
+
copy_file "support/create_gem/basic.bin", binfile
|
265
|
+
run "chmod +x #{binfile}"
|
266
|
+
|
267
|
+
gsub_file binfile, "gem_name_for_replace", name
|
268
|
+
gsub_file binfile, "Gem_name_for_replace", name.camelize
|
269
|
+
|
270
|
+
makesure_in_git(name)
|
271
|
+
invoke :push_to_github, name
|
225
272
|
|
226
|
-
|
273
|
+
s = `cd #{name};git remote -v`.split(' ')[1]
|
274
|
+
homepage = 'https://github.com/' + s.split('/')[0].split(':')[-1] + '/' + s.split('/')[1].split('.')[0]
|
275
|
+
ap homepage
|
276
|
+
gsub_file gemspec_file, "homepage_for_replace", homepage
|
227
277
|
|
278
|
+
run "cd #{name};git commit -a --amend --no-edit"
|
228
279
|
|
280
|
+
command = "cd #{name};gem build #{name}.gemspec; gem push #{name}-0.0.1.gem"
|
281
|
+
ap command
|
282
|
+
run command
|
229
283
|
end
|
230
284
|
|
231
285
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: weapon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chuck.lei
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -75,6 +75,9 @@ extensions: []
|
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
77
|
- bin/weapon
|
78
|
+
- lib/support/create_gem/basic.bin
|
79
|
+
- lib/support/create_gem/basic.gemspec
|
80
|
+
- lib/support/create_gem/basic.rb
|
78
81
|
- lib/support/custom_i18n/_form.html.slim
|
79
82
|
- lib/support/custom_i18n/controller.rb
|
80
83
|
- lib/support/custom_i18n/edit.html.slim
|