new 0.0.11 → 0.0.12
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/.new +1 -1
- data/Guardfile +1 -1
- data/lib/new/cli.rb +4 -4
- data/lib/new/version.rb +30 -25
- data/spec/lib/new/cli_spec.rb +4 -1
- data/spec/lib/new/version_spec.rb +6 -3
- data/tasks/gem/gem.rb +11 -2
- data/tasks/gem/gem_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac708e8f62fd995e12729e8ad37c663cbf5e8428
|
4
|
+
data.tar.gz: b3af8782b660ada2c9c96f7a27363a8bdaa4b30d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d47f8afb9bed21ae1be841aa271353adbc57ebb91d10bf3611d982c92a6f015f05588b2f58d58e414750256686388a9f33ed30645c88fc33c347ec984461074d
|
7
|
+
data.tar.gz: ee279d28962eb4e738a3fade8abc2cfb511744699fc78041f7a89825d72c96e3f990d8519b91e93fe2fa3bbf8b425d1c81e5e38bec6248b77f605f30df5ff1fb
|
data/.new
CHANGED
data/Guardfile
CHANGED
@@ -6,7 +6,7 @@ guard :bundler do
|
|
6
6
|
watch('Gemfile')
|
7
7
|
end
|
8
8
|
|
9
|
-
guard :rspec, all_after_pass: true, all_on_start: true, cmd: 'bundle exec rspec
|
9
|
+
guard :rspec, all_after_pass: true, all_on_start: true, cmd: 'bundle exec rspec spec tasks ~/.new/tasks' do
|
10
10
|
watch(%r{^spec/.+_spec\.rb$})
|
11
11
|
watch(%r{^tasks/.+_spec\.rb$})
|
12
12
|
watch(%r{^tasks/(.+[^_spec])\.rb$}) { |m| "tasks/#{m[1]}_spec.rb" }
|
data/lib/new/cli.rb
CHANGED
@@ -34,19 +34,18 @@ class New::Cli < Thor
|
|
34
34
|
if Dir.exists? New::CUSTOM_DIR
|
35
35
|
New.say 'Home folder already exists.', type: :warn
|
36
36
|
else
|
37
|
-
# create
|
37
|
+
# create folders
|
38
38
|
New.say 'Creating home folder.', type: :success
|
39
|
-
FileUtils.mkdir_p New::CUSTOM_DIR
|
40
39
|
FileUtils.mkdir_p File.join(New::CUSTOM_DIR, New::TASKS_DIR_NAME)
|
41
40
|
FileUtils.mkdir_p File.join(New::CUSTOM_DIR, New::TEMPLATES_DIR_NAME)
|
42
41
|
|
43
42
|
# create config file
|
44
43
|
New.say 'Creating default configuration file.', type: :success
|
45
44
|
File.open File.join(New::CUSTOM_DIR, New::CONFIG_FILE), 'w' do |f|
|
46
|
-
f.write New::Template::CUSTOM_CONFIG_TEMPLATE.to_yaml
|
45
|
+
f.write New::Template::CUSTOM_CONFIG_TEMPLATE.deep_stringify_keys.to_yaml
|
47
46
|
end
|
48
47
|
|
49
|
-
New.say "Edit
|
48
|
+
New.say "Edit `#{File.join(New::CUSTOM_DIR, New::CONFIG_FILE)}` with your custom configuration details.", type: :warn
|
50
49
|
end
|
51
50
|
end
|
52
51
|
|
@@ -73,6 +72,7 @@ class New::Cli < Thor
|
|
73
72
|
New.say "No task '#{task}' found!", type: :fail
|
74
73
|
next
|
75
74
|
end
|
75
|
+
New.say ">>> Initializing #{task.to_s.humanize} Task...", type: :warn
|
76
76
|
"New::Task::#{task.to_s.classify}".constantize.new project_config
|
77
77
|
end
|
78
78
|
end
|
data/lib/new/version.rb
CHANGED
@@ -1,10 +1,35 @@
|
|
1
1
|
module New::Version
|
2
2
|
require 'semantic'
|
3
3
|
|
4
|
+
def part; @part; end
|
5
|
+
def previous_version; @previous_version; end
|
4
6
|
def version; @version; end
|
5
7
|
|
8
|
+
def bump_version previous_version, part = nil
|
9
|
+
@previous_version = get_version previous_version
|
10
|
+
@part = part ||= get_part
|
11
|
+
|
12
|
+
# bump version
|
13
|
+
case part
|
14
|
+
when :major
|
15
|
+
@previous_version.major += 1
|
16
|
+
@previous_version.minor = 0
|
17
|
+
@previous_version.patch = 0
|
18
|
+
when :minor
|
19
|
+
@previous_version.minor += 1
|
20
|
+
@previous_version.patch = 0
|
21
|
+
when :patch
|
22
|
+
@previous_version.patch += 1
|
23
|
+
end
|
24
|
+
|
25
|
+
# set new version
|
26
|
+
@version = @previous_version
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
6
31
|
def get_part
|
7
|
-
New.say " Current Version: #{
|
32
|
+
New.say " Current Version: #{previous_version}", type: :success
|
8
33
|
New.say " Specify which part to bump: [#{'Mmp'.green}] (#{'M'.green}ajor / #{'m'.green}inor / #{'p'.green}atch)"
|
9
34
|
part = STDIN.gets.chomp!
|
10
35
|
|
@@ -18,31 +43,11 @@ module New::Version
|
|
18
43
|
end
|
19
44
|
end
|
20
45
|
|
21
|
-
def
|
22
|
-
|
23
|
-
|
24
|
-
case part
|
25
|
-
when :major
|
26
|
-
version.major += 1
|
27
|
-
version.minor = 0
|
28
|
-
version.patch = 0
|
29
|
-
when :minor
|
30
|
-
version.minor += 1
|
31
|
-
version.patch = 0
|
32
|
-
when :patch
|
33
|
-
version.patch += 1
|
34
|
-
end
|
35
|
-
|
36
|
-
version
|
37
|
-
end
|
38
|
-
|
39
|
-
private
|
40
|
-
|
41
|
-
def get_version string
|
42
|
-
@version ||= begin
|
43
|
-
Semantic::Version.new string
|
46
|
+
def get_version version
|
47
|
+
begin
|
48
|
+
Semantic::Version.new version.to_s
|
44
49
|
rescue
|
45
|
-
New.say "#{
|
50
|
+
New.say "#{version} is not a semantic version. Use format `1.2.3`", type: :fail
|
46
51
|
exit
|
47
52
|
end
|
48
53
|
end
|
data/spec/lib/new/cli_spec.rb
CHANGED
@@ -40,7 +40,10 @@ describe New::Cli do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'should create .new file' do
|
43
|
-
expect(File.exists?(root('.tmp', '.new',
|
43
|
+
expect(File.exists?(root('.tmp', '.new', New::CONFIG_FILE))).to be_true
|
44
|
+
|
45
|
+
# Check that the keys are properly formatted in the yaml file
|
46
|
+
expect(File.read(root('.tmp', '.new', New::CONFIG_FILE))).to match /^version: 0.0.0$/
|
44
47
|
end
|
45
48
|
|
46
49
|
it 'should create an empty templates & tasks dir' do
|
@@ -9,15 +9,18 @@ describe New::Version do
|
|
9
9
|
|
10
10
|
describe '#bump_version' do
|
11
11
|
it 'should bump the major version' do
|
12
|
-
|
12
|
+
version.bump_version('1.2.3', :major)
|
13
|
+
expect(version.version.to_s).to eq '2.0.0'
|
13
14
|
end
|
14
15
|
|
15
16
|
it 'should bump the minor version' do
|
16
|
-
|
17
|
+
version.bump_version('1.2.3', :minor)
|
18
|
+
expect(version.version.to_s).to eq '1.3.0'
|
17
19
|
end
|
18
20
|
|
19
21
|
it 'should bump the patch version' do
|
20
|
-
|
22
|
+
version.bump_version('1.2.3', :patch)
|
23
|
+
expect(version.version.to_s).to eq '1.2.4'
|
21
24
|
end
|
22
25
|
end
|
23
26
|
end
|
data/tasks/gem/gem.rb
CHANGED
@@ -24,16 +24,18 @@ class New::Task::Gem < New::Task
|
|
24
24
|
write_gemspec
|
25
25
|
write_config
|
26
26
|
deploy
|
27
|
+
|
28
|
+
New.say "Version #{project_options[:version].green} of the #{project_options[:project_name].green} gem successfully published."
|
27
29
|
end
|
28
30
|
|
29
31
|
private
|
30
32
|
|
31
33
|
def set_version
|
32
34
|
# bump version
|
33
|
-
|
35
|
+
bump_version project_options[:version]
|
34
36
|
|
35
37
|
# set new version to config
|
36
|
-
project_options[:version] = version
|
38
|
+
project_options[:version] = version.to_s
|
37
39
|
end
|
38
40
|
|
39
41
|
# Check that any glob pattern attributes match existing files
|
@@ -130,6 +132,8 @@ private
|
|
130
132
|
end
|
131
133
|
|
132
134
|
def write_gemspec
|
135
|
+
New.say 'Updating `.gemspec` file...', type: :success
|
136
|
+
|
133
137
|
# process gemspec
|
134
138
|
interpolate File.join(File.dirname(__FILE__), '.gemspec.erb'), project_options
|
135
139
|
|
@@ -141,6 +145,8 @@ private
|
|
141
145
|
end
|
142
146
|
|
143
147
|
def write_config
|
148
|
+
New.say 'Updating `.new` file...', type: :success
|
149
|
+
|
144
150
|
writeable_options = project_options.dup
|
145
151
|
writeable_options.delete(:gemspec_string)
|
146
152
|
GLOB_ATTRIBUTES.each{ |a| writeable_options.delete(a) }
|
@@ -151,6 +157,9 @@ private
|
|
151
157
|
end
|
152
158
|
|
153
159
|
def deploy
|
160
|
+
New.say 'Pushing new gem version to rubygems...', type: :success
|
161
|
+
New.say ' ...This may take a bit', type: :warn
|
162
|
+
|
154
163
|
`gem update --system`
|
155
164
|
`gem build .gemspec`
|
156
165
|
`gem push #{@gemspec[:name]}-#{@gemspec[:version]}.gem`
|
data/tasks/gem/gem_spec.rb
CHANGED
@@ -91,7 +91,7 @@ describe New::Task::Gem do
|
|
91
91
|
it 'should set dependencies' do
|
92
92
|
gem_dependencies = @gem.send(:extract_gem_dependencies)
|
93
93
|
expect(gem_dependencies).to include " s.add_runtime_dependency 'foo', '~> 1.2.3'"
|
94
|
-
expect(gem_dependencies).to include " s.add_development_dependency 'bar', '
|
94
|
+
expect(gem_dependencies).to include " s.add_development_dependency 'bar', '>= 0'"
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: new
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Brewster
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|