skeletor_cli 0.1.0.2 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e8e9985e8921bc93188f5a1a443f2ddffd0fd78d
4
- data.tar.gz: 128d11aea80bb70e58ff18fbc945f1d897610f40
3
+ metadata.gz: b1719f5362a9395f59a167d354491df3b1012edf
4
+ data.tar.gz: cc4dc4f795ffa82adfc570a704eada45ad07683a
5
5
  SHA512:
6
- metadata.gz: 3332e8c0c4b398f17ab6f44f08c5688306489a6120ef36359e787efcff03e6af93c0e89c4e4d476d9bd42c907b1a387a2c8ec18ffb49d82e6a2fa00715069192
7
- data.tar.gz: c36a970f62376b53f4903374a79bef72d803147c6470526729babbbad6a50be0ddd397e06bff84d434ed790b6cb56fac1b9c804c9efeb126abcbe9326095ef80
6
+ metadata.gz: 598b5465d37f8c038396243ad79e09853e176391e451371dc7d4e82f8880ebd09fca489e1866b1ab7e2d88658dfed9e0301c1d35ee80ac0e97ce5ffd80f1408f
7
+ data.tar.gz: 66accc83e90fb58afadf2650439fceafc14d37502b89d09bff2041a96f5cffb9cf2ee34479bebd9977530e7bf8950fcafee75bc085600dd666dc60d233dd06a8
data/bin/version ADDED
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ current_version = File.read('./lib/skeletor_cli/version.rb').split('"')[1]
4
+ version_upgrade = ARGV[0]
5
+ versioning = current_version.split('.')
6
+ major = versioning[0].to_i
7
+ minor = versioning[1].to_i
8
+ patch = versioning[2].to_i
9
+ beta = versioning[3].to_i || -1
10
+
11
+ puts `rm skeletor_cli-#{current_version}.gem`
12
+
13
+ if version_upgrade == 'major'
14
+ major += 1
15
+ minor = 0
16
+ patch = 0
17
+ beta = -1
18
+ elsif version_upgrade == 'minor'
19
+ minor += 1
20
+ patch = 0
21
+ beta = -1
22
+ elsif version_upgrade == 'patch'
23
+ patch += 1
24
+ beta = -1
25
+ else
26
+ beta += 1
27
+ end
28
+
29
+ version_number = "#{major}.#{minor}.#{patch}#{beta > -1 ? ".#{beta}" : ''}"
30
+
31
+ version_file = <<-VERSION_FILE
32
+ module SkeletorCLI
33
+ VERSION = "#{version_number}"
34
+ end
35
+ VERSION_FILE
36
+ File.open('./lib/skeletor_cli/version.rb', 'w') { |f| f.write(version_file) }
37
+ puts `gem build skeletor_cli.gemspec`
38
+ puts `gem install skeletor_cli-#{version_number}.gem`
@@ -5,12 +5,34 @@ module SkeletorCLI
5
5
  def self.build(skeleton, app_name)
6
6
  gemfile(true) do
7
7
  source 'https://rubygems.org'
8
- gem 'railties', skeleton[:gems][:rails][:version]
8
+ if skeleton[:gems][:rails][:version].nil? || skeleton[:gems][:rails][:version] == ''
9
+ gem 'rails'
10
+ else
11
+ gem 'rails', skeleton[:gems][:rails][:version]
12
+ end
9
13
  end
10
14
  require 'rails/generators'
11
15
  require 'rails/generators/rails/app/app_generator'
12
- args = [app_name]
16
+ template_file = template(skeleton, app_name)
17
+ args = [app_name, "--database=#{skeleton[:database]}", "--template=#{template_file.path}"]
13
18
  Rails::Generators::AppGenerator.start args
19
+ template_file.unlink
20
+ end
21
+
22
+ def self.template(skeleton, app_name)
23
+ file = Tempfile.new('skeletor_rails_template')
24
+ file.write <<-TEMPLATE
25
+ create_file '.ruby-gemset', #{'<<-GEMSET'}
26
+ #{app_name}
27
+ GEMSET
28
+ run "rm Gemfile && touch Gemfile"
29
+ add_source 'https://rubygems.org'
30
+ #{skeleton[:gems].map do |gem_name, metadata|
31
+ "gem '#{gem_name}'#{metadata[:version] == '' || metadata[:version].nil? ? '' : ", '#{metadata[:version]}'"}"
32
+ end.join("\n")}
33
+ TEMPLATE
34
+ file.close
35
+ file
14
36
  end
15
37
  end
16
38
  end
@@ -1,3 +1,3 @@
1
1
  module SkeletorCLI
2
- VERSION = "0.1.0.2"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skeletor_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.2
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dean
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-07 00:00:00.000000000 Z
11
+ date: 2016-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: skeletor_api
@@ -91,6 +91,7 @@ files:
91
91
  - bin/console
92
92
  - bin/setup
93
93
  - bin/skeletor
94
+ - bin/version
94
95
  - lib/skeletor_cli.rb
95
96
  - lib/skeletor_cli/cli.rb
96
97
  - lib/skeletor_cli/rails_builder.rb