npm2gem 0.1.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.
Files changed (158) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +241 -0
  5. data/.ruby-version +1 -0
  6. data/.travis.yml +4 -0
  7. data/CODE_OF_CONDUCT.md +111 -0
  8. data/Gemfile +4 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +102 -0
  11. data/Rakefile +6 -0
  12. data/bin/console +14 -0
  13. data/bin/setup +7 -0
  14. data/exe/npm2gem +8 -0
  15. data/lib/npm2gem/cli.rb +56 -0
  16. data/lib/npm2gem/config.rb +21 -0
  17. data/lib/npm2gem/exception.rb +4 -0
  18. data/lib/npm2gem/file_copier.rb +65 -0
  19. data/lib/npm2gem/gem_version_updater.rb +42 -0
  20. data/lib/npm2gem/npm_install.rb +36 -0
  21. data/lib/npm2gem/version.rb +3 -0
  22. data/lib/npm2gem/version_updaters/base_file_updater.rb +29 -0
  23. data/lib/npm2gem/version_updaters/gemspec_updater.rb +12 -0
  24. data/lib/npm2gem/version_updaters/version_file_updater.rb +18 -0
  25. data/lib/npm2gem.rb +5 -0
  26. data/npm2gem.gemspec +31 -0
  27. data/spec/cli_spec.rb +22 -0
  28. data/spec/config_spec.rb +40 -0
  29. data/spec/dummy/Gemfile +4 -0
  30. data/spec/dummy/README.md +7 -0
  31. data/spec/dummy/Rakefile +6 -0
  32. data/spec/dummy/dummy.gemspec +31 -0
  33. data/spec/dummy/lib/dummy/version.rb +3 -0
  34. data/spec/dummy/lib/dummy.rb +8 -0
  35. data/spec/dummy/node_modules/bootstrap/CHANGELOG.md +5 -0
  36. data/spec/dummy/node_modules/bootstrap/Gruntfile.js +533 -0
  37. data/spec/dummy/node_modules/bootstrap/LICENSE +21 -0
  38. data/spec/dummy/node_modules/bootstrap/README.md +139 -0
  39. data/spec/dummy/node_modules/bootstrap/dist/css/bootstrap-theme.css +587 -0
  40. data/spec/dummy/node_modules/bootstrap/dist/css/bootstrap-theme.css.map +1 -0
  41. data/spec/dummy/node_modules/bootstrap/dist/css/bootstrap-theme.min.css +6 -0
  42. data/spec/dummy/node_modules/bootstrap/dist/css/bootstrap-theme.min.css.map +1 -0
  43. data/spec/dummy/node_modules/bootstrap/dist/css/bootstrap.css +6760 -0
  44. data/spec/dummy/node_modules/bootstrap/dist/css/bootstrap.css.map +1 -0
  45. data/spec/dummy/node_modules/bootstrap/dist/css/bootstrap.min.css +6 -0
  46. data/spec/dummy/node_modules/bootstrap/dist/css/bootstrap.min.css.map +1 -0
  47. data/spec/dummy/node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.eot +0 -0
  48. data/spec/dummy/node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.svg +288 -0
  49. data/spec/dummy/node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf +0 -0
  50. data/spec/dummy/node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.woff +0 -0
  51. data/spec/dummy/node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2 +0 -0
  52. data/spec/dummy/node_modules/bootstrap/dist/js/bootstrap.js +2363 -0
  53. data/spec/dummy/node_modules/bootstrap/dist/js/bootstrap.min.js +7 -0
  54. data/spec/dummy/node_modules/bootstrap/dist/js/npm.js +13 -0
  55. data/spec/dummy/node_modules/bootstrap/fonts/glyphicons-halflings-regular.eot +0 -0
  56. data/spec/dummy/node_modules/bootstrap/fonts/glyphicons-halflings-regular.svg +288 -0
  57. data/spec/dummy/node_modules/bootstrap/fonts/glyphicons-halflings-regular.ttf +0 -0
  58. data/spec/dummy/node_modules/bootstrap/fonts/glyphicons-halflings-regular.woff +0 -0
  59. data/spec/dummy/node_modules/bootstrap/fonts/glyphicons-halflings-regular.woff2 +0 -0
  60. data/spec/dummy/node_modules/bootstrap/grunt/bs-commonjs-generator.js +30 -0
  61. data/spec/dummy/node_modules/bootstrap/grunt/bs-glyphicons-data-generator.js +42 -0
  62. data/spec/dummy/node_modules/bootstrap/grunt/bs-lessdoc-parser.js +237 -0
  63. data/spec/dummy/node_modules/bootstrap/grunt/bs-raw-files-generator.js +44 -0
  64. data/spec/dummy/node_modules/bootstrap/grunt/configBridge.json +46 -0
  65. data/spec/dummy/node_modules/bootstrap/grunt/sauce_browsers.yml +82 -0
  66. data/spec/dummy/node_modules/bootstrap/js/affix.js +162 -0
  67. data/spec/dummy/node_modules/bootstrap/js/alert.js +94 -0
  68. data/spec/dummy/node_modules/bootstrap/js/button.js +120 -0
  69. data/spec/dummy/node_modules/bootstrap/js/carousel.js +237 -0
  70. data/spec/dummy/node_modules/bootstrap/js/collapse.js +211 -0
  71. data/spec/dummy/node_modules/bootstrap/js/dropdown.js +165 -0
  72. data/spec/dummy/node_modules/bootstrap/js/modal.js +337 -0
  73. data/spec/dummy/node_modules/bootstrap/js/popover.js +108 -0
  74. data/spec/dummy/node_modules/bootstrap/js/scrollspy.js +172 -0
  75. data/spec/dummy/node_modules/bootstrap/js/tab.js +155 -0
  76. data/spec/dummy/node_modules/bootstrap/js/tooltip.js +514 -0
  77. data/spec/dummy/node_modules/bootstrap/js/transition.js +59 -0
  78. data/spec/dummy/node_modules/bootstrap/less/alerts.less +73 -0
  79. data/spec/dummy/node_modules/bootstrap/less/badges.less +66 -0
  80. data/spec/dummy/node_modules/bootstrap/less/bootstrap.less +56 -0
  81. data/spec/dummy/node_modules/bootstrap/less/breadcrumbs.less +26 -0
  82. data/spec/dummy/node_modules/bootstrap/less/button-groups.less +244 -0
  83. data/spec/dummy/node_modules/bootstrap/less/buttons.less +166 -0
  84. data/spec/dummy/node_modules/bootstrap/less/carousel.less +270 -0
  85. data/spec/dummy/node_modules/bootstrap/less/close.less +34 -0
  86. data/spec/dummy/node_modules/bootstrap/less/code.less +69 -0
  87. data/spec/dummy/node_modules/bootstrap/less/component-animations.less +33 -0
  88. data/spec/dummy/node_modules/bootstrap/less/dropdowns.less +216 -0
  89. data/spec/dummy/node_modules/bootstrap/less/forms.less +613 -0
  90. data/spec/dummy/node_modules/bootstrap/less/glyphicons.less +305 -0
  91. data/spec/dummy/node_modules/bootstrap/less/grid.less +84 -0
  92. data/spec/dummy/node_modules/bootstrap/less/input-groups.less +171 -0
  93. data/spec/dummy/node_modules/bootstrap/less/jumbotron.less +54 -0
  94. data/spec/dummy/node_modules/bootstrap/less/labels.less +64 -0
  95. data/spec/dummy/node_modules/bootstrap/less/list-group.less +130 -0
  96. data/spec/dummy/node_modules/bootstrap/less/media.less +66 -0
  97. data/spec/dummy/node_modules/bootstrap/less/mixins/alerts.less +14 -0
  98. data/spec/dummy/node_modules/bootstrap/less/mixins/background-variant.less +9 -0
  99. data/spec/dummy/node_modules/bootstrap/less/mixins/border-radius.less +18 -0
  100. data/spec/dummy/node_modules/bootstrap/less/mixins/buttons.less +65 -0
  101. data/spec/dummy/node_modules/bootstrap/less/mixins/center-block.less +7 -0
  102. data/spec/dummy/node_modules/bootstrap/less/mixins/clearfix.less +22 -0
  103. data/spec/dummy/node_modules/bootstrap/less/mixins/forms.less +85 -0
  104. data/spec/dummy/node_modules/bootstrap/less/mixins/gradients.less +59 -0
  105. data/spec/dummy/node_modules/bootstrap/less/mixins/grid-framework.less +91 -0
  106. data/spec/dummy/node_modules/bootstrap/less/mixins/grid.less +122 -0
  107. data/spec/dummy/node_modules/bootstrap/less/mixins/hide-text.less +21 -0
  108. data/spec/dummy/node_modules/bootstrap/less/mixins/image.less +33 -0
  109. data/spec/dummy/node_modules/bootstrap/less/mixins/labels.less +12 -0
  110. data/spec/dummy/node_modules/bootstrap/less/mixins/list-group.less +30 -0
  111. data/spec/dummy/node_modules/bootstrap/less/mixins/nav-divider.less +10 -0
  112. data/spec/dummy/node_modules/bootstrap/less/mixins/nav-vertical-align.less +9 -0
  113. data/spec/dummy/node_modules/bootstrap/less/mixins/opacity.less +8 -0
  114. data/spec/dummy/node_modules/bootstrap/less/mixins/pagination.less +24 -0
  115. data/spec/dummy/node_modules/bootstrap/less/mixins/panels.less +24 -0
  116. data/spec/dummy/node_modules/bootstrap/less/mixins/progress-bar.less +10 -0
  117. data/spec/dummy/node_modules/bootstrap/less/mixins/reset-filter.less +8 -0
  118. data/spec/dummy/node_modules/bootstrap/less/mixins/reset-text.less +18 -0
  119. data/spec/dummy/node_modules/bootstrap/less/mixins/resize.less +6 -0
  120. data/spec/dummy/node_modules/bootstrap/less/mixins/responsive-visibility.less +15 -0
  121. data/spec/dummy/node_modules/bootstrap/less/mixins/size.less +10 -0
  122. data/spec/dummy/node_modules/bootstrap/less/mixins/tab-focus.less +9 -0
  123. data/spec/dummy/node_modules/bootstrap/less/mixins/table-row.less +28 -0
  124. data/spec/dummy/node_modules/bootstrap/less/mixins/text-emphasis.less +9 -0
  125. data/spec/dummy/node_modules/bootstrap/less/mixins/text-overflow.less +8 -0
  126. data/spec/dummy/node_modules/bootstrap/less/mixins/vendor-prefixes.less +227 -0
  127. data/spec/dummy/node_modules/bootstrap/less/mixins.less +40 -0
  128. data/spec/dummy/node_modules/bootstrap/less/modals.less +150 -0
  129. data/spec/dummy/node_modules/bootstrap/less/navbar.less +660 -0
  130. data/spec/dummy/node_modules/bootstrap/less/navs.less +242 -0
  131. data/spec/dummy/node_modules/bootstrap/less/normalize.less +424 -0
  132. data/spec/dummy/node_modules/bootstrap/less/pager.less +54 -0
  133. data/spec/dummy/node_modules/bootstrap/less/pagination.less +89 -0
  134. data/spec/dummy/node_modules/bootstrap/less/panels.less +271 -0
  135. data/spec/dummy/node_modules/bootstrap/less/popovers.less +131 -0
  136. data/spec/dummy/node_modules/bootstrap/less/print.less +101 -0
  137. data/spec/dummy/node_modules/bootstrap/less/progress-bars.less +87 -0
  138. data/spec/dummy/node_modules/bootstrap/less/responsive-embed.less +35 -0
  139. data/spec/dummy/node_modules/bootstrap/less/responsive-utilities.less +194 -0
  140. data/spec/dummy/node_modules/bootstrap/less/scaffolding.less +161 -0
  141. data/spec/dummy/node_modules/bootstrap/less/tables.less +234 -0
  142. data/spec/dummy/node_modules/bootstrap/less/theme.less +291 -0
  143. data/spec/dummy/node_modules/bootstrap/less/thumbnails.less +36 -0
  144. data/spec/dummy/node_modules/bootstrap/less/tooltip.less +101 -0
  145. data/spec/dummy/node_modules/bootstrap/less/type.less +302 -0
  146. data/spec/dummy/node_modules/bootstrap/less/utilities.less +55 -0
  147. data/spec/dummy/node_modules/bootstrap/less/variables.less +869 -0
  148. data/spec/dummy/node_modules/bootstrap/less/wells.less +29 -0
  149. data/spec/dummy/node_modules/bootstrap/package.json +138 -0
  150. data/spec/dummy/vendor/assets/javascripts/bootstrap.js +2363 -0
  151. data/spec/dummy/vendor/assets/stylesheets/bootstrap-theme.css +587 -0
  152. data/spec/dummy/vendor/assets/stylesheets/bootstrap.css +6760 -0
  153. data/spec/file_copier_spec.rb +45 -0
  154. data/spec/gem_version_updater_spec.rb +45 -0
  155. data/spec/npm2gem_spec.rb +7 -0
  156. data/spec/npm_install_spec.rb +22 -0
  157. data/spec/spec_helper.rb +26 -0
  158. metadata +403 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ea5ddf081f5d65a4ccd584b25a8cfe11eb32e1eb
4
+ data.tar.gz: 059720c125fc8d381a7256b4284cdfac41e698db
5
+ SHA512:
6
+ metadata.gz: 9d333d7280e0ac37901758b819c078d2fa9f3bc8e1f673b5ab09af483aa57f76a420b382d1f2691114cecc438674dcaa882ff7b2fa597a4541eee5b42f57f307
7
+ data.tar.gz: b826f1e25116f4644cf50fb18bb7a8f1c2d271e5284866c5a9bee58b771575d47c4ae5bed9dba03dff1987483c99348f6cd32f33fbf2c84fca88c91da65f939b
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /node_modules/
11
+ /spec/dummy/node_modules/
12
+ *.js
13
+ *.css
14
+ /vendor/
15
+ /*.gem
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,241 @@
1
+ AllCops:
2
+ Exclude:
3
+ - "vendor/**/*"
4
+ - "db/schema.rb"
5
+ UseCache: false
6
+ Style/CollectionMethods:
7
+ Description: Preferred collection methods.
8
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size
9
+ Enabled: true
10
+ PreferredMethods:
11
+ collect: map
12
+ collect!: map!
13
+ find: detect
14
+ find_all: select
15
+ reduce: inject
16
+ Style/DotPosition:
17
+ Description: Checks the position of the dot in multi-line method calls.
18
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
19
+ Enabled: true
20
+ EnforcedStyle: trailing
21
+ SupportedStyles:
22
+ - leading
23
+ - trailing
24
+ Style/FileName:
25
+ Description: Use snake_case for source file names.
26
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
27
+ Enabled: false
28
+ Exclude: []
29
+ Style/GuardClause:
30
+ Description: Check for conditionals that can be replaced with guard clauses
31
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
32
+ Enabled: false
33
+ MinBodyLength: 1
34
+ Style/IfUnlessModifier:
35
+ Description: Favor modifier if/unless usage when you have a single-line body.
36
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier
37
+ Enabled: false
38
+ MaxLineLength: 80
39
+ Style/OptionHash:
40
+ Description: Don't use option hashes when you can use keyword arguments.
41
+ Enabled: false
42
+ Style/PercentLiteralDelimiters:
43
+ Description: Use `%`-literal delimiters consistently
44
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-literal-braces
45
+ Enabled: false
46
+ PreferredDelimiters:
47
+ "%": "()"
48
+ "%i": "()"
49
+ "%q": "()"
50
+ "%Q": "()"
51
+ "%r": "{}"
52
+ "%s": "()"
53
+ "%w": "()"
54
+ "%W": "()"
55
+ "%x": "()"
56
+ Style/PredicateName:
57
+ Description: Check the names of predicate methods.
58
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
59
+ Enabled: true
60
+ NamePrefix:
61
+ - is_
62
+ - has_
63
+ - have_
64
+ NamePrefixBlacklist:
65
+ - is_
66
+ Exclude:
67
+ - spec/**/*
68
+ Style/RaiseArgs:
69
+ Description: Checks the arguments passed to raise/fail.
70
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#exception-class-messages
71
+ Enabled: false
72
+ EnforcedStyle: exploded
73
+ SupportedStyles:
74
+ - compact
75
+ - exploded
76
+ Style/SignalException:
77
+ Description: Checks for proper usage of fail and raise.
78
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#fail-method
79
+ Enabled: false
80
+ EnforcedStyle: semantic
81
+ SupportedStyles:
82
+ - only_raise
83
+ - only_fail
84
+ - semantic
85
+ Style/SingleLineBlockParams:
86
+ Description: Enforces the names of some block params.
87
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#reduce-blocks
88
+ Enabled: false
89
+ Methods:
90
+ - reduce:
91
+ - a
92
+ - e
93
+ - inject:
94
+ - a
95
+ - e
96
+ Style/SingleLineMethods:
97
+ Description: Avoid single-line methods.
98
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-single-line-methods
99
+ Enabled: false
100
+ AllowIfMethodIsEmpty: true
101
+ Style/StringLiterals:
102
+ Description: Checks if uses of quotes match the configured preference.
103
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-string-literals
104
+ Enabled: true
105
+ EnforcedStyle: double_quotes
106
+ SupportedStyles:
107
+ - single_quotes
108
+ - double_quotes
109
+ Style/StringLiteralsInInterpolation:
110
+ Description: Checks if uses of quotes inside expressions in interpolated strings
111
+ match the configured preference.
112
+ Enabled: true
113
+ EnforcedStyle: single_quotes
114
+ SupportedStyles:
115
+ - single_quotes
116
+ - double_quotes
117
+ Style/TrailingCommaInArguments:
118
+ Description: Checks for trailing comma in parameter lists and literals.
119
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas
120
+ Enabled: false
121
+ EnforcedStyleForMultiline: no_comma
122
+ SupportedStyles:
123
+ - comma
124
+ - no_comma
125
+ Style/TrailingCommaInLiteral:
126
+ Description: Checks for trailing comma in parameter lists and literals.
127
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas
128
+ Enabled: false
129
+ EnforcedStyleForMultiline: no_comma
130
+ SupportedStyles:
131
+ - comma
132
+ - no_comma
133
+ Metrics/AbcSize:
134
+ Description: A calculated magnitude based on number of assignments, branches, and
135
+ conditions.
136
+ Enabled: false
137
+ Max: 15
138
+ Metrics/ClassLength:
139
+ Description: Avoid classes longer than 100 lines of code.
140
+ Enabled: false
141
+ CountComments: false
142
+ Max: 100
143
+ Metrics/ModuleLength:
144
+ CountComments: false
145
+ Max: 100
146
+ Description: Avoid modules longer than 100 lines of code.
147
+ Enabled: false
148
+ Metrics/CyclomaticComplexity:
149
+ Description: A complexity metric that is strongly correlated to the number of test
150
+ cases needed to validate a method.
151
+ Enabled: false
152
+ Max: 6
153
+ Metrics/MethodLength:
154
+ Description: Avoid methods longer than 10 lines of code.
155
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
156
+ Enabled: false
157
+ CountComments: false
158
+ Max: 10
159
+ Metrics/ParameterLists:
160
+ Description: Avoid parameter lists longer than three or four parameters.
161
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#too-many-params
162
+ Enabled: false
163
+ Max: 5
164
+ CountKeywordArgs: true
165
+ Metrics/PerceivedComplexity:
166
+ Description: A complexity metric geared towards measuring complexity for a human
167
+ reader.
168
+ Enabled: false
169
+ Max: 7
170
+ Lint/AssignmentInCondition:
171
+ Description: Don't use assignment in conditions.
172
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition
173
+ Enabled: false
174
+ AllowSafeAssignment: true
175
+ Style/InlineComment:
176
+ Description: Avoid inline comments.
177
+ Enabled: false
178
+ Style/AccessorMethodName:
179
+ Description: Check the naming of accessor methods for get_/set_.
180
+ Enabled: false
181
+ Style/Alias:
182
+ Description: Use alias_method instead of alias.
183
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#alias-method
184
+ Enabled: false
185
+ Style/Documentation:
186
+ Description: Document classes and non-namespace modules.
187
+ Enabled: false
188
+ Style/DoubleNegation:
189
+ Description: Checks for uses of double negation (!!).
190
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-bang-bang
191
+ Enabled: false
192
+ Style/EachWithObject:
193
+ Description: Prefer `each_with_object` over `inject` or `reduce`.
194
+ Enabled: false
195
+ Style/EmptyLiteral:
196
+ Description: Prefer literals to Array.new/Hash.new/String.new.
197
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#literal-array-hash
198
+ Enabled: false
199
+ Style/ModuleFunction:
200
+ Description: Checks for usage of `extend self` in modules.
201
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#module-function
202
+ Enabled: false
203
+ Style/OneLineConditional:
204
+ Description: Favor the ternary operator(?:) over if/then/else/end constructs.
205
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator
206
+ Enabled: false
207
+ Style/PerlBackrefs:
208
+ Description: Avoid Perl-style regex back references.
209
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers
210
+ Enabled: false
211
+ Style/Send:
212
+ Description: Prefer `Object#__send__` or `Object#public_send` to `send`, as `send`
213
+ may overlap with existing methods.
214
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#prefer-public-send
215
+ Enabled: false
216
+ Style/SpecialGlobalVars:
217
+ Description: Avoid Perl-style global variables.
218
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms
219
+ Enabled: false
220
+ Style/VariableInterpolation:
221
+ Description: Don't interpolate global, instance and class variables directly in
222
+ strings.
223
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#curlies-interpolate
224
+ Enabled: false
225
+ Style/WhenThen:
226
+ Description: Use when x then ... for one-line cases.
227
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#one-line-cases
228
+ Enabled: false
229
+ Lint/EachWithObjectArgument:
230
+ Description: Check for immutable argument given to each_with_object.
231
+ Enabled: true
232
+ Lint/HandleExceptions:
233
+ Description: Don't suppress exception.
234
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions
235
+ Enabled: false
236
+ Lint/LiteralInCondition:
237
+ Description: Checks of literals used in conditions.
238
+ Enabled: false
239
+ Lint/LiteralInInterpolation:
240
+ Description: Checks for literals used in interpolation.
241
+ Enabled: false
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.2
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.2
4
+ before_install: gem install bundler -v 1.10.6
@@ -0,0 +1,111 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment,
6
+ we as
7
+ contributors and maintainers pledge to making participation in our project and
8
+ our community a harassment-free experience for everyone,
9
+ regardless of age,
10
+ body
11
+ size,
12
+ disability,
13
+ ethnicity,
14
+ gender identity and expression,
15
+ level of experience,
16
+ nationality,
17
+ personal appearance,
18
+ race,
19
+ religion,
20
+ or sexual identity and
21
+ orientation.
22
+
23
+ ## Our Standards
24
+
25
+ Examples of behavior that contributes to creating a positive environment include:
26
+
27
+ * Using welcoming and inclusive language
28
+ * Being respectful of differing viewpoints and experiences
29
+ * Gracefully accepting constructive criticism
30
+ * Focusing on what is best for the community
31
+ * Showing empathy towards other community members
32
+
33
+ Examples of unacceptable behavior by participants include:
34
+
35
+ * The use of sexualized language or imagery and unwelcome sexual attention or advances
36
+ * Trolling,
37
+ insulting/derogatory comments,
38
+ and personal or political attacks
39
+ * Public or private harassment
40
+ * Publishing others' private information,
41
+ such as a physical or electronic address,
42
+ without explicit permission
43
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
44
+
45
+ ## Our Responsibilities
46
+
47
+ Project maintainers are responsible for clarifying
48
+ the standards of acceptable behavior
49
+ and are expected to take appropriate and fair corrective action
50
+ in response to any instances of unacceptable behavior.
51
+
52
+ Project maintainers have the right and responsibility to remove,
53
+ edit,
54
+ or
55
+ reject comments,
56
+ commits,
57
+ code,
58
+ wiki edits,
59
+ issues,
60
+ and other contributions
61
+ that are not aligned to this Code of Conduct,
62
+ or to ban temporarily or
63
+ permanently any contributor for other behaviors that they deem inappropriate,
64
+ threatening,
65
+ offensive,
66
+ or harmful.
67
+
68
+ ## Scope
69
+
70
+ This Code of Conduct applies both
71
+ within project spaces and in public spaces
72
+ when an individual is representing the project or its community.
73
+ Examples of
74
+ representing a project or community include using an official project e-mail
75
+ address,
76
+ posting via an official social media account,
77
+ or acting as an appointed representative at an online or offline event.
78
+ Representation of a project may be
79
+ further defined and clarified by project maintainers.
80
+
81
+ ## Enforcement
82
+
83
+ Instances of abusive,
84
+ harassing,
85
+ or otherwise unacceptable behavior may be
86
+ reported by contacting @seancllns on Twitter.
87
+ All
88
+ complaints will be reviewed and investigated
89
+ and will result in a response that is deemed necessary
90
+ and appropriate to the circumstances.
91
+ The project team is
92
+ obligated to maintain confidentiality with regard to the reporter of an incident.
93
+ Further details of specific enforcement policies may be posted separately.
94
+
95
+ Project maintainers who do not follow
96
+ or enforce the Code of Conduct in good faith
97
+ may face temporary or permanent repercussions
98
+ as determined by other members of the project's leadership.
99
+
100
+ ## Attribution
101
+
102
+ This Code of Conduct is adapted from the
103
+ [Contributor Covenant][homepage],
104
+ version 1.4,
105
+ available at
106
+ [http://contributor-covenant.org/version/1/4][version]
107
+
108
+ [homepage]:
109
+ http://contributor-covenant.org
110
+ [version]:
111
+ http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in npm2gem.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Sean Collins
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,102 @@
1
+ # npm2gem
2
+
3
+ npm2gem is a tool to help you build
4
+ ['gemified assets'](http://www.prioritized.net/blog/gemify-assets-for-rails/)
5
+ for Rails,
6
+ by automatically pulling assets from NPM.
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ group :development do
14
+ gem 'npm2gem'
15
+ end
16
+ ```
17
+
18
+ Then run:
19
+
20
+ $ bundle
21
+
22
+ ## Usage
23
+
24
+ `npm2gem` works via an config file, `.npm2gem.yml`.
25
+
26
+ Once that file is set up,
27
+ you just run `npm2gem`
28
+ and it'll automatically download the correct package from `npm`,
29
+ and copy the files you want into your application.
30
+
31
+ It assumes that all files will go into `vendor/assets`,
32
+ with javascript files going into `vendor/assets/javascripts`
33
+ and stylesheet files going into `vendor/assets/stylesheets`.
34
+
35
+
36
+ ### `.npm2gem.yml`
37
+
38
+ Here is the specification for the `.npm2gem.yml` file:
39
+
40
+ ```
41
+ bootstrap:
42
+ - dist/css/boostrap.css
43
+ - dist/css/bootstrap-theme.css
44
+ - dist/js/bootstrap.js
45
+
46
+ ```yaml
47
+
48
+
49
+ #### Subdirectories
50
+
51
+ You can also tell `npm2gem` which subfolder
52
+ you'd like the assets to be placed in.
53
+
54
+ Note: all `.css` files go into `vendor/assets/stylesheets`
55
+ and all `.js` files go into `vendor/assets/javascripts`,
56
+ this is currently a default that you cannot override.
57
+
58
+ What you can do though,
59
+ is have subdirectories.
60
+
61
+ Let's say you wanted to put the `bootstrap-theme.css` file into
62
+ `vendor/assets/stylesheets/themes` instead.
63
+
64
+ Here's the `.npm2gem.yml` you'd use:
65
+
66
+ ```
67
+ bootstrap:
68
+ - dist/css/boostrap.css
69
+ - dist/js/bootstrap.js
70
+ - themes:
71
+ - dist/css/bootstrap-theme.css
72
+
73
+ ```yaml
74
+
75
+ ## TODO:
76
+
77
+ - [ ] Support SCSS, Coffee, etc.
78
+ - [ ] Add support for fonts?
79
+ - [ ] Add tests to ensure you can group JS and CSS files together in `.npm2gem.yml`
80
+
81
+ ## Future work
82
+ Eventually, I'd like there to be a service that uses this gem to
83
+ intermittenly poll `npm` to check for new packages.
84
+
85
+ Once it finds one,
86
+ it'll open a PR with the project
87
+ to see if they want to update their gem.
88
+
89
+ ## Development
90
+
91
+ Bug reports, support requests and pull requests are welcome on GitHub at
92
+ https://github.com/cllns/npm2gem.
93
+ This project is intended to be a safe,
94
+ welcoming space for collaboration,
95
+ and contributors are expected to adhere to the
96
+ [Contributor Covenant](contributor-covenant.org)
97
+ code of conduct.
98
+
99
+ ## License
100
+
101
+ The gem is available as open source under the terms of the
102
+ [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "npm2gem"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
data/exe/npm2gem ADDED
@@ -0,0 +1,8 @@
1
+ #! /usr/bin/env ruby
2
+ require "npm2gem"
3
+
4
+ if ARGV.length == 0
5
+ NPM2Gem::CLI.new.run
6
+ else
7
+ abort "USAGE:\t npm2gem "
8
+ end
@@ -0,0 +1,56 @@
1
+ require "npm2gem/config"
2
+ require "npm2gem/npm_install"
3
+ require "npm2gem/file_copier"
4
+ require "npm2gem/exception"
5
+ require "npm2gem/gem_version_updater"
6
+ require "highline/import"
7
+
8
+ module NPM2Gem
9
+ class CLI
10
+ attr_reader :config
11
+
12
+ def initialize
13
+ @config = Config.new
14
+ @npm_install = NPMInstall.new(@config.package_name)
15
+ @file_copier = FileCopier.new(@npm_install.path, "vendor/assets")
16
+ end
17
+
18
+ def run
19
+ if new_version?
20
+ puts "Current (gem)\t Version: #{gem_version}"
21
+ puts "New (npm)\t Version: #{npm_version}"
22
+ if want_to_upgrade?
23
+ @file_copier.copy(@config.files_to_copy)
24
+ version = GemVersionUpdater.new.run(npm_version)
25
+ puts "Done! :) Upgraded to #{version}"
26
+ else
27
+ puts "Okay, no problem!"
28
+ end
29
+ else
30
+ puts "There's no new version of #{@config.package_name} "\
31
+ "on npm. The current version is #{npm_version}"
32
+ end
33
+
34
+ # FileUtils.rm_rf("node_modules")
35
+ end
36
+
37
+ private
38
+
39
+ def want_to_upgrade?
40
+ agree("Do you want to upgrade? [y/n]", true)
41
+ end
42
+
43
+ def new_version?
44
+ Gem::Version.new(npm_version) > Gem::Version.new(gem_version)
45
+ end
46
+
47
+ def gem_version
48
+ gemspec_file_name = Dir["*.gemspec"].first
49
+ Gem::Specification.load(gemspec_file_name).version.to_s
50
+ end
51
+
52
+ def npm_version
53
+ @npm_install.package_version
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,21 @@
1
+ require "yaml"
2
+
3
+ module NPM2Gem
4
+ class Config
5
+ def initialize
6
+ @yaml_file = YAML.load_file(".npm2gem.yml")
7
+ end
8
+
9
+ # TODO: support more than one?
10
+ def package_name
11
+ @yaml_file.keys.first
12
+ end
13
+
14
+ # This is an array, of either:
15
+ # - file names, or
16
+ # - a hash: { destination_subfolder: files }
17
+ def files_to_copy
18
+ @yaml_file[package_name]
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,4 @@
1
+ module NPM2Gem
2
+ class Exception < StandardError
3
+ end
4
+ end