versionate 0.2.0 → 0.3.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: 94e6a72320c0db01b6e702717d6de8d645203dfd
4
- data.tar.gz: cef7b4f819ac70cf7b2b12ed661a0cb9d160ba3f
3
+ metadata.gz: 3bda0008ebbf950eb249f938fc4f6e96fdc611e7
4
+ data.tar.gz: 18dfec73c19aaaa909b2248c4af80c6ad840e70e
5
5
  SHA512:
6
- metadata.gz: 2325185701938205d5ae1833b70e35980b55c265627b7cacefade5eec66429fc2cc087897ed28a55a7a43360c0089968382e6020c40759fb3d91b95700df40fe
7
- data.tar.gz: ed9468e6b9564db667f74436ab68ba1fcfc28988eb9b712c413fbd98af99c7e2d91774c37cc8615da2d02ad1d46e07b3e7d52c34986aa885ec5b2e1686c69da4
6
+ metadata.gz: aa45fd05c5adc3b6a90f945a132a28da5bbe8972128bc5b255052f739fd0cc6297f37f99efc4c3be8f7da4a7b820e6a87780430d5c3174cd0743406fe61388fe
7
+ data.tar.gz: 9f84a1ca603c9b123768e5ce3c55760cd581d27e38e3cc839a3cdc8146c0eb15deee341fbbc977095ad6a73b136f8bbd1cebfe30b0762cb7ae5ce4e0adb58914
data/README.md CHANGED
@@ -16,10 +16,10 @@ $ versionate
16
16
  ```
17
17
 
18
18
  If, for some odd reason, your Gemfile is called something other than “Gemfile”,
19
- you can specify the name as an argument to the sub-command `version`, like this:
19
+ you can specify the name as an argument to the sub-command `process`, like this:
20
20
 
21
21
  ```bash
22
- $ versionate version file_with_gems.rb
22
+ $ versionate process file_with_gems.rb
23
23
  ```
24
24
 
25
25
  ### Options
@@ -42,7 +42,7 @@ $ versionate --specifier="~>"
42
42
  Of course, this also works when using the more verbose syntax:
43
43
 
44
44
  ```bash
45
- $ versionate version --no-patch --specifier="~>" Gemfile
45
+ $ versionate process --no-patch --specifier="~>" Gemfile
46
46
  ```
47
47
 
48
48
  ### Getting help
@@ -12,6 +12,11 @@ module Versionate
12
12
  type: :boolean,
13
13
  desc: "Whether or not to keep patch version (default: true)"
14
14
 
15
+ option :pre,
16
+ type: :boolean,
17
+ desc: "Whether or not to insert unstable versions (default: false)",
18
+ default: false
19
+
15
20
  option :specifier,
16
21
  type: :string,
17
22
  desc: "Specifier to be prepended to version"
@@ -1,3 +1,3 @@
1
1
  module Versionate
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -11,13 +11,18 @@ module Versionate
11
11
  end
12
12
  end
13
13
 
14
- def latest_version_for(gem_name)
15
- provider.info(gem_name.to_sym)["version"]
14
+ def latest_version_for(gem_name, stable:)
15
+ if stable
16
+ provider.info(gem_name.to_sym)["version"]
17
+ else
18
+ provider.versions(gem_name.to_sym).max_by { |v| v["number"] }["number"]
19
+ end
16
20
  end
17
21
 
18
22
  def process(filename, options = {})
19
23
  patch = options.fetch("patch", true)
20
24
  specifier = options["specifier"]
25
+ stable = !options["pre"]
21
26
 
22
27
  orig_file = File.open(filename)
23
28
  tmp = StringIO.new
@@ -26,7 +31,7 @@ module Versionate
26
31
  gem_name = gem_and_only_gem_from_line line
27
32
 
28
33
  if gem_name
29
- version = latest_version_for gem_name
34
+ version = latest_version_for gem_name, stable: stable
30
35
 
31
36
  version = remove_patch_version version unless patch
32
37
  version = with_specifier(specifier, version) if specifier
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: versionate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sindre Moen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-02 00:00:00.000000000 Z
11
+ date: 2014-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gems