hive-toolbelt 0.0.1 → 0.0.2
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 +4 -4
- data/bin/hive +1 -95
- data/lib/hive/toolbelt/cli.rb +96 -0
- data/lib/hive/toolbelt/version.rb +1 -1
- data/lib/hive/toolbelt.rb +1 -93
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ce97020a71f474da3ea838dabe9322ebe05c64a
|
4
|
+
data.tar.gz: cfc75e2f46cc2e51d4227956350fc1e523363c13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5ebf9ada6dac3dfee77702c991e16c0fe6776b738c5e2c6273880fc05fb2076f7f3875629a4e674463a3baa1013074b01a70fb37aaf1ab59c9bbfa902b25a3f
|
7
|
+
data.tar.gz: d83f49af9ea48f2476461454a686f67ed807d7efe64c0161853123a5f047db6faa8072bf3ddc2da5284c48d0f34262d2c23842333d196795172f4743bee98399
|
data/bin/hive
CHANGED
@@ -1,99 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
require "json"
|
5
|
-
require "active_support/core_ext/string"
|
6
|
-
require_relative "toolbelt/version"
|
7
|
-
|
8
|
-
I18n.enforce_available_locales = false
|
9
|
-
|
10
|
-
module Hive
|
11
|
-
module Toolbelt
|
12
|
-
class CLI < Thor
|
13
|
-
desc "init", "scaffolding a Hive app"
|
14
|
-
def init
|
15
|
-
config = {}
|
16
|
-
config[:name] = ask("App Name: ")
|
17
|
-
config[:description] = ask("Description: ")
|
18
|
-
config[:author] = ask("Author Name: ")
|
19
|
-
config[:contact] = ask("Author Contact: ")
|
20
|
-
config[:repo_url] = ask("Git Repository URL: ")
|
21
|
-
|
22
|
-
create_manifest(config)
|
23
|
-
copy_default_icon
|
24
|
-
copy_api_mock # for in-browser development
|
25
|
-
create_index_html config[:name]
|
26
|
-
create_readme config
|
27
|
-
create_license config[:author]
|
28
|
-
end
|
29
|
-
|
30
|
-
no_commands do
|
31
|
-
include Thor::Actions
|
32
|
-
source_paths << 'assets'
|
33
|
-
|
34
|
-
def create_manifest config={}
|
35
|
-
defaults = {
|
36
|
-
version: "0.0.1",
|
37
|
-
icon: "icon.png",
|
38
|
-
id: id_for(config[:author], config[:name])
|
39
|
-
}
|
40
|
-
|
41
|
-
File.open('manifest.json', 'w') do |f|
|
42
|
-
f.puts(JSON.pretty_generate config.clone.merge(defaults))
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def id_for author, name
|
47
|
-
return "" if author.blank? || name.blank?
|
48
|
-
"#{author.parameterize('_')}.#{name.parameterize('_')}"
|
49
|
-
end
|
50
|
-
|
51
|
-
def copy_default_icon
|
52
|
-
copy_file File.join('images', 'icon.png'), 'icon.png'
|
53
|
-
end
|
54
|
-
|
55
|
-
def copy_api_mock
|
56
|
-
filename = File.join('javascripts', 'hiveapp-api-mock.js')
|
57
|
-
copy_file filename, filename
|
58
|
-
end
|
59
|
-
|
60
|
-
def create_index_html title
|
61
|
-
index_filename = 'index.html'
|
62
|
-
copy_file File.join('html', index_filename), index_filename
|
63
|
-
gsub_file index_filename, /{{title}}/, title
|
64
|
-
end
|
65
|
-
|
66
|
-
def create_readme config
|
67
|
-
readme_filename = 'README.md'
|
68
|
-
copy_file readme_filename, readme_filename
|
69
|
-
safe_gsub_file readme_filename, /{{name}}/, config[:name]
|
70
|
-
safe_gsub_file readme_filename, /{{description}}/, config[:description]
|
71
|
-
safe_gsub_file readme_filename, /{{app_id}}/, id_for(config[:author], config[:name])
|
72
|
-
safe_gsub_file readme_filename, /{{repo_url}}/, config[:repo_url]
|
73
|
-
safe_gsub_file readme_filename, /{{project_name}}/, project_name_from(config[:repo_url])
|
74
|
-
end
|
75
|
-
|
76
|
-
def safe_gsub_file filename, pattern, replacement
|
77
|
-
return if replacement.blank?
|
78
|
-
|
79
|
-
gsub_file filename, pattern, replacement
|
80
|
-
end
|
81
|
-
|
82
|
-
def project_name_from repo_url
|
83
|
-
return if repo_url.blank?
|
84
|
-
|
85
|
-
repo_url.split('/').last.gsub(/.git$/, '')
|
86
|
-
end
|
87
|
-
|
88
|
-
def create_license author
|
89
|
-
license_filename = 'LICENSE.txt'
|
90
|
-
copy_file license_filename, license_filename
|
91
|
-
safe_gsub_file license_filename, /{{year}}/, Time.now.year.to_s
|
92
|
-
safe_gsub_file license_filename, /{{author}}/, author
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
3
|
+
require_relative '../lib/hive/toolbelt'
|
98
4
|
|
99
5
|
Hive::Toolbelt::CLI.start
|
@@ -0,0 +1,96 @@
|
|
1
|
+
require "thor"
|
2
|
+
require "json"
|
3
|
+
require "active_support"
|
4
|
+
require "active_support/core_ext/string"
|
5
|
+
|
6
|
+
I18n.enforce_available_locales = false
|
7
|
+
|
8
|
+
module Hive
|
9
|
+
module Toolbelt
|
10
|
+
class CLI < Thor
|
11
|
+
desc "init", "scaffolding a Hive app"
|
12
|
+
def init
|
13
|
+
config = {}
|
14
|
+
config[:name] = ask("App Name: ")
|
15
|
+
config[:description] = ask("Description: ")
|
16
|
+
config[:author] = ask("Author Name: ")
|
17
|
+
config[:contact] = ask("Author Contact: ")
|
18
|
+
config[:repo_url] = ask("Git Repository URL: ")
|
19
|
+
|
20
|
+
create_manifest(config)
|
21
|
+
copy_default_icon
|
22
|
+
copy_api_mock # for in-browser development
|
23
|
+
create_index_html config[:name]
|
24
|
+
create_readme config
|
25
|
+
create_license config[:author]
|
26
|
+
end
|
27
|
+
|
28
|
+
no_commands do
|
29
|
+
include Thor::Actions
|
30
|
+
self.source_paths << File.join(File.dirname(__FILE__), '..', '..', '..', 'assets')
|
31
|
+
|
32
|
+
def create_manifest config={}
|
33
|
+
defaults = {
|
34
|
+
version: "0.0.1",
|
35
|
+
icon: "icon.png",
|
36
|
+
id: id_for(config[:author], config[:name])
|
37
|
+
}
|
38
|
+
|
39
|
+
File.open('manifest.json', 'w') do |f|
|
40
|
+
f.puts(JSON.pretty_generate config.clone.merge(defaults))
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def id_for author, name
|
45
|
+
return "" if author.blank? || name.blank?
|
46
|
+
"#{author.parameterize('_')}.#{name.parameterize('_')}"
|
47
|
+
end
|
48
|
+
|
49
|
+
def copy_default_icon
|
50
|
+
copy_file File.join('images', 'icon.png'), 'icon.png'
|
51
|
+
end
|
52
|
+
|
53
|
+
def copy_api_mock
|
54
|
+
filename = File.join('javascripts', 'hiveapp-api-mock.js')
|
55
|
+
copy_file filename, filename
|
56
|
+
end
|
57
|
+
|
58
|
+
def create_index_html title
|
59
|
+
index_filename = 'index.html'
|
60
|
+
copy_file File.join('html', index_filename), index_filename
|
61
|
+
gsub_file index_filename, /{{title}}/, title
|
62
|
+
end
|
63
|
+
|
64
|
+
def create_readme config
|
65
|
+
readme_filename = 'README.md'
|
66
|
+
copy_file readme_filename, readme_filename
|
67
|
+
safe_gsub_file readme_filename, /{{name}}/, config[:name]
|
68
|
+
safe_gsub_file readme_filename, /{{description}}/, config[:description]
|
69
|
+
safe_gsub_file readme_filename, /{{app_id}}/, id_for(config[:author], config[:name])
|
70
|
+
safe_gsub_file readme_filename, /{{repo_url}}/, config[:repo_url]
|
71
|
+
safe_gsub_file readme_filename, /{{project_name}}/, project_name_from(config[:repo_url])
|
72
|
+
end
|
73
|
+
|
74
|
+
def safe_gsub_file filename, pattern, replacement
|
75
|
+
return if replacement.blank?
|
76
|
+
|
77
|
+
gsub_file filename, pattern, replacement
|
78
|
+
end
|
79
|
+
|
80
|
+
def project_name_from repo_url
|
81
|
+
return if repo_url.blank?
|
82
|
+
|
83
|
+
repo_url.split('/').last.gsub(/.git$/, '')
|
84
|
+
end
|
85
|
+
|
86
|
+
def create_license author
|
87
|
+
license_filename = 'LICENSE.txt'
|
88
|
+
copy_file license_filename, license_filename
|
89
|
+
safe_gsub_file license_filename, /{{year}}/, Time.now.year.to_s
|
90
|
+
safe_gsub_file license_filename, /{{author}}/, author
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
data/lib/hive/toolbelt.rb
CHANGED
@@ -1,99 +1,7 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "thor"
|
4
|
-
require "json"
|
5
|
-
require "active_support/core_ext/string"
|
6
1
|
require_relative "toolbelt/version"
|
7
|
-
|
8
|
-
I18n.enforce_available_locales = false
|
2
|
+
require_relative "toolbelt/cli"
|
9
3
|
|
10
4
|
module Hive
|
11
5
|
module Toolbelt
|
12
|
-
class CLI < Thor
|
13
|
-
desc "init", "scaffolding a Hive app"
|
14
|
-
def init
|
15
|
-
config = {}
|
16
|
-
config[:name] = ask("App Name: ")
|
17
|
-
config[:description] = ask("Description: ")
|
18
|
-
config[:author] = ask("Author Name: ")
|
19
|
-
config[:contact] = ask("Author Contact: ")
|
20
|
-
config[:repo_url] = ask("Git Repository URL: ")
|
21
|
-
|
22
|
-
create_manifest(config)
|
23
|
-
copy_default_icon
|
24
|
-
copy_api_mock # for in-browser development
|
25
|
-
create_index_html config[:name]
|
26
|
-
create_readme config
|
27
|
-
create_license config[:author]
|
28
|
-
end
|
29
|
-
|
30
|
-
no_commands do
|
31
|
-
include Thor::Actions
|
32
|
-
source_paths << 'assets'
|
33
|
-
|
34
|
-
def create_manifest config={}
|
35
|
-
defaults = {
|
36
|
-
version: "0.0.1",
|
37
|
-
icon: "icon.png",
|
38
|
-
id: id_for(config[:author], config[:name])
|
39
|
-
}
|
40
|
-
|
41
|
-
File.open('manifest.json', 'w') do |f|
|
42
|
-
f.puts(JSON.pretty_generate config.clone.merge(defaults))
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def id_for author, name
|
47
|
-
return "" if author.blank? || name.blank?
|
48
|
-
"#{author.parameterize('_')}.#{name.parameterize('_')}"
|
49
|
-
end
|
50
|
-
|
51
|
-
def copy_default_icon
|
52
|
-
copy_file File.join('images', 'icon.png'), 'icon.png'
|
53
|
-
end
|
54
|
-
|
55
|
-
def copy_api_mock
|
56
|
-
filename = File.join('javascripts', 'hiveapp-api-mock.js')
|
57
|
-
copy_file filename, filename
|
58
|
-
end
|
59
|
-
|
60
|
-
def create_index_html title
|
61
|
-
index_filename = 'index.html'
|
62
|
-
copy_file File.join('html', index_filename), index_filename
|
63
|
-
gsub_file index_filename, /{{title}}/, title
|
64
|
-
end
|
65
|
-
|
66
|
-
def create_readme config
|
67
|
-
readme_filename = 'README.md'
|
68
|
-
copy_file readme_filename, readme_filename
|
69
|
-
safe_gsub_file readme_filename, /{{name}}/, config[:name]
|
70
|
-
safe_gsub_file readme_filename, /{{description}}/, config[:description]
|
71
|
-
safe_gsub_file readme_filename, /{{app_id}}/, id_for(config[:author], config[:name])
|
72
|
-
safe_gsub_file readme_filename, /{{repo_url}}/, config[:repo_url]
|
73
|
-
safe_gsub_file readme_filename, /{{project_name}}/, project_name_from(config[:repo_url])
|
74
|
-
end
|
75
|
-
|
76
|
-
def safe_gsub_file filename, pattern, replacement
|
77
|
-
return if replacement.blank?
|
78
|
-
|
79
|
-
gsub_file filename, pattern, replacement
|
80
|
-
end
|
81
|
-
|
82
|
-
def project_name_from repo_url
|
83
|
-
return if repo_url.blank?
|
84
|
-
|
85
|
-
repo_url.split('/').last.gsub(/.git$/, '')
|
86
|
-
end
|
87
|
-
|
88
|
-
def create_license author
|
89
|
-
license_filename = 'LICENSE.txt'
|
90
|
-
copy_file license_filename, license_filename
|
91
|
-
safe_gsub_file license_filename, /{{year}}/, Time.now.year.to_s
|
92
|
-
safe_gsub_file license_filename, /{{author}}/, author
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
6
|
end
|
97
7
|
end
|
98
|
-
|
99
|
-
Hive::Toolbelt::CLI.start
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hive-toolbelt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wei Lu
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- bin/hive
|
117
117
|
- hive-toolbelt.gemspec
|
118
118
|
- lib/hive/toolbelt.rb
|
119
|
+
- lib/hive/toolbelt/cli.rb
|
119
120
|
- lib/hive/toolbelt/version.rb
|
120
121
|
- spec/lib/hive/toolbelt_spec.rb
|
121
122
|
- spec/spec_helper.rb
|