simrb 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f7878b2a1a7e363b08799171e6153e01aba6f50b
4
- data.tar.gz: e1c2104346c1b3b1ab527d29ce9dbfec531235e2
3
+ metadata.gz: a8e46048a5b380a679834372b2ca0fb4eb730c4a
4
+ data.tar.gz: 61d9324ba18be93ac0c7f64b5dc11ffbdfa64502
5
5
  SHA512:
6
- metadata.gz: 82258cd78ad586d504d984e473405f8d53094766967ad499d4ffdd509807a27a07bf93beb9766505b572b845f8eaea3fe8305990b3d4f9a7b4608e92d22445af
7
- data.tar.gz: 11796bc82ccc3d168e5cf35d511f5e6d544f9a811e5a9c6ee3d1c10a75c889d48d7b6d4eb988f972841357e21b2971fb07cdce65be2ec436f3bc800ccd827397
6
+ metadata.gz: ca52c0213a0456e04945da015492091c5e88be3a77c2e05adcc177b314f3f9b12f653dfce9c637d6a8b09dd02d1a052fc377c42100002c50cf078ceceb22fb69
7
+ data.tar.gz: 954cb84511891f77826c011e699acbccb87ebdec9c6fbebeec9b326aefe324dc047279a28dc596a317f79bbbc345d16fc982c2038b54ffa39e748de6842a6d2a
@@ -61,7 +61,9 @@ module Simrb
61
61
 
62
62
  # initialize config file
63
63
  data = File.read(File.dirname(__FILE__) + Scfg[:name_overwrite])
64
+ data << "\nScfg[:created]\t\t\t= '#{Time.now}'"
64
65
  data << "\nScfg[:key]\t\t\t\t= '#{Simrb.random(16)}'\n"
66
+
65
67
  Simrb.path_write(Scfg[:name], data)
66
68
 
67
69
  # create module if it is given,
@@ -131,64 +133,65 @@ module Simrb
131
133
  puts "Initializing module completed"
132
134
  end
133
135
 
134
- # get a module from remote repository to local
135
- # autually, this is a clone method of git
136
- #
137
- # == Example
136
+ # pull module or repository from remote
138
137
  #
139
- # $ simrb get system
140
138
  #
141
- # or, more than one at same time
139
+ # == Example 01, pull out the module
140
+ #
141
+ # $ simrb get simrb/www
142
142
  #
143
- # $ simrb get system test
143
+ # or, more than one at the same time
144
144
  #
145
- def get args
146
- Simrb.root_dir_force
147
-
148
- repo_dir = Simrb.addslash(Spath[:repo_dirs][0] + Spath[:repo_mods])
149
- Simrb.path_write repo_dir
150
-
151
- args.each do | name |
152
- if Smods.keys.include? name
153
- puts "The module #{name} is existing at local repository, hasn't got from remote"
154
- else
155
- path = "#{Scfg[:source]}#{name}.git"
156
- local = "#{repo_dir}#{name}"
157
- system("git clone #{path} #{local}")
158
- end
159
- end
160
-
161
- puts "Implemented completely"
162
- end
163
-
164
- # pull whole remote repository from github
145
+ # $ simrb get simrb/www simrb/work
165
146
  #
166
- # == Example
167
147
  #
168
- # by default, that will pull the official repo
148
+ # == Example 02, pull out the repository with option '-r'
169
149
  #
170
- # $ simrb pull
150
+ # $ simrb pull -r
171
151
  #
172
- # add the option `-f` force to pulling
152
+ # add the option `-f` to force pulling and overwriting the origin repository in local
173
153
  #
174
- # $ simrb pull -f
154
+ # $ simrb pull -f -r
175
155
  #
176
- # or, specify the link you need in second parameter
156
+ # or, specify the save path with second parameter
177
157
  #
178
- # $ simrb pull repo ~/simrb_repo
158
+ # $ simrb pull simrb/test-repo ~/simrb_repo -r
179
159
  #
180
160
  def pull args = []
181
161
  args, opts = Simrb.input_format args
182
- repo_name = args[0] ? args[0] : Scfg[:main_repo]
183
- from_repo = Scfg[:source] + repo_name
184
- to_repo = Simrb.addslash(args[1] ? args[1] : Spath[:repo_dirs][0])
185
- ispull = File.exist?(to_repo + repo_name + "/README.md") ? (opts[:f] ? true : false) : true
186
-
187
- if ispull
188
- Simrb.path_write to_repo
189
- system("git clone #{from_repo}.git")
190
- system("mv #{repo_name} #{to_repo}")
162
+
163
+ # pull the repo
164
+ if opts[:r]
165
+ repo_name = args[0] ? args[0].split('/').last : Scfg[:main_repo]
166
+ full_name = args[0] ? args[0] : "simrb/#{Scfg[:main_repo]}"
167
+ to_repo = Simrb.addslash(args[1] ? args[1] : Spath[:repo_dirs][0])
168
+ ispull = File.exist?(to_repo + repo_name + "/README.md") ? (opts[:f] ? true : false) : true
169
+
170
+ if ispull
171
+ Simrb.path_write to_repo
172
+ system("git clone #{Scfg[:source]}#{full_name}.git")
173
+ system("mv #{repo_name} #{to_repo}")
174
+ end
175
+
176
+ # pull the module
177
+ else
178
+ Simrb.root_dir_force
179
+
180
+ repo_dir = Simrb.addslash(Spath[:repo_dirs][0] + Spath[:def_repo])
181
+ Simrb.path_write repo_dir
182
+
183
+ args.each do | full_name |
184
+ repo, name = full_name.split("/")
185
+ if Smods.keys.include? name
186
+ puts "The module #{name} is existing at local repository, hasn't got from remote"
187
+ else
188
+ path = "#{Scfg[:source]}#{full_name}.git"
189
+ local = "#{repo_dir}#{name}"
190
+ system("git clone #{path} #{local}")
191
+ end
192
+ end
191
193
  end
194
+
192
195
  puts "Implemented completely"
193
196
  end
194
197
 
@@ -8,10 +8,10 @@ module Simrb
8
8
  :name => 'simrb',
9
9
  :created => '2014-01-01',
10
10
  :alias_name => '3s',
11
- :version => '1.0.6',
11
+ :version => '1.0.7',
12
12
  :author => 'Linyu Deng',
13
13
  :email => 'coolesting@gmail.com',
14
- :homepage => 'https://github.com/simrb/simrb-help',
14
+ :homepage => 'https://github.com/simrb/help-gem',
15
15
  :license => 'MIT',
16
16
  :description => 'This is a command helper for simrb',
17
17
  :summary => 'A utility of simrb',
@@ -6,7 +6,7 @@ Spath = {
6
6
  :repo_dirs => [(File.expand_path("~/.simrb") + '/')],
7
7
 
8
8
  # default directory for saving the pulled module from remote
9
- :repo_mods => 'simrb-mods/',
9
+ :def_repo => 'default-repo/',
10
10
 
11
11
  # root directory path of project
12
12
  :module => 'modules/',
@@ -14,6 +14,7 @@ Spath = {
14
14
  :db_dir => 'db/',
15
15
  :upload_dir => 'db/upload/',
16
16
  :backup_dir => 'db/backup/',
17
+ :download_dir => 'db/download/',
17
18
  :tmp_dir => 'tmp/',
18
19
  :cache_dir => 'tmp/cache/simrb/',
19
20
  :install_lock => 'tmp/install.lock',
@@ -68,10 +69,11 @@ Scfg = {
68
69
  :bind => '0.0.0.0',
69
70
  :port => 3000,
70
71
 
71
- :source => 'https://github.com/simrb/',
72
+ :source => 'https://github.com/',
72
73
 
73
74
  # a default core repository for loading when the server booting
74
- :main_repo => 'simrb-repo',
75
+ :main_repo => 'main-repo',
76
+ :test_repo => 'test-repo',
75
77
 
76
78
  # options: development, production, test
77
79
  :environment => 'development',
@@ -101,7 +103,7 @@ Scfg = {
101
103
  ],
102
104
 
103
105
  :init_root_path => [
104
- :db_dir, :upload_dir, :backup_dir,
106
+ :db_dir, :upload_dir, :backup_dir, :download_dir,
105
107
  :tmp_dir, :log_dir, :module, :schema
106
108
  ],
107
109
 
@@ -116,5 +118,5 @@ Scfg = {
116
118
  }
117
119
 
118
120
  # append the children repository
119
- Spath[:repo_dirs] << (Spath[:repo_dirs][0] + Spath[:repo_mods])
121
+ Spath[:repo_dirs] << (Spath[:repo_dirs][0] + Spath[:def_repo])
120
122
  Spath[:repo_dirs] << (Spath[:repo_dirs][0] + Scfg[:main_repo] + '/')
@@ -10,10 +10,16 @@ Scfg[:port] = 3000
10
10
  # options: development, production, test
11
11
  Scfg[:environment] = 'development'
12
12
 
13
- # Scfg[:module_require] = ['base','data','view','file','admin','user']
13
+ # Scfg[:module_require] = [
14
+ # 'base','data','view','file','admin','user',
15
+ # 'custom_module',
16
+ # ]
14
17
 
15
18
  # your directory path of local
16
19
  # Spath[:repo_dirs][0] = (File.expand_path("~/.simrb") + '/')
17
20
 
18
- # add repository path like this
19
- # Spath[:repo_dirs] << "/home/yours"
21
+ # append anthor repository to repo variable
22
+ # Spath[:repo_dirs] << "/home/my/repo"
23
+ #
24
+ # or, overwrite those default repositories
25
+ # Spath[:repo_dirs] = ["/home/my/repo1", "/home/my/repo2"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Linyu Deng
@@ -87,7 +87,7 @@ files:
87
87
  - lib/simrb/scfg_copy.rb
88
88
  - lib/simrb/thin_start.rb
89
89
  - lib/simrb/tool_start.rb
90
- homepage: https://github.com/simrb/simrb-help
90
+ homepage: https://github.com/simrb/help-gem
91
91
  licenses:
92
92
  - MIT
93
93
  metadata: {}