parse_gemspec-cli 0.3.0 → 0.4.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/.gitignore +1 -0
- data/bin/conventional-changelog +42 -0
- data/bin/setup +6 -0
- data/changelog.md +6 -0
- data/lib/parse_gemspec/cli/cli.rb +16 -7
- data/lib/parse_gemspec/cli/version.rb +1 -1
- data/package.json +11 -0
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9cbbd8cd4054b52180d8a2aa70a5835c95501469
|
|
4
|
+
data.tar.gz: 2b658556c2a281b5dce1c89d407435fe751ec1cb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 88a210703a90d32b9b1ea13b95fe8f96a7f8257a38fae3f29c15d0cfc17eb109285cc910e17b6b504c82670507c9d23a0e61f083b7ea08175fbee8394c84402b
|
|
7
|
+
data.tar.gz: 23d1cbf2d97cc2f0b5061b6e234ecbd9d3e17f49cd3b9bc873831f178e55349f3ae65b310b6302c3c757cda3aab6529b596602f00a0138cfa8b8b475981b7b25
|
data/.gitignore
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
var fs = require('fs');
|
|
4
|
+
var execSync = require('child_process').execSync;
|
|
5
|
+
var conventionalChangelog = require('conventional-changelog');
|
|
6
|
+
var tempfile = require('tempfile');
|
|
7
|
+
var addStream = require('add-stream');
|
|
8
|
+
var URI = require('urijs');
|
|
9
|
+
|
|
10
|
+
var gemspec = JSON.parse(execSync('bundle exec exe/parse-gemspec-cli parse_gemspec-cli.gemspec'));
|
|
11
|
+
|
|
12
|
+
var options = { preset: 'angular' };
|
|
13
|
+
var homepageUrl = gemspec.homepage;
|
|
14
|
+
var url = new URI(homepageUrl);
|
|
15
|
+
var host = url.protocol() + '://' + url.authority();
|
|
16
|
+
var owner = url.pathname().split('/')[1];
|
|
17
|
+
var repository = url.pathname().split('/')[2];
|
|
18
|
+
|
|
19
|
+
var templateContext = {
|
|
20
|
+
version: gemspec.version,
|
|
21
|
+
host: host,
|
|
22
|
+
owner: owner,
|
|
23
|
+
repository: repository
|
|
24
|
+
};
|
|
25
|
+
var infile = 'changelog.md';
|
|
26
|
+
var outfile = 'changelog.md';
|
|
27
|
+
var changelogStream = conventionalChangelog(options, templateContext)
|
|
28
|
+
.on('error', function(err) {
|
|
29
|
+
console.error(err.toString());
|
|
30
|
+
process.exit(1);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
var tmp = tempfile();
|
|
34
|
+
var readStream = fs.createReadStream(infile);
|
|
35
|
+
|
|
36
|
+
changelogStream
|
|
37
|
+
.pipe(addStream(readStream))
|
|
38
|
+
.pipe(fs.createWriteStream(tmp))
|
|
39
|
+
.on('finish', function() {
|
|
40
|
+
fs.createReadStream(tmp)
|
|
41
|
+
.pipe(fs.createWriteStream(outfile));
|
|
42
|
+
});
|
data/bin/setup
CHANGED
|
@@ -7,3 +7,9 @@ unless ENV['CI']
|
|
|
7
7
|
$stderr.puts err
|
|
8
8
|
exit status.exitstatus if !status.exitstatus.nil? && status.exitstatus != 0
|
|
9
9
|
end
|
|
10
|
+
unless ENV['CI']
|
|
11
|
+
out, err, status = Open3.capture3(*%w(npm install))
|
|
12
|
+
$stdout.puts out
|
|
13
|
+
$stderr.puts err
|
|
14
|
+
exit status.exitstatus if !status.exitstatus.nil? && status.exitstatus != 0
|
|
15
|
+
end
|
data/changelog.md
CHANGED
|
@@ -9,26 +9,30 @@ module ParseGemspec
|
|
|
9
9
|
|
|
10
10
|
desc 'version', 'Show the ParseGemspec::Cli version'
|
|
11
11
|
map %w(-v --version) => :version
|
|
12
|
-
|
|
12
|
+
option :digit, type: :boolean, default: false
|
|
13
13
|
def version
|
|
14
|
-
|
|
14
|
+
if options[:digit]
|
|
15
|
+
print VERSION
|
|
16
|
+
else
|
|
17
|
+
puts "ParseGemspec::Cli version #{VERSION}"
|
|
18
|
+
end
|
|
15
19
|
end
|
|
16
20
|
|
|
17
|
-
desc 'parse', 'Parse *.gemspec'
|
|
21
|
+
desc 'parse GEMSPEC_PATH', 'Parse *.gemspec'
|
|
18
22
|
option :debug, type: :boolean, default: false
|
|
19
23
|
option :verbose, type: :boolean, default: false
|
|
20
|
-
|
|
21
|
-
def parse
|
|
24
|
+
def parse(gemspec_path)
|
|
22
25
|
setup_logger(options)
|
|
23
|
-
|
|
26
|
+
print MultiJson.dump(
|
|
24
27
|
ParseGemspec::Specification.load(
|
|
25
|
-
|
|
28
|
+
gemspec_path
|
|
26
29
|
).to_hash_object
|
|
27
30
|
)
|
|
28
31
|
rescue StandardError => e
|
|
29
32
|
suggest_messages(options)
|
|
30
33
|
raise e
|
|
31
34
|
end
|
|
35
|
+
default_command :parse
|
|
32
36
|
|
|
33
37
|
no_commands do
|
|
34
38
|
def logger
|
|
@@ -50,6 +54,11 @@ module ParseGemspec
|
|
|
50
54
|
logger.error 'options:'
|
|
51
55
|
logger.error options
|
|
52
56
|
end
|
|
57
|
+
|
|
58
|
+
# http://stackoverflow.com/a/23955971/104080
|
|
59
|
+
def method_missing(method, *args)
|
|
60
|
+
self.class.start([self.class.default_command, method.to_s] + args)
|
|
61
|
+
end
|
|
53
62
|
end
|
|
54
63
|
end
|
|
55
64
|
end
|
data/package.json
ADDED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: parse_gemspec-cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- sanemat
|
|
@@ -111,6 +111,7 @@ files:
|
|
|
111
111
|
- README.md
|
|
112
112
|
- Rakefile
|
|
113
113
|
- bin/console
|
|
114
|
+
- bin/conventional-changelog
|
|
114
115
|
- bin/setup
|
|
115
116
|
- changelog.md
|
|
116
117
|
- example/Gemfile
|
|
@@ -121,6 +122,7 @@ files:
|
|
|
121
122
|
- lib/parse_gemspec/cli/cli.rb
|
|
122
123
|
- lib/parse_gemspec/cli/constants.rb
|
|
123
124
|
- lib/parse_gemspec/cli/version.rb
|
|
125
|
+
- package.json
|
|
124
126
|
- parse_gemspec-cli.gemspec
|
|
125
127
|
homepage: https://github.com/packsaddle/ruby-parse_gemspec-cli
|
|
126
128
|
licenses:
|