hive-toolbelt 1.0.0 → 2.0.0
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/README.md +20 -0
- data/assets/{LICENSE.txt → MIT-LICENSE.txt} +0 -0
- data/lib/hive/toolbelt/cli.rb +24 -21
- data/lib/hive/toolbelt/version.rb +1 -1
- data/spec/lib/hive/toolbelt_spec.rb +3 -3
- data/spec/spec_helper.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d6b49afa5e8f06227fc8b620720ece2b40a9fbb
|
4
|
+
data.tar.gz: c95ade148f4b030a682cd95b1ba402e39f619704
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69d05972959dc82561b4734d57a14a36531b47f823c15521074efe1df4c40cec167bfd45c274481c3db13764069a4ceb929cc461044964b528252d7fc59981d7
|
7
|
+
data.tar.gz: 687f25bef4af32db4622c6d99eadb656dd52dac81e08c7aa728cb4e1102cdebf7a38765bb81e4bc7142eb47ea5be3801a70d87c039ecaaa60e1f11b8c8c2272b
|
data/README.md
CHANGED
@@ -12,6 +12,26 @@ Command Line Interface for the Hive wallet
|
|
12
12
|
$ hive package # creates a .hiveapp bundle from specified or current working directory (.hidden files ignored)
|
13
13
|
$ hive release # (TODO) bumps version, tags and pushes
|
14
14
|
|
15
|
+
### hive init
|
16
|
+
|
17
|
+
$ mkdir new_app
|
18
|
+
$ cd new_app
|
19
|
+
$ hive init
|
20
|
+
|
21
|
+
`hive init` asks questions and scaffolds a Hive app. It
|
22
|
+
|
23
|
+
- creates manifest.json. Read more on [manifest configuration](https://github.com/hivewallet/hive-osx/wiki/How-to-build-a-Hive-app#wiki-manifest-file)
|
24
|
+
- creates a skeleton index.html. Read more on [index.html](https://github.com/hivewallet/hive-osx/wiki/How-to-build-a-Hive-app#wiki-index-page)
|
25
|
+
- provides a default icon
|
26
|
+
- generates basic app structure. Read more on [app structure](https://github.com/hivewallet/hive-osx/wiki/How-to-build-a-Hive-app#wiki-app-structure)
|
27
|
+
- includes a [mock Hive API](https://github.com/javgh/hiveapp-api-mock/blob/v1.0.1/hiveapp-api-mock.js) for in-browser development & testing
|
28
|
+
|
29
|
+
### hive package
|
30
|
+
|
31
|
+
`hive package [DIR_NAME]` packages a directory into a .hiveapp bundle. `DIR_NAME` defaults to current working directory if not specified. Regardless of `DIR_NAME`, the generated `.hiveapp` bundle is always located at current working directory.
|
32
|
+
|
33
|
+
Note that the command deliberately exclude all .hidden files and directories, like `.git`, when generating the bundle.
|
34
|
+
|
15
35
|
## Contributing
|
16
36
|
|
17
37
|
1. Fork it ( http://github.com/hivewallet/hive-toolbelt/fork )
|
File without changes
|
data/lib/hive/toolbelt/cli.rb
CHANGED
@@ -10,6 +10,12 @@ I18n.enforce_available_locales = false
|
|
10
10
|
module Hive
|
11
11
|
module Toolbelt
|
12
12
|
class CLI < Thor
|
13
|
+
MANIFEST = "manifest.json"
|
14
|
+
INDEX = "index.html"
|
15
|
+
ICON = "icon.png"
|
16
|
+
README = "README.md"
|
17
|
+
LICENSE = "MIT-LICENSE.txt"
|
18
|
+
|
13
19
|
desc "init", "scaffold a Hive app"
|
14
20
|
def init
|
15
21
|
config = {}
|
@@ -34,7 +40,7 @@ module Hive
|
|
34
40
|
directory = sanitize_dir_name dir_name
|
35
41
|
check_for_required_files directory
|
36
42
|
|
37
|
-
bundle_name = bundle_name_from_manifest(File.join directory,
|
43
|
+
bundle_name = bundle_name_from_manifest(File.join directory, MANIFEST)
|
38
44
|
FileUtils.rm(bundle_name) if File.exists? bundle_name
|
39
45
|
bundle_files bundle_name, directory
|
40
46
|
|
@@ -50,11 +56,11 @@ module Hive
|
|
50
56
|
def create_manifest config={}
|
51
57
|
defaults = {
|
52
58
|
version: "0.0.1",
|
53
|
-
icon:
|
59
|
+
icon: ICON,
|
54
60
|
id: id_for(config[:author], config[:name])
|
55
61
|
}
|
56
62
|
|
57
|
-
File.open(
|
63
|
+
File.open(MANIFEST, 'w') do |f|
|
58
64
|
config[:accessedHosts] = config[:accessedHosts].split(',').map(&:strip)
|
59
65
|
f.puts(JSON.pretty_generate config.merge(defaults))
|
60
66
|
end
|
@@ -62,11 +68,11 @@ module Hive
|
|
62
68
|
|
63
69
|
def id_for author, name
|
64
70
|
return "" if author.blank? || name.blank?
|
65
|
-
"#{author.parameterize
|
71
|
+
"#{author.parameterize}.#{name.parameterize}"
|
66
72
|
end
|
67
73
|
|
68
74
|
def copy_default_icon
|
69
|
-
copy_file File.join('images',
|
75
|
+
copy_file File.join('images', ICON), ICON
|
70
76
|
end
|
71
77
|
|
72
78
|
def copy_api_mock
|
@@ -75,19 +81,17 @@ module Hive
|
|
75
81
|
end
|
76
82
|
|
77
83
|
def create_index_html title
|
78
|
-
|
79
|
-
|
80
|
-
gsub_file index_filename, /{{title}}/, title
|
84
|
+
copy_file File.join('html', INDEX), INDEX
|
85
|
+
gsub_file INDEX, /{{title}}/, title
|
81
86
|
end
|
82
87
|
|
83
88
|
def create_readme config
|
84
|
-
|
85
|
-
|
86
|
-
safe_gsub_file
|
87
|
-
safe_gsub_file
|
88
|
-
safe_gsub_file
|
89
|
-
safe_gsub_file
|
90
|
-
safe_gsub_file readme_filename, /{{project_name}}/, project_name_from(config[:repo_url])
|
89
|
+
copy_file README, README
|
90
|
+
safe_gsub_file README, /{{name}}/, config[:name]
|
91
|
+
safe_gsub_file README, /{{description}}/, config[:description]
|
92
|
+
safe_gsub_file README, /{{app_id}}/, id_for(config[:author], config[:name])
|
93
|
+
safe_gsub_file README, /{{repo_url}}/, config[:repo_url]
|
94
|
+
safe_gsub_file README, /{{project_name}}/, project_name_from(config[:repo_url])
|
91
95
|
end
|
92
96
|
|
93
97
|
def safe_gsub_file filename, pattern, replacement
|
@@ -103,10 +107,9 @@ module Hive
|
|
103
107
|
end
|
104
108
|
|
105
109
|
def create_license author
|
106
|
-
|
107
|
-
|
108
|
-
safe_gsub_file
|
109
|
-
safe_gsub_file license_filename, /{{author}}/, author
|
110
|
+
copy_file LICENSE, LICENSE
|
111
|
+
safe_gsub_file LICENSE, /{{year}}/, Time.now.year.to_s
|
112
|
+
safe_gsub_file LICENSE, /{{author}}/, author
|
110
113
|
end
|
111
114
|
|
112
115
|
def create_empty_folders
|
@@ -122,7 +125,7 @@ module Hive
|
|
122
125
|
end
|
123
126
|
|
124
127
|
def check_for_required_files sanitized_dir_name
|
125
|
-
|
128
|
+
[INDEX, MANIFEST].each do |filename|
|
126
129
|
if Dir.glob(File.join sanitized_dir_name, filename).empty?
|
127
130
|
raise PackageError.new("#{filename} is required. But it's not found under #{sanitized_dir_name}")
|
128
131
|
end
|
@@ -142,7 +145,7 @@ module Hive
|
|
142
145
|
required = config.slice :author, :name, :version
|
143
146
|
|
144
147
|
required.each do |k, v|
|
145
|
-
raise PackageError.new("Please provide a value for `#{k}` field in
|
148
|
+
raise PackageError.new("Please provide a value for `#{k}` field in #{MANIFEST}") if v.blank?
|
146
149
|
end
|
147
150
|
|
148
151
|
required.values.join(' ').parameterize << '.hiveapp'
|
@@ -36,7 +36,7 @@ module Hive::Toolbelt
|
|
36
36
|
|
37
37
|
expect(manifest["version"]).to eq("0.0.1")
|
38
38
|
expect(manifest["icon"]).to eq("icon.png")
|
39
|
-
expect(manifest["id"]).to eq("
|
39
|
+
expect(manifest["id"]).to eq("wei-lu.foo-app")
|
40
40
|
end
|
41
41
|
|
42
42
|
describe 'accessedHosts' do
|
@@ -119,12 +119,12 @@ module Hive::Toolbelt
|
|
119
119
|
it { expect(readme).to include(config[:name]) }
|
120
120
|
it { expect(readme).to include(config[:description]) }
|
121
121
|
it { expect(readme).to include("cd #{project_name}") }
|
122
|
-
it { expect(readme).to include("ln -s ~/#{project_name}/
|
122
|
+
it { expect(readme).to include("ln -s ~/#{project_name}/ wei-lu.foo-app") }
|
123
123
|
it { expect(readme).to include("git clone #{config[:repo_url]}") }
|
124
124
|
end
|
125
125
|
|
126
126
|
describe '#create_license' do
|
127
|
-
let(:filename) { 'LICENSE.txt' }
|
127
|
+
let(:filename) { 'MIT-LICENSE.txt' }
|
128
128
|
let(:author) { 'Wei Lu' }
|
129
129
|
let(:license) do
|
130
130
|
cli.create_license author
|
data/spec/spec_helper.rb
CHANGED
@@ -8,7 +8,7 @@ RSpec.configure do |config|
|
|
8
8
|
config.order = 'random'
|
9
9
|
|
10
10
|
# clean up generated files
|
11
|
-
generated_files = %w(manifest.json icon.png index.html README.md LICENSE.txt wei-lu-my-app-1-0-1.hiveapp)
|
11
|
+
generated_files = %w(manifest.json icon.png index.html README.md MIT-LICENSE.txt wei-lu-my-app-1-0-1.hiveapp)
|
12
12
|
generated_files << File.join('javascripts', 'hiveapp-api-mock.js')
|
13
13
|
%w(stylesheets images fonts).each do |dirname|
|
14
14
|
generated_files << File.join(dirname, '.gitignore')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hive-toolbelt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wei Lu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -122,7 +122,7 @@ files:
|
|
122
122
|
- LICENSE.txt
|
123
123
|
- README.md
|
124
124
|
- Rakefile
|
125
|
-
- assets/LICENSE.txt
|
125
|
+
- assets/MIT-LICENSE.txt
|
126
126
|
- assets/README.md
|
127
127
|
- assets/html/index.html
|
128
128
|
- assets/images/icon.png
|