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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 710aff438dfb2e4e4e135098175d13949f951f09
4
- data.tar.gz: 054c2aba74586ad31555d9212b43c45c2839704b
3
+ metadata.gz: 9cbbd8cd4054b52180d8a2aa70a5835c95501469
4
+ data.tar.gz: 2b658556c2a281b5dce1c89d407435fe751ec1cb
5
5
  SHA512:
6
- metadata.gz: e9d6c7bc25e9a3b1a271fe4fea4e7a97ac09fa3edeb1ad674ee08a05c44f4f7d745dd4bfca6bb5d9d684b04bd5364f1a8f771e0e2818c2ad83cb27172496bbb0
7
- data.tar.gz: be4ecd053aef431413ab988c0486cbc603e88435ff7edc8190462816ce3f6fe99f5c9d721fd19af9263eafa9756ce99d591325eb05b5c8d09057362494fc4745
6
+ metadata.gz: 88a210703a90d32b9b1ea13b95fe8f96a7f8257a38fae3f29c15d0cfc17eb109285cc910e17b6b504c82670507c9d23a0e61f083b7ea08175fbee8394c84402b
7
+ data.tar.gz: 23d1cbf2d97cc2f0b5061b6e234ecbd9d3e17f49cd3b9bc873831f178e55349f3ae65b310b6302c3c757cda3aab6529b596602f00a0138cfa8b8b475981b7b25
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
  /tmp/
10
10
  /example/.bundle/
11
11
  /example/vendor/
12
+ /node_modules/
@@ -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
@@ -1,3 +1,9 @@
1
+ <a name="0.4.0"></a>
2
+ # [0.4.0](https://github.com/packsaddle/ruby-parse_gemspec-cli/compare/v0.3.0...v0.4.0) (2015-09-23)
3
+
4
+ * CLI improvement
5
+
6
+
1
7
  <a name"0.3.0"></a>
2
8
  ### 0.3.0 (2015-09-24)
3
9
 
@@ -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
- puts "ParseGemspec::Cli version #{VERSION}"
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
- option :load, type: :string, required: true, aliases: '-l'
21
- def parse
24
+ def parse(gemspec_path)
22
25
  setup_logger(options)
23
- puts MultiJson.dump(
26
+ print MultiJson.dump(
24
27
  ParseGemspec::Specification.load(
25
- options[:load]
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
@@ -1,5 +1,5 @@
1
1
  module ParseGemspec
2
2
  module Cli
3
- VERSION = '0.3.0'
3
+ VERSION = '0.4.0'
4
4
  end
5
5
  end
data/package.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "devDependencies": {
3
+ "add-stream": "^1.0.0",
4
+ "conventional-changelog": "0.4.3",
5
+ "tempfile": "^1.1.1",
6
+ "urijs": "^1.16.1"
7
+ },
8
+ "scripts": {
9
+ "changelog": "bin/conventional-changelog"
10
+ }
11
+ }
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.3.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: