shred 0.0.1 → 0.0.2

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: 5082b6bab04c4cf6a6b309058a72abe3eb781e89
4
- data.tar.gz: 5d3da579a0e632bf8f0a13b5cb29f85821de8e01
3
+ metadata.gz: 87f02895b1c18d05766bf9e02790f0e98314fda3
4
+ data.tar.gz: 0d966bf202d43cbcc82d2e3bb6a4c8333b1bd329
5
5
  SHA512:
6
- metadata.gz: 3d974d78ddce385509d35ca9c93f17ca4ec699a2f7d984651d24229185b9e4bf57de677ee2ea958214def1235ee248d0ba95719044e22b2783ce34672fa07271
7
- data.tar.gz: a35e3ab5342d5f19bc561e49a312d2c888eadbd19603058ea68be472a4dcd6df8e451d5a46b0777bfa2d2f128ada982b65319ac10c53d3f251ef4015ebc0cc2f
6
+ metadata.gz: f03a12b0426f62dc6131920cb9af95d0b4aa5ee605c54c75447bb22e4f129ff39640537d642c728dd9dcf430eb0d6ff424ae0f1d195b88fce5ca95230d158108
7
+ data.tar.gz: 14fd3fd258cc4001ec313518d3ef0a316206f270e7aca49103d63c770079e34a5774e55d6b1b80c1cd329d2288154f09f36a571f475e63f2a44fd0948652d6f8
@@ -12,20 +12,25 @@ module Shred
12
12
 
13
13
  Consults the commands.dotenv.heroku.vars config item to determine which Heroku
14
14
  config vars to add to the .env file.
15
+
16
+ If the commands.dotenv.custom config item lists custom config items, they are also
17
+ added to the .env file.
15
18
  LONGDESC
16
19
  def heroku
17
20
  app_name = cfg('heroku.app_name')
18
21
  vars = cfg('heroku.vars')
19
22
  mode = cfg('heroku.mode') == 'a' ? 'a' : 'w'
23
+ custom = cfg('custom.vars', required: false)
20
24
 
21
- authenticate_to_heroku
25
+ run_shell_command(ShellCommand.new(command_lines: 'heroku auth:whoami'))
22
26
 
23
27
  run_shell_command(ShellCommand.new(
24
28
  command_lines: "heroku config --app #{app_name} --shell",
25
29
  output: '.heroku.env'
26
30
  ))
27
- File.open('.heroku.env') do |input|
28
- File.open('.env', mode) do |output|
31
+
32
+ File.open('.env', mode) do |output|
33
+ File.open('.heroku.env') do |input|
29
34
  input.readlines.each do |line|
30
35
  line.chomp!
31
36
  if line =~ /^([^=]+)=/ && vars.include?($1)
@@ -33,35 +38,16 @@ module Shred
33
38
  end
34
39
  end
35
40
  end
36
- end
37
- File.unlink('.heroku.env')
38
- console.say_ok("Heroku config written to environment config file")
39
- end
40
-
41
- desc 'custom', 'Write custom config items to the environment config file'
42
- long_desc <<-LONGDESC
43
- Writes custom config items to the environment config file (.env).
41
+ File.unlink('.heroku.env')
42
+ console.say_ok("Heroku config written to environment config file")
44
43
 
45
- Consults the commands.dotenv.custom config item to determine the custom config items to
46
- add to the .env file.
47
- LONGDESC
48
- option :append, type: :boolean, default: false
49
- def custom
50
- custom = cfg('custom.vars')
51
- mode = cfg('custom.mode') == 'a' ? 'a' : 'w'
52
-
53
- File.open('.env', mode) do |output|
54
- custom.each do |key, value|
55
- output.write("#{key}=#{value}\n")
44
+ if custom
45
+ custom.each do |key, value|
46
+ output.write("#{key}=#{value}\n")
47
+ end
48
+ console.say_ok("Custom config written to environment config file")
56
49
  end
57
50
  end
58
- console.say_ok("Custom config written to environment config file")
59
- end
60
-
61
- no_commands do
62
- def authenticate_to_heroku
63
- run_shell_command(ShellCommand.new(command_lines: 'heroku auth:whoami'))
64
- end
65
51
  end
66
52
  end
67
53
  end
@@ -0,0 +1,16 @@
1
+ require 'shred/commands/base'
2
+
3
+ module Shred
4
+ module Commands
5
+ class JsDeps < Base
6
+ desc 'install', 'Install JavaScript dependencies'
7
+ def install
8
+ run_shell_command(ShellCommand.new(
9
+ command_lines: 'bin/rake bower:install',
10
+ success_msg: "JavaScript dependencies installed",
11
+ error_msg: "JavaScript dependencies could not be installed"
12
+ ))
13
+ end
14
+ end
15
+ end
16
+ end
@@ -49,6 +49,16 @@ module Shred
49
49
  end
50
50
  end
51
51
 
52
+ class NpmDependency < Dependency
53
+ def install(ctx)
54
+ super(ctx, "npm install #{sym}")
55
+ end
56
+
57
+ def update(ctx)
58
+ super(ctx, "npm update #{sym}")
59
+ end
60
+ end
61
+
52
62
  class ShellCommandDependency < Dependency
53
63
  attr_reader :install_command_lines, :update_command_lines
54
64
 
@@ -99,6 +109,8 @@ module Shred
99
109
  specs.each_with_object(m) { |svc, mm| mm << HomebrewDependency.new(sym: svc.to_sym) }
100
110
  when :rubygems
101
111
  specs.each_with_object(m) { |svc, mm| mm << RubyGemDependency.new(sym: svc.to_sym) }
112
+ when :npm
113
+ specs.each_with_object(m) { |svc, mm| mm << NpmDependency.new(sym: svc.to_sym) }
102
114
  when :shell
103
115
  specs.each_with_object(m) do |(svc, keys), mm|
104
116
  install = keys['install'] or
data/lib/shred/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Shred
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
data/lib/shred.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'shred/commands/app'
2
2
  require 'shred/commands/db'
3
3
  require 'shred/commands/dotenv'
4
+ require 'shred/commands/js_deps'
4
5
  require 'shred/commands/platform_deps'
5
6
  require 'shred/commands/ruby_deps'
6
7
  require 'shred/commands/services'
@@ -36,6 +37,10 @@ module Shred
36
37
  desc 'ruby_deps SUBCOMMAND ...ARGS', 'Manage Ruby dependencies'
37
38
  subcommand 'ruby_deps', Commands::RubyDeps
38
39
  end
40
+ if commands.key?('js_deps')
41
+ desc 'js_deps SUBCOMMAND ...ARGS', 'Manage JavaScript dependencies'
42
+ subcommand 'js_deps', Commands::JsDeps
43
+ end
39
44
  if commands.key?('db')
40
45
  desc 'db SUBCOMMAND ...ARGS', 'Manage the database'
41
46
  subcommand 'db', Commands::Db
@@ -55,8 +60,8 @@ module Shred
55
60
  if commands.key?('setup')
56
61
  desc 'setup', 'First-time application setup'
57
62
  def setup
58
- self.class.config['commands']['setup'].each do |cmd, subcmds|
59
- invoke(cmd.to_sym, subcmds.map(&:to_sym))
63
+ self.class.config['commands']['setup'].each do |(cmd, subcmd)|
64
+ invoke(cmd.to_sym, [subcmd.to_sym])
60
65
  end
61
66
  end
62
67
  end
data/shred.yml CHANGED
@@ -44,17 +44,11 @@ commands:
44
44
  start: mailcatcher
45
45
  stop: killall mailcatcher
46
46
  setup:
47
- platform_deps:
48
- - install
49
- services:
50
- - start
51
- ruby_deps:
52
- - install
53
- pg:
54
- - init
55
- dotenv:
56
- - heroku
57
- - custom
47
+ platform_deps: install
48
+ services: start
49
+ ruby_deps: install
50
+ db: init
51
+ dotenv: heroku
58
52
  test:
59
53
  server:
60
54
  - bin/rake spec
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shred
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian
@@ -73,6 +73,7 @@ files:
73
73
  - lib/shred/commands/base.rb
74
74
  - lib/shred/commands/db.rb
75
75
  - lib/shred/commands/dotenv.rb
76
+ - lib/shred/commands/js_deps.rb
76
77
  - lib/shred/commands/platform_deps.rb
77
78
  - lib/shred/commands/ruby_deps.rb
78
79
  - lib/shred/commands/services.rb