weapon 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/weapon.rb +28 -25
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cbb48909536dc3a3318516c7b602448b78b7215e
4
- data.tar.gz: 18524a55d5703272972842ebd49fec2a6d620d50
3
+ metadata.gz: fea6c2404fdb5d642557f968cce45b233c2a0648
4
+ data.tar.gz: b7804c55f63137bcaff47d9624d2915d3f0d6763
5
5
  SHA512:
6
- metadata.gz: 5e06e4e03473ee62432d5a802d79d545aae66a7aeb6b70105587a8eff1a5b9e04e07b2bd71de11ecf275a1a335d2a1852bcc00b8d0cdc51093f0d8496690757f
7
- data.tar.gz: 9260271d0c29c2e43889e3e61336041b39743d568b9e2c5e143055df912cf53ff81f472a285e42db1c5c91793df5ce259bdd8a02c78930e5622e17285de55983
6
+ metadata.gz: 2249aea23c0d36d712c49baae468cfff60b97f72e4a32ccf6d0866ccb5b7a454429651c7f2dbdb0bc62957d4031dee1d987d9ab779ca925b6b81ae97d5d7355a
7
+ data.tar.gz: 53eb483388d689b35de8b84c37dd744295ce254265c57a8ffe89628bbb11b3e5b274f7b3485d634b1cddaf867be1540873c4e9684b5e32a2d0d06ea795c25346
data/lib/weapon.rb CHANGED
@@ -8,20 +8,32 @@ class Weapon < Thor
8
8
  File.dirname(__FILE__)
9
9
  end
10
10
 
11
- desc "makesure_in_git", "makesure all the files is in git version control"
12
- def makesure_in_git
13
- run "spring stop"
14
- unless (run "git remote -v")
15
- puts "this project should in version controll use git"
16
- run "git init"
17
- run "git add *"
18
- run "git commit -a -m 'first commit'"
11
+ no_commands do
12
+ def makesure_in_git
13
+ #run "spring stop"
14
+ unless (run "git remote -v")
15
+ puts "this project should in version controll use git"
16
+ run "git init"
17
+ run "git add *"
18
+ run "git commit -a -m 'first commit'"
19
+ end
19
20
  end
21
+
22
+ def config_bootstrap
23
+ File.open("Gemfile", "a").write("\ngem 'bootstrap-sass'")
24
+ run "bundle"
25
+ #config bootstrap stylesheets
26
+ File.open('app/assets/javascripts/application.js', 'a') { |f| f.write("\n//= require bootstrap-sprockets")}
27
+ File.open('app/assets/stylesheets/application.scss', 'a') { |f| f.write("\n@import 'bootstrap-sprockets';\n@import 'bootstrap';") }
28
+ run "rm app/assets/stylesheets/application.css"
29
+ end
30
+
20
31
  end
21
32
 
33
+
22
34
  desc "setup_mina_deploy", "setup mina deploy"
23
35
  def setup_mina_deploy
24
- invoke :makesure_in_git
36
+ makesure_in_git
25
37
  puts "setup mina deploy"
26
38
  run "mina init"
27
39
  username = ask("input your user name on deploy host:")
@@ -32,8 +44,9 @@ class Weapon < Thor
32
44
  directory = directory.gsub(/\/$/, "")
33
45
  gsub_file "config/deploy.rb", "/var/www/foobar.com", directory
34
46
 
35
- repository = ask("input your git remote url to pull from, like git@github.com:seaify/weapon.git ")
36
- gsub_file "config/deploy.rb", "git://...", repository
47
+ default_repo = `git remote -v`.split(' ')[1]
48
+ repository = ask("input your git remote url to pull from, default #{default_repo} ")
49
+ gsub_file "config/deploy.rb", "git://...", (repository != "")?repository: default_repo
37
50
 
38
51
  setup_dir_command = 'ssh ' + username + '@' + domain + " -t 'mkdir -p " + directory + ';chown -R ' + username + ' ' + directory + "'"
39
52
  run setup_dir_command
@@ -45,7 +58,7 @@ class Weapon < Thor
45
58
 
46
59
  desc "setup_settings_ui", "setup settings ui"
47
60
  def setup_settings_ui
48
- invoke :makesure_in_git
61
+ makesure_in_git
49
62
  #inject_into_file "Gemfile", "gem 'rails-settings-ui', '~> 0.3.0'\n gem 'rails-settings-cached', '0.4.1'\n", :before => /^end/
50
63
  File.open("Gemfile", "a").write("\ngem 'rails-settings-ui', '~> 0.3.0'\n gem 'rails-settings-cached', '0.4.1'\n")
51
64
  run "bundle"
@@ -58,7 +71,7 @@ class Weapon < Thor
58
71
 
59
72
  desc "custom_i18n", "custom i18n and use slim as template engine, use simple_form, currently write to zh-CN.yml"
60
73
  def custom_i18n
61
- invoke :makesure_in_git
74
+ makesure_in_git
62
75
  puts "custom i18n"
63
76
  File.open("Gemfile", "a").write("\ngem 'slim-rails'\ngem 'simple_form', '~> 3.1.0'")
64
77
  run "bundle"
@@ -67,7 +80,7 @@ class Weapon < Thor
67
80
  copy_file 'support/custom_i18n/zh-CN.yml', 'config/locales/zh-CN.yml'
68
81
  end
69
82
 
70
- invoke :config_bootstrap
83
+ config_bootstrap
71
84
  run "rails g simple_form:install --bootstrap"
72
85
  copy_file 'support/custom_i18n/_form.html.slim', 'lib/templates/slim/scaffold/_form.html.slim'
73
86
  copy_file 'support/custom_i18n/index.html.slim', 'lib/templates/slim/scaffold/index.html.slim'
@@ -87,19 +100,9 @@ class Weapon < Thor
87
100
  run "rails g simple_form:install --bootstrap"
88
101
  end
89
102
 
90
- desc "config_bootstrap", "config bootstrap, example, used for simmple_form"
91
- def config_bootstrap
92
- File.open("Gemfile", "a").write("\ngem 'bootstrap-sass'")
93
- run "bundle"
94
- #config bootstrap stylesheets
95
- File.open('app/assets/javascripts/application.js', 'a') { |f| f.write("\n//= require bootstrap-sprockets")}
96
- File.open('app/assets/stylesheets/application.scss', 'a') { |f| f.write("\n@import 'bootstrap-sprockets';\n@import 'bootstrap';") }
97
- run "rm app/assets/stylesheets/application.css"
98
- end
99
-
100
103
  desc "push_to_github", "push to github"
101
104
  def push_to_github
102
- invoke :makesure_in_git
105
+ makesure_in_git
103
106
  puts "pull to github"
104
107
  run 'gem install hub'
105
108
  run "hub create #{File.basename(Dir.getwd)}"
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
4
+ version: 0.0.5
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-07-15 00:00:00.000000000 Z
11
+ date: 2015-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec