hive-toolbelt 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e663b0b31a2fa8d1c51448578d31f17dc0ac374c
4
+ data.tar.gz: a058d0a8b1154a6f0bc9d5aebb30dd87215a4b13
5
+ SHA512:
6
+ metadata.gz: 5e5ee6c76ad4727a7b3368a70741230d52bb4e917c70906e6e35bf4a088d8b46b1cb22360a5bad443e27482e3cd1a3b8ea7082bc65c0f9bd381690feac5d6aa7
7
+ data.tar.gz: b50bcba06c3c044fa36d32cb4b25f105eb262cf00035c013c2f4457762cdd84052ca1f8163ed12b65fb0d273f97c1ddc084ace8590767d473f0533156137e44c
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in hive-toolbelt.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Wei Lu
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # Hive::Toolbelt
2
+
3
+ Command Line Interface for the Hive wallet
4
+
5
+ ## Installation
6
+
7
+ $ gem install hive-toolbelt
8
+
9
+ ## Usage
10
+
11
+ $ hive init # walk you through scaffolding a Hive app
12
+ $ hive package # (TODO) cleans and creates a .hiveapp bundle from current working directory
13
+ $ hive release # (TODO) bumps version, tags and pushes
14
+
15
+ ## Contributing
16
+
17
+ 1. Fork it ( http://github.com/<my-github-username>/hive-toolbelt/fork )
18
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
19
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
20
+ 4. Push to the branch (`git push origin my-new-feature`)
21
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,22 @@
1
+ Copyright (c) {{year}} {{author}}
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/assets/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # {{name}}
2
+
3
+ {{description}}
4
+
5
+ ## Development
6
+
7
+ ### Test it in browser
8
+
9
+ cd ~ && git clone {{repo_url}}
10
+ cd {{project_name}}
11
+ open index.html
12
+
13
+ ### Test it in Hive
14
+
15
+ [Download and install](http://hivewallet.com/) Hive on your Mac OSX
16
+
17
+ cd ~ && git clone {{repo_url}}
18
+ cd ~/Library/Application\ Support/Hive/Applications/
19
+ ln -s ~/{{project_name}}/ {{app_id}}
20
+
21
+ ## Contributing
22
+
23
+ 1. Fork it
24
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
25
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
26
+ 4. Push to the branch (`git push origin my-new-feature`)
27
+ 5. Create new Pull Request
@@ -0,0 +1,11 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>{{title}}</title>
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <script src="javascripts/hiveapp-api-mock.js"></script>
7
+ </head>
8
+ <body>
9
+ <h1>Hello World</h1>
10
+ </body>
11
+ <html>
Binary file
@@ -0,0 +1,144 @@
1
+ /*
2
+ * Hive App API mock https://github.com/javgh/hiveapp-api-mock
3
+ *
4
+ * Licensed under the MIT License.
5
+ *
6
+ * v1.0.0
7
+ */
8
+
9
+ var bitcoin = bitcoin || mockBitcoin()
10
+
11
+ function mockBitcoin() {
12
+ var _BTC_IN_SATOSHI = 100000000;
13
+ var _MBTC_IN_SATOSHI = 100000;
14
+ var _UBTC_IN_SATOSHI = 100;
15
+ var userAddress = 'poqjer23rfc234laq';
16
+ var transactions = [];
17
+ var exchangeRateListeners = [];
18
+ var bitcoinFormatToSatoshi = {
19
+ BTC: _BTC_IN_SATOSHI,
20
+ mBTC: _MBTC_IN_SATOSHI,
21
+ µBTC: _UBTC_IN_SATOSHI
22
+ }
23
+ var preferredBitcoinFormat = 'mBTC';
24
+ var preferredCurrency = 'USD';
25
+ var locale = navigator.language;
26
+
27
+ function async(fn) { setTimeout(fn, 0) }
28
+
29
+ return {
30
+ BTC_IN_SATOSHI: _BTC_IN_SATOSHI,
31
+ MBTC_IN_SATOSHI: _MBTC_IN_SATOSHI,
32
+ UBTC_IN_SATOSHI: _UBTC_IN_SATOSHI,
33
+
34
+ TX_TYPE_INCOMING: "incoming",
35
+ TX_TYPE_OUTGOING: "outgoing",
36
+
37
+ sendMoney: function(address, amount, callback){
38
+ if (!address) { throw "address argument is undefined" }
39
+
40
+ var result = prompt("Send bitcoins to " + address + ": ", amount);
41
+
42
+ if (callback) {
43
+ if (result) {
44
+ var txid = transactions.length + "";
45
+
46
+ transactions.push({
47
+ id: txid,
48
+ amount: amount,
49
+ type: bitcoin.TX_TYPE_OUTGOING,
50
+ timestamp: new Date().toISOString(),
51
+ inputAddresses: [userAddress],
52
+ outputAddresses: [address]
53
+ });
54
+
55
+ async(function() { callback(true, txid) } )
56
+ } else {
57
+ async(function() { callback(false) } )
58
+ }
59
+ }
60
+ },
61
+
62
+ getTransaction: function(id, callback){
63
+ if (!id || !callback){ throw "id and callback are required" }
64
+
65
+ var tx = transactions.filter(function(t){ return t.id == id })[0]
66
+ async(function(){ callback(tx) })
67
+ },
68
+
69
+ getSystemInfo: function(callback){
70
+ if (!callback){
71
+ throw "callback is undefined";
72
+ }
73
+ async(function(){
74
+ callback({
75
+ version: "0.9",
76
+ buildNumber: "2013120901",
77
+ decimalSeparator: (0.1).toLocaleString().substring(1, 2),
78
+ locale: locale,
79
+ preferredCurrency: "USD",
80
+ preferredBitcoinFormat: preferredBitcoinFormat
81
+ })
82
+ })
83
+ },
84
+
85
+ addExchangeRateListener: function(callback) {
86
+ if (!callback){ throw "callback is required" }
87
+
88
+ exchangeRateListeners.push(callback)
89
+ },
90
+
91
+ removeExchangeRateListener: function(callback) {
92
+ if (!callback){ throw "callback is required" }
93
+
94
+ exchangeRateListeners.splice(exchangeRateListeners.indexOf(callback), 1)
95
+ },
96
+
97
+ updateExchangeRate: function(currency) {
98
+ exchangeRateListeners.forEach(function(fn){
99
+ fn(currency, Number((Math.random() * 1000).toFixed(2)))
100
+ })
101
+ },
102
+
103
+ getUserInfo: function(callback){
104
+ if (!callback){
105
+ throw "callback is required";
106
+ }
107
+ async(function(){
108
+ callback({
109
+ firstName: 'Homer',
110
+ lastName: 'Simpson',
111
+ email: 'homer@fake.com',
112
+ address: userAddress
113
+ })
114
+ })
115
+ },
116
+
117
+ makeRequest: function(endpoint, args){
118
+ args['url'] = endpoint.replace(/http[s]?:\/\//gi, "http://www.corsproxy.com/");
119
+ $.ajax(args)
120
+ },
121
+
122
+ userStringForSatoshi: function(satoshiAmount) {
123
+ var amount = satoshiAmount / bitcoinFormatToSatoshi[preferredBitcoinFormat]
124
+ return amount.toLocaleString()
125
+ },
126
+
127
+ satoshiFromUserString: function(formattedAmount) {
128
+ var floatValue = bitcoin.valueFromUserString(formattedAmount)
129
+ return floatValue * bitcoinFormatToSatoshi[preferredBitcoinFormat]
130
+ },
131
+
132
+ userStringForCurrencyValue: function(amount, currency) {
133
+ currency = currency || preferredCurrency
134
+ var maximumFractionDigits = currency == 'JPY' ? 0 : 2
135
+ return parseFloat(amount.toFixed(maximumFractionDigits)).toLocaleString()
136
+ },
137
+
138
+ valueFromUserString: function(formattedAmount) {
139
+ var thousandsSeparator = (1000).toLocaleString().substring(1, 2)
140
+ return parseFloat(formattedAmount.replace(thousandsSeparator, ''))
141
+ }
142
+ };
143
+ }
144
+
data/bin/hive ADDED
@@ -0,0 +1,99 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "thor"
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
98
+
99
+ Hive::Toolbelt::CLI.start
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'hive/toolbelt/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "hive-toolbelt"
8
+ spec.version = Hive::Toolbelt::VERSION
9
+ spec.authors = ["Wei Lu"]
10
+ spec.email = ["luwei.here@gmail.com"]
11
+ spec.summary = %q{Command Line Interface for the Hive wallet}
12
+ spec.description = %q{All you need for developing Hive apps.}
13
+ spec.homepage = "https://github.com/hivewallet/toolbelt"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "thor"
22
+ spec.add_dependency "active_support"
23
+ spec.add_development_dependency "bundler", "~> 1.5"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "rspec"
26
+ spec.add_development_dependency "debugger"
27
+ end
@@ -0,0 +1,99 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "thor"
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
98
+
99
+ Hive::Toolbelt::CLI.start
@@ -0,0 +1,5 @@
1
+ module Hive
2
+ module Toolbelt
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,127 @@
1
+ require 'spec_helper'
2
+ require 'toolbelt'
3
+ require 'fileutils'
4
+
5
+ module Hive::Toolbelt
6
+ describe CLI do
7
+ describe '#create_manifest' do
8
+ let(:cli) { described_class.new }
9
+ let(:filename) { 'manifest.json' }
10
+
11
+ it 'creates a manifest file' do
12
+ cli.create_manifest
13
+ expect(File.exists?(filename)).to be_true
14
+ end
15
+
16
+ def create_manifest_json config
17
+ cli.create_manifest config
18
+ JSON.parse File.read(filename)
19
+ end
20
+
21
+ it 'created manifest file has the specified config' do
22
+ config = { foo: 1, bar: 2 }
23
+ manifest = create_manifest_json config
24
+ config.each do |k, v|
25
+ expect(manifest[k.to_s]).to eq v
26
+ end
27
+ end
28
+
29
+ it 'generates additional required fields' do
30
+ config = { name: "Foo App", author: "Wei Lu" }
31
+ manifest = create_manifest_json config
32
+
33
+ expect(manifest["version"]).to eq("0.0.1")
34
+ expect(manifest["icon"]).to eq("icon.png")
35
+ expect(manifest["id"]).to eq("wei_lu.foo_app")
36
+ end
37
+ end
38
+
39
+ describe '#copy_default_icon' do
40
+ let(:cli) { described_class.new }
41
+ let(:filename) { 'icon.png' }
42
+
43
+ it 'provides a default icon file' do
44
+ cli.copy_default_icon
45
+ expect(File.exists?(filename)).to be_true
46
+ end
47
+ end
48
+
49
+ describe '#copy_api_mock' do
50
+ let(:cli) { described_class.new }
51
+
52
+ it 'provides a mock api for in-browser development' do
53
+ cli.copy_api_mock
54
+ expect(File.exists?(File.join('javascripts', 'hiveapp-api-mock.js'))).to be_true
55
+ end
56
+ end
57
+
58
+ describe '#create_index_html' do
59
+ let(:cli) { described_class.new }
60
+ let(:filename) { 'index.html' }
61
+ let(:index) do
62
+ cli.create_index_html 'Foo App'
63
+ File.read(filename)
64
+ end
65
+
66
+ it 'creates an index.html' do
67
+ cli.create_index_html ''
68
+ expect(File.exists?(filename)).to be_true
69
+ end
70
+
71
+ it 'has app name in title' do
72
+ expect(index).to include('<title>Foo App</title>')
73
+ end
74
+
75
+ it 'includes hive mock api' do
76
+ expect(index).to include('<script src="javascripts/hiveapp-api-mock.js"></script>')
77
+ end
78
+ end
79
+
80
+ describe '#create_readme' do
81
+ let(:cli) { described_class.new }
82
+ let(:filename) { 'README.md' }
83
+ let(:project_name) { 'toolbelt' }
84
+ let(:config) do
85
+ {
86
+ name: "Foo App",
87
+ description: "Super awesome foo app",
88
+ author: "Wei Lu",
89
+ repo_url: "git@github.com:hivewallet/#{project_name}.git"
90
+ }
91
+ end
92
+ let(:readme) do
93
+ cli.create_readme config
94
+ File.read(filename)
95
+ end
96
+
97
+ it 'creates a README.md' do
98
+ cli.create_readme(config)
99
+ expect(File.exists?(filename)).to be_true
100
+ end
101
+
102
+ it { expect(readme).to include(config[:name]) }
103
+ it { expect(readme).to include(config[:description]) }
104
+ it { expect(readme).to include("cd #{project_name}") }
105
+ it { expect(readme).to include("ln -s ~/#{project_name}/ wei_lu.foo_app") }
106
+ it { expect(readme).to include("git clone #{config[:repo_url]}") }
107
+ end
108
+
109
+ describe '#create_license' do
110
+ let(:cli) { described_class.new }
111
+ let(:filename) { 'LICENSE.txt' }
112
+ let(:author) { 'Wei Lu' }
113
+ let(:license) do
114
+ cli.create_license author
115
+ File.read(filename)
116
+ end
117
+
118
+ it 'creates a license file' do
119
+ cli.create_license author
120
+ expect(File.exists?(filename)).to be_true
121
+ end
122
+
123
+ it { expect(license).to include(author) }
124
+ it { expect(license).to include(Time.now.year.to_s) }
125
+ end
126
+ end
127
+ end
@@ -0,0 +1,27 @@
1
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
2
+ $: << File.join(APP_ROOT, 'lib/hive')
3
+
4
+ RSpec.configure do |config|
5
+ config.treat_symbols_as_metadata_keys_with_true_values = true
6
+ config.run_all_when_everything_filtered = true
7
+ config.filter_run :focus
8
+ config.order = 'random'
9
+
10
+ # clean up generated files
11
+ generated_files = %w(manifest.json icon.png index.html README.md LICENSE.txt)
12
+ generated_files << File.join('javascripts', 'hiveapp-api-mock.js')
13
+ config.before do
14
+ generated_files.each do |filename|
15
+ FileUtils.mv(filename, "#{filename}.tmp") if File.exists?(filename)
16
+ end
17
+ end
18
+ config.after do
19
+ generated_files.each do |filename|
20
+ if File.exists?("#{filename}.tmp")
21
+ FileUtils.mv( "#{filename}.tmp", filename)
22
+ elsif File.exists?(filename)
23
+ File.delete(filename)
24
+ end
25
+ end
26
+ end
27
+ end
metadata ADDED
@@ -0,0 +1,148 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hive-toolbelt
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Wei Lu
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: active_support
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.5'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: debugger
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: All you need for developing Hive apps.
98
+ email:
99
+ - luwei.here@gmail.com
100
+ executables:
101
+ - hive
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - .gitignore
106
+ - .rspec
107
+ - Gemfile
108
+ - LICENSE.txt
109
+ - README.md
110
+ - Rakefile
111
+ - assets/LICENSE.txt
112
+ - assets/README.md
113
+ - assets/html/index.html
114
+ - assets/images/icon.png
115
+ - assets/javascripts/hiveapp-api-mock.js
116
+ - bin/hive
117
+ - hive-toolbelt.gemspec
118
+ - lib/hive/toolbelt.rb
119
+ - lib/hive/toolbelt/version.rb
120
+ - spec/lib/hive/toolbelt_spec.rb
121
+ - spec/spec_helper.rb
122
+ homepage: https://github.com/hivewallet/toolbelt
123
+ licenses:
124
+ - MIT
125
+ metadata: {}
126
+ post_install_message:
127
+ rdoc_options: []
128
+ require_paths:
129
+ - lib
130
+ required_ruby_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - '>='
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ required_rubygems_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ requirements: []
141
+ rubyforge_project:
142
+ rubygems_version: 2.0.3
143
+ signing_key:
144
+ specification_version: 4
145
+ summary: Command Line Interface for the Hive wallet
146
+ test_files:
147
+ - spec/lib/hive/toolbelt_spec.rb
148
+ - spec/spec_helper.rb