methadone 1.5.1 → 1.6.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: 62d6b61845648eb9ef67b68270c29d36a36b75c3
4
- data.tar.gz: 93950790b307186c6dca1bd70978e80ac53135a1
3
+ metadata.gz: 28edf03f317826eca04da77d8a6fb3bf4fb0c977
4
+ data.tar.gz: 64b4d8b287ec915faee422425d9054ef79f95b73
5
5
  SHA512:
6
- metadata.gz: a80f01dde40c877f514314d07ded91187d7b9e2ee8c913f1bbdf918b0fc96303a18930e33e513ce3c1b7d2e07f4cb344ef5561a515c89ff6e9825a6b87fdc5b5
7
- data.tar.gz: 9395294305318487bc0f653afbcefab6f184e77654c7a92d3db020508c7c37aac8f085fc2c43bb17de722b69252333d6e8cf64d1e9b9a0815c35183664112621
6
+ metadata.gz: 1e4c6b2c4b41d4f25b6d60c1dc8a2975da51a39cc62bb8073457b61a6c306043b177705f75f10c06cb62452a779730db5263616c7d9e35b5ae6886afe29d8229
7
+ data.tar.gz: 1a0e5f3bc306390de60e25f4a248dc5343e97362fdc4afd7a17a7c854069520af02d480287743a54eb3a7ff358174344d8ed0d718855e3aa5c708997ee1471bc
data/bin/methadone CHANGED
@@ -50,10 +50,25 @@ main do |app_name|
50
50
  end
51
51
 
52
52
 
53
+ gemspec = "#{gemname}.gemspec"
54
+ gem_variable = File.open(gemspec) { |x| x.read }.match(/(\w+)\.executables/)[1]
55
+
53
56
  license = options[:license]
54
57
  warn "warning: your app has no license" unless license
55
58
  license = nil if license == 'NONE'
56
- copy_file "#{options[:license]}_LICENSE.txt", :as => "LICENSE.txt" if license
59
+ if license
60
+ copy_file "#{options[:license]}_LICENSE.txt", :as => "LICENSE.txt"
61
+ else
62
+ #Remove the MIT license generated by `bundle gem`
63
+ debug "Making sure no LICENSE.txt file exists at the root of the repo"
64
+ FileUtils.rm_f "LICENSE.txt"
65
+ end
66
+
67
+ #Ensure the gemspec file mentions the correct license
68
+ gemspec_content = File.read(gemspec)
69
+ gemspec_content.gsub!(/(^\s*#{gem_variable}\.license\s*=\s*).*/,"\\1#{license.to_s.inspect}")
70
+ File.open(gemspec,'w') {|f| f.write gemspec_content }
71
+
57
72
 
58
73
  copy_file "README.rdoc", :binding => binding if using_readme
59
74
 
@@ -61,8 +76,6 @@ main do |app_name|
61
76
  copy_file "features/step_definitions/executable_steps.rb", :as => "#{gemname}_steps.rb"
62
77
  copy_file "bin/executable", :as => gemname, :executable => true, :binding => binding
63
78
 
64
- gemspec = "#{gemname}.gemspec"
65
- gem_variable = File.open(gemspec) { |x| x.read }.match(/(\w+)\.executables/)[1]
66
79
  add_to_file gemspec, [
67
80
  " #{gem_variable}.add_development_dependency('rdoc')",
68
81
  " #{gem_variable}.add_development_dependency('aruba')",
@@ -75,6 +88,8 @@ main do |app_name|
75
88
  " #{gem_variable}.add_development_dependency('rspec', '~> 2.99')",
76
89
  ], :before => /^end\s*$/
77
90
  end
91
+
92
+ sh! %q(git add --all .)
78
93
  end
79
94
 
80
95
  options[:readme] = true
@@ -148,3 +148,10 @@ Feature: Bootstrap a new command-line app
148
148
  And the banner should document that this app's arguments are:
149
149
  |app_name|which is required|
150
150
  And there should be a one line summary of what the app does
151
+
152
+ Scenario: The whole initial state of the app has been staged with git
153
+ Given I successfully run `methadone -l custom tmp/newgem`
154
+ And I cd to "tmp/newgem"
155
+ When I successfully run `git ls-files --others --deleted `
156
+ Then the output should match /\A\Z/
157
+
@@ -11,29 +11,6 @@ Feature: Users should get the license included
11
11
  Then newgem's license should be an empty file
12
12
  And the README should reference the need for a license
13
13
 
14
- Scenario Outline: Include one of a few stock licenses
15
- When I successfully run `methadone -l <license> tmp/newgem`
16
- Then newgem's license should be the <license> license
17
- And the README should reference this license
18
-
19
- Examples:
20
- |license|
21
- |apache|
22
- |mit|
23
- |gplv2|
24
- |gplv3|
25
-
26
- Scenario Outline: Stock licenses should be personalized
27
- When I successfully run `methadone -l <license> tmp/newgem`
28
- Then LICENSE.txt should contain user information and program name
29
-
30
- Examples:
31
- |license|
32
- |apache|
33
- |mit|
34
- |gplv2|
35
- |gplv3|
36
-
37
14
  Scenario: We only support a few licenses
38
15
  When I run `methadone -l foobar tmp/newgem`
39
16
  Then the exit status should not be 0
@@ -43,8 +20,24 @@ Feature: Users should get the license included
43
20
  When I successfully run `methadone tmp/newgem`
44
21
  Then the stderr should contain "warning: your app has no license"
45
22
  And the README should not reference a license
23
+ And the file "tmp/newgem/LICENSE.txt" should not exist
46
24
 
47
25
  Scenario: No license specified explicitly
48
26
  When I successfully run `methadone -l NONE tmp/newgem`
49
27
  Then the stderr should not contain "warning: your app has no license"
50
28
  And the README should not reference a license
29
+ And the file "tmp/newgem/LICENSE.txt" should not exist
30
+
31
+ Scenario Outline: Include one of a few stock licenses
32
+ When I successfully run `methadone -l <license> tmp/newgem`
33
+ Then newgem's license should be the <license> license
34
+ And the README should reference this license
35
+ And LICENSE.txt should contain user information and program name
36
+
37
+ Examples:
38
+ |license|
39
+ |apache|
40
+ |mit|
41
+ |gplv2|
42
+ |gplv3|
43
+
@@ -5,6 +5,7 @@ end
5
5
  Then /^newgem's license should be the (\w+) license/ do |license|
6
6
  @license = license
7
7
  step %(a file named "tmp/newgem/LICENSE.txt" should exist)
8
+ step %(the file "tmp/newgem/newgem.gemspec" should match /#{@license}/)
8
9
  end
9
10
 
10
11
  Then /^the README should reference this license$/ do
@@ -1,3 +1,3 @@
1
1
  module Methadone #:nodoc:
2
- VERSION = "1.5.1" #:nodoc:
2
+ VERSION = "1.6.0" #:nodoc:
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: methadone
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - davetron5000
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-30 00:00:00.000000000 Z
11
+ date: 2014-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler