rails-lineman 0.0.1 → 0.0.2

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: 98e319f1d43ad61aee528dee66183d0d25263e34
4
- data.tar.gz: 52f92a10c47f5f1014a7b4d45cca8f358660cd8d
3
+ metadata.gz: 0c8113d485ea10ec81911a937c61c491b3b5f93c
4
+ data.tar.gz: a9cf0710d4a806f87fe12af899e9bf03cf004968
5
5
  SHA512:
6
- metadata.gz: 7cc1e5d6a863e4b5c3414ad5c643a661a816c15cf0288f7aa21ee95717cee541d5b1a7faef47ad70310fec9875dfd493dff03bdd7f90d3b63201cf2ed506b723
7
- data.tar.gz: d31bbed28501458cc1e85c3206386f4751c29ddbd9d75d6195dd136cf77853597dab916f02aafc701f3c2e5037a95659098b9fbac6652ea4c4f950e043ce409f
6
+ metadata.gz: 66e15c3476e16b121dd3c60b54d1a60995f69972ab3ee6fa1c6c4d004f4c7c668d3e87c689b56abf8ac07bdc52e101183adcc2c0f523bfd3329308ad67687fc6
7
+ data.tar.gz: 04e4477818e3e1543deab05e42617476bb6104968341399b9d927d510b910ab4911b4ca1e343655c21d030746a315a28fd32a3ecff6e465266238359ac70a6a3
@@ -13,8 +13,10 @@ module RailsLineman
13
13
  def build
14
14
  absolutify_lineman_path
15
15
  chdir @lineman_project_location do
16
+ install_node_js_on_heroku
16
17
  run_npm_install
17
18
  run_lineman_build
19
+ delete_node_js_from_heroku
18
20
  end
19
21
  copy_javascripts
20
22
  add_javascripts_to_precompile_list
@@ -52,6 +54,25 @@ module RailsLineman
52
54
  Dir.chdir(og_dir)
53
55
  end
54
56
 
57
+ def install_node_js_on_heroku
58
+ if heroku?
59
+ puts "It looks like we're on heroku, so let's install Node.js"
60
+ system <<-BASH
61
+ node_version=$(curl --silent --get https://semver.io/node/resolve)
62
+ node_url="http://s3pository.heroku.com/node/v$node_version/node-v$node_version-linux-x64.tar.gz"
63
+ curl "$node_url" -s -o - | tar xzf - -C .
64
+ mv node-v$node_version-linux-x64 heroku_node_install
65
+ chmod +x heroku_node_install/bin/*
66
+ export PATH="$PATH:$(pwd)/heroku_node_install/bin"
67
+ BASH
68
+ ENV['PATH'] += ":#{Dir.pwd}/heroku_node_install/bin"
69
+ end
70
+ end
71
+
72
+ def heroku?
73
+ ENV['DYNO'] && ENV['STACK']
74
+ end
75
+
55
76
  def run_npm_install
56
77
  return if system "npm install"
57
78
  raise <<-ERROR
@@ -81,6 +102,10 @@ module RailsLineman
81
102
  ERROR
82
103
  end
83
104
 
105
+ def delete_node_js_from_heroku
106
+ system "rm -rf heroku_node_install" if heroku?
107
+ end
108
+
84
109
  def copy_javascripts
85
110
  FileUtils.cp_r(File.join(@lineman_project_location, "dist", "js"), @javascripts_destination)
86
111
  end
@@ -1,3 +1,3 @@
1
1
  module RailsLineman
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-lineman
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
  - Justin Searls